diff --git a/ecrire/inc/utils.php b/ecrire/inc/utils.php index 832aa6ef9dcd291d6d344452362fe106d06af7a7..7633e15e964756ab9babe543eec292d9a770606c 100644 --- a/ecrire/inc/utils.php +++ b/ecrire/inc/utils.php @@ -207,9 +207,6 @@ function spip_connect($serveur='') { if (!isset($t[$serveur])) { $f = charger_fonction($serveur, 'base', true); $t[$serveur] = $f ? $f() : false; - - // on en profite pour fixer ca si absent de connect.php (hack) - define('_SPIP_CHMOD', 0777); } return $t[$serveur]; diff --git a/ecrire/inc_version.php b/ecrire/inc_version.php index 58f661cf89e4018b2199b5b570f9efaa802a3910..6c310abd2e33933b040e09554ba976e38b66854b 100644 --- a/ecrire/inc_version.php +++ b/ecrire/inc_version.php @@ -303,6 +303,13 @@ function spip_initialisation_parametree($pi, $pa, $ti, $ta) { define('_DIR_CONFIG', $pi); + // Le fichier de definition des droits d'acces en ecriture + define('_FILE_CHMOD_INS', ($pi . "chmod")); + define('_FILE_CHMOD', + (@is_readable($f = _FILE_CHMOD_INS . '.php') ? $f + : false)); + + // Le fichier de connexion a la base de donnees define('_FILE_CONNECT_INS_ANTE_192', (_DIR_RESTREINT . "inc_connect")); define('_FILE_CONNECT_INS', ($pi . "connect")); @@ -353,6 +360,14 @@ spip_initialisation_parametree( (_DIR_RACINE . _DIRNAME_TEMPORAIRE_ACCESSIBLE) ); +if (defined('_FILE_CHMOD')) { + if (@file_exists(_FILE_CHMOD)) { + include_once(_FILE_CHMOD); + } +}else { + define('_SPIP_CHMOD', 0777); +} + // // Definitions standards (charge aussi inc/flock) // diff --git a/ecrire/install/etape_1.php b/ecrire/install/etape_1.php index c04ed92b4d8ebca15ba9f7a766d7b2d2b132c66b..f6b01de73e307ce4c2db41a079f99793d1ddd4a8 100644 --- a/ecrire/install/etape_1.php +++ b/ecrire/install/etape_1.php @@ -42,6 +42,9 @@ function install_etape_1_dist() if ($port_db = $regs[2]) $adresse_db .= ':'.$port_db; $login_db = $regs[3]; } + } + if(@file_exists(_FILE_CHMOD_INS . _FILE_TMP . '.php')){ + $s = @join('', @file(_FILE_CHMOD_INS . _FILE_TMP . '.php')); if(ereg("define\('_SPIP_CHMOD', (.*)\)", $s, $regs)) { $chmod = $regs[1]; } diff --git a/ecrire/install/etape_4.php b/ecrire/install/etape_4.php index c49197fd4c7bfc0386f5be5034f46d3e37bd7d1a..b4639477535d8617fa211154566a81c2139bdb49 100644 --- a/ecrire/install/etape_4.php +++ b/ecrire/install/etape_4.php @@ -66,6 +66,16 @@ function install_etape_4_dist() } echo "($result_ok) -->"; + if($chmod) { + $conn = "<"."?php\n"; + $conn .= "if (!defined(\"_ECRIRE_INC_VERSION\")) return;\n"; + $conn .= "define('_SPIP_CHMOD', ".$chmod.");\n"; + $conn .= "?".">"; + if (!ecrire_fichier(_FILE_CHMOD_INS . _FILE_TMP . '.php', + $conn)) + redirige_par_entete(generer_url_ecrire('install')); + } + if ($result_ok) { if (preg_match(',(.*):(.*),', $adresse_db, $r)) list(,$adresse_db, $port) = $r; @@ -74,7 +84,6 @@ function install_etape_4_dist() $conn = "<"."?php\n"; $conn .= "if (!defined(\"_ECRIRE_INC_VERSION\")) return;\n"; $conn .= "\$GLOBALS['spip_connect_version'] = 0.4;\n"; - $conn .= "define('_SPIP_CHMOD', ".$chmod.");\n"; $conn .= $ligne_rappel; $conn .= "spip_connect_db(" . "'$adresse_db','$port','$login_db','$pass_db','$sel_db'" diff --git a/ecrire/install/etape_5.php b/ecrire/install/etape_5.php index 2d05daef653d01034a2ca94c6589c3e43f321f80..80809a088603fb3b3890d30d2f4b4a2a3370a639 100644 --- a/ecrire/install/etape_5.php +++ b/ecrire/install/etape_5.php @@ -22,6 +22,11 @@ function install_etape_5_dist() else redirige_par_entete(generer_url_ecrire('install')); + if (@file_exists(_FILE_CHMOD_INS . _FILE_TMP . '.php')) + include(_FILE_CHMOD_INS . _FILE_TMP . '.php'); + else + redirige_par_entete(generer_url_ecrire('install')); + echo "<BR />\n<FONT FACE='Verdana,Arial,Sans,sans-serif' SIZE=3>"._T('info_informations_personnelles')."</FONT>\n"; echo "<b>"._T('texte_informations_personnelles_1')."</b>"; diff --git a/ecrire/install/etape_6.php b/ecrire/install/etape_6.php index 839a6b17470a620d245f30176949aa159beb0e0d..efb18c017683b3cec25288f318267df6b13a1a2e 100644 --- a/ecrire/install/etape_6.php +++ b/ecrire/install/etape_6.php @@ -28,6 +28,11 @@ function install_etape_6_dist() else redirige_par_entete(generer_url_ecrire('install')); + if (@file_exists(_FILE_CHMOD_INS . _FILE_TMP . '.php')) + include(_FILE_CHMOD_INS . _FILE_TMP . '.php'); + else + redirige_par_entete(generer_url_ecrire('install')); + # maintenant on connait le vrai charset du site s'il est deja configure # sinon par defaut inc/meta reglera _DEFAULT_CHARSET # (les donnees arrivent de toute facon postees en _DEFAULT_CHARSET) @@ -78,6 +83,13 @@ function install_etape_6_dist() @unlink(_FILE_CONNECT_INS . _FILE_TMP . '.php'); } + if (!@rename(_FILE_CHMOD_INS . _FILE_TMP . '.php', + _FILE_CHMOD_INS . '.php')) { + copy(_FILE_CHMOD_INS . _FILE_TMP . '.php', + _FILE_CHMOD_INS . '.php'); + @unlink(_FILE_CHMOD_INS . _FILE_TMP . '.php'); + } + echo "<form action='./' method='post'>"; echo bouton_suivant(); echo "</FORM>";