Completed
Push — spip-3.0 ( 484b62...e817f1 )
by cam
34:33
created
ecrire/install/etape_chmod.php 2 patches
Spacing   +16 added lines, -17 removed lines patch added patch discarded remove patch
@@ -36,7 +36,7 @@  discard block
 block discarded – undo
36 36
 
37 37
 	// Comparer l'appartenance d'un fichier cree par PHP
38 38
 	// avec celle du script et du repertoire courant
39
-	if(!$chmod) {
39
+	if (!$chmod) {
40 40
 		@rmdir('test');
41 41
 		spip_unlink('test'); // effacer au cas ou
42 42
 		@touch('test');
@@ -67,12 +67,12 @@  discard block
 block discarded – undo
67 67
 function install_etape_chmod_dist()
68 68
 {
69 69
 	global $test_dirs;
70
-	$test_dir =  _request('test_dir');
70
+	$test_dir = _request('test_dir');
71 71
 	$chmod = 0;
72 72
 
73 73
 	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;
74
+		if (substr($test_dir, -1) !== '/') $test_dir .= '/';
75
+		if (!in_array($test_dir, $test_dirs)) $test_dirs[] = _DIR_RACINE.$test_dir;
76 76
 	} else {
77 77
 		if (!_FILE_CONNECT) {
78 78
 			$test_dirs[] = _DIR_CONNECT;
@@ -81,12 +81,12 @@  discard block
 block discarded – undo
81 81
 	}
82 82
 
83 83
 	$bad_dirs = array();
84
-	$absent_dirs  = array();;
84
+	$absent_dirs = array(); ;
85 85
 
86 86
 	while (list(, $my_dir) = each($test_dirs)) {
87 87
 		$test = test_ecrire($my_dir);
88 88
 		if (!$test) {
89
-			$m = spip_htmlspecialchars(preg_replace(',^' . _DIR_RACINE . ',', '',$my_dir));
89
+			$m = spip_htmlspecialchars(preg_replace(',^'._DIR_RACINE.',', '', $my_dir));
90 90
 			if (@file_exists($my_dir)) {
91 91
 				$bad_dirs["<li>".$m."</li>"] = 1;
92 92
 			} else
@@ -98,35 +98,34 @@  discard block
 block discarded – undo
98 98
 
99 99
 	if (!_FILE_CONNECT) {
100 100
 		$titre = _T('dirs_preliminaire');
101
-		$continuer = ' '._T('dirs_commencer') . '.';
101
+		$continuer = ' '._T('dirs_commencer').'.';
102 102
 	} else
103 103
 		$titre = _T('dirs_probleme_droits');
104 104
 
105 105
 
106
-	$res = "<div align='right'>". menu_langues('var_lang_ecrire')."</div>\n";
106
+	$res = "<div align='right'>".menu_langues('var_lang_ecrire')."</div>\n";
107 107
 
108 108
 	if ($bad_dirs) {
109 109
 		$res .=
110 110
 		  _T('dirs_repertoires_suivants',
111
-		     array('bad_dirs' => join("\n", array_keys($bad_dirs)))) .
112
-		  	"<b>". _T('login_recharger')."</b>.";
111
+		     array('bad_dirs' => join("\n", array_keys($bad_dirs)))).
112
+		  	"<b>"._T('login_recharger')."</b>.";
113 113
 	}
114 114
 
115 115
 	if ($absent_dirs) {
116 116
 	  	$res .=
117 117
 			_T('dirs_repertoires_absents',
118
-			   array('bad_dirs' => join("\n", array_keys($absent_dirs)))) .
119
-			"<b>". _T('login_recharger')."</b>.";
118
+			   array('bad_dirs' => join("\n", array_keys($absent_dirs)))).
119
+			"<b>"._T('login_recharger')."</b>.";
120 120
 	}
121
-	$res = "<p>" . $continuer  . $res . aide ("install0", true) . "</p>";
121
+	$res = "<p>".$continuer.$res.aide("install0", true)."</p>";
122 122
 
123 123
 	$t = _T('login_recharger');
124
-	$t = (!$test_dir ? '' :
125
-		"<input type='hidden' name='test_dir' value='" . spip_htmlspecialchars($test_dir, ENT_QUOTES) . "' />")
124
+	$t = (!$test_dir ? '' : "<input type='hidden' name='test_dir' value='".spip_htmlspecialchars($test_dir, ENT_QUOTES)."' />")
126 125
 	. "<input type='hidden' name='etape' value='chmod' />"
127
-	. "<div style='text-align: right'><input type='submit' value='" . attribut_html($t) . "' /></div>";
126
+	. "<div style='text-align: right'><input type='submit' value='".attribut_html($t)."' /></div>";
128 127
 
129
-	echo minipres($titre, $res . generer_form_ecrire('install',  $t));
128
+	echo minipres($titre, $res.generer_form_ecrire('install', $t));
130 129
 
131 130
 	} else {
132 131
 		$deja = (_FILE_CONNECT AND analyse_fichier_connection(_FILE_CONNECT));
Please login to merge, or discard this 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.