Completed
Push — master ( 6e9d01...e4a2f2 )
by cam
04:25
created
ecrire/inc/exporter_csv.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -38,7 +38,7 @@  discard block
 block discarded – undo
38 38
 	$champ = preg_replace(',[\s]+,ms', ' ', $champ);
39 39
 	$champ = str_replace('"', '""', $champ);
40 40
 
41
-	return '"' . $champ . '"';
41
+	return '"'.$champ.'"';
42 42
 }
43 43
 
44 44
 /**
@@ -54,11 +54,11 @@  discard block
 block discarded – undo
54 54
  * @param callable $callback
55 55
  * @return string
56 56
  */
57
-function exporter_csv_ligne_numerotee($nb, $ligne, $delim = ',', $importer_charset = null, $callback=null) {
57
+function exporter_csv_ligne_numerotee($nb, $ligne, $delim = ',', $importer_charset = null, $callback = null) {
58 58
 	if ($callback) {
59 59
 		$ligne = call_user_func($callback, $nb, $ligne, $delim, $importer_charset);
60 60
 	}
61
-	$output = join($delim, array_map('exporter_csv_champ', $ligne)) . "\r\n";
61
+	$output = join($delim, array_map('exporter_csv_champ', $ligne))."\r\n";
62 62
 	if ($importer_charset) {
63 63
 		$output = str_replace('’', '\'', $output);
64 64
 		$output = unicode2charset(html2unicode(charset2unicode($output)), $importer_charset);
@@ -74,7 +74,7 @@  discard block
 block discarded – undo
74 74
  * @param null $importer_charset
75 75
  * @return string
76 76
  */
77
-function exporter_csv_ligne($ligne, $delim = ',', $importer_charset = null){
77
+function exporter_csv_ligne($ligne, $delim = ',', $importer_charset = null) {
78 78
 	return exporter_csv_ligne_numerotee(null, $ligne, $delim, $importer_charset);
79 79
 }
80 80
 
@@ -175,7 +175,7 @@  discard block
 block discarded – undo
175 175
 		$fichier = "php://output";
176 176
 	}
177 177
 	else {
178
-	$fichier = sous_repertoire(_DIR_CACHE, 'export') . $filename;
178
+	$fichier = sous_repertoire(_DIR_CACHE, 'export').$filename;
179 179
 	}
180 180
 
181 181
 	$fp = fopen($fichier, 'w');
Please login to merge, or discard this patch.
ecrire/balise/url_.php 1 patch
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -76,7 +76,7 @@  discard block
 block discarded – undo
76 76
 	if ($s = trouver_nom_serveur_distant($p)) {
77 77
 
78 78
 		// si une fonction de generation des url a ete definie pour ce connect l'utiliser
79
-		if (function_exists($f = 'generer_generer_url_' . $s)) {
79
+		if (function_exists($f = 'generer_generer_url_'.$s)) {
80 80
 			return $f($type, $_id, $s);
81 81
 		}
82 82
 		if (!$GLOBALS['connexions'][strtolower($s)]['spip_connect_version']) {
@@ -86,8 +86,8 @@  discard block
 block discarded – undo
86 86
 		# exception des urls de documents sur un serveur distant...
87 87
 		if ($type == 'document') {
88 88
 			return
89
-				"quete_meta('adresse_site', $s) . '/' .\n\t" .
90
-				"quete_meta('dir_img', $s) . \n\t" .
89
+				"quete_meta('adresse_site', $s) . '/' .\n\t".
90
+				"quete_meta('dir_img', $s) . \n\t".
91 91
 				"quete_fichier($_id,$s)";
92 92
 		}
93 93
 		$s = ", '', '', $s, quete_meta('type_urls', $s)";
@@ -231,7 +231,7 @@  discard block
 block discarded – undo
231 231
  */
232 232
 function balise_URL_SITE_SPIP_dist($p) {
233 233
 	$p->code = "sinon(\$GLOBALS['meta']['adresse_site'],'.')";
234
-	$p->code = "spip_htmlspecialchars(" . $p->code . ")";
234
+	$p->code = "spip_htmlspecialchars(".$p->code.")";
235 235
 	$p->interdire_scripts = false;
236 236
 
237 237
 	return $p;
@@ -272,7 +272,7 @@  discard block
 block discarded – undo
272 272
 	if ($s = trouver_nom_serveur_distant($p)) {
273 273
 		// si une fonction de generation des url a ete definie pour ce connect l'utiliser
274 274
 		// elle devra aussi traiter le cas derogatoire type=page
275
-		if (function_exists($f = 'generer_generer_url_' . $s)) {
275
+		if (function_exists($f = 'generer_generer_url_'.$s)) {
276 276
 			if ($args and $args !== "''") {
277 277
 				$code .= ", $args";
278 278
 			}
@@ -280,7 +280,7 @@  discard block
 block discarded – undo
280 280
 			$p->code = $code;
281 281
 			return $p;
282 282
 		}
283
-		$s = 'connect=' . addslashes($s);
283
+		$s = 'connect='.addslashes($s);
284 284
 		$args = (($args and $args !== "''") ? "$args . '&$s'" : "'$s'");
285 285
 	}
286 286
 
@@ -295,7 +295,7 @@  discard block
 block discarded – undo
295 295
 		$code = "generer_url_public($code, $args$noentities)";
296 296
 	}
297 297
 	$p->code = $code;
298
-	spip_log("Calcul url page : connect vaut $s ca donne :" . $p->code . " args $args", _LOG_INFO);
298
+	spip_log("Calcul url page : connect vaut $s ca donne :".$p->code." args $args", _LOG_INFO);
299 299
 
300 300
 	#$p->interdire_scripts = true;
301 301
 	return $p;
@@ -339,7 +339,7 @@  discard block
 block discarded – undo
339 339
 			$fonc .= ",$args$noentities";
340 340
 		}
341 341
 	}
342
-	$p->code = 'generer_url_ecrire(' . $fonc . ')';
342
+	$p->code = 'generer_url_ecrire('.$fonc.')';
343 343
 	$p->interdire_scripts = false;
344 344
 
345 345
 	return $p;
@@ -374,17 +374,17 @@  discard block
 block discarded – undo
374 374
 
375 375
 	$args = interprete_argument_balise(2, $p);
376 376
 	if ($args != "''" && $args !== null) {
377
-		$p->code .= "," . $args;
377
+		$p->code .= ",".$args;
378 378
 	}
379 379
 	$redirect = interprete_argument_balise(3, $p);
380 380
 	if ($redirect != "''" && $redirect !== null) {
381 381
 		if ($args == "''" || $args === null) {
382 382
 			$p->code .= ",''";
383 383
 		}
384
-		$p->code .= "," . $redirect;
384
+		$p->code .= ",".$redirect;
385 385
 	}
386 386
 
387
-	$p->code = "generer_action_auteur(" . $p->code . ")";
387
+	$p->code = "generer_action_auteur(".$p->code.")";
388 388
 	$p->interdire_scripts = false;
389 389
 
390 390
 	return $p;
Please login to merge, or discard this patch.
prive/formulaires/login.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -134,7 +134,7 @@  discard block
 block discarded – undo
134 134
 
135 135
 	// Si on est connecte, appeler traiter()
136 136
 	// et lancer la redirection si besoin
137
-	if (!$valeurs['editable'] and $loge and _request('formulaire_action')!=='login') {
137
+	if (!$valeurs['editable'] and $loge and _request('formulaire_action') !== 'login') {
138 138
 		$traiter = charger_fonction('traiter', 'formulaires/login');
139 139
 		$res = $traiter($cible, $login, $prive);
140 140
 		$valeurs = array_merge($valeurs, $res);
@@ -144,7 +144,7 @@  discard block
 block discarded – undo
144 144
 			# preparer un lien pour quand redirige_formulaire ne fonctionne pas
145 145
 			$m = redirige_formulaire($res['redirect']);
146 146
 			$valeurs['_deja_loge'] = inserer_attribut(
147
-				'<a>' . _T('login_par_ici') . "</a>$m",
147
+				'<a>'._T('login_par_ici')."</a>$m",
148 148
 				'href',
149 149
 				$res['redirect']
150 150
 			);
@@ -290,7 +290,7 @@  discard block
 block discarded – undo
290 290
 function login_autoriser() {
291 291
 	include_spip('inc/autoriser');
292 292
 	if (!autoriser('ecrire')) {
293
-		$h = generer_url_action('logout', 'logout=prive&url=' . urlencode(self()));
293
+		$h = generer_url_action('logout', 'logout=prive&url='.urlencode(self()));
294 294
 
295 295
 		return array(
296 296
 			'message_erreur' => '<h1>'
@@ -298,7 +298,7 @@  discard block
 block discarded – undo
298 298
 				. '</h1><p>'
299 299
 				. _T('texte_erreur_visiteur')
300 300
 				. "</p><p class='retour'>[<a href='$h'>"
301
-				. _T('icone_deconnecter') . '</a>]</p>'
301
+				. _T('icone_deconnecter').'</a>]</p>'
302 302
 		);
303 303
 	}
304 304
 
@@ -350,7 +350,7 @@  discard block
 block discarded – undo
350 350
 		// transformer la cible absolue en cible relative
351 351
 		// pour pas echouer quand la meta adresse_site est foireuse
352 352
 		if (strncmp($cible, $u = url_de_base(), strlen($u)) == 0) {
353
-			$cible = './' . substr($cible, strlen($u));
353
+			$cible = './'.substr($cible, strlen($u));
354 354
 		} elseif (tester_url_absolue($cible) and !defined('_AUTORISER_LOGIN_ABS_REDIRECT')) {
355 355
 			// si c'est une url absolue, refuser la redirection
356 356
 			// sauf si cette securite est levee volontairement par le webmestre
@@ -362,7 +362,7 @@  discard block
 block discarded – undo
362 362
 	if ($cible and ($cible != self('&')) and ($cible != self())) {
363 363
 		$res['redirect'] = $cible;
364 364
 		$res['message_ok'] = inserer_attribut(
365
-			'<a>' . _T('login_par_ici') . '</a>',
365
+			'<a>'._T('login_par_ici').'</a>',
366 366
 			'href',
367 367
 			$cible
368 368
 		);
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
@@ -114,7 +114,7 @@  discard block
 block discarded – undo
114 114
 // mais apres la fonction autoriser()
115 115
 if ($f = find_in_path('mes_fonctions.php')) {
116 116
 	global $dossier_squelettes;
117
-	include_once(_ROOT_CWD . $f);
117
+	include_once(_ROOT_CWD.$f);
118 118
 }
119 119
 
120 120
 
@@ -148,7 +148,7 @@  discard block
 block discarded – undo
148 148
 		$qui = $GLOBALS['visiteur_session'] ? $GLOBALS['visiteur_session'] : array();
149 149
 		$qui = array_merge(array('statut' => '', 'id_auteur' => 0, 'webmestre' => 'non'), $qui);
150 150
 	} elseif (is_numeric($qui)) {
151
-		$qui = sql_fetsel('*', 'spip_auteurs', 'id_auteur=' . $qui);
151
+		$qui = sql_fetsel('*', 'spip_auteurs', 'id_auteur='.$qui);
152 152
 	}
153 153
 
154 154
 	// Admins restreints, on construit ici (pas generique mais...)
@@ -158,8 +158,8 @@  discard block
 block discarded – undo
158 158
 	}
159 159
 
160 160
 	spip_log(
161
-		"autoriser $faire $type $id (" . (isset($qui['nom']) ? $qui['nom'] : '') . ') ?',
162
-		'autoriser' . _LOG_DEBUG
161
+		"autoriser $faire $type $id (".(isset($qui['nom']) ? $qui['nom'] : '').') ?',
162
+		'autoriser'._LOG_DEBUG
163 163
 	);
164 164
 
165 165
 	// passer par objet_type pour avoir les alias
@@ -170,7 +170,7 @@  discard block
 block discarded – undo
170 170
 	if ((isset($GLOBALS['autoriser_exception'][$faire][$type][$id]) and autoriser_exception($faire, $type, $id, 'verifier'))
171 171
 	  or (isset($GLOBALS['autoriser_exception'][$faire][$type]['*']) and autoriser_exception($faire, $type, '*', 'verifier'))
172 172
 	) {
173
-		spip_log("autoriser ($faire, $type, $id, " . (isset($qui['nom']) ? $qui['nom'] : '') . ') : OK Exception', 'autoriser' . _LOG_DEBUG);
173
+		spip_log("autoriser ($faire, $type, $id, ".(isset($qui['nom']) ? $qui['nom'] : '').') : OK Exception', 'autoriser'._LOG_DEBUG);
174 174
 		return true;
175 175
 	}
176 176
 
@@ -179,18 +179,18 @@  discard block
 block discarded – undo
179 179
 	// autoriser_faire[_dist], autoriser_defaut[_dist]
180 180
 	$fonctions = $type
181 181
 		? array(
182
-			'autoriser_' . $type . '_' . $faire,
183
-			'autoriser_' . $type . '_' . $faire . '_dist',
184
-			'autoriser_' . $type,
185
-			'autoriser_' . $type . '_dist',
186
-			'autoriser_' . $faire,
187
-			'autoriser_' . $faire . '_dist',
182
+			'autoriser_'.$type.'_'.$faire,
183
+			'autoriser_'.$type.'_'.$faire.'_dist',
184
+			'autoriser_'.$type,
185
+			'autoriser_'.$type.'_dist',
186
+			'autoriser_'.$faire,
187
+			'autoriser_'.$faire.'_dist',
188 188
 			'autoriser_defaut',
189 189
 			'autoriser_defaut_dist'
190 190
 		)
191 191
 		: array(
192
-			'autoriser_' . $faire,
193
-			'autoriser_' . $faire . '_dist',
192
+			'autoriser_'.$faire,
193
+			'autoriser_'.$faire.'_dist',
194 194
 			'autoriser_defaut',
195 195
 			'autoriser_defaut_dist'
196 196
 		);
@@ -203,8 +203,8 @@  discard block
 block discarded – undo
203 203
 	}
204 204
 
205 205
 	spip_log(
206
-		"$f($faire, $type, $id, " . (isset($qui['nom']) ? $qui['nom'] : '') . ') : ' . ($a ? 'OK' : 'niet'),
207
-		'autoriser' . _LOG_DEBUG
206
+		"$f($faire, $type, $id, ".(isset($qui['nom']) ? $qui['nom'] : '').') : '.($a ? 'OK' : 'niet'),
207
+		'autoriser'._LOG_DEBUG
208 208
 	);
209 209
 
210 210
 	return $a;
@@ -332,7 +332,7 @@  discard block
 block discarded – undo
332 332
 function autoriser_previsualiser_dist($faire, $type, $id, $qui, $opt) {
333 333
 
334 334
 	// Le visiteur a-t-il un statut prevu par la config ?
335
-	if (strpos($GLOBALS['meta']['preview'], ',' . $qui['statut'] . ',') !== false) {
335
+	if (strpos($GLOBALS['meta']['preview'], ','.$qui['statut'].',') !== false) {
336 336
 		return test_previsualiser_objet_champ($type, $id, $qui, $opt);
337 337
 	}
338 338
 
@@ -389,7 +389,7 @@  discard block
 block discarded – undo
389 389
 				} // pas de champ passe a la demande => NIET
390 390
 				$previsu = explode(',', $c['previsu']);
391 391
 				// regarder si ce statut est autorise pour l'auteur
392
-				if (in_array($opt[$champ] . '/auteur', $previsu)) {
392
+				if (in_array($opt[$champ].'/auteur', $previsu)) {
393 393
 
394 394
 					// retrouver l’id_auteur qui a filé un lien de prévisu éventuellement,
395 395
 					// sinon l’auteur en session
@@ -404,11 +404,11 @@  discard block
 block discarded – undo
404 404
 
405 405
 					if (!$id_auteur) {
406 406
 						return false;
407
-					} elseif(autoriser('previsualiser' . $opt[$champ], $type, '', $id_auteur)) {
407
+					} elseif (autoriser('previsualiser'.$opt[$champ], $type, '', $id_auteur)) {
408 408
 						// dans ce cas (admin en general), pas de filtrage sur ce statut
409 409
 					} elseif (!sql_countsel(
410 410
 						'spip_auteurs_liens',
411
-						'id_auteur=' . intval($id_auteur) . ' AND objet=' . sql_quote($type) . ' AND id_objet=' . intval($id)
411
+						'id_auteur='.intval($id_auteur).' AND objet='.sql_quote($type).' AND id_objet='.intval($id)
412 412
 					)) {
413 413
 						return false;
414 414
 					} // pas auteur de cet objet => NIET
@@ -446,16 +446,16 @@  discard block
 block discarded – undo
446 446
 			// multilinguisme par secteur et objet rattaché à une rubrique
447 447
 			$primary = id_table_objet($type);
448 448
 			if ($table != 'spip_rubriques') {
449
-				$id_rubrique = sql_getfetsel('id_rubrique', "$table", "$primary=" . intval($id));
449
+				$id_rubrique = sql_getfetsel('id_rubrique', "$table", "$primary=".intval($id));
450 450
 			} else {
451 451
 				$id_rubrique = $id;
452 452
 			}
453
-			$id_secteur = sql_getfetsel('id_secteur', 'spip_rubriques', 'id_rubrique=' . intval($id_rubrique));
453
+			$id_secteur = sql_getfetsel('id_secteur', 'spip_rubriques', 'id_rubrique='.intval($id_rubrique));
454 454
 			if (!$id_secteur > 0) {
455 455
 				$id_secteur = $id_rubrique;
456 456
 			}
457
-			$langue_secteur = sql_getfetsel('lang', 'spip_rubriques', 'id_rubrique=' . intval($id_secteur));
458
-			$langue_objet = sql_getfetsel('lang', "$table", "$primary=" . intval($id));
457
+			$langue_secteur = sql_getfetsel('lang', 'spip_rubriques', 'id_rubrique='.intval($id_secteur));
458
+			$langue_objet = sql_getfetsel('lang', "$table", "$primary=".intval($id));
459 459
 			if ($langue_secteur != $langue_objet) {
460 460
 				// configuration incohérente, on laisse l'utilisateur corriger la situation
461 461
 				return true;
@@ -463,7 +463,7 @@  discard block
 block discarded – undo
463 463
 			if ($table != 'spip_rubriques') { // le choix de la langue se fait seulement sur les rubriques
464 464
 				return false;
465 465
 			} else {
466
-				$id_parent = sql_getfetsel('id_parent', 'spip_rubriques', 'id_rubrique=' . intval($id));
466
+				$id_parent = sql_getfetsel('id_parent', 'spip_rubriques', 'id_rubrique='.intval($id));
467 467
 				if ($id_parent != 0) {
468 468
 					// sous-rubriques : pas de choix de langue
469 469
 					return false;
@@ -511,7 +511,7 @@  discard block
 block discarded – undo
511 511
 	
512 512
 	if (!isset($opt['statut'])) {
513 513
 		if (isset($desc['field']['statut'])) {
514
-			$statut = sql_getfetsel('statut', $desc['table'], id_table_objet($type) . '=' . intval($id));
514
+			$statut = sql_getfetsel('statut', $desc['table'], id_table_objet($type).'='.intval($id));
515 515
 		} else {
516 516
 			$statut = 'publie';
517 517
 		} // pas de statut => publie
@@ -669,11 +669,11 @@  discard block
 block discarded – undo
669 669
 		return false;
670 670
 	}
671 671
 
672
-	if (sql_countsel('spip_rubriques', 'id_parent=' . intval($id))) {
672
+	if (sql_countsel('spip_rubriques', 'id_parent='.intval($id))) {
673 673
 		return false;
674 674
 	}
675 675
 
676
-	if (sql_countsel('spip_articles', 'id_rubrique=' . intval($id) . " AND (statut<>'poubelle')")) {
676
+	if (sql_countsel('spip_articles', 'id_rubrique='.intval($id)." AND (statut<>'poubelle')")) {
677 677
 		return false;
678 678
 	}
679 679
 
@@ -705,7 +705,7 @@  discard block
 block discarded – undo
705 705
  * @return bool          true s'il a le droit, false sinon
706 706
  **/
707 707
 function autoriser_article_modifier_dist($faire, $type, $id, $qui, $opt) {
708
-	$r = sql_fetsel('id_rubrique,statut', 'spip_articles', 'id_article=' . sql_quote($id));
708
+	$r = sql_fetsel('id_rubrique,statut', 'spip_articles', 'id_article='.sql_quote($id));
709 709
 
710 710
 	return
711 711
 		$r
@@ -716,7 +716,7 @@  discard block
 block discarded – undo
716 716
 				(!isset($opt['statut']) or $opt['statut'] !== 'publie')
717 717
 				and in_array($qui['statut'], array('0minirezo', '1comite'))
718 718
 				and in_array($r['statut'], array('prop', 'prepa', 'poubelle'))
719
-				and auteurs_objet('article', $id, 'id_auteur=' . $qui['id_auteur'])
719
+				and auteurs_objet('article', $id, 'id_auteur='.$qui['id_auteur'])
720 720
 			)
721 721
 		);
722 722
 }
@@ -764,7 +764,7 @@  discard block
 block discarded – undo
764 764
 		if (!$id) {
765 765
 			return false;
766 766
 		}
767
-		$statut = sql_getfetsel('statut', 'spip_articles', 'id_article=' . intval($id));
767
+		$statut = sql_getfetsel('statut', 'spip_articles', 'id_article='.intval($id));
768 768
 	}
769 769
 
770 770
 	return
@@ -775,7 +775,7 @@  discard block
 block discarded – undo
775 775
 		or
776 776
 		($id
777 777
 			and $qui['id_auteur']
778
-			and auteurs_objet('article', $id, 'id_auteur=' . $qui['id_auteur']));
778
+			and auteurs_objet('article', $id, 'id_auteur='.$qui['id_auteur']));
779 779
 }
780 780
 
781 781
 
@@ -793,8 +793,8 @@  discard block
 block discarded – undo
793 793
  **/
794 794
 function autoriser_voir_dist($faire, $type, $id, $qui, $opt) {
795 795
 	# securite, mais on aurait pas du arriver ici !
796
-	if (function_exists($f = 'autoriser_' . $type . '_voir')
797
-		or function_exists($f = 'autoriser_' . $type . '_voir_dist')) {
796
+	if (function_exists($f = 'autoriser_'.$type.'_voir')
797
+		or function_exists($f = 'autoriser_'.$type.'_voir_dist')) {
798 798
 		return $f($faire, $type, $id, $qui, $opt);
799 799
 	}
800 800
 
@@ -912,7 +912,7 @@  discard block
 block discarded – undo
912 912
 	$n = sql_fetsel(
913 913
 		'A.id_article',
914 914
 		'spip_auteurs_liens AS L LEFT JOIN spip_articles AS A ON (L.objet=\'article\' AND L.id_objet=A.id_article)',
915
-		"A.statut='publie' AND L.id_auteur=" . sql_quote($id)
915
+		"A.statut='publie' AND L.id_auteur=".sql_quote($id)
916 916
 	);
917 917
 
918 918
 	return $n ? true : false;
@@ -1118,7 +1118,7 @@  discard block
 block discarded – undo
1118 1118
 		and $r = sql_allfetsel(
1119 1119
 			'id_objet',
1120 1120
 			'spip_auteurs_liens',
1121
-			'id_auteur=' . intval($id_auteur) . " AND objet='rubrique' AND id_objet!=0"
1121
+			'id_auteur='.intval($id_auteur)." AND objet='rubrique' AND id_objet!=0"
1122 1122
 		)
1123 1123
 		and count($r)
1124 1124
 	) {
@@ -1733,8 +1733,8 @@  discard block
 block discarded – undo
1733 1733
 function auteurs_objet($objet, $id_objet, $cond = '') {
1734 1734
 	$objet = objet_type($objet);
1735 1735
 	$where = array(
1736
-		'objet=' . sql_quote($objet),
1737
-		'id_objet=' . intval($id_objet)
1736
+		'objet='.sql_quote($objet),
1737
+		'id_objet='.intval($id_objet)
1738 1738
 	);
1739 1739
 	if (!empty($cond)) {
1740 1740
 		if (is_array($cond)) {
@@ -1768,7 +1768,7 @@  discard block
 block discarded – undo
1768 1768
 	return sql_allfetsel(
1769 1769
 		'id_auteur',
1770 1770
 		'spip_auteurs_liens',
1771
-		"objet='article' AND id_objet=" . intval($id_article) . ($cond ? " AND $cond" : '')
1771
+		"objet='article' AND id_objet=".intval($id_article).($cond ? " AND $cond" : '')
1772 1772
 	);
1773 1773
 }
1774 1774
 
Please login to merge, or discard this patch.
ecrire/genie/optimiser.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -51,9 +51,9 @@  discard block
 block discarded – undo
51 51
  */
52 52
 function optimiser_caches_contextes() {
53 53
 	sous_repertoire(_DIR_CACHE, 'contextes');
54
-	if (is_dir( $d = _DIR_CACHE . 'contextes')) {
54
+	if (is_dir($d = _DIR_CACHE.'contextes')) {
55 55
 		include_spip('inc/invalideur');
56
-		purger_repertoire($d, ['mtime' => time() - 48*24*3600, 'limit' => 10000]);
56
+		purger_repertoire($d, ['mtime' => time() - 48 * 24 * 3600, 'limit' => 10000]);
57 57
 	}
58 58
 }
59 59
 
@@ -140,8 +140,8 @@  discard block
 block discarded – undo
140 140
 	sql_free($sel);
141 141
 
142 142
 	if ($in) {
143
-		sql_delete($table, sql_in($id, array_keys($in)) . ($and ? " AND $and" : ''));
144
-		spip_log("optimiser_sansref: Numeros des entrees $id supprimees dans la table $table: " . implode(', ', array_keys($in)), 'genie'._LOG_DEBUG);
143
+		sql_delete($table, sql_in($id, array_keys($in)).($and ? " AND $and" : ''));
144
+		spip_log("optimiser_sansref: Numeros des entrees $id supprimees dans la table $table: ".implode(', ', array_keys($in)), 'genie'._LOG_DEBUG);
145 145
 	}
146 146
 
147 147
 	return count($in);
@@ -217,7 +217,7 @@  discard block
 block discarded – undo
217 217
 	if (!defined('_AUTEURS_DELAI_REJET_NOUVEAU')) {
218 218
 		define('_AUTEURS_DELAI_REJET_NOUVEAU', 45 * 24 * 3600);
219 219
 	}
220
-	sql_delete("spip_auteurs", "statut='nouveau' AND maj < " . sql_quote(date('Y-m-d', time() - intval(_AUTEURS_DELAI_REJET_NOUVEAU))));
220
+	sql_delete("spip_auteurs", "statut='nouveau' AND maj < ".sql_quote(date('Y-m-d', time() - intval(_AUTEURS_DELAI_REJET_NOUVEAU))));
221 221
 
222 222
 	/**
223 223
 	 * Permet aux plugins de compléter l'optimisation suite aux éléments disparus
Please login to merge, or discard this patch.
ecrire/action/editer_auteur.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -95,7 +95,7 @@  discard block
 block discarded – undo
95 95
 	$champs['source'] = $source ? $source : 'spip';
96 96
 
97 97
 	$champs['login'] = '';
98
-	$champs['statut'] = '5poubelle';  // inutilisable tant qu'il n'a pas ete renseigne et institue
98
+	$champs['statut'] = '5poubelle'; // inutilisable tant qu'il n'a pas ete renseigne et institue
99 99
 	$champs['webmestre'] = 'non';
100 100
 	if (empty($champs['imessage'])) {
101 101
 		$champs['imessage'] = 'oui';
@@ -324,7 +324,7 @@  discard block
 block discarded – undo
324 324
 		$champs['pass'] = $c['pass'];
325 325
 	}
326 326
 
327
-	$statut = $statut_ancien = sql_getfetsel('statut', 'spip_auteurs', 'id_auteur=' . intval($id_auteur));
327
+	$statut = $statut_ancien = sql_getfetsel('statut', 'spip_auteurs', 'id_auteur='.intval($id_auteur));
328 328
 
329 329
 	if (isset($c['statut'])
330 330
 		and (autoriser('modifier', 'auteur', $id_auteur, null, array('statut' => $c['statut'])))
@@ -380,7 +380,7 @@  discard block
 block discarded – undo
380 380
 	// commencer par traiter les cas particuliers des logins et pass
381 381
 	// avant les autres ecritures en base
382 382
 	if (isset($champs['login']) or isset($champs['pass'])) {
383
-		$auth_methode = sql_getfetsel('source', 'spip_auteurs', 'id_auteur=' . intval($id_auteur));
383
+		$auth_methode = sql_getfetsel('source', 'spip_auteurs', 'id_auteur='.intval($id_auteur));
384 384
 		include_spip('inc/auth');
385 385
 		if (isset($champs['login']) and strlen($champs['login'])) {
386 386
 			if (!auth_modifier_login($auth_methode, $champs['login'], $id_auteur)) {
@@ -388,7 +388,7 @@  discard block
 block discarded – undo
388 388
 			}
389 389
 		}
390 390
 		if (isset($champs['pass']) and strlen($champs['pass'])) {
391
-			$champs['login'] = sql_getfetsel('login', 'spip_auteurs', 'id_auteur=' . intval($id_auteur));
391
+			$champs['login'] = sql_getfetsel('login', 'spip_auteurs', 'id_auteur='.intval($id_auteur));
392 392
 			if (!auth_modifier_pass($auth_methode, $champs['login'], $champs['pass'], $id_auteur)) {
393 393
 				$erreurs[] = 'ecrire:impossible_modifier_pass_auteur';
394 394
 			}
@@ -401,7 +401,7 @@  discard block
 block discarded – undo
401 401
 	if (!count($champs)) {
402 402
 		return implode(' ', array_map('_T', $erreurs));
403 403
 	}
404
-	sql_updateq('spip_auteurs', $champs, 'id_auteur=' . $id_auteur);
404
+	sql_updateq('spip_auteurs', $champs, 'id_auteur='.$id_auteur);
405 405
 
406 406
 	// .. mettre a jour les fichiers .htpasswd et .htpasswd-admin
407 407
 	if ($flag_ecrire_acces
Please login to merge, or discard this patch.
ecrire/maj/2021.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -23,6 +23,6 @@
 block discarded – undo
23 23
 }
24 24
 
25 25
 $GLOBALS['maj'][2021021800] = [
26
-	['sql_alter', "TABLE spip_auteurs CHANGE imessage imessage VARCHAR(3) DEFAULT '' NOT NULL" ],
27
-	['sql_updateq', "spip_auteurs", ['imessage' => 'oui'], "imessage != 'non' OR imessage IS NULL" ],
26
+	['sql_alter', "TABLE spip_auteurs CHANGE imessage imessage VARCHAR(3) DEFAULT '' NOT NULL"],
27
+	['sql_updateq', "spip_auteurs", ['imessage' => 'oui'], "imessage != 'non' OR imessage IS NULL"],
28 28
 ];
Please login to merge, or discard this patch.
ecrire/req/sqlite_generique.php 1 patch
Spacing   +93 added lines, -93 removed lines patch added patch discarded remove patch
@@ -64,27 +64,27 @@  discard block
 block discarded – undo
64 64
 	// determiner le dossier de la base : $addr ou _DIR_DB
65 65
 	$f = _DIR_DB;
66 66
 	if ($addr and strpos($addr, '/') !== false) {
67
-		$f = rtrim($addr, '/') . '/';
67
+		$f = rtrim($addr, '/').'/';
68 68
 	}
69 69
 
70 70
 	// un nom de base demande et impossible d'obtenir la base, on s'en va :
71 71
 	// il faut que la base existe ou que le repertoire parent soit writable
72
-	if ($db and !is_file($f .= $db . '.sqlite') and !is_writable(dirname($f))) {
73
-		spip_log("base $f non trouvee ou droits en ecriture manquants", 'sqlite.' . _LOG_HS);
72
+	if ($db and !is_file($f .= $db.'.sqlite') and !is_writable(dirname($f))) {
73
+		spip_log("base $f non trouvee ou droits en ecriture manquants", 'sqlite.'._LOG_HS);
74 74
 
75 75
 		return false;
76 76
 	}
77 77
 
78 78
 	// charger les modules sqlite au besoin
79 79
 	if (!_sqlite_charger_version($sqlite_version)) {
80
-		spip_log("Impossible de trouver/charger le module SQLite ($sqlite_version)!", 'sqlite.' . _LOG_HS);
80
+		spip_log("Impossible de trouver/charger le module SQLite ($sqlite_version)!", 'sqlite.'._LOG_HS);
81 81
 
82 82
 		return false;
83 83
 	}
84 84
 
85 85
 	// chargement des constantes
86 86
 	// il ne faut pas definir les constantes avant d'avoir charge les modules sqlite
87
-	$define = "spip_sqlite" . $sqlite_version . "_constantes";
87
+	$define = "spip_sqlite".$sqlite_version."_constantes";
88 88
 	$define();
89 89
 
90 90
 	$ok = false;
@@ -92,8 +92,8 @@  discard block
 block discarded – undo
92 92
 		// si pas de db ->
93 93
 		// base temporaire tant qu'on ne connait pas son vrai nom
94 94
 		// pour tester la connexion
95
-		$db = "_sqlite" . $sqlite_version . "_install";
96
-		$tmp = _DIR_DB . $db . ".sqlite";
95
+		$db = "_sqlite".$sqlite_version."_install";
96
+		$tmp = _DIR_DB.$db.".sqlite";
97 97
 		$ok = $link = new \PDO("sqlite:$tmp");
98 98
 	} else {
99 99
 		// Ouvrir (eventuellement creer la base)
@@ -102,7 +102,7 @@  discard block
 block discarded – undo
102 102
 
103 103
 	if (!$ok) {
104 104
 		$e = _sqlite_last_error_from_link($link);
105
-		spip_log("Impossible d'ouvrir la base SQLite($sqlite_version) $f : $e", 'sqlite.' . _LOG_HS);
105
+		spip_log("Impossible d'ouvrir la base SQLite($sqlite_version) $f : $e", 'sqlite.'._LOG_HS);
106 106
 
107 107
 		return false;
108 108
 	}
@@ -188,7 +188,7 @@  discard block
 block discarded – undo
188 188
 		$table = $regs[3];
189 189
 		$suite = $regs[4];
190 190
 	} else {
191
-		spip_log("SQLite : Probleme de ALTER TABLE mal forme dans $query", 'sqlite.' . _LOG_ERREUR);
191
+		spip_log("SQLite : Probleme de ALTER TABLE mal forme dans $query", 'sqlite.'._LOG_ERREUR);
192 192
 
193 193
 		return false;
194 194
 	}
@@ -205,7 +205,7 @@  discard block
 block discarded – undo
205 205
 	$i = 0;
206 206
 	$ouverte = false;
207 207
 	while ($do = array_shift($todo)) {
208
-		$todo2[$i] = isset($todo2[$i]) ? $todo2[$i] . "," . $do : $do;
208
+		$todo2[$i] = isset($todo2[$i]) ? $todo2[$i].",".$do : $do;
209 209
 		$o = (false !== strpos($do, "("));
210 210
 		$f = (false !== strpos($do, ")"));
211 211
 		if ($o and !$f) {
@@ -229,7 +229,7 @@  discard block
 block discarded – undo
229 229
 			. ')\s*([^\s]*)\s*(.*)?/i', $do, $matches)
230 230
 		) {
231 231
 			spip_log("SQLite : Probleme de ALTER TABLE, utilisation non reconnue dans : $do \n(requete d'origine : $query)",
232
-				'sqlite.' . _LOG_ERREUR);
232
+				'sqlite.'._LOG_ERREUR);
233 233
 
234 234
 			return false;
235 235
 		}
@@ -316,10 +316,10 @@  discard block
 block discarded – undo
316 316
 
317 317
 			// pas geres en sqlite2
318 318
 			case 'RENAME':
319
-				$do = "RENAME TO" . substr($do, 6);
319
+				$do = "RENAME TO".substr($do, 6);
320 320
 			case 'RENAME TO':
321 321
 				if (!spip_sqlite::executer_requete("$debut $do", $serveur)) {
322
-					spip_log("SQLite : Erreur ALTER TABLE / RENAME : $query", 'sqlite.' . _LOG_ERREUR);
322
+					spip_log("SQLite : Erreur ALTER TABLE / RENAME : $query", 'sqlite.'._LOG_ERREUR);
323 323
 
324 324
 					return false;
325 325
 				}
@@ -360,7 +360,7 @@  discard block
 block discarded – undo
360 360
 						$colonnes = substr($colonne_origine, 1, -1);
361 361
 						if (false !== strpos(",", $colonnes)) {
362 362
 							spip_log("SQLite : Erreur, impossible de creer un index sur plusieurs colonnes"
363
-								. " sans qu'il ait de nom ($table, ($colonnes))", 'sqlite.' . _LOG_ERREUR);
363
+								. " sans qu'il ait de nom ($table, ($colonnes))", 'sqlite.'._LOG_ERREUR);
364 364
 							break;
365 365
 						} else {
366 366
 							$nom_index = $colonnes;
@@ -375,12 +375,12 @@  discard block
 block discarded – undo
375 375
 
376 376
 			// pas geres en sqlite2
377 377
 			case 'ADD COLUMN':
378
-				$do = "ADD" . substr($do, 10);
378
+				$do = "ADD".substr($do, 10);
379 379
 			case 'ADD':
380 380
 			default:
381 381
 				if (!preg_match(',primary\s+key,i', $do)) {
382 382
 					if (!spip_sqlite::executer_requete("$debut $do", $serveur)) {
383
-						spip_log("SQLite : Erreur ALTER TABLE / ADD : $query", 'sqlite.' . _LOG_ERREUR);
383
+						spip_log("SQLite : Erreur ALTER TABLE / ADD : $query", 'sqlite.'._LOG_ERREUR);
384 384
 
385 385
 						return false;
386 386
 					}
@@ -401,7 +401,7 @@  discard block
 block discarded – undo
401 401
 					}
402 402
 					$opts['field'] = array($colonne_ajoutee => $def);
403 403
 					if (!_sqlite_modifier_table($table, array($colonne_ajoutee), $opts, $serveur)) {
404
-						spip_log("SQLite : Erreur ALTER TABLE / ADD : $query", 'sqlite.' . _LOG_ERREUR);
404
+						spip_log("SQLite : Erreur ALTER TABLE / ADD : $query", 'sqlite.'._LOG_ERREUR);
405 405
 
406 406
 						return false;
407 407
 					}
@@ -409,10 +409,10 @@  discard block
 block discarded – undo
409 409
 				break;
410 410
 		}
411 411
 		// tout est bon, ouf !
412
-		spip_log("SQLite ($serveur) : Changements OK : $debut $do", 'sqlite.' . _LOG_INFO);
412
+		spip_log("SQLite ($serveur) : Changements OK : $debut $do", 'sqlite.'._LOG_INFO);
413 413
 	}
414 414
 
415
-	spip_log("SQLite ($serveur) : fin ALTER TABLE OK !", 'sqlite.' . _LOG_INFO);
415
+	spip_log("SQLite ($serveur) : fin ALTER TABLE OK !", 'sqlite.'._LOG_INFO);
416 416
 
417 417
 	return true;
418 418
 }
@@ -481,9 +481,9 @@  discard block
 block discarded – undo
481 481
  * @return bool true si la base est créee.
482 482
  **/
483 483
 function spip_sqlite_create_base($nom, $serveur = '', $option = true) {
484
-	$f = $nom . '.sqlite';
484
+	$f = $nom.'.sqlite';
485 485
 	if (strpos($nom, "/") === false) {
486
-		$f = _DIR_DB . $f;
486
+		$f = _DIR_DB.$f;
487 487
 	}
488 488
 
489 489
 	$ok = new \PDO("sqlite:$f");
@@ -522,12 +522,12 @@  discard block
 block discarded – undo
522 522
 	// vue deja presente
523 523
 	if (sql_showtable($nom, false, $serveur)) {
524 524
 		spip_log("Echec creation d'une vue sql ($nom) car celle-ci existe deja (serveur:$serveur)",
525
-			'sqlite.' . _LOG_ERREUR);
525
+			'sqlite.'._LOG_ERREUR);
526 526
 
527 527
 		return false;
528 528
 	}
529 529
 
530
-	$query = "CREATE VIEW $nom AS " . $query_select;
530
+	$query = "CREATE VIEW $nom AS ".$query_select;
531 531
 
532 532
 	return spip_sqlite_query($query, $serveur, $requeter);
533 533
 }
@@ -552,15 +552,15 @@  discard block
 block discarded – undo
552 552
  */
553 553
 function spip_sqlite_create_index($nom, $table, $champs, $unique = '', $serveur = '', $requeter = true) {
554 554
 	if (!($nom or $table or $champs)) {
555
-		spip_log("Champ manquant pour creer un index sqlite ($nom, $table, (" . join(',', $champs) . "))",
556
-			'sqlite.' . _LOG_ERREUR);
555
+		spip_log("Champ manquant pour creer un index sqlite ($nom, $table, (".join(',', $champs)."))",
556
+			'sqlite.'._LOG_ERREUR);
557 557
 
558 558
 		return false;
559 559
 	}
560 560
 
561 561
 	// SQLite ne differentie pas noms des index en fonction des tables
562 562
 	// il faut donc creer des noms uniques d'index pour une base sqlite
563
-	$nom = $table . '_' . $nom;
563
+	$nom = $table.'_'.$nom;
564 564
 	// enlever d'eventuelles parentheses deja presentes sur champs
565 565
 	if (!is_array($champs)) {
566 566
 		if ($champs[0] == "(") {
@@ -582,12 +582,12 @@  discard block
 block discarded – undo
582 582
 	} else {
583 583
 		/* simuler le IF EXISTS - version 2 et sqlite < 3.3a */
584 584
 		$a = spip_sqlite_showtable($table, $serveur);
585
-		if (isset($a['key']['KEY ' . $nom])) {
585
+		if (isset($a['key']['KEY '.$nom])) {
586 586
 			return true;
587 587
 		}
588 588
 	}
589 589
 
590
-	$query = "CREATE " . ($unique ? "UNIQUE " : "") . "INDEX$ifnotexists $nom ON $table (" . join(',', $champs) . ")";
590
+	$query = "CREATE ".($unique ? "UNIQUE " : "")."INDEX$ifnotexists $nom ON $table (".join(',', $champs).")";
591 591
 	$res = spip_sqlite_query($query, $serveur, $requeter);
592 592
 	if (!$requeter) {
593 593
 		return $res;
@@ -663,7 +663,7 @@  discard block
 block discarded – undo
663 663
 	$serveur = '',
664 664
 	$requeter = true
665 665
 ) {
666
-	$c = !$groupby ? '*' : ('DISTINCT ' . (is_string($groupby) ? $groupby : join(',', $groupby)));
666
+	$c = !$groupby ? '*' : ('DISTINCT '.(is_string($groupby) ? $groupby : join(',', $groupby)));
667 667
 	$r = spip_sqlite_select("COUNT($c)", $from, $where, '', '', '',
668 668
 		$having, $serveur, $requeter);
669 669
 	if ((is_resource($r) or is_object($r)) && $requeter) { // ressource : sqlite2, object : sqlite3
@@ -761,14 +761,14 @@  discard block
 block discarded – undo
761 761
  */
762 762
 function spip_sqlite_drop_index($nom, $table, $serveur = '', $requeter = true) {
763 763
 	if (!($nom or $table)) {
764
-		spip_log("Champ manquant pour supprimer un index sqlite ($nom, $table)", 'sqlite.' . _LOG_ERREUR);
764
+		spip_log("Champ manquant pour supprimer un index sqlite ($nom, $table)", 'sqlite.'._LOG_ERREUR);
765 765
 
766 766
 		return false;
767 767
 	}
768 768
 
769 769
 	// SQLite ne differentie pas noms des index en fonction des tables
770 770
 	// il faut donc creer des noms uniques d'index pour une base sqlite
771
-	$index = $table . '_' . $nom;
771
+	$index = $table.'_'.$nom;
772 772
 	$exist = " IF EXISTS";
773 773
 
774 774
 	$query = "DROP INDEX$exist $index";
@@ -800,7 +800,7 @@  discard block
 block discarded – undo
800 800
 	if ($s) {
801 801
 		$trace = debug_backtrace();
802 802
 		if ($trace[0]['function'] != "spip_sqlite_error") {
803
-			spip_log("$s - $query - " . sql_error_backtrace(), 'sqlite.' . _LOG_ERREUR);
803
+			spip_log("$s - $query - ".sql_error_backtrace(), 'sqlite.'._LOG_ERREUR);
804 804
 		}
805 805
 	}
806 806
 
@@ -847,14 +847,14 @@  discard block
 block discarded – undo
847 847
 		$t = $link->errorInfo();
848 848
 		$s = ltrim($t[0], '0'); // 00000 si pas d'erreur
849 849
 		if ($s) {
850
-			$s .= ' / ' . $t[1];
850
+			$s .= ' / '.$t[1];
851 851
 		} // ajoute l'erreur du moteur SQLite
852 852
 	} else {
853 853
 		$s = ": aucune ressource sqlite (link)";
854 854
 	}
855 855
 
856 856
 	if ($s) {
857
-		spip_log("Erreur sqlite $s", 'sqlite.' . _LOG_ERREUR);
857
+		spip_log("Erreur sqlite $s", 'sqlite.'._LOG_ERREUR);
858 858
 	}
859 859
 
860 860
 	return $s ? $s : 0;
@@ -878,7 +878,7 @@  discard block
 block discarded – undo
878 878
 	}
879 879
 
880 880
 	$query = spip_sqlite::traduire_requete($query, $serveur);
881
-	$query = 'EXPLAIN ' . $query;
881
+	$query = 'EXPLAIN '.$query;
882 882
 	if (!$requeter) {
883 883
 		return $query;
884 884
 	}
@@ -1038,7 +1038,7 @@  discard block
 block discarded – undo
1038 1038
  **/
1039 1039
 function spip_sqlite_insert($table, $champs, $valeurs, $desc = array(), $serveur = '', $requeter = true) {
1040 1040
 
1041
-	$query = "INSERT INTO $table " . ($champs ? "$champs VALUES $valeurs" : "DEFAULT VALUES");
1041
+	$query = "INSERT INTO $table ".($champs ? "$champs VALUES $valeurs" : "DEFAULT VALUES");
1042 1042
 	if ($r = spip_sqlite_query($query, $serveur, $requeter)) {
1043 1043
 		if (!$requeter) {
1044 1044
 			return $r;
@@ -1094,8 +1094,8 @@  discard block
 block discarded – undo
1094 1094
 
1095 1095
 	$cles = $valeurs = "";
1096 1096
 	if (count($couples)) {
1097
-		$cles = "(" . join(',', array_keys($couples)) . ")";
1098
-		$valeurs = "(" . join(',', $couples) . ")";
1097
+		$cles = "(".join(',', array_keys($couples)).")";
1098
+		$valeurs = "(".join(',', $couples).")";
1099 1099
 	}
1100 1100
 
1101 1101
 	return spip_sqlite_insert($table, $cles, $valeurs, $desc, $serveur, $requeter);
@@ -1155,11 +1155,11 @@  discard block
 block discarded – undo
1155 1155
 
1156 1156
 		$champs = $valeurs = "";
1157 1157
 		if (count($couples)) {
1158
-			$champs = "(" . join(',', array_keys($couples)) . ")";
1159
-			$valeurs = "(" . join(',', $couples) . ")";
1160
-			$query = $query_start . "$champs VALUES $valeurs";
1158
+			$champs = "(".join(',', array_keys($couples)).")";
1159
+			$valeurs = "(".join(',', $couples).")";
1160
+			$query = $query_start."$champs VALUES $valeurs";
1161 1161
 		} else {
1162
-			$query = $query_start . "DEFAULT VALUES";
1162
+			$query = $query_start."DEFAULT VALUES";
1163 1163
 		}
1164 1164
 
1165 1165
 		if ($requeter) {
@@ -1291,7 +1291,7 @@  discard block
 block discarded – undo
1291 1291
  * @return string       Texte de sélection pour la requête
1292 1292
  */
1293 1293
 function spip_sqlite_multi($objet, $lang) {
1294
-	$r = "EXTRAIRE_MULTI(" . $objet . ", '" . $lang . "') AS multi";
1294
+	$r = "EXTRAIRE_MULTI(".$objet.", '".$lang."') AS multi";
1295 1295
 
1296 1296
 	return $r;
1297 1297
 }
@@ -1362,7 +1362,7 @@  discard block
 block discarded – undo
1362 1362
 function spip_sqlite_date_proche($champ, $interval, $unite) {
1363 1363
 	$op = (($interval <= 0) ? '>' : '<');
1364 1364
 
1365
-	return "($champ $op datetime('" . date("Y-m-d H:i:s") . "', '$interval $unite'))";
1365
+	return "($champ $op datetime('".date("Y-m-d H:i:s")."', '$interval $unite'))";
1366 1366
 }
1367 1367
 
1368 1368
 
@@ -1392,7 +1392,7 @@  discard block
 block discarded – undo
1392 1392
 				and (!isset($desc['key']['PRIMARY KEY']) or $desc['key']['PRIMARY KEY'] !== $c)
1393 1393
 			) {
1394 1394
 				spip_sqlite_alter($q = "TABLE $table CHANGE $c $c $d DEFAULT ''", $serveur);
1395
-				spip_log("ALTER $q", "repair" . _LOG_INFO_IMPORTANTE);
1395
+				spip_log("ALTER $q", "repair"._LOG_INFO_IMPORTANTE);
1396 1396
 			}
1397 1397
 			if (preg_match(",^(INTEGER),i", $d)
1398 1398
 				and stripos($d, "NOT NULL") !== false
@@ -1401,7 +1401,7 @@  discard block
 block discarded – undo
1401 1401
 				and (!isset($desc['key']['PRIMARY KEY']) or $desc['key']['PRIMARY KEY'] !== $c)
1402 1402
 			) {
1403 1403
 				spip_sqlite_alter($q = "TABLE $table CHANGE $c $c $d DEFAULT '0'", $serveur);
1404
-				spip_log("ALTER $q", "repair" . _LOG_INFO_IMPORTANTE);
1404
+				spip_log("ALTER $q", "repair"._LOG_INFO_IMPORTANTE);
1405 1405
 			}
1406 1406
 			if (preg_match(",^(datetime),i", $d)
1407 1407
 				and stripos($d, "NOT NULL") !== false
@@ -1410,7 +1410,7 @@  discard block
 block discarded – undo
1410 1410
 				and (!isset($desc['key']['PRIMARY KEY']) or $desc['key']['PRIMARY KEY'] !== $c)
1411 1411
 			) {
1412 1412
 				spip_sqlite_alter($q = "TABLE $table CHANGE $c $c $d DEFAULT '0000-00-00 00:00:00'", $serveur);
1413
-				spip_log("ALTER $q", "repair" . _LOG_INFO_IMPORTANTE);
1413
+				spip_log("ALTER $q", "repair"._LOG_INFO_IMPORTANTE);
1414 1414
 			}
1415 1415
 		}
1416 1416
 
@@ -1461,8 +1461,8 @@  discard block
 block discarded – undo
1461 1461
 	// recherche de champs 'timestamp' pour mise a jour auto de ceux-ci
1462 1462
 	$couples = _sqlite_ajouter_champs_timestamp($table, $couples, $desc, $serveur);
1463 1463
 
1464
-	return spip_sqlite_query("REPLACE INTO $table (" . join(',', array_keys($couples)) . ') VALUES (' . join(',',
1465
-			$couples) . ')', $serveur);
1464
+	return spip_sqlite_query("REPLACE INTO $table (".join(',', array_keys($couples)).') VALUES ('.join(',',
1465
+			$couples).')', $serveur);
1466 1466
 }
1467 1467
 
1468 1468
 
@@ -1548,7 +1548,7 @@  discard block
 block discarded – undo
1548 1548
 		. _sqlite_calculer_expression('WHERE', $where)
1549 1549
 		. _sqlite_calculer_expression('GROUP BY', $groupby, ',')
1550 1550
 		. _sqlite_calculer_expression('HAVING', $having)
1551
-		. ($orderby ? ("\nORDER BY " . _sqlite_calculer_order($orderby)) : '')
1551
+		. ($orderby ? ("\nORDER BY "._sqlite_calculer_order($orderby)) : '')
1552 1552
 		. ($limit ? "\nLIMIT $limit" : '');
1553 1553
 
1554 1554
 	// dans un select, on doit renvoyer la requête en cas d'erreur
@@ -1585,10 +1585,10 @@  discard block
 block discarded – undo
1585 1585
 
1586 1586
 	// interdire la creation d'une nouvelle base, 
1587 1587
 	// sauf si on est dans l'installation
1588
-	if (!is_file($f = _DIR_DB . $db . '.sqlite')
1588
+	if (!is_file($f = _DIR_DB.$db.'.sqlite')
1589 1589
 		&& (!defined('_ECRIRE_INSTALL') || !_ECRIRE_INSTALL)
1590 1590
 	) {
1591
-		spip_log("Il est interdit de creer la base $db", 'sqlite.' . _LOG_HS);
1591
+		spip_log("Il est interdit de creer la base $db", 'sqlite.'._LOG_HS);
1592 1592
 
1593 1593
 		return false;
1594 1594
 	}
@@ -1597,12 +1597,12 @@  discard block
 block discarded – undo
1597 1597
 	// avec les identifiants connus
1598 1598
 	$index = $serveur ? $serveur : 0;
1599 1599
 
1600
-	if ($link = spip_connect_db('', '', '', '', '@selectdb@' . $db, $serveur, '', '')) {
1600
+	if ($link = spip_connect_db('', '', '', '', '@selectdb@'.$db, $serveur, '', '')) {
1601 1601
 		if (($db == $link['db']) && $GLOBALS['connexions'][$index] = $link) {
1602 1602
 			return $db;
1603 1603
 		}
1604 1604
 	} else {
1605
-		spip_log("Impossible de selectionner la base $db", 'sqlite.' . _LOG_HS);
1605
+		spip_log("Impossible de selectionner la base $db", 'sqlite.'._LOG_HS);
1606 1606
 
1607 1607
 		return false;
1608 1608
 	}
@@ -1653,7 +1653,7 @@  discard block
 block discarded – undo
1653 1653
 	$match = str_replace("[[POURCENT]]", "%", $match);
1654 1654
 	$match = "^$match$";
1655 1655
 
1656
-	return spip_sqlite_query("SELECT name FROM sqlite_master WHERE type='table' AND tbl_name REGEXP " . _q($match),
1656
+	return spip_sqlite_query("SELECT name FROM sqlite_master WHERE type='table' AND tbl_name REGEXP "._q($match),
1657 1657
 		$serveur, $requeter);
1658 1658
 }
1659 1659
 
@@ -1743,7 +1743,7 @@  discard block
 block discarded – undo
1743 1743
 				// s'il y a une parenthèse fermante dans la clé
1744 1744
 				// ou dans la définition sans qu'il n'y ait une ouverture avant
1745 1745
 				if (false !== strpos($k, ')') or preg_match('/^[^\(]*\)/', $def)) {
1746
-					$fields[$k_precedent] .= ',' . $k . ' ' . $def;
1746
+					$fields[$k_precedent] .= ','.$k.' '.$def;
1747 1747
 					continue;
1748 1748
 				}
1749 1749
 
@@ -1778,13 +1778,13 @@  discard block
 block discarded – undo
1778 1778
 				. 'ORDER BY substr(type,2,1), name';
1779 1779
 			$a = spip_sqlite_query($query, $serveur, $requeter);
1780 1780
 			while ($r = spip_sqlite_fetch($a, null, $serveur)) {
1781
-				$key = str_replace($nom_table . '_', '', $r['name']); // enlever le nom de la table ajoute a l'index
1781
+				$key = str_replace($nom_table.'_', '', $r['name']); // enlever le nom de la table ajoute a l'index
1782 1782
 				$keytype = "KEY";
1783 1783
 				if (strpos($r['sql'], "UNIQUE INDEX") !== false) {
1784 1784
 					$keytype = "UNIQUE KEY";
1785 1785
 				}
1786 1786
 				$colonnes = preg_replace(',.*\((.*)\).*,', '$1', $r['sql']);
1787
-				$keys[$keytype . ' ' . $key] = $colonnes;
1787
+				$keys[$keytype.' '.$key] = $colonnes;
1788 1788
 			}
1789 1789
 		}
1790 1790
 
@@ -1833,7 +1833,7 @@  discard block
 block discarded – undo
1833 1833
 
1834 1834
 	$set = array();
1835 1835
 	foreach ($champs as $champ => $val) {
1836
-		$set[] = $champ . "=$val";
1836
+		$set[] = $champ."=$val";
1837 1837
 	}
1838 1838
 	if (!empty($set)) {
1839 1839
 		return spip_sqlite_query(
@@ -1887,7 +1887,7 @@  discard block
 block discarded – undo
1887 1887
 
1888 1888
 	$set = array();
1889 1889
 	foreach ($champs as $champ => $val) {
1890
-		$set[] = $champ . '=' . _sqlite_calculer_cite($val, isset($fields[$champ]) ? $fields[$champ] : '');
1890
+		$set[] = $champ.'='._sqlite_calculer_cite($val, isset($fields[$champ]) ? $fields[$champ] : '');
1891 1891
 	}
1892 1892
 
1893 1893
 	return spip_sqlite_query(
@@ -1913,7 +1913,7 @@  discard block
 block discarded – undo
1913 1913
  */
1914 1914
 function _sqlite_init() {
1915 1915
 	if (!defined('_DIR_DB')) {
1916
-		define('_DIR_DB', _DIR_ETC . 'bases/');
1916
+		define('_DIR_DB', _DIR_ETC.'bases/');
1917 1917
 	}
1918 1918
 	if (!defined('_SQLITE_CHMOD')) {
1919 1919
 		define('_SQLITE_CHMOD', _SPIP_CHMOD);
@@ -2016,9 +2016,9 @@  discard block
 block discarded – undo
2016 2016
 	}
2017 2017
 
2018 2018
 	// echapper les ' en ''
2019
-	spip_log("Pas de methode ->quote pour echapper", "sqlite." . _LOG_INFO_IMPORTANTE);
2019
+	spip_log("Pas de methode ->quote pour echapper", "sqlite."._LOG_INFO_IMPORTANTE);
2020 2020
 
2021
-	return ("'" . str_replace("'", "''", $v) . "'");
2021
+	return ("'".str_replace("'", "''", $v)."'");
2022 2022
 }
2023 2023
 
2024 2024
 
@@ -2041,12 +2041,12 @@  discard block
 block discarded – undo
2041 2041
 	$exp = "\n$expression ";
2042 2042
 
2043 2043
 	if (!is_array($v)) {
2044
-		return $exp . $v;
2044
+		return $exp.$v;
2045 2045
 	} else {
2046 2046
 		if (strtoupper($join) === 'AND') {
2047
-			return $exp . join("\n\t$join ", array_map('_sqlite_calculer_where', $v));
2047
+			return $exp.join("\n\t$join ", array_map('_sqlite_calculer_where', $v));
2048 2048
 		} else {
2049
-			return $exp . join($join, $v);
2049
+			return $exp.join($join, $v);
2050 2050
 		}
2051 2051
 	}
2052 2052
 }
@@ -2080,17 +2080,17 @@  discard block
 block discarded – undo
2080 2080
 		if (substr($k, -1) == '@') {
2081 2081
 			// c'est une jointure qui se refere au from precedent
2082 2082
 			// pas de virgule
2083
-			$res .= '  ' . $v;
2083
+			$res .= '  '.$v;
2084 2084
 		} else {
2085 2085
 			if (!is_numeric($k)) {
2086 2086
 				$p = strpos($v, " ");
2087 2087
 				if ($p) {
2088
-					$v = substr($v, 0, $p) . " AS '$k'" . substr($v, $p);
2088
+					$v = substr($v, 0, $p)." AS '$k'".substr($v, $p);
2089 2089
 				} else {
2090 2090
 					$v .= " AS '$k'";
2091 2091
 				}
2092 2092
 			}
2093
-			$res .= ', ' . $v;
2093
+			$res .= ', '.$v;
2094 2094
 		}
2095 2095
 	}
2096 2096
 
@@ -2228,13 +2228,13 @@  discard block
 block discarded – undo
2228 2228
 
2229 2229
 	$def_origine = sql_showtable($table_origine, false, $serveur);
2230 2230
 	if (!$def_origine or !isset($def_origine['field'])) {
2231
-		spip_log("Alter table impossible sur $table_origine : table non trouvee", 'sqlite' . _LOG_ERREUR);
2231
+		spip_log("Alter table impossible sur $table_origine : table non trouvee", 'sqlite'._LOG_ERREUR);
2232 2232
 
2233 2233
 		return false;
2234 2234
 	}
2235 2235
 
2236 2236
 
2237
-	$table_tmp = $table_origine . '_tmp';
2237
+	$table_tmp = $table_origine.'_tmp';
2238 2238
 
2239 2239
 	// 1) creer une table temporaire avec les modifications	
2240 2240
 	// - DROP : suppression de la colonne
@@ -2320,7 +2320,7 @@  discard block
 block discarded – undo
2320 2320
 		} else {
2321 2321
 			// enlever KEY
2322 2322
 			$k = substr($k, 4);
2323
-			$queries[] = "CREATE INDEX $table_destination" . "_$k ON $table_destination ($v)";
2323
+			$queries[] = "CREATE INDEX $table_destination"."_$k ON $table_destination ($v)";
2324 2324
 		}
2325 2325
 	}
2326 2326
 
@@ -2331,7 +2331,7 @@  discard block
 block discarded – undo
2331 2331
 		foreach ($queries as $q) {
2332 2332
 			if (!spip_sqlite::executer_requete($q, $serveur)) {
2333 2333
 				spip_log("SQLite : ALTER TABLE table :"
2334
-					. " Erreur a l'execution de la requete : $q", 'sqlite.' . _LOG_ERREUR);
2334
+					. " Erreur a l'execution de la requete : $q", 'sqlite.'._LOG_ERREUR);
2335 2335
 				spip_sqlite::annuler_transaction($serveur);
2336 2336
 
2337 2337
 				return false;
@@ -2420,27 +2420,27 @@  discard block
 block discarded – undo
2420 2420
 	$enum = "(\s*\([^\)]*\))?";
2421 2421
 
2422 2422
 	$remplace = array(
2423
-		'/enum' . $enum . '/is' => 'VARCHAR(255)',
2423
+		'/enum'.$enum.'/is' => 'VARCHAR(255)',
2424 2424
 		'/COLLATE \w+_bin/is' => 'COLLATE BINARY',
2425 2425
 		'/COLLATE \w+_ci/is' => 'COLLATE NOCASE',
2426 2426
 		'/auto_increment/is' => '',
2427 2427
 		'/current_timestamp\(\)/is' => 'CURRENT_TIMESTAMP', // Fix export depuis mariaDB #4374
2428 2428
 		'/(timestamp .* )ON .*$/is' => '\\1',
2429 2429
 		'/character set \w+/is' => '',
2430
-		'/((big|small|medium|tiny)?int(eger)?)' . $num . '\s*unsigned/is' => '\\1 UNSIGNED',
2430
+		'/((big|small|medium|tiny)?int(eger)?)'.$num.'\s*unsigned/is' => '\\1 UNSIGNED',
2431 2431
 		'/(text\s+not\s+null(\s+collate\s+\w+)?)\s*$/is' => "\\1 DEFAULT ''",
2432
-		'/((char|varchar)' . $num . '\s+not\s+null(\s+collate\s+\w+)?)\s*$/is' => "\\1 DEFAULT ''",
2432
+		'/((char|varchar)'.$num.'\s+not\s+null(\s+collate\s+\w+)?)\s*$/is' => "\\1 DEFAULT ''",
2433 2433
 		'/(datetime\s+not\s+null)\s*$/is' => "\\1 DEFAULT '0000-00-00 00:00:00'",
2434 2434
 		'/(date\s+not\s+null)\s*$/is' => "\\1 DEFAULT '0000-00-00'",
2435 2435
 	);
2436 2436
 
2437 2437
 	// pour l'autoincrement, il faut des INTEGER NOT NULL PRIMARY KEY
2438 2438
 	$remplace_autocinc = array(
2439
-		'/(big|small|medium|tiny)?int(eger)?' . $num . '/is' => 'INTEGER'
2439
+		'/(big|small|medium|tiny)?int(eger)?'.$num.'/is' => 'INTEGER'
2440 2440
 	);
2441 2441
 	// pour les int non autoincrement, il faut un DEFAULT
2442 2442
 	$remplace_nonautocinc = array(
2443
-		'/((big|small|medium|tiny)?int(eger)?' . $num . '\s+not\s+null)\s*$/is' => "\\1 DEFAULT 0",
2443
+		'/((big|small|medium|tiny)?int(eger)?'.$num.'\s+not\s+null)\s*$/is' => "\\1 DEFAULT 0",
2444 2444
 	);
2445 2445
 
2446 2446
 	if (is_string($query)) {
@@ -2482,7 +2482,7 @@  discard block
 block discarded – undo
2482 2482
 		return str_ireplace("BINARY", "COLLATE BINARY", $champ);
2483 2483
 	}
2484 2484
 	if (preg_match(",^(char|varchar|(long|small|medium|tiny)?text),i", $champ)) {
2485
-		return $champ . " COLLATE NOCASE";
2485
+		return $champ." COLLATE NOCASE";
2486 2486
 	}
2487 2487
 
2488 2488
 	return $champ;
@@ -2569,7 +2569,7 @@  discard block
 block discarded – undo
2569 2569
 		} else {
2570 2570
 			/* simuler le IF EXISTS - version 2 et sqlite < 3.3a */
2571 2571
 			$a = spip_sqlite_showtable($nom, $serveur);
2572
-			if (isset($a['key']['KEY ' . $nom])) {
2572
+			if (isset($a['key']['KEY '.$nom])) {
2573 2573
 				return true;
2574 2574
 			}
2575 2575
 		}
@@ -2577,7 +2577,7 @@  discard block
 block discarded – undo
2577 2577
 	}
2578 2578
 
2579 2579
 	$temporary = $temporary ? ' TEMPORARY' : '';
2580
-	$q = "CREATE$temporary TABLE$ifnotexists $nom ($query" . ($keys ? ",$keys" : '') . ")\n";
2580
+	$q = "CREATE$temporary TABLE$ifnotexists $nom ($query".($keys ? ",$keys" : '').")\n";
2581 2581
 
2582 2582
 	return $q;
2583 2583
 }
@@ -2791,7 +2791,7 @@  discard block
 block discarded – undo
2791 2791
 		$this->serveur = strtolower($serveur);
2792 2792
 
2793 2793
 		if (!($this->link = _sqlite_link($this->serveur)) && (!defined('_ECRIRE_INSTALL') || !_ECRIRE_INSTALL)) {
2794
-			spip_log("Aucune connexion sqlite (link)", 'sqlite.' . _LOG_ERREUR);
2794
+			spip_log("Aucune connexion sqlite (link)", 'sqlite.'._LOG_ERREUR);
2795 2795
 
2796 2796
 			return false;
2797 2797
 		}
@@ -2837,7 +2837,7 @@  discard block
 block discarded – undo
2837 2837
 			try {
2838 2838
 				$r = $this->link->query($query);
2839 2839
 			} catch (\PDOException $e) {
2840
-				spip_log("PDOException: " . $e->getMessage(), 'sqlite.' . _LOG_DEBUG);
2840
+				spip_log("PDOException: ".$e->getMessage(), 'sqlite.'._LOG_DEBUG);
2841 2841
 				$r = false;
2842 2842
 			}
2843 2843
 			// sauvegarde de la requete (elle y est deja dans $r->queryString)
@@ -2858,11 +2858,11 @@  discard block
 block discarded – undo
2858 2858
 
2859 2859
 			// loger les warnings/erreurs eventuels de sqlite remontant dans PHP
2860 2860
 			if ($e and $e instanceof \PDOException) {
2861
-				$err = strip_tags($e->getMessage()) . " in " . $e->getFile() . " line " . $e->getLine();
2862
-				spip_log("$err - " . $query, 'sqlite.' . _LOG_ERREUR);
2861
+				$err = strip_tags($e->getMessage())." in ".$e->getFile()." line ".$e->getLine();
2862
+				spip_log("$err - ".$query, 'sqlite.'._LOG_ERREUR);
2863 2863
 			} elseif ($err = (function_exists('error_get_last') ? error_get_last() : "") and $err != $last_error) {
2864
-				$err = strip_tags($err['message']) . " in " . $err['file'] . " line " . $err['line'];
2865
-				spip_log("$err - " . $query, 'sqlite.' . _LOG_ERREUR);
2864
+				$err = strip_tags($err['message'])." in ".$err['file']." line ".$err['line'];
2865
+				spip_log("$err - ".$query, 'sqlite.'._LOG_ERREUR);
2866 2866
 			} else {
2867 2867
 				$err = "";
2868 2868
 			}
@@ -2941,15 +2941,15 @@  discard block
 block discarded – undo
2941 2941
 		// Correction Create Database
2942 2942
 		// Create Database -> requete ignoree
2943 2943
 		if (strpos($this->query, 'CREATE DATABASE') === 0) {
2944
-			spip_log("Sqlite : requete non executee -> $this->query", 'sqlite.' . _LOG_AVERTISSEMENT);
2944
+			spip_log("Sqlite : requete non executee -> $this->query", 'sqlite.'._LOG_AVERTISSEMENT);
2945 2945
 			$this->query = "SELECT 1";
2946 2946
 		}
2947 2947
 
2948 2948
 		// Correction Insert Ignore
2949 2949
 		// INSERT IGNORE -> insert (tout court et pas 'insert or replace')
2950 2950
 		if (strpos($this->query, 'INSERT IGNORE') === 0) {
2951
-			spip_log("Sqlite : requete transformee -> $this->query", 'sqlite.' . _LOG_DEBUG);
2952
-			$this->query = 'INSERT ' . substr($this->query, '13');
2951
+			spip_log("Sqlite : requete transformee -> $this->query", 'sqlite.'._LOG_DEBUG);
2952
+			$this->query = 'INSERT '.substr($this->query, '13');
2953 2953
 		}
2954 2954
 
2955 2955
 		// Correction des dates avec INTERVAL
@@ -2974,7 +2974,7 @@  discard block
 block discarded – undo
2974 2974
 		// problematique car la jointure ne se fait pas du coup.
2975 2975
 		if (($this->sqlite_version == 2) && (strpos($this->query, "USING") !== false)) {
2976 2976
 			spip_log("'USING (champ)' n'est pas reconnu en SQLite 2. Utilisez 'ON table1.champ = table2.champ'",
2977
-				'sqlite.' . _LOG_ERREUR);
2977
+				'sqlite.'._LOG_ERREUR);
2978 2978
 			$this->query = preg_replace('/USING\s*\([^\)]*\)/', '', $this->query);
2979 2979
 		}
2980 2980
 
@@ -2994,8 +2994,8 @@  discard block
 block discarded – undo
2994 2994
 		} else {
2995 2995
 			$suite = '';
2996 2996
 		}
2997
-		$pref = ($this->prefixe) ? $this->prefixe . "_" : "";
2998
-		$this->query = preg_replace('/([,\s])spip_/S', '\1' . $pref, $this->query) . $suite;
2997
+		$pref = ($this->prefixe) ? $this->prefixe."_" : "";
2998
+		$this->query = preg_replace('/([,\s])spip_/S', '\1'.$pref, $this->query).$suite;
2999 2999
 
3000 3000
 		// Correction zero AS x
3001 3001
 		// pg n'aime pas 0+x AS alias, sqlite, dans le meme style, 
Please login to merge, or discard this patch.
ecrire/inc/texte_mini.php 1 patch
Spacing   +29 added lines, -29 removed lines patch added patch discarded remove patch
@@ -44,7 +44,7 @@  discard block
 block discarded – undo
44 44
 	// celle du texte) et public (spip_lang est la langue du texte)
45 45
 	$dir = _DIR_RESTREINT ? lang_dir() : lang_dir($GLOBALS['spip_lang']);
46 46
 
47
-	$p = 'puce' . (test_espace_prive() ? '_prive' : '');
47
+	$p = 'puce'.(test_espace_prive() ? '_prive' : '');
48 48
 	if ($dir == 'rtl') {
49 49
 		$p .= '_rtl';
50 50
 	}
@@ -67,7 +67,7 @@  discard block
 block discarded – undo
67 67
 }
68 68
 
69 69
 if (!defined('_BALISES_BLOCS_REGEXP')) {
70
-	define('_BALISES_BLOCS_REGEXP', ',</?(' . _BALISES_BLOCS . ')[>[:space:]],iS');
70
+	define('_BALISES_BLOCS_REGEXP', ',</?('._BALISES_BLOCS.')[>[:space:]],iS');
71 71
 }
72 72
 
73 73
 //
@@ -85,7 +85,7 @@  discard block
 block discarded – undo
85 85
 
86 86
 	// Tester si on echappe en span ou en div
87 87
 	if (is_null($mode) or !in_array($mode, array('div', 'span'))) {
88
-		$mode = preg_match(',</?(' . _BALISES_BLOCS . ')[>[:space:]],iS', $rempl) ? 'div' : 'span';
88
+		$mode = preg_match(',</?('._BALISES_BLOCS.')[>[:space:]],iS', $rempl) ? 'div' : 'span';
89 89
 	}
90 90
 
91 91
 	// Decouper en morceaux, base64 a des probleme selon la taille de la pile
@@ -117,11 +117,11 @@  discard block
 block discarded – undo
117 117
 	// echapper les < dans <code>
118 118
 	// on utilise _PROTEGE_BLOCS pour simplifier le code et la maintenance, mais on est interesse que par <code>
119 119
 	if (strpos($pre, "<") !== false
120
-		and preg_match_all(_PROTEGE_BLOCS, $pre, $matches, PREG_SET_ORDER)){
120
+		and preg_match_all(_PROTEGE_BLOCS, $pre, $matches, PREG_SET_ORDER)) {
121 121
 
122
-		foreach ($matches as $m){
123
-			if ($m[1]==='code'){
124
-				$code = "<code" . $m[2] . ">" . spip_htmlspecialchars($m[3]) . "</code>";
122
+		foreach ($matches as $m) {
123
+			if ($m[1] === 'code') {
124
+				$code = "<code".$m[2].">".spip_htmlspecialchars($m[3])."</code>";
125 125
 				$pre = str_replace($m[0], $code, $pre);
126 126
 			}
127 127
 		}
@@ -132,7 +132,7 @@  discard block
 block discarded – undo
132 132
 // Echapper les <code>...</ code>
133 133
 // https://code.spip.net/@traiter_echap_code_dist
134 134
 function traiter_echap_code_dist($regs) {
135
-	list(, , $att, $corps) = $regs;
135
+	list(,, $att, $corps) = $regs;
136 136
 	$echap = spip_htmlspecialchars($corps); // il ne faut pas passer dans entites_html, ne pas transformer les &#xxx; du code !
137 137
 
138 138
 	// ne pas mettre le <div...> s'il n'y a qu'une ligne
@@ -143,9 +143,9 @@  discard block
 block discarded – undo
143 143
 		$echap = nl2br($echap);
144 144
 		$echap = "<div style='text-align: left;' "
145 145
 			. "class='spip_code' dir='ltr'><code$att>"
146
-			. $echap . "</code></div>";
146
+			. $echap."</code></div>";
147 147
 	} else {
148
-		$echap = "<code$att class='spip_code' dir='ltr'>" . $echap . "</code>";
148
+		$echap = "<code$att class='spip_code' dir='ltr'>".$echap."</code>";
149 149
 	}
150 150
 
151 151
 	$echap = str_replace("\t", "&nbsp; &nbsp; &nbsp; &nbsp; ", $echap);
@@ -222,10 +222,10 @@  discard block
 block discarded – undo
222 222
 				$echap = $regs[0];
223 223
 			} // sinon les traiter selon le cas
224 224
 			else {
225
-				if (function_exists($f = 'traiter_echap_' . strtolower($regs[1]))) {
225
+				if (function_exists($f = 'traiter_echap_'.strtolower($regs[1]))) {
226 226
 					$echap = $f($regs);
227 227
 				} else {
228
-					if (function_exists($f = $f . '_dist')) {
228
+					if (function_exists($f = $f.'_dist')) {
229 229
 						$echap = $f($regs);
230 230
 					}
231 231
 				}
@@ -245,7 +245,7 @@  discard block
 block discarded – undo
245 245
 	// (derogatoire car on ne peut pas faire passer < ? ... ? >
246 246
 	// dans une callback autonommee
247 247
 	if (strpos($preg ? $preg : _PROTEGE_BLOCS, 'script') !== false) {
248
-		if (strpos($letexte, "<" . "?") !== false and preg_match_all(',<[?].*($|[?]>),UisS',
248
+		if (strpos($letexte, "<"."?") !== false and preg_match_all(',<[?].*($|[?]>),UisS',
249 249
 				$letexte, $matches, PREG_SET_ORDER)
250 250
 		) {
251 251
 			foreach ($matches as $regs) {
@@ -270,7 +270,7 @@  discard block
 block discarded – undo
270 270
 		$max_prof = 5;
271 271
 		while (strpos($letexte, "<") !== false
272 272
 			and
273
-			preg_match_all(',<(span|div)\sclass=[\'"]base64' . $source . '[\'"]\s(.*)>\s*</\1>,UmsS',
273
+			preg_match_all(',<(span|div)\sclass=[\'"]base64'.$source.'[\'"]\s(.*)>\s*</\1>,UmsS',
274 274
 				$letexte, $regs, PREG_SET_ORDER)
275 275
 			and $max_prof--) {
276 276
 			foreach ($regs as $reg) {
@@ -283,7 +283,7 @@  discard block
 block discarded – undo
283 283
 					}
284 284
 				}
285 285
 				if ($at) {
286
-					$rempl = '<' . $reg[1] . '>' . $rempl . '</' . $reg[1] . '>';
286
+					$rempl = '<'.$reg[1].'>'.$rempl.'</'.$reg[1].'>';
287 287
 					foreach ($at as $attr => $a) {
288 288
 						$rempl = inserer_attribut($rempl, $attr, $a);
289 289
 					}
@@ -362,8 +362,8 @@  discard block
 block discarded – undo
362 362
 	$texte = nettoyer_raccourcis_typo($texte);
363 363
 
364 364
 	// balises de sauts de ligne et paragraphe
365
-	$texte = preg_replace("/<p( [^>]*)?" . ">/", "\r", $texte);
366
-	$texte = preg_replace("/<br( [^>]*)?" . ">/", "\n", $texte);
365
+	$texte = preg_replace("/<p( [^>]*)?".">/", "\r", $texte);
366
+	$texte = preg_replace("/<br( [^>]*)?".">/", "\n", $texte);
367 367
 
368 368
 	// on repasse les doubles \n en \r que nettoyer_raccourcis_typo() a pu modifier
369 369
 	$texte = str_replace("\n\n", "\r", $texte);
@@ -371,7 +371,7 @@  discard block
 block discarded – undo
371 371
 	// supprimer les tags
372 372
 	$texte = supprimer_tags($texte);
373 373
 	$texte = trim(str_replace("\n", " ", $texte));
374
-	$texte .= "\n";  // marquer la fin
374
+	$texte .= "\n"; // marquer la fin
375 375
 
376 376
 	// corriger la longueur de coupe
377 377
 	// en fonction de la presence de caracteres utf
@@ -386,7 +386,7 @@  discard block
 block discarded – undo
386 386
 	// couper au mot precedent
387 387
 	$long = spip_substr($texte, 0, max($taille - 4, 1));
388 388
 	$u = $GLOBALS['meta']['pcre_u'];
389
-	$court = preg_replace("/([^\s][\s]+)[^\s]*\n?$/" . $u, "\\1", $long);
389
+	$court = preg_replace("/([^\s][\s]+)[^\s]*\n?$/".$u, "\\1", $long);
390 390
 	if (is_null($suite)) {
391 391
 		$suite = (defined('_COUPER_SUITE') ? _COUPER_SUITE : '&nbsp;(...)');
392 392
 	}
@@ -396,7 +396,7 @@  discard block
 block discarded – undo
396 396
 	if (spip_strlen($court) < max(0.75 * $taille, 2)) {
397 397
 		$points = '';
398 398
 		$long = spip_substr($texte, 0, $taille);
399
-		$texte = preg_replace("/([^\s][\s]+)[^\s]*\n?$/" . $u, "\\1", $long);
399
+		$texte = preg_replace("/([^\s][\s]+)[^\s]*\n?$/".$u, "\\1", $long);
400 400
 		// encore trop court ? couper au caractere
401 401
 		if (spip_strlen($texte) < 0.75 * $taille) {
402 402
 			$texte = $long;
@@ -416,7 +416,7 @@  discard block
 block discarded – undo
416 416
 	// supprimer l'eventuelle entite finale mal coupee
417 417
 	$texte = preg_replace('/&#?[a-z0-9]*$/S', '', $texte);
418 418
 
419
-	return quote_amp(trim($texte)) . $points;
419
+	return quote_amp(trim($texte)).$points;
420 420
 }
421 421
 
422 422
 
@@ -429,16 +429,16 @@  discard block
 block discarded – undo
429 429
 				define('_PROTEGE_JS_MODELES', creer_uniqid());
430 430
 			}
431 431
 			foreach ($r as $regs) {
432
-				$t = str_replace($regs[0], code_echappement($regs[0], 'javascript' . _PROTEGE_JS_MODELES), $t);
432
+				$t = str_replace($regs[0], code_echappement($regs[0], 'javascript'._PROTEGE_JS_MODELES), $t);
433 433
 			}
434 434
 		}
435
-		if (preg_match_all(',<\?php.*?($|\?' . '>),isS', $t, $r, PREG_SET_ORDER)) {
435
+		if (preg_match_all(',<\?php.*?($|\?'.'>),isS', $t, $r, PREG_SET_ORDER)) {
436 436
 			if (!defined('_PROTEGE_PHP_MODELES')) {
437 437
 				include_spip('inc/acces');
438 438
 				define('_PROTEGE_PHP_MODELES', creer_uniqid());
439 439
 			}
440 440
 			foreach ($r as $regs) {
441
-				$t = str_replace($regs[0], code_echappement($regs[0], 'php' . _PROTEGE_PHP_MODELES), $t);
441
+				$t = str_replace($regs[0], code_echappement($regs[0], 'php'._PROTEGE_PHP_MODELES), $t);
442 442
 			}
443 443
 		}
444 444
 	}
@@ -473,7 +473,7 @@  discard block
 block discarded – undo
473 473
  * @param bool $strict
474 474
  * @return string
475 475
  */
476
-function echapper_html_suspect($texte, $strict=true) {
476
+function echapper_html_suspect($texte, $strict = true) {
477 477
 	static $echapper_html_suspect;
478 478
 	if (!$texte or !is_string($texte)) {
479 479
 		return $texte;
@@ -495,8 +495,8 @@  discard block
 block discarded – undo
495 495
 	// quand c'est du texte qui passe par propre on est plus coulant tant qu'il y a pas d'attribut du type onxxx=
496 496
 	// car sinon on declenche sur les modeles ou ressources
497 497
 	if (!$strict and
498
-	  (strpos($texte,'on') === false or !preg_match(",<\w+.*\bon\w+\s*=,UimsS", $texte))
499
-	  ){
498
+	  (strpos($texte, 'on') === false or !preg_match(",<\w+.*\bon\w+\s*=,UimsS", $texte))
499
+	  ) {
500 500
 		return $texte;
501 501
 	}
502 502
 
@@ -575,9 +575,9 @@  discard block
 block discarded – undo
575 575
  **/
576 576
 function supprime_img($letexte, $message = null) {
577 577
 	if ($message === null) {
578
-		$message = '(' . _T('img_indisponible') . ')';
578
+		$message = '('._T('img_indisponible').')';
579 579
 	}
580 580
 
581
-	return preg_replace(',<(img|doc|emb)([0-9]+)(\|([^>]*))?' . '\s*/?' . '>,i',
581
+	return preg_replace(',<(img|doc|emb)([0-9]+)(\|([^>]*))?'.'\s*/?'.'>,i',
582 582
 		$message, $letexte);
583 583
 }
Please login to merge, or discard this patch.