@@ -11,7 +11,7 @@ discard block |
||
| 11 | 11 | \***************************************************************************/ |
| 12 | 12 | |
| 13 | 13 | if (!defined('_ECRIRE_INC_VERSION')) { |
| 14 | - return; |
|
| 14 | + return; |
|
| 15 | 15 | } |
| 16 | 16 | |
| 17 | 17 | include_spip('inc/headers'); |
@@ -20,199 +20,199 @@ discard block |
||
| 20 | 20 | // https://code.spip.net/@install_bases |
| 21 | 21 | function install_bases($adresse_db, $login_db, $pass_db, $server_db, $choix_db, $sel_db, $chmod_db) { |
| 22 | 22 | |
| 23 | - // Prefix des tables : |
|
| 24 | - // S'il n'est pas defini par mes_options/inc/mutualiser, on va le creer |
|
| 25 | - // a partir de ce qui est envoye a l'installation |
|
| 26 | - if (!defined('_INSTALL_TABLE_PREFIX')) { |
|
| 27 | - $table_prefix = ($GLOBALS['table_prefix'] != 'spip') |
|
| 28 | - ? $GLOBALS['table_prefix'] |
|
| 29 | - : preparer_prefixe_tables(_request('tprefix')); |
|
| 30 | - // S'il est vide on remet spip |
|
| 31 | - if (!$table_prefix) { |
|
| 32 | - $table_prefix = 'spip'; |
|
| 33 | - } |
|
| 34 | - } else { |
|
| 35 | - $table_prefix = _INSTALL_TABLE_PREFIX; |
|
| 36 | - } |
|
| 37 | - |
|
| 38 | - if (preg_match(',(.*):(.*),', $adresse_db, $r)) { |
|
| 39 | - list(, $adresse_db, $port) = $r; |
|
| 40 | - } else { |
|
| 41 | - $port = ''; |
|
| 42 | - } |
|
| 43 | - |
|
| 44 | - $GLOBALS['connexions'][$server_db] |
|
| 45 | - = spip_connect_db($adresse_db, $port, $login_db, $pass_db, '', $server_db); |
|
| 46 | - |
|
| 47 | - $GLOBALS['connexions'][$server_db][$GLOBALS['spip_sql_version']] |
|
| 48 | - = $GLOBALS['spip_' . $server_db . '_functions_' . $GLOBALS['spip_sql_version']]; |
|
| 49 | - |
|
| 50 | - $fquery = sql_serveur('query', $server_db); |
|
| 51 | - if ($choix_db == 'new_spip') { |
|
| 52 | - $re = ',^[a-z_][a-z_0-9-]*$,i'; |
|
| 53 | - if (preg_match($re, $sel_db)) { |
|
| 54 | - $ok = sql_create_base($sel_db, $server_db); |
|
| 55 | - if (!$ok) { |
|
| 56 | - $re = "Impossible de creer la base $re"; |
|
| 57 | - spip_log($re); |
|
| 58 | - return '<p>' . _T('avis_connexion_erreur_creer_base') . "</p><!--\n$re\n-->"; |
|
| 59 | - } |
|
| 60 | - } else { |
|
| 61 | - $re = "Le nom de la base doit correspondre a $re"; |
|
| 62 | - spip_log($re); |
|
| 63 | - |
|
| 64 | - return '<p>' . _T('avis_connexion_erreur_nom_base') . "</p><!--\n$re\n-->"; |
|
| 65 | - } |
|
| 66 | - } |
|
| 67 | - |
|
| 68 | - // on rejoue la connexion apres avoir teste si il faut lui indiquer |
|
| 69 | - // un sql_mode |
|
| 70 | - install_mode_appel($server_db, false); |
|
| 71 | - $GLOBALS['connexions'][$server_db] |
|
| 72 | - = spip_connect_db($adresse_db, $port, $login_db, $pass_db, $sel_db, $server_db); |
|
| 73 | - |
|
| 74 | - $GLOBALS['connexions'][$server_db][$GLOBALS['spip_sql_version']] |
|
| 75 | - = $GLOBALS['spip_' . $server_db . '_functions_' . $GLOBALS['spip_sql_version']]; |
|
| 76 | - |
|
| 77 | - // Completer le tableau decrivant la connexion |
|
| 78 | - |
|
| 79 | - $GLOBALS['connexions'][$server_db]['prefixe'] = $table_prefix; |
|
| 80 | - $GLOBALS['connexions'][$server_db]['db'] = $sel_db; |
|
| 81 | - |
|
| 82 | - $old = sql_showbase($table_prefix . '_meta', $server_db); |
|
| 83 | - if ($old) { |
|
| 84 | - $old = sql_fetch($old, $server_db); |
|
| 85 | - } |
|
| 86 | - if (!$old) { |
|
| 87 | - // Si possible, demander au serveur d'envoyer les textes |
|
| 88 | - // dans le codage std de SPIP, |
|
| 89 | - $charset = sql_get_charset(_DEFAULT_CHARSET, $server_db); |
|
| 90 | - |
|
| 91 | - if ($charset) { |
|
| 92 | - sql_set_charset($charset['charset'], $server_db); |
|
| 93 | - $GLOBALS['meta']['charset_sql_base'] = |
|
| 94 | - $charset['charset']; |
|
| 95 | - $GLOBALS['meta']['charset_collation_sql_base'] = |
|
| 96 | - $charset['collation']; |
|
| 97 | - $GLOBALS['meta']['charset_sql_connexion'] = |
|
| 98 | - $charset['charset']; |
|
| 99 | - $charsetbase = $charset['charset']; |
|
| 100 | - } else { |
|
| 101 | - spip_log(_DEFAULT_CHARSET . ' inconnu du serveur SQL'); |
|
| 102 | - $charsetbase = 'standard'; |
|
| 103 | - } |
|
| 104 | - spip_log("Creation des tables. Codage $charsetbase"); |
|
| 105 | - creer_base($server_db); // AT LAST |
|
| 106 | - // memoriser avec quel charset on l'a creee |
|
| 107 | - |
|
| 108 | - if ($charset) { |
|
| 109 | - $t = [ |
|
| 110 | - 'nom' => 'charset_sql_base', |
|
| 111 | - 'valeur' => $charset['charset'], |
|
| 112 | - 'impt' => 'non' |
|
| 113 | - ]; |
|
| 114 | - @sql_insertq('spip_meta', $t, '', $server_db); |
|
| 115 | - $t['nom'] = 'charset_collation_sql_base'; |
|
| 116 | - $t['valeur'] = $charset['collation']; |
|
| 117 | - @sql_insertq('spip_meta', $t, '', $server_db); |
|
| 118 | - $t['nom'] = 'charset_sql_connexion'; |
|
| 119 | - $t['valeur'] = $charset['charset']; |
|
| 120 | - @sql_insertq('spip_meta', $t, '', $server_db); |
|
| 121 | - } |
|
| 122 | - $t = [ |
|
| 123 | - 'nom' => 'version_installee', |
|
| 124 | - 'valeur' => $GLOBALS['spip_version_base'], |
|
| 125 | - 'impt' => 'non' |
|
| 126 | - ]; |
|
| 127 | - @sql_insertq('spip_meta', $t, '', $server_db); |
|
| 128 | - $t['nom'] = 'nouvelle_install'; |
|
| 129 | - $t['valeur'] = 1; |
|
| 130 | - @sql_insertq('spip_meta', $t, '', $server_db); |
|
| 131 | - // positionner la langue par defaut du site si un cookie de lang a ete mis |
|
| 132 | - if (isset($_COOKIE['spip_lang_ecrire'])) { |
|
| 133 | - @sql_insertq( |
|
| 134 | - 'spip_meta', |
|
| 135 | - ['nom' => 'langue_site', 'valeur' => $_COOKIE['spip_lang_ecrire']], |
|
| 136 | - '', |
|
| 137 | - $server_db |
|
| 138 | - ); |
|
| 139 | - } |
|
| 140 | - } else { |
|
| 141 | - // pour recreer les tables disparues au besoin |
|
| 142 | - spip_log('Table des Meta deja la. Verification des autres.'); |
|
| 143 | - creer_base($server_db); |
|
| 144 | - $fupdateq = sql_serveur('updateq', $server_db); |
|
| 145 | - |
|
| 146 | - $r = $fquery("SELECT valeur FROM spip_meta WHERE nom='version_installee'", $server_db); |
|
| 147 | - |
|
| 148 | - if ($r) { |
|
| 149 | - $r = sql_fetch($r, $server_db); |
|
| 150 | - } |
|
| 151 | - $version_installee = !$r ? 0 : (double)$r['valeur']; |
|
| 152 | - if (!$version_installee or ($GLOBALS['spip_version_base'] < $version_installee)) { |
|
| 153 | - $fupdateq( |
|
| 154 | - 'spip_meta', |
|
| 155 | - ['valeur' => $GLOBALS['spip_version_base'], 'impt' => 'non'], |
|
| 156 | - "nom='version_installee'", |
|
| 157 | - '', |
|
| 158 | - $server_db |
|
| 159 | - ); |
|
| 160 | - spip_log('nouvelle version installee: ' . $GLOBALS['spip_version_base']); |
|
| 161 | - } |
|
| 162 | - // eliminer la derniere operation d'admin mal terminee |
|
| 163 | - // notamment la mise a jour |
|
| 164 | - @$fquery("DELETE FROM spip_meta WHERE nom='import_all' OR nom='admin'", $server_db); |
|
| 165 | - } |
|
| 166 | - |
|
| 167 | - // recuperer le charset de la connexion dans les meta |
|
| 168 | - $charset = ''; |
|
| 169 | - $r = $fquery("SELECT valeur FROM spip_meta WHERE nom='charset_sql_connexion'", $server_db); |
|
| 170 | - if ($r) { |
|
| 171 | - $r = sql_fetch($r, $server_db); |
|
| 172 | - } |
|
| 173 | - if ($r) { |
|
| 174 | - $charset = $r['valeur']; |
|
| 175 | - } |
|
| 176 | - |
|
| 177 | - $ligne_rappel = install_mode_appel($server_db); |
|
| 178 | - |
|
| 179 | - $result_ok = @$fquery('SELECT COUNT(*) FROM spip_meta', $server_db); |
|
| 180 | - if (!$result_ok) { |
|
| 181 | - return "<!--\nvielle = $old rappel= $ligne_rappel\n-->"; |
|
| 182 | - } |
|
| 183 | - |
|
| 184 | - if ($chmod_db) { |
|
| 185 | - install_fichier_connexion( |
|
| 186 | - _FILE_CHMOD_TMP, |
|
| 187 | - "if (!defined('_SPIP_CHMOD')) define('_SPIP_CHMOD', " . sprintf('0%3o', $chmod_db) . ");\n" |
|
| 188 | - ); |
|
| 189 | - } |
|
| 190 | - |
|
| 191 | - // si ce fichier existe a cette etape c'est qu'il provient |
|
| 192 | - // d'une installation qui ne l'a pas cree correctement. |
|
| 193 | - // Le supprimer pour que _FILE_CONNECT_TMP prime. |
|
| 194 | - |
|
| 195 | - if (_FILE_CONNECT and file_exists(_FILE_CONNECT)) { |
|
| 196 | - spip_unlink(_FILE_CONNECT); |
|
| 197 | - } |
|
| 198 | - |
|
| 199 | - install_fichier_connexion( |
|
| 200 | - _FILE_CONNECT_TMP, |
|
| 201 | - $ligne_rappel |
|
| 202 | - . install_connexion( |
|
| 203 | - $adresse_db, |
|
| 204 | - $port, |
|
| 205 | - $login_db, |
|
| 206 | - $pass_db, |
|
| 207 | - $sel_db, |
|
| 208 | - $server_db, |
|
| 209 | - $table_prefix, |
|
| 210 | - '', |
|
| 211 | - $charset |
|
| 212 | - ) |
|
| 213 | - ); |
|
| 214 | - |
|
| 215 | - return ''; |
|
| 23 | + // Prefix des tables : |
|
| 24 | + // S'il n'est pas defini par mes_options/inc/mutualiser, on va le creer |
|
| 25 | + // a partir de ce qui est envoye a l'installation |
|
| 26 | + if (!defined('_INSTALL_TABLE_PREFIX')) { |
|
| 27 | + $table_prefix = ($GLOBALS['table_prefix'] != 'spip') |
|
| 28 | + ? $GLOBALS['table_prefix'] |
|
| 29 | + : preparer_prefixe_tables(_request('tprefix')); |
|
| 30 | + // S'il est vide on remet spip |
|
| 31 | + if (!$table_prefix) { |
|
| 32 | + $table_prefix = 'spip'; |
|
| 33 | + } |
|
| 34 | + } else { |
|
| 35 | + $table_prefix = _INSTALL_TABLE_PREFIX; |
|
| 36 | + } |
|
| 37 | + |
|
| 38 | + if (preg_match(',(.*):(.*),', $adresse_db, $r)) { |
|
| 39 | + list(, $adresse_db, $port) = $r; |
|
| 40 | + } else { |
|
| 41 | + $port = ''; |
|
| 42 | + } |
|
| 43 | + |
|
| 44 | + $GLOBALS['connexions'][$server_db] |
|
| 45 | + = spip_connect_db($adresse_db, $port, $login_db, $pass_db, '', $server_db); |
|
| 46 | + |
|
| 47 | + $GLOBALS['connexions'][$server_db][$GLOBALS['spip_sql_version']] |
|
| 48 | + = $GLOBALS['spip_' . $server_db . '_functions_' . $GLOBALS['spip_sql_version']]; |
|
| 49 | + |
|
| 50 | + $fquery = sql_serveur('query', $server_db); |
|
| 51 | + if ($choix_db == 'new_spip') { |
|
| 52 | + $re = ',^[a-z_][a-z_0-9-]*$,i'; |
|
| 53 | + if (preg_match($re, $sel_db)) { |
|
| 54 | + $ok = sql_create_base($sel_db, $server_db); |
|
| 55 | + if (!$ok) { |
|
| 56 | + $re = "Impossible de creer la base $re"; |
|
| 57 | + spip_log($re); |
|
| 58 | + return '<p>' . _T('avis_connexion_erreur_creer_base') . "</p><!--\n$re\n-->"; |
|
| 59 | + } |
|
| 60 | + } else { |
|
| 61 | + $re = "Le nom de la base doit correspondre a $re"; |
|
| 62 | + spip_log($re); |
|
| 63 | + |
|
| 64 | + return '<p>' . _T('avis_connexion_erreur_nom_base') . "</p><!--\n$re\n-->"; |
|
| 65 | + } |
|
| 66 | + } |
|
| 67 | + |
|
| 68 | + // on rejoue la connexion apres avoir teste si il faut lui indiquer |
|
| 69 | + // un sql_mode |
|
| 70 | + install_mode_appel($server_db, false); |
|
| 71 | + $GLOBALS['connexions'][$server_db] |
|
| 72 | + = spip_connect_db($adresse_db, $port, $login_db, $pass_db, $sel_db, $server_db); |
|
| 73 | + |
|
| 74 | + $GLOBALS['connexions'][$server_db][$GLOBALS['spip_sql_version']] |
|
| 75 | + = $GLOBALS['spip_' . $server_db . '_functions_' . $GLOBALS['spip_sql_version']]; |
|
| 76 | + |
|
| 77 | + // Completer le tableau decrivant la connexion |
|
| 78 | + |
|
| 79 | + $GLOBALS['connexions'][$server_db]['prefixe'] = $table_prefix; |
|
| 80 | + $GLOBALS['connexions'][$server_db]['db'] = $sel_db; |
|
| 81 | + |
|
| 82 | + $old = sql_showbase($table_prefix . '_meta', $server_db); |
|
| 83 | + if ($old) { |
|
| 84 | + $old = sql_fetch($old, $server_db); |
|
| 85 | + } |
|
| 86 | + if (!$old) { |
|
| 87 | + // Si possible, demander au serveur d'envoyer les textes |
|
| 88 | + // dans le codage std de SPIP, |
|
| 89 | + $charset = sql_get_charset(_DEFAULT_CHARSET, $server_db); |
|
| 90 | + |
|
| 91 | + if ($charset) { |
|
| 92 | + sql_set_charset($charset['charset'], $server_db); |
|
| 93 | + $GLOBALS['meta']['charset_sql_base'] = |
|
| 94 | + $charset['charset']; |
|
| 95 | + $GLOBALS['meta']['charset_collation_sql_base'] = |
|
| 96 | + $charset['collation']; |
|
| 97 | + $GLOBALS['meta']['charset_sql_connexion'] = |
|
| 98 | + $charset['charset']; |
|
| 99 | + $charsetbase = $charset['charset']; |
|
| 100 | + } else { |
|
| 101 | + spip_log(_DEFAULT_CHARSET . ' inconnu du serveur SQL'); |
|
| 102 | + $charsetbase = 'standard'; |
|
| 103 | + } |
|
| 104 | + spip_log("Creation des tables. Codage $charsetbase"); |
|
| 105 | + creer_base($server_db); // AT LAST |
|
| 106 | + // memoriser avec quel charset on l'a creee |
|
| 107 | + |
|
| 108 | + if ($charset) { |
|
| 109 | + $t = [ |
|
| 110 | + 'nom' => 'charset_sql_base', |
|
| 111 | + 'valeur' => $charset['charset'], |
|
| 112 | + 'impt' => 'non' |
|
| 113 | + ]; |
|
| 114 | + @sql_insertq('spip_meta', $t, '', $server_db); |
|
| 115 | + $t['nom'] = 'charset_collation_sql_base'; |
|
| 116 | + $t['valeur'] = $charset['collation']; |
|
| 117 | + @sql_insertq('spip_meta', $t, '', $server_db); |
|
| 118 | + $t['nom'] = 'charset_sql_connexion'; |
|
| 119 | + $t['valeur'] = $charset['charset']; |
|
| 120 | + @sql_insertq('spip_meta', $t, '', $server_db); |
|
| 121 | + } |
|
| 122 | + $t = [ |
|
| 123 | + 'nom' => 'version_installee', |
|
| 124 | + 'valeur' => $GLOBALS['spip_version_base'], |
|
| 125 | + 'impt' => 'non' |
|
| 126 | + ]; |
|
| 127 | + @sql_insertq('spip_meta', $t, '', $server_db); |
|
| 128 | + $t['nom'] = 'nouvelle_install'; |
|
| 129 | + $t['valeur'] = 1; |
|
| 130 | + @sql_insertq('spip_meta', $t, '', $server_db); |
|
| 131 | + // positionner la langue par defaut du site si un cookie de lang a ete mis |
|
| 132 | + if (isset($_COOKIE['spip_lang_ecrire'])) { |
|
| 133 | + @sql_insertq( |
|
| 134 | + 'spip_meta', |
|
| 135 | + ['nom' => 'langue_site', 'valeur' => $_COOKIE['spip_lang_ecrire']], |
|
| 136 | + '', |
|
| 137 | + $server_db |
|
| 138 | + ); |
|
| 139 | + } |
|
| 140 | + } else { |
|
| 141 | + // pour recreer les tables disparues au besoin |
|
| 142 | + spip_log('Table des Meta deja la. Verification des autres.'); |
|
| 143 | + creer_base($server_db); |
|
| 144 | + $fupdateq = sql_serveur('updateq', $server_db); |
|
| 145 | + |
|
| 146 | + $r = $fquery("SELECT valeur FROM spip_meta WHERE nom='version_installee'", $server_db); |
|
| 147 | + |
|
| 148 | + if ($r) { |
|
| 149 | + $r = sql_fetch($r, $server_db); |
|
| 150 | + } |
|
| 151 | + $version_installee = !$r ? 0 : (double)$r['valeur']; |
|
| 152 | + if (!$version_installee or ($GLOBALS['spip_version_base'] < $version_installee)) { |
|
| 153 | + $fupdateq( |
|
| 154 | + 'spip_meta', |
|
| 155 | + ['valeur' => $GLOBALS['spip_version_base'], 'impt' => 'non'], |
|
| 156 | + "nom='version_installee'", |
|
| 157 | + '', |
|
| 158 | + $server_db |
|
| 159 | + ); |
|
| 160 | + spip_log('nouvelle version installee: ' . $GLOBALS['spip_version_base']); |
|
| 161 | + } |
|
| 162 | + // eliminer la derniere operation d'admin mal terminee |
|
| 163 | + // notamment la mise a jour |
|
| 164 | + @$fquery("DELETE FROM spip_meta WHERE nom='import_all' OR nom='admin'", $server_db); |
|
| 165 | + } |
|
| 166 | + |
|
| 167 | + // recuperer le charset de la connexion dans les meta |
|
| 168 | + $charset = ''; |
|
| 169 | + $r = $fquery("SELECT valeur FROM spip_meta WHERE nom='charset_sql_connexion'", $server_db); |
|
| 170 | + if ($r) { |
|
| 171 | + $r = sql_fetch($r, $server_db); |
|
| 172 | + } |
|
| 173 | + if ($r) { |
|
| 174 | + $charset = $r['valeur']; |
|
| 175 | + } |
|
| 176 | + |
|
| 177 | + $ligne_rappel = install_mode_appel($server_db); |
|
| 178 | + |
|
| 179 | + $result_ok = @$fquery('SELECT COUNT(*) FROM spip_meta', $server_db); |
|
| 180 | + if (!$result_ok) { |
|
| 181 | + return "<!--\nvielle = $old rappel= $ligne_rappel\n-->"; |
|
| 182 | + } |
|
| 183 | + |
|
| 184 | + if ($chmod_db) { |
|
| 185 | + install_fichier_connexion( |
|
| 186 | + _FILE_CHMOD_TMP, |
|
| 187 | + "if (!defined('_SPIP_CHMOD')) define('_SPIP_CHMOD', " . sprintf('0%3o', $chmod_db) . ");\n" |
|
| 188 | + ); |
|
| 189 | + } |
|
| 190 | + |
|
| 191 | + // si ce fichier existe a cette etape c'est qu'il provient |
|
| 192 | + // d'une installation qui ne l'a pas cree correctement. |
|
| 193 | + // Le supprimer pour que _FILE_CONNECT_TMP prime. |
|
| 194 | + |
|
| 195 | + if (_FILE_CONNECT and file_exists(_FILE_CONNECT)) { |
|
| 196 | + spip_unlink(_FILE_CONNECT); |
|
| 197 | + } |
|
| 198 | + |
|
| 199 | + install_fichier_connexion( |
|
| 200 | + _FILE_CONNECT_TMP, |
|
| 201 | + $ligne_rappel |
|
| 202 | + . install_connexion( |
|
| 203 | + $adresse_db, |
|
| 204 | + $port, |
|
| 205 | + $login_db, |
|
| 206 | + $pass_db, |
|
| 207 | + $sel_db, |
|
| 208 | + $server_db, |
|
| 209 | + $table_prefix, |
|
| 210 | + '', |
|
| 211 | + $charset |
|
| 212 | + ) |
|
| 213 | + ); |
|
| 214 | + |
|
| 215 | + return ''; |
|
| 216 | 216 | } |
| 217 | 217 | |
| 218 | 218 | /** |
@@ -227,169 +227,169 @@ discard block |
||
| 227 | 227 | * @return string Le préfixe corrigé |
| 228 | 228 | */ |
| 229 | 229 | function preparer_prefixe_tables($prefixe) { |
| 230 | - return trim(preg_replace(',^[0-9]+,', '', preg_replace(',[^a-z0-9],', '', strtolower($prefixe)))); |
|
| 230 | + return trim(preg_replace(',^[0-9]+,', '', preg_replace(',[^a-z0-9],', '', strtolower($prefixe)))); |
|
| 231 | 231 | } |
| 232 | 232 | |
| 233 | 233 | // https://code.spip.net/@install_propose_ldap |
| 234 | 234 | function install_propose_ldap() { |
| 235 | - return generer_form_ecrire('install', ( |
|
| 236 | - fieldset( |
|
| 237 | - _T('info_authentification_externe'), |
|
| 238 | - [ |
|
| 239 | - 'etape' => [ |
|
| 240 | - 'label' => _T('texte_annuaire_ldap_1'), |
|
| 241 | - 'valeur' => 'ldap1', |
|
| 242 | - 'hidden' => true |
|
| 243 | - ] |
|
| 244 | - ], |
|
| 245 | - bouton_suivant(_T('bouton_acces_ldap')) |
|
| 246 | - ))); |
|
| 235 | + return generer_form_ecrire('install', ( |
|
| 236 | + fieldset( |
|
| 237 | + _T('info_authentification_externe'), |
|
| 238 | + [ |
|
| 239 | + 'etape' => [ |
|
| 240 | + 'label' => _T('texte_annuaire_ldap_1'), |
|
| 241 | + 'valeur' => 'ldap1', |
|
| 242 | + 'hidden' => true |
|
| 243 | + ] |
|
| 244 | + ], |
|
| 245 | + bouton_suivant(_T('bouton_acces_ldap')) |
|
| 246 | + ))); |
|
| 247 | 247 | } |
| 248 | 248 | |
| 249 | 249 | |
| 250 | 250 | // https://code.spip.net/@install_premier_auteur |
| 251 | 251 | function install_premier_auteur($email, $login, $nom, $pass, $hidden, $auteur_obligatoire) { |
| 252 | - return info_progression_etape(3, 'etape_', 'install/') . |
|
| 253 | - info_etape( |
|
| 254 | - _T('info_informations_personnelles'), |
|
| 255 | - '<b>' . _T('texte_informations_personnelles_1') . '</b>' . |
|
| 256 | - aider('install5', true) . |
|
| 257 | - '<p>' . |
|
| 258 | - ($auteur_obligatoire ? |
|
| 259 | - '' |
|
| 260 | - : |
|
| 261 | - _T('texte_informations_personnelles_2') . ' ' . _T('info_laisser_champs_vides') |
|
| 262 | - ) |
|
| 263 | - ) |
|
| 264 | - . generer_form_ecrire('install', ( |
|
| 265 | - "\n<input type='hidden' name='etape' value='3b' />" |
|
| 266 | - . $hidden |
|
| 267 | - . fieldset( |
|
| 268 | - _T('info_identification_publique'), |
|
| 269 | - [ |
|
| 270 | - 'nom' => [ |
|
| 271 | - 'label' => '<b>' . _T('entree_signature') . "</b><br />\n" . _T('entree_nom_pseudo_1') . "\n", |
|
| 272 | - 'valeur' => $nom, |
|
| 273 | - 'required' => $auteur_obligatoire, |
|
| 274 | - ], |
|
| 275 | - 'email' => [ |
|
| 276 | - 'label' => '<b>' . _T('entree_adresse_email') . "</b>\n", |
|
| 277 | - 'valeur' => $email, |
|
| 278 | - ] |
|
| 279 | - ] |
|
| 280 | - ) |
|
| 281 | - |
|
| 282 | - . fieldset( |
|
| 283 | - _T('entree_identifiants_connexion'), |
|
| 284 | - [ |
|
| 285 | - 'login' => [ |
|
| 286 | - 'label' => '<b>' . _T('entree_login') . "</b><br />\n" . _T( |
|
| 287 | - 'info_login_trop_court_car_pluriel', |
|
| 288 | - ['nb' => _LOGIN_TROP_COURT] |
|
| 289 | - ) . "\n", |
|
| 290 | - 'valeur' => $login, |
|
| 291 | - 'required' => $auteur_obligatoire, |
|
| 292 | - ], |
|
| 293 | - 'pass' => [ |
|
| 294 | - 'label' => '<b>' . _T('entree_mot_passe') . "</b><br />\n" . _T( |
|
| 295 | - 'info_passe_trop_court_car_pluriel', |
|
| 296 | - ['nb' => _PASS_LONGUEUR_MINI] |
|
| 297 | - ) . "\n", |
|
| 298 | - 'valeur' => $pass, |
|
| 299 | - 'required' => $auteur_obligatoire, |
|
| 300 | - ], |
|
| 301 | - 'pass_verif' => [ |
|
| 302 | - 'label' => '<b>' . _T('info_confirmer_passe') . "</b><br />\n", |
|
| 303 | - 'valeur' => $pass, |
|
| 304 | - 'required' => $auteur_obligatoire, |
|
| 305 | - ] |
|
| 306 | - ] |
|
| 307 | - ) |
|
| 308 | - . bouton_suivant())); |
|
| 252 | + return info_progression_etape(3, 'etape_', 'install/') . |
|
| 253 | + info_etape( |
|
| 254 | + _T('info_informations_personnelles'), |
|
| 255 | + '<b>' . _T('texte_informations_personnelles_1') . '</b>' . |
|
| 256 | + aider('install5', true) . |
|
| 257 | + '<p>' . |
|
| 258 | + ($auteur_obligatoire ? |
|
| 259 | + '' |
|
| 260 | + : |
|
| 261 | + _T('texte_informations_personnelles_2') . ' ' . _T('info_laisser_champs_vides') |
|
| 262 | + ) |
|
| 263 | + ) |
|
| 264 | + . generer_form_ecrire('install', ( |
|
| 265 | + "\n<input type='hidden' name='etape' value='3b' />" |
|
| 266 | + . $hidden |
|
| 267 | + . fieldset( |
|
| 268 | + _T('info_identification_publique'), |
|
| 269 | + [ |
|
| 270 | + 'nom' => [ |
|
| 271 | + 'label' => '<b>' . _T('entree_signature') . "</b><br />\n" . _T('entree_nom_pseudo_1') . "\n", |
|
| 272 | + 'valeur' => $nom, |
|
| 273 | + 'required' => $auteur_obligatoire, |
|
| 274 | + ], |
|
| 275 | + 'email' => [ |
|
| 276 | + 'label' => '<b>' . _T('entree_adresse_email') . "</b>\n", |
|
| 277 | + 'valeur' => $email, |
|
| 278 | + ] |
|
| 279 | + ] |
|
| 280 | + ) |
|
| 281 | + |
|
| 282 | + . fieldset( |
|
| 283 | + _T('entree_identifiants_connexion'), |
|
| 284 | + [ |
|
| 285 | + 'login' => [ |
|
| 286 | + 'label' => '<b>' . _T('entree_login') . "</b><br />\n" . _T( |
|
| 287 | + 'info_login_trop_court_car_pluriel', |
|
| 288 | + ['nb' => _LOGIN_TROP_COURT] |
|
| 289 | + ) . "\n", |
|
| 290 | + 'valeur' => $login, |
|
| 291 | + 'required' => $auteur_obligatoire, |
|
| 292 | + ], |
|
| 293 | + 'pass' => [ |
|
| 294 | + 'label' => '<b>' . _T('entree_mot_passe') . "</b><br />\n" . _T( |
|
| 295 | + 'info_passe_trop_court_car_pluriel', |
|
| 296 | + ['nb' => _PASS_LONGUEUR_MINI] |
|
| 297 | + ) . "\n", |
|
| 298 | + 'valeur' => $pass, |
|
| 299 | + 'required' => $auteur_obligatoire, |
|
| 300 | + ], |
|
| 301 | + 'pass_verif' => [ |
|
| 302 | + 'label' => '<b>' . _T('info_confirmer_passe') . "</b><br />\n", |
|
| 303 | + 'valeur' => $pass, |
|
| 304 | + 'required' => $auteur_obligatoire, |
|
| 305 | + ] |
|
| 306 | + ] |
|
| 307 | + ) |
|
| 308 | + . bouton_suivant())); |
|
| 309 | 309 | } |
| 310 | 310 | |
| 311 | 311 | // https://code.spip.net/@install_etape_3_dist |
| 312 | 312 | function install_etape_3_dist() { |
| 313 | - $ldap_present = _request('ldap_present'); |
|
| 314 | - |
|
| 315 | - if (!$ldap_present) { |
|
| 316 | - $adresse_db = defined('_INSTALL_HOST_DB') |
|
| 317 | - ? _INSTALL_HOST_DB |
|
| 318 | - : _request('adresse_db'); |
|
| 319 | - |
|
| 320 | - $login_db = defined('_INSTALL_USER_DB') |
|
| 321 | - ? _INSTALL_USER_DB |
|
| 322 | - : _request('login_db'); |
|
| 323 | - |
|
| 324 | - $pass_db = defined('_INSTALL_PASS_DB') |
|
| 325 | - ? _INSTALL_PASS_DB |
|
| 326 | - : _request('pass_db'); |
|
| 327 | - |
|
| 328 | - $server_db = defined('_INSTALL_SERVER_DB') |
|
| 329 | - ? _INSTALL_SERVER_DB |
|
| 330 | - : _request('server_db'); |
|
| 331 | - |
|
| 332 | - $chmod_db = defined('_SPIP_CHMOD') |
|
| 333 | - ? _SPIP_CHMOD |
|
| 334 | - : _request('chmod'); |
|
| 335 | - |
|
| 336 | - $choix_db = defined('_INSTALL_NAME_DB') |
|
| 337 | - ? _INSTALL_NAME_DB |
|
| 338 | - : _request('choix_db'); |
|
| 339 | - |
|
| 340 | - $sel_db = ($choix_db == 'new_spip') |
|
| 341 | - ? _request('table_new') : $choix_db; |
|
| 342 | - |
|
| 343 | - $res = install_bases($adresse_db, $login_db, $pass_db, $server_db, $choix_db, $sel_db, $chmod_db); |
|
| 344 | - |
|
| 345 | - if ($res) { |
|
| 346 | - $res = info_progression_etape(2, 'etape_', 'install/', true) |
|
| 347 | - . "<div class='error'><h3>" . _T('avis_operation_echec') . '</h3>' |
|
| 348 | - . $res |
|
| 349 | - . '<p>' . _T('texte_operation_echec') . '</p>' |
|
| 350 | - . '</div>'; |
|
| 351 | - } |
|
| 352 | - } else { |
|
| 353 | - $res = ''; |
|
| 354 | - list($adresse_db, $login_db, $pass_db, $sel_db, $server_db) = analyse_fichier_connection(_FILE_CONNECT_TMP); |
|
| 355 | - $GLOBALS['connexions'][$server_db] = spip_connect_db($adresse_db, $sel_db, $login_db, $pass_db, $sel_db, $server_db); |
|
| 356 | - } |
|
| 357 | - |
|
| 358 | - if (!$res) { |
|
| 359 | - if (file_exists(_FILE_CONNECT_TMP)) { |
|
| 360 | - include(_FILE_CONNECT_TMP); |
|
| 361 | - } else { |
|
| 362 | - redirige_url_ecrire('install'); |
|
| 363 | - } |
|
| 364 | - |
|
| 365 | - if (file_exists(_FILE_CHMOD_TMP)) { |
|
| 366 | - include(_FILE_CHMOD_TMP); |
|
| 367 | - } else { |
|
| 368 | - redirige_url_ecrire('install'); |
|
| 369 | - } |
|
| 370 | - |
|
| 371 | - $hidden = predef_ou_cache($adresse_db, $login_db, $pass_db, $server_db) |
|
| 372 | - . (defined('_INSTALL_NAME_DB') ? '' |
|
| 373 | - : "\n<input type='hidden' name='sel_db' value='$sel_db' />"); |
|
| 374 | - |
|
| 375 | - $auteur_obligatoire = ($ldap_present ? 0 : !sql_countsel('spip_auteurs', '', '', '', $server_db)); |
|
| 376 | - |
|
| 377 | - $res = "<div class='success'><b>" |
|
| 378 | - . _T('info_base_installee') |
|
| 379 | - . '</b></div>' |
|
| 380 | - . install_premier_auteur( |
|
| 381 | - _request('email'), |
|
| 382 | - _request('login'), |
|
| 383 | - _request('nom'), |
|
| 384 | - _request('pass'), |
|
| 385 | - $hidden, |
|
| 386 | - $auteur_obligatoire |
|
| 387 | - ) |
|
| 388 | - . (($ldap_present or !function_exists('ldap_connect')) |
|
| 389 | - ? '' : install_propose_ldap()); |
|
| 390 | - } |
|
| 391 | - |
|
| 392 | - echo install_debut_html(); |
|
| 393 | - echo $res; |
|
| 394 | - echo install_fin_html(); |
|
| 313 | + $ldap_present = _request('ldap_present'); |
|
| 314 | + |
|
| 315 | + if (!$ldap_present) { |
|
| 316 | + $adresse_db = defined('_INSTALL_HOST_DB') |
|
| 317 | + ? _INSTALL_HOST_DB |
|
| 318 | + : _request('adresse_db'); |
|
| 319 | + |
|
| 320 | + $login_db = defined('_INSTALL_USER_DB') |
|
| 321 | + ? _INSTALL_USER_DB |
|
| 322 | + : _request('login_db'); |
|
| 323 | + |
|
| 324 | + $pass_db = defined('_INSTALL_PASS_DB') |
|
| 325 | + ? _INSTALL_PASS_DB |
|
| 326 | + : _request('pass_db'); |
|
| 327 | + |
|
| 328 | + $server_db = defined('_INSTALL_SERVER_DB') |
|
| 329 | + ? _INSTALL_SERVER_DB |
|
| 330 | + : _request('server_db'); |
|
| 331 | + |
|
| 332 | + $chmod_db = defined('_SPIP_CHMOD') |
|
| 333 | + ? _SPIP_CHMOD |
|
| 334 | + : _request('chmod'); |
|
| 335 | + |
|
| 336 | + $choix_db = defined('_INSTALL_NAME_DB') |
|
| 337 | + ? _INSTALL_NAME_DB |
|
| 338 | + : _request('choix_db'); |
|
| 339 | + |
|
| 340 | + $sel_db = ($choix_db == 'new_spip') |
|
| 341 | + ? _request('table_new') : $choix_db; |
|
| 342 | + |
|
| 343 | + $res = install_bases($adresse_db, $login_db, $pass_db, $server_db, $choix_db, $sel_db, $chmod_db); |
|
| 344 | + |
|
| 345 | + if ($res) { |
|
| 346 | + $res = info_progression_etape(2, 'etape_', 'install/', true) |
|
| 347 | + . "<div class='error'><h3>" . _T('avis_operation_echec') . '</h3>' |
|
| 348 | + . $res |
|
| 349 | + . '<p>' . _T('texte_operation_echec') . '</p>' |
|
| 350 | + . '</div>'; |
|
| 351 | + } |
|
| 352 | + } else { |
|
| 353 | + $res = ''; |
|
| 354 | + list($adresse_db, $login_db, $pass_db, $sel_db, $server_db) = analyse_fichier_connection(_FILE_CONNECT_TMP); |
|
| 355 | + $GLOBALS['connexions'][$server_db] = spip_connect_db($adresse_db, $sel_db, $login_db, $pass_db, $sel_db, $server_db); |
|
| 356 | + } |
|
| 357 | + |
|
| 358 | + if (!$res) { |
|
| 359 | + if (file_exists(_FILE_CONNECT_TMP)) { |
|
| 360 | + include(_FILE_CONNECT_TMP); |
|
| 361 | + } else { |
|
| 362 | + redirige_url_ecrire('install'); |
|
| 363 | + } |
|
| 364 | + |
|
| 365 | + if (file_exists(_FILE_CHMOD_TMP)) { |
|
| 366 | + include(_FILE_CHMOD_TMP); |
|
| 367 | + } else { |
|
| 368 | + redirige_url_ecrire('install'); |
|
| 369 | + } |
|
| 370 | + |
|
| 371 | + $hidden = predef_ou_cache($adresse_db, $login_db, $pass_db, $server_db) |
|
| 372 | + . (defined('_INSTALL_NAME_DB') ? '' |
|
| 373 | + : "\n<input type='hidden' name='sel_db' value='$sel_db' />"); |
|
| 374 | + |
|
| 375 | + $auteur_obligatoire = ($ldap_present ? 0 : !sql_countsel('spip_auteurs', '', '', '', $server_db)); |
|
| 376 | + |
|
| 377 | + $res = "<div class='success'><b>" |
|
| 378 | + . _T('info_base_installee') |
|
| 379 | + . '</b></div>' |
|
| 380 | + . install_premier_auteur( |
|
| 381 | + _request('email'), |
|
| 382 | + _request('login'), |
|
| 383 | + _request('nom'), |
|
| 384 | + _request('pass'), |
|
| 385 | + $hidden, |
|
| 386 | + $auteur_obligatoire |
|
| 387 | + ) |
|
| 388 | + . (($ldap_present or !function_exists('ldap_connect')) |
|
| 389 | + ? '' : install_propose_ldap()); |
|
| 390 | + } |
|
| 391 | + |
|
| 392 | + echo install_debut_html(); |
|
| 393 | + echo $res; |
|
| 394 | + echo install_fin_html(); |
|
| 395 | 395 | } |
@@ -45,7 +45,7 @@ discard block |
||
| 45 | 45 | = spip_connect_db($adresse_db, $port, $login_db, $pass_db, '', $server_db); |
| 46 | 46 | |
| 47 | 47 | $GLOBALS['connexions'][$server_db][$GLOBALS['spip_sql_version']] |
| 48 | - = $GLOBALS['spip_' . $server_db . '_functions_' . $GLOBALS['spip_sql_version']]; |
|
| 48 | + = $GLOBALS['spip_'.$server_db.'_functions_'.$GLOBALS['spip_sql_version']]; |
|
| 49 | 49 | |
| 50 | 50 | $fquery = sql_serveur('query', $server_db); |
| 51 | 51 | if ($choix_db == 'new_spip') { |
@@ -55,13 +55,13 @@ discard block |
||
| 55 | 55 | if (!$ok) { |
| 56 | 56 | $re = "Impossible de creer la base $re"; |
| 57 | 57 | spip_log($re); |
| 58 | - return '<p>' . _T('avis_connexion_erreur_creer_base') . "</p><!--\n$re\n-->"; |
|
| 58 | + return '<p>'._T('avis_connexion_erreur_creer_base')."</p><!--\n$re\n-->"; |
|
| 59 | 59 | } |
| 60 | 60 | } else { |
| 61 | 61 | $re = "Le nom de la base doit correspondre a $re"; |
| 62 | 62 | spip_log($re); |
| 63 | 63 | |
| 64 | - return '<p>' . _T('avis_connexion_erreur_nom_base') . "</p><!--\n$re\n-->"; |
|
| 64 | + return '<p>'._T('avis_connexion_erreur_nom_base')."</p><!--\n$re\n-->"; |
|
| 65 | 65 | } |
| 66 | 66 | } |
| 67 | 67 | |
@@ -72,14 +72,14 @@ discard block |
||
| 72 | 72 | = spip_connect_db($adresse_db, $port, $login_db, $pass_db, $sel_db, $server_db); |
| 73 | 73 | |
| 74 | 74 | $GLOBALS['connexions'][$server_db][$GLOBALS['spip_sql_version']] |
| 75 | - = $GLOBALS['spip_' . $server_db . '_functions_' . $GLOBALS['spip_sql_version']]; |
|
| 75 | + = $GLOBALS['spip_'.$server_db.'_functions_'.$GLOBALS['spip_sql_version']]; |
|
| 76 | 76 | |
| 77 | 77 | // Completer le tableau decrivant la connexion |
| 78 | 78 | |
| 79 | 79 | $GLOBALS['connexions'][$server_db]['prefixe'] = $table_prefix; |
| 80 | 80 | $GLOBALS['connexions'][$server_db]['db'] = $sel_db; |
| 81 | 81 | |
| 82 | - $old = sql_showbase($table_prefix . '_meta', $server_db); |
|
| 82 | + $old = sql_showbase($table_prefix.'_meta', $server_db); |
|
| 83 | 83 | if ($old) { |
| 84 | 84 | $old = sql_fetch($old, $server_db); |
| 85 | 85 | } |
@@ -98,7 +98,7 @@ discard block |
||
| 98 | 98 | $charset['charset']; |
| 99 | 99 | $charsetbase = $charset['charset']; |
| 100 | 100 | } else { |
| 101 | - spip_log(_DEFAULT_CHARSET . ' inconnu du serveur SQL'); |
|
| 101 | + spip_log(_DEFAULT_CHARSET.' inconnu du serveur SQL'); |
|
| 102 | 102 | $charsetbase = 'standard'; |
| 103 | 103 | } |
| 104 | 104 | spip_log("Creation des tables. Codage $charsetbase"); |
@@ -148,7 +148,7 @@ discard block |
||
| 148 | 148 | if ($r) { |
| 149 | 149 | $r = sql_fetch($r, $server_db); |
| 150 | 150 | } |
| 151 | - $version_installee = !$r ? 0 : (double)$r['valeur']; |
|
| 151 | + $version_installee = !$r ? 0 : (double) $r['valeur']; |
|
| 152 | 152 | if (!$version_installee or ($GLOBALS['spip_version_base'] < $version_installee)) { |
| 153 | 153 | $fupdateq( |
| 154 | 154 | 'spip_meta', |
@@ -157,7 +157,7 @@ discard block |
||
| 157 | 157 | '', |
| 158 | 158 | $server_db |
| 159 | 159 | ); |
| 160 | - spip_log('nouvelle version installee: ' . $GLOBALS['spip_version_base']); |
|
| 160 | + spip_log('nouvelle version installee: '.$GLOBALS['spip_version_base']); |
|
| 161 | 161 | } |
| 162 | 162 | // eliminer la derniere operation d'admin mal terminee |
| 163 | 163 | // notamment la mise a jour |
@@ -184,7 +184,7 @@ discard block |
||
| 184 | 184 | if ($chmod_db) { |
| 185 | 185 | install_fichier_connexion( |
| 186 | 186 | _FILE_CHMOD_TMP, |
| 187 | - "if (!defined('_SPIP_CHMOD')) define('_SPIP_CHMOD', " . sprintf('0%3o', $chmod_db) . ");\n" |
|
| 187 | + "if (!defined('_SPIP_CHMOD')) define('_SPIP_CHMOD', ".sprintf('0%3o', $chmod_db).");\n" |
|
| 188 | 188 | ); |
| 189 | 189 | } |
| 190 | 190 | |
@@ -249,16 +249,16 @@ discard block |
||
| 249 | 249 | |
| 250 | 250 | // https://code.spip.net/@install_premier_auteur |
| 251 | 251 | function install_premier_auteur($email, $login, $nom, $pass, $hidden, $auteur_obligatoire) { |
| 252 | - return info_progression_etape(3, 'etape_', 'install/') . |
|
| 252 | + return info_progression_etape(3, 'etape_', 'install/'). |
|
| 253 | 253 | info_etape( |
| 254 | 254 | _T('info_informations_personnelles'), |
| 255 | - '<b>' . _T('texte_informations_personnelles_1') . '</b>' . |
|
| 256 | - aider('install5', true) . |
|
| 257 | - '<p>' . |
|
| 255 | + '<b>'._T('texte_informations_personnelles_1').'</b>'. |
|
| 256 | + aider('install5', true). |
|
| 257 | + '<p>'. |
|
| 258 | 258 | ($auteur_obligatoire ? |
| 259 | 259 | '' |
| 260 | 260 | : |
| 261 | - _T('texte_informations_personnelles_2') . ' ' . _T('info_laisser_champs_vides') |
|
| 261 | + _T('texte_informations_personnelles_2').' '._T('info_laisser_champs_vides') |
|
| 262 | 262 | ) |
| 263 | 263 | ) |
| 264 | 264 | . generer_form_ecrire('install', ( |
@@ -268,12 +268,12 @@ discard block |
||
| 268 | 268 | _T('info_identification_publique'), |
| 269 | 269 | [ |
| 270 | 270 | 'nom' => [ |
| 271 | - 'label' => '<b>' . _T('entree_signature') . "</b><br />\n" . _T('entree_nom_pseudo_1') . "\n", |
|
| 271 | + 'label' => '<b>'._T('entree_signature')."</b><br />\n"._T('entree_nom_pseudo_1')."\n", |
|
| 272 | 272 | 'valeur' => $nom, |
| 273 | 273 | 'required' => $auteur_obligatoire, |
| 274 | 274 | ], |
| 275 | 275 | 'email' => [ |
| 276 | - 'label' => '<b>' . _T('entree_adresse_email') . "</b>\n", |
|
| 276 | + 'label' => '<b>'._T('entree_adresse_email')."</b>\n", |
|
| 277 | 277 | 'valeur' => $email, |
| 278 | 278 | ] |
| 279 | 279 | ] |
@@ -283,23 +283,23 @@ discard block |
||
| 283 | 283 | _T('entree_identifiants_connexion'), |
| 284 | 284 | [ |
| 285 | 285 | 'login' => [ |
| 286 | - 'label' => '<b>' . _T('entree_login') . "</b><br />\n" . _T( |
|
| 286 | + 'label' => '<b>'._T('entree_login')."</b><br />\n"._T( |
|
| 287 | 287 | 'info_login_trop_court_car_pluriel', |
| 288 | 288 | ['nb' => _LOGIN_TROP_COURT] |
| 289 | - ) . "\n", |
|
| 289 | + )."\n", |
|
| 290 | 290 | 'valeur' => $login, |
| 291 | 291 | 'required' => $auteur_obligatoire, |
| 292 | 292 | ], |
| 293 | 293 | 'pass' => [ |
| 294 | - 'label' => '<b>' . _T('entree_mot_passe') . "</b><br />\n" . _T( |
|
| 294 | + 'label' => '<b>'._T('entree_mot_passe')."</b><br />\n"._T( |
|
| 295 | 295 | 'info_passe_trop_court_car_pluriel', |
| 296 | 296 | ['nb' => _PASS_LONGUEUR_MINI] |
| 297 | - ) . "\n", |
|
| 297 | + )."\n", |
|
| 298 | 298 | 'valeur' => $pass, |
| 299 | 299 | 'required' => $auteur_obligatoire, |
| 300 | 300 | ], |
| 301 | 301 | 'pass_verif' => [ |
| 302 | - 'label' => '<b>' . _T('info_confirmer_passe') . "</b><br />\n", |
|
| 302 | + 'label' => '<b>'._T('info_confirmer_passe')."</b><br />\n", |
|
| 303 | 303 | 'valeur' => $pass, |
| 304 | 304 | 'required' => $auteur_obligatoire, |
| 305 | 305 | ] |
@@ -344,9 +344,9 @@ discard block |
||
| 344 | 344 | |
| 345 | 345 | if ($res) { |
| 346 | 346 | $res = info_progression_etape(2, 'etape_', 'install/', true) |
| 347 | - . "<div class='error'><h3>" . _T('avis_operation_echec') . '</h3>' |
|
| 347 | + . "<div class='error'><h3>"._T('avis_operation_echec').'</h3>' |
|
| 348 | 348 | . $res |
| 349 | - . '<p>' . _T('texte_operation_echec') . '</p>' |
|
| 349 | + . '<p>'._T('texte_operation_echec').'</p>' |
|
| 350 | 350 | . '</div>'; |
| 351 | 351 | } |
| 352 | 352 | } else { |
@@ -11,7 +11,7 @@ discard block |
||
| 11 | 11 | \***************************************************************************/ |
| 12 | 12 | |
| 13 | 13 | if (!defined('_ECRIRE_INC_VERSION')) { |
| 14 | - return; |
|
| 14 | + return; |
|
| 15 | 15 | } |
| 16 | 16 | |
| 17 | 17 | include_spip('inc/headers'); |
@@ -21,65 +21,65 @@ discard block |
||
| 21 | 21 | |
| 22 | 22 | // https://code.spip.net/@install_etape_fin_dist |
| 23 | 23 | function install_etape_fin_dist() { |
| 24 | - ecrire_acces(); |
|
| 24 | + ecrire_acces(); |
|
| 25 | 25 | |
| 26 | - $f = str_replace(_FILE_TMP_SUFFIX, '.php', _FILE_CHMOD_TMP); |
|
| 27 | - if (file_exists(_FILE_CHMOD_TMP)) { |
|
| 28 | - if (!@rename(_FILE_CHMOD_TMP, $f)) { |
|
| 29 | - if (@copy(_FILE_CHMOD_TMP, $f)) { |
|
| 30 | - spip_unlink(_FILE_CHMOD_TMP); |
|
| 31 | - } |
|
| 32 | - } |
|
| 33 | - } |
|
| 26 | + $f = str_replace(_FILE_TMP_SUFFIX, '.php', _FILE_CHMOD_TMP); |
|
| 27 | + if (file_exists(_FILE_CHMOD_TMP)) { |
|
| 28 | + if (!@rename(_FILE_CHMOD_TMP, $f)) { |
|
| 29 | + if (@copy(_FILE_CHMOD_TMP, $f)) { |
|
| 30 | + spip_unlink(_FILE_CHMOD_TMP); |
|
| 31 | + } |
|
| 32 | + } |
|
| 33 | + } |
|
| 34 | 34 | |
| 35 | - $f = str_replace(_FILE_TMP_SUFFIX, '.php', _FILE_CONNECT_TMP); |
|
| 36 | - if (file_exists(_FILE_CONNECT_TMP)) { |
|
| 37 | - spip_log("renomme $f"); |
|
| 38 | - if (!@rename(_FILE_CONNECT_TMP, $f)) { |
|
| 39 | - if (@copy(_FILE_CONNECT_TMP, $f)) { |
|
| 40 | - @spip_unlink(_FILE_CONNECT_TMP); |
|
| 41 | - } |
|
| 42 | - } |
|
| 43 | - } |
|
| 35 | + $f = str_replace(_FILE_TMP_SUFFIX, '.php', _FILE_CONNECT_TMP); |
|
| 36 | + if (file_exists(_FILE_CONNECT_TMP)) { |
|
| 37 | + spip_log("renomme $f"); |
|
| 38 | + if (!@rename(_FILE_CONNECT_TMP, $f)) { |
|
| 39 | + if (@copy(_FILE_CONNECT_TMP, $f)) { |
|
| 40 | + @spip_unlink(_FILE_CONNECT_TMP); |
|
| 41 | + } |
|
| 42 | + } |
|
| 43 | + } |
|
| 44 | 44 | |
| 45 | - // creer le repertoire cache, qui sert partout ! |
|
| 46 | - // deja fait en etape 4 en principe, on garde au cas ou |
|
| 47 | - if (!@file_exists(_DIR_CACHE)) { |
|
| 48 | - $rep = preg_replace(',' . _DIR_TMP . ',', '', _DIR_CACHE); |
|
| 49 | - $rep = sous_repertoire(_DIR_TMP, $rep, true, true); |
|
| 50 | - } |
|
| 45 | + // creer le repertoire cache, qui sert partout ! |
|
| 46 | + // deja fait en etape 4 en principe, on garde au cas ou |
|
| 47 | + if (!@file_exists(_DIR_CACHE)) { |
|
| 48 | + $rep = preg_replace(',' . _DIR_TMP . ',', '', _DIR_CACHE); |
|
| 49 | + $rep = sous_repertoire(_DIR_TMP, $rep, true, true); |
|
| 50 | + } |
|
| 51 | 51 | |
| 52 | - // Verifier la securite des htaccess |
|
| 53 | - // Si elle ne fonctionne pas, prevenir |
|
| 54 | - $msg = install_verifier_htaccess(); |
|
| 55 | - if ($msg) { |
|
| 56 | - $cible = _T('public:accueil_site'); |
|
| 57 | - $cible = generer_form_ecrire('accueil', '', '', $cible); |
|
| 58 | - echo minipres('AUTO', $msg . $cible); |
|
| 59 | - // ok, deboucher dans l'espace prive |
|
| 60 | - } else { |
|
| 61 | - redirige_url_ecrire('accueil'); |
|
| 62 | - } |
|
| 52 | + // Verifier la securite des htaccess |
|
| 53 | + // Si elle ne fonctionne pas, prevenir |
|
| 54 | + $msg = install_verifier_htaccess(); |
|
| 55 | + if ($msg) { |
|
| 56 | + $cible = _T('public:accueil_site'); |
|
| 57 | + $cible = generer_form_ecrire('accueil', '', '', $cible); |
|
| 58 | + echo minipres('AUTO', $msg . $cible); |
|
| 59 | + // ok, deboucher dans l'espace prive |
|
| 60 | + } else { |
|
| 61 | + redirige_url_ecrire('accueil'); |
|
| 62 | + } |
|
| 63 | 63 | } |
| 64 | 64 | |
| 65 | 65 | function install_verifier_htaccess() { |
| 66 | - if ( |
|
| 67 | - verifier_htaccess(_DIR_TMP, true) |
|
| 68 | - and verifier_htaccess(_DIR_CONNECT, true) |
|
| 69 | - ) { |
|
| 70 | - return ''; |
|
| 71 | - } |
|
| 66 | + if ( |
|
| 67 | + verifier_htaccess(_DIR_TMP, true) |
|
| 68 | + and verifier_htaccess(_DIR_CONNECT, true) |
|
| 69 | + ) { |
|
| 70 | + return ''; |
|
| 71 | + } |
|
| 72 | 72 | |
| 73 | - $titre = _T('htaccess_inoperant'); |
|
| 73 | + $titre = _T('htaccess_inoperant'); |
|
| 74 | 74 | |
| 75 | - $averti = _T( |
|
| 76 | - 'htaccess_a_simuler', |
|
| 77 | - [ |
|
| 78 | - 'htaccess' => '<tt>' . _ACCESS_FILE_NAME . '</tt>', |
|
| 79 | - 'constantes' => '<tt>_DIR_TMP & _DIR_CONNECT</tt>', |
|
| 80 | - 'document_root' => '<tt>' . $_SERVER['DOCUMENT_ROOT'] . '</tt>' |
|
| 81 | - ] |
|
| 82 | - ); |
|
| 75 | + $averti = _T( |
|
| 76 | + 'htaccess_a_simuler', |
|
| 77 | + [ |
|
| 78 | + 'htaccess' => '<tt>' . _ACCESS_FILE_NAME . '</tt>', |
|
| 79 | + 'constantes' => '<tt>_DIR_TMP & _DIR_CONNECT</tt>', |
|
| 80 | + 'document_root' => '<tt>' . $_SERVER['DOCUMENT_ROOT'] . '</tt>' |
|
| 81 | + ] |
|
| 82 | + ); |
|
| 83 | 83 | |
| 84 | - return "<div class='error'><h3>$titre</h3><p>$averti</p></div>"; |
|
| 84 | + return "<div class='error'><h3>$titre</h3><p>$averti</p></div>"; |
|
| 85 | 85 | } |
@@ -45,7 +45,7 @@ discard block |
||
| 45 | 45 | // creer le repertoire cache, qui sert partout ! |
| 46 | 46 | // deja fait en etape 4 en principe, on garde au cas ou |
| 47 | 47 | if (!@file_exists(_DIR_CACHE)) { |
| 48 | - $rep = preg_replace(',' . _DIR_TMP . ',', '', _DIR_CACHE); |
|
| 48 | + $rep = preg_replace(','._DIR_TMP.',', '', _DIR_CACHE); |
|
| 49 | 49 | $rep = sous_repertoire(_DIR_TMP, $rep, true, true); |
| 50 | 50 | } |
| 51 | 51 | |
@@ -55,7 +55,7 @@ discard block |
||
| 55 | 55 | if ($msg) { |
| 56 | 56 | $cible = _T('public:accueil_site'); |
| 57 | 57 | $cible = generer_form_ecrire('accueil', '', '', $cible); |
| 58 | - echo minipres('AUTO', $msg . $cible); |
|
| 58 | + echo minipres('AUTO', $msg.$cible); |
|
| 59 | 59 | // ok, deboucher dans l'espace prive |
| 60 | 60 | } else { |
| 61 | 61 | redirige_url_ecrire('accueil'); |
@@ -75,9 +75,9 @@ discard block |
||
| 75 | 75 | $averti = _T( |
| 76 | 76 | 'htaccess_a_simuler', |
| 77 | 77 | [ |
| 78 | - 'htaccess' => '<tt>' . _ACCESS_FILE_NAME . '</tt>', |
|
| 78 | + 'htaccess' => '<tt>'._ACCESS_FILE_NAME.'</tt>', |
|
| 79 | 79 | 'constantes' => '<tt>_DIR_TMP & _DIR_CONNECT</tt>', |
| 80 | - 'document_root' => '<tt>' . $_SERVER['DOCUMENT_ROOT'] . '</tt>' |
|
| 80 | + 'document_root' => '<tt>'.$_SERVER['DOCUMENT_ROOT'].'</tt>' |
|
| 81 | 81 | ] |
| 82 | 82 | ); |
| 83 | 83 | |
@@ -11,144 +11,144 @@ |
||
| 11 | 11 | \***************************************************************************/ |
| 12 | 12 | |
| 13 | 13 | if (!defined('_ECRIRE_INC_VERSION')) { |
| 14 | - return; |
|
| 14 | + return; |
|
| 15 | 15 | } |
| 16 | 16 | |
| 17 | 17 | include_spip('inc/headers'); |
| 18 | 18 | |
| 19 | 19 | function install_etape_3b_dist() { |
| 20 | - $login = _request('login'); |
|
| 21 | - $email = _request('email'); |
|
| 22 | - $nom = _request('nom'); |
|
| 23 | - $pass = _request('pass'); |
|
| 24 | - $pass_verif = _request('pass_verif'); |
|
| 25 | - |
|
| 26 | - $server_db = defined('_INSTALL_SERVER_DB') |
|
| 27 | - ? _INSTALL_SERVER_DB |
|
| 28 | - : _request('server_db'); |
|
| 29 | - |
|
| 30 | - if (!defined('_PASS_LONGUEUR_MINI')) { |
|
| 31 | - define('_PASS_LONGUEUR_MINI', 6); |
|
| 32 | - } |
|
| 33 | - if (!defined('_LOGIN_TROP_COURT')) { |
|
| 34 | - define('_LOGIN_TROP_COURT', 4); |
|
| 35 | - } |
|
| 36 | - if ($login) { |
|
| 37 | - $echec = ($pass != $pass_verif) ? |
|
| 38 | - _T('info_passes_identiques') |
|
| 39 | - : ((strlen($pass) < _PASS_LONGUEUR_MINI) ? |
|
| 40 | - _T('info_passe_trop_court_car_pluriel', ['nb' => _PASS_LONGUEUR_MINI]) |
|
| 41 | - : ((strlen($login) < _LOGIN_TROP_COURT) ? |
|
| 42 | - _T('info_login_trop_court') |
|
| 43 | - : '')); |
|
| 44 | - include_spip('inc/filtres'); |
|
| 45 | - if (!$echec and $email and !email_valide($email)) { |
|
| 46 | - $echec = _T('form_email_non_valide'); |
|
| 47 | - } |
|
| 48 | - if ($echec) { |
|
| 49 | - echo minipres( |
|
| 50 | - 'AUTO', |
|
| 51 | - info_progression_etape(3, 'etape_', 'install/', true) . |
|
| 52 | - "<div class='error'><h3>$echec</h3>\n" . |
|
| 53 | - '<p>' . _T('avis_connexion_echec_2') . '</p>' . |
|
| 54 | - '</div>' |
|
| 55 | - ); |
|
| 56 | - exit; |
|
| 57 | - } |
|
| 58 | - } |
|
| 59 | - |
|
| 60 | - if (@file_exists(_FILE_CHMOD_TMP)) { |
|
| 61 | - include(_FILE_CHMOD_TMP); |
|
| 62 | - } else { |
|
| 63 | - redirige_url_ecrire('install'); |
|
| 64 | - } |
|
| 65 | - |
|
| 66 | - if (!@file_exists(_FILE_CONNECT_TMP)) { |
|
| 67 | - redirige_url_ecrire('install'); |
|
| 68 | - } |
|
| 69 | - |
|
| 70 | - # maintenant on connait le vrai charset du site s'il est deja configure |
|
| 71 | - # sinon par defaut lire_meta reglera _DEFAULT_CHARSET |
|
| 72 | - # (les donnees arrivent de toute facon postees en _DEFAULT_CHARSET) |
|
| 73 | - |
|
| 74 | - lire_metas(); |
|
| 75 | - if ($login) { |
|
| 76 | - include_spip('inc/charsets'); |
|
| 77 | - |
|
| 78 | - $nom = (importer_charset($nom, _DEFAULT_CHARSET)); |
|
| 79 | - $login = (importer_charset($login, _DEFAULT_CHARSET)); |
|
| 80 | - $email = (importer_charset($email, _DEFAULT_CHARSET)); |
|
| 81 | - # pour le passwd, bizarrement il faut le convertir comme s'il avait |
|
| 82 | - # ete tape en iso-8859-1 ; car c'est en fait ce que voit md5.js |
|
| 83 | - $pass = unicode2charset(utf_8_to_unicode($pass), 'iso-8859-1'); |
|
| 84 | - include_spip('auth/sha256.inc'); |
|
| 85 | - include_spip('inc/acces'); |
|
| 86 | - $htpass = generer_htpass($pass); |
|
| 87 | - $alea_actuel = creer_uniqid(); |
|
| 88 | - $alea_futur = creer_uniqid(); |
|
| 89 | - $shapass = spip_sha256($alea_actuel . $pass); |
|
| 90 | - // prelablement, creer le champ webmestre si il n'existe pas (install neuve |
|
| 91 | - // sur une vieille base |
|
| 92 | - $t = sql_showtable('spip_auteurs', true); |
|
| 93 | - if (!isset($t['field']['webmestre'])) { |
|
| 94 | - @sql_alter("TABLE spip_auteurs ADD webmestre varchar(3) DEFAULT 'non' NOT NULL"); |
|
| 95 | - } |
|
| 96 | - |
|
| 97 | - $id_auteur = sql_getfetsel('id_auteur', 'spip_auteurs', 'login=' . sql_quote($login)); |
|
| 98 | - if ($id_auteur !== null) { |
|
| 99 | - sql_updateq('spip_auteurs', [ |
|
| 100 | - 'nom' => $nom, |
|
| 101 | - 'email' => $email, |
|
| 102 | - 'login' => $login, |
|
| 103 | - 'pass' => $shapass, |
|
| 104 | - 'alea_actuel' => $alea_actuel, |
|
| 105 | - 'alea_futur' => $alea_futur, |
|
| 106 | - 'htpass' => $htpass, |
|
| 107 | - 'statut' => '0minirezo' |
|
| 108 | - ], "id_auteur=$id_auteur"); |
|
| 109 | - } else { |
|
| 110 | - $id_auteur = sql_insertq('spip_auteurs', [ |
|
| 111 | - 'nom' => $nom, |
|
| 112 | - 'email' => $email, |
|
| 113 | - 'login' => $login, |
|
| 114 | - 'pass' => $shapass, |
|
| 115 | - 'htpass' => $htpass, |
|
| 116 | - 'alea_actuel' => $alea_actuel, |
|
| 117 | - 'alea_futur' => $alea_futur, |
|
| 118 | - 'statut' => '0minirezo' |
|
| 119 | - ]); |
|
| 120 | - } |
|
| 121 | - // le passer webmestre separrement du reste, au cas ou l'alter n'aurait pas fonctionne |
|
| 122 | - @sql_updateq('spip_auteurs', ['webmestre' => 'oui'], "id_auteur=$id_auteur"); |
|
| 123 | - |
|
| 124 | - // inserer email comme email webmaster principal |
|
| 125 | - // (sauf s'il est vide: cas de la re-installation) |
|
| 126 | - if ($email) { |
|
| 127 | - ecrire_meta('email_webmaster', $email); |
|
| 128 | - } |
|
| 129 | - |
|
| 130 | - // Connecter directement celui qui vient de (re)donner son login |
|
| 131 | - // mais sans cookie d'admin ni connexion longue |
|
| 132 | - include_spip('inc/auth'); |
|
| 133 | - if ( |
|
| 134 | - !$auteur = auth_identifier_login($login, $pass) |
|
| 135 | - or !auth_loger($auteur, true) |
|
| 136 | - ) { |
|
| 137 | - spip_log("login automatique impossible $auth_spip $session" . count($row)); |
|
| 138 | - } |
|
| 139 | - } |
|
| 140 | - |
|
| 141 | - // installer les metas |
|
| 142 | - $config = charger_fonction('config', 'inc'); |
|
| 143 | - $config(); |
|
| 144 | - |
|
| 145 | - // activer les plugins |
|
| 146 | - // leur installation ne peut pas se faire sur le meme hit, il faudra donc |
|
| 147 | - // poursuivre au hit suivant |
|
| 148 | - include_spip('inc/plugin'); |
|
| 149 | - actualise_plugins_actifs(); |
|
| 150 | - |
|
| 151 | - |
|
| 152 | - include_spip('inc/distant'); |
|
| 153 | - redirige_par_entete(parametre_url(self(), 'etape', '4', '&')); |
|
| 20 | + $login = _request('login'); |
|
| 21 | + $email = _request('email'); |
|
| 22 | + $nom = _request('nom'); |
|
| 23 | + $pass = _request('pass'); |
|
| 24 | + $pass_verif = _request('pass_verif'); |
|
| 25 | + |
|
| 26 | + $server_db = defined('_INSTALL_SERVER_DB') |
|
| 27 | + ? _INSTALL_SERVER_DB |
|
| 28 | + : _request('server_db'); |
|
| 29 | + |
|
| 30 | + if (!defined('_PASS_LONGUEUR_MINI')) { |
|
| 31 | + define('_PASS_LONGUEUR_MINI', 6); |
|
| 32 | + } |
|
| 33 | + if (!defined('_LOGIN_TROP_COURT')) { |
|
| 34 | + define('_LOGIN_TROP_COURT', 4); |
|
| 35 | + } |
|
| 36 | + if ($login) { |
|
| 37 | + $echec = ($pass != $pass_verif) ? |
|
| 38 | + _T('info_passes_identiques') |
|
| 39 | + : ((strlen($pass) < _PASS_LONGUEUR_MINI) ? |
|
| 40 | + _T('info_passe_trop_court_car_pluriel', ['nb' => _PASS_LONGUEUR_MINI]) |
|
| 41 | + : ((strlen($login) < _LOGIN_TROP_COURT) ? |
|
| 42 | + _T('info_login_trop_court') |
|
| 43 | + : '')); |
|
| 44 | + include_spip('inc/filtres'); |
|
| 45 | + if (!$echec and $email and !email_valide($email)) { |
|
| 46 | + $echec = _T('form_email_non_valide'); |
|
| 47 | + } |
|
| 48 | + if ($echec) { |
|
| 49 | + echo minipres( |
|
| 50 | + 'AUTO', |
|
| 51 | + info_progression_etape(3, 'etape_', 'install/', true) . |
|
| 52 | + "<div class='error'><h3>$echec</h3>\n" . |
|
| 53 | + '<p>' . _T('avis_connexion_echec_2') . '</p>' . |
|
| 54 | + '</div>' |
|
| 55 | + ); |
|
| 56 | + exit; |
|
| 57 | + } |
|
| 58 | + } |
|
| 59 | + |
|
| 60 | + if (@file_exists(_FILE_CHMOD_TMP)) { |
|
| 61 | + include(_FILE_CHMOD_TMP); |
|
| 62 | + } else { |
|
| 63 | + redirige_url_ecrire('install'); |
|
| 64 | + } |
|
| 65 | + |
|
| 66 | + if (!@file_exists(_FILE_CONNECT_TMP)) { |
|
| 67 | + redirige_url_ecrire('install'); |
|
| 68 | + } |
|
| 69 | + |
|
| 70 | + # maintenant on connait le vrai charset du site s'il est deja configure |
|
| 71 | + # sinon par defaut lire_meta reglera _DEFAULT_CHARSET |
|
| 72 | + # (les donnees arrivent de toute facon postees en _DEFAULT_CHARSET) |
|
| 73 | + |
|
| 74 | + lire_metas(); |
|
| 75 | + if ($login) { |
|
| 76 | + include_spip('inc/charsets'); |
|
| 77 | + |
|
| 78 | + $nom = (importer_charset($nom, _DEFAULT_CHARSET)); |
|
| 79 | + $login = (importer_charset($login, _DEFAULT_CHARSET)); |
|
| 80 | + $email = (importer_charset($email, _DEFAULT_CHARSET)); |
|
| 81 | + # pour le passwd, bizarrement il faut le convertir comme s'il avait |
|
| 82 | + # ete tape en iso-8859-1 ; car c'est en fait ce que voit md5.js |
|
| 83 | + $pass = unicode2charset(utf_8_to_unicode($pass), 'iso-8859-1'); |
|
| 84 | + include_spip('auth/sha256.inc'); |
|
| 85 | + include_spip('inc/acces'); |
|
| 86 | + $htpass = generer_htpass($pass); |
|
| 87 | + $alea_actuel = creer_uniqid(); |
|
| 88 | + $alea_futur = creer_uniqid(); |
|
| 89 | + $shapass = spip_sha256($alea_actuel . $pass); |
|
| 90 | + // prelablement, creer le champ webmestre si il n'existe pas (install neuve |
|
| 91 | + // sur une vieille base |
|
| 92 | + $t = sql_showtable('spip_auteurs', true); |
|
| 93 | + if (!isset($t['field']['webmestre'])) { |
|
| 94 | + @sql_alter("TABLE spip_auteurs ADD webmestre varchar(3) DEFAULT 'non' NOT NULL"); |
|
| 95 | + } |
|
| 96 | + |
|
| 97 | + $id_auteur = sql_getfetsel('id_auteur', 'spip_auteurs', 'login=' . sql_quote($login)); |
|
| 98 | + if ($id_auteur !== null) { |
|
| 99 | + sql_updateq('spip_auteurs', [ |
|
| 100 | + 'nom' => $nom, |
|
| 101 | + 'email' => $email, |
|
| 102 | + 'login' => $login, |
|
| 103 | + 'pass' => $shapass, |
|
| 104 | + 'alea_actuel' => $alea_actuel, |
|
| 105 | + 'alea_futur' => $alea_futur, |
|
| 106 | + 'htpass' => $htpass, |
|
| 107 | + 'statut' => '0minirezo' |
|
| 108 | + ], "id_auteur=$id_auteur"); |
|
| 109 | + } else { |
|
| 110 | + $id_auteur = sql_insertq('spip_auteurs', [ |
|
| 111 | + 'nom' => $nom, |
|
| 112 | + 'email' => $email, |
|
| 113 | + 'login' => $login, |
|
| 114 | + 'pass' => $shapass, |
|
| 115 | + 'htpass' => $htpass, |
|
| 116 | + 'alea_actuel' => $alea_actuel, |
|
| 117 | + 'alea_futur' => $alea_futur, |
|
| 118 | + 'statut' => '0minirezo' |
|
| 119 | + ]); |
|
| 120 | + } |
|
| 121 | + // le passer webmestre separrement du reste, au cas ou l'alter n'aurait pas fonctionne |
|
| 122 | + @sql_updateq('spip_auteurs', ['webmestre' => 'oui'], "id_auteur=$id_auteur"); |
|
| 123 | + |
|
| 124 | + // inserer email comme email webmaster principal |
|
| 125 | + // (sauf s'il est vide: cas de la re-installation) |
|
| 126 | + if ($email) { |
|
| 127 | + ecrire_meta('email_webmaster', $email); |
|
| 128 | + } |
|
| 129 | + |
|
| 130 | + // Connecter directement celui qui vient de (re)donner son login |
|
| 131 | + // mais sans cookie d'admin ni connexion longue |
|
| 132 | + include_spip('inc/auth'); |
|
| 133 | + if ( |
|
| 134 | + !$auteur = auth_identifier_login($login, $pass) |
|
| 135 | + or !auth_loger($auteur, true) |
|
| 136 | + ) { |
|
| 137 | + spip_log("login automatique impossible $auth_spip $session" . count($row)); |
|
| 138 | + } |
|
| 139 | + } |
|
| 140 | + |
|
| 141 | + // installer les metas |
|
| 142 | + $config = charger_fonction('config', 'inc'); |
|
| 143 | + $config(); |
|
| 144 | + |
|
| 145 | + // activer les plugins |
|
| 146 | + // leur installation ne peut pas se faire sur le meme hit, il faudra donc |
|
| 147 | + // poursuivre au hit suivant |
|
| 148 | + include_spip('inc/plugin'); |
|
| 149 | + actualise_plugins_actifs(); |
|
| 150 | + |
|
| 151 | + |
|
| 152 | + include_spip('inc/distant'); |
|
| 153 | + redirige_par_entete(parametre_url(self(), 'etape', '4', '&')); |
|
| 154 | 154 | } |
@@ -48,9 +48,9 @@ discard block |
||
| 48 | 48 | if ($echec) { |
| 49 | 49 | echo minipres( |
| 50 | 50 | 'AUTO', |
| 51 | - info_progression_etape(3, 'etape_', 'install/', true) . |
|
| 52 | - "<div class='error'><h3>$echec</h3>\n" . |
|
| 53 | - '<p>' . _T('avis_connexion_echec_2') . '</p>' . |
|
| 51 | + info_progression_etape(3, 'etape_', 'install/', true). |
|
| 52 | + "<div class='error'><h3>$echec</h3>\n". |
|
| 53 | + '<p>'._T('avis_connexion_echec_2').'</p>'. |
|
| 54 | 54 | '</div>' |
| 55 | 55 | ); |
| 56 | 56 | exit; |
@@ -86,7 +86,7 @@ discard block |
||
| 86 | 86 | $htpass = generer_htpass($pass); |
| 87 | 87 | $alea_actuel = creer_uniqid(); |
| 88 | 88 | $alea_futur = creer_uniqid(); |
| 89 | - $shapass = spip_sha256($alea_actuel . $pass); |
|
| 89 | + $shapass = spip_sha256($alea_actuel.$pass); |
|
| 90 | 90 | // prelablement, creer le champ webmestre si il n'existe pas (install neuve |
| 91 | 91 | // sur une vieille base |
| 92 | 92 | $t = sql_showtable('spip_auteurs', true); |
@@ -94,7 +94,7 @@ discard block |
||
| 94 | 94 | @sql_alter("TABLE spip_auteurs ADD webmestre varchar(3) DEFAULT 'non' NOT NULL"); |
| 95 | 95 | } |
| 96 | 96 | |
| 97 | - $id_auteur = sql_getfetsel('id_auteur', 'spip_auteurs', 'login=' . sql_quote($login)); |
|
| 97 | + $id_auteur = sql_getfetsel('id_auteur', 'spip_auteurs', 'login='.sql_quote($login)); |
|
| 98 | 98 | if ($id_auteur !== null) { |
| 99 | 99 | sql_updateq('spip_auteurs', [ |
| 100 | 100 | 'nom' => $nom, |
@@ -134,7 +134,7 @@ discard block |
||
| 134 | 134 | !$auteur = auth_identifier_login($login, $pass) |
| 135 | 135 | or !auth_loger($auteur, true) |
| 136 | 136 | ) { |
| 137 | - spip_log("login automatique impossible $auth_spip $session" . count($row)); |
|
| 137 | + spip_log("login automatique impossible $auth_spip $session".count($row)); |
|
| 138 | 138 | } |
| 139 | 139 | } |
| 140 | 140 | |
@@ -18,7 +18,7 @@ discard block |
||
| 18 | 18 | */ |
| 19 | 19 | |
| 20 | 20 | if (!defined('_ECRIRE_INC_VERSION')) { |
| 21 | - return; |
|
| 21 | + return; |
|
| 22 | 22 | } |
| 23 | 23 | |
| 24 | 24 | /** |
@@ -35,45 +35,45 @@ discard block |
||
| 35 | 35 | * |
| 36 | 36 | */ |
| 37 | 37 | function install_etape_1_dist() { |
| 38 | - echo install_debut_html(); |
|
| 38 | + echo install_debut_html(); |
|
| 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 | - list($adresse_db, $login_db) = $s ? $s : login_hebergeur(); |
|
| 47 | + list($adresse_db, $login_db) = $s ? $s : login_hebergeur(); |
|
| 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 install_fin_html(); |
|
| 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 install_fin_html(); |
|
| 79 | 79 | } |
@@ -11,91 +11,91 @@ discard block |
||
| 11 | 11 | \***************************************************************************/ |
| 12 | 12 | |
| 13 | 13 | if (!defined('_ECRIRE_INC_VERSION')) { |
| 14 | - return; |
|
| 14 | + return; |
|
| 15 | 15 | } |
| 16 | 16 | |
| 17 | 17 | include_spip('base/abstract_sql'); |
| 18 | 18 | |
| 19 | 19 | // https://code.spip.net/@install_etape_2_dist |
| 20 | 20 | function install_etape_2_dist() { |
| 21 | - $adresse_db = defined('_INSTALL_HOST_DB') |
|
| 22 | - ? _INSTALL_HOST_DB |
|
| 23 | - : _request('adresse_db'); |
|
| 21 | + $adresse_db = defined('_INSTALL_HOST_DB') |
|
| 22 | + ? _INSTALL_HOST_DB |
|
| 23 | + : _request('adresse_db'); |
|
| 24 | 24 | |
| 25 | - if (preg_match(',(.*):(.*),', $adresse_db, $r)) { |
|
| 26 | - list(, $adresse_db, $port) = $r; |
|
| 27 | - } else { |
|
| 28 | - $port = ''; |
|
| 29 | - } |
|
| 25 | + if (preg_match(',(.*):(.*),', $adresse_db, $r)) { |
|
| 26 | + list(, $adresse_db, $port) = $r; |
|
| 27 | + } else { |
|
| 28 | + $port = ''; |
|
| 29 | + } |
|
| 30 | 30 | |
| 31 | - $login_db = defined('_INSTALL_USER_DB') |
|
| 32 | - ? _INSTALL_USER_DB |
|
| 33 | - : _request('login_db'); |
|
| 31 | + $login_db = defined('_INSTALL_USER_DB') |
|
| 32 | + ? _INSTALL_USER_DB |
|
| 33 | + : _request('login_db'); |
|
| 34 | 34 | |
| 35 | - $pass_db = defined('_INSTALL_PASS_DB') |
|
| 36 | - ? _INSTALL_PASS_DB |
|
| 37 | - : _request('pass_db'); |
|
| 35 | + $pass_db = defined('_INSTALL_PASS_DB') |
|
| 36 | + ? _INSTALL_PASS_DB |
|
| 37 | + : _request('pass_db'); |
|
| 38 | 38 | |
| 39 | - $server_db = defined('_INSTALL_SERVER_DB') |
|
| 40 | - ? _INSTALL_SERVER_DB |
|
| 41 | - : _request('server_db'); |
|
| 39 | + $server_db = defined('_INSTALL_SERVER_DB') |
|
| 40 | + ? _INSTALL_SERVER_DB |
|
| 41 | + : _request('server_db'); |
|
| 42 | 42 | |
| 43 | - $name_db = defined('_INSTALL_NAME_DB') |
|
| 44 | - ? _INSTALL_NAME_DB |
|
| 45 | - : ''; |
|
| 43 | + $name_db = defined('_INSTALL_NAME_DB') |
|
| 44 | + ? _INSTALL_NAME_DB |
|
| 45 | + : ''; |
|
| 46 | 46 | |
| 47 | - $chmod = _request('chmod'); |
|
| 47 | + $chmod = _request('chmod'); |
|
| 48 | 48 | |
| 49 | - $link = spip_connect_db($adresse_db, $port, $login_db, $pass_db, $name_db, $server_db); |
|
| 50 | - $GLOBALS['connexions'][$server_db] = $link; |
|
| 49 | + $link = spip_connect_db($adresse_db, $port, $login_db, $pass_db, $name_db, $server_db); |
|
| 50 | + $GLOBALS['connexions'][$server_db] = $link; |
|
| 51 | 51 | |
| 52 | - $GLOBALS['connexions'][$server_db][$GLOBALS['spip_sql_version']] |
|
| 53 | - = $GLOBALS['spip_' . $server_db . '_functions_' . $GLOBALS['spip_sql_version']]; |
|
| 52 | + $GLOBALS['connexions'][$server_db][$GLOBALS['spip_sql_version']] |
|
| 53 | + = $GLOBALS['spip_' . $server_db . '_functions_' . $GLOBALS['spip_sql_version']]; |
|
| 54 | 54 | |
| 55 | - echo install_debut_html(); |
|
| 55 | + echo install_debut_html(); |
|
| 56 | 56 | |
| 57 | 57 | // prenons toutes les dispositions possibles pour que rien ne s'affiche ! |
| 58 | 58 | |
| 59 | - /* |
|
| 59 | + /* |
|
| 60 | 60 | * /!\ sqlite3/PDO : erreur sur join(', ', $link) |
| 61 | 61 | * L'objet PDO ne peut pas etre transformee en chaine |
| 62 | 62 | * Un echo $link ne fonctionne pas non plus |
| 63 | 63 | * Il faut utiliser par exemple print_r($link) |
| 64 | 64 | */ |
| 65 | - //echo "\n<!--\n", join(', ', $link), " $login_db "; |
|
| 66 | - $db_connect = 0; // revoirfunction_exists($ferrno) ? $ferrno() : 0; |
|
| 67 | - //echo join(', ', $GLOBALS['connexions'][$server_db]); |
|
| 68 | - //echo "\n-->\n"; |
|
| 65 | + //echo "\n<!--\n", join(', ', $link), " $login_db "; |
|
| 66 | + $db_connect = 0; // revoirfunction_exists($ferrno) ? $ferrno() : 0; |
|
| 67 | + //echo join(', ', $GLOBALS['connexions'][$server_db]); |
|
| 68 | + //echo "\n-->\n"; |
|
| 69 | 69 | |
| 70 | - if (($db_connect == '0') && $link) { |
|
| 71 | - echo "<div class='success'><b>" . _T('info_connexion_ok') . '</b></div>'; |
|
| 72 | - echo info_progression_etape(2, 'etape_', 'install/'); |
|
| 70 | + if (($db_connect == '0') && $link) { |
|
| 71 | + echo "<div class='success'><b>" . _T('info_connexion_ok') . '</b></div>'; |
|
| 72 | + echo info_progression_etape(2, 'etape_', 'install/'); |
|
| 73 | 73 | |
| 74 | - echo info_etape(_T('menu_aide_installation_choix_base') . aider('install2', true)); |
|
| 74 | + echo info_etape(_T('menu_aide_installation_choix_base') . aider('install2', true)); |
|
| 75 | 75 | |
| 76 | - echo "\n", '<!-- ', sql_version($server_db), ' -->'; |
|
| 77 | - list($checked, $res) = install_etape_2_bases($login_db, $server_db); |
|
| 76 | + echo "\n", '<!-- ', sql_version($server_db), ' -->'; |
|
| 77 | + list($checked, $res) = install_etape_2_bases($login_db, $server_db); |
|
| 78 | 78 | |
| 79 | - $hidden = (defined('_SPIP_CHMOD') |
|
| 80 | - ? '' |
|
| 81 | - : ("\n<input type='hidden' name='chmod' value='" . spip_htmlspecialchars($chmod) . "' />")) |
|
| 82 | - . predef_ou_cache($adresse_db . ($port ? ':' . $port : ''), $login_db, $pass_db, $server_db); |
|
| 79 | + $hidden = (defined('_SPIP_CHMOD') |
|
| 80 | + ? '' |
|
| 81 | + : ("\n<input type='hidden' name='chmod' value='" . spip_htmlspecialchars($chmod) . "' />")) |
|
| 82 | + . predef_ou_cache($adresse_db . ($port ? ':' . $port : ''), $login_db, $pass_db, $server_db); |
|
| 83 | 83 | |
| 84 | - echo install_etape_2_form($hidden, $checked, $res, 3); |
|
| 85 | - } else { |
|
| 86 | - echo info_progression_etape(1, 'etape_', 'install/', true); |
|
| 84 | + echo install_etape_2_form($hidden, $checked, $res, 3); |
|
| 85 | + } else { |
|
| 86 | + echo info_progression_etape(1, 'etape_', 'install/', true); |
|
| 87 | 87 | |
| 88 | - echo "<div class='error'>"; |
|
| 89 | - echo info_etape(_T('info_connexion_base')); |
|
| 90 | - echo '<h3>' . _T('avis_connexion_echec_1') . '</h3>'; |
|
| 91 | - echo '<p>' . _T('avis_connexion_echec_2') . '</p>'; |
|
| 88 | + echo "<div class='error'>"; |
|
| 89 | + echo info_etape(_T('info_connexion_base')); |
|
| 90 | + echo '<h3>' . _T('avis_connexion_echec_1') . '</h3>'; |
|
| 91 | + echo '<p>' . _T('avis_connexion_echec_2') . '</p>'; |
|
| 92 | 92 | |
| 93 | - echo "<p style='font-size: small;'>", |
|
| 94 | - _T('avis_connexion_echec_3'), |
|
| 95 | - '</p></div>'; |
|
| 96 | - } |
|
| 93 | + echo "<p style='font-size: small;'>", |
|
| 94 | + _T('avis_connexion_echec_3'), |
|
| 95 | + '</p></div>'; |
|
| 96 | + } |
|
| 97 | 97 | |
| 98 | - echo install_fin_html(); |
|
| 98 | + echo install_fin_html(); |
|
| 99 | 99 | } |
| 100 | 100 | |
| 101 | 101 | // Liste les bases accessibles, |
@@ -103,77 +103,77 @@ discard block |
||
| 103 | 103 | |
| 104 | 104 | // https://code.spip.net/@install_etape_2_bases |
| 105 | 105 | function install_etape_2_bases($login_db, $server_db) { |
| 106 | - $res = install_etape_liste_bases($server_db, $login_db); |
|
| 107 | - if ($res) { |
|
| 108 | - list($checked, $bases) = $res; |
|
| 109 | - |
|
| 110 | - return [ |
|
| 111 | - $checked, |
|
| 112 | - "<label for='choix_db'><b>" |
|
| 113 | - . _T('texte_choix_base_2') |
|
| 114 | - . '</b><br />' |
|
| 115 | - . _T('texte_choix_base_3') |
|
| 116 | - . '</label>' |
|
| 117 | - . "<ul>\n<li>" |
|
| 118 | - . join("</li>\n<li>", $bases) |
|
| 119 | - . "</li>\n</ul><p>" |
|
| 120 | - . _T('info_ou') |
|
| 121 | - . ' ' |
|
| 122 | - ]; |
|
| 123 | - } |
|
| 124 | - $res = '<b>' . _T('avis_lecture_noms_bases_1') . '</b> |
|
| 106 | + $res = install_etape_liste_bases($server_db, $login_db); |
|
| 107 | + if ($res) { |
|
| 108 | + list($checked, $bases) = $res; |
|
| 109 | + |
|
| 110 | + return [ |
|
| 111 | + $checked, |
|
| 112 | + "<label for='choix_db'><b>" |
|
| 113 | + . _T('texte_choix_base_2') |
|
| 114 | + . '</b><br />' |
|
| 115 | + . _T('texte_choix_base_3') |
|
| 116 | + . '</label>' |
|
| 117 | + . "<ul>\n<li>" |
|
| 118 | + . join("</li>\n<li>", $bases) |
|
| 119 | + . "</li>\n</ul><p>" |
|
| 120 | + . _T('info_ou') |
|
| 121 | + . ' ' |
|
| 122 | + ]; |
|
| 123 | + } |
|
| 124 | + $res = '<b>' . _T('avis_lecture_noms_bases_1') . '</b> |
|
| 125 | 125 | ' . _T('avis_lecture_noms_bases_2') . '<p>'; |
| 126 | 126 | |
| 127 | - $checked = false; |
|
| 128 | - if ($login_db) { |
|
| 129 | - // Si un login comporte un point, le nom de la base est plus |
|
| 130 | - // probablement le login sans le point -- testons pour savoir |
|
| 131 | - $test_base = $login_db; |
|
| 132 | - $ok = sql_selectdb($test_base, $server_db); |
|
| 133 | - $test_base2 = str_replace('.', '_', $test_base); |
|
| 134 | - if (sql_selectdb($test_base2, $server_db)) { |
|
| 135 | - $test_base = $test_base2; |
|
| 136 | - $ok = true; |
|
| 137 | - } |
|
| 138 | - |
|
| 139 | - if ($ok) { |
|
| 140 | - $res .= _T('avis_lecture_noms_bases_3') |
|
| 141 | - . '<ul>' |
|
| 142 | - . '<li><input name="choix_db" value="' . $test_base . "\" type='radio' id='stand' checked='checked' />" |
|
| 143 | - . "<label for='stand'>" . $test_base . "</label></li>\n" |
|
| 144 | - . '</ul>' |
|
| 145 | - . '<p>' . _T('info_ou') . ' '; |
|
| 146 | - $checked = true; |
|
| 147 | - } |
|
| 148 | - } |
|
| 149 | - |
|
| 150 | - return [$checked, $res]; |
|
| 127 | + $checked = false; |
|
| 128 | + if ($login_db) { |
|
| 129 | + // Si un login comporte un point, le nom de la base est plus |
|
| 130 | + // probablement le login sans le point -- testons pour savoir |
|
| 131 | + $test_base = $login_db; |
|
| 132 | + $ok = sql_selectdb($test_base, $server_db); |
|
| 133 | + $test_base2 = str_replace('.', '_', $test_base); |
|
| 134 | + if (sql_selectdb($test_base2, $server_db)) { |
|
| 135 | + $test_base = $test_base2; |
|
| 136 | + $ok = true; |
|
| 137 | + } |
|
| 138 | + |
|
| 139 | + if ($ok) { |
|
| 140 | + $res .= _T('avis_lecture_noms_bases_3') |
|
| 141 | + . '<ul>' |
|
| 142 | + . '<li><input name="choix_db" value="' . $test_base . "\" type='radio' id='stand' checked='checked' />" |
|
| 143 | + . "<label for='stand'>" . $test_base . "</label></li>\n" |
|
| 144 | + . '</ul>' |
|
| 145 | + . '<p>' . _T('info_ou') . ' '; |
|
| 146 | + $checked = true; |
|
| 147 | + } |
|
| 148 | + } |
|
| 149 | + |
|
| 150 | + return [$checked, $res]; |
|
| 151 | 151 | } |
| 152 | 152 | |
| 153 | 153 | // https://code.spip.net/@install_etape_2_form |
| 154 | 154 | function install_etape_2_form($hidden, $checked, $res, $etape) { |
| 155 | - return generer_form_ecrire('install', ( |
|
| 156 | - "\n<input type='hidden' name='etape' value='$etape' />" |
|
| 157 | - . $hidden |
|
| 158 | - . (defined('_INSTALL_NAME_DB') |
|
| 159 | - ? '<h3>' . _T('install_nom_base_hebergeur') . ' <tt>' . _INSTALL_NAME_DB . '</tt>' . '</h3>' |
|
| 160 | - : "\n<fieldset><legend>" . _T('texte_choix_base_1') . "</legend>\n" |
|
| 161 | - . $res |
|
| 162 | - . "\n<input name=\"choix_db\" value=\"new_spip\" type='radio' id='nou'" |
|
| 163 | - . ($checked ? '' : " checked='checked'") |
|
| 164 | - . " />\n<label for='nou'>" . _T('info_creer_base') . "</label></p>\n<p>" |
|
| 165 | - . "\n<input type='text' name='table_new' class='text' value=\"spip\" size='20' /></p></fieldset>\n" |
|
| 166 | - ) |
|
| 167 | - |
|
| 168 | - . ((defined('_INSTALL_TABLE_PREFIX') |
|
| 169 | - or $GLOBALS['table_prefix'] != 'spip') |
|
| 170 | - ? '<h3>' . _T('install_table_prefix_hebergeur') . ' <tt>' . $GLOBALS['table_prefix'] . '</tt>' . '</h3>' |
|
| 171 | - : '<fieldset><legend>' . _T('texte_choix_table_prefix') . "</legend>\n" |
|
| 172 | - . "<p><label for='table_prefix'>" . _T('info_table_prefix') . '</label></p><p>' |
|
| 173 | - . "\n<input type='text' id='tprefix' name='tprefix' class='text' value='" |
|
| 174 | - . 'spip' # valeur par defaut |
|
| 175 | - . "' size='20' /></p></fieldset>" |
|
| 176 | - ) |
|
| 177 | - |
|
| 178 | - . bouton_suivant())); |
|
| 155 | + return generer_form_ecrire('install', ( |
|
| 156 | + "\n<input type='hidden' name='etape' value='$etape' />" |
|
| 157 | + . $hidden |
|
| 158 | + . (defined('_INSTALL_NAME_DB') |
|
| 159 | + ? '<h3>' . _T('install_nom_base_hebergeur') . ' <tt>' . _INSTALL_NAME_DB . '</tt>' . '</h3>' |
|
| 160 | + : "\n<fieldset><legend>" . _T('texte_choix_base_1') . "</legend>\n" |
|
| 161 | + . $res |
|
| 162 | + . "\n<input name=\"choix_db\" value=\"new_spip\" type='radio' id='nou'" |
|
| 163 | + . ($checked ? '' : " checked='checked'") |
|
| 164 | + . " />\n<label for='nou'>" . _T('info_creer_base') . "</label></p>\n<p>" |
|
| 165 | + . "\n<input type='text' name='table_new' class='text' value=\"spip\" size='20' /></p></fieldset>\n" |
|
| 166 | + ) |
|
| 167 | + |
|
| 168 | + . ((defined('_INSTALL_TABLE_PREFIX') |
|
| 169 | + or $GLOBALS['table_prefix'] != 'spip') |
|
| 170 | + ? '<h3>' . _T('install_table_prefix_hebergeur') . ' <tt>' . $GLOBALS['table_prefix'] . '</tt>' . '</h3>' |
|
| 171 | + : '<fieldset><legend>' . _T('texte_choix_table_prefix') . "</legend>\n" |
|
| 172 | + . "<p><label for='table_prefix'>" . _T('info_table_prefix') . '</label></p><p>' |
|
| 173 | + . "\n<input type='text' id='tprefix' name='tprefix' class='text' value='" |
|
| 174 | + . 'spip' # valeur par defaut |
|
| 175 | + . "' size='20' /></p></fieldset>" |
|
| 176 | + ) |
|
| 177 | + |
|
| 178 | + . bouton_suivant())); |
|
| 179 | 179 | } |
@@ -50,7 +50,7 @@ discard block |
||
| 50 | 50 | $GLOBALS['connexions'][$server_db] = $link; |
| 51 | 51 | |
| 52 | 52 | $GLOBALS['connexions'][$server_db][$GLOBALS['spip_sql_version']] |
| 53 | - = $GLOBALS['spip_' . $server_db . '_functions_' . $GLOBALS['spip_sql_version']]; |
|
| 53 | + = $GLOBALS['spip_'.$server_db.'_functions_'.$GLOBALS['spip_sql_version']]; |
|
| 54 | 54 | |
| 55 | 55 | echo install_debut_html(); |
| 56 | 56 | |
@@ -68,18 +68,18 @@ discard block |
||
| 68 | 68 | //echo "\n-->\n"; |
| 69 | 69 | |
| 70 | 70 | if (($db_connect == '0') && $link) { |
| 71 | - echo "<div class='success'><b>" . _T('info_connexion_ok') . '</b></div>'; |
|
| 71 | + echo "<div class='success'><b>"._T('info_connexion_ok').'</b></div>'; |
|
| 72 | 72 | echo info_progression_etape(2, 'etape_', 'install/'); |
| 73 | 73 | |
| 74 | - echo info_etape(_T('menu_aide_installation_choix_base') . aider('install2', true)); |
|
| 74 | + echo info_etape(_T('menu_aide_installation_choix_base').aider('install2', true)); |
|
| 75 | 75 | |
| 76 | 76 | echo "\n", '<!-- ', sql_version($server_db), ' -->'; |
| 77 | 77 | list($checked, $res) = install_etape_2_bases($login_db, $server_db); |
| 78 | 78 | |
| 79 | 79 | $hidden = (defined('_SPIP_CHMOD') |
| 80 | 80 | ? '' |
| 81 | - : ("\n<input type='hidden' name='chmod' value='" . spip_htmlspecialchars($chmod) . "' />")) |
|
| 82 | - . predef_ou_cache($adresse_db . ($port ? ':' . $port : ''), $login_db, $pass_db, $server_db); |
|
| 81 | + : ("\n<input type='hidden' name='chmod' value='".spip_htmlspecialchars($chmod)."' />")) |
|
| 82 | + . predef_ou_cache($adresse_db.($port ? ':'.$port : ''), $login_db, $pass_db, $server_db); |
|
| 83 | 83 | |
| 84 | 84 | echo install_etape_2_form($hidden, $checked, $res, 3); |
| 85 | 85 | } else { |
@@ -87,8 +87,8 @@ discard block |
||
| 87 | 87 | |
| 88 | 88 | echo "<div class='error'>"; |
| 89 | 89 | echo info_etape(_T('info_connexion_base')); |
| 90 | - echo '<h3>' . _T('avis_connexion_echec_1') . '</h3>'; |
|
| 91 | - echo '<p>' . _T('avis_connexion_echec_2') . '</p>'; |
|
| 90 | + echo '<h3>'._T('avis_connexion_echec_1').'</h3>'; |
|
| 91 | + echo '<p>'._T('avis_connexion_echec_2').'</p>'; |
|
| 92 | 92 | |
| 93 | 93 | echo "<p style='font-size: small;'>", |
| 94 | 94 | _T('avis_connexion_echec_3'), |
@@ -121,8 +121,8 @@ discard block |
||
| 121 | 121 | . ' ' |
| 122 | 122 | ]; |
| 123 | 123 | } |
| 124 | - $res = '<b>' . _T('avis_lecture_noms_bases_1') . '</b> |
|
| 125 | - ' . _T('avis_lecture_noms_bases_2') . '<p>'; |
|
| 124 | + $res = '<b>'._T('avis_lecture_noms_bases_1').'</b> |
|
| 125 | + ' . _T('avis_lecture_noms_bases_2').'<p>'; |
|
| 126 | 126 | |
| 127 | 127 | $checked = false; |
| 128 | 128 | if ($login_db) { |
@@ -139,10 +139,10 @@ discard block |
||
| 139 | 139 | if ($ok) { |
| 140 | 140 | $res .= _T('avis_lecture_noms_bases_3') |
| 141 | 141 | . '<ul>' |
| 142 | - . '<li><input name="choix_db" value="' . $test_base . "\" type='radio' id='stand' checked='checked' />" |
|
| 143 | - . "<label for='stand'>" . $test_base . "</label></li>\n" |
|
| 142 | + . '<li><input name="choix_db" value="'.$test_base."\" type='radio' id='stand' checked='checked' />" |
|
| 143 | + . "<label for='stand'>".$test_base."</label></li>\n" |
|
| 144 | 144 | . '</ul>' |
| 145 | - . '<p>' . _T('info_ou') . ' '; |
|
| 145 | + . '<p>'._T('info_ou').' '; |
|
| 146 | 146 | $checked = true; |
| 147 | 147 | } |
| 148 | 148 | } |
@@ -156,20 +156,20 @@ discard block |
||
| 156 | 156 | "\n<input type='hidden' name='etape' value='$etape' />" |
| 157 | 157 | . $hidden |
| 158 | 158 | . (defined('_INSTALL_NAME_DB') |
| 159 | - ? '<h3>' . _T('install_nom_base_hebergeur') . ' <tt>' . _INSTALL_NAME_DB . '</tt>' . '</h3>' |
|
| 160 | - : "\n<fieldset><legend>" . _T('texte_choix_base_1') . "</legend>\n" |
|
| 159 | + ? '<h3>'._T('install_nom_base_hebergeur').' <tt>'._INSTALL_NAME_DB.'</tt>'.'</h3>' |
|
| 160 | + : "\n<fieldset><legend>"._T('texte_choix_base_1')."</legend>\n" |
|
| 161 | 161 | . $res |
| 162 | 162 | . "\n<input name=\"choix_db\" value=\"new_spip\" type='radio' id='nou'" |
| 163 | 163 | . ($checked ? '' : " checked='checked'") |
| 164 | - . " />\n<label for='nou'>" . _T('info_creer_base') . "</label></p>\n<p>" |
|
| 164 | + . " />\n<label for='nou'>"._T('info_creer_base')."</label></p>\n<p>" |
|
| 165 | 165 | . "\n<input type='text' name='table_new' class='text' value=\"spip\" size='20' /></p></fieldset>\n" |
| 166 | 166 | ) |
| 167 | 167 | |
| 168 | 168 | . ((defined('_INSTALL_TABLE_PREFIX') |
| 169 | 169 | or $GLOBALS['table_prefix'] != 'spip') |
| 170 | - ? '<h3>' . _T('install_table_prefix_hebergeur') . ' <tt>' . $GLOBALS['table_prefix'] . '</tt>' . '</h3>' |
|
| 171 | - : '<fieldset><legend>' . _T('texte_choix_table_prefix') . "</legend>\n" |
|
| 172 | - . "<p><label for='table_prefix'>" . _T('info_table_prefix') . '</label></p><p>' |
|
| 170 | + ? '<h3>'._T('install_table_prefix_hebergeur').' <tt>'.$GLOBALS['table_prefix'].'</tt>'.'</h3>' |
|
| 171 | + : '<fieldset><legend>'._T('texte_choix_table_prefix')."</legend>\n" |
|
| 172 | + . "<p><label for='table_prefix'>"._T('info_table_prefix').'</label></p><p>' |
|
| 173 | 173 | . "\n<input type='text' id='tprefix' name='tprefix' class='text' value='" |
| 174 | 174 | . 'spip' # valeur par defaut |
| 175 | 175 | . "' size='20' /></p></fieldset>" |
@@ -11,7 +11,7 @@ discard block |
||
| 11 | 11 | \***************************************************************************/ |
| 12 | 12 | |
| 13 | 13 | if (!defined('_ECRIRE_INC_VERSION')) { |
| 14 | - return; |
|
| 14 | + return; |
|
| 15 | 15 | } |
| 16 | 16 | |
| 17 | 17 | include_spip('inc/headers'); |
@@ -19,62 +19,62 @@ discard block |
||
| 19 | 19 | // https://code.spip.net/@install_etape_4_dist |
| 20 | 20 | function install_etape_4_dist() { |
| 21 | 21 | |
| 22 | - // creer le repertoire cache, qui sert partout ! |
|
| 23 | - if (!@file_exists(_DIR_CACHE)) { |
|
| 24 | - $rep = preg_replace(',' . _DIR_TMP . ',', '', _DIR_CACHE); |
|
| 25 | - $rep = sous_repertoire(_DIR_TMP, $rep, true, true); |
|
| 26 | - } |
|
| 22 | + // creer le repertoire cache, qui sert partout ! |
|
| 23 | + if (!@file_exists(_DIR_CACHE)) { |
|
| 24 | + $rep = preg_replace(',' . _DIR_TMP . ',', '', _DIR_CACHE); |
|
| 25 | + $rep = sous_repertoire(_DIR_TMP, $rep, true, true); |
|
| 26 | + } |
|
| 27 | 27 | |
| 28 | 28 | |
| 29 | - echo install_debut_html('AUTO', ' onload="document.getElementById(\'suivant\').focus();return false;"'); |
|
| 30 | - echo info_progression_etape(4, 'etape_', 'install/'); |
|
| 29 | + echo install_debut_html('AUTO', ' onload="document.getElementById(\'suivant\').focus();return false;"'); |
|
| 30 | + echo info_progression_etape(4, 'etape_', 'install/'); |
|
| 31 | 31 | |
| 32 | - echo "<div class='success'><b>" |
|
| 33 | - . _T('info_derniere_etape') |
|
| 34 | - . '</b><p>' |
|
| 35 | - . _T('info_utilisation_spip') |
|
| 36 | - . '</p></div>'; |
|
| 32 | + echo "<div class='success'><b>" |
|
| 33 | + . _T('info_derniere_etape') |
|
| 34 | + . '</b><p>' |
|
| 35 | + . _T('info_utilisation_spip') |
|
| 36 | + . '</p></div>'; |
|
| 37 | 37 | |
| 38 | 38 | |
| 39 | - echo '<p>' |
|
| 40 | - . _T( |
|
| 41 | - 'plugin_info_plugins_dist_1', |
|
| 42 | - ['plugins_dist' => '<tt>' . joli_repertoire(_DIR_PLUGINS_DIST) . '</tt>'] |
|
| 43 | - ) |
|
| 44 | - . '</p>'; |
|
| 39 | + echo '<p>' |
|
| 40 | + . _T( |
|
| 41 | + 'plugin_info_plugins_dist_1', |
|
| 42 | + ['plugins_dist' => '<tt>' . joli_repertoire(_DIR_PLUGINS_DIST) . '</tt>'] |
|
| 43 | + ) |
|
| 44 | + . '</p>'; |
|
| 45 | 45 | |
| 46 | - // installer les extensions |
|
| 47 | - include_spip('inc/plugin'); |
|
| 48 | - $afficher = charger_fonction('afficher_liste', 'plugins'); |
|
| 49 | - echo $afficher( |
|
| 50 | - self(), |
|
| 51 | - liste_plugin_files(_DIR_PLUGINS_DIST), |
|
| 52 | - [], |
|
| 53 | - [], |
|
| 54 | - _DIR_PLUGINS_DIST, |
|
| 55 | - 'afficher_nom_plugin' |
|
| 56 | - ); |
|
| 46 | + // installer les extensions |
|
| 47 | + include_spip('inc/plugin'); |
|
| 48 | + $afficher = charger_fonction('afficher_liste', 'plugins'); |
|
| 49 | + echo $afficher( |
|
| 50 | + self(), |
|
| 51 | + liste_plugin_files(_DIR_PLUGINS_DIST), |
|
| 52 | + [], |
|
| 53 | + [], |
|
| 54 | + _DIR_PLUGINS_DIST, |
|
| 55 | + 'afficher_nom_plugin' |
|
| 56 | + ); |
|
| 57 | 57 | |
| 58 | - // si la base de SPIP est up, on peut installer les plugins, sinon on passe cette etape |
|
| 59 | - // car les plugins supposent que la base de SPIP est dans son etat normal (mise a jour) |
|
| 60 | - // au premier passage dans l'espace prive on aura une demande d'upgrade qui se poursuit sur la page plugin |
|
| 61 | - // et procede alors a l'installation |
|
| 62 | - if ( |
|
| 63 | - !isset($GLOBALS['meta']['version_installee']) |
|
| 64 | - or ($GLOBALS['spip_version_base'] == (str_replace(',', '.', $GLOBALS['meta']['version_installee']))) |
|
| 65 | - ) { |
|
| 66 | - plugin_installes_meta(); |
|
| 67 | - } |
|
| 58 | + // si la base de SPIP est up, on peut installer les plugins, sinon on passe cette etape |
|
| 59 | + // car les plugins supposent que la base de SPIP est dans son etat normal (mise a jour) |
|
| 60 | + // au premier passage dans l'espace prive on aura une demande d'upgrade qui se poursuit sur la page plugin |
|
| 61 | + // et procede alors a l'installation |
|
| 62 | + if ( |
|
| 63 | + !isset($GLOBALS['meta']['version_installee']) |
|
| 64 | + or ($GLOBALS['spip_version_base'] == (str_replace(',', '.', $GLOBALS['meta']['version_installee']))) |
|
| 65 | + ) { |
|
| 66 | + plugin_installes_meta(); |
|
| 67 | + } |
|
| 68 | 68 | |
| 69 | - // mettre a jour si necessaire l'adresse du site |
|
| 70 | - // securite si on arrive plus a se loger |
|
| 71 | - include_spip('inc/config'); |
|
| 72 | - appliquer_adresse_site(''); |
|
| 69 | + // mettre a jour si necessaire l'adresse du site |
|
| 70 | + // securite si on arrive plus a se loger |
|
| 71 | + include_spip('inc/config'); |
|
| 72 | + appliquer_adresse_site(''); |
|
| 73 | 73 | |
| 74 | - // aller a la derniere etape qui clos l'install et redirige |
|
| 75 | - $suite = "\n<input type='hidden' name='etape' value='fin' />" |
|
| 76 | - . bouton_suivant(_T('login_espace_prive')); |
|
| 74 | + // aller a la derniere etape qui clos l'install et redirige |
|
| 75 | + $suite = "\n<input type='hidden' name='etape' value='fin' />" |
|
| 76 | + . bouton_suivant(_T('login_espace_prive')); |
|
| 77 | 77 | |
| 78 | - echo generer_form_ecrire('install', $suite); |
|
| 79 | - echo install_fin_html(); |
|
| 78 | + echo generer_form_ecrire('install', $suite); |
|
| 79 | + echo install_fin_html(); |
|
| 80 | 80 | } |
@@ -21,7 +21,7 @@ discard block |
||
| 21 | 21 | |
| 22 | 22 | // creer le repertoire cache, qui sert partout ! |
| 23 | 23 | if (!@file_exists(_DIR_CACHE)) { |
| 24 | - $rep = preg_replace(',' . _DIR_TMP . ',', '', _DIR_CACHE); |
|
| 24 | + $rep = preg_replace(','._DIR_TMP.',', '', _DIR_CACHE); |
|
| 25 | 25 | $rep = sous_repertoire(_DIR_TMP, $rep, true, true); |
| 26 | 26 | } |
| 27 | 27 | |
@@ -39,7 +39,7 @@ discard block |
||
| 39 | 39 | echo '<p>' |
| 40 | 40 | . _T( |
| 41 | 41 | 'plugin_info_plugins_dist_1', |
| 42 | - ['plugins_dist' => '<tt>' . joli_repertoire(_DIR_PLUGINS_DIST) . '</tt>'] |
|
| 42 | + ['plugins_dist' => '<tt>'.joli_repertoire(_DIR_PLUGINS_DIST).'</tt>'] |
|
| 43 | 43 | ) |
| 44 | 44 | . '</p>'; |
| 45 | 45 | |
@@ -11,85 +11,85 @@ |
||
| 11 | 11 | \***************************************************************************/ |
| 12 | 12 | |
| 13 | 13 | if (!defined('_ECRIRE_INC_VERSION')) { |
| 14 | - return; |
|
| 14 | + return; |
|
| 15 | 15 | } |
| 16 | 16 | include_spip('inc/headers'); |
| 17 | 17 | include_spip('auth/ldap'); |
| 18 | 18 | |
| 19 | 19 | // https://code.spip.net/@install_etape_ldap5_dist |
| 20 | 20 | function install_etape_ldap5_dist() { |
| 21 | - etape_ldap5_save(); |
|
| 22 | - etape_ldap5_suite(); |
|
| 21 | + etape_ldap5_save(); |
|
| 22 | + etape_ldap5_suite(); |
|
| 23 | 23 | } |
| 24 | 24 | |
| 25 | 25 | function etape_ldap5_save() { |
| 26 | - if (!@file_exists(_FILE_CONNECT_TMP)) { |
|
| 27 | - redirige_url_ecrire('install'); |
|
| 28 | - } |
|
| 26 | + if (!@file_exists(_FILE_CONNECT_TMP)) { |
|
| 27 | + redirige_url_ecrire('install'); |
|
| 28 | + } |
|
| 29 | 29 | |
| 30 | - ecrire_meta('ldap_statut_import', _request('statut_ldap')); |
|
| 30 | + ecrire_meta('ldap_statut_import', _request('statut_ldap')); |
|
| 31 | 31 | |
| 32 | - lire_fichier(_FILE_CONNECT_TMP, $conn); |
|
| 32 | + lire_fichier(_FILE_CONNECT_TMP, $conn); |
|
| 33 | 33 | |
| 34 | - if ($p = strpos($conn, "'');")) { |
|
| 35 | - ecrire_fichier( |
|
| 36 | - _FILE_CONNECT_TMP, |
|
| 37 | - substr($conn, 0, $p + 1) |
|
| 38 | - . _FILE_LDAP |
|
| 39 | - . substr($conn, $p + 1) |
|
| 40 | - ); |
|
| 41 | - } |
|
| 34 | + if ($p = strpos($conn, "'');")) { |
|
| 35 | + ecrire_fichier( |
|
| 36 | + _FILE_CONNECT_TMP, |
|
| 37 | + substr($conn, 0, $p + 1) |
|
| 38 | + . _FILE_LDAP |
|
| 39 | + . substr($conn, $p + 1) |
|
| 40 | + ); |
|
| 41 | + } |
|
| 42 | 42 | |
| 43 | - $adresse_ldap = addcslashes(_request('adresse_ldap'), "'\\"); |
|
| 44 | - $login_ldap = addcslashes(_request('login_ldap'), "'\\"); |
|
| 45 | - $pass_ldap = addcslashes(_request('pass_ldap'), "'\\"); |
|
| 46 | - $port_ldap = addcslashes(_request('port_ldap'), "'\\"); |
|
| 47 | - $tls_ldap = addcslashes(_request('tls_ldap'), "'\\"); |
|
| 48 | - $protocole_ldap = addcslashes(_request('protocole_ldap'), "'\\"); |
|
| 49 | - $base_ldap = addcslashes(_request('base_ldap'), "'\\"); |
|
| 50 | - $base_ldap_text = addcslashes(_request('base_ldap_text'), "'\\"); |
|
| 43 | + $adresse_ldap = addcslashes(_request('adresse_ldap'), "'\\"); |
|
| 44 | + $login_ldap = addcslashes(_request('login_ldap'), "'\\"); |
|
| 45 | + $pass_ldap = addcslashes(_request('pass_ldap'), "'\\"); |
|
| 46 | + $port_ldap = addcslashes(_request('port_ldap'), "'\\"); |
|
| 47 | + $tls_ldap = addcslashes(_request('tls_ldap'), "'\\"); |
|
| 48 | + $protocole_ldap = addcslashes(_request('protocole_ldap'), "'\\"); |
|
| 49 | + $base_ldap = addcslashes(_request('base_ldap'), "'\\"); |
|
| 50 | + $base_ldap_text = addcslashes(_request('base_ldap_text'), "'\\"); |
|
| 51 | 51 | |
| 52 | - $conn = "\$GLOBALS['ldap_base'] = '$base_ldap';\n" |
|
| 53 | - . "\$GLOBALS['ldap_link'] = @ldap_connect('$adresse_ldap','$port_ldap');\n" |
|
| 54 | - . "@ldap_set_option(\$GLOBALS['ldap_link'],LDAP_OPT_PROTOCOL_VERSION,'$protocole_ldap');\n" |
|
| 55 | - . (($tls_ldap != 'oui') ? '' : |
|
| 56 | - "@ldap_start_tls(\$GLOBALS['ldap_link']);\n") |
|
| 57 | - . "@ldap_bind(\$GLOBALS['ldap_link'],'$login_ldap','$pass_ldap');\n"; |
|
| 52 | + $conn = "\$GLOBALS['ldap_base'] = '$base_ldap';\n" |
|
| 53 | + . "\$GLOBALS['ldap_link'] = @ldap_connect('$adresse_ldap','$port_ldap');\n" |
|
| 54 | + . "@ldap_set_option(\$GLOBALS['ldap_link'],LDAP_OPT_PROTOCOL_VERSION,'$protocole_ldap');\n" |
|
| 55 | + . (($tls_ldap != 'oui') ? '' : |
|
| 56 | + "@ldap_start_tls(\$GLOBALS['ldap_link']);\n") |
|
| 57 | + . "@ldap_bind(\$GLOBALS['ldap_link'],'$login_ldap','$pass_ldap');\n"; |
|
| 58 | 58 | |
| 59 | - $champs = is_array($GLOBALS['ldap_attributes']) ? $GLOBALS['ldap_attributes'] : []; |
|
| 60 | - $res = ''; |
|
| 61 | - foreach ($champs as $champ => $v) { |
|
| 62 | - $nom = 'ldap_' . $champ; |
|
| 63 | - $val = trim(_request($nom)); |
|
| 64 | - if (preg_match('/^\w*$/', $val)) { |
|
| 65 | - if ($val) { |
|
| 66 | - $val = _q($val); |
|
| 67 | - } |
|
| 68 | - } else { |
|
| 69 | - $val = 'array(' . _q(preg_split('/\W+/', $val)) . ')'; |
|
| 70 | - }; |
|
| 71 | - if ($val) { |
|
| 72 | - $res .= "'$champ' => " . $val . ','; |
|
| 73 | - } |
|
| 74 | - } |
|
| 75 | - $conn .= "\$GLOBALS['ldap_champs'] = array($res);\n"; |
|
| 59 | + $champs = is_array($GLOBALS['ldap_attributes']) ? $GLOBALS['ldap_attributes'] : []; |
|
| 60 | + $res = ''; |
|
| 61 | + foreach ($champs as $champ => $v) { |
|
| 62 | + $nom = 'ldap_' . $champ; |
|
| 63 | + $val = trim(_request($nom)); |
|
| 64 | + if (preg_match('/^\w*$/', $val)) { |
|
| 65 | + if ($val) { |
|
| 66 | + $val = _q($val); |
|
| 67 | + } |
|
| 68 | + } else { |
|
| 69 | + $val = 'array(' . _q(preg_split('/\W+/', $val)) . ')'; |
|
| 70 | + }; |
|
| 71 | + if ($val) { |
|
| 72 | + $res .= "'$champ' => " . $val . ','; |
|
| 73 | + } |
|
| 74 | + } |
|
| 75 | + $conn .= "\$GLOBALS['ldap_champs'] = array($res);\n"; |
|
| 76 | 76 | |
| 77 | - install_fichier_connexion(_DIR_CONNECT . _FILE_LDAP, $conn); |
|
| 77 | + install_fichier_connexion(_DIR_CONNECT . _FILE_LDAP, $conn); |
|
| 78 | 78 | } |
| 79 | 79 | |
| 80 | 80 | function etape_ldap5_suite() { |
| 81 | - echo install_debut_html('AUTO', ' onload="document.getElementById(\'suivant\').focus();return false;"'); |
|
| 81 | + echo install_debut_html('AUTO', ' onload="document.getElementById(\'suivant\').focus();return false;"'); |
|
| 82 | 82 | |
| 83 | - echo info_etape( |
|
| 84 | - _T('info_ldap_ok'), |
|
| 85 | - info_progression_etape(5, 'etape_ldap', 'install/'), |
|
| 86 | - _T('info_terminer_installation') |
|
| 87 | - ); |
|
| 83 | + echo info_etape( |
|
| 84 | + _T('info_ldap_ok'), |
|
| 85 | + info_progression_etape(5, 'etape_ldap', 'install/'), |
|
| 86 | + _T('info_terminer_installation') |
|
| 87 | + ); |
|
| 88 | 88 | |
| 89 | - echo generer_form_ecrire('install', ( |
|
| 90 | - "<input type='hidden' name='etape' value='3' />" . |
|
| 91 | - "<input type='hidden' name='ldap_present' value='true' />" |
|
| 92 | - . bouton_suivant())); |
|
| 89 | + echo generer_form_ecrire('install', ( |
|
| 90 | + "<input type='hidden' name='etape' value='3' />" . |
|
| 91 | + "<input type='hidden' name='ldap_present' value='true' />" |
|
| 92 | + . bouton_suivant())); |
|
| 93 | 93 | |
| 94 | - echo install_fin_html(); |
|
| 94 | + echo install_fin_html(); |
|
| 95 | 95 | } |
@@ -52,29 +52,28 @@ discard block |
||
| 52 | 52 | $conn = "\$GLOBALS['ldap_base'] = '$base_ldap';\n" |
| 53 | 53 | . "\$GLOBALS['ldap_link'] = @ldap_connect('$adresse_ldap','$port_ldap');\n" |
| 54 | 54 | . "@ldap_set_option(\$GLOBALS['ldap_link'],LDAP_OPT_PROTOCOL_VERSION,'$protocole_ldap');\n" |
| 55 | - . (($tls_ldap != 'oui') ? '' : |
|
| 56 | - "@ldap_start_tls(\$GLOBALS['ldap_link']);\n") |
|
| 55 | + . (($tls_ldap != 'oui') ? '' : "@ldap_start_tls(\$GLOBALS['ldap_link']);\n") |
|
| 57 | 56 | . "@ldap_bind(\$GLOBALS['ldap_link'],'$login_ldap','$pass_ldap');\n"; |
| 58 | 57 | |
| 59 | 58 | $champs = is_array($GLOBALS['ldap_attributes']) ? $GLOBALS['ldap_attributes'] : []; |
| 60 | 59 | $res = ''; |
| 61 | 60 | foreach ($champs as $champ => $v) { |
| 62 | - $nom = 'ldap_' . $champ; |
|
| 61 | + $nom = 'ldap_'.$champ; |
|
| 63 | 62 | $val = trim(_request($nom)); |
| 64 | 63 | if (preg_match('/^\w*$/', $val)) { |
| 65 | 64 | if ($val) { |
| 66 | 65 | $val = _q($val); |
| 67 | 66 | } |
| 68 | 67 | } else { |
| 69 | - $val = 'array(' . _q(preg_split('/\W+/', $val)) . ')'; |
|
| 68 | + $val = 'array('._q(preg_split('/\W+/', $val)).')'; |
|
| 70 | 69 | }; |
| 71 | 70 | if ($val) { |
| 72 | - $res .= "'$champ' => " . $val . ','; |
|
| 71 | + $res .= "'$champ' => ".$val.','; |
|
| 73 | 72 | } |
| 74 | 73 | } |
| 75 | 74 | $conn .= "\$GLOBALS['ldap_champs'] = array($res);\n"; |
| 76 | 75 | |
| 77 | - install_fichier_connexion(_DIR_CONNECT . _FILE_LDAP, $conn); |
|
| 76 | + install_fichier_connexion(_DIR_CONNECT._FILE_LDAP, $conn); |
|
| 78 | 77 | } |
| 79 | 78 | |
| 80 | 79 | function etape_ldap5_suite() { |
@@ -87,7 +86,7 @@ discard block |
||
| 87 | 86 | ); |
| 88 | 87 | |
| 89 | 88 | echo generer_form_ecrire('install', ( |
| 90 | - "<input type='hidden' name='etape' value='3' />" . |
|
| 89 | + "<input type='hidden' name='etape' value='3' />". |
|
| 91 | 90 | "<input type='hidden' name='ldap_present' value='true' />" |
| 92 | 91 | . bouton_suivant())); |
| 93 | 92 | |
@@ -17,7 +17,7 @@ discard block |
||
| 17 | 17 | */ |
| 18 | 18 | |
| 19 | 19 | if (!defined('_ECRIRE_INC_VERSION')) { |
| 20 | - return; |
|
| 20 | + return; |
|
| 21 | 21 | } |
| 22 | 22 | |
| 23 | 23 | /** |
@@ -32,35 +32,35 @@ discard block |
||
| 32 | 32 | * @return int |
| 33 | 33 | */ |
| 34 | 34 | function genie_mail_dist($t) { |
| 35 | - $adresse_neuf = $GLOBALS['meta']['adresse_neuf']; |
|
| 36 | - $jours_neuf = $GLOBALS['meta']['jours_neuf']; |
|
| 35 | + $adresse_neuf = $GLOBALS['meta']['adresse_neuf']; |
|
| 36 | + $jours_neuf = $GLOBALS['meta']['jours_neuf']; |
|
| 37 | 37 | |
| 38 | - $now = time(); |
|
| 39 | - if (!isset($GLOBALS['meta']['dernier_envoi_neuf'])) { |
|
| 40 | - ecrire_meta('dernier_envoi_neuf', date('Y-m-d H:i:s', $now - (3600 * 24 * $jours_neuf))); |
|
| 41 | - } |
|
| 38 | + $now = time(); |
|
| 39 | + if (!isset($GLOBALS['meta']['dernier_envoi_neuf'])) { |
|
| 40 | + ecrire_meta('dernier_envoi_neuf', date('Y-m-d H:i:s', $now - (3600 * 24 * $jours_neuf))); |
|
| 41 | + } |
|
| 42 | 42 | |
| 43 | - $page = recuperer_fond( |
|
| 44 | - 'nouveautes', |
|
| 45 | - ['date' => $GLOBALS['meta']['dernier_envoi_neuf'], 'jours_neuf' => $jours_neuf], |
|
| 46 | - ['raw' => true] |
|
| 47 | - ); |
|
| 43 | + $page = recuperer_fond( |
|
| 44 | + 'nouveautes', |
|
| 45 | + ['date' => $GLOBALS['meta']['dernier_envoi_neuf'], 'jours_neuf' => $jours_neuf], |
|
| 46 | + ['raw' => true] |
|
| 47 | + ); |
|
| 48 | 48 | |
| 49 | - if (strlen(trim($page['texte']))) { |
|
| 50 | - // recuperer les entetes envoyes par #HTTP_HEADER |
|
| 51 | - $headers = ''; |
|
| 52 | - if (isset($page['entetes']) and count($page['entetes'])) { |
|
| 53 | - foreach ($page['entetes'] as $k => $v) { |
|
| 54 | - $headers .= (strlen($v) ? "$k: $v" : $k) . "\n"; |
|
| 55 | - } |
|
| 56 | - } |
|
| 49 | + if (strlen(trim($page['texte']))) { |
|
| 50 | + // recuperer les entetes envoyes par #HTTP_HEADER |
|
| 51 | + $headers = ''; |
|
| 52 | + if (isset($page['entetes']) and count($page['entetes'])) { |
|
| 53 | + foreach ($page['entetes'] as $k => $v) { |
|
| 54 | + $headers .= (strlen($v) ? "$k: $v" : $k) . "\n"; |
|
| 55 | + } |
|
| 56 | + } |
|
| 57 | 57 | |
| 58 | - include_spip('inc/notifications'); |
|
| 59 | - notifications_envoyer_mails($adresse_neuf, $page['texte'], '', '', $headers); |
|
| 60 | - ecrire_meta('dernier_envoi_neuf', date('Y-m-d H:i:s', $now)); |
|
| 61 | - } else { |
|
| 62 | - spip_log("mail nouveautes : rien de neuf depuis $jours_neuf jours"); |
|
| 63 | - } |
|
| 58 | + include_spip('inc/notifications'); |
|
| 59 | + notifications_envoyer_mails($adresse_neuf, $page['texte'], '', '', $headers); |
|
| 60 | + ecrire_meta('dernier_envoi_neuf', date('Y-m-d H:i:s', $now)); |
|
| 61 | + } else { |
|
| 62 | + spip_log("mail nouveautes : rien de neuf depuis $jours_neuf jours"); |
|
| 63 | + } |
|
| 64 | 64 | |
| 65 | - return 1; |
|
| 65 | + return 1; |
|
| 66 | 66 | } |
@@ -51,7 +51,7 @@ |
||
| 51 | 51 | $headers = ''; |
| 52 | 52 | if (isset($page['entetes']) and count($page['entetes'])) { |
| 53 | 53 | foreach ($page['entetes'] as $k => $v) { |
| 54 | - $headers .= (strlen($v) ? "$k: $v" : $k) . "\n"; |
|
| 54 | + $headers .= (strlen($v) ? "$k: $v" : $k)."\n"; |
|
| 55 | 55 | } |
| 56 | 56 | } |
| 57 | 57 | |
@@ -17,7 +17,7 @@ discard block |
||
| 17 | 17 | */ |
| 18 | 18 | |
| 19 | 19 | if (!defined('_ECRIRE_INC_VERSION')) { |
| 20 | - return; |
|
| 20 | + return; |
|
| 21 | 21 | } |
| 22 | 22 | |
| 23 | 23 | /** |
@@ -27,15 +27,15 @@ discard block |
||
| 27 | 27 | * @return int |
| 28 | 28 | */ |
| 29 | 29 | function genie_mise_a_jour_dist($t) { |
| 30 | - include_spip('inc/meta'); |
|
| 31 | - $maj = info_maj('spip', 'SPIP', $GLOBALS['spip_version_branche']); |
|
| 32 | - ecrire_meta('info_maj_spip', $maj ? ($GLOBALS['spip_version_branche'] . "|$maj") : '', 'non'); |
|
| 30 | + include_spip('inc/meta'); |
|
| 31 | + $maj = info_maj('spip', 'SPIP', $GLOBALS['spip_version_branche']); |
|
| 32 | + ecrire_meta('info_maj_spip', $maj ? ($GLOBALS['spip_version_branche'] . "|$maj") : '', 'non'); |
|
| 33 | 33 | |
| 34 | - mise_a_jour_ecran_securite(); |
|
| 34 | + mise_a_jour_ecran_securite(); |
|
| 35 | 35 | |
| 36 | - spip_log('Verification version SPIP : ' . ($maj ? $maj : 'version a jour'), 'verifie_maj'); |
|
| 36 | + spip_log('Verification version SPIP : ' . ($maj ? $maj : 'version a jour'), 'verifie_maj'); |
|
| 37 | 37 | |
| 38 | - return 1; |
|
| 38 | + return 1; |
|
| 39 | 39 | } |
| 40 | 40 | |
| 41 | 41 | // TODO : fournir une URL sur spip.net pour maitriser la diffusion d'une nouvelle version de l'ecran via l'update auto |
@@ -52,46 +52,46 @@ discard block |
||
| 52 | 52 | * ou de ne repondre une 304 que si le md5 est bon |
| 53 | 53 | */ |
| 54 | 54 | function mise_a_jour_ecran_securite() { |
| 55 | - // TODO : url https avec verification du certificat |
|
| 56 | - return; |
|
| 57 | - |
|
| 58 | - // si l'ecran n'est pas deja present ou pas updatable, sortir |
|
| 59 | - if ( |
|
| 60 | - !_URL_ECRAN_SECURITE |
|
| 61 | - or !file_exists($filename = _DIR_ETC . 'ecran_securite.php') |
|
| 62 | - or !is_writable($filename) |
|
| 63 | - or !$last_modified = filemtime($filename) |
|
| 64 | - or !$md5 = md5_file($filename) |
|
| 65 | - ) { |
|
| 66 | - return false; |
|
| 67 | - } |
|
| 68 | - |
|
| 69 | - include_spip('inc/distant'); |
|
| 70 | - $tmp_file = _DIR_TMP . 'ecran_securite.php'; |
|
| 71 | - $url = parametre_url(_URL_ECRAN_SECURITE, 'md5', $md5); |
|
| 72 | - $url = parametre_url($url, 'vspip', $GLOBALS['spip_version_branche']); |
|
| 73 | - $res = recuperer_url($url, [ |
|
| 74 | - 'if_modified_since' => $last_modified, |
|
| 75 | - 'file' => $tmp_file |
|
| 76 | - ]); |
|
| 77 | - |
|
| 78 | - // si il y a une version plus recente que l'on a recu correctement |
|
| 79 | - if ( |
|
| 80 | - $res['status'] == 200 |
|
| 81 | - and $res['length'] |
|
| 82 | - and $tmp_file = $res['file'] |
|
| 83 | - ) { |
|
| 84 | - if ($md5 !== md5_file($tmp_file)) { |
|
| 85 | - // on essaye de l'inclure pour verifier que ca ne fait pas erreur fatale |
|
| 86 | - include_once $tmp_file; |
|
| 87 | - // ok, on le copie a la place de l'ecran existant |
|
| 88 | - // en backupant l'ecran avant, au cas ou |
|
| 89 | - @copy($filename, $filename . '-bck-' . date('Y-m-d-His', $last_modified)); |
|
| 90 | - @rename($tmp_file, $filename); |
|
| 91 | - } else { |
|
| 92 | - @unlink($tmp_file); |
|
| 93 | - } |
|
| 94 | - } |
|
| 55 | + // TODO : url https avec verification du certificat |
|
| 56 | + return; |
|
| 57 | + |
|
| 58 | + // si l'ecran n'est pas deja present ou pas updatable, sortir |
|
| 59 | + if ( |
|
| 60 | + !_URL_ECRAN_SECURITE |
|
| 61 | + or !file_exists($filename = _DIR_ETC . 'ecran_securite.php') |
|
| 62 | + or !is_writable($filename) |
|
| 63 | + or !$last_modified = filemtime($filename) |
|
| 64 | + or !$md5 = md5_file($filename) |
|
| 65 | + ) { |
|
| 66 | + return false; |
|
| 67 | + } |
|
| 68 | + |
|
| 69 | + include_spip('inc/distant'); |
|
| 70 | + $tmp_file = _DIR_TMP . 'ecran_securite.php'; |
|
| 71 | + $url = parametre_url(_URL_ECRAN_SECURITE, 'md5', $md5); |
|
| 72 | + $url = parametre_url($url, 'vspip', $GLOBALS['spip_version_branche']); |
|
| 73 | + $res = recuperer_url($url, [ |
|
| 74 | + 'if_modified_since' => $last_modified, |
|
| 75 | + 'file' => $tmp_file |
|
| 76 | + ]); |
|
| 77 | + |
|
| 78 | + // si il y a une version plus recente que l'on a recu correctement |
|
| 79 | + if ( |
|
| 80 | + $res['status'] == 200 |
|
| 81 | + and $res['length'] |
|
| 82 | + and $tmp_file = $res['file'] |
|
| 83 | + ) { |
|
| 84 | + if ($md5 !== md5_file($tmp_file)) { |
|
| 85 | + // on essaye de l'inclure pour verifier que ca ne fait pas erreur fatale |
|
| 86 | + include_once $tmp_file; |
|
| 87 | + // ok, on le copie a la place de l'ecran existant |
|
| 88 | + // en backupant l'ecran avant, au cas ou |
|
| 89 | + @copy($filename, $filename . '-bck-' . date('Y-m-d-His', $last_modified)); |
|
| 90 | + @rename($tmp_file, $filename); |
|
| 91 | + } else { |
|
| 92 | + @unlink($tmp_file); |
|
| 93 | + } |
|
| 94 | + } |
|
| 95 | 95 | } |
| 96 | 96 | |
| 97 | 97 | /** |
@@ -109,54 +109,54 @@ discard block |
||
| 109 | 109 | * @return string |
| 110 | 110 | */ |
| 111 | 111 | function info_maj($dir, $file, $version) { |
| 112 | - include_spip('inc/plugin'); |
|
| 113 | - |
|
| 114 | - list($maj, $min, $rev) = preg_split('/\D+/', $version); |
|
| 115 | - |
|
| 116 | - $nom = _DIR_CACHE_XML . _VERSIONS_LISTE; |
|
| 117 | - $page = !file_exists($nom) ? '' : file_get_contents($nom); |
|
| 118 | - $page = info_maj_cache($nom, $dir, $page); |
|
| 119 | - |
|
| 120 | - // reperer toutes les versions de numero majeur superieur ou egal |
|
| 121 | - // (a revoir quand on arrivera a SPIP V10 ...) |
|
| 122 | - $p = substr('0123456789', intval($maj)); |
|
| 123 | - $p = ',/' . $file . '\D+([' . $p . ']+)\D+(\d+)(\D+(\d+))?.*?[.]zip",i'; |
|
| 124 | - preg_match_all($p, $page, $m, PREG_SET_ORDER); |
|
| 125 | - $page = $page_majeure = ''; |
|
| 126 | - |
|
| 127 | - // branche en cours d'utilisation |
|
| 128 | - $branche = implode('.', array_slice(explode('.', $version, 3), 0, 2)); |
|
| 129 | - |
|
| 130 | - foreach ($m as $v) { |
|
| 131 | - $v = array_pad($v, 5, 0); |
|
| 132 | - list(, $maj2, $min2, , $rev2) = $v; |
|
| 133 | - $branche_maj = $maj2 . '.' . $min2; |
|
| 134 | - $version_maj = $maj2 . '.' . $min2 . '.' . $rev2; |
|
| 135 | - // d'abord les mises à jour de la même branche |
|
| 136 | - if ( |
|
| 137 | - (spip_version_compare($version, $version_maj, '<')) |
|
| 138 | - and (spip_version_compare($page, $version_maj, '<')) |
|
| 139 | - and spip_version_compare($branche, $branche_maj, '=') |
|
| 140 | - ) { |
|
| 141 | - $page = $version_maj; |
|
| 142 | - } |
|
| 143 | - // puis les mises à jours majeures |
|
| 144 | - if ( |
|
| 145 | - (spip_version_compare($version, $version_maj, '<')) |
|
| 146 | - and (spip_version_compare($page, $version_maj, '<')) |
|
| 147 | - and spip_version_compare($branche, $branche_maj, '<') |
|
| 148 | - ) { |
|
| 149 | - $page_majeure = $version_maj; |
|
| 150 | - } |
|
| 151 | - } |
|
| 152 | - if (!$page and !$page_majeure) { |
|
| 153 | - return ''; |
|
| 154 | - } |
|
| 155 | - |
|
| 156 | - $message = $page ? _T('nouvelle_version_spip', ['version' => $page]) . ($page_majeure ? ' | ' : '') : ''; |
|
| 157 | - $message .= $page_majeure ? _T('nouvelle_version_spip_majeure', ['version' => $page_majeure]) : ''; |
|
| 158 | - |
|
| 159 | - return "<a class='info_maj_spip' href='https://www.spip.net/fr_update' title='$page'>" . $message . '</a>'; |
|
| 112 | + include_spip('inc/plugin'); |
|
| 113 | + |
|
| 114 | + list($maj, $min, $rev) = preg_split('/\D+/', $version); |
|
| 115 | + |
|
| 116 | + $nom = _DIR_CACHE_XML . _VERSIONS_LISTE; |
|
| 117 | + $page = !file_exists($nom) ? '' : file_get_contents($nom); |
|
| 118 | + $page = info_maj_cache($nom, $dir, $page); |
|
| 119 | + |
|
| 120 | + // reperer toutes les versions de numero majeur superieur ou egal |
|
| 121 | + // (a revoir quand on arrivera a SPIP V10 ...) |
|
| 122 | + $p = substr('0123456789', intval($maj)); |
|
| 123 | + $p = ',/' . $file . '\D+([' . $p . ']+)\D+(\d+)(\D+(\d+))?.*?[.]zip",i'; |
|
| 124 | + preg_match_all($p, $page, $m, PREG_SET_ORDER); |
|
| 125 | + $page = $page_majeure = ''; |
|
| 126 | + |
|
| 127 | + // branche en cours d'utilisation |
|
| 128 | + $branche = implode('.', array_slice(explode('.', $version, 3), 0, 2)); |
|
| 129 | + |
|
| 130 | + foreach ($m as $v) { |
|
| 131 | + $v = array_pad($v, 5, 0); |
|
| 132 | + list(, $maj2, $min2, , $rev2) = $v; |
|
| 133 | + $branche_maj = $maj2 . '.' . $min2; |
|
| 134 | + $version_maj = $maj2 . '.' . $min2 . '.' . $rev2; |
|
| 135 | + // d'abord les mises à jour de la même branche |
|
| 136 | + if ( |
|
| 137 | + (spip_version_compare($version, $version_maj, '<')) |
|
| 138 | + and (spip_version_compare($page, $version_maj, '<')) |
|
| 139 | + and spip_version_compare($branche, $branche_maj, '=') |
|
| 140 | + ) { |
|
| 141 | + $page = $version_maj; |
|
| 142 | + } |
|
| 143 | + // puis les mises à jours majeures |
|
| 144 | + if ( |
|
| 145 | + (spip_version_compare($version, $version_maj, '<')) |
|
| 146 | + and (spip_version_compare($page, $version_maj, '<')) |
|
| 147 | + and spip_version_compare($branche, $branche_maj, '<') |
|
| 148 | + ) { |
|
| 149 | + $page_majeure = $version_maj; |
|
| 150 | + } |
|
| 151 | + } |
|
| 152 | + if (!$page and !$page_majeure) { |
|
| 153 | + return ''; |
|
| 154 | + } |
|
| 155 | + |
|
| 156 | + $message = $page ? _T('nouvelle_version_spip', ['version' => $page]) . ($page_majeure ? ' | ' : '') : ''; |
|
| 157 | + $message .= $page_majeure ? _T('nouvelle_version_spip_majeure', ['version' => $page_majeure]) : ''; |
|
| 158 | + |
|
| 159 | + return "<a class='info_maj_spip' href='https://www.spip.net/fr_update' title='$page'>" . $message . '</a>'; |
|
| 160 | 160 | } |
| 161 | 161 | |
| 162 | 162 | /** |
@@ -177,25 +177,25 @@ discard block |
||
| 177 | 177 | * Contenu du fichier de cache de l'info de maj de SPIP. |
| 178 | 178 | */ |
| 179 | 179 | function info_maj_cache($nom, $dir, $page = '') { |
| 180 | - include_spip('inc/acces'); |
|
| 181 | - $alea_ephemere = charger_aleas(); |
|
| 182 | - $re = '<archives id="a' . $alea_ephemere . '">'; |
|
| 183 | - if (preg_match("/$re/", $page)) { |
|
| 184 | - return $page; |
|
| 185 | - } |
|
| 186 | - |
|
| 187 | - $url = _VERSIONS_SERVEUR . $dir . '/' . _VERSIONS_LISTE; |
|
| 188 | - $a = file_exists($nom) ? filemtime($nom) : ''; |
|
| 189 | - include_spip('inc/distant'); |
|
| 190 | - $res = recuperer_url_cache($url, ['if_modified_since' => $a]); |
|
| 191 | - // Si rien de neuf (ou inaccessible), garder l'ancienne |
|
| 192 | - if ($res) { |
|
| 193 | - $page = $res['page'] ? $res['page'] : $page; |
|
| 194 | - } |
|
| 195 | - // Placer l'indicateur de fraicheur |
|
| 196 | - $page = preg_replace('/^<archives.*?>/', $re, $page); |
|
| 197 | - sous_repertoire(_DIR_CACHE_XML); |
|
| 198 | - ecrire_fichier($nom, $page); |
|
| 199 | - |
|
| 200 | - return $page; |
|
| 180 | + include_spip('inc/acces'); |
|
| 181 | + $alea_ephemere = charger_aleas(); |
|
| 182 | + $re = '<archives id="a' . $alea_ephemere . '">'; |
|
| 183 | + if (preg_match("/$re/", $page)) { |
|
| 184 | + return $page; |
|
| 185 | + } |
|
| 186 | + |
|
| 187 | + $url = _VERSIONS_SERVEUR . $dir . '/' . _VERSIONS_LISTE; |
|
| 188 | + $a = file_exists($nom) ? filemtime($nom) : ''; |
|
| 189 | + include_spip('inc/distant'); |
|
| 190 | + $res = recuperer_url_cache($url, ['if_modified_since' => $a]); |
|
| 191 | + // Si rien de neuf (ou inaccessible), garder l'ancienne |
|
| 192 | + if ($res) { |
|
| 193 | + $page = $res['page'] ? $res['page'] : $page; |
|
| 194 | + } |
|
| 195 | + // Placer l'indicateur de fraicheur |
|
| 196 | + $page = preg_replace('/^<archives.*?>/', $re, $page); |
|
| 197 | + sous_repertoire(_DIR_CACHE_XML); |
|
| 198 | + ecrire_fichier($nom, $page); |
|
| 199 | + |
|
| 200 | + return $page; |
|
| 201 | 201 | } |
@@ -29,11 +29,11 @@ discard block |
||
| 29 | 29 | function genie_mise_a_jour_dist($t) { |
| 30 | 30 | include_spip('inc/meta'); |
| 31 | 31 | $maj = info_maj('spip', 'SPIP', $GLOBALS['spip_version_branche']); |
| 32 | - ecrire_meta('info_maj_spip', $maj ? ($GLOBALS['spip_version_branche'] . "|$maj") : '', 'non'); |
|
| 32 | + ecrire_meta('info_maj_spip', $maj ? ($GLOBALS['spip_version_branche']."|$maj") : '', 'non'); |
|
| 33 | 33 | |
| 34 | 34 | mise_a_jour_ecran_securite(); |
| 35 | 35 | |
| 36 | - spip_log('Verification version SPIP : ' . ($maj ? $maj : 'version a jour'), 'verifie_maj'); |
|
| 36 | + spip_log('Verification version SPIP : '.($maj ? $maj : 'version a jour'), 'verifie_maj'); |
|
| 37 | 37 | |
| 38 | 38 | return 1; |
| 39 | 39 | } |
@@ -58,7 +58,7 @@ discard block |
||
| 58 | 58 | // si l'ecran n'est pas deja present ou pas updatable, sortir |
| 59 | 59 | if ( |
| 60 | 60 | !_URL_ECRAN_SECURITE |
| 61 | - or !file_exists($filename = _DIR_ETC . 'ecran_securite.php') |
|
| 61 | + or !file_exists($filename = _DIR_ETC.'ecran_securite.php') |
|
| 62 | 62 | or !is_writable($filename) |
| 63 | 63 | or !$last_modified = filemtime($filename) |
| 64 | 64 | or !$md5 = md5_file($filename) |
@@ -67,7 +67,7 @@ discard block |
||
| 67 | 67 | } |
| 68 | 68 | |
| 69 | 69 | include_spip('inc/distant'); |
| 70 | - $tmp_file = _DIR_TMP . 'ecran_securite.php'; |
|
| 70 | + $tmp_file = _DIR_TMP.'ecran_securite.php'; |
|
| 71 | 71 | $url = parametre_url(_URL_ECRAN_SECURITE, 'md5', $md5); |
| 72 | 72 | $url = parametre_url($url, 'vspip', $GLOBALS['spip_version_branche']); |
| 73 | 73 | $res = recuperer_url($url, [ |
@@ -86,7 +86,7 @@ discard block |
||
| 86 | 86 | include_once $tmp_file; |
| 87 | 87 | // ok, on le copie a la place de l'ecran existant |
| 88 | 88 | // en backupant l'ecran avant, au cas ou |
| 89 | - @copy($filename, $filename . '-bck-' . date('Y-m-d-His', $last_modified)); |
|
| 89 | + @copy($filename, $filename.'-bck-'.date('Y-m-d-His', $last_modified)); |
|
| 90 | 90 | @rename($tmp_file, $filename); |
| 91 | 91 | } else { |
| 92 | 92 | @unlink($tmp_file); |
@@ -113,14 +113,14 @@ discard block |
||
| 113 | 113 | |
| 114 | 114 | list($maj, $min, $rev) = preg_split('/\D+/', $version); |
| 115 | 115 | |
| 116 | - $nom = _DIR_CACHE_XML . _VERSIONS_LISTE; |
|
| 116 | + $nom = _DIR_CACHE_XML._VERSIONS_LISTE; |
|
| 117 | 117 | $page = !file_exists($nom) ? '' : file_get_contents($nom); |
| 118 | 118 | $page = info_maj_cache($nom, $dir, $page); |
| 119 | 119 | |
| 120 | 120 | // reperer toutes les versions de numero majeur superieur ou egal |
| 121 | 121 | // (a revoir quand on arrivera a SPIP V10 ...) |
| 122 | 122 | $p = substr('0123456789', intval($maj)); |
| 123 | - $p = ',/' . $file . '\D+([' . $p . ']+)\D+(\d+)(\D+(\d+))?.*?[.]zip",i'; |
|
| 123 | + $p = ',/'.$file.'\D+(['.$p.']+)\D+(\d+)(\D+(\d+))?.*?[.]zip",i'; |
|
| 124 | 124 | preg_match_all($p, $page, $m, PREG_SET_ORDER); |
| 125 | 125 | $page = $page_majeure = ''; |
| 126 | 126 | |
@@ -129,9 +129,9 @@ discard block |
||
| 129 | 129 | |
| 130 | 130 | foreach ($m as $v) { |
| 131 | 131 | $v = array_pad($v, 5, 0); |
| 132 | - list(, $maj2, $min2, , $rev2) = $v; |
|
| 133 | - $branche_maj = $maj2 . '.' . $min2; |
|
| 134 | - $version_maj = $maj2 . '.' . $min2 . '.' . $rev2; |
|
| 132 | + list(, $maj2, $min2,, $rev2) = $v; |
|
| 133 | + $branche_maj = $maj2.'.'.$min2; |
|
| 134 | + $version_maj = $maj2.'.'.$min2.'.'.$rev2; |
|
| 135 | 135 | // d'abord les mises à jour de la même branche |
| 136 | 136 | if ( |
| 137 | 137 | (spip_version_compare($version, $version_maj, '<')) |
@@ -153,10 +153,10 @@ discard block |
||
| 153 | 153 | return ''; |
| 154 | 154 | } |
| 155 | 155 | |
| 156 | - $message = $page ? _T('nouvelle_version_spip', ['version' => $page]) . ($page_majeure ? ' | ' : '') : ''; |
|
| 156 | + $message = $page ? _T('nouvelle_version_spip', ['version' => $page]).($page_majeure ? ' | ' : '') : ''; |
|
| 157 | 157 | $message .= $page_majeure ? _T('nouvelle_version_spip_majeure', ['version' => $page_majeure]) : ''; |
| 158 | 158 | |
| 159 | - return "<a class='info_maj_spip' href='https://www.spip.net/fr_update' title='$page'>" . $message . '</a>'; |
|
| 159 | + return "<a class='info_maj_spip' href='https://www.spip.net/fr_update' title='$page'>".$message.'</a>'; |
|
| 160 | 160 | } |
| 161 | 161 | |
| 162 | 162 | /** |
@@ -179,12 +179,12 @@ discard block |
||
| 179 | 179 | function info_maj_cache($nom, $dir, $page = '') { |
| 180 | 180 | include_spip('inc/acces'); |
| 181 | 181 | $alea_ephemere = charger_aleas(); |
| 182 | - $re = '<archives id="a' . $alea_ephemere . '">'; |
|
| 182 | + $re = '<archives id="a'.$alea_ephemere.'">'; |
|
| 183 | 183 | if (preg_match("/$re/", $page)) { |
| 184 | 184 | return $page; |
| 185 | 185 | } |
| 186 | 186 | |
| 187 | - $url = _VERSIONS_SERVEUR . $dir . '/' . _VERSIONS_LISTE; |
|
| 187 | + $url = _VERSIONS_SERVEUR.$dir.'/'._VERSIONS_LISTE; |
|
| 188 | 188 | $a = file_exists($nom) ? filemtime($nom) : ''; |
| 189 | 189 | include_spip('inc/distant'); |
| 190 | 190 | $res = recuperer_url_cache($url, ['if_modified_since' => $a]); |