Completed
Push — master ( a56a38...81a660 )
by cam
01:36
created
ecrire/plugins/afficher_plugin.php 2 patches
Spacing   +34 added lines, -35 removed lines patch added patch discarded remove patch
@@ -63,9 +63,9 @@  discard block
 block discarded – undo
63 63
 			" class='picto_err'",
64 64
 			_T('plugin_info_erreur_xml')
65 65
 		)
66
-			. "<div class='erreur'>" . join('<br >', $info['erreur']) . '</div>';
66
+			. "<div class='erreur'>".join('<br >', $info['erreur']).'</div>';
67 67
 		$checkable = false;
68
-	} elseif (isset($GLOBALS['erreurs_activation_raw'][$dir_plugins . $plug_file])) {
68
+	} elseif (isset($GLOBALS['erreurs_activation_raw'][$dir_plugins.$plug_file])) {
69 69
 		$class_li .= ' error';
70 70
 		$erreur = http_img_pack(
71 71
 			'plugin-err-32.png',
@@ -73,10 +73,10 @@  discard block
 block discarded – undo
73 73
 			" class='picto_err'",
74 74
 			_T('plugin_impossible_activer', ['plugin' => $nom])
75 75
 		)
76
-			. "<div class='erreur'>" . implode(
76
+			. "<div class='erreur'>".implode(
77 77
 				'<br />',
78
-				$GLOBALS['erreurs_activation_raw'][$dir_plugins . $plug_file]
79
-			) . '</div>';
78
+				$GLOBALS['erreurs_activation_raw'][$dir_plugins.$plug_file]
79
+			).'</div>';
80 80
 	} else {
81 81
 		$cfg = $actif ? plugin_bouton_config($plug_file, $info, $dir_plugins) : '';
82 82
 		if (defined('_DEV_VERSION_SPIP_COMPAT') and !plugin_version_compatible($info['compatibilite'], $GLOBALS['spip_version_branche'])) {
@@ -93,11 +93,11 @@  discard block
 block discarded – undo
93 93
 	// numerotons les occurrences d'un meme prefix
94 94
 	$versions[$prefix] = $id = isset($versions[$prefix]) ? intval($versions[$prefix]) + 1 : '';
95 95
 
96
-	$class_li .= ($actif ? ' actif' : '') . ($expose ? ' on' : '');
96
+	$class_li .= ($actif ? ' actif' : '').($expose ? ' on' : '');
97 97
 
98 98
 	return "<li id='$prefix$id' class='$class_li'>"
99 99
 	. ((!$checkable and !$checked)
100
-		? '' : plugin_checkbox(++$id_input, $dir_plugins . $plug_file, $checked))
100
+		? '' : plugin_checkbox(++$id_input, $dir_plugins.$plug_file, $checked))
101 101
 	. plugin_resume($info, $dir_plugins, $plug_file, $url_page)
102 102
 	. $cfg
103 103
 	. $erreur
@@ -116,9 +116,9 @@  discard block
 block discarded – undo
116 116
 	// si paquet.xml fournit un squelette, le prendre
117 117
 	if (isset($infos['config']) and $infos['config']) {
118 118
 		return recuperer_fond(
119
-			"$dir$nom/" . $infos['config'],
119
+			"$dir$nom/".$infos['config'],
120 120
 			[
121
-				'script' => 'configurer_' . $prefix,
121
+				'script' => 'configurer_'.$prefix,
122 122
 				'nom' => $nom
123 123
 			]
124 124
 		);
@@ -137,7 +137,7 @@  discard block
 block discarded – undo
137 137
 	return recuperer_fond(
138 138
 		'prive/squelettes/inclure/cfg',
139 139
 		[
140
-			'script' => 'configurer_' . $prefix,
140
+			'script' => 'configurer_'.$prefix,
141 141
 			'nom' => $nom
142 142
 		]
143 143
 	);
@@ -153,7 +153,7 @@  discard block
 block discarded – undo
153 153
 	. "<input type='checkbox' name='s$name' id='label_$id_input'"
154 154
 	. ($actif ? " checked='checked'" : '')
155 155
 	. " class='checkbox'  value='O' />"
156
-	. "\n<label for='label_$id_input'>" . _T('activer_plugin') . '</label>'
156
+	. "\n<label for='label_$id_input'>"._T('activer_plugin').'</label>'
157 157
 	. '</div>';
158 158
 }
159 159
 
@@ -208,11 +208,11 @@  discard block
 block discarded – undo
208 208
 	. "<h3><a href='$url' rel='info'>"
209 209
 	. $nom
210 210
 	. '</a></h3>'
211
-	. " <span class='version'>" . $info['version'] . '</span>'
211
+	. " <span class='version'>".$info['version'].'</span>'
212 212
 	. " <span class='etat'> - "
213 213
 	. plugin_etat_en_clair($info['etat'])
214 214
 	. '</span>'
215
-	. "<div class='short'>" . $slogan . '</div>'
215
+	. "<div class='short'>".$slogan.'</div>'
216 216
 	. $i
217 217
 	. '</div>';
218 218
 }
@@ -227,7 +227,7 @@  discard block
 block discarded – undo
227 227
 	$text2 = _T('info_desinstaller_plugin');
228 228
 	$file = basename($plug_file);
229 229
 
230
-	return "<div class='actions'>[" .
230
+	return "<div class='actions'>[".
231 231
 	"<a href='$action'
232 232
 		onclick='return confirm(\"$text $nom ?\\n$text2\")'>"
233 233
 	. $text
@@ -249,7 +249,7 @@  discard block
 block discarded – undo
249 249
 		$etat = 'developpement';
250 250
 	}
251 251
 
252
-	return _T('plugin_etat_' . $etat);
252
+	return _T('plugin_etat_'.$etat);
253 253
 }
254 254
 
255 255
 function plugin_propre($texte, $module = '', $propre = 'propre') {
@@ -258,7 +258,7 @@  discard block
 block discarded – undo
258 258
 		$module = substr($module, strlen(_DIR_RACINE));
259 259
 	}
260 260
 	if (preg_match('|^\w+_[\w_]+$|', $texte)) {
261
-		$texte = _T(($module ? "$module:" : '') . $texte, [], ['force' => false]);
261
+		$texte = _T(($module ? "$module:" : '').$texte, [], ['force' => false]);
262 262
 	}
263 263
 
264 264
 	return $propre($texte);
@@ -291,9 +291,9 @@  discard block
 block discarded – undo
291 291
 		isset($info['documentation'])
292 292
 		and $lien = $info['documentation']
293 293
 	) {
294
-		$description .= "<p><em class='site'><a href='$lien' class='spip_out'>" . _T('en_savoir_plus') . '</a></em></p>';
294
+		$description .= "<p><em class='site'><a href='$lien' class='spip_out'>"._T('en_savoir_plus').'</a></em></p>';
295 295
 	}
296
-	$s .= "<dd class='desc'>" . $description . "</dd>\n";
296
+	$s .= "<dd class='desc'>".$description."</dd>\n";
297 297
 
298 298
 	if (isset($info['auteur'])) {
299 299
 		if (is_array($info['auteur'])) {
@@ -303,19 +303,19 @@  discard block
 block discarded – undo
303 303
 			$a = trim($info['auteur']);
304 304
 		}
305 305
 		if ($a) {
306
-			$s .= "<dt class='auteurs'>" . _T('public:par_auteur') . "</dt><dd class='auteurs'>" . PtoBR(propre(
306
+			$s .= "<dt class='auteurs'>"._T('public:par_auteur')."</dt><dd class='auteurs'>".PtoBR(propre(
307 307
 				$a,
308 308
 				$dir
309
-			)) . "</dd>\n";
309
+			))."</dd>\n";
310 310
 		}
311 311
 	}
312 312
 
313 313
 	if (isset($info['credit'])) {
314 314
 		if ($a = formater_credits($info['credit'], ', ')) {
315
-			$s .= "<dt class='credits'>" . _T('plugin_info_credit') . "</dt><dd class='credits'>" . PtoBR(propre(
315
+			$s .= "<dt class='credits'>"._T('plugin_info_credit')."</dt><dd class='credits'>".PtoBR(propre(
316 316
 				$a,
317 317
 				$dir
318
-			)) . "</dd>\n";
318
+			))."</dd>\n";
319 319
 		}
320 320
 	}
321 321
 
@@ -327,10 +327,10 @@  discard block
 block discarded – undo
327 327
 			$a = trim($info['licence']);
328 328
 		}
329 329
 		if ($a) {
330
-			$s .= "<dt class='licence'>" . _T('intitule_licence') . "</dt><dd class='licence'>" . PtoBR(propre(
330
+			$s .= "<dt class='licence'>"._T('intitule_licence')."</dt><dd class='licence'>".PtoBR(propre(
331 331
 				$a,
332 332
 				$dir
333
-			)) . "</dd>\n";
333
+			))."</dd>\n";
334 334
 		}
335 335
 	}
336 336
 
@@ -341,25 +341,24 @@  discard block
 block discarded – undo
341 341
 	//
342 342
 	$infotech = [];
343 343
 
344
-	$version = '<dt>' . _T('version') . '</dt><dd>' . $info['version'];
344
+	$version = '<dt>'._T('version').'</dt><dd>'.$info['version'];
345 345
 	// Version VCS
346
-	if ($vcs = version_vcs_courante($dir_plugins . $plug_file)) {
347
-		$version .= ' ' . $vcs;
346
+	if ($vcs = version_vcs_courante($dir_plugins.$plug_file)) {
347
+		$version .= ' '.$vcs;
348 348
 	}
349 349
 	$version .= '</dd>';
350 350
 	$infotech[] = $version;
351
-	$infotech[] = '<dt>' . _T('repertoire_plugins') . '</dt><dd>' . joli_repertoire("$dir_plugins$plug_file") . '</dd>';
351
+	$infotech[] = '<dt>'._T('repertoire_plugins').'</dt><dd>'.joli_repertoire("$dir_plugins$plug_file").'</dd>';
352 352
 	// source zip le cas echeant
353
-	$infotech[] = (lire_fichier($dir_plugins . $plug_file . '/install.log', $log)
353
+	$infotech[] = (lire_fichier($dir_plugins.$plug_file.'/install.log', $log)
354 354
 		and preg_match(',^source:(.*)$,m', $log, $r))
355
-		? '<dt>' . _T('plugin_source') . '</dt><dd>' . trim($r[1]) . '</dd>'
355
+		? '<dt>'._T('plugin_source').'</dt><dd>'.trim($r[1]).'</dd>'
356 356
 		: '';
357 357
 
358
-	$infotech[] = !$info['necessite'] ? '' :
359
-		('<dt>' . _T('plugin_info_necessite') . '</dt><dd>' . join(
358
+	$infotech[] = !$info['necessite'] ? '' : ('<dt>'._T('plugin_info_necessite').'</dt><dd>'.join(
360 359
 			' ',
361 360
 			array_map('array_shift', $info['necessite'])
362
-		) . '</dd>');
361
+		).'</dd>');
363 362
 
364 363
 	$s .= "<dl class='tech'>"
365 364
 		. join('', $infotech)
@@ -380,8 +379,8 @@  discard block
 block discarded – undo
380 379
 		$texte .=
381 380
 			(!is_array($_credit))
382 381
 				? PtoBR(propre($_credit))
383
-				: ($_credit['url'] ? '<a href="' . $_credit['url'] . '">' : '') .
384
-				$_credit['nom'] .
382
+				: ($_credit['url'] ? '<a href="'.$_credit['url'].'">' : '').
383
+				$_credit['nom'].
385 384
 				($_credit['url'] ? '</a>' : '');
386 385
 	}
387 386
 
Please login to merge, or discard this patch.
Indentation   +303 added lines, -303 removed lines patch added patch discarded remove patch
@@ -17,212 +17,212 @@  discard block
 block discarded – undo
17 17
  **/
18 18
 
19 19
 if (!defined('_ECRIRE_INC_VERSION')) {
20
-	return;
20
+    return;
21 21
 }
22 22
 include_spip('inc/charsets');
23 23
 include_spip('inc/texte');
24 24
 include_spip('inc/plugin'); // pour plugin_est_installe
25 25
 
26 26
 function plugins_afficher_plugin_dist(
27
-	$url_page,
28
-	$plug_file,
29
-	$checked,
30
-	$actif,
31
-	$expose = false,
32
-	$class_li = 'item',
33
-	$dir_plugins = _DIR_PLUGINS
27
+    $url_page,
28
+    $plug_file,
29
+    $checked,
30
+    $actif,
31
+    $expose = false,
32
+    $class_li = 'item',
33
+    $dir_plugins = _DIR_PLUGINS
34 34
 ) {
35 35
 
36
-	static $id_input = 0;
37
-	static $versions = [];
38
-
39
-	$force_reload = (_request('var_mode') == 'recalcul');
40
-	$get_infos = charger_fonction('get_infos', 'plugins');
41
-	$info = $get_infos($plug_file, $force_reload, $dir_plugins);
42
-	$prefix = $info['prefix'];
43
-	$cfg = '';
44
-	$checkable = ($dir_plugins !== _DIR_PLUGINS_DIST);
45
-	$nom = plugin_nom($info, $dir_plugins, $plug_file);
46
-	$erreur = '';
47
-
48
-	if (!plugin_version_compatible($info['compatibilite'], $GLOBALS['spip_version_branche'], 'spip')) {
49
-		$info['slogan'] = _T('plugin_info_non_compatible_spip');
50
-		$erreur = http_img_pack(
51
-			'plugin-dis-32.png',
52
-			_T('plugin_info_non_compatible_spip'),
53
-			" class='picto_err'",
54
-			_T('plugin_info_non_compatible_spip')
55
-		);
56
-		$class_li .= ' disabled';
57
-		$checkable = false;
58
-	} elseif (isset($info['erreur'])) {
59
-		$class_li .= ' error';
60
-		$erreur = http_img_pack(
61
-			'plugin-err-32.png',
62
-			_T('plugin_info_erreur_xml'),
63
-			" class='picto_err'",
64
-			_T('plugin_info_erreur_xml')
65
-		)
66
-			. "<div class='erreur'>" . join('<br >', $info['erreur']) . '</div>';
67
-		$checkable = false;
68
-	} elseif (isset($GLOBALS['erreurs_activation_raw'][$dir_plugins . $plug_file])) {
69
-		$class_li .= ' error';
70
-		$erreur = http_img_pack(
71
-			'plugin-err-32.png',
72
-			_T('plugin_impossible_activer', ['plugin' => $nom]),
73
-			" class='picto_err'",
74
-			_T('plugin_impossible_activer', ['plugin' => $nom])
75
-		)
76
-			. "<div class='erreur'>" . implode(
77
-				'<br />',
78
-				$GLOBALS['erreurs_activation_raw'][$dir_plugins . $plug_file]
79
-			) . '</div>';
80
-	} else {
81
-		$cfg = $actif ? plugin_bouton_config($plug_file, $info, $dir_plugins) : '';
82
-		if (defined('_DEV_VERSION_SPIP_COMPAT') and !plugin_version_compatible($info['compatibilite'], $GLOBALS['spip_version_branche'])) {
83
-			//$info['slogan'] = _T('plugin_info_non_compatible_spip');
84
-			$erreur = http_img_pack(
85
-				'plugin-dis-32.png',
86
-				_T('plugin_info_non_compatible_spip'),
87
-				" class='picto_err picto_compat_forcee'",
88
-				_L('Version incompatible : compatibilité forcée')
89
-			);
90
-		}
91
-	}
92
-
93
-	// numerotons les occurrences d'un meme prefix
94
-	$versions[$prefix] = $id = isset($versions[$prefix]) ? intval($versions[$prefix]) + 1 : '';
95
-
96
-	$class_li .= ($actif ? ' actif' : '') . ($expose ? ' on' : '');
97
-
98
-	return "<li id='$prefix$id' class='$class_li'>"
99
-	. ((!$checkable and !$checked)
100
-		? '' : plugin_checkbox(++$id_input, $dir_plugins . $plug_file, $checked))
101
-	. plugin_resume($info, $dir_plugins, $plug_file, $url_page)
102
-	. $cfg
103
-	. $erreur
104
-	. (($dir_plugins !== _DIR_PLUGINS_DIST and plugin_est_installe($plug_file))
105
-		? plugin_desintalle($plug_file, $nom, $dir_plugins) : '')
106
-	. "<div class='details'>" // pour l'ajax de exec/info_plugin
107
-	. (!$expose ? '' : affiche_bloc_plugin($plug_file, $info, $dir_plugins))
108
-	. '</div>'
109
-	. '</li>';
36
+    static $id_input = 0;
37
+    static $versions = [];
38
+
39
+    $force_reload = (_request('var_mode') == 'recalcul');
40
+    $get_infos = charger_fonction('get_infos', 'plugins');
41
+    $info = $get_infos($plug_file, $force_reload, $dir_plugins);
42
+    $prefix = $info['prefix'];
43
+    $cfg = '';
44
+    $checkable = ($dir_plugins !== _DIR_PLUGINS_DIST);
45
+    $nom = plugin_nom($info, $dir_plugins, $plug_file);
46
+    $erreur = '';
47
+
48
+    if (!plugin_version_compatible($info['compatibilite'], $GLOBALS['spip_version_branche'], 'spip')) {
49
+        $info['slogan'] = _T('plugin_info_non_compatible_spip');
50
+        $erreur = http_img_pack(
51
+            'plugin-dis-32.png',
52
+            _T('plugin_info_non_compatible_spip'),
53
+            " class='picto_err'",
54
+            _T('plugin_info_non_compatible_spip')
55
+        );
56
+        $class_li .= ' disabled';
57
+        $checkable = false;
58
+    } elseif (isset($info['erreur'])) {
59
+        $class_li .= ' error';
60
+        $erreur = http_img_pack(
61
+            'plugin-err-32.png',
62
+            _T('plugin_info_erreur_xml'),
63
+            " class='picto_err'",
64
+            _T('plugin_info_erreur_xml')
65
+        )
66
+            . "<div class='erreur'>" . join('<br >', $info['erreur']) . '</div>';
67
+        $checkable = false;
68
+    } elseif (isset($GLOBALS['erreurs_activation_raw'][$dir_plugins . $plug_file])) {
69
+        $class_li .= ' error';
70
+        $erreur = http_img_pack(
71
+            'plugin-err-32.png',
72
+            _T('plugin_impossible_activer', ['plugin' => $nom]),
73
+            " class='picto_err'",
74
+            _T('plugin_impossible_activer', ['plugin' => $nom])
75
+        )
76
+            . "<div class='erreur'>" . implode(
77
+                '<br />',
78
+                $GLOBALS['erreurs_activation_raw'][$dir_plugins . $plug_file]
79
+            ) . '</div>';
80
+    } else {
81
+        $cfg = $actif ? plugin_bouton_config($plug_file, $info, $dir_plugins) : '';
82
+        if (defined('_DEV_VERSION_SPIP_COMPAT') and !plugin_version_compatible($info['compatibilite'], $GLOBALS['spip_version_branche'])) {
83
+            //$info['slogan'] = _T('plugin_info_non_compatible_spip');
84
+            $erreur = http_img_pack(
85
+                'plugin-dis-32.png',
86
+                _T('plugin_info_non_compatible_spip'),
87
+                " class='picto_err picto_compat_forcee'",
88
+                _L('Version incompatible : compatibilité forcée')
89
+            );
90
+        }
91
+    }
92
+
93
+    // numerotons les occurrences d'un meme prefix
94
+    $versions[$prefix] = $id = isset($versions[$prefix]) ? intval($versions[$prefix]) + 1 : '';
95
+
96
+    $class_li .= ($actif ? ' actif' : '') . ($expose ? ' on' : '');
97
+
98
+    return "<li id='$prefix$id' class='$class_li'>"
99
+    . ((!$checkable and !$checked)
100
+        ? '' : plugin_checkbox(++$id_input, $dir_plugins . $plug_file, $checked))
101
+    . plugin_resume($info, $dir_plugins, $plug_file, $url_page)
102
+    . $cfg
103
+    . $erreur
104
+    . (($dir_plugins !== _DIR_PLUGINS_DIST and plugin_est_installe($plug_file))
105
+        ? plugin_desintalle($plug_file, $nom, $dir_plugins) : '')
106
+    . "<div class='details'>" // pour l'ajax de exec/info_plugin
107
+    . (!$expose ? '' : affiche_bloc_plugin($plug_file, $info, $dir_plugins))
108
+    . '</div>'
109
+    . '</li>';
110 110
 }
111 111
 
112 112
 function plugin_bouton_config($nom, $infos, $dir) {
113
-	// la verification se base sur le filesystem
114
-	// il faut donc n'utiliser que des minuscules, par convention
115
-	$prefix = strtolower($infos['prefix']);
116
-	// si paquet.xml fournit un squelette, le prendre
117
-	if (isset($infos['config']) and $infos['config']) {
118
-		return recuperer_fond(
119
-			"$dir$nom/" . $infos['config'],
120
-			[
121
-				'script' => 'configurer_' . $prefix,
122
-				'nom' => $nom
123
-			]
124
-		);
125
-	}
126
-
127
-	// sinon prendre le squelette std sur le nom std
128
-	return recuperer_fond(
129
-		'prive/squelettes/inclure/cfg',
130
-		[
131
-			'script' => 'configurer_' . $prefix,
132
-			'nom' => $nom
133
-		]
134
-	);
113
+    // la verification se base sur le filesystem
114
+    // il faut donc n'utiliser que des minuscules, par convention
115
+    $prefix = strtolower($infos['prefix']);
116
+    // si paquet.xml fournit un squelette, le prendre
117
+    if (isset($infos['config']) and $infos['config']) {
118
+        return recuperer_fond(
119
+            "$dir$nom/" . $infos['config'],
120
+            [
121
+                'script' => 'configurer_' . $prefix,
122
+                'nom' => $nom
123
+            ]
124
+        );
125
+    }
126
+
127
+    // sinon prendre le squelette std sur le nom std
128
+    return recuperer_fond(
129
+        'prive/squelettes/inclure/cfg',
130
+        [
131
+            'script' => 'configurer_' . $prefix,
132
+            'nom' => $nom
133
+        ]
134
+    );
135 135
 }
136 136
 
137 137
 // checkbox pour activer ou desactiver
138 138
 // si ce n'est pas une extension
139 139
 
140 140
 function plugin_checkbox($id_input, $file, $actif) {
141
-	$name = substr(md5($file), 0, 16);
142
-
143
-	return "<div class='check'>\n"
144
-	. "<input type='checkbox' name='s$name' id='label_$id_input'"
145
-	. ($actif ? " checked='checked'" : '')
146
-	. " class='checkbox'  value='O' />"
147
-	. "\n<label for='label_$id_input'>" . _T('activer_plugin') . '</label>'
148
-	. '</div>';
141
+    $name = substr(md5($file), 0, 16);
142
+
143
+    return "<div class='check'>\n"
144
+    . "<input type='checkbox' name='s$name' id='label_$id_input'"
145
+    . ($actif ? " checked='checked'" : '')
146
+    . " class='checkbox'  value='O' />"
147
+    . "\n<label for='label_$id_input'>" . _T('activer_plugin') . '</label>'
148
+    . '</div>';
149 149
 }
150 150
 
151 151
 function plugin_nom($info, $dir_plugins, $plug_file) {
152
-	$prefix = $info['prefix'];
153
-	$dir = "$dir_plugins$plug_file";
154
-	// Si dtd paquet, on traite le nom soit par son item de langue soit par sa valeur immediate a l'index "nom"
155
-	if ($info['dtd'] == 'paquet') {
156
-		$nom = plugin_typo("{$prefix}_nom", "$dir/lang/paquet-$prefix");
157
-		if (!$nom) {
158
-			$nom = typo($info['nom']);
159
-		}
160
-	} else {
161
-		$nom = typo(attribut_html($info['nom']));
162
-	}
163
-
164
-	return trim($nom);
152
+    $prefix = $info['prefix'];
153
+    $dir = "$dir_plugins$plug_file";
154
+    // Si dtd paquet, on traite le nom soit par son item de langue soit par sa valeur immediate a l'index "nom"
155
+    if ($info['dtd'] == 'paquet') {
156
+        $nom = plugin_typo("{$prefix}_nom", "$dir/lang/paquet-$prefix");
157
+        if (!$nom) {
158
+            $nom = typo($info['nom']);
159
+        }
160
+    } else {
161
+        $nom = typo(attribut_html($info['nom']));
162
+    }
163
+
164
+    return trim($nom);
165 165
 }
166 166
 
167 167
 // Cartouche Resume
168 168
 function plugin_resume($info, $dir_plugins, $plug_file, $url_page) {
169
-	$prefix = $info['prefix'];
170
-	$dir = "$dir_plugins$plug_file";
171
-	$slogan = PtoBR(plugin_propre($info['slogan'], "$dir/lang/paquet-$prefix"));
172
-	// une seule ligne dans le slogan : couper si besoin
173
-	if (($p = strpos($slogan, '<br />')) !== false) {
174
-		$slogan = substr($slogan, 0, $p);
175
-	}
176
-	// couper par securite
177
-	$slogan = couper($slogan, 80);
178
-
179
-	$nom = plugin_nom($info, $dir_plugins, $plug_file);
180
-
181
-	$url = parametre_url($url_page, 'plugin', substr($dir, strlen(_DIR_RACINE)));
182
-
183
-	$icon_class = 'icon';
184
-	$img = '';
185
-	if (isset($info['logo']) and $i = trim($info['logo'])) {
186
-		$img = http_img_pack("$dir/$i", '', " width='32' height='32'", '', ['variante_svg_si_possible' => true, 'chemin_image' => false]);
187
-		if (!extraire_attribut($img, 'src')) {
188
-			$img = '';
189
-		}
190
-	}
191
-	if (!$img) {
192
-		$img = http_img_pack('plugin-xx.svg', '', " width='32' height='32'");
193
-		$icon_class .= ' no-logo';
194
-	}
195
-
196
-	$i = "<div class='$icon_class'><a href='$url' rel='info'>$img</a></div>";
197
-
198
-	return "<div class='resume'>"
199
-	. "<h3><a href='$url' rel='info'>"
200
-	. $nom
201
-	. '</a></h3>'
202
-	. " <span class='version'>" . $info['version'] . '</span>'
203
-	. " <span class='etat'> - "
204
-	. plugin_etat_en_clair($info['etat'])
205
-	. '</span>'
206
-	. "<div class='short'>" . $slogan . '</div>'
207
-	. $i
208
-	. '</div>';
169
+    $prefix = $info['prefix'];
170
+    $dir = "$dir_plugins$plug_file";
171
+    $slogan = PtoBR(plugin_propre($info['slogan'], "$dir/lang/paquet-$prefix"));
172
+    // une seule ligne dans le slogan : couper si besoin
173
+    if (($p = strpos($slogan, '<br />')) !== false) {
174
+        $slogan = substr($slogan, 0, $p);
175
+    }
176
+    // couper par securite
177
+    $slogan = couper($slogan, 80);
178
+
179
+    $nom = plugin_nom($info, $dir_plugins, $plug_file);
180
+
181
+    $url = parametre_url($url_page, 'plugin', substr($dir, strlen(_DIR_RACINE)));
182
+
183
+    $icon_class = 'icon';
184
+    $img = '';
185
+    if (isset($info['logo']) and $i = trim($info['logo'])) {
186
+        $img = http_img_pack("$dir/$i", '', " width='32' height='32'", '', ['variante_svg_si_possible' => true, 'chemin_image' => false]);
187
+        if (!extraire_attribut($img, 'src')) {
188
+            $img = '';
189
+        }
190
+    }
191
+    if (!$img) {
192
+        $img = http_img_pack('plugin-xx.svg', '', " width='32' height='32'");
193
+        $icon_class .= ' no-logo';
194
+    }
195
+
196
+    $i = "<div class='$icon_class'><a href='$url' rel='info'>$img</a></div>";
197
+
198
+    return "<div class='resume'>"
199
+    . "<h3><a href='$url' rel='info'>"
200
+    . $nom
201
+    . '</a></h3>'
202
+    . " <span class='version'>" . $info['version'] . '</span>'
203
+    . " <span class='etat'> - "
204
+    . plugin_etat_en_clair($info['etat'])
205
+    . '</span>'
206
+    . "<div class='short'>" . $slogan . '</div>'
207
+    . $i
208
+    . '</div>';
209 209
 }
210 210
 
211 211
 function plugin_desintalle($plug_file, $nom, $dir_plugins = null) {
212
-	if (!$dir_plugins) {
213
-		$dir_plugins = _DIR_PLUGINS;
214
-	}
212
+    if (!$dir_plugins) {
213
+        $dir_plugins = _DIR_PLUGINS;
214
+    }
215 215
 
216
-	$action = redirige_action_auteur('desinstaller_plugin', "$dir_plugins::$plug_file", 'admin_plugin');
217
-	$text = _T('bouton_desinstaller');
218
-	$text2 = _T('info_desinstaller_plugin');
219
-	$file = basename($plug_file);
216
+    $action = redirige_action_auteur('desinstaller_plugin', "$dir_plugins::$plug_file", 'admin_plugin');
217
+    $text = _T('bouton_desinstaller');
218
+    $text2 = _T('info_desinstaller_plugin');
219
+    $file = basename($plug_file);
220 220
 
221
-	return "<div class='actions'>[" .
222
-	"<a href='$action'
221
+    return "<div class='actions'>[" .
222
+    "<a href='$action'
223 223
 		onclick='return confirm(\"$text $nom ?\\n$text2\")'>"
224
-	. $text
225
-	. '</a>]</div>';
224
+    . $text
225
+    . '</a>]</div>';
226 226
 }
227 227
 
228 228
 /**
@@ -236,145 +236,145 @@  discard block
 block discarded – undo
236 236
  *     Traduction de l'état dans la langue en cours
237 237
  **/
238 238
 function plugin_etat_en_clair($etat) {
239
-	if (!in_array($etat, ['stable', 'test', 'experimental'])) {
240
-		$etat = 'developpement';
241
-	}
239
+    if (!in_array($etat, ['stable', 'test', 'experimental'])) {
240
+        $etat = 'developpement';
241
+    }
242 242
 
243
-	return _T('plugin_etat_' . $etat);
243
+    return _T('plugin_etat_' . $etat);
244 244
 }
245 245
 
246 246
 function plugin_propre($texte, $module = '', $propre = 'propre') {
247
-	// retirer le retour a la racine du module, car le find_in_path se fait depuis la racine
248
-	if (_DIR_RACINE and strncmp($module, _DIR_RACINE, strlen(_DIR_RACINE)) == 0) {
249
-		$module = substr($module, strlen(_DIR_RACINE));
250
-	}
251
-	if (preg_match('|^\w+_[\w_]+$|', $texte)) {
252
-		$texte = _T(($module ? "$module:" : '') . $texte, [], ['force' => false]);
253
-	}
254
-
255
-	return $propre($texte);
247
+    // retirer le retour a la racine du module, car le find_in_path se fait depuis la racine
248
+    if (_DIR_RACINE and strncmp($module, _DIR_RACINE, strlen(_DIR_RACINE)) == 0) {
249
+        $module = substr($module, strlen(_DIR_RACINE));
250
+    }
251
+    if (preg_match('|^\w+_[\w_]+$|', $texte)) {
252
+        $texte = _T(($module ? "$module:" : '') . $texte, [], ['force' => false]);
253
+    }
254
+
255
+    return $propre($texte);
256 256
 }
257 257
 
258 258
 function plugin_typo($texte, $module = '') {
259
-	return plugin_propre($texte, $module, 'typo');
259
+    return plugin_propre($texte, $module, 'typo');
260 260
 }
261 261
 
262 262
 
263 263
 function affiche_bloc_plugin($plug_file, $info, $dir_plugins = null) {
264
-	$log = null;
265
-	if (!$dir_plugins) {
266
-		$dir_plugins = _DIR_PLUGINS;
267
-	}
268
-
269
-	$prefix = $info['prefix'];
270
-	$dir = "$dir_plugins$plug_file/lang/paquet-$prefix";
271
-
272
-	$s = '';
273
-	// TODO: le traiter_multi ici n'est pas beau
274
-	// cf. description du plugin/_stable_/ortho/plugin.xml
275
-	// concerne les anciens plugin.xml donc on devrait plus en avoir besoin
276
-	$description = '';
277
-	if (isset($info['description'])) {
278
-		$description = plugin_propre($info['description'], $dir);
279
-	}
280
-
281
-	if (
282
-		isset($info['documentation'])
283
-		and $lien = $info['documentation']
284
-	) {
285
-		$description .= "<p><em class='site'><a href='$lien' class='spip_out'>" . _T('en_savoir_plus') . '</a></em></p>';
286
-	}
287
-	$s .= "<dd class='desc'>" . $description . "</dd>\n";
288
-
289
-	if (isset($info['auteur'])) {
290
-		if (is_array($info['auteur'])) {
291
-			$a = formater_credits($info['auteur'], ', ');
292
-		} // pour compat mais ne doit plus arriver
293
-		else {
294
-			$a = trim($info['auteur']);
295
-		}
296
-		if ($a) {
297
-			$s .= "<dt class='auteurs'>" . _T('public:par_auteur') . "</dt><dd class='auteurs'>" . PtoBR(propre(
298
-				$a,
299
-				$dir
300
-			)) . "</dd>\n";
301
-		}
302
-	}
303
-
304
-	if (isset($info['credit'])) {
305
-		if ($a = formater_credits($info['credit'], ', ')) {
306
-			$s .= "<dt class='credits'>" . _T('plugin_info_credit') . "</dt><dd class='credits'>" . PtoBR(propre(
307
-				$a,
308
-				$dir
309
-			)) . "</dd>\n";
310
-		}
311
-	}
312
-
313
-	if (isset($info['licence'])) {
314
-		if (is_array($info['licence'])) {
315
-			$a = formater_credits($info['licence'], ', ');
316
-		} // pour compat mais ne doit plus arriver
317
-		else {
318
-			$a = trim($info['licence']);
319
-		}
320
-		if ($a) {
321
-			$s .= "<dt class='licence'>" . _T('intitule_licence') . "</dt><dd class='licence'>" . PtoBR(propre(
322
-				$a,
323
-				$dir
324
-			)) . "</dd>\n";
325
-		}
326
-	}
327
-
328
-	$s = "<dl class='description'>$s</dl>";
329
-
330
-	//
331
-	// Ajouter les infos techniques
332
-	//
333
-	$infotech = [];
334
-
335
-	$version = '<dt>' . _T('version') . '</dt><dd>' . $info['version'];
336
-	// Version VCS
337
-	if ($vcs = version_vcs_courante($dir_plugins . $plug_file)) {
338
-		$version .= ' ' . $vcs;
339
-	}
340
-	$version .= '</dd>';
341
-	$infotech[] = $version;
342
-	$infotech[] = '<dt>' . _T('repertoire_plugins') . '</dt><dd>' . joli_repertoire("$dir_plugins$plug_file") . '</dd>';
343
-	// source zip le cas echeant
344
-	$infotech[] = (lire_fichier($dir_plugins . $plug_file . '/install.log', $log)
345
-		and preg_match(',^source:(.*)$,m', $log, $r))
346
-		? '<dt>' . _T('plugin_source') . '</dt><dd>' . trim($r[1]) . '</dd>'
347
-		: '';
348
-
349
-	$infotech[] = !$info['necessite'] ? '' :
350
-		('<dt>' . _T('plugin_info_necessite') . '</dt><dd>' . join(
351
-			' ',
352
-			array_map('array_shift', $info['necessite'])
353
-		) . '</dd>');
354
-
355
-	$s .= "<dl class='tech'>"
356
-		. join('', $infotech)
357
-		. '</dl>';
358
-
359
-
360
-	return $s;
264
+    $log = null;
265
+    if (!$dir_plugins) {
266
+        $dir_plugins = _DIR_PLUGINS;
267
+    }
268
+
269
+    $prefix = $info['prefix'];
270
+    $dir = "$dir_plugins$plug_file/lang/paquet-$prefix";
271
+
272
+    $s = '';
273
+    // TODO: le traiter_multi ici n'est pas beau
274
+    // cf. description du plugin/_stable_/ortho/plugin.xml
275
+    // concerne les anciens plugin.xml donc on devrait plus en avoir besoin
276
+    $description = '';
277
+    if (isset($info['description'])) {
278
+        $description = plugin_propre($info['description'], $dir);
279
+    }
280
+
281
+    if (
282
+        isset($info['documentation'])
283
+        and $lien = $info['documentation']
284
+    ) {
285
+        $description .= "<p><em class='site'><a href='$lien' class='spip_out'>" . _T('en_savoir_plus') . '</a></em></p>';
286
+    }
287
+    $s .= "<dd class='desc'>" . $description . "</dd>\n";
288
+
289
+    if (isset($info['auteur'])) {
290
+        if (is_array($info['auteur'])) {
291
+            $a = formater_credits($info['auteur'], ', ');
292
+        } // pour compat mais ne doit plus arriver
293
+        else {
294
+            $a = trim($info['auteur']);
295
+        }
296
+        if ($a) {
297
+            $s .= "<dt class='auteurs'>" . _T('public:par_auteur') . "</dt><dd class='auteurs'>" . PtoBR(propre(
298
+                $a,
299
+                $dir
300
+            )) . "</dd>\n";
301
+        }
302
+    }
303
+
304
+    if (isset($info['credit'])) {
305
+        if ($a = formater_credits($info['credit'], ', ')) {
306
+            $s .= "<dt class='credits'>" . _T('plugin_info_credit') . "</dt><dd class='credits'>" . PtoBR(propre(
307
+                $a,
308
+                $dir
309
+            )) . "</dd>\n";
310
+        }
311
+    }
312
+
313
+    if (isset($info['licence'])) {
314
+        if (is_array($info['licence'])) {
315
+            $a = formater_credits($info['licence'], ', ');
316
+        } // pour compat mais ne doit plus arriver
317
+        else {
318
+            $a = trim($info['licence']);
319
+        }
320
+        if ($a) {
321
+            $s .= "<dt class='licence'>" . _T('intitule_licence') . "</dt><dd class='licence'>" . PtoBR(propre(
322
+                $a,
323
+                $dir
324
+            )) . "</dd>\n";
325
+        }
326
+    }
327
+
328
+    $s = "<dl class='description'>$s</dl>";
329
+
330
+    //
331
+    // Ajouter les infos techniques
332
+    //
333
+    $infotech = [];
334
+
335
+    $version = '<dt>' . _T('version') . '</dt><dd>' . $info['version'];
336
+    // Version VCS
337
+    if ($vcs = version_vcs_courante($dir_plugins . $plug_file)) {
338
+        $version .= ' ' . $vcs;
339
+    }
340
+    $version .= '</dd>';
341
+    $infotech[] = $version;
342
+    $infotech[] = '<dt>' . _T('repertoire_plugins') . '</dt><dd>' . joli_repertoire("$dir_plugins$plug_file") . '</dd>';
343
+    // source zip le cas echeant
344
+    $infotech[] = (lire_fichier($dir_plugins . $plug_file . '/install.log', $log)
345
+        and preg_match(',^source:(.*)$,m', $log, $r))
346
+        ? '<dt>' . _T('plugin_source') . '</dt><dd>' . trim($r[1]) . '</dd>'
347
+        : '';
348
+
349
+    $infotech[] = !$info['necessite'] ? '' :
350
+        ('<dt>' . _T('plugin_info_necessite') . '</dt><dd>' . join(
351
+            ' ',
352
+            array_map('array_shift', $info['necessite'])
353
+        ) . '</dd>');
354
+
355
+    $s .= "<dl class='tech'>"
356
+        . join('', $infotech)
357
+        . '</dl>';
358
+
359
+
360
+    return $s;
361 361
 }
362 362
 
363 363
 function formater_credits($infos, $sep = ', ') {
364
-	$texte = '';
365
-
366
-	foreach ($infos as $_credit) {
367
-		if ($texte) {
368
-			$texte .= $sep;
369
-		}
370
-		// Si le credit en cours n'est pas un array c'est donc un copyright
371
-		$texte .=
372
-			(!is_array($_credit))
373
-				? PtoBR(propre($_credit))
374
-				: ($_credit['url'] ? '<a href="' . $_credit['url'] . '">' : '') .
375
-				$_credit['nom'] .
376
-				($_credit['url'] ? '</a>' : '');
377
-	}
378
-
379
-	return $texte;
364
+    $texte = '';
365
+
366
+    foreach ($infos as $_credit) {
367
+        if ($texte) {
368
+            $texte .= $sep;
369
+        }
370
+        // Si le credit en cours n'est pas un array c'est donc un copyright
371
+        $texte .=
372
+            (!is_array($_credit))
373
+                ? PtoBR(propre($_credit))
374
+                : ($_credit['url'] ? '<a href="' . $_credit['url'] . '">' : '') .
375
+                $_credit['nom'] .
376
+                ($_credit['url'] ? '</a>' : '');
377
+    }
378
+
379
+    return $texte;
380 380
 }
Please login to merge, or discard this patch.
ecrire/inc/presentation.php 2 patches
Indentation   +113 added lines, -113 removed lines patch added patch discarded remove patch
@@ -16,7 +16,7 @@  discard block
 block discarded – undo
16 16
  * @package SPIP\Core\Presentation
17 17
  **/
18 18
 if (!defined('_ECRIRE_INC_VERSION')) {
19
-	return;
19
+    return;
20 20
 }
21 21
 
22 22
 include_spip('inc/presentation_mini');
@@ -31,141 +31,141 @@  discard block
 block discarded – undo
31 31
 include_spip('inc/filtres_alertes');
32 32
 
33 33
 function debut_cadre($style, $icone = '', $fonction = '', $titre = '', $id = '', $class = '', $padding = true) {
34
-	$fond = null;
35
-	$style_mapping = [
36
-		'r' => 'simple',
37
-		'e' => 'raccourcis',
38
-		'couleur' => 'basic highlight',
39
-		'couleur-foncee' => 'basic highlight',
40
-		'trait-couleur' => 'important',
41
-		'alerte' => 'notice',
42
-		'info' => 'info',
43
-		'sous_rub' => 'simple sous-rub'
44
-	];
45
-	$style_titre_mapping = ['couleur' => 'topper', 'trait-couleur' => 'section'];
46
-	$c = $style_mapping[$style] ?? 'simple';
47
-	$class = $c . ($class ? " $class" : '');
48
-	if (!$padding) {
49
-		$class .= ($class ? ' ' : '') . 'no-padding';
50
-	}
51
-
52
-	//($id?"id='$id' ":"")
53
-	if (strlen($icone) > 1) {
54
-		if ($icone_renommer = charger_fonction('icone_renommer', 'inc', true)) {
55
-			[$fond, $fonction] = $icone_renommer($icone, $fonction);
56
-		}
57
-		$size = 24;
58
-		if (preg_match('/-([0-9]{1,3})[.](gif|png)$/i', $fond, $match)) {
59
-			$size = $match[1];
60
-		}
61
-		if ($fonction) {
62
-			// 2 images pour composer l'icone : le fond (article) en background,
63
-			// la fonction (new) en image
64
-			$icone = http_img_pack($fonction, '', "class='cadre-icone' width='$size' height='$size'\n" .
65
-				http_style_background($fond, 'no-repeat center center', $size));
66
-		} else {
67
-			$icone = http_img_pack($fond, '', "class='cadre-icone' width='$size' height='$size'");
68
-		}
69
-		$titre = $icone . $titre;
70
-	}
71
-
72
-	return boite_ouvrir($titre, $class, $style_titre_mapping[$style] ?? '', $id);
34
+    $fond = null;
35
+    $style_mapping = [
36
+        'r' => 'simple',
37
+        'e' => 'raccourcis',
38
+        'couleur' => 'basic highlight',
39
+        'couleur-foncee' => 'basic highlight',
40
+        'trait-couleur' => 'important',
41
+        'alerte' => 'notice',
42
+        'info' => 'info',
43
+        'sous_rub' => 'simple sous-rub'
44
+    ];
45
+    $style_titre_mapping = ['couleur' => 'topper', 'trait-couleur' => 'section'];
46
+    $c = $style_mapping[$style] ?? 'simple';
47
+    $class = $c . ($class ? " $class" : '');
48
+    if (!$padding) {
49
+        $class .= ($class ? ' ' : '') . 'no-padding';
50
+    }
51
+
52
+    //($id?"id='$id' ":"")
53
+    if (strlen($icone) > 1) {
54
+        if ($icone_renommer = charger_fonction('icone_renommer', 'inc', true)) {
55
+            [$fond, $fonction] = $icone_renommer($icone, $fonction);
56
+        }
57
+        $size = 24;
58
+        if (preg_match('/-([0-9]{1,3})[.](gif|png)$/i', $fond, $match)) {
59
+            $size = $match[1];
60
+        }
61
+        if ($fonction) {
62
+            // 2 images pour composer l'icone : le fond (article) en background,
63
+            // la fonction (new) en image
64
+            $icone = http_img_pack($fonction, '', "class='cadre-icone' width='$size' height='$size'\n" .
65
+                http_style_background($fond, 'no-repeat center center', $size));
66
+        } else {
67
+            $icone = http_img_pack($fond, '', "class='cadre-icone' width='$size' height='$size'");
68
+        }
69
+        $titre = $icone . $titre;
70
+    }
71
+
72
+    return boite_ouvrir($titre, $class, $style_titre_mapping[$style] ?? '', $id);
73 73
 }
74 74
 
75 75
 function fin_cadre() {
76
- return boite_fermer();
76
+    return boite_fermer();
77 77
 }
78 78
 
79 79
 
80 80
 function debut_cadre_relief(
81
-	$icone = '',
82
-	$dummy = '',
83
-	$fonction = '',
84
-	$titre = '',
85
-	$id = '',
86
-	$class = ''
81
+    $icone = '',
82
+    $dummy = '',
83
+    $fonction = '',
84
+    $titre = '',
85
+    $id = '',
86
+    $class = ''
87 87
 ) {
88
-	return debut_cadre('r', $icone, $fonction, $titre, $id, $class);
88
+    return debut_cadre('r', $icone, $fonction, $titre, $id, $class);
89 89
 }
90 90
 
91 91
 function fin_cadre_relief() {
92
- return fin_cadre();
92
+    return fin_cadre();
93 93
 }
94 94
 
95 95
 function debut_cadre_enfonce(
96
-	$icone = '',
97
-	$dummy = '',
98
-	$fonction = '',
99
-	$titre = '',
100
-	$id = '',
101
-	$class = ''
96
+    $icone = '',
97
+    $dummy = '',
98
+    $fonction = '',
99
+    $titre = '',
100
+    $id = '',
101
+    $class = ''
102 102
 ) {
103
-	return debut_cadre('e', $icone, $fonction, $titre, $id, $class);
103
+    return debut_cadre('e', $icone, $fonction, $titre, $id, $class);
104 104
 }
105 105
 
106 106
 function fin_cadre_enfonce() {
107
- return fin_cadre();
107
+    return fin_cadre();
108 108
 }
109 109
 
110 110
 function debut_cadre_sous_rub(
111
-	$icone = '',
112
-	$dummy = '',
113
-	$fonction = '',
114
-	$titre = '',
115
-	$id = '',
116
-	$class = ''
111
+    $icone = '',
112
+    $dummy = '',
113
+    $fonction = '',
114
+    $titre = '',
115
+    $id = '',
116
+    $class = ''
117 117
 ) {
118
-	return debut_cadre('sous_rub', $icone, $fonction, $titre, $id, $class);
118
+    return debut_cadre('sous_rub', $icone, $fonction, $titre, $id, $class);
119 119
 }
120 120
 
121 121
 function fin_cadre_sous_rub() {
122
- return fin_cadre();
122
+    return fin_cadre();
123 123
 }
124 124
 
125 125
 function debut_cadre_couleur(
126
-	$icone = '',
127
-	$dummy = '',
128
-	$fonction = '',
129
-	$titre = '',
130
-	$id = '',
131
-	$class = ''
126
+    $icone = '',
127
+    $dummy = '',
128
+    $fonction = '',
129
+    $titre = '',
130
+    $id = '',
131
+    $class = ''
132 132
 ) {
133
-	return debut_cadre('couleur', $icone, $fonction, $titre, $id, $class);
133
+    return debut_cadre('couleur', $icone, $fonction, $titre, $id, $class);
134 134
 }
135 135
 
136 136
 function fin_cadre_couleur() {
137
- return fin_cadre();
137
+    return fin_cadre();
138 138
 }
139 139
 
140 140
 function debut_cadre_trait_couleur(
141
-	$icone = '',
142
-	$dummy = '',
143
-	$fonction = '',
144
-	$titre = '',
145
-	$id = '',
146
-	$class = ''
141
+    $icone = '',
142
+    $dummy = '',
143
+    $fonction = '',
144
+    $titre = '',
145
+    $id = '',
146
+    $class = ''
147 147
 ) {
148
-	return debut_cadre('trait-couleur', $icone, $fonction, $titre, $id, $class);
148
+    return debut_cadre('trait-couleur', $icone, $fonction, $titre, $id, $class);
149 149
 }
150 150
 
151 151
 function fin_cadre_trait_couleur() {
152
- return fin_cadre();
152
+    return fin_cadre();
153 153
 }
154 154
 
155 155
 function debut_boite_alerte() {
156
- return debut_cadre('alerte', '', '', '', '', '');
156
+    return debut_cadre('alerte', '', '', '', '', '');
157 157
 }
158 158
 
159 159
 function fin_boite_alerte() {
160
- return fin_cadre();
160
+    return fin_cadre();
161 161
 }
162 162
 
163 163
 function debut_boite_info() {
164
- return debut_cadre('info', '', '', '', '', '');
164
+    return debut_cadre('info', '', '', '', '', '');
165 165
 }
166 166
 
167 167
 function fin_boite_info() {
168
- return fin_cadre();
168
+    return fin_cadre();
169 169
 }
170 170
 
171 171
 /**
@@ -176,17 +176,17 @@  discard block
 block discarded – undo
176 176
  * @return string Code PHP.
177 177
  **/
178 178
 function gros_titre(
179
-	$titre,
180
-	$ze_logo = ''
179
+    $titre,
180
+    $ze_logo = ''
181 181
 ) {
182
-	return "<h1 class = 'grostitre'>" . $ze_logo . ' ' . typo($titre) . "</h1>\n";
182
+    return "<h1 class = 'grostitre'>" . $ze_logo . ' ' . typo($titre) . "</h1>\n";
183 183
 }
184 184
 
185 185
 // La boite des raccourcis
186 186
 // Se place a droite si l'ecran est en mode panoramique.
187 187
 function bloc_des_raccourcis($bloc) {
188
-	return creer_colonne_droite()
189
-	. boite_ouvrir(_T('titre_cadre_raccourcis'), 'raccourcis') . $bloc . boite_fermer();
188
+    return creer_colonne_droite()
189
+    . boite_ouvrir(_T('titre_cadre_raccourcis'), 'raccourcis') . $bloc . boite_fermer();
190 190
 }
191 191
 
192 192
 //
@@ -196,18 +196,18 @@  discard block
 block discarded – undo
196 196
 // Fonctions onglets
197 197
 // @param string $sous_classe	prend la valeur second pour definir les onglet de deuxieme niveau
198 198
 function debut_onglet($classe = 'barre_onglet') {
199
- return "<div class = '$classe clearfix'><ul>\n";
199
+    return "<div class = '$classe clearfix'><ul>\n";
200 200
 }
201 201
 
202 202
 function fin_onglet() {
203
- return "</ul></div>\n";
203
+    return "</ul></div>\n";
204 204
 }
205 205
 
206 206
 function onglet($texte, $lien, $onglet_ref, $onglet, $icone = '') {
207
-	return '<li>'
208
-	. ($icone ? http_img_pack($icone, '', " class='cadre-icone'") : '')
209
-	. lien_ou_expose($lien, $texte, $onglet == $onglet_ref)
210
-	. '</li>';
207
+    return '<li>'
208
+    . ($icone ? http_img_pack($icone, '', " class='cadre-icone'") : '')
209
+    . lien_ou_expose($lien, $texte, $onglet == $onglet_ref)
210
+    . '</li>';
211 211
 }
212 212
 
213 213
 /**
@@ -239,14 +239,14 @@  discard block
 block discarded – undo
239 239
  *     Code HTML du lien
240 240
  **/
241 241
 function icone_verticale($texte, $lien, $fond, $fonction = '', $align = '', $javascript = '') {
242
-	// cas d'ajax_action_auteur: faut defaire le boulot
243
-	// (il faudrait fusionner avec le cas $javascript)
244
-	if (preg_match(",^<a\shref='([^']*)'([^>]*)>(.*)</a>$,i", $lien, $r)) {
245
-		[$x, $lien, $atts, $texte] = $r;
246
-		$javascript .= $atts;
247
-	}
248
-
249
-	return icone_base($lien, $texte, $fond, $fonction, "verticale $align", $javascript);
242
+    // cas d'ajax_action_auteur: faut defaire le boulot
243
+    // (il faudrait fusionner avec le cas $javascript)
244
+    if (preg_match(",^<a\shref='([^']*)'([^>]*)>(.*)</a>$,i", $lien, $r)) {
245
+        [$x, $lien, $atts, $texte] = $r;
246
+        $javascript .= $atts;
247
+    }
248
+
249
+    return icone_base($lien, $texte, $fond, $fonction, "verticale $align", $javascript);
250 250
 }
251 251
 
252 252
 /**
@@ -271,15 +271,15 @@  discard block
 block discarded – undo
271 271
  *     Code HTML du lien
272 272
  **/
273 273
 function icone_horizontale($texte, $lien, $fond, $fonction = '', $dummy = '', $javascript = '') {
274
-	$retour = '';
275
-	// cas d'ajax_action_auteur: faut defaire le boulot
276
-	// (il faudrait fusionner avec le cas $javascript)
277
-	if (preg_match(",^<a\shref='([^']*)'([^>]*)>(.*)</a>$,i", $lien, $r)) {
278
-		[$x, $lien, $atts, $texte] = $r;
279
-		$javascript .= $atts;
280
-	}
274
+    $retour = '';
275
+    // cas d'ajax_action_auteur: faut defaire le boulot
276
+    // (il faudrait fusionner avec le cas $javascript)
277
+    if (preg_match(",^<a\shref='([^']*)'([^>]*)>(.*)</a>$,i", $lien, $r)) {
278
+        [$x, $lien, $atts, $texte] = $r;
279
+        $javascript .= $atts;
280
+    }
281 281
 
282
-	$retour = icone_base($lien, $texte, $fond, $fonction, 'horizontale', $javascript);
282
+    $retour = icone_base($lien, $texte, $fond, $fonction, 'horizontale', $javascript);
283 283
 
284
-	return $retour;
284
+    return $retour;
285 285
 }
Please login to merge, or discard this patch.
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -44,9 +44,9 @@  discard block
 block discarded – undo
44 44
 	];
45 45
 	$style_titre_mapping = ['couleur' => 'topper', 'trait-couleur' => 'section'];
46 46
 	$c = $style_mapping[$style] ?? 'simple';
47
-	$class = $c . ($class ? " $class" : '');
47
+	$class = $c.($class ? " $class" : '');
48 48
 	if (!$padding) {
49
-		$class .= ($class ? ' ' : '') . 'no-padding';
49
+		$class .= ($class ? ' ' : '').'no-padding';
50 50
 	}
51 51
 
52 52
 	//($id?"id='$id' ":"")
@@ -61,12 +61,12 @@  discard block
 block discarded – undo
61 61
 		if ($fonction) {
62 62
 			// 2 images pour composer l'icone : le fond (article) en background,
63 63
 			// la fonction (new) en image
64
-			$icone = http_img_pack($fonction, '', "class='cadre-icone' width='$size' height='$size'\n" .
64
+			$icone = http_img_pack($fonction, '', "class='cadre-icone' width='$size' height='$size'\n".
65 65
 				http_style_background($fond, 'no-repeat center center', $size));
66 66
 		} else {
67 67
 			$icone = http_img_pack($fond, '', "class='cadre-icone' width='$size' height='$size'");
68 68
 		}
69
-		$titre = $icone . $titre;
69
+		$titre = $icone.$titre;
70 70
 	}
71 71
 
72 72
 	return boite_ouvrir($titre, $class, $style_titre_mapping[$style] ?? '', $id);
@@ -179,14 +179,14 @@  discard block
 block discarded – undo
179 179
 	$titre,
180 180
 	$ze_logo = ''
181 181
 ) {
182
-	return "<h1 class = 'grostitre'>" . $ze_logo . ' ' . typo($titre) . "</h1>\n";
182
+	return "<h1 class = 'grostitre'>".$ze_logo.' '.typo($titre)."</h1>\n";
183 183
 }
184 184
 
185 185
 // La boite des raccourcis
186 186
 // Se place a droite si l'ecran est en mode panoramique.
187 187
 function bloc_des_raccourcis($bloc) {
188 188
 	return creer_colonne_droite()
189
-	. boite_ouvrir(_T('titre_cadre_raccourcis'), 'raccourcis') . $bloc . boite_fermer();
189
+	. boite_ouvrir(_T('titre_cadre_raccourcis'), 'raccourcis').$bloc.boite_fermer();
190 190
 }
191 191
 
192 192
 //
Please login to merge, or discard this patch.
ecrire/inc/layer.php 2 patches
Indentation   +109 added lines, -109 removed lines patch added patch discarded remove patch
@@ -11,7 +11,7 @@  discard block
 block discarded – undo
11 11
 \***************************************************************************/
12 12
 
13 13
 if (!defined('_ECRIRE_INC_VERSION')) {
14
-	return;
14
+    return;
15 15
 }
16 16
 
17 17
 /**
@@ -26,70 +26,70 @@  discard block
 block discarded – undo
26 26
  * @return string Code HTML du cadre dépliable
27 27
  **/
28 28
 function cadre_depliable($icone, $titre, $deplie, $contenu, $ids = '', $style_cadre = 'r') {
29
-	$bouton = bouton_block_depliable($titre, $deplie, $ids);
30
-
31
-	return
32
-		debut_cadre($style_cadre, $icone, '', $bouton, '', '', false)
33
-		. debut_block_depliable($deplie, $ids)
34
-		. "<div class='cadre_padding'>\n"
35
-		. $contenu
36
-		. "</div>\n"
37
-		. fin_block()
38
-		. fin_cadre();
29
+    $bouton = bouton_block_depliable($titre, $deplie, $ids);
30
+
31
+    return
32
+        debut_cadre($style_cadre, $icone, '', $bouton, '', '', false)
33
+        . debut_block_depliable($deplie, $ids)
34
+        . "<div class='cadre_padding'>\n"
35
+        . $contenu
36
+        . "</div>\n"
37
+        . fin_block()
38
+        . fin_cadre();
39 39
 }
40 40
 
41 41
 function block_parfois_visible($nom, $invite, $masque, $style = '', $visible = false) {
42
-	return "\n"
43
-	. bouton_block_depliable($invite, $visible, $nom)
44
-	. debut_block_depliable($visible, $nom)
45
-	. $masque
46
-	. fin_block();
42
+    return "\n"
43
+    . bouton_block_depliable($invite, $visible, $nom)
44
+    . debut_block_depliable($visible, $nom)
45
+    . $masque
46
+    . fin_block();
47 47
 }
48 48
 
49 49
 function debut_block_depliable($deplie, $id = '') {
50
-	$class = ' blocdeplie';
51
-	// si on n'accepte pas js, ne pas fermer
52
-	if (!$deplie) {
53
-		$class = ' blocreplie';
54
-	}
50
+    $class = ' blocdeplie';
51
+    // si on n'accepte pas js, ne pas fermer
52
+    if (!$deplie) {
53
+        $class = ' blocreplie';
54
+    }
55 55
 
56
-	return '<div ' . ($id ? "id='$id' " : '') . "class='bloc_depliable$class'>";
56
+    return '<div ' . ($id ? "id='$id' " : '') . "class='bloc_depliable$class'>";
57 57
 }
58 58
 
59 59
 function fin_block() {
60
-	return "<div class='nettoyeur'></div>\n</div>";
60
+    return "<div class='nettoyeur'></div>\n</div>";
61 61
 }
62 62
 
63 63
 // $texte : texte du bouton
64 64
 // $deplie : true (deplie) ou false (plie) ou -1 (inactif) ou 'incertain' pour que le bouton s'auto init au chargement de la page
65 65
 // $ids : id des div lies au bouton (facultatif, par defaut c'est le div.bloc_depliable qui suit)
66 66
 function bouton_block_depliable($texte, $deplie, $ids = '') {
67
-	$bouton_id = 'b' . substr(md5($texte . microtime()), 0, 8);
68
-
69
-	$class = ($deplie === true) ? ' deplie' : (($deplie == -1) ? ' impliable' : ' replie');
70
-	if (strlen($ids)) {
71
-		$cible = explode(',', $ids);
72
-		$cible = '#' . implode(',#', $cible);
73
-	} else {
74
-		$cible = "#$bouton_id + div.bloc_depliable";
75
-	}
76
-
77
-	$b = (strpos($texte, '<h') === false ? 'h3' : 'div');
78
-
79
-	return "<$b "
80
-	. ($bouton_id ? "id='$bouton_id' " : '')
81
-	. "class='titrem$class'"
82
-	. (($deplie === -1)
83
-		? ''
84
-		: " onmouseover=\"jQuery(this).depliant('$cible');\""
85
-	)
86
-	. '>'
87
-	// une ancre pour rendre accessible au clavier le depliage du sous bloc
88
-	. "<a href='#' onclick=\"return jQuery(this).depliant_clicancre('$cible');\" class='titremancre'></a>"
89
-	. "$texte</$b>"
90
-	. http_script(($deplie === 'incertain')
91
-		? "jQuery(function($){if ($('$cible').is(':visible')) { $('#$bouton_id').addClass('deplie').removeClass('replie'); }});"
92
-		: '');
67
+    $bouton_id = 'b' . substr(md5($texte . microtime()), 0, 8);
68
+
69
+    $class = ($deplie === true) ? ' deplie' : (($deplie == -1) ? ' impliable' : ' replie');
70
+    if (strlen($ids)) {
71
+        $cible = explode(',', $ids);
72
+        $cible = '#' . implode(',#', $cible);
73
+    } else {
74
+        $cible = "#$bouton_id + div.bloc_depliable";
75
+    }
76
+
77
+    $b = (strpos($texte, '<h') === false ? 'h3' : 'div');
78
+
79
+    return "<$b "
80
+    . ($bouton_id ? "id='$bouton_id' " : '')
81
+    . "class='titrem$class'"
82
+    . (($deplie === -1)
83
+        ? ''
84
+        : " onmouseover=\"jQuery(this).depliant('$cible');\""
85
+    )
86
+    . '>'
87
+    // une ancre pour rendre accessible au clavier le depliage du sous bloc
88
+    . "<a href='#' onclick=\"return jQuery(this).depliant_clicancre('$cible');\" class='titremancre'></a>"
89
+    . "$texte</$b>"
90
+    . http_script(($deplie === 'incertain')
91
+        ? "jQuery(function($){if ($('$cible').is(':visible')) { $('#$bouton_id').addClass('deplie').removeClass('replie'); }});"
92
+        : '');
93 93
 }
94 94
 
95 95
 //
@@ -97,66 +97,66 @@  discard block
 block discarded – undo
97 97
 //
98 98
 function verif_butineur() {
99 99
 
100
-	preg_match(',^([A-Za-z]+)/([0-9]+\.[0-9]+) (.*)$,', $_SERVER['HTTP_USER_AGENT'], $match);
101
-	$GLOBALS['browser_name'] = $match[1];
102
-	$GLOBALS['browser_version'] = $match[2];
103
-	$GLOBALS['browser_description'] = $match[3];
104
-	$GLOBALS['browser_layer'] = ' '; // compat avec vieux scripts qui testent la valeur
105
-	$GLOBALS['browser_barre'] = '';
106
-
107
-	if (!preg_match(',opera,i', $GLOBALS['browser_description']) && preg_match(',opera,i', $GLOBALS['browser_name'])) {
108
-		$GLOBALS['browser_name'] = 'Opera';
109
-		$GLOBALS['browser_version'] = $match[2];
110
-		$GLOBALS['browser_barre'] = ($GLOBALS['browser_version'] >= 8.5);
111
-	} else {
112
-		if (preg_match(',opera,i', $GLOBALS['browser_description'])) {
113
-			preg_match(',Opera ([^\ ]*),i', $GLOBALS['browser_description'], $match);
114
-			$GLOBALS['browser_name'] = 'Opera';
115
-			$GLOBALS['browser_version'] = $match[1];
116
-			$GLOBALS['browser_barre'] = ($GLOBALS['browser_version'] >= 8.5);
117
-		} else {
118
-			if (preg_match(',msie,i', $GLOBALS['browser_description'])) {
119
-				preg_match(',MSIE ([^;]*),i', $GLOBALS['browser_description'], $match);
120
-				$GLOBALS['browser_name'] = 'MSIE';
121
-				$GLOBALS['browser_version'] = $match[1];
122
-				$GLOBALS['browser_barre'] = ($GLOBALS['browser_version'] >= 5.5);
123
-			} else {
124
-				if (
125
-					preg_match(',KHTML,i', $GLOBALS['browser_description']) &&
126
-					preg_match(',Safari/([^;]*),', $GLOBALS['browser_description'], $match)
127
-				) {
128
-					$GLOBALS['browser_name'] = 'Safari';
129
-					$GLOBALS['browser_version'] = $match[1];
130
-					$GLOBALS['browser_barre'] = ($GLOBALS['browser_version'] >= 5.0);
131
-				} else {
132
-					if (preg_match(',mozilla,i', $GLOBALS['browser_name']) and $GLOBALS['browser_version'] >= 5) {
133
-						// Numero de version pour Mozilla "authentique"
134
-						if (preg_match(',rv:([0-9]+\.[0-9]+),', $GLOBALS['browser_description'], $match)) {
135
-							$GLOBALS['browser_rev'] = doubleval($match[1]);
136
-						} // Autres Gecko => equivalents 1.4 par defaut (Galeon, etc.)
137
-						else {
138
-							if (
139
-								strpos($GLOBALS['browser_description'], 'Gecko') and !strpos(
140
-									$GLOBALS['browser_description'],
141
-									'KHTML'
142
-								)
143
-							) {
144
-								$GLOBALS['browser_rev'] = 1.4;
145
-							} // Machins quelconques => equivalents 1.0 par defaut (Konqueror, etc.)
146
-							else {
147
-								$GLOBALS['browser_rev'] = 1.0;
148
-							}
149
-						}
150
-						$GLOBALS['browser_barre'] = $GLOBALS['browser_rev'] >= 1.3;
151
-					}
152
-				}
153
-			}
154
-		}
155
-	}
156
-
157
-	if (!$GLOBALS['browser_name']) {
158
-		$GLOBALS['browser_name'] = 'Mozilla';
159
-	}
100
+    preg_match(',^([A-Za-z]+)/([0-9]+\.[0-9]+) (.*)$,', $_SERVER['HTTP_USER_AGENT'], $match);
101
+    $GLOBALS['browser_name'] = $match[1];
102
+    $GLOBALS['browser_version'] = $match[2];
103
+    $GLOBALS['browser_description'] = $match[3];
104
+    $GLOBALS['browser_layer'] = ' '; // compat avec vieux scripts qui testent la valeur
105
+    $GLOBALS['browser_barre'] = '';
106
+
107
+    if (!preg_match(',opera,i', $GLOBALS['browser_description']) && preg_match(',opera,i', $GLOBALS['browser_name'])) {
108
+        $GLOBALS['browser_name'] = 'Opera';
109
+        $GLOBALS['browser_version'] = $match[2];
110
+        $GLOBALS['browser_barre'] = ($GLOBALS['browser_version'] >= 8.5);
111
+    } else {
112
+        if (preg_match(',opera,i', $GLOBALS['browser_description'])) {
113
+            preg_match(',Opera ([^\ ]*),i', $GLOBALS['browser_description'], $match);
114
+            $GLOBALS['browser_name'] = 'Opera';
115
+            $GLOBALS['browser_version'] = $match[1];
116
+            $GLOBALS['browser_barre'] = ($GLOBALS['browser_version'] >= 8.5);
117
+        } else {
118
+            if (preg_match(',msie,i', $GLOBALS['browser_description'])) {
119
+                preg_match(',MSIE ([^;]*),i', $GLOBALS['browser_description'], $match);
120
+                $GLOBALS['browser_name'] = 'MSIE';
121
+                $GLOBALS['browser_version'] = $match[1];
122
+                $GLOBALS['browser_barre'] = ($GLOBALS['browser_version'] >= 5.5);
123
+            } else {
124
+                if (
125
+                    preg_match(',KHTML,i', $GLOBALS['browser_description']) &&
126
+                    preg_match(',Safari/([^;]*),', $GLOBALS['browser_description'], $match)
127
+                ) {
128
+                    $GLOBALS['browser_name'] = 'Safari';
129
+                    $GLOBALS['browser_version'] = $match[1];
130
+                    $GLOBALS['browser_barre'] = ($GLOBALS['browser_version'] >= 5.0);
131
+                } else {
132
+                    if (preg_match(',mozilla,i', $GLOBALS['browser_name']) and $GLOBALS['browser_version'] >= 5) {
133
+                        // Numero de version pour Mozilla "authentique"
134
+                        if (preg_match(',rv:([0-9]+\.[0-9]+),', $GLOBALS['browser_description'], $match)) {
135
+                            $GLOBALS['browser_rev'] = doubleval($match[1]);
136
+                        } // Autres Gecko => equivalents 1.4 par defaut (Galeon, etc.)
137
+                        else {
138
+                            if (
139
+                                strpos($GLOBALS['browser_description'], 'Gecko') and !strpos(
140
+                                    $GLOBALS['browser_description'],
141
+                                    'KHTML'
142
+                                )
143
+                            ) {
144
+                                $GLOBALS['browser_rev'] = 1.4;
145
+                            } // Machins quelconques => equivalents 1.0 par defaut (Konqueror, etc.)
146
+                            else {
147
+                                $GLOBALS['browser_rev'] = 1.0;
148
+                            }
149
+                        }
150
+                        $GLOBALS['browser_barre'] = $GLOBALS['browser_rev'] >= 1.3;
151
+                    }
152
+                }
153
+            }
154
+        }
155
+    }
156
+
157
+    if (!$GLOBALS['browser_name']) {
158
+        $GLOBALS['browser_name'] = 'Mozilla';
159
+    }
160 160
 }
161 161
 
162 162
 verif_butineur();
Please login to merge, or discard this patch.
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -53,7 +53,7 @@  discard block
 block discarded – undo
53 53
 		$class = ' blocreplie';
54 54
 	}
55 55
 
56
-	return '<div ' . ($id ? "id='$id' " : '') . "class='bloc_depliable$class'>";
56
+	return '<div '.($id ? "id='$id' " : '')."class='bloc_depliable$class'>";
57 57
 }
58 58
 
59 59
 function fin_block() {
@@ -64,12 +64,12 @@  discard block
 block discarded – undo
64 64
 // $deplie : true (deplie) ou false (plie) ou -1 (inactif) ou 'incertain' pour que le bouton s'auto init au chargement de la page
65 65
 // $ids : id des div lies au bouton (facultatif, par defaut c'est le div.bloc_depliable qui suit)
66 66
 function bouton_block_depliable($texte, $deplie, $ids = '') {
67
-	$bouton_id = 'b' . substr(md5($texte . microtime()), 0, 8);
67
+	$bouton_id = 'b'.substr(md5($texte.microtime()), 0, 8);
68 68
 
69 69
 	$class = ($deplie === true) ? ' deplie' : (($deplie == -1) ? ' impliable' : ' replie');
70 70
 	if (strlen($ids)) {
71 71
 		$cible = explode(',', $ids);
72
-		$cible = '#' . implode(',#', $cible);
72
+		$cible = '#'.implode(',#', $cible);
73 73
 	} else {
74 74
 		$cible = "#$bouton_id + div.bloc_depliable";
75 75
 	}
Please login to merge, or discard this patch.
ecrire/balise/formulaire_admin.php 2 patches
Indentation   +148 added lines, -148 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
 /**
@@ -42,7 +42,7 @@  discard block
 block discarded – undo
42 42
  *     Pile complétée du code compilé
43 43
  **/
44 44
 function balise_FORMULAIRE_ADMIN($p) {
45
-	return calculer_balise_dynamique($p, 'FORMULAIRE_ADMIN', []);
45
+    return calculer_balise_dynamique($p, 'FORMULAIRE_ADMIN', []);
46 46
 }
47 47
 
48 48
 /**
@@ -59,7 +59,7 @@  discard block
 block discarded – undo
59 59
  *   - chaîne vide sinon.
60 60
  */
61 61
 function balise_FORMULAIRE_ADMIN_stat($args, $context_compil) {
62
-	return $args;
62
+    return $args;
63 63
 }
64 64
 
65 65
 
@@ -84,66 +84,66 @@  discard block
 block discarded – undo
84 84
  **/
85 85
 function balise_FORMULAIRE_ADMIN_dyn($float = '', $debug = '') {
86 86
 
87
-	static $dejafait = false;
87
+    static $dejafait = false;
88 88
 
89
-	if (empty($_COOKIE['spip_admin'])) {
90
-		return '';
91
-	}
89
+    if (empty($_COOKIE['spip_admin'])) {
90
+        return '';
91
+    }
92 92
 
93
-	if (!is_array($debug)) {
94
-		if ($dejafait) {
95
-			return '';
96
-		}
97
-	} else {
98
-		if ($dejafait) {
99
-			if (empty($debug['sourcefile'])) {
100
-				return '';
101
-			}
102
-			foreach ($debug['sourcefile'] as $k => $v) {
103
-				if (strpos($v, 'administration.') !== false) {
104
-					if (isset($debug['resultat'][$k . 'tout'])) {
105
-						return $debug['resultat'][$k . 'tout'];
106
-					}
107
-				}
108
-			}
93
+    if (!is_array($debug)) {
94
+        if ($dejafait) {
95
+            return '';
96
+        }
97
+    } else {
98
+        if ($dejafait) {
99
+            if (empty($debug['sourcefile'])) {
100
+                return '';
101
+            }
102
+            foreach ($debug['sourcefile'] as $k => $v) {
103
+                if (strpos($v, 'administration.') !== false) {
104
+                    if (isset($debug['resultat'][$k . 'tout'])) {
105
+                        return $debug['resultat'][$k . 'tout'];
106
+                    }
107
+                }
108
+            }
109 109
 
110
-			return '';
111
-		}
112
-	}
110
+            return '';
111
+        }
112
+    }
113 113
 
114
-	include_spip('inc/autoriser');
115
-	include_spip('base/abstract_sql');
114
+    include_spip('inc/autoriser');
115
+    include_spip('base/abstract_sql');
116 116
 
117 117
 
118
-	$dejafait = true;
118
+    $dejafait = true;
119 119
 
120
-	// Preparer le #ENV des boutons
120
+    // Preparer le #ENV des boutons
121 121
 
122
-	$env = admin_objet();
122
+    $env = admin_objet();
123 123
 
124
-	// Pas de "modifier ce..." ? -> donner "acces a l'espace prive"
125
-	if (!$env) {
126
-		$env['ecrire'] = _DIR_RESTREINT_ABS;
127
-	}
124
+    // Pas de "modifier ce..." ? -> donner "acces a l'espace prive"
125
+    if (!$env) {
126
+        $env['ecrire'] = _DIR_RESTREINT_ABS;
127
+    }
128 128
 
129
-	$env['divclass'] = $float;
130
-	$env['lang'] = admin_lang();
131
-	$env['calcul'] = (_request('var_mode') ? 'recalcul' : 'calcul');
132
-	$env['debug'] = ((defined('_VAR_PREVIEW') and _VAR_PREVIEW) ? '' : admin_debug());
133
-	$env['analyser'] = (!$env['debug'] and !$GLOBALS['xhtml']) ? '' : admin_valider();
134
-	$env['inclure'] = ((defined('_VAR_INCLURE') and _VAR_INCLURE) ? 'inclure' : '');
129
+    $env['divclass'] = $float;
130
+    $env['lang'] = admin_lang();
131
+    $env['calcul'] = (_request('var_mode') ? 'recalcul' : 'calcul');
132
+    $env['debug'] = ((defined('_VAR_PREVIEW') and _VAR_PREVIEW) ? '' : admin_debug());
133
+    $env['analyser'] = (!$env['debug'] and !$GLOBALS['xhtml']) ? '' : admin_valider();
134
+    $env['inclure'] = ((defined('_VAR_INCLURE') and _VAR_INCLURE) ? 'inclure' : '');
135 135
 
136
-	if (empty($GLOBALS['use_cache'])) {
137
-		$env['use_cache'] = ' *';
138
-	}
136
+    if (empty($GLOBALS['use_cache'])) {
137
+        $env['use_cache'] = ' *';
138
+    }
139 139
 
140
-	if (isset($debug['validation'])) {
141
-		$env['xhtml_error'] = $debug['validation'];
142
-	}
140
+    if (isset($debug['validation'])) {
141
+        $env['xhtml_error'] = $debug['validation'];
142
+    }
143 143
 
144
-	$env['_pipelines']['formulaire_admin'] = [];
144
+    $env['_pipelines']['formulaire_admin'] = [];
145 145
 
146
-	return ['formulaires/administration', 0, $env];
146
+    return ['formulaires/administration', 0, $env];
147 147
 }
148 148
 
149 149
 
@@ -161,47 +161,47 @@  discard block
 block discarded – undo
161 161
  *     Tableau de l'environnement calculé
162 162
  **/
163 163
 function admin_objet() {
164
-	include_spip('inc/urls');
165
-	$env = [];
166
-
167
-	$trouver_table = charger_fonction('trouver_table', 'base');
168
-	$objets = urls_liste_objets(false);
169
-	$objets = array_diff($objets, ['rubrique']);
170
-	$objets = array_reverse($objets);
171
-	array_unshift($objets, 'rubrique');
172
-	foreach ($objets as $obj) {
173
-		$type = $obj;
174
-		if (
175
-			$type == objet_type($type, false)
176
-			and $_id_type = id_table_objet($type)
177
-			and isset($GLOBALS['contexte'][$_id_type])
178
-			and $id = $GLOBALS['contexte'][$_id_type]
179
-			and !is_array($id)
180
-			and $id = intval($id)
181
-			and $desc = $trouver_table(table_objet_sql($type))
182
-		) {
183
-			$id = sql_getfetsel($_id_type, table_objet_sql($type), "$_id_type=" . intval($id));
184
-			if ($id) {
185
-				$env[$_id_type] = $id;
186
-				$env['objet'] = $type;
187
-				$env['id_objet'] = $id;
188
-				$env['voir_' . $obj] =
189
-					str_replace('&amp;', '&', generer_objet_url($id, $obj, '', '', false));
190
-				if (
191
-					isset($desc['field']['id_rubrique'])
192
-					and $type != 'rubrique'
193
-				) {
194
-					unset($env['id_rubrique']);
195
-					unset($env['voir_rubrique']);
196
-					if (admin_preview($type, $id, $desc)) {
197
-						$env['preview'] = parametre_url(self(), 'var_mode', 'preview', '&');
198
-					}
199
-				}
200
-			}
201
-		}
202
-	}
203
-
204
-	return $env;
164
+    include_spip('inc/urls');
165
+    $env = [];
166
+
167
+    $trouver_table = charger_fonction('trouver_table', 'base');
168
+    $objets = urls_liste_objets(false);
169
+    $objets = array_diff($objets, ['rubrique']);
170
+    $objets = array_reverse($objets);
171
+    array_unshift($objets, 'rubrique');
172
+    foreach ($objets as $obj) {
173
+        $type = $obj;
174
+        if (
175
+            $type == objet_type($type, false)
176
+            and $_id_type = id_table_objet($type)
177
+            and isset($GLOBALS['contexte'][$_id_type])
178
+            and $id = $GLOBALS['contexte'][$_id_type]
179
+            and !is_array($id)
180
+            and $id = intval($id)
181
+            and $desc = $trouver_table(table_objet_sql($type))
182
+        ) {
183
+            $id = sql_getfetsel($_id_type, table_objet_sql($type), "$_id_type=" . intval($id));
184
+            if ($id) {
185
+                $env[$_id_type] = $id;
186
+                $env['objet'] = $type;
187
+                $env['id_objet'] = $id;
188
+                $env['voir_' . $obj] =
189
+                    str_replace('&amp;', '&', generer_objet_url($id, $obj, '', '', false));
190
+                if (
191
+                    isset($desc['field']['id_rubrique'])
192
+                    and $type != 'rubrique'
193
+                ) {
194
+                    unset($env['id_rubrique']);
195
+                    unset($env['voir_rubrique']);
196
+                    if (admin_preview($type, $id, $desc)) {
197
+                        $env['preview'] = parametre_url(self(), 'var_mode', 'preview', '&');
198
+                    }
199
+                }
200
+            }
201
+        }
202
+    }
203
+
204
+    return $env;
205 205
 }
206 206
 
207 207
 
@@ -219,30 +219,30 @@  discard block
 block discarded – undo
219 219
  *     - Tableau d'un élément sinon.
220 220
  **/
221 221
 function admin_preview($type, $id, $desc = null) {
222
-	if (defined('_VAR_PREVIEW') and _VAR_PREVIEW) {
223
-		return '';
224
-	}
225
-
226
-	if (!$desc) {
227
-		$trouver_table = charger_fonction('trouver_table', 'base');
228
-		$desc = $trouver_table(table_objet_sql($type));
229
-	}
230
-	if (!$desc or !isset($desc['field']['statut'])) {
231
-		return '';
232
-	}
233
-
234
-	include_spip('inc/autoriser');
235
-	if (!autoriser('previsualiser')) {
236
-		return '';
237
-	}
238
-
239
-	$notpub = sql_in('statut', ['prop', 'prive']);
240
-
241
-	if ($type == 'article' and $GLOBALS['meta']['post_dates'] != 'oui') {
242
-		$notpub .= " OR (statut='publie' AND date>" . sql_quote(date('Y-m-d H:i:s')) . ')';
243
-	}
244
-
245
-	return sql_fetsel('1', table_objet_sql($type), id_table_objet($type) . '=' . $id . " AND ($notpub)");
222
+    if (defined('_VAR_PREVIEW') and _VAR_PREVIEW) {
223
+        return '';
224
+    }
225
+
226
+    if (!$desc) {
227
+        $trouver_table = charger_fonction('trouver_table', 'base');
228
+        $desc = $trouver_table(table_objet_sql($type));
229
+    }
230
+    if (!$desc or !isset($desc['field']['statut'])) {
231
+        return '';
232
+    }
233
+
234
+    include_spip('inc/autoriser');
235
+    if (!autoriser('previsualiser')) {
236
+        return '';
237
+    }
238
+
239
+    $notpub = sql_in('statut', ['prop', 'prive']);
240
+
241
+    if ($type == 'article' and $GLOBALS['meta']['post_dates'] != 'oui') {
242
+        $notpub .= " OR (statut='publie' AND date>" . sql_quote(date('Y-m-d H:i:s')) . ')';
243
+    }
244
+
245
+    return sql_fetsel('1', table_objet_sql($type), id_table_objet($type) . '=' . $id . " AND ($notpub)");
246 246
 }
247 247
 
248 248
 
@@ -253,25 +253,25 @@  discard block
 block discarded – undo
253 253
  *     Code de langue
254 254
  **/
255 255
 function admin_lang() {
256
-	$alang = '';
257
-	if (!empty($_COOKIE['spip_admin'])) {
258
-		$email_or_login = preg_replace(',^@,', '', $_COOKIE['spip_admin']);
259
-		$alang = sql_getfetsel('lang', 'spip_auteurs', 'email=' . sql_quote($email_or_login));
260
-		if (!$alang) {
261
-			$alang = sql_getfetsel('lang', 'spip_auteurs', 'login=' . sql_quote($email_or_login));
262
-		}
263
-	}
264
-	if (!$alang) {
265
-		return '';
266
-	}
267
-
268
-	$l = lang_select($alang);
269
-	$alang = $GLOBALS['spip_lang'];
270
-	if ($l) {
271
-		lang_select();
272
-	}
273
-
274
-	return $alang;
256
+    $alang = '';
257
+    if (!empty($_COOKIE['spip_admin'])) {
258
+        $email_or_login = preg_replace(',^@,', '', $_COOKIE['spip_admin']);
259
+        $alang = sql_getfetsel('lang', 'spip_auteurs', 'email=' . sql_quote($email_or_login));
260
+        if (!$alang) {
261
+            $alang = sql_getfetsel('lang', 'spip_auteurs', 'login=' . sql_quote($email_or_login));
262
+        }
263
+    }
264
+    if (!$alang) {
265
+        return '';
266
+    }
267
+
268
+    $l = lang_select($alang);
269
+    $alang = $GLOBALS['spip_lang'];
270
+    if ($l) {
271
+        lang_select();
272
+    }
273
+
274
+    return $alang;
275 275
 }
276 276
 
277 277
 /**
@@ -281,11 +281,11 @@  discard block
 block discarded – undo
281 281
  **/
282 282
 function admin_valider() {
283 283
 
284
-	return ((!isset($GLOBALS['xhtml']) or $GLOBALS['xhtml'] !== 'true') ?
285
-		(parametre_url(self(), 'var_mode', 'debug', '&')
286
-			. '&var_mode_affiche=validation') :
287
-		('http://validator.w3.org/check?uri='
288
-			. rawurlencode('http://' . $_SERVER['HTTP_HOST'] . nettoyer_uri())));
284
+    return ((!isset($GLOBALS['xhtml']) or $GLOBALS['xhtml'] !== 'true') ?
285
+        (parametre_url(self(), 'var_mode', 'debug', '&')
286
+            . '&var_mode_affiche=validation') :
287
+        ('http://validator.w3.org/check?uri='
288
+            . rawurlencode('http://' . $_SERVER['HTTP_HOST'] . nettoyer_uri())));
289 289
 }
290 290
 
291 291
 /**
@@ -294,14 +294,14 @@  discard block
 block discarded – undo
294 294
  * @return string
295 295
  **/
296 296
 function admin_debug() {
297
-	return ((
298
-			(isset($GLOBALS['forcer_debug']) and $GLOBALS['forcer_debug'])
299
-			or (isset($GLOBALS['bouton_admin_debug']) and $GLOBALS['bouton_admin_debug'])
300
-			or (
301
-				defined('_VAR_MODE') and _VAR_MODE == 'debug'
302
-				and isset($_COOKIE['spip_debug']) and $_COOKIE['spip_debug']
303
-			)
304
-		) and autoriser('debug')
305
-	)
306
-		? parametre_url(self(), 'var_mode', 'debug', '&') : '';
297
+    return ((
298
+            (isset($GLOBALS['forcer_debug']) and $GLOBALS['forcer_debug'])
299
+            or (isset($GLOBALS['bouton_admin_debug']) and $GLOBALS['bouton_admin_debug'])
300
+            or (
301
+                defined('_VAR_MODE') and _VAR_MODE == 'debug'
302
+                and isset($_COOKIE['spip_debug']) and $_COOKIE['spip_debug']
303
+            )
304
+        ) and autoriser('debug')
305
+    )
306
+        ? parametre_url(self(), 'var_mode', 'debug', '&') : '';
307 307
 }
Please login to merge, or discard this patch.
Spacing   +10 added lines, -11 removed lines patch added patch discarded remove patch
@@ -101,8 +101,8 @@  discard block
 block discarded – undo
101 101
 			}
102 102
 			foreach ($debug['sourcefile'] as $k => $v) {
103 103
 				if (strpos($v, 'administration.') !== false) {
104
-					if (isset($debug['resultat'][$k . 'tout'])) {
105
-						return $debug['resultat'][$k . 'tout'];
104
+					if (isset($debug['resultat'][$k.'tout'])) {
105
+						return $debug['resultat'][$k.'tout'];
106 106
 					}
107 107
 				}
108 108
 			}
@@ -180,12 +180,12 @@  discard block
 block discarded – undo
180 180
 			and $id = intval($id)
181 181
 			and $desc = $trouver_table(table_objet_sql($type))
182 182
 		) {
183
-			$id = sql_getfetsel($_id_type, table_objet_sql($type), "$_id_type=" . intval($id));
183
+			$id = sql_getfetsel($_id_type, table_objet_sql($type), "$_id_type=".intval($id));
184 184
 			if ($id) {
185 185
 				$env[$_id_type] = $id;
186 186
 				$env['objet'] = $type;
187 187
 				$env['id_objet'] = $id;
188
-				$env['voir_' . $obj] =
188
+				$env['voir_'.$obj] =
189 189
 					str_replace('&amp;', '&', generer_objet_url($id, $obj, '', '', false));
190 190
 				if (
191 191
 					isset($desc['field']['id_rubrique'])
@@ -239,10 +239,10 @@  discard block
 block discarded – undo
239 239
 	$notpub = sql_in('statut', ['prop', 'prive']);
240 240
 
241 241
 	if ($type == 'article' and $GLOBALS['meta']['post_dates'] != 'oui') {
242
-		$notpub .= " OR (statut='publie' AND date>" . sql_quote(date('Y-m-d H:i:s')) . ')';
242
+		$notpub .= " OR (statut='publie' AND date>".sql_quote(date('Y-m-d H:i:s')).')';
243 243
 	}
244 244
 
245
-	return sql_fetsel('1', table_objet_sql($type), id_table_objet($type) . '=' . $id . " AND ($notpub)");
245
+	return sql_fetsel('1', table_objet_sql($type), id_table_objet($type).'='.$id." AND ($notpub)");
246 246
 }
247 247
 
248 248
 
@@ -256,9 +256,9 @@  discard block
 block discarded – undo
256 256
 	$alang = '';
257 257
 	if (!empty($_COOKIE['spip_admin'])) {
258 258
 		$email_or_login = preg_replace(',^@,', '', $_COOKIE['spip_admin']);
259
-		$alang = sql_getfetsel('lang', 'spip_auteurs', 'email=' . sql_quote($email_or_login));
259
+		$alang = sql_getfetsel('lang', 'spip_auteurs', 'email='.sql_quote($email_or_login));
260 260
 		if (!$alang) {
261
-			$alang = sql_getfetsel('lang', 'spip_auteurs', 'login=' . sql_quote($email_or_login));
261
+			$alang = sql_getfetsel('lang', 'spip_auteurs', 'login='.sql_quote($email_or_login));
262 262
 		}
263 263
 	}
264 264
 	if (!$alang) {
@@ -283,9 +283,8 @@  discard block
 block discarded – undo
283 283
 
284 284
 	return ((!isset($GLOBALS['xhtml']) or $GLOBALS['xhtml'] !== 'true') ?
285 285
 		(parametre_url(self(), 'var_mode', 'debug', '&')
286
-			. '&var_mode_affiche=validation') :
287
-		('http://validator.w3.org/check?uri='
288
-			. rawurlencode('http://' . $_SERVER['HTTP_HOST'] . nettoyer_uri())));
286
+			. '&var_mode_affiche=validation') : ('http://validator.w3.org/check?uri='
287
+			. rawurlencode('http://'.$_SERVER['HTTP_HOST'].nettoyer_uri())));
289 288
 }
290 289
 
291 290
 /**
Please login to merge, or discard this patch.
ecrire/balise/info_.php 2 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -54,12 +54,12 @@
 block discarded – undo
54 54
 		$_params = '[';
55 55
 		$nb_params = is_countable($p->param[0]) ? count($p->param[0]) : 0; // 1ère valeur vide donc 1 en plus
56 56
 		for ($i = 3; $i < $nb_params; $i++) {
57
-			$_params .= interprete_argument_balise($i, $p) . ',';
57
+			$_params .= interprete_argument_balise($i, $p).',';
58 58
 		}
59 59
 		$_params .= ']';
60 60
 
61 61
 		$info_sql = strtolower(substr($info, 5));
62
-		$code = "generer_objet_info($id_objet, $type_objet, '$info_sql', " . ($p->etoile ? _q($p->etoile) : "''") . ", $_params)";
62
+		$code = "generer_objet_info($id_objet, $type_objet, '$info_sql', ".($p->etoile ? _q($p->etoile) : "''").", $_params)";
63 63
 		$p->code = champ_sql($info, $p, $code);
64 64
 		$p->interdire_scripts = true;
65 65
 
Please login to merge, or discard this patch.
Indentation   +23 added lines, -23 removed lines patch added patch discarded remove patch
@@ -16,7 +16,7 @@  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
 /**
@@ -39,29 +39,29 @@  discard block
 block discarded – undo
39 39
  *     Pile complétée par le code à générer
40 40
  */
41 41
 function balise_INFO__dist($p) {
42
-	$info = $p->nom_champ;
43
-	$type_objet = interprete_argument_balise(1, $p);
44
-	$id_objet = interprete_argument_balise(2, $p);
45
-	if ($info === 'INFO_' || !$type_objet || !$id_objet) {
46
-		$msg = _T('zbug_balise_sans_argument', ['balise' => ' INFO_']);
47
-		erreur_squelette($msg, $p);
48
-		$p->interdire_scripts = true;
42
+    $info = $p->nom_champ;
43
+    $type_objet = interprete_argument_balise(1, $p);
44
+    $id_objet = interprete_argument_balise(2, $p);
45
+    if ($info === 'INFO_' || !$type_objet || !$id_objet) {
46
+        $msg = _T('zbug_balise_sans_argument', ['balise' => ' INFO_']);
47
+        erreur_squelette($msg, $p);
48
+        $p->interdire_scripts = true;
49 49
 
50
-		return $p;
51
-	} else {
52
-		// Récupérer tous les params à la suite de objet et id_objet
53
-		$_params = '[';
54
-		$nb_params = is_countable($p->param[0]) ? count($p->param[0]) : 0; // 1ère valeur vide donc 1 en plus
55
-		for ($i = 3; $i < $nb_params; $i++) {
56
-			$_params .= interprete_argument_balise($i, $p) . ',';
57
-		}
58
-		$_params .= ']';
50
+        return $p;
51
+    } else {
52
+        // Récupérer tous les params à la suite de objet et id_objet
53
+        $_params = '[';
54
+        $nb_params = is_countable($p->param[0]) ? count($p->param[0]) : 0; // 1ère valeur vide donc 1 en plus
55
+        for ($i = 3; $i < $nb_params; $i++) {
56
+            $_params .= interprete_argument_balise($i, $p) . ',';
57
+        }
58
+        $_params .= ']';
59 59
 
60
-		$info_sql = strtolower(substr($info, 5));
61
-		$code = "generer_objet_info($id_objet, $type_objet, '$info_sql', " . ($p->etoile ? _q($p->etoile) : "''") . ", $_params)";
62
-		$p->code = champ_sql($info, $p, $code);
63
-		$p->interdire_scripts = true;
60
+        $info_sql = strtolower(substr($info, 5));
61
+        $code = "generer_objet_info($id_objet, $type_objet, '$info_sql', " . ($p->etoile ? _q($p->etoile) : "''") . ", $_params)";
62
+        $p->code = champ_sql($info, $p, $code);
63
+        $p->interdire_scripts = true;
64 64
 
65
-		return $p;
66
-	}
65
+        return $p;
66
+    }
67 67
 }
Please login to merge, or discard this patch.
ecrire/action/menu_rubriques.php 2 patches
Indentation   +156 added lines, -156 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/autoriser');
@@ -35,42 +35,42 @@  discard block
 block discarded – undo
35 35
  **/
36 36
 function action_menu_rubriques_dist() {
37 37
 
38
-	// si pas acces a ecrire, pas acces au menu
39
-	// on renvoi un 401 qui fait echouer la requete ajax silencieusement
40
-	if (!autoriser('ecrire')) {
41
-		$retour =
42
-		'<ul class="deroulant__sous-menu" data-profondeur="1">' .
43
-			'<li class="deroulant__item deroulant__item_plan plan_site" data-profondeur="1">' .
44
-				'<a class="deroulant__lien" href="' . generer_url_ecrire('accueil') . '" data-profondeur="1">' .
45
-					'<span class="libelle">' . _T('public:lien_connecter') . '</span>' .
46
-				'</a>' .
47
-			'</li>' .
48
-		'</ul>';
49
-		include_spip('inc/actions');
50
-		ajax_retour($retour);
51
-		exit;
52
-	}
53
-
54
-	if ($date = intval(_request('date'))) {
55
-		header('Last-Modified: ' . gmdate('D, d M Y H:i:s', $date) . ' GMT');
56
-	}
57
-
58
-	$r = gen_liste_rubriques();
59
-	if (
60
-		!$r
61
-		and isset($_SERVER['HTTP_IF_MODIFIED_SINCE'])
62
-		and !strstr($_SERVER['SERVER_SOFTWARE'], 'IIS/')
63
-	) {
64
-		include_spip('inc/headers');
65
-		header('Content-Type: text/html; charset=' . $GLOBALS['meta']['charset']);
66
-		http_response_code(304);
67
-		exit;
68
-	} else {
69
-		include_spip('inc/actions');
70
-		$ret = menu_rubriques();
71
-		ajax_retour($ret);
72
-		exit;
73
-	}
38
+    // si pas acces a ecrire, pas acces au menu
39
+    // on renvoi un 401 qui fait echouer la requete ajax silencieusement
40
+    if (!autoriser('ecrire')) {
41
+        $retour =
42
+        '<ul class="deroulant__sous-menu" data-profondeur="1">' .
43
+            '<li class="deroulant__item deroulant__item_plan plan_site" data-profondeur="1">' .
44
+                '<a class="deroulant__lien" href="' . generer_url_ecrire('accueil') . '" data-profondeur="1">' .
45
+                    '<span class="libelle">' . _T('public:lien_connecter') . '</span>' .
46
+                '</a>' .
47
+            '</li>' .
48
+        '</ul>';
49
+        include_spip('inc/actions');
50
+        ajax_retour($retour);
51
+        exit;
52
+    }
53
+
54
+    if ($date = intval(_request('date'))) {
55
+        header('Last-Modified: ' . gmdate('D, d M Y H:i:s', $date) . ' GMT');
56
+    }
57
+
58
+    $r = gen_liste_rubriques();
59
+    if (
60
+        !$r
61
+        and isset($_SERVER['HTTP_IF_MODIFIED_SINCE'])
62
+        and !strstr($_SERVER['SERVER_SOFTWARE'], 'IIS/')
63
+    ) {
64
+        include_spip('inc/headers');
65
+        header('Content-Type: text/html; charset=' . $GLOBALS['meta']['charset']);
66
+        http_response_code(304);
67
+        exit;
68
+    } else {
69
+        include_spip('inc/actions');
70
+        $ret = menu_rubriques();
71
+        ajax_retour($ret);
72
+        exit;
73
+    }
74 74
 }
75 75
 
76 76
 /**
@@ -84,44 +84,44 @@  discard block
 block discarded – undo
84 84
  *     Code HTML présentant la liste des rubriques
85 85
  **/
86 86
 function menu_rubriques($complet = true) {
87
-	$ret = '<li class="deroulant__item deroulant__item_tout toutsite" data-profondeur="1">'
88
-		. '<a class="deroulant__lien" href="' . generer_url_ecrire('plan') . '" data-profondeur="1">'
89
-		. '<span class="libelle">' . _T('info_tout_site') . '</span>'
90
-		. '</a>'
91
-		. '</li>';
92
-
93
-	if (!$complet) {
94
-		return "<ul class=\"deroulant__sous-menu\" data-profondeur=\"1\">$ret\n</ul>\n";
95
-	}
96
-
97
-	if (!isset($GLOBALS['db_art_cache'])) {
98
-		gen_liste_rubriques();
99
-	}
100
-	$arr_low = extraire_article(0, $GLOBALS['db_art_cache']);
101
-
102
-	$total_lignes = $i = sizeof($arr_low);
103
-
104
-	if ($i > 0) {
105
-		$nb_col = min(8, ceil($total_lignes / 30));
106
-		if ($nb_col <= 1) {
107
-			$nb_col = ceil($total_lignes / 10);
108
-		}
109
-		foreach ($arr_low as $id_rubrique => $titre_rubrique) {
110
-			if (autoriser('voir', 'rubrique', $id_rubrique)) {
111
-				$ret .= bandeau_rubrique($id_rubrique, $titre_rubrique, $i);
112
-				$i++;
113
-			}
114
-		}
115
-
116
-		$class_cols = ($nb_col > 1 ? "cols-$nb_col" : '');
117
-		$ret = "<ul class=\"deroulant__sous-menu $class_cols\" data-profondeur=\"1\">"
118
-			. $ret
119
-			. "\n</ul>\n";
120
-	} else {
121
-		$ret = "<ul class=\"deroulant__sous-menu\" data-profondeur=\"1\">$ret\n</ul>\n";
122
-	}
123
-
124
-	return $ret;
87
+    $ret = '<li class="deroulant__item deroulant__item_tout toutsite" data-profondeur="1">'
88
+        . '<a class="deroulant__lien" href="' . generer_url_ecrire('plan') . '" data-profondeur="1">'
89
+        . '<span class="libelle">' . _T('info_tout_site') . '</span>'
90
+        . '</a>'
91
+        . '</li>';
92
+
93
+    if (!$complet) {
94
+        return "<ul class=\"deroulant__sous-menu\" data-profondeur=\"1\">$ret\n</ul>\n";
95
+    }
96
+
97
+    if (!isset($GLOBALS['db_art_cache'])) {
98
+        gen_liste_rubriques();
99
+    }
100
+    $arr_low = extraire_article(0, $GLOBALS['db_art_cache']);
101
+
102
+    $total_lignes = $i = sizeof($arr_low);
103
+
104
+    if ($i > 0) {
105
+        $nb_col = min(8, ceil($total_lignes / 30));
106
+        if ($nb_col <= 1) {
107
+            $nb_col = ceil($total_lignes / 10);
108
+        }
109
+        foreach ($arr_low as $id_rubrique => $titre_rubrique) {
110
+            if (autoriser('voir', 'rubrique', $id_rubrique)) {
111
+                $ret .= bandeau_rubrique($id_rubrique, $titre_rubrique, $i);
112
+                $i++;
113
+            }
114
+        }
115
+
116
+        $class_cols = ($nb_col > 1 ? "cols-$nb_col" : '');
117
+        $ret = "<ul class=\"deroulant__sous-menu $class_cols\" data-profondeur=\"1\">"
118
+            . $ret
119
+            . "\n</ul>\n";
120
+    } else {
121
+        $ret = "<ul class=\"deroulant__sous-menu\" data-profondeur=\"1\">$ret\n</ul>\n";
122
+    }
123
+
124
+    return $ret;
125 125
 }
126 126
 
127 127
 /**
@@ -142,48 +142,48 @@  discard block
 block discarded – undo
142 142
  *     Code HTML présentant la liste des rubriques
143 143
  **/
144 144
 function bandeau_rubrique($id_rubrique, $titre_rubrique, $zdecal, $profondeur = 1) {
145
-	static $zmax = 6;
146
-	$profondeur_next = $profondeur + 1;
147
-
148
-	$nav = '<a class="deroulant__lien" href="' . generer_objet_url($id_rubrique, 'rubrique', '', '', false) . "\" data-profondeur=\"$profondeur\">"
149
-		. '<span class="libelle">' . supprimer_tags(preg_replace(',[\x00-\x1f]+,', ' ', $titre_rubrique)) . '</span>'
150
-		. "</a>\n";
151
-
152
-	// Limiter volontairement le nombre de sous-menus
153
-	if (!(--$zmax)) {
154
-		$zmax++;
155
-
156
-		return "\n<li class=\"deroulant__item\" data-profondeur=\"$profondeur\">$nav</li>";
157
-	}
158
-
159
-	$arr_rub = extraire_article($id_rubrique, $GLOBALS['db_art_cache']);
160
-	$i = sizeof($arr_rub);
161
-	if (!$i) {
162
-		$zmax++;
163
-
164
-		return "\n<li class=\"deroulant__item\" data-profondeur=\"$profondeur\">$nav</li>";
165
-	}
166
-
167
-
168
-	$nb_col = 1;
169
-	if ($nb_rub = count($arr_rub)) {
170
-		$nb_col = min(10, max(1, ceil($nb_rub / 10)));
171
-	}
172
-	$class_cols = ($nb_col > 1 ? "cols-$nb_col" : '');
173
-	$ret = "<li class=\"deroulant__item deroulant__item_parent\" data-profondeur=\"$profondeur\">"
174
-	 . $nav
175
-	 . "<ul class=\"deroulant__sous-menu $class_cols\" data-profondeur=\"$profondeur_next\">";
176
-	foreach ($arr_rub as $id_rub => $titre_rub) {
177
-		if (autoriser('voir', 'rubrique', $id_rub)) {
178
-			$titre = supprimer_numero(typo($titre_rub));
179
-			$ret .= bandeau_rubrique($id_rub, $titre, $zdecal + $i, $profondeur_next);
180
-			$i++;
181
-		}
182
-	}
183
-	$ret .= "</ul></li>\n";
184
-	$zmax++;
185
-
186
-	return $ret;
145
+    static $zmax = 6;
146
+    $profondeur_next = $profondeur + 1;
147
+
148
+    $nav = '<a class="deroulant__lien" href="' . generer_objet_url($id_rubrique, 'rubrique', '', '', false) . "\" data-profondeur=\"$profondeur\">"
149
+        . '<span class="libelle">' . supprimer_tags(preg_replace(',[\x00-\x1f]+,', ' ', $titre_rubrique)) . '</span>'
150
+        . "</a>\n";
151
+
152
+    // Limiter volontairement le nombre de sous-menus
153
+    if (!(--$zmax)) {
154
+        $zmax++;
155
+
156
+        return "\n<li class=\"deroulant__item\" data-profondeur=\"$profondeur\">$nav</li>";
157
+    }
158
+
159
+    $arr_rub = extraire_article($id_rubrique, $GLOBALS['db_art_cache']);
160
+    $i = sizeof($arr_rub);
161
+    if (!$i) {
162
+        $zmax++;
163
+
164
+        return "\n<li class=\"deroulant__item\" data-profondeur=\"$profondeur\">$nav</li>";
165
+    }
166
+
167
+
168
+    $nb_col = 1;
169
+    if ($nb_rub = count($arr_rub)) {
170
+        $nb_col = min(10, max(1, ceil($nb_rub / 10)));
171
+    }
172
+    $class_cols = ($nb_col > 1 ? "cols-$nb_col" : '');
173
+    $ret = "<li class=\"deroulant__item deroulant__item_parent\" data-profondeur=\"$profondeur\">"
174
+        . $nav
175
+        . "<ul class=\"deroulant__sous-menu $class_cols\" data-profondeur=\"$profondeur_next\">";
176
+    foreach ($arr_rub as $id_rub => $titre_rub) {
177
+        if (autoriser('voir', 'rubrique', $id_rub)) {
178
+            $titre = supprimer_numero(typo($titre_rub));
179
+            $ret .= bandeau_rubrique($id_rub, $titre, $zdecal + $i, $profondeur_next);
180
+            $i++;
181
+        }
182
+    }
183
+    $ret .= "</ul></li>\n";
184
+    $zmax++;
185
+
186
+    return $ret;
187 187
 }
188 188
 
189 189
 
@@ -201,7 +201,7 @@  discard block
 block discarded – undo
201 201
  *     Liste des rubriques enfants de la rubrique (et leur titre)
202 202
  **/
203 203
 function extraire_article($id_p, $t) {
204
-	return array_key_exists($id_p, $t) ? $t[$id_p] : [];
204
+    return array_key_exists($id_p, $t) ? $t[$id_p] : [];
205 205
 }
206 206
 
207 207
 /**
@@ -217,42 +217,42 @@  discard block
 block discarded – undo
217 217
  **/
218 218
 function gen_liste_rubriques() {
219 219
 
220
-	$cache = null;
221
-	include_spip('inc/config');
222
-	// ici, un petit fichier cache ne fait pas de mal
223
-	$last = lire_config('date_calcul_rubriques', 0);
224
-	if (lire_fichier(_CACHE_RUBRIQUES, $cache)) {
225
-		[$date, $GLOBALS['db_art_cache']] = @unserialize($cache);
226
-		if ($date == $last) {
227
-			return false;
228
-		} // c'etait en cache :-)
229
-	}
230
-	// se restreindre aux rubriques utilisees recemment +secteurs
231
-
232
-	$where = sql_in_select(
233
-		'id_rubrique',
234
-		'id_rubrique',
235
-		'spip_rubriques',
236
-		'',
237
-		'',
238
-		'id_parent=0 DESC, date DESC',
239
-		_CACHE_RUBRIQUES_MAX
240
-	);
241
-
242
-	// puis refaire la requete pour avoir l'ordre alphabetique
243
-
244
-	$res = sql_select('id_rubrique, titre, id_parent', 'spip_rubriques', $where, '', 'id_parent, 0+titre, titre');
245
-
246
-	// il ne faut pas filtrer le autoriser voir ici
247
-	// car on met le resultat en cache, commun a tout le monde
248
-	$GLOBALS['db_art_cache'] = [];
249
-	while ($r = sql_fetch($res)) {
250
-		$t = sinon($r['titre'], _T('ecrire:info_sans_titre'));
251
-		$GLOBALS['db_art_cache'][$r['id_parent']][$r['id_rubrique']] = supprimer_numero(typo($t));
252
-	}
253
-
254
-	$t = [$last ?: time(), $GLOBALS['db_art_cache']];
255
-	ecrire_fichier(_CACHE_RUBRIQUES, serialize($t));
256
-
257
-	return true;
220
+    $cache = null;
221
+    include_spip('inc/config');
222
+    // ici, un petit fichier cache ne fait pas de mal
223
+    $last = lire_config('date_calcul_rubriques', 0);
224
+    if (lire_fichier(_CACHE_RUBRIQUES, $cache)) {
225
+        [$date, $GLOBALS['db_art_cache']] = @unserialize($cache);
226
+        if ($date == $last) {
227
+            return false;
228
+        } // c'etait en cache :-)
229
+    }
230
+    // se restreindre aux rubriques utilisees recemment +secteurs
231
+
232
+    $where = sql_in_select(
233
+        'id_rubrique',
234
+        'id_rubrique',
235
+        'spip_rubriques',
236
+        '',
237
+        '',
238
+        'id_parent=0 DESC, date DESC',
239
+        _CACHE_RUBRIQUES_MAX
240
+    );
241
+
242
+    // puis refaire la requete pour avoir l'ordre alphabetique
243
+
244
+    $res = sql_select('id_rubrique, titre, id_parent', 'spip_rubriques', $where, '', 'id_parent, 0+titre, titre');
245
+
246
+    // il ne faut pas filtrer le autoriser voir ici
247
+    // car on met le resultat en cache, commun a tout le monde
248
+    $GLOBALS['db_art_cache'] = [];
249
+    while ($r = sql_fetch($res)) {
250
+        $t = sinon($r['titre'], _T('ecrire:info_sans_titre'));
251
+        $GLOBALS['db_art_cache'][$r['id_parent']][$r['id_rubrique']] = supprimer_numero(typo($t));
252
+    }
253
+
254
+    $t = [$last ?: time(), $GLOBALS['db_art_cache']];
255
+    ecrire_fichier(_CACHE_RUBRIQUES, serialize($t));
256
+
257
+    return true;
258 258
 }
Please login to merge, or discard this patch.
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -39,12 +39,12 @@  discard block
 block discarded – undo
39 39
 	// on renvoi un 401 qui fait echouer la requete ajax silencieusement
40 40
 	if (!autoriser('ecrire')) {
41 41
 		$retour =
42
-		'<ul class="deroulant__sous-menu" data-profondeur="1">' .
43
-			'<li class="deroulant__item deroulant__item_plan plan_site" data-profondeur="1">' .
44
-				'<a class="deroulant__lien" href="' . generer_url_ecrire('accueil') . '" data-profondeur="1">' .
45
-					'<span class="libelle">' . _T('public:lien_connecter') . '</span>' .
46
-				'</a>' .
47
-			'</li>' .
42
+		'<ul class="deroulant__sous-menu" data-profondeur="1">'.
43
+			'<li class="deroulant__item deroulant__item_plan plan_site" data-profondeur="1">'.
44
+				'<a class="deroulant__lien" href="'.generer_url_ecrire('accueil').'" data-profondeur="1">'.
45
+					'<span class="libelle">'._T('public:lien_connecter').'</span>'.
46
+				'</a>'.
47
+			'</li>'.
48 48
 		'</ul>';
49 49
 		include_spip('inc/actions');
50 50
 		ajax_retour($retour);
@@ -52,7 +52,7 @@  discard block
 block discarded – undo
52 52
 	}
53 53
 
54 54
 	if ($date = intval(_request('date'))) {
55
-		header('Last-Modified: ' . gmdate('D, d M Y H:i:s', $date) . ' GMT');
55
+		header('Last-Modified: '.gmdate('D, d M Y H:i:s', $date).' GMT');
56 56
 	}
57 57
 
58 58
 	$r = gen_liste_rubriques();
@@ -62,7 +62,7 @@  discard block
 block discarded – undo
62 62
 		and !strstr($_SERVER['SERVER_SOFTWARE'], 'IIS/')
63 63
 	) {
64 64
 		include_spip('inc/headers');
65
-		header('Content-Type: text/html; charset=' . $GLOBALS['meta']['charset']);
65
+		header('Content-Type: text/html; charset='.$GLOBALS['meta']['charset']);
66 66
 		http_response_code(304);
67 67
 		exit;
68 68
 	} else {
@@ -85,8 +85,8 @@  discard block
 block discarded – undo
85 85
  **/
86 86
 function menu_rubriques($complet = true) {
87 87
 	$ret = '<li class="deroulant__item deroulant__item_tout toutsite" data-profondeur="1">'
88
-		. '<a class="deroulant__lien" href="' . generer_url_ecrire('plan') . '" data-profondeur="1">'
89
-		. '<span class="libelle">' . _T('info_tout_site') . '</span>'
88
+		. '<a class="deroulant__lien" href="'.generer_url_ecrire('plan').'" data-profondeur="1">'
89
+		. '<span class="libelle">'._T('info_tout_site').'</span>'
90 90
 		. '</a>'
91 91
 		. '</li>';
92 92
 
@@ -145,8 +145,8 @@  discard block
 block discarded – undo
145 145
 	static $zmax = 6;
146 146
 	$profondeur_next = $profondeur + 1;
147 147
 
148
-	$nav = '<a class="deroulant__lien" href="' . generer_objet_url($id_rubrique, 'rubrique', '', '', false) . "\" data-profondeur=\"$profondeur\">"
149
-		. '<span class="libelle">' . supprimer_tags(preg_replace(',[\x00-\x1f]+,', ' ', $titre_rubrique)) . '</span>'
148
+	$nav = '<a class="deroulant__lien" href="'.generer_objet_url($id_rubrique, 'rubrique', '', '', false)."\" data-profondeur=\"$profondeur\">"
149
+		. '<span class="libelle">'.supprimer_tags(preg_replace(',[\x00-\x1f]+,', ' ', $titre_rubrique)).'</span>'
150 150
 		. "</a>\n";
151 151
 
152 152
 	// Limiter volontairement le nombre de sous-menus
Please login to merge, or discard this patch.
ecrire/action/redirect.php 1 patch
Indentation   +72 added lines, -72 removed lines patch added patch discarded remove patch
@@ -18,7 +18,7 @@  discard block
 block discarded – undo
18 18
  **/
19 19
 
20 20
 if (!defined('_ECRIRE_INC_VERSION')) {
21
-	return;
21
+    return;
22 22
 }
23 23
 
24 24
 /**
@@ -36,56 +36,56 @@  discard block
 block discarded – undo
36 36
  *   ```
37 37
  **/
38 38
 function action_redirect_dist() {
39
-	$type = _request('type');
40
-	$id = intval(_request('id'));
41
-	$page = false;
39
+    $type = _request('type');
40
+    $id = intval(_request('id'));
41
+    $page = false;
42 42
 
43
-	// verifier le type ou page transmis
44
-	if (!preg_match('/^\w+$/', $type)) {
45
-		$page = _request('page');
46
-		if (!preg_match('/^\w+$/', $page)) {
47
-			return;
48
-		}
49
-	}
43
+    // verifier le type ou page transmis
44
+    if (!preg_match('/^\w+$/', $type)) {
45
+        $page = _request('page');
46
+        if (!preg_match('/^\w+$/', $page)) {
47
+            return;
48
+        }
49
+    }
50 50
 
51
-	if ($var_mode = _request('var_mode')) {
52
-		// forcer la mise a jour de l'url de cet objet !
53
-		if (!defined('_VAR_URLS')) {
54
-			define('_VAR_URLS', true);
55
-		}
56
-	}
51
+    if ($var_mode = _request('var_mode')) {
52
+        // forcer la mise a jour de l'url de cet objet !
53
+        if (!defined('_VAR_URLS')) {
54
+            define('_VAR_URLS', true);
55
+        }
56
+    }
57 57
 
58
-	if ($page) {
59
-		$url = generer_url_public($page, '', true);
60
-	} else {
61
-		$url = calculer_url_redirect_entite($type, $id, $var_mode);
62
-	}
58
+    if ($page) {
59
+        $url = generer_url_public($page, '', true);
60
+    } else {
61
+        $url = calculer_url_redirect_entite($type, $id, $var_mode);
62
+    }
63 63
 
64
-	$status = '302';
65
-	if ($url) {
66
-		if ($var_mode) {
67
-			$url = parametre_url($url, 'var_mode', $var_mode, '&');
68
-		}
64
+    $status = '302';
65
+    if ($url) {
66
+        if ($var_mode) {
67
+            $url = parametre_url($url, 'var_mode', $var_mode, '&');
68
+        }
69 69
 
70
-		if (
71
-			$var_mode == 'preview'
72
-			and defined('_PREVIEW_TOKEN')
73
-			and _PREVIEW_TOKEN
74
-			and autoriser('previsualiser')
75
-		) {
76
-			include_spip('inc/securiser_action');
77
-			$token = calculer_token_previsu($url);
78
-			$url = parametre_url($url, 'var_previewtoken', $token);
79
-		}
70
+        if (
71
+            $var_mode == 'preview'
72
+            and defined('_PREVIEW_TOKEN')
73
+            and _PREVIEW_TOKEN
74
+            and autoriser('previsualiser')
75
+        ) {
76
+            include_spip('inc/securiser_action');
77
+            $token = calculer_token_previsu($url);
78
+            $url = parametre_url($url, 'var_previewtoken', $token);
79
+        }
80 80
 
81
-		if (_request('status') and _request('status') == '301') {
82
-			$status = '301';
83
-		}
84
-	} else {
85
-		$url = generer_url_public('404', '', true);
86
-	}
81
+        if (_request('status') and _request('status') == '301') {
82
+            $status = '301';
83
+        }
84
+    } else {
85
+        $url = generer_url_public('404', '', true);
86
+    }
87 87
 
88
-	redirige_par_entete(str_replace('&amp;', '&', $url), '', $status);
88
+    redirige_par_entete(str_replace('&amp;', '&', $url), '', $status);
89 89
 }
90 90
 
91 91
 /**
@@ -100,35 +100,35 @@  discard block
 block discarded – undo
100 100
  * @return string|null
101 101
  */
102 102
 function calculer_url_redirect_entite($type, $id, $var_mode) {
103
-	$desc = null;
104
-	$publie = null;
105
-	$url = null;
106
-	// invalider le cache à chaque modif en bdd
107
-	$date = 0;
108
-	if (isset($GLOBALS['meta']['derniere_modif'])) {
109
-		$date = $GLOBALS['meta']['derniere_modif'];
110
-	}
111
-	$key = "url-$date-$type-$id";
103
+    $desc = null;
104
+    $publie = null;
105
+    $url = null;
106
+    // invalider le cache à chaque modif en bdd
107
+    $date = 0;
108
+    if (isset($GLOBALS['meta']['derniere_modif'])) {
109
+        $date = $GLOBALS['meta']['derniere_modif'];
110
+    }
111
+    $key = "url-$date-$type-$id";
112 112
 
113
-	// Obtenir l’url et si elle est publié du cache memoization
114
-	if (function_exists('cache_get') and $desc = cache_get($key)) {
115
-		[$url, $publie] = $desc;
116
-	}
117
-	// Si on ne l’a pas trouvé, ou si var mode, on calcule l’url et son état publie
118
-	if (empty($desc) or $var_mode) {
119
-		$publie = objet_test_si_publie($type, $id);
120
-		$url = generer_objet_url_absolue($id, $type, '', '', true);
121
-		if (function_exists('cache_set')) {
122
-			cache_set($key, [$url, $publie], 3600);
123
-		}
124
-	}
113
+    // Obtenir l’url et si elle est publié du cache memoization
114
+    if (function_exists('cache_get') and $desc = cache_get($key)) {
115
+        [$url, $publie] = $desc;
116
+    }
117
+    // Si on ne l’a pas trouvé, ou si var mode, on calcule l’url et son état publie
118
+    if (empty($desc) or $var_mode) {
119
+        $publie = objet_test_si_publie($type, $id);
120
+        $url = generer_objet_url_absolue($id, $type, '', '', true);
121
+        if (function_exists('cache_set')) {
122
+            cache_set($key, [$url, $publie], 3600);
123
+        }
124
+    }
125 125
 
126
-	// On valide l’url si elle est publiee ; sinon si preview on teste l’autorisation
127
-	if ($publie) {
128
-		return $url;
129
-	} elseif (defined('_VAR_PREVIEW') and _VAR_PREVIEW and autoriser('voir', $type, $id)) {
130
-		return $url;
131
-	}
126
+    // On valide l’url si elle est publiee ; sinon si preview on teste l’autorisation
127
+    if ($publie) {
128
+        return $url;
129
+    } elseif (defined('_VAR_PREVIEW') and _VAR_PREVIEW and autoriser('voir', $type, $id)) {
130
+        return $url;
131
+    }
132 132
 
133
-	return;
133
+    return;
134 134
 }
Please login to merge, or discard this patch.
ecrire/inc/urls.php 2 patches
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -203,7 +203,7 @@  discard block
 block discarded – undo
203 203
 	) {
204 204
 		$r = nettoyer_url_page($url, $contexte);
205 205
 		if ($r) {
206
-			[$contexte, $type, , , $suite] = $r;
206
+			[$contexte, $type,,, $suite] = $r;
207 207
 			$_id = id_table_objet($type);
208 208
 			$id_objet = $contexte[$_id];
209 209
 			$url_propre = generer_objet_url($id_objet, $type);
@@ -274,9 +274,9 @@  discard block
 block discarded – undo
274 274
  */
275 275
 function nettoyer_url_page($url, $contexte = []) {
276 276
 	$url_objets = urls_liste_objets();
277
-	$raccourci_url_page_html = ',^(?:[^?]*/)?(' . $url_objets . ')([0-9]+)(?:\.html)?([?&].*)?$,';
278
-	$raccourci_url_page_id = ',^(?:[^?]*/)?(' . $url_objets . ')\.php3?[?]id_\1=([0-9]+)([?&].*)?$,';
279
-	$raccourci_url_page_spip = ',^(?:[^?]*/)?(?:spip[.]php)?[?](' . $url_objets . ')([0-9]+)=?(&.*)?$,';
277
+	$raccourci_url_page_html = ',^(?:[^?]*/)?('.$url_objets.')([0-9]+)(?:\.html)?([?&].*)?$,';
278
+	$raccourci_url_page_id = ',^(?:[^?]*/)?('.$url_objets.')\.php3?[?]id_\1=([0-9]+)([?&].*)?$,';
279
+	$raccourci_url_page_spip = ',^(?:[^?]*/)?(?:spip[.]php)?[?]('.$url_objets.')([0-9]+)=?(&.*)?$,';
280 280
 
281 281
 	if (
282 282
 		preg_match($raccourci_url_page_html, $url, $regs)
@@ -314,11 +314,11 @@  discard block
 block discarded – undo
314 314
 	$id = intval($id);
315 315
 	if (!isset($furls[$objet])) {
316 316
 		if (
317
-			function_exists($f = 'generer_' . $objet . '_url_ecrire')
317
+			function_exists($f = 'generer_'.$objet.'_url_ecrire')
318 318
 			// ou definie par un plugin
319 319
 			or $f = charger_fonction($f, 'urls', true)
320 320
 			// deprecated
321
-			or function_exists($f = 'generer_url_ecrire_' . $objet) or $f = charger_fonction($f, 'urls', true)
321
+			or function_exists($f = 'generer_url_ecrire_'.$objet) or $f = charger_fonction($f, 'urls', true)
322 322
 		) {
323 323
 			$furls[$objet] = $f;
324 324
 		} else {
@@ -336,12 +336,12 @@  discard block
 block discarded – undo
336 336
 	if ($public or $connect) {
337 337
 		return generer_objet_url_absolue($id, $objet, $args, $ancre, $public, '', $connect);
338 338
 	}
339
-	$a = id_table_objet($objet) . '=' . intval($id);
339
+	$a = id_table_objet($objet).'='.intval($id);
340 340
 	if (!function_exists('objet_info')) {
341 341
 		include_spip('inc/filtres');
342 342
 	}
343 343
 
344
-	return generer_url_ecrire(objet_info($objet, 'url_voir'), $a . ($args ? "&$args" : '')) . ($ancre ? "#$ancre" : '');
344
+	return generer_url_ecrire(objet_info($objet, 'url_voir'), $a.($args ? "&$args" : '')).($ancre ? "#$ancre" : '');
345 345
 }
346 346
 
347 347
 /**
Please login to merge, or discard this patch.
Indentation   +205 added lines, -205 removed lines patch added patch discarded remove patch
@@ -17,7 +17,7 @@  discard block
 block discarded – undo
17 17
  **/
18 18
 
19 19
 if (!defined('_ECRIRE_INC_VERSION')) {
20
-	return;
20
+    return;
21 21
 }
22 22
 include_spip('base/objets');
23 23
 
@@ -57,106 +57,106 @@  discard block
 block discarded – undo
57 57
  *
58 58
  */
59 59
 function urls_decoder_url($url, $fond = '', $contexte = [], $assembler = false) {
60
-	static $current_base = null;
60
+    static $current_base = null;
61 61
 
62
-	// les anciennes fonctions modifient directement les globales
63
-	// on les sauve avant l'appel, et on les retablit apres !
64
-	$save = [
65
-		$GLOBALS['fond'] ?? null,
66
-		$GLOBALS['contexte'] ?? null,
67
-		$_SERVER['REDIRECT_url_propre'] ?? null,
68
-		$_ENV['url_propre'] ?? null,
69
-		$GLOBALS['profondeur_url']
70
-	];
62
+    // les anciennes fonctions modifient directement les globales
63
+    // on les sauve avant l'appel, et on les retablit apres !
64
+    $save = [
65
+        $GLOBALS['fond'] ?? null,
66
+        $GLOBALS['contexte'] ?? null,
67
+        $_SERVER['REDIRECT_url_propre'] ?? null,
68
+        $_ENV['url_propre'] ?? null,
69
+        $GLOBALS['profondeur_url']
70
+    ];
71 71
 
72
-	if (is_null($current_base)) {
73
-		include_spip('inc/filtres_mini');
74
-		// le decodage des urls se fait toujours par rapport au site public
75
-		$current_base = url_absolue(_DIR_RACINE ?: './');
76
-	}
77
-	if (strncmp($url, $current_base, strlen($current_base)) == 0) {
78
-		$url = substr($url, strlen($current_base));
79
-	}
72
+    if (is_null($current_base)) {
73
+        include_spip('inc/filtres_mini');
74
+        // le decodage des urls se fait toujours par rapport au site public
75
+        $current_base = url_absolue(_DIR_RACINE ?: './');
76
+    }
77
+    if (strncmp($url, $current_base, strlen($current_base)) == 0) {
78
+        $url = substr($url, strlen($current_base));
79
+    }
80 80
 
81
-	// si on est en train d'assembler la page principale,
82
-	// recuperer l'url depuis les globales url propres si fournies
83
-	// sinon extraire la bonne portion d'url
84
-	if ($assembler) {
85
-		if (isset($_SERVER['REDIRECT_url_propre'])) {
86
-			$url = $_SERVER['REDIRECT_url_propre'];
87
-		} elseif (isset($_ENV['url_propre'])) {
88
-			$url = $_ENV['url_propre'];
89
-		} else {
90
-			$qs = explode('?', $url);
91
-			// ne prendre que le segment d'url qui correspond, en fonction de la profondeur calculee
92
-			$url = ltrim($qs[0], '/');
93
-			$url = explode('/', $url);
94
-			while (count($url) > $GLOBALS['profondeur_url'] + 1) {
95
-				array_shift($url);
96
-			}
97
-			$qs[0] = implode('/', $url);
98
-			$url = implode('?', $qs);
99
-		}
100
-	}
81
+    // si on est en train d'assembler la page principale,
82
+    // recuperer l'url depuis les globales url propres si fournies
83
+    // sinon extraire la bonne portion d'url
84
+    if ($assembler) {
85
+        if (isset($_SERVER['REDIRECT_url_propre'])) {
86
+            $url = $_SERVER['REDIRECT_url_propre'];
87
+        } elseif (isset($_ENV['url_propre'])) {
88
+            $url = $_ENV['url_propre'];
89
+        } else {
90
+            $qs = explode('?', $url);
91
+            // ne prendre que le segment d'url qui correspond, en fonction de la profondeur calculee
92
+            $url = ltrim($qs[0], '/');
93
+            $url = explode('/', $url);
94
+            while (count($url) > $GLOBALS['profondeur_url'] + 1) {
95
+                array_shift($url);
96
+            }
97
+            $qs[0] = implode('/', $url);
98
+            $url = implode('?', $qs);
99
+        }
100
+    }
101 101
 
102
-	unset($_SERVER['REDIRECT_url_propre']);
103
-	unset($_ENV['url_propre']);
104
-	include_spip('inc/filtres_mini');
105
-	if (strpos($url, '://') === false) {
106
-		$GLOBALS['profondeur_url'] = substr_count(ltrim(resolve_path("/$url"), '/'), '/');
107
-	} else {
108
-		$GLOBALS['profondeur_url'] = max(0, substr_count($url, '/') - substr_count($current_base, '/'));
109
-	}
102
+    unset($_SERVER['REDIRECT_url_propre']);
103
+    unset($_ENV['url_propre']);
104
+    include_spip('inc/filtres_mini');
105
+    if (strpos($url, '://') === false) {
106
+        $GLOBALS['profondeur_url'] = substr_count(ltrim(resolve_path("/$url"), '/'), '/');
107
+    } else {
108
+        $GLOBALS['profondeur_url'] = max(0, substr_count($url, '/') - substr_count($current_base, '/'));
109
+    }
110 110
 
111
-	$url_redirect = '';
112
-	$decoder = charger_fonction_url('decoder');
113
-	if ($decoder) {
114
-		$a = $decoder($url, $fond, $contexte);
115
-		if (is_array($a)) {
116
-			[$ncontexte, $type, $url_redirect, $nfond] = array_pad($a, 4, null);
117
-			$url_redirect ??= '';
118
-			if ($url_redirect === $url) {
119
-				$url_redirect = '';
120
-			} // securite pour eviter une redirection infinie
121
-			if ($assembler and strlen($url_redirect)) {
122
-				spip_log("Redirige $url vers $url_redirect");
123
-				include_spip('inc/headers');
124
-				redirige_par_entete($url_redirect, '', 301);
125
-			}
126
-			if (isset($nfond)) {
127
-				$fond = $nfond;
128
-			} else {
129
-				if (
130
-					$fond == ''
131
-					or $fond == 'type_urls' /* compat avec htaccess 2.0.0 */
132
-				) {
133
-					$fond = $type;
134
-				}
135
-			}
136
-			if (isset($ncontexte)) {
137
-				$contexte = $ncontexte;
138
-			}
139
-			if (defined('_DEFINIR_CONTEXTE_TYPE') and _DEFINIR_CONTEXTE_TYPE) {
140
-				$contexte['type'] = $type;
141
-			}
142
-			if (!defined('_DEFINIR_CONTEXTE_TYPE_PAGE') or _DEFINIR_CONTEXTE_TYPE_PAGE) {
143
-				$contexte['type-page'] = $type;
144
-			}
145
-		}
146
-	}
111
+    $url_redirect = '';
112
+    $decoder = charger_fonction_url('decoder');
113
+    if ($decoder) {
114
+        $a = $decoder($url, $fond, $contexte);
115
+        if (is_array($a)) {
116
+            [$ncontexte, $type, $url_redirect, $nfond] = array_pad($a, 4, null);
117
+            $url_redirect ??= '';
118
+            if ($url_redirect === $url) {
119
+                $url_redirect = '';
120
+            } // securite pour eviter une redirection infinie
121
+            if ($assembler and strlen($url_redirect)) {
122
+                spip_log("Redirige $url vers $url_redirect");
123
+                include_spip('inc/headers');
124
+                redirige_par_entete($url_redirect, '', 301);
125
+            }
126
+            if (isset($nfond)) {
127
+                $fond = $nfond;
128
+            } else {
129
+                if (
130
+                    $fond == ''
131
+                    or $fond == 'type_urls' /* compat avec htaccess 2.0.0 */
132
+                ) {
133
+                    $fond = $type;
134
+                }
135
+            }
136
+            if (isset($ncontexte)) {
137
+                $contexte = $ncontexte;
138
+            }
139
+            if (defined('_DEFINIR_CONTEXTE_TYPE') and _DEFINIR_CONTEXTE_TYPE) {
140
+                $contexte['type'] = $type;
141
+            }
142
+            if (!defined('_DEFINIR_CONTEXTE_TYPE_PAGE') or _DEFINIR_CONTEXTE_TYPE_PAGE) {
143
+                $contexte['type-page'] = $type;
144
+            }
145
+        }
146
+    }
147 147
 
148
-	// retablir les globales
149
-	[$GLOBALS['fond'], $GLOBALS['contexte'], $_SERVER['REDIRECT_url_propre'], $_ENV['url_propre'], $GLOBALS['profondeur_url']] = $save;
148
+    // retablir les globales
149
+    [$GLOBALS['fond'], $GLOBALS['contexte'], $_SERVER['REDIRECT_url_propre'], $_ENV['url_propre'], $GLOBALS['profondeur_url']] = $save;
150 150
 
151
-	// vider les globales url propres qui ne doivent plus etre utilisees en cas
152
-	// d'inversion url => objet
153
-	// maintenir pour compat ?
154
-	#if ($assembler) {
155
-	#	unset($_SERVER['REDIRECT_url_propre']);
156
-	#	unset($_ENV['url_propre']);
157
-	#}
151
+    // vider les globales url propres qui ne doivent plus etre utilisees en cas
152
+    // d'inversion url => objet
153
+    // maintenir pour compat ?
154
+    #if ($assembler) {
155
+    #	unset($_SERVER['REDIRECT_url_propre']);
156
+    #	unset($_ENV['url_propre']);
157
+    #}
158 158
 
159
-	return [$fond, $contexte, $url_redirect];
159
+    return [$fond, $contexte, $url_redirect];
160 160
 }
161 161
 
162 162
 /**
@@ -169,20 +169,20 @@  discard block
 block discarded – undo
169 169
  * @return array|false|string
170 170
  */
171 171
 function urls_transition_retrouver_anciennes_url_propres(string $url_propre, string $entite, array $contexte = []): array {
172
-	if ($url_propre) {
173
-		if ($GLOBALS['profondeur_url'] <= 0) {
174
-			$urls_anciennes = charger_fonction_url('decoder', 'propres');
175
-		} else {
176
-			$urls_anciennes = charger_fonction_url('decoder', 'arbo');
177
-		}
172
+    if ($url_propre) {
173
+        if ($GLOBALS['profondeur_url'] <= 0) {
174
+            $urls_anciennes = charger_fonction_url('decoder', 'propres');
175
+        } else {
176
+            $urls_anciennes = charger_fonction_url('decoder', 'arbo');
177
+        }
178 178
 
179
-		if ($urls_anciennes) {
180
-			$urls_anciennes = $urls_anciennes($url_propre, $entite, $contexte);
181
-		}
182
-		return $urls_anciennes ?: [];
183
-	}
179
+        if ($urls_anciennes) {
180
+            $urls_anciennes = $urls_anciennes($url_propre, $entite, $contexte);
181
+        }
182
+        return $urls_anciennes ?: [];
183
+    }
184 184
 
185
-	return [];
185
+    return [];
186 186
 }
187 187
 
188 188
 /**
@@ -195,41 +195,41 @@  discard block
 block discarded – undo
195 195
  * @return array|false|string
196 196
  */
197 197
 function urls_transition_retrouver_anciennes_url_html(string $url, string $entite, array $contexte = []): array {
198
-	// Migration depuis anciennes URLs ?
199
-	// traiter les injections domain.tld/spip.php/n/importe/quoi/rubrique23
200
-	if (
201
-		$url
202
-		and $GLOBALS['profondeur_url'] <= 0
203
-	) {
204
-		$r = nettoyer_url_page($url, $contexte);
205
-		if ($r) {
206
-			[$contexte, $type, , , $suite] = $r;
207
-			$_id = id_table_objet($type);
208
-			$id_objet = $contexte[$_id];
209
-			$url_propre = generer_objet_url($id_objet, $type);
210
-			if (
211
-				strlen($url_propre)
212
-				and !strstr($url, (string) $url_propre)
213
-				and (
214
-					objet_test_si_publie($type, $id_objet)
215
-					or (defined('_VAR_PREVIEW') and _VAR_PREVIEW and autoriser('voir', $type, $id_objet))
216
-				)
217
-			) {
218
-				[, $hash] = array_pad(explode('#', $url_propre), 2, '');
219
-				$args = [];
220
-				foreach (array_filter(explode('&', $suite ?? '')) as $fragment) {
221
-					if ($fragment != "$_id=$id_objet") {
222
-						$args[] = $fragment;
223
-					}
224
-				}
225
-				$url_redirect = generer_objet_url($id_objet, $type, join('&', array_filter($args)), $hash);
198
+    // Migration depuis anciennes URLs ?
199
+    // traiter les injections domain.tld/spip.php/n/importe/quoi/rubrique23
200
+    if (
201
+        $url
202
+        and $GLOBALS['profondeur_url'] <= 0
203
+    ) {
204
+        $r = nettoyer_url_page($url, $contexte);
205
+        if ($r) {
206
+            [$contexte, $type, , , $suite] = $r;
207
+            $_id = id_table_objet($type);
208
+            $id_objet = $contexte[$_id];
209
+            $url_propre = generer_objet_url($id_objet, $type);
210
+            if (
211
+                strlen($url_propre)
212
+                and !strstr($url, (string) $url_propre)
213
+                and (
214
+                    objet_test_si_publie($type, $id_objet)
215
+                    or (defined('_VAR_PREVIEW') and _VAR_PREVIEW and autoriser('voir', $type, $id_objet))
216
+                )
217
+            ) {
218
+                [, $hash] = array_pad(explode('#', $url_propre), 2, '');
219
+                $args = [];
220
+                foreach (array_filter(explode('&', $suite ?? '')) as $fragment) {
221
+                    if ($fragment != "$_id=$id_objet") {
222
+                        $args[] = $fragment;
223
+                    }
224
+                }
225
+                $url_redirect = generer_objet_url($id_objet, $type, join('&', array_filter($args)), $hash);
226 226
 
227
-				return [$contexte, $type, $url_redirect, $type];
228
-			}
229
-		}
230
-	}
231
-	/* Fin compatibilite anciennes urls */
232
-	return [];
227
+                return [$contexte, $type, $url_redirect, $type];
228
+            }
229
+        }
230
+    }
231
+    /* Fin compatibilite anciennes urls */
232
+    return [];
233 233
 }
234 234
 
235 235
 /**
@@ -242,24 +242,24 @@  discard block
 block discarded – undo
242 242
  * @return string|array
243 243
  */
244 244
 function urls_liste_objets($preg = true) {
245
-	static $url_objets = null;
246
-	if (is_null($url_objets)) {
247
-		$url_objets = [];
248
-		// recuperer les tables_objets_sql declarees
249
-		$tables_objets = lister_tables_objets_sql();
250
-		foreach ($tables_objets as $t => $infos) {
251
-			if ($infos['page']) {
252
-				$url_objets[] = $infos['type'];
253
-				$url_objets = array_merge($url_objets, $infos['type_surnoms']);
254
-			}
255
-		}
256
-		$url_objets = pipeline('declarer_url_objets', $url_objets);
257
-	}
258
-	if (!$preg) {
259
-		return $url_objets;
260
-	}
245
+    static $url_objets = null;
246
+    if (is_null($url_objets)) {
247
+        $url_objets = [];
248
+        // recuperer les tables_objets_sql declarees
249
+        $tables_objets = lister_tables_objets_sql();
250
+        foreach ($tables_objets as $t => $infos) {
251
+            if ($infos['page']) {
252
+                $url_objets[] = $infos['type'];
253
+                $url_objets = array_merge($url_objets, $infos['type_surnoms']);
254
+            }
255
+        }
256
+        $url_objets = pipeline('declarer_url_objets', $url_objets);
257
+    }
258
+    if (!$preg) {
259
+        return $url_objets;
260
+    }
261 261
 
262
-	return implode('|', array_map('preg_quote', $url_objets));
262
+    return implode('|', array_map('preg_quote', $url_objets));
263 263
 }
264 264
 
265 265
 /**
@@ -273,26 +273,26 @@  discard block
 block discarded – undo
273 273
  * @return array
274 274
  */
275 275
 function nettoyer_url_page($url, $contexte = []) {
276
-	$url_objets = urls_liste_objets();
277
-	$raccourci_url_page_html = ',^(?:[^?]*/)?(' . $url_objets . ')([0-9]+)(?:\.html)?([?&].*)?$,';
278
-	$raccourci_url_page_id = ',^(?:[^?]*/)?(' . $url_objets . ')\.php3?[?]id_\1=([0-9]+)([?&].*)?$,';
279
-	$raccourci_url_page_spip = ',^(?:[^?]*/)?(?:spip[.]php)?[?](' . $url_objets . ')([0-9]+)=?(&.*)?$,';
276
+    $url_objets = urls_liste_objets();
277
+    $raccourci_url_page_html = ',^(?:[^?]*/)?(' . $url_objets . ')([0-9]+)(?:\.html)?([?&].*)?$,';
278
+    $raccourci_url_page_id = ',^(?:[^?]*/)?(' . $url_objets . ')\.php3?[?]id_\1=([0-9]+)([?&].*)?$,';
279
+    $raccourci_url_page_spip = ',^(?:[^?]*/)?(?:spip[.]php)?[?](' . $url_objets . ')([0-9]+)=?(&.*)?$,';
280 280
 
281
-	if (
282
-		preg_match($raccourci_url_page_html, $url, $regs)
283
-		or preg_match($raccourci_url_page_id, $url, $regs)
284
-		or preg_match($raccourci_url_page_spip, $url, $regs)
285
-	) {
286
-		$regs = array_pad($regs, 4, null);
287
-		$type = objet_type($regs[1]);
288
-		$_id = id_table_objet($type);
289
-		$contexte[$_id] = $regs[2];
290
-		$suite = $regs[3];
281
+    if (
282
+        preg_match($raccourci_url_page_html, $url, $regs)
283
+        or preg_match($raccourci_url_page_id, $url, $regs)
284
+        or preg_match($raccourci_url_page_spip, $url, $regs)
285
+    ) {
286
+        $regs = array_pad($regs, 4, null);
287
+        $type = objet_type($regs[1]);
288
+        $_id = id_table_objet($type);
289
+        $contexte[$_id] = $regs[2];
290
+        $suite = $regs[3];
291 291
 
292
-		return [$contexte, $type, null, $type, $suite];
293
-	}
292
+        return [$contexte, $type, null, $type, $suite];
293
+    }
294 294
 
295
-	return [];
295
+    return [];
296 296
 }
297 297
 
298 298
 /**
@@ -310,38 +310,38 @@  discard block
 block discarded – undo
310 310
  * @return string
311 311
  */
312 312
 function generer_objet_url_ecrire($id, string $objet, string $args = '', string $ancre = '', ?bool $public = null, string $connect = ''): string {
313
-	static $furls = [];
314
-	$id = intval($id);
315
-	if (!isset($furls[$objet])) {
316
-		if (
317
-			function_exists($f = 'generer_' . $objet . '_url_ecrire')
318
-			// ou definie par un plugin
319
-			or $f = charger_fonction($f, 'urls', true)
320
-			// deprecated
321
-			or function_exists($f = 'generer_url_ecrire_' . $objet) or $f = charger_fonction($f, 'urls', true)
322
-		) {
323
-			$furls[$objet] = $f;
324
-		} else {
325
-			$furls[$objet] = '';
326
-		}
327
-	}
328
-	if ($furls[$objet]) {
329
-		return $furls[$objet]($id, $args, $ancre, $public, $connect);
330
-	}
331
-	// si pas de flag public fourni
332
-	// le calculer en fonction de la declaration de statut
333
-	if (is_null($public) and !$connect) {
334
-		$public = objet_test_si_publie($objet, $id, $connect);
335
-	}
336
-	if ($public or $connect) {
337
-		return generer_objet_url_absolue($id, $objet, $args, $ancre, $public, '', $connect);
338
-	}
339
-	$a = id_table_objet($objet) . '=' . intval($id);
340
-	if (!function_exists('objet_info')) {
341
-		include_spip('inc/filtres');
342
-	}
313
+    static $furls = [];
314
+    $id = intval($id);
315
+    if (!isset($furls[$objet])) {
316
+        if (
317
+            function_exists($f = 'generer_' . $objet . '_url_ecrire')
318
+            // ou definie par un plugin
319
+            or $f = charger_fonction($f, 'urls', true)
320
+            // deprecated
321
+            or function_exists($f = 'generer_url_ecrire_' . $objet) or $f = charger_fonction($f, 'urls', true)
322
+        ) {
323
+            $furls[$objet] = $f;
324
+        } else {
325
+            $furls[$objet] = '';
326
+        }
327
+    }
328
+    if ($furls[$objet]) {
329
+        return $furls[$objet]($id, $args, $ancre, $public, $connect);
330
+    }
331
+    // si pas de flag public fourni
332
+    // le calculer en fonction de la declaration de statut
333
+    if (is_null($public) and !$connect) {
334
+        $public = objet_test_si_publie($objet, $id, $connect);
335
+    }
336
+    if ($public or $connect) {
337
+        return generer_objet_url_absolue($id, $objet, $args, $ancre, $public, '', $connect);
338
+    }
339
+    $a = id_table_objet($objet) . '=' . intval($id);
340
+    if (!function_exists('objet_info')) {
341
+        include_spip('inc/filtres');
342
+    }
343 343
 
344
-	return generer_url_ecrire(objet_info($objet, 'url_voir'), $a . ($args ? "&$args" : '')) . ($ancre ? "#$ancre" : '');
344
+    return generer_url_ecrire(objet_info($objet, 'url_voir'), $a . ($args ? "&$args" : '')) . ($ancre ? "#$ancre" : '');
345 345
 }
346 346
 
347 347
 /**
@@ -349,5 +349,5 @@  discard block
 block discarded – undo
349 349
  * @see generer_objet_url_ecrire
350 350
  */
351 351
 function generer_url_ecrire_objet($objet, $id, $args = '', $ancre = '', $public = null, string $connect = '') {
352
-	return generer_objet_url_ecrire($id, $objet, $args, $ancre, $public, $connect);
352
+    return generer_objet_url_ecrire($id, $objet, $args, $ancre, $public, $connect);
353 353
 }
Please login to merge, or discard this patch.
prive/transmettre/rss/a_suivre_fonctions.php 2 patches
Indentation   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -1,22 +1,22 @@
 block discarded – undo
1 1
 <?php
2 2
 
3 3
 if (!defined('_ECRIRE_INC_VERSION')) {
4
-	return;
4
+    return;
5 5
 }
6 6
 
7 7
 function trier_rss($texte) {
8
-	if (preg_match_all(',<item.*</item>\s*?,Uims', $texte, $matches, PREG_SET_ORDER)) {
9
-		$placeholder = '<!--REINSERT-->';
10
-		$items = [];
11
-		foreach ($matches as $match) {
12
-			if (preg_match(',<dc:date>(.*)</dc:date>,Uims', $match[0], $r)) {
13
-				$items[strtotime($r[1])] = trim($match[0]);
14
-				$texte = str_replace($match[0], unique($placeholder), $texte);
15
-			}
16
-		}
17
-		krsort($items);
18
-		$texte = str_replace($placeholder, implode("\n\t", $items) . "\n", $texte);
19
-	}
8
+    if (preg_match_all(',<item.*</item>\s*?,Uims', $texte, $matches, PREG_SET_ORDER)) {
9
+        $placeholder = '<!--REINSERT-->';
10
+        $items = [];
11
+        foreach ($matches as $match) {
12
+            if (preg_match(',<dc:date>(.*)</dc:date>,Uims', $match[0], $r)) {
13
+                $items[strtotime($r[1])] = trim($match[0]);
14
+                $texte = str_replace($match[0], unique($placeholder), $texte);
15
+            }
16
+        }
17
+        krsort($items);
18
+        $texte = str_replace($placeholder, implode("\n\t", $items) . "\n", $texte);
19
+    }
20 20
 
21
-	return $texte;
21
+    return $texte;
22 22
 }
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -15,7 +15,7 @@
 block discarded – undo
15 15
 			}
16 16
 		}
17 17
 		krsort($items);
18
-		$texte = str_replace($placeholder, implode("\n\t", $items) . "\n", $texte);
18
+		$texte = str_replace($placeholder, implode("\n\t", $items)."\n", $texte);
19 19
 	}
20 20
 
21 21
 	return $texte;
Please login to merge, or discard this patch.