@@ -16,7 +16,7 @@ discard block |
||
| 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 |
||
| 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 |
||
| 75 | 75 | * |
| 76 | 76 | **/ |
| 77 | 77 | function install_connexion($adr, $port, $login, $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 |
||
| 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,75 +143,75 @@ discard block |
||
| 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/pgsql'>PostgreSQL</a>" |
|
| 195 | - . "| <a href='http://www.php.net/sqlite'>SQLite</a>"; |
|
| 196 | - } |
|
| 197 | - |
|
| 198 | - // et surtout pas ce mbstring.overload (has been DEPRECATED as of PHP 7.2.0, and REMOVED as of PHP 8.0.0) |
|
| 199 | - if ($a = @ini_get('mbstring.func_overload')) { |
|
| 200 | - $err[] = _T('install_extension_mbstring') |
|
| 201 | - . "mbstring.func_overload=$a - <a href='http://www.php.net/mb_string'>mb_string</a>.<br /><small>"; |
|
| 202 | - } |
|
| 203 | - |
|
| 204 | - if ($err) { |
|
| 205 | - echo "<div class='error'>" |
|
| 206 | - . '<h3>' . _T('avis_attention') . '</h3><p>' . _T('install_echec_annonce') . "</p><ul class='spip'>"; |
|
| 207 | - foreach ($err as $e) { |
|
| 208 | - echo "<li><strong>$e</strong></li>\n"; |
|
| 209 | - } |
|
| 210 | - |
|
| 211 | - # a priori ici on pourrait die(), mais il faut laisser la possibilite |
|
| 212 | - # de forcer malgre tout (pour tester, ou si bug de detection) |
|
| 213 | - echo "</ul></div>\n"; |
|
| 214 | - } |
|
| 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/pgsql'>PostgreSQL</a>" |
|
| 195 | + . "| <a href='http://www.php.net/sqlite'>SQLite</a>"; |
|
| 196 | + } |
|
| 197 | + |
|
| 198 | + // et surtout pas ce mbstring.overload (has been DEPRECATED as of PHP 7.2.0, and REMOVED as of PHP 8.0.0) |
|
| 199 | + if ($a = @ini_get('mbstring.func_overload')) { |
|
| 200 | + $err[] = _T('install_extension_mbstring') |
|
| 201 | + . "mbstring.func_overload=$a - <a href='http://www.php.net/mb_string'>mb_string</a>.<br /><small>"; |
|
| 202 | + } |
|
| 203 | + |
|
| 204 | + if ($err) { |
|
| 205 | + echo "<div class='error'>" |
|
| 206 | + . '<h3>' . _T('avis_attention') . '</h3><p>' . _T('install_echec_annonce') . "</p><ul class='spip'>"; |
|
| 207 | + foreach ($err as $e) { |
|
| 208 | + echo "<li><strong>$e</strong></li>\n"; |
|
| 209 | + } |
|
| 210 | + |
|
| 211 | + # a priori ici on pourrait die(), mais il faut laisser la possibilite |
|
| 212 | + # de forcer malgre tout (pour tester, ou si bug de detection) |
|
| 213 | + echo "</ul></div>\n"; |
|
| 214 | + } |
|
| 215 | 215 | } |
| 216 | 216 | |
| 217 | 217 | |
@@ -221,23 +221,23 @@ discard block |
||
| 221 | 221 | * @note superflu ?? |
| 222 | 222 | */ |
| 223 | 223 | function login_hebergeur() { |
| 224 | - $base_hebergeur = 'localhost'; # par defaut |
|
| 224 | + $base_hebergeur = 'localhost'; # par defaut |
|
| 225 | 225 | |
| 226 | - // Free |
|
| 227 | - if (preg_match(',(.*)\.free\.fr$,', $_SERVER['SERVER_NAME'], $regs)) { |
|
| 228 | - $base_hebergeur = 'sql.free.fr'; |
|
| 229 | - $login_hebergeur = $regs[1]; |
|
| 230 | - } else { |
|
| 231 | - $login_hebergeur = ''; |
|
| 232 | - } |
|
| 226 | + // Free |
|
| 227 | + if (preg_match(',(.*)\.free\.fr$,', $_SERVER['SERVER_NAME'], $regs)) { |
|
| 228 | + $base_hebergeur = 'sql.free.fr'; |
|
| 229 | + $login_hebergeur = $regs[1]; |
|
| 230 | + } else { |
|
| 231 | + $login_hebergeur = ''; |
|
| 232 | + } |
|
| 233 | 233 | |
| 234 | - return [$base_hebergeur, $login_hebergeur]; |
|
| 234 | + return [$base_hebergeur, $login_hebergeur]; |
|
| 235 | 235 | } |
| 236 | 236 | |
| 237 | 237 | |
| 238 | 238 | function info_etape($titre, $complement = '') { |
| 239 | - return '<h2>' . $titre . "</h2>\n" . |
|
| 240 | - ($complement ? '' . $complement . "\n" : ''); |
|
| 239 | + return '<h2>' . $titre . "</h2>\n" . |
|
| 240 | + ($complement ? '' . $complement . "\n" : ''); |
|
| 241 | 241 | } |
| 242 | 242 | |
| 243 | 243 | /** |
@@ -247,152 +247,152 @@ discard block |
||
| 247 | 247 | * @return string Code HTML du bouton |
| 248 | 248 | **/ |
| 249 | 249 | function bouton_suivant($code = '') { |
| 250 | - if ($code == '') { |
|
| 251 | - $code = _T('bouton_suivant'); |
|
| 252 | - } |
|
| 253 | - static $suivant = 0; |
|
| 254 | - $id = 'suivant' . (($suivant > 0) ? strval($suivant) : ''); |
|
| 255 | - $suivant += 1; |
|
| 256 | - |
|
| 257 | - return "\n<p class='boutons suivant'><input id='" . $id . "' type='submit'\nvalue=\"" . |
|
| 258 | - $code . |
|
| 259 | - " >>\" /></p>\n"; |
|
| 250 | + if ($code == '') { |
|
| 251 | + $code = _T('bouton_suivant'); |
|
| 252 | + } |
|
| 253 | + static $suivant = 0; |
|
| 254 | + $id = 'suivant' . (($suivant > 0) ? strval($suivant) : ''); |
|
| 255 | + $suivant += 1; |
|
| 256 | + |
|
| 257 | + return "\n<p class='boutons suivant'><input id='" . $id . "' type='submit'\nvalue=\"" . |
|
| 258 | + $code . |
|
| 259 | + " >>\" /></p>\n"; |
|
| 260 | 260 | } |
| 261 | 261 | |
| 262 | 262 | function info_progression_etape($en_cours, $phase, $dir, $erreur = false) { |
| 263 | - $intitule_etat = []; |
|
| 264 | - //$en_cours = _request('etape')?_request('etape'):""; |
|
| 265 | - $liste = find_all_in_path($dir, $phase . '(([0-9])+|fin)[.]php$'); |
|
| 266 | - $debut = 1; |
|
| 267 | - $etat = 'ok'; |
|
| 268 | - $last = count($liste); |
|
| 263 | + $intitule_etat = []; |
|
| 264 | + //$en_cours = _request('etape')?_request('etape'):""; |
|
| 265 | + $liste = find_all_in_path($dir, $phase . '(([0-9])+|fin)[.]php$'); |
|
| 266 | + $debut = 1; |
|
| 267 | + $etat = 'ok'; |
|
| 268 | + $last = count($liste); |
|
| 269 | 269 | // $texte_etat = array('ok'=>'OK','encours'=>_T('en_cours'),'todo'=>_T('todo')); |
| 270 | 270 | |
| 271 | - include_spip('inc/texte'); |
|
| 272 | - $intitule_etat['etape_'][1] = typo(_T('info_connexion_base_donnee')); |
|
| 273 | - $intitule_etat['etape_'][2] = typo(_T('menu_aide_installation_choix_base')); |
|
| 274 | - $intitule_etat['etape_'][3] = typo(_T('info_informations_personnelles')); |
|
| 275 | - $intitule_etat['etape_'][4] = typo(_T('info_derniere_etape')); |
|
| 271 | + include_spip('inc/texte'); |
|
| 272 | + $intitule_etat['etape_'][1] = typo(_T('info_connexion_base_donnee')); |
|
| 273 | + $intitule_etat['etape_'][2] = typo(_T('menu_aide_installation_choix_base')); |
|
| 274 | + $intitule_etat['etape_'][3] = typo(_T('info_informations_personnelles')); |
|
| 275 | + $intitule_etat['etape_'][4] = typo(_T('info_derniere_etape')); |
|
| 276 | 276 | |
| 277 | - $intitule_etat['etape_ldap'][1] = typo(_T('titre_connexion_ldap')); |
|
| 278 | - $intitule_etat['etape_ldap'][2] = typo(_T('titre_connexion_ldap')); |
|
| 279 | - $intitule_etat['etape_ldap'][3] = typo(_T('info_chemin_acces_1')); |
|
| 280 | - $intitule_etat['etape_ldap'][4] = typo(_T('info_reglage_ldap')); |
|
| 281 | - $intitule_etat['etape_ldap'][5] = typo(_T('info_ldap_ok')); |
|
| 277 | + $intitule_etat['etape_ldap'][1] = typo(_T('titre_connexion_ldap')); |
|
| 278 | + $intitule_etat['etape_ldap'][2] = typo(_T('titre_connexion_ldap')); |
|
| 279 | + $intitule_etat['etape_ldap'][3] = typo(_T('info_chemin_acces_1')); |
|
| 280 | + $intitule_etat['etape_ldap'][4] = typo(_T('info_reglage_ldap')); |
|
| 281 | + $intitule_etat['etape_ldap'][5] = typo(_T('info_ldap_ok')); |
|
| 282 | 282 | |
| 283 | 283 | // $aff_etapes = "<span id='etapes'>"; |
| 284 | 284 | |
| 285 | - $aff_etapes = "<ul id='infos_etapes' class='infos_$phase$en_cours'>"; |
|
| 286 | - |
|
| 287 | - foreach ($liste as $etape => $fichier) { |
|
| 288 | - if ($debut < $last) { |
|
| 289 | - if ($debut == $en_cours && $erreur) { |
|
| 290 | - $class = 'on erreur'; |
|
| 291 | - } else { |
|
| 292 | - if ($debut == $en_cours) { |
|
| 293 | - $class = 'on'; |
|
| 294 | - } else { |
|
| 295 | - if ($debut > $en_cours) { |
|
| 296 | - $class = 'prochains'; |
|
| 297 | - } else { |
|
| 298 | - $class = 'valides'; |
|
| 299 | - } |
|
| 300 | - } |
|
| 301 | - } |
|
| 302 | - |
|
| 303 | - $aff_etapes .= "<li class='$class'><div class='fond'>"; |
|
| 304 | - $aff_etapes .= '<em>' . _T('etape') . " </em><span class='numero_etape'>$debut</span><em> : </em>"; |
|
| 305 | - $aff_etapes .= '<'.(($debut == $en_cours) ? 'strong' : 'span').' class="label_etape">' . $intitule_etat["$phase"][$debut] . '</'.(($debut == $en_cours) ? 'strong' : 'span').'>'; |
|
| 306 | - $aff_etapes .= '</div></li>'; |
|
| 307 | - } |
|
| 308 | - $debut++; |
|
| 309 | - } |
|
| 310 | - $aff_etapes .= '</ul>'; |
|
| 311 | - |
|
| 312 | - return $aff_etapes; |
|
| 285 | + $aff_etapes = "<ul id='infos_etapes' class='infos_$phase$en_cours'>"; |
|
| 286 | + |
|
| 287 | + foreach ($liste as $etape => $fichier) { |
|
| 288 | + if ($debut < $last) { |
|
| 289 | + if ($debut == $en_cours && $erreur) { |
|
| 290 | + $class = 'on erreur'; |
|
| 291 | + } else { |
|
| 292 | + if ($debut == $en_cours) { |
|
| 293 | + $class = 'on'; |
|
| 294 | + } else { |
|
| 295 | + if ($debut > $en_cours) { |
|
| 296 | + $class = 'prochains'; |
|
| 297 | + } else { |
|
| 298 | + $class = 'valides'; |
|
| 299 | + } |
|
| 300 | + } |
|
| 301 | + } |
|
| 302 | + |
|
| 303 | + $aff_etapes .= "<li class='$class'><div class='fond'>"; |
|
| 304 | + $aff_etapes .= '<em>' . _T('etape') . " </em><span class='numero_etape'>$debut</span><em> : </em>"; |
|
| 305 | + $aff_etapes .= '<'.(($debut == $en_cours) ? 'strong' : 'span').' class="label_etape">' . $intitule_etat["$phase"][$debut] . '</'.(($debut == $en_cours) ? 'strong' : 'span').'>'; |
|
| 306 | + $aff_etapes .= '</div></li>'; |
|
| 307 | + } |
|
| 308 | + $debut++; |
|
| 309 | + } |
|
| 310 | + $aff_etapes .= '</ul>'; |
|
| 311 | + |
|
| 312 | + return $aff_etapes; |
|
| 313 | 313 | } |
| 314 | 314 | |
| 315 | 315 | |
| 316 | 316 | function fieldset($legend, $champs = [], $apres = '', $avant = '') { |
| 317 | - return "<fieldset>\n" . |
|
| 318 | - $avant . |
|
| 319 | - ($legend ? '<legend>' . $legend . "</legend>\n" : '') . |
|
| 320 | - fieldset_champs($champs) . |
|
| 321 | - $apres . |
|
| 322 | - "</fieldset>\n"; |
|
| 317 | + return "<fieldset>\n" . |
|
| 318 | + $avant . |
|
| 319 | + ($legend ? '<legend>' . $legend . "</legend>\n" : '') . |
|
| 320 | + fieldset_champs($champs) . |
|
| 321 | + $apres . |
|
| 322 | + "</fieldset>\n"; |
|
| 323 | 323 | } |
| 324 | 324 | |
| 325 | 325 | function fieldset_champs($champs = []) { |
| 326 | - $fieldset = ''; |
|
| 327 | - foreach ($champs as $nom => $contenu) { |
|
| 328 | - $type = isset($contenu['hidden']) ? 'hidden' : (preg_match(',^pass,', $nom) ? 'password' : 'text'); |
|
| 329 | - $class = isset($contenu['hidden']) ? '' : "class='formo' size='40' "; |
|
| 330 | - if (isset($contenu['alternatives'])) { |
|
| 331 | - $fieldset .= $contenu['label'] . "\n"; |
|
| 332 | - foreach ($contenu['alternatives'] as $valeur => $label) { |
|
| 333 | - $fieldset .= "<input type='radio' name='" . $nom . |
|
| 334 | - "' id='$nom-$valeur' value='$valeur'" |
|
| 335 | - . (($valeur == $contenu['valeur']) ? "\nchecked='checked'" : '') |
|
| 336 | - . "/>\n"; |
|
| 337 | - $fieldset .= "<label for='$nom-$valeur'>" . $label . "</label>\n"; |
|
| 338 | - } |
|
| 339 | - $fieldset .= "<br />\n"; |
|
| 340 | - } else { |
|
| 341 | - $fieldset .= "<label for='" . $nom . "'>" . $contenu['label'] . "</label>\n"; |
|
| 342 | - $fieldset .= '<input ' . $class . "type='" . $type . "' id='" . $nom . "' name='" . $nom . "'\nvalue='" . $contenu['valeur'] . "'" |
|
| 343 | - . (preg_match(',^(pass|login),', $nom) ? " autocomplete='off'" : '') |
|
| 344 | - . ((isset($contenu['required']) and $contenu['required']) ? " required='required'" : '') |
|
| 345 | - . " />\n"; |
|
| 346 | - } |
|
| 347 | - } |
|
| 348 | - |
|
| 349 | - return $fieldset; |
|
| 326 | + $fieldset = ''; |
|
| 327 | + foreach ($champs as $nom => $contenu) { |
|
| 328 | + $type = isset($contenu['hidden']) ? 'hidden' : (preg_match(',^pass,', $nom) ? 'password' : 'text'); |
|
| 329 | + $class = isset($contenu['hidden']) ? '' : "class='formo' size='40' "; |
|
| 330 | + if (isset($contenu['alternatives'])) { |
|
| 331 | + $fieldset .= $contenu['label'] . "\n"; |
|
| 332 | + foreach ($contenu['alternatives'] as $valeur => $label) { |
|
| 333 | + $fieldset .= "<input type='radio' name='" . $nom . |
|
| 334 | + "' id='$nom-$valeur' value='$valeur'" |
|
| 335 | + . (($valeur == $contenu['valeur']) ? "\nchecked='checked'" : '') |
|
| 336 | + . "/>\n"; |
|
| 337 | + $fieldset .= "<label for='$nom-$valeur'>" . $label . "</label>\n"; |
|
| 338 | + } |
|
| 339 | + $fieldset .= "<br />\n"; |
|
| 340 | + } else { |
|
| 341 | + $fieldset .= "<label for='" . $nom . "'>" . $contenu['label'] . "</label>\n"; |
|
| 342 | + $fieldset .= '<input ' . $class . "type='" . $type . "' id='" . $nom . "' name='" . $nom . "'\nvalue='" . $contenu['valeur'] . "'" |
|
| 343 | + . (preg_match(',^(pass|login),', $nom) ? " autocomplete='off'" : '') |
|
| 344 | + . ((isset($contenu['required']) and $contenu['required']) ? " required='required'" : '') |
|
| 345 | + . " />\n"; |
|
| 346 | + } |
|
| 347 | + } |
|
| 348 | + |
|
| 349 | + return $fieldset; |
|
| 350 | 350 | } |
| 351 | 351 | |
| 352 | 352 | function install_select_serveur() { |
| 353 | - $options = []; |
|
| 354 | - $dir = _DIR_RESTREINT . 'req/'; |
|
| 355 | - $d = opendir($dir); |
|
| 356 | - if (!$d) { |
|
| 357 | - return []; |
|
| 358 | - } |
|
| 359 | - while (($f = readdir($d)) !== false) { |
|
| 360 | - if ( |
|
| 361 | - (preg_match('/^(.*)[.]php$/', $f, $s)) |
|
| 362 | - and is_readable($f = $dir . $f) |
|
| 363 | - ) { |
|
| 364 | - require_once($f); |
|
| 365 | - $s = $s[1]; |
|
| 366 | - $v = 'spip_versions_' . $s; |
|
| 367 | - if (function_exists($v) and $v()) { |
|
| 368 | - $titre = _T("install_select_type_$s"); |
|
| 369 | - // proposer mysql par defaut si dispo |
|
| 370 | - $checked = ($s == 'mysql' ? " checked='checked'" : ''); |
|
| 371 | - $options[$s] = "<li><input type='radio' id='$s' value='$s' name='server_db'$checked>" |
|
| 372 | - . "<label for='$s'>" . ($titre ?: $s) . '</label></li>'; |
|
| 373 | - } else { |
|
| 374 | - spip_log("$s: portage indisponible"); |
|
| 375 | - } |
|
| 376 | - } |
|
| 377 | - } |
|
| 378 | - sort($options); |
|
| 379 | - |
|
| 380 | - return $options; |
|
| 353 | + $options = []; |
|
| 354 | + $dir = _DIR_RESTREINT . 'req/'; |
|
| 355 | + $d = opendir($dir); |
|
| 356 | + if (!$d) { |
|
| 357 | + return []; |
|
| 358 | + } |
|
| 359 | + while (($f = readdir($d)) !== false) { |
|
| 360 | + if ( |
|
| 361 | + (preg_match('/^(.*)[.]php$/', $f, $s)) |
|
| 362 | + and is_readable($f = $dir . $f) |
|
| 363 | + ) { |
|
| 364 | + require_once($f); |
|
| 365 | + $s = $s[1]; |
|
| 366 | + $v = 'spip_versions_' . $s; |
|
| 367 | + if (function_exists($v) and $v()) { |
|
| 368 | + $titre = _T("install_select_type_$s"); |
|
| 369 | + // proposer mysql par defaut si dispo |
|
| 370 | + $checked = ($s == 'mysql' ? " checked='checked'" : ''); |
|
| 371 | + $options[$s] = "<li><input type='radio' id='$s' value='$s' name='server_db'$checked>" |
|
| 372 | + . "<label for='$s'>" . ($titre ?: $s) . '</label></li>'; |
|
| 373 | + } else { |
|
| 374 | + spip_log("$s: portage indisponible"); |
|
| 375 | + } |
|
| 376 | + } |
|
| 377 | + } |
|
| 378 | + sort($options); |
|
| 379 | + |
|
| 380 | + return $options; |
|
| 381 | 381 | } |
| 382 | 382 | |
| 383 | 383 | function install_connexion_form($db, $login, $pass, $predef, $hidden, $etape, $jquery = true) { |
| 384 | - $server_db = (is_string($predef[0])) ? $predef[0] : ''; |
|
| 385 | - |
|
| 386 | - return generer_form_ecrire('install', ( |
|
| 387 | - "\n<input type='hidden' name='etape' value='$etape' />" |
|
| 388 | - . $hidden |
|
| 389 | - . (_request('echec') ? |
|
| 390 | - ('<p><b>' . _T('avis_connexion_echec_1') . |
|
| 391 | - '</b></p><p>' . _T('avis_connexion_echec_2') . "</p><p style='font-size: small;'>" . _T('avis_connexion_echec_3') . '</p>') |
|
| 392 | - : '') |
|
| 393 | - |
|
| 394 | - . ($jquery ? http_script('', 'jquery.js') : '') |
|
| 395 | - . http_script(' |
|
| 384 | + $server_db = (is_string($predef[0])) ? $predef[0] : ''; |
|
| 385 | + |
|
| 386 | + return generer_form_ecrire('install', ( |
|
| 387 | + "\n<input type='hidden' name='etape' value='$etape' />" |
|
| 388 | + . $hidden |
|
| 389 | + . (_request('echec') ? |
|
| 390 | + ('<p><b>' . _T('avis_connexion_echec_1') . |
|
| 391 | + '</b></p><p>' . _T('avis_connexion_echec_2') . "</p><p style='font-size: small;'>" . _T('avis_connexion_echec_3') . '</p>') |
|
| 392 | + : '') |
|
| 393 | + |
|
| 394 | + . ($jquery ? http_script('', 'jquery.js') : '') |
|
| 395 | + . http_script(' |
|
| 396 | 396 | jQuery(function($) { |
| 397 | 397 | $details_db = $("#install_adresse_base_hebergeur,#install_login_base_hebergeur,#install_pass_base_hebergeur"); |
| 398 | 398 | $("input[type=hidden][name=server_db]").each(function(){ |
@@ -425,145 +425,145 @@ discard block |
||
| 425 | 425 | }); |
| 426 | 426 | });') |
| 427 | 427 | |
| 428 | - . ($server_db |
|
| 429 | - ? '<input type="hidden" name="server_db" value="' . $server_db . '" />' |
|
| 430 | - . (($predef[0]) |
|
| 431 | - ? ('<h3>' . _T('install_serveur_hebergeur') . '</h3>') |
|
| 432 | - : '') |
|
| 433 | - : ('<fieldset><legend>' |
|
| 434 | - . _T('install_select_type_db') |
|
| 435 | - . '</legend>' |
|
| 436 | - . '<p class="explication">' |
|
| 437 | - . _T('install_types_db_connus') |
|
| 438 | - // Passer l'avertissement SQLIte en commentaire, on pourra facilement le supprimer par la suite sans changer les traductions. |
|
| 439 | - // . "<br /><small>(". _T('install_types_db_connus_avertissement') .')</small>' |
|
| 440 | - . '</p>' |
|
| 441 | - . "\n<div class='p'>\n<ul>\n" |
|
| 442 | - . join("\n", install_select_serveur()) |
|
| 443 | - . "\n</ul>\n</div></fieldset>") |
|
| 444 | - ) |
|
| 445 | - . '<div id="install_adresse_base_hebergeur">' |
|
| 446 | - . '<p>' . _T('texte_connexion_mysql') . '</p>' |
|
| 447 | - . ($predef[1] |
|
| 448 | - ? '<h3>' . _T('install_adresse_base_hebergeur') . '</h3>' |
|
| 449 | - : fieldset( |
|
| 450 | - _T('entree_base_donnee_1'), |
|
| 451 | - [ |
|
| 452 | - 'adresse_db' => [ |
|
| 453 | - 'label' => $db[1], |
|
| 454 | - 'valeur' => $db[0] |
|
| 455 | - ], |
|
| 456 | - ] |
|
| 457 | - ) |
|
| 458 | - ) |
|
| 459 | - . '</div>' |
|
| 460 | - |
|
| 461 | - . '<div id="install_login_base_hebergeur">' |
|
| 462 | - . ($predef[2] |
|
| 463 | - ? '<h3>' . _T('install_login_base_hebergeur') . '</h3>' |
|
| 464 | - : fieldset( |
|
| 465 | - _T('entree_login_connexion_1'), |
|
| 466 | - [ |
|
| 467 | - 'login_db' => [ |
|
| 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( |
|
| 480 | - _T('entree_mot_passe_1'), |
|
| 481 | - [ |
|
| 482 | - 'pass_db' => [ |
|
| 483 | - 'label' => $pass[1], |
|
| 484 | - 'valeur' => $pass[0] |
|
| 485 | - ], |
|
| 486 | - ] |
|
| 487 | - ) |
|
| 488 | - ) |
|
| 489 | - . '</div>' |
|
| 490 | - |
|
| 491 | - . bouton_suivant())); |
|
| 428 | + . ($server_db |
|
| 429 | + ? '<input type="hidden" name="server_db" value="' . $server_db . '" />' |
|
| 430 | + . (($predef[0]) |
|
| 431 | + ? ('<h3>' . _T('install_serveur_hebergeur') . '</h3>') |
|
| 432 | + : '') |
|
| 433 | + : ('<fieldset><legend>' |
|
| 434 | + . _T('install_select_type_db') |
|
| 435 | + . '</legend>' |
|
| 436 | + . '<p class="explication">' |
|
| 437 | + . _T('install_types_db_connus') |
|
| 438 | + // Passer l'avertissement SQLIte en commentaire, on pourra facilement le supprimer par la suite sans changer les traductions. |
|
| 439 | + // . "<br /><small>(". _T('install_types_db_connus_avertissement') .')</small>' |
|
| 440 | + . '</p>' |
|
| 441 | + . "\n<div class='p'>\n<ul>\n" |
|
| 442 | + . join("\n", install_select_serveur()) |
|
| 443 | + . "\n</ul>\n</div></fieldset>") |
|
| 444 | + ) |
|
| 445 | + . '<div id="install_adresse_base_hebergeur">' |
|
| 446 | + . '<p>' . _T('texte_connexion_mysql') . '</p>' |
|
| 447 | + . ($predef[1] |
|
| 448 | + ? '<h3>' . _T('install_adresse_base_hebergeur') . '</h3>' |
|
| 449 | + : fieldset( |
|
| 450 | + _T('entree_base_donnee_1'), |
|
| 451 | + [ |
|
| 452 | + 'adresse_db' => [ |
|
| 453 | + 'label' => $db[1], |
|
| 454 | + 'valeur' => $db[0] |
|
| 455 | + ], |
|
| 456 | + ] |
|
| 457 | + ) |
|
| 458 | + ) |
|
| 459 | + . '</div>' |
|
| 460 | + |
|
| 461 | + . '<div id="install_login_base_hebergeur">' |
|
| 462 | + . ($predef[2] |
|
| 463 | + ? '<h3>' . _T('install_login_base_hebergeur') . '</h3>' |
|
| 464 | + : fieldset( |
|
| 465 | + _T('entree_login_connexion_1'), |
|
| 466 | + [ |
|
| 467 | + 'login_db' => [ |
|
| 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( |
|
| 480 | + _T('entree_mot_passe_1'), |
|
| 481 | + [ |
|
| 482 | + 'pass_db' => [ |
|
| 483 | + 'label' => $pass[1], |
|
| 484 | + 'valeur' => $pass[0] |
|
| 485 | + ], |
|
| 486 | + ] |
|
| 487 | + ) |
|
| 488 | + ) |
|
| 489 | + . '</div>' |
|
| 490 | + |
|
| 491 | + . bouton_suivant())); |
|
| 492 | 492 | } |
| 493 | 493 | |
| 494 | 494 | // 4 valeurs qu'on reconduit d'un script a l'autre |
| 495 | 495 | // sauf s'ils sont predefinis. |
| 496 | 496 | |
| 497 | 497 | function predef_ou_cache($adresse_db, $login_db, $pass_db, $server_db) { |
| 498 | - return ((defined('_INSTALL_HOST_DB')) |
|
| 499 | - ? '' |
|
| 500 | - : "\n<input type='hidden' name='adresse_db' value=\"" . spip_htmlspecialchars($adresse_db) . '" />' |
|
| 501 | - ) |
|
| 502 | - . ((defined('_INSTALL_USER_DB')) |
|
| 503 | - ? '' |
|
| 504 | - : "\n<input type='hidden' name='login_db' value=\"" . spip_htmlspecialchars($login_db) . '" />' |
|
| 505 | - ) |
|
| 506 | - . ((defined('_INSTALL_PASS_DB')) |
|
| 507 | - ? '' |
|
| 508 | - : "\n<input type='hidden' name='pass_db' value=\"" . spip_htmlspecialchars($pass_db) . '" />' |
|
| 509 | - ) |
|
| 510 | - |
|
| 511 | - . ((defined('_INSTALL_SERVER_DB')) |
|
| 512 | - ? '' |
|
| 513 | - : "\n<input type='hidden' name='server_db' value=\"" . spip_htmlspecialchars($server_db) . '" />' |
|
| 514 | - ); |
|
| 498 | + return ((defined('_INSTALL_HOST_DB')) |
|
| 499 | + ? '' |
|
| 500 | + : "\n<input type='hidden' name='adresse_db' value=\"" . spip_htmlspecialchars($adresse_db) . '" />' |
|
| 501 | + ) |
|
| 502 | + . ((defined('_INSTALL_USER_DB')) |
|
| 503 | + ? '' |
|
| 504 | + : "\n<input type='hidden' name='login_db' value=\"" . spip_htmlspecialchars($login_db) . '" />' |
|
| 505 | + ) |
|
| 506 | + . ((defined('_INSTALL_PASS_DB')) |
|
| 507 | + ? '' |
|
| 508 | + : "\n<input type='hidden' name='pass_db' value=\"" . spip_htmlspecialchars($pass_db) . '" />' |
|
| 509 | + ) |
|
| 510 | + |
|
| 511 | + . ((defined('_INSTALL_SERVER_DB')) |
|
| 512 | + ? '' |
|
| 513 | + : "\n<input type='hidden' name='server_db' value=\"" . spip_htmlspecialchars($server_db) . '" />' |
|
| 514 | + ); |
|
| 515 | 515 | } |
| 516 | 516 | |
| 517 | 517 | // presentation des bases existantes |
| 518 | 518 | |
| 519 | 519 | function install_etape_liste_bases($server_db, $login_db, $disabled = []) { |
| 520 | - $bases = $checked = []; |
|
| 521 | - $noms = sql_listdbs($server_db); |
|
| 522 | - if (!$noms) { |
|
| 523 | - return ''; |
|
| 524 | - } |
|
| 525 | - |
|
| 526 | - foreach ($noms as $nom) { |
|
| 527 | - $id = spip_htmlspecialchars($nom); |
|
| 528 | - $dis = in_array($nom, $disabled) ? " disabled='disabled'" : ''; |
|
| 529 | - $base = ' name="choix_db" value="' |
|
| 530 | - . $nom |
|
| 531 | - . '"' |
|
| 532 | - . $dis |
|
| 533 | - . " type='radio' id='$id'"; |
|
| 534 | - $label = "<label for='$id'>" |
|
| 535 | - . ($dis ? "<i>$nom</i>" : $nom) |
|
| 536 | - . '</label>'; |
|
| 537 | - |
|
| 538 | - if ( |
|
| 539 | - !$checked and !$dis and |
|
| 540 | - (($nom == $login_db) or |
|
| 541 | - ($GLOBALS['table_prefix'] == $nom)) |
|
| 542 | - ) { |
|
| 543 | - $checked = "<input$base checked='checked' />\n$label"; |
|
| 544 | - } else { |
|
| 545 | - $bases[] = "<input$base />\n$label"; |
|
| 546 | - } |
|
| 547 | - } |
|
| 548 | - |
|
| 549 | - if (!$bases && !$checked) { |
|
| 550 | - return false; |
|
| 551 | - } |
|
| 552 | - |
|
| 553 | - if ($checked) { |
|
| 554 | - array_unshift($bases, $checked); |
|
| 555 | - $checked = true; |
|
| 556 | - } |
|
| 557 | - |
|
| 558 | - return [$checked, $bases]; |
|
| 520 | + $bases = $checked = []; |
|
| 521 | + $noms = sql_listdbs($server_db); |
|
| 522 | + if (!$noms) { |
|
| 523 | + return ''; |
|
| 524 | + } |
|
| 525 | + |
|
| 526 | + foreach ($noms as $nom) { |
|
| 527 | + $id = spip_htmlspecialchars($nom); |
|
| 528 | + $dis = in_array($nom, $disabled) ? " disabled='disabled'" : ''; |
|
| 529 | + $base = ' name="choix_db" value="' |
|
| 530 | + . $nom |
|
| 531 | + . '"' |
|
| 532 | + . $dis |
|
| 533 | + . " type='radio' id='$id'"; |
|
| 534 | + $label = "<label for='$id'>" |
|
| 535 | + . ($dis ? "<i>$nom</i>" : $nom) |
|
| 536 | + . '</label>'; |
|
| 537 | + |
|
| 538 | + if ( |
|
| 539 | + !$checked and !$dis and |
|
| 540 | + (($nom == $login_db) or |
|
| 541 | + ($GLOBALS['table_prefix'] == $nom)) |
|
| 542 | + ) { |
|
| 543 | + $checked = "<input$base checked='checked' />\n$label"; |
|
| 544 | + } else { |
|
| 545 | + $bases[] = "<input$base />\n$label"; |
|
| 546 | + } |
|
| 547 | + } |
|
| 548 | + |
|
| 549 | + if (!$bases && !$checked) { |
|
| 550 | + return false; |
|
| 551 | + } |
|
| 552 | + |
|
| 553 | + if ($checked) { |
|
| 554 | + array_unshift($bases, $checked); |
|
| 555 | + $checked = true; |
|
| 556 | + } |
|
| 557 | + |
|
| 558 | + return [$checked, $bases]; |
|
| 559 | 559 | } |
| 560 | 560 | |
| 561 | 561 | function install_propager($hidden) { |
| 562 | - $res = ''; |
|
| 563 | - foreach ($hidden as $k) { |
|
| 564 | - $v = spip_htmlentities(_request($k)); |
|
| 565 | - $res .= "<input type='hidden' name='$k' value='$v' />"; |
|
| 566 | - } |
|
| 562 | + $res = ''; |
|
| 563 | + foreach ($hidden as $k) { |
|
| 564 | + $v = spip_htmlentities(_request($k)); |
|
| 565 | + $res .= "<input type='hidden' name='$k' value='$v' />"; |
|
| 566 | + } |
|
| 567 | 567 | |
| 568 | - return $res; |
|
| 568 | + return $res; |
|
| 569 | 569 | } |
@@ -42,7 +42,7 @@ discard block |
||
| 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 |
||
| 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 |
||
| 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 | |
@@ -203,7 +203,7 @@ discard block |
||
| 203 | 203 | |
| 204 | 204 | if ($err) { |
| 205 | 205 | echo "<div class='error'>" |
| 206 | - . '<h3>' . _T('avis_attention') . '</h3><p>' . _T('install_echec_annonce') . "</p><ul class='spip'>"; |
|
| 206 | + . '<h3>'._T('avis_attention').'</h3><p>'._T('install_echec_annonce')."</p><ul class='spip'>"; |
|
| 207 | 207 | foreach ($err as $e) { |
| 208 | 208 | echo "<li><strong>$e</strong></li>\n"; |
| 209 | 209 | } |
@@ -236,8 +236,8 @@ discard block |
||
| 236 | 236 | |
| 237 | 237 | |
| 238 | 238 | function info_etape($titre, $complement = '') { |
| 239 | - return '<h2>' . $titre . "</h2>\n" . |
|
| 240 | - ($complement ? '' . $complement . "\n" : ''); |
|
| 239 | + return '<h2>'.$titre."</h2>\n". |
|
| 240 | + ($complement ? ''.$complement."\n" : ''); |
|
| 241 | 241 | } |
| 242 | 242 | |
| 243 | 243 | /** |
@@ -251,18 +251,18 @@ discard block |
||
| 251 | 251 | $code = _T('bouton_suivant'); |
| 252 | 252 | } |
| 253 | 253 | static $suivant = 0; |
| 254 | - $id = 'suivant' . (($suivant > 0) ? strval($suivant) : ''); |
|
| 254 | + $id = 'suivant'.(($suivant > 0) ? strval($suivant) : ''); |
|
| 255 | 255 | $suivant += 1; |
| 256 | 256 | |
| 257 | - return "\n<p class='boutons suivant'><input id='" . $id . "' type='submit'\nvalue=\"" . |
|
| 258 | - $code . |
|
| 257 | + return "\n<p class='boutons suivant'><input id='".$id."' type='submit'\nvalue=\"". |
|
| 258 | + $code. |
|
| 259 | 259 | " >>\" /></p>\n"; |
| 260 | 260 | } |
| 261 | 261 | |
| 262 | 262 | function info_progression_etape($en_cours, $phase, $dir, $erreur = false) { |
| 263 | 263 | $intitule_etat = []; |
| 264 | 264 | //$en_cours = _request('etape')?_request('etape'):""; |
| 265 | - $liste = find_all_in_path($dir, $phase . '(([0-9])+|fin)[.]php$'); |
|
| 265 | + $liste = find_all_in_path($dir, $phase.'(([0-9])+|fin)[.]php$'); |
|
| 266 | 266 | $debut = 1; |
| 267 | 267 | $etat = 'ok'; |
| 268 | 268 | $last = count($liste); |
@@ -301,8 +301,8 @@ discard block |
||
| 301 | 301 | } |
| 302 | 302 | |
| 303 | 303 | $aff_etapes .= "<li class='$class'><div class='fond'>"; |
| 304 | - $aff_etapes .= '<em>' . _T('etape') . " </em><span class='numero_etape'>$debut</span><em> : </em>"; |
|
| 305 | - $aff_etapes .= '<'.(($debut == $en_cours) ? 'strong' : 'span').' class="label_etape">' . $intitule_etat["$phase"][$debut] . '</'.(($debut == $en_cours) ? 'strong' : 'span').'>'; |
|
| 304 | + $aff_etapes .= '<em>'._T('etape')." </em><span class='numero_etape'>$debut</span><em> : </em>"; |
|
| 305 | + $aff_etapes .= '<'.(($debut == $en_cours) ? 'strong' : 'span').' class="label_etape">'.$intitule_etat["$phase"][$debut].'</'.(($debut == $en_cours) ? 'strong' : 'span').'>'; |
|
| 306 | 306 | $aff_etapes .= '</div></li>'; |
| 307 | 307 | } |
| 308 | 308 | $debut++; |
@@ -314,11 +314,11 @@ discard block |
||
| 314 | 314 | |
| 315 | 315 | |
| 316 | 316 | function fieldset($legend, $champs = [], $apres = '', $avant = '') { |
| 317 | - return "<fieldset>\n" . |
|
| 318 | - $avant . |
|
| 319 | - ($legend ? '<legend>' . $legend . "</legend>\n" : '') . |
|
| 320 | - fieldset_champs($champs) . |
|
| 321 | - $apres . |
|
| 317 | + return "<fieldset>\n". |
|
| 318 | + $avant. |
|
| 319 | + ($legend ? '<legend>'.$legend."</legend>\n" : ''). |
|
| 320 | + fieldset_champs($champs). |
|
| 321 | + $apres. |
|
| 322 | 322 | "</fieldset>\n"; |
| 323 | 323 | } |
| 324 | 324 | |
@@ -328,18 +328,18 @@ discard block |
||
| 328 | 328 | $type = isset($contenu['hidden']) ? 'hidden' : (preg_match(',^pass,', $nom) ? 'password' : 'text'); |
| 329 | 329 | $class = isset($contenu['hidden']) ? '' : "class='formo' size='40' "; |
| 330 | 330 | if (isset($contenu['alternatives'])) { |
| 331 | - $fieldset .= $contenu['label'] . "\n"; |
|
| 331 | + $fieldset .= $contenu['label']."\n"; |
|
| 332 | 332 | foreach ($contenu['alternatives'] as $valeur => $label) { |
| 333 | - $fieldset .= "<input type='radio' name='" . $nom . |
|
| 333 | + $fieldset .= "<input type='radio' name='".$nom. |
|
| 334 | 334 | "' id='$nom-$valeur' value='$valeur'" |
| 335 | 335 | . (($valeur == $contenu['valeur']) ? "\nchecked='checked'" : '') |
| 336 | 336 | . "/>\n"; |
| 337 | - $fieldset .= "<label for='$nom-$valeur'>" . $label . "</label>\n"; |
|
| 337 | + $fieldset .= "<label for='$nom-$valeur'>".$label."</label>\n"; |
|
| 338 | 338 | } |
| 339 | 339 | $fieldset .= "<br />\n"; |
| 340 | 340 | } else { |
| 341 | - $fieldset .= "<label for='" . $nom . "'>" . $contenu['label'] . "</label>\n"; |
|
| 342 | - $fieldset .= '<input ' . $class . "type='" . $type . "' id='" . $nom . "' name='" . $nom . "'\nvalue='" . $contenu['valeur'] . "'" |
|
| 341 | + $fieldset .= "<label for='".$nom."'>".$contenu['label']."</label>\n"; |
|
| 342 | + $fieldset .= '<input '.$class."type='".$type."' id='".$nom."' name='".$nom."'\nvalue='".$contenu['valeur']."'" |
|
| 343 | 343 | . (preg_match(',^(pass|login),', $nom) ? " autocomplete='off'" : '') |
| 344 | 344 | . ((isset($contenu['required']) and $contenu['required']) ? " required='required'" : '') |
| 345 | 345 | . " />\n"; |
@@ -351,7 +351,7 @@ discard block |
||
| 351 | 351 | |
| 352 | 352 | function install_select_serveur() { |
| 353 | 353 | $options = []; |
| 354 | - $dir = _DIR_RESTREINT . 'req/'; |
|
| 354 | + $dir = _DIR_RESTREINT.'req/'; |
|
| 355 | 355 | $d = opendir($dir); |
| 356 | 356 | if (!$d) { |
| 357 | 357 | return []; |
@@ -359,17 +359,17 @@ discard block |
||
| 359 | 359 | while (($f = readdir($d)) !== false) { |
| 360 | 360 | if ( |
| 361 | 361 | (preg_match('/^(.*)[.]php$/', $f, $s)) |
| 362 | - and is_readable($f = $dir . $f) |
|
| 362 | + and is_readable($f = $dir.$f) |
|
| 363 | 363 | ) { |
| 364 | 364 | require_once($f); |
| 365 | 365 | $s = $s[1]; |
| 366 | - $v = 'spip_versions_' . $s; |
|
| 366 | + $v = 'spip_versions_'.$s; |
|
| 367 | 367 | if (function_exists($v) and $v()) { |
| 368 | 368 | $titre = _T("install_select_type_$s"); |
| 369 | 369 | // proposer mysql par defaut si dispo |
| 370 | 370 | $checked = ($s == 'mysql' ? " checked='checked'" : ''); |
| 371 | 371 | $options[$s] = "<li><input type='radio' id='$s' value='$s' name='server_db'$checked>" |
| 372 | - . "<label for='$s'>" . ($titre ?: $s) . '</label></li>'; |
|
| 372 | + . "<label for='$s'>".($titre ?: $s).'</label></li>'; |
|
| 373 | 373 | } else { |
| 374 | 374 | spip_log("$s: portage indisponible"); |
| 375 | 375 | } |
@@ -387,8 +387,8 @@ discard block |
||
| 387 | 387 | "\n<input type='hidden' name='etape' value='$etape' />" |
| 388 | 388 | . $hidden |
| 389 | 389 | . (_request('echec') ? |
| 390 | - ('<p><b>' . _T('avis_connexion_echec_1') . |
|
| 391 | - '</b></p><p>' . _T('avis_connexion_echec_2') . "</p><p style='font-size: small;'>" . _T('avis_connexion_echec_3') . '</p>') |
|
| 390 | + ('<p><b>'._T('avis_connexion_echec_1'). |
|
| 391 | + '</b></p><p>'._T('avis_connexion_echec_2')."</p><p style='font-size: small;'>"._T('avis_connexion_echec_3').'</p>') |
|
| 392 | 392 | : '') |
| 393 | 393 | |
| 394 | 394 | . ($jquery ? http_script('', 'jquery.js') : '') |
@@ -426,9 +426,9 @@ discard block |
||
| 426 | 426 | });') |
| 427 | 427 | |
| 428 | 428 | . ($server_db |
| 429 | - ? '<input type="hidden" name="server_db" value="' . $server_db . '" />' |
|
| 429 | + ? '<input type="hidden" name="server_db" value="'.$server_db.'" />' |
|
| 430 | 430 | . (($predef[0]) |
| 431 | - ? ('<h3>' . _T('install_serveur_hebergeur') . '</h3>') |
|
| 431 | + ? ('<h3>'._T('install_serveur_hebergeur').'</h3>') |
|
| 432 | 432 | : '') |
| 433 | 433 | : ('<fieldset><legend>' |
| 434 | 434 | . _T('install_select_type_db') |
@@ -443,9 +443,9 @@ discard block |
||
| 443 | 443 | . "\n</ul>\n</div></fieldset>") |
| 444 | 444 | ) |
| 445 | 445 | . '<div id="install_adresse_base_hebergeur">' |
| 446 | - . '<p>' . _T('texte_connexion_mysql') . '</p>' |
|
| 446 | + . '<p>'._T('texte_connexion_mysql').'</p>' |
|
| 447 | 447 | . ($predef[1] |
| 448 | - ? '<h3>' . _T('install_adresse_base_hebergeur') . '</h3>' |
|
| 448 | + ? '<h3>'._T('install_adresse_base_hebergeur').'</h3>' |
|
| 449 | 449 | : fieldset( |
| 450 | 450 | _T('entree_base_donnee_1'), |
| 451 | 451 | [ |
@@ -460,7 +460,7 @@ discard block |
||
| 460 | 460 | |
| 461 | 461 | . '<div id="install_login_base_hebergeur">' |
| 462 | 462 | . ($predef[2] |
| 463 | - ? '<h3>' . _T('install_login_base_hebergeur') . '</h3>' |
|
| 463 | + ? '<h3>'._T('install_login_base_hebergeur').'</h3>' |
|
| 464 | 464 | : fieldset( |
| 465 | 465 | _T('entree_login_connexion_1'), |
| 466 | 466 | [ |
@@ -475,7 +475,7 @@ discard block |
||
| 475 | 475 | |
| 476 | 476 | . '<div id="install_pass_base_hebergeur">' |
| 477 | 477 | . ($predef[3] |
| 478 | - ? '<h3>' . _T('install_pass_base_hebergeur') . '</h3>' |
|
| 478 | + ? '<h3>'._T('install_pass_base_hebergeur').'</h3>' |
|
| 479 | 479 | : fieldset( |
| 480 | 480 | _T('entree_mot_passe_1'), |
| 481 | 481 | [ |
@@ -497,20 +497,20 @@ discard block |
||
| 497 | 497 | function predef_ou_cache($adresse_db, $login_db, $pass_db, $server_db) { |
| 498 | 498 | return ((defined('_INSTALL_HOST_DB')) |
| 499 | 499 | ? '' |
| 500 | - : "\n<input type='hidden' name='adresse_db' value=\"" . spip_htmlspecialchars($adresse_db) . '" />' |
|
| 500 | + : "\n<input type='hidden' name='adresse_db' value=\"".spip_htmlspecialchars($adresse_db).'" />' |
|
| 501 | 501 | ) |
| 502 | 502 | . ((defined('_INSTALL_USER_DB')) |
| 503 | 503 | ? '' |
| 504 | - : "\n<input type='hidden' name='login_db' value=\"" . spip_htmlspecialchars($login_db) . '" />' |
|
| 504 | + : "\n<input type='hidden' name='login_db' value=\"".spip_htmlspecialchars($login_db).'" />' |
|
| 505 | 505 | ) |
| 506 | 506 | . ((defined('_INSTALL_PASS_DB')) |
| 507 | 507 | ? '' |
| 508 | - : "\n<input type='hidden' name='pass_db' value=\"" . spip_htmlspecialchars($pass_db) . '" />' |
|
| 508 | + : "\n<input type='hidden' name='pass_db' value=\"".spip_htmlspecialchars($pass_db).'" />' |
|
| 509 | 509 | ) |
| 510 | 510 | |
| 511 | 511 | . ((defined('_INSTALL_SERVER_DB')) |
| 512 | 512 | ? '' |
| 513 | - : "\n<input type='hidden' name='server_db' value=\"" . spip_htmlspecialchars($server_db) . '" />' |
|
| 513 | + : "\n<input type='hidden' name='server_db' value=\"".spip_htmlspecialchars($server_db).'" />' |
|
| 514 | 514 | ); |
| 515 | 515 | } |
| 516 | 516 | |