Completed
Push — spip-3.0 ( 484b62...e817f1 )
by cam
34:33
created
ecrire/install/etape_chmod.php 1 patch
Braces   +33 added lines, -18 removed lines patch added patch discarded remove patch
@@ -10,9 +10,13 @@  discard block
 block discarded – undo
10 10
  *  Pour plus de details voir le fichier COPYING.txt ou l'aide en ligne.   *
11 11
 \***************************************************************************/
12 12
 
13
-if (!defined('_ECRIRE_INC_VERSION')) return;
13
+if (!defined('_ECRIRE_INC_VERSION')) {
14
+    return;
15
+}
14 16
 
15
-if (defined('_TEST_DIRS')) return;
17
+if (defined('_TEST_DIRS')) {
18
+    return;
19
+}
16 20
 define('_TEST_DIRS', "1");
17 21
 
18 22
 include_spip('inc/minipres');
@@ -40,12 +44,13 @@  discard block
 block discarded – undo
40 44
 		@rmdir('test');
41 45
 		spip_unlink('test'); // effacer au cas ou
42 46
 		@touch('test');
43
-		if ($uid > 0 && $uid == $uid2 && @fileowner('test') == $uid)
44
-			$chmod = 0700;
45
-		else if ($gid > 0 && $gid == $gid2 && @filegroup('test') == $gid)
46
-			$chmod = 0770;
47
-		else
48
-			$chmod = 0777;
47
+		if ($uid > 0 && $uid == $uid2 && @fileowner('test') == $uid) {
48
+					$chmod = 0700;
49
+		} else if ($gid > 0 && $gid == $gid2 && @filegroup('test') == $gid) {
50
+					$chmod = 0770;
51
+		} else {
52
+					$chmod = 0777;
53
+		}
49 54
 		// Appliquer de plus les droits d'acces du script
50 55
 		if ($perms > 0) {
51 56
 			$perms = ($perms & 0777) | (($perms & 0444) >> 2);
@@ -71,8 +76,12 @@  discard block
 block discarded – undo
71 76
 	$chmod = 0;
72 77
 
73 78
 	if ($test_dir) {
74
-		if (substr($test_dir,-1)!=='/') $test_dir .= '/';
75
-		if (!in_array($test_dir, $test_dirs)) $test_dirs[] = _DIR_RACINE  . $test_dir;
79
+		if (substr($test_dir,-1)!=='/') {
80
+		    $test_dir .= '/';
81
+		}
82
+		if (!in_array($test_dir, $test_dirs)) {
83
+		    $test_dirs[] = _DIR_RACINE  . $test_dir;
84
+		}
76 85
 	} else {
77 86
 		if (!_FILE_CONNECT) {
78 87
 			$test_dirs[] = _DIR_CONNECT;
@@ -89,9 +98,12 @@  discard block
 block discarded – undo
89 98
 			$m = spip_htmlspecialchars(preg_replace(',^' . _DIR_RACINE . ',', '',$my_dir));
90 99
 			if (@file_exists($my_dir)) {
91 100
 				$bad_dirs["<li>".$m."</li>"] = 1;
92
-			} else
93
-				$absent_dirs["<li>".$m."</li>"] = 1;
94
-		} else $chmod = max($chmod, $test);
101
+			} else {
102
+							$absent_dirs["<li>".$m."</li>"] = 1;
103
+			}
104
+		} else {
105
+		    $chmod = max($chmod, $test);
106
+		}
95 107
 	}
96 108
 
97 109
 	if ($bad_dirs OR $absent_dirs) {
@@ -99,8 +111,9 @@  discard block
 block discarded – undo
99 111
 	if (!_FILE_CONNECT) {
100 112
 		$titre = _T('dirs_preliminaire');
101 113
 		$continuer = ' '._T('dirs_commencer') . '.';
102
-	} else
103
-		$titre = _T('dirs_probleme_droits');
114
+	} else {
115
+			$titre = _T('dirs_probleme_droits');
116
+	}
104 117
 
105 118
 
106 119
 	$res = "<div align='right'>". menu_langues('var_lang_ecrire')."</div>\n";
@@ -130,9 +143,11 @@  discard block
 block discarded – undo
130 143
 
131 144
 	} else {
132 145
 		$deja = (_FILE_CONNECT AND analyse_fichier_connection(_FILE_CONNECT));
133
-		if (!$deja)
134
-			redirige_url_ecrire("install", "etape=1&chmod=".$chmod);
135
-		else	redirige_url_ecrire();
146
+		if (!$deja) {
147
+					redirige_url_ecrire("install", "etape=1&chmod=".$chmod);
148
+		} else {
149
+		    redirige_url_ecrire();
150
+		}
136 151
 	}
137 152
 }
138 153
 ?>
Please login to merge, or discard this patch.