Completed
Push — master ( 478ba3...584367 )
by cam
01:10
created
ecrire/inc/acces.php 1 patch
Spacing   +22 added lines, -22 removed lines patch added patch discarded remove patch
@@ -31,7 +31,7 @@  discard block
 block discarded – undo
31 31
  *     Mot de passe
32 32
  **/
33 33
 function creer_pass_aleatoire($longueur = 16, $sel = '') {
34
-	$seed = (int)round(((float)microtime() + 1) * time());
34
+	$seed = (int) round(((float) microtime() + 1) * time());
35 35
 
36 36
 	mt_srand($seed);
37 37
 	$s = '';
@@ -42,9 +42,9 @@  discard block
 block discarded – undo
42 42
 			if (!$s) {
43 43
 				$s = random_int(0, mt_getrandmax());
44 44
 			}
45
-			$s = substr(md5(uniqid($s) . $sel), 0, 16);
45
+			$s = substr(md5(uniqid($s).$sel), 0, 16);
46 46
 		}
47
-		$r = unpack('Cr', pack('H2', $s . $s));
47
+		$r = unpack('Cr', pack('H2', $s.$s));
48 48
 		$x = $r['r'] & 63;
49 49
 		if ($x < 10) {
50 50
 			$x = chr($x + 48);
@@ -82,7 +82,7 @@  discard block
 block discarded – undo
82 82
 	static $seeded;
83 83
 
84 84
 	if (!$seeded) {
85
-		$seed = (int)round(((float)microtime() + 1) * time());
85
+		$seed = (int) round(((float) microtime() + 1) * time());
86 86
 		mt_srand($seed);
87 87
 		$seeded = true;
88 88
 	}
@@ -168,10 +168,10 @@  discard block
 block discarded – undo
168 168
 			ecrire_meta('low_sec', $low_sec = creer_pass_aleatoire());
169 169
 		}
170 170
 	} else {
171
-		$low_sec = sql_getfetsel('low_sec', 'spip_auteurs', 'id_auteur = ' . intval($id_auteur));
171
+		$low_sec = sql_getfetsel('low_sec', 'spip_auteurs', 'id_auteur = '.intval($id_auteur));
172 172
 		if (!$low_sec) {
173 173
 			$low_sec = creer_pass_aleatoire();
174
-			sql_updateq('spip_auteurs', ['low_sec' => $low_sec], 'id_auteur = ' . intval($id_auteur));
174
+			sql_updateq('spip_auteurs', ['low_sec' => $low_sec], 'id_auteur = '.intval($id_auteur));
175 175
 		}
176 176
 	}
177 177
 
@@ -229,7 +229,7 @@  discard block
 block discarded – undo
229 229
 function generer_url_api_low_sec(string $script, string $format, string $fond, string $path, string $args, bool $no_entities = false, ?bool $public = null) {
230 230
 	$id_auteur = $GLOBALS['visiteur_session']['id_auteur'] ?? 0;
231 231
 	$cle = afficher_low_sec($id_auteur, "$script/$format $fond $args");
232
-	$path = "$id_auteur/$cle/$format/$fond" . ($path ? "/$path" : '');
232
+	$path = "$id_auteur/$cle/$format/$fond".($path ? "/$path" : '');
233 233
 
234 234
 	return generer_url_api($script, $path, $args, $no_entities = false, $public);
235 235
 }
@@ -253,9 +253,9 @@  discard block
 block discarded – undo
253 253
 	foreach ($args as $val => $var) {
254 254
 		if ($var) {
255 255
 			if ($val <> 'statut') {
256
-				$a .= ':' . $val . '-' . $var;
256
+				$a .= ':'.$val.'-'.$var;
257 257
 			}
258
-			$b .= $val . '=' . $var . '&';
258
+			$b .= $val.'='.$var.'&';
259 259
 		}
260 260
 	}
261 261
 	$a = substr($a, 1);
@@ -285,7 +285,7 @@  discard block
 block discarded – undo
285 285
  *     Clé
286 286
  **/
287 287
 function afficher_low_sec($id_auteur, $action = '') {
288
-	return substr(md5($action . low_sec($id_auteur)), 0, 8);
288
+	return substr(md5($action.low_sec($id_auteur)), 0, 8);
289 289
 }
290 290
 
291 291
 /**
@@ -316,7 +316,7 @@  discard block
 block discarded – undo
316 316
 	if (!$id_auteur = intval($id_auteur)) {
317 317
 		return;
318 318
 	} // jamais trop prudent ;)
319
-	sql_updateq('spip_auteurs', ['low_sec' => ''], 'id_auteur = ' . intval($id_auteur));
319
+	sql_updateq('spip_auteurs', ['low_sec' => ''], 'id_auteur = '.intval($id_auteur));
320 320
 }
321 321
 
322 322
 
@@ -334,8 +334,8 @@  discard block
 block discarded – undo
334 334
  *     - void sinon.
335 335
  **/
336 336
 function ecrire_acces() {
337
-	$htaccess = _DIR_RESTREINT . _ACCESS_FILE_NAME;
338
-	$htpasswd = _DIR_TMP . _AUTH_USER_FILE;
337
+	$htaccess = _DIR_RESTREINT._ACCESS_FILE_NAME;
338
+	$htpasswd = _DIR_TMP._AUTH_USER_FILE;
339 339
 
340 340
 	// Cette variable de configuration peut etre posee par un plugin
341 341
 	// par exemple acces_restreint ;
@@ -346,7 +346,7 @@  discard block
 block discarded – undo
346 346
 		and !@file_exists($htaccess)
347 347
 	) {
348 348
 		spip_unlink($htpasswd);
349
-		spip_unlink($htpasswd . '-admin');
349
+		spip_unlink($htpasswd.'-admin');
350 350
 		return;
351 351
 	}
352 352
 
@@ -374,10 +374,10 @@  discard block
 block discarded – undo
374 374
 	$pwd_all = ''; // login:htpass pour tous
375 375
 	$pwd_admin = ''; // login:htpass pour les admins
376 376
 
377
-	$res = sql_select('login, htpass, statut', 'spip_auteurs', "htpass!='' AND login!='' AND " . sql_in('statut', ['1comite', '0minirezo', 'nouveau']));
377
+	$res = sql_select('login, htpass, statut', 'spip_auteurs', "htpass!='' AND login!='' AND ".sql_in('statut', ['1comite', '0minirezo', 'nouveau']));
378 378
 	while ($row = sql_fetch($res)) {
379 379
 		if (strlen($row['login']) and strlen($row['htpass'])) {
380
-			$ligne = $row['login'] . ':' . $row['htpass'] . "\n";
380
+			$ligne = $row['login'].':'.$row['htpass']."\n";
381 381
 			$pwd_all .= $ligne;
382 382
 			if ($row['statut'] == '0minirezo') {
383 383
 				$pwd_admin .= $ligne;
@@ -420,7 +420,7 @@  discard block
 block discarded – undo
420 420
  * @return boolean
421 421
  */
422 422
 function verifier_htaccess($rep, $force = false) {
423
-	$htaccess = rtrim($rep, '/') . '/' . _ACCESS_FILE_NAME;
423
+	$htaccess = rtrim($rep, '/').'/'._ACCESS_FILE_NAME;
424 424
 	if (((@file_exists($htaccess)) or defined('_TEST_DIRS')) and !$force) {
425 425
 		return true;
426 426
 	}
@@ -449,17 +449,17 @@  discard block
 block discarded – undo
449 449
 		fputs($ht, $deny);
450 450
 		fclose($ht);
451 451
 		@chmod($htaccess, _SPIP_CHMOD & 0666);
452
-		$t = rtrim($rep, '/') . '/.ok';
452
+		$t = rtrim($rep, '/').'/.ok';
453 453
 		if ($ht = @fopen($t, 'w')) {
454 454
 			@fclose($ht);
455 455
 			include_spip('inc/distant');
456 456
 			$t = substr($t, strlen(_DIR_RACINE));
457
-			$t = url_de_base() . $t;
457
+			$t = url_de_base().$t;
458 458
 			$ht = recuperer_url($t, ['methode' => 'HEAD', 'taille_max' => 0, 'follow_location' => false]);
459 459
 			$ht = ($ht['status'] ?? null) === 403;
460 460
 		}
461 461
 	}
462
-	spip_log("Creation de $htaccess " . ($ht ? ' reussie' : ' manquee'));
462
+	spip_log("Creation de $htaccess ".($ht ? ' reussie' : ' manquee'));
463 463
 
464 464
 	return $ht;
465 465
 }
@@ -485,11 +485,11 @@  discard block
 block discarded – undo
485 485
 	$dirs = sql_allfetsel('extension', 'spip_types_documents');
486 486
 	$dirs[] = ['extension' => 'distant'];
487 487
 	foreach ($dirs as $e) {
488
-		if (is_dir($dir = _DIR_IMG . $e['extension'])) {
488
+		if (is_dir($dir = _DIR_IMG.$e['extension'])) {
489 489
 			if ($f) {
490 490
 				verifier_htaccess($dir);
491 491
 			} else {
492
-				spip_unlink($dir . '/' . _ACCESS_FILE_NAME);
492
+				spip_unlink($dir.'/'._ACCESS_FILE_NAME);
493 493
 			}
494 494
 		}
495 495
 	}
Please login to merge, or discard this patch.