diff --git a/ecrire/aide_index.php3 b/ecrire/aide_index.php3 index a4348ce65f0ea17df1ba24fbaf93beacb9cc42d2..53274e59b53a1639f7cbfdb94249f8e61de13cfa 100644 --- a/ecrire/aide_index.php3 +++ b/ecrire/aide_index.php3 @@ -12,7 +12,7 @@ include_ecrire ("inc_texte.php3"); include_ecrire ("inc_filtres.php3"); // Recuperer les infos de langue (preferences auteur), si possible -if (@file_exists("inc_connect.php3")) { +if (_FILE_CONNECT) { include_ecrire ("inc_auth.php3"); } include_ecrire ("inc_lang.php3"); @@ -74,8 +74,9 @@ function fichier_aide($lang_aide = '') { else if ($help_server) { // Aide internet, en cache ? include_ecrire('inc_sites.php3'); - if (@file_exists($fichier_aide = _DIR_SESSIONS . "aide-$lang_aide-aide.html")) + if (@file_exists($fichier_aide = _DIR_SESSIONS . "aide-$lang_aide-aide.html")) { return array(file($fichier_aide), $lang_aide); + } else { // sinon aller la chercher sur le site d'aide if (ecrire_fichier(_DIR_SESSIONS . 'aide-test', "test") diff --git a/ecrire/delete_all.php3 b/ecrire/delete_all.php3 index 040df08ad9030fe6a9702fca42633dc267b660b8..58313d7677ca509e6810bb230bd3c9c4107e27f0 100644 --- a/ecrire/delete_all.php3 +++ b/ecrire/delete_all.php3 @@ -53,7 +53,7 @@ spip_query("DROP TABLE spip_visites_temp"); spip_query("DROP TABLE spip_test"); @unlink(_ACCESS_FILE_NAME); -@unlink("inc_connect.php3"); +@unlink(_FILE_CONNECT); @header("Location: ./"); diff --git a/ecrire/inc.php3 b/ecrire/inc.php3 index f48746ef3327002b1ce11f67ec2c18c0235c45b4..8c7196436084a0e876b11c2f435fc4a19cd25921 100644 --- a/ecrire/inc.php3 +++ b/ecrire/inc.php3 @@ -1,12 +1,18 @@ <?php +# pour empecher l'acces aux sites non installes. +# A ameliorer pour le multi-site -// SPIP est-il installe ? -if (!@file_exists("inc_connect.php3")) { +if (!defined('_FILE_CONNECT')) + define('_FILE_CONNECT', + (@file_exists("inc_connect.php3") ? "inc_connect.php3" : '')); + +if (!_FILE_CONNECT) { header("Location: install.php3"); exit; } if (!defined('_ECRIRE_INC_VERSION')) { include ("inc_version.php3"); } +// SPIP est-il installe ? include_ecrire("inc_auth.php3"); diff --git a/ecrire/inc_cron.php3 b/ecrire/inc_cron.php3 index 6824bc7e62fa4f7e905f2eddd71d0948c39b81b4..e6c1384471f89ea2d775cdb1176ee19e86839399 100644 --- a/ecrire/inc_cron.php3 +++ b/ecrire/inc_cron.php3 @@ -61,7 +61,7 @@ function spip_cron() { #echo "hum"; spip_log('hum'); - include_ecrire("inc_connect.php3"); + include(_FILE_CONNECT); if (!$db_ok) { @touch(_FILE_MYSQL_OUT); spip_log('pas de connexion DB pour taches de fond (cron)'); diff --git a/ecrire/inc_version.php3 b/ecrire/inc_version.php3 index 0c7d92f27fb218e893089a17b5ce542227a2ae6a..9b3bbdd73b918afb126bf7606189bc419913aee4 100644 --- a/ecrire/inc_version.php3 +++ b/ecrire/inc_version.php3 @@ -208,6 +208,10 @@ $extension_squelette = 'html'; /* / MERCI DE VOTRE ATTENTION */ +// utilise seulement à l'installation pour l'instant + +define('_EXTENSION_PHP', '.php3'); + // // *** Fin du parametrage statique *** // @@ -216,25 +220,32 @@ $flag_ecrire = !@file_exists('./ecrire/inc_version.php3'); # en fait flag_ecrire est une constante, equivalente a la nullite de: -define('_DIR_RESTREINT', (!@is_dir('ecrire') ? "" : "ecrire/")); +define_once('_DIR_RESTREINT', (!@is_dir('ecrire') ? "" : "ecrire/")); +define('_DIR_PREFIX1', (_DIR_RESTREINT ? "" : "../")); +define('_DIR_PREFIX2', _DIR_RESTREINT); -if (@file_exists(_DIR_RESTREINT . 'mes_options.php3')) { - include(_DIR_RESTREINT . 'mes_options.php3'); +if (@file_exists(_DIR_PREFIX2 . 'mes_options.php3')) { + include(_DIR_PREFIX2 . 'mes_options.php3'); } -if (@file_exists(_DIR_RESTREINT . 'inc_plugins.php3')) { - include(_DIR_RESTREINT . 'inc_plugins.php3'); +if (@file_exists(_DIR_PREFIX2 . 'inc_plugins.php3')) { + include(_DIR_PREFIX2 . 'inc_plugins.php3'); } - -define_once('_DIR_IMG_PACK', (_DIR_RESTREINT . 'img_pack')); +define_once('_FILE_CONNECT_INS', (_DIR_PREFIX2 . "inc_connect")); +define_once('_FILE_CONNECT', + (@file_exists(_FILE_CONNECT_INS . _EXTENSION_PHP) ? + (_FILE_CONNECT_INS . _EXTENSION_PHP) + : '')); // les repertoires des logos, des pieces rapportees, du CACHE et des sessions -define_once('_DIR_IMG', (_DIR_RESTREINT ? "" : "../")."IMG/"); -define_once('_DIR_DOC', (_DIR_RESTREINT ? "" : "../")."IMG/"); -define_once('_DIR_CACHE', (_DIR_RESTREINT ? "" : "../")."CACHE/"); -define_once('_DIR_SESSIONS', _DIR_RESTREINT . "data/"); +define_once('_DIR_IMG', _DIR_PREFIX1 ."IMG/"); +define_once('_DIR_DOC', _DIR_PREFIX1 ."IMG/"); +define_once('_DIR_CACHE', _DIR_PREFIX1 ."CACHE/"); + +define_once('_DIR_SESSIONS', _DIR_PREFIX2 . "data/"); +define_once('_DIR_TRANSFERT', _DIR_PREFIX2 . "upload/"); // exemples de redefinition possible, // SOUS RESERVE QUE php.ini N'AIT PAS pas openbasedir=. !!!!!! @@ -259,15 +270,18 @@ define_once('_FILE_CRON_LOCK', _DIR_SESSIONS . 'cron.lock'); define_once('_FILE_MYSQL_OUT', _DIR_SESSIONS . 'mysql_out'); define_once('_FILE_GARBAGE', _DIR_SESSIONS . '.poubelle'); -define_once('_FILE_CONNECT', (@file_exists(_DIR_RESTREINT . "inc_connect.php3") ? - (_DIR_RESTREINT . "inc_connect.php3") : '')); -// et qq sous-repertoires +// sous-repertoires d'images accessible en ecriture define_once('_DIR_IMG_ICONES', _DIR_IMG . "icones/"); define_once('_DIR_IMG_ICONES_BARRE', _DIR_IMG . "icones_barre/"); define_once('_DIR_TeX', _DIR_IMG . "TeX/"); +// pour ceux qui n'aiment pas nos icones, tout est prevu +// (pas tout à fait) + +define_once('_DIR_IMG_PACK', (_DIR_RESTREINT . 'img_pack')); + // qq chaines standard define_once('_ACCESS_FILE_NAME', '.htaccess'); @@ -468,7 +482,7 @@ function include_plug($file) { function spip_query($query) { if (_FILE_CONNECT) { - include_ecrire("inc_connect.php3"); + include_local(_FILE_CONNECT); if (!$GLOBALS['db_ok']) return; if ($GLOBALS['spip_connect_version'] < 0.1) { @@ -930,7 +944,7 @@ function timeout($lock=false, $action=true, $connect_mysql=true) { // Base connectee ? if ($connect_mysql) { - include_ecrire('inc_connect.php3'); + include_local(_FILE_CONNECT); if (!$db_ok) return false; diff --git a/ecrire/info.php3 b/ecrire/info.php3 index 3a8b6f4b2c584ea0329a57f921fd9747db10089e..4eb7de76c5ecffdf808c97963c1de266d0ad6f60 100644 --- a/ecrire/info.php3 +++ b/ecrire/info.php3 @@ -1,9 +1,7 @@ <?php -if (@file_exists("inc_connect.php3")) { - include ("inc_version.php3"); - - +include ("inc_version.php3"); +if (_FILE_CONNECT) { include_ecrire ("inc_auth.php3"); if ($connect_statut != '0minirezo') exit; } diff --git a/ecrire/install.php3 b/ecrire/install.php3 index 03aaac1a242ace366215800c9f0b2fa8bca9d4c1..712b6d4b77560e956dbc4a085abb9af08a819e49 100644 --- a/ecrire/install.php3 +++ b/ecrire/install.php3 @@ -6,7 +6,7 @@ include_ecrire ("inc_presentation.php3"); utiliser_langue_visiteur(); -if (@file_exists("inc_connect.php3")) { +if (_FILE_CONNECT) { install_debut_html(); echo "<P><FONT FACE='Verdana,Arial,Sans,sans-serif' SIZE=4>"._T('avis_espace_interdit')."</FONT>"; @@ -16,6 +16,7 @@ if (@file_exists("inc_connect.php3")) { include_ecrire ("inc_base.php3"); +define('_FILE_TMP', '_install'); // // Etapes de l'installation standard @@ -29,8 +30,8 @@ if ($etape == 6) { echo "<B>"._T('info_code_acces')."</B>"; echo "<P>"._T('info_utilisation_spip'); - include_ecrire ("inc_connect_install.php3"); - + include(_FILE_CONNECT_INS . _FILE_TMP . _EXTENSION_PHP); + spip_log(_FILE_CONNECT_INS); include_ecrire ("inc_meta.php3"); if ($login) { @@ -62,11 +63,13 @@ if ($etape == 6) { include_ecrire ("inc_acces.php3"); ecrire_acces(); - @unlink(_DIR_SESSIONS . 'inc_meta_cache.php3'); - @unlink(_DIR_SESSIONS . 'meta_cache.php3'); - if (!@rename("inc_connect_install.php3", "inc_connect.php3")) { - copy("inc_connect_install.php3", "inc_connect.php3"); - @unlink("inc_connect_install.php3"); + unlink(_DIR_SESSIONS . 'inc_meta_cache.php3'); + unlink(_DIR_SESSIONS . 'meta_cache.php3'); + if (!@rename(_FILE_CONNECT_INS . _FILE_TMP . _EXTENSION_PHP, + _FILE_CONNECT_INS . _EXTENSION_PHP)) { + copy(_FILE_CONNECT_INS . _FILE_TMP . _EXTENSION_PHP, + _FILE_CONNECT_INS . _EXTENSION_PHP); + @unlink(_FILE_CONNECT_INS . _FILE_TMP . _EXTENSION_PHP); } echo "<FORM ACTION='index.php3' METHOD='post'>"; @@ -81,44 +84,44 @@ if ($etape == 6) { else if ($etape == 5) { install_debut_html(); - include_ecrire ("inc_connect_install.php3"); + include(_FILE_CONNECT_INS . _FILE_TMP . _EXTENSION_PHP); - echo "<BR><FONT FACE='Verdana,Arial,Sans,sans-serif' SIZE=3>"._T('info_informations_personnelles')."</FONT>"; - echo "<P>"; + echo "<BR />\n<FONT FACE='Verdana,Arial,Sans,sans-serif' SIZE=3>"._T('info_informations_personnelles')."</FONT>"; + echo "<P>\n"; echo "<b>"._T('texte_informations_personnelles_1')."</b>"; echo aide ("install5"); - echo "<p>"._T('texte_informations_personnelles_2')." "; + echo "<p>\n"._T('texte_informations_personnelles_2')." "; echo _T('info_laisser_champs_vides'); echo "<FORM ACTION='install.php3' METHOD='post'>"; echo "<INPUT TYPE='hidden' NAME='etape' VALUE='6'>"; - echo "<fieldset><label><B>"._T('info_identification_publique')."</B><BR></label>"; - echo "<B>"._T('entree_signature')."</B><BR>"; - echo _T('entree_nom_pseudo_1')."<BR>"; - echo "<INPUT TYPE='text' NAME='nom' CLASS='formo' VALUE=\"$nom\" SIZE='40'><P>"; + echo "<fieldset><label><B>"._T('info_identification_publique')."</B><BR />\n</label>"; + echo "<B>"._T('entree_signature')."</B><BR />\n"; + echo _T('entree_nom_pseudo_1')."<BR />\n"; + echo "<INPUT TYPE='text' NAME='nom' CLASS='formo' VALUE=\"$nom\" SIZE='40'><P>\n"; - echo "<B>"._T('entree_adresse_email')."</B><BR>"; + echo "<B>"._T('entree_adresse_email')."</B><BR />\n"; echo "<INPUT TYPE='text' NAME='email' CLASS='formo' VALUE=\"$email\" SIZE='40'></fieldset><P>\n"; - echo "<fieldset><label><B>"._T('entree_identifiants_connexion')."</B><BR></label>"; - echo "<B>"._T('entree_login')."</B><BR>"; - echo _T('info_plus_trois_car')."<BR>"; + echo "<fieldset><label><B>"._T('entree_identifiants_connexion')."</B><BR />\n</label>"; + echo "<B>"._T('entree_login')."</B><BR />\n"; + echo _T('info_plus_trois_car')."<BR />\n"; echo "<INPUT TYPE='text' NAME='login' CLASS='formo' VALUE=\"$login\" SIZE='40'><P>\n"; - echo "<B>"._T('entree_mot_passe')."</B> <BR>"; - echo _T('info_plus_cinq_car_2')."<BR>"; + echo "<B>"._T('entree_mot_passe')."</B> <BR />\n"; + echo _T('info_plus_cinq_car_2')."<BR />\n"; echo "<INPUT TYPE='password' NAME='pass' CLASS='formo' VALUE=\"$pass\" SIZE='40'></fieldset><P>\n"; echo "<DIV align='$spip_lang_right'><INPUT TYPE='submit' CLASS='fondl' NAME='Valider' VALUE='"._T('bouton_suivant')." >>'>"; echo "</FORM>"; - echo "<p>"; + echo "<p>\n"; if ($flag_ldap AND !$ldap_present) { echo "<div style='border: 1px solid #404040; padding: 10px; text-align: left;'>"; echo "<b>"._T('info_authentification_externe')."</b>"; - echo "<p>"._T('texte_annuaire_ldap_1'); + echo "<p>\n"._T('texte_annuaire_ldap_1'); echo "<FORM ACTION='install.php3' METHOD='post'>"; echo "<INPUT TYPE='hidden' NAME='etape' VALUE='ldap1'>"; echo "<DIV align='$spip_lang_right'><INPUT TYPE='submit' CLASS='fondl' NAME='Valider' VALUE=\""._T('bouton_acces_ldap')."\">"; @@ -136,8 +139,8 @@ else if ($etape == 4) { // Necessaire pour appeler les fonctions SQL wrappees include_ecrire("inc_db_mysql.php3"); - echo "<BR><FONT FACE='Verdana,Arial,Sans,sans-serif' SIZE=3>"._T('info_creation_tables')."</FONT>"; - echo "<P>"; + echo "<BR />\n<FONT FACE='Verdana,Arial,Sans,sans-serif' SIZE=3>"._T('info_creation_tables')."</FONT>"; + echo "<P>\n"; $link = mysql_connect("$adresse_db", "$login_db", "$pass_db"); @@ -180,11 +183,11 @@ else if ($etape == 4) { $conn .= "@spip_connect_db('$adresse_db','','$login_db','$pass_db','$sel_db');\n"; $conn .= "\$GLOBALS['db_ok'] = !!@spip_num_rows(@spip_query_db('SELECT COUNT(*) FROM spip_meta'));\n"; $conn .= "?".">"; - $myFile = fopen("inc_connect_install.php3", "wb"); + $myFile = fopen(_FILE_CONNECT_INS . _FILE_TMP . _EXTENSION_PHP, "wb"); fputs($myFile, $conn); fclose($myFile); - echo "<B>"._T('info_base_installee')."</B><P>"._T('info_etape_suivante_1'); + echo "<B>"._T('info_base_installee')."</B><P>\n"._T('info_etape_suivante_1'); echo "<FORM ACTION='install.php3' METHOD='post'>"; echo "<INPUT TYPE='hidden' NAME='etape' VALUE='5'>"; @@ -208,21 +211,21 @@ else if ($etape == 3) { install_debut_html(); - echo "<BR><FONT FACE='Verdana,Arial,Sans,sans-serif' SIZE=3>"._T('info_choix_base')." <B>"._T('menu_aide_installation_choix_base')."</B></FONT>"; + echo "<BR />\n<FONT FACE='Verdana,Arial,Sans,sans-serif' SIZE=3>"._T('info_choix_base')." <B>"._T('menu_aide_installation_choix_base')."</B></FONT>"; echo aide ("install2"); - echo "<P>"; + echo "<P>\n"; echo "<FORM ACTION='install.php3' METHOD='post'>"; echo "<INPUT TYPE='hidden' NAME='etape' VALUE='4'>"; echo "<INPUT TYPE='hidden' NAME='adresse_db' VALUE=\"$adresse_db\" SIZE='40'>"; echo "<INPUT TYPE='hidden' NAME='login_db' VALUE=\"$login_db\">"; - echo "<INPUT TYPE='hidden' NAME='pass_db' VALUE=\"$pass_db\"><P>"; + echo "<INPUT TYPE='hidden' NAME='pass_db' VALUE=\"$pass_db\"><P>\n"; $link = mysql_connect("$adresse_db","$login_db","$pass_db"); $result = @mysql_list_dbs(); - echo "<fieldset><label><B>"._T('texte_choix_base_1')."</B><BR></label>"; + echo "<fieldset><label><B>"._T('texte_choix_base_1')."</B><BR />\n</label>"; if ($result AND (($n = @mysql_num_rows($result)) > 0)) { echo "<B>"._T('texte_choix_base_2')."</B><P> "._T('texte_choix_base_3'); @@ -231,7 +234,7 @@ else if ($etape == 3) { for ($i = 0; $i < $n; $i++) { $table_nom = mysql_dbname($result, $i); $base = "<INPUT NAME=\"choix_db\" VALUE=\"".$table_nom."\" TYPE=Radio id='tab$i'"; - $base_fin = "><label for='tab$i'>".$table_nom."</label><BR>\n"; + $base_fin = "><label for='tab$i'>".$table_nom."</label><BR />\n\n"; if ($table_nom == $login_db) { $bases = "$base CHECKED$base_fin".$bases; $checked = true; @@ -250,7 +253,7 @@ else if ($etape == 3) { echo _T('avis_lecture_noms_bases_3'); echo "<UL>"; echo "<INPUT NAME=\"choix_db\" VALUE=\"".$login_db."\" TYPE=Radio id='stand' CHECKED>"; - echo "<label for='stand'>".$login_db."</label><BR>\n"; + echo "<label for='stand'>".$login_db."</label><BR />\n"; echo "</UL>"; echo _T('info_ou')." "; $checked = true; @@ -274,7 +277,7 @@ else if ($etape == 2) { install_debut_html(); - echo "<BR><FONT FACE='Verdana,Arial,Sans,sans-serif' SIZE=3>"._T('info_connexion_base')."</FONT>"; + echo "<BR />\n<FONT FACE='Verdana,Arial,Sans,sans-serif' SIZE=3>"._T('info_connexion_base')."</FONT>"; echo "<!--"; $link = mysql_connect("$adresse_db","$login_db","$pass_db"); @@ -307,7 +310,7 @@ else if ($etape == 2) { else if ($etape == 1) { install_debut_html(); - echo "<BR><FONT FACE='Verdana,Arial,Sans,sans-serif' SIZE=3>"._T('info_connexion_mysql')."</FONT>"; + echo "<BR />\n<FONT FACE='Verdana,Arial,Sans,sans-serif' SIZE=3>"._T('info_connexion_mysql')."</FONT>"; echo "<P>"._T('texte_connexion_mysql'); @@ -318,8 +321,8 @@ else if ($etape == 1) { $pass_db = ''; // Recuperer les anciennes donnees pour plus de facilite (si presentes) - if (@file_exists("inc_connect_install.php3")) { - $s = @join('', @file("inc_connect_install.php3")); + if (@file_exists(_FILE_CONNECT_INS . _FILE_TMP . _EXTENSION_PHP)) { + $s = @join('', @file(_FILE_CONNECT_INS . _FILE_TMP . _EXTENSION_PHP)); if (ereg("mysql_connect\([\"'](.*)[\"'],[\"'](.*)[\"'],[\"'](.*)[\"']\)", $s, $regs)) { $adresse_db = $regs[1]; $login_db = $regs[2]; @@ -333,16 +336,16 @@ else if ($etape == 1) { echo "<p><FORM ACTION='install.php3' METHOD='post'>"; echo "<INPUT TYPE='hidden' NAME='etape' VALUE='2'>"; - echo "<fieldset><label><B>"._T('entree_base_donnee_1')."</B><BR></label>"; - echo _T('entree_base_donnee_2')."<BR>"; + echo "<fieldset><label><B>"._T('entree_base_donnee_1')."</B><BR />\n</label>"; + echo _T('entree_base_donnee_2')."<BR />\n"; echo "<INPUT TYPE='text' NAME='adresse_db' CLASS='formo' VALUE=\"$adresse_db\" SIZE='40'></fieldset><P>"; - echo "<fieldset><label><B>"._T('entree_login_connexion_1')."</B><BR></label>"; - echo _T('entree_login_connexion_2')."<BR>"; + echo "<fieldset><label><B>"._T('entree_login_connexion_1')."</B><BR />\n</label>"; + echo _T('entree_login_connexion_2')."<BR />\n"; echo "<INPUT TYPE='text' NAME='login_db' CLASS='formo' VALUE=\"$login_db\" SIZE='40'></fieldset><P>"; - echo "<fieldset><label><B>"._T('entree_mot_passe_1')."</B><BR></label>"; - echo _T('entree_mot_passe_2')."<BR>"; + echo "<fieldset><label><B>"._T('entree_mot_passe_1')."</B><BR />\n</label>"; + echo _T('entree_mot_passe_2')."<BR />\n"; echo "<INPUT TYPE='password' NAME='pass_db' CLASS='formo' VALUE=\"$pass_db\" SIZE='40'></fieldset><P>"; echo "<DIV align='$spip_lang_right'><INPUT TYPE='submit' CLASS='fondl' NAME='Valider' VALUE='"._T('bouton_suivant')." >>'>"; @@ -390,7 +393,7 @@ else if (!$etape) { else if ($etape == 'ldap5') { install_debut_html(); - include_ecrire('inc_connect_install.php3'); + include_local(_FILE_CONNECT_INS . _FILE_TMP . _EXTENSION_PHP); include_ecrire('inc_meta.php3'); ecrire_meta("ldap_statut_import", $statut_ldap); ecrire_metas(); @@ -419,17 +422,17 @@ else if ($etape == 'ldap4') { $fail = (ldap_errno($ldap_link) == 32); if ($fail) { - echo "<BR><FONT FACE='Verdana,Arial,Sans,sans-serif' SIZE=3>"._T('info_chemin_acces_annuaire')."</B></FONT>"; + echo "<BR />\n<FONT FACE='Verdana,Arial,Sans,sans-serif' SIZE=3>"._T('info_chemin_acces_annuaire')."</B></FONT>"; echo "<P>"; echo "<B>"._T('avis_operation_echec')."</B> "._T('avis_chemin_invalide_1')." (<tt>".htmlspecialchars($base_ldap); echo "</tt>) "._T('avis_chemin_invalide_2'); } else { - echo "<BR><FONT FACE='Verdana,Arial,Sans,sans-serif' SIZE=3>"._T('info_reglage_ldap')."</FONT>"; + echo "<BR />\n<FONT FACE='Verdana,Arial,Sans,sans-serif' SIZE=3>"._T('info_reglage_ldap')."</FONT>"; echo "<P>"; - $conn = join('', file("inc_connect_install.php3")); + $conn = join('', file(_FILE_CONNECT_INS . _FILE_TMP . _EXTENSION_PHP)); if ($p = strpos($conn, '?'.'>')) $conn = substr($conn, 0, $p); if (!strpos($conn, 'spip_connect_ldap')) { @@ -442,21 +445,21 @@ else if ($etape == 'ldap4') { $conn .= "\$GLOBALS['ldap_present'] = true;\n"; } $conn .= "?".">"; - $myFile = fopen("inc_connect_install.php3", "wb"); + $myFile = fopen(_FILE_CONNECT_INS . _FILE_TMP . _EXTENSION_PHP, "wb"); fputs($myFile, $conn); fclose($myFile); echo "<p><FORM ACTION='install.php3' METHOD='post'>"; echo "<INPUT TYPE='hidden' NAME='etape' VALUE='ldap5'>"; - echo "<fieldset><label><B>"._T('info_statut_utilisateurs_1')."</B></label><BR>"; + echo "<fieldset><label><B>"._T('info_statut_utilisateurs_1')."</B></label><BR />\n"; echo _T('info_statut_utilisateurs_2')." "; echo "<p>"; echo "<INPUT TYPE='Radio' NAME='statut_ldap' VALUE=\"6forum\" id='visit'>"; - echo "<label for='visit'><b>"._T('info_visiteur_1')."</b></label> "._T('info_visiteur_2')."<br>"; + echo "<label for='visit'><b>"._T('info_visiteur_1')."</b></label> "._T('info_visiteur_2')."<br />\n"; echo "<INPUT TYPE='Radio' NAME='statut_ldap' VALUE=\"1comite\" id='redac' CHECKED>"; - echo "<label for='redac'><b>"._T('info_redacteur_1')."</b></label> "._T('info_redacteur_2')."<br>"; + echo "<label for='redac'><b>"._T('info_redacteur_1')."</b></label> "._T('info_redacteur_2')."<br />\n"; echo "<INPUT TYPE='Radio' NAME='statut_ldap' VALUE=\"0minirezo\" id='admin'>"; - echo "<label for='admin'><b>"._T('info_administrateur_1')."</b></label> "._T('info_administrateur_2')."<br>"; + echo "<label for='admin'><b>"._T('info_administrateur_1')."</b></label> "._T('info_administrateur_2')."<br />\n"; echo "<DIV align='$spip_lang_right'><INPUT TYPE='submit' CLASS='fondl' NAME='Valider' VALUE='"._T('bouton_suivant')." >>'>"; @@ -469,7 +472,7 @@ else if ($etape == 'ldap4') { else if ($etape == 'ldap3') { install_debut_html(); - echo "<BR><FONT FACE='Verdana,Arial,Sans,sans-serif' SIZE=3>"._T('info_chemin_acces_1')."</FONT>"; + echo "<BR />\n<FONT FACE='Verdana,Arial,Sans,sans-serif' SIZE=3>"._T('info_chemin_acces_1')."</FONT>"; echo "<P>"._T('info_chemin_acces_2'); @@ -505,7 +508,7 @@ else if ($etape == 'ldap3') { $checked = true; } echo ">"; - echo "<label for='tab$n'>".htmlspecialchars($names[$j])."</label><BR>\n"; + echo "<label for='tab$n'>".htmlspecialchars($names[$j])."</label><BR />\n\n"; } } } @@ -531,7 +534,7 @@ else if ($etape == 'ldap3') { else if ($etape == 'ldap2') { install_debut_html(); - echo "<BR><FONT FACE='Verdana,Arial,Sans,sans-serif' SIZE=3>"._T('titre_connexion_ldap')."</FONT>"; + echo "<BR />\n<FONT FACE='Verdana,Arial,Sans,sans-serif' SIZE=3>"._T('titre_connexion_ldap')."</FONT>"; echo "<P>"; @@ -554,7 +557,7 @@ else if ($etape == 'ldap2') { else { echo "<B>"._T('avis_connexion_ldap_echec_1')."</B>"; echo "<P>"._T('avis_connexion_ldap_echec_2'); - echo "<br>"._T('avis_connexion_ldap_echec_3'); + echo "<br />\n"._T('avis_connexion_ldap_echec_3'); } install_fin_html(); @@ -564,7 +567,7 @@ else if ($etape == 'ldap2') { else if ($etape == 'ldap1') { install_debut_html(); - echo "<BR><FONT FACE='Verdana,Arial,Sans,sans-serif' SIZE=3>"._T('titre_connexion_ldap')."</FONT>"; + echo "<BR />\n<FONT FACE='Verdana,Arial,Sans,sans-serif' SIZE=3>"._T('titre_connexion_ldap')."</FONT>"; echo "<P>"._T('entree_informations_connexion_ldap'); @@ -572,8 +575,8 @@ else if ($etape == 'ldap1') { $port_ldap = 389; // Recuperer les anciennes donnees (si presentes) - if (@file_exists("inc_connect_install.php3")) { - $s = @join('', @file("inc_connect_install.php3")); + if (@file_exists(_FILE_CONNECT_INS . _FILE_TMP . _EXTENSION_PHP)) { + $s = @join('', @file(_FILE_CONNECT_INS . _FILE_TMP . _EXTENSION_PHP)); if (ereg('ldap_connect\("(.*)","(.*)"\)', $s, $regs)) { $adresse_ldap = $regs[1]; $port_ldap = $regs[2]; @@ -582,21 +585,21 @@ else if ($etape == 'ldap1') { echo "<p><FORM ACTION='install.php3' METHOD='post'>"; echo "<INPUT TYPE='hidden' NAME='etape' VALUE='ldap2'>"; - echo "<fieldset><label><B>"._T('entree_adresse_annuaire')."</B><BR></label>"; - echo _T('texte_adresse_annuaire_1')."<BR>"; + echo "<fieldset><label><B>"._T('entree_adresse_annuaire')."</B><BR />\n</label>"; + echo _T('texte_adresse_annuaire_1')."<BR />\n"; echo "<INPUT TYPE='text' NAME='adresse_ldap' CLASS='formo' VALUE=\"$adresse_ldap\" SIZE='20'><P>"; - echo "<label><B>"._T('entree_port_annuaire')."</B><BR></label>"; - echo _T('texte_port_annuaire')."<BR>"; + echo "<label><B>"._T('entree_port_annuaire')."</B><BR />\n</label>"; + echo _T('texte_port_annuaire')."<BR />\n"; echo "<INPUT TYPE='text' NAME='port_ldap' CLASS='formo' VALUE=\"$port_ldap\" SIZE='20'><P></fieldset>"; echo "<p><fieldset>"; echo _T('texte_acces_ldap_anonyme_1')." "; - echo "<label><B>"._T('entree_login_ldap')."</B><BR></label>"; - echo _T('texte_login_ldap_1')."<br>"; + echo "<label><B>"._T('entree_login_ldap')."</B><BR />\n</label>"; + echo _T('texte_login_ldap_1')."<br />\n"; echo "<INPUT TYPE='text' NAME='login_ldap' CLASS='formo' VALUE=\"\" SIZE='40'><P>"; - echo "<label><B>"._T('entree_passe_ldap')."</B><BR></label>"; + echo "<label><B>"._T('entree_passe_ldap')."</B><BR />\n</label>"; echo "<INPUT TYPE='password' NAME='pass_ldap' CLASS='formo' VALUE=\"\" SIZE='40'></fieldset>"; echo "<p><DIV align='$spip_lang_right'><INPUT TYPE='submit' CLASS='fondl' NAME='Valider' VALUE='"._T('bouton_suivant')." >>'>"; diff --git a/ecrire/upgrade.php3 b/ecrire/upgrade.php3 index 9ee8346c1c7392be73494ac0c65af6f2e4b665c2..f19d5f4b8c85e395ee8fcf68d4244714c263b5ab 100644 --- a/ecrire/upgrade.php3 +++ b/ecrire/upgrade.php3 @@ -16,12 +16,12 @@ if (!$spip_lang) $spip_lang = "fr"; // Si reinstallation necessaire, message ad hoc if ($reinstall == 'oui') { - if (!@file_exists("inc_connect.php3")) { + if (!FILE_CONNECT) { Header("Location: install.php3"); exit; } - @copy("inc_connect.php3", "inc_connect_install.php3"); + @copy(_FILE_CONNECT, _FILE_CONNECT_INS): install_debut_html(_T('titre_page_upgrade')); echo "<p><b>"._T('texte_nouvelle_version_spip_1')."</b><p> "; diff --git a/inc-cache.php3 b/inc-cache.php3 index 1334c7985f7a154cb869c82dd4edf744c980bcd0..a008d51c035bb2f1e2f22edf1416451c83b604bb 100644 --- a/inc-cache.php3 +++ b/inc-cache.php3 @@ -205,7 +205,7 @@ function determiner_cache($delais, &$use_cache, &$chemin_cache) { // Sinon, tester qu'on a la connexion a la base if (!$use_cache) { - include_ecrire('inc_connect.php3'); + include_local(_FILE_CONNECT); if (!$GLOBALS['db_ok']) { if ($chemin_cache AND @file_exists($chemin_cache)) { $use_cache = true; diff --git a/inc-formulaires.php3 b/inc-formulaires.php3 index 06a1f31c55a75bdf57b0ac3018394db9f0f537b2..0750382e4ee18aea2b470dc61440346a4447d02d 100644 --- a/inc-formulaires.php3 +++ b/inc-formulaires.php3 @@ -50,7 +50,7 @@ function erreur($zetexte){ function reponse_confirmation($id_article, $val_confirm) { - include_ecrire("inc_connect.php3"); + include_local(_FILE_CONNECT); if ($GLOBALS['db_ok']) { include_ecrire("inc_texte.php3"); @@ -146,7 +146,7 @@ function reponse_confirmation($id_article, $val_confirm) { function reponse_signature($id_article) { global $nom_email, $adresse_email, $message, $nom_site, $url_site, $url_page; spip_log("signature petition $id_article ($adresse_email)"); - include_ecrire("inc_connect.php3"); + include_local(_FILE_CONNECT); if ($GLOBALS['db_ok']) { include_ecrire("inc_texte.php3"); diff --git a/inc-public.php3 b/inc-public.php3 index 5dd6089938be4fd9cda4d0bca73bb3285e0cee17..b31e73434d98752ead80cc0dfe56e5b409d82da8 100644 --- a/inc-public.php3 +++ b/inc-public.php3 @@ -16,6 +16,17 @@ if (defined("_INC_PUBLIC")) { else { define("_INC_PUBLIC", "1"); include ("ecrire/inc_version.php3"); + + + if (!_FILE_CONNECT) { + $db_ok = 0; + include_ecrire ("inc_presentation.php3"); + install_debut_html(_T('info_travaux_titre')); + echo "<P>"._T('info_travaux_texte')."</P>"; + install_fin_html(); + exit; + } + // // Initialisations // @@ -71,12 +82,13 @@ else { // demande de debug ? if ($var_debug AND ($code_activation_debug == $var_debug OR $auteur_session['statut'] == '0minirezo' - )) { + )) + { $recalcul = 'oui'; $var_debug = true; spip_log('debug !'); - } else - $var_debug = false; + } else + $var_debug = false; // Faut-il preparer les boutons d'admin ? $affiche_boutons_admin = (!$flag_preserver diff --git a/index.php3 b/index.php3 index b020ea2e82ba78c042ed20a2710b2ada43a0fd96..154579cc217060bb5ea9ce5a4f540d0401df3a68 100644 --- a/index.php3 +++ b/index.php3 @@ -1,16 +1 @@ -<?php - -if (!@file_exists("ecrire/inc_connect.php3")) { - $db_ok = 0; - include ("ecrire/inc_version.php3"); - include_ecrire ("inc_presentation.php3"); - install_debut_html(_T('info_travaux_titre')); - echo "<P>"._T('info_travaux_texte')."</P>"; - install_fin_html(); - exit; -} - -include ("sommaire.php3"); - - -?> +<?php include ("sommaire.php3"); ?> diff --git a/spip_acces_doc.php3 b/spip_acces_doc.php3 index 90e80700c1781974e8e7fd56b0b3ad112e6902bc..dd30e6fe9d4f227a3affc86075a60da9573fce23 100644 --- a/spip_acces_doc.php3 +++ b/spip_acces_doc.php3 @@ -14,7 +14,7 @@ else { $refus = false; include ("ecrire/inc_version.php3"); - include ("ecrire/inc_connect.php3"); + include_local(_FILE_CONNECT); include ("ecrire/inc_meta.php3"); include ("ecrire/inc_session.php3"); diff --git a/spip_cookie.php3 b/spip_cookie.php3 index 279189fd2d3b42f7f194aff86660e2e2fe03316b..a5c3440443f3bb30b0d758dbd82dcfffefbd48ce 100644 --- a/spip_cookie.php3 +++ b/spip_cookie.php3 @@ -2,7 +2,6 @@ include ("ecrire/inc_version.php3"); include_ecrire ("inc_session.php3"); - // determiner ou l'on veut retomber if ($url) $cible = new Link($url); @@ -84,6 +83,8 @@ if ($test_echec_cookie == 'oui') { // Tentative de login unset ($cookie_session); + + if ($essai_login == "oui") { // Recuperer le login en champ hidden if ($session_login_hidden AND !$session_login) @@ -94,9 +95,8 @@ if ($essai_login == "oui") { // Essayer differentes methodes d'authentification $auths = array('spip'); - include_ecrire('inc_connect.php3'); // pour savoir si ldap est present + include_local(_FILE_CONNECT); // pour savoir si ldap est present if ($ldap_present) $auths[] = 'ldap'; - $ok = false; reset($auths); while (list(, $nom_auth) = each($auths)) { @@ -185,7 +185,7 @@ if ($var_lang_ecrire) { spip_setcookie('spip_lang_ecrire', $var_lang_ecrire, time() + 365 * 24 * 3600); spip_setcookie('spip_lang', $var_lang_ecrire, time() + 365 * 24 * 3600); - if (@file_exists('ecrire/inc_connect.php3')) { + if (_FILE_CONNECT) { include_ecrire('inc_admin.php3'); if (verifier_action_auteur('var_lang_ecrire', $valeur, $id_auteur)) { spip_query ("UPDATE spip_auteurs SET lang = '".addslashes($var_lang_ecrire)."' WHERE id_auteur = ".$id_auteur);