Completed
Push — master ( 1dde8c...5a052b )
by cam
01:06
created
ecrire/plugins/infos_plugin.php 2 patches
Indentation   +152 added lines, -152 removed lines patch added patch discarded remove patch
@@ -17,116 +17,116 @@  discard block
 block discarded – undo
17 17
  **/
18 18
 
19 19
 if (!defined('_ECRIRE_INC_VERSION')) {
20
-	return;
20
+    return;
21 21
 }
22 22
 
23 23
 // lecture d'un texte ecrit en pseudo-xml issu d'un fichier plugin.xml
24 24
 // et conversion approximative en tableau PHP.
25 25
 function plugins_infos_plugin($desc, $plug = '', $dir_plugins = _DIR_PLUGINS) {
26
-	include_spip('inc/xml');
27
-	$arbre = spip_xml_parse($desc);
28
-
29
-	$verifie_conformite = charger_fonction('verifie_conformite', 'plugins');
30
-	$verifie_conformite($plug, $arbre, $dir_plugins);
31
-
32
-	include_spip('inc/charsets');
33
-
34
-	// On renvoie la DTD utilisee
35
-	$ret['dtd'] = "plugin";
36
-
37
-	if (isset($arbre['categorie'])) {
38
-		$ret['categorie'] = trim(spip_xml_aplatit($arbre['categorie']));
39
-	}
40
-	if (isset($arbre['nom'])) {
41
-		$ret['nom'] = charset2unicode(spip_xml_aplatit($arbre['nom']));
42
-	}
43
-	if (isset($arbre['icon'])) {
44
-		$ret['logo'] = trim(spip_xml_aplatit($arbre['icon']));
45
-	}
46
-	if (isset($arbre['auteur'])) {
47
-		$ret['auteur'][] = trim(spip_xml_aplatit($arbre['auteur']));
48
-	} // garder le 1er niveau en tableau mais traiter le multi possible
49
-	if (isset($arbre['licence'])) {
50
-		$ret['licence'][] = trim(spip_xml_aplatit($arbre['licence']));
51
-	}
52
-	if (isset($arbre['version'])) {
53
-		$ret['version'] = trim(spip_xml_aplatit($arbre['version']));
54
-	}
55
-	if (isset($arbre['version_base'])) {
56
-		$ret['schema'] = trim(spip_xml_aplatit($arbre['version_base']));
57
-	}
58
-	if (isset($arbre['etat'])) {
59
-		$ret['etat'] = trim(spip_xml_aplatit($arbre['etat']));
60
-	}
61
-
62
-	$ret['description'] = $ret['slogan'] = "";
63
-	if (isset($arbre['slogan'])) {
64
-		$ret['slogan'] = trim(spip_xml_aplatit($arbre['slogan']));
65
-	}
66
-	if (isset($arbre['description'])) {
67
-		$ret['description'] = trim(spip_xml_aplatit($arbre['description']));
68
-	}
69
-
70
-	if (isset($arbre['lien'])) {
71
-		$ret['documentation'] = trim(join(' ', $arbre['lien']));
72
-		if ($ret['documentation']) {
73
-			// le lien de doc doit etre une url et c'est tout
74
-			if (!tester_url_absolue($ret['documentation'])) {
75
-				$ret['documentation'] = "";
76
-			}
77
-		}
78
-	}
79
-
80
-	if (isset($arbre['options'])) {
81
-		$ret['options'] = $arbre['options'];
82
-	}
83
-	if (isset($arbre['fonctions'])) {
84
-		$ret['fonctions'] = $arbre['fonctions'];
85
-	}
86
-	if (isset($arbre['prefix'][0])) {
87
-		$ret['prefix'] = trim(array_pop($arbre['prefix']));
88
-	}
89
-	if (isset($arbre['install'])) {
90
-		$ret['install'] = $arbre['install'];
91
-	}
92
-	if (isset($arbre['meta'])) {
93
-		$ret['meta'] = trim(spip_xml_aplatit($arbre['meta']));
94
-	}
95
-
96
-	$necessite = info_plugin_normalise_necessite(isset($arbre['necessite']) ? $arbre['necessite'] : '');
97
-	$ret['compatibilite'] = isset($necessite['compatible']) ? $necessite['compatible'] : '';
98
-	$ret['necessite'] = $necessite['necessite'];
99
-	$ret['lib'] = $necessite['lib'];
100
-	$ret['utilise'] = info_plugin_normalise_utilise(isset($arbre['utilise']) ? $arbre['utilise'] : '');
101
-	$ret['procure'] = info_plugin_normalise_procure(isset($arbre['procure']) ? $arbre['procure'] : '');
102
-	$ret['chemin'] = info_plugin_normalise_chemin(isset($arbre['path']) ? $arbre['path'] : '');
103
-
104
-	if (isset($arbre['pipeline'])) {
105
-		$ret['pipeline'] = $arbre['pipeline'];
106
-	}
107
-
108
-	$extraire_boutons = charger_fonction('extraire_boutons', 'plugins');
109
-	$les_boutons = $extraire_boutons($arbre);
110
-	$ret['menu'] = $les_boutons['bouton'];
111
-	$ret['onglet'] = $les_boutons['onglet'];
112
-
113
-	$ret['traduire'] = isset($arbre['traduire']) ? $arbre['traduire'] : '';
114
-
115
-	if (isset($arbre['config'])) {
116
-		$ret['config'] = spip_xml_aplatit($arbre['config']);
117
-	}
118
-	if (isset($arbre['noisette'])) {
119
-		$ret['noisette'] = $arbre['noisette'];
120
-	}
121
-
122
-	if (isset($arbre['erreur'])) {
123
-		$ret['erreur'] = $arbre['erreur'];
124
-		if ($plug) {
125
-			spip_log("infos_plugin $plug " . @join(' ', $arbre['erreur']));
126
-		}
127
-	}
128
-
129
-	return $ret;
26
+    include_spip('inc/xml');
27
+    $arbre = spip_xml_parse($desc);
28
+
29
+    $verifie_conformite = charger_fonction('verifie_conformite', 'plugins');
30
+    $verifie_conformite($plug, $arbre, $dir_plugins);
31
+
32
+    include_spip('inc/charsets');
33
+
34
+    // On renvoie la DTD utilisee
35
+    $ret['dtd'] = "plugin";
36
+
37
+    if (isset($arbre['categorie'])) {
38
+        $ret['categorie'] = trim(spip_xml_aplatit($arbre['categorie']));
39
+    }
40
+    if (isset($arbre['nom'])) {
41
+        $ret['nom'] = charset2unicode(spip_xml_aplatit($arbre['nom']));
42
+    }
43
+    if (isset($arbre['icon'])) {
44
+        $ret['logo'] = trim(spip_xml_aplatit($arbre['icon']));
45
+    }
46
+    if (isset($arbre['auteur'])) {
47
+        $ret['auteur'][] = trim(spip_xml_aplatit($arbre['auteur']));
48
+    } // garder le 1er niveau en tableau mais traiter le multi possible
49
+    if (isset($arbre['licence'])) {
50
+        $ret['licence'][] = trim(spip_xml_aplatit($arbre['licence']));
51
+    }
52
+    if (isset($arbre['version'])) {
53
+        $ret['version'] = trim(spip_xml_aplatit($arbre['version']));
54
+    }
55
+    if (isset($arbre['version_base'])) {
56
+        $ret['schema'] = trim(spip_xml_aplatit($arbre['version_base']));
57
+    }
58
+    if (isset($arbre['etat'])) {
59
+        $ret['etat'] = trim(spip_xml_aplatit($arbre['etat']));
60
+    }
61
+
62
+    $ret['description'] = $ret['slogan'] = "";
63
+    if (isset($arbre['slogan'])) {
64
+        $ret['slogan'] = trim(spip_xml_aplatit($arbre['slogan']));
65
+    }
66
+    if (isset($arbre['description'])) {
67
+        $ret['description'] = trim(spip_xml_aplatit($arbre['description']));
68
+    }
69
+
70
+    if (isset($arbre['lien'])) {
71
+        $ret['documentation'] = trim(join(' ', $arbre['lien']));
72
+        if ($ret['documentation']) {
73
+            // le lien de doc doit etre une url et c'est tout
74
+            if (!tester_url_absolue($ret['documentation'])) {
75
+                $ret['documentation'] = "";
76
+            }
77
+        }
78
+    }
79
+
80
+    if (isset($arbre['options'])) {
81
+        $ret['options'] = $arbre['options'];
82
+    }
83
+    if (isset($arbre['fonctions'])) {
84
+        $ret['fonctions'] = $arbre['fonctions'];
85
+    }
86
+    if (isset($arbre['prefix'][0])) {
87
+        $ret['prefix'] = trim(array_pop($arbre['prefix']));
88
+    }
89
+    if (isset($arbre['install'])) {
90
+        $ret['install'] = $arbre['install'];
91
+    }
92
+    if (isset($arbre['meta'])) {
93
+        $ret['meta'] = trim(spip_xml_aplatit($arbre['meta']));
94
+    }
95
+
96
+    $necessite = info_plugin_normalise_necessite(isset($arbre['necessite']) ? $arbre['necessite'] : '');
97
+    $ret['compatibilite'] = isset($necessite['compatible']) ? $necessite['compatible'] : '';
98
+    $ret['necessite'] = $necessite['necessite'];
99
+    $ret['lib'] = $necessite['lib'];
100
+    $ret['utilise'] = info_plugin_normalise_utilise(isset($arbre['utilise']) ? $arbre['utilise'] : '');
101
+    $ret['procure'] = info_plugin_normalise_procure(isset($arbre['procure']) ? $arbre['procure'] : '');
102
+    $ret['chemin'] = info_plugin_normalise_chemin(isset($arbre['path']) ? $arbre['path'] : '');
103
+
104
+    if (isset($arbre['pipeline'])) {
105
+        $ret['pipeline'] = $arbre['pipeline'];
106
+    }
107
+
108
+    $extraire_boutons = charger_fonction('extraire_boutons', 'plugins');
109
+    $les_boutons = $extraire_boutons($arbre);
110
+    $ret['menu'] = $les_boutons['bouton'];
111
+    $ret['onglet'] = $les_boutons['onglet'];
112
+
113
+    $ret['traduire'] = isset($arbre['traduire']) ? $arbre['traduire'] : '';
114
+
115
+    if (isset($arbre['config'])) {
116
+        $ret['config'] = spip_xml_aplatit($arbre['config']);
117
+    }
118
+    if (isset($arbre['noisette'])) {
119
+        $ret['noisette'] = $arbre['noisette'];
120
+    }
121
+
122
+    if (isset($arbre['erreur'])) {
123
+        $ret['erreur'] = $arbre['erreur'];
124
+        if ($plug) {
125
+            spip_log("infos_plugin $plug " . @join(' ', $arbre['erreur']));
126
+        }
127
+    }
128
+
129
+    return $ret;
130 130
 }
131 131
 
132 132
 
@@ -153,27 +153,27 @@  discard block
 block discarded – undo
153 153
  *     Liste des necessite modifiés.
154 154
  */
155 155
 function info_plugin_normalise_necessite($necessite) {
156
-	$res = array('necessite' => array(), 'lib' => array());
157
-
158
-	if (is_array($necessite)) {
159
-		foreach ($necessite as $need) {
160
-			$id = $need['id'];
161
-			$v = isset($need['version']) ? $need['version'] : '';
162
-
163
-			// Necessite SPIP version x ?
164
-			if (strtoupper($id) == 'SPIP') {
165
-				$res['compatible'] = $v;
166
-			} else {
167
-				if (preg_match(',^lib:\s*([^\s]*),i', $id, $r)) {
168
-					$res['lib'][] = array('nom' => $r[1], 'id' => $r[1], 'lien' => $need['src']);
169
-				} else {
170
-					$res['necessite'][] = array('id' => $id, 'nom' => $id, 'version' => $v, 'compatibilite' => $v);
171
-				}
172
-			}
173
-		}
174
-	}
175
-
176
-	return $res;
156
+    $res = array('necessite' => array(), 'lib' => array());
157
+
158
+    if (is_array($necessite)) {
159
+        foreach ($necessite as $need) {
160
+            $id = $need['id'];
161
+            $v = isset($need['version']) ? $need['version'] : '';
162
+
163
+            // Necessite SPIP version x ?
164
+            if (strtoupper($id) == 'SPIP') {
165
+                $res['compatible'] = $v;
166
+            } else {
167
+                if (preg_match(',^lib:\s*([^\s]*),i', $id, $r)) {
168
+                    $res['lib'][] = array('nom' => $r[1], 'id' => $r[1], 'lien' => $need['src']);
169
+                } else {
170
+                    $res['necessite'][] = array('id' => $id, 'nom' => $id, 'version' => $v, 'compatibilite' => $v);
171
+                }
172
+            }
173
+        }
174
+    }
175
+
176
+    return $res;
177 177
 }
178 178
 
179 179
 /**
@@ -189,17 +189,17 @@  discard block
 block discarded – undo
189 189
  *    Liste des utilise modifiés.
190 190
  */
191 191
 function info_plugin_normalise_utilise($utilise) {
192
-	$res = array();
192
+    $res = array();
193 193
 
194
-	if (is_array($utilise)) {
195
-		foreach ($utilise as $need) {
196
-			$id = $need['id'];
197
-			$v = isset($need['version']) ? $need['version'] : '';
198
-			$res[] = array('nom' => $id, 'id' => $id, 'version' => $v, 'compatibilite' => $v);
199
-		}
200
-	}
194
+    if (is_array($utilise)) {
195
+        foreach ($utilise as $need) {
196
+            $id = $need['id'];
197
+            $v = isset($need['version']) ? $need['version'] : '';
198
+            $res[] = array('nom' => $id, 'id' => $id, 'version' => $v, 'compatibilite' => $v);
199
+        }
200
+    }
201 201
 
202
-	return $res;
202
+    return $res;
203 203
 }
204 204
 
205 205
 /**
@@ -213,17 +213,17 @@  discard block
 block discarded – undo
213 213
  *    Liste des procure modifiés.
214 214
  */
215 215
 function info_plugin_normalise_procure($procure) {
216
-	$res = array();
216
+    $res = array();
217 217
 
218
-	if (is_array($procure)) {
219
-		foreach ($procure as $need) {
220
-			$id = $need['id'];
221
-			$v = $need['version'];
222
-			$res[] = array('nom' => $id, 'id' => $id, 'version' => $v);
223
-		}
224
-	}
218
+    if (is_array($procure)) {
219
+        foreach ($procure as $need) {
220
+            $id = $need['id'];
221
+            $v = $need['version'];
222
+            $res[] = array('nom' => $id, 'id' => $id, 'version' => $v);
223
+        }
224
+    }
225 225
 
226
-	return $res;
226
+    return $res;
227 227
 }
228 228
 
229 229
 /**
@@ -237,14 +237,14 @@  discard block
 block discarded – undo
237 237
  *    Liste des chemins modifiés.
238 238
  */
239 239
 function info_plugin_normalise_chemin($chemins) {
240
-	$res = array();
240
+    $res = array();
241 241
 
242
-	if (is_array($chemins)) {
243
-		foreach ($chemins as $c) {
244
-			$c['path'] = $c['dir'];
245
-			$res[] = $c;
246
-		}
247
-	}
242
+    if (is_array($chemins)) {
243
+        foreach ($chemins as $c) {
244
+            $c['path'] = $c['dir'];
245
+            $res[] = $c;
246
+        }
247
+    }
248 248
 
249
-	return $res;
249
+    return $res;
250 250
 }
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -122,7 +122,7 @@
 block discarded – undo
122 122
 	if (isset($arbre['erreur'])) {
123 123
 		$ret['erreur'] = $arbre['erreur'];
124 124
 		if ($plug) {
125
-			spip_log("infos_plugin $plug " . @join(' ', $arbre['erreur']));
125
+			spip_log("infos_plugin $plug ".@join(' ', $arbre['erreur']));
126 126
 		}
127 127
 	}
128 128
 
Please login to merge, or discard this patch.
ecrire/plugins/extraire_pipelines.php 1 patch
Indentation   +22 added lines, -22 removed lines patch added patch discarded remove patch
@@ -11,7 +11,7 @@  discard block
 block discarded – undo
11 11
 \***************************************************************************/
12 12
 
13 13
 if (!defined('_ECRIRE_INC_VERSION')) {
14
-	return;
14
+    return;
15 15
 }
16 16
 
17 17
 
@@ -21,26 +21,26 @@  discard block
 block discarded – undo
21 21
  * @param array $arbre
22 22
  */
23 23
 function plugins_extraire_pipelines_dist(&$arbre) {
24
-	$pipeline = array();
25
-	if (spip_xml_match_nodes(',^pipeline,', $arbre, $pipes)) {
26
-		foreach ($pipes as $tag => $p) {
27
-			if (!is_array($p[0])) {
28
-				list($tag, $att) = spip_xml_decompose_tag($tag);
29
-				$pipeline[] = $att;
30
-			} else {
31
-				foreach ($p as $pipe) {
32
-					$att = array();
33
-					if (is_array($pipe)) {
34
-						foreach ($pipe as $k => $t) {
35
-							$att[$k] = trim(end($t));
36
-						}
37
-					}
38
-					$pipeline[] = $att;
39
-				}
40
-			}
41
-		}
42
-		unset($arbre[$tag]);
43
-	}
24
+    $pipeline = array();
25
+    if (spip_xml_match_nodes(',^pipeline,', $arbre, $pipes)) {
26
+        foreach ($pipes as $tag => $p) {
27
+            if (!is_array($p[0])) {
28
+                list($tag, $att) = spip_xml_decompose_tag($tag);
29
+                $pipeline[] = $att;
30
+            } else {
31
+                foreach ($p as $pipe) {
32
+                    $att = array();
33
+                    if (is_array($pipe)) {
34
+                        foreach ($pipe as $k => $t) {
35
+                            $att[$k] = trim(end($t));
36
+                        }
37
+                    }
38
+                    $pipeline[] = $att;
39
+                }
40
+            }
41
+        }
42
+        unset($arbre[$tag]);
43
+    }
44 44
 
45
-	return $pipeline;
45
+    return $pipeline;
46 46
 }
Please login to merge, or discard this patch.
ecrire/plugins/get_infos.php 2 patches
Indentation   +101 added lines, -101 removed lines patch added patch discarded remove patch
@@ -17,7 +17,7 @@  discard block
 block discarded – undo
17 17
  **/
18 18
 
19 19
 if (!defined('_ECRIRE_INC_VERSION')) {
20
-	return;
20
+    return;
21 21
 }
22 22
 
23 23
 /**
@@ -33,110 +33,110 @@  discard block
 block discarded – undo
33 33
  * @return array
34 34
  */
35 35
 function plugins_get_infos_dist($plug = false, $reload = false, $dir = _DIR_PLUGINS, $clean_old = false) {
36
-	static $cache = '';
37
-	static $filecache = '';
38
-
39
-	if ($cache === '') {
40
-		$filecache = _DIR_TMP . "plugin_xml_cache.gz";
41
-		if (is_file($filecache)) {
42
-			lire_fichier($filecache, $contenu);
43
-			$cache = unserialize($contenu);
44
-		}
45
-		if (!is_array($cache)) {
46
-			$cache = array();
47
-		}
48
-	}
49
-
50
-	if (defined('_VAR_MODE') and _VAR_MODE == 'recalcul') {
51
-		$reload = true;
52
-	}
53
-
54
-	if ($plug === false) {
55
-		ecrire_fichier($filecache, serialize($cache));
56
-
57
-		return $cache;
58
-	} elseif (is_string($plug)) {
59
-		$res = plugins_get_infos_un($plug, $reload, $dir, $cache);
60
-	} elseif (is_array($plug)) {
61
-		$res = false;
62
-		if (!$reload) {
63
-			$reload = -1;
64
-		}
65
-		foreach ($plug as $nom) {
66
-			$res |= plugins_get_infos_un($nom, $reload, $dir, $cache);
67
-		}
68
-
69
-		// Nettoyer le cache des vieux plugins qui ne sont plus la
70
-		if ($clean_old and isset($cache[$dir]) and count($cache[$dir])) {
71
-			foreach (array_keys($cache[$dir]) as $p) {
72
-				if (!in_array($p, $plug)) {
73
-					unset($cache[$dir][$p]);
74
-				}
75
-			}
76
-		}
77
-	}
78
-	if ($res) {
79
-		ecrire_fichier($filecache, serialize($cache));
80
-	}
81
-	if (!isset($cache[$dir])) {
82
-		return array();
83
-	}
84
-	if (is_string($plug)) {
85
-		return isset($cache[$dir][$plug]) ? $cache[$dir][$plug] : array();
86
-	} else {
87
-		return $cache[$dir];
88
-	}
36
+    static $cache = '';
37
+    static $filecache = '';
38
+
39
+    if ($cache === '') {
40
+        $filecache = _DIR_TMP . "plugin_xml_cache.gz";
41
+        if (is_file($filecache)) {
42
+            lire_fichier($filecache, $contenu);
43
+            $cache = unserialize($contenu);
44
+        }
45
+        if (!is_array($cache)) {
46
+            $cache = array();
47
+        }
48
+    }
49
+
50
+    if (defined('_VAR_MODE') and _VAR_MODE == 'recalcul') {
51
+        $reload = true;
52
+    }
53
+
54
+    if ($plug === false) {
55
+        ecrire_fichier($filecache, serialize($cache));
56
+
57
+        return $cache;
58
+    } elseif (is_string($plug)) {
59
+        $res = plugins_get_infos_un($plug, $reload, $dir, $cache);
60
+    } elseif (is_array($plug)) {
61
+        $res = false;
62
+        if (!$reload) {
63
+            $reload = -1;
64
+        }
65
+        foreach ($plug as $nom) {
66
+            $res |= plugins_get_infos_un($nom, $reload, $dir, $cache);
67
+        }
68
+
69
+        // Nettoyer le cache des vieux plugins qui ne sont plus la
70
+        if ($clean_old and isset($cache[$dir]) and count($cache[$dir])) {
71
+            foreach (array_keys($cache[$dir]) as $p) {
72
+                if (!in_array($p, $plug)) {
73
+                    unset($cache[$dir][$p]);
74
+                }
75
+            }
76
+        }
77
+    }
78
+    if ($res) {
79
+        ecrire_fichier($filecache, serialize($cache));
80
+    }
81
+    if (!isset($cache[$dir])) {
82
+        return array();
83
+    }
84
+    if (is_string($plug)) {
85
+        return isset($cache[$dir][$plug]) ? $cache[$dir][$plug] : array();
86
+    } else {
87
+        return $cache[$dir];
88
+    }
89 89
 }
90 90
 
91 91
 
92 92
 function plugins_get_infos_un($plug, $reload, $dir, &$cache) {
93
-	if (!is_readable($file = "$dir$plug/" . ($desc = "paquet") . ".xml")) {
94
-		if (!is_readable($file = "$dir$plug/" . ($desc = "plugin") . ".xml")) {
95
-			return false;
96
-		}
97
-	}
98
-
99
-	if (($time = intval(@filemtime($file))) < 0) {
100
-		return false;
101
-	}
102
-	$md5 = md5_file($file);
103
-
104
-	$pcache = isset($cache[$dir][$plug])
105
-		? $cache[$dir][$plug] : array('filemtime' => 0, 'md5_file' => '');
106
-
107
-	// si le cache est valide
108
-	if ((intval($reload) <= 0)
109
-		and ($time > 0)
110
-		and ($time <= $pcache['filemtime'])
111
-		and $md5 == $pcache['md5_file']
112
-	) {
113
-		return false;
114
-	}
115
-
116
-	// si on arrive pas a lire le fichier, se contenter du cache
117
-	if (!($texte = spip_file_get_contents($file))) {
118
-		return false;
119
-	}
120
-
121
-	$f = charger_fonction('infos_' . $desc, 'plugins');
122
-	$ret = $f($texte, $plug, $dir);
123
-	$ret['filemtime'] = $time;
124
-	$ret['md5_file'] = $md5;
125
-	// Si on lit le paquet.xml de SPIP, on rajoute un procure php afin que les plugins puissent
126
-	// utiliser un necessite php. SPIP procure donc la version php courante du serveur.
127
-	// chaque librairie php est aussi procurée, par exemple 'php:curl'.
128
-	if (isset($ret['prefix']) and $ret['prefix'] == 'spip') {
129
-		$ret['procure']['php'] = array('nom' => 'php', 'version' => phpversion());
130
-		foreach (get_loaded_extensions() as $ext) {
131
-			$ret['procure']['php:' . $ext] = array('nom' => 'php:' . $ext, 'version' => phpversion($ext));
132
-		}
133
-	}
134
-	$diff = ($ret != $pcache);
135
-
136
-	if ($diff) {
137
-		$cache[$dir][$plug] = $ret;
93
+    if (!is_readable($file = "$dir$plug/" . ($desc = "paquet") . ".xml")) {
94
+        if (!is_readable($file = "$dir$plug/" . ($desc = "plugin") . ".xml")) {
95
+            return false;
96
+        }
97
+    }
98
+
99
+    if (($time = intval(@filemtime($file))) < 0) {
100
+        return false;
101
+    }
102
+    $md5 = md5_file($file);
103
+
104
+    $pcache = isset($cache[$dir][$plug])
105
+        ? $cache[$dir][$plug] : array('filemtime' => 0, 'md5_file' => '');
106
+
107
+    // si le cache est valide
108
+    if ((intval($reload) <= 0)
109
+        and ($time > 0)
110
+        and ($time <= $pcache['filemtime'])
111
+        and $md5 == $pcache['md5_file']
112
+    ) {
113
+        return false;
114
+    }
115
+
116
+    // si on arrive pas a lire le fichier, se contenter du cache
117
+    if (!($texte = spip_file_get_contents($file))) {
118
+        return false;
119
+    }
120
+
121
+    $f = charger_fonction('infos_' . $desc, 'plugins');
122
+    $ret = $f($texte, $plug, $dir);
123
+    $ret['filemtime'] = $time;
124
+    $ret['md5_file'] = $md5;
125
+    // Si on lit le paquet.xml de SPIP, on rajoute un procure php afin que les plugins puissent
126
+    // utiliser un necessite php. SPIP procure donc la version php courante du serveur.
127
+    // chaque librairie php est aussi procurée, par exemple 'php:curl'.
128
+    if (isset($ret['prefix']) and $ret['prefix'] == 'spip') {
129
+        $ret['procure']['php'] = array('nom' => 'php', 'version' => phpversion());
130
+        foreach (get_loaded_extensions() as $ext) {
131
+            $ret['procure']['php:' . $ext] = array('nom' => 'php:' . $ext, 'version' => phpversion($ext));
132
+        }
133
+    }
134
+    $diff = ($ret != $pcache);
135
+
136
+    if ($diff) {
137
+        $cache[$dir][$plug] = $ret;
138 138
 #		echo count($cache[$dir]), $dir,$plug, " $reloadc<br>"; 
139
-	}
139
+    }
140 140
 
141
-	return $diff;
141
+    return $diff;
142 142
 }
Please login to merge, or discard this patch.
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -37,7 +37,7 @@  discard block
 block discarded – undo
37 37
 	static $filecache = '';
38 38
 
39 39
 	if ($cache === '') {
40
-		$filecache = _DIR_TMP . "plugin_xml_cache.gz";
40
+		$filecache = _DIR_TMP."plugin_xml_cache.gz";
41 41
 		if (is_file($filecache)) {
42 42
 			lire_fichier($filecache, $contenu);
43 43
 			$cache = unserialize($contenu);
@@ -90,8 +90,8 @@  discard block
 block discarded – undo
90 90
 
91 91
 
92 92
 function plugins_get_infos_un($plug, $reload, $dir, &$cache) {
93
-	if (!is_readable($file = "$dir$plug/" . ($desc = "paquet") . ".xml")) {
94
-		if (!is_readable($file = "$dir$plug/" . ($desc = "plugin") . ".xml")) {
93
+	if (!is_readable($file = "$dir$plug/".($desc = "paquet").".xml")) {
94
+		if (!is_readable($file = "$dir$plug/".($desc = "plugin").".xml")) {
95 95
 			return false;
96 96
 		}
97 97
 	}
@@ -118,7 +118,7 @@  discard block
 block discarded – undo
118 118
 		return false;
119 119
 	}
120 120
 
121
-	$f = charger_fonction('infos_' . $desc, 'plugins');
121
+	$f = charger_fonction('infos_'.$desc, 'plugins');
122 122
 	$ret = $f($texte, $plug, $dir);
123 123
 	$ret['filemtime'] = $time;
124 124
 	$ret['md5_file'] = $md5;
@@ -128,7 +128,7 @@  discard block
 block discarded – undo
128 128
 	if (isset($ret['prefix']) and $ret['prefix'] == 'spip') {
129 129
 		$ret['procure']['php'] = array('nom' => 'php', 'version' => phpversion());
130 130
 		foreach (get_loaded_extensions() as $ext) {
131
-			$ret['procure']['php:' . $ext] = array('nom' => 'php:' . $ext, 'version' => phpversion($ext));
131
+			$ret['procure']['php:'.$ext] = array('nom' => 'php:'.$ext, 'version' => phpversion($ext));
132 132
 		}
133 133
 	}
134 134
 	$diff = ($ret != $pcache);
Please login to merge, or discard this patch.
ecrire/plugins/afficher_plugin.php 3 patches
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -102,10 +102,12 @@
 block discarded – undo
102 102
 
103 103
 	// si le plugin CFG est la, l'essayer
104 104
 	if (defined('_DIR_PLUGIN_CFG')) {
105
-		if (include_spip('inc/cfg')) // test CFG version >= 1.0.5
105
+		if (include_spip('inc/cfg')) {
106
+		    // test CFG version >= 1.0.5
106 107
 		{
107 108
 			if ($cfg = icone_lien_cfg("$dir$nom", "cfg")) {
108 109
 				return "<div class='cfg_link'>$cfg</div>";
110
+		}
109 111
 			}
110 112
 		}
111 113
 	}
Please login to merge, or discard this patch.
Indentation   +283 added lines, -283 removed lines patch added patch discarded remove patch
@@ -17,7 +17,7 @@  discard block
 block discarded – undo
17 17
  **/
18 18
 
19 19
 if (!defined('_ECRIRE_INC_VERSION')) {
20
-	return;
20
+    return;
21 21
 }
22 22
 include_spip('inc/charsets');
23 23
 include_spip('inc/texte');
@@ -25,195 +25,195 @@  discard block
 block discarded – undo
25 25
 
26 26
 // https://code.spip.net/@ligne_plug
27 27
 function plugins_afficher_plugin_dist(
28
-	$url_page,
29
-	$plug_file,
30
-	$checked,
31
-	$actif,
32
-	$expose = false,
33
-	$class_li = "item",
34
-	$dir_plugins = _DIR_PLUGINS
28
+    $url_page,
29
+    $plug_file,
30
+    $checked,
31
+    $actif,
32
+    $expose = false,
33
+    $class_li = "item",
34
+    $dir_plugins = _DIR_PLUGINS
35 35
 ) {
36 36
 
37
-	static $id_input = 0;
38
-	static $versions = array();
39
-
40
-	$force_reload = (_request('var_mode') == 'recalcul');
41
-	$get_infos = charger_fonction('get_infos', 'plugins');
42
-	$info = $get_infos($plug_file, $force_reload, $dir_plugins);
43
-	$prefix = $info['prefix'];
44
-	$cfg = "";
45
-	$checkable = ($dir_plugins !== _DIR_PLUGINS_DIST);
46
-	$nom = plugin_nom($info, $dir_plugins, $plug_file);
47
-	$erreur = "";
48
-
49
-	if (!plugin_version_compatible($info['compatibilite'], $GLOBALS['spip_version_branche'], 'spip')) {
50
-		$info['slogan'] = _T('plugin_info_non_compatible_spip');
51
-		$erreur = http_img_pack("plugin-dis-32.png", _T('plugin_info_non_compatible_spip'), " class='picto_err'",
52
-			_T('plugin_info_non_compatible_spip'));
53
-		$class_li .= " disabled";
54
-		$checkable = false;
55
-
56
-	} elseif (isset($info['erreur'])) {
57
-		$class_li .= " error";
58
-		$erreur = http_img_pack("plugin-err-32.png", _T('plugin_info_erreur_xml'), " class='picto_err'",
59
-				_T('plugin_info_erreur_xml'))
60
-			. "<div class='erreur'>" . join('<br >', $info['erreur']) . "</div>";
61
-		$checkable = false;
62
-
63
-	} elseif (isset($GLOBALS['erreurs_activation_raw'][$dir_plugins . $plug_file])) {
64
-		$class_li .= " error";
65
-		$erreur = http_img_pack("plugin-err-32.png", _T('plugin_impossible_activer', array('plugin' => $nom)),
66
-				" class='picto_err'", _T('plugin_impossible_activer', array('plugin' => $nom)))
67
-			. "<div class='erreur'>" . implode("<br />",
68
-				$GLOBALS['erreurs_activation_raw'][$dir_plugins . $plug_file]) . "</div>";
69
-	} else {
70
-		$cfg = $actif ? plugin_bouton_config($plug_file, $info, $dir_plugins) : "";
71
-		if (defined('_DEV_VERSION_SPIP_COMPAT') and !plugin_version_compatible($info['compatibilite'], $GLOBALS['spip_version_branche'])){
72
-			//$info['slogan'] = _T('plugin_info_non_compatible_spip');
73
-			$erreur = http_img_pack("plugin-dis-32.png", _T('plugin_info_non_compatible_spip'), " class='picto_err picto_compat_forcee'",
74
-				_L('Version incompatible : compatibilité forcée'));
75
-		}
76
-	}
77
-
78
-	// numerotons les occurrences d'un meme prefix
79
-	$versions[$prefix] = $id = isset($versions[$prefix]) ? intval($versions[$prefix]) + 1 : '';
80
-
81
-	$class_li .= ($actif ? " actif" : "") . ($expose ? " on" : "");
82
-
83
-	return "<li id='$prefix$id' class='$class_li'>"
84
-	. ((!$checkable and !$checked)
85
-		? '' : plugin_checkbox(++$id_input, $dir_plugins . $plug_file, $checked))
86
-	. plugin_resume($info, $dir_plugins, $plug_file, $url_page)
87
-	. $cfg
88
-	. $erreur
89
-	. (($dir_plugins !== _DIR_PLUGINS_DIST and plugin_est_installe($plug_file))
90
-		? plugin_desintalle($plug_file, $nom, $dir_plugins) : '')
91
-	. "<div class='details'>" // pour l'ajax de exec/info_plugin
92
-	. (!$expose ? '' : affiche_bloc_plugin($plug_file, $info, $dir_plugins))
93
-	. "</div>"
94
-	. "</li>";
37
+    static $id_input = 0;
38
+    static $versions = array();
39
+
40
+    $force_reload = (_request('var_mode') == 'recalcul');
41
+    $get_infos = charger_fonction('get_infos', 'plugins');
42
+    $info = $get_infos($plug_file, $force_reload, $dir_plugins);
43
+    $prefix = $info['prefix'];
44
+    $cfg = "";
45
+    $checkable = ($dir_plugins !== _DIR_PLUGINS_DIST);
46
+    $nom = plugin_nom($info, $dir_plugins, $plug_file);
47
+    $erreur = "";
48
+
49
+    if (!plugin_version_compatible($info['compatibilite'], $GLOBALS['spip_version_branche'], 'spip')) {
50
+        $info['slogan'] = _T('plugin_info_non_compatible_spip');
51
+        $erreur = http_img_pack("plugin-dis-32.png", _T('plugin_info_non_compatible_spip'), " class='picto_err'",
52
+            _T('plugin_info_non_compatible_spip'));
53
+        $class_li .= " disabled";
54
+        $checkable = false;
55
+
56
+    } elseif (isset($info['erreur'])) {
57
+        $class_li .= " error";
58
+        $erreur = http_img_pack("plugin-err-32.png", _T('plugin_info_erreur_xml'), " class='picto_err'",
59
+                _T('plugin_info_erreur_xml'))
60
+            . "<div class='erreur'>" . join('<br >', $info['erreur']) . "</div>";
61
+        $checkable = false;
62
+
63
+    } elseif (isset($GLOBALS['erreurs_activation_raw'][$dir_plugins . $plug_file])) {
64
+        $class_li .= " error";
65
+        $erreur = http_img_pack("plugin-err-32.png", _T('plugin_impossible_activer', array('plugin' => $nom)),
66
+                " class='picto_err'", _T('plugin_impossible_activer', array('plugin' => $nom)))
67
+            . "<div class='erreur'>" . implode("<br />",
68
+                $GLOBALS['erreurs_activation_raw'][$dir_plugins . $plug_file]) . "</div>";
69
+    } else {
70
+        $cfg = $actif ? plugin_bouton_config($plug_file, $info, $dir_plugins) : "";
71
+        if (defined('_DEV_VERSION_SPIP_COMPAT') and !plugin_version_compatible($info['compatibilite'], $GLOBALS['spip_version_branche'])){
72
+            //$info['slogan'] = _T('plugin_info_non_compatible_spip');
73
+            $erreur = http_img_pack("plugin-dis-32.png", _T('plugin_info_non_compatible_spip'), " class='picto_err picto_compat_forcee'",
74
+                _L('Version incompatible : compatibilité forcée'));
75
+        }
76
+    }
77
+
78
+    // numerotons les occurrences d'un meme prefix
79
+    $versions[$prefix] = $id = isset($versions[$prefix]) ? intval($versions[$prefix]) + 1 : '';
80
+
81
+    $class_li .= ($actif ? " actif" : "") . ($expose ? " on" : "");
82
+
83
+    return "<li id='$prefix$id' class='$class_li'>"
84
+    . ((!$checkable and !$checked)
85
+        ? '' : plugin_checkbox(++$id_input, $dir_plugins . $plug_file, $checked))
86
+    . plugin_resume($info, $dir_plugins, $plug_file, $url_page)
87
+    . $cfg
88
+    . $erreur
89
+    . (($dir_plugins !== _DIR_PLUGINS_DIST and plugin_est_installe($plug_file))
90
+        ? plugin_desintalle($plug_file, $nom, $dir_plugins) : '')
91
+    . "<div class='details'>" // pour l'ajax de exec/info_plugin
92
+    . (!$expose ? '' : affiche_bloc_plugin($plug_file, $info, $dir_plugins))
93
+    . "</div>"
94
+    . "</li>";
95 95
 }
96 96
 
97 97
 function plugin_bouton_config($nom, $infos, $dir) {
98
-	// la verification se base sur le filesystem
99
-	// il faut donc n'utiliser que des minuscules, par convention
100
-	$prefix = strtolower($infos['prefix']);
101
-	// si paquet.xml fournit un squelette, le prendre
102
-	if (isset($infos['config']) and $infos['config']) {
103
-		return recuperer_fond("$dir$nom/" . $infos['config'],
104
-			array(
105
-				'script' => 'configurer_' . $prefix,
106
-				'nom' => $nom
107
-			));
108
-	}
109
-
110
-	// si le plugin CFG est la, l'essayer
111
-	if (defined('_DIR_PLUGIN_CFG')) {
112
-		if (include_spip('inc/cfg')) // test CFG version >= 1.0.5
113
-		{
114
-			if ($cfg = icone_lien_cfg("$dir$nom", "cfg")) {
115
-				return "<div class='cfg_link'>$cfg</div>";
116
-			}
117
-		}
118
-	}
119
-
120
-	// sinon prendre le squelette std sur le nom std
121
-	return recuperer_fond("prive/squelettes/inclure/cfg",
122
-		array(
123
-			'script' => 'configurer_' . $prefix,
124
-			'nom' => $nom
125
-		));
98
+    // la verification se base sur le filesystem
99
+    // il faut donc n'utiliser que des minuscules, par convention
100
+    $prefix = strtolower($infos['prefix']);
101
+    // si paquet.xml fournit un squelette, le prendre
102
+    if (isset($infos['config']) and $infos['config']) {
103
+        return recuperer_fond("$dir$nom/" . $infos['config'],
104
+            array(
105
+                'script' => 'configurer_' . $prefix,
106
+                'nom' => $nom
107
+            ));
108
+    }
109
+
110
+    // si le plugin CFG est la, l'essayer
111
+    if (defined('_DIR_PLUGIN_CFG')) {
112
+        if (include_spip('inc/cfg')) // test CFG version >= 1.0.5
113
+        {
114
+            if ($cfg = icone_lien_cfg("$dir$nom", "cfg")) {
115
+                return "<div class='cfg_link'>$cfg</div>";
116
+            }
117
+        }
118
+    }
119
+
120
+    // sinon prendre le squelette std sur le nom std
121
+    return recuperer_fond("prive/squelettes/inclure/cfg",
122
+        array(
123
+            'script' => 'configurer_' . $prefix,
124
+            'nom' => $nom
125
+        ));
126 126
 }
127 127
 
128 128
 // checkbox pour activer ou desactiver
129 129
 // si ce n'est pas une extension
130 130
 
131 131
 function plugin_checkbox($id_input, $file, $actif) {
132
-	$name = substr(md5($file), 0, 16);
133
-
134
-	return "<div class='check'>\n"
135
-	. "<input type='checkbox' name='s$name' id='label_$id_input'"
136
-	. ($actif ? " checked='checked'" : "")
137
-	. " class='checkbox'  value='O' />"
138
-	. "\n<label for='label_$id_input'>" . _T('activer_plugin') . "</label>"
139
-	. "</div>";
132
+    $name = substr(md5($file), 0, 16);
133
+
134
+    return "<div class='check'>\n"
135
+    . "<input type='checkbox' name='s$name' id='label_$id_input'"
136
+    . ($actif ? " checked='checked'" : "")
137
+    . " class='checkbox'  value='O' />"
138
+    . "\n<label for='label_$id_input'>" . _T('activer_plugin') . "</label>"
139
+    . "</div>";
140 140
 }
141 141
 
142 142
 function plugin_nom($info, $dir_plugins, $plug_file) {
143
-	$prefix = $info['prefix'];
144
-	$dir = "$dir_plugins$plug_file";
145
-	// Si dtd paquet, on traite le nom soit par son item de langue soit par sa valeur immediate a l'index "nom"
146
-	if ($info['dtd'] == "paquet") {
147
-		$nom = plugin_typo("{$prefix}_nom", "$dir/lang/paquet-$prefix");
148
-		if (!$nom) {
149
-			$nom = typo($info['nom']);
150
-		}
151
-	} else {
152
-		$nom = typo(attribut_html($info['nom']));
153
-	}
154
-
155
-	return trim($nom);
143
+    $prefix = $info['prefix'];
144
+    $dir = "$dir_plugins$plug_file";
145
+    // Si dtd paquet, on traite le nom soit par son item de langue soit par sa valeur immediate a l'index "nom"
146
+    if ($info['dtd'] == "paquet") {
147
+        $nom = plugin_typo("{$prefix}_nom", "$dir/lang/paquet-$prefix");
148
+        if (!$nom) {
149
+            $nom = typo($info['nom']);
150
+        }
151
+    } else {
152
+        $nom = typo(attribut_html($info['nom']));
153
+    }
154
+
155
+    return trim($nom);
156 156
 }
157 157
 
158 158
 // Cartouche Resume
159 159
 function plugin_resume($info, $dir_plugins, $plug_file, $url_page) {
160
-	$prefix = $info['prefix'];
161
-	$dir = "$dir_plugins$plug_file";
162
-	$slogan = PtoBR(plugin_propre($info['slogan'], "$dir/lang/paquet-$prefix"));
163
-	// une seule ligne dans le slogan : couper si besoin
164
-	if (($p = strpos($slogan, "<br />")) !== false) {
165
-		$slogan = substr($slogan, 0, $p);
166
-	}
167
-	// couper par securite
168
-	$slogan = couper($slogan, 80);
169
-
170
-	$nom = plugin_nom($info, $dir_plugins, $plug_file);
171
-
172
-	$url = parametre_url($url_page, "plugin", substr($dir, strlen(_DIR_RACINE)));
173
-
174
-	$icon_class = 'icon';
175
-	$img = '';
176
-	if (isset($info['logo']) and $i = trim($info['logo'])) {
177
-		$img = http_img_pack("$dir/$i", '', " width='32' height='32'", '', ['variante_svg_si_possible' => true, 'chemin_image' => false]);
178
-		if (!extraire_attribut($img, 'src')) {
179
-			$img = '';
180
-		}
181
-	}
182
-	if (!$img) {
183
-		$img = http_img_pack("plugin-xx.svg", '', " width='32' height='32'");
184
-		$icon_class .= ' no-logo';
185
-	}
186
-
187
-	$i = "<div class='$icon_class'><a href='$url' rel='info'>$img</a></div>";
188
-
189
-	return "<div class='resume'>"
190
-	. "<h3><a href='$url' rel='info'>"
191
-	. $nom
192
-	. "</a></h3>"
193
-	. " <span class='version'>" . $info['version'] . "</span>"
194
-	. " <span class='etat'> - "
195
-	. plugin_etat_en_clair($info['etat'])
196
-	. "</span>"
197
-	. "<div class='short'>" . $slogan . "</div>"
198
-	. $i
199
-	. "</div>";
160
+    $prefix = $info['prefix'];
161
+    $dir = "$dir_plugins$plug_file";
162
+    $slogan = PtoBR(plugin_propre($info['slogan'], "$dir/lang/paquet-$prefix"));
163
+    // une seule ligne dans le slogan : couper si besoin
164
+    if (($p = strpos($slogan, "<br />")) !== false) {
165
+        $slogan = substr($slogan, 0, $p);
166
+    }
167
+    // couper par securite
168
+    $slogan = couper($slogan, 80);
169
+
170
+    $nom = plugin_nom($info, $dir_plugins, $plug_file);
171
+
172
+    $url = parametre_url($url_page, "plugin", substr($dir, strlen(_DIR_RACINE)));
173
+
174
+    $icon_class = 'icon';
175
+    $img = '';
176
+    if (isset($info['logo']) and $i = trim($info['logo'])) {
177
+        $img = http_img_pack("$dir/$i", '', " width='32' height='32'", '', ['variante_svg_si_possible' => true, 'chemin_image' => false]);
178
+        if (!extraire_attribut($img, 'src')) {
179
+            $img = '';
180
+        }
181
+    }
182
+    if (!$img) {
183
+        $img = http_img_pack("plugin-xx.svg", '', " width='32' height='32'");
184
+        $icon_class .= ' no-logo';
185
+    }
186
+
187
+    $i = "<div class='$icon_class'><a href='$url' rel='info'>$img</a></div>";
188
+
189
+    return "<div class='resume'>"
190
+    . "<h3><a href='$url' rel='info'>"
191
+    . $nom
192
+    . "</a></h3>"
193
+    . " <span class='version'>" . $info['version'] . "</span>"
194
+    . " <span class='etat'> - "
195
+    . plugin_etat_en_clair($info['etat'])
196
+    . "</span>"
197
+    . "<div class='short'>" . $slogan . "</div>"
198
+    . $i
199
+    . "</div>";
200 200
 }
201 201
 
202 202
 function plugin_desintalle($plug_file, $nom, $dir_plugins = null) {
203
-	if (!$dir_plugins) {
204
-		$dir_plugins = _DIR_PLUGINS;
205
-	}
203
+    if (!$dir_plugins) {
204
+        $dir_plugins = _DIR_PLUGINS;
205
+    }
206 206
 
207
-	$action = redirige_action_auteur('desinstaller_plugin', "$dir_plugins::$plug_file", 'admin_plugin');
208
-	$text = _T('bouton_desinstaller');
209
-	$text2 = _T('info_desinstaller_plugin');
210
-	$file = basename($plug_file);
207
+    $action = redirige_action_auteur('desinstaller_plugin', "$dir_plugins::$plug_file", 'admin_plugin');
208
+    $text = _T('bouton_desinstaller');
209
+    $text2 = _T('info_desinstaller_plugin');
210
+    $file = basename($plug_file);
211 211
 
212
-	return "<div class='actions'>[" .
213
-	"<a href='$action'
212
+    return "<div class='actions'>[" .
213
+    "<a href='$action'
214 214
 		onclick='return confirm(\"$text $nom ?\\n$text2\")'>"
215
-	. $text
216
-	. "</a>]</div>";
215
+    . $text
216
+    . "</a>]</div>";
217 217
 }
218 218
 
219 219
 /**
@@ -227,137 +227,137 @@  discard block
 block discarded – undo
227 227
  *     Traduction de l'état dans la langue en cours
228 228
  **/
229 229
 function plugin_etat_en_clair($etat) {
230
-	if (!in_array($etat, array('stable', 'test', 'experimental'))) {
231
-		$etat = 'developpement';
232
-	}
230
+    if (!in_array($etat, array('stable', 'test', 'experimental'))) {
231
+        $etat = 'developpement';
232
+    }
233 233
 
234
-	return _T('plugin_etat_' . $etat);
234
+    return _T('plugin_etat_' . $etat);
235 235
 }
236 236
 
237 237
 // https://code.spip.net/@plugin_propre
238 238
 function plugin_propre($texte, $module = '',$propre='propre') {
239
-	// retirer le retour a la racine du module, car le find_in_path se fait depuis la racine
240
-	if (_DIR_RACINE and strncmp($module, _DIR_RACINE, strlen(_DIR_RACINE)) == 0) {
241
-		$module = substr($module, strlen(_DIR_RACINE));
242
-	}
243
-	if (preg_match("|^\w+_[\w_]+$|", $texte)) {
244
-		$texte = _T(($module ? "$module:" : '') . $texte, array(), array('force' => false));
245
-	}
246
-
247
-	return $propre($texte);
239
+    // retirer le retour a la racine du module, car le find_in_path se fait depuis la racine
240
+    if (_DIR_RACINE and strncmp($module, _DIR_RACINE, strlen(_DIR_RACINE)) == 0) {
241
+        $module = substr($module, strlen(_DIR_RACINE));
242
+    }
243
+    if (preg_match("|^\w+_[\w_]+$|", $texte)) {
244
+        $texte = _T(($module ? "$module:" : '') . $texte, array(), array('force' => false));
245
+    }
246
+
247
+    return $propre($texte);
248 248
 }
249 249
 
250 250
 function plugin_typo($texte, $module = '') {
251
-	return plugin_propre($texte, $module, 'typo');
251
+    return plugin_propre($texte, $module, 'typo');
252 252
 }
253 253
 
254 254
 
255 255
 // https://code.spip.net/@affiche_bloc_plugin
256 256
 function affiche_bloc_plugin($plug_file, $info, $dir_plugins = null) {
257
-	if (!$dir_plugins) {
258
-		$dir_plugins = _DIR_PLUGINS;
259
-	}
260
-
261
-	$prefix = $info['prefix'];
262
-	$dir = "$dir_plugins$plug_file/lang/paquet-$prefix";
263
-
264
-	$s = "";
265
-	// TODO: le traiter_multi ici n'est pas beau
266
-	// cf. description du plugin/_stable_/ortho/plugin.xml
267
-	// concerne les anciens plugin.xml donc on devrait plus en avoir besoin
268
-	$description = "";
269
-	if (isset($info['description'])) {
270
-		$description = plugin_propre($info['description'], $dir);
271
-	}
272
-
273
-	if (isset($info['documentation'])
274
-		and $lien = $info['documentation']
275
-	) {
276
-		$description .= "<p><em class='site'><a href='$lien' class='spip_out'>" . _T('en_savoir_plus') . '</a></em></p>';
277
-	}
278
-	$s .= "<dd class='desc'>" . $description . "</dd>\n";
279
-
280
-	if (isset($info['auteur'])) {
281
-		if (is_array($info['auteur'])) {
282
-			$a = formater_credits($info['auteur'], ', ');
283
-		} // pour compat mais ne doit plus arriver
284
-		else {
285
-			$a = trim($info['auteur']);
286
-		}
287
-		if ($a) {
288
-			$s .= "<dt class='auteurs'>" . _T('public:par_auteur') . "</dt><dd class='auteurs'>" . PtoBR(propre($a,
289
-					$dir)) . "</dd>\n";
290
-		}
291
-	}
292
-
293
-	if (isset($info['credit'])) {
294
-		if ($a = formater_credits($info['credit'], ', ')) {
295
-			$s .= "<dt class='credits'>" . _T('plugin_info_credit') . "</dt><dd class='credits'>" . PtoBR(propre($a,
296
-					$dir)) . "</dd>\n";
297
-		}
298
-	}
299
-
300
-	if (isset($info['licence'])) {
301
-		if (is_array($info['licence'])) {
302
-			$a = formater_credits($info['licence'], ', ');
303
-		} // pour compat mais ne doit plus arriver
304
-		else {
305
-			$a = trim($info['licence']);
306
-		}
307
-		if ($a) {
308
-			$s .= "<dt class='licence'>" . _T('intitule_licence') . "</dt><dd class='licence'>" . PtoBR(propre($a,
309
-					$dir)) . "</dd>\n";
310
-		}
311
-	}
312
-
313
-	$s = "<dl class='description'>$s</dl>";
314
-
315
-	//
316
-	// Ajouter les infos techniques
317
-	//
318
-	$infotech = array();
319
-
320
-	$version = "<dt>" . _T('version') . "</dt><dd>" . $info['version'];
321
-	// Version VCS
322
-	if ($vcs = version_vcs_courante($dir_plugins . $plug_file)) {
323
-		$version .= ' ' . $vcs;
324
-	}
325
-	$version .= "</dd>";
326
-	$infotech[] = $version;
327
-	$infotech[] = "<dt>" . _T('repertoire_plugins') . "</dt><dd>" . joli_repertoire("$dir_plugins$plug_file") . "</dd>";
328
-	// source zip le cas echeant
329
-	$infotech[] = (lire_fichier($dir_plugins . $plug_file . '/install.log', $log)
330
-		and preg_match(',^source:(.*)$,m', $log, $r))
331
-		? '<dt>' . _T('plugin_source') . '</dt><dd>' . trim($r[1]) . "</dd>"
332
-		: '';
333
-
334
-	$infotech[] = !$info['necessite'] ? '' :
335
-		('<dt>' . _T('plugin_info_necessite') . '</dt><dd>' . join(' ',
336
-				array_map('array_shift', $info['necessite'])) . '</dd>');
337
-
338
-	$s .= "<dl class='tech'>"
339
-		. join('', $infotech)
340
-		. "</dl>";
341
-
342
-
343
-	return $s;
257
+    if (!$dir_plugins) {
258
+        $dir_plugins = _DIR_PLUGINS;
259
+    }
260
+
261
+    $prefix = $info['prefix'];
262
+    $dir = "$dir_plugins$plug_file/lang/paquet-$prefix";
263
+
264
+    $s = "";
265
+    // TODO: le traiter_multi ici n'est pas beau
266
+    // cf. description du plugin/_stable_/ortho/plugin.xml
267
+    // concerne les anciens plugin.xml donc on devrait plus en avoir besoin
268
+    $description = "";
269
+    if (isset($info['description'])) {
270
+        $description = plugin_propre($info['description'], $dir);
271
+    }
272
+
273
+    if (isset($info['documentation'])
274
+        and $lien = $info['documentation']
275
+    ) {
276
+        $description .= "<p><em class='site'><a href='$lien' class='spip_out'>" . _T('en_savoir_plus') . '</a></em></p>';
277
+    }
278
+    $s .= "<dd class='desc'>" . $description . "</dd>\n";
279
+
280
+    if (isset($info['auteur'])) {
281
+        if (is_array($info['auteur'])) {
282
+            $a = formater_credits($info['auteur'], ', ');
283
+        } // pour compat mais ne doit plus arriver
284
+        else {
285
+            $a = trim($info['auteur']);
286
+        }
287
+        if ($a) {
288
+            $s .= "<dt class='auteurs'>" . _T('public:par_auteur') . "</dt><dd class='auteurs'>" . PtoBR(propre($a,
289
+                    $dir)) . "</dd>\n";
290
+        }
291
+    }
292
+
293
+    if (isset($info['credit'])) {
294
+        if ($a = formater_credits($info['credit'], ', ')) {
295
+            $s .= "<dt class='credits'>" . _T('plugin_info_credit') . "</dt><dd class='credits'>" . PtoBR(propre($a,
296
+                    $dir)) . "</dd>\n";
297
+        }
298
+    }
299
+
300
+    if (isset($info['licence'])) {
301
+        if (is_array($info['licence'])) {
302
+            $a = formater_credits($info['licence'], ', ');
303
+        } // pour compat mais ne doit plus arriver
304
+        else {
305
+            $a = trim($info['licence']);
306
+        }
307
+        if ($a) {
308
+            $s .= "<dt class='licence'>" . _T('intitule_licence') . "</dt><dd class='licence'>" . PtoBR(propre($a,
309
+                    $dir)) . "</dd>\n";
310
+        }
311
+    }
312
+
313
+    $s = "<dl class='description'>$s</dl>";
314
+
315
+    //
316
+    // Ajouter les infos techniques
317
+    //
318
+    $infotech = array();
319
+
320
+    $version = "<dt>" . _T('version') . "</dt><dd>" . $info['version'];
321
+    // Version VCS
322
+    if ($vcs = version_vcs_courante($dir_plugins . $plug_file)) {
323
+        $version .= ' ' . $vcs;
324
+    }
325
+    $version .= "</dd>";
326
+    $infotech[] = $version;
327
+    $infotech[] = "<dt>" . _T('repertoire_plugins') . "</dt><dd>" . joli_repertoire("$dir_plugins$plug_file") . "</dd>";
328
+    // source zip le cas echeant
329
+    $infotech[] = (lire_fichier($dir_plugins . $plug_file . '/install.log', $log)
330
+        and preg_match(',^source:(.*)$,m', $log, $r))
331
+        ? '<dt>' . _T('plugin_source') . '</dt><dd>' . trim($r[1]) . "</dd>"
332
+        : '';
333
+
334
+    $infotech[] = !$info['necessite'] ? '' :
335
+        ('<dt>' . _T('plugin_info_necessite') . '</dt><dd>' . join(' ',
336
+                array_map('array_shift', $info['necessite'])) . '</dd>');
337
+
338
+    $s .= "<dl class='tech'>"
339
+        . join('', $infotech)
340
+        . "</dl>";
341
+
342
+
343
+    return $s;
344 344
 }
345 345
 
346 346
 function formater_credits($infos, $sep = ', ') {
347
-	$texte = '';
348
-
349
-	foreach ($infos as $_credit) {
350
-		if ($texte) {
351
-			$texte .= $sep;
352
-		}
353
-		// Si le credit en cours n'est pas un array c'est donc un copyright
354
-		$texte .=
355
-			(!is_array($_credit))
356
-				? PtoBR(propre($_credit))
357
-				: ($_credit['url'] ? '<a href="' . $_credit['url'] . '">' : '') .
358
-				$_credit['nom'] .
359
-				($_credit['url'] ? '</a>' : '');
360
-	}
361
-
362
-	return $texte;
347
+    $texte = '';
348
+
349
+    foreach ($infos as $_credit) {
350
+        if ($texte) {
351
+            $texte .= $sep;
352
+        }
353
+        // Si le credit en cours n'est pas un array c'est donc un copyright
354
+        $texte .=
355
+            (!is_array($_credit))
356
+                ? PtoBR(propre($_credit))
357
+                : ($_credit['url'] ? '<a href="' . $_credit['url'] . '">' : '') .
358
+                $_credit['nom'] .
359
+                ($_credit['url'] ? '</a>' : '');
360
+    }
361
+
362
+    return $texte;
363 363
 }
Please login to merge, or discard this patch.
Spacing   +35 added lines, -36 removed lines patch added patch discarded remove patch
@@ -57,18 +57,18 @@  discard block
 block discarded – undo
57 57
 		$class_li .= " error";
58 58
 		$erreur = http_img_pack("plugin-err-32.png", _T('plugin_info_erreur_xml'), " class='picto_err'",
59 59
 				_T('plugin_info_erreur_xml'))
60
-			. "<div class='erreur'>" . join('<br >', $info['erreur']) . "</div>";
60
+			. "<div class='erreur'>".join('<br >', $info['erreur'])."</div>";
61 61
 		$checkable = false;
62 62
 
63
-	} elseif (isset($GLOBALS['erreurs_activation_raw'][$dir_plugins . $plug_file])) {
63
+	} elseif (isset($GLOBALS['erreurs_activation_raw'][$dir_plugins.$plug_file])) {
64 64
 		$class_li .= " error";
65 65
 		$erreur = http_img_pack("plugin-err-32.png", _T('plugin_impossible_activer', array('plugin' => $nom)),
66 66
 				" class='picto_err'", _T('plugin_impossible_activer', array('plugin' => $nom)))
67
-			. "<div class='erreur'>" . implode("<br />",
68
-				$GLOBALS['erreurs_activation_raw'][$dir_plugins . $plug_file]) . "</div>";
67
+			. "<div class='erreur'>".implode("<br />",
68
+				$GLOBALS['erreurs_activation_raw'][$dir_plugins.$plug_file])."</div>";
69 69
 	} else {
70 70
 		$cfg = $actif ? plugin_bouton_config($plug_file, $info, $dir_plugins) : "";
71
-		if (defined('_DEV_VERSION_SPIP_COMPAT') and !plugin_version_compatible($info['compatibilite'], $GLOBALS['spip_version_branche'])){
71
+		if (defined('_DEV_VERSION_SPIP_COMPAT') and !plugin_version_compatible($info['compatibilite'], $GLOBALS['spip_version_branche'])) {
72 72
 			//$info['slogan'] = _T('plugin_info_non_compatible_spip');
73 73
 			$erreur = http_img_pack("plugin-dis-32.png", _T('plugin_info_non_compatible_spip'), " class='picto_err picto_compat_forcee'",
74 74
 				_L('Version incompatible : compatibilité forcée'));
@@ -78,11 +78,11 @@  discard block
 block discarded – undo
78 78
 	// numerotons les occurrences d'un meme prefix
79 79
 	$versions[$prefix] = $id = isset($versions[$prefix]) ? intval($versions[$prefix]) + 1 : '';
80 80
 
81
-	$class_li .= ($actif ? " actif" : "") . ($expose ? " on" : "");
81
+	$class_li .= ($actif ? " actif" : "").($expose ? " on" : "");
82 82
 
83 83
 	return "<li id='$prefix$id' class='$class_li'>"
84 84
 	. ((!$checkable and !$checked)
85
-		? '' : plugin_checkbox(++$id_input, $dir_plugins . $plug_file, $checked))
85
+		? '' : plugin_checkbox(++$id_input, $dir_plugins.$plug_file, $checked))
86 86
 	. plugin_resume($info, $dir_plugins, $plug_file, $url_page)
87 87
 	. $cfg
88 88
 	. $erreur
@@ -100,9 +100,9 @@  discard block
 block discarded – undo
100 100
 	$prefix = strtolower($infos['prefix']);
101 101
 	// si paquet.xml fournit un squelette, le prendre
102 102
 	if (isset($infos['config']) and $infos['config']) {
103
-		return recuperer_fond("$dir$nom/" . $infos['config'],
103
+		return recuperer_fond("$dir$nom/".$infos['config'],
104 104
 			array(
105
-				'script' => 'configurer_' . $prefix,
105
+				'script' => 'configurer_'.$prefix,
106 106
 				'nom' => $nom
107 107
 			));
108 108
 	}
@@ -120,7 +120,7 @@  discard block
 block discarded – undo
120 120
 	// sinon prendre le squelette std sur le nom std
121 121
 	return recuperer_fond("prive/squelettes/inclure/cfg",
122 122
 		array(
123
-			'script' => 'configurer_' . $prefix,
123
+			'script' => 'configurer_'.$prefix,
124 124
 			'nom' => $nom
125 125
 		));
126 126
 }
@@ -135,7 +135,7 @@  discard block
 block discarded – undo
135 135
 	. "<input type='checkbox' name='s$name' id='label_$id_input'"
136 136
 	. ($actif ? " checked='checked'" : "")
137 137
 	. " class='checkbox'  value='O' />"
138
-	. "\n<label for='label_$id_input'>" . _T('activer_plugin') . "</label>"
138
+	. "\n<label for='label_$id_input'>"._T('activer_plugin')."</label>"
139 139
 	. "</div>";
140 140
 }
141 141
 
@@ -190,11 +190,11 @@  discard block
 block discarded – undo
190 190
 	. "<h3><a href='$url' rel='info'>"
191 191
 	. $nom
192 192
 	. "</a></h3>"
193
-	. " <span class='version'>" . $info['version'] . "</span>"
193
+	. " <span class='version'>".$info['version']."</span>"
194 194
 	. " <span class='etat'> - "
195 195
 	. plugin_etat_en_clair($info['etat'])
196 196
 	. "</span>"
197
-	. "<div class='short'>" . $slogan . "</div>"
197
+	. "<div class='short'>".$slogan."</div>"
198 198
 	. $i
199 199
 	. "</div>";
200 200
 }
@@ -209,7 +209,7 @@  discard block
 block discarded – undo
209 209
 	$text2 = _T('info_desinstaller_plugin');
210 210
 	$file = basename($plug_file);
211 211
 
212
-	return "<div class='actions'>[" .
212
+	return "<div class='actions'>[".
213 213
 	"<a href='$action'
214 214
 		onclick='return confirm(\"$text $nom ?\\n$text2\")'>"
215 215
 	. $text
@@ -231,17 +231,17 @@  discard block
 block discarded – undo
231 231
 		$etat = 'developpement';
232 232
 	}
233 233
 
234
-	return _T('plugin_etat_' . $etat);
234
+	return _T('plugin_etat_'.$etat);
235 235
 }
236 236
 
237 237
 // https://code.spip.net/@plugin_propre
238
-function plugin_propre($texte, $module = '',$propre='propre') {
238
+function plugin_propre($texte, $module = '', $propre = 'propre') {
239 239
 	// retirer le retour a la racine du module, car le find_in_path se fait depuis la racine
240 240
 	if (_DIR_RACINE and strncmp($module, _DIR_RACINE, strlen(_DIR_RACINE)) == 0) {
241 241
 		$module = substr($module, strlen(_DIR_RACINE));
242 242
 	}
243 243
 	if (preg_match("|^\w+_[\w_]+$|", $texte)) {
244
-		$texte = _T(($module ? "$module:" : '') . $texte, array(), array('force' => false));
244
+		$texte = _T(($module ? "$module:" : '').$texte, array(), array('force' => false));
245 245
 	}
246 246
 
247 247
 	return $propre($texte);
@@ -273,9 +273,9 @@  discard block
 block discarded – undo
273 273
 	if (isset($info['documentation'])
274 274
 		and $lien = $info['documentation']
275 275
 	) {
276
-		$description .= "<p><em class='site'><a href='$lien' class='spip_out'>" . _T('en_savoir_plus') . '</a></em></p>';
276
+		$description .= "<p><em class='site'><a href='$lien' class='spip_out'>"._T('en_savoir_plus').'</a></em></p>';
277 277
 	}
278
-	$s .= "<dd class='desc'>" . $description . "</dd>\n";
278
+	$s .= "<dd class='desc'>".$description."</dd>\n";
279 279
 
280 280
 	if (isset($info['auteur'])) {
281 281
 		if (is_array($info['auteur'])) {
@@ -285,15 +285,15 @@  discard block
 block discarded – undo
285 285
 			$a = trim($info['auteur']);
286 286
 		}
287 287
 		if ($a) {
288
-			$s .= "<dt class='auteurs'>" . _T('public:par_auteur') . "</dt><dd class='auteurs'>" . PtoBR(propre($a,
289
-					$dir)) . "</dd>\n";
288
+			$s .= "<dt class='auteurs'>"._T('public:par_auteur')."</dt><dd class='auteurs'>".PtoBR(propre($a,
289
+					$dir))."</dd>\n";
290 290
 		}
291 291
 	}
292 292
 
293 293
 	if (isset($info['credit'])) {
294 294
 		if ($a = formater_credits($info['credit'], ', ')) {
295
-			$s .= "<dt class='credits'>" . _T('plugin_info_credit') . "</dt><dd class='credits'>" . PtoBR(propre($a,
296
-					$dir)) . "</dd>\n";
295
+			$s .= "<dt class='credits'>"._T('plugin_info_credit')."</dt><dd class='credits'>".PtoBR(propre($a,
296
+					$dir))."</dd>\n";
297 297
 		}
298 298
 	}
299 299
 
@@ -305,8 +305,8 @@  discard block
 block discarded – undo
305 305
 			$a = trim($info['licence']);
306 306
 		}
307 307
 		if ($a) {
308
-			$s .= "<dt class='licence'>" . _T('intitule_licence') . "</dt><dd class='licence'>" . PtoBR(propre($a,
309
-					$dir)) . "</dd>\n";
308
+			$s .= "<dt class='licence'>"._T('intitule_licence')."</dt><dd class='licence'>".PtoBR(propre($a,
309
+					$dir))."</dd>\n";
310 310
 		}
311 311
 	}
312 312
 
@@ -317,23 +317,22 @@  discard block
 block discarded – undo
317 317
 	//
318 318
 	$infotech = array();
319 319
 
320
-	$version = "<dt>" . _T('version') . "</dt><dd>" . $info['version'];
320
+	$version = "<dt>"._T('version')."</dt><dd>".$info['version'];
321 321
 	// Version VCS
322
-	if ($vcs = version_vcs_courante($dir_plugins . $plug_file)) {
323
-		$version .= ' ' . $vcs;
322
+	if ($vcs = version_vcs_courante($dir_plugins.$plug_file)) {
323
+		$version .= ' '.$vcs;
324 324
 	}
325 325
 	$version .= "</dd>";
326 326
 	$infotech[] = $version;
327
-	$infotech[] = "<dt>" . _T('repertoire_plugins') . "</dt><dd>" . joli_repertoire("$dir_plugins$plug_file") . "</dd>";
327
+	$infotech[] = "<dt>"._T('repertoire_plugins')."</dt><dd>".joli_repertoire("$dir_plugins$plug_file")."</dd>";
328 328
 	// source zip le cas echeant
329
-	$infotech[] = (lire_fichier($dir_plugins . $plug_file . '/install.log', $log)
329
+	$infotech[] = (lire_fichier($dir_plugins.$plug_file.'/install.log', $log)
330 330
 		and preg_match(',^source:(.*)$,m', $log, $r))
331
-		? '<dt>' . _T('plugin_source') . '</dt><dd>' . trim($r[1]) . "</dd>"
331
+		? '<dt>'._T('plugin_source').'</dt><dd>'.trim($r[1])."</dd>"
332 332
 		: '';
333 333
 
334
-	$infotech[] = !$info['necessite'] ? '' :
335
-		('<dt>' . _T('plugin_info_necessite') . '</dt><dd>' . join(' ',
336
-				array_map('array_shift', $info['necessite'])) . '</dd>');
334
+	$infotech[] = !$info['necessite'] ? '' : ('<dt>'._T('plugin_info_necessite').'</dt><dd>'.join(' ',
335
+				array_map('array_shift', $info['necessite'])).'</dd>');
337 336
 
338 337
 	$s .= "<dl class='tech'>"
339 338
 		. join('', $infotech)
@@ -354,8 +353,8 @@  discard block
 block discarded – undo
354 353
 		$texte .=
355 354
 			(!is_array($_credit))
356 355
 				? PtoBR(propre($_credit))
357
-				: ($_credit['url'] ? '<a href="' . $_credit['url'] . '">' : '') .
358
-				$_credit['nom'] .
356
+				: ($_credit['url'] ? '<a href="'.$_credit['url'].'">' : '').
357
+				$_credit['nom'].
359 358
 				($_credit['url'] ? '</a>' : '');
360 359
 	}
361 360
 
Please login to merge, or discard this patch.
ecrire/plugins/verifie_conformite.php 2 patches
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -47,7 +47,7 @@  discard block
 block discarded – undo
47 47
 		}
48 48
 	}
49 49
 	if (is_null($p)) {
50
-		$arbre = array('erreur' => array(_T('erreur_plugin_tag_plugin_absent') . " : $plug"));
50
+		$arbre = array('erreur' => array(_T('erreur_plugin_tag_plugin_absent')." : $plug"));
51 51
 		$silence = true;
52 52
 	} else {
53 53
 		$arbre = $p;
@@ -82,15 +82,15 @@  discard block
 block discarded – undo
82 82
 		if (isset($arbre['etat'])) {
83 83
 			$etat = trim(end($arbre['etat']));
84 84
 			if (!in_array($etat, $etats)) {
85
-				$arbre['erreur'][] = _T('erreur_plugin_etat_inconnu') . " : '$etat'";
85
+				$arbre['erreur'][] = _T('erreur_plugin_etat_inconnu')." : '$etat'";
86 86
 			}
87 87
 		}
88 88
 		if (isset($arbre['options'])) {
89 89
 			foreach ($arbre['options'] as $optfile) {
90 90
 				$optfile = trim($optfile);
91
-				if (!@is_readable($dir_plugins . "$plug/$optfile")) {
91
+				if (!@is_readable($dir_plugins."$plug/$optfile")) {
92 92
 					if (!$silence) {
93
-						$arbre['erreur'][] = _T('erreur_plugin_fichier_absent') . " : $optfile";
93
+						$arbre['erreur'][] = _T('erreur_plugin_fichier_absent')." : $optfile";
94 94
 					}
95 95
 				}
96 96
 			}
@@ -98,9 +98,9 @@  discard block
 block discarded – undo
98 98
 		if (isset($arbre['fonctions'])) {
99 99
 			foreach ($arbre['fonctions'] as $optfile) {
100 100
 				$optfile = trim($optfile);
101
-				if (!@is_readable($dir_plugins . "$plug/$optfile")) {
101
+				if (!@is_readable($dir_plugins."$plug/$optfile")) {
102 102
 					if (!$silence) {
103
-						$arbre['erreur'][] = _T('erreur_plugin_fichier_absent') . " : $optfile";
103
+						$arbre['erreur'][] = _T('erreur_plugin_fichier_absent')." : $optfile";
104 104
 					}
105 105
 				}
106 106
 			}
@@ -134,14 +134,14 @@  discard block
 block discarded – undo
134 134
 			// verif que la methode a un nom autorise
135 135
 			if (in_array(strtolower($action), $liste_methodes_reservees)) {
136 136
 				if (!$silence) {
137
-					$arbre['erreur'][] = _T("erreur_plugin_nom_fonction_interdit") . " : $action";
137
+					$arbre['erreur'][] = _T("erreur_plugin_nom_fonction_interdit")." : $action";
138 138
 				}
139 139
 			}
140 140
 			if (isset($pipe['inclure'])) {
141
-				$inclure = $dir_plugins . "$plug/" . $pipe['inclure'];
141
+				$inclure = $dir_plugins."$plug/".$pipe['inclure'];
142 142
 				if (!@is_readable($inclure)) {
143 143
 					if (!$silence) {
144
-						$arbre['erreur'][] = _T('erreur_plugin_fichier_absent') . " : $inclure";
144
+						$arbre['erreur'][] = _T('erreur_plugin_fichier_absent')." : $inclure";
145 145
 					}
146 146
 				}
147 147
 			}
@@ -207,9 +207,9 @@  discard block
 block discarded – undo
207 207
 			foreach ($arbre['noisette'] as $k => $nut) {
208 208
 				$nut = preg_replace(',[.]html$,uims', '', trim($nut));
209 209
 				$arbre['noisette'][$k] = $nut;
210
-				if (!@is_readable($dir_plugins . "$plug/$nut.html")) {
210
+				if (!@is_readable($dir_plugins."$plug/$nut.html")) {
211 211
 					if (!$silence) {
212
-						$arbre['erreur'][] = _T('erreur_plugin_fichier_absent') . " : $nut";
212
+						$arbre['erreur'][] = _T('erreur_plugin_fichier_absent')." : $nut";
213 213
 					}
214 214
 				}
215 215
 			}
Please login to merge, or discard this patch.
Indentation   +203 added lines, -203 removed lines patch added patch discarded remove patch
@@ -11,7 +11,7 @@  discard block
 block discarded – undo
11 11
 \***************************************************************************/
12 12
 
13 13
 if (!defined('_ECRIRE_INC_VERSION')) {
14
-	return;
14
+    return;
15 15
 }
16 16
 
17 17
 include_spip('inc/xml');
@@ -19,208 +19,208 @@  discard block
 block discarded – undo
19 19
 
20 20
 // https://code.spip.net/@plugin_verifie_conformite
21 21
 function plugins_verifie_conformite_dist($plug, &$arbre, $dir_plugins = _DIR_PLUGINS) {
22
-	static $etats = array('dev', 'experimental', 'test', 'stable');
22
+    static $etats = array('dev', 'experimental', 'test', 'stable');
23 23
 
24
-	$matches = array();
25
-	$silence = false;
26
-	$p = null;
27
-	// chercher la declaration <plugin spip='...'> a prendre pour cette version de SPIP
28
-	if ($n = spip_xml_match_nodes(",^plugin(\s|$),", $arbre, $matches)) {
29
-		// version de SPIP
30
-		$vspip = $GLOBALS['spip_version_branche'];
31
-		foreach ($matches as $tag => $sous) {
32
-			list($tagname, $atts) = spip_xml_decompose_tag($tag);
33
-			if ($tagname == 'plugin' and is_array($sous)) {
34
-				// On rajoute la condition sur $n :
35
-				// -- en effet si $n==1 on a pas plus a choisir la balise que l'on ait
36
-				//    un attribut spip ou pas. Cela permet de traiter tous les cas mono-balise
37
-				//    de la meme facon.
38
-				if (!isset($atts['spip'])
39
-					or $n == 1
40
-					or plugin_version_compatible($atts['spip'], $vspip, 'spip')
41
-				) {
42
-					// on prend la derniere declaration avec ce nom
43
-					$p = end($sous);
44
-					$compat_spip = isset($atts['spip']) ? $atts['spip'] : '';
45
-				}
46
-			}
47
-		}
48
-	}
49
-	if (is_null($p)) {
50
-		$arbre = array('erreur' => array(_T('erreur_plugin_tag_plugin_absent') . " : $plug"));
51
-		$silence = true;
52
-	} else {
53
-		$arbre = $p;
54
-	}
55
-	if (!is_array($arbre)) {
56
-		$arbre = array();
57
-	}
58
-	// verification de la conformite du plugin avec quelques
59
-	// precautions elementaires
60
-	if (!isset($arbre['nom'])) {
61
-		if (!$silence) {
62
-			$arbre['erreur'][] = _T('erreur_plugin_nom_manquant');
63
-		}
64
-		$arbre['nom'] = array("");
65
-	}
66
-	if (!isset($arbre['version'])) {
67
-		if (!$silence) {
68
-			$arbre['erreur'][] = _T('erreur_plugin_version_manquant');
69
-		}
70
-		$arbre['version'] = array("");
71
-	}
72
-	if (!isset($arbre['prefix'])) {
73
-		if (!$silence) {
74
-			$arbre['erreur'][] = _T('erreur_plugin_prefix_manquant');
75
-		}
76
-		$arbre['prefix'] = array("");
77
-	} else {
78
-		$prefix = trim(end($arbre['prefix']));
79
-		if (strtoupper($prefix) == 'SPIP' and $plug != "./") {
80
-			$arbre['erreur'][] = _T('erreur_plugin_prefix_interdit');
81
-		}
82
-		if (isset($arbre['etat'])) {
83
-			$etat = trim(end($arbre['etat']));
84
-			if (!in_array($etat, $etats)) {
85
-				$arbre['erreur'][] = _T('erreur_plugin_etat_inconnu') . " : '$etat'";
86
-			}
87
-		}
88
-		if (isset($arbre['options'])) {
89
-			foreach ($arbre['options'] as $optfile) {
90
-				$optfile = trim($optfile);
91
-				if (!@is_readable($dir_plugins . "$plug/$optfile")) {
92
-					if (!$silence) {
93
-						$arbre['erreur'][] = _T('erreur_plugin_fichier_absent') . " : $optfile";
94
-					}
95
-				}
96
-			}
97
-		}
98
-		if (isset($arbre['fonctions'])) {
99
-			foreach ($arbre['fonctions'] as $optfile) {
100
-				$optfile = trim($optfile);
101
-				if (!@is_readable($dir_plugins . "$plug/$optfile")) {
102
-					if (!$silence) {
103
-						$arbre['erreur'][] = _T('erreur_plugin_fichier_absent') . " : $optfile";
104
-					}
105
-				}
106
-			}
107
-		}
108
-		$fonctions = array();
109
-		if (isset($arbre['fonctions'])) {
110
-			$fonctions = $arbre['fonctions'];
111
-		}
112
-		$liste_methodes_reservees = array(
113
-			'__construct',
114
-			'__destruct',
115
-			'plugin',
116
-			'install',
117
-			'uninstall',
118
-			strtolower($prefix)
119
-		);
24
+    $matches = array();
25
+    $silence = false;
26
+    $p = null;
27
+    // chercher la declaration <plugin spip='...'> a prendre pour cette version de SPIP
28
+    if ($n = spip_xml_match_nodes(",^plugin(\s|$),", $arbre, $matches)) {
29
+        // version de SPIP
30
+        $vspip = $GLOBALS['spip_version_branche'];
31
+        foreach ($matches as $tag => $sous) {
32
+            list($tagname, $atts) = spip_xml_decompose_tag($tag);
33
+            if ($tagname == 'plugin' and is_array($sous)) {
34
+                // On rajoute la condition sur $n :
35
+                // -- en effet si $n==1 on a pas plus a choisir la balise que l'on ait
36
+                //    un attribut spip ou pas. Cela permet de traiter tous les cas mono-balise
37
+                //    de la meme facon.
38
+                if (!isset($atts['spip'])
39
+                    or $n == 1
40
+                    or plugin_version_compatible($atts['spip'], $vspip, 'spip')
41
+                ) {
42
+                    // on prend la derniere declaration avec ce nom
43
+                    $p = end($sous);
44
+                    $compat_spip = isset($atts['spip']) ? $atts['spip'] : '';
45
+                }
46
+            }
47
+        }
48
+    }
49
+    if (is_null($p)) {
50
+        $arbre = array('erreur' => array(_T('erreur_plugin_tag_plugin_absent') . " : $plug"));
51
+        $silence = true;
52
+    } else {
53
+        $arbre = $p;
54
+    }
55
+    if (!is_array($arbre)) {
56
+        $arbre = array();
57
+    }
58
+    // verification de la conformite du plugin avec quelques
59
+    // precautions elementaires
60
+    if (!isset($arbre['nom'])) {
61
+        if (!$silence) {
62
+            $arbre['erreur'][] = _T('erreur_plugin_nom_manquant');
63
+        }
64
+        $arbre['nom'] = array("");
65
+    }
66
+    if (!isset($arbre['version'])) {
67
+        if (!$silence) {
68
+            $arbre['erreur'][] = _T('erreur_plugin_version_manquant');
69
+        }
70
+        $arbre['version'] = array("");
71
+    }
72
+    if (!isset($arbre['prefix'])) {
73
+        if (!$silence) {
74
+            $arbre['erreur'][] = _T('erreur_plugin_prefix_manquant');
75
+        }
76
+        $arbre['prefix'] = array("");
77
+    } else {
78
+        $prefix = trim(end($arbre['prefix']));
79
+        if (strtoupper($prefix) == 'SPIP' and $plug != "./") {
80
+            $arbre['erreur'][] = _T('erreur_plugin_prefix_interdit');
81
+        }
82
+        if (isset($arbre['etat'])) {
83
+            $etat = trim(end($arbre['etat']));
84
+            if (!in_array($etat, $etats)) {
85
+                $arbre['erreur'][] = _T('erreur_plugin_etat_inconnu') . " : '$etat'";
86
+            }
87
+        }
88
+        if (isset($arbre['options'])) {
89
+            foreach ($arbre['options'] as $optfile) {
90
+                $optfile = trim($optfile);
91
+                if (!@is_readable($dir_plugins . "$plug/$optfile")) {
92
+                    if (!$silence) {
93
+                        $arbre['erreur'][] = _T('erreur_plugin_fichier_absent') . " : $optfile";
94
+                    }
95
+                }
96
+            }
97
+        }
98
+        if (isset($arbre['fonctions'])) {
99
+            foreach ($arbre['fonctions'] as $optfile) {
100
+                $optfile = trim($optfile);
101
+                if (!@is_readable($dir_plugins . "$plug/$optfile")) {
102
+                    if (!$silence) {
103
+                        $arbre['erreur'][] = _T('erreur_plugin_fichier_absent') . " : $optfile";
104
+                    }
105
+                }
106
+            }
107
+        }
108
+        $fonctions = array();
109
+        if (isset($arbre['fonctions'])) {
110
+            $fonctions = $arbre['fonctions'];
111
+        }
112
+        $liste_methodes_reservees = array(
113
+            '__construct',
114
+            '__destruct',
115
+            'plugin',
116
+            'install',
117
+            'uninstall',
118
+            strtolower($prefix)
119
+        );
120 120
 
121
-		$extraire_pipelines = charger_fonction("extraire_pipelines", "plugins");
122
-		$arbre['pipeline'] = $extraire_pipelines($arbre);
123
-		foreach ($arbre['pipeline'] as $pipe) {
124
-			if (!isset($pipe['nom'])) {
125
-				if (!$silence) {
126
-					$arbre['erreur'][] = _T("erreur_plugin_nom_pipeline_non_defini");
127
-				}
128
-			}
129
-			if (isset($pipe['action'])) {
130
-				$action = $pipe['action'];
131
-			} else {
132
-				$action = $pipe['nom'];
133
-			}
134
-			// verif que la methode a un nom autorise
135
-			if (in_array(strtolower($action), $liste_methodes_reservees)) {
136
-				if (!$silence) {
137
-					$arbre['erreur'][] = _T("erreur_plugin_nom_fonction_interdit") . " : $action";
138
-				}
139
-			}
140
-			if (isset($pipe['inclure'])) {
141
-				$inclure = $dir_plugins . "$plug/" . $pipe['inclure'];
142
-				if (!@is_readable($inclure)) {
143
-					if (!$silence) {
144
-						$arbre['erreur'][] = _T('erreur_plugin_fichier_absent') . " : $inclure";
145
-					}
146
-				}
147
-			}
148
-		}
149
-		$necessite = array();
150
-		$spip_trouve = false;
151
-		if (spip_xml_match_nodes(',^necessite,', $arbre, $needs)) {
152
-			foreach (array_keys($needs) as $tag) {
153
-				list($tag, $att) = spip_xml_decompose_tag($tag);
154
-				if (!isset($att['id'])) {
155
-					if (!$silence) {
156
-						$arbre['erreur'][] = _T('erreur_plugin_attribut_balise_manquant',
157
-							array('attribut' => 'id', 'balise' => $att));
158
-					}
159
-				} else {
160
-					$necessite[] = $att;
161
-				}
162
-				if (strtolower($att['id']) == 'spip') {
163
-					$spip_trouve = true;
164
-				}
165
-			}
166
-		}
167
-		if ($compat_spip and !$spip_trouve) {
168
-			$necessite[] = array('id' => 'spip', 'version' => $compat_spip);
169
-		}
170
-		$arbre['necessite'] = $necessite;
171
-		$utilise = array();
172
-		if (spip_xml_match_nodes(',^utilise,', $arbre, $uses)) {
173
-			foreach (array_keys($uses) as $tag) {
174
-				list($tag, $att) = spip_xml_decompose_tag($tag);
175
-				if (!isset($att['id'])) {
176
-					if (!$silence) {
177
-						$arbre['erreur'][] = _T('erreur_plugin_attribut_balise_manquant',
178
-							array('attribut' => 'id', 'balise' => $att));
179
-					}
180
-				} else {
181
-					$utilise[] = $att;
182
-				}
183
-			}
184
-		}
185
-		$arbre['utilise'] = $utilise;
186
-		$procure = array();
187
-		if (spip_xml_match_nodes(',^procure,', $arbre, $uses)) {
188
-			foreach (array_keys($uses) as $tag) {
189
-				list($tag, $att) = spip_xml_decompose_tag($tag);
190
-				$procure[] = $att;
191
-			}
192
-		}
193
-		$arbre['procure'] = $procure;
194
-		$path = array();
195
-		if (spip_xml_match_nodes(',^chemin,', $arbre, $paths)) {
196
-			foreach (array_keys($paths) as $tag) {
197
-				list($tag, $att) = spip_xml_decompose_tag($tag);
198
-				$att['path'] = $att['dir']; // ancienne syntaxe
199
-				$path[] = $att;
200
-			}
201
-		} else {
202
-			$path = array(array('dir' => ''));
203
-		} // initialiser par defaut
204
-		$arbre['path'] = $path;
205
-		// exposer les noisettes
206
-		if (isset($arbre['noisette'])) {
207
-			foreach ($arbre['noisette'] as $k => $nut) {
208
-				$nut = preg_replace(',[.]html$,uims', '', trim($nut));
209
-				$arbre['noisette'][$k] = $nut;
210
-				if (!@is_readable($dir_plugins . "$plug/$nut.html")) {
211
-					if (!$silence) {
212
-						$arbre['erreur'][] = _T('erreur_plugin_fichier_absent') . " : $nut";
213
-					}
214
-				}
215
-			}
216
-		}
217
-		$traduire = array();
218
-		if (spip_xml_match_nodes(',^traduire,', $arbre, $trads)) {
219
-			foreach (array_keys($trads) as $tag) {
220
-				list($tag, $att) = spip_xml_decompose_tag($tag);
221
-				$traduire[] = $att;
222
-			}
223
-		}
224
-		$arbre['traduire'] = $traduire;
225
-	}
121
+        $extraire_pipelines = charger_fonction("extraire_pipelines", "plugins");
122
+        $arbre['pipeline'] = $extraire_pipelines($arbre);
123
+        foreach ($arbre['pipeline'] as $pipe) {
124
+            if (!isset($pipe['nom'])) {
125
+                if (!$silence) {
126
+                    $arbre['erreur'][] = _T("erreur_plugin_nom_pipeline_non_defini");
127
+                }
128
+            }
129
+            if (isset($pipe['action'])) {
130
+                $action = $pipe['action'];
131
+            } else {
132
+                $action = $pipe['nom'];
133
+            }
134
+            // verif que la methode a un nom autorise
135
+            if (in_array(strtolower($action), $liste_methodes_reservees)) {
136
+                if (!$silence) {
137
+                    $arbre['erreur'][] = _T("erreur_plugin_nom_fonction_interdit") . " : $action";
138
+                }
139
+            }
140
+            if (isset($pipe['inclure'])) {
141
+                $inclure = $dir_plugins . "$plug/" . $pipe['inclure'];
142
+                if (!@is_readable($inclure)) {
143
+                    if (!$silence) {
144
+                        $arbre['erreur'][] = _T('erreur_plugin_fichier_absent') . " : $inclure";
145
+                    }
146
+                }
147
+            }
148
+        }
149
+        $necessite = array();
150
+        $spip_trouve = false;
151
+        if (spip_xml_match_nodes(',^necessite,', $arbre, $needs)) {
152
+            foreach (array_keys($needs) as $tag) {
153
+                list($tag, $att) = spip_xml_decompose_tag($tag);
154
+                if (!isset($att['id'])) {
155
+                    if (!$silence) {
156
+                        $arbre['erreur'][] = _T('erreur_plugin_attribut_balise_manquant',
157
+                            array('attribut' => 'id', 'balise' => $att));
158
+                    }
159
+                } else {
160
+                    $necessite[] = $att;
161
+                }
162
+                if (strtolower($att['id']) == 'spip') {
163
+                    $spip_trouve = true;
164
+                }
165
+            }
166
+        }
167
+        if ($compat_spip and !$spip_trouve) {
168
+            $necessite[] = array('id' => 'spip', 'version' => $compat_spip);
169
+        }
170
+        $arbre['necessite'] = $necessite;
171
+        $utilise = array();
172
+        if (spip_xml_match_nodes(',^utilise,', $arbre, $uses)) {
173
+            foreach (array_keys($uses) as $tag) {
174
+                list($tag, $att) = spip_xml_decompose_tag($tag);
175
+                if (!isset($att['id'])) {
176
+                    if (!$silence) {
177
+                        $arbre['erreur'][] = _T('erreur_plugin_attribut_balise_manquant',
178
+                            array('attribut' => 'id', 'balise' => $att));
179
+                    }
180
+                } else {
181
+                    $utilise[] = $att;
182
+                }
183
+            }
184
+        }
185
+        $arbre['utilise'] = $utilise;
186
+        $procure = array();
187
+        if (spip_xml_match_nodes(',^procure,', $arbre, $uses)) {
188
+            foreach (array_keys($uses) as $tag) {
189
+                list($tag, $att) = spip_xml_decompose_tag($tag);
190
+                $procure[] = $att;
191
+            }
192
+        }
193
+        $arbre['procure'] = $procure;
194
+        $path = array();
195
+        if (spip_xml_match_nodes(',^chemin,', $arbre, $paths)) {
196
+            foreach (array_keys($paths) as $tag) {
197
+                list($tag, $att) = spip_xml_decompose_tag($tag);
198
+                $att['path'] = $att['dir']; // ancienne syntaxe
199
+                $path[] = $att;
200
+            }
201
+        } else {
202
+            $path = array(array('dir' => ''));
203
+        } // initialiser par defaut
204
+        $arbre['path'] = $path;
205
+        // exposer les noisettes
206
+        if (isset($arbre['noisette'])) {
207
+            foreach ($arbre['noisette'] as $k => $nut) {
208
+                $nut = preg_replace(',[.]html$,uims', '', trim($nut));
209
+                $arbre['noisette'][$k] = $nut;
210
+                if (!@is_readable($dir_plugins . "$plug/$nut.html")) {
211
+                    if (!$silence) {
212
+                        $arbre['erreur'][] = _T('erreur_plugin_fichier_absent') . " : $nut";
213
+                    }
214
+                }
215
+            }
216
+        }
217
+        $traduire = array();
218
+        if (spip_xml_match_nodes(',^traduire,', $arbre, $trads)) {
219
+            foreach (array_keys($trads) as $tag) {
220
+                list($tag, $att) = spip_xml_decompose_tag($tag);
221
+                $traduire[] = $att;
222
+            }
223
+        }
224
+        $arbre['traduire'] = $traduire;
225
+    }
226 226
 }
Please login to merge, or discard this patch.
ecrire/plugins/extraire_boutons.php 1 patch
Indentation   +26 added lines, -26 removed lines patch added patch discarded remove patch
@@ -11,7 +11,7 @@  discard block
 block discarded – undo
11 11
 \***************************************************************************/
12 12
 
13 13
 if (!defined('_ECRIRE_INC_VERSION')) {
14
-	return;
14
+    return;
15 15
 }
16 16
 
17 17
 /**
@@ -21,30 +21,30 @@  discard block
 block discarded – undo
21 21
  * @return <type>
22 22
  */
23 23
 function plugins_extraire_boutons_dist($arbre) {
24
-	$ret = array('bouton' => array(), 'onglet' => array());
25
-	// recuperer les boutons et onglets si necessaire
26
-	spip_xml_match_nodes(",^(bouton|onglet)\s,", $arbre, $les_boutons);
27
-	if (is_array($les_boutons) && count($les_boutons)) {
28
-		$ret['bouton'] = array();
29
-		$ret['onglet'] = array();
30
-		foreach ($les_boutons as $bouton => $val) {
31
-			$bouton = spip_xml_decompose_tag($bouton);
32
-			$type = reset($bouton);
33
-			$bouton = end($bouton);
34
-			if (isset($bouton['id'])) {
35
-				$id = $bouton['id'];
36
-				$val = reset($val);
37
-				if (is_array($val)) {
38
-					$ret[$type][$id]['parent'] = isset($bouton['parent']) ? $bouton['parent'] : '';
39
-					$ret[$type][$id]['position'] = isset($bouton['position']) ? $bouton['position'] : '';
40
-					$ret[$type][$id]['titre'] = isset($val['titre']) ? trim(spip_xml_aplatit($val['titre'])) : '';
41
-					$ret[$type][$id]['icone'] = isset($val['icone']) ? trim(end($val['icone'])) : '';
42
-					$ret[$type][$id]['action'] = isset($val['url']) ? trim(end($val['url'])) : '';
43
-					$ret[$type][$id]['parametres'] = isset($val['args']) ? trim(end($val['args'])) : '';
44
-				}
45
-			}
46
-		}
47
-	}
24
+    $ret = array('bouton' => array(), 'onglet' => array());
25
+    // recuperer les boutons et onglets si necessaire
26
+    spip_xml_match_nodes(",^(bouton|onglet)\s,", $arbre, $les_boutons);
27
+    if (is_array($les_boutons) && count($les_boutons)) {
28
+        $ret['bouton'] = array();
29
+        $ret['onglet'] = array();
30
+        foreach ($les_boutons as $bouton => $val) {
31
+            $bouton = spip_xml_decompose_tag($bouton);
32
+            $type = reset($bouton);
33
+            $bouton = end($bouton);
34
+            if (isset($bouton['id'])) {
35
+                $id = $bouton['id'];
36
+                $val = reset($val);
37
+                if (is_array($val)) {
38
+                    $ret[$type][$id]['parent'] = isset($bouton['parent']) ? $bouton['parent'] : '';
39
+                    $ret[$type][$id]['position'] = isset($bouton['position']) ? $bouton['position'] : '';
40
+                    $ret[$type][$id]['titre'] = isset($val['titre']) ? trim(spip_xml_aplatit($val['titre'])) : '';
41
+                    $ret[$type][$id]['icone'] = isset($val['icone']) ? trim(end($val['icone'])) : '';
42
+                    $ret[$type][$id]['action'] = isset($val['url']) ? trim(end($val['url'])) : '';
43
+                    $ret[$type][$id]['parametres'] = isset($val['args']) ? trim(end($val['args'])) : '';
44
+                }
45
+            }
46
+        }
47
+    }
48 48
 
49
-	return $ret;
49
+    return $ret;
50 50
 }
Please login to merge, or discard this patch.
ecrire/plugins/afficher_repertoires.php 2 patches
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -58,8 +58,8 @@  discard block
 block discarded – undo
58 58
 				$plug = $liste_plugins[$key];
59 59
 				$actif = @isset($fast_liste_plugins_actifs[$plug]);
60 60
 				$id = substr(md5($plug), 0, 16);
61
-				$res .= $ligne_plug($url_page, str_replace(_DIR_PLUGINS, '', _DIR_RACINE . $plug), $actif,
62
-						'menu-entree') . "\n";
61
+				$res .= $ligne_plug($url_page, str_replace(_DIR_PLUGINS, '', _DIR_RACINE.$plug), $actif,
62
+						'menu-entree')."\n";
63 63
 				unset($liste_plugins[$key]);
64 64
 			}
65 65
 		}
@@ -101,12 +101,12 @@  discard block
 block discarded – undo
101 101
 	}
102 102
 	$chemin = "";
103 103
 	if (count($tcom)) {
104
-		$chemin .= implode("/", $tcom) . "/";
104
+		$chemin .= implode("/", $tcom)."/";
105 105
 	}
106 106
 	// ouvrir les repertoires jusqu'a la cible
107 107
 	while ($open = array_shift($ttarg)) {
108
-		$visible = @isset($deplie[$chemin . $open]);
109
-		$chemin .= $open . "/";
108
+		$visible = @isset($deplie[$chemin.$open]);
109
+		$chemin .= $open."/";
110 110
 		$output .= "<li>";
111 111
 		$output .= bouton_block_depliable($chemin, $visible);
112 112
 		$output .= debut_block_depliable($visible);
Please login to merge, or discard this patch.
Indentation   +83 added lines, -83 removed lines patch added patch discarded remove patch
@@ -11,64 +11,64 @@  discard block
 block discarded – undo
11 11
 \***************************************************************************/
12 12
 
13 13
 if (!defined('_ECRIRE_INC_VERSION')) {
14
-	return;
14
+    return;
15 15
 }
16 16
 
17 17
 // https://code.spip.net/@affiche_arbre_plugins
18 18
 function plugins_afficher_repertoires_dist($url_page, $liste_plugins, $liste_plugins_actifs) {
19
-	$ligne_plug = charger_fonction('afficher_plugin', 'plugins');
20
-	$racine = basename(_DIR_PLUGINS);
21
-	$init_dir = $current_dir = "";
22
-	// liste des repertoires deplies : construit en remontant l'arbo de chaque plugin actif
23
-	// des qu'un path est deja note deplie on s'arrete
24
-	$deplie = array($racine => true);
25
-	$fast_liste_plugins_actifs = array();
26
-	foreach ($liste_plugins_actifs as $key => $plug) {
27
-		$chemin_plug = chemin_plug($racine, $plug);
28
-		$fast_liste_plugins_actifs[$chemin_plug] = true;
29
-		$dir = dirname($chemin_plug);
30
-		$maxiter = 100;
31
-		while (strlen($dir) && !isset($deplie[$dir]) && $dir != $racine && $maxiter-- > 0) {
32
-			$deplie[$dir] = true;
33
-			$dir = dirname($dir);
34
-		}
35
-	}
19
+    $ligne_plug = charger_fonction('afficher_plugin', 'plugins');
20
+    $racine = basename(_DIR_PLUGINS);
21
+    $init_dir = $current_dir = "";
22
+    // liste des repertoires deplies : construit en remontant l'arbo de chaque plugin actif
23
+    // des qu'un path est deja note deplie on s'arrete
24
+    $deplie = array($racine => true);
25
+    $fast_liste_plugins_actifs = array();
26
+    foreach ($liste_plugins_actifs as $key => $plug) {
27
+        $chemin_plug = chemin_plug($racine, $plug);
28
+        $fast_liste_plugins_actifs[$chemin_plug] = true;
29
+        $dir = dirname($chemin_plug);
30
+        $maxiter = 100;
31
+        while (strlen($dir) && !isset($deplie[$dir]) && $dir != $racine && $maxiter-- > 0) {
32
+            $deplie[$dir] = true;
33
+            $dir = dirname($dir);
34
+        }
35
+    }
36 36
 
37
-	// index repertoires --> plugin
38
-	$dir_index = array();
39
-	foreach ($liste_plugins as $key => $plug) {
40
-		$liste_plugins[$key] = chemin_plug($racine, $plug);
41
-		$dir_index[dirname($liste_plugins[$key])][] = $key;
42
-	}
37
+    // index repertoires --> plugin
38
+    $dir_index = array();
39
+    foreach ($liste_plugins as $key => $plug) {
40
+        $liste_plugins[$key] = chemin_plug($racine, $plug);
41
+        $dir_index[dirname($liste_plugins[$key])][] = $key;
42
+    }
43 43
 
44
-	$visible = @isset($deplie[$current_dir]);
45
-	$maxiter = 1000;
44
+    $visible = @isset($deplie[$current_dir]);
45
+    $maxiter = 1000;
46 46
 
47
-	$res = '';
48
-	while (count($liste_plugins) && $maxiter--) {
49
-		// le rep suivant
50
-		$dir = dirname(reset($liste_plugins));
51
-		if ($dir != $current_dir) {
52
-			$res .= tree_open_close_dir($current_dir, $dir, $deplie);
53
-		}
47
+    $res = '';
48
+    while (count($liste_plugins) && $maxiter--) {
49
+        // le rep suivant
50
+        $dir = dirname(reset($liste_plugins));
51
+        if ($dir != $current_dir) {
52
+            $res .= tree_open_close_dir($current_dir, $dir, $deplie);
53
+        }
54 54
 
55
-		// d'abord tous les plugins du rep courant
56
-		if (isset($dir_index[$current_dir])) {
57
-			foreach ($dir_index[$current_dir] as $key) {
58
-				$plug = $liste_plugins[$key];
59
-				$actif = @isset($fast_liste_plugins_actifs[$plug]);
60
-				$id = substr(md5($plug), 0, 16);
61
-				$res .= $ligne_plug($url_page, str_replace(_DIR_PLUGINS, '', _DIR_RACINE . $plug), $actif,
62
-						'menu-entree') . "\n";
63
-				unset($liste_plugins[$key]);
64
-			}
65
-		}
66
-	}
67
-	$res .= tree_open_close_dir($current_dir, $init_dir, true);
55
+        // d'abord tous les plugins du rep courant
56
+        if (isset($dir_index[$current_dir])) {
57
+            foreach ($dir_index[$current_dir] as $key) {
58
+                $plug = $liste_plugins[$key];
59
+                $actif = @isset($fast_liste_plugins_actifs[$plug]);
60
+                $id = substr(md5($plug), 0, 16);
61
+                $res .= $ligne_plug($url_page, str_replace(_DIR_PLUGINS, '', _DIR_RACINE . $plug), $actif,
62
+                        'menu-entree') . "\n";
63
+                unset($liste_plugins[$key]);
64
+            }
65
+        }
66
+    }
67
+    $res .= tree_open_close_dir($current_dir, $init_dir, true);
68 68
 
69
-	return "<ul class='menu-liste plugins'>"
70
-	. $res
71
-	. "</ul>";
69
+    return "<ul class='menu-liste plugins'>"
70
+    . $res
71
+    . "</ul>";
72 72
 }
73 73
 
74 74
 
@@ -76,44 +76,44 @@  discard block
 block discarded – undo
76 76
 // une fonction pour aider...
77 77
 // https://code.spip.net/@chemin_plug
78 78
 function chemin_plug($racine, $plug) {
79
-	return preg_replace(',[^/]+/\.\./,', '', "$racine/$plug");
79
+    return preg_replace(',[^/]+/\.\./,', '', "$racine/$plug");
80 80
 }
81 81
 
82 82
 // https://code.spip.net/@tree_open_close_dir
83 83
 function tree_open_close_dir(&$current, $target, $deplie = array()) {
84
-	if ($current == $target) {
85
-		return "";
86
-	}
87
-	$tcur = explode("/", $current);
88
-	$ttarg = explode("/", $target);
89
-	$tcom = array();
90
-	$output = "";
91
-	// la partie commune
92
-	while (reset($tcur) == reset($ttarg)) {
93
-		$tcom[] = array_shift($tcur);
94
-		array_shift($ttarg);
95
-	}
96
-	// fermer les repertoires courant jusqu'au point de fork
97
-	while ($close = array_pop($tcur)) {
98
-		$output .= "</ul>\n";
99
-		$output .= fin_block();
100
-		$output .= "</li>\n";
101
-	}
102
-	$chemin = "";
103
-	if (count($tcom)) {
104
-		$chemin .= implode("/", $tcom) . "/";
105
-	}
106
-	// ouvrir les repertoires jusqu'a la cible
107
-	while ($open = array_shift($ttarg)) {
108
-		$visible = @isset($deplie[$chemin . $open]);
109
-		$chemin .= $open . "/";
110
-		$output .= "<li>";
111
-		$output .= bouton_block_depliable($chemin, $visible);
112
-		$output .= debut_block_depliable($visible);
84
+    if ($current == $target) {
85
+        return "";
86
+    }
87
+    $tcur = explode("/", $current);
88
+    $ttarg = explode("/", $target);
89
+    $tcom = array();
90
+    $output = "";
91
+    // la partie commune
92
+    while (reset($tcur) == reset($ttarg)) {
93
+        $tcom[] = array_shift($tcur);
94
+        array_shift($ttarg);
95
+    }
96
+    // fermer les repertoires courant jusqu'au point de fork
97
+    while ($close = array_pop($tcur)) {
98
+        $output .= "</ul>\n";
99
+        $output .= fin_block();
100
+        $output .= "</li>\n";
101
+    }
102
+    $chemin = "";
103
+    if (count($tcom)) {
104
+        $chemin .= implode("/", $tcom) . "/";
105
+    }
106
+    // ouvrir les repertoires jusqu'a la cible
107
+    while ($open = array_shift($ttarg)) {
108
+        $visible = @isset($deplie[$chemin . $open]);
109
+        $chemin .= $open . "/";
110
+        $output .= "<li>";
111
+        $output .= bouton_block_depliable($chemin, $visible);
112
+        $output .= debut_block_depliable($visible);
113 113
 
114
-		$output .= "<ul>\n";
115
-	}
116
-	$current = $target;
114
+        $output .= "<ul>\n";
115
+    }
116
+    $current = $target;
117 117
 
118
-	return $output;
118
+    return $output;
119 119
 }
Please login to merge, or discard this patch.
ecrire/plugins/afficher_liste.php 2 patches
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -64,7 +64,7 @@  discard block
 block discarded – undo
64 64
 	asort($liste_plugins);
65 65
 	$exposed = urldecode(_request('plugin'));
66 66
 
67
-	$block_par_lettre = false;//count($liste_plugins)>10;
67
+	$block_par_lettre = false; //count($liste_plugins)>10;
68 68
 	$fast_liste_plugins_actifs = array();
69 69
 	$fast_liste_plugins_checked = array();
70 70
 	if (is_array($liste_plugins_actifs)) {
@@ -89,9 +89,9 @@  discard block
 block discarded – undo
89 89
 		$actif = isset($fast_liste_plugins_actifs[$plug]);
90 90
 		$checked = isset($fast_liste_plugins_checked[$plug]);
91 91
 		$block_actif = $block_actif | $actif;
92
-		$expose = ($exposed and ($exposed == $plug or $exposed == $dir_plugins . $plug or $exposed == substr($dir_plugins,
93
-					strlen(_DIR_RACINE)) . $plug));
94
-		$block .= $ligne_plug($url_page, $plug, $checked, $actif, $expose, "item", $dir_plugins) . "\n";
92
+		$expose = ($exposed and ($exposed == $plug or $exposed == $dir_plugins.$plug or $exposed == substr($dir_plugins,
93
+					strlen(_DIR_RACINE)).$plug));
94
+		$block .= $ligne_plug($url_page, $plug, $checked, $actif, $expose, "item", $dir_plugins)."\n";
95 95
 	}
96 96
 	$res .= $block_par_lettre ? affiche_block_initiale($initiale, $block, $block_actif) : $block;
97 97
 	$class = basename($dir_plugins);
Please login to merge, or discard this patch.
Indentation   +72 added lines, -72 removed lines patch added patch discarded remove patch
@@ -11,7 +11,7 @@  discard block
 block discarded – undo
11 11
 \***************************************************************************/
12 12
 
13 13
 if (!defined('_ECRIRE_INC_VERSION')) {
14
-	return;
14
+    return;
15 15
 }
16 16
 include_spip('inc/charsets');
17 17
 
@@ -28,88 +28,88 @@  discard block
 block discarded – undo
28 28
  * @return string
29 29
  */
30 30
 function plugins_afficher_liste_dist(
31
-	$url_page,
32
-	$liste_plugins,
33
-	$liste_plugins_checked,
34
-	$liste_plugins_actifs,
35
-	$dir_plugins = _DIR_PLUGINS,
36
-	$afficher_un = 'afficher_plugin'
31
+    $url_page,
32
+    $liste_plugins,
33
+    $liste_plugins_checked,
34
+    $liste_plugins_actifs,
35
+    $dir_plugins = _DIR_PLUGINS,
36
+    $afficher_un = 'afficher_plugin'
37 37
 ) {
38
-	$get_infos = charger_fonction('get_infos', 'plugins');
39
-	$ligne_plug = charger_fonction($afficher_un, 'plugins');
38
+    $get_infos = charger_fonction('get_infos', 'plugins');
39
+    $ligne_plug = charger_fonction($afficher_un, 'plugins');
40 40
 
41
-	$all_infos = $get_infos($liste_plugins, false, $dir_plugins);
41
+    $all_infos = $get_infos($liste_plugins, false, $dir_plugins);
42 42
 
43
-	$all_infos = pipeline('filtrer_liste_plugins',
44
-		array(
45
-			'args' => array(
46
-				'liste_plugins' => $liste_plugins,
47
-				'liste_plugins_checked' => $liste_plugins_checked,
48
-				'liste_plugins_actifs' => $liste_plugins_actifs,
49
-				'dir_plugins' => $dir_plugins
50
-			),
51
-			'data' => $all_infos
52
-		)
53
-	);
43
+    $all_infos = pipeline('filtrer_liste_plugins',
44
+        array(
45
+            'args' => array(
46
+                'liste_plugins' => $liste_plugins,
47
+                'liste_plugins_checked' => $liste_plugins_checked,
48
+                'liste_plugins_actifs' => $liste_plugins_actifs,
49
+                'dir_plugins' => $dir_plugins
50
+            ),
51
+            'data' => $all_infos
52
+        )
53
+    );
54 54
 
55
-	$liste_plugins = array_flip($liste_plugins);
56
-	foreach ($liste_plugins as $chemin => $v) {
57
-		// des plugins ont pu etre enleves de la liste par le pipeline. On en tient compte.
58
-		if (isset($all_infos[$chemin])) {
59
-			$liste_plugins[$chemin] = strtoupper(trim(typo(translitteration(unicode2charset(html2unicode($all_infos[$chemin]['nom']))))));
60
-		} else {
61
-			unset($liste_plugins[$chemin]);
62
-		}
63
-	}
64
-	asort($liste_plugins);
65
-	$exposed = urldecode(_request('plugin'));
55
+    $liste_plugins = array_flip($liste_plugins);
56
+    foreach ($liste_plugins as $chemin => $v) {
57
+        // des plugins ont pu etre enleves de la liste par le pipeline. On en tient compte.
58
+        if (isset($all_infos[$chemin])) {
59
+            $liste_plugins[$chemin] = strtoupper(trim(typo(translitteration(unicode2charset(html2unicode($all_infos[$chemin]['nom']))))));
60
+        } else {
61
+            unset($liste_plugins[$chemin]);
62
+        }
63
+    }
64
+    asort($liste_plugins);
65
+    $exposed = urldecode(_request('plugin'));
66 66
 
67
-	$block_par_lettre = false;//count($liste_plugins)>10;
68
-	$fast_liste_plugins_actifs = array();
69
-	$fast_liste_plugins_checked = array();
70
-	if (is_array($liste_plugins_actifs)) {
71
-		$fast_liste_plugins_actifs = array_flip($liste_plugins_actifs);
72
-	}
73
-	if (is_array($liste_plugins_checked)) {
74
-		$fast_liste_plugins_checked = array_flip($liste_plugins_checked);
75
-	}
67
+    $block_par_lettre = false;//count($liste_plugins)>10;
68
+    $fast_liste_plugins_actifs = array();
69
+    $fast_liste_plugins_checked = array();
70
+    if (is_array($liste_plugins_actifs)) {
71
+        $fast_liste_plugins_actifs = array_flip($liste_plugins_actifs);
72
+    }
73
+    if (is_array($liste_plugins_checked)) {
74
+        $fast_liste_plugins_checked = array_flip($liste_plugins_checked);
75
+    }
76 76
 
77
-	$res = '';
78
-	$block = '';
79
-	$initiale = '';
80
-	$block_actif = false;
81
-	foreach ($liste_plugins as $plug => $nom) {
82
-		if (($i = substr($nom, 0, 1)) !== $initiale) {
83
-			$res .= $block_par_lettre ? affiche_block_initiale($initiale, $block, $block_actif) : $block;
84
-			$initiale = $i;
85
-			$block = '';
86
-			$block_actif = false;
87
-		}
88
-		// le rep suivant
89
-		$actif = isset($fast_liste_plugins_actifs[$plug]);
90
-		$checked = isset($fast_liste_plugins_checked[$plug]);
91
-		$block_actif = $block_actif | $actif;
92
-		$expose = ($exposed and ($exposed == $plug or $exposed == $dir_plugins . $plug or $exposed == substr($dir_plugins,
93
-					strlen(_DIR_RACINE)) . $plug));
94
-		$block .= $ligne_plug($url_page, $plug, $checked, $actif, $expose, "item", $dir_plugins) . "\n";
95
-	}
96
-	$res .= $block_par_lettre ? affiche_block_initiale($initiale, $block, $block_actif) : $block;
97
-	$class = basename($dir_plugins);
77
+    $res = '';
78
+    $block = '';
79
+    $initiale = '';
80
+    $block_actif = false;
81
+    foreach ($liste_plugins as $plug => $nom) {
82
+        if (($i = substr($nom, 0, 1)) !== $initiale) {
83
+            $res .= $block_par_lettre ? affiche_block_initiale($initiale, $block, $block_actif) : $block;
84
+            $initiale = $i;
85
+            $block = '';
86
+            $block_actif = false;
87
+        }
88
+        // le rep suivant
89
+        $actif = isset($fast_liste_plugins_actifs[$plug]);
90
+        $checked = isset($fast_liste_plugins_checked[$plug]);
91
+        $block_actif = $block_actif | $actif;
92
+        $expose = ($exposed and ($exposed == $plug or $exposed == $dir_plugins . $plug or $exposed == substr($dir_plugins,
93
+                    strlen(_DIR_RACINE)) . $plug));
94
+        $block .= $ligne_plug($url_page, $plug, $checked, $actif, $expose, "item", $dir_plugins) . "\n";
95
+    }
96
+    $res .= $block_par_lettre ? affiche_block_initiale($initiale, $block, $block_actif) : $block;
97
+    $class = basename($dir_plugins);
98 98
 
99
-	return $res ? "<ul class='liste-items plugins $class'>$res</ul>" : "";
99
+    return $res ? "<ul class='liste-items plugins $class'>$res</ul>" : "";
100 100
 }
101 101
 
102 102
 
103 103
 // https://code.spip.net/@affiche_block_initiale
104 104
 function affiche_block_initiale($initiale, $block, $block_actif) {
105
-	if (strlen($block)) {
106
-		return "<li class='item'>"
107
-		. bouton_block_depliable($initiale, $block_actif ? true : false)
108
-		. debut_block_depliable($block_actif)
109
-		. "<ul>$block</ul>"
110
-		. fin_block()
111
-		. "</li>";
112
-	}
105
+    if (strlen($block)) {
106
+        return "<li class='item'>"
107
+        . bouton_block_depliable($initiale, $block_actif ? true : false)
108
+        . debut_block_depliable($block_actif)
109
+        . "<ul>$block</ul>"
110
+        . fin_block()
111
+        . "</li>";
112
+    }
113 113
 
114
-	return "";
114
+    return "";
115 115
 }
Please login to merge, or discard this patch.
ecrire/urls/page.php 2 patches
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -23,7 +23,7 @@  discard block
 block discarded – undo
23 23
 # attention toutefois seuls '' et '=' figurent dans les modes de compatibilite
24 24
 define('_separateur_urls_page', '');
25 25
 # on peut indiquer '' si on a installe le .htaccess
26
-define('_debut_urls_page', get_spip_script('./') . '?');
26
+define('_debut_urls_page', get_spip_script('./').'?');
27 27
 #######
28 28
 
29 29
 
@@ -37,14 +37,14 @@  discard block
 block discarded – undo
37 37
 		}
38 38
 	}
39 39
 
40
-	$url = _debut_urls_page . $type . _separateur_urls_page
41
-		. $id . _terminaison_urls_page;
40
+	$url = _debut_urls_page.$type._separateur_urls_page
41
+		. $id._terminaison_urls_page;
42 42
 
43 43
 	if ($args) {
44 44
 		$args = strpos($url, '?') ? "&$args" : "?$args";
45 45
 	}
46 46
 
47
-	return _DIR_RACINE . $url . $args . ($ancre ? "#$ancre" : '');
47
+	return _DIR_RACINE.$url.$args.($ancre ? "#$ancre" : '');
48 48
 }
49 49
 
50 50
 // retrouve le fond et les parametres d'une URL abregee
Please login to merge, or discard this patch.
Indentation   +53 added lines, -53 removed lines patch added patch discarded remove patch
@@ -11,7 +11,7 @@  discard block
 block discarded – undo
11 11
 \***************************************************************************/
12 12
 
13 13
 if (!defined('_ECRIRE_INC_VERSION')) {
14
-	return;
14
+    return;
15 15
 }
16 16
 
17 17
 define('URLS_PAGE_EXEMPLE', 'spip.php?article12');
@@ -30,74 +30,74 @@  discard block
 block discarded – undo
30 30
 // https://code.spip.net/@_generer_url_page
31 31
 function _generer_url_page($type, $id, $args = '', $ancre = '') {
32 32
 
33
-	if ($generer_url_externe = charger_fonction("generer_url_$type", 'urls', true)) {
34
-		$url = $generer_url_externe($id, $args, $ancre);
35
-		if (null != $url) {
36
-			return $url;
37
-		}
38
-	}
33
+    if ($generer_url_externe = charger_fonction("generer_url_$type", 'urls', true)) {
34
+        $url = $generer_url_externe($id, $args, $ancre);
35
+        if (null != $url) {
36
+            return $url;
37
+        }
38
+    }
39 39
 
40
-	$url = _debut_urls_page . $type . _separateur_urls_page
41
-		. $id . _terminaison_urls_page;
40
+    $url = _debut_urls_page . $type . _separateur_urls_page
41
+        . $id . _terminaison_urls_page;
42 42
 
43
-	if ($args) {
44
-		$args = strpos($url, '?') ? "&$args" : "?$args";
45
-	}
43
+    if ($args) {
44
+        $args = strpos($url, '?') ? "&$args" : "?$args";
45
+    }
46 46
 
47
-	return _DIR_RACINE . $url . $args . ($ancre ? "#$ancre" : '');
47
+    return _DIR_RACINE . $url . $args . ($ancre ? "#$ancre" : '');
48 48
 }
49 49
 
50 50
 // retrouve le fond et les parametres d'une URL abregee
51 51
 // le contexte deja existant est fourni dans args sous forme de tableau ou query string
52 52
 // https://code.spip.net/@urls_page_dist
53 53
 function urls_page_dist($i, &$entite, $args = '', $ancre = '') {
54
-	if (is_numeric($i)) {
55
-		return _generer_url_page($entite, $i, $args, $ancre);
56
-	}
54
+    if (is_numeric($i)) {
55
+        return _generer_url_page($entite, $i, $args, $ancre);
56
+    }
57 57
 
58
-	// traiter les injections du type domaine.org/spip.php/cestnimportequoi/ou/encore/plus/rubrique23
59
-	if ($GLOBALS['profondeur_url'] > 0 and $entite == 'sommaire') {
60
-		return array(array(), '404');
61
-	}
58
+    // traiter les injections du type domaine.org/spip.php/cestnimportequoi/ou/encore/plus/rubrique23
59
+    if ($GLOBALS['profondeur_url'] > 0 and $entite == 'sommaire') {
60
+        return array(array(), '404');
61
+    }
62 62
 
63
-	// voir s'il faut recuperer le id_* implicite et les &debut_xx;
64
-	if (is_array($args)) {
65
-		$contexte = $args;
66
-	} else {
67
-		parse_str($args, $contexte);
68
-	}
69
-	include_spip('inc/urls');
70
-	$r = nettoyer_url_page($i, $contexte);
71
-	if ($r) {
72
-		array_pop($r); // nettoyer_url_page renvoie un argument de plus inutile ici
73
-		return $r;
74
-	}
63
+    // voir s'il faut recuperer le id_* implicite et les &debut_xx;
64
+    if (is_array($args)) {
65
+        $contexte = $args;
66
+    } else {
67
+        parse_str($args, $contexte);
68
+    }
69
+    include_spip('inc/urls');
70
+    $r = nettoyer_url_page($i, $contexte);
71
+    if ($r) {
72
+        array_pop($r); // nettoyer_url_page renvoie un argument de plus inutile ici
73
+        return $r;
74
+    }
75 75
 
76
-	/*
76
+    /*
77 77
 	 * Le bloc qui suit sert a faciliter les transitions depuis
78 78
 	 * le mode 'urls-propres' vers les modes 'urls-standard' et 'url-html'
79 79
 	 * Il est inutile de le recopier si vous personnalisez vos URLs
80 80
 	 * et votre .htaccess
81 81
 	 */
82
-	// Si on est revenu en mode html, mais c'est une ancienne url_propre
83
-	// on ne redirige pas, on assume le nouveau contexte (si possible)
84
-	$url = $i;
85
-	$url_propre = isset($url)
86
-		? $url
87
-		: (isset($_SERVER['REDIRECT_url_propre'])
88
-			? $_SERVER['REDIRECT_url_propre']
89
-			: (isset($_ENV['url_propre'])
90
-				? $_ENV['url_propre']
91
-				: ''
92
-			));
93
-	if ($url_propre) {
94
-		if ($GLOBALS['profondeur_url'] <= 0) {
95
-			$urls_anciennes = charger_fonction('propres', 'urls', true);
96
-		} else {
97
-			$urls_anciennes = charger_fonction('arbo', 'urls', true);
98
-		}
82
+    // Si on est revenu en mode html, mais c'est une ancienne url_propre
83
+    // on ne redirige pas, on assume le nouveau contexte (si possible)
84
+    $url = $i;
85
+    $url_propre = isset($url)
86
+        ? $url
87
+        : (isset($_SERVER['REDIRECT_url_propre'])
88
+            ? $_SERVER['REDIRECT_url_propre']
89
+            : (isset($_ENV['url_propre'])
90
+                ? $_ENV['url_propre']
91
+                : ''
92
+            ));
93
+    if ($url_propre) {
94
+        if ($GLOBALS['profondeur_url'] <= 0) {
95
+            $urls_anciennes = charger_fonction('propres', 'urls', true);
96
+        } else {
97
+            $urls_anciennes = charger_fonction('arbo', 'urls', true);
98
+        }
99 99
 
100
-		return $urls_anciennes ? $urls_anciennes($url_propre, $entite, $contexte) : '';
101
-	}
102
-	/* Fin du bloc compatibilite url-propres */
100
+        return $urls_anciennes ? $urls_anciennes($url_propre, $entite, $contexte) : '';
101
+    }
102
+    /* Fin du bloc compatibilite url-propres */
103 103
 }
Please login to merge, or discard this patch.