@@ -10,7 +10,7 @@ discard block |
||
| 10 | 10 | \***************************************************************************/ |
| 11 | 11 | |
| 12 | 12 | if (!defined('_ECRIRE_INC_VERSION')) { |
| 13 | - return; |
|
| 13 | + return; |
|
| 14 | 14 | } |
| 15 | 15 | |
| 16 | 16 | include_spip('inc/headers'); |
@@ -19,61 +19,61 @@ discard block |
||
| 19 | 19 | // Mise en place des fichiers de configuration si ce n'est fait |
| 20 | 20 | |
| 21 | 21 | function install_etape_fin_dist() { |
| 22 | - ecrire_acces(); |
|
| 22 | + ecrire_acces(); |
|
| 23 | 23 | |
| 24 | - $f = str_replace(_FILE_TMP_SUFFIX, '.php', (string) _FILE_CHMOD_TMP); |
|
| 25 | - if (file_exists(_FILE_CHMOD_TMP) && !@rename(_FILE_CHMOD_TMP, $f) && @copy(_FILE_CHMOD_TMP, $f)) { |
|
| 26 | - spip_unlink(_FILE_CHMOD_TMP); |
|
| 27 | - } |
|
| 24 | + $f = str_replace(_FILE_TMP_SUFFIX, '.php', (string) _FILE_CHMOD_TMP); |
|
| 25 | + if (file_exists(_FILE_CHMOD_TMP) && !@rename(_FILE_CHMOD_TMP, $f) && @copy(_FILE_CHMOD_TMP, $f)) { |
|
| 26 | + spip_unlink(_FILE_CHMOD_TMP); |
|
| 27 | + } |
|
| 28 | 28 | |
| 29 | - $f = str_replace(_FILE_TMP_SUFFIX, '.php', (string) _FILE_CONNECT_TMP); |
|
| 30 | - if (file_exists(_FILE_CONNECT_TMP)) { |
|
| 31 | - spip_log("renomme $f"); |
|
| 32 | - if (!@rename(_FILE_CONNECT_TMP, $f) && @copy(_FILE_CONNECT_TMP, $f)) { |
|
| 33 | - @spip_unlink(_FILE_CONNECT_TMP); |
|
| 34 | - } |
|
| 35 | - } |
|
| 29 | + $f = str_replace(_FILE_TMP_SUFFIX, '.php', (string) _FILE_CONNECT_TMP); |
|
| 30 | + if (file_exists(_FILE_CONNECT_TMP)) { |
|
| 31 | + spip_log("renomme $f"); |
|
| 32 | + if (!@rename(_FILE_CONNECT_TMP, $f) && @copy(_FILE_CONNECT_TMP, $f)) { |
|
| 33 | + @spip_unlink(_FILE_CONNECT_TMP); |
|
| 34 | + } |
|
| 35 | + } |
|
| 36 | 36 | |
| 37 | - // creer le repertoire cache, qui sert partout ! |
|
| 38 | - // deja fait en etape 4 en principe, on garde au cas ou |
|
| 39 | - if (!@file_exists(_DIR_CACHE)) { |
|
| 40 | - $rep = preg_replace(',' . _DIR_TMP . ',', '', (string) _DIR_CACHE); |
|
| 41 | - $rep = sous_repertoire(_DIR_TMP, $rep, true, true); |
|
| 42 | - } |
|
| 37 | + // creer le repertoire cache, qui sert partout ! |
|
| 38 | + // deja fait en etape 4 en principe, on garde au cas ou |
|
| 39 | + if (!@file_exists(_DIR_CACHE)) { |
|
| 40 | + $rep = preg_replace(',' . _DIR_TMP . ',', '', (string) _DIR_CACHE); |
|
| 41 | + $rep = sous_repertoire(_DIR_TMP, $rep, true, true); |
|
| 42 | + } |
|
| 43 | 43 | |
| 44 | - // Verifier la securite des htaccess |
|
| 45 | - // Si elle ne fonctionne pas, prevenir |
|
| 46 | - $msg = install_verifier_htaccess(); |
|
| 47 | - if ($msg) { |
|
| 48 | - $cible = _T('public:accueil_site'); |
|
| 49 | - $cible = generer_form_ecrire('accueil', '', '', $cible); |
|
| 50 | - $minipage = new Spip\Afficher\Minipage\Installation(); |
|
| 51 | - echo $minipage->page($msg . $cible); |
|
| 52 | - // ok, deboucher dans l'espace prive |
|
| 53 | - } else { |
|
| 54 | - redirige_url_ecrire('accueil'); |
|
| 55 | - } |
|
| 44 | + // Verifier la securite des htaccess |
|
| 45 | + // Si elle ne fonctionne pas, prevenir |
|
| 46 | + $msg = install_verifier_htaccess(); |
|
| 47 | + if ($msg) { |
|
| 48 | + $cible = _T('public:accueil_site'); |
|
| 49 | + $cible = generer_form_ecrire('accueil', '', '', $cible); |
|
| 50 | + $minipage = new Spip\Afficher\Minipage\Installation(); |
|
| 51 | + echo $minipage->page($msg . $cible); |
|
| 52 | + // ok, deboucher dans l'espace prive |
|
| 53 | + } else { |
|
| 54 | + redirige_url_ecrire('accueil'); |
|
| 55 | + } |
|
| 56 | 56 | } |
| 57 | 57 | |
| 58 | 58 | function install_verifier_htaccess() { |
| 59 | - if ( |
|
| 60 | - verifier_htaccess(_DIR_TMP, true) |
|
| 61 | - && verifier_htaccess(_DIR_CONNECT, true) |
|
| 62 | - && verifier_htaccess(_DIR_VENDOR, true) |
|
| 63 | - ) { |
|
| 64 | - return ''; |
|
| 65 | - } |
|
| 59 | + if ( |
|
| 60 | + verifier_htaccess(_DIR_TMP, true) |
|
| 61 | + && verifier_htaccess(_DIR_CONNECT, true) |
|
| 62 | + && verifier_htaccess(_DIR_VENDOR, true) |
|
| 63 | + ) { |
|
| 64 | + return ''; |
|
| 65 | + } |
|
| 66 | 66 | |
| 67 | - $titre = _T('htaccess_inoperant'); |
|
| 67 | + $titre = _T('htaccess_inoperant'); |
|
| 68 | 68 | |
| 69 | - $averti = _T( |
|
| 70 | - 'htaccess_a_simuler', |
|
| 71 | - [ |
|
| 72 | - 'htaccess' => '<tt>' . _ACCESS_FILE_NAME . '</tt>', |
|
| 73 | - 'constantes' => '<tt>_DIR_TMP & _DIR_CONNECT</tt>', |
|
| 74 | - 'document_root' => '<tt>' . $_SERVER['DOCUMENT_ROOT'] . '</tt>' |
|
| 75 | - ] |
|
| 76 | - ); |
|
| 69 | + $averti = _T( |
|
| 70 | + 'htaccess_a_simuler', |
|
| 71 | + [ |
|
| 72 | + 'htaccess' => '<tt>' . _ACCESS_FILE_NAME . '</tt>', |
|
| 73 | + 'constantes' => '<tt>_DIR_TMP & _DIR_CONNECT</tt>', |
|
| 74 | + 'document_root' => '<tt>' . $_SERVER['DOCUMENT_ROOT'] . '</tt>' |
|
| 75 | + ] |
|
| 76 | + ); |
|
| 77 | 77 | |
| 78 | - return "<div class='error'><h3>$titre</h3><p>$averti</p></div>"; |
|
| 78 | + return "<div class='error'><h3>$titre</h3><p>$averti</p></div>"; |
|
| 79 | 79 | } |
@@ -37,7 +37,7 @@ discard block |
||
| 37 | 37 | // creer le repertoire cache, qui sert partout ! |
| 38 | 38 | // deja fait en etape 4 en principe, on garde au cas ou |
| 39 | 39 | if (!@file_exists(_DIR_CACHE)) { |
| 40 | - $rep = preg_replace(',' . _DIR_TMP . ',', '', (string) _DIR_CACHE); |
|
| 40 | + $rep = preg_replace(','._DIR_TMP.',', '', (string) _DIR_CACHE); |
|
| 41 | 41 | $rep = sous_repertoire(_DIR_TMP, $rep, true, true); |
| 42 | 42 | } |
| 43 | 43 | |
@@ -48,7 +48,7 @@ discard block |
||
| 48 | 48 | $cible = _T('public:accueil_site'); |
| 49 | 49 | $cible = generer_form_ecrire('accueil', '', '', $cible); |
| 50 | 50 | $minipage = new Spip\Afficher\Minipage\Installation(); |
| 51 | - echo $minipage->page($msg . $cible); |
|
| 51 | + echo $minipage->page($msg.$cible); |
|
| 52 | 52 | // ok, deboucher dans l'espace prive |
| 53 | 53 | } else { |
| 54 | 54 | redirige_url_ecrire('accueil'); |
@@ -69,9 +69,9 @@ discard block |
||
| 69 | 69 | $averti = _T( |
| 70 | 70 | 'htaccess_a_simuler', |
| 71 | 71 | [ |
| 72 | - 'htaccess' => '<tt>' . _ACCESS_FILE_NAME . '</tt>', |
|
| 72 | + 'htaccess' => '<tt>'._ACCESS_FILE_NAME.'</tt>', |
|
| 73 | 73 | 'constantes' => '<tt>_DIR_TMP & _DIR_CONNECT</tt>', |
| 74 | - 'document_root' => '<tt>' . $_SERVER['DOCUMENT_ROOT'] . '</tt>' |
|
| 74 | + 'document_root' => '<tt>'.$_SERVER['DOCUMENT_ROOT'].'</tt>' |
|
| 75 | 75 | ] |
| 76 | 76 | ); |
| 77 | 77 | |
@@ -10,85 +10,85 @@ |
||
| 10 | 10 | \***************************************************************************/ |
| 11 | 11 | |
| 12 | 12 | if (!defined('_ECRIRE_INC_VERSION')) { |
| 13 | - return; |
|
| 13 | + return; |
|
| 14 | 14 | } |
| 15 | 15 | include_spip('inc/headers'); |
| 16 | 16 | include_spip('auth/ldap'); |
| 17 | 17 | |
| 18 | 18 | function install_etape_ldap5_dist() { |
| 19 | - etape_ldap5_save(); |
|
| 20 | - etape_ldap5_suite(); |
|
| 19 | + etape_ldap5_save(); |
|
| 20 | + etape_ldap5_suite(); |
|
| 21 | 21 | } |
| 22 | 22 | |
| 23 | 23 | function etape_ldap5_save() { |
| 24 | - $conn = null; |
|
| 25 | - if (!@file_exists(_FILE_CONNECT_TMP)) { |
|
| 26 | - redirige_url_ecrire('install'); |
|
| 27 | - } |
|
| 24 | + $conn = null; |
|
| 25 | + if (!@file_exists(_FILE_CONNECT_TMP)) { |
|
| 26 | + redirige_url_ecrire('install'); |
|
| 27 | + } |
|
| 28 | 28 | |
| 29 | - ecrire_meta('ldap_statut_import', _request('statut_ldap')); |
|
| 29 | + ecrire_meta('ldap_statut_import', _request('statut_ldap')); |
|
| 30 | 30 | |
| 31 | - lire_fichier(_FILE_CONNECT_TMP, $conn); |
|
| 31 | + lire_fichier(_FILE_CONNECT_TMP, $conn); |
|
| 32 | 32 | |
| 33 | - if ($p = strpos((string) $conn, "'');")) { |
|
| 34 | - ecrire_fichier( |
|
| 35 | - _FILE_CONNECT_TMP, |
|
| 36 | - substr((string) $conn, 0, $p + 1) |
|
| 37 | - . _FILE_LDAP |
|
| 38 | - . substr((string) $conn, $p + 1) |
|
| 39 | - ); |
|
| 40 | - } |
|
| 33 | + if ($p = strpos((string) $conn, "'');")) { |
|
| 34 | + ecrire_fichier( |
|
| 35 | + _FILE_CONNECT_TMP, |
|
| 36 | + substr((string) $conn, 0, $p + 1) |
|
| 37 | + . _FILE_LDAP |
|
| 38 | + . substr((string) $conn, $p + 1) |
|
| 39 | + ); |
|
| 40 | + } |
|
| 41 | 41 | |
| 42 | - $adresse_ldap = addcslashes((string) _request('adresse_ldap'), "'\\"); |
|
| 43 | - $login_ldap = addcslashes((string) _request('login_ldap'), "'\\"); |
|
| 44 | - $pass_ldap = addcslashes((string) _request('pass_ldap'), "'\\"); |
|
| 45 | - $port_ldap = addcslashes((string) _request('port_ldap'), "'\\"); |
|
| 46 | - $tls_ldap = addcslashes((string) _request('tls_ldap'), "'\\"); |
|
| 47 | - $protocole_ldap = addcslashes((string) _request('protocole_ldap'), "'\\"); |
|
| 48 | - $base_ldap = addcslashes((string) _request('base_ldap'), "'\\"); |
|
| 49 | - $base_ldap_text = addcslashes((string) _request('base_ldap_text'), "'\\"); |
|
| 42 | + $adresse_ldap = addcslashes((string) _request('adresse_ldap'), "'\\"); |
|
| 43 | + $login_ldap = addcslashes((string) _request('login_ldap'), "'\\"); |
|
| 44 | + $pass_ldap = addcslashes((string) _request('pass_ldap'), "'\\"); |
|
| 45 | + $port_ldap = addcslashes((string) _request('port_ldap'), "'\\"); |
|
| 46 | + $tls_ldap = addcslashes((string) _request('tls_ldap'), "'\\"); |
|
| 47 | + $protocole_ldap = addcslashes((string) _request('protocole_ldap'), "'\\"); |
|
| 48 | + $base_ldap = addcslashes((string) _request('base_ldap'), "'\\"); |
|
| 49 | + $base_ldap_text = addcslashes((string) _request('base_ldap_text'), "'\\"); |
|
| 50 | 50 | |
| 51 | - $conn = "\$GLOBALS['ldap_base'] = '$base_ldap';\n" |
|
| 52 | - . "\$GLOBALS['ldap_link'] = @ldap_connect('$adresse_ldap','$port_ldap');\n" |
|
| 53 | - . "@ldap_set_option(\$GLOBALS['ldap_link'],LDAP_OPT_PROTOCOL_VERSION,'$protocole_ldap');\n" |
|
| 54 | - . (($tls_ldap != 'oui') ? '' : |
|
| 55 | - "@ldap_start_tls(\$GLOBALS['ldap_link']);\n") |
|
| 56 | - . "@ldap_bind(\$GLOBALS['ldap_link'],'$login_ldap','$pass_ldap');\n"; |
|
| 51 | + $conn = "\$GLOBALS['ldap_base'] = '$base_ldap';\n" |
|
| 52 | + . "\$GLOBALS['ldap_link'] = @ldap_connect('$adresse_ldap','$port_ldap');\n" |
|
| 53 | + . "@ldap_set_option(\$GLOBALS['ldap_link'],LDAP_OPT_PROTOCOL_VERSION,'$protocole_ldap');\n" |
|
| 54 | + . (($tls_ldap != 'oui') ? '' : |
|
| 55 | + "@ldap_start_tls(\$GLOBALS['ldap_link']);\n") |
|
| 56 | + . "@ldap_bind(\$GLOBALS['ldap_link'],'$login_ldap','$pass_ldap');\n"; |
|
| 57 | 57 | |
| 58 | - $champs = is_array($GLOBALS['ldap_attributes']) ? $GLOBALS['ldap_attributes'] : []; |
|
| 59 | - $res = ''; |
|
| 60 | - foreach (array_keys($champs) as $champ) { |
|
| 61 | - $nom = 'ldap_' . $champ; |
|
| 62 | - $val = trim((string) _request($nom)); |
|
| 63 | - if (preg_match('/^\w*$/', $val)) { |
|
| 64 | - if ($val) { |
|
| 65 | - $val = _q($val); |
|
| 66 | - } |
|
| 67 | - } else { |
|
| 68 | - $val = 'array(' . _q(preg_split('/\W+/', $val)) . ')'; |
|
| 69 | - }; |
|
| 70 | - if ($val) { |
|
| 71 | - $res .= "'$champ' => " . $val . ','; |
|
| 72 | - } |
|
| 73 | - } |
|
| 74 | - $conn .= "\$GLOBALS['ldap_champs'] = array($res);\n"; |
|
| 58 | + $champs = is_array($GLOBALS['ldap_attributes']) ? $GLOBALS['ldap_attributes'] : []; |
|
| 59 | + $res = ''; |
|
| 60 | + foreach (array_keys($champs) as $champ) { |
|
| 61 | + $nom = 'ldap_' . $champ; |
|
| 62 | + $val = trim((string) _request($nom)); |
|
| 63 | + if (preg_match('/^\w*$/', $val)) { |
|
| 64 | + if ($val) { |
|
| 65 | + $val = _q($val); |
|
| 66 | + } |
|
| 67 | + } else { |
|
| 68 | + $val = 'array(' . _q(preg_split('/\W+/', $val)) . ')'; |
|
| 69 | + }; |
|
| 70 | + if ($val) { |
|
| 71 | + $res .= "'$champ' => " . $val . ','; |
|
| 72 | + } |
|
| 73 | + } |
|
| 74 | + $conn .= "\$GLOBALS['ldap_champs'] = array($res);\n"; |
|
| 75 | 75 | |
| 76 | - install_fichier_connexion(_DIR_CONNECT . _FILE_LDAP, $conn); |
|
| 76 | + install_fichier_connexion(_DIR_CONNECT . _FILE_LDAP, $conn); |
|
| 77 | 77 | } |
| 78 | 78 | |
| 79 | 79 | function etape_ldap5_suite() { |
| 80 | - $minipage = new Spip\Afficher\Minipage\Installation(); |
|
| 81 | - echo $minipage->installDebutPage(['onload' => 'document.getElementById(\'suivant\').focus();return false;']); |
|
| 80 | + $minipage = new Spip\Afficher\Minipage\Installation(); |
|
| 81 | + echo $minipage->installDebutPage(['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 | - ); |
|
| 83 | + echo info_etape( |
|
| 84 | + _T('info_ldap_ok'), |
|
| 85 | + info_progression_etape(5, 'etape_ldap', 'install/') |
|
| 86 | + ); |
|
| 87 | 87 | |
| 88 | - echo generer_form_ecrire('install', ( |
|
| 89 | - "<input type='hidden' name='etape' value='3' />" . |
|
| 90 | - "<input type='hidden' name='ldap_present' value='true' />" |
|
| 91 | - . bouton_suivant())); |
|
| 88 | + echo generer_form_ecrire('install', ( |
|
| 89 | + "<input type='hidden' name='etape' value='3' />" . |
|
| 90 | + "<input type='hidden' name='ldap_present' value='true' />" |
|
| 91 | + . bouton_suivant())); |
|
| 92 | 92 | |
| 93 | - echo $minipage->installFinPage(); |
|
| 93 | + echo $minipage->installFinPage(); |
|
| 94 | 94 | } |
@@ -51,29 +51,28 @@ discard block |
||
| 51 | 51 | $conn = "\$GLOBALS['ldap_base'] = '$base_ldap';\n" |
| 52 | 52 | . "\$GLOBALS['ldap_link'] = @ldap_connect('$adresse_ldap','$port_ldap');\n" |
| 53 | 53 | . "@ldap_set_option(\$GLOBALS['ldap_link'],LDAP_OPT_PROTOCOL_VERSION,'$protocole_ldap');\n" |
| 54 | - . (($tls_ldap != 'oui') ? '' : |
|
| 55 | - "@ldap_start_tls(\$GLOBALS['ldap_link']);\n") |
|
| 54 | + . (($tls_ldap != 'oui') ? '' : "@ldap_start_tls(\$GLOBALS['ldap_link']);\n") |
|
| 56 | 55 | . "@ldap_bind(\$GLOBALS['ldap_link'],'$login_ldap','$pass_ldap');\n"; |
| 57 | 56 | |
| 58 | 57 | $champs = is_array($GLOBALS['ldap_attributes']) ? $GLOBALS['ldap_attributes'] : []; |
| 59 | 58 | $res = ''; |
| 60 | 59 | foreach (array_keys($champs) as $champ) { |
| 61 | - $nom = 'ldap_' . $champ; |
|
| 60 | + $nom = 'ldap_'.$champ; |
|
| 62 | 61 | $val = trim((string) _request($nom)); |
| 63 | 62 | if (preg_match('/^\w*$/', $val)) { |
| 64 | 63 | if ($val) { |
| 65 | 64 | $val = _q($val); |
| 66 | 65 | } |
| 67 | 66 | } else { |
| 68 | - $val = 'array(' . _q(preg_split('/\W+/', $val)) . ')'; |
|
| 67 | + $val = 'array('._q(preg_split('/\W+/', $val)).')'; |
|
| 69 | 68 | }; |
| 70 | 69 | if ($val) { |
| 71 | - $res .= "'$champ' => " . $val . ','; |
|
| 70 | + $res .= "'$champ' => ".$val.','; |
|
| 72 | 71 | } |
| 73 | 72 | } |
| 74 | 73 | $conn .= "\$GLOBALS['ldap_champs'] = array($res);\n"; |
| 75 | 74 | |
| 76 | - install_fichier_connexion(_DIR_CONNECT . _FILE_LDAP, $conn); |
|
| 75 | + install_fichier_connexion(_DIR_CONNECT._FILE_LDAP, $conn); |
|
| 77 | 76 | } |
| 78 | 77 | |
| 79 | 78 | function etape_ldap5_suite() { |
@@ -86,7 +85,7 @@ discard block |
||
| 86 | 85 | ); |
| 87 | 86 | |
| 88 | 87 | echo generer_form_ecrire('install', ( |
| 89 | - "<input type='hidden' name='etape' value='3' />" . |
|
| 88 | + "<input type='hidden' name='etape' value='3' />". |
|
| 90 | 89 | "<input type='hidden' name='ldap_present' value='true' />" |
| 91 | 90 | . bouton_suivant())); |
| 92 | 91 | |
@@ -10,167 +10,167 @@ |
||
| 10 | 10 | \***************************************************************************/ |
| 11 | 11 | |
| 12 | 12 | if (!defined('_ECRIRE_INC_VERSION')) { |
| 13 | - return; |
|
| 13 | + return; |
|
| 14 | 14 | } |
| 15 | 15 | |
| 16 | 16 | include_spip('base/abstract_sql'); |
| 17 | 17 | |
| 18 | 18 | function install_etape_2_dist() { |
| 19 | - $adresse_db = defined('_INSTALL_HOST_DB') |
|
| 20 | - ? _INSTALL_HOST_DB |
|
| 21 | - : _request('adresse_db'); |
|
| 19 | + $adresse_db = defined('_INSTALL_HOST_DB') |
|
| 20 | + ? _INSTALL_HOST_DB |
|
| 21 | + : _request('adresse_db'); |
|
| 22 | 22 | |
| 23 | - if (preg_match(',(.*):(.*),', (string) $adresse_db, $r)) { |
|
| 24 | - [, $adresse_db, $port] = $r; |
|
| 25 | - } else { |
|
| 26 | - $port = ''; |
|
| 27 | - } |
|
| 23 | + if (preg_match(',(.*):(.*),', (string) $adresse_db, $r)) { |
|
| 24 | + [, $adresse_db, $port] = $r; |
|
| 25 | + } else { |
|
| 26 | + $port = ''; |
|
| 27 | + } |
|
| 28 | 28 | |
| 29 | - $login_db = defined('_INSTALL_USER_DB') |
|
| 30 | - ? _INSTALL_USER_DB |
|
| 31 | - : _request('login_db'); |
|
| 29 | + $login_db = defined('_INSTALL_USER_DB') |
|
| 30 | + ? _INSTALL_USER_DB |
|
| 31 | + : _request('login_db'); |
|
| 32 | 32 | |
| 33 | - $pass_db = defined('_INSTALL_PASS_DB') |
|
| 34 | - ? _INSTALL_PASS_DB |
|
| 35 | - : _request('pass_db'); |
|
| 33 | + $pass_db = defined('_INSTALL_PASS_DB') |
|
| 34 | + ? _INSTALL_PASS_DB |
|
| 35 | + : _request('pass_db'); |
|
| 36 | 36 | |
| 37 | - $server_db = defined('_INSTALL_SERVER_DB') |
|
| 38 | - ? _INSTALL_SERVER_DB |
|
| 39 | - : _request('server_db'); |
|
| 37 | + $server_db = defined('_INSTALL_SERVER_DB') |
|
| 38 | + ? _INSTALL_SERVER_DB |
|
| 39 | + : _request('server_db'); |
|
| 40 | 40 | |
| 41 | - $name_db = defined('_INSTALL_NAME_DB') |
|
| 42 | - ? _INSTALL_NAME_DB |
|
| 43 | - : ''; |
|
| 41 | + $name_db = defined('_INSTALL_NAME_DB') |
|
| 42 | + ? _INSTALL_NAME_DB |
|
| 43 | + : ''; |
|
| 44 | 44 | |
| 45 | - $chmod = _request('chmod'); |
|
| 45 | + $chmod = _request('chmod'); |
|
| 46 | 46 | |
| 47 | - $link = spip_connect_db($adresse_db, $port, $login_db, $pass_db, $name_db, $server_db); |
|
| 48 | - $GLOBALS['connexions'][$server_db] = $link; |
|
| 47 | + $link = spip_connect_db($adresse_db, $port, $login_db, $pass_db, $name_db, $server_db); |
|
| 48 | + $GLOBALS['connexions'][$server_db] = $link; |
|
| 49 | 49 | |
| 50 | - $GLOBALS['connexions'][$server_db][$GLOBALS['spip_sql_version']] |
|
| 51 | - = $GLOBALS['spip_' . $server_db . '_functions_' . $GLOBALS['spip_sql_version']]; |
|
| 50 | + $GLOBALS['connexions'][$server_db][$GLOBALS['spip_sql_version']] |
|
| 51 | + = $GLOBALS['spip_' . $server_db . '_functions_' . $GLOBALS['spip_sql_version']]; |
|
| 52 | 52 | |
| 53 | - $minipage = new Spip\Afficher\Minipage\Installation(); |
|
| 54 | - echo $minipage->installDebutPage(); |
|
| 53 | + $minipage = new Spip\Afficher\Minipage\Installation(); |
|
| 54 | + echo $minipage->installDebutPage(); |
|
| 55 | 55 | |
| 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 | - [$checked, $res] = install_etape_2_bases($login_db, $server_db); |
|
| 76 | + echo "\n", '<!-- ', sql_version($server_db), ' -->'; |
|
| 77 | + [$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 $minipage->installFinPage(); |
|
| 98 | + echo $minipage->installFinPage(); |
|
| 99 | 99 | } |
| 100 | 100 | |
| 101 | 101 | // Liste les bases accessibles, |
| 102 | 102 | // avec une heuristique pour preselectionner la plus probable |
| 103 | 103 | |
| 104 | 104 | function install_etape_2_bases($login_db, $server_db) { |
| 105 | - $res = install_etape_liste_bases($server_db, $login_db); |
|
| 106 | - if ($res) { |
|
| 107 | - [$checked, $bases] = $res; |
|
| 108 | - |
|
| 109 | - return [ |
|
| 110 | - $checked, |
|
| 111 | - "<label for='choix_db'><b>" |
|
| 112 | - . _T('texte_choix_base_2') |
|
| 113 | - . '</b><br />' |
|
| 114 | - . _T('texte_choix_base_3') |
|
| 115 | - . '</label>' |
|
| 116 | - . "<ul>\n<li>" |
|
| 117 | - . implode("</li>\n<li>", $bases) |
|
| 118 | - . "</li>\n</ul><p>" |
|
| 119 | - . _T('info_ou') |
|
| 120 | - . ' ' |
|
| 121 | - ]; |
|
| 122 | - } |
|
| 123 | - $res = '<b>' . _T('avis_lecture_noms_bases_1') . '</b> |
|
| 105 | + $res = install_etape_liste_bases($server_db, $login_db); |
|
| 106 | + if ($res) { |
|
| 107 | + [$checked, $bases] = $res; |
|
| 108 | + |
|
| 109 | + return [ |
|
| 110 | + $checked, |
|
| 111 | + "<label for='choix_db'><b>" |
|
| 112 | + . _T('texte_choix_base_2') |
|
| 113 | + . '</b><br />' |
|
| 114 | + . _T('texte_choix_base_3') |
|
| 115 | + . '</label>' |
|
| 116 | + . "<ul>\n<li>" |
|
| 117 | + . implode("</li>\n<li>", $bases) |
|
| 118 | + . "</li>\n</ul><p>" |
|
| 119 | + . _T('info_ou') |
|
| 120 | + . ' ' |
|
| 121 | + ]; |
|
| 122 | + } |
|
| 123 | + $res = '<b>' . _T('avis_lecture_noms_bases_1') . '</b> |
|
| 124 | 124 | ' . _T('avis_lecture_noms_bases_2') . '<p>'; |
| 125 | 125 | |
| 126 | - $checked = false; |
|
| 127 | - if ($login_db) { |
|
| 128 | - // Si un login comporte un point, le nom de la base est plus |
|
| 129 | - // probablement le login sans le point -- testons pour savoir |
|
| 130 | - $test_base = $login_db; |
|
| 131 | - $ok = sql_selectdb($test_base, $server_db); |
|
| 132 | - $test_base2 = str_replace('.', '_', (string) $test_base); |
|
| 133 | - if (sql_selectdb($test_base2, $server_db)) { |
|
| 134 | - $test_base = $test_base2; |
|
| 135 | - $ok = true; |
|
| 136 | - } |
|
| 137 | - |
|
| 138 | - if ($ok) { |
|
| 139 | - $res .= _T('avis_lecture_noms_bases_3') |
|
| 140 | - . '<ul>' |
|
| 141 | - . '<li><input name="choix_db" value="' . $test_base . "\" type='radio' id='stand' checked='checked' />" |
|
| 142 | - . "<label for='stand'>" . $test_base . "</label></li>\n" |
|
| 143 | - . '</ul>' |
|
| 144 | - . '<p>' . _T('info_ou') . ' '; |
|
| 145 | - $checked = true; |
|
| 146 | - } |
|
| 147 | - } |
|
| 148 | - |
|
| 149 | - return [$checked, $res]; |
|
| 126 | + $checked = false; |
|
| 127 | + if ($login_db) { |
|
| 128 | + // Si un login comporte un point, le nom de la base est plus |
|
| 129 | + // probablement le login sans le point -- testons pour savoir |
|
| 130 | + $test_base = $login_db; |
|
| 131 | + $ok = sql_selectdb($test_base, $server_db); |
|
| 132 | + $test_base2 = str_replace('.', '_', (string) $test_base); |
|
| 133 | + if (sql_selectdb($test_base2, $server_db)) { |
|
| 134 | + $test_base = $test_base2; |
|
| 135 | + $ok = true; |
|
| 136 | + } |
|
| 137 | + |
|
| 138 | + if ($ok) { |
|
| 139 | + $res .= _T('avis_lecture_noms_bases_3') |
|
| 140 | + . '<ul>' |
|
| 141 | + . '<li><input name="choix_db" value="' . $test_base . "\" type='radio' id='stand' checked='checked' />" |
|
| 142 | + . "<label for='stand'>" . $test_base . "</label></li>\n" |
|
| 143 | + . '</ul>' |
|
| 144 | + . '<p>' . _T('info_ou') . ' '; |
|
| 145 | + $checked = true; |
|
| 146 | + } |
|
| 147 | + } |
|
| 148 | + |
|
| 149 | + return [$checked, $res]; |
|
| 150 | 150 | } |
| 151 | 151 | |
| 152 | 152 | function install_etape_2_form($hidden, $checked, $res, $etape) { |
| 153 | - return generer_form_ecrire('install', ( |
|
| 154 | - "\n<input type='hidden' name='etape' value='$etape' />" |
|
| 155 | - . $hidden |
|
| 156 | - . (defined('_INSTALL_NAME_DB') |
|
| 157 | - ? '<h3>' . _T('install_nom_base_hebergeur') . ' <tt>' . _INSTALL_NAME_DB . '</tt>' . '</h3>' |
|
| 158 | - : "\n<fieldset><legend>" . _T('texte_choix_base_1') . "</legend>\n" |
|
| 159 | - . $res |
|
| 160 | - . "\n<input name=\"choix_db\" value=\"new_spip\" type='radio' id='nou'" |
|
| 161 | - . ($checked ? '' : " checked='checked'") |
|
| 162 | - . " />\n<label for='nou'>" . _T('info_creer_base') . "</label></p>\n<p>" |
|
| 163 | - . "\n<input type='text' name='table_new' class='text' value=\"spip\" size='20' /></p></fieldset>\n" |
|
| 164 | - ) |
|
| 165 | - |
|
| 166 | - . ((defined('_INSTALL_TABLE_PREFIX') || $GLOBALS['table_prefix'] != 'spip') |
|
| 167 | - ? '<h3>' . _T('install_table_prefix_hebergeur') . ' <tt>' . $GLOBALS['table_prefix'] . '</tt>' . '</h3>' |
|
| 168 | - : '<fieldset><legend>' . _T('texte_choix_table_prefix') . "</legend>\n" |
|
| 169 | - . "<p><label for='table_prefix'>" . _T('info_table_prefix') . '</label></p><p>' |
|
| 170 | - . "\n<input type='text' id='tprefix' name='tprefix' class='text' value='" |
|
| 171 | - . 'spip' # valeur par defaut |
|
| 172 | - . "' size='20' /></p></fieldset>" |
|
| 173 | - ) |
|
| 174 | - |
|
| 175 | - . bouton_suivant())); |
|
| 153 | + return generer_form_ecrire('install', ( |
|
| 154 | + "\n<input type='hidden' name='etape' value='$etape' />" |
|
| 155 | + . $hidden |
|
| 156 | + . (defined('_INSTALL_NAME_DB') |
|
| 157 | + ? '<h3>' . _T('install_nom_base_hebergeur') . ' <tt>' . _INSTALL_NAME_DB . '</tt>' . '</h3>' |
|
| 158 | + : "\n<fieldset><legend>" . _T('texte_choix_base_1') . "</legend>\n" |
|
| 159 | + . $res |
|
| 160 | + . "\n<input name=\"choix_db\" value=\"new_spip\" type='radio' id='nou'" |
|
| 161 | + . ($checked ? '' : " checked='checked'") |
|
| 162 | + . " />\n<label for='nou'>" . _T('info_creer_base') . "</label></p>\n<p>" |
|
| 163 | + . "\n<input type='text' name='table_new' class='text' value=\"spip\" size='20' /></p></fieldset>\n" |
|
| 164 | + ) |
|
| 165 | + |
|
| 166 | + . ((defined('_INSTALL_TABLE_PREFIX') || $GLOBALS['table_prefix'] != 'spip') |
|
| 167 | + ? '<h3>' . _T('install_table_prefix_hebergeur') . ' <tt>' . $GLOBALS['table_prefix'] . '</tt>' . '</h3>' |
|
| 168 | + : '<fieldset><legend>' . _T('texte_choix_table_prefix') . "</legend>\n" |
|
| 169 | + . "<p><label for='table_prefix'>" . _T('info_table_prefix') . '</label></p><p>' |
|
| 170 | + . "\n<input type='text' id='tprefix' name='tprefix' class='text' value='" |
|
| 171 | + . 'spip' # valeur par defaut |
|
| 172 | + . "' size='20' /></p></fieldset>" |
|
| 173 | + ) |
|
| 174 | + |
|
| 175 | + . bouton_suivant())); |
|
| 176 | 176 | } |
@@ -10,167 +10,167 @@ |
||
| 10 | 10 | \***************************************************************************/ |
| 11 | 11 | |
| 12 | 12 | if (!defined('_ECRIRE_INC_VERSION')) { |
| 13 | - return; |
|
| 13 | + return; |
|
| 14 | 14 | } |
| 15 | 15 | |
| 16 | 16 | include_spip('inc/headers'); |
| 17 | 17 | |
| 18 | 18 | function install_etape_3b_dist() { |
| 19 | - $auth_spip = null; |
|
| 20 | - $session = null; |
|
| 21 | - $row = null; |
|
| 22 | - $login = _request('login'); |
|
| 23 | - $email = _request('email'); |
|
| 24 | - $nom = _request('nom'); |
|
| 25 | - $pass = _request('pass'); |
|
| 26 | - $pass_verif = _request('pass_verif'); |
|
| 27 | - |
|
| 28 | - $server_db = defined('_INSTALL_SERVER_DB') |
|
| 29 | - ? _INSTALL_SERVER_DB |
|
| 30 | - : _request('server_db'); |
|
| 31 | - |
|
| 32 | - if (!defined('_PASS_LONGUEUR_MINI')) { |
|
| 33 | - define('_PASS_LONGUEUR_MINI', 6); |
|
| 34 | - } |
|
| 35 | - if (!defined('_LOGIN_TROP_COURT')) { |
|
| 36 | - define('_LOGIN_TROP_COURT', 4); |
|
| 37 | - } |
|
| 38 | - if ($login) { |
|
| 39 | - $echec = ($pass != $pass_verif) ? |
|
| 40 | - _T('info_passes_identiques') |
|
| 41 | - : ((strlen((string) $pass) < _PASS_LONGUEUR_MINI) ? |
|
| 42 | - _T('info_passe_trop_court_car_pluriel', ['nb' => _PASS_LONGUEUR_MINI]) |
|
| 43 | - : ((strlen((string) $login) < _LOGIN_TROP_COURT) ? |
|
| 44 | - _T('info_login_trop_court') |
|
| 45 | - : '')); |
|
| 46 | - include_spip('inc/filtres'); |
|
| 47 | - if (!$echec && $email && !email_valide($email)) { |
|
| 48 | - $echec = _T('form_email_non_valide'); |
|
| 49 | - } |
|
| 50 | - if ($echec) { |
|
| 51 | - echouer_etape_3b($echec); |
|
| 52 | - } |
|
| 53 | - } |
|
| 54 | - |
|
| 55 | - if (@file_exists(_FILE_CHMOD_TMP)) { |
|
| 56 | - include(_FILE_CHMOD_TMP); |
|
| 57 | - } else { |
|
| 58 | - redirige_url_ecrire('install'); |
|
| 59 | - } |
|
| 60 | - |
|
| 61 | - if (!@file_exists(_FILE_CONNECT_TMP)) { |
|
| 62 | - redirige_url_ecrire('install'); |
|
| 63 | - } |
|
| 64 | - |
|
| 65 | - # maintenant on connait le vrai charset du site s'il est deja configure |
|
| 66 | - # sinon par defaut lire_meta reglera _DEFAULT_CHARSET |
|
| 67 | - # (les donnees arrivent de toute facon postees en _DEFAULT_CHARSET) |
|
| 68 | - |
|
| 69 | - lire_metas(); |
|
| 70 | - if ($login) { |
|
| 71 | - include_spip('inc/charsets'); |
|
| 72 | - |
|
| 73 | - $nom = (importer_charset($nom, _DEFAULT_CHARSET)); |
|
| 74 | - $login = (importer_charset($login, _DEFAULT_CHARSET)); |
|
| 75 | - $email = (importer_charset($email, _DEFAULT_CHARSET)); |
|
| 76 | - |
|
| 77 | - include_spip('auth/spip'); |
|
| 78 | - // prelablement, creer le champ webmestre si il n'existe pas (install neuve |
|
| 79 | - // sur une vieille base |
|
| 80 | - $t = sql_showtable('spip_auteurs', true); |
|
| 81 | - if (!isset($t['field']['webmestre'])) { |
|
| 82 | - @sql_alter("TABLE spip_auteurs ADD webmestre varchar(3) DEFAULT 'non' NOT NULL"); |
|
| 83 | - } |
|
| 84 | - |
|
| 85 | - // il faut avoir une cle des auth valide pour creer un nouvel auteur webmestre |
|
| 86 | - $cles = \Spip\Chiffrer\SpipCles::instance(); |
|
| 87 | - $secret = $cles->getSecretAuth(); |
|
| 88 | - |
|
| 89 | - $id_auteur = sql_getfetsel('id_auteur', 'spip_auteurs', 'login=' . sql_quote($login)); |
|
| 90 | - if ($id_auteur !== null) { |
|
| 91 | - // c'est un auteur connu : si on a pas de secret il faut absolument qu'il se reconnecte avec le meme mot de passe |
|
| 92 | - // pour restaurer la copie des cles |
|
| 93 | - if (!$secret && !auth_spip_initialiser_secret()) { |
|
| 94 | - $row = sql_fetsel('backup_cles, pass', 'spip_auteurs', 'id_auteur=' . (int) $id_auteur); |
|
| 95 | - if (empty($row['backup_cles']) || !$cles->restore($row['backup_cles'], $pass, $row['pass'], $id_auteur)) { |
|
| 96 | - $echec = _T('avis_connexion_erreur_fichier_cle_manquant_1'); |
|
| 97 | - echouer_etape_3b($echec); |
|
| 98 | - } |
|
| 99 | - spip_log("Les cles secretes ont ete restaurées avec le backup du webmestre #$id_auteur", 'auth' . _LOG_INFO_IMPORTANTE); |
|
| 100 | - $cles->save(); |
|
| 101 | - } |
|
| 102 | - |
|
| 103 | - sql_updateq('spip_auteurs', [ |
|
| 104 | - 'nom' => $nom, |
|
| 105 | - 'email' => $email, |
|
| 106 | - 'login' => $login, |
|
| 107 | - 'statut' => '0minirezo' |
|
| 108 | - ], 'id_auteur=' . (int) $id_auteur); |
|
| 109 | - // le passer webmestre separement du reste, au cas ou l'alter n'aurait pas fonctionne |
|
| 110 | - @sql_updateq('spip_auteurs', ['webmestre' => 'oui'], "id_auteur=$id_auteur"); |
|
| 111 | - if (!auth_spip_modifier_pass($login, $pass, $id_auteur)) { |
|
| 112 | - $echec = _T('avis_erreur_creation_compte'); |
|
| 113 | - echouer_etape_3b($echec); |
|
| 114 | - } |
|
| 115 | - } else { |
|
| 116 | - // Si on a pas de cle et qu'on ne sait pas la creer, on ne peut pas creer de nouveau compte : |
|
| 117 | - // il faut qu'un webmestre avec un backup fasse l'install |
|
| 118 | - if (!$secret && !auth_spip_initialiser_secret()) { |
|
| 119 | - $echec = _T('avis_connexion_erreur_fichier_cle_manquant_2'); |
|
| 120 | - echouer_etape_3b($echec); |
|
| 121 | - } |
|
| 122 | - |
|
| 123 | - $id_auteur = sql_insertq('spip_auteurs', [ |
|
| 124 | - 'nom' => $nom, |
|
| 125 | - 'email' => $email, |
|
| 126 | - 'login' => $login, |
|
| 127 | - 'statut' => '0minirezo' |
|
| 128 | - ]); |
|
| 129 | - // le passer webmestre separrement du reste, au cas ou l'alter n'aurait pas fonctionne |
|
| 130 | - @sql_updateq('spip_auteurs', ['webmestre' => 'oui'], "id_auteur=$id_auteur"); |
|
| 131 | - if (!auth_spip_modifier_pass($login, $pass, $id_auteur)) { |
|
| 132 | - $echec = _T('avis_erreur_creation_compte'); |
|
| 133 | - echouer_etape_3b($echec); |
|
| 134 | - } |
|
| 135 | - } |
|
| 136 | - |
|
| 137 | - // inserer email comme email webmaster principal |
|
| 138 | - // (sauf s'il est vide: cas de la re-installation) |
|
| 139 | - if ($email) { |
|
| 140 | - ecrire_meta('email_webmaster', $email); |
|
| 141 | - } |
|
| 142 | - |
|
| 143 | - // Connecter directement celui qui vient de (re)donner son login |
|
| 144 | - // mais sans cookie d'admin ni connexion longue |
|
| 145 | - include_spip('inc/auth'); |
|
| 146 | - $auteur = auth_identifier_login($login, $pass); |
|
| 147 | - if (!$auteur || !auth_loger($auteur)) { |
|
| 148 | - spip_log("login automatique impossible $auth_spip $session" . (is_countable($row) ? count($row) : 0)); |
|
| 149 | - } |
|
| 150 | - } |
|
| 151 | - |
|
| 152 | - // installer les metas |
|
| 153 | - $config = charger_fonction('config', 'inc'); |
|
| 154 | - $config(); |
|
| 155 | - |
|
| 156 | - // activer les plugins |
|
| 157 | - // leur installation ne peut pas se faire sur le meme hit, il faudra donc |
|
| 158 | - // poursuivre au hit suivant |
|
| 159 | - include_spip('inc/plugin'); |
|
| 160 | - actualise_plugins_actifs(); |
|
| 161 | - |
|
| 162 | - |
|
| 163 | - include_spip('inc/distant'); |
|
| 164 | - redirige_par_entete(parametre_url(self(), 'etape', '4', '&')); |
|
| 19 | + $auth_spip = null; |
|
| 20 | + $session = null; |
|
| 21 | + $row = null; |
|
| 22 | + $login = _request('login'); |
|
| 23 | + $email = _request('email'); |
|
| 24 | + $nom = _request('nom'); |
|
| 25 | + $pass = _request('pass'); |
|
| 26 | + $pass_verif = _request('pass_verif'); |
|
| 27 | + |
|
| 28 | + $server_db = defined('_INSTALL_SERVER_DB') |
|
| 29 | + ? _INSTALL_SERVER_DB |
|
| 30 | + : _request('server_db'); |
|
| 31 | + |
|
| 32 | + if (!defined('_PASS_LONGUEUR_MINI')) { |
|
| 33 | + define('_PASS_LONGUEUR_MINI', 6); |
|
| 34 | + } |
|
| 35 | + if (!defined('_LOGIN_TROP_COURT')) { |
|
| 36 | + define('_LOGIN_TROP_COURT', 4); |
|
| 37 | + } |
|
| 38 | + if ($login) { |
|
| 39 | + $echec = ($pass != $pass_verif) ? |
|
| 40 | + _T('info_passes_identiques') |
|
| 41 | + : ((strlen((string) $pass) < _PASS_LONGUEUR_MINI) ? |
|
| 42 | + _T('info_passe_trop_court_car_pluriel', ['nb' => _PASS_LONGUEUR_MINI]) |
|
| 43 | + : ((strlen((string) $login) < _LOGIN_TROP_COURT) ? |
|
| 44 | + _T('info_login_trop_court') |
|
| 45 | + : '')); |
|
| 46 | + include_spip('inc/filtres'); |
|
| 47 | + if (!$echec && $email && !email_valide($email)) { |
|
| 48 | + $echec = _T('form_email_non_valide'); |
|
| 49 | + } |
|
| 50 | + if ($echec) { |
|
| 51 | + echouer_etape_3b($echec); |
|
| 52 | + } |
|
| 53 | + } |
|
| 54 | + |
|
| 55 | + if (@file_exists(_FILE_CHMOD_TMP)) { |
|
| 56 | + include(_FILE_CHMOD_TMP); |
|
| 57 | + } else { |
|
| 58 | + redirige_url_ecrire('install'); |
|
| 59 | + } |
|
| 60 | + |
|
| 61 | + if (!@file_exists(_FILE_CONNECT_TMP)) { |
|
| 62 | + redirige_url_ecrire('install'); |
|
| 63 | + } |
|
| 64 | + |
|
| 65 | + # maintenant on connait le vrai charset du site s'il est deja configure |
|
| 66 | + # sinon par defaut lire_meta reglera _DEFAULT_CHARSET |
|
| 67 | + # (les donnees arrivent de toute facon postees en _DEFAULT_CHARSET) |
|
| 68 | + |
|
| 69 | + lire_metas(); |
|
| 70 | + if ($login) { |
|
| 71 | + include_spip('inc/charsets'); |
|
| 72 | + |
|
| 73 | + $nom = (importer_charset($nom, _DEFAULT_CHARSET)); |
|
| 74 | + $login = (importer_charset($login, _DEFAULT_CHARSET)); |
|
| 75 | + $email = (importer_charset($email, _DEFAULT_CHARSET)); |
|
| 76 | + |
|
| 77 | + include_spip('auth/spip'); |
|
| 78 | + // prelablement, creer le champ webmestre si il n'existe pas (install neuve |
|
| 79 | + // sur une vieille base |
|
| 80 | + $t = sql_showtable('spip_auteurs', true); |
|
| 81 | + if (!isset($t['field']['webmestre'])) { |
|
| 82 | + @sql_alter("TABLE spip_auteurs ADD webmestre varchar(3) DEFAULT 'non' NOT NULL"); |
|
| 83 | + } |
|
| 84 | + |
|
| 85 | + // il faut avoir une cle des auth valide pour creer un nouvel auteur webmestre |
|
| 86 | + $cles = \Spip\Chiffrer\SpipCles::instance(); |
|
| 87 | + $secret = $cles->getSecretAuth(); |
|
| 88 | + |
|
| 89 | + $id_auteur = sql_getfetsel('id_auteur', 'spip_auteurs', 'login=' . sql_quote($login)); |
|
| 90 | + if ($id_auteur !== null) { |
|
| 91 | + // c'est un auteur connu : si on a pas de secret il faut absolument qu'il se reconnecte avec le meme mot de passe |
|
| 92 | + // pour restaurer la copie des cles |
|
| 93 | + if (!$secret && !auth_spip_initialiser_secret()) { |
|
| 94 | + $row = sql_fetsel('backup_cles, pass', 'spip_auteurs', 'id_auteur=' . (int) $id_auteur); |
|
| 95 | + if (empty($row['backup_cles']) || !$cles->restore($row['backup_cles'], $pass, $row['pass'], $id_auteur)) { |
|
| 96 | + $echec = _T('avis_connexion_erreur_fichier_cle_manquant_1'); |
|
| 97 | + echouer_etape_3b($echec); |
|
| 98 | + } |
|
| 99 | + spip_log("Les cles secretes ont ete restaurées avec le backup du webmestre #$id_auteur", 'auth' . _LOG_INFO_IMPORTANTE); |
|
| 100 | + $cles->save(); |
|
| 101 | + } |
|
| 102 | + |
|
| 103 | + sql_updateq('spip_auteurs', [ |
|
| 104 | + 'nom' => $nom, |
|
| 105 | + 'email' => $email, |
|
| 106 | + 'login' => $login, |
|
| 107 | + 'statut' => '0minirezo' |
|
| 108 | + ], 'id_auteur=' . (int) $id_auteur); |
|
| 109 | + // le passer webmestre separement du reste, au cas ou l'alter n'aurait pas fonctionne |
|
| 110 | + @sql_updateq('spip_auteurs', ['webmestre' => 'oui'], "id_auteur=$id_auteur"); |
|
| 111 | + if (!auth_spip_modifier_pass($login, $pass, $id_auteur)) { |
|
| 112 | + $echec = _T('avis_erreur_creation_compte'); |
|
| 113 | + echouer_etape_3b($echec); |
|
| 114 | + } |
|
| 115 | + } else { |
|
| 116 | + // Si on a pas de cle et qu'on ne sait pas la creer, on ne peut pas creer de nouveau compte : |
|
| 117 | + // il faut qu'un webmestre avec un backup fasse l'install |
|
| 118 | + if (!$secret && !auth_spip_initialiser_secret()) { |
|
| 119 | + $echec = _T('avis_connexion_erreur_fichier_cle_manquant_2'); |
|
| 120 | + echouer_etape_3b($echec); |
|
| 121 | + } |
|
| 122 | + |
|
| 123 | + $id_auteur = sql_insertq('spip_auteurs', [ |
|
| 124 | + 'nom' => $nom, |
|
| 125 | + 'email' => $email, |
|
| 126 | + 'login' => $login, |
|
| 127 | + 'statut' => '0minirezo' |
|
| 128 | + ]); |
|
| 129 | + // le passer webmestre separrement du reste, au cas ou l'alter n'aurait pas fonctionne |
|
| 130 | + @sql_updateq('spip_auteurs', ['webmestre' => 'oui'], "id_auteur=$id_auteur"); |
|
| 131 | + if (!auth_spip_modifier_pass($login, $pass, $id_auteur)) { |
|
| 132 | + $echec = _T('avis_erreur_creation_compte'); |
|
| 133 | + echouer_etape_3b($echec); |
|
| 134 | + } |
|
| 135 | + } |
|
| 136 | + |
|
| 137 | + // inserer email comme email webmaster principal |
|
| 138 | + // (sauf s'il est vide: cas de la re-installation) |
|
| 139 | + if ($email) { |
|
| 140 | + ecrire_meta('email_webmaster', $email); |
|
| 141 | + } |
|
| 142 | + |
|
| 143 | + // Connecter directement celui qui vient de (re)donner son login |
|
| 144 | + // mais sans cookie d'admin ni connexion longue |
|
| 145 | + include_spip('inc/auth'); |
|
| 146 | + $auteur = auth_identifier_login($login, $pass); |
|
| 147 | + if (!$auteur || !auth_loger($auteur)) { |
|
| 148 | + spip_log("login automatique impossible $auth_spip $session" . (is_countable($row) ? count($row) : 0)); |
|
| 149 | + } |
|
| 150 | + } |
|
| 151 | + |
|
| 152 | + // installer les metas |
|
| 153 | + $config = charger_fonction('config', 'inc'); |
|
| 154 | + $config(); |
|
| 155 | + |
|
| 156 | + // activer les plugins |
|
| 157 | + // leur installation ne peut pas se faire sur le meme hit, il faudra donc |
|
| 158 | + // poursuivre au hit suivant |
|
| 159 | + include_spip('inc/plugin'); |
|
| 160 | + actualise_plugins_actifs(); |
|
| 161 | + |
|
| 162 | + |
|
| 163 | + include_spip('inc/distant'); |
|
| 164 | + redirige_par_entete(parametre_url(self(), 'etape', '4', '&')); |
|
| 165 | 165 | } |
| 166 | 166 | |
| 167 | 167 | function echouer_etape_3b($echec): never { |
| 168 | - echo minipres( |
|
| 169 | - 'AUTO', |
|
| 170 | - info_progression_etape(3, 'etape_', 'install/', true) . |
|
| 171 | - "<div class='error'><h3>$echec</h3>\n" . |
|
| 172 | - '<p>' . _T('avis_connexion_echec_2') . '</p>' . |
|
| 173 | - '</div>' |
|
| 174 | - ); |
|
| 175 | - exit; |
|
| 168 | + echo minipres( |
|
| 169 | + 'AUTO', |
|
| 170 | + info_progression_etape(3, 'etape_', 'install/', true) . |
|
| 171 | + "<div class='error'><h3>$echec</h3>\n" . |
|
| 172 | + '<p>' . _T('avis_connexion_echec_2') . '</p>' . |
|
| 173 | + '</div>' |
|
| 174 | + ); |
|
| 175 | + exit; |
|
| 176 | 176 | } |
@@ -86,17 +86,17 @@ discard block |
||
| 86 | 86 | $cles = \Spip\Chiffrer\SpipCles::instance(); |
| 87 | 87 | $secret = $cles->getSecretAuth(); |
| 88 | 88 | |
| 89 | - $id_auteur = sql_getfetsel('id_auteur', 'spip_auteurs', 'login=' . sql_quote($login)); |
|
| 89 | + $id_auteur = sql_getfetsel('id_auteur', 'spip_auteurs', 'login='.sql_quote($login)); |
|
| 90 | 90 | if ($id_auteur !== null) { |
| 91 | 91 | // c'est un auteur connu : si on a pas de secret il faut absolument qu'il se reconnecte avec le meme mot de passe |
| 92 | 92 | // pour restaurer la copie des cles |
| 93 | 93 | if (!$secret && !auth_spip_initialiser_secret()) { |
| 94 | - $row = sql_fetsel('backup_cles, pass', 'spip_auteurs', 'id_auteur=' . (int) $id_auteur); |
|
| 94 | + $row = sql_fetsel('backup_cles, pass', 'spip_auteurs', 'id_auteur='.(int) $id_auteur); |
|
| 95 | 95 | if (empty($row['backup_cles']) || !$cles->restore($row['backup_cles'], $pass, $row['pass'], $id_auteur)) { |
| 96 | 96 | $echec = _T('avis_connexion_erreur_fichier_cle_manquant_1'); |
| 97 | 97 | echouer_etape_3b($echec); |
| 98 | 98 | } |
| 99 | - spip_log("Les cles secretes ont ete restaurées avec le backup du webmestre #$id_auteur", 'auth' . _LOG_INFO_IMPORTANTE); |
|
| 99 | + spip_log("Les cles secretes ont ete restaurées avec le backup du webmestre #$id_auteur", 'auth'._LOG_INFO_IMPORTANTE); |
|
| 100 | 100 | $cles->save(); |
| 101 | 101 | } |
| 102 | 102 | |
@@ -105,7 +105,7 @@ discard block |
||
| 105 | 105 | 'email' => $email, |
| 106 | 106 | 'login' => $login, |
| 107 | 107 | 'statut' => '0minirezo' |
| 108 | - ], 'id_auteur=' . (int) $id_auteur); |
|
| 108 | + ], 'id_auteur='.(int) $id_auteur); |
|
| 109 | 109 | // le passer webmestre separement du reste, au cas ou l'alter n'aurait pas fonctionne |
| 110 | 110 | @sql_updateq('spip_auteurs', ['webmestre' => 'oui'], "id_auteur=$id_auteur"); |
| 111 | 111 | if (!auth_spip_modifier_pass($login, $pass, $id_auteur)) { |
@@ -145,7 +145,7 @@ discard block |
||
| 145 | 145 | include_spip('inc/auth'); |
| 146 | 146 | $auteur = auth_identifier_login($login, $pass); |
| 147 | 147 | if (!$auteur || !auth_loger($auteur)) { |
| 148 | - spip_log("login automatique impossible $auth_spip $session" . (is_countable($row) ? count($row) : 0)); |
|
| 148 | + spip_log("login automatique impossible $auth_spip $session".(is_countable($row) ? count($row) : 0)); |
|
| 149 | 149 | } |
| 150 | 150 | } |
| 151 | 151 | |
@@ -167,9 +167,9 @@ discard block |
||
| 167 | 167 | function echouer_etape_3b($echec): never { |
| 168 | 168 | echo minipres( |
| 169 | 169 | 'AUTO', |
| 170 | - info_progression_etape(3, 'etape_', 'install/', true) . |
|
| 171 | - "<div class='error'><h3>$echec</h3>\n" . |
|
| 172 | - '<p>' . _T('avis_connexion_echec_2') . '</p>' . |
|
| 170 | + info_progression_etape(3, 'etape_', 'install/', true). |
|
| 171 | + "<div class='error'><h3>$echec</h3>\n". |
|
| 172 | + '<p>'._T('avis_connexion_echec_2').'</p>'. |
|
| 173 | 173 | '</div>' |
| 174 | 174 | ); |
| 175 | 175 | exit; |
@@ -10,70 +10,70 @@ |
||
| 10 | 10 | \***************************************************************************/ |
| 11 | 11 | |
| 12 | 12 | if (!defined('_ECRIRE_INC_VERSION')) { |
| 13 | - return; |
|
| 13 | + return; |
|
| 14 | 14 | } |
| 15 | 15 | |
| 16 | 16 | include_spip('inc/headers'); |
| 17 | 17 | |
| 18 | 18 | function install_etape_4_dist() { |
| 19 | 19 | |
| 20 | - // creer le repertoire cache, qui sert partout ! |
|
| 21 | - if (!@file_exists(_DIR_CACHE)) { |
|
| 22 | - $rep = preg_replace(',' . _DIR_TMP . ',', '', (string) _DIR_CACHE); |
|
| 23 | - $rep = sous_repertoire(_DIR_TMP, $rep, true, true); |
|
| 24 | - } |
|
| 20 | + // creer le repertoire cache, qui sert partout ! |
|
| 21 | + if (!@file_exists(_DIR_CACHE)) { |
|
| 22 | + $rep = preg_replace(',' . _DIR_TMP . ',', '', (string) _DIR_CACHE); |
|
| 23 | + $rep = sous_repertoire(_DIR_TMP, $rep, true, true); |
|
| 24 | + } |
|
| 25 | 25 | |
| 26 | - $minipage = new Spip\Afficher\Minipage\Installation(); |
|
| 27 | - echo $minipage->installDebutPage(['onload' => 'document.getElementById(\'suivant\').focus();return false;']); |
|
| 26 | + $minipage = new Spip\Afficher\Minipage\Installation(); |
|
| 27 | + echo $minipage->installDebutPage(['onload' => 'document.getElementById(\'suivant\').focus();return false;']); |
|
| 28 | 28 | |
| 29 | - echo info_progression_etape(4, 'etape_', 'install/'); |
|
| 29 | + echo info_progression_etape(4, 'etape_', 'install/'); |
|
| 30 | 30 | |
| 31 | - echo "<div class='success'><b>" |
|
| 32 | - . _T('info_derniere_etape') |
|
| 33 | - . '</b><p>' |
|
| 34 | - . _T('info_utilisation_spip') |
|
| 35 | - . '</p></div>'; |
|
| 31 | + echo "<div class='success'><b>" |
|
| 32 | + . _T('info_derniere_etape') |
|
| 33 | + . '</b><p>' |
|
| 34 | + . _T('info_utilisation_spip') |
|
| 35 | + . '</p></div>'; |
|
| 36 | 36 | |
| 37 | 37 | |
| 38 | - echo '<p>' |
|
| 39 | - . _T( |
|
| 40 | - 'plugin_info_plugins_dist_1', |
|
| 41 | - ['plugins_dist' => '<tt>' . joli_repertoire(_DIR_PLUGINS_DIST) . '</tt>'] |
|
| 42 | - ) |
|
| 43 | - . '</p>'; |
|
| 38 | + echo '<p>' |
|
| 39 | + . _T( |
|
| 40 | + 'plugin_info_plugins_dist_1', |
|
| 41 | + ['plugins_dist' => '<tt>' . joli_repertoire(_DIR_PLUGINS_DIST) . '</tt>'] |
|
| 42 | + ) |
|
| 43 | + . '</p>'; |
|
| 44 | 44 | |
| 45 | - // installer les extensions |
|
| 46 | - include_spip('inc/plugin'); |
|
| 47 | - $afficher = charger_fonction('afficher_liste', 'plugins'); |
|
| 48 | - echo $afficher( |
|
| 49 | - self(), |
|
| 50 | - liste_plugin_files(_DIR_PLUGINS_DIST), |
|
| 51 | - [], |
|
| 52 | - [], |
|
| 53 | - _DIR_PLUGINS_DIST, |
|
| 54 | - 'afficher_nom_plugin' |
|
| 55 | - ); |
|
| 45 | + // installer les extensions |
|
| 46 | + include_spip('inc/plugin'); |
|
| 47 | + $afficher = charger_fonction('afficher_liste', 'plugins'); |
|
| 48 | + echo $afficher( |
|
| 49 | + self(), |
|
| 50 | + liste_plugin_files(_DIR_PLUGINS_DIST), |
|
| 51 | + [], |
|
| 52 | + [], |
|
| 53 | + _DIR_PLUGINS_DIST, |
|
| 54 | + 'afficher_nom_plugin' |
|
| 55 | + ); |
|
| 56 | 56 | |
| 57 | - // si la base de SPIP est up, on peut installer les plugins, sinon on passe cette etape |
|
| 58 | - // car les plugins supposent que la base de SPIP est dans son etat normal (mise a jour) |
|
| 59 | - // au premier passage dans l'espace prive on aura une demande d'upgrade qui se poursuit sur la page plugin |
|
| 60 | - // et procede alors a l'installation |
|
| 61 | - if ( |
|
| 62 | - !isset($GLOBALS['meta']['version_installee']) |
|
| 63 | - || $GLOBALS['spip_version_base'] == (str_replace(',', '.', (string) $GLOBALS['meta']['version_installee'])) |
|
| 64 | - ) { |
|
| 65 | - plugin_installes_meta(); |
|
| 66 | - } |
|
| 57 | + // si la base de SPIP est up, on peut installer les plugins, sinon on passe cette etape |
|
| 58 | + // car les plugins supposent que la base de SPIP est dans son etat normal (mise a jour) |
|
| 59 | + // au premier passage dans l'espace prive on aura une demande d'upgrade qui se poursuit sur la page plugin |
|
| 60 | + // et procede alors a l'installation |
|
| 61 | + if ( |
|
| 62 | + !isset($GLOBALS['meta']['version_installee']) |
|
| 63 | + || $GLOBALS['spip_version_base'] == (str_replace(',', '.', (string) $GLOBALS['meta']['version_installee'])) |
|
| 64 | + ) { |
|
| 65 | + plugin_installes_meta(); |
|
| 66 | + } |
|
| 67 | 67 | |
| 68 | - // mettre a jour si necessaire l'adresse du site |
|
| 69 | - // securite si on arrive plus a se loger |
|
| 70 | - include_spip('inc/config'); |
|
| 71 | - appliquer_adresse_site(''); |
|
| 68 | + // mettre a jour si necessaire l'adresse du site |
|
| 69 | + // securite si on arrive plus a se loger |
|
| 70 | + include_spip('inc/config'); |
|
| 71 | + appliquer_adresse_site(''); |
|
| 72 | 72 | |
| 73 | - // aller a la derniere etape qui clos l'install et redirige |
|
| 74 | - $suite = "\n<input type='hidden' name='etape' value='fin' />" |
|
| 75 | - . bouton_suivant(_T('login_espace_prive')); |
|
| 73 | + // aller a la derniere etape qui clos l'install et redirige |
|
| 74 | + $suite = "\n<input type='hidden' name='etape' value='fin' />" |
|
| 75 | + . bouton_suivant(_T('login_espace_prive')); |
|
| 76 | 76 | |
| 77 | - echo generer_form_ecrire('install', $suite); |
|
| 78 | - echo $minipage->installFinPage(); |
|
| 77 | + echo generer_form_ecrire('install', $suite); |
|
| 78 | + echo $minipage->installFinPage(); |
|
| 79 | 79 | } |
@@ -19,7 +19,7 @@ discard block |
||
| 19 | 19 | |
| 20 | 20 | // creer le repertoire cache, qui sert partout ! |
| 21 | 21 | if (!@file_exists(_DIR_CACHE)) { |
| 22 | - $rep = preg_replace(',' . _DIR_TMP . ',', '', (string) _DIR_CACHE); |
|
| 22 | + $rep = preg_replace(','._DIR_TMP.',', '', (string) _DIR_CACHE); |
|
| 23 | 23 | $rep = sous_repertoire(_DIR_TMP, $rep, true, true); |
| 24 | 24 | } |
| 25 | 25 | |
@@ -38,7 +38,7 @@ discard block |
||
| 38 | 38 | echo '<p>' |
| 39 | 39 | . _T( |
| 40 | 40 | 'plugin_info_plugins_dist_1', |
| 41 | - ['plugins_dist' => '<tt>' . joli_repertoire(_DIR_PLUGINS_DIST) . '</tt>'] |
|
| 41 | + ['plugins_dist' => '<tt>'.joli_repertoire(_DIR_PLUGINS_DIST).'</tt>'] |
|
| 42 | 42 | ) |
| 43 | 43 | . '</p>'; |
| 44 | 44 | |
@@ -10,7 +10,7 @@ discard block |
||
| 10 | 10 | \***************************************************************************/ |
| 11 | 11 | |
| 12 | 12 | if (!defined('_ECRIRE_INC_VERSION')) { |
| 13 | - return; |
|
| 13 | + return; |
|
| 14 | 14 | } |
| 15 | 15 | |
| 16 | 16 | include_spip('inc/headers'); |
@@ -18,199 +18,199 @@ discard block |
||
| 18 | 18 | |
| 19 | 19 | function install_bases($adresse_db, $login_db, $pass_db, $server_db, $choix_db, $sel_db, $chmod_db) { |
| 20 | 20 | |
| 21 | - // Prefix des tables : |
|
| 22 | - // S'il n'est pas defini par mes_options/inc/mutualiser, on va le creer |
|
| 23 | - // a partir de ce qui est envoye a l'installation |
|
| 24 | - if (!defined('_INSTALL_TABLE_PREFIX')) { |
|
| 25 | - $table_prefix = ($GLOBALS['table_prefix'] != 'spip') |
|
| 26 | - ? $GLOBALS['table_prefix'] |
|
| 27 | - : preparer_prefixe_tables(_request('tprefix')); |
|
| 28 | - // S'il est vide on remet spip |
|
| 29 | - if (!$table_prefix) { |
|
| 30 | - $table_prefix = 'spip'; |
|
| 31 | - } |
|
| 32 | - } else { |
|
| 33 | - $table_prefix = _INSTALL_TABLE_PREFIX; |
|
| 34 | - } |
|
| 35 | - |
|
| 36 | - if (preg_match(',(.*):(.*),', (string) $adresse_db, $r)) { |
|
| 37 | - [, $adresse_db, $port] = $r; |
|
| 38 | - } else { |
|
| 39 | - $port = ''; |
|
| 40 | - } |
|
| 41 | - |
|
| 42 | - $GLOBALS['connexions'][$server_db] |
|
| 43 | - = spip_connect_db($adresse_db, $port, $login_db, $pass_db, '', $server_db); |
|
| 44 | - |
|
| 45 | - $GLOBALS['connexions'][$server_db][$GLOBALS['spip_sql_version']] |
|
| 46 | - = $GLOBALS['spip_' . $server_db . '_functions_' . $GLOBALS['spip_sql_version']]; |
|
| 47 | - |
|
| 48 | - $fquery = sql_serveur('query', $server_db); |
|
| 49 | - if ($choix_db == 'new_spip') { |
|
| 50 | - $re = ',^[a-z_][a-z_0-9-]*$,i'; |
|
| 51 | - if (preg_match($re, (string) $sel_db)) { |
|
| 52 | - $ok = sql_create_base($sel_db, $server_db); |
|
| 53 | - if (!$ok) { |
|
| 54 | - $re = "Impossible de creer la base $re"; |
|
| 55 | - spip_log($re); |
|
| 56 | - return '<p>' . _T('avis_connexion_erreur_creer_base') . "</p><!--\n$re\n-->"; |
|
| 57 | - } |
|
| 58 | - } else { |
|
| 59 | - $re = "Le nom de la base doit correspondre a $re"; |
|
| 60 | - spip_log($re); |
|
| 61 | - |
|
| 62 | - return '<p>' . _T('avis_connexion_erreur_nom_base') . "</p><!--\n$re\n-->"; |
|
| 63 | - } |
|
| 64 | - } |
|
| 65 | - |
|
| 66 | - // on rejoue la connexion apres avoir teste si il faut lui indiquer |
|
| 67 | - // un sql_mode |
|
| 68 | - install_mode_appel($server_db, false); |
|
| 69 | - $GLOBALS['connexions'][$server_db] |
|
| 70 | - = spip_connect_db($adresse_db, $port, $login_db, $pass_db, $sel_db, $server_db); |
|
| 71 | - |
|
| 72 | - $GLOBALS['connexions'][$server_db][$GLOBALS['spip_sql_version']] |
|
| 73 | - = $GLOBALS['spip_' . $server_db . '_functions_' . $GLOBALS['spip_sql_version']]; |
|
| 74 | - |
|
| 75 | - // Completer le tableau decrivant la connexion |
|
| 76 | - |
|
| 77 | - $GLOBALS['connexions'][$server_db]['prefixe'] = $table_prefix; |
|
| 78 | - $GLOBALS['connexions'][$server_db]['db'] = $sel_db; |
|
| 79 | - |
|
| 80 | - $old = sql_showbase($table_prefix . '_meta', $server_db); |
|
| 81 | - if ($old) { |
|
| 82 | - $old = sql_fetch($old, $server_db); |
|
| 83 | - } |
|
| 84 | - if (!$old) { |
|
| 85 | - // Si possible, demander au serveur d'envoyer les textes |
|
| 86 | - // dans le codage std de SPIP, |
|
| 87 | - $charset = sql_get_charset(_DEFAULT_CHARSET, $server_db); |
|
| 88 | - |
|
| 89 | - if ($charset) { |
|
| 90 | - sql_set_charset($charset['charset'], $server_db); |
|
| 91 | - $GLOBALS['meta']['charset_sql_base'] = |
|
| 92 | - $charset['charset']; |
|
| 93 | - $GLOBALS['meta']['charset_collation_sql_base'] = |
|
| 94 | - $charset['collation']; |
|
| 95 | - $GLOBALS['meta']['charset_sql_connexion'] = |
|
| 96 | - $charset['charset']; |
|
| 97 | - $charsetbase = $charset['charset']; |
|
| 98 | - } else { |
|
| 99 | - spip_log(_DEFAULT_CHARSET . ' inconnu du serveur SQL'); |
|
| 100 | - $charsetbase = 'standard'; |
|
| 101 | - } |
|
| 102 | - spip_log("Creation des tables. Codage $charsetbase"); |
|
| 103 | - creer_base($server_db); // AT LAST |
|
| 104 | - // memoriser avec quel charset on l'a creee |
|
| 105 | - |
|
| 106 | - if ($charset) { |
|
| 107 | - $t = [ |
|
| 108 | - 'nom' => 'charset_sql_base', |
|
| 109 | - 'valeur' => $charset['charset'], |
|
| 110 | - 'impt' => 'non' |
|
| 111 | - ]; |
|
| 112 | - @sql_insertq('spip_meta', $t, [], $server_db); |
|
| 113 | - $t['nom'] = 'charset_collation_sql_base'; |
|
| 114 | - $t['valeur'] = $charset['collation']; |
|
| 115 | - @sql_insertq('spip_meta', $t, [], $server_db); |
|
| 116 | - $t['nom'] = 'charset_sql_connexion'; |
|
| 117 | - $t['valeur'] = $charset['charset']; |
|
| 118 | - @sql_insertq('spip_meta', $t, [], $server_db); |
|
| 119 | - } |
|
| 120 | - $t = [ |
|
| 121 | - 'nom' => 'version_installee', |
|
| 122 | - 'valeur' => $GLOBALS['spip_version_base'], |
|
| 123 | - 'impt' => 'non' |
|
| 124 | - ]; |
|
| 125 | - @sql_insertq('spip_meta', $t, [], $server_db); |
|
| 126 | - $t['nom'] = 'nouvelle_install'; |
|
| 127 | - $t['valeur'] = 1; |
|
| 128 | - @sql_insertq('spip_meta', $t, [], $server_db); |
|
| 129 | - // positionner la langue par defaut du site si un cookie de lang a ete mis |
|
| 130 | - if (isset($_COOKIE['spip_lang_ecrire'])) { |
|
| 131 | - @sql_insertq( |
|
| 132 | - 'spip_meta', |
|
| 133 | - ['nom' => 'langue_site', 'valeur' => $_COOKIE['spip_lang_ecrire']], |
|
| 134 | - [], |
|
| 135 | - $server_db |
|
| 136 | - ); |
|
| 137 | - } |
|
| 138 | - } else { |
|
| 139 | - // pour recreer les tables disparues au besoin |
|
| 140 | - spip_log('Table des Meta deja la. Verification des autres.'); |
|
| 141 | - creer_base($server_db); |
|
| 142 | - $fupdateq = sql_serveur('updateq', $server_db); |
|
| 143 | - |
|
| 144 | - $r = $fquery("SELECT valeur FROM spip_meta WHERE nom='version_installee'", $server_db); |
|
| 145 | - |
|
| 146 | - if ($r) { |
|
| 147 | - $r = sql_fetch($r, $server_db); |
|
| 148 | - } |
|
| 149 | - $version_installee = $r ? (double)$r['valeur'] : 0; |
|
| 150 | - if (!$version_installee || $GLOBALS['spip_version_base'] < $version_installee) { |
|
| 151 | - $fupdateq( |
|
| 152 | - 'spip_meta', |
|
| 153 | - ['valeur' => $GLOBALS['spip_version_base'], 'impt' => 'non'], |
|
| 154 | - "nom='version_installee'", |
|
| 155 | - '', |
|
| 156 | - $server_db |
|
| 157 | - ); |
|
| 158 | - spip_log('nouvelle version installee: ' . $GLOBALS['spip_version_base']); |
|
| 159 | - } |
|
| 160 | - // eliminer la derniere operation d'admin mal terminee |
|
| 161 | - // notamment la mise a jour |
|
| 162 | - @$fquery("DELETE FROM spip_meta WHERE nom='import_all' OR nom='admin'", $server_db); |
|
| 163 | - } |
|
| 164 | - |
|
| 165 | - // recuperer le charset de la connexion dans les meta |
|
| 166 | - $charset = ''; |
|
| 167 | - $r = $fquery("SELECT valeur FROM spip_meta WHERE nom='charset_sql_connexion'", $server_db); |
|
| 168 | - if ($r) { |
|
| 169 | - $r = sql_fetch($r, $server_db); |
|
| 170 | - } |
|
| 171 | - if ($r) { |
|
| 172 | - $charset = $r['valeur']; |
|
| 173 | - } |
|
| 174 | - |
|
| 175 | - $ligne_rappel = install_mode_appel($server_db); |
|
| 176 | - |
|
| 177 | - $result_ok = @$fquery('SELECT COUNT(*) FROM spip_meta', $server_db); |
|
| 178 | - if (!$result_ok) { |
|
| 179 | - return "<!--\nvielle = $old rappel= $ligne_rappel\n-->"; |
|
| 180 | - } |
|
| 181 | - |
|
| 182 | - if ($chmod_db) { |
|
| 183 | - install_fichier_connexion( |
|
| 184 | - _FILE_CHMOD_TMP, |
|
| 185 | - "if (!defined('_SPIP_CHMOD')) define('_SPIP_CHMOD', " . sprintf('0%3o', $chmod_db) . ");\n" |
|
| 186 | - ); |
|
| 187 | - } |
|
| 188 | - |
|
| 189 | - // si ce fichier existe a cette etape c'est qu'il provient |
|
| 190 | - // d'une installation qui ne l'a pas cree correctement. |
|
| 191 | - // Le supprimer pour que _FILE_CONNECT_TMP prime. |
|
| 192 | - |
|
| 193 | - if (_FILE_CONNECT && file_exists(_FILE_CONNECT)) { |
|
| 194 | - spip_unlink(_FILE_CONNECT); |
|
| 195 | - } |
|
| 196 | - |
|
| 197 | - install_fichier_connexion( |
|
| 198 | - _FILE_CONNECT_TMP, |
|
| 199 | - $ligne_rappel |
|
| 200 | - . install_connexion( |
|
| 201 | - $adresse_db, |
|
| 202 | - $port, |
|
| 203 | - $login_db, |
|
| 204 | - $pass_db, |
|
| 205 | - $sel_db, |
|
| 206 | - $server_db, |
|
| 207 | - $table_prefix, |
|
| 208 | - '', |
|
| 209 | - $charset |
|
| 210 | - ) |
|
| 211 | - ); |
|
| 212 | - |
|
| 213 | - return ''; |
|
| 21 | + // Prefix des tables : |
|
| 22 | + // S'il n'est pas defini par mes_options/inc/mutualiser, on va le creer |
|
| 23 | + // a partir de ce qui est envoye a l'installation |
|
| 24 | + if (!defined('_INSTALL_TABLE_PREFIX')) { |
|
| 25 | + $table_prefix = ($GLOBALS['table_prefix'] != 'spip') |
|
| 26 | + ? $GLOBALS['table_prefix'] |
|
| 27 | + : preparer_prefixe_tables(_request('tprefix')); |
|
| 28 | + // S'il est vide on remet spip |
|
| 29 | + if (!$table_prefix) { |
|
| 30 | + $table_prefix = 'spip'; |
|
| 31 | + } |
|
| 32 | + } else { |
|
| 33 | + $table_prefix = _INSTALL_TABLE_PREFIX; |
|
| 34 | + } |
|
| 35 | + |
|
| 36 | + if (preg_match(',(.*):(.*),', (string) $adresse_db, $r)) { |
|
| 37 | + [, $adresse_db, $port] = $r; |
|
| 38 | + } else { |
|
| 39 | + $port = ''; |
|
| 40 | + } |
|
| 41 | + |
|
| 42 | + $GLOBALS['connexions'][$server_db] |
|
| 43 | + = spip_connect_db($adresse_db, $port, $login_db, $pass_db, '', $server_db); |
|
| 44 | + |
|
| 45 | + $GLOBALS['connexions'][$server_db][$GLOBALS['spip_sql_version']] |
|
| 46 | + = $GLOBALS['spip_' . $server_db . '_functions_' . $GLOBALS['spip_sql_version']]; |
|
| 47 | + |
|
| 48 | + $fquery = sql_serveur('query', $server_db); |
|
| 49 | + if ($choix_db == 'new_spip') { |
|
| 50 | + $re = ',^[a-z_][a-z_0-9-]*$,i'; |
|
| 51 | + if (preg_match($re, (string) $sel_db)) { |
|
| 52 | + $ok = sql_create_base($sel_db, $server_db); |
|
| 53 | + if (!$ok) { |
|
| 54 | + $re = "Impossible de creer la base $re"; |
|
| 55 | + spip_log($re); |
|
| 56 | + return '<p>' . _T('avis_connexion_erreur_creer_base') . "</p><!--\n$re\n-->"; |
|
| 57 | + } |
|
| 58 | + } else { |
|
| 59 | + $re = "Le nom de la base doit correspondre a $re"; |
|
| 60 | + spip_log($re); |
|
| 61 | + |
|
| 62 | + return '<p>' . _T('avis_connexion_erreur_nom_base') . "</p><!--\n$re\n-->"; |
|
| 63 | + } |
|
| 64 | + } |
|
| 65 | + |
|
| 66 | + // on rejoue la connexion apres avoir teste si il faut lui indiquer |
|
| 67 | + // un sql_mode |
|
| 68 | + install_mode_appel($server_db, false); |
|
| 69 | + $GLOBALS['connexions'][$server_db] |
|
| 70 | + = spip_connect_db($adresse_db, $port, $login_db, $pass_db, $sel_db, $server_db); |
|
| 71 | + |
|
| 72 | + $GLOBALS['connexions'][$server_db][$GLOBALS['spip_sql_version']] |
|
| 73 | + = $GLOBALS['spip_' . $server_db . '_functions_' . $GLOBALS['spip_sql_version']]; |
|
| 74 | + |
|
| 75 | + // Completer le tableau decrivant la connexion |
|
| 76 | + |
|
| 77 | + $GLOBALS['connexions'][$server_db]['prefixe'] = $table_prefix; |
|
| 78 | + $GLOBALS['connexions'][$server_db]['db'] = $sel_db; |
|
| 79 | + |
|
| 80 | + $old = sql_showbase($table_prefix . '_meta', $server_db); |
|
| 81 | + if ($old) { |
|
| 82 | + $old = sql_fetch($old, $server_db); |
|
| 83 | + } |
|
| 84 | + if (!$old) { |
|
| 85 | + // Si possible, demander au serveur d'envoyer les textes |
|
| 86 | + // dans le codage std de SPIP, |
|
| 87 | + $charset = sql_get_charset(_DEFAULT_CHARSET, $server_db); |
|
| 88 | + |
|
| 89 | + if ($charset) { |
|
| 90 | + sql_set_charset($charset['charset'], $server_db); |
|
| 91 | + $GLOBALS['meta']['charset_sql_base'] = |
|
| 92 | + $charset['charset']; |
|
| 93 | + $GLOBALS['meta']['charset_collation_sql_base'] = |
|
| 94 | + $charset['collation']; |
|
| 95 | + $GLOBALS['meta']['charset_sql_connexion'] = |
|
| 96 | + $charset['charset']; |
|
| 97 | + $charsetbase = $charset['charset']; |
|
| 98 | + } else { |
|
| 99 | + spip_log(_DEFAULT_CHARSET . ' inconnu du serveur SQL'); |
|
| 100 | + $charsetbase = 'standard'; |
|
| 101 | + } |
|
| 102 | + spip_log("Creation des tables. Codage $charsetbase"); |
|
| 103 | + creer_base($server_db); // AT LAST |
|
| 104 | + // memoriser avec quel charset on l'a creee |
|
| 105 | + |
|
| 106 | + if ($charset) { |
|
| 107 | + $t = [ |
|
| 108 | + 'nom' => 'charset_sql_base', |
|
| 109 | + 'valeur' => $charset['charset'], |
|
| 110 | + 'impt' => 'non' |
|
| 111 | + ]; |
|
| 112 | + @sql_insertq('spip_meta', $t, [], $server_db); |
|
| 113 | + $t['nom'] = 'charset_collation_sql_base'; |
|
| 114 | + $t['valeur'] = $charset['collation']; |
|
| 115 | + @sql_insertq('spip_meta', $t, [], $server_db); |
|
| 116 | + $t['nom'] = 'charset_sql_connexion'; |
|
| 117 | + $t['valeur'] = $charset['charset']; |
|
| 118 | + @sql_insertq('spip_meta', $t, [], $server_db); |
|
| 119 | + } |
|
| 120 | + $t = [ |
|
| 121 | + 'nom' => 'version_installee', |
|
| 122 | + 'valeur' => $GLOBALS['spip_version_base'], |
|
| 123 | + 'impt' => 'non' |
|
| 124 | + ]; |
|
| 125 | + @sql_insertq('spip_meta', $t, [], $server_db); |
|
| 126 | + $t['nom'] = 'nouvelle_install'; |
|
| 127 | + $t['valeur'] = 1; |
|
| 128 | + @sql_insertq('spip_meta', $t, [], $server_db); |
|
| 129 | + // positionner la langue par defaut du site si un cookie de lang a ete mis |
|
| 130 | + if (isset($_COOKIE['spip_lang_ecrire'])) { |
|
| 131 | + @sql_insertq( |
|
| 132 | + 'spip_meta', |
|
| 133 | + ['nom' => 'langue_site', 'valeur' => $_COOKIE['spip_lang_ecrire']], |
|
| 134 | + [], |
|
| 135 | + $server_db |
|
| 136 | + ); |
|
| 137 | + } |
|
| 138 | + } else { |
|
| 139 | + // pour recreer les tables disparues au besoin |
|
| 140 | + spip_log('Table des Meta deja la. Verification des autres.'); |
|
| 141 | + creer_base($server_db); |
|
| 142 | + $fupdateq = sql_serveur('updateq', $server_db); |
|
| 143 | + |
|
| 144 | + $r = $fquery("SELECT valeur FROM spip_meta WHERE nom='version_installee'", $server_db); |
|
| 145 | + |
|
| 146 | + if ($r) { |
|
| 147 | + $r = sql_fetch($r, $server_db); |
|
| 148 | + } |
|
| 149 | + $version_installee = $r ? (double)$r['valeur'] : 0; |
|
| 150 | + if (!$version_installee || $GLOBALS['spip_version_base'] < $version_installee) { |
|
| 151 | + $fupdateq( |
|
| 152 | + 'spip_meta', |
|
| 153 | + ['valeur' => $GLOBALS['spip_version_base'], 'impt' => 'non'], |
|
| 154 | + "nom='version_installee'", |
|
| 155 | + '', |
|
| 156 | + $server_db |
|
| 157 | + ); |
|
| 158 | + spip_log('nouvelle version installee: ' . $GLOBALS['spip_version_base']); |
|
| 159 | + } |
|
| 160 | + // eliminer la derniere operation d'admin mal terminee |
|
| 161 | + // notamment la mise a jour |
|
| 162 | + @$fquery("DELETE FROM spip_meta WHERE nom='import_all' OR nom='admin'", $server_db); |
|
| 163 | + } |
|
| 164 | + |
|
| 165 | + // recuperer le charset de la connexion dans les meta |
|
| 166 | + $charset = ''; |
|
| 167 | + $r = $fquery("SELECT valeur FROM spip_meta WHERE nom='charset_sql_connexion'", $server_db); |
|
| 168 | + if ($r) { |
|
| 169 | + $r = sql_fetch($r, $server_db); |
|
| 170 | + } |
|
| 171 | + if ($r) { |
|
| 172 | + $charset = $r['valeur']; |
|
| 173 | + } |
|
| 174 | + |
|
| 175 | + $ligne_rappel = install_mode_appel($server_db); |
|
| 176 | + |
|
| 177 | + $result_ok = @$fquery('SELECT COUNT(*) FROM spip_meta', $server_db); |
|
| 178 | + if (!$result_ok) { |
|
| 179 | + return "<!--\nvielle = $old rappel= $ligne_rappel\n-->"; |
|
| 180 | + } |
|
| 181 | + |
|
| 182 | + if ($chmod_db) { |
|
| 183 | + install_fichier_connexion( |
|
| 184 | + _FILE_CHMOD_TMP, |
|
| 185 | + "if (!defined('_SPIP_CHMOD')) define('_SPIP_CHMOD', " . sprintf('0%3o', $chmod_db) . ");\n" |
|
| 186 | + ); |
|
| 187 | + } |
|
| 188 | + |
|
| 189 | + // si ce fichier existe a cette etape c'est qu'il provient |
|
| 190 | + // d'une installation qui ne l'a pas cree correctement. |
|
| 191 | + // Le supprimer pour que _FILE_CONNECT_TMP prime. |
|
| 192 | + |
|
| 193 | + if (_FILE_CONNECT && file_exists(_FILE_CONNECT)) { |
|
| 194 | + spip_unlink(_FILE_CONNECT); |
|
| 195 | + } |
|
| 196 | + |
|
| 197 | + install_fichier_connexion( |
|
| 198 | + _FILE_CONNECT_TMP, |
|
| 199 | + $ligne_rappel |
|
| 200 | + . install_connexion( |
|
| 201 | + $adresse_db, |
|
| 202 | + $port, |
|
| 203 | + $login_db, |
|
| 204 | + $pass_db, |
|
| 205 | + $sel_db, |
|
| 206 | + $server_db, |
|
| 207 | + $table_prefix, |
|
| 208 | + '', |
|
| 209 | + $charset |
|
| 210 | + ) |
|
| 211 | + ); |
|
| 212 | + |
|
| 213 | + return ''; |
|
| 214 | 214 | } |
| 215 | 215 | |
| 216 | 216 | /** |
@@ -225,166 +225,166 @@ discard block |
||
| 225 | 225 | * @return string Le préfixe corrigé |
| 226 | 226 | */ |
| 227 | 227 | function preparer_prefixe_tables($prefixe) { |
| 228 | - return trim(preg_replace(',^\d+,', '', preg_replace(',[^a-z0-9],', '', strtolower($prefixe)))); |
|
| 228 | + return trim(preg_replace(',^\d+,', '', preg_replace(',[^a-z0-9],', '', strtolower($prefixe)))); |
|
| 229 | 229 | } |
| 230 | 230 | |
| 231 | 231 | function install_propose_ldap() { |
| 232 | - return generer_form_ecrire('install', ( |
|
| 233 | - fieldset( |
|
| 234 | - _T('info_authentification_externe'), |
|
| 235 | - [ |
|
| 236 | - 'etape' => [ |
|
| 237 | - 'label' => _T('texte_annuaire_ldap_1'), |
|
| 238 | - 'valeur' => 'ldap1', |
|
| 239 | - 'hidden' => true |
|
| 240 | - ] |
|
| 241 | - ], |
|
| 242 | - bouton_suivant(_T('bouton_acces_ldap')) |
|
| 243 | - ))); |
|
| 232 | + return generer_form_ecrire('install', ( |
|
| 233 | + fieldset( |
|
| 234 | + _T('info_authentification_externe'), |
|
| 235 | + [ |
|
| 236 | + 'etape' => [ |
|
| 237 | + 'label' => _T('texte_annuaire_ldap_1'), |
|
| 238 | + 'valeur' => 'ldap1', |
|
| 239 | + 'hidden' => true |
|
| 240 | + ] |
|
| 241 | + ], |
|
| 242 | + bouton_suivant(_T('bouton_acces_ldap')) |
|
| 243 | + ))); |
|
| 244 | 244 | } |
| 245 | 245 | |
| 246 | 246 | |
| 247 | 247 | function install_premier_auteur($email, $login, $nom, #[\SensitiveParameter] $pass, $hidden, $auteur_obligatoire) { |
| 248 | - return info_progression_etape(3, 'etape_', 'install/') . |
|
| 249 | - info_etape( |
|
| 250 | - _T('info_informations_personnelles'), |
|
| 251 | - '<b>' . _T('texte_informations_personnelles_1') . '</b>' . |
|
| 252 | - aider('install5', true) . |
|
| 253 | - '<p>' . |
|
| 254 | - ($auteur_obligatoire ? |
|
| 255 | - '' |
|
| 256 | - : |
|
| 257 | - _T('texte_informations_personnelles_2') . ' ' . _T('info_laisser_champs_vides') |
|
| 258 | - ) |
|
| 259 | - ) |
|
| 260 | - . generer_form_ecrire('install', ( |
|
| 261 | - "\n<input type='hidden' name='etape' value='3b' />" |
|
| 262 | - . $hidden |
|
| 263 | - . fieldset( |
|
| 264 | - _T('info_identification_publique'), |
|
| 265 | - [ |
|
| 266 | - 'nom' => [ |
|
| 267 | - 'label' => '<b>' . _T('entree_signature') . "</b><br />\n" . _T('entree_nom_pseudo_1') . "\n", |
|
| 268 | - 'valeur' => $nom, |
|
| 269 | - 'required' => $auteur_obligatoire, |
|
| 270 | - ], |
|
| 271 | - 'email' => [ |
|
| 272 | - 'label' => '<b>' . _T('entree_adresse_email') . "</b>\n", |
|
| 273 | - 'valeur' => $email, |
|
| 274 | - ] |
|
| 275 | - ] |
|
| 276 | - ) |
|
| 277 | - |
|
| 278 | - . fieldset( |
|
| 279 | - _T('entree_identifiants_connexion'), |
|
| 280 | - [ |
|
| 281 | - 'login' => [ |
|
| 282 | - 'label' => '<b>' . _T('entree_login') . "</b><br />\n" . _T( |
|
| 283 | - 'info_login_trop_court_car_pluriel', |
|
| 284 | - ['nb' => _LOGIN_TROP_COURT] |
|
| 285 | - ) . "\n", |
|
| 286 | - 'valeur' => $login, |
|
| 287 | - 'required' => $auteur_obligatoire, |
|
| 288 | - ], |
|
| 289 | - 'pass' => [ |
|
| 290 | - 'label' => '<b>' . _T('entree_mot_passe') . "</b><br />\n" . _T( |
|
| 291 | - 'info_passe_trop_court_car_pluriel', |
|
| 292 | - ['nb' => _PASS_LONGUEUR_MINI] |
|
| 293 | - ) . "\n", |
|
| 294 | - 'valeur' => $pass, |
|
| 295 | - 'required' => $auteur_obligatoire, |
|
| 296 | - ], |
|
| 297 | - 'pass_verif' => [ |
|
| 298 | - 'label' => '<b>' . _T('info_confirmer_passe') . "</b><br />\n", |
|
| 299 | - 'valeur' => $pass, |
|
| 300 | - 'required' => $auteur_obligatoire, |
|
| 301 | - ] |
|
| 302 | - ] |
|
| 303 | - ) |
|
| 304 | - . bouton_suivant())); |
|
| 248 | + return info_progression_etape(3, 'etape_', 'install/') . |
|
| 249 | + info_etape( |
|
| 250 | + _T('info_informations_personnelles'), |
|
| 251 | + '<b>' . _T('texte_informations_personnelles_1') . '</b>' . |
|
| 252 | + aider('install5', true) . |
|
| 253 | + '<p>' . |
|
| 254 | + ($auteur_obligatoire ? |
|
| 255 | + '' |
|
| 256 | + : |
|
| 257 | + _T('texte_informations_personnelles_2') . ' ' . _T('info_laisser_champs_vides') |
|
| 258 | + ) |
|
| 259 | + ) |
|
| 260 | + . generer_form_ecrire('install', ( |
|
| 261 | + "\n<input type='hidden' name='etape' value='3b' />" |
|
| 262 | + . $hidden |
|
| 263 | + . fieldset( |
|
| 264 | + _T('info_identification_publique'), |
|
| 265 | + [ |
|
| 266 | + 'nom' => [ |
|
| 267 | + 'label' => '<b>' . _T('entree_signature') . "</b><br />\n" . _T('entree_nom_pseudo_1') . "\n", |
|
| 268 | + 'valeur' => $nom, |
|
| 269 | + 'required' => $auteur_obligatoire, |
|
| 270 | + ], |
|
| 271 | + 'email' => [ |
|
| 272 | + 'label' => '<b>' . _T('entree_adresse_email') . "</b>\n", |
|
| 273 | + 'valeur' => $email, |
|
| 274 | + ] |
|
| 275 | + ] |
|
| 276 | + ) |
|
| 277 | + |
|
| 278 | + . fieldset( |
|
| 279 | + _T('entree_identifiants_connexion'), |
|
| 280 | + [ |
|
| 281 | + 'login' => [ |
|
| 282 | + 'label' => '<b>' . _T('entree_login') . "</b><br />\n" . _T( |
|
| 283 | + 'info_login_trop_court_car_pluriel', |
|
| 284 | + ['nb' => _LOGIN_TROP_COURT] |
|
| 285 | + ) . "\n", |
|
| 286 | + 'valeur' => $login, |
|
| 287 | + 'required' => $auteur_obligatoire, |
|
| 288 | + ], |
|
| 289 | + 'pass' => [ |
|
| 290 | + 'label' => '<b>' . _T('entree_mot_passe') . "</b><br />\n" . _T( |
|
| 291 | + 'info_passe_trop_court_car_pluriel', |
|
| 292 | + ['nb' => _PASS_LONGUEUR_MINI] |
|
| 293 | + ) . "\n", |
|
| 294 | + 'valeur' => $pass, |
|
| 295 | + 'required' => $auteur_obligatoire, |
|
| 296 | + ], |
|
| 297 | + 'pass_verif' => [ |
|
| 298 | + 'label' => '<b>' . _T('info_confirmer_passe') . "</b><br />\n", |
|
| 299 | + 'valeur' => $pass, |
|
| 300 | + 'required' => $auteur_obligatoire, |
|
| 301 | + ] |
|
| 302 | + ] |
|
| 303 | + ) |
|
| 304 | + . bouton_suivant())); |
|
| 305 | 305 | } |
| 306 | 306 | |
| 307 | 307 | function install_etape_3_dist() { |
| 308 | - $ldap_present = _request('ldap_present'); |
|
| 309 | - |
|
| 310 | - if (!$ldap_present) { |
|
| 311 | - $adresse_db = defined('_INSTALL_HOST_DB') |
|
| 312 | - ? _INSTALL_HOST_DB |
|
| 313 | - : _request('adresse_db'); |
|
| 314 | - |
|
| 315 | - $login_db = defined('_INSTALL_USER_DB') |
|
| 316 | - ? _INSTALL_USER_DB |
|
| 317 | - : _request('login_db'); |
|
| 318 | - |
|
| 319 | - $pass_db = defined('_INSTALL_PASS_DB') |
|
| 320 | - ? _INSTALL_PASS_DB |
|
| 321 | - : _request('pass_db'); |
|
| 322 | - |
|
| 323 | - $server_db = defined('_INSTALL_SERVER_DB') |
|
| 324 | - ? _INSTALL_SERVER_DB |
|
| 325 | - : _request('server_db'); |
|
| 326 | - |
|
| 327 | - $chmod_db = defined('_SPIP_CHMOD') |
|
| 328 | - ? _SPIP_CHMOD |
|
| 329 | - : _request('chmod'); |
|
| 330 | - |
|
| 331 | - $choix_db = defined('_INSTALL_NAME_DB') |
|
| 332 | - ? _INSTALL_NAME_DB |
|
| 333 | - : _request('choix_db'); |
|
| 334 | - |
|
| 335 | - $sel_db = ($choix_db == 'new_spip') |
|
| 336 | - ? _request('table_new') : $choix_db; |
|
| 337 | - |
|
| 338 | - $res = install_bases($adresse_db, $login_db, $pass_db, $server_db, $choix_db, $sel_db, $chmod_db); |
|
| 339 | - |
|
| 340 | - if ($res) { |
|
| 341 | - $res = info_progression_etape(2, 'etape_', 'install/', true) |
|
| 342 | - . "<div class='error'><h3>" . _T('avis_operation_echec') . '</h3>' |
|
| 343 | - . $res |
|
| 344 | - . '<p>' . _T('texte_operation_echec') . '</p>' |
|
| 345 | - . '</div>'; |
|
| 346 | - } |
|
| 347 | - } else { |
|
| 348 | - $res = ''; |
|
| 349 | - [$adresse_db, $login_db, $pass_db, $sel_db, $server_db] = analyse_fichier_connection(_FILE_CONNECT_TMP); |
|
| 350 | - $GLOBALS['connexions'][$server_db] = spip_connect_db($adresse_db, $sel_db, $login_db, $pass_db, $sel_db, $server_db); |
|
| 351 | - } |
|
| 352 | - |
|
| 353 | - if (!$res) { |
|
| 354 | - if (file_exists(_FILE_CONNECT_TMP)) { |
|
| 355 | - include(_FILE_CONNECT_TMP); |
|
| 356 | - } else { |
|
| 357 | - redirige_url_ecrire('install'); |
|
| 358 | - } |
|
| 359 | - |
|
| 360 | - if (file_exists(_FILE_CHMOD_TMP)) { |
|
| 361 | - include(_FILE_CHMOD_TMP); |
|
| 362 | - } else { |
|
| 363 | - redirige_url_ecrire('install'); |
|
| 364 | - } |
|
| 365 | - |
|
| 366 | - $hidden = predef_ou_cache($adresse_db, $login_db, $pass_db, $server_db) |
|
| 367 | - . (defined('_INSTALL_NAME_DB') ? '' |
|
| 368 | - : "\n<input type='hidden' name='sel_db' value=\"" . spip_htmlspecialchars($sel_db) . '" />'); |
|
| 369 | - |
|
| 370 | - $auteur_obligatoire = ($ldap_present ? 0 : !sql_countsel('spip_auteurs', '', '', '', $server_db)); |
|
| 371 | - |
|
| 372 | - $res = "<div class='success'><b>" |
|
| 373 | - . _T('info_base_installee') |
|
| 374 | - . '</b></div>' |
|
| 375 | - . install_premier_auteur( |
|
| 376 | - _request('email'), |
|
| 377 | - _request('login'), |
|
| 378 | - _request('nom'), |
|
| 379 | - _request('pass'), |
|
| 380 | - $hidden, |
|
| 381 | - $auteur_obligatoire |
|
| 382 | - ) |
|
| 383 | - . (($ldap_present || !function_exists('ldap_connect')) |
|
| 384 | - ? '' : install_propose_ldap()); |
|
| 385 | - } |
|
| 386 | - |
|
| 387 | - |
|
| 388 | - $minipage = new Spip\Afficher\Minipage\Installation(); |
|
| 389 | - echo $minipage->page($res); |
|
| 308 | + $ldap_present = _request('ldap_present'); |
|
| 309 | + |
|
| 310 | + if (!$ldap_present) { |
|
| 311 | + $adresse_db = defined('_INSTALL_HOST_DB') |
|
| 312 | + ? _INSTALL_HOST_DB |
|
| 313 | + : _request('adresse_db'); |
|
| 314 | + |
|
| 315 | + $login_db = defined('_INSTALL_USER_DB') |
|
| 316 | + ? _INSTALL_USER_DB |
|
| 317 | + : _request('login_db'); |
|
| 318 | + |
|
| 319 | + $pass_db = defined('_INSTALL_PASS_DB') |
|
| 320 | + ? _INSTALL_PASS_DB |
|
| 321 | + : _request('pass_db'); |
|
| 322 | + |
|
| 323 | + $server_db = defined('_INSTALL_SERVER_DB') |
|
| 324 | + ? _INSTALL_SERVER_DB |
|
| 325 | + : _request('server_db'); |
|
| 326 | + |
|
| 327 | + $chmod_db = defined('_SPIP_CHMOD') |
|
| 328 | + ? _SPIP_CHMOD |
|
| 329 | + : _request('chmod'); |
|
| 330 | + |
|
| 331 | + $choix_db = defined('_INSTALL_NAME_DB') |
|
| 332 | + ? _INSTALL_NAME_DB |
|
| 333 | + : _request('choix_db'); |
|
| 334 | + |
|
| 335 | + $sel_db = ($choix_db == 'new_spip') |
|
| 336 | + ? _request('table_new') : $choix_db; |
|
| 337 | + |
|
| 338 | + $res = install_bases($adresse_db, $login_db, $pass_db, $server_db, $choix_db, $sel_db, $chmod_db); |
|
| 339 | + |
|
| 340 | + if ($res) { |
|
| 341 | + $res = info_progression_etape(2, 'etape_', 'install/', true) |
|
| 342 | + . "<div class='error'><h3>" . _T('avis_operation_echec') . '</h3>' |
|
| 343 | + . $res |
|
| 344 | + . '<p>' . _T('texte_operation_echec') . '</p>' |
|
| 345 | + . '</div>'; |
|
| 346 | + } |
|
| 347 | + } else { |
|
| 348 | + $res = ''; |
|
| 349 | + [$adresse_db, $login_db, $pass_db, $sel_db, $server_db] = analyse_fichier_connection(_FILE_CONNECT_TMP); |
|
| 350 | + $GLOBALS['connexions'][$server_db] = spip_connect_db($adresse_db, $sel_db, $login_db, $pass_db, $sel_db, $server_db); |
|
| 351 | + } |
|
| 352 | + |
|
| 353 | + if (!$res) { |
|
| 354 | + if (file_exists(_FILE_CONNECT_TMP)) { |
|
| 355 | + include(_FILE_CONNECT_TMP); |
|
| 356 | + } else { |
|
| 357 | + redirige_url_ecrire('install'); |
|
| 358 | + } |
|
| 359 | + |
|
| 360 | + if (file_exists(_FILE_CHMOD_TMP)) { |
|
| 361 | + include(_FILE_CHMOD_TMP); |
|
| 362 | + } else { |
|
| 363 | + redirige_url_ecrire('install'); |
|
| 364 | + } |
|
| 365 | + |
|
| 366 | + $hidden = predef_ou_cache($adresse_db, $login_db, $pass_db, $server_db) |
|
| 367 | + . (defined('_INSTALL_NAME_DB') ? '' |
|
| 368 | + : "\n<input type='hidden' name='sel_db' value=\"" . spip_htmlspecialchars($sel_db) . '" />'); |
|
| 369 | + |
|
| 370 | + $auteur_obligatoire = ($ldap_present ? 0 : !sql_countsel('spip_auteurs', '', '', '', $server_db)); |
|
| 371 | + |
|
| 372 | + $res = "<div class='success'><b>" |
|
| 373 | + . _T('info_base_installee') |
|
| 374 | + . '</b></div>' |
|
| 375 | + . install_premier_auteur( |
|
| 376 | + _request('email'), |
|
| 377 | + _request('login'), |
|
| 378 | + _request('nom'), |
|
| 379 | + _request('pass'), |
|
| 380 | + $hidden, |
|
| 381 | + $auteur_obligatoire |
|
| 382 | + ) |
|
| 383 | + . (($ldap_present || !function_exists('ldap_connect')) |
|
| 384 | + ? '' : install_propose_ldap()); |
|
| 385 | + } |
|
| 386 | + |
|
| 387 | + |
|
| 388 | + $minipage = new Spip\Afficher\Minipage\Installation(); |
|
| 389 | + echo $minipage->page($res); |
|
| 390 | 390 | } |
@@ -10,7 +10,7 @@ discard block |
||
| 10 | 10 | \***************************************************************************/ |
| 11 | 11 | |
| 12 | 12 | if (!defined('_ECRIRE_INC_VERSION')) { |
| 13 | - return; |
|
| 13 | + return; |
|
| 14 | 14 | } |
| 15 | 15 | include_spip('inc/charsets'); |
| 16 | 16 | |
@@ -26,90 +26,90 @@ discard block |
||
| 26 | 26 | * @return string |
| 27 | 27 | */ |
| 28 | 28 | function plugins_afficher_liste_dist( |
| 29 | - $url_page, |
|
| 30 | - $liste_plugins, |
|
| 31 | - $liste_plugins_checked, |
|
| 32 | - $liste_plugins_actifs, |
|
| 33 | - $dir_plugins = _DIR_PLUGINS, |
|
| 34 | - $afficher_un = 'afficher_plugin' |
|
| 29 | + $url_page, |
|
| 30 | + $liste_plugins, |
|
| 31 | + $liste_plugins_checked, |
|
| 32 | + $liste_plugins_actifs, |
|
| 33 | + $dir_plugins = _DIR_PLUGINS, |
|
| 34 | + $afficher_un = 'afficher_plugin' |
|
| 35 | 35 | ) { |
| 36 | - $get_infos = charger_fonction('get_infos', 'plugins'); |
|
| 37 | - $ligne_plug = charger_fonction($afficher_un, 'plugins'); |
|
| 36 | + $get_infos = charger_fonction('get_infos', 'plugins'); |
|
| 37 | + $ligne_plug = charger_fonction($afficher_un, 'plugins'); |
|
| 38 | 38 | |
| 39 | - $all_infos = $get_infos($liste_plugins, false, $dir_plugins); |
|
| 39 | + $all_infos = $get_infos($liste_plugins, false, $dir_plugins); |
|
| 40 | 40 | |
| 41 | - $all_infos = pipeline( |
|
| 42 | - 'filtrer_liste_plugins', |
|
| 43 | - [ |
|
| 44 | - 'args' => [ |
|
| 45 | - 'liste_plugins' => $liste_plugins, |
|
| 46 | - 'liste_plugins_checked' => $liste_plugins_checked, |
|
| 47 | - 'liste_plugins_actifs' => $liste_plugins_actifs, |
|
| 48 | - 'dir_plugins' => $dir_plugins |
|
| 49 | - ], |
|
| 50 | - 'data' => $all_infos |
|
| 51 | - ] |
|
| 52 | - ); |
|
| 41 | + $all_infos = pipeline( |
|
| 42 | + 'filtrer_liste_plugins', |
|
| 43 | + [ |
|
| 44 | + 'args' => [ |
|
| 45 | + 'liste_plugins' => $liste_plugins, |
|
| 46 | + 'liste_plugins_checked' => $liste_plugins_checked, |
|
| 47 | + 'liste_plugins_actifs' => $liste_plugins_actifs, |
|
| 48 | + 'dir_plugins' => $dir_plugins |
|
| 49 | + ], |
|
| 50 | + 'data' => $all_infos |
|
| 51 | + ] |
|
| 52 | + ); |
|
| 53 | 53 | |
| 54 | - $liste_plugins = array_flip($liste_plugins); |
|
| 55 | - foreach (array_keys($liste_plugins) as $chemin) { |
|
| 56 | - // des plugins ont pu etre enleves de la liste par le pipeline. On en tient compte. |
|
| 57 | - if (isset($all_infos[$chemin])) { |
|
| 58 | - $liste_plugins[$chemin] = strtoupper(trim((string) typo(translitteration(unicode2charset(html2unicode($all_infos[$chemin]['nom'])))))); |
|
| 59 | - } else { |
|
| 60 | - unset($liste_plugins[$chemin]); |
|
| 61 | - } |
|
| 62 | - } |
|
| 63 | - asort($liste_plugins); |
|
| 64 | - $exposed = urldecode(_request('plugin') ?? ''); |
|
| 54 | + $liste_plugins = array_flip($liste_plugins); |
|
| 55 | + foreach (array_keys($liste_plugins) as $chemin) { |
|
| 56 | + // des plugins ont pu etre enleves de la liste par le pipeline. On en tient compte. |
|
| 57 | + if (isset($all_infos[$chemin])) { |
|
| 58 | + $liste_plugins[$chemin] = strtoupper(trim((string) typo(translitteration(unicode2charset(html2unicode($all_infos[$chemin]['nom'])))))); |
|
| 59 | + } else { |
|
| 60 | + unset($liste_plugins[$chemin]); |
|
| 61 | + } |
|
| 62 | + } |
|
| 63 | + asort($liste_plugins); |
|
| 64 | + $exposed = urldecode(_request('plugin') ?? ''); |
|
| 65 | 65 | |
| 66 | - $block_par_lettre = false;//count($liste_plugins)>10; |
|
| 67 | - $fast_liste_plugins_actifs = []; |
|
| 68 | - $fast_liste_plugins_checked = []; |
|
| 69 | - if (is_array($liste_plugins_actifs)) { |
|
| 70 | - $fast_liste_plugins_actifs = array_flip($liste_plugins_actifs); |
|
| 71 | - } |
|
| 72 | - if (is_array($liste_plugins_checked)) { |
|
| 73 | - $fast_liste_plugins_checked = array_flip($liste_plugins_checked); |
|
| 74 | - } |
|
| 66 | + $block_par_lettre = false;//count($liste_plugins)>10; |
|
| 67 | + $fast_liste_plugins_actifs = []; |
|
| 68 | + $fast_liste_plugins_checked = []; |
|
| 69 | + if (is_array($liste_plugins_actifs)) { |
|
| 70 | + $fast_liste_plugins_actifs = array_flip($liste_plugins_actifs); |
|
| 71 | + } |
|
| 72 | + if (is_array($liste_plugins_checked)) { |
|
| 73 | + $fast_liste_plugins_checked = array_flip($liste_plugins_checked); |
|
| 74 | + } |
|
| 75 | 75 | |
| 76 | - $res = ''; |
|
| 77 | - $block = ''; |
|
| 78 | - $initiale = ''; |
|
| 79 | - $block_actif = false; |
|
| 80 | - foreach ($liste_plugins as $plug => $nom) { |
|
| 81 | - if (($i = substr($nom, 0, 1)) !== $initiale) { |
|
| 82 | - $res .= $block_par_lettre ? affiche_block_initiale($initiale, $block, $block_actif) : $block; |
|
| 83 | - $initiale = $i; |
|
| 84 | - $block = ''; |
|
| 85 | - $block_actif = false; |
|
| 86 | - } |
|
| 87 | - // le rep suivant |
|
| 88 | - $actif = isset($fast_liste_plugins_actifs[$plug]); |
|
| 89 | - $checked = isset($fast_liste_plugins_checked[$plug]); |
|
| 90 | - $block_actif |= $actif; |
|
| 91 | - $expose = ($exposed && ($exposed == $plug || $exposed === $dir_plugins . $plug || $exposed === substr( |
|
| 92 | - $dir_plugins, |
|
| 93 | - strlen(_DIR_RACINE) |
|
| 94 | - ) . $plug)); |
|
| 95 | - $block .= $ligne_plug($url_page, $plug, $checked, $actif, $expose, 'item', $dir_plugins) . "\n"; |
|
| 96 | - } |
|
| 97 | - $res .= $block_par_lettre ? affiche_block_initiale($initiale, $block, $block_actif) : $block; |
|
| 98 | - $class = basename($dir_plugins); |
|
| 76 | + $res = ''; |
|
| 77 | + $block = ''; |
|
| 78 | + $initiale = ''; |
|
| 79 | + $block_actif = false; |
|
| 80 | + foreach ($liste_plugins as $plug => $nom) { |
|
| 81 | + if (($i = substr($nom, 0, 1)) !== $initiale) { |
|
| 82 | + $res .= $block_par_lettre ? affiche_block_initiale($initiale, $block, $block_actif) : $block; |
|
| 83 | + $initiale = $i; |
|
| 84 | + $block = ''; |
|
| 85 | + $block_actif = false; |
|
| 86 | + } |
|
| 87 | + // le rep suivant |
|
| 88 | + $actif = isset($fast_liste_plugins_actifs[$plug]); |
|
| 89 | + $checked = isset($fast_liste_plugins_checked[$plug]); |
|
| 90 | + $block_actif |= $actif; |
|
| 91 | + $expose = ($exposed && ($exposed == $plug || $exposed === $dir_plugins . $plug || $exposed === substr( |
|
| 92 | + $dir_plugins, |
|
| 93 | + strlen(_DIR_RACINE) |
|
| 94 | + ) . $plug)); |
|
| 95 | + $block .= $ligne_plug($url_page, $plug, $checked, $actif, $expose, 'item', $dir_plugins) . "\n"; |
|
| 96 | + } |
|
| 97 | + $res .= $block_par_lettre ? affiche_block_initiale($initiale, $block, $block_actif) : $block; |
|
| 98 | + $class = basename($dir_plugins); |
|
| 99 | 99 | |
| 100 | - return $res ? "<ul class='liste-items plugins $class'>$res</ul>" : ''; |
|
| 100 | + return $res ? "<ul class='liste-items plugins $class'>$res</ul>" : ''; |
|
| 101 | 101 | } |
| 102 | 102 | |
| 103 | 103 | |
| 104 | 104 | function affiche_block_initiale($initiale, $block, $block_actif) { |
| 105 | - if (strlen((string) $block)) { |
|
| 106 | - return "<li class='item'>" |
|
| 107 | - . bouton_block_depliable($initiale, (bool) $block_actif) |
|
| 108 | - . debut_block_depliable($block_actif) |
|
| 109 | - . "<ul>$block</ul>" |
|
| 110 | - . fin_block() |
|
| 111 | - . '</li>'; |
|
| 112 | - } |
|
| 105 | + if (strlen((string) $block)) { |
|
| 106 | + return "<li class='item'>" |
|
| 107 | + . bouton_block_depliable($initiale, (bool) $block_actif) |
|
| 108 | + . debut_block_depliable($block_actif) |
|
| 109 | + . "<ul>$block</ul>" |
|
| 110 | + . fin_block() |
|
| 111 | + . '</li>'; |
|
| 112 | + } |
|
| 113 | 113 | |
| 114 | - return ''; |
|
| 114 | + return ''; |
|
| 115 | 115 | } |
@@ -10,7 +10,7 @@ discard block |
||
| 10 | 10 | \***************************************************************************/ |
| 11 | 11 | |
| 12 | 12 | if (!defined('_ECRIRE_INC_VERSION')) { |
| 13 | - return; |
|
| 13 | + return; |
|
| 14 | 14 | } |
| 15 | 15 | |
| 16 | 16 | |
@@ -20,28 +20,28 @@ discard block |
||
| 20 | 20 | * @param array $arbre |
| 21 | 21 | */ |
| 22 | 22 | function plugins_extraire_pipelines_dist(&$arbre) { |
| 23 | - $pipes = null; |
|
| 24 | - $tag = null; |
|
| 25 | - $pipeline = []; |
|
| 26 | - if (spip_xml_match_nodes(',^pipeline,', $arbre, $pipes)) { |
|
| 27 | - foreach ($pipes as $tag => $p) { |
|
| 28 | - if (!is_array($p[0])) { |
|
| 29 | - [$tag, $att] = spip_xml_decompose_tag($tag); |
|
| 30 | - $pipeline[] = $att; |
|
| 31 | - } else { |
|
| 32 | - foreach ($p as $pipe) { |
|
| 33 | - $att = []; |
|
| 34 | - if (is_array($pipe)) { |
|
| 35 | - foreach ($pipe as $k => $t) { |
|
| 36 | - $att[$k] = trim((string) end($t)); |
|
| 37 | - } |
|
| 38 | - } |
|
| 39 | - $pipeline[] = $att; |
|
| 40 | - } |
|
| 41 | - } |
|
| 42 | - } |
|
| 43 | - unset($arbre[$tag]); |
|
| 44 | - } |
|
| 23 | + $pipes = null; |
|
| 24 | + $tag = null; |
|
| 25 | + $pipeline = []; |
|
| 26 | + if (spip_xml_match_nodes(',^pipeline,', $arbre, $pipes)) { |
|
| 27 | + foreach ($pipes as $tag => $p) { |
|
| 28 | + if (!is_array($p[0])) { |
|
| 29 | + [$tag, $att] = spip_xml_decompose_tag($tag); |
|
| 30 | + $pipeline[] = $att; |
|
| 31 | + } else { |
|
| 32 | + foreach ($p as $pipe) { |
|
| 33 | + $att = []; |
|
| 34 | + if (is_array($pipe)) { |
|
| 35 | + foreach ($pipe as $k => $t) { |
|
| 36 | + $att[$k] = trim((string) end($t)); |
|
| 37 | + } |
|
| 38 | + } |
|
| 39 | + $pipeline[] = $att; |
|
| 40 | + } |
|
| 41 | + } |
|
| 42 | + } |
|
| 43 | + unset($arbre[$tag]); |
|
| 44 | + } |
|
| 45 | 45 | |
| 46 | - return $pipeline; |
|
| 46 | + return $pipeline; |
|
| 47 | 47 | } |
@@ -10,207 +10,207 @@ |
||
| 10 | 10 | \***************************************************************************/ |
| 11 | 11 | |
| 12 | 12 | if (!defined('_ECRIRE_INC_VERSION')) { |
| 13 | - return; |
|
| 13 | + return; |
|
| 14 | 14 | } |
| 15 | 15 | |
| 16 | 16 | include_spip('inc/xml'); |
| 17 | 17 | include_spip('inc/plugin'); |
| 18 | 18 | |
| 19 | 19 | function plugins_verifie_conformite_dist($plug, &$arbre, $dir_plugins = _DIR_PLUGINS) { |
| 20 | - $needs = null; |
|
| 21 | - $compat_spip = null; |
|
| 22 | - $uses = null; |
|
| 23 | - $paths = null; |
|
| 24 | - $trads = null; |
|
| 25 | - static $etats = ['dev', 'experimental', 'test', 'stable']; |
|
| 20 | + $needs = null; |
|
| 21 | + $compat_spip = null; |
|
| 22 | + $uses = null; |
|
| 23 | + $paths = null; |
|
| 24 | + $trads = null; |
|
| 25 | + static $etats = ['dev', 'experimental', 'test', 'stable']; |
|
| 26 | 26 | |
| 27 | - $matches = []; |
|
| 28 | - $silence = false; |
|
| 29 | - $p = null; |
|
| 30 | - // chercher la declaration <plugin spip='...'> a prendre pour cette version de SPIP |
|
| 31 | - if ($n = spip_xml_match_nodes(',^plugin(\s|$),', $arbre, $matches)) { |
|
| 32 | - // version de SPIP |
|
| 33 | - $vspip = $GLOBALS['spip_version_branche']; |
|
| 34 | - foreach ($matches as $tag => $sous) { |
|
| 35 | - [$tagname, $atts] = spip_xml_decompose_tag($tag); |
|
| 36 | - // On rajoute la condition sur $n : |
|
| 37 | - // -- en effet si $n==1 on a pas plus a choisir la balise que l'on ait |
|
| 38 | - // un attribut spip ou pas. Cela permet de traiter tous les cas mono-balise |
|
| 39 | - // de la meme facon. |
|
| 40 | - if ( |
|
| 41 | - $tagname == 'plugin' |
|
| 42 | - && is_array($sous) |
|
| 43 | - && (!isset($atts['spip']) || $n == 1 || plugin_version_compatible($atts['spip'], $vspip, 'spip')) |
|
| 44 | - ) { |
|
| 45 | - // on prend la derniere declaration avec ce nom |
|
| 46 | - $p = end($sous); |
|
| 47 | - $compat_spip = $atts['spip'] ?? ''; |
|
| 48 | - } |
|
| 49 | - } |
|
| 50 | - } |
|
| 51 | - if (is_null($p)) { |
|
| 52 | - $arbre = ['erreur' => [_T('erreur_plugin_tag_plugin_absent') . " : $plug"]]; |
|
| 53 | - $silence = true; |
|
| 54 | - } else { |
|
| 55 | - $arbre = $p; |
|
| 56 | - } |
|
| 57 | - if (!is_array($arbre)) { |
|
| 58 | - $arbre = []; |
|
| 59 | - } |
|
| 60 | - // verification de la conformite du plugin avec quelques |
|
| 61 | - // precautions elementaires |
|
| 62 | - if (!isset($arbre['nom'])) { |
|
| 63 | - if (!$silence) { |
|
| 64 | - $arbre['erreur'][] = _T('erreur_plugin_nom_manquant'); |
|
| 65 | - } |
|
| 66 | - $arbre['nom'] = ['']; |
|
| 67 | - } |
|
| 68 | - if (!isset($arbre['version'])) { |
|
| 69 | - if (!$silence) { |
|
| 70 | - $arbre['erreur'][] = _T('erreur_plugin_version_manquant'); |
|
| 71 | - } |
|
| 72 | - $arbre['version'] = ['']; |
|
| 73 | - } |
|
| 74 | - if (!isset($arbre['prefix'])) { |
|
| 75 | - if (!$silence) { |
|
| 76 | - $arbre['erreur'][] = _T('erreur_plugin_prefix_manquant'); |
|
| 77 | - } |
|
| 78 | - $arbre['prefix'] = ['']; |
|
| 79 | - } else { |
|
| 80 | - $prefix = trim((string) end($arbre['prefix'])); |
|
| 81 | - if (strtoupper($prefix) == 'SPIP' && $plug != './') { |
|
| 82 | - $arbre['erreur'][] = _T('erreur_plugin_prefix_interdit'); |
|
| 83 | - } |
|
| 84 | - if (isset($arbre['etat'])) { |
|
| 85 | - $etat = trim((string) end($arbre['etat'])); |
|
| 86 | - if (!in_array($etat, $etats)) { |
|
| 87 | - $arbre['erreur'][] = _T('erreur_plugin_etat_inconnu') . " : '$etat'"; |
|
| 88 | - } |
|
| 89 | - } |
|
| 90 | - if (isset($arbre['options'])) { |
|
| 91 | - foreach ($arbre['options'] as $optfile) { |
|
| 92 | - $optfile = trim((string) $optfile); |
|
| 93 | - if (!@is_readable($dir_plugins . "$plug/$optfile") && !$silence) { |
|
| 94 | - $arbre['erreur'][] = _T('erreur_plugin_fichier_absent') . " : $optfile"; |
|
| 95 | - } |
|
| 96 | - } |
|
| 97 | - } |
|
| 98 | - if (isset($arbre['fonctions'])) { |
|
| 99 | - foreach ($arbre['fonctions'] as $optfile) { |
|
| 100 | - $optfile = trim((string) $optfile); |
|
| 101 | - if (!@is_readable($dir_plugins . "$plug/$optfile") && !$silence) { |
|
| 102 | - $arbre['erreur'][] = _T('erreur_plugin_fichier_absent') . " : $optfile"; |
|
| 103 | - } |
|
| 104 | - } |
|
| 105 | - } |
|
| 106 | - $fonctions = []; |
|
| 107 | - if (isset($arbre['fonctions'])) { |
|
| 108 | - $fonctions = $arbre['fonctions']; |
|
| 109 | - } |
|
| 110 | - $liste_methodes_reservees = [ |
|
| 111 | - '__construct', |
|
| 112 | - '__destruct', |
|
| 113 | - 'plugin', |
|
| 114 | - 'install', |
|
| 115 | - 'uninstall', |
|
| 116 | - strtolower($prefix) |
|
| 117 | - ]; |
|
| 27 | + $matches = []; |
|
| 28 | + $silence = false; |
|
| 29 | + $p = null; |
|
| 30 | + // chercher la declaration <plugin spip='...'> a prendre pour cette version de SPIP |
|
| 31 | + if ($n = spip_xml_match_nodes(',^plugin(\s|$),', $arbre, $matches)) { |
|
| 32 | + // version de SPIP |
|
| 33 | + $vspip = $GLOBALS['spip_version_branche']; |
|
| 34 | + foreach ($matches as $tag => $sous) { |
|
| 35 | + [$tagname, $atts] = spip_xml_decompose_tag($tag); |
|
| 36 | + // On rajoute la condition sur $n : |
|
| 37 | + // -- en effet si $n==1 on a pas plus a choisir la balise que l'on ait |
|
| 38 | + // un attribut spip ou pas. Cela permet de traiter tous les cas mono-balise |
|
| 39 | + // de la meme facon. |
|
| 40 | + if ( |
|
| 41 | + $tagname == 'plugin' |
|
| 42 | + && is_array($sous) |
|
| 43 | + && (!isset($atts['spip']) || $n == 1 || plugin_version_compatible($atts['spip'], $vspip, 'spip')) |
|
| 44 | + ) { |
|
| 45 | + // on prend la derniere declaration avec ce nom |
|
| 46 | + $p = end($sous); |
|
| 47 | + $compat_spip = $atts['spip'] ?? ''; |
|
| 48 | + } |
|
| 49 | + } |
|
| 50 | + } |
|
| 51 | + if (is_null($p)) { |
|
| 52 | + $arbre = ['erreur' => [_T('erreur_plugin_tag_plugin_absent') . " : $plug"]]; |
|
| 53 | + $silence = true; |
|
| 54 | + } else { |
|
| 55 | + $arbre = $p; |
|
| 56 | + } |
|
| 57 | + if (!is_array($arbre)) { |
|
| 58 | + $arbre = []; |
|
| 59 | + } |
|
| 60 | + // verification de la conformite du plugin avec quelques |
|
| 61 | + // precautions elementaires |
|
| 62 | + if (!isset($arbre['nom'])) { |
|
| 63 | + if (!$silence) { |
|
| 64 | + $arbre['erreur'][] = _T('erreur_plugin_nom_manquant'); |
|
| 65 | + } |
|
| 66 | + $arbre['nom'] = ['']; |
|
| 67 | + } |
|
| 68 | + if (!isset($arbre['version'])) { |
|
| 69 | + if (!$silence) { |
|
| 70 | + $arbre['erreur'][] = _T('erreur_plugin_version_manquant'); |
|
| 71 | + } |
|
| 72 | + $arbre['version'] = ['']; |
|
| 73 | + } |
|
| 74 | + if (!isset($arbre['prefix'])) { |
|
| 75 | + if (!$silence) { |
|
| 76 | + $arbre['erreur'][] = _T('erreur_plugin_prefix_manquant'); |
|
| 77 | + } |
|
| 78 | + $arbre['prefix'] = ['']; |
|
| 79 | + } else { |
|
| 80 | + $prefix = trim((string) end($arbre['prefix'])); |
|
| 81 | + if (strtoupper($prefix) == 'SPIP' && $plug != './') { |
|
| 82 | + $arbre['erreur'][] = _T('erreur_plugin_prefix_interdit'); |
|
| 83 | + } |
|
| 84 | + if (isset($arbre['etat'])) { |
|
| 85 | + $etat = trim((string) end($arbre['etat'])); |
|
| 86 | + if (!in_array($etat, $etats)) { |
|
| 87 | + $arbre['erreur'][] = _T('erreur_plugin_etat_inconnu') . " : '$etat'"; |
|
| 88 | + } |
|
| 89 | + } |
|
| 90 | + if (isset($arbre['options'])) { |
|
| 91 | + foreach ($arbre['options'] as $optfile) { |
|
| 92 | + $optfile = trim((string) $optfile); |
|
| 93 | + if (!@is_readable($dir_plugins . "$plug/$optfile") && !$silence) { |
|
| 94 | + $arbre['erreur'][] = _T('erreur_plugin_fichier_absent') . " : $optfile"; |
|
| 95 | + } |
|
| 96 | + } |
|
| 97 | + } |
|
| 98 | + if (isset($arbre['fonctions'])) { |
|
| 99 | + foreach ($arbre['fonctions'] as $optfile) { |
|
| 100 | + $optfile = trim((string) $optfile); |
|
| 101 | + if (!@is_readable($dir_plugins . "$plug/$optfile") && !$silence) { |
|
| 102 | + $arbre['erreur'][] = _T('erreur_plugin_fichier_absent') . " : $optfile"; |
|
| 103 | + } |
|
| 104 | + } |
|
| 105 | + } |
|
| 106 | + $fonctions = []; |
|
| 107 | + if (isset($arbre['fonctions'])) { |
|
| 108 | + $fonctions = $arbre['fonctions']; |
|
| 109 | + } |
|
| 110 | + $liste_methodes_reservees = [ |
|
| 111 | + '__construct', |
|
| 112 | + '__destruct', |
|
| 113 | + 'plugin', |
|
| 114 | + 'install', |
|
| 115 | + 'uninstall', |
|
| 116 | + strtolower($prefix) |
|
| 117 | + ]; |
|
| 118 | 118 | |
| 119 | - $extraire_pipelines = charger_fonction('extraire_pipelines', 'plugins'); |
|
| 120 | - $arbre['pipeline'] = $extraire_pipelines($arbre); |
|
| 121 | - foreach ($arbre['pipeline'] as $pipe) { |
|
| 122 | - if (!isset($pipe['nom']) && !$silence) { |
|
| 123 | - $arbre['erreur'][] = _T('erreur_plugin_nom_pipeline_non_defini'); |
|
| 124 | - } |
|
| 125 | - $action = $pipe['action'] ?? $pipe['nom']; |
|
| 126 | - // verif que la methode a un nom autorise |
|
| 127 | - if (in_array(strtolower((string) $action), $liste_methodes_reservees) && !$silence) { |
|
| 128 | - $arbre['erreur'][] = _T('erreur_plugin_nom_fonction_interdit') . " : $action"; |
|
| 129 | - } |
|
| 130 | - if (isset($pipe['inclure'])) { |
|
| 131 | - $inclure = $dir_plugins . "$plug/" . $pipe['inclure']; |
|
| 132 | - if (!@is_readable($inclure) && !$silence) { |
|
| 133 | - $arbre['erreur'][] = _T('erreur_plugin_fichier_absent') . " : $inclure"; |
|
| 134 | - } |
|
| 135 | - } |
|
| 136 | - } |
|
| 137 | - $necessite = []; |
|
| 138 | - $spip_trouve = false; |
|
| 139 | - if (spip_xml_match_nodes(',^necessite,', $arbre, $needs)) { |
|
| 140 | - foreach (array_keys($needs) as $tag) { |
|
| 141 | - [$tag, $att] = spip_xml_decompose_tag($tag); |
|
| 142 | - if (!isset($att['id'])) { |
|
| 143 | - if (!$silence) { |
|
| 144 | - $arbre['erreur'][] = _T( |
|
| 145 | - 'erreur_plugin_attribut_balise_manquant', |
|
| 146 | - ['attribut' => 'id', 'balise' => $att] |
|
| 147 | - ); |
|
| 148 | - } |
|
| 149 | - } else { |
|
| 150 | - $necessite[] = $att; |
|
| 151 | - } |
|
| 152 | - if (strtolower((string) $att['id']) == 'spip') { |
|
| 153 | - $spip_trouve = true; |
|
| 154 | - } |
|
| 155 | - } |
|
| 156 | - } |
|
| 157 | - if ($compat_spip && !$spip_trouve) { |
|
| 158 | - $necessite[] = ['id' => 'spip', 'version' => $compat_spip]; |
|
| 159 | - } |
|
| 160 | - $arbre['necessite'] = $necessite; |
|
| 161 | - $utilise = []; |
|
| 162 | - if (spip_xml_match_nodes(',^utilise,', $arbre, $uses)) { |
|
| 163 | - foreach (array_keys($uses) as $tag) { |
|
| 164 | - [$tag, $att] = spip_xml_decompose_tag($tag); |
|
| 165 | - if (!isset($att['id'])) { |
|
| 166 | - if (!$silence) { |
|
| 167 | - $arbre['erreur'][] = _T( |
|
| 168 | - 'erreur_plugin_attribut_balise_manquant', |
|
| 169 | - ['attribut' => 'id', 'balise' => $att] |
|
| 170 | - ); |
|
| 171 | - } |
|
| 172 | - } else { |
|
| 173 | - $utilise[] = $att; |
|
| 174 | - } |
|
| 175 | - } |
|
| 176 | - } |
|
| 177 | - $arbre['utilise'] = $utilise; |
|
| 178 | - $procure = []; |
|
| 179 | - if (spip_xml_match_nodes(',^procure,', $arbre, $uses)) { |
|
| 180 | - foreach (array_keys($uses) as $tag) { |
|
| 181 | - [$tag, $att] = spip_xml_decompose_tag($tag); |
|
| 182 | - $procure[] = $att; |
|
| 183 | - } |
|
| 184 | - } |
|
| 185 | - $arbre['procure'] = $procure; |
|
| 186 | - $path = []; |
|
| 187 | - if (spip_xml_match_nodes(',^chemin,', $arbre, $paths)) { |
|
| 188 | - foreach (array_keys($paths) as $tag) { |
|
| 189 | - [$tag, $att] = spip_xml_decompose_tag($tag); |
|
| 190 | - $att['path'] = $att['dir']; // ancienne syntaxe |
|
| 191 | - $path[] = $att; |
|
| 192 | - } |
|
| 193 | - } else { |
|
| 194 | - $path = [['dir' => '']]; |
|
| 195 | - } // initialiser par defaut |
|
| 196 | - $arbre['path'] = $path; |
|
| 197 | - // exposer les noisettes |
|
| 198 | - if (isset($arbre['noisette'])) { |
|
| 199 | - foreach ($arbre['noisette'] as $k => $nut) { |
|
| 200 | - $nut = preg_replace(',[.]html$,uims', '', trim((string) $nut)); |
|
| 201 | - $arbre['noisette'][$k] = $nut; |
|
| 202 | - if (!@is_readable($dir_plugins . "$plug/$nut.html") && !$silence) { |
|
| 203 | - $arbre['erreur'][] = _T('erreur_plugin_fichier_absent') . " : $nut"; |
|
| 204 | - } |
|
| 205 | - } |
|
| 206 | - } |
|
| 207 | - $traduire = []; |
|
| 208 | - if (spip_xml_match_nodes(',^traduire,', $arbre, $trads)) { |
|
| 209 | - foreach (array_keys($trads) as $tag) { |
|
| 210 | - [$tag, $att] = spip_xml_decompose_tag($tag); |
|
| 211 | - $traduire[] = $att; |
|
| 212 | - } |
|
| 213 | - } |
|
| 214 | - $arbre['traduire'] = $traduire; |
|
| 215 | - } |
|
| 119 | + $extraire_pipelines = charger_fonction('extraire_pipelines', 'plugins'); |
|
| 120 | + $arbre['pipeline'] = $extraire_pipelines($arbre); |
|
| 121 | + foreach ($arbre['pipeline'] as $pipe) { |
|
| 122 | + if (!isset($pipe['nom']) && !$silence) { |
|
| 123 | + $arbre['erreur'][] = _T('erreur_plugin_nom_pipeline_non_defini'); |
|
| 124 | + } |
|
| 125 | + $action = $pipe['action'] ?? $pipe['nom']; |
|
| 126 | + // verif que la methode a un nom autorise |
|
| 127 | + if (in_array(strtolower((string) $action), $liste_methodes_reservees) && !$silence) { |
|
| 128 | + $arbre['erreur'][] = _T('erreur_plugin_nom_fonction_interdit') . " : $action"; |
|
| 129 | + } |
|
| 130 | + if (isset($pipe['inclure'])) { |
|
| 131 | + $inclure = $dir_plugins . "$plug/" . $pipe['inclure']; |
|
| 132 | + if (!@is_readable($inclure) && !$silence) { |
|
| 133 | + $arbre['erreur'][] = _T('erreur_plugin_fichier_absent') . " : $inclure"; |
|
| 134 | + } |
|
| 135 | + } |
|
| 136 | + } |
|
| 137 | + $necessite = []; |
|
| 138 | + $spip_trouve = false; |
|
| 139 | + if (spip_xml_match_nodes(',^necessite,', $arbre, $needs)) { |
|
| 140 | + foreach (array_keys($needs) as $tag) { |
|
| 141 | + [$tag, $att] = spip_xml_decompose_tag($tag); |
|
| 142 | + if (!isset($att['id'])) { |
|
| 143 | + if (!$silence) { |
|
| 144 | + $arbre['erreur'][] = _T( |
|
| 145 | + 'erreur_plugin_attribut_balise_manquant', |
|
| 146 | + ['attribut' => 'id', 'balise' => $att] |
|
| 147 | + ); |
|
| 148 | + } |
|
| 149 | + } else { |
|
| 150 | + $necessite[] = $att; |
|
| 151 | + } |
|
| 152 | + if (strtolower((string) $att['id']) == 'spip') { |
|
| 153 | + $spip_trouve = true; |
|
| 154 | + } |
|
| 155 | + } |
|
| 156 | + } |
|
| 157 | + if ($compat_spip && !$spip_trouve) { |
|
| 158 | + $necessite[] = ['id' => 'spip', 'version' => $compat_spip]; |
|
| 159 | + } |
|
| 160 | + $arbre['necessite'] = $necessite; |
|
| 161 | + $utilise = []; |
|
| 162 | + if (spip_xml_match_nodes(',^utilise,', $arbre, $uses)) { |
|
| 163 | + foreach (array_keys($uses) as $tag) { |
|
| 164 | + [$tag, $att] = spip_xml_decompose_tag($tag); |
|
| 165 | + if (!isset($att['id'])) { |
|
| 166 | + if (!$silence) { |
|
| 167 | + $arbre['erreur'][] = _T( |
|
| 168 | + 'erreur_plugin_attribut_balise_manquant', |
|
| 169 | + ['attribut' => 'id', 'balise' => $att] |
|
| 170 | + ); |
|
| 171 | + } |
|
| 172 | + } else { |
|
| 173 | + $utilise[] = $att; |
|
| 174 | + } |
|
| 175 | + } |
|
| 176 | + } |
|
| 177 | + $arbre['utilise'] = $utilise; |
|
| 178 | + $procure = []; |
|
| 179 | + if (spip_xml_match_nodes(',^procure,', $arbre, $uses)) { |
|
| 180 | + foreach (array_keys($uses) as $tag) { |
|
| 181 | + [$tag, $att] = spip_xml_decompose_tag($tag); |
|
| 182 | + $procure[] = $att; |
|
| 183 | + } |
|
| 184 | + } |
|
| 185 | + $arbre['procure'] = $procure; |
|
| 186 | + $path = []; |
|
| 187 | + if (spip_xml_match_nodes(',^chemin,', $arbre, $paths)) { |
|
| 188 | + foreach (array_keys($paths) as $tag) { |
|
| 189 | + [$tag, $att] = spip_xml_decompose_tag($tag); |
|
| 190 | + $att['path'] = $att['dir']; // ancienne syntaxe |
|
| 191 | + $path[] = $att; |
|
| 192 | + } |
|
| 193 | + } else { |
|
| 194 | + $path = [['dir' => '']]; |
|
| 195 | + } // initialiser par defaut |
|
| 196 | + $arbre['path'] = $path; |
|
| 197 | + // exposer les noisettes |
|
| 198 | + if (isset($arbre['noisette'])) { |
|
| 199 | + foreach ($arbre['noisette'] as $k => $nut) { |
|
| 200 | + $nut = preg_replace(',[.]html$,uims', '', trim((string) $nut)); |
|
| 201 | + $arbre['noisette'][$k] = $nut; |
|
| 202 | + if (!@is_readable($dir_plugins . "$plug/$nut.html") && !$silence) { |
|
| 203 | + $arbre['erreur'][] = _T('erreur_plugin_fichier_absent') . " : $nut"; |
|
| 204 | + } |
|
| 205 | + } |
|
| 206 | + } |
|
| 207 | + $traduire = []; |
|
| 208 | + if (spip_xml_match_nodes(',^traduire,', $arbre, $trads)) { |
|
| 209 | + foreach (array_keys($trads) as $tag) { |
|
| 210 | + [$tag, $att] = spip_xml_decompose_tag($tag); |
|
| 211 | + $traduire[] = $att; |
|
| 212 | + } |
|
| 213 | + } |
|
| 214 | + $arbre['traduire'] = $traduire; |
|
| 215 | + } |
|
| 216 | 216 | } |
@@ -49,7 +49,7 @@ discard block |
||
| 49 | 49 | } |
| 50 | 50 | } |
| 51 | 51 | if (is_null($p)) { |
| 52 | - $arbre = ['erreur' => [_T('erreur_plugin_tag_plugin_absent') . " : $plug"]]; |
|
| 52 | + $arbre = ['erreur' => [_T('erreur_plugin_tag_plugin_absent')." : $plug"]]; |
|
| 53 | 53 | $silence = true; |
| 54 | 54 | } else { |
| 55 | 55 | $arbre = $p; |
@@ -84,22 +84,22 @@ discard block |
||
| 84 | 84 | if (isset($arbre['etat'])) { |
| 85 | 85 | $etat = trim((string) end($arbre['etat'])); |
| 86 | 86 | if (!in_array($etat, $etats)) { |
| 87 | - $arbre['erreur'][] = _T('erreur_plugin_etat_inconnu') . " : '$etat'"; |
|
| 87 | + $arbre['erreur'][] = _T('erreur_plugin_etat_inconnu')." : '$etat'"; |
|
| 88 | 88 | } |
| 89 | 89 | } |
| 90 | 90 | if (isset($arbre['options'])) { |
| 91 | 91 | foreach ($arbre['options'] as $optfile) { |
| 92 | 92 | $optfile = trim((string) $optfile); |
| 93 | - if (!@is_readable($dir_plugins . "$plug/$optfile") && !$silence) { |
|
| 94 | - $arbre['erreur'][] = _T('erreur_plugin_fichier_absent') . " : $optfile"; |
|
| 93 | + if (!@is_readable($dir_plugins."$plug/$optfile") && !$silence) { |
|
| 94 | + $arbre['erreur'][] = _T('erreur_plugin_fichier_absent')." : $optfile"; |
|
| 95 | 95 | } |
| 96 | 96 | } |
| 97 | 97 | } |
| 98 | 98 | if (isset($arbre['fonctions'])) { |
| 99 | 99 | foreach ($arbre['fonctions'] as $optfile) { |
| 100 | 100 | $optfile = trim((string) $optfile); |
| 101 | - if (!@is_readable($dir_plugins . "$plug/$optfile") && !$silence) { |
|
| 102 | - $arbre['erreur'][] = _T('erreur_plugin_fichier_absent') . " : $optfile"; |
|
| 101 | + if (!@is_readable($dir_plugins."$plug/$optfile") && !$silence) { |
|
| 102 | + $arbre['erreur'][] = _T('erreur_plugin_fichier_absent')." : $optfile"; |
|
| 103 | 103 | } |
| 104 | 104 | } |
| 105 | 105 | } |
@@ -125,12 +125,12 @@ discard block |
||
| 125 | 125 | $action = $pipe['action'] ?? $pipe['nom']; |
| 126 | 126 | // verif que la methode a un nom autorise |
| 127 | 127 | if (in_array(strtolower((string) $action), $liste_methodes_reservees) && !$silence) { |
| 128 | - $arbre['erreur'][] = _T('erreur_plugin_nom_fonction_interdit') . " : $action"; |
|
| 128 | + $arbre['erreur'][] = _T('erreur_plugin_nom_fonction_interdit')." : $action"; |
|
| 129 | 129 | } |
| 130 | 130 | if (isset($pipe['inclure'])) { |
| 131 | - $inclure = $dir_plugins . "$plug/" . $pipe['inclure']; |
|
| 131 | + $inclure = $dir_plugins."$plug/".$pipe['inclure']; |
|
| 132 | 132 | if (!@is_readable($inclure) && !$silence) { |
| 133 | - $arbre['erreur'][] = _T('erreur_plugin_fichier_absent') . " : $inclure"; |
|
| 133 | + $arbre['erreur'][] = _T('erreur_plugin_fichier_absent')." : $inclure"; |
|
| 134 | 134 | } |
| 135 | 135 | } |
| 136 | 136 | } |
@@ -199,8 +199,8 @@ discard block |
||
| 199 | 199 | foreach ($arbre['noisette'] as $k => $nut) { |
| 200 | 200 | $nut = preg_replace(',[.]html$,uims', '', trim((string) $nut)); |
| 201 | 201 | $arbre['noisette'][$k] = $nut; |
| 202 | - if (!@is_readable($dir_plugins . "$plug/$nut.html") && !$silence) { |
|
| 203 | - $arbre['erreur'][] = _T('erreur_plugin_fichier_absent') . " : $nut"; |
|
| 202 | + if (!@is_readable($dir_plugins."$plug/$nut.html") && !$silence) { |
|
| 203 | + $arbre['erreur'][] = _T('erreur_plugin_fichier_absent')." : $nut"; |
|
| 204 | 204 | } |
| 205 | 205 | } |
| 206 | 206 | } |