Completed
Push — master ( abdc2a...4fc560 )
by cam
02:15
created
ecrire/install/etape_1.php 1 patch
Indentation   +31 added lines, -31 removed lines patch added patch discarded remove patch
@@ -17,7 +17,7 @@  discard block
 block discarded – undo
17 17
  */
18 18
 
19 19
 if (!defined('_ECRIRE_INC_VERSION')) {
20
-	return;
20
+    return;
21 21
 }
22 22
 
23 23
 /**
@@ -34,46 +34,46 @@  discard block
 block discarded – undo
34 34
  */
35 35
 function install_etape_1_dist() {
36 36
 
37
-	$minipage = new Spip\Afficher\Minipage\Installation();
38
-	echo $minipage->installDebutPage();
37
+    $minipage = new Spip\Afficher\Minipage\Installation();
38
+    echo $minipage->installDebutPage();
39 39
 
40
-	// stopper en cas de grosse incompatibilite de l'hebergement
41
-	tester_compatibilite_hebergement();
40
+    // stopper en cas de grosse incompatibilite de l'hebergement
41
+    tester_compatibilite_hebergement();
42 42
 
43
-	// Recuperer les anciennes donnees pour plus de facilite (si presentes)
44
-	$s = !@is_readable(_FILE_CONNECT_TMP) ? ''
45
-		: analyse_fichier_connection(_FILE_CONNECT_TMP);
43
+    // Recuperer les anciennes donnees pour plus de facilite (si presentes)
44
+    $s = !@is_readable(_FILE_CONNECT_TMP) ? ''
45
+        : analyse_fichier_connection(_FILE_CONNECT_TMP);
46 46
 
47
-	[$adresse_db, $login_db] = $s ?: ['localhost', ''];
47
+    [$adresse_db, $login_db] = $s ?: ['localhost', ''];
48 48
 
49
-	$chmod = (isset($_GET['chmod']) and preg_match(',^[0-9]+$,', $_GET['chmod'])) ?
50
-		sprintf('%04o', $_GET['chmod']) : '0777';
49
+    $chmod = (isset($_GET['chmod']) and preg_match(',^[0-9]+$,', $_GET['chmod'])) ?
50
+        sprintf('%04o', $_GET['chmod']) : '0777';
51 51
 
52
-	if (@is_readable(_FILE_CHMOD_TMP)) {
53
-		$s = @join('', @file(_FILE_CHMOD_TMP));
54
-		if (preg_match("#define\('_SPIP_CHMOD', (.*)\)#", $s, $regs)) {
55
-			$chmod = $regs[1];
56
-		}
57
-	}
52
+    if (@is_readable(_FILE_CHMOD_TMP)) {
53
+        $s = @join('', @file(_FILE_CHMOD_TMP));
54
+        if (preg_match("#define\('_SPIP_CHMOD', (.*)\)#", $s, $regs)) {
55
+            $chmod = $regs[1];
56
+        }
57
+    }
58 58
 
59 59
 
60
-	$db = [$adresse_db, _T('entree_base_donnee_2')];
61
-	$login = [$login_db, _T('entree_login_connexion_2')];
62
-	$pass = ['', _T('entree_mot_passe_2')];
60
+    $db = [$adresse_db, _T('entree_base_donnee_2')];
61
+    $login = [$login_db, _T('entree_login_connexion_2')];
62
+    $pass = ['', _T('entree_mot_passe_2')];
63 63
 
64
-	$predef = [
65
-		defined('_INSTALL_SERVER_DB') ? _INSTALL_SERVER_DB : '',
66
-		defined('_INSTALL_HOST_DB'),
67
-		defined('_INSTALL_USER_DB'),
68
-		defined('_INSTALL_PASS_DB')
69
-	];
64
+    $predef = [
65
+        defined('_INSTALL_SERVER_DB') ? _INSTALL_SERVER_DB : '',
66
+        defined('_INSTALL_HOST_DB'),
67
+        defined('_INSTALL_USER_DB'),
68
+        defined('_INSTALL_PASS_DB')
69
+    ];
70 70
 
71 71
 
72
-	echo info_progression_etape(1, 'etape_', 'install/');
72
+    echo info_progression_etape(1, 'etape_', 'install/');
73 73
 
74
-	// ces deux chaines de langues doivent etre reecrites
74
+    // ces deux chaines de langues doivent etre reecrites
75 75
 #	echo info_etape(_T('info_connexion_mysql'), _T('texte_connexion_mysql').aide ("install1", true));
76
-	echo info_etape(_T('info_connexion_base_donnee'));
77
-	echo install_connexion_form($db, $login, $pass, $predef, "\n<input type='hidden' name='chmod' value='$chmod' />", 2);
78
-	echo $minipage->installFinPage();
76
+    echo info_etape(_T('info_connexion_base_donnee'));
77
+    echo install_connexion_form($db, $login, $pass, $predef, "\n<input type='hidden' name='chmod' value='$chmod' />", 2);
78
+    echo $minipage->installFinPage();
79 79
 }
Please login to merge, or discard this patch.
ecrire/public/fonctions.php 3 patches
Indentation   +390 added lines, -390 removed lines patch added patch discarded remove patch
@@ -22,7 +22,7 @@  discard block
 block discarded – undo
22 22
  **/
23 23
 
24 24
 if (!defined('_ECRIRE_INC_VERSION')) {
25
-	return;
25
+    return;
26 26
 }
27 27
 
28 28
 // public/interfaces definit des traitements sur les champs qui utilisent des fonctions de inc/texte
@@ -54,75 +54,75 @@  discard block
 block discarded – undo
54 54
  *     Introduction calculée
55 55
  **/
56 56
 function filtre_introduction_dist($descriptif, $texte, $longueur, $connect, $suite = null) {
57
-	// Si un descriptif est envoye, on l'utilise directement
58
-	if (strlen($descriptif)) {
59
-		return appliquer_traitement_champ($descriptif, 'introduction', '', [], $connect);
60
-	}
61
-
62
-	// De preference ce qui est marque <intro>...</intro>
63
-	$intro = '';
64
-	$texte = preg_replace(',(</?)intro>,i', "\\1intro>", $texte); // minuscules
65
-	while ($fin = strpos($texte, '</intro>')) {
66
-		$zone = substr($texte, 0, $fin);
67
-		$texte = substr($texte, $fin + strlen('</intro>'));
68
-		if ($deb = strpos($zone, '<intro>') or substr($zone, 0, 7) == '<intro>') {
69
-			$zone = substr($zone, $deb + 7);
70
-		}
71
-		$intro .= $zone;
72
-	}
73
-
74
-	// [12025] On ne *PEUT* pas couper simplement ici car c'est du texte brut,
75
-	// qui inclus raccourcis et modeles
76
-	// un simple <articlexx> peut etre ensuite transforme en 1000 lignes ...
77
-	// par ailleurs le nettoyage des raccourcis ne tient pas compte
78
-	// des surcharges et enrichissement de propre
79
-	// couper doit se faire apres propre
80
-	//$texte = nettoyer_raccourcis_typo($intro ? $intro : $texte, $connect);
81
-
82
-	// Cependant pour des questions de perfs on coupe quand meme, en prenant
83
-	// large et en se mefiant des tableaux #1323
84
-
85
-	if (strlen($intro)) {
86
-		$texte = $intro;
87
-	} else {
88
-		if (
89
-			strpos("\n" . $texte, "\n|") === false
90
-			and strlen($texte) > 2.5 * $longueur
91
-		) {
92
-			if (strpos($texte, '<multi') !== false) {
93
-				$texte = extraire_multi($texte);
94
-			}
95
-			$texte = couper($texte, 2 * $longueur);
96
-		}
97
-	}
98
-
99
-	// ne pas tenir compte des notes
100
-	if ($notes = charger_fonction('notes', 'inc', true)) {
101
-		$notes('', 'empiler');
102
-	}
103
-	// Supprimer les modèles avant le propre afin d'éviter qu'ils n'ajoutent du texte indésirable
104
-	// dans l'introduction.
105
-	$texte = supprime_img($texte, '');
106
-	$texte = appliquer_traitement_champ($texte, 'introduction', '', [], $connect);
107
-
108
-	if ($notes) {
109
-		$notes('', 'depiler');
110
-	}
111
-
112
-	if (is_null($suite) and defined('_INTRODUCTION_SUITE')) {
113
-		$suite = _INTRODUCTION_SUITE;
114
-	}
115
-	$texte = couper($texte, $longueur, $suite);
116
-	// comme on a coupe il faut repasser la typo (on a perdu les insecables)
117
-	$texte = typo($texte, true, $connect, []);
118
-
119
-	// et reparagrapher si necessaire (coherence avec le cas descriptif)
120
-	// une introduction a tojours un <p>
121
-	if ($GLOBALS['toujours_paragrapher']) { // Fermer les paragraphes
122
-	$texte = paragrapher($texte, $GLOBALS['toujours_paragrapher']);
123
-	}
124
-
125
-	return $texte;
57
+    // Si un descriptif est envoye, on l'utilise directement
58
+    if (strlen($descriptif)) {
59
+        return appliquer_traitement_champ($descriptif, 'introduction', '', [], $connect);
60
+    }
61
+
62
+    // De preference ce qui est marque <intro>...</intro>
63
+    $intro = '';
64
+    $texte = preg_replace(',(</?)intro>,i', "\\1intro>", $texte); // minuscules
65
+    while ($fin = strpos($texte, '</intro>')) {
66
+        $zone = substr($texte, 0, $fin);
67
+        $texte = substr($texte, $fin + strlen('</intro>'));
68
+        if ($deb = strpos($zone, '<intro>') or substr($zone, 0, 7) == '<intro>') {
69
+            $zone = substr($zone, $deb + 7);
70
+        }
71
+        $intro .= $zone;
72
+    }
73
+
74
+    // [12025] On ne *PEUT* pas couper simplement ici car c'est du texte brut,
75
+    // qui inclus raccourcis et modeles
76
+    // un simple <articlexx> peut etre ensuite transforme en 1000 lignes ...
77
+    // par ailleurs le nettoyage des raccourcis ne tient pas compte
78
+    // des surcharges et enrichissement de propre
79
+    // couper doit se faire apres propre
80
+    //$texte = nettoyer_raccourcis_typo($intro ? $intro : $texte, $connect);
81
+
82
+    // Cependant pour des questions de perfs on coupe quand meme, en prenant
83
+    // large et en se mefiant des tableaux #1323
84
+
85
+    if (strlen($intro)) {
86
+        $texte = $intro;
87
+    } else {
88
+        if (
89
+            strpos("\n" . $texte, "\n|") === false
90
+            and strlen($texte) > 2.5 * $longueur
91
+        ) {
92
+            if (strpos($texte, '<multi') !== false) {
93
+                $texte = extraire_multi($texte);
94
+            }
95
+            $texte = couper($texte, 2 * $longueur);
96
+        }
97
+    }
98
+
99
+    // ne pas tenir compte des notes
100
+    if ($notes = charger_fonction('notes', 'inc', true)) {
101
+        $notes('', 'empiler');
102
+    }
103
+    // Supprimer les modèles avant le propre afin d'éviter qu'ils n'ajoutent du texte indésirable
104
+    // dans l'introduction.
105
+    $texte = supprime_img($texte, '');
106
+    $texte = appliquer_traitement_champ($texte, 'introduction', '', [], $connect);
107
+
108
+    if ($notes) {
109
+        $notes('', 'depiler');
110
+    }
111
+
112
+    if (is_null($suite) and defined('_INTRODUCTION_SUITE')) {
113
+        $suite = _INTRODUCTION_SUITE;
114
+    }
115
+    $texte = couper($texte, $longueur, $suite);
116
+    // comme on a coupe il faut repasser la typo (on a perdu les insecables)
117
+    $texte = typo($texte, true, $connect, []);
118
+
119
+    // et reparagrapher si necessaire (coherence avec le cas descriptif)
120
+    // une introduction a tojours un <p>
121
+    if ($GLOBALS['toujours_paragrapher']) { // Fermer les paragraphes
122
+    $texte = paragrapher($texte, $GLOBALS['toujours_paragrapher']);
123
+    }
124
+
125
+    return $texte;
126 126
 }
127 127
 
128 128
 
@@ -157,73 +157,73 @@  discard block
 block discarded – undo
157 157
  *     Code HTML de la pagination
158 158
  **/
159 159
 function filtre_pagination_dist(
160
-	$total,
161
-	$nom,
162
-	$position,
163
-	$pas,
164
-	$liste = true,
165
-	$modele = '',
166
-	string $connect = '',
167
-	$env = []
160
+    $total,
161
+    $nom,
162
+    $position,
163
+    $pas,
164
+    $liste = true,
165
+    $modele = '',
166
+    string $connect = '',
167
+    $env = []
168 168
 ) {
169
-	static $ancres = [];
170
-	if ($pas < 1) {
171
-		return '';
172
-	}
173
-	$ancre = 'pagination' . $nom; // #pagination_articles
174
-	$debut = 'debut' . $nom; // 'debut_articles'
175
-
176
-	// n'afficher l'ancre qu'une fois
177
-	if (!isset($ancres[$ancre])) {
178
-		$bloc_ancre = $ancres[$ancre] = "<a id='" . $ancre . "' class='pagination_ancre'></a>";
179
-	} else {
180
-		$bloc_ancre = '';
181
-	}
182
-	// liste = false : on ne veut que l'ancre
183
-	if (!$liste) {
184
-		return $ancres[$ancre];
185
-	}
186
-
187
-	$self = (empty($env['self']) ? self() : $env['self']);
188
-	$pagination = [
189
-		'debut' => $debut,
190
-		'url' => parametre_url($self, 'fragment', ''), // nettoyer l'id ahah eventuel
191
-		'total' => $total,
192
-		'position' => intval($position),
193
-		'pas' => $pas,
194
-		'nombre_pages' => floor(($total - 1) / $pas) + 1,
195
-		'page_courante' => floor(intval($position) / $pas) + 1,
196
-		'ancre' => $ancre,
197
-		'bloc_ancre' => $bloc_ancre
198
-	];
199
-	if (is_array($env)) {
200
-		$pagination = array_merge($env, $pagination);
201
-	}
202
-
203
-	// Pas de pagination
204
-	if ($pagination['nombre_pages'] <= 1) {
205
-		return '';
206
-	}
207
-
208
-	if ($modele) {
209
-		$pagination['type_pagination'] = $modele;
210
-		if (trouver_fond('pagination_' . $modele, 'modeles')) {
211
-			$modele = '_' . $modele;
212
-		}
213
-		else {
214
-			$modele = '';
215
-		}
216
-	}
217
-
218
-	if (!defined('_PAGINATION_NOMBRE_LIENS_MAX')) {
219
-		define('_PAGINATION_NOMBRE_LIENS_MAX', 10);
220
-	}
221
-	if (!defined('_PAGINATION_NOMBRE_LIENS_MAX_ECRIRE')) {
222
-		define('_PAGINATION_NOMBRE_LIENS_MAX_ECRIRE', 5);
223
-	}
224
-
225
-
226
-	return recuperer_fond("modeles/pagination$modele", $pagination, ['trim' => true], $connect);
169
+    static $ancres = [];
170
+    if ($pas < 1) {
171
+        return '';
172
+    }
173
+    $ancre = 'pagination' . $nom; // #pagination_articles
174
+    $debut = 'debut' . $nom; // 'debut_articles'
175
+
176
+    // n'afficher l'ancre qu'une fois
177
+    if (!isset($ancres[$ancre])) {
178
+        $bloc_ancre = $ancres[$ancre] = "<a id='" . $ancre . "' class='pagination_ancre'></a>";
179
+    } else {
180
+        $bloc_ancre = '';
181
+    }
182
+    // liste = false : on ne veut que l'ancre
183
+    if (!$liste) {
184
+        return $ancres[$ancre];
185
+    }
186
+
187
+    $self = (empty($env['self']) ? self() : $env['self']);
188
+    $pagination = [
189
+        'debut' => $debut,
190
+        'url' => parametre_url($self, 'fragment', ''), // nettoyer l'id ahah eventuel
191
+        'total' => $total,
192
+        'position' => intval($position),
193
+        'pas' => $pas,
194
+        'nombre_pages' => floor(($total - 1) / $pas) + 1,
195
+        'page_courante' => floor(intval($position) / $pas) + 1,
196
+        'ancre' => $ancre,
197
+        'bloc_ancre' => $bloc_ancre
198
+    ];
199
+    if (is_array($env)) {
200
+        $pagination = array_merge($env, $pagination);
201
+    }
202
+
203
+    // Pas de pagination
204
+    if ($pagination['nombre_pages'] <= 1) {
205
+        return '';
206
+    }
207
+
208
+    if ($modele) {
209
+        $pagination['type_pagination'] = $modele;
210
+        if (trouver_fond('pagination_' . $modele, 'modeles')) {
211
+            $modele = '_' . $modele;
212
+        }
213
+        else {
214
+            $modele = '';
215
+        }
216
+    }
217
+
218
+    if (!defined('_PAGINATION_NOMBRE_LIENS_MAX')) {
219
+        define('_PAGINATION_NOMBRE_LIENS_MAX', 10);
220
+    }
221
+    if (!defined('_PAGINATION_NOMBRE_LIENS_MAX_ECRIRE')) {
222
+        define('_PAGINATION_NOMBRE_LIENS_MAX_ECRIRE', 5);
223
+    }
224
+
225
+
226
+    return recuperer_fond("modeles/pagination$modele", $pagination, ['trim' => true], $connect);
227 227
 }
228 228
 
229 229
 
@@ -242,44 +242,44 @@  discard block
 block discarded – undo
242 242
  *     Liste (première page, dernière page).
243 243
  **/
244 244
 function filtre_bornes_pagination_dist($courante, $nombre, $max = 10) {
245
-	if ($max <= 0 or $max >= $nombre) {
246
-		return [1, $nombre];
247
-	}
248
-	if ($max <= 1) {
249
-		return [$courante, $courante];
250
-	}
251
-
252
-	$premiere = max(1, $courante - floor(($max - 1) / 2));
253
-	$derniere = min($nombre, $premiere + $max - 2);
254
-	$premiere = $derniere == $nombre ? $derniere - $max + 1 : $premiere;
255
-
256
-	return [$premiere, $derniere];
245
+    if ($max <= 0 or $max >= $nombre) {
246
+        return [1, $nombre];
247
+    }
248
+    if ($max <= 1) {
249
+        return [$courante, $courante];
250
+    }
251
+
252
+    $premiere = max(1, $courante - floor(($max - 1) / 2));
253
+    $derniere = min($nombre, $premiere + $max - 2);
254
+    $premiere = $derniere == $nombre ? $derniere - $max + 1 : $premiere;
255
+
256
+    return [$premiere, $derniere];
257 257
 }
258 258
 
259 259
 function filtre_pagination_affiche_texte_lien_page_dist($type_pagination, $numero_page, $rang_item) {
260
-	if ($numero_page === 'tous') {
261
-		return '&#8734;';
262
-	}
263
-	if ($numero_page === 'prev') {
264
-		return '&lt;';
265
-	}
266
-	if ($numero_page === 'next') {
267
-		return '&gt;';
268
-	}
269
-
270
-	switch ($type_pagination) {
271
-		case 'resultats':
272
-			return $rang_item + 1; // 1 11 21 31...
273
-		case 'naturel':
274
-			return $rang_item ?: 1; // 1 10 20 30...
275
-		case 'rang':
276
-			return $rang_item; // 0 10 20 30...
277
-
278
-		case 'page':
279
-		case 'prive':
280
-		default:
281
-			return $numero_page; // 1 2 3 4 5...
282
-	}
260
+    if ($numero_page === 'tous') {
261
+        return '&#8734;';
262
+    }
263
+    if ($numero_page === 'prev') {
264
+        return '&lt;';
265
+    }
266
+    if ($numero_page === 'next') {
267
+        return '&gt;';
268
+    }
269
+
270
+    switch ($type_pagination) {
271
+        case 'resultats':
272
+            return $rang_item + 1; // 1 11 21 31...
273
+        case 'naturel':
274
+            return $rang_item ?: 1; // 1 10 20 30...
275
+        case 'rang':
276
+            return $rang_item; // 0 10 20 30...
277
+
278
+        case 'page':
279
+        case 'prive':
280
+        default:
281
+            return $numero_page; // 1 2 3 4 5...
282
+    }
283 283
 }
284 284
 
285 285
 /**
@@ -292,15 +292,15 @@  discard block
 block discarded – undo
292 292
  **/
293 293
 function lister_objets_avec_logos($type) {
294 294
 
295
-	$objet = objet_type($type);
296
-	$ids = sql_allfetsel('L.id_objet', 'spip_documents AS D JOIN spip_documents_liens AS L ON L.id_document=D.id_document', 'D.mode=' . sql_quote('logoon') . ' AND L.objet=' . sql_quote($objet));
297
-	if ($ids) {
298
-		$ids = array_column($ids, 'id_objet');
299
-		return implode(',', $ids);
300
-	}
301
-	else {
302
-		return '0';
303
-	}
295
+    $objet = objet_type($type);
296
+    $ids = sql_allfetsel('L.id_objet', 'spip_documents AS D JOIN spip_documents_liens AS L ON L.id_document=D.id_document', 'D.mode=' . sql_quote('logoon') . ' AND L.objet=' . sql_quote($objet));
297
+    if ($ids) {
298
+        $ids = array_column($ids, 'id_objet');
299
+        return implode(',', $ids);
300
+    }
301
+    else {
302
+        return '0';
303
+    }
304 304
 }
305 305
 
306 306
 
@@ -316,14 +316,14 @@  discard block
 block discarded – undo
316 316
  *     Code HTML des notes
317 317
  **/
318 318
 function calculer_notes() {
319
-	$r = '';
320
-	if ($notes = charger_fonction('notes', 'inc', true)) {
321
-		$r = $notes([]);
322
-		$notes('', 'depiler');
323
-		$notes('', 'empiler');
324
-	}
325
-
326
-	return $r;
319
+    $r = '';
320
+    if ($notes = charger_fonction('notes', 'inc', true)) {
321
+        $r = $notes([]);
322
+        $notes('', 'depiler');
323
+        $notes('', 'empiler');
324
+    }
325
+
326
+    return $r;
327 327
 }
328 328
 
329 329
 
@@ -340,10 +340,10 @@  discard block
 block discarded – undo
340 340
  * @return string
341 341
  */
342 342
 function retrouver_rang_lien($objet_source, $ids, $objet_lie, $idl, $objet_lien) {
343
-	$res = lister_objets_liens($objet_source, $objet_lie, $idl, $objet_lien);
344
-	$res = array_column($res, 'rang_lien', $objet_source);
343
+    $res = lister_objets_liens($objet_source, $objet_lie, $idl, $objet_lien);
344
+    $res = array_column($res, 'rang_lien', $objet_source);
345 345
 
346
-	return ($res[$ids] ?? '');
346
+    return ($res[$ids] ?? '');
347 347
 }
348 348
 
349 349
 
@@ -360,19 +360,19 @@  discard block
 block discarded – undo
360 360
  * @private
361 361
  */
362 362
 function lister_objets_liens($objet_source, $objet, $id_objet, $objet_lien) {
363
-	static $liens = [];
364
-	if (!isset($liens["$objet_source-$objet-$id_objet-$objet_lien"])) {
365
-		include_spip('action/editer_liens');
366
-		// quand $objet == $objet_lien == $objet_source on reste sur le cas par defaut de $objet_lien == $objet_source
367
-		if ($objet_lien == $objet and $objet_lien !== $objet_source) {
368
-			$res = objet_trouver_liens([$objet => $id_objet], [$objet_source => '*']);
369
-		} else {
370
-			$res = objet_trouver_liens([$objet_source => '*'], [$objet => $id_objet]);
371
-		}
372
-
373
-		$liens["$objet_source-$objet-$id_objet-$objet_lien"] = $res;
374
-	}
375
-	return $liens["$objet_source-$objet-$id_objet-$objet_lien"];
363
+    static $liens = [];
364
+    if (!isset($liens["$objet_source-$objet-$id_objet-$objet_lien"])) {
365
+        include_spip('action/editer_liens');
366
+        // quand $objet == $objet_lien == $objet_source on reste sur le cas par defaut de $objet_lien == $objet_source
367
+        if ($objet_lien == $objet and $objet_lien !== $objet_source) {
368
+            $res = objet_trouver_liens([$objet => $id_objet], [$objet_source => '*']);
369
+        } else {
370
+            $res = objet_trouver_liens([$objet_source => '*'], [$objet => $id_objet]);
371
+        }
372
+
373
+        $liens["$objet_source-$objet-$id_objet-$objet_lien"] = $res;
374
+    }
375
+    return $liens["$objet_source-$objet-$id_objet-$objet_lien"];
376 376
 }
377 377
 
378 378
 /**
@@ -386,24 +386,24 @@  discard block
 block discarded – undo
386 386
  * @return int|string
387 387
  */
388 388
 function calculer_rang_smart($titre, $objet_source, $id, $env) {
389
-	// Cas du #RANG utilisé dans #FORMULAIRE_EDITER_LIENS -> attraper le rang du lien
390
-	// permet de voir le rang du lien si il y en a un en base, meme avant un squelette xxxx-lies.html ne gerant pas les liens
391
-	if (
392
-		isset($env['form']) and $env['form']
393
-		and isset($env['_objet_lien']) and $env['_objet_lien']
394
-		and (function_exists('lien_triables') or include_spip('action/editer_liens'))
395
-		and $r = objet_associable($env['_objet_lien'])
396
-		and [$p, $table_lien] = $r
397
-		and lien_triables($table_lien)
398
-		and isset($env['objet']) and $env['objet']
399
-		and isset($env['id_objet']) and $env['id_objet']
400
-		and $objet_source
401
-		and $id = intval($id)
402
-	) {
403
-		$rang = retrouver_rang_lien($objet_source, $id, $env['objet'], $env['id_objet'], $env['_objet_lien']);
404
-		return ($rang ?: '');
405
-	}
406
-	return recuperer_numero($titre);
389
+    // Cas du #RANG utilisé dans #FORMULAIRE_EDITER_LIENS -> attraper le rang du lien
390
+    // permet de voir le rang du lien si il y en a un en base, meme avant un squelette xxxx-lies.html ne gerant pas les liens
391
+    if (
392
+        isset($env['form']) and $env['form']
393
+        and isset($env['_objet_lien']) and $env['_objet_lien']
394
+        and (function_exists('lien_triables') or include_spip('action/editer_liens'))
395
+        and $r = objet_associable($env['_objet_lien'])
396
+        and [$p, $table_lien] = $r
397
+        and lien_triables($table_lien)
398
+        and isset($env['objet']) and $env['objet']
399
+        and isset($env['id_objet']) and $env['id_objet']
400
+        and $objet_source
401
+        and $id = intval($id)
402
+    ) {
403
+        $rang = retrouver_rang_lien($objet_source, $id, $env['objet'], $env['id_objet'], $env['_objet_lien']);
404
+        return ($rang ?: '');
405
+    }
406
+    return recuperer_numero($titre);
407 407
 }
408 408
 
409 409
 /**
@@ -430,72 +430,72 @@  discard block
 block discarded – undo
430 430
  */
431 431
 function calculer_balise_tri(string $champ_ou_sens, string $libelle, string $classe, string $tri_nom, string $tri_champ, string $tri_sens, $liste_tri_sens_defaut): string {
432 432
 
433
-	$url = self('&');
434
-	$tri_sens = (int) $tri_sens;
435
-	$alias_sens = [
436
-		'<' => -1,
437
-		'>' => 1,
438
-		'inverse' => -1,
439
-	];
440
-
441
-	// Normaliser la liste des sens de tri par défaut
442
-	// On ajoute un jocker pour les champs non présents dans la liste
443
-	// avec la valeur du 1er item de la liste, idem critère {tri}
444
-	if (is_array($liste_tri_sens_defaut)) {
445
-		$liste_tri_sens_defaut['*'] = array_values($liste_tri_sens_defaut)[0];
446
-	} else {
447
-		$liste_tri_sens_defaut = [
448
-			'*' => (int) ($alias_sens[$liste_tri_sens_defaut] ?? $liste_tri_sens_defaut),
449
-		];
450
-	}
451
-
452
-	// Les sens de tri actuel et nouveau :
453
-	// Soit c'est un sens fixe donné en paramètre (< ou >)
454
-	$is_sens_fixe = array_key_exists($champ_ou_sens, $alias_sens);
455
-	if ($is_sens_fixe) {
456
-		$tri_sens_actuel = $tri_sens;
457
-		$tri_sens_nouveau = $alias_sens[$champ_ou_sens];
458
-	// Soit c'est le champ utilisé actuellement pour le tri → on inverse le sens
459
-	} elseif ($champ_ou_sens === $tri_champ) {
460
-		$tri_sens_actuel = $tri_sens;
461
-		$tri_sens_nouveau = $tri_sens * -1;
462
-	// Sinon c'est un nouveau champ, et on prend son tri par défaut
463
-	} else {
464
-		$tri_sens_actuel = $tri_sens_nouveau = (int) ($liste_tri_sens_defaut[$champ_ou_sens] ?? $liste_tri_sens_defaut['*']);
465
-	}
466
-
467
-	// URL : ajouter le champ sur lequel porte le tri
468
-	if (!$is_sens_fixe) {
469
-		$param_tri = "tri$tri_nom";
470
-		$url = parametre_url($url, $param_tri, $champ_ou_sens);
471
-	}
472
-
473
-	// URL : n'ajouter le sens de tri que si nécessaire,
474
-	// c.à.d différent du sens par défaut pour le champ
475
-	$param_sens = "sens$tri_nom";
476
-	$tri_sens_defaut_champ = (int) ($liste_tri_sens_defaut[$champ_ou_sens] ?? $liste_tri_sens_defaut['*']);
477
-	if ($tri_sens_nouveau !== $tri_sens_defaut_champ) {
478
-		$url = parametre_url($url, $param_sens, $tri_sens_nouveau);
479
-	} else {
480
-		$url = parametre_url($url, $param_sens, '');
481
-	}
482
-
483
-	// Drapeau pour garder en session ?
484
-	$param_memo = (!$is_sens_fixe ? $param_tri : $param_sens);
485
-	$url = parametre_url($url, 'var_memotri', strncmp($tri_nom, 'session', 7) == 0 ? $param_memo : '');
486
-
487
-	// Classes : on indique le sens de tri et l'item exposé
488
-	if (!$is_sens_fixe) {
489
-		$classe .= ' item-tri item-tri_' . ($tri_sens_actuel === 1 ? 'asc' : 'desc');
490
-	}
491
-	if ($champ_ou_sens === $tri_champ) {
492
-		$classe .= ' item-tri_actif';
493
-	}
494
-
495
-	// Lien
496
-	$balise = lien_ou_expose($url, $libelle, false, $classe);
497
-
498
-	return $balise;
433
+    $url = self('&');
434
+    $tri_sens = (int) $tri_sens;
435
+    $alias_sens = [
436
+        '<' => -1,
437
+        '>' => 1,
438
+        'inverse' => -1,
439
+    ];
440
+
441
+    // Normaliser la liste des sens de tri par défaut
442
+    // On ajoute un jocker pour les champs non présents dans la liste
443
+    // avec la valeur du 1er item de la liste, idem critère {tri}
444
+    if (is_array($liste_tri_sens_defaut)) {
445
+        $liste_tri_sens_defaut['*'] = array_values($liste_tri_sens_defaut)[0];
446
+    } else {
447
+        $liste_tri_sens_defaut = [
448
+            '*' => (int) ($alias_sens[$liste_tri_sens_defaut] ?? $liste_tri_sens_defaut),
449
+        ];
450
+    }
451
+
452
+    // Les sens de tri actuel et nouveau :
453
+    // Soit c'est un sens fixe donné en paramètre (< ou >)
454
+    $is_sens_fixe = array_key_exists($champ_ou_sens, $alias_sens);
455
+    if ($is_sens_fixe) {
456
+        $tri_sens_actuel = $tri_sens;
457
+        $tri_sens_nouveau = $alias_sens[$champ_ou_sens];
458
+    // Soit c'est le champ utilisé actuellement pour le tri → on inverse le sens
459
+    } elseif ($champ_ou_sens === $tri_champ) {
460
+        $tri_sens_actuel = $tri_sens;
461
+        $tri_sens_nouveau = $tri_sens * -1;
462
+    // Sinon c'est un nouveau champ, et on prend son tri par défaut
463
+    } else {
464
+        $tri_sens_actuel = $tri_sens_nouveau = (int) ($liste_tri_sens_defaut[$champ_ou_sens] ?? $liste_tri_sens_defaut['*']);
465
+    }
466
+
467
+    // URL : ajouter le champ sur lequel porte le tri
468
+    if (!$is_sens_fixe) {
469
+        $param_tri = "tri$tri_nom";
470
+        $url = parametre_url($url, $param_tri, $champ_ou_sens);
471
+    }
472
+
473
+    // URL : n'ajouter le sens de tri que si nécessaire,
474
+    // c.à.d différent du sens par défaut pour le champ
475
+    $param_sens = "sens$tri_nom";
476
+    $tri_sens_defaut_champ = (int) ($liste_tri_sens_defaut[$champ_ou_sens] ?? $liste_tri_sens_defaut['*']);
477
+    if ($tri_sens_nouveau !== $tri_sens_defaut_champ) {
478
+        $url = parametre_url($url, $param_sens, $tri_sens_nouveau);
479
+    } else {
480
+        $url = parametre_url($url, $param_sens, '');
481
+    }
482
+
483
+    // Drapeau pour garder en session ?
484
+    $param_memo = (!$is_sens_fixe ? $param_tri : $param_sens);
485
+    $url = parametre_url($url, 'var_memotri', strncmp($tri_nom, 'session', 7) == 0 ? $param_memo : '');
486
+
487
+    // Classes : on indique le sens de tri et l'item exposé
488
+    if (!$is_sens_fixe) {
489
+        $classe .= ' item-tri item-tri_' . ($tri_sens_actuel === 1 ? 'asc' : 'desc');
490
+    }
491
+    if ($champ_ou_sens === $tri_champ) {
492
+        $classe .= ' item-tri_actif';
493
+    }
494
+
495
+    // Lien
496
+    $balise = lien_ou_expose($url, $libelle, false, $classe);
497
+
498
+    return $balise;
499 499
 }
500 500
 
501 501
 
@@ -511,7 +511,7 @@  discard block
 block discarded – undo
511 511
  * @return string
512 512
  */
513 513
 function tri_protege_champ($t) {
514
-	return preg_replace(',[^\s\w.+\[\]],', '', $t);
514
+    return preg_replace(',[^\s\w.+\[\]],', '', $t);
515 515
 }
516 516
 
517 517
 /**
@@ -524,43 +524,43 @@  discard block
 block discarded – undo
524 524
  * @return string
525 525
  */
526 526
 function tri_champ_order($t, $from = null, $senstri = '') {
527
-	if (strncmp($t, 'multi ', 6) == 0) {
528
-		return 'multi' . $senstri;
529
-	}
530
-
531
-	$champ = $t;
532
-
533
-	$prefixe = '';
534
-	foreach (['num ', 'sinum '] as $p) {
535
-		if (strpos($t, $p) === 0) {
536
-			$champ = substr($t, strlen($p));
537
-			$prefixe = $p;
538
-		}
539
-	}
540
-
541
-	// enlever les autres espaces non evacues par tri_protege_champ
542
-	$champ = preg_replace(',\s,', '', $champ);
543
-
544
-	if (is_array($from)) {
545
-		$trouver_table = charger_fonction('trouver_table', 'base');
546
-		foreach ($from as $idt => $table_sql) {
547
-			if (
548
-				$desc = $trouver_table($table_sql)
549
-				and isset($desc['field'][$champ])
550
-			) {
551
-				$champ = "$idt.$champ";
552
-				break;
553
-			}
554
-		}
555
-	}
556
-	switch ($prefixe) {
557
-		case 'num ':
558
-			return "CASE( 0+$champ ) WHEN 0 THEN 1 ELSE 0 END{$senstri}, 0+$champ{$senstri}";
559
-		case 'sinum ':
560
-			return "CASE( 0+$champ ) WHEN 0 THEN 1 ELSE 0 END{$senstri}";
561
-		default:
562
-			return $champ . $senstri;
563
-	}
527
+    if (strncmp($t, 'multi ', 6) == 0) {
528
+        return 'multi' . $senstri;
529
+    }
530
+
531
+    $champ = $t;
532
+
533
+    $prefixe = '';
534
+    foreach (['num ', 'sinum '] as $p) {
535
+        if (strpos($t, $p) === 0) {
536
+            $champ = substr($t, strlen($p));
537
+            $prefixe = $p;
538
+        }
539
+    }
540
+
541
+    // enlever les autres espaces non evacues par tri_protege_champ
542
+    $champ = preg_replace(',\s,', '', $champ);
543
+
544
+    if (is_array($from)) {
545
+        $trouver_table = charger_fonction('trouver_table', 'base');
546
+        foreach ($from as $idt => $table_sql) {
547
+            if (
548
+                $desc = $trouver_table($table_sql)
549
+                and isset($desc['field'][$champ])
550
+            ) {
551
+                $champ = "$idt.$champ";
552
+                break;
553
+            }
554
+        }
555
+    }
556
+    switch ($prefixe) {
557
+        case 'num ':
558
+            return "CASE( 0+$champ ) WHEN 0 THEN 1 ELSE 0 END{$senstri}, 0+$champ{$senstri}";
559
+        case 'sinum ':
560
+            return "CASE( 0+$champ ) WHEN 0 THEN 1 ELSE 0 END{$senstri}";
561
+        default:
562
+            return $champ . $senstri;
563
+    }
564 564
 }
565 565
 
566 566
 /**
@@ -574,18 +574,18 @@  discard block
 block discarded – undo
574 574
  * @return string
575 575
  */
576 576
 function tri_champ_select($t) {
577
-	if (strncmp($t, 'multi ', 6) == 0) {
578
-		$t = substr($t, 6);
579
-		$t = preg_replace(',\s,', '', $t);
580
-		$t = sql_multi($t, $GLOBALS['spip_lang']);
581
-
582
-		return $t;
583
-	}
584
-	if (trim($t) == 'hasard') {
585
-		return 'rand() AS hasard';
586
-	}
587
-
588
-	return "''";
577
+    if (strncmp($t, 'multi ', 6) == 0) {
578
+        $t = substr($t, 6);
579
+        $t = preg_replace(',\s,', '', $t);
580
+        $t = sql_multi($t, $GLOBALS['spip_lang']);
581
+
582
+        return $t;
583
+    }
584
+    if (trim($t) == 'hasard') {
585
+        return 'rand() AS hasard';
586
+    }
587
+
588
+    return "''";
589 589
 }
590 590
 
591 591
 /**
@@ -597,16 +597,16 @@  discard block
 block discarded – undo
597 597
  * @return string
598 598
  */
599 599
 function formate_liste_critere_par_ordre_liste($valeurs, $serveur = '') {
600
-	if (!is_array($valeurs)) {
601
-		return '';
602
-	}
603
-	$f = sql_serveur('quote', $serveur, true);
604
-	if (!is_string($f) or !$f) {
605
-		return '';
606
-	}
607
-	$valeurs = implode(',', array_map($f, array_unique($valeurs)));
608
-
609
-	return $valeurs;
600
+    if (!is_array($valeurs)) {
601
+        return '';
602
+    }
603
+    $f = sql_serveur('quote', $serveur, true);
604
+    if (!is_string($f) or !$f) {
605
+        return '';
606
+    }
607
+    $valeurs = implode(',', array_map($f, array_unique($valeurs)));
608
+
609
+    return $valeurs;
610 610
 }
611 611
 
612 612
 /**
@@ -629,22 +629,22 @@  discard block
 block discarded – undo
629 629
  *     Valeur $defaut sinon.
630 630
  **/
631 631
 function appliquer_filtre_sinon($arg, $filtre, $args, $defaut = '') {
632
-	// Si c'est un filtre d'image, on utilise image_filtrer()
633
-	// Attention : les 2 premiers arguments sont inversés dans ce cas
634
-	if (trouver_filtre_matrice($filtre) and substr($filtre, 0, 6) == 'image_') {
635
-		include_spip('inc/filtres_images_lib_mini');
636
-		$args[1] = $args[0];
637
-		$args[0] = $filtre;
638
-		return image_graver(image_filtrer($args));
639
-	}
640
-
641
-	$f = chercher_filtre($filtre);
642
-	if (!$f) {
643
-		return $defaut;
644
-	}
645
-	array_shift($args); // enlever $arg
646
-	array_shift($args); // enlever $filtre
647
-	return $f($arg, ...$args);
632
+    // Si c'est un filtre d'image, on utilise image_filtrer()
633
+    // Attention : les 2 premiers arguments sont inversés dans ce cas
634
+    if (trouver_filtre_matrice($filtre) and substr($filtre, 0, 6) == 'image_') {
635
+        include_spip('inc/filtres_images_lib_mini');
636
+        $args[1] = $args[0];
637
+        $args[0] = $filtre;
638
+        return image_graver(image_filtrer($args));
639
+    }
640
+
641
+    $f = chercher_filtre($filtre);
642
+    if (!$f) {
643
+        return $defaut;
644
+    }
645
+    array_shift($args); // enlever $arg
646
+    array_shift($args); // enlever $filtre
647
+    return $f($arg, ...$args);
648 648
 }
649 649
 
650 650
 /**
@@ -654,30 +654,30 @@  discard block
 block discarded – undo
654 654
  * @return string
655 655
  */
656 656
 function filtre_styles_inline_page_login_pass_dist(&$Pile,...$dummy) {
657
-	$styles = '';
658
-	include_spip('inc/config');
659
-	if ($couleur = lire_config('couleur_login')) {
660
-		include_spip('inc/filtres_images_mini');
661
-		$hs = couleur_hex_to_hsl($couleur, 'h, s');
662
-		$l = couleur_hex_to_hsl($couleur, 'l');
663
-		$styles .= ":root {--spip-login-color-theme--hs: {$hs};--spip-login-color-theme--l: {$l};}\n";
664
-	}
665
-	$logo_bg = _DIR_IMG . "spip_fond_login.jpg";
666
-	if (file_exists($logo_bg)) {
667
-		include_spip('inc/filtres_images_mini');
668
-		$logo_mini = image_reduire($logo_bg, 64, 64);
669
-		$logo_mini = extraire_attribut($logo_mini, 'src');
670
-		$embarque_fichier = charger_filtre('embarque_fichier');
671
-		$logo_mini = $embarque_fichier($logo_mini);
672
-		$logo_bg = timestamp($logo_bg);
673
-		$styles .= ".page_login, .page_spip_pass {background-image:url($logo_bg), url($logo_mini);}\n";
674
-		$Pile[0]['body_class'] = 'fond_image';
675
-	}
676
-	else {
677
-		$Pile[0]['body_class'] = 'sans_fond';
678
-	}
679
-	if ($styles) {
680
-		$styles = "<style type='text/css'>$styles</style>";
681
-	}
682
-	return $styles;
657
+    $styles = '';
658
+    include_spip('inc/config');
659
+    if ($couleur = lire_config('couleur_login')) {
660
+        include_spip('inc/filtres_images_mini');
661
+        $hs = couleur_hex_to_hsl($couleur, 'h, s');
662
+        $l = couleur_hex_to_hsl($couleur, 'l');
663
+        $styles .= ":root {--spip-login-color-theme--hs: {$hs};--spip-login-color-theme--l: {$l};}\n";
664
+    }
665
+    $logo_bg = _DIR_IMG . "spip_fond_login.jpg";
666
+    if (file_exists($logo_bg)) {
667
+        include_spip('inc/filtres_images_mini');
668
+        $logo_mini = image_reduire($logo_bg, 64, 64);
669
+        $logo_mini = extraire_attribut($logo_mini, 'src');
670
+        $embarque_fichier = charger_filtre('embarque_fichier');
671
+        $logo_mini = $embarque_fichier($logo_mini);
672
+        $logo_bg = timestamp($logo_bg);
673
+        $styles .= ".page_login, .page_spip_pass {background-image:url($logo_bg), url($logo_mini);}\n";
674
+        $Pile[0]['body_class'] = 'fond_image';
675
+    }
676
+    else {
677
+        $Pile[0]['body_class'] = 'sans_fond';
678
+    }
679
+    if ($styles) {
680
+        $styles = "<style type='text/css'>$styles</style>";
681
+    }
682
+    return $styles;
683 683
 }
Please login to merge, or discard this patch.
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -86,7 +86,7 @@  discard block
 block discarded – undo
86 86
 		$texte = $intro;
87 87
 	} else {
88 88
 		if (
89
-			strpos("\n" . $texte, "\n|") === false
89
+			strpos("\n".$texte, "\n|") === false
90 90
 			and strlen($texte) > 2.5 * $longueur
91 91
 		) {
92 92
 			if (strpos($texte, '<multi') !== false) {
@@ -170,12 +170,12 @@  discard block
 block discarded – undo
170 170
 	if ($pas < 1) {
171 171
 		return '';
172 172
 	}
173
-	$ancre = 'pagination' . $nom; // #pagination_articles
174
-	$debut = 'debut' . $nom; // 'debut_articles'
173
+	$ancre = 'pagination'.$nom; // #pagination_articles
174
+	$debut = 'debut'.$nom; // 'debut_articles'
175 175
 
176 176
 	// n'afficher l'ancre qu'une fois
177 177
 	if (!isset($ancres[$ancre])) {
178
-		$bloc_ancre = $ancres[$ancre] = "<a id='" . $ancre . "' class='pagination_ancre'></a>";
178
+		$bloc_ancre = $ancres[$ancre] = "<a id='".$ancre."' class='pagination_ancre'></a>";
179 179
 	} else {
180 180
 		$bloc_ancre = '';
181 181
 	}
@@ -207,8 +207,8 @@  discard block
 block discarded – undo
207 207
 
208 208
 	if ($modele) {
209 209
 		$pagination['type_pagination'] = $modele;
210
-		if (trouver_fond('pagination_' . $modele, 'modeles')) {
211
-			$modele = '_' . $modele;
210
+		if (trouver_fond('pagination_'.$modele, 'modeles')) {
211
+			$modele = '_'.$modele;
212 212
 		}
213 213
 		else {
214 214
 			$modele = '';
@@ -293,7 +293,7 @@  discard block
 block discarded – undo
293 293
 function lister_objets_avec_logos($type) {
294 294
 
295 295
 	$objet = objet_type($type);
296
-	$ids = sql_allfetsel('L.id_objet', 'spip_documents AS D JOIN spip_documents_liens AS L ON L.id_document=D.id_document', 'D.mode=' . sql_quote('logoon') . ' AND L.objet=' . sql_quote($objet));
296
+	$ids = sql_allfetsel('L.id_objet', 'spip_documents AS D JOIN spip_documents_liens AS L ON L.id_document=D.id_document', 'D.mode='.sql_quote('logoon').' AND L.objet='.sql_quote($objet));
297 297
 	if ($ids) {
298 298
 		$ids = array_column($ids, 'id_objet');
299 299
 		return implode(',', $ids);
@@ -486,7 +486,7 @@  discard block
 block discarded – undo
486 486
 
487 487
 	// Classes : on indique le sens de tri et l'item exposé
488 488
 	if (!$is_sens_fixe) {
489
-		$classe .= ' item-tri item-tri_' . ($tri_sens_actuel === 1 ? 'asc' : 'desc');
489
+		$classe .= ' item-tri item-tri_'.($tri_sens_actuel === 1 ? 'asc' : 'desc');
490 490
 	}
491 491
 	if ($champ_ou_sens === $tri_champ) {
492 492
 		$classe .= ' item-tri_actif';
@@ -525,7 +525,7 @@  discard block
 block discarded – undo
525 525
  */
526 526
 function tri_champ_order($t, $from = null, $senstri = '') {
527 527
 	if (strncmp($t, 'multi ', 6) == 0) {
528
-		return 'multi' . $senstri;
528
+		return 'multi'.$senstri;
529 529
 	}
530 530
 
531 531
 	$champ = $t;
@@ -559,7 +559,7 @@  discard block
 block discarded – undo
559 559
 		case 'sinum ':
560 560
 			return "CASE( 0+$champ ) WHEN 0 THEN 1 ELSE 0 END{$senstri}";
561 561
 		default:
562
-			return $champ . $senstri;
562
+			return $champ.$senstri;
563 563
 	}
564 564
 }
565 565
 
@@ -653,7 +653,7 @@  discard block
 block discarded – undo
653 653
  * @param ...$dummy
654 654
  * @return string
655 655
  */
656
-function filtre_styles_inline_page_login_pass_dist(&$Pile,...$dummy) {
656
+function filtre_styles_inline_page_login_pass_dist(&$Pile, ...$dummy) {
657 657
 	$styles = '';
658 658
 	include_spip('inc/config');
659 659
 	if ($couleur = lire_config('couleur_login')) {
@@ -662,7 +662,7 @@  discard block
 block discarded – undo
662 662
 		$l = couleur_hex_to_hsl($couleur, 'l');
663 663
 		$styles .= ":root {--spip-login-color-theme--hs: {$hs};--spip-login-color-theme--l: {$l};}\n";
664 664
 	}
665
-	$logo_bg = _DIR_IMG . "spip_fond_login.jpg";
665
+	$logo_bg = _DIR_IMG."spip_fond_login.jpg";
666 666
 	if (file_exists($logo_bg)) {
667 667
 		include_spip('inc/filtres_images_mini');
668 668
 		$logo_mini = image_reduire($logo_bg, 64, 64);
Please login to merge, or discard this patch.
Braces   +3 added lines, -6 removed lines patch added patch discarded remove patch
@@ -209,8 +209,7 @@  discard block
 block discarded – undo
209 209
 		$pagination['type_pagination'] = $modele;
210 210
 		if (trouver_fond('pagination_' . $modele, 'modeles')) {
211 211
 			$modele = '_' . $modele;
212
-		}
213
-		else {
212
+		} else {
214 213
 			$modele = '';
215 214
 		}
216 215
 	}
@@ -297,8 +296,7 @@  discard block
 block discarded – undo
297 296
 	if ($ids) {
298 297
 		$ids = array_column($ids, 'id_objet');
299 298
 		return implode(',', $ids);
300
-	}
301
-	else {
299
+	} else {
302 300
 		return '0';
303 301
 	}
304 302
 }
@@ -672,8 +670,7 @@  discard block
 block discarded – undo
672 670
 		$logo_bg = timestamp($logo_bg);
673 671
 		$styles .= ".page_login, .page_spip_pass {background-image:url($logo_bg), url($logo_mini);}\n";
674 672
 		$Pile[0]['body_class'] = 'fond_image';
675
-	}
676
-	else {
673
+	} else {
677 674
 		$Pile[0]['body_class'] = 'sans_fond';
678 675
 	}
679 676
 	if ($styles) {
Please login to merge, or discard this patch.
ecrire/inc/minipres.php 1 patch
Indentation   +30 added lines, -30 removed lines patch added patch discarded remove patch
@@ -15,7 +15,7 @@  discard block
 block discarded – undo
15 15
  * @package SPIP\Core\Minipres
16 16
  **/
17 17
 if (!defined('_ECRIRE_INC_VERSION')) {
18
-	return;
18
+    return;
19 19
 }
20 20
 
21 21
 /**
@@ -35,19 +35,19 @@  discard block
 block discarded – undo
35 35
  */
36 36
 function install_debut_html($titre = 'AUTO', $onLoad = '', $all_inline = false) {
37 37
 
38
-	if ($onLoad) {
39
-		include_spip('inc/filtres');
40
-		$onLoad = extraire_attribut("<body $onLoad>", "onload");
41
-	}
38
+    if ($onLoad) {
39
+        include_spip('inc/filtres');
40
+        $onLoad = extraire_attribut("<body $onLoad>", "onload");
41
+    }
42 42
 
43
-	$options = [
44
-		'all_inline' => $all_inline,
45
-		'onload' => $onLoad,
46
-		'titre' => $titre,
47
-	];
43
+    $options = [
44
+        'all_inline' => $all_inline,
45
+        'onload' => $onLoad,
46
+        'titre' => $titre,
47
+    ];
48 48
 
49
-	$minipage = new Spip\Afficher\Minipage\Admin();
50
-	return $minipage->installDebutPage($options);
49
+    $minipage = new Spip\Afficher\Minipage\Admin();
50
+    return $minipage->installDebutPage($options);
51 51
 }
52 52
 
53 53
 /**
@@ -59,8 +59,8 @@  discard block
 block discarded – undo
59 59
  * @return string Code HTML
60 60
  */
61 61
 function install_fin_html() {
62
-	$minipage = new Spip\Afficher\Minipage\Admin();
63
-	return $minipage->installFinPage();
62
+    $minipage = new Spip\Afficher\Minipage\Admin();
63
+    return $minipage->installFinPage();
64 64
 }
65 65
 
66 66
 
@@ -99,23 +99,23 @@  discard block
 block discarded – undo
99 99
  */
100 100
 function minipres($titre = '', $corps = '', $options = []) {
101 101
 
102
-	// compat signature old
103
-	// minipres($titre='', $corps="", $onload='', $all_inline = false)
104
-	$args = func_get_args();
105
-	if (isset($args[2]) and is_string($args[2])) {
106
-		$options = ['onload' => $args[2]];
107
-	}
108
-	if (isset($args[3])) {
109
-		$options['all_inline'] = $args[3];
110
-	}
102
+    // compat signature old
103
+    // minipres($titre='', $corps="", $onload='', $all_inline = false)
104
+    $args = func_get_args();
105
+    if (isset($args[2]) and is_string($args[2])) {
106
+        $options = ['onload' => $args[2]];
107
+    }
108
+    if (isset($args[3])) {
109
+        $options['all_inline'] = $args[3];
110
+    }
111 111
 
112
-	$options = array_merge([
113
-		'onload' => '',
114
-		'all_inline' => false,
115
-	], $options);
112
+    $options = array_merge([
113
+        'onload' => '',
114
+        'all_inline' => false,
115
+    ], $options);
116 116
 
117
-	$options['titre'] = $titre;
117
+    $options['titre'] = $titre;
118 118
 
119
-	$minipage = new Spip\Afficher\Minipage\Admin();
120
-	return $minipage->page($corps, $options);
119
+    $minipage = new Spip\Afficher\Minipage\Admin();
120
+    return $minipage->page($corps, $options);
121 121
 }
Please login to merge, or discard this patch.
ecrire/inc/install.php 2 patches
Indentation   +354 added lines, -354 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
 
@@ -42,11 +42,11 @@  discard block
 block discarded – undo
42 42
  * @return void
43 43
  **/
44 44
 function install_fichier_connexion($nom, $texte) {
45
-	$texte = '<' . "?php\n"
46
-		. "if (!defined(\"_ECRIRE_INC_VERSION\")) return;\n"
47
-		. $texte;
45
+    $texte = '<' . "?php\n"
46
+        . "if (!defined(\"_ECRIRE_INC_VERSION\")) return;\n"
47
+        . $texte;
48 48
 
49
-	ecrire_fichier($nom, $texte);
49
+    ecrire_fichier($nom, $texte);
50 50
 }
51 51
 
52 52
 
@@ -75,20 +75,20 @@  discard block
 block discarded – undo
75 75
  *
76 76
  **/
77 77
 function install_connexion($adr, $port, $login, #[\SensitiveParameter] $pass, $base, $type, $pref, $ldap = '', $charset = '') {
78
-	$adr = addcslashes($adr, "'\\");
79
-	$port = addcslashes($port, "'\\");
80
-	$login = addcslashes($login, "'\\");
81
-	$pass = addcslashes($pass, "'\\");
82
-	$base = addcslashes($base, "'\\");
83
-	$type = addcslashes($type, "'\\");
84
-	$pref = addcslashes($pref, "'\\");
85
-	$ldap = addcslashes($ldap, "'\\");
86
-	$charset = addcslashes($charset, "'\\");
87
-
88
-	return "\$GLOBALS['spip_connect_version'] = 0.8;\n"
89
-	. 'spip_connect_db('
90
-	. "'$adr','$port','$login','$pass','$base'"
91
-	. ",'$type', '$pref','$ldap','$charset');\n";
78
+    $adr = addcslashes($adr, "'\\");
79
+    $port = addcslashes($port, "'\\");
80
+    $login = addcslashes($login, "'\\");
81
+    $pass = addcslashes($pass, "'\\");
82
+    $base = addcslashes($base, "'\\");
83
+    $type = addcslashes($type, "'\\");
84
+    $pref = addcslashes($pref, "'\\");
85
+    $ldap = addcslashes($ldap, "'\\");
86
+    $charset = addcslashes($charset, "'\\");
87
+
88
+    return "\$GLOBALS['spip_connect_version'] = 0.8;\n"
89
+    . 'spip_connect_db('
90
+    . "'$adr','$port','$login','$pass','$base'"
91
+    . ",'$type', '$pref','$ldap','$charset');\n";
92 92
 }
93 93
 
94 94
 
@@ -104,29 +104,29 @@  discard block
 block discarded – undo
104 104
  *     Tableau des informations sur la connexion
105 105
  **/
106 106
 function analyse_fichier_connection(string $file): array {
107
-	if (!file_exists($file)) {
108
-		return [];
109
-	}
110
-	$s = file_get_contents($file);
111
-	if (preg_match("#mysql_connect\([\"'](.*)[\"'],[\"'](.*)[\"'],[\"'](.*)[\"']\)#", $s, $regs)) {
112
-		array_shift($regs);
113
-
114
-		return $regs;
115
-	} else {
116
-		$ar = '\s*\'([^\']*)\'';
117
-		$r = '\s*,' . $ar;
118
-		$r = "#spip_connect_db[(]$ar$r$r$r$r(?:$r(?:$r(?:$r(?:$r)?)?)?)?#";
119
-		if (preg_match($r, $s, $regs)) {
120
-			$regs[2] = $regs[1] . (!$regs[2] ? '' : ':' . $regs[2] . ';');
121
-			array_shift($regs);
122
-			array_shift($regs);
123
-
124
-			return $regs;
125
-		}
126
-	}
127
-	spip_log("$file n'est pas un fichier de connexion");
128
-
129
-	return [];
107
+    if (!file_exists($file)) {
108
+        return [];
109
+    }
110
+    $s = file_get_contents($file);
111
+    if (preg_match("#mysql_connect\([\"'](.*)[\"'],[\"'](.*)[\"'],[\"'](.*)[\"']\)#", $s, $regs)) {
112
+        array_shift($regs);
113
+
114
+        return $regs;
115
+    } else {
116
+        $ar = '\s*\'([^\']*)\'';
117
+        $r = '\s*,' . $ar;
118
+        $r = "#spip_connect_db[(]$ar$r$r$r$r(?:$r(?:$r(?:$r(?:$r)?)?)?)?#";
119
+        if (preg_match($r, $s, $regs)) {
120
+            $regs[2] = $regs[1] . (!$regs[2] ? '' : ':' . $regs[2] . ';');
121
+            array_shift($regs);
122
+            array_shift($regs);
123
+
124
+            return $regs;
125
+        }
126
+    }
127
+    spip_log("$file n'est pas un fichier de connexion");
128
+
129
+    return [];
130 130
 }
131 131
 
132 132
 /**
@@ -143,80 +143,80 @@  discard block
 block discarded – undo
143 143
  *     Liste des noms de connecteurs
144 144
  **/
145 145
 function bases_referencees($exclu = '') {
146
-	$tables = [];
147
-	foreach (preg_files(_DIR_CONNECT, '.php$') as $f) {
148
-		if ($f != $exclu and analyse_fichier_connection($f)) {
149
-			$tables[] = basename($f, '.php');
150
-		}
151
-	}
152
-
153
-	return $tables;
146
+    $tables = [];
147
+    foreach (preg_files(_DIR_CONNECT, '.php$') as $f) {
148
+        if ($f != $exclu and analyse_fichier_connection($f)) {
149
+            $tables[] = basename($f, '.php');
150
+        }
151
+    }
152
+
153
+    return $tables;
154 154
 }
155 155
 
156 156
 
157 157
 function install_mode_appel($server_db, $tout = true) {
158
-	return ($server_db != 'mysql') ? ''
159
-		: (($tout ? test_rappel_nom_base_mysql($server_db) : '')
160
-			. test_sql_mode_mysql($server_db));
158
+    return ($server_db != 'mysql') ? ''
159
+        : (($tout ? test_rappel_nom_base_mysql($server_db) : '')
160
+            . test_sql_mode_mysql($server_db));
161 161
 }
162 162
 
163 163
 //
164 164
 // Verifier que l'hebergement est compatible SPIP ... ou l'inverse :-)
165 165
 // (sert a l'etape 1 de l'installation)
166 166
 function tester_compatibilite_hebergement() {
167
-	$err = [];
168
-
169
-	$p = phpversion();
170
-	if (version_compare($p, _PHP_MIN, '<')) {
171
-		$err[] = _T('install_php_version', ['version' => $p, 'minimum' => _PHP_MIN]);
172
-	}
173
-	if (version_compare($p, _PHP_MAX, '>')) {
174
-		$err[] = _T('install_php_version_max', ['version' => $p, 'maximum' => _PHP_MAX]);
175
-	}
176
-
177
-	$diff = array_diff(['sodium', 'xml', 'zip'], get_loaded_extensions());
178
-	if (!empty($diff)) {
179
-		$err[] = _T('install_php_extension', ['extensions' => implode(',', $diff)]);
180
-	}
181
-
182
-	// Si on n'a pas la bonne version de PHP, c'est la fin
183
-	if ($err) {
184
-		die("<div class='error'>"
185
-			. '<h3>' . _T('avis_attention') . '</h3><p>' . _T('install_echec_annonce') . "</p><ul class='spip'>"
186
-			. "<li><strong>{$err[0]}</strong></li>\n</ul></div>");
187
-	}
188
-
189
-	// Il faut une base de donnees tout de meme ...
190
-	$serveurs = install_select_serveur();
191
-	if (!$serveurs) {
192
-		$err[] = _T('install_extension_php_obligatoire')
193
-			. " <a href='http://www.php.net/mysql'>MYSQL</a>"
194
-			. "| <a href='http://www.php.net/sqlite'>SQLite</a>";
195
-	}
196
-
197
-	// et surtout pas ce mbstring.overload (has been DEPRECATED as of PHP 7.2.0, and REMOVED as of PHP 8.0.0)
198
-	if ($a = @ini_get('mbstring.func_overload')) {
199
-		$err[] = _T('install_extension_mbstring')
200
-			. "mbstring.func_overload=$a - <a href='http://www.php.net/mb_string'>mb_string</a>.<br /><small>";
201
-	}
202
-
203
-	if ($err) {
204
-		echo "<div class='error'>"
205
-			. '<h3>' . _T('avis_attention') . '</h3><p>' . _T('install_echec_annonce') . "</p><ul class='spip'>";
206
-		foreach ($err as $e) {
207
-			echo "<li><strong>$e</strong></li>\n";
208
-		}
209
-
210
-		# a priori ici on pourrait die(), mais il faut laisser la possibilite
211
-		# de forcer malgre tout (pour tester, ou si bug de detection)
212
-		echo "</ul></div>\n";
213
-	}
167
+    $err = [];
168
+
169
+    $p = phpversion();
170
+    if (version_compare($p, _PHP_MIN, '<')) {
171
+        $err[] = _T('install_php_version', ['version' => $p, 'minimum' => _PHP_MIN]);
172
+    }
173
+    if (version_compare($p, _PHP_MAX, '>')) {
174
+        $err[] = _T('install_php_version_max', ['version' => $p, 'maximum' => _PHP_MAX]);
175
+    }
176
+
177
+    $diff = array_diff(['sodium', 'xml', 'zip'], get_loaded_extensions());
178
+    if (!empty($diff)) {
179
+        $err[] = _T('install_php_extension', ['extensions' => implode(',', $diff)]);
180
+    }
181
+
182
+    // Si on n'a pas la bonne version de PHP, c'est la fin
183
+    if ($err) {
184
+        die("<div class='error'>"
185
+            . '<h3>' . _T('avis_attention') . '</h3><p>' . _T('install_echec_annonce') . "</p><ul class='spip'>"
186
+            . "<li><strong>{$err[0]}</strong></li>\n</ul></div>");
187
+    }
188
+
189
+    // Il faut une base de donnees tout de meme ...
190
+    $serveurs = install_select_serveur();
191
+    if (!$serveurs) {
192
+        $err[] = _T('install_extension_php_obligatoire')
193
+            . " <a href='http://www.php.net/mysql'>MYSQL</a>"
194
+            . "| <a href='http://www.php.net/sqlite'>SQLite</a>";
195
+    }
196
+
197
+    // et surtout pas ce mbstring.overload (has been DEPRECATED as of PHP 7.2.0, and REMOVED as of PHP 8.0.0)
198
+    if ($a = @ini_get('mbstring.func_overload')) {
199
+        $err[] = _T('install_extension_mbstring')
200
+            . "mbstring.func_overload=$a - <a href='http://www.php.net/mb_string'>mb_string</a>.<br /><small>";
201
+    }
202
+
203
+    if ($err) {
204
+        echo "<div class='error'>"
205
+            . '<h3>' . _T('avis_attention') . '</h3><p>' . _T('install_echec_annonce') . "</p><ul class='spip'>";
206
+        foreach ($err as $e) {
207
+            echo "<li><strong>$e</strong></li>\n";
208
+        }
209
+
210
+        # a priori ici on pourrait die(), mais il faut laisser la possibilite
211
+        # de forcer malgre tout (pour tester, ou si bug de detection)
212
+        echo "</ul></div>\n";
213
+    }
214 214
 }
215 215
 
216 216
 
217 217
 function info_etape($titre, $complement = '') {
218
-	return '<h2>' . $titre . "</h2>\n" .
219
-	($complement ? '' . $complement . "\n" : '');
218
+    return '<h2>' . $titre . "</h2>\n" .
219
+    ($complement ? '' . $complement . "\n" : '');
220 220
 }
221 221
 
222 222
 /**
@@ -226,148 +226,148 @@  discard block
 block discarded – undo
226 226
  * @return string Code HTML du bouton
227 227
  **/
228 228
 function bouton_suivant($code = '') {
229
-	if ($code == '') {
230
-		$code = _T('bouton_suivant');
231
-	}
232
-	static $suivant = 0;
233
-	$id = 'suivant' . (($suivant > 0) ? strval($suivant) : '');
234
-	$suivant += 1;
235
-
236
-	return "\n<p class='boutons suivant'><input id='" . $id . "' type='submit'\nvalue=\"" .
237
-	$code .
238
-	" >>\" /></p>\n";
229
+    if ($code == '') {
230
+        $code = _T('bouton_suivant');
231
+    }
232
+    static $suivant = 0;
233
+    $id = 'suivant' . (($suivant > 0) ? strval($suivant) : '');
234
+    $suivant += 1;
235
+
236
+    return "\n<p class='boutons suivant'><input id='" . $id . "' type='submit'\nvalue=\"" .
237
+    $code .
238
+    " >>\" /></p>\n";
239 239
 }
240 240
 
241 241
 function info_progression_etape($en_cours, $phase, $dir, $erreur = false) {
242
-	$intitule_etat = [];
243
-
244
-	$liste = find_all_in_path($dir, $phase . '(([0-9])+|fin)[.]php$');
245
-	$debut = 1;
246
-	$last = count($liste);
247
-
248
-	include_spip('inc/texte');
249
-	$intitule_etat['etape_'][1] = typo(_T('info_connexion_base_donnee'));
250
-	$intitule_etat['etape_'][2] = typo(_T('menu_aide_installation_choix_base'));
251
-	$intitule_etat['etape_'][3] = typo(_T('info_informations_personnelles'));
252
-	$intitule_etat['etape_'][4] = typo(_T('info_derniere_etape'));
253
-
254
-	$intitule_etat['etape_ldap'][1] = typo(_T('titre_connexion_ldap'));
255
-	$intitule_etat['etape_ldap'][2] = typo(_T('titre_connexion_ldap'));
256
-	$intitule_etat['etape_ldap'][3] = typo(_T('info_chemin_acces_1'));
257
-	$intitule_etat['etape_ldap'][4] = typo(_T('info_reglage_ldap'));
258
-	$intitule_etat['etape_ldap'][5] = typo(_T('info_ldap_ok'));
259
-
260
-	$aff_etapes = "<ul id='infos_etapes' class='infos_$phase$en_cours'>";
261
-
262
-	foreach ($liste as $etape => $fichier) {
263
-		if ($debut < $last) {
264
-			if ($debut == $en_cours && $erreur) {
265
-				$class = 'on erreur';
266
-			} else {
267
-				if ($debut == $en_cours) {
268
-					$class = 'on';
269
-				} else {
270
-					if ($debut > $en_cours) {
271
-						$class = 'prochains';
272
-					} else {
273
-						$class = 'valides';
274
-					}
275
-				}
276
-			}
277
-
278
-			$aff_etapes .= "<li class='$class'><div class='fond'>";
279
-			$aff_etapes .= '<em>' . _T('etape') . " </em><span class='numero_etape'>$debut</span><em>&nbsp;: </em>";
280
-			$aff_etapes .= '<'.(($debut == $en_cours) ? 'strong' : 'span').' class="label_etape">' . $intitule_etat["$phase"][$debut] . '</'.(($debut == $en_cours) ? 'strong' : 'span').'>';
281
-			$aff_etapes .= '</div></li>';
282
-		}
283
-		$debut++;
284
-	}
285
-	$aff_etapes .= '</ul>';
286
-
287
-	return $aff_etapes;
242
+    $intitule_etat = [];
243
+
244
+    $liste = find_all_in_path($dir, $phase . '(([0-9])+|fin)[.]php$');
245
+    $debut = 1;
246
+    $last = count($liste);
247
+
248
+    include_spip('inc/texte');
249
+    $intitule_etat['etape_'][1] = typo(_T('info_connexion_base_donnee'));
250
+    $intitule_etat['etape_'][2] = typo(_T('menu_aide_installation_choix_base'));
251
+    $intitule_etat['etape_'][3] = typo(_T('info_informations_personnelles'));
252
+    $intitule_etat['etape_'][4] = typo(_T('info_derniere_etape'));
253
+
254
+    $intitule_etat['etape_ldap'][1] = typo(_T('titre_connexion_ldap'));
255
+    $intitule_etat['etape_ldap'][2] = typo(_T('titre_connexion_ldap'));
256
+    $intitule_etat['etape_ldap'][3] = typo(_T('info_chemin_acces_1'));
257
+    $intitule_etat['etape_ldap'][4] = typo(_T('info_reglage_ldap'));
258
+    $intitule_etat['etape_ldap'][5] = typo(_T('info_ldap_ok'));
259
+
260
+    $aff_etapes = "<ul id='infos_etapes' class='infos_$phase$en_cours'>";
261
+
262
+    foreach ($liste as $etape => $fichier) {
263
+        if ($debut < $last) {
264
+            if ($debut == $en_cours && $erreur) {
265
+                $class = 'on erreur';
266
+            } else {
267
+                if ($debut == $en_cours) {
268
+                    $class = 'on';
269
+                } else {
270
+                    if ($debut > $en_cours) {
271
+                        $class = 'prochains';
272
+                    } else {
273
+                        $class = 'valides';
274
+                    }
275
+                }
276
+            }
277
+
278
+            $aff_etapes .= "<li class='$class'><div class='fond'>";
279
+            $aff_etapes .= '<em>' . _T('etape') . " </em><span class='numero_etape'>$debut</span><em>&nbsp;: </em>";
280
+            $aff_etapes .= '<'.(($debut == $en_cours) ? 'strong' : 'span').' class="label_etape">' . $intitule_etat["$phase"][$debut] . '</'.(($debut == $en_cours) ? 'strong' : 'span').'>';
281
+            $aff_etapes .= '</div></li>';
282
+        }
283
+        $debut++;
284
+    }
285
+    $aff_etapes .= '</ul>';
286
+
287
+    return $aff_etapes;
288 288
 }
289 289
 
290 290
 
291 291
 function fieldset($legend, $champs = [], $apres = '', $avant = '') {
292
-	return "<fieldset>\n" .
293
-	$avant .
294
-	($legend ? '<legend>' . $legend . "</legend>\n" : '') .
295
-	fieldset_champs($champs) .
296
-	$apres .
297
-	"</fieldset>\n";
292
+    return "<fieldset>\n" .
293
+    $avant .
294
+    ($legend ? '<legend>' . $legend . "</legend>\n" : '') .
295
+    fieldset_champs($champs) .
296
+    $apres .
297
+    "</fieldset>\n";
298 298
 }
299 299
 
300 300
 function fieldset_champs($champs = []) {
301
-	$fieldset = '';
302
-	foreach ($champs as $nom => $contenu) {
303
-		$type = isset($contenu['hidden']) ? 'hidden' : (preg_match(',^pass,', $nom) ? 'password' : 'text');
304
-		$class = isset($contenu['hidden']) ? '' : "class='formo' size='40' ";
305
-		if (isset($contenu['alternatives'])) {
306
-			$fieldset .= $contenu['label'] . "\n";
307
-			foreach ($contenu['alternatives'] as $valeur => $label) {
308
-				$fieldset .= "<input type='radio' name='" . $nom .
309
-					"' id='$nom-$valeur' value='$valeur'"
310
-					. (($valeur == $contenu['valeur']) ? "\nchecked='checked'" : '')
311
-					. "/>\n";
312
-				$fieldset .= "<label for='$nom-$valeur'>" . $label . "</label>\n";
313
-			}
314
-			$fieldset .= "<br />\n";
315
-		} else {
316
-			$fieldset .= "<label for='" . $nom . "'>" . $contenu['label'] . "</label>\n";
317
-			$fieldset .= '<input ' . $class . "type='" . $type . "' id='" . $nom . "' name='" . $nom . "'\nvalue='" . $contenu['valeur'] . "'"
318
-				. (preg_match(',^(pass|login),', $nom) ? " autocomplete='off'" : '')
319
-				. ((isset($contenu['required']) and $contenu['required']) ? " required='required'" : '')
320
-				. " />\n";
321
-		}
322
-	}
323
-
324
-	return $fieldset;
301
+    $fieldset = '';
302
+    foreach ($champs as $nom => $contenu) {
303
+        $type = isset($contenu['hidden']) ? 'hidden' : (preg_match(',^pass,', $nom) ? 'password' : 'text');
304
+        $class = isset($contenu['hidden']) ? '' : "class='formo' size='40' ";
305
+        if (isset($contenu['alternatives'])) {
306
+            $fieldset .= $contenu['label'] . "\n";
307
+            foreach ($contenu['alternatives'] as $valeur => $label) {
308
+                $fieldset .= "<input type='radio' name='" . $nom .
309
+                    "' id='$nom-$valeur' value='$valeur'"
310
+                    . (($valeur == $contenu['valeur']) ? "\nchecked='checked'" : '')
311
+                    . "/>\n";
312
+                $fieldset .= "<label for='$nom-$valeur'>" . $label . "</label>\n";
313
+            }
314
+            $fieldset .= "<br />\n";
315
+        } else {
316
+            $fieldset .= "<label for='" . $nom . "'>" . $contenu['label'] . "</label>\n";
317
+            $fieldset .= '<input ' . $class . "type='" . $type . "' id='" . $nom . "' name='" . $nom . "'\nvalue='" . $contenu['valeur'] . "'"
318
+                . (preg_match(',^(pass|login),', $nom) ? " autocomplete='off'" : '')
319
+                . ((isset($contenu['required']) and $contenu['required']) ? " required='required'" : '')
320
+                . " />\n";
321
+        }
322
+    }
323
+
324
+    return $fieldset;
325 325
 }
326 326
 
327 327
 function install_select_serveur() {
328
-	$options = [];
329
-	$dir = _DIR_RESTREINT . 'req/';
330
-	$d = opendir($dir);
331
-	if (!$d) {
332
-		return [];
333
-	}
334
-	while (($f = readdir($d)) !== false) {
335
-		if (
336
-			(preg_match('/^(.*)[.]php$/', $f, $s))
337
-			and is_readable($f = $dir . $f)
338
-		) {
339
-			require_once($f);
340
-			$s = $s[1];
341
-			$v = 'spip_versions_' . $s;
342
-			if (function_exists($v) and $v()) {
343
-				$titre = _T("install_select_type_$s");
344
-				// proposer mysql par defaut si dispo
345
-				$checked = ($s == 'mysql' ? " checked='checked'" : '');
346
-				$options[$s] = "<li><input type='radio' id='$s' value='$s' name='server_db'$checked>"
347
-					. "<label for='$s'>" . ($titre ?: $s) . '</label></li>';
348
-			} else {
349
-				spip_log("$s: portage indisponible");
350
-			}
351
-		}
352
-	}
353
-	sort($options);
354
-
355
-	return $options;
328
+    $options = [];
329
+    $dir = _DIR_RESTREINT . 'req/';
330
+    $d = opendir($dir);
331
+    if (!$d) {
332
+        return [];
333
+    }
334
+    while (($f = readdir($d)) !== false) {
335
+        if (
336
+            (preg_match('/^(.*)[.]php$/', $f, $s))
337
+            and is_readable($f = $dir . $f)
338
+        ) {
339
+            require_once($f);
340
+            $s = $s[1];
341
+            $v = 'spip_versions_' . $s;
342
+            if (function_exists($v) and $v()) {
343
+                $titre = _T("install_select_type_$s");
344
+                // proposer mysql par defaut si dispo
345
+                $checked = ($s == 'mysql' ? " checked='checked'" : '');
346
+                $options[$s] = "<li><input type='radio' id='$s' value='$s' name='server_db'$checked>"
347
+                    . "<label for='$s'>" . ($titre ?: $s) . '</label></li>';
348
+            } else {
349
+                spip_log("$s: portage indisponible");
350
+            }
351
+        }
352
+    }
353
+    sort($options);
354
+
355
+    return $options;
356 356
 }
357 357
 
358 358
 function install_connexion_form($db, $login, #[\SensitiveParameter] $pass, $predef, $hidden, $etape, $jquery = true) {
359
-	$server_db = (is_string($predef[0])) ? $predef[0] : '';
360
-
361
-	return generer_form_ecrire('install', (
362
-		"\n<input type='hidden' name='etape' value='$etape' />"
363
-		. $hidden
364
-		. (_request('echec') ?
365
-			('<p><b>' . _T('avis_connexion_echec_1') .
366
-				'</b></p><p>' . _T('avis_connexion_echec_2') . "</p><p style='font-size: small;'>" . _T('avis_connexion_echec_3') . '</p>')
367
-			: '')
368
-
369
-		. ($jquery ? http_script('', 'jquery.js') : '')
370
-		. http_script('
359
+    $server_db = (is_string($predef[0])) ? $predef[0] : '';
360
+
361
+    return generer_form_ecrire('install', (
362
+        "\n<input type='hidden' name='etape' value='$etape' />"
363
+        . $hidden
364
+        . (_request('echec') ?
365
+            ('<p><b>' . _T('avis_connexion_echec_1') .
366
+                '</b></p><p>' . _T('avis_connexion_echec_2') . "</p><p style='font-size: small;'>" . _T('avis_connexion_echec_3') . '</p>')
367
+            : '')
368
+
369
+        . ($jquery ? http_script('', 'jquery.js') : '')
370
+        . http_script('
371 371
 		jQuery(function($) {
372 372
 			$details_db = $("#install_adresse_base_hebergeur,#install_login_base_hebergeur,#install_pass_base_hebergeur");
373 373
 			$("input[type=hidden][name=server_db]").each(function(){
@@ -400,145 +400,145 @@  discard block
 block discarded – undo
400 400
 			});
401 401
 		});')
402 402
 
403
-		. ($server_db
404
-			? '<input type="hidden" name="server_db" value="' . $server_db . '" />'
405
-			. (($predef[0])
406
-				? ('<h3>' . _T('install_serveur_hebergeur') . '</h3>')
407
-				: '')
408
-			: ('<fieldset><legend>'
409
-				. _T('install_select_type_db')
410
-				. '</legend>'
411
-				. '<p class="explication">'
412
-				. _T('install_types_db_connus')
413
-				// Passer l'avertissement SQLIte en  commentaire, on pourra facilement le supprimer par la suite sans changer les traductions.
414
-				// . "<br /><small>(". _T('install_types_db_connus_avertissement') .')</small>'
415
-				. '</p>'
416
-				. "\n<div class='p'>\n<ul>\n"
417
-				. join("\n", install_select_serveur())
418
-				. "\n</ul>\n</div></fieldset>")
419
-		)
420
-		. '<div id="install_adresse_base_hebergeur">'
421
-		. '<p>' . _T('texte_connexion_mysql') . '</p>'
422
-		. ($predef[1]
423
-			? '<h3>' . _T('install_adresse_base_hebergeur') . '</h3>'
424
-			: fieldset(
425
-				_T('entree_base_donnee_1'),
426
-				[
427
-					'adresse_db' => [
428
-						'label' => $db[1],
429
-						'valeur' => $db[0]
430
-					],
431
-				]
432
-			)
433
-		)
434
-		. '</div>'
435
-
436
-		. '<div id="install_login_base_hebergeur">'
437
-		. ($predef[2]
438
-			? '<h3>' . _T('install_login_base_hebergeur') . '</h3>'
439
-			: fieldset(
440
-				_T('entree_login_connexion_1'),
441
-				[
442
-					'login_db' => [
443
-						'label' => $login[1],
444
-						'valeur' => $login[0]
445
-					],
446
-				]
447
-			)
448
-		)
449
-		. '</div>'
450
-
451
-		. '<div id="install_pass_base_hebergeur">'
452
-		. ($predef[3]
453
-			? '<h3>' . _T('install_pass_base_hebergeur') . '</h3>'
454
-			: fieldset(
455
-				_T('entree_mot_passe_1'),
456
-				[
457
-					'pass_db' => [
458
-						'label' => $pass[1],
459
-						'valeur' => $pass[0]
460
-					],
461
-				]
462
-			)
463
-		)
464
-		. '</div>'
465
-
466
-		. bouton_suivant()));
403
+        . ($server_db
404
+            ? '<input type="hidden" name="server_db" value="' . $server_db . '" />'
405
+            . (($predef[0])
406
+                ? ('<h3>' . _T('install_serveur_hebergeur') . '</h3>')
407
+                : '')
408
+            : ('<fieldset><legend>'
409
+                . _T('install_select_type_db')
410
+                . '</legend>'
411
+                . '<p class="explication">'
412
+                . _T('install_types_db_connus')
413
+                // Passer l'avertissement SQLIte en  commentaire, on pourra facilement le supprimer par la suite sans changer les traductions.
414
+                // . "<br /><small>(". _T('install_types_db_connus_avertissement') .')</small>'
415
+                . '</p>'
416
+                . "\n<div class='p'>\n<ul>\n"
417
+                . join("\n", install_select_serveur())
418
+                . "\n</ul>\n</div></fieldset>")
419
+        )
420
+        . '<div id="install_adresse_base_hebergeur">'
421
+        . '<p>' . _T('texte_connexion_mysql') . '</p>'
422
+        . ($predef[1]
423
+            ? '<h3>' . _T('install_adresse_base_hebergeur') . '</h3>'
424
+            : fieldset(
425
+                _T('entree_base_donnee_1'),
426
+                [
427
+                    'adresse_db' => [
428
+                        'label' => $db[1],
429
+                        'valeur' => $db[0]
430
+                    ],
431
+                ]
432
+            )
433
+        )
434
+        . '</div>'
435
+
436
+        . '<div id="install_login_base_hebergeur">'
437
+        . ($predef[2]
438
+            ? '<h3>' . _T('install_login_base_hebergeur') . '</h3>'
439
+            : fieldset(
440
+                _T('entree_login_connexion_1'),
441
+                [
442
+                    'login_db' => [
443
+                        'label' => $login[1],
444
+                        'valeur' => $login[0]
445
+                    ],
446
+                ]
447
+            )
448
+        )
449
+        . '</div>'
450
+
451
+        . '<div id="install_pass_base_hebergeur">'
452
+        . ($predef[3]
453
+            ? '<h3>' . _T('install_pass_base_hebergeur') . '</h3>'
454
+            : fieldset(
455
+                _T('entree_mot_passe_1'),
456
+                [
457
+                    'pass_db' => [
458
+                        'label' => $pass[1],
459
+                        'valeur' => $pass[0]
460
+                    ],
461
+                ]
462
+            )
463
+        )
464
+        . '</div>'
465
+
466
+        . bouton_suivant()));
467 467
 }
468 468
 
469 469
 // 4 valeurs qu'on reconduit d'un script a l'autre
470 470
 // sauf s'ils sont predefinis.
471 471
 
472 472
 function predef_ou_cache($adresse_db, $login_db, $pass_db, $server_db) {
473
-	return ((defined('_INSTALL_HOST_DB'))
474
-		? ''
475
-		: "\n<input type='hidden' name='adresse_db'  value=\"" . spip_htmlspecialchars($adresse_db) . '" />'
476
-	)
477
-	. ((defined('_INSTALL_USER_DB'))
478
-		? ''
479
-		: "\n<input type='hidden' name='login_db' value=\"" . spip_htmlspecialchars($login_db) . '" />'
480
-	)
481
-	. ((defined('_INSTALL_PASS_DB'))
482
-		? ''
483
-		: "\n<input type='hidden' name='pass_db' value=\"" . spip_htmlspecialchars($pass_db) . '" />'
484
-	)
485
-
486
-	. ((defined('_INSTALL_SERVER_DB'))
487
-		? ''
488
-		: "\n<input type='hidden' name='server_db' value=\"" . spip_htmlspecialchars($server_db) . '" />'
489
-	);
473
+    return ((defined('_INSTALL_HOST_DB'))
474
+        ? ''
475
+        : "\n<input type='hidden' name='adresse_db'  value=\"" . spip_htmlspecialchars($adresse_db) . '" />'
476
+    )
477
+    . ((defined('_INSTALL_USER_DB'))
478
+        ? ''
479
+        : "\n<input type='hidden' name='login_db' value=\"" . spip_htmlspecialchars($login_db) . '" />'
480
+    )
481
+    . ((defined('_INSTALL_PASS_DB'))
482
+        ? ''
483
+        : "\n<input type='hidden' name='pass_db' value=\"" . spip_htmlspecialchars($pass_db) . '" />'
484
+    )
485
+
486
+    . ((defined('_INSTALL_SERVER_DB'))
487
+        ? ''
488
+        : "\n<input type='hidden' name='server_db' value=\"" . spip_htmlspecialchars($server_db) . '" />'
489
+    );
490 490
 }
491 491
 
492 492
 // presentation des bases existantes
493 493
 
494 494
 function install_etape_liste_bases($server_db, $login_db, $disabled = []) {
495
-	$bases = $checked = [];
496
-	$noms = sql_listdbs($server_db);
497
-	if (!$noms) {
498
-		return '';
499
-	}
500
-
501
-	foreach ($noms as $nom) {
502
-		$id = spip_htmlspecialchars($nom);
503
-		$dis = in_array($nom, $disabled) ? " disabled='disabled'" : '';
504
-		$base = ' name="choix_db" value="'
505
-			. $nom
506
-			. '"'
507
-			. $dis
508
-			. " type='radio' id='$id'";
509
-		$label = "<label for='$id'>"
510
-			. ($dis ? "<i>$nom</i>" : $nom)
511
-			. '</label>';
512
-
513
-		if (
514
-			!$checked and !$dis and
515
-			(($nom == $login_db) or
516
-				($GLOBALS['table_prefix'] == $nom))
517
-		) {
518
-			$checked = "<input$base checked='checked' />\n$label";
519
-		} else {
520
-			$bases[] = "<input$base />\n$label";
521
-		}
522
-	}
523
-
524
-	if (!$bases && !$checked) {
525
-		return false;
526
-	}
527
-
528
-	if ($checked) {
529
-		array_unshift($bases, $checked);
530
-		$checked = true;
531
-	}
532
-
533
-	return [$checked, $bases];
495
+    $bases = $checked = [];
496
+    $noms = sql_listdbs($server_db);
497
+    if (!$noms) {
498
+        return '';
499
+    }
500
+
501
+    foreach ($noms as $nom) {
502
+        $id = spip_htmlspecialchars($nom);
503
+        $dis = in_array($nom, $disabled) ? " disabled='disabled'" : '';
504
+        $base = ' name="choix_db" value="'
505
+            . $nom
506
+            . '"'
507
+            . $dis
508
+            . " type='radio' id='$id'";
509
+        $label = "<label for='$id'>"
510
+            . ($dis ? "<i>$nom</i>" : $nom)
511
+            . '</label>';
512
+
513
+        if (
514
+            !$checked and !$dis and
515
+            (($nom == $login_db) or
516
+                ($GLOBALS['table_prefix'] == $nom))
517
+        ) {
518
+            $checked = "<input$base checked='checked' />\n$label";
519
+        } else {
520
+            $bases[] = "<input$base />\n$label";
521
+        }
522
+    }
523
+
524
+    if (!$bases && !$checked) {
525
+        return false;
526
+    }
527
+
528
+    if ($checked) {
529
+        array_unshift($bases, $checked);
530
+        $checked = true;
531
+    }
532
+
533
+    return [$checked, $bases];
534 534
 }
535 535
 
536 536
 function install_propager($hidden) {
537
-	$res = '';
538
-	foreach ($hidden as $k) {
539
-		$v = spip_htmlentities(_request($k));
540
-		$res .= "<input type='hidden' name='$k' value='$v' />";
541
-	}
537
+    $res = '';
538
+    foreach ($hidden as $k) {
539
+        $v = spip_htmlentities(_request($k));
540
+        $res .= "<input type='hidden' name='$k' value='$v' />";
541
+    }
542 542
 
543
-	return $res;
543
+    return $res;
544 544
 }
Please login to merge, or discard this patch.
Spacing   +39 added lines, -39 removed lines patch added patch discarded remove patch
@@ -42,7 +42,7 @@  discard block
 block discarded – undo
42 42
  * @return void
43 43
  **/
44 44
 function install_fichier_connexion($nom, $texte) {
45
-	$texte = '<' . "?php\n"
45
+	$texte = '<'."?php\n"
46 46
 		. "if (!defined(\"_ECRIRE_INC_VERSION\")) return;\n"
47 47
 		. $texte;
48 48
 
@@ -114,10 +114,10 @@  discard block
 block discarded – undo
114 114
 		return $regs;
115 115
 	} else {
116 116
 		$ar = '\s*\'([^\']*)\'';
117
-		$r = '\s*,' . $ar;
117
+		$r = '\s*,'.$ar;
118 118
 		$r = "#spip_connect_db[(]$ar$r$r$r$r(?:$r(?:$r(?:$r(?:$r)?)?)?)?#";
119 119
 		if (preg_match($r, $s, $regs)) {
120
-			$regs[2] = $regs[1] . (!$regs[2] ? '' : ':' . $regs[2] . ';');
120
+			$regs[2] = $regs[1].(!$regs[2] ? '' : ':'.$regs[2].';');
121 121
 			array_shift($regs);
122 122
 			array_shift($regs);
123 123
 
@@ -182,7 +182,7 @@  discard block
 block discarded – undo
182 182
 	// Si on n'a pas la bonne version de PHP, c'est la fin
183 183
 	if ($err) {
184 184
 		die("<div class='error'>"
185
-			. '<h3>' . _T('avis_attention') . '</h3><p>' . _T('install_echec_annonce') . "</p><ul class='spip'>"
185
+			. '<h3>'._T('avis_attention').'</h3><p>'._T('install_echec_annonce')."</p><ul class='spip'>"
186 186
 			. "<li><strong>{$err[0]}</strong></li>\n</ul></div>");
187 187
 	}
188 188
 
@@ -202,7 +202,7 @@  discard block
 block discarded – undo
202 202
 
203 203
 	if ($err) {
204 204
 		echo "<div class='error'>"
205
-			. '<h3>' . _T('avis_attention') . '</h3><p>' . _T('install_echec_annonce') . "</p><ul class='spip'>";
205
+			. '<h3>'._T('avis_attention').'</h3><p>'._T('install_echec_annonce')."</p><ul class='spip'>";
206 206
 		foreach ($err as $e) {
207 207
 			echo "<li><strong>$e</strong></li>\n";
208 208
 		}
@@ -215,8 +215,8 @@  discard block
 block discarded – undo
215 215
 
216 216
 
217 217
 function info_etape($titre, $complement = '') {
218
-	return '<h2>' . $titre . "</h2>\n" .
219
-	($complement ? '' . $complement . "\n" : '');
218
+	return '<h2>'.$titre."</h2>\n".
219
+	($complement ? ''.$complement."\n" : '');
220 220
 }
221 221
 
222 222
 /**
@@ -230,18 +230,18 @@  discard block
 block discarded – undo
230 230
 		$code = _T('bouton_suivant');
231 231
 	}
232 232
 	static $suivant = 0;
233
-	$id = 'suivant' . (($suivant > 0) ? strval($suivant) : '');
233
+	$id = 'suivant'.(($suivant > 0) ? strval($suivant) : '');
234 234
 	$suivant += 1;
235 235
 
236
-	return "\n<p class='boutons suivant'><input id='" . $id . "' type='submit'\nvalue=\"" .
237
-	$code .
236
+	return "\n<p class='boutons suivant'><input id='".$id."' type='submit'\nvalue=\"".
237
+	$code.
238 238
 	" >>\" /></p>\n";
239 239
 }
240 240
 
241 241
 function info_progression_etape($en_cours, $phase, $dir, $erreur = false) {
242 242
 	$intitule_etat = [];
243 243
 
244
-	$liste = find_all_in_path($dir, $phase . '(([0-9])+|fin)[.]php$');
244
+	$liste = find_all_in_path($dir, $phase.'(([0-9])+|fin)[.]php$');
245 245
 	$debut = 1;
246 246
 	$last = count($liste);
247 247
 
@@ -276,8 +276,8 @@  discard block
 block discarded – undo
276 276
 			}
277 277
 
278 278
 			$aff_etapes .= "<li class='$class'><div class='fond'>";
279
-			$aff_etapes .= '<em>' . _T('etape') . " </em><span class='numero_etape'>$debut</span><em>&nbsp;: </em>";
280
-			$aff_etapes .= '<'.(($debut == $en_cours) ? 'strong' : 'span').' class="label_etape">' . $intitule_etat["$phase"][$debut] . '</'.(($debut == $en_cours) ? 'strong' : 'span').'>';
279
+			$aff_etapes .= '<em>'._T('etape')." </em><span class='numero_etape'>$debut</span><em>&nbsp;: </em>";
280
+			$aff_etapes .= '<'.(($debut == $en_cours) ? 'strong' : 'span').' class="label_etape">'.$intitule_etat["$phase"][$debut].'</'.(($debut == $en_cours) ? 'strong' : 'span').'>';
281 281
 			$aff_etapes .= '</div></li>';
282 282
 		}
283 283
 		$debut++;
@@ -289,11 +289,11 @@  discard block
 block discarded – undo
289 289
 
290 290
 
291 291
 function fieldset($legend, $champs = [], $apres = '', $avant = '') {
292
-	return "<fieldset>\n" .
293
-	$avant .
294
-	($legend ? '<legend>' . $legend . "</legend>\n" : '') .
295
-	fieldset_champs($champs) .
296
-	$apres .
292
+	return "<fieldset>\n".
293
+	$avant.
294
+	($legend ? '<legend>'.$legend."</legend>\n" : '').
295
+	fieldset_champs($champs).
296
+	$apres.
297 297
 	"</fieldset>\n";
298 298
 }
299 299
 
@@ -303,18 +303,18 @@  discard block
 block discarded – undo
303 303
 		$type = isset($contenu['hidden']) ? 'hidden' : (preg_match(',^pass,', $nom) ? 'password' : 'text');
304 304
 		$class = isset($contenu['hidden']) ? '' : "class='formo' size='40' ";
305 305
 		if (isset($contenu['alternatives'])) {
306
-			$fieldset .= $contenu['label'] . "\n";
306
+			$fieldset .= $contenu['label']."\n";
307 307
 			foreach ($contenu['alternatives'] as $valeur => $label) {
308
-				$fieldset .= "<input type='radio' name='" . $nom .
308
+				$fieldset .= "<input type='radio' name='".$nom.
309 309
 					"' id='$nom-$valeur' value='$valeur'"
310 310
 					. (($valeur == $contenu['valeur']) ? "\nchecked='checked'" : '')
311 311
 					. "/>\n";
312
-				$fieldset .= "<label for='$nom-$valeur'>" . $label . "</label>\n";
312
+				$fieldset .= "<label for='$nom-$valeur'>".$label."</label>\n";
313 313
 			}
314 314
 			$fieldset .= "<br />\n";
315 315
 		} else {
316
-			$fieldset .= "<label for='" . $nom . "'>" . $contenu['label'] . "</label>\n";
317
-			$fieldset .= '<input ' . $class . "type='" . $type . "' id='" . $nom . "' name='" . $nom . "'\nvalue='" . $contenu['valeur'] . "'"
316
+			$fieldset .= "<label for='".$nom."'>".$contenu['label']."</label>\n";
317
+			$fieldset .= '<input '.$class."type='".$type."' id='".$nom."' name='".$nom."'\nvalue='".$contenu['valeur']."'"
318 318
 				. (preg_match(',^(pass|login),', $nom) ? " autocomplete='off'" : '')
319 319
 				. ((isset($contenu['required']) and $contenu['required']) ? " required='required'" : '')
320 320
 				. " />\n";
@@ -326,7 +326,7 @@  discard block
 block discarded – undo
326 326
 
327 327
 function install_select_serveur() {
328 328
 	$options = [];
329
-	$dir = _DIR_RESTREINT . 'req/';
329
+	$dir = _DIR_RESTREINT.'req/';
330 330
 	$d = opendir($dir);
331 331
 	if (!$d) {
332 332
 		return [];
@@ -334,17 +334,17 @@  discard block
 block discarded – undo
334 334
 	while (($f = readdir($d)) !== false) {
335 335
 		if (
336 336
 			(preg_match('/^(.*)[.]php$/', $f, $s))
337
-			and is_readable($f = $dir . $f)
337
+			and is_readable($f = $dir.$f)
338 338
 		) {
339 339
 			require_once($f);
340 340
 			$s = $s[1];
341
-			$v = 'spip_versions_' . $s;
341
+			$v = 'spip_versions_'.$s;
342 342
 			if (function_exists($v) and $v()) {
343 343
 				$titre = _T("install_select_type_$s");
344 344
 				// proposer mysql par defaut si dispo
345 345
 				$checked = ($s == 'mysql' ? " checked='checked'" : '');
346 346
 				$options[$s] = "<li><input type='radio' id='$s' value='$s' name='server_db'$checked>"
347
-					. "<label for='$s'>" . ($titre ?: $s) . '</label></li>';
347
+					. "<label for='$s'>".($titre ?: $s).'</label></li>';
348 348
 			} else {
349 349
 				spip_log("$s: portage indisponible");
350 350
 			}
@@ -362,8 +362,8 @@  discard block
 block discarded – undo
362 362
 		"\n<input type='hidden' name='etape' value='$etape' />"
363 363
 		. $hidden
364 364
 		. (_request('echec') ?
365
-			('<p><b>' . _T('avis_connexion_echec_1') .
366
-				'</b></p><p>' . _T('avis_connexion_echec_2') . "</p><p style='font-size: small;'>" . _T('avis_connexion_echec_3') . '</p>')
365
+			('<p><b>'._T('avis_connexion_echec_1').
366
+				'</b></p><p>'._T('avis_connexion_echec_2')."</p><p style='font-size: small;'>"._T('avis_connexion_echec_3').'</p>')
367 367
 			: '')
368 368
 
369 369
 		. ($jquery ? http_script('', 'jquery.js') : '')
@@ -401,9 +401,9 @@  discard block
 block discarded – undo
401 401
 		});')
402 402
 
403 403
 		. ($server_db
404
-			? '<input type="hidden" name="server_db" value="' . $server_db . '" />'
404
+			? '<input type="hidden" name="server_db" value="'.$server_db.'" />'
405 405
 			. (($predef[0])
406
-				? ('<h3>' . _T('install_serveur_hebergeur') . '</h3>')
406
+				? ('<h3>'._T('install_serveur_hebergeur').'</h3>')
407 407
 				: '')
408 408
 			: ('<fieldset><legend>'
409 409
 				. _T('install_select_type_db')
@@ -418,9 +418,9 @@  discard block
 block discarded – undo
418 418
 				. "\n</ul>\n</div></fieldset>")
419 419
 		)
420 420
 		. '<div id="install_adresse_base_hebergeur">'
421
-		. '<p>' . _T('texte_connexion_mysql') . '</p>'
421
+		. '<p>'._T('texte_connexion_mysql').'</p>'
422 422
 		. ($predef[1]
423
-			? '<h3>' . _T('install_adresse_base_hebergeur') . '</h3>'
423
+			? '<h3>'._T('install_adresse_base_hebergeur').'</h3>'
424 424
 			: fieldset(
425 425
 				_T('entree_base_donnee_1'),
426 426
 				[
@@ -435,7 +435,7 @@  discard block
 block discarded – undo
435 435
 
436 436
 		. '<div id="install_login_base_hebergeur">'
437 437
 		. ($predef[2]
438
-			? '<h3>' . _T('install_login_base_hebergeur') . '</h3>'
438
+			? '<h3>'._T('install_login_base_hebergeur').'</h3>'
439 439
 			: fieldset(
440 440
 				_T('entree_login_connexion_1'),
441 441
 				[
@@ -450,7 +450,7 @@  discard block
 block discarded – undo
450 450
 
451 451
 		. '<div id="install_pass_base_hebergeur">'
452 452
 		. ($predef[3]
453
-			? '<h3>' . _T('install_pass_base_hebergeur') . '</h3>'
453
+			? '<h3>'._T('install_pass_base_hebergeur').'</h3>'
454 454
 			: fieldset(
455 455
 				_T('entree_mot_passe_1'),
456 456
 				[
@@ -472,20 +472,20 @@  discard block
 block discarded – undo
472 472
 function predef_ou_cache($adresse_db, $login_db, $pass_db, $server_db) {
473 473
 	return ((defined('_INSTALL_HOST_DB'))
474 474
 		? ''
475
-		: "\n<input type='hidden' name='adresse_db'  value=\"" . spip_htmlspecialchars($adresse_db) . '" />'
475
+		: "\n<input type='hidden' name='adresse_db'  value=\"".spip_htmlspecialchars($adresse_db).'" />'
476 476
 	)
477 477
 	. ((defined('_INSTALL_USER_DB'))
478 478
 		? ''
479
-		: "\n<input type='hidden' name='login_db' value=\"" . spip_htmlspecialchars($login_db) . '" />'
479
+		: "\n<input type='hidden' name='login_db' value=\"".spip_htmlspecialchars($login_db).'" />'
480 480
 	)
481 481
 	. ((defined('_INSTALL_PASS_DB'))
482 482
 		? ''
483
-		: "\n<input type='hidden' name='pass_db' value=\"" . spip_htmlspecialchars($pass_db) . '" />'
483
+		: "\n<input type='hidden' name='pass_db' value=\"".spip_htmlspecialchars($pass_db).'" />'
484 484
 	)
485 485
 
486 486
 	. ((defined('_INSTALL_SERVER_DB'))
487 487
 		? ''
488
-		: "\n<input type='hidden' name='server_db' value=\"" . spip_htmlspecialchars($server_db) . '" />'
488
+		: "\n<input type='hidden' name='server_db' value=\"".spip_htmlspecialchars($server_db).'" />'
489 489
 	);
490 490
 }
491 491
 
Please login to merge, or discard this patch.
ecrire/src/Afficher/Minipage/Page.php 1 patch
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -16,5 +16,5 @@
 block discarded – undo
16 16
  * Présentation des pages simplifiées publiques pour envoyer un message à un utilisateur
17 17
  **/
18 18
 class Page extends AbstractPage {
19
-	public const TYPE = 'public';
19
+    public const TYPE = 'public';
20 20
 }
Please login to merge, or discard this patch.
ecrire/src/Afficher/Minipage/Installation.php 1 patch
Indentation   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -16,23 +16,23 @@
 block discarded – undo
16 16
  **/
17 17
 class Installation extends Admin {
18 18
 
19
-	public const TYPE = 'installation';
19
+    public const TYPE = 'installation';
20 20
 
21
-	protected function setOptions(array $options) {
22
-		$options['titre'] ??= '';
23
-		if (!$options['titre'] or $options['titre'] === 'AUTO') {
24
-			$options['titre'] = _T('info_installation_systeme_publication');
25
-		}
26
-		$options = parent::setOptions($options);
27
-		$options['couleur_fond'] = '#a1124d';
28
-		$options['css_files'][] = find_in_theme('installation.css');
29
-		$options['footer'] = '';
30
-		return $options;
31
-	}
21
+    protected function setOptions(array $options) {
22
+        $options['titre'] ??= '';
23
+        if (!$options['titre'] or $options['titre'] === 'AUTO') {
24
+            $options['titre'] = _T('info_installation_systeme_publication');
25
+        }
26
+        $options = parent::setOptions($options);
27
+        $options['couleur_fond'] = '#a1124d';
28
+        $options['css_files'][] = find_in_theme('installation.css');
29
+        $options['footer'] = '';
30
+        return $options;
31
+    }
32 32
 
33
-	public function page($corps = '', $options = []) {
34
-		$options['titre'] ??= 'AUTO';
35
-		return parent::page($corps, $options);
36
-	}
33
+    public function page($corps = '', $options = []) {
34
+        $options['titre'] ??= 'AUTO';
35
+        return parent::page($corps, $options);
36
+    }
37 37
 
38 38
 }
Please login to merge, or discard this patch.
ecrire/src/Afficher/Minipage/Admin.php 3 patches
Indentation   +142 added lines, -142 removed lines patch added patch discarded remove patch
@@ -16,147 +16,147 @@
 block discarded – undo
16 16
  * Présentation des pages simplifiées d’admin pour envoyer un message à un utilisateur
17 17
  **/
18 18
 class Admin extends Page {
19
-	public const TYPE = 'admin';
20
-	protected function setOptions(array $options) {
21
-		$options['couleur_fond'] = '#999';
22
-		if (empty($options['css_files'])) {
23
-			$options['css_files'] = [];
24
-		}
25
-		array_unshift($options['css_files'], find_in_theme('minipres.css'));
26
-
27
-		$options['page_title'] = ($options['titre'] ?? '');
28
-
29
-		return $options;
30
-	}
31
-
32
-
33
-	/**
34
-	 * Retourne le début d'une page HTML minimale (de type installation ou erreur)
35
-	 *
36
-	 * @param array $options
37
-	 * @return string
38
-	 *    Code HTML
39
-	 */
40
-	public function installDebutPage($options = []) {
41
-
42
-		$options = $this->setOptions($options);
43
-		return parent::ouvreBody($options)
44
-			. parent::ouvreCorps($options);
45
-	}
46
-
47
-	/**
48
-	 * Retourne le fin d'une page HTML minimale (de type installation ou erreur)
49
-	 *
50
-	 * @param array $options
51
-	 * @return string
52
-	 *    Code HTML
53
-	 */
54
-	public function installFinPage($options = []) {
55
-
56
-		$options = $this->setOptions($options);
57
-		return parent::fermeCorps($options)
58
-			. parent::fermeBody();
59
-	}
60
-
61
-
62
-	/**
63
-	 * Retourne une page HTML contenant, dans une présentation minimale,
64
-	 * le contenu transmis dans `$corps`.
65
-	 *
66
-	 * Appelée pour afficher un message d’erreur (l’utilisateur n’a pas
67
-	 * accès à cette page par exemple).
68
-	 *
69
-	 * Lorsqu’aucun argument n’est transmis, un header 403 est renvoyé,
70
-	 * ainsi qu’un message indiquant une interdiction d’accès.
71
-	 *
72
-	 * @param string $corps
73
-	 *   Corps de la page
74
-	 * @param array $options
75
-	 * @return string
76
-	 *   HTML de la page
77
-	 * @see  ouvreBody()
78
-	 *   string $titre : Titre à l'affichage (différent de $page_title)
79
-	 *   int $status : status de la page
80
-	 *   string $footer : pied de la box en remplacement du bouton retour par défaut
81
-	 * @uses ouvreBody()
82
-	 * @uses fermeBody()
83
-	 *
84
-	 */
85
-	public function page($corps = '', $options = []) {
86
-
87
-		$footer = '';
88
-
89
-		$titre = $options['titre'] ?? '';
90
-		if (!$titre) {
91
-			if (empty($corps) and !isset($options['status'])) {
92
-				$options['status'] = 403;
93
-			}
94
-
95
-			if (
96
-				!$titre = _request('action')
97
-				and !$titre = _request('exec')
98
-				and !$titre = _request('page')
99
-			) {
100
-				$titre = '?';
101
-			}
102
-
103
-			$titre = spip_htmlspecialchars($titre);
104
-
105
-			$titre = ($titre == 'install')
106
-				? _T('avis_espace_interdit')
107
-				: $titre . '&nbsp;: ' . _T('info_acces_interdit');
108
-
109
-			$statut = $GLOBALS['visiteur_session']['statut'] ?? '';
110
-			$nom = $GLOBALS['visiteur_session']['nom'] ?? '';
111
-
112
-			if ($statut != '0minirezo') {
113
-				$titre = _T('info_acces_interdit');
114
-			}
115
-
116
-			if ($statut and test_espace_prive()) {
117
-				$footer = bouton_action(_T('public:accueil_site'), generer_url_ecrire('accueil'));
118
-			}
119
-			elseif (!empty($_COOKIE['spip_admin'])) {
120
-				$footer = bouton_action(_T('public:lien_connecter'), generer_url_public('login'));
121
-			}
122
-			else {
123
-				$footer = bouton_action(_T('public:accueil_site'), $GLOBALS['meta']['adresse_site'] ?? '');
124
-			}
125
-
126
-			spip_log($nom . " $titre " . $_SERVER['REQUEST_URI'], 'minipres');
127
-
128
-			$options['footer'] = $footer;
129
-			if (empty($corps)) {
130
-				$corps = "<div class='msg-alert error'>"
131
-					. $titre
132
-					. "</div>";
133
-				$options['titre'] = '';
134
-			}
135
-			else {
136
-				$options['titre'] = $titre;
137
-			}
138
-		}
139
-		else {
140
-			$options['titre'] = $titre;
141
-		}
142
-		$options['page_title'] = $titre;
143
-
144
-		$options = $this->setOptions($options);
145
-
146
-		$html = parent::page($corps, $options);
147
-
148
-		if (!_AJAX) {
149
-			return $html;
150
-		} else {
151
-			include_spip('inc/headers');
152
-			include_spip('inc/actions');
153
-			$url = self('&', true);
154
-			foreach ($_POST as $v => $c) {
155
-				$url = parametre_url($url, $v, $c, '&');
156
-			}
157
-			ajax_retour('<div>' . $titre . redirige_formulaire($url) . '</div>', false);
158
-			return '';
159
-		}
160
-	}
19
+    public const TYPE = 'admin';
20
+    protected function setOptions(array $options) {
21
+        $options['couleur_fond'] = '#999';
22
+        if (empty($options['css_files'])) {
23
+            $options['css_files'] = [];
24
+        }
25
+        array_unshift($options['css_files'], find_in_theme('minipres.css'));
26
+
27
+        $options['page_title'] = ($options['titre'] ?? '');
28
+
29
+        return $options;
30
+    }
31
+
32
+
33
+    /**
34
+     * Retourne le début d'une page HTML minimale (de type installation ou erreur)
35
+     *
36
+     * @param array $options
37
+     * @return string
38
+     *    Code HTML
39
+     */
40
+    public function installDebutPage($options = []) {
41
+
42
+        $options = $this->setOptions($options);
43
+        return parent::ouvreBody($options)
44
+            . parent::ouvreCorps($options);
45
+    }
46
+
47
+    /**
48
+     * Retourne le fin d'une page HTML minimale (de type installation ou erreur)
49
+     *
50
+     * @param array $options
51
+     * @return string
52
+     *    Code HTML
53
+     */
54
+    public function installFinPage($options = []) {
55
+
56
+        $options = $this->setOptions($options);
57
+        return parent::fermeCorps($options)
58
+            . parent::fermeBody();
59
+    }
60
+
61
+
62
+    /**
63
+     * Retourne une page HTML contenant, dans une présentation minimale,
64
+     * le contenu transmis dans `$corps`.
65
+     *
66
+     * Appelée pour afficher un message d’erreur (l’utilisateur n’a pas
67
+     * accès à cette page par exemple).
68
+     *
69
+     * Lorsqu’aucun argument n’est transmis, un header 403 est renvoyé,
70
+     * ainsi qu’un message indiquant une interdiction d’accès.
71
+     *
72
+     * @param string $corps
73
+     *   Corps de la page
74
+     * @param array $options
75
+     * @return string
76
+     *   HTML de la page
77
+     * @see  ouvreBody()
78
+     *   string $titre : Titre à l'affichage (différent de $page_title)
79
+     *   int $status : status de la page
80
+     *   string $footer : pied de la box en remplacement du bouton retour par défaut
81
+     * @uses ouvreBody()
82
+     * @uses fermeBody()
83
+     *
84
+     */
85
+    public function page($corps = '', $options = []) {
86
+
87
+        $footer = '';
88
+
89
+        $titre = $options['titre'] ?? '';
90
+        if (!$titre) {
91
+            if (empty($corps) and !isset($options['status'])) {
92
+                $options['status'] = 403;
93
+            }
94
+
95
+            if (
96
+                !$titre = _request('action')
97
+                and !$titre = _request('exec')
98
+                and !$titre = _request('page')
99
+            ) {
100
+                $titre = '?';
101
+            }
102
+
103
+            $titre = spip_htmlspecialchars($titre);
104
+
105
+            $titre = ($titre == 'install')
106
+                ? _T('avis_espace_interdit')
107
+                : $titre . '&nbsp;: ' . _T('info_acces_interdit');
108
+
109
+            $statut = $GLOBALS['visiteur_session']['statut'] ?? '';
110
+            $nom = $GLOBALS['visiteur_session']['nom'] ?? '';
111
+
112
+            if ($statut != '0minirezo') {
113
+                $titre = _T('info_acces_interdit');
114
+            }
115
+
116
+            if ($statut and test_espace_prive()) {
117
+                $footer = bouton_action(_T('public:accueil_site'), generer_url_ecrire('accueil'));
118
+            }
119
+            elseif (!empty($_COOKIE['spip_admin'])) {
120
+                $footer = bouton_action(_T('public:lien_connecter'), generer_url_public('login'));
121
+            }
122
+            else {
123
+                $footer = bouton_action(_T('public:accueil_site'), $GLOBALS['meta']['adresse_site'] ?? '');
124
+            }
125
+
126
+            spip_log($nom . " $titre " . $_SERVER['REQUEST_URI'], 'minipres');
127
+
128
+            $options['footer'] = $footer;
129
+            if (empty($corps)) {
130
+                $corps = "<div class='msg-alert error'>"
131
+                    . $titre
132
+                    . "</div>";
133
+                $options['titre'] = '';
134
+            }
135
+            else {
136
+                $options['titre'] = $titre;
137
+            }
138
+        }
139
+        else {
140
+            $options['titre'] = $titre;
141
+        }
142
+        $options['page_title'] = $titre;
143
+
144
+        $options = $this->setOptions($options);
145
+
146
+        $html = parent::page($corps, $options);
147
+
148
+        if (!_AJAX) {
149
+            return $html;
150
+        } else {
151
+            include_spip('inc/headers');
152
+            include_spip('inc/actions');
153
+            $url = self('&', true);
154
+            foreach ($_POST as $v => $c) {
155
+                $url = parametre_url($url, $v, $c, '&');
156
+            }
157
+            ajax_retour('<div>' . $titre . redirige_formulaire($url) . '</div>', false);
158
+            return '';
159
+        }
160
+    }
161 161
 
162 162
 }
Please login to merge, or discard this patch.
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -104,7 +104,7 @@  discard block
 block discarded – undo
104 104
 
105 105
 			$titre = ($titre == 'install')
106 106
 				? _T('avis_espace_interdit')
107
-				: $titre . '&nbsp;: ' . _T('info_acces_interdit');
107
+				: $titre.'&nbsp;: '._T('info_acces_interdit');
108 108
 
109 109
 			$statut = $GLOBALS['visiteur_session']['statut'] ?? '';
110 110
 			$nom = $GLOBALS['visiteur_session']['nom'] ?? '';
@@ -123,7 +123,7 @@  discard block
 block discarded – undo
123 123
 				$footer = bouton_action(_T('public:accueil_site'), $GLOBALS['meta']['adresse_site'] ?? '');
124 124
 			}
125 125
 
126
-			spip_log($nom . " $titre " . $_SERVER['REQUEST_URI'], 'minipres');
126
+			spip_log($nom." $titre ".$_SERVER['REQUEST_URI'], 'minipres');
127 127
 
128 128
 			$options['footer'] = $footer;
129 129
 			if (empty($corps)) {
@@ -154,7 +154,7 @@  discard block
 block discarded – undo
154 154
 			foreach ($_POST as $v => $c) {
155 155
 				$url = parametre_url($url, $v, $c, '&');
156 156
 			}
157
-			ajax_retour('<div>' . $titre . redirige_formulaire($url) . '</div>', false);
157
+			ajax_retour('<div>'.$titre.redirige_formulaire($url).'</div>', false);
158 158
 			return '';
159 159
 		}
160 160
 	}
Please login to merge, or discard this patch.
Braces   +4 added lines, -8 removed lines patch added patch discarded remove patch
@@ -115,11 +115,9 @@  discard block
 block discarded – undo
115 115
 
116 116
 			if ($statut and test_espace_prive()) {
117 117
 				$footer = bouton_action(_T('public:accueil_site'), generer_url_ecrire('accueil'));
118
-			}
119
-			elseif (!empty($_COOKIE['spip_admin'])) {
118
+			} elseif (!empty($_COOKIE['spip_admin'])) {
120 119
 				$footer = bouton_action(_T('public:lien_connecter'), generer_url_public('login'));
121
-			}
122
-			else {
120
+			} else {
123 121
 				$footer = bouton_action(_T('public:accueil_site'), $GLOBALS['meta']['adresse_site'] ?? '');
124 122
 			}
125 123
 
@@ -131,12 +129,10 @@  discard block
 block discarded – undo
131 129
 					. $titre
132 130
 					. "</div>";
133 131
 				$options['titre'] = '';
134
-			}
135
-			else {
132
+			} else {
136 133
 				$options['titre'] = $titre;
137 134
 			}
138
-		}
139
-		else {
135
+		} else {
140 136
 			$options['titre'] = $titre;
141 137
 		}
142 138
 		$options['page_title'] = $titre;
Please login to merge, or discard this patch.