Completed
Push — master ( 410b54...85a1b0 )
by cam
01:12
created
ecrire/balise/menu_lang.php 1 patch
Indentation   +8 added lines, -8 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
 /**
@@ -37,7 +37,7 @@  discard block
 block discarded – undo
37 37
  *     Pile complétée du code compilé
38 38
  **/
39 39
 function balise_MENU_LANG($p) {
40
-	return calculer_balise_dynamique($p, 'MENU_LANG', array('lang'));
40
+    return calculer_balise_dynamique($p, 'MENU_LANG', array('lang'));
41 41
 }
42 42
 
43 43
 /**
@@ -55,11 +55,11 @@  discard block
 block discarded – undo
55 55
  *   Liste (lang) des arguments collectés et fournis.
56 56
  */
57 57
 function balise_MENU_LANG_stat($args, $context_compil) {
58
-	if (strpos($GLOBALS['meta']['langues_multilingue'], ',') === false) {
59
-		return '';
60
-	}
58
+    if (strpos($GLOBALS['meta']['langues_multilingue'], ',') === false) {
59
+        return '';
60
+    }
61 61
 
62
-	return $args;
62
+    return $args;
63 63
 }
64 64
 
65 65
 /**
@@ -75,7 +75,7 @@  discard block
 block discarded – undo
75 75
  *     Liste : Chemin du squelette, durée du cache, contexte
76 76
  **/
77 77
 function balise_MENU_LANG_dyn($opt) {
78
-	include_spip('balise/menu_lang_ecrire');
78
+    include_spip('balise/menu_lang_ecrire');
79 79
 
80
-	return menu_lang_pour_tous('var_lang', $opt);
80
+    return menu_lang_pour_tous('var_lang', $opt);
81 81
 }
Please login to merge, or discard this patch.
ecrire/auth/ldap.php 1 patch
Indentation   +175 added lines, -175 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
 // Authentifie via LDAP et retourne la ligne SQL decrivant l'utilisateur si ok
@@ -25,12 +25,12 @@  discard block
 block discarded – undo
25 25
 // Attributs LDAP correspondants a ceux de SPIP, notamment pour le login
26 26
 // ne pas ecraser une definition perso dans mes_options
27 27
 if (!isset($GLOBALS['ldap_attributes']) or !is_array($GLOBALS['ldap_attributes'])) {
28
-	$GLOBALS['ldap_attributes'] = array(
29
-		'login' => array('sAMAccountName', 'uid', 'login', 'userid', 'cn', 'sn'),
30
-		'nom' => "cn",
31
-		'email' => "mail",
32
-		'bio' => "description"
33
-	);
28
+    $GLOBALS['ldap_attributes'] = array(
29
+        'login' => array('sAMAccountName', 'uid', 'login', 'userid', 'cn', 'sn'),
30
+        'nom' => "cn",
31
+        'email' => "mail",
32
+        'bio' => "description"
33
+    );
34 34
 }
35 35
 
36 36
 /**
@@ -56,49 +56,49 @@  discard block
 block discarded – undo
56 56
  */
57 57
 function auth_ldap_dist($login, $pass, $serveur = '', $phpauth = false) {
58 58
 
59
-	#spip_log("ldap $login " . ($pass ? "mdp fourni" : "mdp absent"));
60
-
61
-	// Utilisateur connu ?
62
-	// si http auth, inutile de reauthentifier: cela
63
-	// ne marchera pas avec auth http autre que basic.
64
-	$checkpass = isset($_SERVER["REMOTE_USER"]) ? false : true;
65
-	if (!($dn = auth_ldap_search($login, $pass, $checkpass, $serveur))) {
66
-		return array();
67
-	}
68
-	$credentials_ldap = array('ldap_dn' => $dn, 'ldap_password' => $pass);
69
-
70
-	// Si l'utilisateur figure deja dans la base, y recuperer les infos
71
-	$r = sql_fetsel("*", "spip_auteurs", "login=" . sql_quote($login) . " AND source='ldap'", '', '', '', '', $serveur);
72
-
73
-	if ($r) {
74
-		return array_merge($r, $credentials_ldap);
75
-	}
76
-
77
-	// sinon importer les infos depuis LDAP, 
78
-
79
-	if ($GLOBALS['meta']["ldap_statut_import"]
80
-		and $desc = auth_ldap_retrouver($dn, array(), $serveur)
81
-	) {
82
-		// rajouter le statut indique  a l'install
83
-		$desc['statut'] = $GLOBALS['meta']["ldap_statut_import"];
84
-		$desc['login'] = $login;
85
-		$desc['source'] = 'ldap';
86
-		$desc['pass'] = '';
87
-
88
-		$r = sql_insertq('spip_auteurs', $desc, '', $serveur);
89
-	}
90
-
91
-	if ($r) {
92
-		return array_merge(
93
-			$credentials_ldap,
94
-			sql_fetsel("*", "spip_auteurs", "id_auteur=" . intval($r), '', '', '', '', $serveur)
95
-		);
96
-	}
97
-
98
-	// sinon echec
99
-	spip_log("Creation de l'auteur '$login' impossible");
100
-
101
-	return array();
59
+    #spip_log("ldap $login " . ($pass ? "mdp fourni" : "mdp absent"));
60
+
61
+    // Utilisateur connu ?
62
+    // si http auth, inutile de reauthentifier: cela
63
+    // ne marchera pas avec auth http autre que basic.
64
+    $checkpass = isset($_SERVER["REMOTE_USER"]) ? false : true;
65
+    if (!($dn = auth_ldap_search($login, $pass, $checkpass, $serveur))) {
66
+        return array();
67
+    }
68
+    $credentials_ldap = array('ldap_dn' => $dn, 'ldap_password' => $pass);
69
+
70
+    // Si l'utilisateur figure deja dans la base, y recuperer les infos
71
+    $r = sql_fetsel("*", "spip_auteurs", "login=" . sql_quote($login) . " AND source='ldap'", '', '', '', '', $serveur);
72
+
73
+    if ($r) {
74
+        return array_merge($r, $credentials_ldap);
75
+    }
76
+
77
+    // sinon importer les infos depuis LDAP, 
78
+
79
+    if ($GLOBALS['meta']["ldap_statut_import"]
80
+        and $desc = auth_ldap_retrouver($dn, array(), $serveur)
81
+    ) {
82
+        // rajouter le statut indique  a l'install
83
+        $desc['statut'] = $GLOBALS['meta']["ldap_statut_import"];
84
+        $desc['login'] = $login;
85
+        $desc['source'] = 'ldap';
86
+        $desc['pass'] = '';
87
+
88
+        $r = sql_insertq('spip_auteurs', $desc, '', $serveur);
89
+    }
90
+
91
+    if ($r) {
92
+        return array_merge(
93
+            $credentials_ldap,
94
+            sql_fetsel("*", "spip_auteurs", "id_auteur=" . intval($r), '', '', '', '', $serveur)
95
+        );
96
+    }
97
+
98
+    // sinon echec
99
+    spip_log("Creation de l'auteur '$login' impossible");
100
+
101
+    return array();
102 102
 }
103 103
 
104 104
 /**
@@ -112,36 +112,36 @@  discard block
 block discarded – undo
112 112
  * @return array
113 113
  */
114 114
 function auth_ldap_connect($serveur = '') {
115
-	include_spip('base/connect_sql');
116
-	static $connexions_ldap = array();
117
-	if (isset($connexions_ldap[$serveur])) {
118
-		return $connexions_ldap[$serveur];
119
-	}
120
-	$connexion = spip_connect($serveur);
121
-	if (!is_array($connexion['ldap'])) {
122
-		if ($connexion['authentification']['ldap']) {
123
-			$f = _DIR_CONNECT . $connexion['authentification']['ldap'];
124
-			unset($GLOBALS['ldap_link']);
125
-			if (is_readable($f)) {
126
-				include_once($f);
127
-			};
128
-			if (isset($GLOBALS['ldap_link'])) {
129
-				$connexion['ldap'] = array(
130
-					'link' => $GLOBALS['ldap_link'],
131
-					'base' => $GLOBALS['ldap_base']
132
-				);
133
-			} else {
134
-				spip_log("connection LDAP $serveur mal definie dans $f");
135
-			}
136
-			if (isset($GLOBALS['ldap_champs'])) {
137
-				$connexion['ldap']['attributes'] = $GLOBALS['ldap_champs'];
138
-			}
139
-		} else {
140
-			spip_log("connection LDAP $serveur inconnue");
141
-		}
142
-	}
143
-
144
-	return $connexions_ldap[$serveur] = $connexion['ldap'];
115
+    include_spip('base/connect_sql');
116
+    static $connexions_ldap = array();
117
+    if (isset($connexions_ldap[$serveur])) {
118
+        return $connexions_ldap[$serveur];
119
+    }
120
+    $connexion = spip_connect($serveur);
121
+    if (!is_array($connexion['ldap'])) {
122
+        if ($connexion['authentification']['ldap']) {
123
+            $f = _DIR_CONNECT . $connexion['authentification']['ldap'];
124
+            unset($GLOBALS['ldap_link']);
125
+            if (is_readable($f)) {
126
+                include_once($f);
127
+            };
128
+            if (isset($GLOBALS['ldap_link'])) {
129
+                $connexion['ldap'] = array(
130
+                    'link' => $GLOBALS['ldap_link'],
131
+                    'base' => $GLOBALS['ldap_base']
132
+                );
133
+            } else {
134
+                spip_log("connection LDAP $serveur mal definie dans $f");
135
+            }
136
+            if (isset($GLOBALS['ldap_champs'])) {
137
+                $connexion['ldap']['attributes'] = $GLOBALS['ldap_champs'];
138
+            }
139
+        } else {
140
+            spip_log("connection LDAP $serveur inconnue");
141
+        }
142
+    }
143
+
144
+    return $connexions_ldap[$serveur] = $connexion['ldap'];
145 145
 }
146 146
 
147 147
 /**
@@ -155,52 +155,52 @@  discard block
 block discarded – undo
155 155
  *    Le login trouvé ou chaine vide si non trouvé
156 156
  */
157 157
 function auth_ldap_search($login, $pass, $checkpass = true, $serveur = '') {
158
-	// Securite anti-injection et contre un serveur LDAP laxiste
159
-	$login_search = preg_replace("/[^-@._\s\d\w]/", "", $login);
160
-	if (!strlen($login_search) or ($checkpass and !strlen($pass))) {
161
-		return '';
162
-	}
163
-
164
-	// verifier la connexion
165
-	if (!$ldap = auth_ldap_connect($serveur)) {
166
-		return '';
167
-	}
168
-
169
-	$ldap_link = isset($ldap['link']) ? $ldap['link'] : null;
170
-	$ldap_base = isset($ldap['base']) ? $ldap['base'] : null;
171
-	$desc = isset($ldap['attributes']) && $ldap['attributes'] ? $ldap['attributes'] : $GLOBALS['ldap_attributes'] ;
172
-
173
-	$logins = is_array($desc['login']) ? $desc['login'] : array($desc['login']);
174
-
175
-	// Tenter une recherche pour essayer de retrouver le DN
176
-	foreach ($logins as $att) {
177
-		$result = @ldap_search($ldap_link, $ldap_base, "$att=$login_search", array("dn"));
178
-		$info = @ldap_get_entries($ldap_link, $result);
179
-		// Ne pas accepter les resultats si plus d'une entree
180
-		// (on veut un attribut unique)
181
-
182
-		if (is_array($info) and $info['count'] == 1) {
183
-			$dn = $info[0]['dn'];
184
-			if (!$checkpass) {
185
-				return $dn;
186
-			}
187
-			if (@ldap_bind($ldap_link, $dn, $pass)) {
188
-				return $dn;
189
-			}
190
-		}
191
-	}
192
-
193
-	if ($checkpass and !isset($dn)) {
194
-		// Si echec, essayer de deviner le DN
195
-		foreach ($logins as $att) {
196
-			$dn = "$att=$login_search, $ldap_base";
197
-			if (@ldap_bind($ldap_link, $dn, $pass)) {
198
-				return "$att=$login_search, $ldap_base";
199
-			}
200
-		}
201
-	}
202
-
203
-	return '';
158
+    // Securite anti-injection et contre un serveur LDAP laxiste
159
+    $login_search = preg_replace("/[^-@._\s\d\w]/", "", $login);
160
+    if (!strlen($login_search) or ($checkpass and !strlen($pass))) {
161
+        return '';
162
+    }
163
+
164
+    // verifier la connexion
165
+    if (!$ldap = auth_ldap_connect($serveur)) {
166
+        return '';
167
+    }
168
+
169
+    $ldap_link = isset($ldap['link']) ? $ldap['link'] : null;
170
+    $ldap_base = isset($ldap['base']) ? $ldap['base'] : null;
171
+    $desc = isset($ldap['attributes']) && $ldap['attributes'] ? $ldap['attributes'] : $GLOBALS['ldap_attributes'] ;
172
+
173
+    $logins = is_array($desc['login']) ? $desc['login'] : array($desc['login']);
174
+
175
+    // Tenter une recherche pour essayer de retrouver le DN
176
+    foreach ($logins as $att) {
177
+        $result = @ldap_search($ldap_link, $ldap_base, "$att=$login_search", array("dn"));
178
+        $info = @ldap_get_entries($ldap_link, $result);
179
+        // Ne pas accepter les resultats si plus d'une entree
180
+        // (on veut un attribut unique)
181
+
182
+        if (is_array($info) and $info['count'] == 1) {
183
+            $dn = $info[0]['dn'];
184
+            if (!$checkpass) {
185
+                return $dn;
186
+            }
187
+            if (@ldap_bind($ldap_link, $dn, $pass)) {
188
+                return $dn;
189
+            }
190
+        }
191
+    }
192
+
193
+    if ($checkpass and !isset($dn)) {
194
+        // Si echec, essayer de deviner le DN
195
+        foreach ($logins as $att) {
196
+            $dn = "$att=$login_search, $ldap_base";
197
+            if (@ldap_bind($ldap_link, $dn, $pass)) {
198
+                return "$att=$login_search, $ldap_base";
199
+            }
200
+        }
201
+    }
202
+
203
+    return '';
204 204
 }
205 205
 
206 206
 /**
@@ -212,40 +212,40 @@  discard block
 block discarded – undo
212 212
  * @return array
213 213
  */
214 214
 function auth_ldap_retrouver($dn, $desc = array(), $serveur = '') {
215
-	// Lire les infos sur l'utilisateur a partir de son DN depuis LDAP
215
+    // Lire les infos sur l'utilisateur a partir de son DN depuis LDAP
216 216
 
217
-	if (!$ldap = spip_connect_ldap($serveur)) {
218
-		spip_log("ldap $serveur injoignable");
217
+    if (!$ldap = spip_connect_ldap($serveur)) {
218
+        spip_log("ldap $serveur injoignable");
219 219
 
220
-		return array();
221
-	}
220
+        return array();
221
+    }
222 222
 
223
-	$ldap_link = $ldap['link'];
224
-	if (!$desc) {
225
-		$desc = $ldap['attributes'] ? $ldap['attributes'] : $GLOBALS['ldap_attributes'];
226
-		unset($desc['login']);
227
-	}
228
-	$result = @ldap_read($ldap_link, $dn, "objectClass=*", array_values($desc));
223
+    $ldap_link = $ldap['link'];
224
+    if (!$desc) {
225
+        $desc = $ldap['attributes'] ? $ldap['attributes'] : $GLOBALS['ldap_attributes'];
226
+        unset($desc['login']);
227
+    }
228
+    $result = @ldap_read($ldap_link, $dn, "objectClass=*", array_values($desc));
229 229
 
230
-	if (!$result) {
231
-		return array();
232
-	}
230
+    if (!$result) {
231
+        return array();
232
+    }
233 233
 
234
-	// Recuperer les donnees du premier (unique?) compte de l'auteur
235
-	$val = @ldap_get_entries($ldap_link, $result);
236
-	if (!is_array($val) or !is_array($val[0])) {
237
-		return array();
238
-	}
239
-	$val = $val[0];
234
+    // Recuperer les donnees du premier (unique?) compte de l'auteur
235
+    $val = @ldap_get_entries($ldap_link, $result);
236
+    if (!is_array($val) or !is_array($val[0])) {
237
+        return array();
238
+    }
239
+    $val = $val[0];
240 240
 
241
-	// Convertir depuis UTF-8 (jeu de caracteres par defaut)
242
-	include_spip('inc/charsets');
241
+    // Convertir depuis UTF-8 (jeu de caracteres par defaut)
242
+    include_spip('inc/charsets');
243 243
 
244
-	foreach ($desc as $k => $v) {
245
-		$desc[$k] = importer_charset($val[strtolower($v)][0], 'utf-8');
246
-	}
244
+    foreach ($desc as $k => $v) {
245
+        $desc[$k] = importer_charset($val[strtolower($v)][0], 'utf-8');
246
+    }
247 247
 
248
-	return $desc;
248
+    return $desc;
249 249
 }
250 250
 
251 251
 
@@ -257,7 +257,7 @@  discard block
 block discarded – undo
257 257
  * @return string
258 258
  */
259 259
 function auth_ldap_retrouver_login($login, $serveur = '') {
260
-	return auth_ldap_search($login, '', false, $serveur) ? $login : '';
260
+    return auth_ldap_search($login, '', false, $serveur) ? $login : '';
261 261
 }
262 262
 
263 263
 /**
@@ -277,9 +277,9 @@  discard block
 block discarded – undo
277 277
  *   Message d'erreur si login non valide, chaîne vide sinon
278 278
  */
279 279
 function auth_ldap_verifier_pass($login, $new_pass, $id_auteur = 0, $serveur = '') {
280
-	include_spip('auth/spip');
280
+    include_spip('auth/spip');
281 281
 
282
-	return auth_spip_verifier_pass($login, $new_pass, $id_auteur, $serveur);
282
+    return auth_spip_verifier_pass($login, $new_pass, $id_auteur, $serveur);
283 283
 }
284 284
 
285 285
 /**
@@ -300,7 +300,7 @@  discard block
 block discarded – undo
300 300
  *   ```
301 301
  */
302 302
 function auth_ldap_autoriser_modifier_pass($serveur = '') {
303
-	return true;
303
+    return true;
304 304
 }
305 305
 
306 306
 /**
@@ -318,23 +318,23 @@  discard block
 block discarded – undo
318 318
  *    Informe du succès ou de l'echec du changement du mot de passe
319 319
  */
320 320
 function auth_ldap_modifier_pass($login, $new_pass, $id_auteur, $serveur = '') {
321
-	if (is_null($new_pass) or auth_ldap_verifier_pass($login, $new_pass, $id_auteur, $serveur) != '') {
322
-		return false;
323
-	}
324
-	if (!$ldap = auth_ldap_connect($serveur)) {
325
-		return '';
326
-	}
327
-	$link = $ldap['link'];
328
-	include_spip("inc/session");
329
-	$dn = session_get('ldap_dn');
330
-	if ('' == $dn) {
331
-		return false;
332
-	}
333
-	if (!ldap_bind($link, $dn, session_get('ldap_password'))) {
334
-		return false;
335
-	}
336
-	$encoded_pass = "{MD5}" . base64_encode(pack("H*", md5($new_pass)));
337
-	$success = ldap_mod_replace($link, $dn, array('userPassword' => $encoded_pass));
338
-
339
-	return $success;
321
+    if (is_null($new_pass) or auth_ldap_verifier_pass($login, $new_pass, $id_auteur, $serveur) != '') {
322
+        return false;
323
+    }
324
+    if (!$ldap = auth_ldap_connect($serveur)) {
325
+        return '';
326
+    }
327
+    $link = $ldap['link'];
328
+    include_spip("inc/session");
329
+    $dn = session_get('ldap_dn');
330
+    if ('' == $dn) {
331
+        return false;
332
+    }
333
+    if (!ldap_bind($link, $dn, session_get('ldap_password'))) {
334
+        return false;
335
+    }
336
+    $encoded_pass = "{MD5}" . base64_encode(pack("H*", md5($new_pass)));
337
+    $success = ldap_mod_replace($link, $dn, array('userPassword' => $encoded_pass));
338
+
339
+    return $success;
340 340
 }
Please login to merge, or discard this patch.
ecrire/plugins/infos_plugin.php 1 patch
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.
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 1 patch
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.
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/xml/interfaces.php 1 patch
Indentation   +16 added lines, -16 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('_REGEXP_DOCTYPE',
@@ -33,14 +33,14 @@  discard block
 block discarded – undo
33 33
 define('_REGEXP_ENTITY_DEF', '/^%(' . _SUB_REGEXP_SYMBOL . '+);/');
34 34
 define('_REGEXP_TYPE_XML', 'PUBLIC|SYSTEM|INCLUDE|IGNORE|CDATA');
35 35
 define('_REGEXP_ENTITY_DECL', '/^<!ENTITY\s+(%?)\s*(' .
36
-	_SUB_REGEXP_SYMBOL .
37
-	'+;?)\s+(' .
38
-	_REGEXP_TYPE_XML .
39
-	')?\s*(' .
40
-	"('([^']*)')" .
41
-	'|("([^"]*)")' .
42
-	'|\s*(%' . _SUB_REGEXP_SYMBOL . '+;)\s*' .
43
-	')\s*(--.*?--)?("([^"]*)")?\s*>\s*(.*)$/s');
36
+    _SUB_REGEXP_SYMBOL .
37
+    '+;?)\s+(' .
38
+    _REGEXP_TYPE_XML .
39
+    ')?\s*(' .
40
+    "('([^']*)')" .
41
+    '|("([^"]*)")' .
42
+    '|\s*(%' . _SUB_REGEXP_SYMBOL . '+;)\s*' .
43
+    ')\s*(--.*?--)?("([^"]*)")?\s*>\s*(.*)$/s');
44 44
 
45 45
 define('_REGEXP_INCLUDE_USE', '/^<!\[\s*%\s*([^;]*);\s*\[\s*(.*)$/s');
46 46
 
@@ -50,11 +50,11 @@  discard block
 block discarded – undo
50 50
  * Document Type Compilation
51 51
  **/
52 52
 class DTC {
53
-	public $macros = array();
54
-	public $elements = array();
55
-	public $peres = array();
56
-	public $attributs = array();
57
-	public $entites = array();
58
-	public $regles = array();
59
-	public $pcdata = array();
53
+    public $macros = array();
54
+    public $elements = array();
55
+    public $peres = array();
56
+    public $attributs = array();
57
+    public $entites = array();
58
+    public $regles = array();
59
+    public $pcdata = array();
60 60
 }
Please login to merge, or discard this patch.
ecrire/public/evaluer_page.php 1 patch
Indentation   +55 added lines, -55 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
 /**
@@ -33,64 +33,64 @@  discard block
 block discarded – undo
33 33
 // Cas d'une page contenant du PHP :
34 34
 if (empty($page['process_ins']) or $page['process_ins'] != 'html') {
35 35
 
36
-	include_spip('inc/lang');
36
+    include_spip('inc/lang');
37 37
 
38
-	// restaurer l'etat des notes avant calcul
39
-	if (isset($page['notes'])
40
-		and $page['notes']
41
-		and $notes = charger_fonction("notes", "inc", true)
42
-	) {
43
-		$notes($page['notes'], 'restaurer_etat');
44
-	}
45
-	ob_start();
46
-	if (strpos($page['texte'], '?xml') !== false) {
47
-		$page['texte'] = str_replace('<' . '?xml', "<\1?xml", $page['texte']);
48
-	}
38
+    // restaurer l'etat des notes avant calcul
39
+    if (isset($page['notes'])
40
+        and $page['notes']
41
+        and $notes = charger_fonction("notes", "inc", true)
42
+    ) {
43
+        $notes($page['notes'], 'restaurer_etat');
44
+    }
45
+    ob_start();
46
+    if (strpos($page['texte'], '?xml') !== false) {
47
+        $page['texte'] = str_replace('<' . '?xml', "<\1?xml", $page['texte']);
48
+    }
49 49
 
50
-	try {
51
-		$res = eval('?' . '>' . $page['texte']);
52
-		// error catching 5.2<=PHP<7
53
-		if ($res === false
54
-		  and function_exists('error_get_last')
55
-		  and ($erreur = error_get_last()) ) {
56
-			$code = $page['texte'];
57
-			$GLOBALS['numero_ligne_php'] = 1;
58
-			if (!function_exists('numerote_ligne_php')){
59
-				function numerote_ligne_php($match){
60
-					$GLOBALS['numero_ligne_php']++;
61
-					return "\n/*".str_pad($GLOBALS['numero_ligne_php'],3,"0",STR_PAD_LEFT)."*/";
62
-				}
63
-			}
64
-			$code = "/*001*/".preg_replace_callback(",\n,","numerote_ligne_php",$code);
65
-			$code = trim(highlight_string($code,true));
66
-			erreur_squelette("L".$erreur['line'].": ".$erreur['message']."<br />".$code,array($page['source'],'',$erreur['file'],'',$GLOBALS['spip_lang']));
67
-			$page['texte'] = "<!-- Erreur -->";
68
-		}
69
-		else {
70
-			$page['texte'] = ob_get_contents();
71
-		}
72
-	}
73
-	catch (Exception $e){
74
-		$code = $page['texte'];
75
-		$GLOBALS['numero_ligne_php'] = 1;
76
-		if (!function_exists('numerote_ligne_php')){
77
-			function numerote_ligne_php($match){
78
-				$GLOBALS['numero_ligne_php']++;
79
-				return "\n/*".str_pad($GLOBALS['numero_ligne_php'],3,"0",STR_PAD_LEFT)."*/";
80
-			}
81
-		}
82
-		$code = "/*001*/".preg_replace_callback(",\n,","numerote_ligne_php",$code);
83
-		$code = trim(highlight_string($code,true));
84
-		erreur_squelette("L".$e->getLine().": ".$e->getMessage()."<br />".$code,array($page['source'],'',$e->getFile(),'',$GLOBALS['spip_lang']));
85
-		$page['texte'] = "<!-- Erreur -->";
86
-	}
87
-	ob_end_clean();
50
+    try {
51
+        $res = eval('?' . '>' . $page['texte']);
52
+        // error catching 5.2<=PHP<7
53
+        if ($res === false
54
+          and function_exists('error_get_last')
55
+          and ($erreur = error_get_last()) ) {
56
+            $code = $page['texte'];
57
+            $GLOBALS['numero_ligne_php'] = 1;
58
+            if (!function_exists('numerote_ligne_php')){
59
+                function numerote_ligne_php($match){
60
+                    $GLOBALS['numero_ligne_php']++;
61
+                    return "\n/*".str_pad($GLOBALS['numero_ligne_php'],3,"0",STR_PAD_LEFT)."*/";
62
+                }
63
+            }
64
+            $code = "/*001*/".preg_replace_callback(",\n,","numerote_ligne_php",$code);
65
+            $code = trim(highlight_string($code,true));
66
+            erreur_squelette("L".$erreur['line'].": ".$erreur['message']."<br />".$code,array($page['source'],'',$erreur['file'],'',$GLOBALS['spip_lang']));
67
+            $page['texte'] = "<!-- Erreur -->";
68
+        }
69
+        else {
70
+            $page['texte'] = ob_get_contents();
71
+        }
72
+    }
73
+    catch (Exception $e){
74
+        $code = $page['texte'];
75
+        $GLOBALS['numero_ligne_php'] = 1;
76
+        if (!function_exists('numerote_ligne_php')){
77
+            function numerote_ligne_php($match){
78
+                $GLOBALS['numero_ligne_php']++;
79
+                return "\n/*".str_pad($GLOBALS['numero_ligne_php'],3,"0",STR_PAD_LEFT)."*/";
80
+            }
81
+        }
82
+        $code = "/*001*/".preg_replace_callback(",\n,","numerote_ligne_php",$code);
83
+        $code = trim(highlight_string($code,true));
84
+        erreur_squelette("L".$e->getLine().": ".$e->getMessage()."<br />".$code,array($page['source'],'',$e->getFile(),'',$GLOBALS['spip_lang']));
85
+        $page['texte'] = "<!-- Erreur -->";
86
+    }
87
+    ob_end_clean();
88 88
 
89
-	$page['process_ins'] = 'html';
89
+    $page['process_ins'] = 'html';
90 90
 
91
-	if (strpos($page['texte'], '?xml') !== false) {
92
-		$page['texte'] = str_replace("<\1?xml", '<' . '?xml', $page['texte']);
93
-	}
91
+    if (strpos($page['texte'], '?xml') !== false) {
92
+        $page['texte'] = str_replace("<\1?xml", '<' . '?xml', $page['texte']);
93
+    }
94 94
 }
95 95
 
96 96
 page_base_href($page['texte']);
Please login to merge, or discard this patch.
ecrire/public/admin.php 1 patch
Indentation   +22 added lines, -22 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
 /**
@@ -34,32 +34,32 @@  discard block
 block discarded – undo
34 34
  *     Contenu HTML, avec boutons d'administrations et sa CSS
35 35
  **/
36 36
 function affiche_boutons_admin($contenu) {
37
-	include_spip('inc/filtres');
37
+    include_spip('inc/filtres');
38 38
 
39
-	// Inserer le css d'admin
40
-	$css = "<link rel='stylesheet' href='" . url_absolue(direction_css(find_in_path('spip_admin.css')))
41
-		. "' type='text/css' />\n";
42
-	if ($f = find_in_path('spip_admin_perso.css')) {
43
-		$css .= "<link rel='stylesheet' href='"
44
-			. url_absolue(direction_css($f)) . "' type='text/css' />\n";
45
-	}
39
+    // Inserer le css d'admin
40
+    $css = "<link rel='stylesheet' href='" . url_absolue(direction_css(find_in_path('spip_admin.css')))
41
+        . "' type='text/css' />\n";
42
+    if ($f = find_in_path('spip_admin_perso.css')) {
43
+        $css .= "<link rel='stylesheet' href='"
44
+            . url_absolue(direction_css($f)) . "' type='text/css' />\n";
45
+    }
46 46
 
47
-	($pos = stripos($contenu, '</head>'))
48
-	|| ($pos = stripos($contenu, '<body>'))
49
-	|| ($pos = 0);
50
-	$contenu = substr_replace($contenu, $css, $pos, 0);
47
+    ($pos = stripos($contenu, '</head>'))
48
+    || ($pos = stripos($contenu, '<body>'))
49
+    || ($pos = 0);
50
+    $contenu = substr_replace($contenu, $css, $pos, 0);
51 51
 
52 52
 
53
-	// Inserer la balise #FORMULAIRE_ADMIN, en float
54
-	$boutons_admin = inclure_balise_dynamique(
55
-		balise_FORMULAIRE_ADMIN_dyn('spip-admin-float'),
56
-		false);
53
+    // Inserer la balise #FORMULAIRE_ADMIN, en float
54
+    $boutons_admin = inclure_balise_dynamique(
55
+        balise_FORMULAIRE_ADMIN_dyn('spip-admin-float'),
56
+        false);
57 57
 
58
-	($pos = strripos($contenu, '</body>'))
59
-	|| ($pos = strripos($contenu, '</html>'))
60
-	|| ($pos = strlen($contenu));
61
-	$contenu = substr_replace($contenu, $boutons_admin, $pos, 0);
58
+    ($pos = strripos($contenu, '</body>'))
59
+    || ($pos = strripos($contenu, '</html>'))
60
+    || ($pos = strlen($contenu));
61
+    $contenu = substr_replace($contenu, $boutons_admin, $pos, 0);
62 62
 
63 63
 
64
-	return $contenu;
64
+    return $contenu;
65 65
 }
Please login to merge, or discard this patch.