[ Index ] |
|
Code source de SPIP Agora 1.4 |
1 <?php 2 /***************************************************** 3 * This file is part of Agora, web based content management system. 4 * 5 * Agora is free software; you can redistribute it and/or modify 6 * it under the terms of the GNU General Public License as published by 7 * the Free Software Foundation; version 2 of the License. 8 * 9 * Agora is distributed in the hope that it will be useful, 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 * GNU General Public License for more details (file "COPYING"). 13 * 14 * Copyright © Arnaud Martin, Antoine Pitrou et Philippe Rivière. 15 * List of authors detailed in "copyright_fr.html" file. 16 * E-mail : agora@sig.premier-ministre.gouv.fr 17 * Web site : http://www.agora.gouv.fr 18 *****************************************************/ 19 include_once ("ecrire/inc_version.php"); 20 21 include_once ("ecrire/inc_presentation.php"); 22 23 gerer_menu_langues(); 24 25 function bad_dirs ($bad_dirs, $test_dir, $install) { 26 install_debut_html(); 27 28 if ($install) { 29 $titre = _T('dirs_preliminaire'); 30 $continuer = _T('dirs_commencer'); 31 } 32 else 33 $titre = _T('dirs_probleme_droits'); 34 35 $bad_url = "spip_test_dirs.php"; 36 37 if ($test_dir) 38 $bad_url .= '?test_dir=' . $test_dir; 39 40 echo "<FONT FACE=\"Verdana,Arial,Helvetica,sans-serif\" SIZE=3>$titre</FONT>\n<p>"; 41 echo "<div align='right'>" . menu_langues(). "</div><p>"; 42 43 echo _T('dirs_repertoires_suivants', array('bad_dirs' => $bad_dirs)); 44 echo "<B>" . _T('login_recharger'). " $continuer."; 45 46 if ($install) 47 echo aide("install0"); 48 49 echo "<p>"; 50 51 echo "<FORM ACTION='$bad_urls' METHOD='GET'>\n"; 52 echo "<DIV align='right'><INPUT TYPE='submit' CLASS='fondl' NAME='Valider' VALUE='" . _T('login_recharger'). "'></DIV>"; 53 echo "</FORM>"; 54 55 install_fin_html(); 56 } 57 58 function absent_dirs ($bad_dirs, $test_dir) { 59 install_debut_html(); 60 61 $titre = _T('dirs_preliminaire'); 62 $continuer = _T('dirs_commencer'); 63 64 $bad_url = "spip_test_dirs.php"; 65 66 if ($test_dir) 67 $bad_url .= '?test_dir=' . $test_dir; 68 69 echo "<FONT FACE=\"Verdana,Arial,Helvetica,sans-serif\" SIZE=3>$titre</FONT>\n<p>"; 70 echo "<div align='right'>" . menu_langues(). "</div><p>"; 71 72 echo _T('dirs_repertoires_absents', array('bad_dirs' => $bad_dirs)); 73 echo "<B>" . _T('login_recharger'). " $continuer."; 74 75 if ($install) 76 echo aide("install0"); 77 78 echo "<p>"; 79 80 echo "<FORM ACTION='$bad_urls' METHOD='GET'>\n"; 81 echo "<DIV align='right'><INPUT TYPE='submit' CLASS='fondl' NAME='Valider' VALUE='" . _T('login_recharger'). "'></DIV>"; 82 echo "</FORM>"; 83 84 install_fin_html(); 85 } 86 87 // 88 // Tente d'ecrire 89 // 90 function test_ecrire ($my_dir) { 91 $ok = true; 92 $nom_fich = "$my_dir/test.txt"; 93 $f = @fopen($nom_fich, "w"); 94 95 if (!$f) 96 $ok = false; 97 else if (!@fclose($f)) 98 $ok = false; 99 else if (!@unlink($nom_fich)) 100 $ok = false; 101 102 return $ok; 103 } 104 105 // 106 // teste les droits sur les repertoires 107 // 108 //******** MODIFICATON elebescond@clever-age.com **** 109 $install = !file_exists("ecrire/include/bd/inc_config_metier.php"); 110 //$install = !file_exists("ecrire/inc_connect.php"); 111 //******** FIN MODIFICATION ************************* 112 113 if ($test_dir) 114 $test_dirs[] = $test_dir; 115 else { 116 $test_dirs = array("CACHE", "IMG", "ecrire/data", "ecrire/include/bd", "ecrire/squelettes_newsletter"); 117 /****** Ajout elebescond@clever-age.com ********/ 118 $dir = 'IMG'; 119 120 if ($handle = @opendir($dir)) { 121 while (false !== ($file = @readdir($handle))) { 122 /********** Modification CHMOD IMG johnny.muller@ypok.com **********/ 123 if ($file != "." && $file != ".." && $file != "CVS" && $file != "binettes" && $file != "icones_barre" 124 && is_dir($dir . '/' . $file)) { 125 //if ($file != "." && $file != ".." && $file != "CVS" && $file != "binettes" && $file != "icones_barre" && is_dir($file) ) { 126 /********** Fin Modification CHMOD IMG johnny.muller@ypok.com **********/ 127 $test_dirs[] = $dir . '/' . $file; 128 } 129 } 130 closedir ($handle); 131 } 132 /****** Fin ajout elebescond@clever-age.com ********/ 133 134 if ($install) 135 $test_dirs[] = "ecrire"; 136 } 137 138 unset ($bad_dirs); 139 unset ($absent_dirs); 140 141 while (list(, $my_dir) = each($test_dirs)) { 142 if (!test_ecrire($my_dir)) { 143 @umask (0); 144 if (@file_exists($my_dir)) { 145 @chmod($my_dir, 0777); 146 147 // ??? 148 if (!test_ecrire($my_dir)) 149 @chmod($my_dir, 0775); 150 151 if (!test_ecrire($my_dir)) 152 @chmod($my_dir, 0755); 153 if (!test_ecrire($my_dir)) 154 $bad_dirs[] = "<LI>" . $my_dir; 155 } 156 else { 157 // Ajout+modifs Olivier Mansour ... on tente de fabriquer les répertoires qui n'existent pas 158 if (!@mkdir($my_dir)) { 159 $absent_dirs[] = "<LI>" . $my_dir; 160 } 161 //$absent_dirs[] = "<LI>".$my_dir; 162 // fin modifs 163 } 164 } 165 } 166 167 if ($bad_dirs) { 168 $bad_dirs = join(" ", $bad_dirs); 169 bad_dirs($bad_dirs, $test_dir, $install); 170 } 171 else if ($absent_dirs) { 172 $absent_dirs = join(" ", $absent_dirs); 173 absent_dirs($absent_dirs, $test_dir); 174 } 175 else { 176 if ($install) 177 header ("Location: ./ecrire/install.php?etape=1"); 178 else 179 header ("Location: ./ecrire/"); 180 } 181 ?>
titre
Description
Corps
titre
Description
Corps
titre
Description
Corps
titre
Corps
Généré le : Sat Feb 24 14:40:03 2007 | par Balluche grâce à PHPXref 0.7 |