Completed
Push — master ( 6c9939...4ccfda )
by cam
01:06
created
ecrire/inc/plonger.php 1 patch
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -35,9 +35,9 @@  discard block
 block discarded – undo
35 35
 	$res = sql_select(
36 36
 		'rub1.id_rubrique, rub1.titre, rub1.id_parent, rub1.lang, rub1.langue_choisie, rub2.id_rubrique AS id_enfant',
37 37
 		'spip_rubriques AS rub1 LEFT JOIN spip_rubriques AS rub2 ON (rub1.id_rubrique = rub2.id_parent)',
38
-		'rub1.id_parent = ' . sql_quote($id_rubrique) . '
39
-			AND rub1.id_rubrique!=' . sql_quote($exclu) . '
40
-			AND (rub2.id_rubrique IS NULL OR rub2.id_rubrique!=' . sql_quote($exclu) . ')',
38
+		'rub1.id_parent = '.sql_quote($id_rubrique).'
39
+			AND rub1.id_rubrique!=' . sql_quote($exclu).'
40
+			AND (rub2.id_rubrique IS NULL OR rub2.id_rubrique!=' . sql_quote($exclu).')',
41 41
 		'',
42 42
 		'0+rub1.titre,rub1.titre'
43 43
 	);
@@ -50,7 +50,7 @@  discard block
 block discarded – undo
50 50
 				if ($row['langue_choisie'] != 'oui') {
51 51
 					$t .= ' <small title="'
52 52
 						. traduire_nom_langue($row['lang'])
53
-						. '">[' . $row['lang'] . ']</small>';
53
+						. '">['.$row['lang'].']</small>';
54 54
 				}
55 55
 				$ordre[$row['id_rubrique']] = $t;
56 56
 			}
@@ -58,14 +58,14 @@  discard block
 block discarded – undo
58 58
 	}
59 59
 	$next = $list[$col] ?? 0;
60 60
 	if ($ordre) {
61
-		$rec = generer_url_ecrire('plonger', "rac=$idom&exclus=$exclu&do=$do&col=" . ($col + 1));
61
+		$rec = generer_url_ecrire('plonger', "rac=$idom&exclus=$exclu&do=$do&col=".($col + 1));
62 62
 		$info = generer_url_ecrire('informer', "type=rubrique&rac=$idom&do=$do&id=");
63
-		$args = "'$idom',this,$col,'" . $GLOBALS['spip_lang_left'] . "','$info',event";
63
+		$args = "'$idom',this,$col,'".$GLOBALS['spip_lang_left']."','$info',event";
64 64
 
65 65
 		foreach ($ordre as $id => $titrebrut) {
66 66
 			$titre = supprimer_numero($titrebrut);
67 67
 
68
-			$classe1 = 'petit-item ' . ($id_rubrique ? 'petite-rubrique' : 'petit-secteur');
68
+			$classe1 = 'petit-item '.($id_rubrique ? 'petite-rubrique' : 'petit-secteur');
69 69
 			if (isset($rub[$id]['enfants'])) {
70 70
 				$classe2 = " class='rub-ouverte'";
71 71
 				$url = "\nhref='$rec&amp;id=$id'";
@@ -74,7 +74,7 @@  discard block
 block discarded – undo
74 74
 				$url = "\nhref='javascript:void(0)'";
75 75
 			}
76 76
 
77
-			$js_func = $do . '_selection_titre';
77
+			$js_func = $do.'_selection_titre';
78 78
 			$click = "\nonclick=\"changerhighlight(this.parentNode.parentNode.parentNode);\nreturn "
79 79
 				. (!is_array($list) ? ' false'
80 80
 					: "aff_selection_provisoire($id,$args)")
@@ -101,17 +101,17 @@  discard block
 block discarded – undo
101 101
 		}
102 102
 	}
103 103
 
104
-	$idom2 = $idom . '_col_' . ($col + 1);
104
+	$idom2 = $idom.'_col_'.($col + 1);
105 105
 	$left = ($col * 250);
106 106
 
107 107
 	return http_img_pack(
108 108
 		'loader.svg',
109 109
 		'',
110
-		"class='loader' style='visibility: hidden; position: absolute; " . $GLOBALS['spip_lang_left'] . ': '
110
+		"class='loader' style='visibility: hidden; position: absolute; ".$GLOBALS['spip_lang_left'].': '
111 111
 		. ($left - 30)
112 112
 		. "px; top: 2px; z-index: 2;' id='img_$idom2'"
113 113
 	)
114
-	. "<div style='width: 250px; height: 100%; overflow: auto; position: absolute; top: 0px; " . $GLOBALS['spip_lang_left'] . ': '
114
+	. "<div style='width: 250px; height: 100%; overflow: auto; position: absolute; top: 0px; ".$GLOBALS['spip_lang_left'].': '
115 115
 	. ($left - 250)
116 116
 	. "px;'>"
117 117
 	. $ret
Please login to merge, or discard this patch.
ecrire/inc/texte.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -105,12 +105,12 @@  discard block
 block discarded – undo
105 105
 	foreach (['script', 'iframe'] as $tag) {
106 106
 		if (
107 107
 			stripos($t, (string) "<$tag") !== false
108
-			and preg_match_all(',<' . $tag . '.*?($|</' . $tag . '.),isS', $t, $r, PREG_SET_ORDER)
108
+			and preg_match_all(',<'.$tag.'.*?($|</'.$tag.'.),isS', $t, $r, PREG_SET_ORDER)
109 109
 		) {
110 110
 			foreach ($r as $regs) {
111 111
 				$t = str_replace(
112 112
 					$regs[0],
113
-					"<code$class>" . nl2br(spip_htmlspecialchars($regs[0])) . '</code>',
113
+					"<code$class>".nl2br(spip_htmlspecialchars($regs[0])).'</code>',
114 114
 					$t
115 115
 				);
116 116
 			}
@@ -163,10 +163,10 @@  discard block
 block discarded – undo
163 163
 	}
164 164
 
165 165
 	// echapper les tags asp/php
166
-	$t = str_replace('<' . '%', '&lt;%', $arg);
166
+	$t = str_replace('<'.'%', '&lt;%', $arg);
167 167
 
168 168
 	// echapper le php
169
-	$t = str_replace('<' . '?', '&lt;?', $t);
169
+	$t = str_replace('<'.'?', '&lt;?', $t);
170 170
 
171 171
 	// echapper le < script language=php >
172 172
 	$t = preg_replace(',<(script\b[^>]+\blanguage\b[^\w>]+php\b),UimsS', '&lt;\1', $t);
@@ -188,10 +188,10 @@  discard block
 block discarded – undo
188 188
 
189 189
 	// Reinserer les echappements des modeles
190 190
 	if (defined('_PROTEGE_JS_MODELES')) {
191
-		$t = echappe_retour($t, 'javascript' . _PROTEGE_JS_MODELES);
191
+		$t = echappe_retour($t, 'javascript'._PROTEGE_JS_MODELES);
192 192
 	}
193 193
 	if (defined('_PROTEGE_PHP_MODELES')) {
194
-		$t = echappe_retour($t, 'php' . _PROTEGE_PHP_MODELES);
194
+		$t = echappe_retour($t, 'php'._PROTEGE_PHP_MODELES);
195 195
 	}
196 196
 
197 197
 	return $dejavu[$mode_filtre][$arg] = $t;
@@ -289,7 +289,7 @@  discard block
 block discarded – undo
289 289
 define('_TYPO_PROTEGER', "!':;?~%-");
290 290
 define('_TYPO_PROTECTEUR', "\x1\x2\x3\x4\x5\x6\x7\x8");
291 291
 
292
-define('_TYPO_BALISE', ',</?[a-z!][^<>]*[' . preg_quote(_TYPO_PROTEGER) . '][^<>]*>,imsS');
292
+define('_TYPO_BALISE', ',</?[a-z!][^<>]*['.preg_quote(_TYPO_PROTEGER).'][^<>]*>,imsS');
293 293
 
294 294
 /**
295 295
  * Corrige la typographie
Please login to merge, or discard this patch.
ecrire/inc/queue.php 1 patch
Spacing   +38 added lines, -40 removed lines patch added patch discarded remove patch
@@ -70,7 +70,7 @@  discard block
 block discarded – undo
70 70
 	$md5args = md5($arguments);
71 71
 
72 72
 	// si pas de date programee, des que possible
73
-	$duplicate_where = 'status=' . intval(_JQ_SCHEDULED) . ' AND ';
73
+	$duplicate_where = 'status='.intval(_JQ_SCHEDULED).' AND ';
74 74
 	if (!$time) {
75 75
 		$time = time();
76 76
 		$duplicate_where = ''; // ne pas dupliquer si deja le meme job en cours d'execution
@@ -96,9 +96,8 @@  discard block
 block discarded – undo
96 96
 			'id_job',
97 97
 			'spip_jobs',
98 98
 			$duplicate_where =
99
-				$duplicate_where . 'fonction=' . sql_quote($function)
100
-				. (($no_duplicate === 'function_only') ? '' :
101
-			' AND md5args=' . sql_quote($md5args) . ' AND inclure=' . sql_quote($file))
99
+				$duplicate_where.'fonction='.sql_quote($function)
100
+				. (($no_duplicate === 'function_only') ? '' : ' AND md5args='.sql_quote($md5args).' AND inclure='.sql_quote($file))
102 101
 		)
103 102
 	) {
104 103
 		return $id_job;
@@ -111,9 +110,9 @@  discard block
 block discarded – undo
111 110
 	if (
112 111
 		$no_duplicate
113 112
 		and
114
-		$id_prev = sql_getfetsel('id_job', 'spip_jobs', 'id_job<' . intval($id_job) . " AND $duplicate_where")
113
+		$id_prev = sql_getfetsel('id_job', 'spip_jobs', 'id_job<'.intval($id_job)." AND $duplicate_where")
115 114
 	) {
116
-		sql_delete('spip_jobs', 'id_job=' . intval($id_job));
115
+		sql_delete('spip_jobs', 'id_job='.intval($id_job));
117 116
 
118 117
 		return $id_prev;
119 118
 	}
@@ -125,9 +124,9 @@  discard block
 block discarded – undo
125 124
 	// ie cas d'un char non acceptables sur certains type de champs
126 125
 	// qui coupe la valeur
127 126
 	if (defined('_JQ_INSERT_CHECK_ARGS') and $id_job) {
128
-		$args = sql_getfetsel('args', 'spip_jobs', 'id_job=' . intval($id_job));
127
+		$args = sql_getfetsel('args', 'spip_jobs', 'id_job='.intval($id_job));
129 128
 		if ($args !== $arguments) {
130
-			spip_log('arguments job errones / longueur ' . strlen($args) . ' vs ' . strlen($arguments) . ' / valeur : ' . var_export(
129
+			spip_log('arguments job errones / longueur '.strlen($args).' vs '.strlen($arguments).' / valeur : '.var_export(
131 130
 				$arguments,
132 131
 				true
133 132
 			), 'queue');
@@ -157,7 +156,7 @@  discard block
 block discarded – undo
157 156
 function queue_purger() {
158 157
 	include_spip('base/abstract_sql');
159 158
 	sql_delete('spip_jobs');
160
-	sql_delete('spip_jobs_liens', 'id_job NOT IN (' . sql_get_select('id_job', 'spip_jobs') . ')');
159
+	sql_delete('spip_jobs_liens', 'id_job NOT IN ('.sql_get_select('id_job', 'spip_jobs').')');
161 160
 	include_spip('inc/genie');
162 161
 	genie_queue_watch_dist();
163 162
 }
@@ -173,8 +172,8 @@  discard block
 block discarded – undo
173 172
 	include_spip('base/abstract_sql');
174 173
 
175 174
 	if (
176
-		$row = sql_fetsel('fonction,inclure,date', 'spip_jobs', 'id_job=' . intval($id_job))
177
-		and $res = sql_delete('spip_jobs', 'id_job=' . intval($id_job))
175
+		$row = sql_fetsel('fonction,inclure,date', 'spip_jobs', 'id_job='.intval($id_job))
176
+		and $res = sql_delete('spip_jobs', 'id_job='.intval($id_job))
178 177
 	) {
179 178
 		queue_unlink_job($id_job);
180 179
 		// est-ce une tache cron qu'il faut relancer ?
@@ -224,7 +223,7 @@  discard block
 block discarded – undo
224 223
  *  resultat du sql_delete
225 224
  */
226 225
 function queue_unlink_job($id_job) {
227
-	return sql_delete('spip_jobs_liens', 'id_job=' . intval($id_job));
226
+	return sql_delete('spip_jobs_liens', 'id_job='.intval($id_job));
228 227
 }
229 228
 
230 229
 /**
@@ -240,7 +239,7 @@  discard block
 block discarded – undo
240 239
 	// deserialiser les arguments
241 240
 	$args = unserialize($row['args']);
242 241
 	if ($args === false) {
243
-		spip_log('arguments job errones ' . var_export($row, true), 'queue');
242
+		spip_log('arguments job errones '.var_export($row, true), 'queue');
244 243
 		$args = [];
245 244
 	}
246 245
 
@@ -257,15 +256,14 @@  discard block
 block discarded – undo
257 256
 	}
258 257
 
259 258
 	if (!function_exists($fonction)) {
260
-		spip_log("fonction $fonction ($inclure) inexistante " . var_export($row, true), 'queue');
259
+		spip_log("fonction $fonction ($inclure) inexistante ".var_export($row, true), 'queue');
261 260
 
262 261
 		return false;
263 262
 	}
264 263
 
265
-	spip_log('queue [' . $row['id_job'] . "]: $fonction() start", 'queue');
264
+	spip_log('queue ['.$row['id_job']."]: $fonction() start", 'queue');
266 265
 	switch (is_countable($args) ? count($args) : 0) {
267
-		case 0:
268
-			$res = $fonction();
266
+		case 0 : $res = $fonction();
269 267
 			break;
270 268
 		case 1:
271 269
 			$res = $fonction($args[0]);
@@ -312,7 +310,7 @@  discard block
 block discarded – undo
312 310
 			# plus lent mais completement generique
313 311
 			$res = call_user_func_array($fonction, $args);
314 312
 	}
315
-	spip_log('queue [' . $row['id_job'] . "]: $fonction() end", 'queue');
313
+	spip_log('queue ['.$row['id_job']."]: $fonction() end", 'queue');
316 314
 
317 315
 	return $res;
318 316
 }
@@ -343,14 +341,14 @@  discard block
 block discarded – undo
343 341
 function queue_schedule($force_jobs = null) {
344 342
 	$time = time();
345 343
 	if (defined('_DEBUG_BLOCK_QUEUE')) {
346
-		spip_log('_DEBUG_BLOCK_QUEUE : schedule stop', 'jq' . _LOG_DEBUG);
344
+		spip_log('_DEBUG_BLOCK_QUEUE : schedule stop', 'jq'._LOG_DEBUG);
347 345
 
348 346
 		return;
349 347
 	}
350 348
 
351 349
 	// rien a faire si le prochain job est encore dans le futur
352 350
 	if (queue_sleep_time_to_next_job() > 0 and (!$force_jobs or !count($force_jobs))) {
353
-		spip_log('queue_sleep_time_to_next_job', 'jq' . _LOG_DEBUG);
351
+		spip_log('queue_sleep_time_to_next_job', 'jq'._LOG_DEBUG);
354 352
 
355 353
 		return;
356 354
 	}
@@ -371,7 +369,7 @@  discard block
 block discarded – undo
371 369
 	}
372 370
 	$end_time = $time + _JQ_MAX_JOBS_TIME_TO_EXECUTE;
373 371
 
374
-	spip_log("JQ schedule $time / $end_time", 'jq' . _LOG_DEBUG);
372
+	spip_log("JQ schedule $time / $end_time", 'jq'._LOG_DEBUG);
375 373
 
376 374
 	if (!defined('_JQ_MAX_JOBS_EXECUTE')) {
377 375
 		define('_JQ_MAX_JOBS_EXECUTE', 200);
@@ -385,19 +383,19 @@  discard block
 block discarded – undo
385 383
 	// lorsqu'un job cron n'a pas fini, sa priorite est descendue
386 384
 	// pour qu'il ne bloque pas les autres jobs en attente
387 385
 	if (is_array($force_jobs) and count($force_jobs)) {
388
-		$cond = 'status=' . intval(_JQ_SCHEDULED) . ' AND ' . sql_in('id_job', $force_jobs);
386
+		$cond = 'status='.intval(_JQ_SCHEDULED).' AND '.sql_in('id_job', $force_jobs);
389 387
 	} else {
390 388
 		$now = date('Y-m-d H:i:s', $time);
391
-		$cond = 'status=' . intval(_JQ_SCHEDULED) . ' AND date<=' . sql_quote($now);
389
+		$cond = 'status='.intval(_JQ_SCHEDULED).' AND date<='.sql_quote($now);
392 390
 	}
393 391
 
394 392
 	register_shutdown_function('queue_error_handler'); // recuperer les erreurs auant que possible
395
-	$res = sql_allfetsel('*', 'spip_jobs', $cond, '', 'priorite DESC,date', '0,' . (_JQ_MAX_JOBS_EXECUTE + 1));
393
+	$res = sql_allfetsel('*', 'spip_jobs', $cond, '', 'priorite DESC,date', '0,'.(_JQ_MAX_JOBS_EXECUTE + 1));
396 394
 	do {
397 395
 		if ($row = array_shift($res)) {
398 396
 			$nbj++;
399 397
 			// il faut un verrou, a base de sql_delete
400
-			if (sql_delete('spip_jobs', 'id_job=' . intval($row['id_job']) . ' AND status=' . intval(_JQ_SCHEDULED))) {
398
+			if (sql_delete('spip_jobs', 'id_job='.intval($row['id_job']).' AND status='.intval(_JQ_SCHEDULED))) {
401 399
 				#spip_log("JQ schedule job ".$nbj." OK",'jq');
402 400
 				// on reinsert dans la base aussitot avec un status=_JQ_PENDING
403 401
 				$row['status'] = _JQ_PENDING;
@@ -412,13 +410,13 @@  discard block
 block discarded – undo
412 410
 				queue_close_job($row, $time, $result);
413 411
 			}
414 412
 		}
415
-		spip_log('JQ schedule job end time ' . $time, 'jq' . _LOG_DEBUG);
413
+		spip_log('JQ schedule job end time '.$time, 'jq'._LOG_DEBUG);
416 414
 	} while ($nbj < _JQ_MAX_JOBS_EXECUTE and $row and $time < $end_time);
417
-	spip_log('JQ schedule end time ' . time(), 'jq' . _LOG_DEBUG);
415
+	spip_log('JQ schedule end time '.time(), 'jq'._LOG_DEBUG);
418 416
 
419 417
 	if ($row = array_shift($res)) {
420 418
 		queue_update_next_job_time(0); // on sait qu'il y a encore des jobs a lancer ASAP
421
-		spip_log('JQ encore !', 'jq' . _LOG_DEBUG);
419
+		spip_log('JQ encore !', 'jq'._LOG_DEBUG);
422 420
 	} else {
423 421
 		queue_update_next_job_time();
424 422
 	}
@@ -453,9 +451,9 @@  discard block
 block discarded – undo
453 451
 		}
454 452
 	}
455 453
 	// purger ses liens eventuels avec des objets
456
-	sql_delete('spip_jobs_liens', 'id_job=' . intval($row['id_job']));
454
+	sql_delete('spip_jobs_liens', 'id_job='.intval($row['id_job']));
457 455
 	// supprimer le job fini
458
-	sql_delete('spip_jobs', 'id_job=' . intval($row['id_job']));
456
+	sql_delete('spip_jobs', 'id_job='.intval($row['id_job']));
459 457
 }
460 458
 
461 459
 /**
@@ -528,18 +526,18 @@  discard block
 block discarded – undo
528 526
 	$res = sql_allfetsel(
529 527
 		'*',
530 528
 		'spip_jobs',
531
-		'status=' . intval(_JQ_PENDING) . ' AND date<' . sql_quote(date('Y-m-d H:i:s', $time - 180))
529
+		'status='.intval(_JQ_PENDING).' AND date<'.sql_quote(date('Y-m-d H:i:s', $time - 180))
532 530
 	);
533 531
 	if (is_array($res)) {
534 532
 		foreach ($res as $row) {
535 533
 			queue_close_job($row, $time);
536
-			spip_log('queue_close_job car _JQ_PENDING depuis +180s : ' . print_r($row, 1), 'job_mort' . _LOG_ERREUR);
534
+			spip_log('queue_close_job car _JQ_PENDING depuis +180s : '.print_r($row, 1), 'job_mort'._LOG_ERREUR);
537 535
 		}
538 536
 	}
539 537
 
540 538
 	// chercher la date du prochain job si pas connu
541 539
 	if (is_null($next) or is_null(queue_sleep_time_to_next_job())) {
542
-		$date = sql_getfetsel('date', 'spip_jobs', 'status=' . intval(_JQ_SCHEDULED), '', 'date', '0,1');
540
+		$date = sql_getfetsel('date', 'spip_jobs', 'status='.intval(_JQ_SCHEDULED), '', 'date', '0,1');
543 541
 		$next = strtotime($date);
544 542
 	}
545 543
 	if (!is_null($next_time)) {
@@ -552,7 +550,7 @@  discard block
 block discarded – undo
552 550
 		if (is_null($nb_jobs_scheduled)) {
553 551
 			$nb_jobs_scheduled = sql_countsel(
554 552
 				'spip_jobs',
555
-				'status=' . intval(_JQ_SCHEDULED) . ' AND date<' . sql_quote(date('Y-m-d H:i:s', $time))
553
+				'status='.intval(_JQ_SCHEDULED).' AND date<'.sql_quote(date('Y-m-d H:i:s', $time))
556 554
 			);
557 555
 		} elseif ($next <= $time) {
558 556
 			$nb_jobs_scheduled++;
@@ -621,7 +619,7 @@  discard block
 block discarded – undo
621 619
 	}
622 620
 
623 621
 	// ne pas relancer si on vient de lancer dans la meme seconde par un hit concurent
624
-	if (file_exists($lock = _DIR_TMP . 'cron.lock') and !(@filemtime($lock) < $_SERVER['REQUEST_TIME'])) {
622
+	if (file_exists($lock = _DIR_TMP.'cron.lock') and !(@filemtime($lock) < $_SERVER['REQUEST_TIME'])) {
625 623
 		return $texte;
626 624
 	}
627 625
 
@@ -693,7 +691,7 @@  discard block
 block discarded – undo
693 691
 				$port = 80;
694 692
 		}
695 693
 		$fp = @fsockopen(
696
-			$scheme . $parts['host'],
694
+			$scheme.$parts['host'],
697 695
 			$parts['port'] ?? $port,
698 696
 			$errno,
699 697
 			$errstr,
@@ -703,13 +701,13 @@  discard block
 block discarded – undo
703 701
 		if ($fp) {
704 702
 			$host_sent = $parts['host'];
705 703
 			if (isset($parts['port']) and $parts['port'] !== $port) {
706
-				$host_sent .= ':' . $parts['port'];
704
+				$host_sent .= ':'.$parts['port'];
707 705
 			}
708 706
 			$timeout = 200; // ms
709 707
 			stream_set_timeout($fp, 0, $timeout * 1000);
710
-			$query = $parts['path'] . ($parts['query'] ? '?' . $parts['query'] : '');
711
-			$out = 'GET ' . $query . " HTTP/1.1\r\n";
712
-			$out .= 'Host: ' . $host_sent . "\r\n";
708
+			$query = $parts['path'].($parts['query'] ? '?'.$parts['query'] : '');
709
+			$out = 'GET '.$query." HTTP/1.1\r\n";
710
+			$out .= 'Host: '.$host_sent."\r\n";
713 711
 			$out .= "Connection: Close\r\n\r\n";
714 712
 			fwrite($fp, $out);
715 713
 			spip_timer('read');
Please login to merge, or discard this patch.
ecrire/inc/filtres_alertes.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -51,8 +51,8 @@  discard block
 block discarded – undo
51 51
 	$_texte = ($_texte ?: "''");
52 52
 	$_titre = ($_titre ? ", $_titre" : ', null');
53 53
 	$_class = ($_class ? ", $_class" : ', null');
54
-	$_role  = ($_role  ? ", $_role"  : ', null');
55
-	$_id    = ($_id    ? ", $_id"    : ', null');
54
+	$_role  = ($_role ? ", $_role" : ', null');
55
+	$_id    = ($_id ? ", $_id" : ', null');
56 56
 
57 57
 	$f = chercher_filtre('message_alerte');
58 58
 	$p->code = "$f($_texte$_titre$_class$_role$_id)";
@@ -90,10 +90,10 @@  discard block
 block discarded – undo
90 90
 	$_class = interprete_argument_balise(2, $p);
91 91
 	$_role  = interprete_argument_balise(3, $p);
92 92
 	$_id    = interprete_argument_balise(4, $p);
93
-	$_titre = ($_titre ? "$_titre"   : 'null');
93
+	$_titre = ($_titre ? "$_titre" : 'null');
94 94
 	$_class = ($_class ? ", $_class" : ', null');
95
-	$_role  = ($_role  ? ", $_role"  : ', null');
96
-	$_id    = ($_id    ? ", $_id"    : ', null');
95
+	$_role  = ($_role ? ", $_role" : ', null');
96
+	$_id    = ($_id ? ", $_id" : ', null');
97 97
 
98 98
 	$f = chercher_filtre('message_alerte_ouvrir');
99 99
 	$p->code = "$f($_titre$_class$_role$_id)";
@@ -163,8 +163,8 @@  discard block
 block discarded – undo
163 163
 	$message_alerte_ouvrir = chercher_filtre('message_alerte_ouvrir');
164 164
 	$message_alerte_fermer = chercher_filtre('message_alerte_fermer');
165 165
 	$message =
166
-		$message_alerte_ouvrir($titre, $class, $role, $id) .
167
-		$texte .
166
+		$message_alerte_ouvrir($titre, $class, $role, $id).
167
+		$texte.
168 168
 		$message_alerte_fermer();
169 169
 
170 170
 	return $message;
@@ -213,7 +213,7 @@  discard block
 block discarded – undo
213 213
 	];
214 214
 	$type  = array_intersect(explode(' ', $class), $types);
215 215
 	$type  = reset($type);
216
-	$class = trim(str_replace($types, '', $class) . " $type");
216
+	$class = trim(str_replace($types, '', $class)." $type");
217 217
 
218 218
 	// Classes
219 219
 	$class_racine = 'msg-alert';
@@ -238,7 +238,7 @@  discard block
 block discarded – undo
238 238
 
239 239
 	// Attributs
240 240
 	$attr_role = ($role ? "role=\"$role\"" : '');
241
-	$attr_id   = ($id   ? "id=\"$id\"" : '');
241
+	$attr_id   = ($id ? "id=\"$id\"" : '');
242 242
 	$attr_data = ($type ? "data-alert=\"$type\"" : '');
243 243
 
244 244
 	$message =
Please login to merge, or discard this patch.
ecrire/inc/cvt_configurer.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -38,7 +38,7 @@  discard block
 block discarded – undo
38 38
 	) {
39 39
 		// Pour tous les formulaires CONFIGURER, ayant une fonction charger ou pas, on teste si autorisé
40 40
 		include_spip('inc/autoriser');
41
-		if (!autoriser('configurer', '_' . substr($form, 11))) {
41
+		if (!autoriser('configurer', '_'.substr($form, 11))) {
42 42
 			return false;
43 43
 		}
44 44
 
@@ -72,7 +72,7 @@  discard block
 block discarded – undo
72 72
 		and !charger_fonction('traiter', "formulaires/$form/", true) // sans fonction traiter()
73 73
 	) {
74 74
 		$trace = cvtconf_formulaires_configurer_enregistre($form, $flux['args']['args']);
75
-		$flux['data'] = ['message_ok' => _T('config_info_enregistree') . $trace, 'editable' => true];
75
+		$flux['data'] = ['message_ok' => _T('config_info_enregistree').$trace, 'editable' => true];
76 76
 	}
77 77
 
78 78
 	return $flux;
@@ -146,7 +146,7 @@  discard block
 block discarded – undo
146 146
 		$prefixe = $valeurs['_meta_prefixe'];
147 147
 	}
148 148
 	if (isset($valeurs['_meta_stockage'])) {
149
-		$stockage = $valeurs['_meta_stockage'] . '::';
149
+		$stockage = $valeurs['_meta_stockage'].'::';
150 150
 	}
151 151
 
152 152
 	// si on indique juste une table, il faut vider les autres proprietes
@@ -171,7 +171,7 @@  discard block
 block discarded – undo
171 171
 
172 172
 	// sinon cas analyse du squelette
173 173
 	if (
174
-		$f = find_in_path($form . '.' . _EXTENSION_SQUELETTES, 'formulaires/')
174
+		$f = find_in_path($form.'.'._EXTENSION_SQUELETTES, 'formulaires/')
175 175
 		and lire_fichier($f, $contenu)
176 176
 	) {
177 177
 		for ($i = 0; $i < 2; $i++) {
@@ -228,14 +228,14 @@  discard block
 block discarded – undo
228 228
 		lire_metas($table);
229 229
 	}
230 230
 
231
-	$prefixe = ($prefixe ? $prefixe . '_' : '');
231
+	$prefixe = ($prefixe ? $prefixe.'_' : '');
232 232
 	$table = ($table) ? "/$table/" : '';
233
-	$casier = ($casier) ? rtrim($casier, '/') . '/' : ''; // slash final, sinon rien
233
+	$casier = ($casier) ? rtrim($casier, '/').'/' : ''; // slash final, sinon rien
234 234
 
235 235
 	foreach ($store as $k => $v) {
236 236
 		ecrire_config("$stockage$table$prefixe$casier$k", $v);
237 237
 		if (_request('var_mode') == 'configurer' and autoriser('webmestre')) {
238
-			$trace .= "<br />table $table : " . $prefixe . $k . " = $v;";
238
+			$trace .= "<br />table $table : ".$prefixe.$k." = $v;";
239 239
 		}
240 240
 	}
241 241
 
@@ -252,7 +252,7 @@  discard block
 block discarded – undo
252 252
 	[$table, $casier, $prefixe, $stockage] = cvtconf_definir_configurer_conteneur($form, $valeurs);
253 253
 
254 254
 	$table = ($table) ? "/$table/" : '';
255
-	$prefixe = ($prefixe ? $prefixe . '_' : '');
255
+	$prefixe = ($prefixe ? $prefixe.'_' : '');
256 256
 	if ($casier) {
257 257
 		$meta = lire_config("$stockage$table$prefixe$casier");
258 258
 		$prefixe = '';
@@ -263,7 +263,7 @@  discard block
 block discarded – undo
263 263
 
264 264
 	foreach ($valeurs as $k => $v) {
265 265
 		if (substr($k, 0, 1) !== '_') {
266
-			$valeurs[$k] = ($meta[$prefixe . $k] ?? null);
266
+			$valeurs[$k] = ($meta[$prefixe.$k] ?? null);
267 267
 		}
268 268
 	}
269 269
 }
Please login to merge, or discard this patch.
ecrire/inc/distant.php 1 patch
Spacing   +60 added lines, -60 removed lines patch added patch discarded remove patch
@@ -26,7 +26,7 @@  discard block
 block discarded – undo
26 26
 	define('_INC_DISTANT_CONTENT_ENCODING', 'gzip');
27 27
 }
28 28
 if (!defined('_INC_DISTANT_USER_AGENT')) {
29
-	define('_INC_DISTANT_USER_AGENT', 'SPIP-' . $GLOBALS['spip_version_affichee'] . ' (' . $GLOBALS['home_server'] . ')');
29
+	define('_INC_DISTANT_USER_AGENT', 'SPIP-'.$GLOBALS['spip_version_affichee'].' ('.$GLOBALS['home_server'].')');
30 30
 }
31 31
 if (!defined('_INC_DISTANT_MAX_SIZE')) {
32 32
 	define('_INC_DISTANT_MAX_SIZE', 2_097_152);
@@ -35,7 +35,7 @@  discard block
 block discarded – undo
35 35
 	define('_INC_DISTANT_CONNECT_TIMEOUT', 10);
36 36
 }
37 37
 
38
-define('_REGEXP_COPIE_LOCALE', ',' 	.
38
+define('_REGEXP_COPIE_LOCALE', ','.
39 39
 	preg_replace(
40 40
 		'@^https?:@',
41 41
 		'https?:',
@@ -70,7 +70,7 @@  discard block
 block discarded – undo
70 70
 
71 71
 	// si c'est la protection de soi-meme, retourner le path
72 72
 	if ($mode !== 'force' and preg_match(_REGEXP_COPIE_LOCALE, $source, $match)) {
73
-		$source = substr(_DIR_IMG, strlen(_DIR_RACINE)) . urldecode($match[1]);
73
+		$source = substr(_DIR_IMG, strlen(_DIR_RACINE)).urldecode($match[1]);
74 74
 
75 75
 		return @file_exists($source) ? $source : false;
76 76
 	}
@@ -90,7 +90,7 @@  discard block
 block discarded – undo
90 90
 		return false;
91 91
 	}
92 92
 
93
-	$localrac = _DIR_RACINE . $local;
93
+	$localrac = _DIR_RACINE.$local;
94 94
 	$t = ($mode === 'force') ? false : @file_exists($localrac);
95 95
 
96 96
 	// test d'existence du fichier
@@ -115,10 +115,10 @@  discard block
 block discarded – undo
115 115
 			['file' => $localrac, 'taille_max' => $taille_max, 'if_modified_since' => $t ? filemtime($localrac) : '']
116 116
 		);
117 117
 		if (!$res or (!$res['length'] and $res['status'] != 304)) {
118
-			spip_log("copie_locale : Echec recuperation $source sur $localrac status : " . ($res ? $res['status'] : '-'), 'distant' . _LOG_INFO_IMPORTANTE);
118
+			spip_log("copie_locale : Echec recuperation $source sur $localrac status : ".($res ? $res['status'] : '-'), 'distant'._LOG_INFO_IMPORTANTE);
119 119
 		}
120 120
 		else {
121
-			spip_log("copie_locale : recuperation $source sur $localrac OK | taille " . $res['length'] . ' status ' . $res['status'], 'distant');
121
+			spip_log("copie_locale : recuperation $source sur $localrac OK | taille ".$res['length'].' status '.$res['status'], 'distant');
122 122
 		}
123 123
 		if (!$res or !$res['length']) {
124 124
 			// si $t c'est sans doute juste un not-modified-since
@@ -207,7 +207,7 @@  discard block
 block discarded – undo
207 207
 
208 208
 	if (!$is_known_host) {
209 209
 		$host = trim($parsed_url['host'], '.');
210
-		if (! $ip = filter_var($host, FILTER_VALIDATE_IP)) {
210
+		if (!$ip = filter_var($host, FILTER_VALIDATE_IP)) {
211 211
 			$ip = gethostbyname($host);
212 212
 			if ($ip === $host) {
213 213
 				// Error condition for gethostbyname()
@@ -228,7 +228,7 @@  discard block
 block discarded – undo
228 228
 			}
229 229
 		}
230 230
 		if ($ip) {
231
-			if (! filter_var($ip, FILTER_VALIDATE_IP, FILTER_FLAG_NO_PRIV_RANGE | FILTER_FLAG_NO_RES_RANGE)) {
231
+			if (!filter_var($ip, FILTER_VALIDATE_IP, FILTER_FLAG_NO_PRIV_RANGE | FILTER_FLAG_NO_RES_RANGE)) {
232 232
 				return false;
233 233
 			}
234 234
 		}
@@ -239,7 +239,7 @@  discard block
 block discarded – undo
239 239
 	}
240 240
 
241 241
 	$port = $parsed_url['port'];
242
-	if ($port === 80  or $port === 443  or $port === 8080) {
242
+	if ($port === 80 or $port === 443 or $port === 8080) {
243 243
 		return $url;
244 244
 	}
245 245
 
@@ -309,7 +309,7 @@  discard block
 block discarded – undo
309 309
 				}
310 310
 			}
311 311
 			if ($taille > 500) {
312
-				$boundary = substr(md5(random_int(0, mt_getrandmax()) . 'spip'), 0, 8);
312
+				$boundary = substr(md5(random_int(0, mt_getrandmax()).'spip'), 0, 8);
313 313
 			}
314 314
 		}
315 315
 
@@ -337,16 +337,16 @@  discard block
 block discarded – undo
337 337
 			}
338 338
 		} else {
339 339
 			// fabrique une chaine HTTP simple pour un POST
340
-			$entete = 'Content-Type: application/x-www-form-urlencoded' . "\r\n";
340
+			$entete = 'Content-Type: application/x-www-form-urlencoded'."\r\n";
341 341
 			$chaine = [];
342 342
 			if (is_array($donnees)) {
343 343
 				foreach ($donnees as $cle => $valeur) {
344 344
 					if (is_array($valeur)) {
345 345
 						foreach ($valeur as $val2) {
346
-							$chaine[] = rawurlencode($cle) . '[]=' . rawurlencode($val2);
346
+							$chaine[] = rawurlencode($cle).'[]='.rawurlencode($val2);
347 347
 						}
348 348
 					} else {
349
-						$chaine[] = rawurlencode($cle) . '=' . rawurlencode($valeur);
349
+						$chaine[] = rawurlencode($cle).'='.rawurlencode($valeur);
350 350
 					}
351 351
 				}
352 352
 				$chaine = implode('&', $chaine);
@@ -456,7 +456,7 @@  discard block
 block discarded – undo
456 456
 	$head_add = '';
457 457
 	if (!empty($options['headers'])) {
458 458
 		foreach ($options['headers'] as $champ => $valeur) {
459
-			$head_add .= $champ . ': ' . $valeur . "\r\n";
459
+			$head_add .= $champ.': '.$valeur."\r\n";
460 460
 		}
461 461
 		// ne pas le repasser a recuperer_url si on follow un location, car ils seront dans datas
462 462
 		unset($options['headers']);
@@ -466,9 +466,9 @@  discard block
 block discarded – undo
466 466
 		[$head, $postdata] = prepare_donnees_post($options['datas'], $options['boundary']);
467 467
 		$head .= $head_add;
468 468
 		if (stripos($head, 'Content-Length:') === false) {
469
-			$head .= 'Content-Length: ' . strlen($postdata) . "\r\n";
469
+			$head .= 'Content-Length: '.strlen($postdata)."\r\n";
470 470
 		}
471
-		$options['datas'] = $head . "\r\n" . $postdata;
471
+		$options['datas'] = $head."\r\n".$postdata;
472 472
 		if (
473 473
 			strlen($postdata)
474 474
 			and !$methode_demandee
@@ -476,15 +476,15 @@  discard block
 block discarded – undo
476 476
 			$options['methode'] = 'POST';
477 477
 		}
478 478
 	} elseif ($head_add) {
479
-		$options['datas'] = $head_add . "\r\n";
479
+		$options['datas'] = $head_add."\r\n";
480 480
 	}
481 481
 
482 482
 	// Accepter les URLs au format feed:// ou qui ont oublie le http:// ou les urls relatives au protocole
483 483
 	$url = preg_replace(',^feed://,i', 'http://', $url);
484 484
 	if (!tester_url_absolue($url)) {
485
-		$url = 'http://' . $url;
485
+		$url = 'http://'.$url;
486 486
 	} elseif (strncmp($url, '//', 2) == 0) {
487
-		$url = 'http:' . $url;
487
+		$url = 'http:'.$url;
488 488
 	}
489 489
 
490 490
 	$url = url_to_ascii($url);
@@ -513,7 +513,7 @@  discard block
 block discarded – undo
513 513
 		$options['if_modified_since']
514 514
 	);
515 515
 	if (!$handle) {
516
-		spip_log("ECHEC init_http $url", 'distant' . _LOG_ERREUR);
516
+		spip_log("ECHEC init_http $url", 'distant'._LOG_ERREUR);
517 517
 
518 518
 		return false;
519 519
 	}
@@ -543,7 +543,7 @@  discard block
 block discarded – undo
543 543
 					'status' => 200,
544 544
 				];
545 545
 			} else {
546
-				spip_log("ECHEC chinoiserie $url", 'distant' . _LOG_ERREUR);
546
+				spip_log("ECHEC chinoiserie $url", 'distant'._LOG_ERREUR);
547 547
 				return false;
548 548
 			}
549 549
 		} elseif ($res['location'] and $options['follow_location']) {
@@ -555,7 +555,7 @@  discard block
 block discarded – undo
555 555
 
556 556
 			return recuperer_url($url, $options);
557 557
 		} elseif ($res['status'] !== 200) {
558
-			spip_log('HTTP status ' . $res['status'] . " pour $url", 'distant');
558
+			spip_log('HTTP status '.$res['status']." pour $url", 'distant');
559 559
 		}
560 560
 		$result['status'] = $res['status'];
561 561
 		if (isset($res['headers'])) {
@@ -580,7 +580,7 @@  discard block
 block discarded – undo
580 580
 
581 581
 	$gz = false;
582 582
 	if (preg_match(",\bContent-Encoding: .*gzip,is", $result['headers'])) {
583
-		$gz = (_DIR_TMP . md5(uniqid(random_int(0, mt_getrandmax()))) . '.tmp.gz');
583
+		$gz = (_DIR_TMP.md5(uniqid(random_int(0, mt_getrandmax()))).'.tmp.gz');
584 584
 	}
585 585
 
586 586
 	// si on a pas deja recuperer le contenu par une methode detournee
@@ -666,7 +666,7 @@  discard block
 block discarded – undo
666 666
 	$sig['url'] = $url;
667 667
 
668 668
 	$dir = sous_repertoire(_DIR_CACHE, 'curl');
669
-	$cache = md5(serialize($sig)) . '-' . substr(preg_replace(',\W+,', '_', $url), 0, 80);
669
+	$cache = md5(serialize($sig)).'-'.substr(preg_replace(',\W+,', '_', $url), 0, 80);
670 670
 	$sub = sous_repertoire($dir, substr($cache, 0, 2));
671 671
 	$cache = "$sub$cache";
672 672
 
@@ -720,7 +720,7 @@  discard block
 block discarded – undo
720 720
 	$fp = false;
721 721
 	if ($fichier) {
722 722
 		include_spip('inc/acces');
723
-		$tmpfile = "$fichier." . creer_uniqid() . '.tmp';
723
+		$tmpfile = "$fichier.".creer_uniqid().'.tmp';
724 724
 		$fp = spip_fopen_lock($tmpfile, 'w', LOCK_EX);
725 725
 		if (!$fp and file_exists($fichier)) {
726 726
 			return filesize($fichier);
@@ -779,7 +779,7 @@  discard block
 block discarded – undo
779 779
 	}
780 780
 	$result['status'] = intval($r[1]);
781 781
 	while ($s = trim(fgets($handle, 16384))) {
782
-		$result['headers'][] = $s . "\n";
782
+		$result['headers'][] = $s."\n";
783 783
 		preg_match(',^([^:]*): *(.*)$,i', $s, $r);
784 784
 		[, $d, $v] = $r;
785 785
 		if (strtolower(trim($d)) == 'location' and $result['status'] >= 300 and $result['status'] < 400) {
@@ -828,13 +828,13 @@  discard block
 block discarded – undo
828 828
 
829 829
 	// on se place tout le temps comme si on etait a la racine
830 830
 	if (_DIR_RACINE) {
831
-		$d = preg_replace(',^' . preg_quote(_DIR_RACINE) . ',', '', $d);
831
+		$d = preg_replace(',^'.preg_quote(_DIR_RACINE).',', '', $d);
832 832
 	}
833 833
 
834 834
 	$m = md5($source);
835 835
 
836 836
 	return $d
837
-	. substr(preg_replace(',[^\w-],', '', basename($source)) . '-' . $m, 0, 12)
837
+	. substr(preg_replace(',[^\w-],', '', basename($source)).'-'.$m, 0, 12)
838 838
 	. substr($m, 0, 4)
839 839
 	. ".$extension";
840 840
 }
@@ -857,7 +857,7 @@  discard block
 block discarded – undo
857 857
 	// Si c'est deja local pas de souci
858 858
 	if (!tester_url_absolue($source)) {
859 859
 		if (_DIR_RACINE) {
860
-			$source = preg_replace(',^' . preg_quote(_DIR_RACINE) . ',', '', $source);
860
+			$source = preg_replace(',^'.preg_quote(_DIR_RACINE).',', '', $source);
861 861
 		}
862 862
 
863 863
 		return $source;
@@ -875,7 +875,7 @@  discard block
 block discarded – undo
875 875
 		$ext
876 876
 		and preg_match(',^\w+$,', $ext) // pas de php?truc=1&...
877 877
 		and $f = nom_fichier_copie_locale($source, $ext)
878
-		and file_exists(_DIR_RACINE . $f)
878
+		and file_exists(_DIR_RACINE.$f)
879 879
 	) {
880 880
 		return $f;
881 881
 	}
@@ -883,7 +883,7 @@  discard block
 block discarded – undo
883 883
 
884 884
 	// Si c'est deja dans la table des documents,
885 885
 	// ramener le nom de sa copie potentielle
886
-	$ext = sql_getfetsel('extension', 'spip_documents', 'fichier=' . sql_quote($source) . " AND distant='oui' AND extension <> ''");
886
+	$ext = sql_getfetsel('extension', 'spip_documents', 'fichier='.sql_quote($source)." AND distant='oui' AND extension <> ''");
887 887
 
888 888
 	if ($ext) {
889 889
 		return nom_fichier_copie_locale($source, $ext);
@@ -894,9 +894,9 @@  discard block
 block discarded – undo
894 894
 
895 895
 	$ext = $path_parts ? $path_parts['extension'] : '';
896 896
 
897
-	if ($ext and sql_getfetsel('extension', 'spip_types_documents', 'extension=' . sql_quote($ext))) {
897
+	if ($ext and sql_getfetsel('extension', 'spip_types_documents', 'extension='.sql_quote($ext))) {
898 898
 		$f = nom_fichier_copie_locale($source, $ext);
899
-		if (file_exists(_DIR_RACINE . $f)) {
899
+		if (file_exists(_DIR_RACINE.$f)) {
900 900
 			return $f;
901 901
 		}
902 902
 	}
@@ -904,7 +904,7 @@  discard block
 block discarded – undo
904 904
 	// Ping  pour voir si son extension est connue et autorisee
905 905
 	// avec mise en cache du resultat du ping
906 906
 
907
-	$cache = sous_repertoire(_DIR_CACHE, 'rid') . md5($source);
907
+	$cache = sous_repertoire(_DIR_CACHE, 'rid').md5($source);
908 908
 	if (
909 909
 		!@file_exists($cache)
910 910
 		or !$path_parts = @unserialize(spip_file_get_contents($cache))
@@ -914,10 +914,10 @@  discard block
 block discarded – undo
914 914
 		ecrire_fichier($cache, serialize($path_parts));
915 915
 	}
916 916
 	$ext = !empty($path_parts['extension']) ? $path_parts['extension'] : '';
917
-	if ($ext and sql_getfetsel('extension', 'spip_types_documents', 'extension=' . sql_quote($ext))) {
917
+	if ($ext and sql_getfetsel('extension', 'spip_types_documents', 'extension='.sql_quote($ext))) {
918 918
 		return nom_fichier_copie_locale($source, $ext);
919 919
 	}
920
-	spip_log("pas de copie locale pour $source", 'distant' . _LOG_ERREUR);
920
+	spip_log("pas de copie locale pour $source", 'distant'._LOG_ERREUR);
921 921
 }
922 922
 
923 923
 
@@ -1001,7 +1001,7 @@  discard block
 block discarded – undo
1001 1001
 		} else {
1002 1002
 			if ($a['body']) {
1003 1003
 				$a['extension'] = $extension;
1004
-				$a['fichier'] = _DIR_RACINE . nom_fichier_copie_locale($source, $extension);
1004
+				$a['fichier'] = _DIR_RACINE.nom_fichier_copie_locale($source, $extension);
1005 1005
 				ecrire_fichier($a['fichier'], $a['body']);
1006 1006
 				$size_image = @spip_getimagesize($a['fichier']);
1007 1007
 				$a['largeur'] = intval($size_image[0]);
@@ -1069,20 +1069,20 @@  discard block
 block discarded – undo
1069 1069
 			!$t
1070 1070
 			and preg_match(',\.([a-z0-9]+)(\?.*)?$,i', $source, $rext)
1071 1071
 		) {
1072
-			$t = sql_fetsel('extension', 'spip_types_documents', 'extension=' . sql_quote(corriger_extension($rext[1]), '', 'text'));
1072
+			$t = sql_fetsel('extension', 'spip_types_documents', 'extension='.sql_quote(corriger_extension($rext[1]), '', 'text'));
1073 1073
 		}
1074 1074
 		if (
1075 1075
 			!$t
1076 1076
 			and preg_match(',^Content-Disposition:\s*attachment;\s*filename=(.*)$,Uims', $headers, $m)
1077 1077
 			and preg_match(',\.([a-z0-9]+)(\?.*)?$,i', $m[1], $rext)
1078 1078
 		) {
1079
-			$t = sql_fetsel('extension', 'spip_types_documents', 'extension=' . sql_quote(corriger_extension($rext[1]), '', 'text'));
1079
+			$t = sql_fetsel('extension', 'spip_types_documents', 'extension='.sql_quote(corriger_extension($rext[1]), '', 'text'));
1080 1080
 		}
1081 1081
 	}
1082 1082
 
1083 1083
 	// Autre mime/type (ou text/plain avec fichier d'extension inconnue)
1084 1084
 	if (!$t) {
1085
-		$t = sql_fetsel('extension', 'spip_types_documents', 'mime_type=' . sql_quote($mime_type));
1085
+		$t = sql_fetsel('extension', 'spip_types_documents', 'mime_type='.sql_quote($mime_type));
1086 1086
 	}
1087 1087
 
1088 1088
 	// Toujours rien ? (ex: audio/x-ogg au lieu de application/ogg)
@@ -1093,11 +1093,11 @@  discard block
 block discarded – undo
1093 1093
 		and preg_match(',\.([a-z0-9]+)(\?.*)?$,i', $source, $rext)
1094 1094
 	) {
1095 1095
 		# eviter xxx.3 => 3gp (> SPIP 3)
1096
-		$t = sql_fetsel('extension', 'spip_types_documents', 'extension=' . sql_quote(corriger_extension($rext[1]), '', 'text'));
1096
+		$t = sql_fetsel('extension', 'spip_types_documents', 'extension='.sql_quote(corriger_extension($rext[1]), '', 'text'));
1097 1097
 	}
1098 1098
 
1099 1099
 	if ($t) {
1100
-		spip_log("mime-type $mime_type ok, extension " . $t['extension'], 'distant');
1100
+		spip_log("mime-type $mime_type ok, extension ".$t['extension'], 'distant');
1101 1101
 		return $t['extension'];
1102 1102
 	} else {
1103 1103
 		# par defaut on retombe sur '.bin' si c'est autorise
@@ -1200,7 +1200,7 @@  discard block
 block discarded – undo
1200 1200
 		}
1201 1201
 	} else {
1202 1202
 		$scheme = $t['scheme'];
1203
-		$noproxy = $scheme . '://';
1203
+		$noproxy = $scheme.'://';
1204 1204
 	}
1205 1205
 	if (isset($t['user'])) {
1206 1206
 		$user = [$t['user'], $t['pass']];
@@ -1214,7 +1214,7 @@  discard block
 block discarded – undo
1214 1214
 	}
1215 1215
 
1216 1216
 	if (!empty($t['query'])) {
1217
-		$path .= '?' . $t['query'];
1217
+		$path .= '?'.$t['query'];
1218 1218
 	}
1219 1219
 
1220 1220
 	$f = lance_requete($method, $scheme, $user, $host, $path, $port, $noproxy, $refuse_gz, $referer, $datas, $vers, $date);
@@ -1288,20 +1288,20 @@  discard block
 block discarded – undo
1288 1288
 	$proxy_user = '';
1289 1289
 	$http_proxy = need_proxy($host);
1290 1290
 	if ($user) {
1291
-		$user = urlencode($user[0]) . ':' . urlencode($user[1]);
1291
+		$user = urlencode($user[0]).':'.urlencode($user[1]);
1292 1292
 	}
1293 1293
 
1294 1294
 	$connect = '';
1295 1295
 	if ($http_proxy) {
1296
-		if (!defined('_PROXY_HTTPS_NOT_VIA_CONNECT') and in_array($scheme, ['tls','ssl'])) {
1297
-			$path_host = (!$user ? '' : "$user@") . $host . (($port != 80) ? ":$port" : '');
1298
-			$connect = 'CONNECT ' . $path_host . " $vers\r\n"
1296
+		if (!defined('_PROXY_HTTPS_NOT_VIA_CONNECT') and in_array($scheme, ['tls', 'ssl'])) {
1297
+			$path_host = (!$user ? '' : "$user@").$host.(($port != 80) ? ":$port" : '');
1298
+			$connect = 'CONNECT '.$path_host." $vers\r\n"
1299 1299
 				. "Host: $path_host\r\n"
1300 1300
 				. "Proxy-Connection: Keep-Alive\r\n";
1301 1301
 		} else {
1302
-			$path = (in_array($scheme, ['tls','ssl']) ? 'https://' : "$scheme://")
1302
+			$path = (in_array($scheme, ['tls', 'ssl']) ? 'https://' : "$scheme://")
1303 1303
 				. (!$user ? '' : "$user@")
1304
-				. "$host" . (($port != 80) ? ":$port" : '') . $path;
1304
+				. "$host".(($port != 80) ? ":$port" : '').$path;
1305 1305
 		}
1306 1306
 		$t2 = @parse_url($http_proxy);
1307 1307
 		$first_host = $t2['host'];
@@ -1309,10 +1309,10 @@  discard block
 block discarded – undo
1309 1309
 			$port = 80;
1310 1310
 		}
1311 1311
 		if ($t2['user']) {
1312
-			$proxy_user = base64_encode($t2['user'] . ':' . $t2['pass']);
1312
+			$proxy_user = base64_encode($t2['user'].':'.$t2['pass']);
1313 1313
 		}
1314 1314
 	} else {
1315
-		$first_host = $noproxy . $host;
1315
+		$first_host = $noproxy.$host;
1316 1316
 	}
1317 1317
 
1318 1318
 	if ($connect) {
@@ -1334,7 +1334,7 @@  discard block
 block discarded – undo
1334 1334
 		);
1335 1335
 		spip_log("Recuperer $path sur $first_host:$port par $f (via CONNECT)", 'connect');
1336 1336
 		if (!$f) {
1337
-			spip_log("Erreur connexion $errno $errstr", 'distant' . _LOG_ERREUR);
1337
+			spip_log("Erreur connexion $errno $errstr", 'distant'._LOG_ERREUR);
1338 1338
 			return $errno;
1339 1339
 		}
1340 1340
 		stream_set_timeout($f, _INC_DISTANT_CONNECT_TIMEOUT);
@@ -1347,7 +1347,7 @@  discard block
 block discarded – undo
1347 1347
 			or !count($res = explode(' ', $res))
1348 1348
 			or $res[1] !== '200'
1349 1349
 		) {
1350
-			spip_log("Echec CONNECT sur $first_host:$port", 'connect' . _LOG_INFO_IMPORTANTE);
1350
+			spip_log("Echec CONNECT sur $first_host:$port", 'connect'._LOG_INFO_IMPORTANTE);
1351 1351
 			fclose($f);
1352 1352
 
1353 1353
 			return false;
@@ -1364,7 +1364,7 @@  discard block
 block discarded – undo
1364 1364
 		} while (!$f and $ntry-- and $errno !== 110 and sleep(1));
1365 1365
 		spip_log("Recuperer $path sur $first_host:$port par $f");
1366 1366
 		if (!$f) {
1367
-			spip_log("Erreur connexion $errno $errstr", 'distant' . _LOG_ERREUR);
1367
+			spip_log("Erreur connexion $errno $errstr", 'distant'._LOG_ERREUR);
1368 1368
 
1369 1369
 			return $errno;
1370 1370
 		}
@@ -1374,16 +1374,16 @@  discard block
 block discarded – undo
1374 1374
 	$site = $GLOBALS['meta']['adresse_site'] ?? '';
1375 1375
 
1376 1376
 	$host_port = $host;
1377
-	if ($port != (in_array($scheme, ['tls','ssl']) ? 443 : 80)) {
1377
+	if ($port != (in_array($scheme, ['tls', 'ssl']) ? 443 : 80)) {
1378 1378
 		$host_port .= ":$port";
1379 1379
 	}
1380 1380
 	$req = "$method $path $vers\r\n"
1381 1381
 		. "Host: $host_port\r\n"
1382
-		. 'User-Agent: ' . _INC_DISTANT_USER_AGENT . "\r\n"
1383
-		. ($refuse_gz ? '' : ('Accept-Encoding: ' . _INC_DISTANT_CONTENT_ENCODING . "\r\n"))
1382
+		. 'User-Agent: '._INC_DISTANT_USER_AGENT."\r\n"
1383
+		. ($refuse_gz ? '' : ('Accept-Encoding: '._INC_DISTANT_CONTENT_ENCODING."\r\n"))
1384 1384
 		. (!$site ? '' : "Referer: $site/$referer\r\n")
1385
-		. (!$date ? '' : 'If-Modified-Since: ' . (gmdate('D, d M Y H:i:s', $date) . " GMT\r\n"))
1386
-		. (!$user ? '' : ('Authorization: Basic ' . base64_encode($user) . "\r\n"))
1385
+		. (!$date ? '' : 'If-Modified-Since: '.(gmdate('D, d M Y H:i:s', $date)." GMT\r\n"))
1386
+		. (!$user ? '' : ('Authorization: Basic '.base64_encode($user)."\r\n"))
1387 1387
 		. (!$proxy_user ? '' : "Proxy-Authorization: Basic $proxy_user\r\n")
1388 1388
 		. (!strpos($vers, '1.1') ? '' : "Keep-Alive: 300\r\nConnection: keep-alive\r\n");
1389 1389
 
Please login to merge, or discard this patch.
ecrire/inc/idna_convert.class.php 1 patch
Spacing   +43 added lines, -46 removed lines patch added patch discarded remove patch
@@ -73,16 +73,16 @@  discard block
 block discarded – undo
73 73
     protected $_lcount = 19;
74 74
     protected $_vcount = 21;
75 75
     protected $_tcount = 28;
76
-    protected $_ncount = 588;   // _vcount * _tcount
76
+    protected $_ncount = 588; // _vcount * _tcount
77 77
     protected $_scount = 11172; // _lcount * _tcount * _vcount
78 78
     protected $_error = false;
79 79
     protected static $_mb_string_overload = null;
80 80
     // See {@link set_paramter()} for details of how to change the following
81 81
     // settings from within your script / application
82
-    protected $_api_encoding = 'utf8';   // Default input charset is UTF-8
83
-    protected $_allow_overlong = false;  // Overlong UTF-8 encodings are forbidden
84
-    protected $_strict_mode = false;     // Behave strict or not
85
-    protected $_idn_version = 2003;      // Can be either 2003 (old, default) or 2008
82
+    protected $_api_encoding = 'utf8'; // Default input charset is UTF-8
83
+    protected $_allow_overlong = false; // Overlong UTF-8 encodings are forbidden
84
+    protected $_strict_mode = false; // Behave strict or not
85
+    protected $_idn_version = 2003; // Can be either 2003 (old, default) or 2008
86 86
 
87 87
     /**
88 88
      * the constructor
@@ -140,7 +140,7 @@  discard block
 block discarded – undo
140 140
                             $this->_api_encoding = $v;
141 141
                             break;
142 142
                         default:
143
-                            $this->_error('Set Parameter: Unknown parameter ' . $v . ' for option ' . $k);
143
+                            $this->_error('Set Parameter: Unknown parameter '.$v.' for option '.$k);
144 144
                             return false;
145 145
                     }
146 146
                     break;
@@ -154,7 +154,7 @@  discard block
 block discarded – undo
154 154
                     if (in_array($v, array('2003', '2008'))) {
155 155
                         $this->_idn_version = $v;
156 156
                     } else {
157
-                        $this->_error('Set Parameter: Unknown parameter ' . $v . ' for option ' . $k);
157
+                        $this->_error('Set Parameter: Unknown parameter '.$v.' for option '.$k);
158 158
                     }
159 159
                     break;
160 160
                 case 'encode_german_sz': // Deprecated
@@ -165,7 +165,7 @@  discard block
 block discarded – undo
165 165
                     }
166 166
                     break;
167 167
                 default:
168
-                    $this->_error('Set Parameter: Unknown option ' . $k);
168
+                    $this->_error('Set Parameter: Unknown option '.$k);
169 169
                     return false;
170 170
             }
171 171
         }
@@ -188,7 +188,7 @@  discard block
 block discarded – undo
188 188
                 case 'ucs4_array':
189 189
                     break;
190 190
                 default:
191
-                    $this->_error('Unknown encoding ' . $one_time_encoding);
191
+                    $this->_error('Unknown encoding '.$one_time_encoding);
192 192
                     return false;
193 193
             }
194 194
         }
@@ -206,7 +206,7 @@  discard block
 block discarded – undo
206 206
             [$email_pref, $input] = explode('@', $input, 2);
207 207
             $arr = explode('.', $input);
208 208
             foreach ($arr as $k => $v) {
209
-                if (preg_match('!^' . preg_quote($this->_punycode_prefix, '!') . '!', $v)) {
209
+                if (preg_match('!^'.preg_quote($this->_punycode_prefix, '!').'!', $v)) {
210 210
                     $conv = $this->_decode($v);
211 211
                     if ($conv) {
212 212
                         $arr[$k] = $conv;
@@ -216,7 +216,7 @@  discard block
 block discarded – undo
216 216
             $input = join('.', $arr);
217 217
             $arr = explode('.', $email_pref);
218 218
             foreach ($arr as $k => $v) {
219
-                if (preg_match('!^' . preg_quote($this->_punycode_prefix, '!') . '!', $v)) {
219
+                if (preg_match('!^'.preg_quote($this->_punycode_prefix, '!').'!', $v)) {
220 220
                     $conv = $this->_decode($v);
221 221
                     if ($conv) {
222 222
                         $arr[$k] = $conv;
@@ -224,7 +224,7 @@  discard block
 block discarded – undo
224 224
                 }
225 225
             }
226 226
             $email_pref = join('.', $arr);
227
-            $return = $email_pref . '@' . $input;
227
+            $return = $email_pref.'@'.$input;
228 228
         } elseif (preg_match('![:\./]!', $input)) { // Or a complete domain name (with or without paths / parameters)
229 229
             // No no in strict mode
230 230
             if ($this->_strict_mode) {
@@ -241,13 +241,13 @@  discard block
 block discarded – undo
241 241
                     }
242 242
                 }
243 243
                 $parsed['host'] = join('.', $arr);
244
-                $return = (empty($parsed['scheme']) ? '' : $parsed['scheme'] . (strtolower($parsed['scheme']) == 'mailto' ? ':' : '://')).
245
-                        (empty($parsed['user']) ? '' : $parsed['user'] . (empty($parsed['pass']) ? '' : ':' . $parsed['pass']) . '@').
244
+                $return = (empty($parsed['scheme']) ? '' : $parsed['scheme'].(strtolower($parsed['scheme']) == 'mailto' ? ':' : '://')).
245
+                        (empty($parsed['user']) ? '' : $parsed['user'].(empty($parsed['pass']) ? '' : ':'.$parsed['pass']).'@').
246 246
                         $parsed['host'].
247
-                        (empty($parsed['port']) ? '' : ':' . $parsed['port']).
247
+                        (empty($parsed['port']) ? '' : ':'.$parsed['port']).
248 248
                         (empty($parsed['path']) ? '' : $parsed['path']).
249
-                        (empty($parsed['query']) ? '' : '?' . $parsed['query']).
250
-                        (empty($parsed['fragment']) ? '' : '#' . $parsed['fragment']);
249
+                        (empty($parsed['query']) ? '' : '?'.$parsed['query']).
250
+                        (empty($parsed['fragment']) ? '' : '#'.$parsed['fragment']);
251 251
             } else { // parse_url seems to have failed, try without it
252 252
                 $arr = explode('.', $input);
253 253
                 foreach ($arr as $k => $v) {
@@ -265,8 +265,8 @@  discard block
 block discarded – undo
265 265
         // The output is UTF-8 by default, other output formats need conversion here
266 266
         // If one time encoding is given, use this, else the objects property
267 267
         switch ($one_time_encoding ?: $this->_api_encoding) {
268
-            case 'utf8':        return $return; // break;
269
-            case 'ucs4_string': return $this->_ucs4_to_ucs4_string($this->_utf8_to_ucs4($return));  // break;
268
+            case 'utf8' : return $return; // break;
269
+            case 'ucs4_string': return $this->_ucs4_to_ucs4_string($this->_utf8_to_ucs4($return)); // break;
270 270
             case 'ucs4_array':  return $this->_utf8_to_ucs4($return); // break;
271 271
             default:            $this->_error('Unsupported output format'); return false;
272 272
         }
@@ -283,15 +283,14 @@  discard block
 block discarded – undo
283 283
         // Forcing conversion of input to UCS4 array
284 284
         // If one time encoding is given, use this, else the objects property
285 285
         switch ($one_time_encoding ?: $this->_api_encoding) {
286
-            case 'utf8':
287
-                $decoded = $this->_utf8_to_ucs4($decoded);
286
+            case 'utf8' : $decoded = $this->_utf8_to_ucs4($decoded);
288 287
                 break;
289 288
             case 'ucs4_string':
290 289
                 $decoded = $this->_ucs4_string_to_ucs4($decoded);
291 290
             case 'ucs4_array':
292 291
                 break;
293 292
             default:
294
-                $this->_error('Unsupported input format: ' . ($one_time_encoding ?: $this->_api_encoding));
293
+                $this->_error('Unsupported input format: '.($one_time_encoding ?: $this->_api_encoding));
295 294
                 return false;
296 295
         }
297 296
 
@@ -380,13 +379,13 @@  discard block
 block discarded – undo
380 379
             }
381 380
         }
382 381
         $parsed['host'] = join('.', $arr);
383
-        $return = (empty($parsed['scheme']) ? '' : $parsed['scheme'] . (strtolower($parsed['scheme']) == 'mailto' ? ':' : '://')).
384
-                (empty($parsed['user']) ? '' : $parsed['user'] . (empty($parsed['pass']) ? '' : ':' . $parsed['pass']) . '@').
382
+        $return = (empty($parsed['scheme']) ? '' : $parsed['scheme'].(strtolower($parsed['scheme']) == 'mailto' ? ':' : '://')).
383
+                (empty($parsed['user']) ? '' : $parsed['user'].(empty($parsed['pass']) ? '' : ':'.$parsed['pass']).'@').
385 384
                 $parsed['host'].
386
-                (empty($parsed['port']) ? '' : ':' . $parsed['port']).
385
+                (empty($parsed['port']) ? '' : ':'.$parsed['port']).
387 386
                 (empty($parsed['path']) ? '' : $parsed['path']).
388
-                (empty($parsed['query']) ? '' : '?' . $parsed['query']).
389
-                (empty($parsed['fragment']) ? '' : '#' . $parsed['fragment']);
387
+                (empty($parsed['query']) ? '' : '?'.$parsed['query']).
388
+                (empty($parsed['fragment']) ? '' : '#'.$parsed['fragment']);
390 389
         return $return;
391 390
     }
392 391
 
@@ -409,11 +408,11 @@  discard block
 block discarded – undo
409 408
     {
410 409
         $decoded = array();
411 410
         // find the Punycode prefix
412
-        if (!preg_match('!^' . preg_quote($this->_punycode_prefix, '!') . '!', $encoded)) {
411
+        if (!preg_match('!^'.preg_quote($this->_punycode_prefix, '!').'!', $encoded)) {
413 412
             $this->_error('This is not a punycode string');
414 413
             return false;
415 414
         }
416
-        $encode_test = preg_replace('!^' . preg_quote($this->_punycode_prefix, '!') . '!', '', $encoded);
415
+        $encode_test = preg_replace('!^'.preg_quote($this->_punycode_prefix, '!').'!', '', $encoded);
417 416
         // If nothing left after removing the prefix, it is hopeless
418 417
         if (!$encode_test) {
419 418
             $this->_error('The given encoded string was empty');
@@ -439,8 +438,7 @@  discard block
 block discarded – undo
439 438
             for ($old_idx = $idx, $w = 1, $k = $this->_base; 1; $k += $this->_base) {
440 439
                 $digit = $this->_decode_digit($encoded[$enco_idx++]);
441 440
                 $idx += $digit * $w;
442
-                $t = ($k <= $bias) ? $this->_tmin :
443
-                        (($k >= $bias + $this->_tmax) ? $this->_tmax : ($k - $bias));
441
+                $t = ($k <= $bias) ? $this->_tmin : (($k >= $bias + $this->_tmax) ? $this->_tmax : ($k - $bias));
444 442
                 if ($digit < $t) {
445 443
                     break;
446 444
                 }
@@ -513,7 +511,7 @@  discard block
 block discarded – undo
513 511
             return $encoded; // All codepoints were basic ones
514 512
         }
515 513
         // Start with the prefix; copy it to output
516
-        $encoded = $this->_punycode_prefix . $encoded;
514
+        $encoded = $this->_punycode_prefix.$encoded;
517 515
         // If we have basic code points in output, add an hyphen to the end
518 516
         if ($codecount) {
519 517
             $encoded .= '-';
@@ -540,8 +538,7 @@  discard block
 block discarded – undo
540 538
                     $delta++;
541 539
                 } elseif ($decoded[$i] == $cur_code) {
542 540
                     for ($q = $delta, $k = $this->_base; 1; $k += $this->_base) {
543
-                        $t = ($k <= $bias) ? $this->_tmin :
544
-                                (($k >= $bias + $this->_tmax) ? $this->_tmax : $k - $bias);
541
+                        $t = ($k <= $bias) ? $this->_tmin : (($k >= $bias + $this->_tmax) ? $this->_tmax : $k - $bias);
545 542
                         if ($q < $t) {
546 543
                             break;
547 544
                         }
@@ -628,12 +625,12 @@  discard block
 block discarded – undo
628 625
             }
629 626
             // Try to find prohibited input
630 627
             if (in_array($v, self::$NP['prohibit']) || in_array($v, self::$NP['general_prohibited'])) {
631
-                $this->_error('NAMEPREP: Prohibited input U+' . sprintf('%08X', $v));
628
+                $this->_error('NAMEPREP: Prohibited input U+'.sprintf('%08X', $v));
632 629
                 return false;
633 630
             }
634 631
             foreach (self::$NP['prohibit_ranges'] as $range) {
635 632
                 if ($range[0] <= $v && $v <= $range[1]) {
636
-                    $this->_error('NAMEPREP: Prohibited input U+' . sprintf('%08X', $v));
633
+                    $this->_error('NAMEPREP: Prohibited input U+'.sprintf('%08X', $v));
637 634
                     return false;
638 635
                 }
639 636
             }
@@ -871,7 +868,7 @@  discard block
 block discarded – undo
871 868
                 $output[$out_len] = $v;
872 869
                 ++$out_len;
873 870
                 if ('add' == $mode) {
874
-                    $this->_error('Conversion from UTF-8 to UCS-4 failed: malformed input at byte ' . $k);
871
+                    $this->_error('Conversion from UTF-8 to UCS-4 failed: malformed input at byte '.$k);
875 872
                     return false;
876 873
                 }
877 874
                 continue;
@@ -896,7 +893,7 @@  discard block
 block discarded – undo
896 893
                     $next_byte = 4;
897 894
                     $v = ($v - 252) << 30;
898 895
                 } else {
899
-                    $this->_error('This might be UTF-8, but I don\'t understand it at byte ' . $k);
896
+                    $this->_error('This might be UTF-8, but I don\'t understand it at byte '.$k);
900 897
                     return false;
901 898
                 }
902 899
                 if ('add' == $mode) {
@@ -909,7 +906,7 @@  discard block
 block discarded – undo
909 906
                 if (!$this->_allow_overlong && $test == 'range') {
910 907
                     $test = 'none';
911 908
                     if (($v < 0xA0 && $start_byte == 0xE0) || ($v < 0x90 && $start_byte == 0xF0) || ($v > 0x8F && $start_byte == 0xF4)) {
912
-                        $this->_error('Bogus UTF-8 character detected (out of legal range) at byte ' . $k);
909
+                        $this->_error('Bogus UTF-8 character detected (out of legal range) at byte '.$k);
913 910
                         return false;
914 911
                     }
915 912
                 }
@@ -918,7 +915,7 @@  discard block
 block discarded – undo
918 915
                     $output[($out_len - 1)] += $v;
919 916
                     --$next_byte;
920 917
                 } else {
921
-                    $this->_error('Conversion from UTF-8 to UCS-4 failed: malformed input at byte ' . $k);
918
+                    $this->_error('Conversion from UTF-8 to UCS-4 failed: malformed input at byte '.$k);
922 919
                     return false;
923 920
                 }
924 921
                 if ($next_byte < 0) {
@@ -942,13 +939,13 @@  discard block
 block discarded – undo
942 939
             if ($v < 128) { // 7bit are transferred literally
943 940
                 $output .= chr($v);
944 941
             } elseif ($v < (1 << 11)) { // 2 bytes
945
-                $output .= chr(192 + ($v >> 6)) . chr(128 + ($v & 63));
942
+                $output .= chr(192 + ($v >> 6)).chr(128 + ($v & 63));
946 943
             } elseif ($v < (1 << 16)) { // 3 bytes
947
-                $output .= chr(224 + ($v >> 12)) . chr(128 + (($v >> 6) & 63)) . chr(128 + ($v & 63));
944
+                $output .= chr(224 + ($v >> 12)).chr(128 + (($v >> 6) & 63)).chr(128 + ($v & 63));
948 945
             } elseif ($v < (1 << 21)) { // 4 bytes
949
-                $output .= chr(240 + ($v >> 18)) . chr(128 + (($v >> 12) & 63)) . chr(128 + (($v >> 6) & 63)) . chr(128 + ($v & 63));
946
+                $output .= chr(240 + ($v >> 18)).chr(128 + (($v >> 12) & 63)).chr(128 + (($v >> 6) & 63)).chr(128 + ($v & 63));
950 947
             } else {
951
-                $this->_error('Conversion from UCS-4 to UTF-8 failed: malformed input at byte ' . $k);
948
+                $this->_error('Conversion from UCS-4 to UTF-8 failed: malformed input at byte '.$k);
952 949
                 return false;
953 950
             }
954 951
         }
@@ -967,7 +964,7 @@  discard block
 block discarded – undo
967 964
         // Take array values and split output to 4 bytes per value
968 965
         // The bit mask is 255, which reads &11111111
969 966
         foreach ($input as $v) {
970
-            $output .= chr(($v >> 24) & 255) . chr(($v >> 16) & 255) . chr(($v >> 8) & 255) . chr($v & 255);
967
+            $output .= chr(($v >> 24) & 255).chr(($v >> 16) & 255).chr(($v >> 8) & 255).chr($v & 255);
971 968
         }
972 969
         return $output;
973 970
     }
@@ -997,7 +994,7 @@  discard block
 block discarded – undo
997 994
                 $out_len++;
998 995
                 $output[$out_len] = 0;
999 996
             }
1000
-            $output[$out_len] += ord($input[$i]) << (8 * (3 - ($i % 4) ) );
997
+            $output[$out_len] += ord($input[$i]) << (8 * (3 - ($i % 4)));
1001 998
         }
1002 999
         return $output;
1003 1000
     }
Please login to merge, or discard this patch.
ecrire/inc/install.php 1 patch
Spacing   +39 added lines, -39 removed lines patch added patch discarded remove patch
@@ -43,10 +43,10 @@  discard block
 block discarded – undo
43 43
  * @return void
44 44
  **/
45 45
 function install_fichier_connexion($nom, $texte) {
46
-	$texte = '<' . "?php\n"
46
+	$texte = '<'."?php\n"
47 47
 		. "if (!defined(\"_ECRIRE_INC_VERSION\")) return;\n"
48 48
 		. $texte
49
-		. '?' . '>';
49
+		. '?'.'>';
50 50
 
51 51
 	ecrire_fichier($nom, $texte);
52 52
 }
@@ -113,10 +113,10 @@  discard block
 block discarded – undo
113 113
 		return $regs;
114 114
 	} else {
115 115
 		$ar = '\s*\'([^\']*)\'';
116
-		$r = '\s*,' . $ar;
116
+		$r = '\s*,'.$ar;
117 117
 		$r = "#spip_connect_db[(]$ar$r$r$r$r(?:$r(?:$r(?:$r(?:$r)?)?)?)?#";
118 118
 		if (preg_match($r, $s, $regs)) {
119
-			$regs[2] = $regs[1] . (!$regs[2] ? '' : ':' . $regs[2] . ';');
119
+			$regs[2] = $regs[1].(!$regs[2] ? '' : ':'.$regs[2].';');
120 120
 			array_shift($regs);
121 121
 			array_shift($regs);
122 122
 
@@ -174,7 +174,7 @@  discard block
 block discarded – undo
174 174
 	// Si on n'a pas la bonne version de PHP, c'est la fin
175 175
 	if ($err) {
176 176
 		die("<div class='error'>"
177
-			. '<h3>' . _T('avis_attention') . '</h3><p>' . _T('install_echec_annonce') . "</p><ul class='spip'>"
177
+			. '<h3>'._T('avis_attention').'</h3><p>'._T('install_echec_annonce')."</p><ul class='spip'>"
178 178
 			. "<li><strong>{$err[0]}</strong></li>\n</ul></div>");
179 179
 	}
180 180
 
@@ -201,7 +201,7 @@  discard block
 block discarded – undo
201 201
 
202 202
 	if ($err) {
203 203
 		echo "<div class='error'>"
204
-			. '<h3>' . _T('avis_attention') . '</h3><p>' . _T('install_echec_annonce') . "</p><ul class='spip'>";
204
+			. '<h3>'._T('avis_attention').'</h3><p>'._T('install_echec_annonce')."</p><ul class='spip'>";
205 205
 		foreach ($err as $e) {
206 206
 			echo "<li><strong>$e</strong></li>\n";
207 207
 		}
@@ -235,8 +235,8 @@  discard block
 block discarded – undo
235 235
 
236 236
 // https://code.spip.net/@info_etape
237 237
 function info_etape($titre, $complement = '') {
238
-	return '<h2>' . $titre . "</h2>\n" .
239
-	($complement ? '' . $complement . "\n" : '');
238
+	return '<h2>'.$titre."</h2>\n".
239
+	($complement ? ''.$complement."\n" : '');
240 240
 }
241 241
 
242 242
 /**
@@ -250,11 +250,11 @@  discard block
 block discarded – undo
250 250
 		$code = _T('bouton_suivant');
251 251
 	}
252 252
 	static $suivant = 0;
253
-	$id = 'suivant' . (($suivant > 0) ? strval($suivant) : '');
253
+	$id = 'suivant'.(($suivant > 0) ? strval($suivant) : '');
254 254
 	$suivant += 1;
255 255
 
256
-	return "\n<p class='boutons suivant'><input id='" . $id . "' type='submit'\nvalue=\"" .
257
-	$code .
256
+	return "\n<p class='boutons suivant'><input id='".$id."' type='submit'\nvalue=\"".
257
+	$code.
258 258
 	" >>\" /></p>\n";
259 259
 }
260 260
 
@@ -262,7 +262,7 @@  discard block
 block discarded – undo
262 262
 function info_progression_etape($en_cours, $phase, $dir, $erreur = false) {
263 263
 	$intitule_etat = [];
264 264
 	//$en_cours = _request('etape')?_request('etape'):"";
265
-	$liste = find_all_in_path($dir, $phase . '(([0-9])+|fin)[.]php$');
265
+	$liste = find_all_in_path($dir, $phase.'(([0-9])+|fin)[.]php$');
266 266
 	$debut = 1;
267 267
 	$etat = 'ok';
268 268
 	$last = count($liste);
@@ -301,7 +301,7 @@  discard block
 block discarded – undo
301 301
 
302 302
 			$aff_etapes .= "<li class='$class'><div class='fond'>";
303 303
 			$aff_etapes .= ($debut == $en_cours) ? '<strong>' : '';
304
-			$aff_etapes .= '<em>' . _T('etape') . " </em><span class='numero_etape'>$debut</span><em>&nbsp;: </em>";
304
+			$aff_etapes .= '<em>'._T('etape')." </em><span class='numero_etape'>$debut</span><em>&nbsp;: </em>";
305 305
 			$aff_etapes .= $intitule_etat["$phase"][$debut];
306 306
 			$aff_etapes .= ($debut == $en_cours) ? '</strong>' : '';
307 307
 			$aff_etapes .= '</div></li>';
@@ -317,11 +317,11 @@  discard block
 block discarded – undo
317 317
 
318 318
 // https://code.spip.net/@fieldset
319 319
 function fieldset($legend, $champs = [], $apres = '', $avant = '') {
320
-	return "<fieldset>\n" .
321
-	$avant .
322
-	($legend ? '<legend>' . $legend . "</legend>\n" : '') .
323
-	fieldset_champs($champs) .
324
-	$apres .
320
+	return "<fieldset>\n".
321
+	$avant.
322
+	($legend ? '<legend>'.$legend."</legend>\n" : '').
323
+	fieldset_champs($champs).
324
+	$apres.
325 325
 	"</fieldset>\n";
326 326
 }
327 327
 
@@ -331,18 +331,18 @@  discard block
 block discarded – undo
331 331
 		$type = isset($contenu['hidden']) ? 'hidden' : (preg_match(',^pass,', $nom) ? 'password' : 'text');
332 332
 		$class = isset($contenu['hidden']) ? '' : "class='formo' size='40' ";
333 333
 		if (isset($contenu['alternatives'])) {
334
-			$fieldset .= $contenu['label'] . "\n";
334
+			$fieldset .= $contenu['label']."\n";
335 335
 			foreach ($contenu['alternatives'] as $valeur => $label) {
336
-				$fieldset .= "<input type='radio' name='" . $nom .
336
+				$fieldset .= "<input type='radio' name='".$nom.
337 337
 					"' id='$nom-$valeur' value='$valeur'"
338 338
 					. (($valeur == $contenu['valeur']) ? "\nchecked='checked'" : '')
339 339
 					. "/>\n";
340
-				$fieldset .= "<label for='$nom-$valeur'>" . $label . "</label>\n";
340
+				$fieldset .= "<label for='$nom-$valeur'>".$label."</label>\n";
341 341
 			}
342 342
 			$fieldset .= "<br />\n";
343 343
 		} else {
344
-			$fieldset .= "<label for='" . $nom . "'>" . $contenu['label'] . "</label>\n";
345
-			$fieldset .= '<input ' . $class . "type='" . $type . "' id='" . $nom . "' name='" . $nom . "'\nvalue='" . $contenu['valeur'] . "'"
344
+			$fieldset .= "<label for='".$nom."'>".$contenu['label']."</label>\n";
345
+			$fieldset .= '<input '.$class."type='".$type."' id='".$nom."' name='".$nom."'\nvalue='".$contenu['valeur']."'"
346 346
 				. (preg_match(',^(pass|login),', $nom) ? " autocomplete='off'" : '')
347 347
 				. ((isset($contenu['required']) and $contenu['required']) ? " required='required'" : '')
348 348
 				. " />\n";
@@ -354,7 +354,7 @@  discard block
 block discarded – undo
354 354
 
355 355
 function install_select_serveur() {
356 356
 	$options = [];
357
-	$dir = _DIR_RESTREINT . 'req/';
357
+	$dir = _DIR_RESTREINT.'req/';
358 358
 	$d = opendir($dir);
359 359
 	if (!$d) {
360 360
 		return [];
@@ -362,17 +362,17 @@  discard block
 block discarded – undo
362 362
 	while (($f = readdir($d)) !== false) {
363 363
 		if (
364 364
 			(preg_match('/^(.*)[.]php$/', $f, $s))
365
-			and is_readable($f = $dir . $f)
365
+			and is_readable($f = $dir.$f)
366 366
 		) {
367 367
 			require_once($f);
368 368
 			$s = $s[1];
369
-			$v = 'spip_versions_' . $s;
369
+			$v = 'spip_versions_'.$s;
370 370
 			if (function_exists($v) and $v()) {
371 371
 				$titre = _T("install_select_type_$s");
372 372
 				// proposer mysql par defaut si dispo
373 373
 				$checked = ($s == 'mysql' ? " checked='checked'" : '');
374 374
 				$options[$s] = "<li><input type='radio' id='$s' value='$s' name='server_db'$checked>"
375
-					. "<label for='$s'>" . ($titre ?: $s) . '</label></li>';
375
+					. "<label for='$s'>".($titre ?: $s).'</label></li>';
376 376
 			} else {
377 377
 				spip_log("$s: portage indisponible");
378 378
 			}
@@ -391,8 +391,8 @@  discard block
 block discarded – undo
391 391
 		"\n<input type='hidden' name='etape' value='$etape' />"
392 392
 		. $hidden
393 393
 		. (_request('echec') ?
394
-			('<p><b>' . _T('avis_connexion_echec_1') .
395
-				'</b></p><p>' . _T('avis_connexion_echec_2') . "</p><p style='font-size: small;'>" . _T('avis_connexion_echec_3') . '</p>')
394
+			('<p><b>'._T('avis_connexion_echec_1').
395
+				'</b></p><p>'._T('avis_connexion_echec_2')."</p><p style='font-size: small;'>"._T('avis_connexion_echec_3').'</p>')
396 396
 			: '')
397 397
 
398 398
 		. ($jquery ? http_script('', 'jquery.js') : '')
@@ -430,9 +430,9 @@  discard block
 block discarded – undo
430 430
 		});')
431 431
 
432 432
 		. ($server_db
433
-			? '<input type="hidden" name="server_db" value="' . $server_db . '" />'
433
+			? '<input type="hidden" name="server_db" value="'.$server_db.'" />'
434 434
 			. (($predef[0])
435
-				? ('<h3>' . _T('install_serveur_hebergeur') . '</h3>')
435
+				? ('<h3>'._T('install_serveur_hebergeur').'</h3>')
436 436
 				: '')
437 437
 			: ('<fieldset><legend>'
438 438
 				. _T('install_select_type_db')
@@ -447,9 +447,9 @@  discard block
 block discarded – undo
447 447
 				. "\n</ul>\n</div></fieldset>")
448 448
 		)
449 449
 		. '<div id="install_adresse_base_hebergeur">'
450
-		. '<p>' . _T('texte_connexion_mysql') . '</p>'
450
+		. '<p>'._T('texte_connexion_mysql').'</p>'
451 451
 		. ($predef[1]
452
-			? '<h3>' . _T('install_adresse_base_hebergeur') . '</h3>'
452
+			? '<h3>'._T('install_adresse_base_hebergeur').'</h3>'
453 453
 			: fieldset(
454 454
 				_T('entree_base_donnee_1'),
455 455
 				[
@@ -464,7 +464,7 @@  discard block
 block discarded – undo
464 464
 
465 465
 		. '<div id="install_login_base_hebergeur">'
466 466
 		. ($predef[2]
467
-			? '<h3>' . _T('install_login_base_hebergeur') . '</h3>'
467
+			? '<h3>'._T('install_login_base_hebergeur').'</h3>'
468 468
 			: fieldset(
469 469
 				_T('entree_login_connexion_1'),
470 470
 				[
@@ -479,7 +479,7 @@  discard block
 block discarded – undo
479 479
 
480 480
 		. '<div id="install_pass_base_hebergeur">'
481 481
 		. ($predef[3]
482
-			? '<h3>' . _T('install_pass_base_hebergeur') . '</h3>'
482
+			? '<h3>'._T('install_pass_base_hebergeur').'</h3>'
483 483
 			: fieldset(
484 484
 				_T('entree_mot_passe_1'),
485 485
 				[
@@ -502,20 +502,20 @@  discard block
 block discarded – undo
502 502
 function predef_ou_cache($adresse_db, $login_db, $pass_db, $server_db) {
503 503
 	return ((defined('_INSTALL_HOST_DB'))
504 504
 		? ''
505
-		: "\n<input type='hidden' name='adresse_db'  value=\"" . spip_htmlspecialchars($adresse_db) . '" />'
505
+		: "\n<input type='hidden' name='adresse_db'  value=\"".spip_htmlspecialchars($adresse_db).'" />'
506 506
 	)
507 507
 	. ((defined('_INSTALL_USER_DB'))
508 508
 		? ''
509
-		: "\n<input type='hidden' name='login_db' value=\"" . spip_htmlspecialchars($login_db) . '" />'
509
+		: "\n<input type='hidden' name='login_db' value=\"".spip_htmlspecialchars($login_db).'" />'
510 510
 	)
511 511
 	. ((defined('_INSTALL_PASS_DB'))
512 512
 		? ''
513
-		: "\n<input type='hidden' name='pass_db' value=\"" . spip_htmlspecialchars($pass_db) . '" />'
513
+		: "\n<input type='hidden' name='pass_db' value=\"".spip_htmlspecialchars($pass_db).'" />'
514 514
 	)
515 515
 
516 516
 	. ((defined('_INSTALL_SERVER_DB'))
517 517
 		? ''
518
-		: "\n<input type='hidden' name='server_db' value=\"" . spip_htmlspecialchars($server_db) . '" />'
518
+		: "\n<input type='hidden' name='server_db' value=\"".spip_htmlspecialchars($server_db).'" />'
519 519
 	);
520 520
 }
521 521
 
Please login to merge, or discard this patch.
ecrire/inc/filtres_ecrire.php 1 patch
Spacing   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -114,7 +114,7 @@  discard block
 block discarded – undo
114 114
 	if ($objet == 'rubrique') {
115 115
 		// si c'est une rubrique-secteur contenant des breves, demander la
116 116
 		// confirmation du deplacement
117
-		$contient_breves = sql_countsel('spip_breves', 'id_rubrique=' . intval($id_objet));
117
+		$contient_breves = sql_countsel('spip_breves', 'id_rubrique='.intval($id_objet));
118 118
 
119 119
 		if ($contient_breves > 0) {
120 120
 			$scb = ($contient_breves > 1 ? 's' : '');
@@ -127,7 +127,7 @@  discard block
 block discarded – undo
127 127
 			);
128 128
 			$confirm .= "\n<div class='confirmer_deplacement verdana2'>"
129 129
 				. "<div class='choix'><input type='checkbox' name='confirme_deplace' value='oui' id='confirme-deplace' /><label for='confirme-deplace'>"
130
-				. $scb .
130
+				. $scb.
131 131
 				"</label></div></div>\n";
132 132
 		} else {
133 133
 			$confirm .= "<input type='hidden' name='confirme_deplace' value='oui' />\n";
@@ -136,11 +136,11 @@  discard block
 block discarded – undo
136 136
 	$form .= $confirm;
137 137
 	if ($actionable) {
138 138
 		if (strpos($form, '<select') !== false) {
139
-			$form .= "<div style='text-align: " . $GLOBALS['spip_lang_right'] . ";'>"
140
-				. '<input class="fondo submit btn" type="submit" value="' . _T('bouton_choisir') . '"/>'
139
+			$form .= "<div style='text-align: ".$GLOBALS['spip_lang_right'].";'>"
140
+				. '<input class="fondo submit btn" type="submit" value="'._T('bouton_choisir').'"/>'
141 141
 				. '</div>';
142 142
 		}
143
-		$form = "<input type='hidden' name='editer_$objet' value='oui' />\n" . $form;
143
+		$form = "<input type='hidden' name='editer_$objet' value='oui' />\n".$form;
144 144
 		if ($action = charger_fonction("editer_$objet", 'action', true)) {
145 145
 			$form = generer_action_auteur(
146 146
 				"editer_$objet",
@@ -166,7 +166,7 @@  discard block
 block discarded – undo
166 166
 
167 167
 	include_spip('inc/presentation');
168 168
 
169
-	return debut_cadre_couleur($logo, true, '', $titre) . $form . fin_cadre_couleur();
169
+	return debut_cadre_couleur($logo, true, '', $titre).$form.fin_cadre_couleur();
170 170
 }
171 171
 
172 172
 
@@ -242,7 +242,7 @@  discard block
 block discarded – undo
242 242
 	if ($statut == 'nouveau') {
243 243
 		if ($attente) {
244 244
 			$statut = $attente;
245
-			$plus = ' (' . _T('info_statut_auteur_a_confirmer') . ')';
245
+			$plus = ' ('._T('info_statut_auteur_a_confirmer').')';
246 246
 		} else {
247 247
 			return _T('info_statut_auteur_a_confirmer');
248 248
 		}
@@ -255,16 +255,16 @@  discard block
 block discarded – undo
255 255
 		'5poubelle' => _T('texte_statut_poubelle'), // bouh
256 256
 	];
257 257
 	if (isset($recom[$statut])) {
258
-		return $recom[$statut] . $plus;
258
+		return $recom[$statut].$plus;
259 259
 	}
260 260
 
261 261
 	// retrouver directement par le statut sinon
262 262
 	if ($t = array_search($statut, $GLOBALS['liste_des_statuts'])) {
263 263
 		if (isset($recom[$t])) {
264
-			return $recom[$t] . $plus;
264
+			return $recom[$t].$plus;
265 265
 		}
266 266
 
267
-		return _T($t) . $plus;
267
+		return _T($t).$plus;
268 268
 	}
269 269
 
270 270
 	// si on a pas reussi a le traduire, retournons la chaine telle quelle
@@ -388,7 +388,7 @@  discard block
 block discarded – undo
388 388
 	if (!$id_rubrique and defined('_CHOIX_RUBRIQUE_PAR_DEFAUT') and _CHOIX_RUBRIQUE_PAR_DEFAUT) {
389 389
 		$in = !(is_countable($GLOBALS['connect_id_rubrique']) ? count($GLOBALS['connect_id_rubrique']) : 0)
390 390
 			? ''
391
-			: (' AND ' . sql_in('id_rubrique', $GLOBALS['connect_id_rubrique']));
391
+			: (' AND '.sql_in('id_rubrique', $GLOBALS['connect_id_rubrique']));
392 392
 
393 393
 		// on tente d'abord l'ecriture a la racine dans le cas des rubriques uniquement
394 394
 		if ($objet == 'rubrique') {
@@ -422,7 +422,7 @@  discard block
 block discarded – undo
422 422
 		return '';
423 423
 	}
424 424
 
425
-	return propre('[->' . $virtuel . ']');
425
+	return propre('[->'.$virtuel.']');
426 426
 }
427 427
 
428 428
 
@@ -450,7 +450,7 @@  discard block
 block discarded – undo
450 450
 	$args = param_low_sec($op, $args, $lang, 'rss');
451 451
 	$url = generer_url_public('rss', $args);
452 452
 
453
-	return "<a style='float: " . $GLOBALS['spip_lang_right'] . ";' href='$url'>$clic</a>";
453
+	return "<a style='float: ".$GLOBALS['spip_lang_right'].";' href='$url'>$clic</a>";
454 454
 }
455 455
 
456 456
 
@@ -526,7 +526,7 @@  discard block
 block discarded – undo
526 526
 	);
527 527
 
528 528
 	if ($alertes = array_filter($alertes)) {
529
-		return "<div class='wrap-messages-alertes'><div class='messages-alertes'>" .
529
+		return "<div class='wrap-messages-alertes'><div class='messages-alertes'>".
530 530
 		join(' | ', $alertes)
531 531
 		. '</div></div>';
532 532
 	}
@@ -560,13 +560,13 @@  discard block
 block discarded – undo
560 560
  */
561 561
 function afficher_plus_info($lien, $titre = '+', $titre_lien = '') {
562 562
 	$titre = attribut_html($titre);
563
-	$icone = "\n<a href='$lien' title='$titre' class='plus_info'>" .
564
-		http_img_pack('information-16.png', $titre) . '</a>';
563
+	$icone = "\n<a href='$lien' title='$titre' class='plus_info'>".
564
+		http_img_pack('information-16.png', $titre).'</a>';
565 565
 
566 566
 	if (!$titre_lien) {
567 567
 		return $icone;
568 568
 	} else {
569
-		return $icone . "\n<a href='$lien'>$titre_lien</a>";
569
+		return $icone."\n<a href='$lien'>$titre_lien</a>";
570 570
 	}
571 571
 }
572 572
 
Please login to merge, or discard this patch.