[SPIP] +2.1.12
[velocampus/web/www.git] / www / plugins / auto / cfg / controleurs / config.php
1 <?php
2
3 /**
4 * Plugin générique de configuration pour SPIP
5 *
6 * @license GNU/GPL
7 * @package plugins
8 * @subpackage cfg
9 * @category outils
10 * @copyright (c) toggg, marcimat 2007-2008
11 * @link http://www.spip-contrib.net/
12 * @version $Id: config.php 53409 2011-10-13 20:42:57Z yffic@lefourneau.com $
13 */
14 if (!defined("_ECRIRE_INC_VERSION")) return;
15
16 /**
17 * Le controlleur de CFG
18 *
19 * @param Array $regs
20 * @return Array
21 */
22 function controleurs_config_dist($regs) {
23 list(,$crayon,$type,$champ,$id) = $regs;
24 // evidemment, pour CFG, on recupere pas tout a fait ce qu'on souhaite...
25 // retraduire depot___plugin__casier__cle en depot::plugin/casier/cle
26 include_spip('cfg_fonctions');
27 $config = cfg_crayon2config($champ);
28 $val = lire_config($config);
29 if ($val === null) {
30 return array("$type $config: " . _U('crayons:pas_de_valeur'), 6);
31 }
32
33 $valeur = array('config' => $val);
34 $n = new Crayon($crayon, $valeur);
35
36 $contexte = array();
37 if (is_string($val) and preg_match(",[\n\r],", $val))
38 $contexte['config'] = array('type'=>'texte');
39 else
40 $contexte['config'] = array('type'=>'ligne');
41
42 $html = $n->formulaire($contexte);
43 include_spip('action/crayon_html');
44 $html = crayons_formulaire($html, 'crayons_config_store');
45 $status = NULL;
46
47 return array($html, $status);
48
49 }
50
51
52 ?>