Completed
Push — master ( 0dc181...9db7a9 )
by cam
04:22
created
ecrire/inc/install.php 1 patch
Indentation   +354 added lines, -354 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
 
@@ -43,12 +43,12 @@  discard block
 block discarded – undo
43 43
  * @return void
44 44
  **/
45 45
 function install_fichier_connexion($nom, $texte) {
46
-	$texte = "<" . "?php\n"
47
-		. "if (!defined(\"_ECRIRE_INC_VERSION\")) return;\n"
48
-		. $texte
49
-		. "?" . ">";
46
+    $texte = "<" . "?php\n"
47
+        . "if (!defined(\"_ECRIRE_INC_VERSION\")) return;\n"
48
+        . $texte
49
+        . "?" . ">";
50 50
 
51
-	ecrire_fichier($nom, $texte);
51
+    ecrire_fichier($nom, $texte);
52 52
 }
53 53
 
54 54
 
@@ -77,20 +77,20 @@  discard block
 block discarded – undo
77 77
  *
78 78
  **/
79 79
 function install_connexion($adr, $port, $login, $pass, $base, $type, $pref, $ldap = '', $charset = '') {
80
-	$adr = addcslashes($adr, "'\\");
81
-	$port = addcslashes($port, "'\\");
82
-	$login = addcslashes($login, "'\\");
83
-	$pass = addcslashes($pass, "'\\");
84
-	$base = addcslashes($base, "'\\");
85
-	$type = addcslashes($type, "'\\");
86
-	$pref = addcslashes($pref, "'\\");
87
-	$ldap = addcslashes($ldap, "'\\");
88
-	$charset = addcslashes($charset, "'\\");
89
-
90
-	return "\$GLOBALS['spip_connect_version'] = 0.8;\n"
91
-	. "spip_connect_db("
92
-	. "'$adr','$port','$login','$pass','$base'"
93
-	. ",'$type', '$pref','$ldap','$charset');\n";
80
+    $adr = addcslashes($adr, "'\\");
81
+    $port = addcslashes($port, "'\\");
82
+    $login = addcslashes($login, "'\\");
83
+    $pass = addcslashes($pass, "'\\");
84
+    $base = addcslashes($base, "'\\");
85
+    $type = addcslashes($type, "'\\");
86
+    $pref = addcslashes($pref, "'\\");
87
+    $ldap = addcslashes($ldap, "'\\");
88
+    $charset = addcslashes($charset, "'\\");
89
+
90
+    return "\$GLOBALS['spip_connect_version'] = 0.8;\n"
91
+    . "spip_connect_db("
92
+    . "'$adr','$port','$login','$pass','$base'"
93
+    . ",'$type', '$pref','$ldap','$charset');\n";
94 94
 }
95 95
 
96 96
 
@@ -106,26 +106,26 @@  discard block
 block discarded – undo
106 106
  *     Tableau des informations sur la connexion
107 107
  **/
108 108
 function analyse_fichier_connection($file) {
109
-	$s = @join('', file($file));
110
-	if (preg_match("#mysql_connect\([\"'](.*)[\"'],[\"'](.*)[\"'],[\"'](.*)[\"']\)#", $s, $regs)) {
111
-		array_shift($regs);
112
-
113
-		return $regs;
114
-	} else {
115
-		$ar = '\s*\'([^\']*)\'';
116
-		$r = '\s*,' . $ar;
117
-		$r = "#spip_connect_db[(]$ar$r$r$r$r(?:$r(?:$r(?:$r(?:$r)?)?)?)?#";
118
-		if (preg_match($r, $s, $regs)) {
119
-			$regs[2] = $regs[1] . (!$regs[2] ? '' : ":" . $regs[2] . ";");
120
-			array_shift($regs);
121
-			array_shift($regs);
122
-
123
-			return $regs;
124
-		}
125
-	}
126
-	spip_log("$file n'est pas un fichier de connexion");
127
-
128
-	return array();
109
+    $s = @join('', file($file));
110
+    if (preg_match("#mysql_connect\([\"'](.*)[\"'],[\"'](.*)[\"'],[\"'](.*)[\"']\)#", $s, $regs)) {
111
+        array_shift($regs);
112
+
113
+        return $regs;
114
+    } else {
115
+        $ar = '\s*\'([^\']*)\'';
116
+        $r = '\s*,' . $ar;
117
+        $r = "#spip_connect_db[(]$ar$r$r$r$r(?:$r(?:$r(?:$r(?:$r)?)?)?)?#";
118
+        if (preg_match($r, $s, $regs)) {
119
+            $regs[2] = $regs[1] . (!$regs[2] ? '' : ":" . $regs[2] . ";");
120
+            array_shift($regs);
121
+            array_shift($regs);
122
+
123
+            return $regs;
124
+        }
125
+    }
126
+    spip_log("$file n'est pas un fichier de connexion");
127
+
128
+    return array();
129 129
 }
130 130
 
131 131
 /**
@@ -142,21 +142,21 @@  discard block
 block discarded – undo
142 142
  *     Liste des noms de connecteurs
143 143
  **/
144 144
 function bases_referencees($exclu = '') {
145
-	$tables = array();
146
-	foreach (preg_files(_DIR_CONNECT, '.php$') as $f) {
147
-		if ($f != $exclu and analyse_fichier_connection($f)) {
148
-			$tables[] = basename($f, '.php');
149
-		}
150
-	}
151
-
152
-	return $tables;
145
+    $tables = array();
146
+    foreach (preg_files(_DIR_CONNECT, '.php$') as $f) {
147
+        if ($f != $exclu and analyse_fichier_connection($f)) {
148
+            $tables[] = basename($f, '.php');
149
+        }
150
+    }
151
+
152
+    return $tables;
153 153
 }
154 154
 
155 155
 
156 156
 function install_mode_appel($server_db, $tout = true) {
157
-	return ($server_db != 'mysql') ? ''
158
-		: (($tout ? test_rappel_nom_base_mysql($server_db) : '')
159
-			. test_sql_mode_mysql($server_db));
157
+    return ($server_db != 'mysql') ? ''
158
+        : (($tout ? test_rappel_nom_base_mysql($server_db) : '')
159
+            . test_sql_mode_mysql($server_db));
160 160
 }
161 161
 
162 162
 //
@@ -164,52 +164,52 @@  discard block
 block discarded – undo
164 164
 // (sert a l'etape 1 de l'installation)
165 165
 // http://code.spip.net/@tester_compatibilite_hebergement
166 166
 function tester_compatibilite_hebergement() {
167
-	$err = array();
168
-
169
-	$p = phpversion();
170
-	if (version_compare($p, _PHP_MIN, '<')) {
171
-		$err[] = _T('install_php_version', array('version' => $p, 'minimum' => _PHP_MIN));
172
-	}
173
-
174
-	// Si on n'a pas la bonne version de PHP, c'est la fin
175
-	if ($err) {
176
-		die("<div class='error'>"
177
-			. "<h3>" . _T('avis_attention') . '</h3><p>' . _T('install_echec_annonce') . "</p><ul class='spip'>"
178
-			. "<li><strong>{$err[0]}</strong></li>\n</ul></div>");
179
-	}
180
-
181
-	// Il faut une base de donnees tout de meme ...
182
-	$serveurs = install_select_serveur();
183
-	if (!$serveurs) {
184
-		$err[] = _T('install_extension_php_obligatoire')
185
-			. " <a href='http://www.php.net/mysql'>MYSQL</a>"
186
-			. "| <a href='http://www.php.net/pgsql'>PostgreSQL</a>"
187
-			. "| <a href='http://www.php.net/sqlite'>SQLite</a>";
188
-	}
189
-
190
-	// et il faut preg
191
-	if (!function_exists('preg_match_all')) {
192
-		$err[] = _T('install_extension_php_obligatoire')
193
-			. " <a href='http://se.php.net/pcre'>PCRE</a>";
194
-	}
195
-
196
-	// et surtout pas ce mbstring.overload
197
-	if ($a = @ini_get('mbstring.func_overload')) {
198
-		$err[] = _T('install_extension_mbstring')
199
-			. "mbstring.func_overload=$a - <a href='http://www.php.net/mb_string'>mb_string</a>.<br /><small>";
200
-	}
201
-
202
-	if ($err) {
203
-		echo "<div class='error'>"
204
-			. "<h3>" . _T('avis_attention') . '</h3><p>' . _T('install_echec_annonce') . "</p><ul class='spip'>";
205
-		foreach ($err as $e) {
206
-			echo "<li><strong>$e</strong></li>\n";
207
-		}
208
-
209
-		# a priori ici on pourrait die(), mais il faut laisser la possibilite
210
-		# de forcer malgre tout (pour tester, ou si bug de detection)
211
-		echo "</ul></div>\n";
212
-	}
167
+    $err = array();
168
+
169
+    $p = phpversion();
170
+    if (version_compare($p, _PHP_MIN, '<')) {
171
+        $err[] = _T('install_php_version', array('version' => $p, 'minimum' => _PHP_MIN));
172
+    }
173
+
174
+    // Si on n'a pas la bonne version de PHP, c'est la fin
175
+    if ($err) {
176
+        die("<div class='error'>"
177
+            . "<h3>" . _T('avis_attention') . '</h3><p>' . _T('install_echec_annonce') . "</p><ul class='spip'>"
178
+            . "<li><strong>{$err[0]}</strong></li>\n</ul></div>");
179
+    }
180
+
181
+    // Il faut une base de donnees tout de meme ...
182
+    $serveurs = install_select_serveur();
183
+    if (!$serveurs) {
184
+        $err[] = _T('install_extension_php_obligatoire')
185
+            . " <a href='http://www.php.net/mysql'>MYSQL</a>"
186
+            . "| <a href='http://www.php.net/pgsql'>PostgreSQL</a>"
187
+            . "| <a href='http://www.php.net/sqlite'>SQLite</a>";
188
+    }
189
+
190
+    // et il faut preg
191
+    if (!function_exists('preg_match_all')) {
192
+        $err[] = _T('install_extension_php_obligatoire')
193
+            . " <a href='http://se.php.net/pcre'>PCRE</a>";
194
+    }
195
+
196
+    // et surtout pas ce mbstring.overload
197
+    if ($a = @ini_get('mbstring.func_overload')) {
198
+        $err[] = _T('install_extension_mbstring')
199
+            . "mbstring.func_overload=$a - <a href='http://www.php.net/mb_string'>mb_string</a>.<br /><small>";
200
+    }
201
+
202
+    if ($err) {
203
+        echo "<div class='error'>"
204
+            . "<h3>" . _T('avis_attention') . '</h3><p>' . _T('install_echec_annonce') . "</p><ul class='spip'>";
205
+        foreach ($err as $e) {
206
+            echo "<li><strong>$e</strong></li>\n";
207
+        }
208
+
209
+        # a priori ici on pourrait die(), mais il faut laisser la possibilite
210
+        # de forcer malgre tout (pour tester, ou si bug de detection)
211
+        echo "</ul></div>\n";
212
+    }
213 213
 }
214 214
 
215 215
 
@@ -219,24 +219,24 @@  discard block
 block discarded – undo
219 219
  * @note superflu ??
220 220
  */
221 221
 function login_hebergeur() {
222
-	$base_hebergeur = 'localhost'; # par defaut
222
+    $base_hebergeur = 'localhost'; # par defaut
223 223
 
224
-	// Free
225
-	if (preg_match(',(.*)\.free\.fr$,', $_SERVER['SERVER_NAME'], $regs)) {
226
-		$base_hebergeur = 'sql.free.fr';
227
-		$login_hebergeur = $regs[1];
228
-	} else {
229
-		$login_hebergeur = '';
230
-	}
224
+    // Free
225
+    if (preg_match(',(.*)\.free\.fr$,', $_SERVER['SERVER_NAME'], $regs)) {
226
+        $base_hebergeur = 'sql.free.fr';
227
+        $login_hebergeur = $regs[1];
228
+    } else {
229
+        $login_hebergeur = '';
230
+    }
231 231
 
232
-	return array($base_hebergeur, $login_hebergeur);
232
+    return array($base_hebergeur, $login_hebergeur);
233 233
 }
234 234
 
235 235
 
236 236
 // http://code.spip.net/@info_etape
237 237
 function info_etape($titre, $complement = '') {
238
-	return "<h2>" . $titre . "</h2>\n" .
239
-	($complement ? "" . $complement . "\n" : '');
238
+    return "<h2>" . $titre . "</h2>\n" .
239
+    ($complement ? "" . $complement . "\n" : '');
240 240
 }
241 241
 
242 242
 /**
@@ -246,155 +246,155 @@  discard block
 block discarded – undo
246 246
  * @return string Code HTML du bouton
247 247
  **/
248 248
 function bouton_suivant($code = '') {
249
-	if ($code == '') {
250
-		$code = _T('bouton_suivant');
251
-	}
252
-	static $suivant = 0;
253
-	$id = 'suivant' . (($suivant > 0) ? strval($suivant) : '');
254
-	$suivant += 1;
255
-
256
-	return "\n<p class='boutons suivant'><input id='" . $id . "' type='submit'\nvalue=\"" .
257
-	$code .
258
-	" >>\" /></p>\n";
249
+    if ($code == '') {
250
+        $code = _T('bouton_suivant');
251
+    }
252
+    static $suivant = 0;
253
+    $id = 'suivant' . (($suivant > 0) ? strval($suivant) : '');
254
+    $suivant += 1;
255
+
256
+    return "\n<p class='boutons suivant'><input id='" . $id . "' type='submit'\nvalue=\"" .
257
+    $code .
258
+    " >>\" /></p>\n";
259 259
 }
260 260
 
261 261
 // http://code.spip.net/@info_progression_etape
262 262
 function info_progression_etape($en_cours, $phase, $dir, $erreur = false) {
263
-	//$en_cours = _request('etape')?_request('etape'):"";
264
-	$liste = find_all_in_path($dir, $phase . '(([0-9])+|fin)[.]php$');
265
-	$debut = 1;
266
-	$etat = "ok";
267
-	$last = count($liste);
263
+    //$en_cours = _request('etape')?_request('etape'):"";
264
+    $liste = find_all_in_path($dir, $phase . '(([0-9])+|fin)[.]php$');
265
+    $debut = 1;
266
+    $etat = "ok";
267
+    $last = count($liste);
268 268
 //	$texte_etat = array('ok'=>'OK','encours'=>_T('en_cours'),'todo'=>_T('todo'));
269 269
 
270
-	$intitule_etat["etape_"][1] = typo(_T('info_connexion_base_donnee'));
271
-	$intitule_etat["etape_"][2] = typo(_T('menu_aide_installation_choix_base'));
272
-	$intitule_etat["etape_"][3] = typo(_T('info_informations_personnelles'));
273
-	$intitule_etat["etape_"][4] = typo(_T('info_derniere_etape'));
270
+    $intitule_etat["etape_"][1] = typo(_T('info_connexion_base_donnee'));
271
+    $intitule_etat["etape_"][2] = typo(_T('menu_aide_installation_choix_base'));
272
+    $intitule_etat["etape_"][3] = typo(_T('info_informations_personnelles'));
273
+    $intitule_etat["etape_"][4] = typo(_T('info_derniere_etape'));
274 274
 
275
-	$intitule_etat["etape_ldap"][1] = typo(_T('titre_connexion_ldap'));
276
-	$intitule_etat["etape_ldap"][2] = typo(_T('titre_connexion_ldap'));
277
-	$intitule_etat["etape_ldap"][3] = typo(_T('info_chemin_acces_1'));
278
-	$intitule_etat["etape_ldap"][4] = typo(_T('info_reglage_ldap'));
279
-	$intitule_etat["etape_ldap"][5] = typo(_T('info_ldap_ok'));
275
+    $intitule_etat["etape_ldap"][1] = typo(_T('titre_connexion_ldap'));
276
+    $intitule_etat["etape_ldap"][2] = typo(_T('titre_connexion_ldap'));
277
+    $intitule_etat["etape_ldap"][3] = typo(_T('info_chemin_acces_1'));
278
+    $intitule_etat["etape_ldap"][4] = typo(_T('info_reglage_ldap'));
279
+    $intitule_etat["etape_ldap"][5] = typo(_T('info_ldap_ok'));
280 280
 
281 281
 //	$aff_etapes = "<span id='etapes'>";
282 282
 
283
-	$aff_etapes = "<ul id='infos_etapes' class='infos_$phase$en_cours'>";
284
-
285
-	foreach ($liste as $etape => $fichier) {
286
-		if ($debut < $last) {
287
-			if ($debut == $en_cours && $erreur) {
288
-				$class = "on erreur";
289
-			} else {
290
-				if ($debut == $en_cours) {
291
-					$class = "on";
292
-				} else {
293
-					if ($debut > $en_cours) {
294
-						$class = "prochains";
295
-					} else {
296
-						$class = "valides";
297
-					}
298
-				}
299
-			}
300
-
301
-			$aff_etapes .= "<li class='$class'><div class='fond'>";
302
-			$aff_etapes .= ($debut == $en_cours) ? "<strong>" : '';
303
-			$aff_etapes .= "<em>" . _T('etape') . " </em><span class='numero_etape'>$debut</span><em>&nbsp;: </em>";
304
-			$aff_etapes .= $intitule_etat["$phase"][$debut];
305
-			$aff_etapes .= ($debut == $en_cours) ? "</strong>" : '';
306
-			$aff_etapes .= "</div></li>";
307
-		}
308
-		$debut++;
309
-	}
310
-	$aff_etapes .= "</ul>";
311
-	$aff_etapes .= "<br class='nettoyeur' />\n";
312
-
313
-	return $aff_etapes;
283
+    $aff_etapes = "<ul id='infos_etapes' class='infos_$phase$en_cours'>";
284
+
285
+    foreach ($liste as $etape => $fichier) {
286
+        if ($debut < $last) {
287
+            if ($debut == $en_cours && $erreur) {
288
+                $class = "on erreur";
289
+            } else {
290
+                if ($debut == $en_cours) {
291
+                    $class = "on";
292
+                } else {
293
+                    if ($debut > $en_cours) {
294
+                        $class = "prochains";
295
+                    } else {
296
+                        $class = "valides";
297
+                    }
298
+                }
299
+            }
300
+
301
+            $aff_etapes .= "<li class='$class'><div class='fond'>";
302
+            $aff_etapes .= ($debut == $en_cours) ? "<strong>" : '';
303
+            $aff_etapes .= "<em>" . _T('etape') . " </em><span class='numero_etape'>$debut</span><em>&nbsp;: </em>";
304
+            $aff_etapes .= $intitule_etat["$phase"][$debut];
305
+            $aff_etapes .= ($debut == $en_cours) ? "</strong>" : '';
306
+            $aff_etapes .= "</div></li>";
307
+        }
308
+        $debut++;
309
+    }
310
+    $aff_etapes .= "</ul>";
311
+    $aff_etapes .= "<br class='nettoyeur' />\n";
312
+
313
+    return $aff_etapes;
314 314
 }
315 315
 
316 316
 
317 317
 // http://code.spip.net/@fieldset
318 318
 function fieldset($legend, $champs = array(), $apres = '', $avant = '') {
319
-	return "<fieldset>\n" .
320
-	$avant .
321
-	($legend ? "<legend>" . $legend . "</legend>\n" : '') .
322
-	fieldset_champs($champs) .
323
-	$apres .
324
-	"</fieldset>\n";
319
+    return "<fieldset>\n" .
320
+    $avant .
321
+    ($legend ? "<legend>" . $legend . "</legend>\n" : '') .
322
+    fieldset_champs($champs) .
323
+    $apres .
324
+    "</fieldset>\n";
325 325
 }
326 326
 
327 327
 function fieldset_champs($champs = array()) {
328
-	$fieldset = '';
329
-	foreach ($champs as $nom => $contenu) {
330
-		$type = isset($contenu['hidden']) ? 'hidden' : (preg_match(',^pass,', $nom) ? 'password' : 'text');
331
-		$class = isset($contenu['hidden']) ? '' : "class='formo' size='40' ";
332
-		if (isset($contenu['alternatives'])) {
333
-			$fieldset .= $contenu['label'] . "\n";
334
-			foreach ($contenu['alternatives'] as $valeur => $label) {
335
-				$fieldset .= "<input type='radio' name='" . $nom .
336
-					"' id='$nom-$valeur' value='$valeur'"
337
-					. (($valeur == $contenu['valeur']) ? "\nchecked='checked'" : '')
338
-					. "/>\n";
339
-				$fieldset .= "<label for='$nom-$valeur'>" . $label . "</label>\n";
340
-			}
341
-			$fieldset .= "<br />\n";
342
-		} else {
343
-			$fieldset .= "<label for='" . $nom . "'>" . $contenu['label'] . "</label>\n";
344
-			$fieldset .= "<input " . $class . "type='" . $type . "' id='" . $nom . "' name='" . $nom . "'\nvalue='" . $contenu['valeur'] . "'"
345
-				. (preg_match(',^(pass|login),', $nom) ? " autocomplete='off'" : '')
346
-				. ((isset($contenu['required']) and $contenu['required']) ? " required='required'" : "")
347
-				. " />\n";
348
-		}
349
-	}
350
-
351
-	return $fieldset;
328
+    $fieldset = '';
329
+    foreach ($champs as $nom => $contenu) {
330
+        $type = isset($contenu['hidden']) ? 'hidden' : (preg_match(',^pass,', $nom) ? 'password' : 'text');
331
+        $class = isset($contenu['hidden']) ? '' : "class='formo' size='40' ";
332
+        if (isset($contenu['alternatives'])) {
333
+            $fieldset .= $contenu['label'] . "\n";
334
+            foreach ($contenu['alternatives'] as $valeur => $label) {
335
+                $fieldset .= "<input type='radio' name='" . $nom .
336
+                    "' id='$nom-$valeur' value='$valeur'"
337
+                    . (($valeur == $contenu['valeur']) ? "\nchecked='checked'" : '')
338
+                    . "/>\n";
339
+                $fieldset .= "<label for='$nom-$valeur'>" . $label . "</label>\n";
340
+            }
341
+            $fieldset .= "<br />\n";
342
+        } else {
343
+            $fieldset .= "<label for='" . $nom . "'>" . $contenu['label'] . "</label>\n";
344
+            $fieldset .= "<input " . $class . "type='" . $type . "' id='" . $nom . "' name='" . $nom . "'\nvalue='" . $contenu['valeur'] . "'"
345
+                . (preg_match(',^(pass|login),', $nom) ? " autocomplete='off'" : '')
346
+                . ((isset($contenu['required']) and $contenu['required']) ? " required='required'" : "")
347
+                . " />\n";
348
+        }
349
+    }
350
+
351
+    return $fieldset;
352 352
 }
353 353
 
354 354
 function install_select_serveur() {
355
-	$options = array();
356
-	$dir = _DIR_RESTREINT . 'req/';
357
-	$d = opendir($dir);
358
-	if (!$d) {
359
-		return array();
360
-	}
361
-	while (($f = readdir($d)) !== false) {
362
-		if ((preg_match('/^(.*)[.]php$/', $f, $s))
363
-			and is_readable($f = $dir . $f)
364
-		) {
365
-			require_once($f);
366
-			$s = $s[1];
367
-			$v = 'spip_versions_' . $s;
368
-			if (function_exists($v) and $v()) {
369
-				$titre = _T("install_select_type_$s");
370
-				// proposer mysql par defaut si dispo
371
-				$checked = ($s == 'mysql' ? " checked='checked'" : "");
372
-				$options[$s] = "<li><input type='radio' id='$s' value='$s' name='server_db'$checked>"
373
-					. "<label for='$s'>" . ($titre ? $titre : $s) . "</label></li>";
374
-			} else {
375
-				spip_log("$s: portage indisponible");
376
-			}
377
-		}
378
-	}
379
-	sort($options);
380
-
381
-	return $options;
355
+    $options = array();
356
+    $dir = _DIR_RESTREINT . 'req/';
357
+    $d = opendir($dir);
358
+    if (!$d) {
359
+        return array();
360
+    }
361
+    while (($f = readdir($d)) !== false) {
362
+        if ((preg_match('/^(.*)[.]php$/', $f, $s))
363
+            and is_readable($f = $dir . $f)
364
+        ) {
365
+            require_once($f);
366
+            $s = $s[1];
367
+            $v = 'spip_versions_' . $s;
368
+            if (function_exists($v) and $v()) {
369
+                $titre = _T("install_select_type_$s");
370
+                // proposer mysql par defaut si dispo
371
+                $checked = ($s == 'mysql' ? " checked='checked'" : "");
372
+                $options[$s] = "<li><input type='radio' id='$s' value='$s' name='server_db'$checked>"
373
+                    . "<label for='$s'>" . ($titre ? $titre : $s) . "</label></li>";
374
+            } else {
375
+                spip_log("$s: portage indisponible");
376
+            }
377
+        }
378
+    }
379
+    sort($options);
380
+
381
+    return $options;
382 382
 }
383 383
 
384 384
 // http://code.spip.net/@install_connexion_form
385 385
 function install_connexion_form($db, $login, $pass, $predef, $hidden, $etape, $jquery = true) {
386
-	$server_db = (is_string($predef[0])) ? $predef[0] : '';
387
-
388
-	return generer_form_ecrire('install', (
389
-		"\n<input type='hidden' name='etape' value='$etape' />"
390
-		. $hidden
391
-		. (_request('echec') ?
392
-			("<p><b>" . _T('avis_connexion_echec_1') .
393
-				"</b></p><p>" . _T('avis_connexion_echec_2') . "</p><p style='font-size: small;'>" . _T('avis_connexion_echec_3') . "</p>")
394
-			: "")
395
-
396
-		. ($jquery ? http_script('', 'jquery.js') : '')
397
-		. http_script('
386
+    $server_db = (is_string($predef[0])) ? $predef[0] : '';
387
+
388
+    return generer_form_ecrire('install', (
389
+        "\n<input type='hidden' name='etape' value='$etape' />"
390
+        . $hidden
391
+        . (_request('echec') ?
392
+            ("<p><b>" . _T('avis_connexion_echec_1') .
393
+                "</b></p><p>" . _T('avis_connexion_echec_2') . "</p><p style='font-size: small;'>" . _T('avis_connexion_echec_3') . "</p>")
394
+            : "")
395
+
396
+        . ($jquery ? http_script('', 'jquery.js') : '')
397
+        . http_script('
398 398
 		jQuery(function($) {
399 399
 			$details_db = $("#install_adresse_base_hebergeur,#install_login_base_hebergeur,#install_pass_base_hebergeur");
400 400
 			$("input[type=hidden][name=server_db]").each(function(){
@@ -427,67 +427,67 @@  discard block
 block discarded – undo
427 427
 			});
428 428
 		});')
429 429
 
430
-		. ($server_db
431
-			? '<input type="hidden" name="server_db" value="' . $server_db . '" />'
432
-			. (($predef[0])
433
-				? ('<h3>' . _T('install_serveur_hebergeur') . '</h3>')
434
-				: '')
435
-			: ('<fieldset><legend>'
436
-				. _T('install_select_type_db')
437
-				. "</legend>"
438
-				. '<p class="explication">'
439
-				. _T('install_types_db_connus')
440
-				// Passer l'avertissement SQLIte en  commentaire, on pourra facilement le supprimer par la suite sans changer les traductions.
441
-				// . "<br /><small>(". _T('install_types_db_connus_avertissement') .')</small>'
442
-				. '</p>'
443
-				. "\n<div class='p'>\n<ul>\n"
444
-				. join("\n", install_select_serveur())
445
-				. "\n</ul>\n</div></fieldset>")
446
-		)
447
-		. '<div id="install_adresse_base_hebergeur">'
448
-		. '<p>' . _T('texte_connexion_mysql') . '</p>'
449
-		. ($predef[1]
450
-			? '<h3>' . _T('install_adresse_base_hebergeur') . '</h3>'
451
-			: fieldset(_T('entree_base_donnee_1'),
452
-				array(
453
-					'adresse_db' => array(
454
-						'label' => $db[1],
455
-						'valeur' => $db[0]
456
-					),
457
-				)
458
-			)
459
-		)
460
-		. '</div>'
461
-
462
-		. '<div id="install_login_base_hebergeur">'
463
-		. ($predef[2]
464
-			? '<h3>' . _T('install_login_base_hebergeur') . '</h3>'
465
-			: fieldset(_T('entree_login_connexion_1'),
466
-				array(
467
-					'login_db' => array(
468
-						'label' => $login[1],
469
-						'valeur' => $login[0]
470
-					),
471
-				)
472
-			)
473
-		)
474
-		. '</div>'
475
-
476
-		. '<div id="install_pass_base_hebergeur">'
477
-		. ($predef[3]
478
-			? '<h3>' . _T('install_pass_base_hebergeur') . '</h3>'
479
-			: fieldset(_T('entree_mot_passe_1'),
480
-				array(
481
-					'pass_db' => array(
482
-						'label' => $pass[1],
483
-						'valeur' => $pass[0]
484
-					),
485
-				)
486
-			)
487
-		)
488
-		. '</div>'
489
-
490
-		. bouton_suivant()));
430
+        . ($server_db
431
+            ? '<input type="hidden" name="server_db" value="' . $server_db . '" />'
432
+            . (($predef[0])
433
+                ? ('<h3>' . _T('install_serveur_hebergeur') . '</h3>')
434
+                : '')
435
+            : ('<fieldset><legend>'
436
+                . _T('install_select_type_db')
437
+                . "</legend>"
438
+                . '<p class="explication">'
439
+                . _T('install_types_db_connus')
440
+                // Passer l'avertissement SQLIte en  commentaire, on pourra facilement le supprimer par la suite sans changer les traductions.
441
+                // . "<br /><small>(". _T('install_types_db_connus_avertissement') .')</small>'
442
+                . '</p>'
443
+                . "\n<div class='p'>\n<ul>\n"
444
+                . join("\n", install_select_serveur())
445
+                . "\n</ul>\n</div></fieldset>")
446
+        )
447
+        . '<div id="install_adresse_base_hebergeur">'
448
+        . '<p>' . _T('texte_connexion_mysql') . '</p>'
449
+        . ($predef[1]
450
+            ? '<h3>' . _T('install_adresse_base_hebergeur') . '</h3>'
451
+            : fieldset(_T('entree_base_donnee_1'),
452
+                array(
453
+                    'adresse_db' => array(
454
+                        'label' => $db[1],
455
+                        'valeur' => $db[0]
456
+                    ),
457
+                )
458
+            )
459
+        )
460
+        . '</div>'
461
+
462
+        . '<div id="install_login_base_hebergeur">'
463
+        . ($predef[2]
464
+            ? '<h3>' . _T('install_login_base_hebergeur') . '</h3>'
465
+            : fieldset(_T('entree_login_connexion_1'),
466
+                array(
467
+                    'login_db' => array(
468
+                        'label' => $login[1],
469
+                        'valeur' => $login[0]
470
+                    ),
471
+                )
472
+            )
473
+        )
474
+        . '</div>'
475
+
476
+        . '<div id="install_pass_base_hebergeur">'
477
+        . ($predef[3]
478
+            ? '<h3>' . _T('install_pass_base_hebergeur') . '</h3>'
479
+            : fieldset(_T('entree_mot_passe_1'),
480
+                array(
481
+                    'pass_db' => array(
482
+                        'label' => $pass[1],
483
+                        'valeur' => $pass[0]
484
+                    ),
485
+                )
486
+            )
487
+        )
488
+        . '</div>'
489
+
490
+        . bouton_suivant()));
491 491
 
492 492
 }
493 493
 
@@ -496,75 +496,75 @@  discard block
 block discarded – undo
496 496
 
497 497
 // http://code.spip.net/@predef_ou_cache
498 498
 function predef_ou_cache($adresse_db, $login_db, $pass_db, $server_db) {
499
-	return ((defined('_INSTALL_HOST_DB'))
500
-		? ''
501
-		: "\n<input type='hidden' name='adresse_db'  value=\"" . spip_htmlspecialchars($adresse_db) . "\" />"
502
-	)
503
-	. ((defined('_INSTALL_USER_DB'))
504
-		? ''
505
-		: "\n<input type='hidden' name='login_db' value=\"" . spip_htmlspecialchars($login_db) . "\" />"
506
-	)
507
-	. ((defined('_INSTALL_PASS_DB'))
508
-		? ''
509
-		: "\n<input type='hidden' name='pass_db' value=\"" . spip_htmlspecialchars($pass_db) . "\" />"
510
-	)
511
-
512
-	. ((defined('_INSTALL_SERVER_DB'))
513
-		? ''
514
-		: "\n<input type='hidden' name='server_db' value=\"" . spip_htmlspecialchars($server_db) . "\" />"
515
-	);
499
+    return ((defined('_INSTALL_HOST_DB'))
500
+        ? ''
501
+        : "\n<input type='hidden' name='adresse_db'  value=\"" . spip_htmlspecialchars($adresse_db) . "\" />"
502
+    )
503
+    . ((defined('_INSTALL_USER_DB'))
504
+        ? ''
505
+        : "\n<input type='hidden' name='login_db' value=\"" . spip_htmlspecialchars($login_db) . "\" />"
506
+    )
507
+    . ((defined('_INSTALL_PASS_DB'))
508
+        ? ''
509
+        : "\n<input type='hidden' name='pass_db' value=\"" . spip_htmlspecialchars($pass_db) . "\" />"
510
+    )
511
+
512
+    . ((defined('_INSTALL_SERVER_DB'))
513
+        ? ''
514
+        : "\n<input type='hidden' name='server_db' value=\"" . spip_htmlspecialchars($server_db) . "\" />"
515
+    );
516 516
 }
517 517
 
518 518
 // presentation des bases existantes
519 519
 
520 520
 // http://code.spip.net/@install_etape_liste_bases
521 521
 function install_etape_liste_bases($server_db, $login_db, $disabled = array()) {
522
-	$bases = $checked = array();
523
-	$noms = sql_listdbs($server_db);
524
-	if (!$noms) {
525
-		return '';
526
-	}
527
-
528
-	foreach ($noms as $nom) {
529
-		$id = spip_htmlspecialchars($nom);
530
-		$dis = in_array($nom, $disabled) ? " disabled='disabled'" : '';
531
-		$base = " name=\"choix_db\" value=\""
532
-			. $nom
533
-			. '"'
534
-			. $dis
535
-			. " type='radio' id='$id'";
536
-		$label = "<label for='$id'>"
537
-			. ($dis ? "<i>$nom</i>" : $nom)
538
-			. "</label>";
539
-
540
-		if (!$checked and !$dis and
541
-			(($nom == $login_db) or
542
-				($GLOBALS['table_prefix'] == $nom))
543
-		) {
544
-			$checked = "<input$base checked='checked' />\n$label";
545
-		} else {
546
-			$bases[] = "<input$base />\n$label";
547
-		}
548
-	}
549
-
550
-	if (!$bases && !$checked) {
551
-		return false;
552
-	}
553
-
554
-	if ($checked) {
555
-		array_unshift($bases, $checked);
556
-		$checked = true;
557
-	}
558
-
559
-	return array($checked, $bases);
522
+    $bases = $checked = array();
523
+    $noms = sql_listdbs($server_db);
524
+    if (!$noms) {
525
+        return '';
526
+    }
527
+
528
+    foreach ($noms as $nom) {
529
+        $id = spip_htmlspecialchars($nom);
530
+        $dis = in_array($nom, $disabled) ? " disabled='disabled'" : '';
531
+        $base = " name=\"choix_db\" value=\""
532
+            . $nom
533
+            . '"'
534
+            . $dis
535
+            . " type='radio' id='$id'";
536
+        $label = "<label for='$id'>"
537
+            . ($dis ? "<i>$nom</i>" : $nom)
538
+            . "</label>";
539
+
540
+        if (!$checked and !$dis and
541
+            (($nom == $login_db) or
542
+                ($GLOBALS['table_prefix'] == $nom))
543
+        ) {
544
+            $checked = "<input$base checked='checked' />\n$label";
545
+        } else {
546
+            $bases[] = "<input$base />\n$label";
547
+        }
548
+    }
549
+
550
+    if (!$bases && !$checked) {
551
+        return false;
552
+    }
553
+
554
+    if ($checked) {
555
+        array_unshift($bases, $checked);
556
+        $checked = true;
557
+    }
558
+
559
+    return array($checked, $bases);
560 560
 }
561 561
 
562 562
 function install_propager($hidden) {
563
-	$res = '';
564
-	foreach ($hidden as $k) {
565
-		$v = spip_htmlentities(_request($k));
566
-		$res .= "<input type='hidden' name='$k' value='$v' />";
567
-	}
563
+    $res = '';
564
+    foreach ($hidden as $k) {
565
+        $v = spip_htmlentities(_request($k));
566
+        $res .= "<input type='hidden' name='$k' value='$v' />";
567
+    }
568 568
 
569
-	return $res;
569
+    return $res;
570 570
 }
Please login to merge, or discard this patch.