Completed
Push — spip-3.0 ( ab100a...484b62 )
by cam
06:49
created
ecrire/maj/v014.php 1 patch
Braces   +6 added lines, -3 removed lines patch added patch discarded remove patch
@@ -10,7 +10,9 @@  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 17
 
16 18
 
@@ -222,8 +224,9 @@  discard block
 block discarded – undo
222 224
 			$res = spip_query("SELECT * FROM spip_groupes_mots WHERE titre='$type'");
223 225
 			if (sql_count($res) == 0) {
224 226
 				$s = spip_query("INSERT INTO spip_groupes_mots (titre, unseul, obligatoire, articles, breves, rubriques, syndic, minirezo, comite, forum) VALUES ('$type', 'non', 'non', 'oui', 'oui', 'non', 'oui', 'oui', 'oui', 'non')");
225
-			  if ($id_groupe = mysql_insert_id($s))
226
-					spip_query("UPDATE spip_mots SET id_groupe = '$id_groupe' WHERE type='$type'");
227
+			  if ($id_groupe = mysql_insert_id($s)) {
228
+			  					spip_query("UPDATE spip_mots SET id_groupe = '$id_groupe' WHERE type='$type'");
229
+			  }
227 230
 			}
228 231
 		}
229 232
 		spip_query("UPDATE spip_articles SET popularite=0");
Please login to merge, or discard this patch.
ecrire/maj/v019_pre193.php 1 patch
Braces   +15 added lines, -9 removed lines patch added patch discarded remove patch
@@ -10,7 +10,9 @@  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 17
 function v019_pre193($version_installee, $version_cible)
16 18
 {
@@ -222,15 +224,17 @@  discard block
 block discarded – undo
222 224
 		spip_query("ALTER TABLE spip_meta ADD `impt` ENUM('non', 'oui') DEFAULT 'oui' NOT NULL AFTER `valeur`");
223 225
 		$meta_serveur = array('version_installee','adresse_site','alea_ephemere_ancien','alea_ephemere','alea_ephemere_date','langue_site','langues_proposees','date_calcul_rubriques','derniere_modif','optimiser_table','drapeau_edition','creer_preview','taille_preview','creer_htpasswd','creer_htaccess','gd_formats_read','gd_formats',
224 226
 		'netpbm_formats','formats_graphiques','image_process','plugin_header','plugin');
225
-		foreach($meta_serveur as $nom)
226
-			spip_query("UPDATE spip_meta SET `impt`='non' WHERE `nom`="._q($nom));
227
+		foreach($meta_serveur as $nom) {
228
+					spip_query("UPDATE spip_meta SET `impt`='non' WHERE `nom`="._q($nom));
229
+		}
227 230
 		maj_version('1.922');
228 231
 	}
229 232
 	if (upgrade_vers(1.923, $version_installee, $version_cible)) {
230 233
 		if (isset($GLOBALS['meta']['IMPORT_tables_noimport'])){
231 234
 			$IMPORT_tables_noimport = unserialize($GLOBALS['meta']['IMPORT_tables_noimport']);
232
-			foreach ($IMPORT_tables_noimport as $key=>$table)
233
-				if ($table=='spip_meta') unset($IMPORT_tables_noimport[$key]);
235
+			foreach ($IMPORT_tables_noimport as $key=>$table) {
236
+							if ($table=='spip_meta') unset($IMPORT_tables_noimport[$key]);
237
+			}
234 238
 			ecrire_meta('IMPORT_tables_noimport',serialize($IMPORT_tables_noimport),'non');
235 239
 		}
236 240
 		maj_version('1.923');
@@ -264,8 +268,9 @@  discard block
 block discarded – undo
264 268
 		/* deplacement des upload */
265 269
 		$auteurs = array();
266 270
 		$req = spip_query("SELECT `login` FROM spip_auteurs WHERE `statut` = '0minirezo'");
267
-		while($row = sql_fetch($req))
268
-			$auteurs[] = $row['login']; 
271
+		while($row = sql_fetch($req)) {
272
+					$auteurs[] = $row['login'];
273
+		}
269 274
 		$f_upload = preg_files('upload', -1, 10000, $auteurs);
270 275
 		$repertoire = _DIR_TRANSFERT;
271 276
 		if(!@file_exists($repertoire)) {
@@ -273,8 +278,9 @@  discard block
 block discarded – undo
273 278
 			$repertoire = sous_repertoire(_DIR_TMP, $repertoire);
274 279
 		}
275 280
 		foreach($auteurs as $login) {
276
-			if(is_dir('upload/'.$login))
277
-				$sous_repertoire = sous_repertoire(_DIR_TRANSFERT, $login);
281
+			if(is_dir('upload/'.$login)) {
282
+							$sous_repertoire = sous_repertoire(_DIR_TRANSFERT, $login);
283
+			}
278 284
 		}
279 285
 		foreach($f_upload as $f) {
280 286
 			@copy($f, _DIR_TMP.$f);
Please login to merge, or discard this patch.
ecrire/maj/v018.php 1 patch
Braces   +9 added lines, -6 removed lines patch added patch discarded remove patch
@@ -10,7 +10,9 @@  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 17
 function maj_v018_dist($version_installee, $version_cible)
16 18
 {
@@ -67,11 +69,12 @@  discard block
 block discarded – undo
67 69
 			$precedent = 0;
68 70
 			$r = sql_select("fille.id_forum AS id,	maman.id_thread AS thread", 'spip_forum AS fille, spip_forum AS maman', "fille.id_parent = maman.id_forum AND fille.id_thread <> maman.id_thread",'', "thread");
69 71
 			while ($row = sql_fetch($r)) {
70
-				if ($row['thread'] == $precedent)
71
-					$discussion .= "," . $row['id'];
72
-				else {
73
-					if ($precedent)
74
-						sql_updateq("spip_forum", array("id_thread" => $precedent), "id_forum IN ($discussion)");
72
+				if ($row['thread'] == $precedent) {
73
+									$discussion .= "," . $row['id'];
74
+				} else {
75
+					if ($precedent) {
76
+											sql_updateq("spip_forum", array("id_thread" => $precedent), "id_forum IN ($discussion)");
77
+					}
75 78
 					$precedent = $row['thread'];
76 79
 					$discussion = $row['id'];
77 80
 				}
Please login to merge, or discard this patch.
ecrire/maj/v010.php 1 patch
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -10,7 +10,9 @@
 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 17
 function maj_v010_dist($version_installee, $version_cible)
16 18
 {
Please login to merge, or discard this patch.
ecrire/auth/sha256.inc.php 1 patch
Braces   +14 added lines, -15 removed lines patch added patch discarded remove patch
@@ -155,7 +155,9 @@  discard block
 block discarded – undo
155 155
 						// mais si un char necessite 16bits, on passe tout sur 16
156 156
 						// sinon on ne concorde pas avec le lecture de la chaine en js
157 157
 						// et le sha256 js
158
-						if ($bytes>1) $byteSize = 16;
158
+						if ($bytes>1) {
159
+						    $byteSize = 16;
160
+						}
159 161
 					}
160 162
 					return $chars;
161 163
 				}
@@ -165,36 +167,32 @@  discard block
 block discarded – undo
165 167
 					$len = strlen($c);
166 168
 					$bytes = 0;
167 169
 
168
-					if ($index >= $len)
169
-						return false;
170
+					if ($index >= $len) {
171
+											return false;
172
+					}
170 173
 
171 174
 					$h = ord($c{$index});
172 175
 
173 176
 					if ($h <= 0x7F) {
174 177
 						$bytes = 1;
175 178
 						return $h;
176
-					}
177
-					else if ($h < 0xC2){
179
+					} else if ($h < 0xC2){
178 180
 						// pas utf mais renvoyer quand meme ce qu'on a
179 181
 						$bytes = 1;
180 182
 						return $h;
181
-					}
182
-					else if ($h <= 0xDF && $index < $len - 1) {
183
+					} else if ($h <= 0xDF && $index < $len - 1) {
183 184
 						$bytes = 2;
184 185
 						return ($h & 0x1F) <<  6 | (ord($c{$index + 1}) & 0x3F);
185
-					}
186
-					else if ($h <= 0xEF && $index < $len - 2) {
186
+					} else if ($h <= 0xEF && $index < $len - 2) {
187 187
 						$bytes = 3;
188 188
 						return ($h & 0x0F) << 12 | (ord($c{$index + 1}) & 0x3F) << 6
189 189
 																		 | (ord($c{$index + 2}) & 0x3F);
190
-					}
191
-					else if ($h <= 0xF4 && $index < $len - 3) {
190
+					} else if ($h <= 0xF4 && $index < $len - 3) {
192 191
 						$bytes = 4;
193 192
 						return ($h & 0x0F) << 18 | (ord($c{$index + 1}) & 0x3F) << 12
194 193
 																		 | (ord($c{$index + 2}) & 0x3F) << 6
195 194
 																		 | (ord($c{$index + 3}) & 0x3F);
196
-					}
197
-					else {
195
+					} else {
198 196
 						// pas utf mais renvoyer quand meme ce qu'on a
199 197
 						$bytes = 1;
200 198
 						return $h;
@@ -222,8 +220,9 @@  discard block
 block discarded – undo
222 220
 					$split = array();
223 221
 					while (count($a)>$n) {
224 222
 						$s = array();
225
-						for($i = 0;$i<$n;$i++)
226
-							$s[] = array_shift($a);
223
+						for($i = 0;$i<$n;$i++) {
224
+													$s[] = array_shift($a);
225
+						}
227 226
 						$split[] = $s;
228 227
 					}
229 228
 					if (count($a)){
Please login to merge, or discard this patch.
ecrire/auth/ldap.php 1 patch
Braces   +53 added lines, -26 removed lines patch added patch discarded remove patch
@@ -10,7 +10,9 @@  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 17
 // Authentifie via LDAP et retourne la ligne SQL decrivant l'utilisateur si ok
16 18
 
@@ -54,13 +56,17 @@  discard block
 block discarded – undo
54 56
 	// si http auth, inutile de reauthentifier: cela
55 57
  	// ne marchera pas avec auth http autre que basic.
56 58
 	$checkpass = isset($_SERVER["REMOTE_USER"])?false:true;
57
-	if (!($dn = auth_ldap_search($login, $pass, $checkpass, $serveur))) return array();
59
+	if (!($dn = auth_ldap_search($login, $pass, $checkpass, $serveur))) {
60
+	    return array();
61
+	}
58 62
 	$credentials_ldap = array('ldap_dn' => $dn, 'ldap_password' => $pass);
59 63
 
60 64
 	// Si l'utilisateur figure deja dans la base, y recuperer les infos
61 65
 	$r = sql_fetsel("*", "spip_auteurs", "login=" . sql_quote($login) . " AND source='ldap'",'','','','',$serveur);
62 66
 
63
-	if ($r) return array_merge($r, $credentials_ldap);
67
+	if ($r) {
68
+	    return array_merge($r, $credentials_ldap);
69
+	}
64 70
 
65 71
 	// sinon importer les infos depuis LDAP, 
66 72
 
@@ -75,11 +81,12 @@  discard block
 block discarded – undo
75 81
 		$r = sql_insertq('spip_auteurs', $desc,'',$serveur);
76 82
 	}				
77 83
 
78
-	if ($r)
79
-		return array_merge(
84
+	if ($r) {
85
+			return array_merge(
80 86
 			$credentials_ldap,
81 87
 			sql_fetsel("*", "spip_auteurs", "id_auteur=".intval($r),'','','','',$serveur)
82 88
 			);
89
+	}
83 90
 
84 91
 	// sinon echec
85 92
 	spip_log("Creation de l'auteur '$login' impossible");
@@ -98,20 +105,27 @@  discard block
 block discarded – undo
98 105
 function auth_ldap_connect($serveur='') {
99 106
 	include_spip('base/connect_sql');
100 107
 	static $connexions_ldap = array();
101
-	if (isset($connexions_ldap[$serveur])) return $connexions_ldap[$serveur]; 
108
+	if (isset($connexions_ldap[$serveur])) {
109
+	    return $connexions_ldap[$serveur];
110
+	}
102 111
 	$connexion = spip_connect($serveur);
103 112
 	if (!is_array($connexion['ldap'])) {
104 113
 		if ($connexion['authentification']['ldap']) {
105 114
 			$f =  _DIR_CONNECT . $connexion['authentification']['ldap'];
106 115
 			unset($GLOBALS['ldap_link']);
107 116
 			if (is_readable($f)) { include_once($f); };
108
-			if (isset($GLOBALS['ldap_link']))
109
-				$connexion['ldap'] = array('link' => $GLOBALS['ldap_link'],
117
+			if (isset($GLOBALS['ldap_link'])) {
118
+							$connexion['ldap'] = array('link' => $GLOBALS['ldap_link'],
110 119
 					'base' => $GLOBALS['ldap_base']);
111
-			else spip_log("connection LDAP $serveur mal definie dans $f");
112
-			if (isset($GLOBALS['ldap_champs']))
113
-				$connexion['ldap']['attributes'] = $GLOBALS['ldap_champs'];
114
-		} else spip_log("connection LDAP $serveur inconnue");
120
+			} else {
121
+			    spip_log("connection LDAP $serveur mal definie dans $f");
122
+			}
123
+			if (isset($GLOBALS['ldap_champs'])) {
124
+							$connexion['ldap']['attributes'] = $GLOBALS['ldap_champs'];
125
+			}
126
+		} else {
127
+		    spip_log("connection LDAP $serveur inconnue");
128
+		}
115 129
 	}
116 130
 	return $connexions_ldap[$serveur]=$connexion['ldap'];
117 131
 }
@@ -129,12 +143,14 @@  discard block
 block discarded – undo
129 143
 function auth_ldap_search($login, $pass, $checkpass=true, $serveur=''){
130 144
 	// Securite anti-injection et contre un serveur LDAP laxiste
131 145
 	$login_search = preg_replace("/[^-@._\s\d\w]/", "", $login); 
132
-	if (!strlen($login_search) OR ($checkpass AND !strlen($pass)) )
133
-		return '';
146
+	if (!strlen($login_search) OR ($checkpass AND !strlen($pass)) ) {
147
+			return '';
148
+	}
134 149
 
135 150
 	// verifier la connexion
136
-	if (!$ldap = auth_ldap_connect($serveur))
137
-		return '';
151
+	if (!$ldap = auth_ldap_connect($serveur)) {
152
+			return '';
153
+	}
138 154
 
139 155
 	$ldap_link = isset($ldap['link']) ? $ldap['link'] : null;
140 156
 	$ldap_base = isset($ldap['base']) ? $ldap['base'] : null;
@@ -151,8 +167,12 @@  discard block
 block discarded – undo
151 167
 
152 168
 		if (is_array($info) AND $info['count'] == 1) {
153 169
 			$dn = $info[0]['dn'];
154
-			if (!$checkpass) return $dn;
155
-			if (@ldap_bind($ldap_link, $dn, $pass)) return $dn;
170
+			if (!$checkpass) {
171
+			    return $dn;
172
+			}
173
+			if (@ldap_bind($ldap_link, $dn, $pass)) {
174
+			    return $dn;
175
+			}
156 176
 		}
157 177
 	}
158 178
 
@@ -160,8 +180,9 @@  discard block
 block discarded – undo
160 180
 		// Si echec, essayer de deviner le DN
161 181
 		foreach($logins as $att) {
162 182
 			$dn = "$att=$login_search, $ldap_base";
163
-			if (@ldap_bind($ldap_link, $dn, $pass))
164
-				return "$att=$login_search, $ldap_base";
183
+			if (@ldap_bind($ldap_link, $dn, $pass)) {
184
+							return "$att=$login_search, $ldap_base";
185
+			}
165 186
 		}
166 187
 	}
167 188
 	return '';
@@ -190,18 +211,23 @@  discard block
 block discarded – undo
190 211
 	}
191 212
 	$result = @ldap_read($ldap_link, $dn, "objectClass=*", array_values($desc));
192 213
 
193
-	if (!$result) return array();
214
+	if (!$result) {
215
+	    return array();
216
+	}
194 217
 
195 218
 	// Recuperer les donnees du premier (unique?) compte de l'auteur
196 219
 	$val = @ldap_get_entries($ldap_link, $result);
197
-	if (!is_array($val) OR !is_array($val[0])) return array();
220
+	if (!is_array($val) OR !is_array($val[0])) {
221
+	    return array();
222
+	}
198 223
 	$val = $val[0];
199 224
 
200 225
 	// Convertir depuis UTF-8 (jeu de caracteres par defaut)
201 226
 	include_spip('inc/charsets');
202 227
 
203
-	foreach ($desc as $k => $v)
204
-		$desc[$k] = importer_charset($val[strtolower($v)][0], 'utf-8');
228
+	foreach ($desc as $k => $v) {
229
+			$desc[$k] = importer_charset($val[strtolower($v)][0], 'utf-8');
230
+	}
205 231
 	return $desc;
206 232
 }
207 233
 
@@ -273,8 +299,9 @@  discard block
 block discarded – undo
273 299
     if (is_null($new_pass) OR auth_ldap_verifier_pass($login, $new_pass,$id_auteur,$serveur)!='') {
274 300
         return false;
275 301
     }
276
-    if (!$ldap = auth_ldap_connect($serveur))
277
-       return '';
302
+    if (!$ldap = auth_ldap_connect($serveur)) {
303
+           return '';
304
+    }
278 305
     $link = $ldap['link'];
279 306
     include_spip("inc/session");
280 307
     $dn = session_get('ldap_dn');
Please login to merge, or discard this patch.
ecrire/auth/spip.php 1 patch
Braces   +74 added lines, -40 removed lines patch added patch discarded remove patch
@@ -10,7 +10,9 @@  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 17
 /**
16 18
  * Authentifie et si ok retourne le tableau de la ligne SQL de l'utilisateur
@@ -27,7 +29,9 @@  discard block
 block discarded – undo
27 29
 	// retrouver le login
28 30
 	$login = auth_spip_retrouver_login($login);
29 31
 	// login inconnu, n'allons pas plus loin
30
-	if (!$login) return array();
32
+	if (!$login) {
33
+	    return array();
34
+	}
31 35
 
32 36
 	$md5pass = "";
33 37
 	$shapass = $shanext = "";
@@ -57,16 +61,21 @@  discard block
 block discarded – undo
57 61
 	}
58 62
 
59 63
 	// login inexistant ou mot de passe vide
60
-	if (!$shapass AND !$md5pass) return array();
64
+	if (!$shapass AND !$md5pass) {
65
+	    return array();
66
+	}
61 67
 
62 68
 	$row = sql_fetsel("*", "spip_auteurs", "login=" . sql_quote($login,$serveur,'text') . " AND pass=" . sql_quote($shapass,$serveur,'text') . " AND statut<>'5poubelle'",'','','','',$serveur);
63 69
 
64 70
 	// compat avec les anciennes bases en md5
65
-	if (!$row AND $md5pass)
66
-		$row = sql_fetsel("*", "spip_auteurs", "login=" . sql_quote($login,$serveur,'text') . " AND pass=" . sql_quote($md5pass,$serveur,'text') . " AND statut<>'5poubelle'",'','','','',$serveur);
71
+	if (!$row AND $md5pass) {
72
+			$row = sql_fetsel("*", "spip_auteurs", "login=" . sql_quote($login,$serveur,'text') . " AND pass=" . sql_quote($md5pass,$serveur,'text') . " AND statut<>'5poubelle'",'','','','',$serveur);
73
+	}
67 74
 
68 75
 	// login/mot de passe incorrect
69
-	if (!$row) return array();
76
+	if (!$row) {
77
+	    return array();
78
+	}
70 79
 
71 80
 	// fait tourner le codage du pass dans la base
72 81
 	// sauf si phpauth : cela reviendrait a changer l'alea a chaque hit, et aucune action verifiable par securiser_action()
@@ -76,8 +85,9 @@  discard block
 block discarded – undo
76 85
 		@sql_update('spip_auteurs', array('alea_actuel' => 'alea_futur', 'pass' => sql_quote($shanext,$serveur,'text'), 'alea_futur' => sql_quote(creer_uniqid(),$serveur,'text')), "id_auteur=" . $row['id_auteur'].' AND pass IN ('.sql_quote($shapass,$serveur,'text').', '.sql_quote($md5pass,$serveur,'text').')','',$serveur);
77 86
 		// En profiter pour verifier la securite de tmp/
78 87
 		// Si elle ne fonctionne pas a l'installation, prevenir
79
-		if (!verifier_htaccess(_DIR_TMP) AND defined('_ECRIRE_INSTALL'))
80
-			return false;
88
+		if (!verifier_htaccess(_DIR_TMP) AND defined('_ECRIRE_INSTALL')) {
89
+					return false;
90
+		}
81 91
 	}
82 92
 	return $row;
83 93
 }
@@ -97,8 +107,12 @@  discard block
 block discarded – undo
97 107
 	$compat_md5 = false;
98 108
 	if (!isset($GLOBALS['meta']['sha_256_only']) OR _request('var_mode')){
99 109
 		$compat_md5 = sql_countsel("spip_auteurs", "length(pass)=32 AND statut<>'poubelle'");
100
-		if ($compat_md5 AND isset($GLOBALS['meta']['sha_256_only'])) effacer_meta('sha_256_only');
101
-		if (!$compat_md5) ecrire_meta('sha_256_only','oui');
110
+		if ($compat_md5 AND isset($GLOBALS['meta']['sha_256_only'])) {
111
+		    effacer_meta('sha_256_only');
112
+		}
113
+		if (!$compat_md5) {
114
+		    ecrire_meta('sha_256_only','oui');
115
+		}
102 116
 	}
103 117
 
104 118
 	// javascript qui gere la securite du login en evitant de faire circuler le pass en clair
@@ -133,8 +147,10 @@  discard block
 block discarded – undo
133 147
  *	 toujours true pour un auteur cree dans SPIP
134 148
  */
135 149
 function auth_spip_autoriser_modifier_login($serveur=''){
136
-	if (strlen($serveur))
137
-		return false; // les fonctions d'ecriture sur base distante sont encore incompletes
150
+	if (strlen($serveur)) {
151
+			return false;
152
+	}
153
+	// les fonctions d'ecriture sur base distante sont encore incompletes
138 154
 	return true;
139 155
 }
140 156
 
@@ -151,12 +167,13 @@  discard block
 block discarded – undo
151 167
 function auth_spip_verifier_login($new_login, $id_auteur=0, $serveur=''){
152 168
 	// login et mot de passe
153 169
 	if (strlen($new_login)){
154
-		if (strlen($new_login) < _LOGIN_TROP_COURT)
155
-			return _T('info_login_trop_court_car_pluriel',array('nb'=>_LOGIN_TROP_COURT));
156
-		else {
170
+		if (strlen($new_login) < _LOGIN_TROP_COURT) {
171
+					return _T('info_login_trop_court_car_pluriel',array('nb'=>_LOGIN_TROP_COURT));
172
+		} else {
157 173
 			$n = sql_countsel('spip_auteurs', "login=" . sql_quote($new_login) . " AND id_auteur!=".intval($id_auteur)." AND statut!='5poubelle'",'','',$serveur);
158
-			if ($n)
159
-				return _T('info_login_existant');
174
+			if ($n) {
175
+							return _T('info_login_existant');
176
+			}
160 177
 		}
161 178
 	}
162 179
 	return '';
@@ -171,13 +188,17 @@  discard block
 block discarded – undo
171 188
  * @return bool
172 189
  */
173 190
 function auth_spip_modifier_login($new_login, $id_auteur, $serveur=''){
174
-	if (is_null($new_login) OR auth_spip_verifier_login($new_login,$id_auteur,$serveur)!='')
175
-		return false;
191
+	if (is_null($new_login) OR auth_spip_verifier_login($new_login,$id_auteur,$serveur)!='') {
192
+			return false;
193
+	}
176 194
 	if (!$id_auteur = intval($id_auteur)
177
-		OR !$auteur = sql_fetsel('login','spip_auteurs','id_auteur='.intval($id_auteur),'','','','',$serveur))
178
-		return false;
179
-	if ($new_login == $auteur['login'])
180
-		return true; // on a rien fait mais c'est bon !
195
+		OR !$auteur = sql_fetsel('login','spip_auteurs','id_auteur='.intval($id_auteur),'','','','',$serveur)) {
196
+			return false;
197
+	}
198
+	if ($new_login == $auteur['login']) {
199
+			return true;
200
+	}
201
+	// on a rien fait mais c'est bon !
181 202
 
182 203
 	include_spip('action/editer_auteur');
183 204
 
@@ -203,22 +224,28 @@  discard block
 block discarded – undo
203 224
  * @return string
204 225
  */
205 226
 function auth_spip_retrouver_login($login, $serveur=''){
206
-	if (!strlen($login)) return null; // pas la peine de requeter
227
+	if (!strlen($login)) {
228
+	    return null;
229
+	}
230
+	// pas la peine de requeter
207 231
 	$l = sql_quote($login,$serveur,'text');
208 232
 	if ($r = sql_getfetsel('login', 'spip_auteurs',
209 233
 			"statut<>'5poubelle'" .
210 234
 			" AND (length(pass)>0)" .
211
-			" AND (login=$l)",'','','','',$serveur))
212
-		return $r;
235
+			" AND (login=$l)",'','','','',$serveur)) {
236
+			return $r;
237
+	}
213 238
 	// Si pas d'auteur avec ce login
214 239
 	// regarder s'il a saisi son nom ou son mail.
215 240
 	// Ne pas fusionner avec la requete precedente
216 241
 	// car un nom peut etre homonyme d'un autre login
217
-	else return sql_getfetsel('login', 'spip_auteurs',
242
+	else {
243
+	    return sql_getfetsel('login', 'spip_auteurs',
218 244
 			"statut<>'5poubelle'" .
219 245
 			" AND (length(pass)>0)" .
220 246
 			" AND (login<>'' AND (nom=$l OR email=$l))",'','','','',$serveur);
221
-}
247
+	}
248
+	}
222 249
 
223 250
 
224 251
 /**
@@ -249,8 +276,10 @@  discard block
 block discarded – undo
249 276
  *	toujours true pour un auteur cree dans SPIP
250 277
  */
251 278
 function auth_spip_autoriser_modifier_pass($serveur=''){
252
-	if (strlen($serveur))
253
-		return false; // les fonctions d'ecriture sur base distante sont encore incompletes
279
+	if (strlen($serveur)) {
280
+			return false;
281
+	}
282
+	// les fonctions d'ecriture sur base distante sont encore incompletes
254 283
 	return true;
255 284
 }
256 285
 
@@ -273,8 +302,9 @@  discard block
 block discarded – undo
273 302
  */
274 303
 function auth_spip_verifier_pass($login, $new_pass, $id_auteur=0, $serveur=''){
275 304
 	// login et mot de passe
276
-	if (strlen($new_pass) < _PASS_LONGUEUR_MINI)
277
-		return _T('info_passe_trop_court_car_pluriel',array('nb'=>_PASS_LONGUEUR_MINI));
305
+	if (strlen($new_pass) < _PASS_LONGUEUR_MINI) {
306
+			return _T('info_passe_trop_court_car_pluriel',array('nb'=>_PASS_LONGUEUR_MINI));
307
+	}
278 308
 
279 309
 	return '';
280 310
 }
@@ -289,12 +319,14 @@  discard block
 block discarded – undo
289 319
  * @return bool
290 320
  */
291 321
 function auth_spip_modifier_pass($login, $new_pass, $id_auteur, $serveur=''){
292
-	if (is_null($new_pass) OR auth_spip_verifier_pass($login, $new_pass,$id_auteur,$serveur)!='')
293
-		return false;
322
+	if (is_null($new_pass) OR auth_spip_verifier_pass($login, $new_pass,$id_auteur,$serveur)!='') {
323
+			return false;
324
+	}
294 325
 
295 326
 	if (!$id_auteur = intval($id_auteur)
296
-		OR !sql_fetsel('login','spip_auteurs','id_auteur='.intval($id_auteur),'','','','',$serveur))
297
-		return false;
327
+		OR !sql_fetsel('login','spip_auteurs','id_auteur='.intval($id_auteur),'','','','',$serveur)) {
328
+			return false;
329
+	}
298 330
 
299 331
 	$c = array();
300 332
 	include_spip('inc/acces');
@@ -327,8 +359,9 @@  discard block
 block discarded – undo
327 359
  */
328 360
 function auth_spip_synchroniser_distant($id_auteur, $champs, $options = array(), $serveur=''){
329 361
 	// ne rien faire pour une base distante : on ne sait pas regenerer les htaccess
330
-	if (strlen($serveur))
331
-		return;
362
+	if (strlen($serveur)) {
363
+			return;
364
+	}
332 365
 	// si un login, pass ou statut a ete modifie
333 366
 	// regenerer les fichier htpass
334 367
 	if (isset($champs['login'])
@@ -360,8 +393,9 @@  discard block
 block discarded – undo
360 393
 		while ($t = sql_fetch($s)) {
361 394
 			if (strlen($t['login']) AND strlen($t['htpass'])) {
362 395
 				$p1 .= $t['login'].':'.$t['htpass']."\n";
363
-				if ($t['statut'] == '0minirezo')
364
-					$p2 .= $t['login'].':'.$t['htpass']."\n";
396
+				if ($t['statut'] == '0minirezo') {
397
+									$p2 .= $t['login'].':'.$t['htpass']."\n";
398
+				}
365 399
 			}
366 400
 		}
367 401
 		sql_free($s);
Please login to merge, or discard this patch.
ecrire/lang/spip_ar.php 1 patch
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -3,7 +3,9 @@
 block discarded – undo
3 3
 // extrait automatiquement de http://trad.spip.net/tradlang_module/spip?lang_cible=ar
4 4
 // ** ne pas modifier le fichier **
5 5
 
6
-if (!defined('_ECRIRE_INC_VERSION')) return;
6
+if (!defined('_ECRIRE_INC_VERSION')) {
7
+    return;
8
+}
7 9
 
8 10
 $GLOBALS[$GLOBALS['idx_lang']] = array(
9 11
 
Please login to merge, or discard this patch.
ecrire/lang/public_oc_va.php 1 patch
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -3,7 +3,9 @@
 block discarded – undo
3 3
 // extrait automatiquement de http://trad.spip.net/tradlang_module/public?lang_cible=oc_va
4 4
 // ** ne pas modifier le fichier **
5 5
 
6
-if (!defined('_ECRIRE_INC_VERSION')) return;
6
+if (!defined('_ECRIRE_INC_VERSION')) {
7
+    return;
8
+}
7 9
 
8 10
 $GLOBALS[$GLOBALS['idx_lang']] = array(
9 11
 
Please login to merge, or discard this patch.