Completed
Push — master ( 1ee6c1...34072e )
by cam
01:29
created
ecrire/inc/plugin.php 1 patch
Spacing   +48 added lines, -48 removed lines patch added patch discarded remove patch
@@ -22,7 +22,7 @@  discard block
 block discarded – undo
22 22
 
23 23
 /** l'adresse du repertoire de telechargement et de decompactage des plugins */
24 24
 if (!defined('_DIR_PLUGINS_AUTO')) {
25
-	define('_DIR_PLUGINS_AUTO', _DIR_PLUGINS . 'auto/');
25
+	define('_DIR_PLUGINS_AUTO', _DIR_PLUGINS.'auto/');
26 26
 }
27 27
 
28 28
 #include_spip('inc/texte'); // ????? Appelle public/parametrer trop tot avant la reconstruction du chemin des plugins.
@@ -373,7 +373,7 @@  discard block
 block discarded – undo
373 373
 				if ($dir) {
374 374
 					$dir .= '/';
375 375
 				}
376
-				$dir .= 'procure:' . $procure['nom'];
376
+				$dir .= 'procure:'.$procure['nom'];
377 377
 
378 378
 				$procure['etat'] = '?';
379 379
 				$procure['dir_type'] = $resume['dir_type'];
@@ -557,7 +557,7 @@  discard block
 block discarded – undo
557 557
 		$plug = $resume['dir'];
558 558
 		$k = $infos[$dir_type][$plug];
559 559
 
560
-		$plug = constant($dir_type) . $plug;
560
+		$plug = constant($dir_type).$plug;
561 561
 		if (!isset($msg[$p])) {
562 562
 			if (isset($resume['erreur']) and $resume['erreur']) {
563 563
 				$msg[$p] = [$resume['erreur']];
@@ -600,10 +600,10 @@  discard block
 block discarded – undo
600 600
 		$list = $raw ? [] : $GLOBALS['meta']['plugin_erreur_activation'];
601 601
 	} elseif (!$raw) {
602 602
 		foreach ($list as $plug => $msg) {
603
-			$list[$plug] = '<li>' . _T('plugin_impossible_activer', ['plugin' => $plug])
604
-				. '<ul><li>' . implode('</li><li>', $msg) . '</li></ul></li>';
603
+			$list[$plug] = '<li>'._T('plugin_impossible_activer', ['plugin' => $plug])
604
+				. '<ul><li>'.implode('</li><li>', $msg).'</li></ul></li>';
605 605
 		}
606
-		$list = '<ul>' . join("\n", $list) . '</ul>';
606
+		$list = '<ul>'.join("\n", $list).'</ul>';
607 607
 	}
608 608
 	if ($raz) {
609 609
 		effacer_meta('plugin_erreur_activation');
@@ -717,13 +717,13 @@  discard block
 block discarded – undo
717 717
 			if ($minimum_inclus and spip_version_compare($version, $minimum, '<')) {
718 718
 				return _T("plugin_${balise}_${type}", [
719 719
 					'plugin' => $nom,
720
-					'version' => ' &ge; ' . $minimum
720
+					'version' => ' &ge; '.$minimum
721 721
 				]);
722 722
 			}
723 723
 			if (!$minimum_inclus and spip_version_compare($version, $minimum, '<=')) {
724 724
 				return _T("plugin_${balise}_${type}", [
725 725
 					'plugin' => $nom,
726
-					'version' => ' &gt; ' . $minimum
726
+					'version' => ' &gt; '.$minimum
727 727
 				]);
728 728
 			}
729 729
 		}
@@ -732,13 +732,13 @@  discard block
 block discarded – undo
732 732
 			if ($maximum_inclus and spip_version_compare($version, $maximum, '>')) {
733 733
 				return _T("plugin_${balise}_${type}", [
734 734
 					'plugin' => $nom,
735
-					'version' => ' &le; ' . $maximum
735
+					'version' => ' &le; '.$maximum
736 736
 				]);
737 737
 			}
738 738
 			if (!$maximum_inclus and spip_version_compare($version, $maximum, '>=')) {
739 739
 				return _T("plugin_${balise}_plugin", [
740 740
 					'plugin' => $nom,
741
-					'version' => ' &lt; ' . $maximum
741
+					'version' => ' &lt; '.$maximum
742 742
 				]);
743 743
 			}
744 744
 		}
@@ -757,7 +757,7 @@  discard block
 block discarded – undo
757 757
 		include_spip('inc/charger_plugin');
758 758
 		$url = '<br />'	. bouton_telechargement_plugin($url, 'lib');
759 759
 	}*/
760
-	return _T('plugin_necessite_lib', ['lib' => $lib]) . " <a href='$url'>$url</a>";
760
+	return _T('plugin_necessite_lib', ['lib' => $lib])." <a href='$url'>$url</a>";
761 761
 }
762 762
 
763 763
 
@@ -857,7 +857,7 @@  discard block
 block discarded – undo
857 857
 	foreach ($plugin_valides as $p => $resume) {
858 858
 		// Les headers ne doivent pas indiquer les versions des extensions PHP, ni la version PHP
859 859
 		if (0 !== strpos($p, 'PHP:') and $p !== 'PHP') {
860
-			$header[] = $p . ($resume['version'] ? '(' . $resume['version'] . ')' : '');
860
+			$header[] = $p.($resume['version'] ? '('.$resume['version'].')' : '');
861 861
 		}
862 862
 		if ($resume['dir']) {
863 863
 			foreach ($infos[$resume['dir_type']][$resume['dir']]['lib'] as $l) {
@@ -882,11 +882,11 @@  discard block
 block discarded – undo
882 882
 	$header = strtolower(implode(',', $header));
883 883
 	if (!isset($GLOBALS['spip_header_silencieux']) or !$GLOBALS['spip_header_silencieux']) {
884 884
 		ecrire_fichier(
885
-			_DIR_VAR . 'config.txt',
886
-			(defined('_HEADER_COMPOSED_BY') ? _HEADER_COMPOSED_BY : 'Composed-By: SPIP') . ' ' . $GLOBALS['spip_version_affichee'] . ' @ www.spip.net + ' . $header
885
+			_DIR_VAR.'config.txt',
886
+			(defined('_HEADER_COMPOSED_BY') ? _HEADER_COMPOSED_BY : 'Composed-By: SPIP').' '.$GLOBALS['spip_version_affichee'].' @ www.spip.net + '.$header
887 887
 		);
888 888
 	} else {
889
-		@unlink(_DIR_VAR . 'config.txt');
889
+		@unlink(_DIR_VAR.'config.txt');
890 890
 	}
891 891
 	// generer charger_plugins_chemin.php
892 892
 	plugins_precompile_chemin($plugin_valides, $ordre);
@@ -940,7 +940,7 @@  discard block
 block discarded – undo
940 940
 			// definir le plugin, donc le path avant l'include du fichier options
941 941
 			// permet de faire des include_spip pour attraper un inc_ du plugin
942 942
 
943
-			$dir = $dir_type . ".'" . $plug . "/'";
943
+			$dir = $dir_type.".'".$plug."/'";
944 944
 
945 945
 			$prefix = strtoupper(preg_replace(',\W,', '_', $info['prefix']));
946 946
 			if (
@@ -951,7 +951,7 @@  discard block
 block discarded – undo
951 951
 				if (!$info['chemin']) {
952 952
 					$chemins['public'][] = "_DIR_PLUGIN_$prefix";
953 953
 					$chemins['prive'][] = "_DIR_PLUGIN_$prefix";
954
-					if (is_dir(constant($dir_type) . $plug . '/squelettes/')) {
954
+					if (is_dir(constant($dir_type).$plug.'/squelettes/')) {
955 955
 						$chemins['public'][] = "_DIR_PLUGIN_{$prefix}.'squelettes/'";
956 956
 					}
957 957
 				}
@@ -972,13 +972,13 @@  discard block
 block discarded – undo
972 972
 								$dir = '';
973 973
 							}
974 974
 							if (strlen($dir)) {
975
-								$dir = rtrim($dir, '/') . '/';
975
+								$dir = rtrim($dir, '/').'/';
976 976
 							}
977 977
 							if (!isset($chemin['type']) or $chemin['type'] == 'public') {
978
-								$chemins['public'][] = "_DIR_PLUGIN_$prefix" . (strlen($dir) ? ".'$dir'" : '');
978
+								$chemins['public'][] = "_DIR_PLUGIN_$prefix".(strlen($dir) ? ".'$dir'" : '');
979 979
 							}
980 980
 							if (!isset($chemin['type']) or $chemin['type'] == 'prive') {
981
-								$chemins['prive'][] = "_DIR_PLUGIN_$prefix" . (strlen($dir) ? ".'$dir'" : '');
981
+								$chemins['prive'][] = "_DIR_PLUGIN_$prefix".(strlen($dir) ? ".'$dir'" : '');
982 982
 							}
983 983
 						}
984 984
 					}
@@ -987,11 +987,11 @@  discard block
 block discarded – undo
987 987
 		}
988 988
 	}
989 989
 	if (count($chemins['public']) or count($chemins['prive'])) {
990
-		$contenu .= 'if (_DIR_RESTREINT) _chemin([' . implode(
990
+		$contenu .= 'if (_DIR_RESTREINT) _chemin(['.implode(
991 991
 			',',
992 992
 			array_reverse($chemins['public'])
993
-		) . "]);\n"
994
-			. 'else _chemin([' . implode(',', array_reverse($chemins['prive'])) . "]);\n";
993
+		)."]);\n"
994
+			. 'else _chemin(['.implode(',', array_reverse($chemins['prive']))."]);\n";
995 995
 	}
996 996
 
997 997
 	ecrire_fichier_php(_CACHE_PLUGINS_PATH, $contenu);
@@ -1040,7 +1040,7 @@  discard block
 block discarded – undo
1040 1040
 					and strpos($dir, ':') === false // exclure le cas des procure:
1041 1041
 					and file_exists("$dir$plug/paquet.xml") // uniquement pour les paquet.xml
1042 1042
 				) {
1043
-					if (is_readable("$dir$plug/" . ($file = $info['prefix'] . '_' . $charge . '.php'))) {
1043
+					if (is_readable("$dir$plug/".($file = $info['prefix'].'_'.$charge.'.php'))) {
1044 1044
 						$info[$charge] = [$file];
1045 1045
 					}
1046 1046
 				}
@@ -1057,7 +1057,7 @@  discard block
 block discarded – undo
1057 1057
 						) {
1058 1058
 							unset($info[$charge][$k]);
1059 1059
 						} else {
1060
-							$_file = $root_dir_type . ".'$plug/$file'";
1060
+							$_file = $root_dir_type.".'$plug/$file'";
1061 1061
 							$contenu[$charge] .= "include_once_check($_file);\n";
1062 1062
 						}
1063 1063
 					}
@@ -1067,7 +1067,7 @@  discard block
 block discarded – undo
1067 1067
 		}
1068 1068
 	}
1069 1069
 
1070
-	$contenu['options'] = "define('_PLUGINS_HASH','" . md5($sign) . "');\n" . $contenu['options'];
1070
+	$contenu['options'] = "define('_PLUGINS_HASH','".md5($sign)."');\n".$contenu['options'];
1071 1071
 	$contenu['fonctions'] .= plugin_ongletbouton('boutons_plugins', $boutons)
1072 1072
 		. plugin_ongletbouton('onglets_plugins', $onglets);
1073 1073
 
@@ -1102,12 +1102,12 @@  discard block
 block discarded – undo
1102 1102
 		define("_UPDATED_$nom", $val);
1103 1103
 		define("_UPDATED_md5_$nom", $md5);
1104 1104
 	}
1105
-	$val = "unserialize('" . str_replace("'", "\'", $val) . "')";
1105
+	$val = "unserialize('".str_replace("'", "\'", $val)."')";
1106 1106
 
1107 1107
 	return
1108 1108
 		"if (!function_exists('$nom')) {\n"
1109 1109
 		. "function $nom(){return defined('_UPDATED_$nom')?unserialize(_UPDATED_$nom):$val;}\n"
1110
-		. "function md5_$nom(){return defined('_UPDATED_md5_$nom')?_UPDATED_md5_$nom:'" . $md5 . "';}\n"
1110
+		. "function md5_$nom(){return defined('_UPDATED_md5_$nom')?_UPDATED_md5_$nom:'".$md5."';}\n"
1111 1111
 		. "}\n";
1112 1112
 }
1113 1113
 
@@ -1130,7 +1130,7 @@  discard block
 block discarded – undo
1130 1130
 	if (@is_readable(_CACHE_PLUGINS_OPT)) {
1131 1131
 		include_once(_CACHE_PLUGINS_OPT);
1132 1132
 	} else {
1133
-		spip_log('pipelines desactives: impossible de produire ' . _CACHE_PLUGINS_OPT);
1133
+		spip_log('pipelines desactives: impossible de produire '._CACHE_PLUGINS_OPT);
1134 1134
 	}
1135 1135
 }
1136 1136
 
@@ -1167,7 +1167,7 @@  discard block
 block discarded – undo
1167 1167
 			$dir_type = $plugin_valides[$p]['dir_type'];
1168 1168
 			$root_dir_type = str_replace('_DIR_', '_ROOT_', $dir_type);
1169 1169
 			$plug = $plugin_valides[$p]['dir'];
1170
-			$prefix = (($info['prefix'] == 'spip') ? '' : $info['prefix'] . '_');
1170
+			$prefix = (($info['prefix'] == 'spip') ? '' : $info['prefix'].'_');
1171 1171
 			if (isset($info['pipeline']) and is_array($info['pipeline'])) {
1172 1172
 				foreach ($info['pipeline'] as $pipe) {
1173 1173
 					$nom = $pipe['nom'];
@@ -1201,7 +1201,7 @@  discard block
 block discarded – undo
1201 1201
 						}
1202 1202
 						if (isset($pipe['inclure'])) {
1203 1203
 							$GLOBALS['spip_matrice']["$prefix$action"] =
1204
-								"$root_dir_type:$plug/" . $pipe['inclure'];
1204
+								"$root_dir_type:$plug/".$pipe['inclure'];
1205 1205
 						}
1206 1206
 					}
1207 1207
 				}
@@ -1211,7 +1211,7 @@  discard block
 block discarded – undo
1211 1211
 					$prepend_code['taches_generales_cron'] = '';
1212 1212
 				}
1213 1213
 				foreach ($info['genie'] as $genie) {
1214
-					$nom = $prefix . $genie['nom'];
1214
+					$nom = $prefix.$genie['nom'];
1215 1215
 					$periode = max(60, intval($genie['periode']));
1216 1216
 					if (charger_fonction($nom, 'genie', true)) {
1217 1217
 						$prepend_code['taches_generales_cron'] .= "\$val['$nom'] = $periode;\n";
@@ -1229,13 +1229,13 @@  discard block
 block discarded – undo
1229 1229
 				}
1230 1230
 				foreach ($info['style'] as $style) {
1231 1231
 					if (isset($style['path']) and $style['path']) {
1232
-						$code = "if (\$f=timestamp(direction_css(find_in_path('" . addslashes($style['path']) . "')))) ";
1232
+						$code = "if (\$f=timestamp(direction_css(find_in_path('".addslashes($style['path'])."')))) ";
1233 1233
 					} else {
1234
-						$code = "if (\$f='" . addslashes($style['url']) . "') ";
1234
+						$code = "if (\$f='".addslashes($style['url'])."') ";
1235 1235
 					}
1236 1236
 					$code .= "\$val .= '<link rel=\"stylesheet\" href=\"'.\$f.'\" type=\"text/css\"";
1237 1237
 					if (isset($style['media']) and strlen($style['media'])) {
1238
-						$code .= ' media="' . addslashes($style['media']) . '"';
1238
+						$code .= ' media="'.addslashes($style['media']).'"';
1239 1239
 					}
1240 1240
 					$code .= "/>';\n";
1241 1241
 					if ($style['type'] != 'prive') {
@@ -1255,9 +1255,9 @@  discard block
 block discarded – undo
1255 1255
 			if (isset($info['script']) and is_countable($info['script']) ? count($info['script']) : 0) {
1256 1256
 				foreach ($info['script'] as $script) {
1257 1257
 					if (isset($script['path']) and $script['path']) {
1258
-						$code = "if (\$f=timestamp(find_in_path('" . addslashes($script['path']) . "'))) ";
1258
+						$code = "if (\$f=timestamp(find_in_path('".addslashes($script['path'])."'))) ";
1259 1259
 					} else {
1260
-						$code = "if (\$f='" . addslashes($script['url']) . "') ";
1260
+						$code = "if (\$f='".addslashes($script['url'])."') ";
1261 1261
 					}
1262 1262
 					$code .= "\$val .= '<script src=\"'.\$f.'\" type=\"text/javascript\"></script>';\n";
1263 1263
 					if ($script['type'] != 'prive') {
@@ -1320,10 +1320,10 @@  discard block
 block discarded – undo
1320 1320
 		unset($GLOBALS['spip_pipeline']['all']);
1321 1321
 		$all_pipes = trim(array_shift($a));
1322 1322
 		if ($all_pipes) {
1323
-			$all_pipes = '|' . ltrim($all_pipes, '|');
1323
+			$all_pipes = '|'.ltrim($all_pipes, '|');
1324 1324
 		}
1325 1325
 		if (count($a)) {
1326
-			$all_pipes_end = '||' . array_shift($a);
1326
+			$all_pipes_end = '||'.array_shift($a);
1327 1327
 		}
1328 1328
 	}
1329 1329
 	$content = '';
@@ -1340,7 +1340,7 @@  discard block
 block discarded – undo
1340 1340
 		// Eclater le pipeline en filtres et appliquer chaque filtre
1341 1341
 		foreach ($pipe as $fonc) {
1342 1342
 			$fonc = trim($fonc);
1343
-			$s_call .= '$val = minipipe(\'' . $fonc . '\', $val);' . "\n";
1343
+			$s_call .= '$val = minipipe(\''.$fonc.'\', $val);'."\n";
1344 1344
 			if (isset($GLOBALS['spip_matrice'][$fonc])) {
1345 1345
 				$file = $GLOBALS['spip_matrice'][$fonc];
1346 1346
 				$file = "'$file'";
@@ -1351,7 +1351,7 @@  discard block
 block discarded – undo
1351 1351
 					if (defined($root_dir)) {
1352 1352
 						$dir = $root_dir;
1353 1353
 					}
1354
-					$file = str_replace($regs[0], "'." . $dir . ".'", $file);
1354
+					$file = str_replace($regs[0], "'.".$dir.".'", $file);
1355 1355
 					$file = str_replace("''.", '', $file);
1356 1356
 					$file = str_replace(constant($dir), '', $file);
1357 1357
 				}
@@ -1364,7 +1364,7 @@  discard block
 block discarded – undo
1364 1364
 		$content .= "// Pipeline $action \n"
1365 1365
 			. "function execute_pipeline_$action(&\$val){\n"
1366 1366
 			. $s_inc
1367
-			. ((isset($prepend_code[$action]) and strlen($prepend_code[$action])) ? trim($prepend_code[$action]) . "\n" : '')
1367
+			. ((isset($prepend_code[$action]) and strlen($prepend_code[$action])) ? trim($prepend_code[$action])."\n" : '')
1368 1368
 			. $s_call
1369 1369
 			. "return \$val;\n}\n";
1370 1370
 	}
@@ -1420,9 +1420,9 @@  discard block
 block discarded – undo
1420 1420
 					$result = ($ok ? ((isset($infos['upgrade']) && $infos['upgrade']) ? _T('plugin_info_upgrade_ok') : _T('plugin_info_install_ok')) : _T('avis_operation_echec'));
1421 1421
 					if (_IS_CLI) {
1422 1422
 						include_spip('inc/filtres');
1423
-						$trace = ltrim(textebrut($trace) . "\n" . $result);
1424
-						$trace = '    ' . str_replace("\n", "\n    ", $trace);
1425
-						echo "\n" . ($ok ? 'OK  ' : '/!\ ') . textebrut($titre) . "\n",
1423
+						$trace = ltrim(textebrut($trace)."\n".$result);
1424
+						$trace = '    '.str_replace("\n", "\n    ", $trace);
1425
+						echo "\n".($ok ? 'OK  ' : '/!\ ').textebrut($titre)."\n",
1426 1426
 						  $trace,
1427 1427
 						  "\n";
1428 1428
 					}
@@ -1457,15 +1457,15 @@  discard block
 block discarded – undo
1457 1457
 		$GLOBALS['fichier_php_compile_recent'] = 0;
1458 1458
 	}
1459 1459
 
1460
-	$contenu = '<' . '?php' . "\n" . $comment . "\nif (defined('_ECRIRE_INC_VERSION')) {\n" . $contenu . "}\n?" . '>';
1460
+	$contenu = '<'.'?php'."\n".$comment."\nif (defined('_ECRIRE_INC_VERSION')) {\n".$contenu."}\n?".'>';
1461 1461
 	// si un fichier existe deja on verifie que son contenu change avant de l'ecraser
1462 1462
 	// si pas de modif on ne touche pas au fichier initial
1463 1463
 	if (file_exists($nom)) {
1464 1464
 		if (substr($nom, -4) == '.php') {
1465
-			$fichier_tmp = substr($nom, 0, -4) . '.tmp.php';
1465
+			$fichier_tmp = substr($nom, 0, -4).'.tmp.php';
1466 1466
 		}
1467 1467
 		else {
1468
-			$fichier_tmp = $nom . '.tmp';
1468
+			$fichier_tmp = $nom.'.tmp';
1469 1469
 		}
1470 1470
 		file_put_contents($fichier_tmp, $contenu);
1471 1471
 		if (md5_file($nom) == md5_file($fichier_tmp)) {
Please login to merge, or discard this patch.
ecrire/inc/rubriques.php 1 patch
Spacing   +35 added lines, -35 removed lines patch added patch discarded remove patch
@@ -135,9 +135,9 @@  discard block
 block discarded – undo
135 135
 		sql_updateq(
136 136
 			'spip_rubriques',
137 137
 			['statut' => 'publie', 'date' => date('Y-m-d H:i:s')],
138
-			'id_rubrique=' . intval($id_rubrique)
138
+			'id_rubrique='.intval($id_rubrique)
139 139
 		);
140
-		$id_parent = sql_getfetsel('id_parent', 'spip_rubriques AS R', 'R.id_rubrique=' . intval($id_rubrique));
140
+		$id_parent = sql_getfetsel('id_parent', 'spip_rubriques AS R', 'R.id_rubrique='.intval($id_rubrique));
141 141
 		if (!$id_parent) {
142 142
 			break;
143 143
 		}
@@ -172,7 +172,7 @@  discard block
 block discarded – undo
172 172
 			return $id_pred != $id_rubrique;
173 173
 		}
174 174
 		// passer au parent si on a depublie
175
-		$r = sql_fetsel('id_parent', 'spip_rubriques', 'id_rubrique=' . intval($id_pred));
175
+		$r = sql_fetsel('id_parent', 'spip_rubriques', 'id_rubrique='.intval($id_pred));
176 176
 		$id_pred = $r['id_parent'];
177 177
 	}
178 178
 
@@ -197,14 +197,14 @@  discard block
 block discarded – undo
197 197
 		$date = date('Y-m-d H:i:s');
198 198
 	}
199 199
 	$postdates = ($GLOBALS['meta']['post_dates'] == 'non') ?
200
-		' AND date <= ' . sql_quote($date) : '';
200
+		' AND date <= '.sql_quote($date) : '';
201 201
 
202 202
 	if (!$id_rubrique = intval($id_rubrique)) {
203 203
 		return false;
204 204
 	}
205 205
 
206 206
 	// verifier qu'elle existe et est bien publiee
207
-	$r = sql_fetsel('id_rubrique,statut', 'spip_rubriques', 'id_rubrique=' . intval($id_rubrique));
207
+	$r = sql_fetsel('id_rubrique,statut', 'spip_rubriques', 'id_rubrique='.intval($id_rubrique));
208 208
 	if (!$r or $r['statut'] !== 'publie') {
209 209
 		return false;
210 210
 	}
@@ -214,12 +214,12 @@  discard block
 block discarded – undo
214 214
 	$compte = [
215 215
 		'articles' => sql_countsel(
216 216
 			'spip_articles',
217
-			'id_rubrique=' . intval($id_rubrique) . " AND statut='publie'$postdates"
217
+			'id_rubrique='.intval($id_rubrique)." AND statut='publie'$postdates"
218 218
 		),
219
-		'rubriques' => sql_countsel('spip_rubriques', 'id_parent=' . intval($id_rubrique) . " AND statut='publie'"),
219
+		'rubriques' => sql_countsel('spip_rubriques', 'id_parent='.intval($id_rubrique)." AND statut='publie'"),
220 220
 		'documents' => sql_countsel(
221 221
 			'spip_documents AS D JOIN spip_documents_liens AS L ON D.id_document=L.id_document',
222
-			'L.id_objet=' . intval($id_rubrique) . " AND L.objet='rubrique' and D.mode NOT IN('logoon', 'logooff') "
222
+			'L.id_objet='.intval($id_rubrique)." AND L.objet='rubrique' and D.mode NOT IN('logoon', 'logooff') "
223 223
 		)
224 224
 	];
225 225
 
@@ -244,7 +244,7 @@  discard block
 block discarded – undo
244 244
 		}
245 245
 	}
246 246
 
247
-	sql_updateq('spip_rubriques', ['statut' => 'prepa'], 'id_rubrique=' . intval($id_rubrique));
247
+	sql_updateq('spip_rubriques', ['statut' => 'prepa'], 'id_rubrique='.intval($id_rubrique));
248 248
 
249 249
 #		spip_log("depublier_rubrique $id_pred");
250 250
 	return true;
@@ -307,7 +307,7 @@  discard block
 block discarded – undo
307 307
 
308 308
 	// Afficher les articles post-dates ?
309 309
 	$postdates = ($GLOBALS['meta']['post_dates'] == 'non') ?
310
-		'AND A.date <= ' . sql_quote(date('Y-m-d H:i:s')) : '';
310
+		'AND A.date <= '.sql_quote(date('Y-m-d H:i:s')) : '';
311 311
 
312 312
 	$r = sql_select(
313 313
 		'R.id_rubrique AS id, max(A.date) AS date_h',
@@ -319,7 +319,7 @@  discard block
 block discarded – undo
319 319
 		sql_updateq(
320 320
 			'spip_rubriques',
321 321
 			['statut_tmp' => 'publie', 'date_tmp' => $row['date_h']],
322
-			'id_rubrique=' . intval($row['id'])
322
+			'id_rubrique='.intval($row['id'])
323 323
 		);
324 324
 	}
325 325
 
@@ -345,7 +345,7 @@  discard block
 block discarded – undo
345 345
 			sql_updateq(
346 346
 				'spip_rubriques',
347 347
 				['statut_tmp' => 'publie', 'date_tmp' => $row['date_h']],
348
-				'id_rubrique=' . intval($row['id'])
348
+				'id_rubrique='.intval($row['id'])
349 349
 			);
350 350
 			$continuer = true;
351 351
 		}
@@ -398,7 +398,7 @@  discard block
 block discarded – undo
398 398
 			and $rows = sql_allfetsel(
399 399
 				'A.id_rubrique AS id, R.id_secteur AS id_secteur, R.profondeur+1 as profondeur',
400 400
 				'spip_rubriques AS A JOIN spip_rubriques AS R ON A.id_parent = R.id_rubrique',
401
-				'R.profondeur=' . intval($prof) . ' AND (A.id_secteur <> R.id_secteur OR A.profondeur > R.profondeur+1)',
401
+				'R.profondeur='.intval($prof).' AND (A.id_secteur <> R.id_secteur OR A.profondeur > R.profondeur+1)',
402 402
 				'',
403 403
 				'R.id_secteur',
404 404
 				'0,100'
@@ -437,11 +437,11 @@  discard block
 block discarded – undo
437 437
 			and $rows = sql_allfetsel(
438 438
 				'id_rubrique as id',
439 439
 				'spip_rubriques',
440
-				'profondeur=' . intval($prof + 1) . ' AND id_parent NOT IN (' . sql_get_select(
440
+				'profondeur='.intval($prof + 1).' AND id_parent NOT IN ('.sql_get_select(
441 441
 					'zzz.id_rubrique',
442 442
 					'spip_rubriques AS zzz',
443
-					'zzz.profondeur=' . intval($prof)
444
-				) . ')',
443
+					'zzz.profondeur='.intval($prof)
444
+				).')',
445 445
 				'',
446 446
 				'',
447 447
 				'0,100'
@@ -455,7 +455,7 @@  discard block
 block discarded – undo
455 455
 		// si pas de rubrique a profondeur $prof+1 pas la peine de continuer
456 456
 		// si il reste des rubriques non vues, c'est une branche morte ou reference circulaire (base foireuse)
457 457
 		// on arrete les frais
458
-		if (sql_countsel('spip_rubriques', 'profondeur=' . intval($prof + 1))) {
458
+		if (sql_countsel('spip_rubriques', 'profondeur='.intval($prof + 1))) {
459 459
 			$prof++;
460 460
 			$continuer = true;
461 461
 		}
@@ -463,12 +463,12 @@  discard block
 block discarded – undo
463 463
 
464 464
 	// loger si la table des rubriques semble foireuse
465 465
 	// et mettre un id_secteur=0 sur ces rubriques pour eviter toute selection par les boucles
466
-	if (sql_countsel('spip_rubriques', 'profondeur>' . intval($prof + 1))) {
466
+	if (sql_countsel('spip_rubriques', 'profondeur>'.intval($prof + 1))) {
467 467
 		spip_log(
468
-			'Les rubriques de profondeur>' . ($prof + 1) . ' semblent suspectes (branches morte ou reference circulaire dans les parents)',
468
+			'Les rubriques de profondeur>'.($prof + 1).' semblent suspectes (branches morte ou reference circulaire dans les parents)',
469 469
 			_LOG_CRITIQUE
470 470
 		);
471
-		sql_update('spip_rubriques', ['id_secteur' => 0], 'profondeur>' . intval($prof + 1));
471
+		sql_update('spip_rubriques', ['id_secteur' => 0], 'profondeur>'.intval($prof + 1));
472 472
 	}
473 473
 
474 474
 	// reparer les articles
@@ -479,7 +479,7 @@  discard block
 block discarded – undo
479 479
 	);
480 480
 
481 481
 	while ($row = sql_fetch($r)) {
482
-		sql_update('spip_articles', ['id_secteur' => $row['secteur']], 'id_article=' . intval($row['id']));
482
+		sql_update('spip_articles', ['id_secteur' => $row['secteur']], 'id_article='.intval($row['id']));
483 483
 	}
484 484
 
485 485
 	// avertir les plugins qui peuvent faire leur mises a jour egalement
@@ -510,7 +510,7 @@  discard block
 block discarded – undo
510 510
 		$t = sql_updateq(
511 511
 			'spip_rubriques',
512 512
 			['lang' => $row['lang'], 'langue_choisie' => 'non'],
513
-			'id_rubrique=' . intval($id_rubrique)
513
+			'id_rubrique='.intval($id_rubrique)
514 514
 		);
515 515
 	}
516 516
 
@@ -555,7 +555,7 @@  discard block
 block discarded – undo
555 555
 		sql_updateq(
556 556
 			'spip_articles',
557 557
 			['lang' => $row['lang'], 'langue_choisie' => 'non'],
558
-			'id_article=' . intval($id_article)
558
+			'id_article='.intval($id_article)
559 559
 		);
560 560
 	}
561 561
 
@@ -630,11 +630,11 @@  discard block
 block discarded – undo
630 630
 				];
631 631
 				// generer un nom de fonction "anonyme" unique
632 632
 				do {
633
-					$functionname = 'f_calculer_langues_utilisees_' . $boucle->id_table . '_' . time() . '_' . random_int(0, mt_getrandmax());
633
+					$functionname = 'f_calculer_langues_utilisees_'.$boucle->id_table.'_'.time().'_'.random_int(0, mt_getrandmax());
634 634
 				} while (function_exists($functionname));
635 635
 				$code = calculer_boucle('calculer_langues_utilisees', $boucles);
636
-				$code = '$SP=0; $command=array();$command["connect"] = $connect = "' . $serveur . '"; $Pile=array(0=>array());' . "\n" . $code;
637
-				$code = 'function ' . $functionname . '(){' . $code . '};$res = ' . $functionname . '();';
636
+				$code = '$SP=0; $command=array();$command["connect"] = $connect = "'.$serveur.'"; $Pile=array(0=>array());'."\n".$code;
637
+				$code = 'function '.$functionname.'(){'.$code.'};$res = '.$functionname.'();';
638 638
 				$res = '';
639 639
 				eval($code);
640 640
 				$res = explode(',', $res);
@@ -736,11 +736,11 @@  discard block
 block discarded – undo
736 736
 		$maxiter-- and $filles = sql_allfetsel(
737 737
 			'id_rubrique',
738 738
 			'spip_rubriques',
739
-			sql_in('id_parent', $r) . ' AND ' . sql_in('id_rubrique', $r, 'NOT')
739
+			sql_in('id_parent', $r).' AND '.sql_in('id_rubrique', $r, 'NOT')
740 740
 		)
741 741
 	) {
742 742
 		$r = join(',', array_column($filles, 'id_rubrique'));
743
-		$branche .= ',' . $r;
743
+		$branche .= ','.$r;
744 744
 	}
745 745
 
746 746
 	# securite pour ne pas plomber la conso memoire sur les sites prolifiques
@@ -780,7 +780,7 @@  discard block
 block discarded – undo
780 780
 
781 781
 	if (isset($b[$id])) {
782 782
 		// Notre branche commence par la rubrique de depart si $tout=true
783
-		return $tout ? (strlen($b[$id]) ? $b[$id] . ",$id" : $id) : $b[$id];
783
+		return $tout ? (strlen($b[$id]) ? $b[$id].",$id" : $id) : $b[$id];
784 784
 	}
785 785
 
786 786
 	$hier = '';
@@ -793,11 +793,11 @@  discard block
 block discarded – undo
793 793
 		$maxiter-- and $parents = sql_allfetsel(
794 794
 			'id_parent',
795 795
 			'spip_rubriques',
796
-			sql_in('id_rubrique', $ids_nouveaux_parents) . ' AND ' . sql_in('id_parent', $hier, 'NOT')
796
+			sql_in('id_rubrique', $ids_nouveaux_parents).' AND '.sql_in('id_parent', $hier, 'NOT')
797 797
 		)
798 798
 	) {
799 799
 		$ids_nouveaux_parents = join(',', array_column($parents, 'id_parent'));
800
-		$hier = $ids_nouveaux_parents . (strlen($hier) ? ',' . $hier : '');
800
+		$hier = $ids_nouveaux_parents.(strlen($hier) ? ','.$hier : '');
801 801
 	}
802 802
 
803 803
 	# securite pour ne pas plomber la conso memoire sur les sites prolifiques
@@ -829,7 +829,7 @@  discard block
 block discarded – undo
829 829
 	include_spip('base/abstract_sql');
830 830
 	if ($check) {
831 831
 		$postdates = ($GLOBALS['meta']['post_dates'] == 'non') ?
832
-			'AND A.date <= ' . sql_quote(date('Y-m-d H:i:s')) : '';
832
+			'AND A.date <= '.sql_quote(date('Y-m-d H:i:s')) : '';
833 833
 
834 834
 		$r = sql_select(
835 835
 			'DISTINCT A.id_rubrique AS id',
@@ -846,7 +846,7 @@  discard block
 block discarded – undo
846 846
 	$t = sql_fetsel(
847 847
 		'date',
848 848
 		'spip_articles',
849
-		"statut='publie' AND date > " . sql_quote(date('Y-m-d H:i:s')),
849
+		"statut='publie' AND date > ".sql_quote(date('Y-m-d H:i:s')),
850 850
 		'',
851 851
 		'date',
852 852
 		'1'
@@ -902,7 +902,7 @@  discard block
 block discarded – undo
902 902
 		$r = sql_getfetsel(
903 903
 			'id_rubrique',
904 904
 			'spip_rubriques',
905
-			'titre = ' . sql_quote($titre) . ' AND id_parent=' . intval($id_parent),
905
+			'titre = '.sql_quote($titre).' AND id_parent='.intval($id_parent),
906 906
 			$groupby = [],
907 907
 			$orderby = [],
908 908
 			$limit = '',
@@ -938,7 +938,7 @@  discard block
 block discarded – undo
938 938
 			sql_updateq(
939 939
 				'spip_rubriques',
940 940
 				['id_secteur' => $id_secteur, 'lang' => $lang],
941
-				'id_rubrique=' . intval($id_rubrique),
941
+				'id_rubrique='.intval($id_rubrique),
942 942
 				$desc = '',
943 943
 				$serveur
944 944
 			);
Please login to merge, or discard this patch.
ecrire/inc/bandeau.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -50,7 +50,7 @@  discard block
 block discarded – undo
50 50
 			$_id = $e['id_table_objet'];
51 51
 			if (isset($contexte[$_id]) and $id = intval($contexte[$_id])) {
52 52
 				$table = $e['table_objet_sql'];
53
-				$row = sql_fetsel('*', $table, "$_id=" . intval($id));
53
+				$row = sql_fetsel('*', $table, "$_id=".intval($id));
54 54
 				if (isset($row['id_rubrique'])) {
55 55
 					$contexte['id_rubrique'] = $row['id_rubrique'];
56 56
 					if (isset($row['id_secteur'])) {
@@ -117,8 +117,8 @@  discard block
 block discarded – undo
117 117
 				$boutons_admin[$parent]->sousmenu = array_slice($boutons_admin[$parent]->sousmenu, 0, $position)
118 118
 					+ [
119 119
 						$id => new Bouton(
120
-							($icones and !empty($infos['icone'])) ? find_in_theme($infos['icone']) : '',  // icone
121
-							$infos['titre'],  // titre
120
+							($icones and !empty($infos['icone'])) ? find_in_theme($infos['icone']) : '', // icone
121
+							$infos['titre'], // titre
122 122
 							(isset($infos['action']) and $infos['action']) ? $infos['action'] : null,
123 123
 							(isset($infos['parametres']) and $infos['parametres']) ? $infos['parametres'] : null
124 124
 						)
@@ -135,8 +135,8 @@  discard block
 block discarded – undo
135 135
 				$boutons_admin = array_slice($boutons_admin, 0, $position)
136 136
 					+ [
137 137
 						$id => new Bouton(
138
-							($icones and isset($infos['icone']) and $infos['icone']) ? find_in_theme($infos['icone']) : '',  // icone
139
-							$infos['titre'],  // titre
138
+							($icones and isset($infos['icone']) and $infos['icone']) ? find_in_theme($infos['icone']) : '', // icone
139
+							$infos['titre'], // titre
140 140
 							(isset($infos['action']) and $infos['action']) ? $infos['action'] : null,
141 141
 							(isset($infos['parametres']) and $infos['parametres']) ? $infos['parametres'] : null
142 142
 						)
@@ -181,7 +181,7 @@  discard block
 block discarded – undo
181 181
 			$libelles = $isfavoris = $favoris = [];
182 182
 			foreach ($menu->sousmenu as $key => $item) {
183 183
 				$libelles[$key] = strtolower(translitteration(_T($item->libelle)));
184
-				$isfavoris[$key] = (bool)$item->favori;
184
+				$isfavoris[$key] = (bool) $item->favori;
185 185
 				$favoris[$key] = $item->favori;
186 186
 			}
187 187
 			if ($avec_favoris) {
@@ -223,7 +223,7 @@  discard block
 block discarded – undo
223 223
 		$url = str_replace('&amp;', '&', $url);
224 224
 		while (preg_match(',[&?]([a-z_]+)=@([a-z_]+)@,i', $url, $matches)) {
225 225
 			if ($matches[2] == 'id_secteur' and !isset($contexte['id_secteur']) and isset($contexte['id_rubrique'])) {
226
-				$contexte['id_secteur'] = sql_getfetsel('id_secteur', 'spip_rubriques', 'id_rubrique=' . intval($contexte['id_rubrique']));
226
+				$contexte['id_secteur'] = sql_getfetsel('id_secteur', 'spip_rubriques', 'id_rubrique='.intval($contexte['id_rubrique']));
227 227
 			}
228 228
 			$val = _request($matches[2], $contexte);
229 229
 			$url = parametre_url($url, $matches[1], $val ?: '', '&');
Please login to merge, or discard this patch.
ecrire/inc/filtres_images_mini.php 1 patch
Spacing   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -204,8 +204,8 @@  discard block
 block discarded – undo
204 204
 	$hsl = _couleur_hex_to_hsl($couleur);
205 205
 	$hsl = [
206 206
 		'h' => round($hsl['h'] * 360),
207
-		's' => round($hsl['s'] * 100) . '%',
208
-		'l' => round($hsl['l'] * 100) . '%'
207
+		's' => round($hsl['s'] * 100).'%',
208
+		'l' => round($hsl['l'] * 100).'%'
209 209
 	];
210 210
 	if ($format === null) {
211 211
 		return "hsl({$hsl['h']}, {$hsl['s']}, {$hsl['l']})";
@@ -384,11 +384,11 @@  discard block
 block discarded – undo
384 384
 	$process = 'AUTO'
385 385
 ) {
386 386
 	// PHP 7+ type hint
387
-	$img = (string)$img;
388
-	$taille_x = (int)$taille_x;
389
-	$taille_y = (int)$taille_y;
390
-	$force = (bool)$force;
391
-	$process = (string)$process;
387
+	$img = (string) $img;
388
+	$taille_x = (int) $taille_x;
389
+	$taille_y = (int) $taille_y;
390
+	$force = (bool) $force;
391
+	$process = (string) $process;
392 392
 
393 393
 	if (!$img) {
394 394
 		return '';
@@ -465,11 +465,11 @@  discard block
 block discarded – undo
465 465
 	$process = 'AUTO'
466 466
 ) {
467 467
 	// PHP 7+ type hint
468
-	$img = (string)$img;
469
-	$taille = (int)$taille;
470
-	$taille_y = (int)$taille_y;
471
-	$force = (bool)$force;
472
-	$process = (string)$process;
468
+	$img = (string) $img;
469
+	$taille = (int) $taille;
470
+	$taille_y = (int) $taille_y;
471
+	$force = (bool) $force;
472
+	$process = (string) $process;
473 473
 
474 474
 	// Determiner la taille x,y maxi
475 475
 	// prendre le reglage de previsu par defaut
@@ -512,7 +512,7 @@  discard block
 block discarded – undo
512 512
 	$background_color = 'white'
513 513
 ) {
514 514
 	if (function_exists('image_recadre') && ($GLOBALS['meta']['image_process'] ?? '') === 'gd2') {
515
-		return image_reduire(image_recadre($im, $width . ':' . $height, '-', $position, $background_color), $width, $height);
515
+		return image_reduire(image_recadre($im, $width.':'.$height, '-', $position, $background_color), $width, $height);
516 516
 	} else { return image_passe_partout($im, $width, $height);
517 517
 	}
518 518
 }
@@ -533,9 +533,9 @@  discard block
 block discarded – undo
533 533
  **/
534 534
 function image_reduire_par($img, $val = 1, $force = false) {
535 535
 	// PHP 7+ type hint
536
-	$img = (string)$img;
537
-	$val = (int)$val;
538
-	$force = (bool)$force;
536
+	$img = (string) $img;
537
+	$val = (int) $val;
538
+	$force = (bool) $force;
539 539
 
540 540
 	[$hauteur, $largeur] = taille_image($img);
541 541
 
Please login to merge, or discard this patch.
ecrire/inc/log.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -53,11 +53,11 @@  discard block
 block discarded – undo
53 53
 
54 54
 	// si spip_log() dans mes_options, ou repertoire log/ non present, poser dans tmp/
55 55
 	if (!defined('_DIR_LOG') or !$test_repertoire[$d]) {
56
-		$logfile = _DIR_RACINE . _NOM_TEMPORAIRES_INACCESSIBLES . $logname . '.log';
56
+		$logfile = _DIR_RACINE._NOM_TEMPORAIRES_INACCESSIBLES.$logname.'.log';
57 57
 	}
58 58
 
59 59
 	$rotate = 0;
60
-	$pid = '(pid ' . @getmypid() . ')';
60
+	$pid = '(pid '.@getmypid().')';
61 61
 
62 62
 	// accepter spip_log( Array )
63 63
 	if (!is_string($message)) {
@@ -72,10 +72,10 @@  discard block
 block discarded – undo
72 72
 			$fi = substr($fi, strlen(_ROOT_RACINE));
73 73
 		}
74 74
 		$fu = $debug[2]['function'] ?? '';
75
-		$debugverb = "$fi:L$l:$fu" . '():';
75
+		$debugverb = "$fi:L$l:$fu".'():';
76 76
 	}
77 77
 
78
-	$m = date('Y-m-d H:i:s') . ' ' . ($GLOBALS['ip'] ?? '') . ' ' . $pid . ' '
78
+	$m = date('Y-m-d H:i:s').' '.($GLOBALS['ip'] ?? '').' '.$pid.' '
79 79
 		//distinguer les logs prives et publics dans les grep
80 80
 		. $debugverb
81 81
 		. (test_espace_prive() ? ':Pri:' : ':Pub:')
@@ -100,9 +100,9 @@  discard block
 block discarded – undo
100 100
 		$rotate-- > 0
101 101
 		and function_exists('spip_unlink')
102 102
 	) {
103
-		spip_unlink($logfile . '.' . $rotate);
103
+		spip_unlink($logfile.'.'.$rotate);
104 104
 		while ($rotate--) {
105
-			@rename($logfile . ($rotate ? '.' . $rotate : ''), $logfile . '.' . ($rotate + 1));
105
+			@rename($logfile.($rotate ? '.'.$rotate : ''), $logfile.'.'.($rotate + 1));
106 106
 		}
107 107
 	}
108 108
 
Please login to merge, or discard this patch.
ecrire/inc/envoyer_mail.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -134,7 +134,7 @@  discard block
 block discarded – undo
134 134
 
135 135
 	// ceci est la RegExp NO_REAL_NAME faisant hurler SpamAssassin
136 136
 	if (preg_match('/^["\s]*\<?\S+\@\S+\>?\s*$/', $from)) {
137
-		$from .= ' (' . str_replace(')', '', translitteration(str_replace('@', ' at ', $from))) . ')';
137
+		$from .= ' ('.str_replace(')', '', translitteration(str_replace('@', ' at ', $from))).')';
138 138
 	}
139 139
 
140 140
 	// nettoyer les &eacute; &#8217, &emdash; etc...
@@ -171,7 +171,7 @@  discard block
 block discarded – undo
171 171
 		if (!_TEST_EMAIL_DEST) {
172 172
 			return false;
173 173
 		} else {
174
-			$texte = "Dest : $destinataire\r\n" . $texte;
174
+			$texte = "Dest : $destinataire\r\n".$texte;
175 175
 			$destinataire = _TEST_EMAIL_DEST;
176 176
 		}
177 177
 	}
@@ -195,7 +195,7 @@  discard block
 block discarded – undo
195 195
 	// Ajouter le Content-Type et consort s'il n'y est pas deja
196 196
 	if (strpos($headers, 'Content-Type: ') === false) {
197 197
 		$type =
198
-			"Content-Type: text/plain;charset=\"$charset\";\n" .
198
+			"Content-Type: text/plain;charset=\"$charset\";\n".
199 199
 			"Content-Transfer-Encoding: 8bit\n";
200 200
 	} else {
201 201
 		$type = '';
@@ -207,17 +207,17 @@  discard block
 block discarded – undo
207 207
 		$domain = $domain[0];
208 208
 	}
209 209
 	else {
210
-		$domain = '@unknown-' . md5($from) . '.org';
210
+		$domain = '@unknown-'.md5($from).'.org';
211 211
 	}
212
-	$uniq = random_int(0, mt_getrandmax()) . '_' . md5($to . $texte) . $domain;
212
+	$uniq = random_int(0, mt_getrandmax()).'_'.md5($to.$texte).$domain;
213 213
 
214 214
 	// Si multi-part, s'en servir comme borne ...
215 215
 	if ($parts) {
216
-		$texte = "--$uniq\n$type\n" . $texte . "\n";
216
+		$texte = "--$uniq\n$type\n".$texte."\n";
217 217
 		foreach ($parts as $part) {
218
-			$n = strlen($part[1]) . ($part[0] ? "\n" : '');
218
+			$n = strlen($part[1]).($part[0] ? "\n" : '');
219 219
 			$e = join("\n", $part[0]);
220
-			$texte .= "\n--$uniq\nContent-Length: $n$e\n\n" . $part[1];
220
+			$texte .= "\n--$uniq\nContent-Length: $n$e\n\n".$part[1];
221 221
 		}
222 222
 		$texte .= "\n\n--$uniq--\n";
223 223
 		// Si boundary n'est pas entre guillemets,
@@ -227,7 +227,7 @@  discard block
 block discarded – undo
227 227
 
228 228
 	// .. et s'en servir pour plaire a SpamAssassin
229 229
 
230
-	$mid = 'Message-Id: <' . $uniq . '>';
230
+	$mid = 'Message-Id: <'.$uniq.'>';
231 231
 
232 232
 	// indispensable pour les sites qui collent d'office From: serveur-http
233 233
 	// sauf si deja mis par l'envoyeur
Please login to merge, or discard this patch.
ecrire/inc/autoriser.php 1 patch
Spacing   +38 added lines, -38 removed lines patch added patch discarded remove patch
@@ -115,7 +115,7 @@  discard block
 block discarded – undo
115 115
 // mais apres la fonction autoriser()
116 116
 if ($f = find_in_path('mes_fonctions.php')) {
117 117
 	global $dossier_squelettes;
118
-	include_once(_ROOT_CWD . $f);
118
+	include_once(_ROOT_CWD.$f);
119 119
 }
120 120
 
121 121
 
@@ -157,7 +157,7 @@  discard block
 block discarded – undo
157 157
 		$qui = $GLOBALS['visiteur_session'] ?: [];
158 158
 		$qui = array_merge(['statut' => '', 'id_auteur' => 0, 'webmestre' => 'non'], $qui);
159 159
 	} elseif (is_numeric($qui)) {
160
-		$qui = sql_fetsel('*', 'spip_auteurs', 'id_auteur=' . $qui);
160
+		$qui = sql_fetsel('*', 'spip_auteurs', 'id_auteur='.$qui);
161 161
 	}
162 162
 
163 163
 	// Admins restreints, on construit ici (pas generique mais...)
@@ -167,8 +167,8 @@  discard block
 block discarded – undo
167 167
 	}
168 168
 
169 169
 	spip_log(
170
-		"autoriser $faire $type $id (" . ($qui['nom'] ?? '') . ') ?',
171
-		'autoriser' . _LOG_DEBUG
170
+		"autoriser $faire $type $id (".($qui['nom'] ?? '').') ?',
171
+		'autoriser'._LOG_DEBUG
172 172
 	);
173 173
 
174 174
 	// passer par objet_type pour avoir les alias
@@ -184,7 +184,7 @@  discard block
 block discarded – undo
184 184
 		(isset($GLOBALS['autoriser_exception'][$faire][$type][$id]) and autoriser_exception($faire, $type, $id, 'verifier'))
185 185
 		or (isset($GLOBALS['autoriser_exception'][$faire][$type]['*']) and autoriser_exception($faire, $type, '*', 'verifier'))
186 186
 	) {
187
-		spip_log("autoriser ($faire, $type, $id, " . ($qui['nom'] ?? '') . ') : OK Exception', 'autoriser' . _LOG_DEBUG);
187
+		spip_log("autoriser ($faire, $type, $id, ".($qui['nom'] ?? '').') : OK Exception', 'autoriser'._LOG_DEBUG);
188 188
 		return true;
189 189
 	}
190 190
 
@@ -193,18 +193,18 @@  discard block
 block discarded – undo
193 193
 	// autoriser_faire[_dist], autoriser_defaut[_dist]
194 194
 	$fonctions = $type
195 195
 		? [
196
-			'autoriser_' . $type . '_' . $faire,
197
-			'autoriser_' . $type . '_' . $faire . '_dist',
198
-			'autoriser_' . $type,
199
-			'autoriser_' . $type . '_dist',
200
-			'autoriser_' . $faire,
201
-			'autoriser_' . $faire . '_dist',
196
+			'autoriser_'.$type.'_'.$faire,
197
+			'autoriser_'.$type.'_'.$faire.'_dist',
198
+			'autoriser_'.$type,
199
+			'autoriser_'.$type.'_dist',
200
+			'autoriser_'.$faire,
201
+			'autoriser_'.$faire.'_dist',
202 202
 			'autoriser_defaut',
203 203
 			'autoriser_defaut_dist'
204 204
 		]
205 205
 		: [
206
-			'autoriser_' . $faire,
207
-			'autoriser_' . $faire . '_dist',
206
+			'autoriser_'.$faire,
207
+			'autoriser_'.$faire.'_dist',
208 208
 			'autoriser_defaut',
209 209
 			'autoriser_defaut_dist'
210 210
 		];
@@ -217,8 +217,8 @@  discard block
 block discarded – undo
217 217
 	}
218 218
 
219 219
 	spip_log(
220
-		"$f($faire, $type, $id, " . ($qui['nom'] ?? '') . ') : ' . ($a ? 'OK' : 'niet'),
221
-		'autoriser' . _LOG_DEBUG
220
+		"$f($faire, $type, $id, ".($qui['nom'] ?? '').') : '.($a ? 'OK' : 'niet'),
221
+		'autoriser'._LOG_DEBUG
222 222
 	);
223 223
 
224 224
 	return $a;
@@ -353,7 +353,7 @@  discard block
 block discarded – undo
353 353
 function autoriser_previsualiser_dist(string $faire, string $type, int $id, array $qui, array $opt): bool {
354 354
 
355 355
 	// Le visiteur a-t-il un statut prevu par la config ?
356
-	if (strpos($GLOBALS['meta']['preview'], ',' . $qui['statut'] . ',') !== false) {
356
+	if (strpos($GLOBALS['meta']['preview'], ','.$qui['statut'].',') !== false) {
357 357
 		return test_previsualiser_objet_champ($type, $id, $qui, $opt);
358 358
 	}
359 359
 
@@ -410,7 +410,7 @@  discard block
 block discarded – undo
410 410
 				} // pas de champ passe a la demande => NIET
411 411
 				$previsu = explode(',', $c['previsu']);
412 412
 				// regarder si ce statut est autorise pour l'auteur
413
-				if (in_array($opt[$champ] . '/auteur', $previsu)) {
413
+				if (in_array($opt[$champ].'/auteur', $previsu)) {
414 414
 					// retrouver l’id_auteur qui a filé un lien de prévisu éventuellement,
415 415
 					// sinon l’auteur en session
416 416
 					include_spip('inc/securiser_action');
@@ -424,12 +424,12 @@  discard block
 block discarded – undo
424 424
 
425 425
 					if (!$id_auteur) {
426 426
 						return false;
427
-					} elseif (autoriser('previsualiser' . $opt[$champ], $type, 0, $id_auteur)) {
427
+					} elseif (autoriser('previsualiser'.$opt[$champ], $type, 0, $id_auteur)) {
428 428
 						// dans ce cas (admin en general), pas de filtrage sur ce statut
429 429
 					} elseif (
430 430
 						!sql_countsel(
431 431
 							'spip_auteurs_liens',
432
-							'id_auteur=' . intval($id_auteur) . ' AND objet=' . sql_quote($type) . ' AND id_objet=' . intval($id)
432
+							'id_auteur='.intval($id_auteur).' AND objet='.sql_quote($type).' AND id_objet='.intval($id)
433 433
 						)
434 434
 					) {
435 435
 						return false;
@@ -472,16 +472,16 @@  discard block
 block discarded – undo
472 472
 			// multilinguisme par secteur et objet rattaché à une rubrique
473 473
 			$primary = id_table_objet($type);
474 474
 			if ($table != 'spip_rubriques') {
475
-				$id_rubrique = sql_getfetsel('id_rubrique', "$table", "$primary=" . intval($id));
475
+				$id_rubrique = sql_getfetsel('id_rubrique', "$table", "$primary=".intval($id));
476 476
 			} else {
477 477
 				$id_rubrique = $id;
478 478
 			}
479
-			$id_secteur = sql_getfetsel('id_secteur', 'spip_rubriques', 'id_rubrique=' . intval($id_rubrique));
479
+			$id_secteur = sql_getfetsel('id_secteur', 'spip_rubriques', 'id_rubrique='.intval($id_rubrique));
480 480
 			if (!$id_secteur > 0) {
481 481
 				$id_secteur = $id_rubrique;
482 482
 			}
483
-			$langue_secteur = sql_getfetsel('lang', 'spip_rubriques', 'id_rubrique=' . intval($id_secteur));
484
-			$langue_objet = sql_getfetsel('lang', "$table", "$primary=" . intval($id));
483
+			$langue_secteur = sql_getfetsel('lang', 'spip_rubriques', 'id_rubrique='.intval($id_secteur));
484
+			$langue_objet = sql_getfetsel('lang', "$table", "$primary=".intval($id));
485 485
 			if ($langue_secteur != $langue_objet) {
486 486
 				// configuration incohérente, on laisse l'utilisateur corriger la situation
487 487
 				return true;
@@ -489,7 +489,7 @@  discard block
 block discarded – undo
489 489
 			if ($table != 'spip_rubriques') { // le choix de la langue se fait seulement sur les rubriques
490 490
 				return false;
491 491
 			} else {
492
-				$id_parent = sql_getfetsel('id_parent', 'spip_rubriques', 'id_rubrique=' . intval($id));
492
+				$id_parent = sql_getfetsel('id_parent', 'spip_rubriques', 'id_rubrique='.intval($id));
493 493
 				if ($id_parent != 0) {
494 494
 					// sous-rubriques : pas de choix de langue
495 495
 					return false;
@@ -537,7 +537,7 @@  discard block
 block discarded – undo
537 537
 
538 538
 	if (!isset($opt['statut'])) {
539 539
 		if (isset($desc['field']['statut'])) {
540
-			$statut = sql_getfetsel('statut', $desc['table'], id_table_objet($type) . '=' . intval($id));
540
+			$statut = sql_getfetsel('statut', $desc['table'], id_table_objet($type).'='.intval($id));
541 541
 		} else {
542 542
 			$statut = 'publie';
543 543
 		} // pas de statut => publie
@@ -697,11 +697,11 @@  discard block
 block discarded – undo
697 697
 		return false;
698 698
 	}
699 699
 
700
-	if (sql_countsel('spip_rubriques', 'id_parent=' . intval($id))) {
700
+	if (sql_countsel('spip_rubriques', 'id_parent='.intval($id))) {
701 701
 		return false;
702 702
 	}
703 703
 
704
-	if (sql_countsel('spip_articles', 'id_rubrique=' . intval($id) . " AND (statut<>'poubelle')")) {
704
+	if (sql_countsel('spip_articles', 'id_rubrique='.intval($id)." AND (statut<>'poubelle')")) {
705 705
 		return false;
706 706
 	}
707 707
 
@@ -736,7 +736,7 @@  discard block
 block discarded – undo
736 736
 	if (!$id) {
737 737
 		return false;
738 738
 	}
739
-	$r = sql_fetsel('id_rubrique,statut', 'spip_articles', 'id_article=' . sql_quote($id));
739
+	$r = sql_fetsel('id_rubrique,statut', 'spip_articles', 'id_article='.sql_quote($id));
740 740
 
741 741
 	return
742 742
 		$r
@@ -747,7 +747,7 @@  discard block
 block discarded – undo
747 747
 				(!isset($opt['statut']) or $opt['statut'] !== 'publie')
748 748
 				and in_array($qui['statut'], ['0minirezo', '1comite'])
749 749
 				and in_array($r['statut'], ['prop', 'prepa', 'poubelle'])
750
-				and auteurs_objet('article', $id, 'id_auteur=' . $qui['id_auteur'])
750
+				and auteurs_objet('article', $id, 'id_auteur='.$qui['id_auteur'])
751 751
 			)
752 752
 		);
753 753
 }
@@ -801,7 +801,7 @@  discard block
 block discarded – undo
801 801
 		if (!$id) {
802 802
 			return false;
803 803
 		}
804
-		$statut = sql_getfetsel('statut', 'spip_articles', 'id_article=' . intval($id));
804
+		$statut = sql_getfetsel('statut', 'spip_articles', 'id_article='.intval($id));
805 805
 	}
806 806
 
807 807
 	return
@@ -812,7 +812,7 @@  discard block
 block discarded – undo
812 812
 		or
813 813
 		($id
814 814
 			and $qui['id_auteur']
815
-			and auteurs_objet('article', $id, 'id_auteur=' . $qui['id_auteur']));
815
+			and auteurs_objet('article', $id, 'id_auteur='.$qui['id_auteur']));
816 816
 }
817 817
 
818 818
 
@@ -831,8 +831,8 @@  discard block
 block discarded – undo
831 831
 function autoriser_voir_dist(string $faire, string $type, int $id, array $qui, array $opt): bool {
832 832
 	# securite, mais on aurait pas du arriver ici !
833 833
 	if (
834
-		function_exists($f = 'autoriser_' . $type . '_voir')
835
-		or function_exists($f = 'autoriser_' . $type . '_voir_dist')
834
+		function_exists($f = 'autoriser_'.$type.'_voir')
835
+		or function_exists($f = 'autoriser_'.$type.'_voir_dist')
836 836
 	) {
837 837
 		return $f($faire, $type, $id, $qui, $opt);
838 838
 	}
@@ -953,7 +953,7 @@  discard block
 block discarded – undo
953 953
 	$n = sql_fetsel(
954 954
 		'A.id_article',
955 955
 		'spip_auteurs_liens AS L LEFT JOIN spip_articles AS A ON (L.objet=\'article\' AND L.id_objet=A.id_article)',
956
-		"A.statut='publie' AND L.id_auteur=" . sql_quote($id)
956
+		"A.statut='publie' AND L.id_auteur=".sql_quote($id)
957 957
 	);
958 958
 
959 959
 	return $n ? true : false;
@@ -1155,7 +1155,7 @@  discard block
 block discarded – undo
1155 1155
 		and $r = sql_allfetsel(
1156 1156
 			'id_objet',
1157 1157
 			'spip_auteurs_liens',
1158
-			'id_auteur=' . intval($id_auteur) . " AND objet='rubrique' AND id_objet!=0"
1158
+			'id_auteur='.intval($id_auteur)." AND objet='rubrique' AND id_objet!=0"
1159 1159
 		)
1160 1160
 		and is_countable($r) ? count($r) : 0
1161 1161
 	) {
@@ -1771,8 +1771,8 @@  discard block
 block discarded – undo
1771 1771
 function auteurs_objet($objet, $id_objet, $cond = '') {
1772 1772
 	$objet = objet_type($objet);
1773 1773
 	$where = [
1774
-		'objet=' . sql_quote($objet),
1775
-		'id_objet=' . intval($id_objet)
1774
+		'objet='.sql_quote($objet),
1775
+		'id_objet='.intval($id_objet)
1776 1776
 	];
1777 1777
 	if (!empty($cond)) {
1778 1778
 		if (is_array($cond)) {
@@ -1807,7 +1807,7 @@  discard block
 block discarded – undo
1807 1807
 	return sql_allfetsel(
1808 1808
 		'id_auteur',
1809 1809
 		'spip_auteurs_liens',
1810
-		"objet='article' AND id_objet=" . intval($id_article) . ($cond ? " AND $cond" : '')
1810
+		"objet='article' AND id_objet=".intval($id_article).($cond ? " AND $cond" : '')
1811 1811
 	);
1812 1812
 }
1813 1813
 
Please login to merge, or discard this patch.
ecrire/inc/session.php 1 patch
Spacing   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -82,13 +82,13 @@  discard block
 block discarded – undo
82 82
 	spip_log("supprimer sessions auteur $id_auteur", 'session');
83 83
 	if ($toutes or $id_auteur !== $GLOBALS['visiteur_session']['id_auteur']) {
84 84
 		if ($dir = opendir(_DIR_SESSIONS)) {
85
-			$t = $_SERVER['REQUEST_TIME']  - (4 * _RENOUVELLE_ALEA); // 48h par defaut
86
-			$t_short = $_SERVER['REQUEST_TIME']  - max(_RENOUVELLE_ALEA / 4, 3 * 3600); // 3h par defaut
85
+			$t = $_SERVER['REQUEST_TIME'] - (4 * _RENOUVELLE_ALEA); // 48h par defaut
86
+			$t_short = $_SERVER['REQUEST_TIME'] - max(_RENOUVELLE_ALEA / 4, 3 * 3600); // 3h par defaut
87 87
 			$t = time() - (4 * _RENOUVELLE_ALEA);
88 88
 			while (($f = readdir($dir)) !== false) {
89 89
 				$nb_files++;
90 90
 				if (preg_match(',^[^\d-]*(-?\d+)_\w{32}\.php[3]?$,', $f, $regs)) {
91
-					$f = _DIR_SESSIONS . $f;
91
+					$f = _DIR_SESSIONS.$f;
92 92
 					if (($actives and $regs[1] == $id_auteur) or ($t > filemtime($f))) {
93 93
 						spip_unlink($f);
94 94
 					}
@@ -171,9 +171,9 @@  discard block
 block discarded – undo
171 171
 
172 172
 	if (
173 173
 		!isset($_COOKIE['spip_session'])
174
-		or !preg_match(',^' . $id_auteur . '_,', $_COOKIE['spip_session'])
174
+		or !preg_match(',^'.$id_auteur.'_,', $_COOKIE['spip_session'])
175 175
 	) {
176
-		$_COOKIE['spip_session'] = $id_auteur . '_' . md5(uniqid(random_int(0, mt_getrandmax()), true));
176
+		$_COOKIE['spip_session'] = $id_auteur.'_'.md5(uniqid(random_int(0, mt_getrandmax()), true));
177 177
 	}
178 178
 
179 179
 	// Maintenant on sait qu'on a des choses à écrire
@@ -206,7 +206,7 @@  discard block
 block discarded – undo
206 206
 	} else {
207 207
 		$fichier_session = fichier_session('alea_ephemere');
208 208
 		if (!ecrire_fichier_session($fichier_session, $auteur)) {
209
-			spip_log('Echec ecriture fichier session ' . $fichier_session, 'session' . _LOG_HS);
209
+			spip_log('Echec ecriture fichier session '.$fichier_session, 'session'._LOG_HS);
210 210
 			include_spip('inc/minipres');
211 211
 			echo minipres();
212 212
 			exit;
@@ -229,7 +229,7 @@  discard block
 block discarded – undo
229 229
 		include_spip('inc/autoriser');
230 230
 	}
231 231
 	if (autoriser('ecrire', '', '', $auteur) and _DUREE_COOKIE_ADMIN) {
232
-		spip_setcookie('spip_admin', '@' . ($auteur['email'] ?: $auteur['login']), [
232
+		spip_setcookie('spip_admin', '@'.($auteur['email'] ?: $auteur['login']), [
233 233
 			'expires' => time() + max(_DUREE_COOKIE_ADMIN, $duree)
234 234
 		]);
235 235
 	} // sinon le supprimer ...
@@ -270,7 +270,7 @@  discard block
 block discarded – undo
270 270
 			$coef = 20;
271 271
 		}
272 272
 	}
273
-	return (int)(_RENOUVELLE_ALEA * $coef);
273
+	return (int) (_RENOUVELLE_ALEA * $coef);
274 274
 }
275 275
 
276 276
 /**
@@ -318,7 +318,7 @@  discard block
 block discarded – undo
318 318
 
319 319
 			// Renouveler la session avec l'alea courant
320 320
 			include($fichier_session);
321
-			spip_log('renouvelle session ' . $GLOBALS['visiteur_session']['id_auteur'], 'session');
321
+			spip_log('renouvelle session '.$GLOBALS['visiteur_session']['id_auteur'], 'session');
322 322
 			spip_unlink($fichier_session);
323 323
 			ajouter_session($GLOBALS['visiteur_session']);
324 324
 		}
@@ -350,7 +350,7 @@  discard block
 block discarded – undo
350 350
 		}
351 351
 	} else {
352 352
 		if ($change) {
353
-			spip_log("rejoue session $fichier_session " . $_COOKIE['spip_session'], 'session');
353
+			spip_log("rejoue session $fichier_session ".$_COOKIE['spip_session'], 'session');
354 354
 			if ($fichier_session) {
355 355
 				spip_unlink($fichier_session);
356 356
 			}
@@ -567,7 +567,7 @@  discard block
 block discarded – undo
567 567
 	}
568 568
 
569 569
 	// liste des sessions
570
-	$sessions = preg_files(_DIR_SESSIONS, '/' . $id_auteur . '_.*\.php$');
570
+	$sessions = preg_files(_DIR_SESSIONS, '/'.$id_auteur.'_.*\.php$');
571 571
 
572 572
 	// si on en a plus que la limite, supprimer les plus vieilles
573 573
 	// si ce ne sont pas des sessions anonymes car elles sont alors chacune differentes
@@ -648,12 +648,12 @@  discard block
 block discarded – undo
648 648
 	$auteur = preparer_ecriture_session($auteur);
649 649
 
650 650
 	// enregistrer les autres donnees du visiteur
651
-	$texte = '<' . "?php\n";
651
+	$texte = '<'."?php\n";
652 652
 	foreach ($auteur as $var => $val) {
653
-		$texte .= '$GLOBALS[\'visiteur_session\'][' . var_export($var, true) . '] = '
654
-			. var_export($val, true) . ";\n";
653
+		$texte .= '$GLOBALS[\'visiteur_session\']['.var_export($var, true).'] = '
654
+			. var_export($val, true).";\n";
655 655
 	}
656
-	$texte .= '?' . ">\n";
656
+	$texte .= '?'.">\n";
657 657
 
658 658
 	return ecrire_fichier($fichier, $texte);
659 659
 }
@@ -683,7 +683,7 @@  discard block
 block discarded – undo
683 683
 		$repertoire = sous_repertoire(_DIR_SESSIONS, '', false, $tantpis);
684 684
 		$c = $_COOKIE['spip_session'];
685 685
 
686
-		return $repertoire . intval($c) . '_' . md5($c . ' ' . $GLOBALS['meta'][$alea]) . '.php';
686
+		return $repertoire.intval($c).'_'.md5($c.' '.$GLOBALS['meta'][$alea]).'.php';
687 687
 	}
688 688
 }
689 689
 
@@ -701,7 +701,7 @@  discard block
 block discarded – undo
701 701
  * @return string
702 702
  */
703 703
 function rejouer_session() {
704
-	return '<img src="' . generer_url_action('cookie', 'change_session=oui', true) . '" width="0" height="0" alt="" />';
704
+	return '<img src="'.generer_url_action('cookie', 'change_session=oui', true).'" width="0" height="0" alt="" />';
705 705
 }
706 706
 
707 707
 
@@ -716,7 +716,7 @@  discard block
 block discarded – undo
716 716
 		return $res;
717 717
 	}
718 718
 
719
-	return $res = md5($GLOBALS['ip'] . ($_SERVER['HTTP_USER_AGENT'] ?? ''));
719
+	return $res = md5($GLOBALS['ip'].($_SERVER['HTTP_USER_AGENT'] ?? ''));
720 720
 }
721 721
 
722 722
 
Please login to merge, or discard this patch.
ecrire/base/delete_all.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -51,5 +51,5 @@
 block discarded – undo
51 51
 	}
52 52
 	$d = is_countable($delete) ? count($delete) : 0;
53 53
 	$r = count($res);
54
-	spip_log("Tables detruites: $r sur $d: " . join(', ', $res), _LOG_INFO_IMPORTANTE);
54
+	spip_log("Tables detruites: $r sur $d: ".join(', ', $res), _LOG_INFO_IMPORTANTE);
55 55
 }
Please login to merge, or discard this patch.