4 |
david |
1 |
<?php
|
|
|
2 |
|
|
|
3 |
/***************************************************************************\
|
|
|
4 |
* SPIP, Systeme de publication pour l'internet *
|
|
|
5 |
* *
|
|
|
6 |
* Copyright (c) 2001-2005 *
|
|
|
7 |
* Arnaud Martin, Antoine Pitrou, Philippe Riviere, Emmanuel Saint-James *
|
|
|
8 |
* *
|
|
|
9 |
* Ce programme est un logiciel libre distribue sous licence GNU/GPL. *
|
|
|
10 |
* Pour plus de details voir le fichier COPYING.txt ou l'aide en ligne. *
|
|
|
11 |
\***************************************************************************/
|
|
|
12 |
|
|
|
13 |
if (defined("_TEST_DIRS")) return;
|
|
|
14 |
define("_TEST_DIRS", "1");
|
|
|
15 |
|
|
|
16 |
include("ecrire/inc_version.php3");
|
|
|
17 |
|
|
|
18 |
include_ecrire("inc_presentation.php3");
|
|
|
19 |
|
|
|
20 |
utiliser_langue_visiteur();
|
|
|
21 |
|
|
|
22 |
|
|
|
23 |
//
|
|
|
24 |
// Tente d'ecrire
|
|
|
25 |
//
|
|
|
26 |
function test_ecrire($my_dir) {
|
|
|
27 |
$ok = true;
|
|
|
28 |
$nom_fich = "$my_dir/test.txt";
|
|
|
29 |
$f = @fopen($nom_fich, "w");
|
|
|
30 |
if (!$f) $ok = false;
|
|
|
31 |
else if (!@fclose($f)) $ok = false;
|
|
|
32 |
else if (!@unlink($nom_fich)) $ok = false;
|
|
|
33 |
return $ok;
|
|
|
34 |
}
|
|
|
35 |
|
|
|
36 |
//
|
|
|
37 |
// teste les droits sur les repertoires $test_dirs declares dans inc_version
|
|
|
38 |
//
|
|
|
39 |
|
|
|
40 |
// rajouter celui passer dans l'url ou celui du source (a l'installation)
|
|
|
41 |
|
|
|
42 |
if ($test_dir) {
|
|
|
43 |
if (!ereg("/$", $test_dir)) $test_dir .= '/';
|
|
|
44 |
if (!in_array($test_dir, $test_dirs)) $test_dirs[] = $test_dir;
|
|
|
45 |
}
|
|
|
46 |
else {
|
|
|
47 |
if (!_FILE_CONNECT)
|
|
|
48 |
$test_dirs[] = dirname(_FILE_CONNECT_INS);
|
|
|
49 |
}
|
|
|
50 |
|
|
|
51 |
unset($bad_dirs);
|
|
|
52 |
unset($absent_dirs);
|
|
|
53 |
|
|
|
54 |
while (list(, $my_dir) = each($test_dirs)) {
|
|
|
55 |
if (!test_ecrire($my_dir)) {
|
|
|
56 |
@umask(0);
|
|
|
57 |
if (@file_exists($my_dir)) {
|
|
|
58 |
@chmod($my_dir, 0777);
|
|
|
59 |
// ???
|
|
|
60 |
if (!test_ecrire($my_dir))
|
|
|
61 |
@chmod($my_dir, 0775);
|
|
|
62 |
if (!test_ecrire($my_dir))
|
|
|
63 |
@chmod($my_dir, 0755);
|
|
|
64 |
if (!test_ecrire($my_dir))
|
|
|
65 |
$bad_dirs[] = "<LI>".$my_dir;
|
|
|
66 |
} else
|
|
|
67 |
$absent_dirs[] = "<LI>".$my_dir;
|
|
|
68 |
}
|
|
|
69 |
}
|
|
|
70 |
|
|
|
71 |
if ($bad_dirs OR $absent_dirs) {
|
|
|
72 |
install_debut_html();
|
|
|
73 |
|
|
|
74 |
if (!_FILE_CONNECT) {
|
|
|
75 |
$titre = _T('dirs_preliminaire');
|
|
|
76 |
$continuer = ' '._T('dirs_commencer');
|
|
|
77 |
} else
|
|
|
78 |
$titre = _T('dirs_probleme_droits');
|
|
|
79 |
|
|
|
80 |
$bad_url = "spip_test_dirs.php3";
|
|
|
81 |
if ($test_dir) $bad_url .= '?test_dir='.$test_dir;
|
|
|
82 |
|
|
|
83 |
echo "<FONT FACE=\"Verdana,Arial,Helvetica,sans-serif\" SIZE=3>$titre</FONT>\n<p>";
|
|
|
84 |
echo "<div align='right'>". menu_langues('var_lang_ecrire')."</div>\n";
|
|
|
85 |
|
|
|
86 |
if ($bad_dirs) {
|
|
|
87 |
echo "<p>";
|
|
|
88 |
echo _T('dirs_repertoires_suivants',
|
|
|
89 |
array('bad_dirs' => join(" ", $bad_dirs)));
|
|
|
90 |
echo "<B>". _T('login_recharger')."</b>";
|
|
|
91 |
}
|
|
|
92 |
|
|
|
93 |
if ($absent_dirs) {
|
|
|
94 |
echo "<p>";
|
|
|
95 |
echo _T('dirs_repertoires_absents',
|
|
|
96 |
array('bad_dirs' => join(" ", $absent_dirs)));
|
|
|
97 |
echo "<B>". _T('login_recharger')."</b>";
|
|
|
98 |
}
|
|
|
99 |
|
|
|
100 |
echo $continuer.'. ';
|
|
|
101 |
echo aide ("install0");
|
|
|
102 |
echo "<p>";
|
|
|
103 |
|
|
|
104 |
echo "<FORM ACTION='$bad_urls' METHOD='GET'>\n";
|
|
|
105 |
echo "<DIV align='right'><INPUT TYPE='submit' CLASS='fondl' VALUE='". _T('login_recharger')."'></DIV>";
|
|
|
106 |
echo "</FORM>";
|
|
|
107 |
|
|
|
108 |
install_fin_html();
|
|
|
109 |
|
|
|
110 |
} else {
|
|
|
111 |
if (!_FILE_CONNECT)
|
|
|
112 |
header("Location: " . _DIR_RESTREINT_ABS . "install.php3?etape=1");
|
|
|
113 |
else
|
|
|
114 |
header("Location: " . _DIR_RESTREINT_ABS);
|
|
|
115 |
}
|
|
|
116 |
|
|
|
117 |
?>
|