Completed
Push — master ( 604e76...351d3e )
by cam
08:44
created
ecrire/req/mysql.php 2 patches
Doc Comments   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -337,8 +337,8 @@  discard block
 block discarded – undo
337 337
  * @param string|array $select Champs sélectionnés
338 338
  * @param string|array $from Tables sélectionnées
339 339
  * @param string|array $where Contraintes
340
- * @param string|array $groupby Regroupements
341
- * @param string|array $orderby Tris
340
+ * @param string $groupby Regroupements
341
+ * @param string $orderby Tris
342 342
  * @param string $limit Limites de résultats
343 343
  * @param string|array $having Contraintes posts sélections
344 344
  * @param string $serveur Nom de la connexion
@@ -970,7 +970,7 @@  discard block
 block discarded – undo
970 970
  * @param int $row_number Position. Déplacer le pointeur à cette ligne
971 971
  * @param string $serveur Nom de la connexion
972 972
  * @param bool $requeter Inutilisé
973
- * @return bool True si déplacement réussi, false sinon.
973
+ * @return boolean|null True si déplacement réussi, false sinon.
974 974
  **/
975 975
 function spip_mysql_seek($r, $row_number, $serveur = '', $requeter = true) {
976 976
 	if ($r and mysqli_num_rows($r)) {
Please login to merge, or discard this patch.
Spacing   +77 added lines, -77 removed lines patch added patch discarded remove patch
@@ -48,7 +48,7 @@  discard block
 block discarded – undo
48 48
 	// si port est fourni mais pas host, c'est un socket -> compat avec vieille syntaxe de mysql_connect() et anciens fichiers connect.php
49 49
 	if (
50 50
 		$port and !is_numeric($socket = $port)
51
-		and (!$host or $host=='localhost')) {
51
+		and (!$host or $host == 'localhost')) {
52 52
 		$link = @mysqli_connect($host, $login, $pass, '', null, $socket);
53 53
 	}
54 54
 	elseif ($port) {
@@ -59,7 +59,7 @@  discard block
 block discarded – undo
59 59
 	}
60 60
 
61 61
 	if (!$link) {
62
-		spip_log('Echec mysqli_connect. Erreur : ' . mysqli_connect_error(), 'mysql.' . _LOG_HS);
62
+		spip_log('Echec mysqli_connect. Erreur : '.mysqli_connect_error(), 'mysql.'._LOG_HS);
63 63
 
64 64
 		return false;
65 65
 	}
@@ -76,7 +76,7 @@  discard block
 block discarded – undo
76 76
 		}
77 77
 	}
78 78
 
79
-	spip_log("Connexion MySQLi vers $host, base $db, prefixe $prefixe " . ($ok ? "operationnelle" : 'impossible'),
79
+	spip_log("Connexion MySQLi vers $host, base $db, prefixe $prefixe ".($ok ? "operationnelle" : 'impossible'),
80 80
 		_LOG_DEBUG);
81 81
 
82 82
 	return !$ok ? false : array(
@@ -165,9 +165,9 @@  discard block
 block discarded – undo
165 165
  */
166 166
 function spip_mysql_set_charset($charset, $serveur = '', $requeter = true) {
167 167
 	$connexion = &$GLOBALS['connexions'][$serveur ? strtolower($serveur) : 0];
168
-	spip_log("changement de charset sql : " . "SET NAMES " . _q($charset), _LOG_DEBUG);
168
+	spip_log("changement de charset sql : "."SET NAMES "._q($charset), _LOG_DEBUG);
169 169
 
170
-	return mysqli_query($connexion['link'], $connexion['last'] = "SET NAMES " . _q($charset));
170
+	return mysqli_query($connexion['link'], $connexion['last'] = "SET NAMES "._q($charset));
171 171
 }
172 172
 
173 173
 
@@ -182,7 +182,7 @@  discard block
 block discarded – undo
182 182
 function spip_mysql_get_charset($charset = array(), $serveur = '', $requeter = true) {
183 183
 	$connexion = &$GLOBALS['connexions'][$serveur ? strtolower($serveur) : 0];
184 184
 	$connexion['last'] = $c = "SHOW CHARACTER SET"
185
-		. (!$charset ? '' : (" LIKE " . _q($charset['charset'])));
185
+		. (!$charset ? '' : (" LIKE "._q($charset['charset'])));
186 186
 
187 187
 	return spip_mysql_fetch(mysqli_query($connexion['link'], $c), null, $serveur);
188 188
 }
@@ -242,19 +242,19 @@  discard block
 block discarded – undo
242 242
 	$debug = '';
243 243
 	if (defined('_DEBUG_SLOW_QUERIES') and _DEBUG_SLOW_QUERIES) {
244 244
 		if (isset($GLOBALS['debug']['aucasou'])) {
245
-			list(, $id, , $infos) = $GLOBALS['debug']['aucasou'];
246
-			$debug .= "BOUCLE$id @ " . (isset($infos[0]) ? $infos[0] : '') . " | ";
245
+			list(, $id,, $infos) = $GLOBALS['debug']['aucasou'];
246
+			$debug .= "BOUCLE$id @ ".(isset($infos[0]) ? $infos[0] : '')." | ";
247 247
 		}
248 248
 		if (isset($_SERVER['REQUEST_URI'])) {
249 249
 			$debug .= $_SERVER['REQUEST_URI'];
250 250
 		}
251 251
 		if (!empty($GLOBALS['ip'])) {
252
-			$debug .= ' + ' . $GLOBALS['ip'];
252
+			$debug .= ' + '.$GLOBALS['ip'];
253 253
 		}
254
-		$debug = ' /* ' . mysqli_real_escape_string($link, str_replace('*/', '@/', $debug)) . ' */';
254
+		$debug = ' /* '.mysqli_real_escape_string($link, str_replace('*/', '@/', $debug)).' */';
255 255
 	}
256 256
 
257
-	$r = mysqli_query($link, $query . $debug);
257
+	$r = mysqli_query($link, $query.$debug);
258 258
 
259 259
 	//Eviter de propager le GoneAway sur les autres requetes d'un même processus PHP
260 260
 	if ($e = spip_mysql_errno($serveur)) {  // Log d'un Gone Away
@@ -267,7 +267,7 @@  discard block
 block discarded – undo
267 267
 			$connexion = &$GLOBALS['connexions'][$serveur ? strtolower($serveur) : 0];
268 268
 			$link = $connexion['link'];
269 269
 			//On retente au cas où
270
-			$r = mysqli_query($link, $query . $debug);
270
+			$r = mysqli_query($link, $query.$debug);
271 271
 		}
272 272
 	}
273 273
 
@@ -295,7 +295,7 @@  discard block
 block discarded – undo
295 295
 	// d'utiliser ceux-ci, copie-colle de phpmyadmin
296 296
 	$query = preg_replace(",^TABLE\s*`([^`]*)`,i", "TABLE \\1", $query);
297 297
 
298
-	return spip_mysql_query("ALTER " . $query, $serveur, $requeter); # i.e. que PG se debrouille
298
+	return spip_mysql_query("ALTER ".$query, $serveur, $requeter); # i.e. que PG se debrouille
299 299
 }
300 300
 
301 301
 
@@ -308,7 +308,7 @@  discard block
 block discarded – undo
308 308
  * @return bool            Toujours true
309 309
  */
310 310
 function spip_mysql_optimize($table, $serveur = '', $requeter = true) {
311
-	spip_mysql_query("OPTIMIZE TABLE " . $table);
311
+	spip_mysql_query("OPTIMIZE TABLE ".$table);
312 312
 
313 313
 	return true;
314 314
 }
@@ -331,7 +331,7 @@  discard block
 block discarded – undo
331 331
 	$link = $connexion['link'];
332 332
 	$db = $connexion['db'];
333 333
 
334
-	$query = 'EXPLAIN ' . _mysql_traite_query($query, $db, $prefixe);
334
+	$query = 'EXPLAIN '._mysql_traite_query($query, $db, $prefixe);
335 335
 	$r = mysqli_query($link, $query);
336 336
 
337 337
 	return spip_mysql_fetch($r, null, $serveur);
@@ -382,7 +382,7 @@  discard block
 block discarded – undo
382 382
 		. calculer_mysql_expression('WHERE', $where)
383 383
 		. calculer_mysql_expression('GROUP BY', $groupby, ',')
384 384
 		. calculer_mysql_expression('HAVING', $having)
385
-		. ($orderby ? ("\nORDER BY " . spip_mysql_order($orderby)) : '')
385
+		. ($orderby ? ("\nORDER BY ".spip_mysql_order($orderby)) : '')
386 386
 		. ($limit ? "\nLIMIT $limit" : '');
387 387
 
388 388
 	// renvoyer la requete inerte si demandee
@@ -472,12 +472,12 @@  discard block
 block discarded – undo
472 472
 	$exp = "\n$expression ";
473 473
 
474 474
 	if (!is_array($v)) {
475
-		return $exp . $v;
475
+		return $exp.$v;
476 476
 	} else {
477 477
 		if (strtoupper($join) === 'AND') {
478
-			return $exp . join("\n\t$join ", array_map('calculer_mysql_where', $v));
478
+			return $exp.join("\n\t$join ", array_map('calculer_mysql_where', $v));
479 479
 		} else {
480
-			return $exp . join($join, $v);
480
+			return $exp.join($join, $v);
481 481
 		}
482 482
 	}
483 483
 }
@@ -495,17 +495,17 @@  discard block
 block discarded – undo
495 495
 		if (substr($k, -1) == '@') {
496 496
 			// c'est une jointure qui se refere au from precedent
497 497
 			// pas de virgule
498
-			$res .= '  ' . $v;
498
+			$res .= '  '.$v;
499 499
 		} else {
500 500
 			if (!is_numeric($k)) {
501 501
 				$p = strpos($v, " ");
502 502
 				if ($p) {
503
-					$v = substr($v, 0, $p) . " AS `$k`" . substr($v, $p);
503
+					$v = substr($v, 0, $p)." AS `$k`".substr($v, $p);
504 504
 				} else {
505 505
 					$v .= " AS `$k`";
506 506
 				}
507 507
 			}
508
-			$res .= ', ' . $v;
508
+			$res .= ', '.$v;
509 509
 		}
510 510
 	}
511 511
 
@@ -534,13 +534,13 @@  discard block
 block discarded – undo
534 534
 function _mysql_traite_query($query, $db = '', $prefixe = '') {
535 535
 
536 536
 	if ($GLOBALS['mysql_rappel_nom_base'] and $db) {
537
-		$pref = '`' . $db . '`.';
537
+		$pref = '`'.$db.'`.';
538 538
 	} else {
539 539
 		$pref = '';
540 540
 	}
541 541
 
542 542
 	if ($prefixe) {
543
-		$pref .= $prefixe . "_";
543
+		$pref .= $prefixe."_";
544 544
 	}
545 545
 
546 546
 	if (!preg_match('/\s(SET|VALUES|WHERE|DATABASE)\s/i', $query, $regs)) {
@@ -554,12 +554,12 @@  discard block
 block discarded – undo
554 554
 		if (stripos($suite, "SELECT") !== false) {
555 555
 			list($suite, $textes) = query_echappe_textes($suite);
556 556
 			if (preg_match('/^(.*?)([(]\s*SELECT\b.*)$/si', $suite, $r)) {
557
-				$suite = $r[1] . _mysql_traite_query($r[2], $db, $prefixe);
557
+				$suite = $r[1]._mysql_traite_query($r[2], $db, $prefixe);
558 558
 			}
559 559
 			$suite = query_reinjecte_textes($suite, $textes);
560 560
 		}
561 561
 	}
562
-	$r = preg_replace(_SQL_PREFIXE_TABLE_MYSQL, '\1' . $pref, $query) . $suite;
562
+	$r = preg_replace(_SQL_PREFIXE_TABLE_MYSQL, '\1'.$pref, $query).$suite;
563 563
 
564 564
 	// en option, remplacer les emoji (que mysql ne sait pas gérer) en 💩
565 565
 	// remplacer les emoji (que mysql ne sait pas gérer) en 💩
@@ -593,7 +593,7 @@  discard block
 block discarded – undo
593 593
 	$link = _mysql_link($serveur);
594 594
 	$ok = mysqli_select_db($link, $db);
595 595
 	if (!$ok) {
596
-		spip_log('Echec mysqli_selectdb. Erreur : ' . mysqli_error($link), 'mysql.' . _LOG_CRITIQUE);
596
+		spip_log('Echec mysqli_selectdb. Erreur : '.mysqli_error($link), 'mysql.'._LOG_CRITIQUE);
597 597
 	}
598 598
 
599 599
 	return $ok;
@@ -683,10 +683,10 @@  discard block
 block discarded – undo
683 683
 
684 684
 	$character_set = "";
685 685
 	if (@$GLOBALS['meta']['charset_sql_base']) {
686
-		$character_set .= " CHARACTER SET " . $GLOBALS['meta']['charset_sql_base'];
686
+		$character_set .= " CHARACTER SET ".$GLOBALS['meta']['charset_sql_base'];
687 687
 	}
688 688
 	if (@$GLOBALS['meta']['charset_collation_sql_base']) {
689
-		$character_set .= " COLLATE " . $GLOBALS['meta']['charset_collation_sql_base'];
689
+		$character_set .= " COLLATE ".$GLOBALS['meta']['charset_collation_sql_base'];
690 690
 	}
691 691
 
692 692
 	foreach ($champs as $k => $v) {
@@ -695,7 +695,7 @@  discard block
 block discarded – undo
695 695
 			if (preg_match(',(char|text),i', $defs[1])
696 696
 				and !preg_match(',(binary|CHARACTER|COLLATE),i', $v)
697 697
 			) {
698
-				$v = $defs[1] . $character_set . ' ' . substr($v, strlen($defs[1]));
698
+				$v = $defs[1].$character_set.' '.substr($v, strlen($defs[1]));
699 699
 			}
700 700
 		}
701 701
 
@@ -707,7 +707,7 @@  discard block
 block discarded – undo
707 707
 		$s = ",";
708 708
 	}
709 709
 	$temporary = $temporary ? 'TEMPORARY' : '';
710
-	$q = "CREATE $temporary TABLE IF NOT EXISTS $nom ($query" . ($keys ? ",$keys" : '') . ")"
710
+	$q = "CREATE $temporary TABLE IF NOT EXISTS $nom ($query".($keys ? ",$keys" : '').")"
711 711
 		. " ENGINE=MyISAM"
712 712
 		. ($character_set ? " DEFAULT $character_set" : "")
713 713
 		. "\n";
@@ -787,7 +787,7 @@  discard block
 block discarded – undo
787 787
 		return false;
788 788
 	}
789 789
 
790
-	$query = "CREATE VIEW $nom AS " . $query_select;
790
+	$query = "CREATE VIEW $nom AS ".$query_select;
791 791
 
792 792
 	return spip_mysql_query($query, $serveur, $requeter);
793 793
 }
@@ -845,7 +845,7 @@  discard block
 block discarded – undo
845 845
  *     Ressource à utiliser avec sql_fetch()
846 846
  **/
847 847
 function spip_mysql_showbase($match, $serveur = '', $requeter = true) {
848
-	return spip_mysql_query("SHOW TABLES LIKE " . _q($match), $serveur, $requeter);
848
+	return spip_mysql_query("SHOW TABLES LIKE "._q($match), $serveur, $requeter);
849 849
 }
850 850
 
851 851
 /**
@@ -939,22 +939,22 @@  discard block
 block discarded – undo
939 939
 			}
940 940
 			if ($val['Default'] === '0' || $val['Default']) {
941 941
 				if (preg_match('/[A-Z_]/', $val['Default'])) {
942
-					$nfields[$val["Field"]] .= ' DEFAULT ' . $val['Default'];
942
+					$nfields[$val["Field"]] .= ' DEFAULT '.$val['Default'];
943 943
 				} else {
944
-					$nfields[$val["Field"]] .= " DEFAULT '" . $val['Default'] . "'";
944
+					$nfields[$val["Field"]] .= " DEFAULT '".$val['Default']."'";
945 945
 				}
946 946
 			}
947 947
 			if ($val['Extra']) {
948
-				$nfields[$val["Field"]] .= ' ' . $val['Extra'];
948
+				$nfields[$val["Field"]] .= ' '.$val['Extra'];
949 949
 			}
950 950
 			if ($val['Key'] == 'PRI') {
951 951
 				$nkeys['PRIMARY KEY'] = $val["Field"];
952 952
 			} else {
953 953
 				if ($val['Key'] == 'MUL') {
954
-					$nkeys['KEY ' . $val["Field"]] = $val["Field"];
954
+					$nkeys['KEY '.$val["Field"]] = $val["Field"];
955 955
 				} else {
956 956
 					if ($val['Key'] == 'UNI') {
957
-						$nkeys['UNIQUE KEY ' . $val["Field"]] = $val["Field"];
957
+						$nkeys['UNIQUE KEY '.$val["Field"]] = $val["Field"];
958 958
 					}
959 959
 				}
960 960
 			}
@@ -1025,7 +1025,7 @@  discard block
 block discarded – undo
1025 1025
 	$serveur = '',
1026 1026
 	$requeter = true
1027 1027
 ) {
1028
-	$c = !$groupby ? '*' : ('DISTINCT ' . (is_string($groupby) ? $groupby : join(',', $groupby)));
1028
+	$c = !$groupby ? '*' : ('DISTINCT '.(is_string($groupby) ? $groupby : join(',', $groupby)));
1029 1029
 
1030 1030
 	$r = spip_mysql_select("COUNT($c)", $from, $where, '', '', '', $having, $serveur, $requeter);
1031 1031
 	if (!$requeter) {
@@ -1065,7 +1065,7 @@  discard block
 block discarded – undo
1065 1065
 	if ($s) {
1066 1066
 		$trace = debug_backtrace();
1067 1067
 		if ($trace[0]['function'] != "spip_mysql_error") {
1068
-			spip_log("$s - $query - " . sql_error_backtrace(), 'mysql.' . _LOG_ERREUR);
1068
+			spip_log("$s - $query - ".sql_error_backtrace(), 'mysql.'._LOG_ERREUR);
1069 1069
 		}
1070 1070
 	}
1071 1071
 
@@ -1232,7 +1232,7 @@  discard block
 block discarded – undo
1232 1232
 		$couples[$champ] = spip_mysql_cite($val, $fields[$champ]);
1233 1233
 	}
1234 1234
 
1235
-	return spip_mysql_insert($table, "(" . join(',', array_keys($couples)) . ")", "(" . join(',', $couples) . ")", $desc,
1235
+	return spip_mysql_insert($table, "(".join(',', array_keys($couples)).")", "(".join(',', $couples).")", $desc,
1236 1236
 		$serveur, $requeter);
1237 1237
 }
1238 1238
 
@@ -1266,7 +1266,7 @@  discard block
 block discarded – undo
1266 1266
 	}
1267 1267
 	$fields = isset($desc['field']) ? $desc['field'] : array();
1268 1268
 
1269
-	$cles = "(" . join(',', array_keys(reset($tab_couples))) . ')';
1269
+	$cles = "(".join(',', array_keys(reset($tab_couples))).')';
1270 1270
 	$valeurs = array();
1271 1271
 	$r = false;
1272 1272
 
@@ -1275,7 +1275,7 @@  discard block
 block discarded – undo
1275 1275
 		foreach ($couples as $champ => $val) {
1276 1276
 			$couples[$champ] = spip_mysql_cite($val, $fields[$champ]);
1277 1277
 		}
1278
-		$valeurs[] = '(' . join(',', $couples) . ')';
1278
+		$valeurs[] = '('.join(',', $couples).')';
1279 1279
 		if (count($valeurs) >= 100) {
1280 1280
 			$r = spip_mysql_insert($table, $cles, join(', ', $valeurs), $desc, $serveur, $requeter);
1281 1281
 			$valeurs = array();
@@ -1312,7 +1312,7 @@  discard block
 block discarded – undo
1312 1312
 function spip_mysql_update($table, $champs, $where = '', $desc = array(), $serveur = '', $requeter = true) {
1313 1313
 	$set = array();
1314 1314
 	foreach ($champs as $champ => $val) {
1315
-		$set[] = $champ . "=$val";
1315
+		$set[] = $champ."=$val";
1316 1316
 	}
1317 1317
 	if (!empty($set)) {
1318 1318
 		return spip_mysql_query(
@@ -1366,7 +1366,7 @@  discard block
 block discarded – undo
1366 1366
 	}
1367 1367
 	$set = array();
1368 1368
 	foreach ($champs as $champ => $val) {
1369
-		$set[] = $champ . '=' . spip_mysql_cite($val, @$fields[$champ]);
1369
+		$set[] = $champ.'='.spip_mysql_cite($val, @$fields[$champ]);
1370 1370
 	}
1371 1371
 
1372 1372
 	return spip_mysql_query(
@@ -1431,8 +1431,8 @@  discard block
 block discarded – undo
1431 1431
  *     - False en cas d'erreur.
1432 1432
  **/
1433 1433
 function spip_mysql_replace($table, $couples, $desc = array(), $serveur = '', $requeter = true) {
1434
-	return spip_mysql_query("REPLACE $table (" . join(',', array_keys($couples)) . ') VALUES (' . join(',',
1435
-			array_map('_q', $couples)) . ')', $serveur, $requeter);
1434
+	return spip_mysql_query("REPLACE $table (".join(',', array_keys($couples)).') VALUES ('.join(',',
1435
+			array_map('_q', $couples)).')', $serveur, $requeter);
1436 1436
 }
1437 1437
 
1438 1438
 
@@ -1461,10 +1461,10 @@  discard block
 block discarded – undo
1461 1461
  *     - False en cas d'erreur.
1462 1462
  **/
1463 1463
 function spip_mysql_replace_multi($table, $tab_couples, $desc = array(), $serveur = '', $requeter = true) {
1464
-	$cles = "(" . join(',', array_keys($tab_couples[0])) . ')';
1464
+	$cles = "(".join(',', array_keys($tab_couples[0])).')';
1465 1465
 	$valeurs = array();
1466 1466
 	foreach ($tab_couples as $couples) {
1467
-		$valeurs[] = '(' . join(',', array_map('_q', $couples)) . ')';
1467
+		$valeurs[] = '('.join(',', array_map('_q', $couples)).')';
1468 1468
 	}
1469 1469
 	$valeurs = implode(', ', $valeurs);
1470 1470
 
@@ -1484,28 +1484,28 @@  discard block
 block discarded – undo
1484 1484
  */
1485 1485
 function spip_mysql_multi($objet, $lang) {
1486 1486
 	$lengthlang = strlen("[$lang]");
1487
-	$posmulti = "INSTR(" . $objet . ", '<multi>')";
1488
-	$posfinmulti = "INSTR(" . $objet . ", '</multi>')";
1489
-	$debutchaine = "LEFT(" . $objet . ", $posmulti-1)";
1490
-	$finchaine = "RIGHT(" . $objet . ", CHAR_LENGTH(" . $objet . ") -(7+$posfinmulti))";
1491
-	$chainemulti = "TRIM(SUBSTRING(" . $objet . ", $posmulti+7, $posfinmulti -(7+$posmulti)))";
1492
-	$poslang = "INSTR($chainemulti,'[" . $lang . "]')";
1487
+	$posmulti = "INSTR(".$objet.", '<multi>')";
1488
+	$posfinmulti = "INSTR(".$objet.", '</multi>')";
1489
+	$debutchaine = "LEFT(".$objet.", $posmulti-1)";
1490
+	$finchaine = "RIGHT(".$objet.", CHAR_LENGTH(".$objet.") -(7+$posfinmulti))";
1491
+	$chainemulti = "TRIM(SUBSTRING(".$objet.", $posmulti+7, $posfinmulti -(7+$posmulti)))";
1492
+	$poslang = "INSTR($chainemulti,'[".$lang."]')";
1493 1493
 	$poslang = "IF($poslang=0,INSTR($chainemulti,']')+1,$poslang+$lengthlang)";
1494
-	$chainelang = "TRIM(SUBSTRING(" . $objet . ", $posmulti+7+$poslang-1,$posfinmulti -($posmulti+7+$poslang-1) ))";
1495
-	$posfinlang = "INSTR(" . $chainelang . ", '[')";
1494
+	$chainelang = "TRIM(SUBSTRING(".$objet.", $posmulti+7+$poslang-1,$posfinmulti -($posmulti+7+$poslang-1) ))";
1495
+	$posfinlang = "INSTR(".$chainelang.", '[')";
1496 1496
 	$chainelang = "IF($posfinlang>0,LEFT($chainelang,$posfinlang-1),$chainelang)";
1497 1497
 	//$chainelang = "LEFT($chainelang,$posfinlang-1)";
1498
-	$retour = "(TRIM(IF($posmulti = 0 , " .
1499
-		"     TRIM(" . $objet . "), " .
1500
-		"     CONCAT( " .
1501
-		"          $debutchaine, " .
1502
-		"          IF( " .
1503
-		"               $poslang = 0, " .
1504
-		"                     $chainemulti, " .
1505
-		"               $chainelang" .
1506
-		"          ), " .
1507
-		"          $finchaine" .
1508
-		"     ) " .
1498
+	$retour = "(TRIM(IF($posmulti = 0 , ".
1499
+		"     TRIM(".$objet."), ".
1500
+		"     CONCAT( ".
1501
+		"          $debutchaine, ".
1502
+		"          IF( ".
1503
+		"               $poslang = 0, ".
1504
+		"                     $chainemulti, ".
1505
+		"               $chainelang".
1506
+		"          ), ".
1507
+		"          $finchaine".
1508
+		"     ) ".
1509 1509
 		"))) AS multi";
1510 1510
 
1511 1511
 	return $retour;
@@ -1522,7 +1522,7 @@  discard block
 block discarded – undo
1522 1522
  *     Valeur hexadécimale pour MySQL
1523 1523
  **/
1524 1524
 function spip_mysql_hex($v) {
1525
-	return "0x" . $v;
1525
+	return "0x".$v;
1526 1526
 }
1527 1527
 
1528 1528
 /**
@@ -1562,7 +1562,7 @@  discard block
 block discarded – undo
1562 1562
  *     Expression SQL
1563 1563
  **/
1564 1564
 function spip_mysql_date_proche($champ, $interval, $unite) {
1565
-	$use_now = ( ($champ === 'maj' or strpos($champ, '.maj')) ? true : false );
1565
+	$use_now = (($champ === 'maj' or strpos($champ, '.maj')) ? true : false);
1566 1566
 	return '('
1567 1567
 	. $champ
1568 1568
 	. (($interval <= 0) ? '>' : '<')
@@ -1616,7 +1616,7 @@  discard block
 block discarded – undo
1616 1616
 		elseif (is_numeric($v)) {
1617 1617
 			return strval($v);
1618 1618
 		}
1619
-		return "'" . addslashes($v) . "'";
1619
+		return "'".addslashes($v)."'";
1620 1620
 	}
1621 1621
 
1622 1622
 	if (is_null($v)
@@ -1638,7 +1638,7 @@  discard block
 block discarded – undo
1638 1638
 		}
1639 1639
 	}
1640 1640
 
1641
-	return ("'" . addslashes($v) . "'");
1641
+	return ("'".addslashes($v)."'");
1642 1642
 }
1643 1643
 
1644 1644
 
@@ -1667,9 +1667,9 @@  discard block
 block discarded – undo
1667 1667
 	$connexion = &$GLOBALS['connexions'][0];
1668 1668
 	$bd = $connexion['db'];
1669 1669
 	$prefixe = $connexion['prefixe'];
1670
-	$nom = "$bd:$prefixe:$nom" . _LOCK_TIME;
1670
+	$nom = "$bd:$prefixe:$nom"._LOCK_TIME;
1671 1671
 
1672
-	$connexion['last'] = $q = "SELECT GET_LOCK(" . _q($nom) . ", $timeout) AS n";
1672
+	$connexion['last'] = $q = "SELECT GET_LOCK("._q($nom).", $timeout) AS n";
1673 1673
 
1674 1674
 	$q = @sql_fetch(mysqli_query(_mysql_link(), $q));
1675 1675
 	if (!$q) {
@@ -1696,9 +1696,9 @@  discard block
 block discarded – undo
1696 1696
 	$connexion = &$GLOBALS['connexions'][0];
1697 1697
 	$bd = $connexion['db'];
1698 1698
 	$prefixe = $connexion['prefixe'];
1699
-	$nom = "$bd:$prefixe:$nom" . _LOCK_TIME;
1699
+	$nom = "$bd:$prefixe:$nom"._LOCK_TIME;
1700 1700
 
1701
-	$connexion['last'] = $q = "SELECT RELEASE_LOCK(" . _q($nom) . ")";
1701
+	$connexion['last'] = $q = "SELECT RELEASE_LOCK("._q($nom).")";
1702 1702
 	mysqli_query(_mysql_link(), $q);
1703 1703
 }
1704 1704
 
@@ -1734,7 +1734,7 @@  discard block
 block discarded – undo
1734 1734
 	} else {
1735 1735
 		$GLOBALS['mysql_rappel_nom_base'] = false;
1736 1736
 
1737
-		return "\$GLOBALS['mysql_rappel_nom_base'] = false; " .
1737
+		return "\$GLOBALS['mysql_rappel_nom_base'] = false; ".
1738 1738
 		"/* echec de test_rappel_nom_base_mysql a l'installation. */\n";
1739 1739
 	}
1740 1740
 }
Please login to merge, or discard this patch.
ecrire/xml/valider.php 2 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -319,7 +319,7 @@
 block discarded – undo
319 319
 	/**
320 320
 	 * Constructeur
321 321
 	 *
322
-	 * @param array $process ?
322
+	 * @param boolean $process ?
323 323
 	 **/
324 324
 	public function __construct($process = array()) {
325 325
 		if (is_array($process)) {
Please login to merge, or discard this patch.
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -62,7 +62,7 @@  discard block
 block discarded – undo
62 62
 							. $pere
63 63
 							. '</b>'
64 64
 							. (!$bons_peres ? ''
65
-								: ('<p style="font-size: 80%"> ' . _T('zxml_mais_de') . ' <b>' . $bons_peres . '</b></p>')));
65
+								: ('<p style="font-size: 80%"> '._T('zxml_mais_de').' <b>'.$bons_peres.'</b></p>')));
66 66
 					} elseif ($this->dtc->regles[$pere][0] == '/') {
67 67
 						$frat = substr($depth, 2);
68 68
 						if (!isset($this->fratrie[$frat])) {
@@ -100,15 +100,15 @@  discard block
 block discarded – undo
100 100
 		if (!isset($a[$name])) {
101 101
 			$bons = join(', ', array_keys($a));
102 102
 			if ($bons) {
103
-				$bons = " title=' " .
104
-					_T('zxml_connus_attributs') .
105
-					'&nbsp;: ' .
106
-					$bons .
103
+				$bons = " title=' ".
104
+					_T('zxml_connus_attributs').
105
+					'&nbsp;: '.
106
+					$bons.
107 107
 					"'";
108 108
 			}
109 109
 			$bons .= " style='font-weight: bold'";
110 110
 			coordonnees_erreur($this, " <b>$name</b> "
111
-				. _T('zxml_inconnu_attribut') . ' ' . _T('zxml_de')
111
+				. _T('zxml_inconnu_attribut').' '._T('zxml_de')
112 112
 				. " <a$bons>$bal</a> ("
113 113
 				. _T('zxml_survoler')
114 114
 				. ")");
@@ -117,7 +117,7 @@  discard block
 block discarded – undo
117 117
 			if (!preg_match('/^\w+$/', $type)) {
118 118
 				$this->valider_motif($phraseur, $name, $val, $bal, $type);
119 119
 			} else {
120
-				if (method_exists($this, $f = 'validerAttribut_' . $type)) {
120
+				if (method_exists($this, $f = 'validerAttribut_'.$type)) {
121 121
 					$this->$f($phraseur, $name, $val, $bal);
122 122
 				}
123 123
 			}
@@ -170,14 +170,14 @@  discard block
 block discarded – undo
170 170
 				. " <b>$bal</b> "
171 171
 				. _T('zxml_non_conforme')
172 172
 				. "</p><p>"
173
-				. "<b>" . $motif . "</b>");
173
+				. "<b>".$motif."</b>");
174 174
 		}
175 175
 	}
176 176
 
177 177
 	// https://code.spip.net/@valider_idref
178 178
 	public function valider_idref($nom, $ligne, $col) {
179 179
 		if (!isset($this->ids[$nom])) {
180
-			$this->err[] = array(" <p><b>$nom</b> " . _T('zxml_inconnu_id'), $ligne, $col);
180
+			$this->err[] = array(" <p><b>$nom</b> "._T('zxml_inconnu_id'), $ligne, $col);
181 181
 		}
182 182
 	}
183 183
 
@@ -227,7 +227,7 @@  discard block
 block discarded – undo
227 227
 		// controler que les balises devant etre vides le sont 
228 228
 		if ($vide) {
229 229
 			if ($n <> ($k + $c)) {
230
-				coordonnees_erreur($this, " <p><b>$name</b> " . _T('zxml_nonvide_balise'));
230
+				coordonnees_erreur($this, " <p><b>$name</b> "._T('zxml_nonvide_balise'));
231 231
 			}
232 232
 			// pour les regles PCDATA ou iteration de disjonction, tout est fait
233 233
 		} elseif ($regle and ($regle != '*')) {
@@ -262,7 +262,7 @@  discard block
 block discarded – undo
262 262
 			$d = $this->ouvrant[$d];
263 263
 			preg_match('/^\s*(\S+)/', $d, $m);
264 264
 			if (isset($this->dtc->pcdata[$m[1]]) and ($this->dtc->pcdata[$m[1]])) {
265
-				coordonnees_erreur($this, " <p><b>" . $m[1] . "</b> "
265
+				coordonnees_erreur($this, " <p><b>".$m[1]."</b> "
266 266
 					. _T('zxml_nonvide_balise') // message a affiner
267 267
 				);
268 268
 			}
@@ -309,7 +309,7 @@  discard block
 block discarded – undo
309 309
 	public function phraserTout($phraseur, $data) {
310 310
 		xml_parsestring($this, $data);
311 311
 
312
-		if (!$this->dtc or preg_match(',^' . _MESSAGE_DOCTYPE . ',', $data)) {
312
+		if (!$this->dtc or preg_match(',^'._MESSAGE_DOCTYPE.',', $data)) {
313 313
 			$this->err[] = array('DOCTYPE ?', 0, 0);
314 314
 		} else {
315 315
 			$this->valider_passe2($this);
Please login to merge, or discard this patch.
ecrire/public/iterateur.php 2 patches
Doc Comments   +4 added lines patch added patch discarded remove patch
@@ -457,6 +457,10 @@
 block discarded – undo
457 457
 	 * aller a la position $n en parcourant
458 458
 	 * un par un tous les elements
459 459
 	 */
460
+
461
+	/**
462
+	 * @param integer $n
463
+	 */
460 464
 	private function seek_loop($n) {
461 465
 		if ($this->pos > $n) {
462 466
 			$this->rewind();
Please login to merge, or discard this patch.
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -79,9 +79,9 @@  discard block
 block discarded – undo
79 79
 			// chercher la classe d'iterateur
80 80
 			// IterateurXXX
81 81
 			// definie dans le fichier iterateurs/xxx.php
82
-			$class = "Iterateur" . $iterateur;
82
+			$class = "Iterateur".$iterateur;
83 83
 			if (!class_exists($class)) {
84
-				if (!include_spip("iterateur/" . strtolower($iterateur))
84
+				if (!include_spip("iterateur/".strtolower($iterateur))
85 85
 					or !class_exists($class)
86 86
 				) {
87 87
 					die("Iterateur $iterateur non trouv&#233;");
@@ -208,7 +208,7 @@  discard block
 block discarded – undo
208 208
 				return $this->iter->$nom();
209 209
 			} catch (Exception $e) {
210 210
 				// #GETCHILDREN sur un fichier de DirectoryIterator ...
211
-				spip_log("Methode $nom en echec sur " . get_class($this->iter));
211
+				spip_log("Methode $nom en echec sur ".get_class($this->iter));
212 212
 				spip_log("Cela peut être normal : retour d'une ligne de resultat ne pouvant pas calculer cette methode");
213 213
 
214 214
 				return '';
@@ -290,8 +290,8 @@  discard block
 block discarded – undo
290 290
 
291 291
 		// Creer la fonction de filtrage sur $this
292 292
 		if ($this->filtre) {
293
-			$filtres = 'return (' . join(') AND (', $this->filtre) . ');';
294
-			$this->func_filtre = function () use ($filtres) {
293
+			$filtres = 'return ('.join(') AND (', $this->filtre).');';
294
+			$this->func_filtre = function() use ($filtres) {
295 295
 				return eval($filtres);
296 296
 			};
297 297
 		}
@@ -313,28 +313,28 @@  discard block
 block discarded – undo
313 313
 		# if (!in_array($cle, array('cle', 'valeur')))
314 314
 		#	return;
315 315
 
316
-		$a = '$this->get_select(\'' . $cle . '\')';
316
+		$a = '$this->get_select(\''.$cle.'\')';
317 317
 
318 318
 		$filtre = '';
319 319
 
320 320
 		if ($op == 'REGEXP') {
321
-			$filtre = 'filtrer("match", ' . $a . ', ' . str_replace('\"', '"', $valeur) . ')';
321
+			$filtre = 'filtrer("match", '.$a.', '.str_replace('\"', '"', $valeur).')';
322 322
 			$op = '';
323 323
 		} else {
324 324
 			if ($op == 'LIKE') {
325 325
 				$valeur = str_replace(array('\"', '_', '%'), array('"', '.', '.*'), preg_quote($valeur));
326
-				$filtre = 'filtrer("match", ' . $a . ', ' . $valeur . ')';
326
+				$filtre = 'filtrer("match", '.$a.', '.$valeur.')';
327 327
 				$op = '';
328 328
 			} else {
329 329
 				if ($op == '=') {
330 330
 					$op = '==';
331 331
 				} else {
332 332
 					if ($op == 'IN') {
333
-						$filtre = 'in_array(' . $a . ', array' . $valeur . ')';
333
+						$filtre = 'in_array('.$a.', array'.$valeur.')';
334 334
 						$op = '';
335 335
 					} else {
336 336
 						if (!in_array($op, array('<', '<=', '>', '>='))) {
337
-							spip_log('operateur non reconnu ' . $op); // [todo] mettre une erreur de squelette
337
+							spip_log('operateur non reconnu '.$op); // [todo] mettre une erreur de squelette
338 338
 							$op = '';
339 339
 						}
340 340
 					}
@@ -343,7 +343,7 @@  discard block
 block discarded – undo
343 343
 		}
344 344
 
345 345
 		if ($op) {
346
-			$filtre = $a . $op . str_replace('\"', '"', $valeur);
346
+			$filtre = $a.$op.str_replace('\"', '"', $valeur);
347 347
 		}
348 348
 
349 349
 		if ($not) {
Please login to merge, or discard this patch.
ecrire/public/jointures.php 2 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -231,7 +231,7 @@
 block discarded – undo
231 231
  *
232 232
  * @param array $depart
233 233
  * @param array $arrivee
234
- * @param string|array $col
234
+ * @param string $col
235 235
  * @return bool
236 236
  */
237 237
 function nogroupby_if($depart, $arrivee, $col) {
Please login to merge, or discard this patch.
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -176,14 +176,14 @@  discard block
 block discarded – undo
176 176
 			// sache qu'il peut enlever ce where si il enleve la jointure
177 177
 			$boucle->where["JOIN-L$n"] =
178 178
 				$echap ?
179
-					array("'='","'$obj'","sql_quote('$type')")
179
+					array("'='", "'$obj'", "sql_quote('$type')")
180 180
 					:
181
-					array("=","$obj",sql_quote($type));
181
+					array("=", "$obj", sql_quote($type));
182 182
 			$boucle->join["L$n"] =
183 183
 				$echap ?
184 184
 					array("'$id_table'", "'$j2'", "'$j1'", "'$obj='.sql_quote('$type')")
185 185
 					:
186
-					array($id_table, $j2, $j1, "$obj=" . sql_quote($type));
186
+					array($id_table, $j2, $j1, "$obj=".sql_quote($type));
187 187
 		} else {
188 188
 			$boucle->join["L$n"] = $echap ? array("'$id_table'", "'$j'") : array($id_table, $j);
189 189
 		}
@@ -216,7 +216,7 @@  discard block
 block discarded – undo
216 216
 	$groups = liste_champs_jointures($nom, $desc, true);
217 217
 	if (!$pk) {
218 218
 		foreach ($groups as $id_prim) {
219
-			$id_field = $nom . '.' . $id_prim;
219
+			$id_field = $nom.'.'.$id_prim;
220 220
 			if (!in_array($id_field, $boucle->group)) {
221 221
 				$boucle->group[] = $id_field;
222 222
 			}
Please login to merge, or discard this patch.
ecrire/public/normaliser.php 2 patches
Doc Comments   +3 added lines patch added patch discarded remove patch
@@ -75,6 +75,9 @@
 block discarded – undo
75 75
 }
76 76
 
77 77
 
78
+/**
79
+ * @param string $nom
80
+ */
78 81
 function phraser_logo_faux_filtres($nom) {
79 82
 	switch ($nom) {
80 83
 		case 'top':
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -53,7 +53,7 @@  discard block
 block discarded – undo
53 53
 			$p->etoile = '*';
54 54
 			spip_log("filtre de logo obsolete $nom", 'vieilles_defs');
55 55
 
56
-		} elseif (preg_match("/^" . NOM_DE_CHAMP . '(.*)$/sS', $nom, $m)) {
56
+		} elseif (preg_match("/^".NOM_DE_CHAMP.'(.*)$/sS', $nom, $m)) {
57 57
 			$champ = new Champ();
58 58
 			$champ->nom_boucle = $m[2];
59 59
 			$champ->nom_champ = $m[3];
@@ -131,7 +131,7 @@  discard block
 block discarded – undo
131 131
 		$p->param[0][1] = array($c);
132 132
 		$p->param[0][0] = '';
133 133
 		$p->fonctions = array();
134
-		spip_log('FORMULAIRE_RECHERCHE avec filtre ' . $c->texte, 'vieilles_defs');
134
+		spip_log('FORMULAIRE_RECHERCHE avec filtre '.$c->texte, 'vieilles_defs');
135 135
 	}
136 136
 }
137 137
 
Please login to merge, or discard this patch.
ecrire/public/parametrer.php 2 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -231,7 +231,7 @@
 block discarded – undo
231 231
  *
232 232
  * @uses public_tester_redirection_dist()
233 233
  * @param string $fond
234
- * @param array $contexte
234
+ * @param string $contexte
235 235
  * @param string $connect
236 236
  * @return array|bool
237 237
  */
Please login to merge, or discard this patch.
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -81,7 +81,7 @@  discard block
 block discarded – undo
81 81
 	} else {
82 82
 		// Preparer l'appel de la fonction principale du squelette 
83 83
 
84
-		spip_timer($a = 'calcul page ' . rand(0, 1000));
84
+		spip_timer($a = 'calcul page '.rand(0, 1000));
85 85
 
86 86
 		// On cree un marqueur de notes unique lie a cette composition
87 87
 		// et on enregistre l'etat courant des globales de notes...
@@ -113,8 +113,8 @@  discard block
 block discarded – undo
113 113
 		try {
114 114
 			$page = $fonc(array('cache' => $cache), array($contexte));
115 115
 		} catch (Throwable $e) {
116
-			$msg = _T('zbug_erreur_execution_page') . " $sourcefile";
117
-			$full_msg = $msg . ' | File ' . $e->getFile() . ' Line ' . $e->getLine() . ' : ' . $e->getMessage();
116
+			$msg = _T('zbug_erreur_execution_page')." $sourcefile";
117
+			$full_msg = $msg.' | File '.$e->getFile().' Line '.$e->getLine().' : '.$e->getMessage();
118 118
 			$full_msg = str_replace(_ROOT_RACINE, '[…]/', $full_msg);
119 119
 			$corps = "<pre>$msg</pre>";
120 120
 			$page = analyse_resultat_skel($fond, array('cache' => $cache), $corps, $sourcefile);
@@ -145,17 +145,17 @@  discard block
 block discarded – undo
145 145
 
146 146
 		$profile = spip_timer($a);
147 147
 		spip_log("calcul ($profile) [$skel] $infos"
148
-			. ' (' . strlen($page['texte']) . ' octets)');
148
+			. ' ('.strlen($page['texte']).' octets)');
149 149
 
150
-		if (defined('_CALCUL_PROFILER') AND intval($profile)>_CALCUL_PROFILER){
150
+		if (defined('_CALCUL_PROFILER') AND intval($profile) > _CALCUL_PROFILER) {
151 151
 			spip_log("calcul ($profile) [$skel] $infos"
152
-				.' ('.strlen($page['texte']).' octets) | '.$_SERVER['REQUEST_URI'],"profiler"._LOG_AVERTISSEMENT);
152
+				.' ('.strlen($page['texte']).' octets) | '.$_SERVER['REQUEST_URI'], "profiler"._LOG_AVERTISSEMENT);
153 153
 		}
154 154
 
155 155
 		if ($debug) {
156 156
 			// si c'est ce que demande le debusqueur, lui passer la main
157 157
 			$t = strlen($page['texte']) ? $page['texte'] : " ";
158
-			$GLOBALS['debug_objets']['resultat'][$fonc . 'tout'] = $t;
158
+			$GLOBALS['debug_objets']['resultat'][$fonc.'tout'] = $t;
159 159
 			$GLOBALS['debug_objets']['courant'] = $courant;
160 160
 			$GLOBALS['debug_objets']['profile'][$sourcefile] = $profile;
161 161
 			if ($GLOBALS['debug_objets']['sourcefile']
@@ -185,7 +185,7 @@  discard block
 block discarded – undo
185 185
 		if (defined('_VAR_INCLURE') and _VAR_INCLURE) {
186 186
 			$page['sourcefile'] = $sourcefile;
187 187
 			$page['texte'] =
188
-				"<div class='inclure_blocs'><h6>" . $page['sourcefile'] . "</h6>" . $page['texte'] . "</div>"
188
+				"<div class='inclure_blocs'><h6>".$page['sourcefile']."</h6>".$page['texte']."</div>"
189 189
 				. ($js_inclus ? "" : "<script type='text/javascript'>jQuery(function(){jQuery('.inclure_blocs > h6:first-child').hover(function(){jQuery(this).parent().addClass('hover')},function(){jQuery(this).parent().removeClass('hover')})});</script>");
190 190
 			$js_inclus = true;
191 191
 		}
@@ -220,21 +220,21 @@  discard block
 block discarded – undo
220 220
 		}
221 221
 		if (is_array($val)) {
222 222
 			if ($profondeur_max > 0) {
223
-				$val = 'array:' . count($val) . '(' . presenter_contexte($val, $profondeur_max - 1, 3) . ')';
223
+				$val = 'array:'.count($val).'('.presenter_contexte($val, $profondeur_max - 1, 3).')';
224 224
 			} else {
225
-				$val = 'array:' . count($val);
225
+				$val = 'array:'.count($val);
226 226
 			}
227 227
 		} elseif (is_object($val)) {
228 228
 			$val = get_class($val);
229 229
 		} elseif (strlen("$val") > 30) {
230
-			$val = substr("$val", 0, 29) . '…';
230
+			$val = substr("$val", 0, 29).'…';
231 231
 			if (strstr($val, ' ')) {
232 232
 				$val = "'$val'";
233 233
 			}
234 234
 		} elseif (strstr($val, ' ')) {
235 235
 			$val = "'$val'";
236 236
 		}
237
-		$infos[] = $var . '=' . $val;
237
+		$infos[] = $var.'='.$val;
238 238
 	}
239 239
 	return join(', ', $infos);
240 240
 }
@@ -301,7 +301,7 @@  discard block
 block discarded – undo
301 301
 						. "?php include_spip('inc/headers');redirige_par_entete('"
302 302
 						. texte_script($url)
303 303
 						. "','',$status);"
304
-						. "?" . ">",
304
+						. "?".">",
305 305
 					'process_ins' => 'php',
306 306
 					'status' => $status
307 307
 				);
Please login to merge, or discard this patch.
ecrire/public/sandbox.php 2 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -158,7 +158,7 @@
 block discarded – undo
158 158
  * @param string $corps
159 159
  * @param array $filtres
160 160
  *     Tableau de filtres à appliquer.
161
- * @return mixed|string
161
+ * @return string
162 162
  */
163 163
 function sandbox_filtrer_squelette($skel, $corps, $filtres) {
164 164
 	$series_filtres = func_get_args();
Please login to merge, or discard this patch.
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -41,7 +41,7 @@  discard block
 block discarded – undo
41 41
  *     Texte
42 42
  */
43 43
 function sandbox_composer_texte($texte, &$p) {
44
-	$code = "'" . str_replace(array("\\", "'"), array("\\\\", "\\'"), $texte) . "'";
44
+	$code = "'".str_replace(array("\\", "'"), array("\\\\", "\\'"), $texte)."'";
45 45
 
46 46
 	return $code;
47 47
 }
@@ -58,7 +58,7 @@  discard block
 block discarded – undo
58 58
  *     Balise qui appelle ce filtre
59 59
  * @return string
60 60
  */
61
-function sandbox_composer_filtre($fonc, $code, $arglist, &$p, $nb_arg_droite=1000) : string {
61
+function sandbox_composer_filtre($fonc, $code, $arglist, &$p, $nb_arg_droite = 1000) : string {
62 62
 	if (isset($GLOBALS['spip_matrice'][$fonc])) {
63 63
 		$code = "filtrer('$fonc',$code$arglist)";
64 64
 	}
@@ -82,11 +82,11 @@  discard block
 block discarded – undo
82 82
 			$code = "$f($code$arglist)";
83 83
 			$nb_arg_gauche = 1; // la balise à laquelle s'applique le filtre
84 84
 		}
85
-		$nb_args_f = $nb_arg_gauche+$nb_arg_droite;
85
+		$nb_args_f = $nb_arg_gauche + $nb_arg_droite;
86 86
 		$min_f = $refl->getNumberOfRequiredParameters();
87 87
 		if (($nb_args_f < $min_f)) {
88
-			$msg_args = ['filtre' => texte_script ($fonc), 'nb'=> $min_f - $nb_args_f];
89
-			erreur_squelette ([ 'zbug_erreur_filtre_nbarg_min', $msg_args], $p);
88
+			$msg_args = ['filtre' => texte_script($fonc), 'nb'=> $min_f - $nb_args_f];
89
+			erreur_squelette(['zbug_erreur_filtre_nbarg_min', $msg_args], $p);
90 90
 		}
91 91
 	}
92 92
 	// le filtre n'existe pas,
@@ -171,8 +171,8 @@  discard block
 block discarded – undo
171 171
  */
172 172
 function sandbox_filtrer_squelette($skel, $corps, $filtres) {
173 173
 	$series_filtres = func_get_args();
174
-	array_shift($series_filtres);// skel
175
-	array_shift($series_filtres);// corps
174
+	array_shift($series_filtres); // skel
175
+	array_shift($series_filtres); // corps
176 176
 
177 177
 	// proteger les <INCLUDE> et tous les morceaux de php licites
178 178
 	if ($skel['process_ins'] == 'php') {
@@ -220,7 +220,7 @@  discard block
 block discarded – undo
220 220
 	if (is_array($r)) {
221 221
 		$dst[] = $r[0];
222 222
 
223
-		return $src[] = '___' . md5($r[0]) . '___';
223
+		return $src[] = '___'.md5($r[0]).'___';
224 224
 	}
225 225
 
226 226
 	// si on recoit pas un tableau, on renvoit les couples de substitution
Please login to merge, or discard this patch.
ecrire/public/styliser_par_z.php 2 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -236,7 +236,7 @@
 block discarded – undo
236 236
  * @param string $type
237 237
  * @param string $ext
238 238
  * @param bool $echafauder
239
- * @return mixed
239
+ * @return string|boolean
240 240
  */
241 241
 function z_contenu_disponible($prefix_path, $z_contenu, $type, $ext, $echafauder = true) {
242 242
 	if ($d = z_trouver_bloc($prefix_path, $z_contenu, $type, $ext)) {
Please login to merge, or discard this patch.
Spacing   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -53,7 +53,7 @@  discard block
 block discarded – undo
53 53
 			$apl_constant = '_Z_AJAX_PARALLEL_LOAD';
54 54
 			$page = _SPIP_PAGE;
55 55
 			$echafauder = charger_fonction('echafauder', 'public', true);
56
-			define('_ZCORE_EXCLURE_PATH', '\bprive|\bsquelettes-dist' . (defined('_DIR_PLUGIN_DIST') ? '|\b' . rtrim(_DIR_PLUGIN_DIST,
56
+			define('_ZCORE_EXCLURE_PATH', '\bprive|\bsquelettes-dist'.(defined('_DIR_PLUGIN_DIST') ? '|\b'.rtrim(_DIR_PLUGIN_DIST,
57 57
 						'/') : ''));
58 58
 		}
59 59
 		$prepend = (defined('_Z_PREPEND_PATH') ? _Z_PREPEND_PATH : "");
@@ -74,7 +74,7 @@  discard block
 block discarded – undo
74 74
 			and in_array($dir, $z_blocs) // verifier deja qu'on est dans un bloc Z
75 75
 			and defined($apl_constant)
76 76
 			and in_array($dir, explode(',', constant($apl_constant))) // et dans un demande en APL
77
-			and $pipe = z_trouver_bloc($prefix_path . $prepend, $dir, 'z_apl', $ext) // et qui contient le squelette APL
77
+			and $pipe = z_trouver_bloc($prefix_path.$prepend, $dir, 'z_apl', $ext) // et qui contient le squelette APL
78 78
 		) {
79 79
 			$flux['data'] = $pipe;
80 80
 
@@ -87,7 +87,7 @@  discard block
 block discarded – undo
87 87
 			$echafauder = "";
88 88
 		}
89 89
 		if ($prepend) {
90
-			$squelette = substr(find_in_path($prefix_path . $prepend . "$fond.$ext"), 0, -strlen(".$ext"));
90
+			$squelette = substr(find_in_path($prefix_path.$prepend."$fond.$ext"), 0, -strlen(".$ext"));
91 91
 			if ($squelette) {
92 92
 				$flux['data'] = $squelette;
93 93
 			}
@@ -111,11 +111,11 @@  discard block
 block discarded – undo
111 111
 				// se brancher sur contenu/xx si il existe
112 112
 				// ou si c'est un objet spip, associe a une table, utiliser le fond homonyme
113 113
 				if (!isset($disponible[$fond])) {
114
-					$disponible[$fond] = z_contenu_disponible($prefix_path . $prepend, $z_contenu, $fond, $ext, $echafauder);
114
+					$disponible[$fond] = z_contenu_disponible($prefix_path.$prepend, $z_contenu, $fond, $ext, $echafauder);
115 115
 				}
116 116
 
117 117
 				if ($disponible[$fond]) {
118
-					$flux['data'] = substr(find_in_path($prefix_path . "page.$ext"), 0, -strlen(".$ext"));
118
+					$flux['data'] = substr(find_in_path($prefix_path."page.$ext"), 0, -strlen(".$ext"));
119 119
 				}
120 120
 			}
121 121
 
@@ -128,7 +128,7 @@  discard block
 block discarded – undo
128 128
 					$type = $flux['args']['contexte'][$page];
129 129
 				}
130 130
 				if (!isset($disponible[$type])) {
131
-					$disponible[$type] = z_contenu_disponible($prefix_path . $prepend, $z_contenu, $type, $ext, $echafauder);
131
+					$disponible[$type] = z_contenu_disponible($prefix_path.$prepend, $z_contenu, $type, $ext, $echafauder);
132 132
 				}
133 133
 				if (is_string($disponible[$type])) {
134 134
 					$flux['data'] = $disponible[$type];
@@ -141,7 +141,7 @@  discard block
 block discarded – undo
141 141
 				) {
142 142
 					$flux['data'] = $echafauder($type, $is[0], $is[1], $is[2], $ext);
143 143
 				} else {
144
-					$flux['data'] = ($disponible['404'] = z_contenu_disponible($prefix_path . $prepend, $z_contenu, '404', $ext,
144
+					$flux['data'] = ($disponible['404'] = z_contenu_disponible($prefix_path.$prepend, $z_contenu, '404', $ext,
145 145
 						$echafauder));
146 146
 				}
147 147
 			}
@@ -160,10 +160,10 @@  discard block
 block discarded – undo
160 160
 						$type = $flux['args']['contexte'][$page];
161 161
 					}
162 162
 					if ($type !== 'page' and !isset($disponible[$type])) {
163
-						$disponible[$type] = z_contenu_disponible($prefix_path . $prepend, $z_contenu, $type, $ext, $echafauder);
163
+						$disponible[$type] = z_contenu_disponible($prefix_path.$prepend, $z_contenu, $type, $ext, $echafauder);
164 164
 					}
165 165
 					if ($type == 'page' or $disponible[$type]) {
166
-						$flux['data'] = z_trouver_bloc($prefix_path . $prepend, $dir, 'dist', $ext);
166
+						$flux['data'] = z_trouver_bloc($prefix_path.$prepend, $dir, 'dist', $ext);
167 167
 					}
168 168
 				}
169 169
 			}
@@ -178,16 +178,16 @@  discard block
 block discarded – undo
178 178
 			if (isset($flux['args']['contexte']['type-page'])
179 179
 				and (
180 180
 					(isset($flux['args']['contexte']['composition'])
181
-						and file_exists(($f = $squelette . "-" . $flux['args']['contexte']['type-page'] . "-" . $flux['args']['contexte']['composition']) . ".$ext"))
181
+						and file_exists(($f = $squelette."-".$flux['args']['contexte']['type-page']."-".$flux['args']['contexte']['composition']).".$ext"))
182 182
 					or
183
-					file_exists(($f = $squelette . "-" . $flux['args']['contexte']['type-page']) . ".$ext")
183
+					file_exists(($f = $squelette."-".$flux['args']['contexte']['type-page']).".$ext")
184 184
 				)
185 185
 			) {
186 186
 				$flux['data'] = $f;
187 187
 			}
188 188
 		} elseif ($fond == 'structure'
189 189
 			and z_sanitize_var_zajax()
190
-			and $f = find_in_path($prefix_path . $prepend . 'ajax' . ".$ext")
190
+			and $f = find_in_path($prefix_path.$prepend.'ajax'.".$ext")
191 191
 		) {
192 192
 			$flux['data'] = substr($f, 0, -strlen(".$ext"));
193 193
 		} // chercher le fond correspondant a la composition
@@ -197,7 +197,7 @@  discard block
 block discarded – undo
197 197
 			and $dir = explode('/', $dir)
198 198
 			and $dir = reset($dir)
199 199
 			and in_array($dir, $z_blocs)
200
-			and $f = find_in_path($prefix_path . $prepend . $fond . "-" . $flux['args']['contexte']['composition'] . ".$ext")
200
+			and $f = find_in_path($prefix_path.$prepend.$fond."-".$flux['args']['contexte']['composition'].".$ext")
201 201
 		) {
202 202
 			$flux['data'] = substr($f, 0, -strlen(".$ext"));
203 203
 		}
@@ -258,7 +258,7 @@  discard block
 block discarded – undo
258 258
  **/
259 259
 function z_fond_valide($squelette) {
260 260
 	if (!_ZCORE_EXCLURE_PATH
261
-		or !preg_match(',(' . _ZCORE_EXCLURE_PATH . ')/,', $squelette)
261
+		or !preg_match(',('._ZCORE_EXCLURE_PATH.')/,', $squelette)
262 262
 	) {
263 263
 		return true;
264 264
 	}
@@ -381,23 +381,23 @@  discard block
 block discarded – undo
381 381
 		}
382 382
 		$dir = z_blocs(test_espace_prive());
383 383
 		$dir = reset($dir);
384
-		$scaffold = "<INCLURE{fond=prive/echafaudage/$dir/" . $fond . ",objet=" . $type . ",id_objet=#" . strtoupper($primary) . ",env}>";
384
+		$scaffold = "<INCLURE{fond=prive/echafaudage/$dir/".$fond.",objet=".$type.",id_objet=#".strtoupper($primary).",env}>";
385 385
 	} // page objets
386 386
 	elseif ($type = $desc_exec and strpos($type, "/") === false) {
387 387
 		$dir = z_blocs(test_espace_prive());
388 388
 		$dir = reset($dir);
389
-		$scaffold = "<INCLURE{fond=prive/echafaudage/$dir/objets,objet=" . $type . ",env} />";
389
+		$scaffold = "<INCLURE{fond=prive/echafaudage/$dir/objets,objet=".$type.",env} />";
390 390
 	}
391 391
 	// morceau d'objet : on fournit le fond de sibstitution dans $desc_exec
392 392
 	// et objet et tire de $table
393 393
 	elseif ($fond = $desc_exec) {
394 394
 		$dir = md5(dirname($fond));
395
-		$scaffold = "<INCLURE{fond=$fond,objet=" . objet_type($table) . ",env} />";
395
+		$scaffold = "<INCLURE{fond=$fond,objet=".objet_type($table).",env} />";
396 396
 	}
397 397
 
398 398
 	$base_dir = sous_repertoire(_DIR_CACHE, "scaffold", false);
399 399
 	$base_dir = sous_repertoire($base_dir, $dir, false);
400
-	$f = $base_dir . "$exec";
400
+	$f = $base_dir."$exec";
401 401
 	ecrire_fichier("$f.$ext", $scaffold);
402 402
 
403 403
 	return $f;
Please login to merge, or discard this patch.
ecrire/public/quete.php 2 patches
Doc Comments   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -28,9 +28,9 @@  discard block
 block discarded – undo
28 28
 /**
29 29
  * Retourne l'URL de redirection d'un article virtuel, seulement si il est publié
30 30
  *
31
- * @param $id_article
32
- * @param $connect
33
- * @return array|bool|null
31
+ * @param integer $id_article
32
+ * @param string $connect
33
+ * @return string
34 34
  */
35 35
 function quete_virtuel($id_article, $connect) {
36 36
 	return sql_getfetsel(
@@ -122,7 +122,7 @@  discard block
 block discarded – undo
122 122
  * @uses quete_parent_lang()
123 123
  *
124 124
  * @param int $id_article
125
- * @param $serveur
125
+ * @param string $serveur
126 126
  * @return int
127 127
  */
128 128
 function quete_rubrique($id_article, $serveur) {
@@ -293,7 +293,7 @@  discard block
 block discarded – undo
293 293
  *
294 294
  * @param int $id_document
295 295
  * @param string $serveur
296
- * @return array|bool|null
296
+ * @return string
297 297
  */
298 298
 function quete_fichier($id_document, $serveur = '') {
299 299
 	return sql_getfetsel('fichier', 'spip_documents', ('id_document=' . intval($id_document)), '', array(), '', '', $serveur);
Please login to merge, or discard this patch.
Spacing   +17 added lines, -18 removed lines patch added patch discarded remove patch
@@ -36,7 +36,7 @@  discard block
 block discarded – undo
36 36
 	return sql_getfetsel(
37 37
 		'virtuel',
38 38
 		'spip_articles',
39
-		array('id_article=' . intval($id_article), "statut='publie'"),
39
+		array('id_article='.intval($id_article), "statut='publie'"),
40 40
 		'',
41 41
 		'',
42 42
 		'',
@@ -78,7 +78,7 @@  discard block
 block discarded – undo
78 78
 			$cache_quete[$connect][$table][$id] = sql_fetsel(
79 79
 				$cache_quete[$connect][$table]['_select'],
80 80
 				$table,
81
-				$cache_quete[$connect][$table]['_id'] . '=' . intval($id),
81
+				$cache_quete[$connect][$table]['_id'].'='.intval($id),
82 82
 				'',
83 83
 				'',
84 84
 				'',
@@ -171,7 +171,7 @@  discard block
 block discarded – undo
171 171
 	return
172 172
 		(isset($GLOBALS['meta']['date_prochain_postdate'])
173 173
 			and $GLOBALS['meta']['date_prochain_postdate'] > time())
174
-			? "$champ_date<" . sql_quote(date('Y-m-d H:i:s', $GLOBALS['meta']['date_prochain_postdate']), $serveur)
174
+			? "$champ_date<".sql_quote(date('Y-m-d H:i:s', $GLOBALS['meta']['date_prochain_postdate']), $serveur)
175 175
 			: '1=1';
176 176
 }
177 177
 
@@ -229,7 +229,7 @@  discard block
 block discarded – undo
229 229
 				and $id_table = reset($objet)
230 230
 				and $objet = objet_type($id_table)
231 231
 			) {
232
-				$w = "$mstatut<>" . sql_quote($v);
232
+				$w = "$mstatut<>".sql_quote($v);
233 233
 
234 234
 				// retrouver l’id_auteur qui a filé un lien de prévisu éventuellement,
235 235
 				// sinon l’auteur en session
@@ -243,22 +243,22 @@  discard block
 block discarded – undo
243 243
 				}
244 244
 
245 245
 				// dans ce cas (admin en general), pas de filtrage sur ce statut
246
-				if (!autoriser('previsualiser' . $v, $objet, '', $id_auteur)) {
246
+				if (!autoriser('previsualiser'.$v, $objet, '', $id_auteur)) {
247 247
 					// si pas d'auteur identifie pas de sous-requete car pas d'article qui matche
248 248
 					if (!$id_auteur) {
249 249
 						$where[] = $w;
250 250
 					} else {
251 251
 						$primary = id_table_objet($objet);
252
-						$where[] = "($w OR $id_table.$primary IN (" . sql_get_select(
252
+						$where[] = "($w OR $id_table.$primary IN (".sql_get_select(
253 253
 								'ssss.id_objet',
254 254
 								'spip_auteurs_liens AS ssss',
255
-								'ssss.objet=' . sql_quote($objet) . ' AND ssss.id_auteur=' . intval($id_auteur),
255
+								'ssss.objet='.sql_quote($objet).' AND ssss.id_auteur='.intval($id_auteur),
256 256
 								'',
257 257
 								'',
258 258
 								'',
259 259
 								'',
260 260
 								$serveur
261
-							) . '))';
261
+							).'))';
262 262
 					}
263 263
 				}
264 264
 			} // ignorer ce statut si on ne sait pas comment le filtrer
@@ -296,7 +296,7 @@  discard block
 block discarded – undo
296 296
  * @return array|bool|null
297 297
  */
298 298
 function quete_fichier($id_document, $serveur = '') {
299
-	return sql_getfetsel('fichier', 'spip_documents', ('id_document=' . intval($id_document)), '', array(), '', '', $serveur);
299
+	return sql_getfetsel('fichier', 'spip_documents', ('id_document='.intval($id_document)), '', array(), '', '', $serveur);
300 300
 }
301 301
 
302 302
 /**
@@ -307,7 +307,7 @@  discard block
 block discarded – undo
307 307
  * @return array|bool
308 308
  */
309 309
 function quete_document($id_document, $serveur = '') {
310
-	return sql_fetsel('*', 'spip_documents', ('id_document=' . intval($id_document)), '', array(), '', '', $serveur);
310
+	return sql_fetsel('*', 'spip_documents', ('id_document='.intval($id_document)), '', array(), '', '', $serveur);
311 311
 }
312 312
 
313 313
 /**
@@ -318,7 +318,7 @@  discard block
 block discarded – undo
318 318
  * @return array|bool|null
319 319
  */
320 320
 function quete_meta($nom, $serveur) {
321
-	return sql_getfetsel('valeur', 'spip_meta', 'nom=' . sql_quote($nom), '', '', '', '', $serveur);
321
+	return sql_getfetsel('valeur', 'spip_meta', 'nom='.sql_quote($nom), '', '', '', '', $serveur);
322 322
 }
323 323
 
324 324
 /**
@@ -372,9 +372,9 @@  discard block
 block discarded – undo
372 372
 				// qui permet de distinguer le changement de logo
373 373
 				// et placer un expire sur le dossier IMG/
374 374
 				$res = array(
375
-					$on['chemin'] . ($on['timestamp'] ? "?{$on['timestamp']}" : ''),
376
-					($off ? $off['chemin'] . ($off['timestamp'] ? "?{$off['timestamp']}" : '') : ''),
377
-					(!$taille ? '' : (' ' . $taille[3]))
375
+					$on['chemin'].($on['timestamp'] ? "?{$on['timestamp']}" : ''),
376
+					($off ? $off['chemin'].($off['timestamp'] ? "?{$off['timestamp']}" : '') : ''),
377
+					(!$taille ? '' : (' '.$taille[3]))
378 378
 				);
379 379
 				$res['src'] = $res[0];
380 380
 				$res['logo_on'] = $res[0];
@@ -470,7 +470,7 @@  discard block
 block discarded – undo
470 470
 	// si c'est une vignette type doc, la renvoyer direct
471 471
 	if (strcmp($logo, _DIR_PLUGINS) == 0
472 472
 		or strcmp($logo, _DIR_PLUGINS_DIST) == 0
473
-		or strcmp($logo, _DIR_RACINE . 'prive/') == 0
473
+		or strcmp($logo, _DIR_RACINE.'prive/') == 0
474 474
 	) {
475 475
 		return $logo;
476 476
 	}
@@ -589,8 +589,7 @@  discard block
 block discarded – undo
589 589
 	// qu'une fois (par squelette) et on conserve le resultat
590 590
 	// en static.
591 591
 	if (!isset($exposer[$m = md5(serialize($reference))][$prim])) {
592
-		$principal = isset($reference[$type]) ? $reference[$type] :
593
-			// cas de la pagination indecte @xx qui positionne la page avec l'id xx
592
+		$principal = isset($reference[$type]) ? $reference[$type] : // cas de la pagination indecte @xx qui positionne la page avec l'id xx
594 593
 			// et donne la reference dynamique @type=xx dans le contexte
595 594
 			(isset($reference["@$type"]) ? $reference["@$type"] : '');
596 595
 		// le parent fournit en argument est le parent de $id, pas celui de $principal
@@ -618,7 +617,7 @@  discard block
 block discarded – undo
618 617
 				$exposer[$m][$type][$principal] = true;
619 618
 				if ($type == 'id_mot') {
620 619
 					if (!$parent) {
621
-						$parent = sql_getfetsel('id_groupe', 'spip_mots', 'id_mot=' . intval($principal), '', '', '', '', $connect);
620
+						$parent = sql_getfetsel('id_groupe', 'spip_mots', 'id_mot='.intval($principal), '', '', '', '', $connect);
622 621
 					}
623 622
 					if ($parent) {
624 623
 						$exposer[$m]['id_groupe'][$parent] = true;
Please login to merge, or discard this patch.