Completed
Push — master ( fb0017...92433c )
by cam
01:14
created
ecrire/inc/admin.php 2 patches
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -55,7 +55,7 @@  discard block
 block discarded – undo
55 55
 		if ($res) {
56 56
 			return $res;
57 57
 		}
58
-		spip_log("meta: $script " . print_r($_POST, true));
58
+		spip_log("meta: $script ".print_r($_POST, true));
59 59
 		ecrire_meta($script, serialize($_POST));
60 60
 	}
61 61
 
@@ -124,7 +124,7 @@  discard block
 block discarded – undo
124 124
 	}
125 125
 	// on pourrait statuer automatiquement les webmestres a l'init d'une action auth par ftp ... ?
126 126
 
127
-	spip_log("admin $pref" . ($valeur ? ' (reprise)' : ' (init)'), $journal);
127
+	spip_log("admin $pref".($valeur ? ' (reprise)' : ' (init)'), $journal);
128 128
 
129 129
 	return '';
130 130
 }
@@ -142,7 +142,7 @@  discard block
 block discarded – undo
142 142
 	if (autoriser('configurer')) {
143 143
 		return _DIR_TMP;
144 144
 	} else {
145
-		return _DIR_TRANSFERT . $GLOBALS['visiteur_session']['login'] . '/';
145
+		return _DIR_TRANSFERT.$GLOBALS['visiteur_session']['login'].'/';
146 146
 	}
147 147
 }
148 148
 
@@ -160,8 +160,8 @@  discard block
 block discarded – undo
160 160
  *     Nom du fichier
161 161
  **/
162 162
 function fichier_admin($action, $pref = 'admin_') {
163
-	return $pref .
164
-	substr(md5($action . (time() & ~2047) . $GLOBALS['visiteur_session']['login']), 0, 10);
163
+	return $pref.
164
+	substr(md5($action.(time() & ~2047).$GLOBALS['visiteur_session']['login']), 0, 10);
165 165
 }
166 166
 
167 167
 /**
@@ -194,7 +194,7 @@  discard block
 block discarded – undo
194 194
 	} else {
195 195
 		$dir = dir_admin();
196 196
 		$signal = fichier_admin($script);
197
-		if (@file_exists($dir . $signal)) {
197
+		if (@file_exists($dir.$signal)) {
198 198
 			spip_log("Action admin: $action");
199 199
 
200 200
 			return '';
@@ -212,7 +212,7 @@  discard block
 block discarded – undo
212 212
 
213 213
 				return '';
214 214
 			}
215
-			$corps .= '<input type="hidden" name="validation_admin" value="' . $signal . '" />';
215
+			$corps .= '<input type="hidden" name="validation_admin" value="'.$signal.'" />';
216 216
 			$suivant = _T('bouton_valider');
217 217
 			$js = '';
218 218
 		} else {
@@ -227,7 +227,7 @@  discard block
 block discarded – undo
227 227
 				. "</legend>\n<label for='fichier'>"
228 228
 				. _T('info_creer_repertoire')
229 229
 				. "</label>\n"
230
-				. "<span id='signal' class='formo'>" . $signal . '</span>'
230
+				. "<span id='signal' class='formo'>".$signal.'</span>'
231 231
 				. "<input type='hidden' id='fichier' name='fichier' value='"
232 232
 				. $signal
233 233
 				. "' />"
@@ -264,7 +264,7 @@  discard block
 block discarded – undo
264 264
  *     Nom de l'action (en base) qui a été exécutée
265 265
  **/
266 266
 function fin_admin($action) {
267
-	$signal = dir_admin() . fichier_admin($action);
267
+	$signal = dir_admin().fichier_admin($action);
268 268
 	spip_unlink($signal);
269 269
 	if ($action != 'delete_all') {
270 270
 		effacer_meta($action);
@@ -292,8 +292,8 @@  discard block
 block discarded – undo
292 292
 	include_spip('inc/filtres');
293 293
 	foreach (array_merge($_POST, $_GET) as $n => $c) {
294 294
 		if (!in_array($n, ['fichier', 'exec', 'validation_admin']) and !is_array($c)) {
295
-			$suite .= "\n<input type='hidden' name='" . spip_htmlspecialchars($n) . "' value='" .
296
-				entites_html($c) .
295
+			$suite .= "\n<input type='hidden' name='".spip_htmlspecialchars($n)."' value='".
296
+				entites_html($c).
297 297
 				"'  />";
298 298
 		}
299 299
 	}
Please login to merge, or discard this patch.
Indentation   +129 added lines, -129 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
 /**
@@ -45,29 +45,29 @@  discard block
 block discarded – undo
45 45
  *     sinon code HTML de la page après le traitement effectué.
46 46
  **/
47 47
 function inc_admin_dist($script, $titre, $comment = '', $anonymous = false) {
48
-	$reprise = true;
49
-	if (
50
-		!isset($GLOBALS['meta'][$script])
51
-		or !isset($GLOBALS['meta']['admin'])
52
-	) {
53
-		$reprise = false;
54
-		$res = debut_admin($script, $titre, $comment);
55
-		if ($res) {
56
-			return $res;
57
-		}
58
-		spip_log("meta: $script " . print_r($_POST, true));
59
-		ecrire_meta($script, serialize($_POST));
60
-	}
48
+    $reprise = true;
49
+    if (
50
+        !isset($GLOBALS['meta'][$script])
51
+        or !isset($GLOBALS['meta']['admin'])
52
+    ) {
53
+        $reprise = false;
54
+        $res = debut_admin($script, $titre, $comment);
55
+        if ($res) {
56
+            return $res;
57
+        }
58
+        spip_log("meta: $script " . print_r($_POST, true));
59
+        ecrire_meta($script, serialize($_POST));
60
+    }
61 61
 
62
-	$res = admin_verifie_session($script, $anonymous);
63
-	if ($res) {
64
-		return $res;
65
-	}
66
-	$base = charger_fonction($script, 'base');
67
-	$base($titre, $reprise);
68
-	fin_admin($script);
62
+    $res = admin_verifie_session($script, $anonymous);
63
+    if ($res) {
64
+        return $res;
65
+    }
66
+    $base = charger_fonction($script, 'base');
67
+    $base($titre, $reprise);
68
+    fin_admin($script);
69 69
 
70
-	return '';
70
+    return '';
71 71
 }
72 72
 
73 73
 /**
@@ -98,35 +98,35 @@  discard block
 block discarded – undo
98 98
  *     Code HTML si message d'erreur, '' sinon;
99 99
  */
100 100
 function admin_verifie_session($script, $anonymous = false) {
101
-	include_spip('base/abstract_sql');
102
-	$pref = sprintf('_%d_', $GLOBALS['visiteur_session']['id_auteur']);
103
-	$signal = fichier_admin($script, "$script$pref");
104
-	$valeur = sql_getfetsel('valeur', 'spip_meta', "nom='admin'");
105
-	if ($valeur === null) {
106
-		ecrire_meta('admin', $signal, 'non');
107
-	} else {
108
-		if (!$anonymous and ($valeur != $signal)) {
109
-			if (
110
-				!preg_match('/^(.*)_(\d+)_/', $GLOBALS['meta']['admin'], $l)
111
-				or intval($l[2]) != $GLOBALS['visiteur_session']['id_auteur']
112
-			) {
113
-				include_spip('inc/minipres');
114
-				spip_log("refus de lancer $script, priorite a $valeur");
101
+    include_spip('base/abstract_sql');
102
+    $pref = sprintf('_%d_', $GLOBALS['visiteur_session']['id_auteur']);
103
+    $signal = fichier_admin($script, "$script$pref");
104
+    $valeur = sql_getfetsel('valeur', 'spip_meta', "nom='admin'");
105
+    if ($valeur === null) {
106
+        ecrire_meta('admin', $signal, 'non');
107
+    } else {
108
+        if (!$anonymous and ($valeur != $signal)) {
109
+            if (
110
+                !preg_match('/^(.*)_(\d+)_/', $GLOBALS['meta']['admin'], $l)
111
+                or intval($l[2]) != $GLOBALS['visiteur_session']['id_auteur']
112
+            ) {
113
+                include_spip('inc/minipres');
114
+                spip_log("refus de lancer $script, priorite a $valeur");
115 115
 
116
-				return minipres(_T('info_travaux_texte'), '', ['status' => 503]);
117
-			}
118
-		}
119
-	}
120
-	$journal = 'spip';
121
-	if (autoriser('configurer')) {
122
-		// c'est une action webmestre, soit par ftp soit par statut webmestre
123
-		$journal = 'webmestre';
124
-	}
125
-	// on pourrait statuer automatiquement les webmestres a l'init d'une action auth par ftp ... ?
116
+                return minipres(_T('info_travaux_texte'), '', ['status' => 503]);
117
+            }
118
+        }
119
+    }
120
+    $journal = 'spip';
121
+    if (autoriser('configurer')) {
122
+        // c'est une action webmestre, soit par ftp soit par statut webmestre
123
+        $journal = 'webmestre';
124
+    }
125
+    // on pourrait statuer automatiquement les webmestres a l'init d'une action auth par ftp ... ?
126 126
 
127
-	spip_log("admin $pref" . ($valeur ? ' (reprise)' : ' (init)'), $journal);
127
+    spip_log("admin $pref" . ($valeur ? ' (reprise)' : ' (init)'), $journal);
128 128
 
129
-	return '';
129
+    return '';
130 130
 }
131 131
 
132 132
 /**
@@ -139,11 +139,11 @@  discard block
 block discarded – undo
139 139
  *     Chemin du répertoire.
140 140
  **/
141 141
 function dir_admin() {
142
-	if (autoriser('configurer')) {
143
-		return _DIR_TMP;
144
-	} else {
145
-		return _DIR_TRANSFERT . $GLOBALS['visiteur_session']['login'] . '/';
146
-	}
142
+    if (autoriser('configurer')) {
143
+        return _DIR_TMP;
144
+    } else {
145
+        return _DIR_TRANSFERT . $GLOBALS['visiteur_session']['login'] . '/';
146
+    }
147 147
 }
148 148
 
149 149
 /**
@@ -160,8 +160,8 @@  discard block
 block discarded – undo
160 160
  *     Nom du fichier
161 161
  **/
162 162
 function fichier_admin($action, $pref = 'admin_') {
163
-	return $pref .
164
-	substr(md5($action . (time() & ~2047) . $GLOBALS['visiteur_session']['login']), 0, 10);
163
+    return $pref .
164
+    substr(md5($action . (time() & ~2047) . $GLOBALS['visiteur_session']['login']), 0, 10);
165 165
 }
166 166
 
167 167
 /**
@@ -187,73 +187,73 @@  discard block
 block discarded – undo
187 187
  *     sinon chaîne vide si déjà fait.
188 188
  **/
189 189
 function debut_admin($script, $action = '', $corps = '') {
190
-	if ((!$action) || !(autoriser('webmestre') or autoriser('chargerftp'))) {
191
-		include_spip('inc/minipres');
190
+    if ((!$action) || !(autoriser('webmestre') or autoriser('chargerftp'))) {
191
+        include_spip('inc/minipres');
192 192
 
193
-		return minipres();
194
-	} else {
195
-		$dir = dir_admin();
196
-		$signal = fichier_admin($script);
197
-		if (@file_exists($dir . $signal)) {
198
-			spip_log("Action admin: $action");
193
+        return minipres();
194
+    } else {
195
+        $dir = dir_admin();
196
+        $signal = fichier_admin($script);
197
+        if (@file_exists($dir . $signal)) {
198
+            spip_log("Action admin: $action");
199 199
 
200
-			return '';
201
-		}
202
-		include_spip('inc/minipres');
200
+            return '';
201
+        }
202
+        include_spip('inc/minipres');
203 203
 
204
-		// Si on est un super-admin, un bouton de validation suffit
205
-		// sauf dans les cas destroy
206
-		if (
207
-			(autoriser('webmestre') or $script === 'repair')
208
-			and $script != 'delete_all'
209
-		) {
210
-			if (_request('validation_admin') == $signal) {
211
-				spip_log("Action super-admin: $action");
204
+        // Si on est un super-admin, un bouton de validation suffit
205
+        // sauf dans les cas destroy
206
+        if (
207
+            (autoriser('webmestre') or $script === 'repair')
208
+            and $script != 'delete_all'
209
+        ) {
210
+            if (_request('validation_admin') == $signal) {
211
+                spip_log("Action super-admin: $action");
212 212
 
213
-				return '';
214
-			}
215
-			$corps .= '<input type="hidden" name="validation_admin" value="' . $signal . '" />';
216
-			$suivant = _T('bouton_valider');
217
-			$js = '';
218
-		} else {
219
-			// cet appel permet d'assurer un copier-coller du nom du repertoire a creer dans tmp (esj)
220
-			// l'insertion du script a cet endroit n'est pas xhtml licite
221
-			// mais evite de l'embarquer dans toutes les pages minipres
222
-			$corps .= http_script('', 'spip_barre.js');
213
+                return '';
214
+            }
215
+            $corps .= '<input type="hidden" name="validation_admin" value="' . $signal . '" />';
216
+            $suivant = _T('bouton_valider');
217
+            $js = '';
218
+        } else {
219
+            // cet appel permet d'assurer un copier-coller du nom du repertoire a creer dans tmp (esj)
220
+            // l'insertion du script a cet endroit n'est pas xhtml licite
221
+            // mais evite de l'embarquer dans toutes les pages minipres
222
+            $corps .= http_script('', 'spip_barre.js');
223 223
 
224
-			$corps .= '<fieldset><legend>'
225
-				. _T('info_authentification_ftp')
226
-				. aider('ftp_auth')
227
-				. "</legend>\n<label for='fichier'>"
228
-				. _T('info_creer_repertoire')
229
-				. "</label>\n"
230
-				. "<span id='signal' class='formo'>" . $signal . '</span>'
231
-				. "<input type='hidden' id='fichier' name='fichier' value='"
232
-				. $signal
233
-				. "' />"
234
-				. _T('info_creer_repertoire_2', ['repertoire' => joli_repertoire($dir)])
235
-				. '</fieldset>';
224
+            $corps .= '<fieldset><legend>'
225
+                . _T('info_authentification_ftp')
226
+                . aider('ftp_auth')
227
+                . "</legend>\n<label for='fichier'>"
228
+                . _T('info_creer_repertoire')
229
+                . "</label>\n"
230
+                . "<span id='signal' class='formo'>" . $signal . '</span>'
231
+                . "<input type='hidden' id='fichier' name='fichier' value='"
232
+                . $signal
233
+                . "' />"
234
+                . _T('info_creer_repertoire_2', ['repertoire' => joli_repertoire($dir)])
235
+                . '</fieldset>';
236 236
 
237
-			$suivant = _T('bouton_recharger_page');
237
+            $suivant = _T('bouton_recharger_page');
238 238
 
239
-			// code volontairement tordu:
240
-			// provoquer la copie dans le presse papier du nom du repertoire
241
-			// en remettant a vide le champ pour que ca marche aussi en cas
242
-			// de JavaScript inactif.
243
-			$js = " onload='var range=document.createRange(); var signal = document.getElementById(\"signal\"); var userSelection = window.getSelection(); range.setStart(signal,0); range.setEnd(signal,1); userSelection.addRange(range);'";
244
-		}
239
+            // code volontairement tordu:
240
+            // provoquer la copie dans le presse papier du nom du repertoire
241
+            // en remettant a vide le champ pour que ca marche aussi en cas
242
+            // de JavaScript inactif.
243
+            $js = " onload='var range=document.createRange(); var signal = document.getElementById(\"signal\"); var userSelection = window.getSelection(); range.setStart(signal,0); range.setEnd(signal,1); userSelection.addRange(range);'";
244
+        }
245 245
 
246
-		// admin/xxx correspond
247
-		// a exec/base_xxx de preference
248
-		// et exec/xxx sinon (compat)
249
-		if (tester_url_ecrire("base_$script")) {
250
-			$script = "base_$script";
251
-		}
252
-		$form = copy_request($script, $corps, $suivant);
253
-		$info_action = _T('info_action', ['action' => "$action"]);
246
+        // admin/xxx correspond
247
+        // a exec/base_xxx de preference
248
+        // et exec/xxx sinon (compat)
249
+        if (tester_url_ecrire("base_$script")) {
250
+            $script = "base_$script";
251
+        }
252
+        $form = copy_request($script, $corps, $suivant);
253
+        $info_action = _T('info_action', ['action' => "$action"]);
254 254
 
255
-		return minipres($info_action, $form, ['onload' => $js]);
256
-	}
255
+        return minipres($info_action, $form, ['onload' => $js]);
256
+    }
257 257
 }
258 258
 
259 259
 /**
@@ -264,13 +264,13 @@  discard block
 block discarded – undo
264 264
  *     Nom de l'action (en base) qui a été exécutée
265 265
  **/
266 266
 function fin_admin($action) {
267
-	$signal = dir_admin() . fichier_admin($action);
268
-	spip_unlink($signal);
269
-	if ($action != 'delete_all') {
270
-		effacer_meta($action);
271
-		effacer_meta('admin');
272
-		spip_log("efface les meta admin et $action ");
273
-	}
267
+    $signal = dir_admin() . fichier_admin($action);
268
+    spip_unlink($signal);
269
+    if ($action != 'delete_all') {
270
+        effacer_meta($action);
271
+        effacer_meta('admin');
272
+        spip_log("efface les meta admin et $action ");
273
+    }
274 274
 }
275 275
 
276 276
 /**
@@ -289,14 +289,14 @@  discard block
 block discarded – undo
289 289
  *     Code HTML du formulaire
290 290
  **/
291 291
 function copy_request($script, $suite, $submit = '') {
292
-	include_spip('inc/filtres');
293
-	foreach (array_merge($_POST, $_GET) as $n => $c) {
294
-		if (!in_array($n, ['fichier', 'exec', 'validation_admin']) and !is_array($c)) {
295
-			$suite .= "\n<input type='hidden' name='" . spip_htmlspecialchars($n) . "' value='" .
296
-				entites_html($c) .
297
-				"'  />";
298
-		}
299
-	}
292
+    include_spip('inc/filtres');
293
+    foreach (array_merge($_POST, $_GET) as $n => $c) {
294
+        if (!in_array($n, ['fichier', 'exec', 'validation_admin']) and !is_array($c)) {
295
+            $suite .= "\n<input type='hidden' name='" . spip_htmlspecialchars($n) . "' value='" .
296
+                entites_html($c) .
297
+                "'  />";
298
+        }
299
+    }
300 300
 
301
-	return generer_form_ecrire($script, $suite, '', $submit);
301
+    return generer_form_ecrire($script, $suite, '', $submit);
302 302
 }
Please login to merge, or discard this patch.
ecrire/inc/flock.php 3 patches
Spacing   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -122,7 +122,7 @@  discard block
 block discarded – undo
122 122
 		$contenu = @gzfile($fichier);
123 123
 	}
124 124
 
125
-	return is_array($contenu) ? join('', $contenu) : (string)$contenu;
125
+	return is_array($contenu) ? join('', $contenu) : (string) $contenu;
126 126
 }
127 127
 
128 128
 
@@ -315,9 +315,9 @@  discard block
 block discarded – undo
315 315
  */
316 316
 function ecrire_fichier_securise($fichier, $contenu, $ecrire_quand_meme = false, $truncate = true) {
317 317
 	if (substr($fichier, -4) !== '.php') {
318
-		spip_log('Erreur de programmation: ' . $fichier . ' doit finir par .php');
318
+		spip_log('Erreur de programmation: '.$fichier.' doit finir par .php');
319 319
 	}
320
-	$contenu = '<' . "?php die ('Acces interdit'); ?" . ">\n" . $contenu;
320
+	$contenu = '<'."?php die ('Acces interdit'); ?".">\n".$contenu;
321 321
 
322 322
 	return ecrire_fichier($fichier, $contenu, $ecrire_quand_meme, $truncate);
323 323
 }
@@ -330,7 +330,7 @@  discard block
 block discarded – undo
330 330
  * @return bool
331 331
  */
332 332
 function ecrire_fichier_calcule_si_modifie($fichier, $contenu, $force = false, $use_copy = false) {
333
-	$fichier_tmp = $fichier . '.last';
333
+	$fichier_tmp = $fichier.'.last';
334 334
 	if (!ecrire_fichier($fichier_tmp, $contenu, true)) {
335 335
 		return false;
336 336
 	}
@@ -370,7 +370,7 @@  discard block
 block discarded – undo
370 370
  */
371 371
 function lire_fichier_securise($fichier, &$contenu, $options = []) {
372 372
 	if ($res = lire_fichier($fichier, $contenu, $options)) {
373
-		$contenu = substr($contenu, strlen('<' . "?php die ('Acces interdit'); ?" . ">\n"));
373
+		$contenu = substr($contenu, strlen('<'."?php die ('Acces interdit'); ?".">\n"));
374 374
 	}
375 375
 
376 376
 	return $res;
@@ -540,7 +540,7 @@  discard block
 block discarded – undo
540 540
 				$wait = 0;
541 541
 			}
542 542
 		}
543
-		spip_log('Probleme de configuration opcache.revalidate_freq ' . $duree . 's : on attend ' . $wait . 's', _LOG_INFO_IMPORTANTE);
543
+		spip_log('Probleme de configuration opcache.revalidate_freq '.$duree.'s : on attend '.$wait.'s', _LOG_INFO_IMPORTANTE);
544 544
 		if ($wait) {
545 545
 			sleep($duree + 1);
546 546
 		}
@@ -568,9 +568,9 @@  discard block
 block discarded – undo
568 568
 		if ($item == '.' || $item == '..') {
569 569
 			continue;
570 570
 		}
571
-		if (!supprimer_repertoire($dir . '/' . $item)) {
572
-			@chmod($dir . '/' . $item, 0777);
573
-			if (!supprimer_repertoire($dir . '/' . $item)) {
571
+		if (!supprimer_repertoire($dir.'/'.$item)) {
572
+			@chmod($dir.'/'.$item, 0777);
573
+			if (!supprimer_repertoire($dir.'/'.$item)) {
574 574
 				return false;
575 575
 			}
576 576
 		};
@@ -615,7 +615,7 @@  discard block
 block discarded – undo
615 615
 	if (!strlen($subdir)) {
616 616
 		$n = strrpos($base, '/');
617 617
 		if ($n === false) {
618
-			return $nobase ? '' : ($base . '/');
618
+			return $nobase ? '' : ($base.'/');
619 619
 		}
620 620
 		$subdir = substr($base, $n + 1);
621 621
 		$base = substr($base, 0, $n + 1);
@@ -625,14 +625,14 @@  discard block
 block discarded – undo
625 625
 	}
626 626
 
627 627
 	$baseaff = $nobase ? '' : $base;
628
-	if (isset($dirs[$base . $subdir])) {
629
-		return $baseaff . $dirs[$base . $subdir];
628
+	if (isset($dirs[$base.$subdir])) {
629
+		return $baseaff.$dirs[$base.$subdir];
630 630
 	}
631 631
 
632
-	$path = $base . $subdir; # $path = 'IMG/distant/pdf' ou 'IMG/distant_pdf'
632
+	$path = $base.$subdir; # $path = 'IMG/distant/pdf' ou 'IMG/distant_pdf'
633 633
 
634 634
 	if (file_exists("$path/.ok")) {
635
-		return $baseaff . ($dirs[$base . $subdir] = "$subdir/");
635
+		return $baseaff.($dirs[$base.$subdir] = "$subdir/");
636 636
 	}
637 637
 
638 638
 	@mkdir($path, _SPIP_CHMOD);
@@ -642,7 +642,7 @@  discard block
 block discarded – undo
642 642
 		@touch("$path/.ok");
643 643
 		spip_log("creation $base$subdir/");
644 644
 
645
-		return $baseaff . ($dirs[$base . $subdir] = "$subdir/");
645
+		return $baseaff.($dirs[$base.$subdir] = "$subdir/");
646 646
 	}
647 647
 
648 648
 	// en cas d'echec c'est peut etre tout simplement que le disque est plein :
@@ -652,10 +652,10 @@  discard block
 block discarded – undo
652 652
 		return '';
653 653
 	}
654 654
 	if (!_DIR_RESTREINT) {
655
-		$base = preg_replace(',^' . _DIR_RACINE . ',', '', $base);
655
+		$base = preg_replace(',^'._DIR_RACINE.',', '', $base);
656 656
 	}
657 657
 	$base .= $subdir;
658
-	raler_fichier($base . '/.ok');
658
+	raler_fichier($base.'/.ok');
659 659
 }
660 660
 
661 661
 
@@ -728,7 +728,7 @@  discard block
 block discarded – undo
728 728
 								$maxfiles - $nbfiles,
729 729
 								$recurs
730 730
 							);
731
-							$fichiers = array_merge((array)$beginning, (array)$end);
731
+							$fichiers = array_merge((array) $beginning, (array) $end);
732 732
 							$nbfiles = count($fichiers);
733 733
 						}
734 734
 					}
Please login to merge, or discard this patch.
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -341,8 +341,7 @@
 block discarded – undo
341 341
 	) {
342 342
 		if ($use_copy) {
343 343
 			@copy($fichier_tmp, $fichier);
344
-		}
345
-		else {
344
+		} else {
346 345
 			@rename($fichier_tmp, $fichier);
347 346
 		}
348 347
 		// eviter que PHP ne reserve le vieux timestamp
Please login to merge, or discard this patch.
Indentation   +414 added lines, -414 removed lines patch added patch discarded remove patch
@@ -16,12 +16,12 @@  discard block
 block discarded – undo
16 16
  **/
17 17
 
18 18
 if (!defined('_ECRIRE_INC_VERSION')) {
19
-	return;
19
+    return;
20 20
 }
21 21
 
22 22
 if (!defined('_TEST_FILE_EXISTS')) {
23
-	/** Permettre d'éviter des tests file_exists sur certains hébergeurs */
24
-	define('_TEST_FILE_EXISTS', preg_match(',(online|free)[.]fr$,', $_ENV['HTTP_HOST'] ?? ''));
23
+    /** Permettre d'éviter des tests file_exists sur certains hébergeurs */
24
+    define('_TEST_FILE_EXISTS', preg_match(',(online|free)[.]fr$,', $_ENV['HTTP_HOST'] ?? ''));
25 25
 }
26 26
 
27 27
 #define('_SPIP_LOCK_MODE',0); // ne pas utiliser de lock (deconseille)
@@ -29,7 +29,7 @@  discard block
 block discarded – undo
29 29
 #define('_SPIP_LOCK_MODE',2); // utiliser le nfslock de spip
30 30
 
31 31
 if (_SPIP_LOCK_MODE == 2) {
32
-	include_spip('inc/nfslock');
32
+    include_spip('inc/nfslock');
33 33
 }
34 34
 
35 35
 $GLOBALS['liste_verrous'] = [];
@@ -52,24 +52,24 @@  discard block
 block discarded – undo
52 52
  *     Ressource sur le fichier ouvert, sinon false.
53 53
  **/
54 54
 function spip_fopen_lock($fichier, $mode, $verrou) {
55
-	if (_SPIP_LOCK_MODE == 1) {
56
-		if ($fl = @fopen($fichier, $mode)) {
57
-			// verrou
58
-			@flock($fl, $verrou);
59
-		}
60
-
61
-		return $fl;
62
-	} elseif (_SPIP_LOCK_MODE == 2) {
63
-		if (($verrou = spip_nfslock($fichier)) && ($fl = @fopen($fichier, $mode))) {
64
-			$GLOBALS['liste_verrous'][$fl] = [$fichier, $verrou];
65
-
66
-			return $fl;
67
-		} else {
68
-			return false;
69
-		}
70
-	}
71
-
72
-	return @fopen($fichier, $mode);
55
+    if (_SPIP_LOCK_MODE == 1) {
56
+        if ($fl = @fopen($fichier, $mode)) {
57
+            // verrou
58
+            @flock($fl, $verrou);
59
+        }
60
+
61
+        return $fl;
62
+    } elseif (_SPIP_LOCK_MODE == 2) {
63
+        if (($verrou = spip_nfslock($fichier)) && ($fl = @fopen($fichier, $mode))) {
64
+            $GLOBALS['liste_verrous'][$fl] = [$fichier, $verrou];
65
+
66
+            return $fl;
67
+        } else {
68
+            return false;
69
+        }
70
+    }
71
+
72
+    return @fopen($fichier, $mode);
73 73
 }
74 74
 
75 75
 /**
@@ -84,14 +84,14 @@  discard block
 block discarded – undo
84 84
  *     true si succès, false sinon.
85 85
  **/
86 86
 function spip_fclose_unlock($handle) {
87
-	if (_SPIP_LOCK_MODE == 1) {
88
-		@flock($handle, LOCK_UN);
89
-	} elseif (_SPIP_LOCK_MODE == 2) {
90
-		spip_nfsunlock(reset($GLOBALS['liste_verrous'][$handle]), end($GLOBALS['liste_verrous'][$handle]));
91
-		unset($GLOBALS['liste_verrous'][$handle]);
92
-	}
93
-
94
-	return @fclose($handle);
87
+    if (_SPIP_LOCK_MODE == 1) {
88
+        @flock($handle, LOCK_UN);
89
+    } elseif (_SPIP_LOCK_MODE == 2) {
90
+        spip_nfsunlock(reset($GLOBALS['liste_verrous'][$handle]), end($GLOBALS['liste_verrous'][$handle]));
91
+        unset($GLOBALS['liste_verrous'][$handle]);
92
+    }
93
+
94
+    return @fclose($handle);
95 95
 }
96 96
 
97 97
 
@@ -105,23 +105,23 @@  discard block
 block discarded – undo
105 105
  *     Contenu du fichier
106 106
  **/
107 107
 function spip_file_get_contents($fichier) {
108
-	if (substr($fichier, -3) != '.gz') {
109
-		if (function_exists('file_get_contents')) {
110
-			// quand on est sous windows on ne sait pas si file_get_contents marche
111
-			// on essaye : si ca retourne du contenu alors c'est bon
112
-			// sinon on fait un file() pour avoir le coeur net
113
-			$contenu = @file_get_contents($fichier);
114
-			if (!$contenu and _OS_SERVEUR == 'windows') {
115
-				$contenu = @file($fichier);
116
-			}
117
-		} else {
118
-			$contenu = @file($fichier);
119
-		}
120
-	} else {
121
-		$contenu = @gzfile($fichier);
122
-	}
123
-
124
-	return is_array($contenu) ? join('', $contenu) : (string)$contenu;
108
+    if (substr($fichier, -3) != '.gz') {
109
+        if (function_exists('file_get_contents')) {
110
+            // quand on est sous windows on ne sait pas si file_get_contents marche
111
+            // on essaye : si ca retourne du contenu alors c'est bon
112
+            // sinon on fait un file() pour avoir le coeur net
113
+            $contenu = @file_get_contents($fichier);
114
+            if (!$contenu and _OS_SERVEUR == 'windows') {
115
+                $contenu = @file($fichier);
116
+            }
117
+        } else {
118
+            $contenu = @file($fichier);
119
+        }
120
+    } else {
121
+        $contenu = @gzfile($fichier);
122
+    }
123
+
124
+    return is_array($contenu) ? join('', $contenu) : (string)$contenu;
125 125
 }
126 126
 
127 127
 
@@ -146,48 +146,48 @@  discard block
 block discarded – undo
146 146
  *     true si l'opération a réussie, false sinon.
147 147
  **/
148 148
 function lire_fichier($fichier, &$contenu, $options = []) {
149
-	$contenu = '';
150
-	// inutile car si le fichier n'existe pas, le lock va renvoyer false juste apres
151
-	// economisons donc les acces disque, sauf chez free qui rale pour un rien
152
-	if (_TEST_FILE_EXISTS and !@file_exists($fichier)) {
153
-		return false;
154
-	}
155
-
156
-	#spip_timer('lire_fichier');
157
-
158
-	// pas de @ sur spip_fopen_lock qui est silencieux de toute facon
159
-	if ($fl = spip_fopen_lock($fichier, 'r', LOCK_SH)) {
160
-		// lire le fichier avant tout
161
-		$contenu = spip_file_get_contents($fichier);
162
-
163
-		// le fichier a-t-il ete supprime par le locker ?
164
-		// on ne verifie que si la tentative de lecture a echoue
165
-		// pour discriminer un contenu vide d'un fichier absent
166
-		// et eviter un acces disque
167
-		if (!$contenu and !@file_exists($fichier)) {
168
-			spip_fclose_unlock($fl);
169
-
170
-			return false;
171
-		}
172
-
173
-		// liberer le verrou
174
-		spip_fclose_unlock($fl);
175
-
176
-		// Verifications
177
-		$ok = true;
178
-		if (isset($options['phpcheck']) and $options['phpcheck'] == 'oui') {
179
-			$ok &= (preg_match(",[?]>\n?$,", $contenu));
180
-		}
181
-
182
-		#spip_log("$fread $fichier ".spip_timer('lire_fichier'));
183
-		if (!$ok) {
184
-			spip_log("echec lecture $fichier");
185
-		}
186
-
187
-		return $ok;
188
-	}
189
-
190
-	return false;
149
+    $contenu = '';
150
+    // inutile car si le fichier n'existe pas, le lock va renvoyer false juste apres
151
+    // economisons donc les acces disque, sauf chez free qui rale pour un rien
152
+    if (_TEST_FILE_EXISTS and !@file_exists($fichier)) {
153
+        return false;
154
+    }
155
+
156
+    #spip_timer('lire_fichier');
157
+
158
+    // pas de @ sur spip_fopen_lock qui est silencieux de toute facon
159
+    if ($fl = spip_fopen_lock($fichier, 'r', LOCK_SH)) {
160
+        // lire le fichier avant tout
161
+        $contenu = spip_file_get_contents($fichier);
162
+
163
+        // le fichier a-t-il ete supprime par le locker ?
164
+        // on ne verifie que si la tentative de lecture a echoue
165
+        // pour discriminer un contenu vide d'un fichier absent
166
+        // et eviter un acces disque
167
+        if (!$contenu and !@file_exists($fichier)) {
168
+            spip_fclose_unlock($fl);
169
+
170
+            return false;
171
+        }
172
+
173
+        // liberer le verrou
174
+        spip_fclose_unlock($fl);
175
+
176
+        // Verifications
177
+        $ok = true;
178
+        if (isset($options['phpcheck']) and $options['phpcheck'] == 'oui') {
179
+            $ok &= (preg_match(",[?]>\n?$,", $contenu));
180
+        }
181
+
182
+        #spip_log("$fread $fichier ".spip_timer('lire_fichier'));
183
+        if (!$ok) {
184
+            spip_log("echec lecture $fichier");
185
+        }
186
+
187
+        return $ok;
188
+    }
189
+
190
+    return false;
191 191
 }
192 192
 
193 193
 
@@ -215,92 +215,92 @@  discard block
 block discarded – undo
215 215
  **/
216 216
 function ecrire_fichier($fichier, $contenu, $ignorer_echec = false, $truncate = true) {
217 217
 
218
-	#spip_timer('ecrire_fichier');
219
-
220
-	// verrouiller le fichier destination
221
-	if ($fp = spip_fopen_lock($fichier, 'a', LOCK_EX)) {
222
-		// ecrire les donnees, compressees le cas echeant
223
-		// (on ouvre un nouveau pointeur sur le fichier, ce qui a l'avantage
224
-		// de le recreer si le locker qui nous precede l'avait supprime...)
225
-		if (substr($fichier, -3) == '.gz') {
226
-			$contenu = gzencode($contenu);
227
-		}
228
-		// si c'est une ecriture avec troncation , on fait plutot une ecriture complete a cote suivie unlink+rename
229
-		// pour etre sur d'avoir une operation atomique
230
-		// y compris en NFS : http://www.ietf.org/rfc/rfc1094.txt
231
-		// sauf sous wintruc ou ca ne marche pas
232
-		$ok = false;
233
-		if ($truncate and _OS_SERVEUR != 'windows') {
234
-			if (!function_exists('creer_uniqid')) {
235
-				include_spip('inc/acces');
236
-			}
237
-			$id = creer_uniqid();
238
-			// on ouvre un pointeur sur un fichier temporaire en ecriture +raz
239
-			if ($fp2 = spip_fopen_lock("$fichier.$id", 'w', LOCK_EX)) {
240
-				$s = @fputs($fp2, $contenu, $a = strlen($contenu));
241
-				$ok = ($s == $a);
242
-				spip_fclose_unlock($fp2);
243
-				spip_fclose_unlock($fp);
244
-				$fp = null;
245
-				// unlink direct et pas spip_unlink car on avait deja le verrou
246
-				// a priori pas besoin car rename ecrase la cible
247
-				// @unlink($fichier);
248
-				// le rename aussitot, atomique quand on est pas sous windows
249
-				// au pire on arrive en second en cas de concourance, et le rename echoue
250
-				// --> on a la version de l'autre process qui doit etre identique
251
-				@rename("$fichier.$id", $fichier);
252
-				// precaution en cas d'echec du rename
253
-				if (!_TEST_FILE_EXISTS or @file_exists("$fichier.$id")) {
254
-					@unlink("$fichier.$id");
255
-				}
256
-				if ($ok) {
257
-					$ok = file_exists($fichier);
258
-				}
259
-			} else // echec mais penser a fermer ..
260
-			{
261
-				spip_fclose_unlock($fp);
262
-				$fp = null;
263
-			}
264
-		}
265
-		// sinon ou si methode precedente a echoueee
266
-		// on se rabat sur la methode ancienne
267
-		if (!$ok and !is_null($fp)) {
268
-			// ici on est en ajout ou sous windows, cas desespere
269
-			if ($truncate) {
270
-				@ftruncate($fp, 0);
271
-			}
272
-			$s = @fputs($fp, $contenu, $a = strlen($contenu));
273
-
274
-			$ok = ($s == $a);
275
-			spip_fclose_unlock($fp);
276
-		}
277
-		// on tente une dernière fois file_put_contents
278
-		if (!$ok) {
279
-			$l = file_put_contents($fichier, $contenu, $truncate ? LOCK_EX : LOCK_EX | FILE_APPEND);
280
-			$ok = ($l === strlen($contenu));
281
-		}
282
-
283
-		// liberer le verrou et fermer le fichier
284
-		@chmod($fichier, _SPIP_CHMOD & 0666);
285
-		if ($ok) {
286
-			if (strpos($fichier, '.php') !== false) {
287
-				spip_clear_opcode_cache(realpath($fichier));
288
-			}
289
-
290
-			return $ok;
291
-		}
292
-	}
293
-
294
-	if (!$ignorer_echec) {
295
-		include_spip('inc/autoriser');
296
-		if (autoriser('chargerftp')) {
297
-			raler_fichier($fichier);
298
-		}
299
-		spip_unlink($fichier);
300
-	}
301
-	spip_log("Ecriture fichier $fichier impossible", _LOG_INFO_IMPORTANTE);
302
-
303
-	return false;
218
+    #spip_timer('ecrire_fichier');
219
+
220
+    // verrouiller le fichier destination
221
+    if ($fp = spip_fopen_lock($fichier, 'a', LOCK_EX)) {
222
+        // ecrire les donnees, compressees le cas echeant
223
+        // (on ouvre un nouveau pointeur sur le fichier, ce qui a l'avantage
224
+        // de le recreer si le locker qui nous precede l'avait supprime...)
225
+        if (substr($fichier, -3) == '.gz') {
226
+            $contenu = gzencode($contenu);
227
+        }
228
+        // si c'est une ecriture avec troncation , on fait plutot une ecriture complete a cote suivie unlink+rename
229
+        // pour etre sur d'avoir une operation atomique
230
+        // y compris en NFS : http://www.ietf.org/rfc/rfc1094.txt
231
+        // sauf sous wintruc ou ca ne marche pas
232
+        $ok = false;
233
+        if ($truncate and _OS_SERVEUR != 'windows') {
234
+            if (!function_exists('creer_uniqid')) {
235
+                include_spip('inc/acces');
236
+            }
237
+            $id = creer_uniqid();
238
+            // on ouvre un pointeur sur un fichier temporaire en ecriture +raz
239
+            if ($fp2 = spip_fopen_lock("$fichier.$id", 'w', LOCK_EX)) {
240
+                $s = @fputs($fp2, $contenu, $a = strlen($contenu));
241
+                $ok = ($s == $a);
242
+                spip_fclose_unlock($fp2);
243
+                spip_fclose_unlock($fp);
244
+                $fp = null;
245
+                // unlink direct et pas spip_unlink car on avait deja le verrou
246
+                // a priori pas besoin car rename ecrase la cible
247
+                // @unlink($fichier);
248
+                // le rename aussitot, atomique quand on est pas sous windows
249
+                // au pire on arrive en second en cas de concourance, et le rename echoue
250
+                // --> on a la version de l'autre process qui doit etre identique
251
+                @rename("$fichier.$id", $fichier);
252
+                // precaution en cas d'echec du rename
253
+                if (!_TEST_FILE_EXISTS or @file_exists("$fichier.$id")) {
254
+                    @unlink("$fichier.$id");
255
+                }
256
+                if ($ok) {
257
+                    $ok = file_exists($fichier);
258
+                }
259
+            } else // echec mais penser a fermer ..
260
+            {
261
+                spip_fclose_unlock($fp);
262
+                $fp = null;
263
+            }
264
+        }
265
+        // sinon ou si methode precedente a echoueee
266
+        // on se rabat sur la methode ancienne
267
+        if (!$ok and !is_null($fp)) {
268
+            // ici on est en ajout ou sous windows, cas desespere
269
+            if ($truncate) {
270
+                @ftruncate($fp, 0);
271
+            }
272
+            $s = @fputs($fp, $contenu, $a = strlen($contenu));
273
+
274
+            $ok = ($s == $a);
275
+            spip_fclose_unlock($fp);
276
+        }
277
+        // on tente une dernière fois file_put_contents
278
+        if (!$ok) {
279
+            $l = file_put_contents($fichier, $contenu, $truncate ? LOCK_EX : LOCK_EX | FILE_APPEND);
280
+            $ok = ($l === strlen($contenu));
281
+        }
282
+
283
+        // liberer le verrou et fermer le fichier
284
+        @chmod($fichier, _SPIP_CHMOD & 0666);
285
+        if ($ok) {
286
+            if (strpos($fichier, '.php') !== false) {
287
+                spip_clear_opcode_cache(realpath($fichier));
288
+            }
289
+
290
+            return $ok;
291
+        }
292
+    }
293
+
294
+    if (!$ignorer_echec) {
295
+        include_spip('inc/autoriser');
296
+        if (autoriser('chargerftp')) {
297
+            raler_fichier($fichier);
298
+        }
299
+        spip_unlink($fichier);
300
+    }
301
+    spip_log("Ecriture fichier $fichier impossible", _LOG_INFO_IMPORTANTE);
302
+
303
+    return false;
304 304
 }
305 305
 
306 306
 /**
@@ -320,12 +320,12 @@  discard block
 block discarded – undo
320 320
  *     Écriture avec troncation ?
321 321
  */
322 322
 function ecrire_fichier_securise($fichier, $contenu, $ecrire_quand_meme = false, $truncate = true) {
323
-	if (substr($fichier, -4) !== '.php') {
324
-		spip_log('Erreur de programmation: ' . $fichier . ' doit finir par .php');
325
-	}
326
-	$contenu = '<' . "?php die ('Acces interdit'); ?" . ">\n" . $contenu;
323
+    if (substr($fichier, -4) !== '.php') {
324
+        spip_log('Erreur de programmation: ' . $fichier . ' doit finir par .php');
325
+    }
326
+    $contenu = '<' . "?php die ('Acces interdit'); ?" . ">\n" . $contenu;
327 327
 
328
-	return ecrire_fichier($fichier, $contenu, $ecrire_quand_meme, $truncate);
328
+    return ecrire_fichier($fichier, $contenu, $ecrire_quand_meme, $truncate);
329 329
 }
330 330
 
331 331
 
@@ -336,25 +336,25 @@  discard block
 block discarded – undo
336 336
  * @return bool
337 337
  */
338 338
 function ecrire_fichier_calcule_si_modifie($fichier, $contenu, $force = false, $use_copy = false) {
339
-	$fichier_tmp = $fichier . '.last';
340
-	if (!ecrire_fichier($fichier_tmp, $contenu, true)) {
341
-		return false;
342
-	}
343
-	if (
344
-		$force
345
-		or !file_exists($fichier)
346
-		or md5_file($fichier) != md5_file($fichier_tmp)
347
-	) {
348
-		if ($use_copy) {
349
-			@copy($fichier_tmp, $fichier);
350
-		}
351
-		else {
352
-			@rename($fichier_tmp, $fichier);
353
-		}
354
-		// eviter que PHP ne reserve le vieux timestamp
355
-		clearstatcache(true, $fichier);
356
-	}
357
-	return true;
339
+    $fichier_tmp = $fichier . '.last';
340
+    if (!ecrire_fichier($fichier_tmp, $contenu, true)) {
341
+        return false;
342
+    }
343
+    if (
344
+        $force
345
+        or !file_exists($fichier)
346
+        or md5_file($fichier) != md5_file($fichier_tmp)
347
+    ) {
348
+        if ($use_copy) {
349
+            @copy($fichier_tmp, $fichier);
350
+        }
351
+        else {
352
+            @rename($fichier_tmp, $fichier);
353
+        }
354
+        // eviter que PHP ne reserve le vieux timestamp
355
+        clearstatcache(true, $fichier);
356
+    }
357
+    return true;
358 358
 }
359 359
 
360 360
 
@@ -375,11 +375,11 @@  discard block
 block discarded – undo
375 375
  *     true si l'opération a réussie, false sinon.
376 376
  */
377 377
 function lire_fichier_securise($fichier, &$contenu, $options = []) {
378
-	if ($res = lire_fichier($fichier, $contenu, $options)) {
379
-		$contenu = substr($contenu, strlen('<' . "?php die ('Acces interdit'); ?" . ">\n"));
380
-	}
378
+    if ($res = lire_fichier($fichier, $contenu, $options)) {
379
+        $contenu = substr($contenu, strlen('<' . "?php die ('Acces interdit'); ?" . ">\n"));
380
+    }
381 381
 
382
-	return $res;
382
+    return $res;
383 383
 }
384 384
 
385 385
 /**
@@ -394,25 +394,25 @@  discard block
 block discarded – undo
394 394
  *     Chemin du fichier
395 395
  **/
396 396
 function raler_fichier($fichier) {
397
-	if (!defined('_SPIP_ECRIRE_SCRIPT')) {
398
-		spip_initialisation_suite();
399
-	}
400
-	include_spip('inc/minipres');
401
-	$dir = dirname($fichier);
402
-	http_response_code(401);
403
-	echo minipres(_T('texte_inc_meta_2'), "<h4 style='color: red'>"
404
-		. _T('texte_inc_meta_1', ['fichier' => $fichier])
405
-		. " <a href='"
406
-		. generer_url_ecrire('install', "etape=chmod&test_dir=$dir")
407
-		. "'>"
408
-		. _T('texte_inc_meta_2')
409
-		. '</a> '
410
-		. _T(
411
-			'texte_inc_meta_3',
412
-			['repertoire' => joli_repertoire($dir)]
413
-		)
414
-		. "</h4>\n");
415
-	exit;
397
+    if (!defined('_SPIP_ECRIRE_SCRIPT')) {
398
+        spip_initialisation_suite();
399
+    }
400
+    include_spip('inc/minipres');
401
+    $dir = dirname($fichier);
402
+    http_response_code(401);
403
+    echo minipres(_T('texte_inc_meta_2'), "<h4 style='color: red'>"
404
+        . _T('texte_inc_meta_1', ['fichier' => $fichier])
405
+        . " <a href='"
406
+        . generer_url_ecrire('install', "etape=chmod&test_dir=$dir")
407
+        . "'>"
408
+        . _T('texte_inc_meta_2')
409
+        . '</a> '
410
+        . _T(
411
+            'texte_inc_meta_3',
412
+            ['repertoire' => joli_repertoire($dir)]
413
+        )
414
+        . "</h4>\n");
415
+    exit;
416 416
 }
417 417
 
418 418
 
@@ -427,14 +427,14 @@  discard block
 block discarded – undo
427 427
  *     - true si récent, false sinon
428 428
  */
429 429
 function jeune_fichier($fichier, $n) {
430
-	if (!file_exists($fichier)) {
431
-		return false;
432
-	}
433
-	if (!$c = @filemtime($fichier)) {
434
-		return false;
435
-	}
436
-
437
-	return (time() - $n <= $c);
430
+    if (!file_exists($fichier)) {
431
+        return false;
432
+    }
433
+    if (!$c = @filemtime($fichier)) {
434
+        return false;
435
+    }
436
+
437
+    return (time() - $n <= $c);
438 438
 }
439 439
 
440 440
 /**
@@ -449,22 +449,22 @@  discard block
 block discarded – undo
449 449
  *     - false si on n'arrive pas poser le verrou ou si la suppression échoue
450 450
  */
451 451
 function supprimer_fichier($fichier, $lock = true) {
452
-	if (!@file_exists($fichier)) {
453
-		return true;
454
-	}
455
-
456
-	if ($lock) {
457
-		// verrouiller le fichier destination
458
-		if (!$fp = spip_fopen_lock($fichier, 'a', LOCK_EX)) {
459
-			return false;
460
-		}
461
-
462
-		// liberer le verrou
463
-		spip_fclose_unlock($fp);
464
-	}
465
-
466
-	// supprimer
467
-	return @unlink($fichier);
452
+    if (!@file_exists($fichier)) {
453
+        return true;
454
+    }
455
+
456
+    if ($lock) {
457
+        // verrouiller le fichier destination
458
+        if (!$fp = spip_fopen_lock($fichier, 'a', LOCK_EX)) {
459
+            return false;
460
+        }
461
+
462
+        // liberer le verrou
463
+        spip_fclose_unlock($fp);
464
+    }
465
+
466
+    // supprimer
467
+    return @unlink($fichier);
468 468
 }
469 469
 
470 470
 /**
@@ -474,12 +474,12 @@  discard block
 block discarded – undo
474 474
  *     Chemin du fichier
475 475
  */
476 476
 function spip_unlink($f) {
477
-	if (!is_dir($f)) {
478
-		supprimer_fichier($f, false);
479
-	} else {
480
-		@unlink("$f/.ok");
481
-		@rmdir($f);
482
-	}
477
+    if (!is_dir($f)) {
478
+        supprimer_fichier($f, false);
479
+    } else {
480
+        @unlink("$f/.ok");
481
+        @rmdir($f);
482
+    }
483 483
 }
484 484
 
485 485
 /**
@@ -493,26 +493,26 @@  discard block
 block discarded – undo
493 493
  *   The absolute path of the PHP file to invalidate.
494 494
  */
495 495
 function spip_clear_opcode_cache($filepath) {
496
-	clearstatcache(true, $filepath);
497
-
498
-	// Zend OPcache
499
-	if (function_exists('opcache_invalidate')) {
500
-		$invalidate = @opcache_invalidate($filepath, true);
501
-		// si l'invalidation a echoue lever un flag
502
-		if (!$invalidate and !defined('_spip_attend_invalidation_opcode_cache')) {
503
-			define('_spip_attend_invalidation_opcode_cache', true);
504
-		}
505
-	} elseif (!defined('_spip_attend_invalidation_opcode_cache')) {
506
-		// n'agira que si opcache est effectivement actif (il semble qu'on a pas toujours la fonction opcache_invalidate)
507
-		define('_spip_attend_invalidation_opcode_cache', true);
508
-	}
509
-	// APC.
510
-	if (function_exists('apc_delete_file')) {
511
-		// apc_delete_file() throws a PHP warning in case the specified file was
512
-		// not compiled yet.
513
-		// @see http://php.net/apc-delete-file
514
-		@apc_delete_file($filepath);
515
-	}
496
+    clearstatcache(true, $filepath);
497
+
498
+    // Zend OPcache
499
+    if (function_exists('opcache_invalidate')) {
500
+        $invalidate = @opcache_invalidate($filepath, true);
501
+        // si l'invalidation a echoue lever un flag
502
+        if (!$invalidate and !defined('_spip_attend_invalidation_opcode_cache')) {
503
+            define('_spip_attend_invalidation_opcode_cache', true);
504
+        }
505
+    } elseif (!defined('_spip_attend_invalidation_opcode_cache')) {
506
+        // n'agira que si opcache est effectivement actif (il semble qu'on a pas toujours la fonction opcache_invalidate)
507
+        define('_spip_attend_invalidation_opcode_cache', true);
508
+    }
509
+    // APC.
510
+    if (function_exists('apc_delete_file')) {
511
+        // apc_delete_file() throws a PHP warning in case the specified file was
512
+        // not compiled yet.
513
+        // @see http://php.net/apc-delete-file
514
+        @apc_delete_file($filepath);
515
+    }
516 516
 }
517 517
 
518 518
 /**
@@ -535,25 +535,25 @@  discard block
 block discarded – undo
535 535
  *
536 536
  */
537 537
 function spip_attend_invalidation_opcode_cache($timestamp = null) {
538
-	if (
539
-		function_exists('opcache_get_configuration')
540
-		and @ini_get('opcache.enable')
541
-		and @ini_get('opcache.validate_timestamps')
542
-		and ($duree = intval(@ini_get('opcache.revalidate_freq')) or $duree = 2)
543
-		and defined('_spip_attend_invalidation_opcode_cache') // des invalidations ont echouees
544
-	) {
545
-		$wait = $duree + 1;
546
-		if ($timestamp) {
547
-			$wait -= (time() - $timestamp);
548
-			if ($wait < 0) {
549
-				$wait = 0;
550
-			}
551
-		}
552
-		spip_log('Probleme de configuration opcache.revalidate_freq ' . $duree . 's : on attend ' . $wait . 's', _LOG_INFO_IMPORTANTE);
553
-		if ($wait) {
554
-			sleep($duree + 1);
555
-		}
556
-	}
538
+    if (
539
+        function_exists('opcache_get_configuration')
540
+        and @ini_get('opcache.enable')
541
+        and @ini_get('opcache.validate_timestamps')
542
+        and ($duree = intval(@ini_get('opcache.revalidate_freq')) or $duree = 2)
543
+        and defined('_spip_attend_invalidation_opcode_cache') // des invalidations ont echouees
544
+    ) {
545
+        $wait = $duree + 1;
546
+        if ($timestamp) {
547
+            $wait -= (time() - $timestamp);
548
+            if ($wait < 0) {
549
+                $wait = 0;
550
+            }
551
+        }
552
+        spip_log('Probleme de configuration opcache.revalidate_freq ' . $duree . 's : on attend ' . $wait . 's', _LOG_INFO_IMPORTANTE);
553
+        if ($wait) {
554
+            sleep($duree + 1);
555
+        }
556
+    }
557 557
 }
558 558
 
559 559
 
@@ -566,26 +566,26 @@  discard block
 block discarded – undo
566 566
  * @return bool Suppression reussie.
567 567
  */
568 568
 function supprimer_repertoire($dir) {
569
-	if (!file_exists($dir)) {
570
-		return true;
571
-	}
572
-	if (!is_dir($dir) || is_link($dir)) {
573
-		return @unlink($dir);
574
-	}
575
-
576
-	foreach (scandir($dir) as $item) {
577
-		if ($item == '.' || $item == '..') {
578
-			continue;
579
-		}
580
-		if (!supprimer_repertoire($dir . '/' . $item)) {
581
-			@chmod($dir . '/' . $item, 0777);
582
-			if (!supprimer_repertoire($dir . '/' . $item)) {
583
-				return false;
584
-			}
585
-		};
586
-	}
587
-
588
-	return @rmdir($dir);
569
+    if (!file_exists($dir)) {
570
+        return true;
571
+    }
572
+    if (!is_dir($dir) || is_link($dir)) {
573
+        return @unlink($dir);
574
+    }
575
+
576
+    foreach (scandir($dir) as $item) {
577
+        if ($item == '.' || $item == '..') {
578
+            continue;
579
+        }
580
+        if (!supprimer_repertoire($dir . '/' . $item)) {
581
+            @chmod($dir . '/' . $item, 0777);
582
+            if (!supprimer_repertoire($dir . '/' . $item)) {
583
+                return false;
584
+            }
585
+        };
586
+    }
587
+
588
+    return @rmdir($dir);
589 589
 }
590 590
 
591 591
 
@@ -614,57 +614,57 @@  discard block
 block discarded – undo
614 614
  *     Chemin du répertoire créé.
615 615
  **/
616 616
 function sous_repertoire($base, $subdir = '', $nobase = false, $tantpis = false) {
617
-	static $dirs = [];
618
-
619
-	$base = str_replace('//', '/', $base);
620
-
621
-	# suppr le dernier caractere si c'est un /
622
-	$base = rtrim($base, '/');
623
-
624
-	if (!strlen($subdir)) {
625
-		$n = strrpos($base, '/');
626
-		if ($n === false) {
627
-			return $nobase ? '' : ($base . '/');
628
-		}
629
-		$subdir = substr($base, $n + 1);
630
-		$base = substr($base, 0, $n + 1);
631
-	} else {
632
-		$base .= '/';
633
-		$subdir = str_replace('/', '', $subdir);
634
-	}
635
-
636
-	$baseaff = $nobase ? '' : $base;
637
-	if (isset($dirs[$base . $subdir])) {
638
-		return $baseaff . $dirs[$base . $subdir];
639
-	}
640
-
641
-	$path = $base . $subdir; # $path = 'IMG/distant/pdf' ou 'IMG/distant_pdf'
642
-
643
-	if (file_exists("$path/.ok")) {
644
-		return $baseaff . ($dirs[$base . $subdir] = "$subdir/");
645
-	}
646
-
647
-	@mkdir($path, _SPIP_CHMOD);
648
-	@chmod($path, _SPIP_CHMOD);
649
-
650
-	if (is_dir($path) && is_writable($path)) {
651
-		@touch("$path/.ok");
652
-		spip_log("creation $base$subdir/");
653
-
654
-		return $baseaff . ($dirs[$base . $subdir] = "$subdir/");
655
-	}
656
-
657
-	// en cas d'echec c'est peut etre tout simplement que le disque est plein :
658
-	// l'inode du fichier dir_test existe, mais impossible d'y mettre du contenu
659
-	spip_log("echec creation $base{$subdir}");
660
-	if ($tantpis) {
661
-		return '';
662
-	}
663
-	if (!_DIR_RESTREINT) {
664
-		$base = preg_replace(',^' . _DIR_RACINE . ',', '', $base);
665
-	}
666
-	$base .= $subdir;
667
-	raler_fichier($base . '/.ok');
617
+    static $dirs = [];
618
+
619
+    $base = str_replace('//', '/', $base);
620
+
621
+    # suppr le dernier caractere si c'est un /
622
+    $base = rtrim($base, '/');
623
+
624
+    if (!strlen($subdir)) {
625
+        $n = strrpos($base, '/');
626
+        if ($n === false) {
627
+            return $nobase ? '' : ($base . '/');
628
+        }
629
+        $subdir = substr($base, $n + 1);
630
+        $base = substr($base, 0, $n + 1);
631
+    } else {
632
+        $base .= '/';
633
+        $subdir = str_replace('/', '', $subdir);
634
+    }
635
+
636
+    $baseaff = $nobase ? '' : $base;
637
+    if (isset($dirs[$base . $subdir])) {
638
+        return $baseaff . $dirs[$base . $subdir];
639
+    }
640
+
641
+    $path = $base . $subdir; # $path = 'IMG/distant/pdf' ou 'IMG/distant_pdf'
642
+
643
+    if (file_exists("$path/.ok")) {
644
+        return $baseaff . ($dirs[$base . $subdir] = "$subdir/");
645
+    }
646
+
647
+    @mkdir($path, _SPIP_CHMOD);
648
+    @chmod($path, _SPIP_CHMOD);
649
+
650
+    if (is_dir($path) && is_writable($path)) {
651
+        @touch("$path/.ok");
652
+        spip_log("creation $base$subdir/");
653
+
654
+        return $baseaff . ($dirs[$base . $subdir] = "$subdir/");
655
+    }
656
+
657
+    // en cas d'echec c'est peut etre tout simplement que le disque est plein :
658
+    // l'inode du fichier dir_test existe, mais impossible d'y mettre du contenu
659
+    spip_log("echec creation $base{$subdir}");
660
+    if ($tantpis) {
661
+        return '';
662
+    }
663
+    if (!_DIR_RESTREINT) {
664
+        $base = preg_replace(',^' . _DIR_RACINE . ',', '', $base);
665
+    }
666
+    $base .= $subdir;
667
+    raler_fichier($base . '/.ok');
668 668
 }
669 669
 
670 670
 
@@ -697,56 +697,56 @@  discard block
 block discarded – undo
697 697
  *     Chemins des fichiers trouvés.
698 698
  **/
699 699
 function preg_files($dir, $pattern = -1 /* AUTO */, $maxfiles = 10000, $recurs = []) {
700
-	$nbfiles = 0;
701
-	if ($pattern == -1) {
702
-		$pattern = '';
703
-	}
704
-	$fichiers = [];
705
-	// revenir au repertoire racine si on a recu dossier/truc
706
-	// pour regarder dossier/truc/ ne pas oublier le / final
707
-	$dir = preg_replace(',/[^/]*$,', '', $dir);
708
-	if ($dir == '') {
709
-		$dir = '.';
710
-	}
711
-
712
-	if (@is_dir($dir) and is_readable($dir) and $d = opendir($dir)) {
713
-		while (($f = readdir($d)) !== false && ($nbfiles < $maxfiles)) {
714
-			if (
715
-				$f[0] != '.' # ignorer . .. .svn etc
716
-				and $f != 'CVS'
717
-				and $f != 'remove.txt'
718
-				and is_readable($f = "$dir/$f")
719
-			) {
720
-				if (is_file($f)) {
721
-					if (!$pattern or preg_match(";$pattern;iS", $f)) {
722
-						$fichiers[] = $f;
723
-						$nbfiles++;
724
-					}
725
-				} else {
726
-					if (is_dir($f) and is_array($recurs)) {
727
-						$rp = @realpath($f);
728
-						if (!is_string($rp) or !strlen($rp)) {
729
-							$rp = $f;
730
-						} # realpath n'est peut etre pas autorise
731
-						if (!isset($recurs[$rp])) {
732
-							$recurs[$rp] = true;
733
-							$beginning = $fichiers;
734
-							$end = preg_files(
735
-								"$f/",
736
-								$pattern,
737
-								$maxfiles - $nbfiles,
738
-								$recurs
739
-							);
740
-							$fichiers = array_merge((array)$beginning, (array)$end);
741
-							$nbfiles = count($fichiers);
742
-						}
743
-					}
744
-				}
745
-			}
746
-		}
747
-		closedir($d);
748
-	}
749
-	sort($fichiers);
750
-
751
-	return $fichiers;
700
+    $nbfiles = 0;
701
+    if ($pattern == -1) {
702
+        $pattern = '';
703
+    }
704
+    $fichiers = [];
705
+    // revenir au repertoire racine si on a recu dossier/truc
706
+    // pour regarder dossier/truc/ ne pas oublier le / final
707
+    $dir = preg_replace(',/[^/]*$,', '', $dir);
708
+    if ($dir == '') {
709
+        $dir = '.';
710
+    }
711
+
712
+    if (@is_dir($dir) and is_readable($dir) and $d = opendir($dir)) {
713
+        while (($f = readdir($d)) !== false && ($nbfiles < $maxfiles)) {
714
+            if (
715
+                $f[0] != '.' # ignorer . .. .svn etc
716
+                and $f != 'CVS'
717
+                and $f != 'remove.txt'
718
+                and is_readable($f = "$dir/$f")
719
+            ) {
720
+                if (is_file($f)) {
721
+                    if (!$pattern or preg_match(";$pattern;iS", $f)) {
722
+                        $fichiers[] = $f;
723
+                        $nbfiles++;
724
+                    }
725
+                } else {
726
+                    if (is_dir($f) and is_array($recurs)) {
727
+                        $rp = @realpath($f);
728
+                        if (!is_string($rp) or !strlen($rp)) {
729
+                            $rp = $f;
730
+                        } # realpath n'est peut etre pas autorise
731
+                        if (!isset($recurs[$rp])) {
732
+                            $recurs[$rp] = true;
733
+                            $beginning = $fichiers;
734
+                            $end = preg_files(
735
+                                "$f/",
736
+                                $pattern,
737
+                                $maxfiles - $nbfiles,
738
+                                $recurs
739
+                            );
740
+                            $fichiers = array_merge((array)$beginning, (array)$end);
741
+                            $nbfiles = count($fichiers);
742
+                        }
743
+                    }
744
+                }
745
+            }
746
+        }
747
+        closedir($d);
748
+    }
749
+    sort($fichiers);
750
+
751
+    return $fichiers;
752 752
 }
Please login to merge, or discard this patch.
ecrire/inc/couleurs.php 2 patches
Indentation   +63 added lines, -63 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
 /**
@@ -38,70 +38,70 @@  discard block
 block discarded – undo
38 38
  * @return array|string
39 39
  */
40 40
 function inc_couleurs_dist($choix = null, $ajouter = false) {
41
-	static $couleurs_spip = [
42
-		// Violet soutenu
43
-		9 => ['couleur_theme' => '#9a6ef2'],
44
-		// Violet rosé
45
-		4 => ['couleur_theme' => '#c464cb'],
46
-		// Rose interface SPIP
47
-		2 => ['couleur_theme' =>  '#F02364'],
48
-		// Rouge
49
-		8 => ['couleur_theme' => '#ff4524'],
50
-		// Orange
51
-		3 => ['couleur_theme' => '#c97500'],
52
-		// Vert SPIP
53
-		1 => ['couleur_theme' => '#9dba00'],
54
-		// Vert Troglo
55
-		7 => ['couleur_theme' => '#419a2c'],
56
-		// Bleu-vert
57
-		12 => ['couleur_theme' => '#269681'],
58
-		//  Bleu pastel
59
-		5 => ['couleur_theme' => '#3190ae'],
60
-		//  Bleu Kermesse
61
-		11 => ['couleur_theme' => '#288bdd'],
62
-		//  Gris bleuté
63
-		6 => ['couleur_theme' => '#7d90a2'],
64
-		//  Gris
65
-		10 => ['couleur_theme' => '#909090'],
66
-	];
41
+    static $couleurs_spip = [
42
+        // Violet soutenu
43
+        9 => ['couleur_theme' => '#9a6ef2'],
44
+        // Violet rosé
45
+        4 => ['couleur_theme' => '#c464cb'],
46
+        // Rose interface SPIP
47
+        2 => ['couleur_theme' =>  '#F02364'],
48
+        // Rouge
49
+        8 => ['couleur_theme' => '#ff4524'],
50
+        // Orange
51
+        3 => ['couleur_theme' => '#c97500'],
52
+        // Vert SPIP
53
+        1 => ['couleur_theme' => '#9dba00'],
54
+        // Vert Troglo
55
+        7 => ['couleur_theme' => '#419a2c'],
56
+        // Bleu-vert
57
+        12 => ['couleur_theme' => '#269681'],
58
+        //  Bleu pastel
59
+        5 => ['couleur_theme' => '#3190ae'],
60
+        //  Bleu Kermesse
61
+        11 => ['couleur_theme' => '#288bdd'],
62
+        //  Gris bleuté
63
+        6 => ['couleur_theme' => '#7d90a2'],
64
+        //  Gris
65
+        10 => ['couleur_theme' => '#909090'],
66
+    ];
67 67
 
68
-	if (is_numeric($choix)) {
69
-		$c = $couleurs_spip[$choix];
70
-		// compat < SPIP 3.3
71
-		include_spip('inc/filtres_images_mini');
72
-		$c['couleur_foncee'] = $c['couleur_theme'];
73
-		$c['couleur_claire'] = '#' . couleur_eclaircir($c['couleur_theme'], .5);
68
+    if (is_numeric($choix)) {
69
+        $c = $couleurs_spip[$choix];
70
+        // compat < SPIP 3.3
71
+        include_spip('inc/filtres_images_mini');
72
+        $c['couleur_foncee'] = $c['couleur_theme'];
73
+        $c['couleur_claire'] = '#' . couleur_eclaircir($c['couleur_theme'], .5);
74 74
 
75
-		return
76
-			'couleur_theme=' . substr($c['couleur_theme'], 1)
77
-			// compat < SPIP 3.3
78
-			. '&couleur_claire=' . substr($c['couleur_claire'], 1)
79
-			. '&couleur_foncee=' . substr($c['couleur_foncee'], 1);
80
-	} else {
81
-		if (is_array($choix)) {
82
-			// compat < SPIP 3.3
83
-			$compat_spip_33 = function ($c) {
84
-				if (!isset($c['couleur_theme'])) {
85
-					$c['couleur_theme'] = $c['couleur_foncee'];
86
-					unset($c['couleur_foncee']);
87
-					unset($c['couleur_claire']);
88
-					unset($c['couleur_lien']);
89
-					unset($c['couleur_lien_off']);
90
-				}
91
-				return $c;
92
-			};
93
-			if ($ajouter) {
94
-				foreach ($choix as $c) {
95
-					$couleurs_spip[] = $compat_spip_33($c);
96
-				}
75
+        return
76
+            'couleur_theme=' . substr($c['couleur_theme'], 1)
77
+            // compat < SPIP 3.3
78
+            . '&couleur_claire=' . substr($c['couleur_claire'], 1)
79
+            . '&couleur_foncee=' . substr($c['couleur_foncee'], 1);
80
+    } else {
81
+        if (is_array($choix)) {
82
+            // compat < SPIP 3.3
83
+            $compat_spip_33 = function ($c) {
84
+                if (!isset($c['couleur_theme'])) {
85
+                    $c['couleur_theme'] = $c['couleur_foncee'];
86
+                    unset($c['couleur_foncee']);
87
+                    unset($c['couleur_claire']);
88
+                    unset($c['couleur_lien']);
89
+                    unset($c['couleur_lien_off']);
90
+                }
91
+                return $c;
92
+            };
93
+            if ($ajouter) {
94
+                foreach ($choix as $c) {
95
+                    $couleurs_spip[] = $compat_spip_33($c);
96
+                }
97 97
 
98
-				return $couleurs_spip;
99
-			} else {
100
-				$choix = array_map($compat_spip_33, $choix);
101
-				return $couleurs_spip = $choix;
102
-			}
103
-		}
104
-	}
98
+                return $couleurs_spip;
99
+            } else {
100
+                $choix = array_map($compat_spip_33, $choix);
101
+                return $couleurs_spip = $choix;
102
+            }
103
+        }
104
+    }
105 105
 
106
-	return $couleurs_spip;
106
+    return $couleurs_spip;
107 107
 }
Please login to merge, or discard this patch.
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -70,17 +70,17 @@
 block discarded – undo
70 70
 		// compat < SPIP 3.3
71 71
 		include_spip('inc/filtres_images_mini');
72 72
 		$c['couleur_foncee'] = $c['couleur_theme'];
73
-		$c['couleur_claire'] = '#' . couleur_eclaircir($c['couleur_theme'], .5);
73
+		$c['couleur_claire'] = '#'.couleur_eclaircir($c['couleur_theme'], .5);
74 74
 
75 75
 		return
76
-			'couleur_theme=' . substr($c['couleur_theme'], 1)
76
+			'couleur_theme='.substr($c['couleur_theme'], 1)
77 77
 			// compat < SPIP 3.3
78
-			. '&couleur_claire=' . substr($c['couleur_claire'], 1)
79
-			. '&couleur_foncee=' . substr($c['couleur_foncee'], 1);
78
+			. '&couleur_claire='.substr($c['couleur_claire'], 1)
79
+			. '&couleur_foncee='.substr($c['couleur_foncee'], 1);
80 80
 	} else {
81 81
 		if (is_array($choix)) {
82 82
 			// compat < SPIP 3.3
83
-			$compat_spip_33 = function ($c) {
83
+			$compat_spip_33 = function($c) {
84 84
 				if (!isset($c['couleur_theme'])) {
85 85
 					$c['couleur_theme'] = $c['couleur_foncee'];
86 86
 					unset($c['couleur_foncee']);
Please login to merge, or discard this patch.
ecrire/inc/iconifier.php 1 patch
Indentation   +7 added lines, -7 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
 include_spip('inc/actions');
@@ -36,11 +36,11 @@  discard block
 block discarded – undo
36 36
  *     - ou tableau d'information sur le squelette.
37 37
  */
38 38
 function inc_iconifier_dist($objet, $id, $script, $visible = false, $flag_modif = true) {
39
-	// compat avec anciens appels
40
-	$objet = objet_type($objet);
39
+    // compat avec anciens appels
40
+    $objet = objet_type($objet);
41 41
 
42
-	return recuperer_fond(
43
-		'prive/objets/editer/logo',
44
-		['objet' => $objet, 'id_objet' => $id, 'editable' => $flag_modif]
45
-	);
42
+    return recuperer_fond(
43
+        'prive/objets/editer/logo',
44
+        ['objet' => $objet, 'id_objet' => $id, 'editable' => $flag_modif]
45
+    );
46 46
 }
Please login to merge, or discard this patch.
ecrire/inc/preselectionner_parent_nouvel_objet.php 2 patches
Indentation   +34 added lines, -34 removed lines patch added patch discarded remove patch
@@ -11,10 +11,10 @@  discard block
 block discarded – undo
11 11
 \***************************************************************************/
12 12
 
13 13
 if (!defined('_ECRIRE_INC_VERSION')) {
14
-	return;
14
+    return;
15 15
 }
16 16
 if (!defined('_AUTO_SELECTION_RUBRIQUE')) {
17
-	define('_AUTO_SELECTION_RUBRIQUE', false);
17
+    define('_AUTO_SELECTION_RUBRIQUE', false);
18 18
 }
19 19
 
20 20
 
@@ -28,39 +28,39 @@  discard block
 block discarded – undo
28 28
  * @return string
29 29
  */
30 30
 function inc_preselectionner_parent_nouvel_objet_dist($objet, $row) {
31
-	if (!_AUTO_SELECTION_RUBRIQUE) {
32
-		return '';
33
-	}
31
+    if (!_AUTO_SELECTION_RUBRIQUE) {
32
+        return '';
33
+    }
34 34
 
35
-	if (!isset($row['id_rubrique'])) {
36
-		return '';
37
-	}
35
+    if (!isset($row['id_rubrique'])) {
36
+        return '';
37
+    }
38 38
 
39
-	$id_rubrique = '';
40
-	if ($GLOBALS['connect_id_rubrique']) {
41
-		// si admin restreint : sa rubrique
42
-		$id_rubrique = $GLOBALS['connect_id_rubrique'][0];
43
-	} elseif (
44
-		is_int(_AUTO_SELECTION_RUBRIQUE)
45
-		and sql_fetsel('id_rubrique', 'spip_rubriques', 'id_rubrique=' . intval(_AUTO_SELECTION_RUBRIQUE))
46
-	) {
47
-		$id_rubrique = _AUTO_SELECTION_RUBRIQUE;
48
-	} else {
49
-		// sinon la derniere rubrique cree
50
-		$row_rub = sql_fetsel('id_rubrique', 'spip_rubriques', '', '', 'id_rubrique DESC', '0,1');
51
-		$id_rubrique = $row_rub['id_rubrique'];
52
-	}
53
-	// si le choix ne convient pas, on cherche dans un secteur
54
-	if (!autoriser('creer' . $objet . 'dans', 'rubrique', $id_rubrique)) {
55
-		$id_rubrique = '';
56
-		// manque de chance, la rubrique n'est pas autorisee, on cherche un des secteurs autorises
57
-		$res = sql_select('id_rubrique', 'spip_rubriques', 'id_parent=0');
58
-		while (!$id_rubrique and $row_rub = sql_fetch($res)) {
59
-			if (autoriser('creer' . $objet . 'dans', 'rubrique', $row_rub['id_rubrique'])) {
60
-				$id_rubrique = $row_rub['id_rubrique'];
61
-			}
62
-		}
63
-	}
39
+    $id_rubrique = '';
40
+    if ($GLOBALS['connect_id_rubrique']) {
41
+        // si admin restreint : sa rubrique
42
+        $id_rubrique = $GLOBALS['connect_id_rubrique'][0];
43
+    } elseif (
44
+        is_int(_AUTO_SELECTION_RUBRIQUE)
45
+        and sql_fetsel('id_rubrique', 'spip_rubriques', 'id_rubrique=' . intval(_AUTO_SELECTION_RUBRIQUE))
46
+    ) {
47
+        $id_rubrique = _AUTO_SELECTION_RUBRIQUE;
48
+    } else {
49
+        // sinon la derniere rubrique cree
50
+        $row_rub = sql_fetsel('id_rubrique', 'spip_rubriques', '', '', 'id_rubrique DESC', '0,1');
51
+        $id_rubrique = $row_rub['id_rubrique'];
52
+    }
53
+    // si le choix ne convient pas, on cherche dans un secteur
54
+    if (!autoriser('creer' . $objet . 'dans', 'rubrique', $id_rubrique)) {
55
+        $id_rubrique = '';
56
+        // manque de chance, la rubrique n'est pas autorisee, on cherche un des secteurs autorises
57
+        $res = sql_select('id_rubrique', 'spip_rubriques', 'id_parent=0');
58
+        while (!$id_rubrique and $row_rub = sql_fetch($res)) {
59
+            if (autoriser('creer' . $objet . 'dans', 'rubrique', $row_rub['id_rubrique'])) {
60
+                $id_rubrique = $row_rub['id_rubrique'];
61
+            }
62
+        }
63
+    }
64 64
 
65
-	return $id_rubrique;
65
+    return $id_rubrique;
66 66
 }
Please login to merge, or discard this patch.
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -42,7 +42,7 @@  discard block
 block discarded – undo
42 42
 		$id_rubrique = $GLOBALS['connect_id_rubrique'][0];
43 43
 	} elseif (
44 44
 		is_int(_AUTO_SELECTION_RUBRIQUE)
45
-		and sql_fetsel('id_rubrique', 'spip_rubriques', 'id_rubrique=' . intval(_AUTO_SELECTION_RUBRIQUE))
45
+		and sql_fetsel('id_rubrique', 'spip_rubriques', 'id_rubrique='.intval(_AUTO_SELECTION_RUBRIQUE))
46 46
 	) {
47 47
 		$id_rubrique = _AUTO_SELECTION_RUBRIQUE;
48 48
 	} else {
@@ -51,12 +51,12 @@  discard block
 block discarded – undo
51 51
 		$id_rubrique = $row_rub['id_rubrique'];
52 52
 	}
53 53
 	// si le choix ne convient pas, on cherche dans un secteur
54
-	if (!autoriser('creer' . $objet . 'dans', 'rubrique', $id_rubrique)) {
54
+	if (!autoriser('creer'.$objet.'dans', 'rubrique', $id_rubrique)) {
55 55
 		$id_rubrique = '';
56 56
 		// manque de chance, la rubrique n'est pas autorisee, on cherche un des secteurs autorises
57 57
 		$res = sql_select('id_rubrique', 'spip_rubriques', 'id_parent=0');
58 58
 		while (!$id_rubrique and $row_rub = sql_fetch($res)) {
59
-			if (autoriser('creer' . $objet . 'dans', 'rubrique', $row_rub['id_rubrique'])) {
59
+			if (autoriser('creer'.$objet.'dans', 'rubrique', $row_rub['id_rubrique'])) {
60 60
 				$id_rubrique = $row_rub['id_rubrique'];
61 61
 			}
62 62
 		}
Please login to merge, or discard this patch.
ecrire/inc/xml.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -137,7 +137,7 @@
 block discarded – undo
137 137
 					$p !== false
138 138
 					and ($morceau = substr($txt, $d, $p - $d))
139 139
 					and (($nopen += preg_match_all(
140
-						'{<' . preg_quote($closing_tag) . '(\s*>|\s[^>]*[^/>]>)}is',
140
+						'{<'.preg_quote($closing_tag).'(\s*>|\s[^>]*[^/>]>)}is',
141 141
 						$morceau,
142 142
 						$matches,
143 143
 						PREG_SET_ORDER
Please login to merge, or discard this patch.
Indentation   +157 added lines, -157 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
 
@@ -47,24 +47,24 @@  discard block
 block discarded – undo
47 47
  *     - false si l'arbre xml ne peut être créé ou est vide
48 48
  **/
49 49
 function spip_xml_load($fichier, $strict = true, $clean = true, $taille_max = 1_048_576, $datas = '', $profondeur = -1) {
50
-	$contenu = '';
51
-	if (tester_url_absolue($fichier)) {
52
-		include_spip('inc/distant');
53
-		$contenu = recuperer_url($fichier, ['taille_max' => $taille_max, 'datas' => $datas]);
54
-		$contenu = $contenu['page'] ?? '';
55
-	} else {
56
-		lire_fichier($fichier, $contenu);
57
-	}
58
-	$arbre = [];
59
-	if ($contenu) {
60
-		$arbre = spip_xml_parse($contenu, $strict, $clean, $profondeur);
61
-	}
50
+    $contenu = '';
51
+    if (tester_url_absolue($fichier)) {
52
+        include_spip('inc/distant');
53
+        $contenu = recuperer_url($fichier, ['taille_max' => $taille_max, 'datas' => $datas]);
54
+        $contenu = $contenu['page'] ?? '';
55
+    } else {
56
+        lire_fichier($fichier, $contenu);
57
+    }
58
+    $arbre = [];
59
+    if ($contenu) {
60
+        $arbre = spip_xml_parse($contenu, $strict, $clean, $profondeur);
61
+    }
62 62
 
63
-	return count($arbre) ? $arbre : false;
63
+    return count($arbre) ? $arbre : false;
64 64
 }
65 65
 
66 66
 if (!defined('_SPIP_XML_TAG_SPLIT')) {
67
-	define('_SPIP_XML_TAG_SPLIT', '{<([^:>][^>]*?)>}sS');
67
+    define('_SPIP_XML_TAG_SPLIT', '{<([^:>][^>]*?)>}sS');
68 68
 }
69 69
 
70 70
 /**
@@ -83,150 +83,150 @@  discard block
 block discarded – undo
83 83
  *     - false si l'arbre xml ne peut être créé ou est vide
84 84
  **/
85 85
 function spip_xml_parse(&$texte, $strict = true, $clean = true, $profondeur = -1) {
86
-	$out = [];
87
-	// enlever les commentaires
88
-	$charset = 'AUTO';
89
-	if ($clean === true) {
90
-		if (preg_match(",<\?xml\s(.*?)encoding=['\"]?(.*?)['\"]?(\s(.*))?\?>,im", $texte, $regs)) {
91
-			$charset = $regs[2];
92
-		}
93
-		$texte = preg_replace(',<!--(.*?)-->,is', '', $texte);
94
-		$texte = preg_replace(',<\?(.*?)\?>,is', '', $texte);
95
-		include_spip('inc/charsets');
96
-		$clean = $charset;
97
-		//$texte = importer_charset($texte,$charset);
98
-	}
99
-	if (is_string($clean)) {
100
-		$charset = $clean;
101
-	}
102
-	$txt = $texte;
86
+    $out = [];
87
+    // enlever les commentaires
88
+    $charset = 'AUTO';
89
+    if ($clean === true) {
90
+        if (preg_match(",<\?xml\s(.*?)encoding=['\"]?(.*?)['\"]?(\s(.*))?\?>,im", $texte, $regs)) {
91
+            $charset = $regs[2];
92
+        }
93
+        $texte = preg_replace(',<!--(.*?)-->,is', '', $texte);
94
+        $texte = preg_replace(',<\?(.*?)\?>,is', '', $texte);
95
+        include_spip('inc/charsets');
96
+        $clean = $charset;
97
+        //$texte = importer_charset($texte,$charset);
98
+    }
99
+    if (is_string($clean)) {
100
+        $charset = $clean;
101
+    }
102
+    $txt = $texte;
103 103
 
104
-	// tant qu'il y a des tags
105
-	$chars = preg_split(_SPIP_XML_TAG_SPLIT, $txt, 2, PREG_SPLIT_DELIM_CAPTURE);
106
-	while ((is_countable($chars) ? count($chars) : 0) >= 2) {
107
-		// tag ouvrant
108
-		//$chars = preg_split("{<([^>]*?)>}s",$txt,2,PREG_SPLIT_DELIM_CAPTURE);
104
+    // tant qu'il y a des tags
105
+    $chars = preg_split(_SPIP_XML_TAG_SPLIT, $txt, 2, PREG_SPLIT_DELIM_CAPTURE);
106
+    while ((is_countable($chars) ? count($chars) : 0) >= 2) {
107
+        // tag ouvrant
108
+        //$chars = preg_split("{<([^>]*?)>}s",$txt,2,PREG_SPLIT_DELIM_CAPTURE);
109 109
 
110
-		// $before doit etre vide ou des espaces uniquements!
111
-		$before = trim($chars[0]);
110
+        // $before doit etre vide ou des espaces uniquements!
111
+        $before = trim($chars[0]);
112 112
 
113
-		if (strlen($before) > 0) {
114
-			return importer_charset($texte, $charset);
115
-		}//$texte; // before non vide, donc on est dans du texte
113
+        if (strlen($before) > 0) {
114
+            return importer_charset($texte, $charset);
115
+        }//$texte; // before non vide, donc on est dans du texte
116 116
 
117
-		$tag = rtrim($chars[1]);
118
-		$txt = $chars[2];
117
+        $tag = rtrim($chars[1]);
118
+        $txt = $chars[2];
119 119
 
120
-		if (strncmp($tag, '![CDATA[', 8) == 0) {
121
-			return importer_charset($texte, $charset);
122
-		}//$texte;
123
-		if (substr($tag, -1) == '/') { // self closing tag
124
-			$tag = rtrim(substr($tag, 0, strlen($tag) - 1));
125
-			$out[$tag][] = '';
126
-		} else {
127
-			$closing_tag = preg_split(",\s|\t|\n|\r,", trim($tag));
128
-			$closing_tag = reset($closing_tag);
129
-			// tag fermant
130
-			$ncclos = strlen("</$closing_tag>");
131
-			$p = strpos($txt, (string) "</$closing_tag>");
132
-			if ($p !== false and (strpos($txt, '<') < $p)) {
133
-				$nclose = 0;
134
-				$nopen = 0;
135
-				$d = 0;
136
-				while (
137
-					$p !== false
138
-					and ($morceau = substr($txt, $d, $p - $d))
139
-					and (($nopen += preg_match_all(
140
-						'{<' . preg_quote($closing_tag) . '(\s*>|\s[^>]*[^/>]>)}is',
141
-						$morceau,
142
-						$matches,
143
-						PREG_SET_ORDER
144
-					)) > $nclose)
145
-				) {
146
-					$nclose++;
147
-					$d = $p + $ncclos;
148
-					$p = strpos($txt, (string) "</$closing_tag>", $d);
149
-				}
150
-			}
151
-			if ($p === false) {
152
-				if ($strict) {
153
-					$out[$tag][] = "erreur : tag fermant $tag manquant::$txt";
120
+        if (strncmp($tag, '![CDATA[', 8) == 0) {
121
+            return importer_charset($texte, $charset);
122
+        }//$texte;
123
+        if (substr($tag, -1) == '/') { // self closing tag
124
+            $tag = rtrim(substr($tag, 0, strlen($tag) - 1));
125
+            $out[$tag][] = '';
126
+        } else {
127
+            $closing_tag = preg_split(",\s|\t|\n|\r,", trim($tag));
128
+            $closing_tag = reset($closing_tag);
129
+            // tag fermant
130
+            $ncclos = strlen("</$closing_tag>");
131
+            $p = strpos($txt, (string) "</$closing_tag>");
132
+            if ($p !== false and (strpos($txt, '<') < $p)) {
133
+                $nclose = 0;
134
+                $nopen = 0;
135
+                $d = 0;
136
+                while (
137
+                    $p !== false
138
+                    and ($morceau = substr($txt, $d, $p - $d))
139
+                    and (($nopen += preg_match_all(
140
+                        '{<' . preg_quote($closing_tag) . '(\s*>|\s[^>]*[^/>]>)}is',
141
+                        $morceau,
142
+                        $matches,
143
+                        PREG_SET_ORDER
144
+                    )) > $nclose)
145
+                ) {
146
+                    $nclose++;
147
+                    $d = $p + $ncclos;
148
+                    $p = strpos($txt, (string) "</$closing_tag>", $d);
149
+                }
150
+            }
151
+            if ($p === false) {
152
+                if ($strict) {
153
+                    $out[$tag][] = "erreur : tag fermant $tag manquant::$txt";
154 154
 
155
-					return $out;
156
-				} else {
157
-					return importer_charset($texte, $charset);
158
-				}//$texte // un tag qui constitue du texte a reporter dans $before
159
-			}
160
-			$content = substr($txt, 0, $p);
161
-			$txt = substr($txt, $p + $ncclos);
162
-			if ($profondeur == 0 or !str_contains($content, '<')) { // eviter une recursion si pas utile
163
-			$out[$tag][] = importer_charset($content, $charset);
164
-			}//$content;
165
-			else {
166
-				$out[$tag][] = spip_xml_parse($content, $strict, $clean, $profondeur - 1);
167
-			}
168
-		}
169
-		$chars = preg_split(_SPIP_XML_TAG_SPLIT, $txt, 2, PREG_SPLIT_DELIM_CAPTURE);
170
-	}
171
-	if (count($out) && (strlen(trim($txt)) == 0)) {
172
-		return $out;
173
-	} else {
174
-		return importer_charset($texte, $charset);
175
-	}//$texte;
155
+                    return $out;
156
+                } else {
157
+                    return importer_charset($texte, $charset);
158
+                }//$texte // un tag qui constitue du texte a reporter dans $before
159
+            }
160
+            $content = substr($txt, 0, $p);
161
+            $txt = substr($txt, $p + $ncclos);
162
+            if ($profondeur == 0 or !str_contains($content, '<')) { // eviter une recursion si pas utile
163
+            $out[$tag][] = importer_charset($content, $charset);
164
+            }//$content;
165
+            else {
166
+                $out[$tag][] = spip_xml_parse($content, $strict, $clean, $profondeur - 1);
167
+            }
168
+        }
169
+        $chars = preg_split(_SPIP_XML_TAG_SPLIT, $txt, 2, PREG_SPLIT_DELIM_CAPTURE);
170
+    }
171
+    if (count($out) && (strlen(trim($txt)) == 0)) {
172
+        return $out;
173
+    } else {
174
+        return importer_charset($texte, $charset);
175
+    }//$texte;
176 176
 }
177 177
 
178 178
 function spip_xml_aplatit($arbre, $separateur = ' ') {
179
-	$s = '';
180
-	if (is_array($arbre)) {
181
-		foreach ($arbre as $tag => $feuille) {
182
-			if (is_array($feuille)) {
183
-				if ($tag !== intval($tag)) {
184
-					$f = spip_xml_aplatit($feuille, $separateur);
185
-					if (strlen($f)) {
186
-						$tagf = explode(' ', $tag);
187
-						$tagf = $tagf[0];
188
-						$s .= "<$tag>$f</$tagf>";
189
-					} else {
190
-						$s .= "<$tag />";
191
-					}
192
-				} else {
193
-					$s .= spip_xml_aplatit($feuille);
194
-				}
195
-				$s .= $separateur;
196
-			} else {
197
-				$s .= "$feuille$separateur";
198
-			}
199
-		}
200
-	}
179
+    $s = '';
180
+    if (is_array($arbre)) {
181
+        foreach ($arbre as $tag => $feuille) {
182
+            if (is_array($feuille)) {
183
+                if ($tag !== intval($tag)) {
184
+                    $f = spip_xml_aplatit($feuille, $separateur);
185
+                    if (strlen($f)) {
186
+                        $tagf = explode(' ', $tag);
187
+                        $tagf = $tagf[0];
188
+                        $s .= "<$tag>$f</$tagf>";
189
+                    } else {
190
+                        $s .= "<$tag />";
191
+                    }
192
+                } else {
193
+                    $s .= spip_xml_aplatit($feuille);
194
+                }
195
+                $s .= $separateur;
196
+            } else {
197
+                $s .= "$feuille$separateur";
198
+            }
199
+        }
200
+    }
201 201
 
202
-	return strlen($separateur) ? substr($s, 0, -strlen($separateur)) : $s;
202
+    return strlen($separateur) ? substr($s, 0, -strlen($separateur)) : $s;
203 203
 }
204 204
 
205 205
 function spip_xml_tagname($tag) {
206
-	if (preg_match(',^([a-z][\w:]*),i', $tag, $reg)) {
207
-		return $reg[1];
208
-	}
206
+    if (preg_match(',^([a-z][\w:]*),i', $tag, $reg)) {
207
+        return $reg[1];
208
+    }
209 209
 
210
-	return '';
210
+    return '';
211 211
 }
212 212
 
213 213
 function spip_xml_decompose_tag($tag) {
214
-	$tagname = spip_xml_tagname($tag);
215
-	$liste = [];
216
-	$tag = ltrim(strpbrk($tag, " \n\t"));
217
-	$p = strpos($tag, '=');
218
-	while ($p !== false) {
219
-		$attr = trim(substr($tag, 0, $p));
220
-		$tag = ltrim(substr($tag, $p + 1));
221
-		$quote = $tag[0];
222
-		$p = strpos($tag, $quote, 1);
223
-		$cont = substr($tag, 1, $p - 1);
224
-		$liste[$attr] = $cont;
225
-		$tag = substr($tag, $p + 1);
226
-		$p = strpos($tag, '=');
227
-	}
214
+    $tagname = spip_xml_tagname($tag);
215
+    $liste = [];
216
+    $tag = ltrim(strpbrk($tag, " \n\t"));
217
+    $p = strpos($tag, '=');
218
+    while ($p !== false) {
219
+        $attr = trim(substr($tag, 0, $p));
220
+        $tag = ltrim(substr($tag, $p + 1));
221
+        $quote = $tag[0];
222
+        $p = strpos($tag, $quote, 1);
223
+        $cont = substr($tag, 1, $p - 1);
224
+        $liste[$attr] = $cont;
225
+        $tag = substr($tag, $p + 1);
226
+        $p = strpos($tag, '=');
227
+    }
228 228
 
229
-	return [$tagname, $liste];
229
+    return [$tagname, $liste];
230 230
 }
231 231
 
232 232
 /**
@@ -249,21 +249,21 @@  discard block
 block discarded – undo
249 249
  *     false si aucun élément ne valide l'expression régulière, true sinon.
250 250
  **/
251 251
 function spip_xml_match_nodes($regexp, &$arbre, &$matches, $init = true) {
252
-	if ($init) {
253
-		$matches = [];
254
-	}
255
-	if (is_array($arbre) && count($arbre)) {
256
-		foreach (array_keys($arbre) as $tag) {
257
-			if (preg_match($regexp, $tag)) {
258
-				$matches[$tag] = &$arbre[$tag];
259
-			}
260
-			if (is_array($arbre[$tag])) {
261
-				foreach (array_keys($arbre[$tag]) as $occurences) {
262
-					spip_xml_match_nodes($regexp, $arbre[$tag][$occurences], $matches, false);
263
-				}
264
-			}
265
-		}
266
-	}
252
+    if ($init) {
253
+        $matches = [];
254
+    }
255
+    if (is_array($arbre) && count($arbre)) {
256
+        foreach (array_keys($arbre) as $tag) {
257
+            if (preg_match($regexp, $tag)) {
258
+                $matches[$tag] = &$arbre[$tag];
259
+            }
260
+            if (is_array($arbre[$tag])) {
261
+                foreach (array_keys($arbre[$tag]) as $occurences) {
262
+                    spip_xml_match_nodes($regexp, $arbre[$tag][$occurences], $matches, false);
263
+                }
264
+            }
265
+        }
266
+    }
267 267
 
268
-	return (is_countable($matches) ? count($matches) : 0);
268
+    return (is_countable($matches) ? count($matches) : 0);
269 269
 }
Please login to merge, or discard this patch.
ecrire/inc/lang_liste.php 2 patches
Indentation   +198 added lines, -198 removed lines patch added patch discarded remove patch
@@ -18,206 +18,206 @@
 block discarded – undo
18 18
 */
19 19
 
20 20
 if (!defined('_ECRIRE_INC_VERSION')) {
21
-	return;
21
+    return;
22 22
 }
23 23
 
24 24
 $GLOBALS['codes_langues'] = [
25
-	'aa' => 'Afar',
26
-	'ab' => 'Abkhazian',
27
-	'af' => 'Afrikaans',
28
-	'am' => 'Amharic',
29
-	'an' => 'Aragon&#233;s',
30
-	'ar' => '&#1593;&#1585;&#1576;&#1610;',
31
-	'as' => 'Assamese',
32
-	'ast' => 'asturianu',
33
-	'ay' => 'Aymara',
34
-	'az' => 'Az&#601;rbaycan dili',
35
-	'ba' => 'Bashkir',
36
-	'be' => '&#1041;&#1077;&#1083;&#1072;&#1088;&#1091;&#1089;&#1082;&#1072;&#1103;',
37
-	'ber_tam' => 'Tamazigh',
38
-	'ber_tam_tfng' => 'Tamazigh tifinagh',
39
-	'bg' => '&#1073;&#1098;&#1083;&#1075;&#1072;&#1088;&#1089;&#1082;&#1080;',
40
-	'bh' => 'Bihari',
41
-	'bi' => 'Bislama',
42
-	'bm' => 'Bambara',
43
-	'bn' => 'Bengali; Bangla',
44
-	'bo' => 'Tibetan',
45
-	'br' => 'brezhoneg',
46
-	'bs' => 'bosanski',
47
-	'ca' => 'catal&#224;',
48
-	'co' => 'corsu',
49
-	'cpf' => 'Kr&eacute;ol r&eacute;yon&eacute;',
50
-	'cpf_dom' => 'Krey&ograve;l',
51
-	'cpf_hat' => 'Krey&ograve;l (Peyi Dayiti)',
52
-	'cs' => '&#269;e&#353;tina',
53
-	'cy' => 'Cymraeg',  # welsh, gallois
54
-	'da' => 'dansk',
55
-	'de' => 'Deutsch',
56
-	'dz' => 'Bhutani',
57
-	'el' => '&#949;&#955;&#955;&#951;&#957;&#953;&#954;&#940;',
58
-	'en' => 'English',
59
-	'en_hx' => 'H4ck3R',
60
-	'en_sm' => 'Smurf',
61
-	'eo' => 'Esperanto',
62
-	'es' => 'Espa&#241;ol',
63
-	'es_co' => 'Colombiano',
64
-	'es_mx_pop' => 'Mexicano a lo g&#252;ey',
65
-	'et' => 'eesti',
66
-	'eu' => 'euskara',
67
-	'fa' => '&#1601;&#1575;&#1585;&#1587;&#1609;',
68
-	'ff' => 'Fulah', // peul
69
-	'fi' => 'suomi',
70
-	'fj' => 'Fiji',
71
-	'fo' => 'f&#248;royskt',
72
-	'fon' => 'fongb&egrave;',
73
-	'fr' => 'fran&#231;ais',
74
-	'fr_fem' => 'fran&#231;ais f&#233;minin',
75
-	'fr_sc' => 'schtroumpf',
76
-	'fr_lpc' => 'langue parl&#233;e compl&#233;t&#233;e',
77
-	'fr_lsf' => 'langue des signes fran&#231;aise',
78
-	'fr_spl' => 'fran&#231;ais simplifi&#233;',
79
-	'fr_tu' => 'fran&#231;ais copain',
80
-	'fy' => 'Frisian',
81
-	'ga' => 'Irish',
82
-	'gd' => 'Scots Gaelic',
83
-	'gl' => 'galego',
84
-	'gn' => 'Guarani',
85
-	'grc' => '&#7944;&#961;&#967;&#945;&#943;&#945; &#7961;&#955;&#955;&#951;&#957;&#953;&#954;&#942;', // grec ancien
86
-	'gu' => 'Gujarati',
87
-	'ha' => 'Hausa',
88
-	'hac' => '&#1705;-&#1607;&#1734;&#1585;&#1575;&#1605;&#1740;', //"Kurdish-Horami"
89
-	'hbo' => '&#1506;&#1489;&#1512;&#1497;&#1514;&#1470;&#1492;&#1514;&#1504;&#1498;', // hebreu classique ou biblique
90
-	'haz' => '&#x647;&#x632;&#x627;&#x631;&#x647; &#x6AF;&#x6CC;',
91
-	'he' => '&#1506;&#1489;&#1512;&#1497;&#1514;',
92
-	'hi' => '&#2361;&#2367;&#2306;&#2342;&#2368;',
93
-	'hr' => 'hrvatski',
94
-	'hu' => 'magyar',
95
-	'hy' => '&#1344;&#1377;&#1397;&#1381;&#1408;&#1381;&#1398;',// Arménien
96
-	'ia' => 'Interlingua',
97
-	'id' => 'Indonesia',
98
-	'ie' => 'Interlingue',
99
-	'ik' => 'Inupiak',
100
-	'is' => '&#237;slenska',
101
-	'it' => 'italiano',
102
-	'it_fem' => 'italiana',
103
-	'iu' => 'Inuktitut',
104
-	'ja' => '&#26085;&#26412;&#35486;',
105
-	'jv' => 'Javanese',
106
-	'ka' => '&#4325;&#4304;&#4320;&#4311;&#4323;&#4314;&#4312;',
107
-	'kk' => '&#1179;&#1072;&#1079;&#1072;&#1179;&#32;&#1090;&#1110;&#1083;&#1110;', // Kazakh
108
-	'kl' => 'kalaallisut',
109
-	'km' => '&#6039;&#6070;&#6047;&#6070;&#6017;&#6098;&#6040;&#6082;&#6042;',// Khmer
110
-	'kn' => 'Kannada',
111
-	'ko' => '&#54620;&#44397;&#50612;',
112
-	'kok' => '&#2325;&#2379;&#2306;&#2325;&#2339;&#2368;',
113
-	'ks' => 'Kashmiri',
114
-	'ku' => '&#1705;&#1608;&#1585;&#1583;&#1740;',
115
-	'ky' => 'Kirghiz',
116
-	'la' => 'lingua latina',
117
-	'lb' => 'L&euml;tzebuergesch',
118
-	'ln' => 'Lingala',
119
-	'lo' => '&#3742;&#3762;&#3754;&#3762;&#3749;&#3762;&#3751;', # lao
120
-	'lt' => 'lietuvi&#371;',
121
-	'lu' => 'luba-katanga',
122
-	'lv' => 'latvie&#353;u',
123
-	'man' => 'mandingue', # a traduire en mandingue
124
-	'mfv' => 'manjak', # ISO-639-3
125
-	'mg' => 'Malagasy',
126
-	'mi' => 'Maori',
127
-	'mk' => '&#1084;&#1072;&#1082;&#1077;&#1076;&#1086;&#1085;&#1089;&#1082;&#1080; &#1112;&#1072;&#1079;&#1080;&#1082;',
128
-	'ml' => 'Malayalam',
129
-	'mn' => 'Монгол хэл',
130
-	'mo' => 'Moldavian',
131
-	'mos' => 'Mor&eacute;',
132
-	'mr' => '&#2350;&#2352;&#2366;&#2336;&#2368;',
133
-	'ms' => 'Bahasa Malaysia',
134
-	'mt' => 'Maltese',
135
-	'my' => 'Burmese',
136
-	'na' => 'Nauru',
137
-	'nap' => 'napulitano',
138
-	'ne' => 'Nepali',
139
-	'nqo' => "N'ko", // www.manden.org
140
-	'nl' => 'Nederlands',
141
-	'no' => 'norsk',
142
-	'nb' => 'norsk bokm&aring;l',
143
-	'nn' => 'norsk nynorsk',
144
-	'oc' => '&ograve;c',
145
-	'oc_lnc' => '&ograve;c lengadocian',
146
-	'oc_ni' => '&ograve;c ni&ccedil;ard',
147
-	'oc_ni_la' => '&ograve;c ni&ccedil;ard (larg)',
148
-	'oc_ni_mis' => '&ograve;c nissart (mistralenc)',
149
-	'oc_prv' => '&ograve;c proven&ccedil;au',
150
-	'oc_gsc' => '&ograve;c gascon',
151
-	'oc_lms' => '&ograve;c lemosin',
152
-	'oc_auv' => '&ograve;c auvernhat',
153
-	'oc_va' => '&ograve;c vivaroaupenc',
154
-	'om' => '(Afan) Oromo',
155
-	'or' => 'Oriya',
156
-	'pa' => 'Punjabi',
157
-	'pbb' => 'Nasa Yuwe',
158
-	'pl' => 'polski',
159
-	'prs' => '&#1583;&#1585;&#1740;', // ISO-639-3 Dari (Afghanistan)
160
-	'ps' => '&#1662;&#1690;&#1578;&#1608;',
161
-	'pt' => 'Portugu&#234;s',
162
-	'pt_br' => 'Portugu&#234;s do Brasil',
163
-	'qu' => 'Quechua',
164
-	'rm' => 'Rhaeto-Romance',
165
-	'rn' => 'Kirundi',
166
-	'ro' => 'rom&#226;n&#259;',
167
-	'roa' => "ch'ti",
168
-	'ru' => '&#1088;&#1091;&#1089;&#1089;&#1082;&#1080;&#1081;',
169
-	'rw' => 'Kinyarwanda',
170
-	'sa' => '&#2360;&#2306;&#2360;&#2381;&#2325;&#2371;&#2340;',
171
-	'sc' => 'sardu',
172
-	'scn' => 'sicilianu',
173
-	'sd' => 'Sindhi',
174
-	'sg' => 'Sangho',
175
-	'sh' => 'srpskohrvastski',
176
-	'sh_latn' => 'srpskohrvastski',
177
-	'sh_cyrl' => '&#1057;&#1088;&#1087;&#1089;&#1082;&#1086;&#1093;&#1088;&#1074;&#1072;&#1090;&#1089;&#1082;&#1080;',
178
-	'si' => 'Sinhalese',
179
-	'sk' => 'sloven&#269;ina',  // (Slovakia)
180
-	'sl' => 'sloven&#353;&#269;ina',  // (Slovenia)
181
-	'sm' => 'Samoan',
182
-	'sn' => 'Shona',
183
-	'so' => 'Somali',
184
-	'sq' => 'shqip',
185
-	'sr' => '&#1089;&#1088;&#1087;&#1089;&#1082;&#1080;',
186
-	'src' => 'sardu logudor&#233;su', // sarde cf 'sc'
187
-	'sro' => 'sardu campidan&#233;su',
188
-	'ss' => 'Siswati',
189
-	'st' => 'Sesotho',
190
-	'su' => 'Sundanese',
191
-	'sv' => 'svenska',
192
-	'sw' => 'Kiswahili',
193
-	'ta' => '&#2980;&#2990;&#3007;&#2996;&#3021;', // Tamil
194
-	'te' => 'Telugu',
195
-	'tg' => 'Tajik',
196
-	'th' => '&#3652;&#3607;&#3618;',
197
-	'ti' => 'Tigrinya',
198
-	'tk' => 'Turkmen',
199
-	'tl' => 'Tagalog',
200
-	'tn' => 'Setswana',
201
-	'to' => 'Tonga',
202
-	'tr' => 'T&#252;rk&#231;e',
203
-	'ts' => 'Tsonga',
204
-	'tt' => '&#1058;&#1072;&#1090;&#1072;&#1088;',
205
-	'tw' => 'Twi',
206
-	'ty' => 'reo m&#257;`ohi', // tahitien
207
-	'ug' => 'Uighur',
208
-	'uk' => '&#1091;&#1082;&#1088;&#1072;&#1111;&#1085;&#1089;&#1100;&#1082;&#1072;',
209
-	'ur' => '&#1649;&#1585;&#1583;&#1608;',
210
-	'uz' => "O'zbekcha",
211
-	'vi' => 'Ti&#7871;ng Vi&#7879;t',
212
-	'vo' => 'Volapuk',
213
-	'wa' => 'walon',
214
-	'wo' => 'Wolof',
215
-	'xh' => 'Xhosa',
216
-	'yi' => 'Yiddish',
217
-	'yo' => 'Yoruba',
218
-	'za' => 'Zhuang',
219
-	'zh' => '&#20013;&#25991;', // chinois (ecriture simplifiee)
220
-	'zh_tw' => '&#21488;&#28771;&#20013;&#25991;', // chinois taiwan (ecr. traditionnelle)
221
-	'zu' => 'Zulu'
25
+    'aa' => 'Afar',
26
+    'ab' => 'Abkhazian',
27
+    'af' => 'Afrikaans',
28
+    'am' => 'Amharic',
29
+    'an' => 'Aragon&#233;s',
30
+    'ar' => '&#1593;&#1585;&#1576;&#1610;',
31
+    'as' => 'Assamese',
32
+    'ast' => 'asturianu',
33
+    'ay' => 'Aymara',
34
+    'az' => 'Az&#601;rbaycan dili',
35
+    'ba' => 'Bashkir',
36
+    'be' => '&#1041;&#1077;&#1083;&#1072;&#1088;&#1091;&#1089;&#1082;&#1072;&#1103;',
37
+    'ber_tam' => 'Tamazigh',
38
+    'ber_tam_tfng' => 'Tamazigh tifinagh',
39
+    'bg' => '&#1073;&#1098;&#1083;&#1075;&#1072;&#1088;&#1089;&#1082;&#1080;',
40
+    'bh' => 'Bihari',
41
+    'bi' => 'Bislama',
42
+    'bm' => 'Bambara',
43
+    'bn' => 'Bengali; Bangla',
44
+    'bo' => 'Tibetan',
45
+    'br' => 'brezhoneg',
46
+    'bs' => 'bosanski',
47
+    'ca' => 'catal&#224;',
48
+    'co' => 'corsu',
49
+    'cpf' => 'Kr&eacute;ol r&eacute;yon&eacute;',
50
+    'cpf_dom' => 'Krey&ograve;l',
51
+    'cpf_hat' => 'Krey&ograve;l (Peyi Dayiti)',
52
+    'cs' => '&#269;e&#353;tina',
53
+    'cy' => 'Cymraeg',  # welsh, gallois
54
+    'da' => 'dansk',
55
+    'de' => 'Deutsch',
56
+    'dz' => 'Bhutani',
57
+    'el' => '&#949;&#955;&#955;&#951;&#957;&#953;&#954;&#940;',
58
+    'en' => 'English',
59
+    'en_hx' => 'H4ck3R',
60
+    'en_sm' => 'Smurf',
61
+    'eo' => 'Esperanto',
62
+    'es' => 'Espa&#241;ol',
63
+    'es_co' => 'Colombiano',
64
+    'es_mx_pop' => 'Mexicano a lo g&#252;ey',
65
+    'et' => 'eesti',
66
+    'eu' => 'euskara',
67
+    'fa' => '&#1601;&#1575;&#1585;&#1587;&#1609;',
68
+    'ff' => 'Fulah', // peul
69
+    'fi' => 'suomi',
70
+    'fj' => 'Fiji',
71
+    'fo' => 'f&#248;royskt',
72
+    'fon' => 'fongb&egrave;',
73
+    'fr' => 'fran&#231;ais',
74
+    'fr_fem' => 'fran&#231;ais f&#233;minin',
75
+    'fr_sc' => 'schtroumpf',
76
+    'fr_lpc' => 'langue parl&#233;e compl&#233;t&#233;e',
77
+    'fr_lsf' => 'langue des signes fran&#231;aise',
78
+    'fr_spl' => 'fran&#231;ais simplifi&#233;',
79
+    'fr_tu' => 'fran&#231;ais copain',
80
+    'fy' => 'Frisian',
81
+    'ga' => 'Irish',
82
+    'gd' => 'Scots Gaelic',
83
+    'gl' => 'galego',
84
+    'gn' => 'Guarani',
85
+    'grc' => '&#7944;&#961;&#967;&#945;&#943;&#945; &#7961;&#955;&#955;&#951;&#957;&#953;&#954;&#942;', // grec ancien
86
+    'gu' => 'Gujarati',
87
+    'ha' => 'Hausa',
88
+    'hac' => '&#1705;-&#1607;&#1734;&#1585;&#1575;&#1605;&#1740;', //"Kurdish-Horami"
89
+    'hbo' => '&#1506;&#1489;&#1512;&#1497;&#1514;&#1470;&#1492;&#1514;&#1504;&#1498;', // hebreu classique ou biblique
90
+    'haz' => '&#x647;&#x632;&#x627;&#x631;&#x647; &#x6AF;&#x6CC;',
91
+    'he' => '&#1506;&#1489;&#1512;&#1497;&#1514;',
92
+    'hi' => '&#2361;&#2367;&#2306;&#2342;&#2368;',
93
+    'hr' => 'hrvatski',
94
+    'hu' => 'magyar',
95
+    'hy' => '&#1344;&#1377;&#1397;&#1381;&#1408;&#1381;&#1398;',// Arménien
96
+    'ia' => 'Interlingua',
97
+    'id' => 'Indonesia',
98
+    'ie' => 'Interlingue',
99
+    'ik' => 'Inupiak',
100
+    'is' => '&#237;slenska',
101
+    'it' => 'italiano',
102
+    'it_fem' => 'italiana',
103
+    'iu' => 'Inuktitut',
104
+    'ja' => '&#26085;&#26412;&#35486;',
105
+    'jv' => 'Javanese',
106
+    'ka' => '&#4325;&#4304;&#4320;&#4311;&#4323;&#4314;&#4312;',
107
+    'kk' => '&#1179;&#1072;&#1079;&#1072;&#1179;&#32;&#1090;&#1110;&#1083;&#1110;', // Kazakh
108
+    'kl' => 'kalaallisut',
109
+    'km' => '&#6039;&#6070;&#6047;&#6070;&#6017;&#6098;&#6040;&#6082;&#6042;',// Khmer
110
+    'kn' => 'Kannada',
111
+    'ko' => '&#54620;&#44397;&#50612;',
112
+    'kok' => '&#2325;&#2379;&#2306;&#2325;&#2339;&#2368;',
113
+    'ks' => 'Kashmiri',
114
+    'ku' => '&#1705;&#1608;&#1585;&#1583;&#1740;',
115
+    'ky' => 'Kirghiz',
116
+    'la' => 'lingua latina',
117
+    'lb' => 'L&euml;tzebuergesch',
118
+    'ln' => 'Lingala',
119
+    'lo' => '&#3742;&#3762;&#3754;&#3762;&#3749;&#3762;&#3751;', # lao
120
+    'lt' => 'lietuvi&#371;',
121
+    'lu' => 'luba-katanga',
122
+    'lv' => 'latvie&#353;u',
123
+    'man' => 'mandingue', # a traduire en mandingue
124
+    'mfv' => 'manjak', # ISO-639-3
125
+    'mg' => 'Malagasy',
126
+    'mi' => 'Maori',
127
+    'mk' => '&#1084;&#1072;&#1082;&#1077;&#1076;&#1086;&#1085;&#1089;&#1082;&#1080; &#1112;&#1072;&#1079;&#1080;&#1082;',
128
+    'ml' => 'Malayalam',
129
+    'mn' => 'Монгол хэл',
130
+    'mo' => 'Moldavian',
131
+    'mos' => 'Mor&eacute;',
132
+    'mr' => '&#2350;&#2352;&#2366;&#2336;&#2368;',
133
+    'ms' => 'Bahasa Malaysia',
134
+    'mt' => 'Maltese',
135
+    'my' => 'Burmese',
136
+    'na' => 'Nauru',
137
+    'nap' => 'napulitano',
138
+    'ne' => 'Nepali',
139
+    'nqo' => "N'ko", // www.manden.org
140
+    'nl' => 'Nederlands',
141
+    'no' => 'norsk',
142
+    'nb' => 'norsk bokm&aring;l',
143
+    'nn' => 'norsk nynorsk',
144
+    'oc' => '&ograve;c',
145
+    'oc_lnc' => '&ograve;c lengadocian',
146
+    'oc_ni' => '&ograve;c ni&ccedil;ard',
147
+    'oc_ni_la' => '&ograve;c ni&ccedil;ard (larg)',
148
+    'oc_ni_mis' => '&ograve;c nissart (mistralenc)',
149
+    'oc_prv' => '&ograve;c proven&ccedil;au',
150
+    'oc_gsc' => '&ograve;c gascon',
151
+    'oc_lms' => '&ograve;c lemosin',
152
+    'oc_auv' => '&ograve;c auvernhat',
153
+    'oc_va' => '&ograve;c vivaroaupenc',
154
+    'om' => '(Afan) Oromo',
155
+    'or' => 'Oriya',
156
+    'pa' => 'Punjabi',
157
+    'pbb' => 'Nasa Yuwe',
158
+    'pl' => 'polski',
159
+    'prs' => '&#1583;&#1585;&#1740;', // ISO-639-3 Dari (Afghanistan)
160
+    'ps' => '&#1662;&#1690;&#1578;&#1608;',
161
+    'pt' => 'Portugu&#234;s',
162
+    'pt_br' => 'Portugu&#234;s do Brasil',
163
+    'qu' => 'Quechua',
164
+    'rm' => 'Rhaeto-Romance',
165
+    'rn' => 'Kirundi',
166
+    'ro' => 'rom&#226;n&#259;',
167
+    'roa' => "ch'ti",
168
+    'ru' => '&#1088;&#1091;&#1089;&#1089;&#1082;&#1080;&#1081;',
169
+    'rw' => 'Kinyarwanda',
170
+    'sa' => '&#2360;&#2306;&#2360;&#2381;&#2325;&#2371;&#2340;',
171
+    'sc' => 'sardu',
172
+    'scn' => 'sicilianu',
173
+    'sd' => 'Sindhi',
174
+    'sg' => 'Sangho',
175
+    'sh' => 'srpskohrvastski',
176
+    'sh_latn' => 'srpskohrvastski',
177
+    'sh_cyrl' => '&#1057;&#1088;&#1087;&#1089;&#1082;&#1086;&#1093;&#1088;&#1074;&#1072;&#1090;&#1089;&#1082;&#1080;',
178
+    'si' => 'Sinhalese',
179
+    'sk' => 'sloven&#269;ina',  // (Slovakia)
180
+    'sl' => 'sloven&#353;&#269;ina',  // (Slovenia)
181
+    'sm' => 'Samoan',
182
+    'sn' => 'Shona',
183
+    'so' => 'Somali',
184
+    'sq' => 'shqip',
185
+    'sr' => '&#1089;&#1088;&#1087;&#1089;&#1082;&#1080;',
186
+    'src' => 'sardu logudor&#233;su', // sarde cf 'sc'
187
+    'sro' => 'sardu campidan&#233;su',
188
+    'ss' => 'Siswati',
189
+    'st' => 'Sesotho',
190
+    'su' => 'Sundanese',
191
+    'sv' => 'svenska',
192
+    'sw' => 'Kiswahili',
193
+    'ta' => '&#2980;&#2990;&#3007;&#2996;&#3021;', // Tamil
194
+    'te' => 'Telugu',
195
+    'tg' => 'Tajik',
196
+    'th' => '&#3652;&#3607;&#3618;',
197
+    'ti' => 'Tigrinya',
198
+    'tk' => 'Turkmen',
199
+    'tl' => 'Tagalog',
200
+    'tn' => 'Setswana',
201
+    'to' => 'Tonga',
202
+    'tr' => 'T&#252;rk&#231;e',
203
+    'ts' => 'Tsonga',
204
+    'tt' => '&#1058;&#1072;&#1090;&#1072;&#1088;',
205
+    'tw' => 'Twi',
206
+    'ty' => 'reo m&#257;`ohi', // tahitien
207
+    'ug' => 'Uighur',
208
+    'uk' => '&#1091;&#1082;&#1088;&#1072;&#1111;&#1085;&#1089;&#1100;&#1082;&#1072;',
209
+    'ur' => '&#1649;&#1585;&#1583;&#1608;',
210
+    'uz' => "O'zbekcha",
211
+    'vi' => 'Ti&#7871;ng Vi&#7879;t',
212
+    'vo' => 'Volapuk',
213
+    'wa' => 'walon',
214
+    'wo' => 'Wolof',
215
+    'xh' => 'Xhosa',
216
+    'yi' => 'Yiddish',
217
+    'yo' => 'Yoruba',
218
+    'za' => 'Zhuang',
219
+    'zh' => '&#20013;&#25991;', // chinois (ecriture simplifiee)
220
+    'zh_tw' => '&#21488;&#28771;&#20013;&#25991;', // chinois taiwan (ecr. traditionnelle)
221
+    'zu' => 'Zulu'
222 222
 
223 223
 ];
Please login to merge, or discard this patch.
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -50,7 +50,7 @@  discard block
 block discarded – undo
50 50
 	'cpf_dom' => 'Krey&ograve;l',
51 51
 	'cpf_hat' => 'Krey&ograve;l (Peyi Dayiti)',
52 52
 	'cs' => '&#269;e&#353;tina',
53
-	'cy' => 'Cymraeg',  # welsh, gallois
53
+	'cy' => 'Cymraeg', # welsh, gallois
54 54
 	'da' => 'dansk',
55 55
 	'de' => 'Deutsch',
56 56
 	'dz' => 'Bhutani',
@@ -92,7 +92,7 @@  discard block
 block discarded – undo
92 92
 	'hi' => '&#2361;&#2367;&#2306;&#2342;&#2368;',
93 93
 	'hr' => 'hrvatski',
94 94
 	'hu' => 'magyar',
95
-	'hy' => '&#1344;&#1377;&#1397;&#1381;&#1408;&#1381;&#1398;',// Arménien
95
+	'hy' => '&#1344;&#1377;&#1397;&#1381;&#1408;&#1381;&#1398;', // Arménien
96 96
 	'ia' => 'Interlingua',
97 97
 	'id' => 'Indonesia',
98 98
 	'ie' => 'Interlingue',
@@ -106,7 +106,7 @@  discard block
 block discarded – undo
106 106
 	'ka' => '&#4325;&#4304;&#4320;&#4311;&#4323;&#4314;&#4312;',
107 107
 	'kk' => '&#1179;&#1072;&#1079;&#1072;&#1179;&#32;&#1090;&#1110;&#1083;&#1110;', // Kazakh
108 108
 	'kl' => 'kalaallisut',
109
-	'km' => '&#6039;&#6070;&#6047;&#6070;&#6017;&#6098;&#6040;&#6082;&#6042;',// Khmer
109
+	'km' => '&#6039;&#6070;&#6047;&#6070;&#6017;&#6098;&#6040;&#6082;&#6042;', // Khmer
110 110
 	'kn' => 'Kannada',
111 111
 	'ko' => '&#54620;&#44397;&#50612;',
112 112
 	'kok' => '&#2325;&#2379;&#2306;&#2325;&#2339;&#2368;',
@@ -176,8 +176,8 @@  discard block
 block discarded – undo
176 176
 	'sh_latn' => 'srpskohrvastski',
177 177
 	'sh_cyrl' => '&#1057;&#1088;&#1087;&#1089;&#1082;&#1086;&#1093;&#1088;&#1074;&#1072;&#1090;&#1089;&#1082;&#1080;',
178 178
 	'si' => 'Sinhalese',
179
-	'sk' => 'sloven&#269;ina',  // (Slovakia)
180
-	'sl' => 'sloven&#353;&#269;ina',  // (Slovenia)
179
+	'sk' => 'sloven&#269;ina', // (Slovakia)
180
+	'sl' => 'sloven&#353;&#269;ina', // (Slovenia)
181 181
 	'sm' => 'Samoan',
182 182
 	'sn' => 'Shona',
183 183
 	'so' => 'Somali',
Please login to merge, or discard this patch.
ecrire/inc/selectionner.php 2 patches
Indentation   +108 added lines, -108 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
 include_spip('inc/filtres');
@@ -46,56 +46,56 @@  discard block
 block discarded – undo
46 46
  **/
47 47
 function inc_selectionner_dist($sel, $idom = '', $exclus = 0, $aff_racine = false, $recur = true, $do = 'aff') {
48 48
 
49
-	if ($recur) {
50
-		$recur = mini_hier($sel);
51
-	} else {
52
-		$sel = 0;
53
-	}
54
-
55
-	if ($aff_racine) {
56
-		$info = generer_url_ecrire('informer', "type=rubrique&rac=$idom&do=$do&id=");
57
-		$idom3 = $idom . '_selection';
58
-
59
-		$onClick = "jQuery(this).parent().addClass('on');jQuery('#choix_parent_principal .on').removeClass('on'); aff_selection(0, '$idom3', '$info', event);return false;";
60
-
61
-		$ondbClick = strtr(
62
-			str_replace(
63
-				"'",
64
-				'&#8217;',
65
-				str_replace(
66
-					'"',
67
-					'&#34;',
68
-					textebrut(_T('info_racine_site'))
69
-				)
70
-			),
71
-			"\n\r",
72
-			'  '
73
-		);
74
-
75
-		$js_func = $do . '_selection_titre';
76
-		$ondbClick = "$js_func('$ondbClick',0,'selection_rubrique','id_parent');";
77
-
78
-		$aff_racine = "<div class='petit-item petite-racine item'>"
79
-			. "<a href='#'"
80
-			. 'onclick="'
81
-			. $onClick
82
-			. "\"\nondbclick=\""
83
-			. $ondbClick
84
-			. $onClick
85
-			. '">'
86
-			. _T('info_racine_site')
87
-			. '</a></div>';
88
-	}
89
-
90
-	$url_init = generer_url_ecrire('plonger', "rac=$idom&exclus=$exclus&id=0&col=1&do=$do");
91
-
92
-	$plonger = charger_fonction('plonger', 'inc');
93
-	$plonger_r = $plonger($sel, $idom, $recur, 1, $exclus, $do);
94
-
95
-	// url completee par la fonction JS onkeypress_rechercher
96
-	$url = generer_url_ecrire('rechercher', "exclus=$exclus&rac=$idom&do=$do&type=");
97
-
98
-	return construire_selectionner_hierarchie($idom, $plonger_r, $aff_racine, $url, 'id_parent', $url_init);
49
+    if ($recur) {
50
+        $recur = mini_hier($sel);
51
+    } else {
52
+        $sel = 0;
53
+    }
54
+
55
+    if ($aff_racine) {
56
+        $info = generer_url_ecrire('informer', "type=rubrique&rac=$idom&do=$do&id=");
57
+        $idom3 = $idom . '_selection';
58
+
59
+        $onClick = "jQuery(this).parent().addClass('on');jQuery('#choix_parent_principal .on').removeClass('on'); aff_selection(0, '$idom3', '$info', event);return false;";
60
+
61
+        $ondbClick = strtr(
62
+            str_replace(
63
+                "'",
64
+                '&#8217;',
65
+                str_replace(
66
+                    '"',
67
+                    '&#34;',
68
+                    textebrut(_T('info_racine_site'))
69
+                )
70
+            ),
71
+            "\n\r",
72
+            '  '
73
+        );
74
+
75
+        $js_func = $do . '_selection_titre';
76
+        $ondbClick = "$js_func('$ondbClick',0,'selection_rubrique','id_parent');";
77
+
78
+        $aff_racine = "<div class='petit-item petite-racine item'>"
79
+            . "<a href='#'"
80
+            . 'onclick="'
81
+            . $onClick
82
+            . "\"\nondbclick=\""
83
+            . $ondbClick
84
+            . $onClick
85
+            . '">'
86
+            . _T('info_racine_site')
87
+            . '</a></div>';
88
+    }
89
+
90
+    $url_init = generer_url_ecrire('plonger', "rac=$idom&exclus=$exclus&id=0&col=1&do=$do");
91
+
92
+    $plonger = charger_fonction('plonger', 'inc');
93
+    $plonger_r = $plonger($sel, $idom, $recur, 1, $exclus, $do);
94
+
95
+    // url completee par la fonction JS onkeypress_rechercher
96
+    $url = generer_url_ecrire('rechercher', "exclus=$exclus&rac=$idom&do=$do&type=");
97
+
98
+    return construire_selectionner_hierarchie($idom, $plonger_r, $aff_racine, $url, 'id_parent', $url_init);
99 99
 }
100 100
 
101 101
 /**
@@ -113,58 +113,58 @@  discard block
 block discarded – undo
113 113
  **/
114 114
 function construire_selectionner_hierarchie($idom, $liste, $racine, $url, $name, $url_init = '') {
115 115
 
116
-	$idom1 = $idom . '_champ_recherche';
117
-	$idom2 = $idom . '_principal';
118
-	$idom3 = $idom . '_selection';
119
-	$idom4 = $idom . '_col_1';
120
-	$idom5 = 'img_' . $idom4;
121
-	$idom6 = $idom . '_fonc';
122
-
123
-	return "<div id='$idom'>"
124
-	. "<a id='$idom6' style='visibility: hidden;'"
125
-	. ($url_init ? "\nhref='$url_init'" : '')
126
-	. '></a>'
127
-	. "<div class='recherche_rapide_parent formulaire_recherche'>"
128
-	. http_img_pack(
129
-		'loader.svg',
130
-		'',
131
-		"class='loader' style='visibility: hidden;float:" . $GLOBALS['spip_lang_right'] . "' id='$idom5'"
132
-	)
133
-	. ''
134
-	. "<input style='width: 10em;float:" . $GLOBALS['spip_lang_right'] . ";' type='text' class='text search' id='$idom1' placeholder='" . _T('info_rechercher') . "'"
135
-	// eliminer Return car il provoque la soumission (balise unique)
136
-	// et eliminer Tab pour la navigation au clavier
137
-	// ce serait encore mieux de ne le faire que s'il y a encore plusieurs
138
-	// resultats retournes par la recherche
139
-	. "\nonkeypress=\"k=event.keyCode;if (k==13 || k==3 || k==9){return false;}\""
140
-	// lancer la recherche apres le filtrage ci-dessus sauf sur le tab (navigation au clavier)
141
-	. "\nonkeyup=\"if(event.keyCode==9){return false;};return onkey_rechercher(this.value,"
142
-	// la destination de la recherche
143
-	. "'$idom4'"
116
+    $idom1 = $idom . '_champ_recherche';
117
+    $idom2 = $idom . '_principal';
118
+    $idom3 = $idom . '_selection';
119
+    $idom4 = $idom . '_col_1';
120
+    $idom5 = 'img_' . $idom4;
121
+    $idom6 = $idom . '_fonc';
122
+
123
+    return "<div id='$idom'>"
124
+    . "<a id='$idom6' style='visibility: hidden;'"
125
+    . ($url_init ? "\nhref='$url_init'" : '')
126
+    . '></a>'
127
+    . "<div class='recherche_rapide_parent formulaire_recherche'>"
128
+    . http_img_pack(
129
+        'loader.svg',
130
+        '',
131
+        "class='loader' style='visibility: hidden;float:" . $GLOBALS['spip_lang_right'] . "' id='$idom5'"
132
+    )
133
+    . ''
134
+    . "<input style='width: 10em;float:" . $GLOBALS['spip_lang_right'] . ";' type='text' class='text search' id='$idom1' placeholder='" . _T('info_rechercher') . "'"
135
+    // eliminer Return car il provoque la soumission (balise unique)
136
+    // et eliminer Tab pour la navigation au clavier
137
+    // ce serait encore mieux de ne le faire que s'il y a encore plusieurs
138
+    // resultats retournes par la recherche
139
+    . "\nonkeypress=\"k=event.keyCode;if (k==13 || k==3 || k==9){return false;}\""
140
+    // lancer la recherche apres le filtrage ci-dessus sauf sur le tab (navigation au clavier)
141
+    . "\nonkeyup=\"if(event.keyCode==9){return false;};return onkey_rechercher(this.value,"
142
+    // la destination de la recherche
143
+    . "'$idom4'"
144 144
 #	. "this.parentNode.parentNode.parentNode.parentNode.nextSibling.firstChild.id"
145
-	. ",'"
146
-	// l'url effectuant la recherche
147
-	. $url
148
-	. "',"
149
-	// le noeud contenant un gif anime
150
-	// . "'idom5'"
151
-	. 'this.parentNode.previousSibling.firstChild'
152
-	. ",'"
153
-	// la valeur de l'attribut Name a remplir
154
-	. $name
155
-	. "','"
156
-	// noeud invisible memorisant l'URL initiale (pour re-initialisation)
157
-	. $idom6
158
-	. "')\""
159
-	. ' />'
160
-	. "\n</div>"
161
-	. ($racine ? "<div>$racine</div>" : '')
162
-	. "<div id='"
163
-	. $idom2
164
-	. "'><div id='$idom4'"
165
-	. " class=''>"
166
-	. $liste
167
-	. "</div></div>\n<div id='$idom3'></div></div>\n";
145
+    . ",'"
146
+    // l'url effectuant la recherche
147
+    . $url
148
+    . "',"
149
+    // le noeud contenant un gif anime
150
+    // . "'idom5'"
151
+    . 'this.parentNode.previousSibling.firstChild'
152
+    . ",'"
153
+    // la valeur de l'attribut Name a remplir
154
+    . $name
155
+    . "','"
156
+    // noeud invisible memorisant l'URL initiale (pour re-initialisation)
157
+    . $idom6
158
+    . "')\""
159
+    . ' />'
160
+    . "\n</div>"
161
+    . ($racine ? "<div>$racine</div>" : '')
162
+    . "<div id='"
163
+    . $idom2
164
+    . "'><div id='$idom4'"
165
+    . " class=''>"
166
+    . $liste
167
+    . "</div></div>\n<div id='$idom3'></div></div>\n";
168 168
 }
169 169
 
170 170
 /**
@@ -176,11 +176,11 @@  discard block
 block discarded – undo
176 176
  **/
177 177
 function mini_hier($id_rubrique) {
178 178
 
179
-	$liste = $id_rubrique;
180
-	$id_rubrique = intval($id_rubrique);
181
-	while ($id_rubrique = sql_getfetsel('id_parent', 'spip_rubriques', 'id_rubrique = ' . $id_rubrique)) {
182
-		$liste = $id_rubrique . ",$liste";
183
-	}
179
+    $liste = $id_rubrique;
180
+    $id_rubrique = intval($id_rubrique);
181
+    while ($id_rubrique = sql_getfetsel('id_parent', 'spip_rubriques', 'id_rubrique = ' . $id_rubrique)) {
182
+        $liste = $id_rubrique . ",$liste";
183
+    }
184 184
 
185
-	return explode(',', "0,$liste");
185
+    return explode(',', "0,$liste");
186 186
 }
Please login to merge, or discard this patch.
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -54,7 +54,7 @@  discard block
 block discarded – undo
54 54
 
55 55
 	if ($aff_racine) {
56 56
 		$info = generer_url_ecrire('informer', "type=rubrique&rac=$idom&do=$do&id=");
57
-		$idom3 = $idom . '_selection';
57
+		$idom3 = $idom.'_selection';
58 58
 
59 59
 		$onClick = "jQuery(this).parent().addClass('on');jQuery('#choix_parent_principal .on').removeClass('on'); aff_selection(0, '$idom3', '$info', event);return false;";
60 60
 
@@ -72,7 +72,7 @@  discard block
 block discarded – undo
72 72
 			'  '
73 73
 		);
74 74
 
75
-		$js_func = $do . '_selection_titre';
75
+		$js_func = $do.'_selection_titre';
76 76
 		$ondbClick = "$js_func('$ondbClick',0,'selection_rubrique','id_parent');";
77 77
 
78 78
 		$aff_racine = "<div class='petit-item petite-racine item'>"
@@ -113,12 +113,12 @@  discard block
 block discarded – undo
113 113
  **/
114 114
 function construire_selectionner_hierarchie($idom, $liste, $racine, $url, $name, $url_init = '') {
115 115
 
116
-	$idom1 = $idom . '_champ_recherche';
117
-	$idom2 = $idom . '_principal';
118
-	$idom3 = $idom . '_selection';
119
-	$idom4 = $idom . '_col_1';
120
-	$idom5 = 'img_' . $idom4;
121
-	$idom6 = $idom . '_fonc';
116
+	$idom1 = $idom.'_champ_recherche';
117
+	$idom2 = $idom.'_principal';
118
+	$idom3 = $idom.'_selection';
119
+	$idom4 = $idom.'_col_1';
120
+	$idom5 = 'img_'.$idom4;
121
+	$idom6 = $idom.'_fonc';
122 122
 
123 123
 	return "<div id='$idom'>"
124 124
 	. "<a id='$idom6' style='visibility: hidden;'"
@@ -128,10 +128,10 @@  discard block
 block discarded – undo
128 128
 	. http_img_pack(
129 129
 		'loader.svg',
130 130
 		'',
131
-		"class='loader' style='visibility: hidden;float:" . $GLOBALS['spip_lang_right'] . "' id='$idom5'"
131
+		"class='loader' style='visibility: hidden;float:".$GLOBALS['spip_lang_right']."' id='$idom5'"
132 132
 	)
133 133
 	. ''
134
-	. "<input style='width: 10em;float:" . $GLOBALS['spip_lang_right'] . ";' type='text' class='text search' id='$idom1' placeholder='" . _T('info_rechercher') . "'"
134
+	. "<input style='width: 10em;float:".$GLOBALS['spip_lang_right'].";' type='text' class='text search' id='$idom1' placeholder='"._T('info_rechercher')."'"
135 135
 	// eliminer Return car il provoque la soumission (balise unique)
136 136
 	// et eliminer Tab pour la navigation au clavier
137 137
 	// ce serait encore mieux de ne le faire que s'il y a encore plusieurs
@@ -178,8 +178,8 @@  discard block
 block discarded – undo
178 178
 
179 179
 	$liste = $id_rubrique;
180 180
 	$id_rubrique = intval($id_rubrique);
181
-	while ($id_rubrique = sql_getfetsel('id_parent', 'spip_rubriques', 'id_rubrique = ' . $id_rubrique)) {
182
-		$liste = $id_rubrique . ",$liste";
181
+	while ($id_rubrique = sql_getfetsel('id_parent', 'spip_rubriques', 'id_rubrique = '.$id_rubrique)) {
182
+		$liste = $id_rubrique.",$liste";
183 183
 	}
184 184
 
185 185
 	return explode(',', "0,$liste");
Please login to merge, or discard this patch.
ecrire/inc/notifications.php 2 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -39,7 +39,7 @@  discard block
 block discarded – undo
39 39
 
40 40
 	if ($notification = charger_fonction($quoi, 'notifications', true)) {
41 41
 		spip_log("$notification($quoi,$id"
42
-			. ($options ? ',' . serialize($options) : '')
42
+			. ($options ? ','.serialize($options) : '')
43 43
 			. ')', 'notifications');
44 44
 		$notification($quoi, $id, $options);
45 45
 	}
@@ -157,7 +157,7 @@  discard block
 block discarded – undo
157 157
 
158 158
 		job_queue_add(
159 159
 			'envoyer_mail',
160
-			">$email : " . $envoi['sujet'],
160
+			">$email : ".$envoi['sujet'],
161 161
 			[$email, $envoi['sujet'], $envoi['texte'], $envoi['from'], $envoi['headers']],
162 162
 			'inc/'
163 163
 		);
Please login to merge, or discard this patch.
Indentation   +108 added lines, -108 removed lines patch added patch discarded remove patch
@@ -16,7 +16,7 @@  discard block
 block discarded – undo
16 16
  * @package SPIP\Core\Notifications
17 17
  **/
18 18
 if (!defined('_ECRIRE_INC_VERSION')) {
19
-	return;
19
+    return;
20 20
 }
21 21
 
22 22
 
@@ -33,16 +33,16 @@  discard block
 block discarded – undo
33 33
  */
34 34
 function inc_notifications_dist($quoi, $id = 0, $options = []) {
35 35
 
36
-	// charger les fichiers qui veulent ajouter des definitions
37
-	// ou faire des trucs aussi dans le pipeline, ca fait deux api pour le prix d'une ...
38
-	pipeline('notifications', ['args' => ['quoi' => $quoi, 'id' => $id, 'options' => $options]]);
36
+    // charger les fichiers qui veulent ajouter des definitions
37
+    // ou faire des trucs aussi dans le pipeline, ca fait deux api pour le prix d'une ...
38
+    pipeline('notifications', ['args' => ['quoi' => $quoi, 'id' => $id, 'options' => $options]]);
39 39
 
40
-	if ($notification = charger_fonction($quoi, 'notifications', true)) {
41
-		spip_log("$notification($quoi,$id"
42
-			. ($options ? ',' . serialize($options) : '')
43
-			. ')', 'notifications');
44
-		$notification($quoi, $id, $options);
45
-	}
40
+    if ($notification = charger_fonction($quoi, 'notifications', true)) {
41
+        spip_log("$notification($quoi,$id"
42
+            . ($options ? ',' . serialize($options) : '')
43
+            . ')', 'notifications');
44
+        $notification($quoi, $id, $options);
45
+    }
46 46
 }
47 47
 
48 48
 /**
@@ -56,15 +56,15 @@  discard block
 block discarded – undo
56 56
  * @param array $exclure
57 57
  */
58 58
 function notifications_nettoyer_emails(&$emails, $exclure = []) {
59
-	// filtrer et unifier
60
-	include_spip('inc/filtres');
61
-	$emails = array_unique(array_filter(array_map('email_valide', array_map('trim', $emails))));
62
-	if ($exclure and count($exclure)) {
63
-		// nettoyer les exclusions d'abord
64
-		notifications_nettoyer_emails($exclure);
65
-		// faire un diff
66
-		$emails = array_diff($emails, $exclure);
67
-	}
59
+    // filtrer et unifier
60
+    include_spip('inc/filtres');
61
+    $emails = array_unique(array_filter(array_map('email_valide', array_map('trim', $emails))));
62
+    if ($exclure and count($exclure)) {
63
+        // nettoyer les exclusions d'abord
64
+        notifications_nettoyer_emails($exclure);
65
+        // faire un diff
66
+        $emails = array_diff($emails, $exclure);
67
+    }
68 68
 }
69 69
 
70 70
 /**
@@ -79,90 +79,90 @@  discard block
 block discarded – undo
79 79
  * @param string $headers
80 80
  */
81 81
 function notifications_envoyer_mails($emails, $texte, $sujet = '', $from = '', $headers = '') {
82
-	// rien a faire si pas de texte !
83
-	if (!strlen($texte)) {
84
-		return;
85
-	}
86
-
87
-	// si on ne specifie qu'un email, le mettre dans un tableau
88
-	if (!is_array($emails)) {
89
-		$emails = explode(',', $emails);
90
-	}
91
-
92
-	notifications_nettoyer_emails($emails);
93
-
94
-	// tester si le mail est deja en html
95
-	if (
96
-		strpos($texte, '<') !== false // eviter les tests suivants si possible
97
-		and $ttrim = trim($texte)
98
-		and substr($ttrim, 0, 1) == '<'
99
-		and substr($ttrim, -1, 1) == '>'
100
-		and stripos($ttrim, '</html>') !== false
101
-	) {
102
-		if (!strlen($sujet)) {
103
-			// dans ce cas on ruse un peu : extraire le sujet du title
104
-			if (preg_match(',<title>(.*)</title>,Uims', $texte, $m)) {
105
-				$sujet = $m[1];
106
-			} else {
107
-				// fallback, on prend le body si on le trouve
108
-				if (preg_match(',<body[^>]*>(.*)</body>,Uims', $texte, $m)) {
109
-					$ttrim = $m[1];
110
-				}
111
-
112
-				// et on extrait la premiere ligne de vrai texte...
113
-				// nettoyer le html et les retours chariots
114
-				$ttrim = textebrut($ttrim);
115
-				$ttrim = str_replace("\r\n", "\r", $ttrim);
116
-				$ttrim = str_replace("\r", "\n", $ttrim);
117
-				// decouper
118
-				$ttrim = explode("\n", trim($ttrim));
119
-				// extraire la premiere ligne de texte brut
120
-				$sujet = array_shift($ttrim);
121
-			}
122
-		}
123
-
124
-		// si besoin on ajoute le content-type dans les headers
125
-		if (stripos($headers, 'Content-Type') === false) {
126
-			$headers .= "Content-Type: text/html\n";
127
-		}
128
-	}
129
-
130
-	// si le sujet est vide, extraire la premiere ligne du corps
131
-	// du mail qui est donc du texte
132
-	if (!strlen($sujet)) {
133
-		// nettoyer un peu les retours chariots
134
-		$texte = str_replace("\r\n", "\r", $texte);
135
-		$texte = str_replace("\r", "\n", $texte);
136
-		// decouper
137
-		$texte = explode("\n", trim($texte));
138
-		// extraire la premiere ligne
139
-		$sujet = array_shift($texte);
140
-		$texte = trim(implode("\n", $texte));
141
-	}
142
-
143
-	$envoyer_mail = charger_fonction('envoyer_mail', 'inc');
144
-	foreach ($emails as $email) {
145
-		// passer dans un pipeline qui permet un ajout eventuel
146
-		// (url de suivi des notifications par exemple)
147
-		$envoi = pipeline(
148
-			'notifications_envoyer_mails',
149
-			[
150
-				'email' => $email,
151
-				'sujet' => $sujet,
152
-				'texte' => $texte,
153
-				'from' => $from,
154
-				'headers' => $headers,
155
-			]
156
-		);
157
-		$email = $envoi['email'];
158
-
159
-		job_queue_add(
160
-			'envoyer_mail',
161
-			">$email : " . $envoi['sujet'],
162
-			[$email, $envoi['sujet'], $envoi['texte'], $envoi['from'], $envoi['headers']],
163
-			'inc/'
164
-		);
165
-	}
82
+    // rien a faire si pas de texte !
83
+    if (!strlen($texte)) {
84
+        return;
85
+    }
86
+
87
+    // si on ne specifie qu'un email, le mettre dans un tableau
88
+    if (!is_array($emails)) {
89
+        $emails = explode(',', $emails);
90
+    }
91
+
92
+    notifications_nettoyer_emails($emails);
93
+
94
+    // tester si le mail est deja en html
95
+    if (
96
+        strpos($texte, '<') !== false // eviter les tests suivants si possible
97
+        and $ttrim = trim($texte)
98
+        and substr($ttrim, 0, 1) == '<'
99
+        and substr($ttrim, -1, 1) == '>'
100
+        and stripos($ttrim, '</html>') !== false
101
+    ) {
102
+        if (!strlen($sujet)) {
103
+            // dans ce cas on ruse un peu : extraire le sujet du title
104
+            if (preg_match(',<title>(.*)</title>,Uims', $texte, $m)) {
105
+                $sujet = $m[1];
106
+            } else {
107
+                // fallback, on prend le body si on le trouve
108
+                if (preg_match(',<body[^>]*>(.*)</body>,Uims', $texte, $m)) {
109
+                    $ttrim = $m[1];
110
+                }
111
+
112
+                // et on extrait la premiere ligne de vrai texte...
113
+                // nettoyer le html et les retours chariots
114
+                $ttrim = textebrut($ttrim);
115
+                $ttrim = str_replace("\r\n", "\r", $ttrim);
116
+                $ttrim = str_replace("\r", "\n", $ttrim);
117
+                // decouper
118
+                $ttrim = explode("\n", trim($ttrim));
119
+                // extraire la premiere ligne de texte brut
120
+                $sujet = array_shift($ttrim);
121
+            }
122
+        }
123
+
124
+        // si besoin on ajoute le content-type dans les headers
125
+        if (stripos($headers, 'Content-Type') === false) {
126
+            $headers .= "Content-Type: text/html\n";
127
+        }
128
+    }
129
+
130
+    // si le sujet est vide, extraire la premiere ligne du corps
131
+    // du mail qui est donc du texte
132
+    if (!strlen($sujet)) {
133
+        // nettoyer un peu les retours chariots
134
+        $texte = str_replace("\r\n", "\r", $texte);
135
+        $texte = str_replace("\r", "\n", $texte);
136
+        // decouper
137
+        $texte = explode("\n", trim($texte));
138
+        // extraire la premiere ligne
139
+        $sujet = array_shift($texte);
140
+        $texte = trim(implode("\n", $texte));
141
+    }
142
+
143
+    $envoyer_mail = charger_fonction('envoyer_mail', 'inc');
144
+    foreach ($emails as $email) {
145
+        // passer dans un pipeline qui permet un ajout eventuel
146
+        // (url de suivi des notifications par exemple)
147
+        $envoi = pipeline(
148
+            'notifications_envoyer_mails',
149
+            [
150
+                'email' => $email,
151
+                'sujet' => $sujet,
152
+                'texte' => $texte,
153
+                'from' => $from,
154
+                'headers' => $headers,
155
+            ]
156
+        );
157
+        $email = $envoi['email'];
158
+
159
+        job_queue_add(
160
+            'envoyer_mail',
161
+            ">$email : " . $envoi['sujet'],
162
+            [$email, $envoi['sujet'], $envoi['texte'], $envoi['from'], $envoi['headers']],
163
+            'inc/'
164
+        );
165
+    }
166 166
 }
167 167
 
168 168
 /**
@@ -178,10 +178,10 @@  discard block
 block discarded – undo
178 178
  * @return string
179 179
  */
180 180
 function email_notification_objet($id_objet, $type_objet, $modele) {
181
-	$envoyer_mail = charger_fonction('envoyer_mail', 'inc'); // pour nettoyer_titre_email
182
-	$id_type = id_table_objet($type_objet);
181
+    $envoyer_mail = charger_fonction('envoyer_mail', 'inc'); // pour nettoyer_titre_email
182
+    $id_type = id_table_objet($type_objet);
183 183
 
184
-	return recuperer_fond($modele, [$id_type => $id_objet, 'id' => $id_objet]);
184
+    return recuperer_fond($modele, [$id_type => $id_objet, 'id' => $id_objet]);
185 185
 }
186 186
 
187 187
 /**
@@ -196,7 +196,7 @@  discard block
 block discarded – undo
196 196
  * @return string
197 197
  */
198 198
 function email_notification_article($id_article, $modele) {
199
-	$envoyer_mail = charger_fonction('envoyer_mail', 'inc'); // pour nettoyer_titre_email
199
+    $envoyer_mail = charger_fonction('envoyer_mail', 'inc'); // pour nettoyer_titre_email
200 200
 
201
-	return recuperer_fond($modele, ['id_article' => $id_article]);
201
+    return recuperer_fond($modele, ['id_article' => $id_article]);
202 202
 }
Please login to merge, or discard this patch.