Completed
Push — master ( 1dde8c...5a052b )
by cam
01:06
created
ecrire/action/editer_logo.php 1 patch
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -81,14 +81,14 @@  discard block
 block discarded – undo
81 81
 	include_spip('inc/chercher_logo');
82 82
 
83 83
 	$mode = preg_replace(",\W,", '', $etat);
84
-	if (!$mode){
84
+	if (!$mode) {
85 85
 		spip_log("logo_modifier : etat $etat invalide", 'logo');
86 86
 		$erreur = 'etat invalide';
87 87
 
88 88
 		return $erreur;
89 89
 	}
90 90
 	// chercher dans la base
91
-	$mode_document = 'logo' . $mode;
91
+	$mode_document = 'logo'.$mode;
92 92
 
93 93
 	include_spip('inc/documents');
94 94
 	$erreur = '';
@@ -105,7 +105,7 @@  discard block
 block discarded – undo
105 105
 		$tmp_name = false;
106 106
 		if (file_exists($source)) {
107 107
 			$tmp_name = $source;
108
-		} elseif (file_exists($f = determine_upload() . $source)) {
108
+		} elseif (file_exists($f = determine_upload().$source)) {
109 109
 			$tmp_name = $f;
110 110
 		}
111 111
 		if (!$tmp_name) {
@@ -162,27 +162,27 @@  discard block
 block discarded – undo
162 162
 	$type = type_du_logo($_id_objet);
163 163
 
164 164
 	foreach (['on', 'off'] as $mode) {
165
-		$nom_base = $type . $mode;
165
+		$nom_base = $type.$mode;
166 166
 		$dir = (defined('_DIR_LOGOS') ? _DIR_LOGOS : _DIR_IMG);
167 167
 
168 168
 		$deja = array();
169
-		$files = glob($dir . $nom_base . "*");
169
+		$files = glob($dir.$nom_base."*");
170 170
 
171 171
 		foreach ($files as $file) {
172
-			$logo = substr($file, strlen($dir . $nom_base));
172
+			$logo = substr($file, strlen($dir.$nom_base));
173 173
 			$logo = explode('.', $logo);
174 174
 			if (is_numeric($logo[0])
175 175
 			  and ($id_objet = intval($logo[0]) or in_array($objet, ['site', 'rubrique']))) {
176 176
 				if (!isset($deja[$id_objet])) {
177 177
 					$logo = $chercher_logo($id_objet, $_id_objet, $mode);
178 178
 					// if no logo in base
179
-					if (!$logo or count($logo)<6) {
179
+					if (!$logo or count($logo) < 6) {
180 180
 						foreach ($formats_logos as $format) {
181
-							if (@file_exists($d = ($dir . ($nom = $nom_base . intval($id_objet) . '.' . $format)))) {
181
+							if (@file_exists($d = ($dir.($nom = $nom_base.intval($id_objet).'.'.$format)))) {
182 182
 								// logo_modifier commence par supprimer le logo existant, donc on le deplace pour pas le perdre
183
-								@rename($d, $dir_logos . $nom);
183
+								@rename($d, $dir_logos.$nom);
184 184
 								// et on le declare comme nouveau logo
185
-								logo_modifier($objet, $id_objet, $mode, $dir_logos . $nom);
185
+								logo_modifier($objet, $id_objet, $mode, $dir_logos.$nom);
186 186
 								break;
187 187
 							}
188 188
 						}
@@ -192,7 +192,7 @@  discard block
 block discarded – undo
192 192
 			}
193 193
 			// si le fichier est encore la on le move : rien a faire ici
194 194
 			if (file_exists($file)) {
195
-				@rename($file, $dir_logos_erreurs . basename($file));
195
+				@rename($file, $dir_logos_erreurs.basename($file));
196 196
 			}
197 197
 
198 198
 			if ($time_limit and time() > $time_limit) {
Please login to merge, or discard this patch.
ecrire/inc/rubriques.php 1 patch
Spacing   +34 added lines, -34 removed lines patch added patch discarded remove patch
@@ -105,8 +105,8 @@  discard block
 block discarded – undo
105 105
 	$id_pred = $id_rubrique;
106 106
 	while (true) {
107 107
 		sql_updateq('spip_rubriques', array('statut' => 'publie', 'date' => date('Y-m-d H:i:s')),
108
-			"id_rubrique=" . intval($id_rubrique));
109
-		$id_parent = sql_getfetsel('id_parent', 'spip_rubriques AS R', "R.id_rubrique=" . intval($id_rubrique));
108
+			"id_rubrique=".intval($id_rubrique));
109
+		$id_parent = sql_getfetsel('id_parent', 'spip_rubriques AS R', "R.id_rubrique=".intval($id_rubrique));
110 110
 		if (!$id_parent) {
111 111
 			break;
112 112
 		}
@@ -142,7 +142,7 @@  discard block
 block discarded – undo
142 142
 			return $id_pred != $id_rubrique;
143 143
 		}
144 144
 		// passer au parent si on a depublie
145
-		$r = sql_fetsel("id_parent", "spip_rubriques", "id_rubrique=" . intval($id_pred));
145
+		$r = sql_fetsel("id_parent", "spip_rubriques", "id_rubrique=".intval($id_pred));
146 146
 		$id_pred = $r['id_parent'];
147 147
 	}
148 148
 
@@ -167,14 +167,14 @@  discard block
 block discarded – undo
167 167
 		$date = date('Y-m-d H:i:s');
168 168
 	}
169 169
 	$postdates = ($GLOBALS['meta']["post_dates"] == "non") ?
170
-		" AND date <= " . sql_quote($date) : '';
170
+		" AND date <= ".sql_quote($date) : '';
171 171
 
172 172
 	if (!$id_rubrique = intval($id_rubrique)) {
173 173
 		return false;
174 174
 	}
175 175
 
176 176
 	// verifier qu'elle existe et est bien publiee
177
-	$r = sql_fetsel('id_rubrique,statut', 'spip_rubriques', "id_rubrique=" . intval($id_rubrique));
177
+	$r = sql_fetsel('id_rubrique,statut', 'spip_rubriques', "id_rubrique=".intval($id_rubrique));
178 178
 	if (!$r or $r['statut'] !== 'publie') {
179 179
 		return false;
180 180
 	}
@@ -183,11 +183,11 @@  discard block
 block discarded – undo
183 183
 	// Le type de l'objet est au pluriel
184 184
 	$compte = array(
185 185
 		'articles' => sql_countsel("spip_articles",
186
-			"id_rubrique=" . intval($id_rubrique) . " AND statut='publie'$postdates"),
187
-		'rubriques' => sql_countsel("spip_rubriques", "id_parent=" . intval($id_rubrique) . " AND statut='publie'"),
186
+			"id_rubrique=".intval($id_rubrique)." AND statut='publie'$postdates"),
187
+		'rubriques' => sql_countsel("spip_rubriques", "id_parent=".intval($id_rubrique)." AND statut='publie'"),
188 188
 		'documents' => sql_countsel(
189 189
 			"spip_documents AS D JOIN spip_documents_liens AS L ON D.id_document=L.id_document", 
190
-			"L.id_objet=" . intval($id_rubrique) . " AND L.objet='rubrique' and D.mode NOT IN('logoon', 'logooff') ")
190
+			"L.id_objet=".intval($id_rubrique)." AND L.objet='rubrique' and D.mode NOT IN('logoon', 'logooff') ")
191 191
 	);
192 192
 
193 193
 	// On passe le tableau des comptes dans un pipeline pour que les plugins puissent ajouter (ou retirer) des enfants
@@ -210,7 +210,7 @@  discard block
 block discarded – undo
210 210
 		}
211 211
 	}
212 212
 
213
-	sql_updateq("spip_rubriques", array("statut" => 'prepa'), "id_rubrique=" . intval($id_rubrique));
213
+	sql_updateq("spip_rubriques", array("statut" => 'prepa'), "id_rubrique=".intval($id_rubrique));
214 214
 
215 215
 #		spip_log("depublier_rubrique $id_pred");
216 216
 	return true;
@@ -273,7 +273,7 @@  discard block
 block discarded – undo
273 273
 
274 274
 	// Afficher les articles post-dates ?
275 275
 	$postdates = ($GLOBALS['meta']["post_dates"] == "non") ?
276
-		"AND A.date <= " . sql_quote(date('Y-m-d H:i:s')) : '';
276
+		"AND A.date <= ".sql_quote(date('Y-m-d H:i:s')) : '';
277 277
 
278 278
 	$r = sql_select(
279 279
 		"R.id_rubrique AS id, max(A.date) AS date_h",
@@ -281,7 +281,7 @@  discard block
 block discarded – undo
281 281
 		"A.date>R.date_tmp AND A.statut='publie' $postdates ", "R.id_rubrique");
282 282
 	while ($row = sql_fetch($r)) {
283 283
 		sql_updateq("spip_rubriques", array("statut_tmp" => 'publie', "date_tmp" => $row['date_h']),
284
-			"id_rubrique=" . intval($row['id']));
284
+			"id_rubrique=".intval($row['id']));
285 285
 	}
286 286
 
287 287
 	// point d'entree pour permettre a des plugins de gerer le statut
@@ -302,7 +302,7 @@  discard block
 block discarded – undo
302 302
 			"(SR.date_tmp>R.date_tmp OR R.statut_tmp<>'publie') AND SR.statut_tmp='publie' ", "R.id_rubrique");
303 303
 		while ($row = sql_fetch($r)) {
304 304
 			sql_updateq('spip_rubriques', array('statut_tmp' => 'publie', 'date_tmp' => $row['date_h']),
305
-				"id_rubrique=" . intval($row['id']));
305
+				"id_rubrique=".intval($row['id']));
306 306
 			$continuer = true;
307 307
 		}
308 308
 	} while ($continuer);
@@ -353,7 +353,7 @@  discard block
 block discarded – undo
353 353
 			and $rows = sql_allfetsel(
354 354
 				"A.id_rubrique AS id, R.id_secteur AS id_secteur, R.profondeur+1 as profondeur",
355 355
 				"spip_rubriques AS A JOIN spip_rubriques AS R ON A.id_parent = R.id_rubrique",
356
-				"R.profondeur=" . intval($prof) . " AND (A.id_secteur <> R.id_secteur OR A.profondeur > R.profondeur+1)",
356
+				"R.profondeur=".intval($prof)." AND (A.id_secteur <> R.id_secteur OR A.profondeur > R.profondeur+1)",
357 357
 				"", "R.id_secteur", "0,100")) {
358 358
 
359 359
 			$id_secteur = null;
@@ -382,8 +382,8 @@  discard block
 block discarded – undo
382 382
 			and $rows = sql_allfetsel(
383 383
 				"id_rubrique as id",
384 384
 				"spip_rubriques",
385
-				"profondeur=" . intval($prof + 1) . " AND id_parent NOT IN (" . sql_get_select("zzz.id_rubrique",
386
-					"spip_rubriques AS zzz", "zzz.profondeur=" . intval($prof)) . ")", '', '', '0,100')) {
385
+				"profondeur=".intval($prof + 1)." AND id_parent NOT IN (".sql_get_select("zzz.id_rubrique",
386
+					"spip_rubriques AS zzz", "zzz.profondeur=".intval($prof)).")", '', '', '0,100')) {
387 387
 			$rows = array_column($rows, 'id');
388 388
 			sql_updateq("spip_rubriques", array('profondeur' => $prof + 2), sql_in("id_rubrique", $rows));
389 389
 		}
@@ -392,7 +392,7 @@  discard block
 block discarded – undo
392 392
 		// si pas de rubrique a profondeur $prof+1 pas la peine de continuer
393 393
 		// si il reste des rubriques non vues, c'est une branche morte ou reference circulaire (base foireuse)
394 394
 		// on arrete les frais
395
-		if (sql_countsel("spip_rubriques", "profondeur=" . intval($prof + 1))) {
395
+		if (sql_countsel("spip_rubriques", "profondeur=".intval($prof + 1))) {
396 396
 			$prof++;
397 397
 			$continuer = true;
398 398
 		}
@@ -400,10 +400,10 @@  discard block
 block discarded – undo
400 400
 
401 401
 	// loger si la table des rubriques semble foireuse
402 402
 	// et mettre un id_secteur=0 sur ces rubriques pour eviter toute selection par les boucles
403
-	if (sql_countsel("spip_rubriques", "profondeur>" . intval($prof + 1))) {
404
-		spip_log("Les rubriques de profondeur>" . ($prof + 1) . " semblent suspectes (branches morte ou reference circulaire dans les parents)",
403
+	if (sql_countsel("spip_rubriques", "profondeur>".intval($prof + 1))) {
404
+		spip_log("Les rubriques de profondeur>".($prof + 1)." semblent suspectes (branches morte ou reference circulaire dans les parents)",
405 405
 			_LOG_CRITIQUE);
406
-		sql_update("spip_rubriques", array('id_secteur' => 0), "profondeur>" . intval($prof + 1));
406
+		sql_update("spip_rubriques", array('id_secteur' => 0), "profondeur>".intval($prof + 1));
407 407
 	}
408 408
 
409 409
 	// reparer les articles
@@ -411,7 +411,7 @@  discard block
 block discarded – undo
411 411
 		"A.id_rubrique = R.id_rubrique AND A.id_secteur <> R.id_secteur");
412 412
 
413 413
 	while ($row = sql_fetch($r)) {
414
-		sql_update("spip_articles", array("id_secteur" => $row['secteur']), "id_article=" . intval($row['id']));
414
+		sql_update("spip_articles", array("id_secteur" => $row['secteur']), "id_article=".intval($row['id']));
415 415
 	}
416 416
 
417 417
 	// avertir les plugins qui peuvent faire leur mises a jour egalement
@@ -437,7 +437,7 @@  discard block
 block discarded – undo
437 437
 	while ($row = sql_fetch($s)) {
438 438
 		$id_rubrique = $row['id_rubrique'];
439 439
 		$t = sql_updateq('spip_rubriques', array('lang' => $row['lang'], 'langue_choisie' => 'non'),
440
-			"id_rubrique=" . intval($id_rubrique));
440
+			"id_rubrique=".intval($id_rubrique));
441 441
 	}
442 442
 
443 443
 	return $t;
@@ -473,7 +473,7 @@  discard block
 block discarded – undo
473 473
 	while ($row = sql_fetch($s)) {
474 474
 		$id_article = $row['id_article'];
475 475
 		sql_updateq('spip_articles', array("lang" => $row['lang'], 'langue_choisie' => 'non'),
476
-			"id_article=" . intval($id_article));
476
+			"id_article=".intval($id_article));
477 477
 	}
478 478
 
479 479
 	if ($GLOBALS['meta']['multi_rubriques'] == 'oui') {
@@ -545,11 +545,11 @@  discard block
 block discarded – undo
545 545
 				);
546 546
 				// generer un nom de fonction "anonyme" unique
547 547
 				do {
548
-					$functionname = 'f_calculer_langues_utilisees_' . $boucle->id_table . '_' . time() . '_' . rand();
548
+					$functionname = 'f_calculer_langues_utilisees_'.$boucle->id_table.'_'.time().'_'.rand();
549 549
 				} while (function_exists($functionname));
550 550
 				$code = calculer_boucle('calculer_langues_utilisees', $boucles);
551
-				$code = '$SP=0; $command=array();$command["connect"] = $connect = "' . $serveur . '"; $Pile=array(0=>array());' . "\n" . $code;
552
-				$code = 'function ' . $functionname . '(){' . $code . '};$res = ' . $functionname . '();';
551
+				$code = '$SP=0; $command=array();$command["connect"] = $connect = "'.$serveur.'"; $Pile=array(0=>array());'."\n".$code;
552
+				$code = 'function '.$functionname.'(){'.$code.'};$res = '.$functionname.'();';
553 553
 				$res = '';
554 554
 				eval($code);
555 555
 				$res = explode(',', $res);
@@ -663,10 +663,10 @@  discard block
 block discarded – undo
663 663
 	while ($maxiter-- and $filles = sql_allfetsel(
664 664
 			'id_rubrique',
665 665
 			'spip_rubriques',
666
-			sql_in('id_parent', $r) . " AND " . sql_in('id_rubrique', $r, 'NOT')
666
+			sql_in('id_parent', $r)." AND ".sql_in('id_rubrique', $r, 'NOT')
667 667
 		)) {
668 668
 		$r = join(',', array_column($filles, 'id_rubrique'));
669
-		$branche .= ',' . $r;
669
+		$branche .= ','.$r;
670 670
 	}
671 671
 
672 672
 	# securite pour ne pas plomber la conso memoire sur les sites prolifiques
@@ -706,7 +706,7 @@  discard block
 block discarded – undo
706 706
 
707 707
 	if (isset($b[$id])) {
708 708
 		// Notre branche commence par la rubrique de depart si $tout=true
709
-		return $tout ? (strlen($b[$id]) ? $b[$id] . ",$id" : $id) : $b[$id];
709
+		return $tout ? (strlen($b[$id]) ? $b[$id].",$id" : $id) : $b[$id];
710 710
 	}
711 711
 
712 712
 	$hier = "";
@@ -718,10 +718,10 @@  discard block
 block discarded – undo
718 718
 	while ($maxiter-- and $parents = sql_allfetsel(
719 719
 			'id_parent',
720 720
 			'spip_rubriques',
721
-			sql_in('id_rubrique', $ids_nouveaux_parents) . " AND " . sql_in('id_parent', $hier, 'NOT')
721
+			sql_in('id_rubrique', $ids_nouveaux_parents)." AND ".sql_in('id_parent', $hier, 'NOT')
722 722
 		)) {
723 723
 		$ids_nouveaux_parents = join(',', array_column($parents, 'id_parent'));
724
-		$hier = $ids_nouveaux_parents . (strlen($hier) ? ',' . $hier : '');
724
+		$hier = $ids_nouveaux_parents.(strlen($hier) ? ','.$hier : '');
725 725
 	}
726 726
 
727 727
 	# securite pour ne pas plomber la conso memoire sur les sites prolifiques
@@ -753,7 +753,7 @@  discard block
 block discarded – undo
753 753
 	include_spip('base/abstract_sql');
754 754
 	if ($check) {
755 755
 		$postdates = ($GLOBALS['meta']["post_dates"] == "non") ?
756
-			"AND A.date <= " . sql_quote(date('Y-m-d H:i:s')) : '';
756
+			"AND A.date <= ".sql_quote(date('Y-m-d H:i:s')) : '';
757 757
 
758 758
 		$r = sql_select("DISTINCT A.id_rubrique AS id",
759 759
 			"spip_articles AS A LEFT JOIN spip_rubriques AS R ON A.id_rubrique=R.id_rubrique",
@@ -765,7 +765,7 @@  discard block
 block discarded – undo
765 765
 		pipeline('trig_calculer_prochain_postdate', '');
766 766
 	}
767 767
 
768
-	$t = sql_fetsel("date", "spip_articles", "statut='publie' AND date > " . sql_quote(date('Y-m-d H:i:s')), "", "date",
768
+	$t = sql_fetsel("date", "spip_articles", "statut='publie' AND date > ".sql_quote(date('Y-m-d H:i:s')), "", "date",
769 769
 		"1");
770 770
 
771 771
 	if ($t) {
@@ -815,7 +815,7 @@  discard block
 block discarded – undo
815 815
 		// retablir les </multi> et autres balises fermantes html
816 816
 		$titre = preg_replace(",<@([a-z][^>]*)>,ims", "</\\1>", $titre);
817 817
 		$r = sql_getfetsel("id_rubrique", "spip_rubriques",
818
-			"titre = " . sql_quote($titre) . " AND id_parent=" . intval($id_parent),
818
+			"titre = ".sql_quote($titre)." AND id_parent=".intval($id_parent),
819 819
 			$groupby = array(), $orderby = array(), $limit = '', $having = array(), $serveur);
820 820
 		if ($r !== null) {
821 821
 			$id_parent = $r;
@@ -836,7 +836,7 @@  discard block
 block discarded – undo
836 836
 			}
837 837
 
838 838
 			sql_updateq('spip_rubriques', array('id_secteur' => $id_secteur, "lang" => $lang),
839
-				"id_rubrique=" . intval($id_rubrique), $desc = '', $serveur);
839
+				"id_rubrique=".intval($id_rubrique), $desc = '', $serveur);
840 840
 
841 841
 			// pour la recursion
842 842
 			$id_parent = $id_rubrique;
Please login to merge, or discard this patch.
ecrire/exec/403.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -37,7 +37,7 @@
 block discarded – undo
37 37
 		$message = _T('avis_acces_interdit_prive', array('exec' => _request('exec')));
38 38
 	}
39 39
 
40
-	$contenu = "<h1 class='grostitre'>" . _T('info_acces_interdit') . '</h1>' . $message;
40
+	$contenu = "<h1 class='grostitre'>"._T('info_acces_interdit').'</h1>'.$message;
41 41
 
42 42
 	if (_request('var_zajax')) {
43 43
 		include_spip('inc/actions');
Please login to merge, or discard this patch.
ecrire/inc/icone_renommer.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -46,12 +46,12 @@  discard block
 block discarded – undo
46 46
 
47 47
 	$dir = "images/";
48 48
 	$f = "$type-$size.png";
49
-	if ($icone = find_in_theme($dir . $f)) {
49
+	if ($icone = find_in_theme($dir.$f)) {
50 50
 		$dir = dirname($icone);
51 51
 		$fond = $icone;
52 52
 
53 53
 		if ($rtl
54
-			and $fr = $dir . '/' . str_replace("$type-", "$type-rtl-", basename($icone))
54
+			and $fr = $dir.'/'.str_replace("$type-", "$type-rtl-", basename($icone))
55 55
 			and file_exists($fr)
56 56
 		) {
57 57
 			$fond = $fr;
@@ -67,7 +67,7 @@  discard block
 block discarded – undo
67 67
 		}
68 68
 
69 69
 		$fonction = "";
70
-		if (in_array($action, array('add','del', 'new', 'edit', 'config'))) {
70
+		if (in_array($action, array('add', 'del', 'new', 'edit', 'config'))) {
71 71
 			$fonction = $action;
72 72
 		}
73 73
 
Please login to merge, or discard this patch.
ecrire/action/purger.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -61,7 +61,7 @@  discard block
 block discarded – undo
61 61
 			supprime_invalideurs();
62 62
 			@spip_unlink(_CACHE_RUBRIQUES);
63 63
 			@spip_unlink(_CACHE_CHEMIN);
64
-			@spip_unlink(_DIR_TMP . "plugin_xml_cache.gz");
64
+			@spip_unlink(_DIR_TMP."plugin_xml_cache.gz");
65 65
 			// on ne supprime que _CACHE_PLUGINS_OPT qui declenche la reconstruction des 3
66 66
 			// _CACHE_PIPELINES _CACHE_PLUGINS_PATH et _CACHE_PLUGINS_FCT
67 67
 			// pour eviter des problemes de concurence
@@ -72,8 +72,8 @@  discard block
 block discarded – undo
72 72
 			@spip_unlink(_CACHE_PLUGINS_OPT);
73 73
 			purger_repertoire(_DIR_CACHE, array('subdir' => true));
74 74
 			purger_repertoire(_DIR_AIDE);
75
-			purger_repertoire(_DIR_VAR . 'cache-css');
76
-			purger_repertoire(_DIR_VAR . 'cache-js');
75
+			purger_repertoire(_DIR_VAR.'cache-css');
76
+			purger_repertoire(_DIR_VAR.'cache-js');
77 77
 			break;
78 78
 
79 79
 		case 'squelettes':
@@ -81,10 +81,10 @@  discard block
 block discarded – undo
81 81
 			break;
82 82
 
83 83
 		case 'vignettes':
84
-			purger_repertoire(_DIR_VAR . 'cache-gd2', array('subdir' => true));
85
-			purger_repertoire(_DIR_VAR . 'cache-texte', array('subdir' => true));
86
-			purger_repertoire(_DIR_VAR . 'cache-vignettes', array('subdir' => true));
87
-			purger_repertoire(_DIR_VAR . 'cache-TeX', array('subdir' => true));
84
+			purger_repertoire(_DIR_VAR.'cache-gd2', array('subdir' => true));
85
+			purger_repertoire(_DIR_VAR.'cache-texte', array('subdir' => true));
86
+			purger_repertoire(_DIR_VAR.'cache-vignettes', array('subdir' => true));
87
+			purger_repertoire(_DIR_VAR.'cache-TeX', array('subdir' => true));
88 88
 			supprime_invalideurs();
89 89
 			purger_repertoire(_DIR_CACHE, array('subdir' => true));
90 90
 			break;
Please login to merge, or discard this patch.
ecrire/inc/svg.php 1 patch
Spacing   +40 added lines, -40 removed lines patch added patch discarded remove patch
@@ -22,7 +22,7 @@  discard block
 block discarded – undo
22 22
 
23 23
 if (!defined('IMG_SVG')) {
24 24
 	// complete 	IMG_BMP | IMG_GIF | IMG_JPG | IMG_PNG | IMG_WBMP | IMG_XPM | IMG_WEBP
25
-	define('IMG_SVG',128);
25
+	define('IMG_SVG', 128);
26 26
 	define('IMAGETYPE_SVG', 19);
27 27
 }
28 28
 
@@ -38,7 +38,7 @@  discard block
 block discarded – undo
38 38
  * @return bool|string
39 39
  *   false si on a pas pu charger l'image
40 40
  */
41
-function svg_charger($fichier, $maxlen=null) {
41
+function svg_charger($fichier, $maxlen = null) {
42 42
 	if (strpos($fichier, "data:image/svg+xml") === 0) {
43 43
 		$image = explode(";", $fichier, 2);
44 44
 		$image = end($image);
@@ -56,7 +56,7 @@  discard block
 block discarded – undo
56 56
 		return $fichier;
57 57
 	}
58 58
 	if (!file_exists($fichier)) {
59
-		$fichier  = supprimer_timestamp($fichier);
59
+		$fichier = supprimer_timestamp($fichier);
60 60
 		if (!file_exists($fichier)) {
61 61
 			return false;
62 62
 		}
@@ -65,7 +65,7 @@  discard block
 block discarded – undo
65 65
 		$image = file_get_contents($fichier);
66 66
 	}
67 67
 	else {
68
-		$image = file_get_contents($fichier, false,null,0, $maxlen);
68
+		$image = file_get_contents($fichier, false, null, 0, $maxlen);
69 69
 	}
70 70
 	// est-ce bien une image svg ?
71 71
 	if (strpos($image, "<svg") !== false) {
@@ -87,7 +87,7 @@  discard block
 block discarded – undo
87 87
 	if (($ps = stripos($debut_fichier, "<svg")) !== false) {
88 88
 
89 89
 		$pe = stripos($debut_fichier, ">", $ps);
90
-		$balise_svg = substr($debut_fichier, $ps, $pe - $ps +1);
90
+		$balise_svg = substr($debut_fichier, $ps, $pe - $ps + 1);
91 91
 
92 92
 		if (preg_match_all(",([\w:\-]+)=,Uims", $balise_svg, $matches)) {
93 93
 			if (!function_exists('extraire_attribut')) {
@@ -127,29 +127,29 @@  discard block
 block discarded – undo
127 127
  * @return bool|float|int
128 128
  */
129 129
 function svg_dimension_to_pixels($dimension, $precision = 2) {
130
-	if (preg_match(',^(-?\d+(\.\d+)?)([^\d]*),i', trim($dimension), $m)){
130
+	if (preg_match(',^(-?\d+(\.\d+)?)([^\d]*),i', trim($dimension), $m)) {
131 131
 		switch (strtolower($m[2])) {
132 132
 			case '%':
133 133
 				// on ne sait pas faire :(
134 134
 				return false;
135 135
 				break;
136 136
 			case 'em':
137
-				return round($m[1]*16, $precision); // 16px font-size par defaut
137
+				return round($m[1] * 16, $precision); // 16px font-size par defaut
138 138
 				break;
139 139
 			case 'ex':
140
-				return round($m[1]*16, $precision); // 16px font-size par defaut
140
+				return round($m[1] * 16, $precision); // 16px font-size par defaut
141 141
 				break;
142 142
 			case 'pc':
143
-				return round($m[1]*16, $precision); // 1/6 inch = 96px/6 in CSS
143
+				return round($m[1] * 16, $precision); // 1/6 inch = 96px/6 in CSS
144 144
 				break;
145 145
 			case 'cm':
146
-				return round($m[1]*96/2.54, $precision); // 96px / 2.54cm;
146
+				return round($m[1] * 96 / 2.54, $precision); // 96px / 2.54cm;
147 147
 				break;
148 148
 			case 'mm':
149
-				return round($m[1]*96/25.4, $precision); // 96px / 25.4mm;
149
+				return round($m[1] * 96 / 25.4, $precision); // 96px / 25.4mm;
150 150
 				break;
151 151
 			case 'in':
152
-				return round($m[1]*96, $precision); // 1 inch = 96px in CSS
152
+				return round($m[1] * 96, $precision); // 1 inch = 96px in CSS
153 153
 				break;
154 154
 			case 'px':
155 155
 			case 'pt':
@@ -187,15 +187,15 @@  discard block
 block discarded – undo
187 187
  *   inserer au debut (true) ou a la fin (false)
188 188
  * @return string
189 189
  */
190
-function svg_insert_shapes($svg, $shapes, $start=true) {
190
+function svg_insert_shapes($svg, $shapes, $start = true) {
191 191
 
192 192
 	if ($start === false or $start === 'end') {
193
-		$svg = str_replace("</svg>", $shapes . "</svg>", $svg);
193
+		$svg = str_replace("</svg>", $shapes."</svg>", $svg);
194 194
 	}
195 195
 	else {
196 196
 		$p = stripos($svg, "<svg");
197 197
 		$p = strpos($svg, ">", $p);
198
-		$svg = substr_replace($svg, $shapes, $p+1, 0);
198
+		$svg = substr_replace($svg, $shapes, $p + 1, 0);
199 199
 	}
200 200
 	return $svg;
201 201
 }
@@ -211,10 +211,10 @@  discard block
 block discarded – undo
211 211
  */
212 212
 function svg_clip_in_box($svg, $x, $y, $width, $height) {
213 213
 	$rect = "<rect x=\"$x\" y=\"$y\" width=\"$width\" height=\"$height\" />";
214
-	$id = 'clip-'.substr(md5($rect . strlen($svg)),0,8);
214
+	$id = 'clip-'.substr(md5($rect.strlen($svg)), 0, 8);
215 215
 	$clippath = "<clipPath id=\"$id\">$rect</clipPath>";
216 216
 	$g = "<g clip-path=\"url(#$id)\">";
217
-	$svg = svg_insert_shapes($svg, $clippath . $g);
217
+	$svg = svg_insert_shapes($svg, $clippath.$g);
218 218
 	$svg = svg_insert_shapes($svg, "</g>", false);
219 219
 	return $svg;
220 220
 }
@@ -232,7 +232,7 @@  discard block
 block discarded – undo
232 232
 
233 233
 		list($balise_svg, $attributs) = $svg_infos;
234 234
 		if (!isset($attributs['viewBox'])) {
235
-			$attributs['viewBox'] = "0 0 " . $attributs['width'] . " " . $attributs['height'];
235
+			$attributs['viewBox'] = "0 0 ".$attributs['width']." ".$attributs['height'];
236 236
 		}
237 237
 		$attributs['width'] = strval($new_width);
238 238
 		$attributs['height'] = strval($new_height);
@@ -250,14 +250,14 @@  discard block
 block discarded – undo
250 250
  * @return string
251 251
  */
252 252
 function svg_couleur_to_hexa($couleur) {
253
-	if (strpos($couleur, "rgb(")===0) {
253
+	if (strpos($couleur, "rgb(") === 0) {
254 254
 		$c = explode(',', substr($couleur, 4));
255 255
 		$couleur = _couleur_dec_to_hex(intval($c[0]), intval($c[1]), intval($c[2]));
256 256
 	}
257 257
 	else {
258 258
 		$couleur = couleur_html_to_hex($couleur);
259 259
 	}
260
-	$couleur = '#'.ltrim($couleur,'#');
260
+	$couleur = '#'.ltrim($couleur, '#');
261 261
 	return $couleur;
262 262
 }
263 263
 
@@ -267,9 +267,9 @@  discard block
 block discarded – undo
267 267
  * @return array
268 268
  */
269 269
 function svg_couleur_to_rgb($couleur) {
270
-	if (strpos($couleur, "rgb(")===0) {
270
+	if (strpos($couleur, "rgb(") === 0) {
271 271
 		$c = explode(',', substr($couleur, 4));
272
-		return ['red' => intval($c[0]),'green' => intval($c[1]),'blue' => intval($c[2])];
272
+		return ['red' => intval($c[0]), 'green' => intval($c[1]), 'blue' => intval($c[2])];
273 273
 	}
274 274
 	return _couleur_hex_to_dec($couleur);
275 275
 }
@@ -357,7 +357,7 @@  discard block
 block discarded – undo
357 357
  */
358 358
 function svg_force_viewBox_px($img, $force_width_and_height = false) {
359 359
 	if ($svg = svg_charger($img)
360
-	  and $svg_infos = svg_lire_balise_svg($svg)){
360
+	  and $svg_infos = svg_lire_balise_svg($svg)) {
361 361
 
362 362
 		list($balise_svg, $attributs) = $svg_infos;
363 363
 
@@ -397,7 +397,7 @@  discard block
 block discarded – undo
397 397
  * @param $new_height
398 398
  * @return bool|string
399 399
  */
400
-function svg_recadrer($img, $new_width, $new_height, $offset_width, $offset_height, $background_color='') {
400
+function svg_recadrer($img, $new_width, $new_height, $offset_width, $offset_height, $background_color = '') {
401 401
 	if ($svg = svg_force_viewBox_px($img)
402 402
 	  and $svg_infos = svg_lire_balise_svg($svg)) {
403 403
 
@@ -423,7 +423,7 @@  discard block
 block discarded – undo
423 423
 			$viewport_oy = round($viewport_oy * $yscale, 2);
424 424
 		}
425 425
 
426
-		if ($viewport_w>$viewBox[2] or $viewport_h>$viewBox[3]) {
426
+		if ($viewport_w > $viewBox[2] or $viewport_h > $viewBox[3]) {
427 427
 			$svg = svg_clip_in_box($svg, $viewBox[0], $viewBox[1], $viewBox[2], $viewBox[3]);
428 428
 		}
429 429
 
@@ -440,7 +440,7 @@  discard block
 block discarded – undo
440 440
 		$svg = svg_change_balise_svg($svg, $balise_svg, $attributs);
441 441
 
442 442
 		// ajouter un background
443
-		if ($background_color and $background_color!=='transparent') {
443
+		if ($background_color and $background_color !== 'transparent') {
444 444
 			$svg = svg_ajouter_background($svg, $background_color);
445 445
 		}
446 446
 
@@ -458,9 +458,9 @@  discard block
 block discarded – undo
458 458
  */
459 459
 function svg_ajouter_background($img, $background_color) {
460 460
 	if ($svg = svg_charger($img)
461
-	  and $svg_infos = svg_lire_balise_svg($svg)){
461
+	  and $svg_infos = svg_lire_balise_svg($svg)) {
462 462
 
463
-		if ($background_color and $background_color!=='transparent') {
463
+		if ($background_color and $background_color !== 'transparent') {
464 464
 			list($balise_svg, $attributs) = $svg_infos;
465 465
 
466 466
 			$background_color = svg_couleur_to_hexa($background_color);
@@ -487,9 +487,9 @@  discard block
 block discarded – undo
487 487
  */
488 488
 function svg_ajouter_voile($img, $background_color, $opacity) {
489 489
 	if ($svg = svg_charger($img)
490
-	  and $svg_infos = svg_lire_balise_svg($svg)){
490
+	  and $svg_infos = svg_lire_balise_svg($svg)) {
491 491
 
492
-		if ($background_color and $background_color!=='transparent') {
492
+		if ($background_color and $background_color !== 'transparent') {
493 493
 			list($balise_svg, $attributs) = $svg_infos;
494 494
 
495 495
 			$background_color = svg_couleur_to_hexa($background_color);
@@ -516,10 +516,10 @@  discard block
 block discarded – undo
516 516
  */
517 517
 function svg_transformer($img, $attributs) {
518 518
 	if ($svg = svg_charger($img)
519
-	  and $svg_infos = svg_lire_balise_svg($svg)){
519
+	  and $svg_infos = svg_lire_balise_svg($svg)) {
520 520
 
521 521
 		if ($attributs) {
522
-			list($balise_svg, ) = $svg_infos;
522
+			list($balise_svg,) = $svg_infos;
523 523
 			$g = "<g";
524 524
 			foreach ($attributs as $k=>$v) {
525 525
 				if (strlen($v)) {
@@ -546,14 +546,14 @@  discard block
 block discarded – undo
546 546
  */
547 547
 function svg_apply_filter($img, $filter_def) {
548 548
 	if ($svg = svg_charger($img)
549
-	  and $svg_infos = svg_lire_balise_svg($svg)){
549
+	  and $svg_infos = svg_lire_balise_svg($svg)) {
550 550
 
551 551
 		if ($filter_def) {
552
-			list($balise_svg, ) = $svg_infos;
553
-			$filter_id = "filter-". substr(md5($filter_def . strlen($svg)), 0, 8);
552
+			list($balise_svg,) = $svg_infos;
553
+			$filter_id = "filter-".substr(md5($filter_def.strlen($svg)), 0, 8);
554 554
 			$filter = "<defs><filter id=\"$filter_id\">$filter_def</filter></defs>";
555 555
 			$g = "<g filter=\"url(#$filter_id)\">";
556
-			$svg = svg_insert_shapes($svg, $filter . $g);
556
+			$svg = svg_insert_shapes($svg, $filter.$g);
557 557
 			$svg = svg_insert_shapes($svg, "</g>", false);
558 558
 		}
559 559
 		return $svg;
@@ -604,7 +604,7 @@  discard block
 block discarded – undo
604 604
  */
605 605
 function svg_flip($img, $HorV) {
606 606
 	if ($svg = svg_force_viewBox_px($img)
607
-	  and $svg_infos = svg_lire_balise_svg($svg)){
607
+	  and $svg_infos = svg_lire_balise_svg($svg)) {
608 608
 
609 609
 		list($balise_svg, $atts) = $svg_infos;
610 610
 		$viewBox = explode(' ', $atts['viewBox']);
@@ -612,14 +612,14 @@  discard block
 block discarded – undo
612 612
 		if (!in_array($HorV, ['h', 'H'])) {
613 613
 			$transform = "scale(-1,1)";
614 614
 
615
-			$x = intval($viewBox[0]) + intval($viewBox[2]/2);
615
+			$x = intval($viewBox[0]) + intval($viewBox[2] / 2);
616 616
 			$mx = -$x;
617 617
 			$transform = "translate($x, 0) $transform translate($mx, 0)";
618 618
 		}
619 619
 		else {
620 620
 			$transform = "scale(1,-1)";
621 621
 
622
-			$y = intval($viewBox[1]) + intval($viewBox[3]/2);
622
+			$y = intval($viewBox[1]) + intval($viewBox[3] / 2);
623 623
 			$my = -$y;
624 624
 			$transform = "translate(0, $y) $transform translate(0, $my)";
625 625
 		}
@@ -641,7 +641,7 @@  discard block
 block discarded – undo
641 641
  */
642 642
 function svg_rotate($img, $angle, $center_x, $center_y) {
643 643
 	if ($svg = svg_force_viewBox_px($img)
644
-		and $svg_infos = svg_lire_balise_svg($svg)){
644
+		and $svg_infos = svg_lire_balise_svg($svg)) {
645 645
 
646 646
 		list($balise_svg, $atts) = $svg_infos;
647 647
 		$viewBox = explode(' ', $atts['viewBox']);
Please login to merge, or discard this patch.
prive/formulaires/editer_liens.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -104,7 +104,7 @@  discard block
 block discarded – undo
104 104
 
105 105
 	// L'éditabilité :) est définie par un test permanent (par exemple "associermots") ET le 4ème argument
106 106
 	include_spip('inc/autoriser');
107
-	$editable = ($editable and autoriser('associer' . $table_source, $objet, $id_objet)
107
+	$editable = ($editable and autoriser('associer'.$table_source, $objet, $id_objet)
108 108
 		and autoriser('modifier', $objet, $id_objet));
109 109
 
110 110
 	if (!$editable and !count(objet_trouver_liens(
@@ -116,22 +116,22 @@  discard block
 block discarded – undo
116 116
 
117 117
 	// squelettes de vue et de d'association
118 118
 	// ils sont différents si des rôles sont définis.
119
-	$skel_vue = $table_source . '_lies';
120
-	$skel_ajout = $table_source . '_associer';
119
+	$skel_vue = $table_source.'_lies';
120
+	$skel_ajout = $table_source.'_associer';
121 121
 
122 122
 	// description des roles
123 123
 	include_spip('inc/roles');
124 124
 	if ($roles = roles_presents($objet_source, $objet)) {
125 125
 		// on demande de nouveaux squelettes en conséquence
126
-		$skel_vue = $table_source . '_roles_lies';
127
-		$skel_ajout = $table_source . '_roles_associer';
126
+		$skel_vue = $table_source.'_roles_lies';
127
+		$skel_ajout = $table_source.'_roles_associer';
128 128
 	}
129 129
 
130 130
 	$oups = _request('_oups');
131 131
 	if (unserialize(base64_decode($oups))) {
132 132
 		// on est bon, rien a faire
133 133
 	}
134
-	elseif(unserialize($oups)) {
134
+	elseif (unserialize($oups)) {
135 135
 		// il faut encoder
136 136
 		$oups = base64_encode($oups);
137 137
 	}
@@ -419,7 +419,7 @@  discard block
 block discarded – undo
419 419
 function lien_retrouver_qualif($objet_lien, $lien) {
420 420
 	// un role est défini dans la liaison
421 421
 	$defs = explode('-', $lien);
422
-	list($objet1, , $objet2, , $role) = array_pad($defs, 5, null);
422
+	list($objet1,, $objet2,, $role) = array_pad($defs, 5, null);
423 423
 	if ($objet_lien == $objet1) {
424 424
 		$colonne_role = roles_colonne($objet1, $objet2);
425 425
 	} else {
Please login to merge, or discard this patch.
prive/formulaires/traduire.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -60,7 +60,7 @@  discard block
 block discarded – undo
60 60
 		$id_parent = $valeurs['id_parent'];
61 61
 	}
62 62
 	if ($id_parent) {
63
-		$langue_parent = sql_getfetsel('lang', 'spip_rubriques', 'id_rubrique=' . intval($id_parent));
63
+		$langue_parent = sql_getfetsel('lang', 'spip_rubriques', 'id_rubrique='.intval($id_parent));
64 64
 	}
65 65
 
66 66
 	if (!$langue_parent) {
@@ -82,8 +82,8 @@  discard block
 block discarded – undo
82 82
 	$valeurs['_traduire'] = '';
83 83
 	if (isset($valeurs['id_trad'])) {
84 84
 		$valeurs['_traduire'] = ($traduire ? ' ' : '');
85
-		$valeurs['_vue_traductions'] = 'prive/objets/liste/' . (trouver_fond(
86
-			$f = table_objet($objet) . '-trad',
85
+		$valeurs['_vue_traductions'] = 'prive/objets/liste/'.(trouver_fond(
86
+			$f = table_objet($objet).'-trad',
87 87
 			'prive/objets/liste'
88 88
 		) ? $f : 'objets-trad');
89 89
 		// pour afficher la liste des trad sur la base de l'id_trad en base
@@ -128,11 +128,11 @@  discard block
 block discarded – undo
128 128
 		if (sql_getfetsel(
129 129
 			'id_trad',
130 130
 			$table_objet_sql,
131
-			"$_id_table_objet=" . intval($id_objet)
131
+			"$_id_table_objet=".intval($id_objet)
132 132
 		)) {
133 133
 			// ne devrait jamais arriver sauf concurence de saisie
134 134
 			$erreurs['id_trad'] = _L('Une traduction est deja referencee');
135
-		} elseif (!sql_getfetsel($_id_table_objet, $table_objet_sql, "$_id_table_objet=" . intval($id_trad))) {
135
+		} elseif (!sql_getfetsel($_id_table_objet, $table_objet_sql, "$_id_table_objet=".intval($id_trad))) {
136 136
 			$erreurs['id_trad'] = _L('Indiquez un contenu existant');
137 137
 		}
138 138
 	}
@@ -171,7 +171,7 @@  discard block
 block discarded – undo
171 171
 		) {
172 172
 			$table_objet_sql = table_objet_sql($objet);
173 173
 			$_id_table_objet = id_table_objet($objet);
174
-			if ($id_trad = sql_getfetsel('id_trad', $table_objet_sql, "$_id_table_objet=" . intval($id_objet))) {
174
+			if ($id_trad = sql_getfetsel('id_trad', $table_objet_sql, "$_id_table_objet=".intval($id_objet))) {
175 175
 				$referencer_traduction = charger_fonction('referencer_traduction', 'action');
176 176
 				$referencer_traduction($objet, $id_trad, $new_id_trad);
177 177
 			}
Please login to merge, or discard this patch.
ecrire/public/tracer.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -77,13 +77,13 @@  discard block
 block discarded – undo
77 77
 
78 78
 function chrono_requete($temps) {
79 79
 	$total = 0;
80
-	$hors = "<i>" . _T('zbug_hors_compilation') . "</i>";
80
+	$hors = "<i>"._T('zbug_hors_compilation')."</i>";
81 81
 	$t = $q = $n = $d = array();
82 82
 	// Totaliser les temps et completer le Explain
83 83
 	foreach ($temps as $key => $v) {
84 84
 		list($dt, $nb, $boucle, $query, $explain, $res, $contexte) = $v;
85 85
 		if (is_array($contexte)) {
86
-			$k = ($contexte[0] . " $boucle");
86
+			$k = ($contexte[0]." $boucle");
87 87
 			include_spip('public/compiler');
88 88
 			$env = reconstruire_contexte_compil($contexte);
89 89
 		} else {
@@ -128,7 +128,7 @@  discard block
 block discarded – undo
128 128
 	// Fabriquer les liens de navigations dans le tableau des temps
129 129
 	foreach ($temps as $k => $v) {
130 130
 		$titre = strip_tags($v[2]);
131
-		$href = quote_amp($GLOBALS['REQUEST_URI']) . "#req$i";
131
+		$href = quote_amp($GLOBALS['REQUEST_URI'])."#req$i";
132 132
 		$href = str_replace("\\'", '&#39;', $href);
133 133
 
134 134
 		if (!isset($t[$v[2]])) {
@@ -149,7 +149,7 @@  discard block
 block discarded – undo
149 149
 	unset($d['']);
150 150
 	// Fabriquer le tableau des liens de navigation dans le grand tableau
151 151
 	foreach ($d as $k => $v) {
152
-		$d[$k] = $n[$k] . "</td><td>$k</td><td class='time'>$v</td><td class='liste-reqs'>"
152
+		$d[$k] = $n[$k]."</td><td>$k</td><td class='time'>$v</td><td class='liste-reqs'>"
153 153
 			. join('', $t[$k]);
154 154
 	}
155 155
 
@@ -159,7 +159,7 @@  discard block
 block discarded – undo
159 159
 		. join("</td></tr>\n<tr><td>", $d)
160 160
 		. "</td></tr>\n"
161 161
 		. (# _request('var_mode_objet') ? '' :
162
-		("<tr><td>" . count($temps) . "</td><td>" . _T('info_total') . '</td><td class="time">' . $total . "</td><td></td></tr>"))
162
+		("<tr><td>".count($temps)."</td><td>"._T('info_total').'</td><td class="time">'.$total."</td><td></td></tr>"))
163 163
 	);
164 164
 
165 165
 	return array($temps, $navigation);
Please login to merge, or discard this patch.