@@ -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'); |
@@ -74,9 +74,9 @@ discard block |
||
| 74 | 74 | $averti = _T( |
| 75 | 75 | 'htaccess_a_simuler', |
| 76 | 76 | array( |
| 77 | - 'htaccess' => '<tt>' . _ACCESS_FILE_NAME . '</tt>', |
|
| 77 | + 'htaccess' => '<tt>'._ACCESS_FILE_NAME.'</tt>', |
|
| 78 | 78 | 'constantes' => '<tt>_DIR_TMP & _DIR_CONNECT</tt>', |
| 79 | - 'document_root' => '<tt>' . $_SERVER['DOCUMENT_ROOT'] . '</tt>' |
|
| 79 | + 'document_root' => '<tt>'.$_SERVER['DOCUMENT_ROOT'].'</tt>' |
|
| 80 | 80 | ) |
| 81 | 81 | ); |
| 82 | 82 | |
@@ -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,64 +21,64 @@ 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 (verifier_htaccess(_DIR_TMP, true) |
|
| 67 | - and verifier_htaccess(_DIR_CONNECT, true) |
|
| 68 | - ) { |
|
| 69 | - return ''; |
|
| 70 | - } |
|
| 66 | + if (verifier_htaccess(_DIR_TMP, true) |
|
| 67 | + and verifier_htaccess(_DIR_CONNECT, true) |
|
| 68 | + ) { |
|
| 69 | + return ''; |
|
| 70 | + } |
|
| 71 | 71 | |
| 72 | - $titre = _T('htaccess_inoperant'); |
|
| 72 | + $titre = _T('htaccess_inoperant'); |
|
| 73 | 73 | |
| 74 | - $averti = _T( |
|
| 75 | - 'htaccess_a_simuler', |
|
| 76 | - array( |
|
| 77 | - 'htaccess' => '<tt>' . _ACCESS_FILE_NAME . '</tt>', |
|
| 78 | - 'constantes' => '<tt>_DIR_TMP & _DIR_CONNECT</tt>', |
|
| 79 | - 'document_root' => '<tt>' . $_SERVER['DOCUMENT_ROOT'] . '</tt>' |
|
| 80 | - ) |
|
| 81 | - ); |
|
| 74 | + $averti = _T( |
|
| 75 | + 'htaccess_a_simuler', |
|
| 76 | + array( |
|
| 77 | + 'htaccess' => '<tt>' . _ACCESS_FILE_NAME . '</tt>', |
|
| 78 | + 'constantes' => '<tt>_DIR_TMP & _DIR_CONNECT</tt>', |
|
| 79 | + 'document_root' => '<tt>' . $_SERVER['DOCUMENT_ROOT'] . '</tt>' |
|
| 80 | + ) |
|
| 81 | + ); |
|
| 82 | 82 | |
| 83 | - return "<div class='error'><h3>$titre</h3><p>$averti</p></div>"; |
|
| 83 | + return "<div class='error'><h3>$titre</h3><p>$averti</p></div>"; |
|
| 84 | 84 | } |
@@ -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,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 array( |
|
| 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 array( |
|
| 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 array($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 array($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 | } |
@@ -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 | - array('plugins_dist' => '<tt>' . joli_repertoire(_DIR_PLUGINS_DIST) . '</tt>') |
|
| 42 | + array('plugins_dist' => '<tt>'.joli_repertoire(_DIR_PLUGINS_DIST).'</tt>') |
|
| 43 | 43 | ) |
| 44 | 44 | . '</p>'; |
| 45 | 45 | |
@@ -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,55 +19,55 @@ 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 | - array('plugins_dist' => '<tt>' . joli_repertoire(_DIR_PLUGINS_DIST) . '</tt>') |
|
| 43 | - ) |
|
| 44 | - . '</p>'; |
|
| 39 | + echo '<p>' |
|
| 40 | + . _T( |
|
| 41 | + 'plugin_info_plugins_dist_1', |
|
| 42 | + array('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(self(), liste_plugin_files(_DIR_PLUGINS_DIST), array(), array(), _DIR_PLUGINS_DIST, |
|
| 50 | - 'afficher_nom_plugin'); |
|
| 46 | + // installer les extensions |
|
| 47 | + include_spip('inc/plugin'); |
|
| 48 | + $afficher = charger_fonction('afficher_liste', 'plugins'); |
|
| 49 | + echo $afficher(self(), liste_plugin_files(_DIR_PLUGINS_DIST), array(), array(), _DIR_PLUGINS_DIST, |
|
| 50 | + 'afficher_nom_plugin'); |
|
| 51 | 51 | |
| 52 | - // si la base de SPIP est up, on peut installer les plugins, sinon on passe cette etape |
|
| 53 | - // car les plugins supposent que la base de SPIP est dans son etat normal (mise a jour) |
|
| 54 | - // au premier passage dans l'espace prive on aura une demande d'upgrade qui se poursuit sur la page plugin |
|
| 55 | - // et procede alors a l'installation |
|
| 56 | - if (!isset($GLOBALS['meta']['version_installee']) |
|
| 57 | - or ($GLOBALS['spip_version_base'] == (str_replace(',', '.', $GLOBALS['meta']['version_installee']))) |
|
| 58 | - ) { |
|
| 59 | - plugin_installes_meta(); |
|
| 60 | - } |
|
| 52 | + // si la base de SPIP est up, on peut installer les plugins, sinon on passe cette etape |
|
| 53 | + // car les plugins supposent que la base de SPIP est dans son etat normal (mise a jour) |
|
| 54 | + // au premier passage dans l'espace prive on aura une demande d'upgrade qui se poursuit sur la page plugin |
|
| 55 | + // et procede alors a l'installation |
|
| 56 | + if (!isset($GLOBALS['meta']['version_installee']) |
|
| 57 | + or ($GLOBALS['spip_version_base'] == (str_replace(',', '.', $GLOBALS['meta']['version_installee']))) |
|
| 58 | + ) { |
|
| 59 | + plugin_installes_meta(); |
|
| 60 | + } |
|
| 61 | 61 | |
| 62 | - // mettre a jour si necessaire l'adresse du site |
|
| 63 | - // securite si on arrive plus a se loger |
|
| 64 | - include_spip('inc/config'); |
|
| 65 | - appliquer_adresse_site(''); |
|
| 62 | + // mettre a jour si necessaire l'adresse du site |
|
| 63 | + // securite si on arrive plus a se loger |
|
| 64 | + include_spip('inc/config'); |
|
| 65 | + appliquer_adresse_site(''); |
|
| 66 | 66 | |
| 67 | - // aller a la derniere etape qui clos l'install et redirige |
|
| 68 | - $suite = "\n<input type='hidden' name='etape' value='fin' />" |
|
| 69 | - . bouton_suivant(_T('login_espace_prive')); |
|
| 67 | + // aller a la derniere etape qui clos l'install et redirige |
|
| 68 | + $suite = "\n<input type='hidden' name='etape' value='fin' />" |
|
| 69 | + . bouton_suivant(_T('login_espace_prive')); |
|
| 70 | 70 | |
| 71 | - echo generer_form_ecrire('install', $suite); |
|
| 72 | - echo install_fin_html(); |
|
| 71 | + echo generer_form_ecrire('install', $suite); |
|
| 72 | + echo install_fin_html(); |
|
| 73 | 73 | } |
@@ -66,7 +66,7 @@ discard block |
||
| 66 | 66 | echo info_etape( |
| 67 | 67 | _T('titre_connexion_ldap'), |
| 68 | 68 | info_progression_etape(2, 'etape_ldap', 'install/') |
| 69 | - ), _T('info_connexion_ldap_ok'); |
|
| 69 | + ), _T('info_connexion_ldap_ok'); |
|
| 70 | 70 | echo generer_form_ecrire('install', ( |
| 71 | 71 | "\n<input type='hidden' name='etape' value='ldap3' />" |
| 72 | 72 | . "\n<input type='hidden' name='adresse_ldap' value=\"$adresse_ldap\" />" |
@@ -78,10 +78,10 @@ discard block |
||
| 78 | 78 | . bouton_suivant())); |
| 79 | 79 | } else { |
| 80 | 80 | echo info_etape(_T('titre_connexion_ldap')), info_progression_etape(1, 'etape_ldap', 'install/', true), |
| 81 | - "<div class='error'><p>" . _T('avis_connexion_ldap_echec_1') . '</p>', |
|
| 82 | - '<p>' . _T('avis_connexion_ldap_echec_2') . |
|
| 83 | - "<br />\n" . _T('avis_connexion_ldap_echec_3') . |
|
| 84 | - '<br /><br />' . $erreur . '<b> ?</b></p></div>'; |
|
| 81 | + "<div class='error'><p>"._T('avis_connexion_ldap_echec_1').'</p>', |
|
| 82 | + '<p>'._T('avis_connexion_ldap_echec_2'). |
|
| 83 | + "<br />\n"._T('avis_connexion_ldap_echec_3'). |
|
| 84 | + '<br /><br />'.$erreur.'<b> ?</b></p></div>'; |
|
| 85 | 85 | } |
| 86 | 86 | |
| 87 | 87 | echo install_fin_html(); |
@@ -12,77 +12,77 @@ |
||
| 12 | 12 | |
| 13 | 13 | |
| 14 | 14 | if (!defined('_ECRIRE_INC_VERSION')) { |
| 15 | - return; |
|
| 15 | + return; |
|
| 16 | 16 | } |
| 17 | 17 | |
| 18 | 18 | // https://code.spip.net/@install_etape_ldap2_dist |
| 19 | 19 | function install_etape_ldap2_dist() { |
| 20 | - echo install_debut_html('AUTO', ' onload="document.getElementById(\'suivant\').focus();return false;"'); |
|
| 21 | - |
|
| 22 | - $adresse_ldap = _request('adresse_ldap'); |
|
| 23 | - |
|
| 24 | - $port_ldap = _request('port_ldap'); |
|
| 25 | - |
|
| 26 | - $tls_ldap = _request('tls_ldap'); |
|
| 27 | - |
|
| 28 | - $protocole_ldap = _request('protocole_ldap'); |
|
| 29 | - |
|
| 30 | - $login_ldap = _request('login_ldap'); |
|
| 31 | - |
|
| 32 | - $pass_ldap = _request('pass_ldap'); |
|
| 33 | - |
|
| 34 | - $port_ldap = intval($port_ldap); |
|
| 35 | - |
|
| 36 | - $tls = false; |
|
| 37 | - |
|
| 38 | - if ($tls_ldap == 'oui') { |
|
| 39 | - if ($port_ldap == 636) { |
|
| 40 | - $adresse_ldap = "ldaps://$adresse_ldap"; |
|
| 41 | - } else { |
|
| 42 | - $tls = true; |
|
| 43 | - } |
|
| 44 | - } |
|
| 45 | - $ldap_link = ldap_connect($adresse_ldap, $port_ldap); |
|
| 46 | - $erreur = "ldap_connect($adresse_ldap, $port_ldap)"; |
|
| 47 | - |
|
| 48 | - if ($ldap_link) { |
|
| 49 | - if (!ldap_set_option($ldap_link, LDAP_OPT_PROTOCOL_VERSION, $protocole_ldap)) { |
|
| 50 | - $protocole_ldap = 2; |
|
| 51 | - ldap_set_option($ldap_link, LDAP_OPT_PROTOCOL_VERSION, $protocole_ldap); |
|
| 52 | - } |
|
| 53 | - if ($tls === true) { |
|
| 54 | - if (!ldap_start_tls($ldap_link)) { |
|
| 55 | - $erreur = "ldap_start_tls($ldap_link) $adresse_ldap, $port_ldap"; |
|
| 56 | - $ldap_link = false; |
|
| 57 | - } |
|
| 58 | - } |
|
| 59 | - if ($ldap_link) { |
|
| 60 | - $ldap_link = ldap_bind($ldap_link, $login_ldap, $pass_ldap); |
|
| 61 | - $erreur = "ldap_bind('$ldap_link', '$login_ldap', '$pass_ldap'): $adresse_ldap, $port_ldap"; |
|
| 62 | - } |
|
| 63 | - } |
|
| 64 | - |
|
| 65 | - if ($ldap_link) { |
|
| 66 | - echo info_etape( |
|
| 67 | - _T('titre_connexion_ldap'), |
|
| 68 | - info_progression_etape(2, 'etape_ldap', 'install/') |
|
| 69 | - ), _T('info_connexion_ldap_ok'); |
|
| 70 | - echo generer_form_ecrire('install', ( |
|
| 71 | - "\n<input type='hidden' name='etape' value='ldap3' />" |
|
| 72 | - . "\n<input type='hidden' name='adresse_ldap' value=\"$adresse_ldap\" />" |
|
| 73 | - . "\n<input type='hidden' name='port_ldap' value=\"$port_ldap\" />" |
|
| 74 | - . "\n<input type='hidden' name='login_ldap' value=\"$login_ldap\" />" |
|
| 75 | - . "\n<input type='hidden' name='pass_ldap' value=\"$pass_ldap\" />" |
|
| 76 | - . "\n<input type='hidden' name='protocole_ldap' value=\"$protocole_ldap\" />" |
|
| 77 | - . "\n<input type='hidden' name='tls_ldap' value=\"$tls_ldap\" />" |
|
| 78 | - . bouton_suivant())); |
|
| 79 | - } else { |
|
| 80 | - echo info_etape(_T('titre_connexion_ldap')), info_progression_etape(1, 'etape_ldap', 'install/', true), |
|
| 81 | - "<div class='error'><p>" . _T('avis_connexion_ldap_echec_1') . '</p>', |
|
| 82 | - '<p>' . _T('avis_connexion_ldap_echec_2') . |
|
| 83 | - "<br />\n" . _T('avis_connexion_ldap_echec_3') . |
|
| 84 | - '<br /><br />' . $erreur . '<b> ?</b></p></div>'; |
|
| 85 | - } |
|
| 86 | - |
|
| 87 | - echo install_fin_html(); |
|
| 20 | + echo install_debut_html('AUTO', ' onload="document.getElementById(\'suivant\').focus();return false;"'); |
|
| 21 | + |
|
| 22 | + $adresse_ldap = _request('adresse_ldap'); |
|
| 23 | + |
|
| 24 | + $port_ldap = _request('port_ldap'); |
|
| 25 | + |
|
| 26 | + $tls_ldap = _request('tls_ldap'); |
|
| 27 | + |
|
| 28 | + $protocole_ldap = _request('protocole_ldap'); |
|
| 29 | + |
|
| 30 | + $login_ldap = _request('login_ldap'); |
|
| 31 | + |
|
| 32 | + $pass_ldap = _request('pass_ldap'); |
|
| 33 | + |
|
| 34 | + $port_ldap = intval($port_ldap); |
|
| 35 | + |
|
| 36 | + $tls = false; |
|
| 37 | + |
|
| 38 | + if ($tls_ldap == 'oui') { |
|
| 39 | + if ($port_ldap == 636) { |
|
| 40 | + $adresse_ldap = "ldaps://$adresse_ldap"; |
|
| 41 | + } else { |
|
| 42 | + $tls = true; |
|
| 43 | + } |
|
| 44 | + } |
|
| 45 | + $ldap_link = ldap_connect($adresse_ldap, $port_ldap); |
|
| 46 | + $erreur = "ldap_connect($adresse_ldap, $port_ldap)"; |
|
| 47 | + |
|
| 48 | + if ($ldap_link) { |
|
| 49 | + if (!ldap_set_option($ldap_link, LDAP_OPT_PROTOCOL_VERSION, $protocole_ldap)) { |
|
| 50 | + $protocole_ldap = 2; |
|
| 51 | + ldap_set_option($ldap_link, LDAP_OPT_PROTOCOL_VERSION, $protocole_ldap); |
|
| 52 | + } |
|
| 53 | + if ($tls === true) { |
|
| 54 | + if (!ldap_start_tls($ldap_link)) { |
|
| 55 | + $erreur = "ldap_start_tls($ldap_link) $adresse_ldap, $port_ldap"; |
|
| 56 | + $ldap_link = false; |
|
| 57 | + } |
|
| 58 | + } |
|
| 59 | + if ($ldap_link) { |
|
| 60 | + $ldap_link = ldap_bind($ldap_link, $login_ldap, $pass_ldap); |
|
| 61 | + $erreur = "ldap_bind('$ldap_link', '$login_ldap', '$pass_ldap'): $adresse_ldap, $port_ldap"; |
|
| 62 | + } |
|
| 63 | + } |
|
| 64 | + |
|
| 65 | + if ($ldap_link) { |
|
| 66 | + echo info_etape( |
|
| 67 | + _T('titre_connexion_ldap'), |
|
| 68 | + info_progression_etape(2, 'etape_ldap', 'install/') |
|
| 69 | + ), _T('info_connexion_ldap_ok'); |
|
| 70 | + echo generer_form_ecrire('install', ( |
|
| 71 | + "\n<input type='hidden' name='etape' value='ldap3' />" |
|
| 72 | + . "\n<input type='hidden' name='adresse_ldap' value=\"$adresse_ldap\" />" |
|
| 73 | + . "\n<input type='hidden' name='port_ldap' value=\"$port_ldap\" />" |
|
| 74 | + . "\n<input type='hidden' name='login_ldap' value=\"$login_ldap\" />" |
|
| 75 | + . "\n<input type='hidden' name='pass_ldap' value=\"$pass_ldap\" />" |
|
| 76 | + . "\n<input type='hidden' name='protocole_ldap' value=\"$protocole_ldap\" />" |
|
| 77 | + . "\n<input type='hidden' name='tls_ldap' value=\"$tls_ldap\" />" |
|
| 78 | + . bouton_suivant())); |
|
| 79 | + } else { |
|
| 80 | + echo info_etape(_T('titre_connexion_ldap')), info_progression_etape(1, 'etape_ldap', 'install/', true), |
|
| 81 | + "<div class='error'><p>" . _T('avis_connexion_ldap_echec_1') . '</p>', |
|
| 82 | + '<p>' . _T('avis_connexion_ldap_echec_2') . |
|
| 83 | + "<br />\n" . _T('avis_connexion_ldap_echec_3') . |
|
| 84 | + '<br /><br />' . $erreur . '<b> ?</b></p></div>'; |
|
| 85 | + } |
|
| 86 | + |
|
| 87 | + echo install_fin_html(); |
|
| 88 | 88 | } |
@@ -45,7 +45,7 @@ discard block |
||
| 45 | 45 | $checked = false; |
| 46 | 46 | $res = ''; |
| 47 | 47 | if (is_array($info) and $info['count'] > 0) { |
| 48 | - $res .= '<p>' . _T('info_selection_chemin_acces') . '</p>'; |
|
| 48 | + $res .= '<p>'._T('info_selection_chemin_acces').'</p>'; |
|
| 49 | 49 | $res .= '<ul>'; |
| 50 | 50 | $n = 0; |
| 51 | 51 | for ($i = 0; $i < $info['count']; $i++) { |
@@ -53,18 +53,18 @@ discard block |
||
| 53 | 53 | if (is_array($names)) { |
| 54 | 54 | for ($j = 0; $j < $names['count']; $j++) { |
| 55 | 55 | $n++; |
| 56 | - $res .= '<li><input name="base_ldap" value="' . spip_htmlspecialchars($names[$j]) . "\" type='radio' id='tab$n'"; |
|
| 56 | + $res .= '<li><input name="base_ldap" value="'.spip_htmlspecialchars($names[$j])."\" type='radio' id='tab$n'"; |
|
| 57 | 57 | if (!$checked) { |
| 58 | 58 | $res .= ' checked="checked"'; |
| 59 | 59 | $checked = true; |
| 60 | 60 | } |
| 61 | 61 | $res .= ' />'; |
| 62 | - $res .= "<label for='tab$n'>" . spip_htmlspecialchars($names[$j]) . "</label></li>\n"; |
|
| 62 | + $res .= "<label for='tab$n'>".spip_htmlspecialchars($names[$j])."</label></li>\n"; |
|
| 63 | 63 | } |
| 64 | 64 | } |
| 65 | 65 | } |
| 66 | 66 | $res .= '</ul>'; |
| 67 | - $res .= _T('info_ou') . ' '; |
|
| 67 | + $res .= _T('info_ou').' '; |
|
| 68 | 68 | } |
| 69 | 69 | $res .= "<br />\n<input name=\"base_ldap\" value=\"\" type='radio' id='manuel'"; |
| 70 | 70 | if (!$checked) { |
@@ -73,7 +73,7 @@ discard block |
||
| 73 | 73 | } |
| 74 | 74 | |
| 75 | 75 | $res .= ' />' |
| 76 | - . "\n<label for='manuel'>" . _T('entree_chemin_acces') . '</label> ' |
|
| 76 | + . "\n<label for='manuel'>"._T('entree_chemin_acces').'</label> ' |
|
| 77 | 77 | . "\n<fieldset>" |
| 78 | 78 | . "<input type='text' name='base_ldap_text' class='text' value=\"$base_ldap_text\" size='40' />" |
| 79 | 79 | . "\n</fieldset>" |
@@ -12,76 +12,76 @@ |
||
| 12 | 12 | |
| 13 | 13 | |
| 14 | 14 | if (!defined('_ECRIRE_INC_VERSION')) { |
| 15 | - return; |
|
| 15 | + return; |
|
| 16 | 16 | } |
| 17 | 17 | |
| 18 | 18 | // https://code.spip.net/@install_etape_ldap3_dist |
| 19 | 19 | function install_etape_ldap3_dist() { |
| 20 | - $adresse_ldap = _request('adresse_ldap'); |
|
| 21 | - $login_ldap = _request('login_ldap'); |
|
| 22 | - $pass_ldap = _request('pass_ldap'); |
|
| 23 | - $port_ldap = _request('port_ldap'); |
|
| 20 | + $adresse_ldap = _request('adresse_ldap'); |
|
| 21 | + $login_ldap = _request('login_ldap'); |
|
| 22 | + $pass_ldap = _request('pass_ldap'); |
|
| 23 | + $port_ldap = _request('port_ldap'); |
|
| 24 | 24 | |
| 25 | - $base_ldap_text = defined('_INSTALL_BASE_LDAP') |
|
| 26 | - ? _INSTALL_BASE_LDAP |
|
| 27 | - : 'ou=users, dc=mon-domaine, dc=com'; |
|
| 25 | + $base_ldap_text = defined('_INSTALL_BASE_LDAP') |
|
| 26 | + ? _INSTALL_BASE_LDAP |
|
| 27 | + : 'ou=users, dc=mon-domaine, dc=com'; |
|
| 28 | 28 | |
| 29 | - echo install_debut_html('AUTO', ' onload="document.getElementById(\'suivant\').focus();return false;"'); |
|
| 29 | + echo install_debut_html('AUTO', ' onload="document.getElementById(\'suivant\').focus();return false;"'); |
|
| 30 | 30 | |
| 31 | - echo info_etape( |
|
| 32 | - _T('info_chemin_acces_1'), |
|
| 33 | - info_progression_etape(3, 'etape_ldap', 'install/') |
|
| 34 | - ), |
|
| 35 | - _T('info_chemin_acces_2'); |
|
| 31 | + echo info_etape( |
|
| 32 | + _T('info_chemin_acces_1'), |
|
| 33 | + info_progression_etape(3, 'etape_ldap', 'install/') |
|
| 34 | + ), |
|
| 35 | + _T('info_chemin_acces_2'); |
|
| 36 | 36 | |
| 37 | - $ldap_link = @ldap_connect("$adresse_ldap", "$port_ldap"); |
|
| 38 | - if ($ldap_link) { |
|
| 39 | - @ldap_bind($ldap_link, "$login_ldap", "$pass_ldap"); |
|
| 40 | - $result = @ldap_read($ldap_link, '', 'objectclass=*', array('namingContexts')); |
|
| 41 | - $info = @ldap_get_entries($ldap_link, $result); |
|
| 42 | - @ldap_close($ldap_link); |
|
| 43 | - } |
|
| 37 | + $ldap_link = @ldap_connect("$adresse_ldap", "$port_ldap"); |
|
| 38 | + if ($ldap_link) { |
|
| 39 | + @ldap_bind($ldap_link, "$login_ldap", "$pass_ldap"); |
|
| 40 | + $result = @ldap_read($ldap_link, '', 'objectclass=*', array('namingContexts')); |
|
| 41 | + $info = @ldap_get_entries($ldap_link, $result); |
|
| 42 | + @ldap_close($ldap_link); |
|
| 43 | + } |
|
| 44 | 44 | |
| 45 | - $checked = false; |
|
| 46 | - $res = ''; |
|
| 47 | - if (is_array($info) and $info['count'] > 0) { |
|
| 48 | - $res .= '<p>' . _T('info_selection_chemin_acces') . '</p>'; |
|
| 49 | - $res .= '<ul>'; |
|
| 50 | - $n = 0; |
|
| 51 | - for ($i = 0; $i < $info['count']; $i++) { |
|
| 52 | - $names = $info[$i]['namingcontexts']; |
|
| 53 | - if (is_array($names)) { |
|
| 54 | - for ($j = 0; $j < $names['count']; $j++) { |
|
| 55 | - $n++; |
|
| 56 | - $res .= '<li><input name="base_ldap" value="' . spip_htmlspecialchars($names[$j]) . "\" type='radio' id='tab$n'"; |
|
| 57 | - if (!$checked) { |
|
| 58 | - $res .= ' checked="checked"'; |
|
| 59 | - $checked = true; |
|
| 60 | - } |
|
| 61 | - $res .= ' />'; |
|
| 62 | - $res .= "<label for='tab$n'>" . spip_htmlspecialchars($names[$j]) . "</label></li>\n"; |
|
| 63 | - } |
|
| 64 | - } |
|
| 65 | - } |
|
| 66 | - $res .= '</ul>'; |
|
| 67 | - $res .= _T('info_ou') . ' '; |
|
| 68 | - } |
|
| 69 | - $res .= "<br />\n<input name=\"base_ldap\" value=\"\" type='radio' id='manuel'"; |
|
| 70 | - if (!$checked) { |
|
| 71 | - $res .= ' checked="checked"'; |
|
| 72 | - $checked = true; |
|
| 73 | - } |
|
| 45 | + $checked = false; |
|
| 46 | + $res = ''; |
|
| 47 | + if (is_array($info) and $info['count'] > 0) { |
|
| 48 | + $res .= '<p>' . _T('info_selection_chemin_acces') . '</p>'; |
|
| 49 | + $res .= '<ul>'; |
|
| 50 | + $n = 0; |
|
| 51 | + for ($i = 0; $i < $info['count']; $i++) { |
|
| 52 | + $names = $info[$i]['namingcontexts']; |
|
| 53 | + if (is_array($names)) { |
|
| 54 | + for ($j = 0; $j < $names['count']; $j++) { |
|
| 55 | + $n++; |
|
| 56 | + $res .= '<li><input name="base_ldap" value="' . spip_htmlspecialchars($names[$j]) . "\" type='radio' id='tab$n'"; |
|
| 57 | + if (!$checked) { |
|
| 58 | + $res .= ' checked="checked"'; |
|
| 59 | + $checked = true; |
|
| 60 | + } |
|
| 61 | + $res .= ' />'; |
|
| 62 | + $res .= "<label for='tab$n'>" . spip_htmlspecialchars($names[$j]) . "</label></li>\n"; |
|
| 63 | + } |
|
| 64 | + } |
|
| 65 | + } |
|
| 66 | + $res .= '</ul>'; |
|
| 67 | + $res .= _T('info_ou') . ' '; |
|
| 68 | + } |
|
| 69 | + $res .= "<br />\n<input name=\"base_ldap\" value=\"\" type='radio' id='manuel'"; |
|
| 70 | + if (!$checked) { |
|
| 71 | + $res .= ' checked="checked"'; |
|
| 72 | + $checked = true; |
|
| 73 | + } |
|
| 74 | 74 | |
| 75 | - $res .= ' />' |
|
| 76 | - . "\n<label for='manuel'>" . _T('entree_chemin_acces') . '</label> ' |
|
| 77 | - . "\n<fieldset>" |
|
| 78 | - . "<input type='text' name='base_ldap_text' class='text' value=\"$base_ldap_text\" size='40' />" |
|
| 79 | - . "\n</fieldset>" |
|
| 80 | - . "\n<input type='hidden' name='etape' value='ldap4' />" |
|
| 81 | - . install_propager(array('adresse_ldap', 'port_ldap', 'login_ldap', 'pass_ldap', 'protocole_ldap', 'tls_ldap')) |
|
| 82 | - . bouton_suivant(); |
|
| 75 | + $res .= ' />' |
|
| 76 | + . "\n<label for='manuel'>" . _T('entree_chemin_acces') . '</label> ' |
|
| 77 | + . "\n<fieldset>" |
|
| 78 | + . "<input type='text' name='base_ldap_text' class='text' value=\"$base_ldap_text\" size='40' />" |
|
| 79 | + . "\n</fieldset>" |
|
| 80 | + . "\n<input type='hidden' name='etape' value='ldap4' />" |
|
| 81 | + . install_propager(array('adresse_ldap', 'port_ldap', 'login_ldap', 'pass_ldap', 'protocole_ldap', 'tls_ldap')) |
|
| 82 | + . bouton_suivant(); |
|
| 83 | 83 | |
| 84 | - echo generer_form_ecrire('install', $res); |
|
| 84 | + echo generer_form_ecrire('install', $res); |
|
| 85 | 85 | |
| 86 | - echo install_fin_html(); |
|
| 86 | + echo install_fin_html(); |
|
| 87 | 87 | } |
@@ -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'] : array(); |
| 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 | |
@@ -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'] : array(); |
|
| 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'] : array(); |
|
| 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 | } |
@@ -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 | /** |
@@ -27,18 +27,18 @@ discard block |
||
| 27 | 27 | * @uses info_copyright() |
| 28 | 28 | **/ |
| 29 | 29 | function install_etape__dist() { |
| 30 | - utiliser_langue_visiteur(); |
|
| 31 | - $menu_langues = menu_langues('var_lang_ecrire'); |
|
| 32 | - if (!$menu_langues) { |
|
| 33 | - redirige_url_ecrire('install', 'etape=chmod'); |
|
| 34 | - } else { |
|
| 35 | - include_spip('inc/presentation'); // pour info_copyright |
|
| 30 | + utiliser_langue_visiteur(); |
|
| 31 | + $menu_langues = menu_langues('var_lang_ecrire'); |
|
| 32 | + if (!$menu_langues) { |
|
| 33 | + redirige_url_ecrire('install', 'etape=chmod'); |
|
| 34 | + } else { |
|
| 35 | + include_spip('inc/presentation'); // pour info_copyright |
|
| 36 | 36 | |
| 37 | - $res = "<div class='petit-centre'><img alt='SPIP' class='logo' src='" . chemin_image('logo-spip.png') . "' />\n" . |
|
| 38 | - "<p class='small'>" . info_copyright() . "</p></div>\n" . |
|
| 39 | - '<p>' . _T('install_select_langue') . '</p>' . |
|
| 40 | - '<div>' . $menu_langues . "</div>\n" . |
|
| 41 | - generer_form_ecrire('install', "<input type='hidden' name='etape' value='chmod' />" . bouton_suivant()); |
|
| 42 | - echo minipres('AUTO', $res); |
|
| 43 | - } |
|
| 37 | + $res = "<div class='petit-centre'><img alt='SPIP' class='logo' src='" . chemin_image('logo-spip.png') . "' />\n" . |
|
| 38 | + "<p class='small'>" . info_copyright() . "</p></div>\n" . |
|
| 39 | + '<p>' . _T('install_select_langue') . '</p>' . |
|
| 40 | + '<div>' . $menu_langues . "</div>\n" . |
|
| 41 | + generer_form_ecrire('install', "<input type='hidden' name='etape' value='chmod' />" . bouton_suivant()); |
|
| 42 | + echo minipres('AUTO', $res); |
|
| 43 | + } |
|
| 44 | 44 | } |
@@ -34,11 +34,11 @@ |
||
| 34 | 34 | } else { |
| 35 | 35 | include_spip('inc/presentation'); // pour info_copyright |
| 36 | 36 | |
| 37 | - $res = "<div class='petit-centre'><img alt='SPIP' class='logo' src='" . chemin_image('logo-spip.png') . "' />\n" . |
|
| 38 | - "<p class='small'>" . info_copyright() . "</p></div>\n" . |
|
| 39 | - '<p>' . _T('install_select_langue') . '</p>' . |
|
| 40 | - '<div>' . $menu_langues . "</div>\n" . |
|
| 41 | - generer_form_ecrire('install', "<input type='hidden' name='etape' value='chmod' />" . bouton_suivant()); |
|
| 37 | + $res = "<div class='petit-centre'><img alt='SPIP' class='logo' src='".chemin_image('logo-spip.png')."' />\n". |
|
| 38 | + "<p class='small'>".info_copyright()."</p></div>\n". |
|
| 39 | + '<p>'._T('install_select_langue').'</p>'. |
|
| 40 | + '<div>'.$menu_langues."</div>\n". |
|
| 41 | + generer_form_ecrire('install', "<input type='hidden' name='etape' value='chmod' />".bouton_suivant()); |
|
| 42 | 42 | echo minipres('AUTO', $res); |
| 43 | 43 | } |
| 44 | 44 | } |
@@ -22,192 +22,192 @@ |
||
| 22 | 22 | |
| 23 | 23 | if (isset($GLOBALS['_INC_PUBLIC']) and $GLOBALS['_INC_PUBLIC']) { |
| 24 | 24 | |
| 25 | - echo recuperer_fond($fond, $contexte_inclus, array(), _request('connect')); |
|
| 25 | + echo recuperer_fond($fond, $contexte_inclus, array(), _request('connect')); |
|
| 26 | 26 | |
| 27 | 27 | } else { |
| 28 | 28 | |
| 29 | - $GLOBALS['_INC_PUBLIC'] = 1; |
|
| 30 | - define('_PIPELINE_SUFFIX', test_espace_prive() ? '_prive' : ''); |
|
| 31 | - |
|
| 32 | - // Faut-il initialiser SPIP ? (oui dans le cas general) |
|
| 33 | - if (!defined('_DIR_RESTREINT_ABS')) { |
|
| 34 | - if (defined('_DIR_RESTREINT') |
|
| 35 | - and @file_exists(_ROOT_RESTREINT . 'inc_version.php') |
|
| 36 | - ) { |
|
| 37 | - include_once _ROOT_RESTREINT . 'inc_version.php'; |
|
| 38 | - } else { |
|
| 39 | - die('inc_version absent ?'); |
|
| 40 | - } |
|
| 41 | - } // $fond defini dans le fichier d'appel ? |
|
| 42 | - |
|
| 43 | - else { |
|
| 44 | - if (isset($fond) and !_request('fond')) { |
|
| 45 | - } // fond demande dans l'url par page=xxxx ? |
|
| 46 | - else { |
|
| 47 | - if (isset($_GET[_SPIP_PAGE])) { |
|
| 48 | - $fond = (string)$_GET[_SPIP_PAGE]; |
|
| 49 | - |
|
| 50 | - // Securite |
|
| 51 | - if (strstr($fond, '/') |
|
| 52 | - and !( |
|
| 53 | - isset($GLOBALS['visiteur_session']) // pour eviter d'evaluer la suite pour les anonymes |
|
| 54 | - and include_spip('inc/autoriser') |
|
| 55 | - and autoriser('webmestre')) |
|
| 56 | - ) { |
|
| 57 | - include_spip('inc/minipres'); |
|
| 58 | - echo minipres(); |
|
| 59 | - exit; |
|
| 60 | - } |
|
| 61 | - // l'argument Page a priorite sur l'argument action |
|
| 62 | - // le cas se presente a cause des RewriteRule d'Apache |
|
| 63 | - // qui permettent d'ajouter un argument dans la QueryString |
|
| 64 | - // mais pas d'en retirer un en conservant les autres. |
|
| 65 | - if (isset($_GET['action']) and $_GET['action'] === $fond) { |
|
| 66 | - unset($_GET['action']); |
|
| 67 | - } |
|
| 68 | - # sinon, fond par defaut |
|
| 69 | - } else { |
|
| 70 | - // sinon fond par defaut (cf. assembler.php) |
|
| 71 | - $fond = pipeline('detecter_fond_par_defaut', ''); |
|
| 72 | - } |
|
| 73 | - } |
|
| 74 | - } |
|
| 75 | - |
|
| 76 | - $tableau_des_temps = array(); |
|
| 77 | - |
|
| 78 | - // Particularites de certains squelettes |
|
| 79 | - if ($fond == 'login') { |
|
| 80 | - $forcer_lang = true; |
|
| 81 | - } |
|
| 82 | - |
|
| 83 | - if (isset($forcer_lang) and $forcer_lang and ($forcer_lang !== 'non') |
|
| 84 | - and !_request('action') |
|
| 85 | - and $_SERVER['REQUEST_METHOD'] != 'POST' |
|
| 86 | - ) { |
|
| 87 | - include_spip('inc/lang'); |
|
| 88 | - verifier_lang_url(); |
|
| 89 | - } |
|
| 90 | - |
|
| 91 | - $lang = !isset($_GET['lang']) ? '' : lang_select($_GET['lang']); |
|
| 92 | - |
|
| 93 | - // Charger l'aiguilleur des traitements derogatoires |
|
| 94 | - // (action en base SQL, formulaires CVT, AJax) |
|
| 95 | - if (_request('action') or _request('var_ajax') or _request('formulaire_action')) { |
|
| 96 | - include_spip('public/aiguiller'); |
|
| 97 | - if ( |
|
| 98 | - // cas des appels actions ?action=xxx |
|
| 99 | - traiter_appels_actions() |
|
| 100 | - or |
|
| 101 | - // cas des hits ajax sur les inclusions ajax |
|
| 102 | - traiter_appels_inclusions_ajax() |
|
| 103 | - or |
|
| 104 | - // cas des formulaires charger/verifier/traiter |
|
| 105 | - traiter_formulaires_dynamiques() |
|
| 106 | - ) { |
|
| 107 | - // lancer les taches sur affichage final, comme le cron |
|
| 108 | - // mais sans rien afficher |
|
| 109 | - $GLOBALS['html'] = false; // ne rien afficher |
|
| 110 | - pipeline('affichage_final' . _PIPELINE_SUFFIX, ''); |
|
| 111 | - exit; // le hit est fini ! |
|
| 112 | - } |
|
| 113 | - } |
|
| 114 | - |
|
| 115 | - // Il y a du texte a produire, charger le metteur en page |
|
| 116 | - include_spip('public/assembler'); |
|
| 117 | - $page = assembler($fond, _request('connect')); |
|
| 118 | - |
|
| 119 | - if (isset($page['status'])) { |
|
| 120 | - include_spip('inc/headers'); |
|
| 121 | - http_status($page['status']); |
|
| 122 | - } |
|
| 123 | - |
|
| 124 | - // Content-Type ? |
|
| 125 | - if (!isset($page['entetes']['Content-Type'])) { |
|
| 126 | - $charset = isset($GLOBALS['meta']['charset']) ? $GLOBALS['meta']['charset'] : "utf-8"; |
|
| 127 | - $page['entetes']['Content-Type'] = 'text/html; charset=' . $charset; |
|
| 128 | - $html = true; |
|
| 129 | - } else { |
|
| 130 | - $html = preg_match(',^\s*text/html,', $page['entetes']['Content-Type']); |
|
| 131 | - } |
|
| 132 | - |
|
| 133 | - // Tester si on est admin et il y a des choses supplementaires a dire |
|
| 134 | - // type tableau pour y mettre des choses au besoin. |
|
| 135 | - $debug = ((_request('var_mode') == 'debug') or $tableau_des_temps) ? array(1) : array(); |
|
| 136 | - |
|
| 137 | - // affiche-t-on les boutons d'administration ? voir f_admin() |
|
| 138 | - $affiche_boutons_admin = ($html and ( |
|
| 139 | - (isset($_COOKIE['spip_admin']) and (!isset($flag_preserver) or !$flag_preserver)) |
|
| 140 | - or ($debug and include_spip('inc/autoriser') and autoriser('debug')) |
|
| 141 | - or (defined('_VAR_PREVIEW') and _VAR_PREVIEW) |
|
| 142 | - )); |
|
| 143 | - |
|
| 144 | - if ($affiche_boutons_admin) { |
|
| 145 | - include_spip('balise/formulaire_admin'); |
|
| 146 | - } |
|
| 147 | - |
|
| 148 | - |
|
| 149 | - // Execution de la page calculee |
|
| 150 | - |
|
| 151 | - // traitements sur les entetes avant envoi |
|
| 152 | - // peut servir pour le plugin de stats |
|
| 153 | - $page['entetes'] = pipeline('affichage_entetes_final' . _PIPELINE_SUFFIX, $page['entetes']); |
|
| 154 | - |
|
| 155 | - |
|
| 156 | - // eval $page et affecte $res |
|
| 157 | - include _ROOT_RESTREINT . "public/evaluer_page.php"; |
|
| 158 | - envoyer_entetes($page['entetes']); |
|
| 159 | - if ($res === false) { |
|
| 160 | - include_spip('inc/autoriser'); |
|
| 161 | - $err = _T('zbug_erreur_execution_page'); |
|
| 162 | - if (autoriser('webmestre')) { |
|
| 163 | - $err .= "\n<hr />\n" |
|
| 164 | - . highlight_string($page['codephp'], true) |
|
| 165 | - . "\n<hr />\n"; |
|
| 166 | - } |
|
| 167 | - $msg = array($err); |
|
| 168 | - erreur_squelette($msg); |
|
| 169 | - } |
|
| 170 | - |
|
| 171 | - // |
|
| 172 | - // Envoyer le resultat apres post-traitements |
|
| 173 | - // |
|
| 174 | - // (c'est ici qu'on fait var_recherche, validation, boutons d'admin, |
|
| 175 | - // cf. public/assembler.php) |
|
| 176 | - echo pipeline('affichage_final' . _PIPELINE_SUFFIX, $page['texte']); |
|
| 177 | - |
|
| 178 | - if ($lang) { |
|
| 179 | - lang_select(); |
|
| 180 | - } |
|
| 181 | - // l'affichage de la page a pu lever des erreurs (inclusion manquante) |
|
| 182 | - // il faut tester a nouveau |
|
| 183 | - $debug = ((_request('var_mode') == 'debug') or $tableau_des_temps) ? array(1) : array(); |
|
| 184 | - |
|
| 185 | - // Appel au debusqueur en cas d'erreurs ou de demande de trace |
|
| 186 | - // at last |
|
| 187 | - if ($debug) { |
|
| 188 | - // en cas d'erreur, retester l'affichage |
|
| 189 | - if ($html and ($affiche_boutons_admin or $debug)) { |
|
| 190 | - $var_mode_affiche = _request('var_mode_affiche'); |
|
| 191 | - $var_mode_objet = _request('var_mode_objet'); |
|
| 192 | - $GLOBALS['debug_objets'][$var_mode_affiche][$var_mode_objet . 'tout'] = ($var_mode_affiche == 'validation' ? $page['texte'] : ""); |
|
| 193 | - echo erreur_squelette(false); |
|
| 194 | - } |
|
| 195 | - } else { |
|
| 196 | - |
|
| 197 | - if (isset($GLOBALS['meta']['date_prochain_postdate']) |
|
| 198 | - and $GLOBALS['meta']['date_prochain_postdate'] <= time() |
|
| 199 | - ) { |
|
| 200 | - include_spip('inc/rubriques'); |
|
| 201 | - calculer_prochain_postdate(true); |
|
| 202 | - } |
|
| 203 | - |
|
| 204 | - // Effectuer une tache de fond ? |
|
| 205 | - // si _DIRECT_CRON_FORCE est present, on force l'appel |
|
| 206 | - if (defined('_DIRECT_CRON_FORCE')) { |
|
| 207 | - cron(); |
|
| 208 | - } |
|
| 209 | - |
|
| 210 | - // sauver le cache chemin si necessaire |
|
| 211 | - save_path_cache(); |
|
| 212 | - } |
|
| 29 | + $GLOBALS['_INC_PUBLIC'] = 1; |
|
| 30 | + define('_PIPELINE_SUFFIX', test_espace_prive() ? '_prive' : ''); |
|
| 31 | + |
|
| 32 | + // Faut-il initialiser SPIP ? (oui dans le cas general) |
|
| 33 | + if (!defined('_DIR_RESTREINT_ABS')) { |
|
| 34 | + if (defined('_DIR_RESTREINT') |
|
| 35 | + and @file_exists(_ROOT_RESTREINT . 'inc_version.php') |
|
| 36 | + ) { |
|
| 37 | + include_once _ROOT_RESTREINT . 'inc_version.php'; |
|
| 38 | + } else { |
|
| 39 | + die('inc_version absent ?'); |
|
| 40 | + } |
|
| 41 | + } // $fond defini dans le fichier d'appel ? |
|
| 42 | + |
|
| 43 | + else { |
|
| 44 | + if (isset($fond) and !_request('fond')) { |
|
| 45 | + } // fond demande dans l'url par page=xxxx ? |
|
| 46 | + else { |
|
| 47 | + if (isset($_GET[_SPIP_PAGE])) { |
|
| 48 | + $fond = (string)$_GET[_SPIP_PAGE]; |
|
| 49 | + |
|
| 50 | + // Securite |
|
| 51 | + if (strstr($fond, '/') |
|
| 52 | + and !( |
|
| 53 | + isset($GLOBALS['visiteur_session']) // pour eviter d'evaluer la suite pour les anonymes |
|
| 54 | + and include_spip('inc/autoriser') |
|
| 55 | + and autoriser('webmestre')) |
|
| 56 | + ) { |
|
| 57 | + include_spip('inc/minipres'); |
|
| 58 | + echo minipres(); |
|
| 59 | + exit; |
|
| 60 | + } |
|
| 61 | + // l'argument Page a priorite sur l'argument action |
|
| 62 | + // le cas se presente a cause des RewriteRule d'Apache |
|
| 63 | + // qui permettent d'ajouter un argument dans la QueryString |
|
| 64 | + // mais pas d'en retirer un en conservant les autres. |
|
| 65 | + if (isset($_GET['action']) and $_GET['action'] === $fond) { |
|
| 66 | + unset($_GET['action']); |
|
| 67 | + } |
|
| 68 | + # sinon, fond par defaut |
|
| 69 | + } else { |
|
| 70 | + // sinon fond par defaut (cf. assembler.php) |
|
| 71 | + $fond = pipeline('detecter_fond_par_defaut', ''); |
|
| 72 | + } |
|
| 73 | + } |
|
| 74 | + } |
|
| 75 | + |
|
| 76 | + $tableau_des_temps = array(); |
|
| 77 | + |
|
| 78 | + // Particularites de certains squelettes |
|
| 79 | + if ($fond == 'login') { |
|
| 80 | + $forcer_lang = true; |
|
| 81 | + } |
|
| 82 | + |
|
| 83 | + if (isset($forcer_lang) and $forcer_lang and ($forcer_lang !== 'non') |
|
| 84 | + and !_request('action') |
|
| 85 | + and $_SERVER['REQUEST_METHOD'] != 'POST' |
|
| 86 | + ) { |
|
| 87 | + include_spip('inc/lang'); |
|
| 88 | + verifier_lang_url(); |
|
| 89 | + } |
|
| 90 | + |
|
| 91 | + $lang = !isset($_GET['lang']) ? '' : lang_select($_GET['lang']); |
|
| 92 | + |
|
| 93 | + // Charger l'aiguilleur des traitements derogatoires |
|
| 94 | + // (action en base SQL, formulaires CVT, AJax) |
|
| 95 | + if (_request('action') or _request('var_ajax') or _request('formulaire_action')) { |
|
| 96 | + include_spip('public/aiguiller'); |
|
| 97 | + if ( |
|
| 98 | + // cas des appels actions ?action=xxx |
|
| 99 | + traiter_appels_actions() |
|
| 100 | + or |
|
| 101 | + // cas des hits ajax sur les inclusions ajax |
|
| 102 | + traiter_appels_inclusions_ajax() |
|
| 103 | + or |
|
| 104 | + // cas des formulaires charger/verifier/traiter |
|
| 105 | + traiter_formulaires_dynamiques() |
|
| 106 | + ) { |
|
| 107 | + // lancer les taches sur affichage final, comme le cron |
|
| 108 | + // mais sans rien afficher |
|
| 109 | + $GLOBALS['html'] = false; // ne rien afficher |
|
| 110 | + pipeline('affichage_final' . _PIPELINE_SUFFIX, ''); |
|
| 111 | + exit; // le hit est fini ! |
|
| 112 | + } |
|
| 113 | + } |
|
| 114 | + |
|
| 115 | + // Il y a du texte a produire, charger le metteur en page |
|
| 116 | + include_spip('public/assembler'); |
|
| 117 | + $page = assembler($fond, _request('connect')); |
|
| 118 | + |
|
| 119 | + if (isset($page['status'])) { |
|
| 120 | + include_spip('inc/headers'); |
|
| 121 | + http_status($page['status']); |
|
| 122 | + } |
|
| 123 | + |
|
| 124 | + // Content-Type ? |
|
| 125 | + if (!isset($page['entetes']['Content-Type'])) { |
|
| 126 | + $charset = isset($GLOBALS['meta']['charset']) ? $GLOBALS['meta']['charset'] : "utf-8"; |
|
| 127 | + $page['entetes']['Content-Type'] = 'text/html; charset=' . $charset; |
|
| 128 | + $html = true; |
|
| 129 | + } else { |
|
| 130 | + $html = preg_match(',^\s*text/html,', $page['entetes']['Content-Type']); |
|
| 131 | + } |
|
| 132 | + |
|
| 133 | + // Tester si on est admin et il y a des choses supplementaires a dire |
|
| 134 | + // type tableau pour y mettre des choses au besoin. |
|
| 135 | + $debug = ((_request('var_mode') == 'debug') or $tableau_des_temps) ? array(1) : array(); |
|
| 136 | + |
|
| 137 | + // affiche-t-on les boutons d'administration ? voir f_admin() |
|
| 138 | + $affiche_boutons_admin = ($html and ( |
|
| 139 | + (isset($_COOKIE['spip_admin']) and (!isset($flag_preserver) or !$flag_preserver)) |
|
| 140 | + or ($debug and include_spip('inc/autoriser') and autoriser('debug')) |
|
| 141 | + or (defined('_VAR_PREVIEW') and _VAR_PREVIEW) |
|
| 142 | + )); |
|
| 143 | + |
|
| 144 | + if ($affiche_boutons_admin) { |
|
| 145 | + include_spip('balise/formulaire_admin'); |
|
| 146 | + } |
|
| 147 | + |
|
| 148 | + |
|
| 149 | + // Execution de la page calculee |
|
| 150 | + |
|
| 151 | + // traitements sur les entetes avant envoi |
|
| 152 | + // peut servir pour le plugin de stats |
|
| 153 | + $page['entetes'] = pipeline('affichage_entetes_final' . _PIPELINE_SUFFIX, $page['entetes']); |
|
| 154 | + |
|
| 155 | + |
|
| 156 | + // eval $page et affecte $res |
|
| 157 | + include _ROOT_RESTREINT . "public/evaluer_page.php"; |
|
| 158 | + envoyer_entetes($page['entetes']); |
|
| 159 | + if ($res === false) { |
|
| 160 | + include_spip('inc/autoriser'); |
|
| 161 | + $err = _T('zbug_erreur_execution_page'); |
|
| 162 | + if (autoriser('webmestre')) { |
|
| 163 | + $err .= "\n<hr />\n" |
|
| 164 | + . highlight_string($page['codephp'], true) |
|
| 165 | + . "\n<hr />\n"; |
|
| 166 | + } |
|
| 167 | + $msg = array($err); |
|
| 168 | + erreur_squelette($msg); |
|
| 169 | + } |
|
| 170 | + |
|
| 171 | + // |
|
| 172 | + // Envoyer le resultat apres post-traitements |
|
| 173 | + // |
|
| 174 | + // (c'est ici qu'on fait var_recherche, validation, boutons d'admin, |
|
| 175 | + // cf. public/assembler.php) |
|
| 176 | + echo pipeline('affichage_final' . _PIPELINE_SUFFIX, $page['texte']); |
|
| 177 | + |
|
| 178 | + if ($lang) { |
|
| 179 | + lang_select(); |
|
| 180 | + } |
|
| 181 | + // l'affichage de la page a pu lever des erreurs (inclusion manquante) |
|
| 182 | + // il faut tester a nouveau |
|
| 183 | + $debug = ((_request('var_mode') == 'debug') or $tableau_des_temps) ? array(1) : array(); |
|
| 184 | + |
|
| 185 | + // Appel au debusqueur en cas d'erreurs ou de demande de trace |
|
| 186 | + // at last |
|
| 187 | + if ($debug) { |
|
| 188 | + // en cas d'erreur, retester l'affichage |
|
| 189 | + if ($html and ($affiche_boutons_admin or $debug)) { |
|
| 190 | + $var_mode_affiche = _request('var_mode_affiche'); |
|
| 191 | + $var_mode_objet = _request('var_mode_objet'); |
|
| 192 | + $GLOBALS['debug_objets'][$var_mode_affiche][$var_mode_objet . 'tout'] = ($var_mode_affiche == 'validation' ? $page['texte'] : ""); |
|
| 193 | + echo erreur_squelette(false); |
|
| 194 | + } |
|
| 195 | + } else { |
|
| 196 | + |
|
| 197 | + if (isset($GLOBALS['meta']['date_prochain_postdate']) |
|
| 198 | + and $GLOBALS['meta']['date_prochain_postdate'] <= time() |
|
| 199 | + ) { |
|
| 200 | + include_spip('inc/rubriques'); |
|
| 201 | + calculer_prochain_postdate(true); |
|
| 202 | + } |
|
| 203 | + |
|
| 204 | + // Effectuer une tache de fond ? |
|
| 205 | + // si _DIRECT_CRON_FORCE est present, on force l'appel |
|
| 206 | + if (defined('_DIRECT_CRON_FORCE')) { |
|
| 207 | + cron(); |
|
| 208 | + } |
|
| 209 | + |
|
| 210 | + // sauver le cache chemin si necessaire |
|
| 211 | + save_path_cache(); |
|
| 212 | + } |
|
| 213 | 213 | } |
@@ -32,9 +32,9 @@ discard block |
||
| 32 | 32 | // Faut-il initialiser SPIP ? (oui dans le cas general) |
| 33 | 33 | if (!defined('_DIR_RESTREINT_ABS')) { |
| 34 | 34 | if (defined('_DIR_RESTREINT') |
| 35 | - and @file_exists(_ROOT_RESTREINT . 'inc_version.php') |
|
| 35 | + and @file_exists(_ROOT_RESTREINT.'inc_version.php') |
|
| 36 | 36 | ) { |
| 37 | - include_once _ROOT_RESTREINT . 'inc_version.php'; |
|
| 37 | + include_once _ROOT_RESTREINT.'inc_version.php'; |
|
| 38 | 38 | } else { |
| 39 | 39 | die('inc_version absent ?'); |
| 40 | 40 | } |
@@ -45,7 +45,7 @@ discard block |
||
| 45 | 45 | } // fond demande dans l'url par page=xxxx ? |
| 46 | 46 | else { |
| 47 | 47 | if (isset($_GET[_SPIP_PAGE])) { |
| 48 | - $fond = (string)$_GET[_SPIP_PAGE]; |
|
| 48 | + $fond = (string) $_GET[_SPIP_PAGE]; |
|
| 49 | 49 | |
| 50 | 50 | // Securite |
| 51 | 51 | if (strstr($fond, '/') |
@@ -107,7 +107,7 @@ discard block |
||
| 107 | 107 | // lancer les taches sur affichage final, comme le cron |
| 108 | 108 | // mais sans rien afficher |
| 109 | 109 | $GLOBALS['html'] = false; // ne rien afficher |
| 110 | - pipeline('affichage_final' . _PIPELINE_SUFFIX, ''); |
|
| 110 | + pipeline('affichage_final'._PIPELINE_SUFFIX, ''); |
|
| 111 | 111 | exit; // le hit est fini ! |
| 112 | 112 | } |
| 113 | 113 | } |
@@ -124,7 +124,7 @@ discard block |
||
| 124 | 124 | // Content-Type ? |
| 125 | 125 | if (!isset($page['entetes']['Content-Type'])) { |
| 126 | 126 | $charset = isset($GLOBALS['meta']['charset']) ? $GLOBALS['meta']['charset'] : "utf-8"; |
| 127 | - $page['entetes']['Content-Type'] = 'text/html; charset=' . $charset; |
|
| 127 | + $page['entetes']['Content-Type'] = 'text/html; charset='.$charset; |
|
| 128 | 128 | $html = true; |
| 129 | 129 | } else { |
| 130 | 130 | $html = preg_match(',^\s*text/html,', $page['entetes']['Content-Type']); |
@@ -150,11 +150,11 @@ discard block |
||
| 150 | 150 | |
| 151 | 151 | // traitements sur les entetes avant envoi |
| 152 | 152 | // peut servir pour le plugin de stats |
| 153 | - $page['entetes'] = pipeline('affichage_entetes_final' . _PIPELINE_SUFFIX, $page['entetes']); |
|
| 153 | + $page['entetes'] = pipeline('affichage_entetes_final'._PIPELINE_SUFFIX, $page['entetes']); |
|
| 154 | 154 | |
| 155 | 155 | |
| 156 | 156 | // eval $page et affecte $res |
| 157 | - include _ROOT_RESTREINT . "public/evaluer_page.php"; |
|
| 157 | + include _ROOT_RESTREINT."public/evaluer_page.php"; |
|
| 158 | 158 | envoyer_entetes($page['entetes']); |
| 159 | 159 | if ($res === false) { |
| 160 | 160 | include_spip('inc/autoriser'); |
@@ -173,7 +173,7 @@ discard block |
||
| 173 | 173 | // |
| 174 | 174 | // (c'est ici qu'on fait var_recherche, validation, boutons d'admin, |
| 175 | 175 | // cf. public/assembler.php) |
| 176 | - echo pipeline('affichage_final' . _PIPELINE_SUFFIX, $page['texte']); |
|
| 176 | + echo pipeline('affichage_final'._PIPELINE_SUFFIX, $page['texte']); |
|
| 177 | 177 | |
| 178 | 178 | if ($lang) { |
| 179 | 179 | lang_select(); |
@@ -189,7 +189,7 @@ discard block |
||
| 189 | 189 | if ($html and ($affiche_boutons_admin or $debug)) { |
| 190 | 190 | $var_mode_affiche = _request('var_mode_affiche'); |
| 191 | 191 | $var_mode_objet = _request('var_mode_objet'); |
| 192 | - $GLOBALS['debug_objets'][$var_mode_affiche][$var_mode_objet . 'tout'] = ($var_mode_affiche == 'validation' ? $page['texte'] : ""); |
|
| 192 | + $GLOBALS['debug_objets'][$var_mode_affiche][$var_mode_objet.'tout'] = ($var_mode_affiche == 'validation' ? $page['texte'] : ""); |
|
| 193 | 193 | echo erreur_squelette(false); |
| 194 | 194 | } |
| 195 | 195 | } else { |
@@ -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 | /** |
@@ -35,18 +35,18 @@ discard block |
||
| 35 | 35 | */ |
| 36 | 36 | function genie_maintenance_dist($t) { |
| 37 | 37 | |
| 38 | - // (re)mettre .htaccess avec deny from all |
|
| 39 | - // dans les deux repertoires dits inaccessibles par http |
|
| 40 | - include_spip('inc/acces'); |
|
| 41 | - verifier_htaccess(_DIR_ETC); |
|
| 42 | - verifier_htaccess(_DIR_TMP); |
|
| 38 | + // (re)mettre .htaccess avec deny from all |
|
| 39 | + // dans les deux repertoires dits inaccessibles par http |
|
| 40 | + include_spip('inc/acces'); |
|
| 41 | + verifier_htaccess(_DIR_ETC); |
|
| 42 | + verifier_htaccess(_DIR_TMP); |
|
| 43 | 43 | |
| 44 | - // Verifier qu'aucune table n'est crashee |
|
| 45 | - if (!_request('reinstall')) { |
|
| 46 | - verifier_crash_tables(); |
|
| 47 | - } |
|
| 44 | + // Verifier qu'aucune table n'est crashee |
|
| 45 | + if (!_request('reinstall')) { |
|
| 46 | + verifier_crash_tables(); |
|
| 47 | + } |
|
| 48 | 48 | |
| 49 | - return 1; |
|
| 49 | + return 1; |
|
| 50 | 50 | } |
| 51 | 51 | |
| 52 | 52 | |
@@ -63,33 +63,33 @@ discard block |
||
| 63 | 63 | * des tables qui ont crashé. |
| 64 | 64 | */ |
| 65 | 65 | function verifier_crash_tables() { |
| 66 | - if (spip_connect()) { |
|
| 67 | - include_spip('base/serial'); |
|
| 68 | - include_spip('base/auxiliaires'); |
|
| 69 | - $crash = array(); |
|
| 70 | - foreach (array('tables_principales', 'tables_auxiliaires') as $com) { |
|
| 71 | - foreach ($GLOBALS[$com] as $table => $desc) { |
|
| 72 | - if (!sql_select('*', $table, '', '', '', 1) |
|
| 73 | - and !defined('spip_interdire_cache') |
|
| 74 | - ) # cas "LOST CONNECTION" |
|
| 75 | - { |
|
| 76 | - $crash[] = $table; |
|
| 77 | - } |
|
| 78 | - } |
|
| 79 | - } |
|
| 80 | - #$crash[] = 'test'; |
|
| 81 | - if ($crash) { |
|
| 82 | - ecrire_meta('message_crash_tables', serialize($crash)); |
|
| 83 | - spip_log('crash des tables', 'err'); |
|
| 84 | - spip_log($crash, 'err'); |
|
| 85 | - } else { |
|
| 86 | - effacer_meta('message_crash_tables'); |
|
| 87 | - } |
|
| 66 | + if (spip_connect()) { |
|
| 67 | + include_spip('base/serial'); |
|
| 68 | + include_spip('base/auxiliaires'); |
|
| 69 | + $crash = array(); |
|
| 70 | + foreach (array('tables_principales', 'tables_auxiliaires') as $com) { |
|
| 71 | + foreach ($GLOBALS[$com] as $table => $desc) { |
|
| 72 | + if (!sql_select('*', $table, '', '', '', 1) |
|
| 73 | + and !defined('spip_interdire_cache') |
|
| 74 | + ) # cas "LOST CONNECTION" |
|
| 75 | + { |
|
| 76 | + $crash[] = $table; |
|
| 77 | + } |
|
| 78 | + } |
|
| 79 | + } |
|
| 80 | + #$crash[] = 'test'; |
|
| 81 | + if ($crash) { |
|
| 82 | + ecrire_meta('message_crash_tables', serialize($crash)); |
|
| 83 | + spip_log('crash des tables', 'err'); |
|
| 84 | + spip_log($crash, 'err'); |
|
| 85 | + } else { |
|
| 86 | + effacer_meta('message_crash_tables'); |
|
| 87 | + } |
|
| 88 | 88 | |
| 89 | - return $crash; |
|
| 90 | - } |
|
| 89 | + return $crash; |
|
| 90 | + } |
|
| 91 | 91 | |
| 92 | - return false; |
|
| 92 | + return false; |
|
| 93 | 93 | } |
| 94 | 94 | |
| 95 | 95 | /** |
@@ -105,12 +105,12 @@ discard block |
||
| 105 | 105 | * @return string |
| 106 | 106 | */ |
| 107 | 107 | function message_crash_tables() { |
| 108 | - if ($crash = verifier_crash_tables()) { |
|
| 109 | - return |
|
| 110 | - '<strong>' . _T('texte_recuperer_base') . '</strong><br />' |
|
| 111 | - . ' <tt>' . join(', ', $crash) . '</tt><br />' |
|
| 112 | - . generer_form_ecrire('base_repair', |
|
| 113 | - _T('texte_crash_base'), '', |
|
| 114 | - _T('bouton_tenter_recuperation')); |
|
| 115 | - } |
|
| 108 | + if ($crash = verifier_crash_tables()) { |
|
| 109 | + return |
|
| 110 | + '<strong>' . _T('texte_recuperer_base') . '</strong><br />' |
|
| 111 | + . ' <tt>' . join(', ', $crash) . '</tt><br />' |
|
| 112 | + . generer_form_ecrire('base_repair', |
|
| 113 | + _T('texte_crash_base'), '', |
|
| 114 | + _T('bouton_tenter_recuperation')); |
|
| 115 | + } |
|
| 116 | 116 | } |
@@ -107,8 +107,8 @@ |
||
| 107 | 107 | function message_crash_tables() { |
| 108 | 108 | if ($crash = verifier_crash_tables()) { |
| 109 | 109 | return |
| 110 | - '<strong>' . _T('texte_recuperer_base') . '</strong><br />' |
|
| 111 | - . ' <tt>' . join(', ', $crash) . '</tt><br />' |
|
| 110 | + '<strong>'._T('texte_recuperer_base').'</strong><br />' |
|
| 111 | + . ' <tt>'.join(', ', $crash).'</tt><br />' |
|
| 112 | 112 | . generer_form_ecrire('base_repair', |
| 113 | 113 | _T('texte_crash_base'), '', |
| 114 | 114 | _T('bouton_tenter_recuperation')); |
@@ -71,10 +71,12 @@ |
||
| 71 | 71 | foreach ($GLOBALS[$com] as $table => $desc) { |
| 72 | 72 | if (!sql_select('*', $table, '', '', '', 1) |
| 73 | 73 | and !defined('spip_interdire_cache') |
| 74 | - ) # cas "LOST CONNECTION" |
|
| 74 | + ) { |
|
| 75 | + # cas "LOST CONNECTION" |
|
| 75 | 76 | { |
| 76 | 77 | $crash[] = $table; |
| 77 | 78 | } |
| 79 | + } |
|
| 78 | 80 | } |
| 79 | 81 | } |
| 80 | 82 | #$crash[] = 'test'; |