From a9936bf2f8b1f125ed60a8fc032dc5ed205b5859 Mon Sep 17 00:00:00 2001 From: James <james@rezo.net> Date: Sat, 21 Oct 2006 00:03:13 +0000 Subject: [PATCH] =?UTF-8?q?la=20fonction=20spip=5Finitialisation=5Fparamet?= =?UTF-8?q?ree=20prend=20d=C3=A9sormais=204=20param=C3=A8tres=20repr=C3=A9?= =?UTF-8?q?sentant=20les=204=20r=C3=A9pertoires=20non=20partageables=20d'u?= =?UTF-8?q?n=20SPIP.=20=5FDIR=5FCHMOD,=20s'appelle=20maintenant=20=5FSPIP?= =?UTF-8?q?=5FCHMOD=20et=20est=20calcul=C3=A9e=20=C3=A0=20l'installation?= =?UTF-8?q?=20de=20spip.=20On=20colle=20la=20constante=20dans=20le=20fichi?= =?UTF-8?q?er=20de=20connection.=20On=20ajoute=20le=20r=C3=A9pertoire=20tm?= =?UTF-8?q?p=5Fimg/=20qui=20servira=20de=20base=20aux=20donn=C3=A9es=20vol?= =?UTF-8?q?atiles=20mais=20devant=20=C3=AAtre=20accessible=20via=20http.?= =?UTF-8?q?=20C'est=20l=C3=A0=20qu'on=20calculera=20tous=20les=20images=20?= =?UTF-8?q?r=C3=A9duites,=20(=C3=A0=20tester)=20On=20en=20profite=20pour?= =?UTF-8?q?=20faire=20une=20tr=C3=A8s=20l=C3=A9g=C3=A8re=20toilette=20au?= =?UTF-8?q?=20page=20d'installation.=20C'est=20pas=20encore=20fantastik=20?= =?UTF-8?q?;)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit TODO: la vérification des sous-répertoires de tmp/ en écriture, voire, leur création à la volée --- ecrire/action/purger.php | 8 ++--- ecrire/action/test_dirs.php | 68 ++++++++++++++++++++++++----------- ecrire/action/tester.php | 6 ++-- ecrire/inc/filtres.php | 2 +- ecrire/inc/filtres_images.php | 4 +-- ecrire/inc/flock.php | 4 +-- ecrire/inc/getdocument.php | 2 +- ecrire/inc/math.php | 2 +- ecrire/inc/minipres.php | 56 +++++++++++++++++++++-------- ecrire/inc/utils.php | 4 +-- ecrire/inc_version.php | 57 ++++++++++++++++------------- ecrire/install/etape_.php | 29 +++++++-------- ecrire/install/etape_1.php | 24 +++++++------ ecrire/install/etape_2.php | 13 +++---- ecrire/install/etape_3.php | 35 +++++++++--------- ecrire/install/etape_4.php | 7 ++-- ecrire/install/etape_5.php | 25 +++++++------ ecrire/install/etape_6.php | 6 ++-- ecrire/lang/spip_fr.php | 16 ++++----- 19 files changed, 215 insertions(+), 153 deletions(-) diff --git a/ecrire/action/purger.php b/ecrire/action/purger.php index 551f1e4f1f..e07fa28c59 100644 --- a/ecrire/action/purger.php +++ b/ecrire/action/purger.php @@ -42,7 +42,7 @@ function action_purger_dist() break; case 'vignettes': - purger_repertoire(_DIR_IMG, $age='ignore', $regexp = '^cache\-'); + purger_repertoire(_DIR_TMP_IMG, $age='ignore', $regexp = '^cache\-'); spip_log('vider le cache'); supprime_invalideurs(); purger_repertoire(_DIR_CACHE, 0); @@ -51,7 +51,7 @@ function action_purger_dist() case 'taille_vignettes': global $lang; - $handle = @opendir(_DIR_IMG); + $handle = @opendir(_DIR_TMP_IMG); if (!$handle) return; $taille = 0; @@ -59,8 +59,8 @@ function action_purger_dist() // Eviter ".", "..", ".htaccess", etc. if ($fichier[0] == '.') continue; if ($regexp AND !ereg($regexp, $fichier)) continue; - if (is_dir(_DIR_IMG.$fichier) AND ereg("^cache-", $fichier)) { - $taille += calculer_taille_dossier(_DIR_IMG.$fichier); + if (is_dir(_DIR_TMP_IMG.$fichier) AND ereg("^cache-", $fichier)) { + $taille += calculer_taille_dossier(_DIR_TMP_IMG.$fichier); } } closedir($handle); diff --git a/ecrire/action/test_dirs.php b/ecrire/action/test_dirs.php index 955230b055..063dd74d6a 100644 --- a/ecrire/action/test_dirs.php +++ b/ecrire/action/test_dirs.php @@ -22,13 +22,46 @@ include_spip('inc/minipres'); // // http://doc.spip.org/@test_ecrire function test_ecrire($my_dir) { - $ok = true; - $nom_fich = "$my_dir/test.txt"; - $f = @fopen($nom_fich, "w"); - if (!$f) $ok = false; - else if (!@fclose($f)) $ok = false; - else if (!@unlink($nom_fich)) $ok = false; - return $ok; + static $chmod = 0; + + $ok = false; + $script = @file_exists('spip_loader.php') ? 'spip_loader.php' : $_SERVER['PHP_SELF']; + $self = basename($script); + $uid = @fileowner('.'); + $uid2 = @fileowner($self); + $gid = @filegroup('.'); + $gid2 = @filegroup($self); + $perms = @fileperms($self); + + // Comparer l'appartenance d'un fichier cree par PHP + // avec celle du script et du repertoire courant + if(!$chmod) { + @rmdir('test'); + @unlink('test'); // effacer au cas ou + @touch('test'); + if ($uid > 0 && $uid == $uid2 && @fileowner('test') == $uid) + $chmod = 0700; + else if ($gid > 0 && $gid == $gid2 && @filegroup('test') == $gid) + $chmod = 0770; + else + $chmod = 0777; + // Appliquer de plus les droits d'acces du script + if ($perms > 0) { + $perms = ($perms & 0777) | (($perms & 0444) >> 2); + $chmod |= $perms; + } + @unlink('test'); + } + // Verifier que les valeurs sont correctes + $f = @fopen($my_dir.'test.php', 'w'); + if ($f) { + @fputs($f, '<'.'?php $ok = true; ?'.'>'); + @fclose($f); + @chmod($my_dir.'test.php', $chmod); + include($my_dir.'test.php'); + } + @unlink($my_dir.'test.php'); + return $ok?$chmod:false; } // @@ -40,6 +73,7 @@ function test_ecrire($my_dir) { function action_test_dirs_dist() { global $test_dir, $test_dirs; + $chmod = 0; if ($test_dir) { if (!ereg("/$", $test_dir)) $test_dir .= '/'; @@ -47,27 +81,21 @@ if ($test_dir) { } else { if (!_FILE_CONNECT) - $test_dirs[] = dirname(_FILE_CONNECT_INS); + $test_dirs[] = dirname(_FILE_CONNECT_INS).'/'; } $bad_dirs = array(); $absent_dirs = array();; while (list(, $my_dir) = each($test_dirs)) { + $test = test_ecrire($my_dir); if (!test_ecrire($my_dir)) { - @umask(0); if (@file_exists($my_dir)) { - @chmod($my_dir, 0777); - // ??? - if (!test_ecrire($my_dir)) - @chmod($my_dir, 0775); - if (!test_ecrire($my_dir)) - @chmod($my_dir, 0755); - if (!test_ecrire($my_dir)) - $bad_dirs[] = "<li>".$my_dir; + $bad_dirs[] = "<li>".$my_dir."</li>"; } else - $absent_dirs[] = "<li>". $my_dir; + $absent_dirs[] = "<li>".$my_dir."</li>"; } + $chmod = max($chmod, $test); } if ($bad_dirs OR $absent_dirs) { @@ -101,13 +129,13 @@ if ($bad_dirs OR $absent_dirs) { (!$test_dir ? "" : "<input type='hidden' name='test_dir' value='$test_dir' />") . "<DIV align='right'><input type='submit' class='fondl' value='". - _T('login_recharger')."'></DIV>" . + _T('login_recharger')."' /></DIV>" . "</form>"; minipres($titre, $res); } else { if (!_FILE_CONNECT) - header("Location: " . generer_url_ecrire("install", "etape=1", true)); + header("Location: " . generer_url_ecrire("install", "etape=1&chmod=".$chmod, true)); else header("Location: " . _DIR_RESTREINT_ABS); } diff --git a/ecrire/action/tester.php b/ecrire/action/tester.php index 3d03aff052..c162ea3999 100644 --- a/ecrire/action/tester.php +++ b/ecrire/action/tester.php @@ -88,7 +88,7 @@ function action_tester_dist() { "pnmtojpeg", $pnmscale_command); $vignette = _ROOT_IMG_PACK."test.jpg"; - $dest = _DIR_IMG . "test-jpg.jpg"; + $dest = _DIR_TMP_IMG . "test-jpg.jpg"; $commande = "$jpegtopnm_command $vignette | $pnmscale_command -width 10 | $pnmtojpeg_command > $dest"; spip_log($commande); exec($commande); @@ -98,7 +98,7 @@ function action_tester_dist() { $giftopnm_command = str_replace("pnmscale", "giftopnm", $pnmscale_command); $pnmtojpeg_command = str_replace("pnmscale", "pnmtojpeg", $pnmscale_command); $vignette = _ROOT_IMG_PACK."test.gif"; - $dest = _DIR_IMG . "test-gif.jpg"; + $dest = _DIR_TMP_IMG . "test-gif.jpg"; $commande = "$giftopnm_command $vignette | $pnmscale_command -width 10 | $pnmtojpeg_command > $dest"; spip_log($commande); exec($commande); @@ -108,7 +108,7 @@ function action_tester_dist() { $pngtopnm_command = str_replace("pnmscale", "pngtopnm", $pnmscale_command); $vignette = _ROOT_IMG_PACK."test.png"; - $dest = _DIR_IMG . "test-gif.jpg"; + $dest = _DIR_TMP_IMG . "test-gif.jpg"; $commande = "$pngtopnm_command $vignette | $pnmscale_command -width 10 | $pnmtojpeg_command > $dest"; spip_log($commande); exec($commande); diff --git a/ecrire/inc/filtres.php b/ecrire/inc/filtres.php index 1eae7409fe..8cb8e35b35 100644 --- a/ecrire/inc/filtres.php +++ b/ecrire/inc/filtres.php @@ -1589,7 +1589,7 @@ function direction_css ($css, $voulue='') { return $f; // 2. - $f = sous_repertoire (_DIR_IMG, 'cache-css') + $f = sous_repertoire (_DIR_TMP_IMG, 'cache-css') . preg_replace(',.*/(.*?)(_rtl)?\.css,', '\1', $css) . '.' . substr(md5($css), 0,4) . '_' . $ndir . '.css'; diff --git a/ecrire/inc/filtres_images.php b/ecrire/inc/filtres_images.php index de47700ee8..23b96ef86d 100644 --- a/ecrire/inc/filtres_images.php +++ b/ecrire/inc/filtres_images.php @@ -43,7 +43,7 @@ function image_valeurs_trans($img, $effet, $forcer_format = false) { $nom_fichier = substr($fichier, 0, strlen($fichier) - 4); $fichier_dest = "$nom_fichier-$effet"; $fichier_dest = md5($fichier_dest); - $fichier_dest = sous_repertoire(_DIR_IMG, "cache-gd2") . $fichier_dest . "." .$terminaison_dest; + $fichier_dest = sous_repertoire(_DIR_TMP_IMG, "cache-gd2") . $fichier_dest . "." .$terminaison_dest; $creer = true; if (@filemtime($fichier) < @filemtime($fichier_dest)) { @@ -1623,7 +1623,7 @@ function produire_image_typo() { $string = "$text-$taille-$couleur-$align-$police-$largeur-$hauteur_ligne-$padding"; $query = md5($string); - $dossier = sous_repertoire(_DIR_IMG, 'cache-texte'); + $dossier = sous_repertoire(_DIR_TMP_IMG, 'cache-texte'); $fichier = "$dossier$query.png"; $flag_gd_typo = function_exists("imageftbbox") diff --git a/ecrire/inc/flock.php b/ecrire/inc/flock.php index d6b9ef604a..abb52e70cc 100644 --- a/ecrire/inc/flock.php +++ b/ecrire/inc/flock.php @@ -162,8 +162,8 @@ function sous_repertoire($base, $subdir, $nobase = false) { if (@file_exists("$path/.ok")) return "$baseaff$subdir/"; - @mkdir($path, _DIR_CHMOD); - @chmod($path, _DIR_CHMOD); + @mkdir($path, _SPIP_CHMOD); + @chmod($path, _SPIP_CHMOD); $ok = false; if ($f = @fopen("$path/dir_test.php", "w")) { diff --git a/ecrire/inc/getdocument.php b/ecrire/inc/getdocument.php index 968e7fdb91..5886b76b6a 100644 --- a/ecrire/inc/getdocument.php +++ b/ecrire/inc/getdocument.php @@ -88,7 +88,7 @@ function deplacer_fichier_upload($source, $dest, $move=false) { else $ok = @copy($source, $dest); if (!$ok) $ok = @move_uploaded_file($source, $dest); if ($ok) - @chmod($dest, _DIR_CHMOD & ~0111); + @chmod($dest, _SPIP_CHMOD & ~0111); else { $f = @fopen($dest,'w'); if ($f) { diff --git a/ecrire/inc/math.php b/ecrire/inc/math.php index bb12fcc4fa..1723e22e09 100644 --- a/ecrire/inc/math.php +++ b/ecrire/inc/math.php @@ -38,7 +38,7 @@ function image_math($tex) { // Regarder dans le repertoire local des images TeX et blocs MathML if (!@is_dir(_DIR_TeX)) - @mkdir (_DIR_TeX, _DIR_CHMOD); + @mkdir (_DIR_TeX, _SPIP_CHMOD); $fichier = _DIR_TeX .md5(trim($tex)).$ext; diff --git a/ecrire/inc/minipres.php b/ecrire/inc/minipres.php index c983cc1a01..031ec2c3a9 100644 --- a/ecrire/inc/minipres.php +++ b/ecrire/inc/minipres.php @@ -20,6 +20,8 @@ include_spip('inc/lang'); // http://doc.spip.org/@install_debut_html function install_debut_html($titre = 'AUTO') { + global $spip_lang_right; + include_spip('inc/filtres'); include_spip('inc/headers'); utiliser_langue_visiteur(); @@ -35,28 +37,54 @@ function install_debut_html($titre = 'AUTO') { header('Content-Type: text/html; charset=utf-8'); echo _DOCTYPE_ECRIRE , - html_lang_attributes(), - "<head>\n", - "<title>", - textebrut($titre), - "</title> - <style type='text/css'><!--\n/*<![CDATA[*/\n\n\n", - "a {text-decoration: none; }", - "img {border: 0; }", + html_lang_attributes(), + "<head>\n", + "<title>", + textebrut($titre), + "</title> + <style type='text/css'><!--\n/*<![CDATA[*/\n\n\n", + "body { background: #FFF; color: #000; }\n", + "h1 { color: #970038; margin-top: 50px; font-family: Verdana; font-weigth: bold; font-size: 18px }\n", + "a { color: #E86519; text-decoration: none; }\n", + "a:visited { color: #6E003A; }\n", + "a:active { color: #FF9900; }\n", + "img { border: 0; }\n", + "#minipres { width: 30em; text-align: center; margin-left: auto; margin-right: auto; }\n", + "ul, p, label { text-align: justify; margin: 0;}\n", + "fieldset { margin: 0.5em 0; }\n", + ".suivant { text-align: $spip_lang_right; }\n", + ".sans_puce { list-style-type: none; }\n", + ".fondl { padding: 3px; background-color: #eee; border: 1px solid #333; + background-position: center bottom; + font-size: 0.8em; + font-family: Verdana,Arial,Sans,sans-serif; }\n", + ".formo { width: 100%; display: block; padding: 3px; + margin-top: 1em; + background-color: #FFF; + border: 1px solid #333; + background-position: center bottom; + behavior: url(../dist/win_width.htc); + font-size: 0.8em; + font-family: Verdana,Arial,Sans,sans-serif; }\n", "\n\n]]>\n--></style>\n\n </head> -<body bgcolor='#FFFFFF' text='#000000' link='#E86519' vlink='#6E003A' alink='#FF9900'> -<table style='margin-top:50px; width: 450px;' align='center'> -<tr><th style='color: #970038;text-align: left;font-family: Verdana; font-weigth: bold; font-size: 18px'>", +<body> + <div id='minipres'> + <h1>", $titre , - "</th></tr> -<tr><td class='serif'>"; + "</h1> + <div>\n"; } // http://doc.spip.org/@install_fin_html function install_fin_html() { + echo "\n\t</div>\n\t</div>\n</body>\n</html>"; +} - echo '</td></tr></table></body></html>'; +function bouton_suivant() { + return "<p class='suivant'><input type='submit' class='fondl' value='" . + _T('bouton_suivant') . + " >>' /></p>"; } // http://doc.spip.org/@minipres diff --git a/ecrire/inc/utils.php b/ecrire/inc/utils.php index 1d9f23c712..4367780f8a 100644 --- a/ecrire/inc/utils.php +++ b/ecrire/inc/utils.php @@ -489,7 +489,7 @@ function spip_touch($fichier, $duree=0, $touch=true) { || (@filemtime($fichier) < time() - $duree)) { if ($touch) { if (!@touch($fichier)) { @unlink($fichier); @touch($fichier); }; - if (!$exists) @chmod($fichier, _DIR_CHMOD & ~0111); + if (!$exists) @chmod($fichier, _SPIP_CHMOD & ~0111); } return true; } @@ -1119,7 +1119,7 @@ function spip_desinfecte(&$t) { function verifier_visiteur() { // Rq: pour que cette fonction marche depuis mes_options elle a besoin // que les constantes principales soient initialisees - spip_initialisation_parametree(_DIR_RACINE, _DIR_RESTREINT) ; + spip_initialisation_parametree(_DIR_CONFIG, _DIR_IMG, _DIR_TMP_IMG, _DIR_TMP) ; if (isset($_COOKIE['spip_session']) OR (isset($_SERVER['PHP_AUTH_USER']) AND !$GLOBALS['ignore_auth_http'])) { diff --git a/ecrire/inc_version.php b/ecrire/inc_version.php index 25b0feb55a..06952545ae 100644 --- a/ecrire/inc_version.php +++ b/ecrire/inc_version.php @@ -28,13 +28,25 @@ define("_ECRIRE_INC_VERSION", "1"); # ou inversement ? @define('_DIR_RACINE', _DIR_RESTREINT ? '' : '../'); -# le nom du repertoire config/ -define('_DIR_CONFIG', _DIR_RACINE . "config/"); +# le nom du repertoire plugins/ +define('_DIR_PLUGINS', _DIR_RACINE . "plugins/"); // nombre de repertoires depuis la racine $profondeur_url = _DIR_RESTREINT ? 0 : 1; +# LES 4 repertoires que les scripts lances par httpd doivent pouvoir modifier +# Par defaut ces 4 noms seront suffixes par _DIR_RACINE (cf plus bas) +# mais on peut les mettre ailleurs et changer completement leur nom +# le nom du repertoire des fichiers Permanents Inaccessibles par http:// +define('_DIR_CONFIG', _DIR_RACINE . "config/"); +# le nom du repertoire des fichiers Permanents Accessibles par http:// +define('_DIR_IMG', _DIR_RACINE . "IMG/"); +# le nom du repertoire des fichiers Temporaires Accessibles par http:// +define('_DIR_TMP_IMG', _DIR_RACINE . "tmp_img/"); +# le nom du repertoire des fichiers Temporaires Inaccessibles par http:// +define('_DIR_TMP', _DIR_RACINE . "tmp/"); + // // *** Parametrage par defaut de SPIP *** // @@ -262,25 +274,23 @@ $auteur_session = $connect_statut = $connect_toutes_rubriques = $connect_id_rubr // mais ne touche pas a cette variable si elle est deja definie // afin que mes_options.php puisse en specifier d'autres. -function spip_initialisation_parametree($dir1) { +function spip_initialisation_parametree($pi, $pa, $ti, $ta) { static $too_late = false; if ($too_late) return; $too_late = true; - define('_DIR_CHMOD', 0777); + define('_DIR_DOC', $pa); + define('_DIR_LOGOS', $pa); + define('_DIR_IMG_ICONES', $pa . "icones/"); - define('_DIR_IMG', $dir1 ."IMG/"); - define('_DIR_DOC', $dir1 ."IMG/"); - define('_DIR_LOGOS', $dir1 ."IMG/"); - define('_DIR_CACHE', $dir1 ."tmp/CACHE/"); - define('_DIR_SKELS', $dir1 ."tmp/CACHE/skel/"); - define('_DIR_PLUGINS', $dir1 . "plugins/"); + define('_DIR_TeX', _DIR_TMP . "cache-TeX/"); - define('_DIR_TMP', $dir1 . "tmp/"); - define('_DIR_DUMP', $dir1 . "tmp/data/"); - define('_DIR_SESSIONS', $dir1 . "tmp/sessions/"); - define('_DIR_TRANSFERT', $dir1 . "tmp/upload/"); + define('_DIR_DUMP', $ta . "data/"); + define('_DIR_SESSIONS', $ta . "sessions/"); + define('_DIR_TRANSFERT', $ta . "upload/"); + define('_DIR_CACHE', $ta . "CACHE/"); + define('_DIR_SKELS', $ta . "CACHE/skel/"); // les fichiers qu'on y met, entre autres define('_FILE_CRON_LOCK', _DIR_TMP . 'cron.lock'); @@ -288,21 +298,18 @@ function spip_initialisation_parametree($dir1) { define('_FILE_GARBAGE', _DIR_TMP . '.poubelle'); define('_FILE_META', _DIR_TMP . 'meta_cache.txt'); - // sous-repertoires d'images et d'icones - define('_DIR_TeX', _DIR_IMG . "cache-TeX/"); - define('_DIR_IMG_ICONES', _DIR_IMG . "icones/"); // Le fichier de connexion a la base de donnees - define('_FILE_CONNECT_INS_191', (_DIR_RESTREINT . "inc_connect")); - define('_FILE_CONNECT_INS', (_DIR_CONFIG . "connect")); + define('_FILE_CONNECT_INS_ANTE_192', (_DIR_RESTREINT . "inc_connect")); + define('_FILE_CONNECT_INS', ($pi . "connect")); define('_FILE_CONNECT', (@is_readable($f = _FILE_CONNECT_INS . '.php') ? $f - : (@is_readable($f = _FILE_CONNECT_INS_191 . '.php') ? $f - : (@is_readable($f = _FILE_CONNECT_INS_191 . '.php3') ? $f + : (@is_readable($f = _FILE_CONNECT_INS_ANTE_192 . '.php') ? $f + : (@is_readable($f = _FILE_CONNECT_INS_ANTE_192 . '.php3') ? $f : false)))); if (!isset($GLOBALS['test_dirs'])) - $GLOBALS['test_dirs'] = array(_DIR_IMG, _DIR_TMP); + $GLOBALS['test_dirs'] = array($pa, $ti, $ta); } // @@ -314,7 +321,7 @@ if (defined('_FILE_OPTIONS')) { include_once(_FILE_OPTIONS); } } else { - if (@file_exists(_DIR_CONFIG . 'mes_options.php')) { + if (@file_exists(_DIR_PI . 'mes_options.php')) { define('_FILE_OPTIONS',_DIR_CONFIG . 'mes_options.php'); include_once(_FILE_OPTIONS); } @@ -335,7 +342,7 @@ if (defined('_FILE_OPTIONS')) { // // mais cette fonction a peut-etre deja ete appelee par mes_options -spip_initialisation_parametree(_DIR_RACINE) ; +spip_initialisation_parametree(_DIR_CONFIG, _DIR_IMG, _DIR_TMP_IMG, _DIR_TMP); // // Definitions standards (charge aussi inc/flock) @@ -383,7 +390,7 @@ OR _request('action') == 'test_dirs')) { } else { // Si on est dans le site public, dire que qq s'en occupe include_spip('inc/minipres'); - minipres(_T('info_travaux_titre'), "<p>"._T('info_travaux_texte')."</p>"); + minipres(_T('info_travaux_titre'), "<p style='text-align: center;'>"._T('info_travaux_texte')."</p>"); } // autrement c'est une install ad hoc (spikini...), on sait pas faire } diff --git a/ecrire/install/etape_.php b/ecrire/install/etape_.php index f29780de63..4930b1ed39 100644 --- a/ecrire/install/etape_.php +++ b/ecrire/install/etape_.php @@ -20,22 +20,19 @@ function install_etape__dist() redirige_par_entete(generer_url_action('test_dirs')); else { install_debut_html(); - - echo "<p align='center'><img src='" . _DIR_IMG_PACK . "logo-spip.gif'></p>", - "<p style='text-align: center; font-family: Verdana,Arial,Sans,sans-serif; font-size: 10px;'>", - info_copyright(), - "</p>", - "<p>" . _T('install_select_langue'), - "<p><div align='center'>", - $menu_langues, - "</div>", - "<p><form action='", generer_url_action('test_dirs'), - "'>", - '<input type="hidden" name="action" value="test_dirs" />', - "<div align='$spip_lang_right'><input type='submit' class='fondl' VALUE='", - _T('bouton_suivant'), - " >>'>", - "</form>"; + echo "<p align='center'><img alt='SPIP' src='" . _DIR_IMG_PACK . "logo-spip.gif' /></p>\n", + "<p style='text-align: center; font-family: Verdana,Arial,Sans,sans-serif; font-size: 10px;'>", + info_copyright(), + "</p>\n", + "<p>" . _T('install_select_langue'), + "</p><div align='center'>", + $menu_langues, + "</div>\n", + "<form action='", generer_url_action('test_dirs'), + "'>", + '<input type="hidden" name="action" value="test_dirs" />', + bouton_suivant(), + "</form>"; install_fin_html(); } } diff --git a/ecrire/install/etape_1.php b/ecrire/install/etape_1.php index 885a82dd8c..21dd9fd5de 100644 --- a/ecrire/install/etape_1.php +++ b/ecrire/install/etape_1.php @@ -29,6 +29,7 @@ function install_etape_1_dist() list($adresse_db, $login_db) = login_hebergeur(); $pass_db = ''; + $chmod = (isset($_GET['chmod']) AND preg_match(',^[0-9]+$,', $_GET['chmod']))? sprintf('%04o', $_GET['chmod']):'0777'; // Recuperer les anciennes donnees pour plus de facilite (si presentes) if (@file_exists(_FILE_CONNECT_INS . _FILE_TMP . '.php')) { $s = @join('', @file(_FILE_CONNECT_INS . _FILE_TMP . '.php')); @@ -41,25 +42,26 @@ function install_etape_1_dist() if ($port_db = $regs[2]) $adresse_db .= ':'.$port_db; $login_db = $regs[3]; } + if(ereg("define\(_SPIP_CHMOD, (.*)\)", $s, $regs)) { + $chmod = $regs[1]; + } } - echo generer_url_post_ecrire('install'); - echo "<INPUT TYPE='hidden' NAME='etape' VALUE='2'>"; + echo "<INPUT TYPE='hidden' NAME='etape' VALUE='2' />"; + echo "<INPUT TYPE='hidden' NAME='chmod' VALUE='$chmod' />"; 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 "<p>"._T('entree_base_donnee_2')."</p>\n"; + echo "<INPUT TYPE='text' NAME='adresse_db' CLASS='formo' VALUE=\"$adresse_db\" SIZE='40' /></fieldset>"; 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 "<p>"._T('entree_login_connexion_2')."</p>\n"; + echo "<INPUT TYPE='text' NAME='login_db' CLASS='formo' VALUE=\"$login_db\" SIZE='40' /></fieldset>"; 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' VALUE='"._T('bouton_suivant')." >>'>"; - + echo "<p>"._T('entree_mot_passe_2')."</p>\n"; + echo "<INPUT TYPE='password' NAME='pass_db' CLASS='formo' VALUE=\"$pass_db\" SIZE='40' /></fieldset>"; + echo bouton_suivant(); echo "</FORM>"; install_fin_html(); diff --git a/ecrire/install/etape_2.php b/ecrire/install/etape_2.php index 1fc3f41f80..6b74e07e42 100644 --- a/ecrire/install/etape_2.php +++ b/ecrire/install/etape_2.php @@ -13,7 +13,7 @@ // http://doc.spip.org/@inc_install_2 function install_etape_2_dist() { - global $adresse_db, $login_db, $pass_db, $spip_lang_right; + global $adresse_db, $login_db, $pass_db, $spip_lang_right,$chmod; install_debut_html(); @@ -32,12 +32,13 @@ function install_etape_2_dist() echo "<B>"._T('info_connexion_ok')."</B><P> "._T('info_etape_suivante_2'); echo generer_url_post_ecrire('install'); - echo "<INPUT TYPE='hidden' NAME='etape' VALUE='3'>"; - 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='etape' VALUE='3' />"; + echo "<INPUT TYPE='hidden' NAME='chmod' VALUE='$chmod' />"; + 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\" />"; - echo "<DIV align='$spip_lang_right'><INPUT TYPE='submit' CLASS='fondl' VALUE='"._T('bouton_suivant')." >>'>"; + echo "</p>".bouton_suivant(); echo "</FORM>"; } else { diff --git a/ecrire/install/etape_3.php b/ecrire/install/etape_3.php index ffc2a694dc..5b924bfdc6 100644 --- a/ecrire/install/etape_3.php +++ b/ecrire/install/etape_3.php @@ -13,34 +13,35 @@ // http://doc.spip.org/@inc_install_3 function install_etape_3_dist() { - global $adresse_db, $login_db, $pass_db, $spip_lang_right; + global $adresse_db, $login_db, $pass_db, $spip_lang_right, $chmod; install_debut_html(); 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>\n"; + echo "\n"; echo generer_url_post_ecrire('install'); - 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>\n"; + echo "<INPUT TYPE='hidden' NAME='etape' VALUE='4' />"; + echo "<INPUT TYPE='hidden' NAME='chmod' VALUE='$chmod' />"; + 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\" />\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 />\n</label>"; + echo "<fieldset><label><B>"._T('texte_choix_base_1')."</B></label>\n"; if ($result AND (($n = @mysql_num_rows($result)) > 0)) { echo "<B>"._T('texte_choix_base_2')."</B><P> "._T('texte_choix_base_3'); - echo "<UL>"; + echo "<ul class='sans_puce'>"; $bases = ""; 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\n"; + $base = "<li><INPUT NAME=\"choix_db\" VALUE=\"".$table_nom."\" TYPE=Radio id='tab$i'"; + $base_fin = " /><label for='tab$i'>".$table_nom."</label></li>\n\n"; if ($table_nom == $login_db) { $bases = "$base CHECKED$base_fin".$bases; $checked = true; @@ -68,9 +69,9 @@ function install_etape_3_dist() if ($ok) { echo _T('avis_lecture_noms_bases_3'); - echo "<UL>"; - echo "<INPUT NAME=\"choix_db\" VALUE=\"".$test_base."\" TYPE=Radio id='stand' CHECKED>"; - echo "<label for='stand'>".$test_base."</label><BR />\n"; + echo "<ul class='sans_puce'>"; + echo "<li><INPUT NAME=\"choix_db\" VALUE=\"".$test_base."\" TYPE=Radio id='stand' CHECKED>"; + echo "<label for='stand'>".$test_base."</label></li>\n"; echo "</UL>"; echo _T('info_ou')." "; $checked = true; @@ -79,12 +80,10 @@ function install_etape_3_dist() } echo "<INPUT NAME=\"choix_db\" VALUE=\"new_spip\" TYPE=Radio id='nou'"; if (!$checked) echo " CHECKED"; - echo "> <label for='nou'>"._T('info_creer_base')."</label> "; - echo "<INPUT TYPE='text' NAME='table_new' CLASS='fondl' VALUE=\"spip\" SIZE='20'></fieldset><P>"; - - echo "<DIV align='$spip_lang_right'><INPUT TYPE='submit' CLASS='fondl' VALUE='"._T('bouton_suivant')." >>'>"; - + echo " /> <label for='nou'>"._T('info_creer_base')."</label> "; + echo "<INPUT TYPE='text' NAME='table_new' CLASS='fondl' VALUE=\"spip\" SIZE='20' /></fieldset>"; + echo bouton_suivant(); echo "</FORM>"; install_fin_html(); diff --git a/ecrire/install/etape_4.php b/ecrire/install/etape_4.php index 85a04cc3dd..c49197fd4c 100644 --- a/ecrire/install/etape_4.php +++ b/ecrire/install/etape_4.php @@ -13,7 +13,7 @@ // http://doc.spip.org/@inc_install_4 function install_etape_4_dist() { - global $adresse_db, $choix_db, $login_db, $pass_db, $spip_lang_right, $spip_version, $table_new; + global $adresse_db, $choix_db, $login_db, $pass_db, $spip_lang_right, $spip_version, $table_new, $chmod; install_debut_html(); @@ -74,6 +74,7 @@ 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'" @@ -87,9 +88,9 @@ function install_etape_4_dist() echo "<B>"._T('info_base_installee')."</B><P>\n"._T('info_etape_suivante_1'); echo generer_url_post_ecrire('install'); - echo "<INPUT TYPE='hidden' NAME='etape' VALUE='5'>"; + echo "<INPUT TYPE='hidden' NAME='etape' VALUE='5' />"; - echo "<DIV align='$spip_lang_right'><INPUT TYPE='submit' CLASS='fondl' VALUE='"._T('bouton_suivant')." >>'>"; + echo bouton_suivant(); echo "</FORM>"; } diff --git a/ecrire/install/etape_5.php b/ecrire/install/etape_5.php index 3aff37a5e0..2d05daef65 100644 --- a/ecrire/install/etape_5.php +++ b/ecrire/install/etape_5.php @@ -22,8 +22,7 @@ function install_etape_5_dist() 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>"; - echo "<P>\n"; + 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>"; echo aide ("install5"); @@ -32,37 +31,37 @@ function install_etape_5_dist() echo generer_url_post_ecrire('install'); - echo "<INPUT TYPE='hidden' NAME='etape' VALUE='6'>"; + echo "<INPUT TYPE='hidden' NAME='etape' VALUE='6' />"; 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 "<INPUT TYPE='text' NAME='nom' CLASS='formo' VALUE=\"$nom\" SIZE='40' /><P>\n"; 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 "<INPUT TYPE='text' NAME='email' CLASS='formo' VALUE=\"$email\" SIZE='40' /></fieldset>\n"; 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 "<INPUT TYPE='text' NAME='login' CLASS='formo' VALUE=\"$login\" SIZE='40' />\n"; 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 "<INPUT TYPE='password' NAME='pass' CLASS='formo' VALUE=\"$pass\" SIZE='40' /></fieldset>\n"; - echo "<DIV align='$spip_lang_right'><INPUT TYPE='submit' CLASS='fondl' VALUE='"._T('bouton_suivant')." >>'>"; - echo "</FORM>"; - echo "<p>\n"; + echo bouton_suivant(); + echo "</FORM>\n"; if (function_exists('ldap_connect') AND !$ldap_present) { echo "<div style='border: 1px solid #404040; padding: 10px; text-align: left;'>"; echo "<b>"._T('info_authentification_externe')."</b>"; echo "<p>\n"._T('texte_annuaire_ldap_1'); echo generer_url_post_ecrire('install'); - echo "<INPUT TYPE='hidden' NAME='etape' VALUE='ldap1'>"; - echo "<DIV align='$spip_lang_right'><INPUT TYPE='submit' CLASS='fondl' VALUE=\""._T('bouton_acces_ldap')."\">"; - echo "</FORM>"; + echo "<INPUT TYPE='hidden' NAME='etape' VALUE='ldap1' />"; + echo "<DIV align='$spip_lang_right'><INPUT TYPE='submit' CLASS='fondl' VALUE=\""._T('bouton_acces_ldap')."\" /></div>"; + echo "</FORM> + </div>"; } install_fin_html(); diff --git a/ecrire/install/etape_6.php b/ecrire/install/etape_6.php index cfe9f9357d..839a6b1747 100644 --- a/ecrire/install/etape_6.php +++ b/ecrire/install/etape_6.php @@ -18,10 +18,10 @@ function install_etape_6_dist() install_debut_html(); - echo "<BR><FONT FACE='Verdana,Arial,Sans,sans-serif' SIZE=3>"._T('info_derniere_etape')."</B></FONT>"; + echo "<p><FONT FACE='Verdana,Arial,Sans,sans-serif' SIZE=3>"._T('info_derniere_etape')."</B></FONT></p>"; echo "<P>"; echo "<B>"._T('info_code_acces')."</B>"; - echo "<P>"._T('info_utilisation_spip'); + echo "</p><P>"._T('info_utilisation_spip')."</p>"; if (@file_exists(_FILE_CONNECT_INS . _FILE_TMP . '.php')) include(_FILE_CONNECT_INS . _FILE_TMP . '.php'); @@ -79,7 +79,7 @@ function install_etape_6_dist() } echo "<form action='./' method='post'>"; - echo "<DIV align='$spip_lang_right'><INPUT TYPE='submit' CLASS='fondl' VALUE='"._T('bouton_suivant')." >>'>"; + echo bouton_suivant(); echo "</FORM>"; ecrire_metas(); diff --git a/ecrire/lang/spip_fr.php b/ecrire/lang/spip_fr.php index 528902a814..69bb2ef804 100644 --- a/ecrire/lang/spip_fr.php +++ b/ecrire/lang/spip_fr.php @@ -183,15 +183,15 @@ $GLOBALS[$GLOBALS['idx_lang']] = array( 'dirs_commencer' => ' afin de commencer réellement l\'installation', 'dirs_preliminaire' => 'Préliminaire : <b>Régler les droits d\'accès</b>', 'dirs_probleme_droits' => 'Problème de droits d\'accès', -'dirs_repertoires_absents' => '<b>Les répertoires suivants n\'ont pas été trouvés : <ul>@bad_dirs@.</ul> </b> - <p />Il est probable que cela soit dû à un problème de mauvaise mise en majuscules ou minuscules. +'dirs_repertoires_absents' => '<p><b>Les répertoires suivants n\'ont pas été trouvés :</b></p><ul>@bad_dirs@</ul> + <p>Il est probable que cela soit dû à un problème de mauvaise mise en majuscules ou minuscules. Vérifiez que les minuscules et majuscules de ces répertoires concordent bien avec ce qui est affiché - ci-dessus ; si ce n\'est pas le cas, renommez les répertoires avec votre logiciel FTP de façon à corriger l\'erreur. - <p />Une fois cette manipulation effectuée, vous pourrez ', -'dirs_repertoires_suivants' => '<b>Les répertoires suivants ne sont pas accessibles en écriture : <ul>@bad_dirs@.</ul> </b> - <p />Pour y remédier, utilisez votre client FTP afin de régler les droits d\'accès de chacun - de ces répertoires. La procédure est expliquée en détail dans le guide d\'installation. - <p />Une fois cette manipulation effectuée, vous pourrez ', + ci-dessus ; si ce n\'est pas le cas, renommez les répertoires avec votre logiciel FTP de façon à corriger l\'erreur.</p> + <p>Une fois cette manipulation effectuée, vous pourrez ', +'dirs_repertoires_suivants' => '<p><b>Les répertoires suivants ne sont pas accessibles en écriture :</b></p><ul>@bad_dirs@</ul> + <p>Pour y remédier, utilisez votre client FTP afin de régler les droits d\'accès de chacun + de ces répertoires. La procédure est expliquée en détail dans le guide d\'installation.</p> + <p>Une fois cette manipulation effectuée, vous pourrez ', // E -- GitLab