1 | <?php |
---|
2 | |
---|
3 | /***************************************************************************\ |
---|
4 | * SPIP, Systeme de publication pour l'internet * |
---|
5 | * * |
---|
6 | * Copyright (c) 2001-2015 * |
---|
7 | * Arnaud Martin, Antoine Pitrou, Philippe Riviere, Emmanuel Saint-James * |
---|
8 | * * |
---|
9 | * Ce programme est un logiciel libre distribue sous licence GNU/GPL. * |
---|
10 | * Pour plus de details voir le fichier COPYING.txt ou l'aide en ligne. * |
---|
11 | \***************************************************************************/ |
---|
12 | |
---|
13 | if (!defined("_ECRIRE_INC_VERSION")) return; |
---|
14 | |
---|
15 | function formulaires_configurer_urls_charger_dist(){ |
---|
16 | if (isset($GLOBALS['type_urls'])) // priorité au fichier d'options |
---|
17 | return "<p>"._T('urls:erreur_config_url_forcee')."</p>"; |
---|
18 | |
---|
19 | $valeurs = array( |
---|
20 | 'type_urls' => $GLOBALS['meta']['type_urls'], |
---|
21 | 'urls_activer_controle' => (isset($GLOBALS['meta']['urls_activer_controle']) ? $GLOBALS['meta']['urls_activer_controle'] : ''), |
---|
22 | '_urls_dispos'=>type_urls_lister(), |
---|
23 | ); |
---|
24 | |
---|
25 | return $valeurs; |
---|
26 | |
---|
27 | } |
---|
28 | |
---|
29 | function formulaires_configurer_urls_traiter_dist(){ |
---|
30 | ecrire_meta('type_urls',_request('type_urls')); |
---|
31 | ecrire_meta('urls_activer_controle',_request('urls_activer_controle')?'oui':'non'); |
---|
32 | |
---|
33 | return array('message_ok'=>_T('config_info_enregistree'),'editable'=>true); |
---|
34 | } |
---|
35 | |
---|
36 | function type_url_choisir($liste, $name, $selected){ |
---|
37 | $res = '<dl class="choix">'; |
---|
38 | foreach($liste as $url){ |
---|
39 | $k = $url[0]; |
---|
40 | $res .= '<dt>' |
---|
41 | .'<input type="radio" name="'.$name.'" id="'.$name.'_'.$k.'" value="'.$k.'"' |
---|
42 | .($selected==$k ? ' checked="checked"':'') |
---|
43 | .'/>' |
---|
44 | .'<label for="'.$name.'_'.$k.'">'.$url[1].'</label></dt>' |
---|
45 | .'<dd><tt>'.$url[2].'</tt></dd>' |
---|
46 | ."\n"; |
---|
47 | } |
---|
48 | $res .= "</dl>"; |
---|
49 | return $res; |
---|
50 | } |
---|
51 | |
---|
52 | function type_urls_lister(){ |
---|
53 | |
---|
54 | $dispo = array(); |
---|
55 | foreach (find_all_in_path('urls/', '\w+\.php$', array()) as $f) { |
---|
56 | $r = basename($f, '.php'); |
---|
57 | if ($r == 'index' OR strncmp('generer_',$r,8)==0 OR $r=="standard") continue; |
---|
58 | include_once $f; |
---|
59 | $exemple = 'URLS_' . strtoupper($r) . '_EXEMPLE'; |
---|
60 | $exemple = defined($exemple) ? constant($exemple) : '?'; |
---|
61 | $dispo[_T("urls:titre_type_$r")] = array($r, _T("urls:titre_type_$r"),$exemple); |
---|
62 | } |
---|
63 | |
---|
64 | ksort($dispo); |
---|
65 | |
---|
66 | return $dispo; |
---|
67 | } |
---|
68 | ?> |
---|