[SPIP] +2.1.12
[velocampus/web/www.git] / www / plugins / auto / cfg / controleurs / config.php
diff --git a/www/plugins/auto/cfg/controleurs/config.php b/www/plugins/auto/cfg/controleurs/config.php
new file mode 100644 (file)
index 0000000..a1ea343
--- /dev/null
@@ -0,0 +1,52 @@
+<?php\r
+\r
+/**\r
+ * Plugin générique de configuration pour SPIP\r
+ *\r
+ * @license    GNU/GPL\r
+ * @package    plugins\r
+ * @subpackage cfg\r
+ * @category   outils\r
+ * @copyright  (c) toggg, marcimat 2007-2008\r
+ * @link       http://www.spip-contrib.net/\r
+ * @version    $Id: config.php 53409 2011-10-13 20:42:57Z yffic@lefourneau.com $\r
+ */\r
+if (!defined("_ECRIRE_INC_VERSION")) return;\r
+\r
+/**\r
+ * Le controlleur de CFG\r
+ *\r
+ * @param Array $regs\r
+ * @return Array\r
+ */\r
+function controleurs_config_dist($regs) {\r
+    list(,$crayon,$type,$champ,$id) = $regs;\r
+       // evidemment, pour CFG, on recupere pas tout a fait ce qu'on souhaite...\r
+       // retraduire depot___plugin__casier__cle en depot::plugin/casier/cle\r
+       include_spip('cfg_fonctions');\r
+       $config = cfg_crayon2config($champ);\r
+       $val = lire_config($config);\r
+    if ($val === null) {\r
+           return array("$type $config: " . _U('crayons:pas_de_valeur'), 6);\r
+    }\r
+    \r
+    $valeur = array('config' => $val);\r
+       $n = new Crayon($crayon, $valeur);\r
+       \r
+       $contexte = array();\r
+    if (is_string($val) and preg_match(",[\n\r],", $val))\r
+               $contexte['config'] = array('type'=>'texte');\r
+       else\r
+               $contexte['config'] = array('type'=>'ligne');\r
+               \r
+    $html = $n->formulaire($contexte);\r
+    include_spip('action/crayon_html');\r
+    $html = crayons_formulaire($html, 'crayons_config_store');\r
+    $status = NULL;\r
+\r
+       return array($html, $status);\r
+\r
+}\r
+\r
+\r
+?>\r