Completed
Pull Request — master (#36)
by
unknown
06:08
created
ecrire/base/dump.php 2 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -311,7 +311,7 @@
 block discarded – undo
311 311
  * peut etre utilise pour l'import depuis xml,
312 312
  * ou la copie de base a base (mysql<->sqlite par exemple)
313 313
  *
314
- * @param array $tables
314
+ * @param string[] $tables
315 315
  * @param array $exclure_tables
316 316
  * @param string $serveur
317 317
  */
Please login to merge, or discard this patch.
Spacing   +36 added lines, -36 removed lines patch added patch discarded remove patch
@@ -30,7 +30,7 @@  discard block
 block discarded – undo
30 30
 // donc il faut l'inclure "en globals"
31 31
 if ($f = find_in_path('mes_fonctions.php')) {
32 32
 	global $dossier_squelettes;
33
-	@include_once(_ROOT_CWD . $f);
33
+	@include_once(_ROOT_CWD.$f);
34 34
 }
35 35
 
36 36
 if (@is_readable(_CACHE_PLUGINS_FCT)) {
@@ -48,7 +48,7 @@  discard block
 block discarded – undo
48 48
  * @return string
49 49
  **/
50 50
 function base_dump_meta_name($rub) {
51
-	return $meta = "status_dump_{$rub}_" . abs($GLOBALS['visiteur_session']['id_auteur']);
51
+	return $meta = "status_dump_{$rub}_".abs($GLOBALS['visiteur_session']['id_auteur']);
52 52
 }
53 53
 
54 54
 /**
@@ -94,7 +94,7 @@  discard block
 block discarded – undo
94 94
 	$connexion = $GLOBALS['connexions'][$serveur ? $serveur : 0];
95 95
 	$prefixe = $connexion['prefixe'];
96 96
 
97
-	$p = '/^' . $prefixe . '/';
97
+	$p = '/^'.$prefixe.'/';
98 98
 	$res = $tables;
99 99
 	foreach (sql_alltable(null, $serveur) as $t) {
100 100
 		if (preg_match($p, $t)) {
@@ -353,8 +353,8 @@  discard block
 block discarded – undo
353 353
 function base_vider_tables_destination_copie($tables, $exclure_tables = array(), $serveur = '') {
354 354
 	$trouver_table = charger_fonction('trouver_table', 'base');
355 355
 
356
-	spip_log('Vider ' . count($tables) . " tables sur serveur '$serveur' : " . join(', ', $tables),
357
-		'base.' . _LOG_INFO_IMPORTANTE);
356
+	spip_log('Vider '.count($tables)." tables sur serveur '$serveur' : ".join(', ', $tables),
357
+		'base.'._LOG_INFO_IMPORTANTE);
358 358
 	foreach ($tables as $table) {
359 359
 		if (!in_array($table, $exclure_tables)) {
360 360
 			// sur le serveur principal, il ne faut pas supprimer l'auteur loge !
@@ -391,14 +391,14 @@  discard block
 block discarded – undo
391 391
 function base_conserver_copieur($move = true, $serveur = '') {
392 392
 	// s'asurer qu'on a pas deja fait la manip !
393 393
 	if ($GLOBALS['visiteur_session']['id_auteur'] > 0 and sql_countsel("spip_auteurs", "id_auteur>0")) {
394
-		spip_log('Conserver copieur dans id_auteur=' . $GLOBALS['visiteur_session']['id_auteur'] . " pour le serveur '$serveur'",
395
-			'dump.' . _LOG_INFO_IMPORTANTE);
394
+		spip_log('Conserver copieur dans id_auteur='.$GLOBALS['visiteur_session']['id_auteur']." pour le serveur '$serveur'",
395
+			'dump.'._LOG_INFO_IMPORTANTE);
396 396
 		sql_delete("spip_auteurs", "id_auteur<0", $serveur);
397 397
 		if ($move) {
398 398
 			sql_updateq('spip_auteurs', array('id_auteur' => -$GLOBALS['visiteur_session']['id_auteur']),
399
-				"id_auteur=" . intval($GLOBALS['visiteur_session']['id_auteur']), array(), $serveur);
399
+				"id_auteur=".intval($GLOBALS['visiteur_session']['id_auteur']), array(), $serveur);
400 400
 		} else {
401
-			$row = sql_fetsel('*', 'spip_auteurs', 'id_auteur=' . $GLOBALS['visiteur_session']['id_auteur'], '', '', '', '',
401
+			$row = sql_fetsel('*', 'spip_auteurs', 'id_auteur='.$GLOBALS['visiteur_session']['id_auteur'], '', '', '', '',
402 402
 				$serveur);
403 403
 			$row['id_auteur'] = -$GLOBALS['visiteur_session']['id_auteur'];
404 404
 			sql_insertq('spip_auteurs', $row, array(), $serveur);
@@ -421,15 +421,15 @@  discard block
 block discarded – undo
421 421
 	// rien a faire si ce n'est pas le serveur principal !
422 422
 	if ($serveur == '') {
423 423
 		if (sql_countsel("spip_auteurs", "id_auteur>0")) {
424
-			spip_log("Detruire copieur id_auteur<0 pour le serveur '$serveur'", 'dump.' . _LOG_INFO_IMPORTANTE);
424
+			spip_log("Detruire copieur id_auteur<0 pour le serveur '$serveur'", 'dump.'._LOG_INFO_IMPORTANTE);
425 425
 			sql_delete("spip_auteurs", "id_auteur<0", $serveur);
426 426
 		} else {
427 427
 			spip_log("Restaurer copieur id_auteur<0 pour le serveur '$serveur' (aucun autre auteur en base)",
428
-				'dump.' . _LOG_INFO_IMPORTANTE);
428
+				'dump.'._LOG_INFO_IMPORTANTE);
429 429
 			sql_update('spip_auteurs', array('id_auteur' => '-id_auteur'), "id_auteur<0");
430 430
 		}
431 431
 	} else {
432
-		spip_log("Pas de destruction copieur sur serveur '$serveur'", 'dump.' . _LOG_INFO_IMPORTANTE);
432
+		spip_log("Pas de destruction copieur sur serveur '$serveur'", 'dump.'._LOG_INFO_IMPORTANTE);
433 433
 	}
434 434
 }
435 435
 
@@ -463,19 +463,19 @@  discard block
 block discarded – undo
463 463
 			}
464 464
 		} else {
465 465
 			sql_drop_table($table, '', $serveur_dest);
466
-			spip_log("drop table '$table' sur serveur '$serveur_dest'", 'dump.' . _LOG_INFO_IMPORTANTE);
466
+			spip_log("drop table '$table' sur serveur '$serveur_dest'", 'dump.'._LOG_INFO_IMPORTANTE);
467 467
 		}
468 468
 		$desc_dest = false;
469 469
 	}
470 470
 	// si la table n'existe pas dans la destination, la creer a l'identique !
471 471
 	if (!$desc_dest) {
472
-		spip_log("creation '$table' sur serveur '$serveur_dest'", 'dump.' . _LOG_INFO_IMPORTANTE);
472
+		spip_log("creation '$table' sur serveur '$serveur_dest'", 'dump.'._LOG_INFO_IMPORTANTE);
473 473
 		include_spip('base/create');
474 474
 		creer_ou_upgrader_table($table, $desc, 'auto', $upgrade, $serveur_dest);
475 475
 		$desc_dest = sql_showtable($table, true, $serveur_dest);
476 476
 	}
477 477
 	if (!$desc_dest) {
478
-		spip_log("Erreur creation '$table' sur serveur '$serveur_dest'" . var_export($desc, 1), 'dump.' . _LOG_ERREUR);
478
+		spip_log("Erreur creation '$table' sur serveur '$serveur_dest'".var_export($desc, 1), 'dump.'._LOG_ERREUR);
479 479
 	}
480 480
 
481 481
 	return $desc_dest;
@@ -534,16 +534,16 @@  discard block
 block discarded – undo
534 534
 	$racine_fonctions = (isset($options['racine_fonctions_dest']) ? $options['racine_fonctions_dest'] : 'base');
535 535
 	$data_pool = (isset($options['data_pool']) ? $options['data_pool'] : 50 * 1024);
536 536
 
537
-	spip_log("Copier " . count($tables) . " tables de '$serveur_source' vers '$serveur_dest'",
538
-		'dump.' . _LOG_INFO_IMPORTANTE);
537
+	spip_log("Copier ".count($tables)." tables de '$serveur_source' vers '$serveur_dest'",
538
+		'dump.'._LOG_INFO_IMPORTANTE);
539 539
 
540 540
 	if (!$inserer_copie = charger_fonction($fonction_base_inserer, $racine_fonctions, true)) {
541
-		spip_log("Fonction '{$racine_fonctions}_$fonction_base_inserer' inconnue. Abandon", 'dump.' . _LOG_INFO_IMPORTANTE);
541
+		spip_log("Fonction '{$racine_fonctions}_$fonction_base_inserer' inconnue. Abandon", 'dump.'._LOG_INFO_IMPORTANTE);
542 542
 
543 543
 		return true; // echec mais on a fini, donc true
544 544
 	}
545 545
 	if (!$preparer_table_dest = charger_fonction('preparer_table_dest', $racine_fonctions, true)) {
546
-		spip_log("Fonction '{$racine_fonctions}_$preparer_table_dest' inconnue. Abandon", 'dump.' . _LOG_INFO_IMPORTANTE);
546
+		spip_log("Fonction '{$racine_fonctions}_$preparer_table_dest' inconnue. Abandon", 'dump.'._LOG_INFO_IMPORTANTE);
547 547
 
548 548
 		return true; // echec mais on a fini, donc true
549 549
 	}
@@ -565,7 +565,7 @@  discard block
 block discarded – undo
565 565
 			true)
566 566
 		) {
567 567
 			spip_log("Fonction '{$racine_fonctions}_vider_tables_destination_copie' inconnue. Abandon",
568
-				'dump.' . _LOG_INFO_IMPORTANTE);
568
+				'dump.'._LOG_INFO_IMPORTANTE);
569 569
 
570 570
 			return true; // echec mais on a fini, donc true
571 571
 		}
@@ -583,7 +583,7 @@  discard block
 block discarded – undo
583 583
 		$tables = array_diff($tables, array('spip_meta'));
584 584
 		$tables[] = 'spip_meta';
585 585
 	}
586
-	spip_log("Tables a copier :" . implode(", ", $tables), 'dump.' . _LOG_INFO);
586
+	spip_log("Tables a copier :".implode(", ", $tables), 'dump.'._LOG_INFO);
587 587
 
588 588
 	$trouver_table = charger_fonction('trouver_table', 'base');
589 589
 
@@ -637,7 +637,7 @@  discard block
 block discarded – undo
637 637
 						// mais si ca renvoie false c'est une erreur fatale => abandon
638 638
 						if ($inserer_copie($table, $rows, $desc_dest, $serveur_dest) === false) {
639 639
 							// forcer la sortie, charge a l'appelant de gerer l'echec
640
-							spip_log("Erreur fatale dans $inserer_copie table $table", "dump" . _LOG_ERREUR);
640
+							spip_log("Erreur fatale dans $inserer_copie table $table", "dump"._LOG_ERREUR);
641 641
 							$status['errors'][] = "Erreur fatale  lors de la copie de la table $table";
642 642
 							ecrire_fichier($status_file, serialize($status));
643 643
 
@@ -652,7 +652,7 @@  discard block
 block discarded – undo
652 652
 					if ($n == $status['tables_copiees'][$table]) {
653 653
 						break;
654 654
 					}
655
-					spip_log("recopie $table " . $status['tables_copiees'][$table], 'dump.' . _LOG_INFO_IMPORTANTE);
655
+					spip_log("recopie $table ".$status['tables_copiees'][$table], 'dump.'._LOG_INFO_IMPORTANTE);
656 656
 					if ($callback_progression) {
657 657
 						$callback_progression($status['tables_copiees'][$table], 0, $table);
658 658
 					}
@@ -663,43 +663,43 @@  discard block
 block discarded – undo
663 663
 				}
664 664
 				if ($drop_source) {
665 665
 					sql_drop_table($table, '', $serveur_source);
666
-					spip_log("drop $table sur serveur source '$serveur_source'", 'dump.' . _LOG_INFO_IMPORTANTE);
666
+					spip_log("drop $table sur serveur source '$serveur_source'", 'dump.'._LOG_INFO_IMPORTANTE);
667 667
 				}
668 668
 				$status['tables_copiees'][$table] = ($status['tables_copiees'][$table] ? -$status['tables_copiees'][$table] : "zero");
669 669
 				ecrire_fichier($status_file, serialize($status));
670
-				spip_log("tables_recopiees " . implode(',', array_keys($status['tables_copiees'])), 'dump.' . _LOG_INFO);
670
+				spip_log("tables_recopiees ".implode(',', array_keys($status['tables_copiees'])), 'dump.'._LOG_INFO);
671 671
 				if ($callback_progression) {
672 672
 					$callback_progression($status['tables_copiees'][$table], $status['tables_copiees'][$table], $table);
673 673
 				}
674 674
 			} else {
675 675
 				if ($status['tables_copiees'][$table] < 0) {
676
-					spip_log("Table $table deja copiee : " . $status['tables_copiees'][$table], "dump." . _LOG_INFO);
676
+					spip_log("Table $table deja copiee : ".$status['tables_copiees'][$table], "dump."._LOG_INFO);
677 677
 				}
678 678
 				if ($callback_progression) {
679 679
 					$callback_progression(0, $status['tables_copiees'][$table],
680
-						"$table" . ((is_numeric($status['tables_copiees'][$table]) and $status['tables_copiees'][$table] >= 0) ? "[Echec]" : ""));
680
+						"$table".((is_numeric($status['tables_copiees'][$table]) and $status['tables_copiees'][$table] >= 0) ? "[Echec]" : ""));
681 681
 				}
682 682
 			}
683 683
 		} else {
684 684
 			$status['errors'][] = "Impossible de lire la description de la table $table";
685 685
 			ecrire_fichier($status_file, serialize($status));
686
-			spip_log("Impossible de lire la description de la table $table", "dump." . _LOG_ERREUR);
686
+			spip_log("Impossible de lire la description de la table $table", "dump."._LOG_ERREUR);
687 687
 		}
688 688
 	}
689 689
 
690 690
 	// si le nombre de tables envoyees n'est pas egal au nombre de tables demandees
691 691
 	// abandonner
692 692
 	if (count($status['tables_copiees']) < count($tables)) {
693
-		spip_log("Nombre de tables copiees incorrect : " . count($status['tables_copiees']) . "/" . count($tables),
694
-			"dump." . _LOG_ERREUR);
695
-		$status['errors'][] = "Nombre de tables copiees incorrect : " . count($status['tables_copiees']) . "/" . count($tables);
693
+		spip_log("Nombre de tables copiees incorrect : ".count($status['tables_copiees'])."/".count($tables),
694
+			"dump."._LOG_ERREUR);
695
+		$status['errors'][] = "Nombre de tables copiees incorrect : ".count($status['tables_copiees'])."/".count($tables);
696 696
 		ecrire_fichier($status_file, serialize($status));
697 697
 	}
698 698
 
699 699
 	if ($detruire_copieur_si_besoin = charger_fonction('detruire_copieur_si_besoin', $racine_fonctions, true)) {
700 700
 		$detruire_copieur_si_besoin($serveur_dest);
701 701
 	} else {
702
-		spip_log("Fonction '{$racine_fonctions}_detruire_copieur_si_besoin' inconnue.", 'dump.' . _LOG_INFO_IMPORTANTE);
702
+		spip_log("Fonction '{$racine_fonctions}_detruire_copieur_si_besoin' inconnue.", 'dump.'._LOG_INFO_IMPORTANTE);
703 703
 	}
704 704
 
705 705
 	// OK, copie complete
@@ -723,8 +723,8 @@  discard block
 block discarded – undo
723 723
 	$r = sql_insertq_multi($table, $rows, $desc_dest, $serveur_dest);
724 724
 	$nb = sql_countsel($table, '', '', '', $serveur_dest);
725 725
 	if ($nb - $nb1 < count($rows)) {
726
-		spip_log("base_inserer_copie : " . ($nb - $nb1) . " insertions au lieu de " . count($rows) . ". On retente 1 par 1",
727
-			"dump" . _LOG_INFO_IMPORTANTE);
726
+		spip_log("base_inserer_copie : ".($nb - $nb1)." insertions au lieu de ".count($rows).". On retente 1 par 1",
727
+			"dump"._LOG_INFO_IMPORTANTE);
728 728
 		foreach ($rows as $row) {
729 729
 			// si l'enregistrement est deja en base, ca fera un echec ou un doublon
730 730
 			$r = sql_insertq($table, $row, $desc_dest, $serveur_dest);
@@ -733,8 +733,8 @@  discard block
 block discarded – undo
733 733
 		$r = 0;
734 734
 		$nb = sql_countsel($table, '', '', '', $serveur_dest);
735 735
 		if ($nb - $nb1 < count($rows)) {
736
-			spip_log("base_inserer_copie : " . ($nb - $nb1) . " insertions au lieu de " . count($rows) . " apres insertion 1 par 1",
737
-				"dump" . _LOG_ERREUR);
736
+			spip_log("base_inserer_copie : ".($nb - $nb1)." insertions au lieu de ".count($rows)." apres insertion 1 par 1",
737
+				"dump"._LOG_ERREUR);
738 738
 			$r = false;
739 739
 		}
740 740
 	}
Please login to merge, or discard this patch.
ecrire/inc/cookie.php 2 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -35,7 +35,7 @@
 block discarded – undo
35 35
  *     Chemin sur lequel le cookie sera disponible
36 36
  * @param string $domain
37 37
  *     Domaine à partir duquel le cookie est disponible
38
- * @param bool $secure
38
+ * @param string|boolean $secure
39 39
  *     cookie sécurisé ou non ?
40 40
  * @return bool
41 41
  *     true si le cookie a été posé, false sinon.
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -46,7 +46,7 @@  discard block
 block discarded – undo
46 46
 	// liste des cookies en httponly (a passer en define si besoin)
47 47
 	$httponly = in_array($name, explode(' ', 'spip_session'));
48 48
 
49
-	$name = preg_replace('/^spip_/', $GLOBALS['cookie_prefix'] . '_', $name);
49
+	$name = preg_replace('/^spip_/', $GLOBALS['cookie_prefix'].'_', $name);
50 50
 	if ($path == 'AUTO') {
51 51
 		$path = defined('_COOKIE_PATH') ? _COOKIE_PATH : preg_replace(',^\w+://[^/]*,', '', url_de_base());
52 52
 	}
@@ -123,7 +123,7 @@  discard block
 block discarded – undo
123 123
 	}
124 124
 	foreach ($_COOKIE as $name => $value) {
125 125
 		if (substr($name, 0, $prefix_long) == $cookie_prefix) {
126
-			$spipname = preg_replace('/^' . $cookie_prefix . '_/', 'spip_', $name);
126
+			$spipname = preg_replace('/^'.$cookie_prefix.'_/', 'spip_', $name);
127 127
 			$_COOKIE[$spipname] = $value;
128 128
 			$GLOBALS[$spipname] = $value;
129 129
 		}
Please login to merge, or discard this patch.
ecrire/inc/modifier.php 2 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -83,7 +83,7 @@
 block discarded – undo
83 83
  *     Couples champ/valeur à modifier
84 84
  * @param string $serveur
85 85
  *     Nom du connecteur à la base de données
86
- * @return bool|string
86
+ * @return string|false
87 87
  *     - false  : Aucune modification, aucun champ n'est à modifier
88 88
  *     - chaîne vide : Vide si tout s'est bien passé
89 89
  *     - chaîne : Texte d'un message d'erreur
Please login to merge, or discard this patch.
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -113,7 +113,7 @@  discard block
 block discarded – undo
113 113
 
114 114
 	// Appels incomplets (sans $c)
115 115
 	if (!is_array($c)) {
116
-		spip_log('erreur appel objet_modifier_champs(' . $objet . '), manque $c');
116
+		spip_log('erreur appel objet_modifier_champs('.$objet.'), manque $c');
117 117
 
118 118
 		return _T('erreur_technique_enregistrement_impossible');
119 119
 	}
@@ -181,7 +181,7 @@  discard block
 block discarded – undo
181 181
 
182 182
 	// Verifier si les mises a jour sont pertinentes, datees, en conflit etc
183 183
 	include_spip('inc/editer');
184
-	if (!isset($options['data']) or is_null($options['data'])){
184
+	if (!isset($options['data']) or is_null($options['data'])) {
185 185
 		$options['data'] = &$_POST;
186 186
 	}
187 187
 	$conflits = controler_md5($champs, $options['data'], $objet, $id_objet, $serveur);
@@ -199,7 +199,7 @@  discard block
 block discarded – undo
199 199
 				$id_rubrique = 0;
200 200
 				if (isset($desc['field']['id_rubrique'])) {
201 201
 					$parent = ($objet == 'rubrique') ? 'id_parent' : 'id_rubrique';
202
-					$id_rubrique = sql_getfetsel($parent, $spip_table_objet, "$id_table_objet=" . intval($id_objet));
202
+					$id_rubrique = sql_getfetsel($parent, $spip_table_objet, "$id_table_objet=".intval($id_objet));
203 203
 				}
204 204
 				$instituer_langue_objet = charger_fonction('instituer_langue_objet', 'action');
205 205
 				$champs['lang'] = $instituer_langue_objet($objet, $id_objet, $id_rubrique, $changer_lang, $serveur);
@@ -220,10 +220,10 @@  discard block
 block discarded – undo
220 220
 		}
221 221
 
222 222
 		// allez on commit la modif
223
-		sql_updateq($spip_table_objet, $champs, "$id_table_objet=" . intval($id_objet), $serveur);
223
+		sql_updateq($spip_table_objet, $champs, "$id_table_objet=".intval($id_objet), $serveur);
224 224
 
225 225
 		// on verifie si elle est bien passee
226
-		$moof = sql_fetsel(array_keys($champs), $spip_table_objet, "$id_table_objet=" . intval($id_objet), array(), array(),
226
+		$moof = sql_fetsel(array_keys($champs), $spip_table_objet, "$id_table_objet=".intval($id_objet), array(), array(),
227 227
 			'', array(), $serveur);
228 228
 		// si difference entre les champs, reperer les champs mal enregistres
229 229
 		if ($moof != $champs) {
@@ -250,11 +250,11 @@  discard block
 block discarded – undo
250 250
 			// si un champ n'a pas ete correctement enregistre, loger et retourner une erreur
251 251
 			// c'est un cas exceptionnel
252 252
 			if (count($liste)) {
253
-				spip_log("Erreur enregistrement en base $objet/$id_objet champs :" . var_export($conflits, true),
254
-					'modifier.' . _LOG_CRITIQUE);
253
+				spip_log("Erreur enregistrement en base $objet/$id_objet champs :".var_export($conflits, true),
254
+					'modifier.'._LOG_CRITIQUE);
255 255
 
256 256
 				return _T('erreur_technique_enregistrement_champs',
257
-					array('champs' => "<i>'" . implode("'</i>,<i>'", $liste) . "'</i>"));
257
+					array('champs' => "<i>'".implode("'</i>,<i>'", $liste)."'</i>"));
258 258
 			}
259 259
 		}
260 260
 
@@ -291,8 +291,8 @@  discard block
 block discarded – undo
291 291
 	// message a affiner :-)
292 292
 	include_spip('inc/filtres_mini');
293 293
 	$qui = isset($GLOBALS['visiteur_session']['nom']) and $GLOBALS['visiteur_session']['nom'] ? $GLOBALS['visiteur_session']['nom'] : $GLOBALS['ip'];
294
-	journal(_L($qui . ' a &#233;dit&#233; l&#8217;' . $objet . ' ' . $id_objet . ' (' . join('+',
295
-			array_diff(array_keys($champs), array('date_modif'))) . ')'), array(
294
+	journal(_L($qui.' a &#233;dit&#233; l&#8217;'.$objet.' '.$id_objet.' ('.join('+',
295
+			array_diff(array_keys($champs), array('date_modif'))).')'), array(
296 296
 		'faire' => 'modifier',
297 297
 		'quoi' => $objet,
298 298
 		'id' => $id_objet
Please login to merge, or discard this patch.
ecrire/auth/sha256.inc.php 2 patches
Doc Comments   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -328,7 +328,7 @@  discard block
 block discarded – undo
328 328
 
329 329
 		/** Array split
330 330
 		 *
331
-		 * @param array $a
331
+		 * @param integer[] $a
332 332
 		 * @param int $n
333 333
 		 * @return array
334 334
 		 **/
@@ -352,7 +352,7 @@  discard block
 block discarded – undo
352 352
 		/**
353 353
 		 * Process and return the hash.
354 354
 		 *
355
-		 * @param $str Input string to hash
355
+		 * @param string $str Input string to hash
356 356
 		 * @param $ig_func Option param to ignore checking for php > 5.1.2
357 357
 		 * @return string Hexadecimal representation of the message digest
358 358
 		 */
Please login to merge, or discard this patch.
Spacing   +114 added lines, -114 removed lines patch added patch discarded remove patch
@@ -98,7 +98,7 @@  discard block
 block discarded – undo
98 98
 				: ((defined('_NANO_SHA2_UPPER')) ? true : false);
99 99
 
100 100
 			// Deteremine if the system is 32 or 64 bit.
101
-			$tmpInt = (int)4294967295;
101
+			$tmpInt = (int) 4294967295;
102 102
 			$this->platform = ($tmpInt > 0) ? 64 : 32;
103 103
 		}
104 104
 
@@ -116,15 +116,15 @@  discard block
 block discarded – undo
116 116
 
117 117
 			if ($x < 0) {
118 118
 				$x &= 0x7FFFFFFF;
119
-				$x = (float)$x+$mask;
119
+				$x = (float) $x + $mask;
120 120
 			}
121 121
 
122 122
 			if ($y < 0) {
123 123
 				$y &= 0x7FFFFFFF;
124
-				$y = (float)$y+$mask;
124
+				$y = (float) $y + $mask;
125 125
 			}
126 126
 
127
-			$r = $x+$y;
127
+			$r = $x + $y;
128 128
 
129 129
 			if ($r >= $n) {
130 130
 				while ($r >= $n) {
@@ -132,7 +132,7 @@  discard block
 block discarded – undo
132 132
 				}
133 133
 			}
134 134
 
135
-			return (int)$r;
135
+			return (int) $r;
136 136
 		}
137 137
 
138 138
 		/**
@@ -145,23 +145,23 @@  discard block
 block discarded – undo
145 145
 		function SHR($x, $n)        // x >> n
146 146
 		{
147 147
 			if ($n >= 32) {      // impose some limits to keep it 32-bit
148
-				return (int)0;
148
+				return (int) 0;
149 149
 			}
150 150
 
151 151
 			if ($n <= 0) {
152
-				return (int)$x;
152
+				return (int) $x;
153 153
 			}
154 154
 
155 155
 			$mask = 0x40000000;
156 156
 
157 157
 			if ($x < 0) {
158 158
 				$x &= 0x7FFFFFFF;
159
-				$mask = $mask >> ($n-1);
159
+				$mask = $mask >> ($n - 1);
160 160
 
161 161
 				return ($x >> $n) | $mask;
162 162
 			}
163 163
 
164
-			return (int)$x >> (int)$n;
164
+			return (int) $x >> (int) $n;
165 165
 		}
166 166
 
167 167
 		/** ROTR
@@ -170,7 +170,7 @@  discard block
 block discarded – undo
170 170
 		 * @param int $n
171 171
 		 * @return int
172 172
 		 */
173
-		function ROTR($x, $n) { return (int)(($this->SHR($x, $n) | ($x << (32-$n)) & 0xFFFFFFFF)); }
173
+		function ROTR($x, $n) { return (int) (($this->SHR($x, $n) | ($x << (32 - $n)) & 0xFFFFFFFF)); }
174 174
 
175 175
 		/** Ch
176 176
 		 *
@@ -195,28 +195,28 @@  discard block
 block discarded – undo
195 195
 		 * @param int $x
196 196
 		 * @return int
197 197
 		 */
198
-		function Sigma0($x) { return (int)($this->ROTR($x, 2) ^ $this->ROTR($x, 13) ^ $this->ROTR($x, 22)); }
198
+		function Sigma0($x) { return (int) ($this->ROTR($x, 2) ^ $this->ROTR($x, 13) ^ $this->ROTR($x, 22)); }
199 199
 
200 200
 		/** Sigma1
201 201
 		 *
202 202
 		 * @param int $x
203 203
 		 * @return int
204 204
 		 */
205
-		function Sigma1($x) { return (int)($this->ROTR($x, 6) ^ $this->ROTR($x, 11) ^ $this->ROTR($x, 25)); }
205
+		function Sigma1($x) { return (int) ($this->ROTR($x, 6) ^ $this->ROTR($x, 11) ^ $this->ROTR($x, 25)); }
206 206
 
207 207
 		/** Sigma_0
208 208
 		 *
209 209
 		 * @param int $x
210 210
 		 * @return int
211 211
 		 */
212
-		function sigma_0($x) { return (int)($this->ROTR($x, 7) ^ $this->ROTR($x, 18) ^ $this->SHR($x, 3)); }
212
+		function sigma_0($x) { return (int) ($this->ROTR($x, 7) ^ $this->ROTR($x, 18) ^ $this->SHR($x, 3)); }
213 213
 
214 214
 		/** Sigma_1
215 215
 		 *
216 216
 		 * @param int $x
217 217
 		 * @return int
218 218
 		 */
219
-		function sigma_1($x) { return (int)($this->ROTR($x, 17) ^ $this->ROTR($x, 19) ^ $this->SHR($x, 10)); }
219
+		function sigma_1($x) { return (int) ($this->ROTR($x, 17) ^ $this->ROTR($x, 19) ^ $this->SHR($x, 10)); }
220 220
 
221 221
 		/** String 2 ord UTF8
222 222
 		 *
@@ -271,23 +271,23 @@  discard block
 block discarded – undo
271 271
 
272 272
 					return $h;
273 273
 				} else {
274
-					if ($h <= 0xDF && $index < $len-1) {
274
+					if ($h <= 0xDF && $index < $len - 1) {
275 275
 						$bytes = 2;
276 276
 
277
-						return ($h & 0x1F) << 6 | (ord($c{$index+1}) & 0x3F);
277
+						return ($h & 0x1F) << 6 | (ord($c{$index + 1}) & 0x3F);
278 278
 					} else {
279
-						if ($h <= 0xEF && $index < $len-2) {
279
+						if ($h <= 0xEF && $index < $len - 2) {
280 280
 							$bytes = 3;
281 281
 
282
-							return ($h & 0x0F) << 12 | (ord($c{$index+1}) & 0x3F) << 6
283
-							| (ord($c{$index+2}) & 0x3F);
282
+							return ($h & 0x0F) << 12 | (ord($c{$index + 1}) & 0x3F) << 6
283
+							| (ord($c{$index + 2}) & 0x3F);
284 284
 						} else {
285
-							if ($h <= 0xF4 && $index < $len-3) {
285
+							if ($h <= 0xF4 && $index < $len - 3) {
286 286
 								$bytes = 4;
287 287
 
288
-								return ($h & 0x0F) << 18 | (ord($c{$index+1}) & 0x3F) << 12
289
-								| (ord($c{$index+2}) & 0x3F) << 6
290
-								| (ord($c{$index+3}) & 0x3F);
288
+								return ($h & 0x0F) << 18 | (ord($c{$index + 1}) & 0x3F) << 12
289
+								| (ord($c{$index + 2}) & 0x3F) << 6
290
+								| (ord($c{$index + 3}) & 0x3F);
291 291
 							} else {
292 292
 								// pas utf mais renvoyer quand meme ce qu'on a
293 293
 								$bytes = 1;
@@ -309,19 +309,19 @@  discard block
 block discarded – undo
309 309
 		function string2binint($str, $npad = 512) {
310 310
 			$bin = array();
311 311
 			$ords = $this->string2ordUTF8($str, $this->bytesString);
312
-			$npad = $npad/$this->bytesString;
312
+			$npad = $npad / $this->bytesString;
313 313
 			$length = count($ords);
314 314
 			$ords[] = 0x80; // append the "1" bit followed by 7 0's
315
-			$pad = ceil(($length+1+32/$this->bytesString)/$npad)*$npad-32/$this->bytesString;
315
+			$pad = ceil(($length + 1 + 32 / $this->bytesString) / $npad) * $npad - 32 / $this->bytesString;
316 316
 			$ords = array_pad($ords, $pad, 0);
317
-			$mask = (1 << $this->bytesString)-1;
318
-			for ($i = 0; $i < count($ords)*$this->bytesString; $i += $this->bytesString) {
317
+			$mask = (1 << $this->bytesString) - 1;
318
+			for ($i = 0; $i < count($ords) * $this->bytesString; $i += $this->bytesString) {
319 319
 				if (!isset($bin[$i >> 5])) {
320 320
 					$bin[$i >> 5] = 0;
321 321
 				} // pour eviter des notices.
322
-				$bin[$i >> 5] |= ($ords[$i/$this->bytesString] & $mask) << (24-$i%32);
322
+				$bin[$i >> 5] |= ($ords[$i / $this->bytesString] & $mask) << (24 - $i % 32);
323 323
 			}
324
-			$bin[] = $length*$this->bytesString;
324
+			$bin[] = $length * $this->bytesString;
325 325
 
326 326
 			return $bin;
327 327
 		}
@@ -357,8 +357,8 @@  discard block
 block discarded – undo
357 357
 		 * @return string Hexadecimal representation of the message digest
358 358
 		 */
359 359
 		function hash($str, $ig_func = true) {
360
-			unset($binStr);     // binary representation of input string
361
-			unset($hexStr);     // 256-bit message digest in readable hex format
360
+			unset($binStr); // binary representation of input string
361
+			unset($hexStr); // 256-bit message digest in readable hex format
362 362
 
363 363
 			// check for php's internal sha256 function, ignore if ig_func==true
364 364
 			if ($ig_func == false) {
@@ -378,70 +378,70 @@  discard block
 block discarded – undo
378 378
 			 *  of the first sixtyfour prime numbers.
379 379
 			 */
380 380
 			$K = array(
381
-				(int)0x428a2f98,
382
-				(int)0x71374491,
383
-				(int)0xb5c0fbcf,
384
-				(int)0xe9b5dba5,
385
-				(int)0x3956c25b,
386
-				(int)0x59f111f1,
387
-				(int)0x923f82a4,
388
-				(int)0xab1c5ed5,
389
-				(int)0xd807aa98,
390
-				(int)0x12835b01,
391
-				(int)0x243185be,
392
-				(int)0x550c7dc3,
393
-				(int)0x72be5d74,
394
-				(int)0x80deb1fe,
395
-				(int)0x9bdc06a7,
396
-				(int)0xc19bf174,
397
-				(int)0xe49b69c1,
398
-				(int)0xefbe4786,
399
-				(int)0x0fc19dc6,
400
-				(int)0x240ca1cc,
401
-				(int)0x2de92c6f,
402
-				(int)0x4a7484aa,
403
-				(int)0x5cb0a9dc,
404
-				(int)0x76f988da,
405
-				(int)0x983e5152,
406
-				(int)0xa831c66d,
407
-				(int)0xb00327c8,
408
-				(int)0xbf597fc7,
409
-				(int)0xc6e00bf3,
410
-				(int)0xd5a79147,
411
-				(int)0x06ca6351,
412
-				(int)0x14292967,
413
-				(int)0x27b70a85,
414
-				(int)0x2e1b2138,
415
-				(int)0x4d2c6dfc,
416
-				(int)0x53380d13,
417
-				(int)0x650a7354,
418
-				(int)0x766a0abb,
419
-				(int)0x81c2c92e,
420
-				(int)0x92722c85,
421
-				(int)0xa2bfe8a1,
422
-				(int)0xa81a664b,
423
-				(int)0xc24b8b70,
424
-				(int)0xc76c51a3,
425
-				(int)0xd192e819,
426
-				(int)0xd6990624,
427
-				(int)0xf40e3585,
428
-				(int)0x106aa070,
429
-				(int)0x19a4c116,
430
-				(int)0x1e376c08,
431
-				(int)0x2748774c,
432
-				(int)0x34b0bcb5,
433
-				(int)0x391c0cb3,
434
-				(int)0x4ed8aa4a,
435
-				(int)0x5b9cca4f,
436
-				(int)0x682e6ff3,
437
-				(int)0x748f82ee,
438
-				(int)0x78a5636f,
439
-				(int)0x84c87814,
440
-				(int)0x8cc70208,
441
-				(int)0x90befffa,
442
-				(int)0xa4506ceb,
443
-				(int)0xbef9a3f7,
444
-				(int)0xc67178f2
381
+				(int) 0x428a2f98,
382
+				(int) 0x71374491,
383
+				(int) 0xb5c0fbcf,
384
+				(int) 0xe9b5dba5,
385
+				(int) 0x3956c25b,
386
+				(int) 0x59f111f1,
387
+				(int) 0x923f82a4,
388
+				(int) 0xab1c5ed5,
389
+				(int) 0xd807aa98,
390
+				(int) 0x12835b01,
391
+				(int) 0x243185be,
392
+				(int) 0x550c7dc3,
393
+				(int) 0x72be5d74,
394
+				(int) 0x80deb1fe,
395
+				(int) 0x9bdc06a7,
396
+				(int) 0xc19bf174,
397
+				(int) 0xe49b69c1,
398
+				(int) 0xefbe4786,
399
+				(int) 0x0fc19dc6,
400
+				(int) 0x240ca1cc,
401
+				(int) 0x2de92c6f,
402
+				(int) 0x4a7484aa,
403
+				(int) 0x5cb0a9dc,
404
+				(int) 0x76f988da,
405
+				(int) 0x983e5152,
406
+				(int) 0xa831c66d,
407
+				(int) 0xb00327c8,
408
+				(int) 0xbf597fc7,
409
+				(int) 0xc6e00bf3,
410
+				(int) 0xd5a79147,
411
+				(int) 0x06ca6351,
412
+				(int) 0x14292967,
413
+				(int) 0x27b70a85,
414
+				(int) 0x2e1b2138,
415
+				(int) 0x4d2c6dfc,
416
+				(int) 0x53380d13,
417
+				(int) 0x650a7354,
418
+				(int) 0x766a0abb,
419
+				(int) 0x81c2c92e,
420
+				(int) 0x92722c85,
421
+				(int) 0xa2bfe8a1,
422
+				(int) 0xa81a664b,
423
+				(int) 0xc24b8b70,
424
+				(int) 0xc76c51a3,
425
+				(int) 0xd192e819,
426
+				(int) 0xd6990624,
427
+				(int) 0xf40e3585,
428
+				(int) 0x106aa070,
429
+				(int) 0x19a4c116,
430
+				(int) 0x1e376c08,
431
+				(int) 0x2748774c,
432
+				(int) 0x34b0bcb5,
433
+				(int) 0x391c0cb3,
434
+				(int) 0x4ed8aa4a,
435
+				(int) 0x5b9cca4f,
436
+				(int) 0x682e6ff3,
437
+				(int) 0x748f82ee,
438
+				(int) 0x78a5636f,
439
+				(int) 0x84c87814,
440
+				(int) 0x8cc70208,
441
+				(int) 0x90befffa,
442
+				(int) 0xa4506ceb,
443
+				(int) 0xbef9a3f7,
444
+				(int) 0xc67178f2
445 445
 			);
446 446
 
447 447
 			// Pre-processing: Padding the string
@@ -451,14 +451,14 @@  discard block
 block discarded – undo
451 451
 			$M = $this->array_split($binStr, 16);
452 452
 
453 453
 			// Set the initial hash values
454
-			$h[0] = (int)0x6a09e667;
455
-			$h[1] = (int)0xbb67ae85;
456
-			$h[2] = (int)0x3c6ef372;
457
-			$h[3] = (int)0xa54ff53a;
458
-			$h[4] = (int)0x510e527f;
459
-			$h[5] = (int)0x9b05688c;
460
-			$h[6] = (int)0x1f83d9ab;
461
-			$h[7] = (int)0x5be0cd19;
454
+			$h[0] = (int) 0x6a09e667;
455
+			$h[1] = (int) 0xbb67ae85;
456
+			$h[2] = (int) 0x3c6ef372;
457
+			$h[3] = (int) 0xa54ff53a;
458
+			$h[4] = (int) 0x510e527f;
459
+			$h[5] = (int) 0x9b05688c;
460
+			$h[6] = (int) 0x1f83d9ab;
461
+			$h[7] = (int) 0x5be0cd19;
462 462
 
463 463
 			// loop through message blocks and compute hash. ( For i=1 to N : )
464 464
 			$N = count($M);
@@ -467,14 +467,14 @@  discard block
 block discarded – undo
467 467
 				$MI = $M[$i];
468 468
 
469 469
 				// Initialize working variables
470
-				$_a = (int)$h[0];
471
-				$_b = (int)$h[1];
472
-				$_c = (int)$h[2];
473
-				$_d = (int)$h[3];
474
-				$_e = (int)$h[4];
475
-				$_f = (int)$h[5];
476
-				$_g = (int)$h[6];
477
-				$_h = (int)$h[7];
470
+				$_a = (int) $h[0];
471
+				$_b = (int) $h[1];
472
+				$_c = (int) $h[2];
473
+				$_d = (int) $h[3];
474
+				$_e = (int) $h[4];
475
+				$_f = (int) $h[5];
476
+				$_g = (int) $h[6];
477
+				$_h = (int) $h[7];
478 478
 				unset($_s0);
479 479
 				unset($_s1);
480 480
 				unset($_T1);
@@ -504,12 +504,12 @@  discard block
 block discarded – undo
504 504
 
505 505
 				for (; $t < 64; $t++) {
506 506
 					// Continue building the message schedule as we loop
507
-					$_s0 = $W[($t+1) & 0x0F];
507
+					$_s0 = $W[($t + 1) & 0x0F];
508 508
 					$_s0 = $this->sigma_0($_s0);
509
-					$_s1 = $W[($t+14) & 0x0F];
509
+					$_s1 = $W[($t + 14) & 0x0F];
510 510
 					$_s1 = $this->sigma_1($_s1);
511 511
 
512
-					$W[$t & 0xF] = $this->addmod2n($this->addmod2n($this->addmod2n($W[$t & 0xF], $_s0), $_s1), $W[($t+9) & 0x0F]);
512
+					$W[$t & 0xF] = $this->addmod2n($this->addmod2n($this->addmod2n($W[$t & 0xF], $_s0), $_s1), $W[($t + 9) & 0x0F]);
513 513
 
514 514
 					// Compute hash
515 515
 					$_T1 = $this->addmod2n($this->addmod2n($this->addmod2n($this->addmod2n($_h, $this->Sigma1($_e)),
Please login to merge, or discard this patch.
ecrire/inc/filtres_images_lib_mini.php 2 patches
Doc Comments   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -83,7 +83,7 @@  discard block
 block discarded – undo
83 83
  *
84 84
  * @param bool|string $stat
85 85
  *     true, false ou le statut déjà défini si traitements enchaînés.
86
- * @return bool
86
+ * @return false|null
87 87
  *     true si il faut supprimer le fichier temporaire ; false sinon.
88 88
  */
89 89
 function statut_effacer_images_temporaires($stat) {
@@ -554,7 +554,7 @@  discard block
 block discarded – undo
554 554
  *
555 555
  * @uses statut_effacer_images_temporaires()
556 556
  *
557
- * @param ressource $img
557
+ * @param resource $img
558 558
  *     Une ressource de type Image GD.
559 559
  * @param array $valeurs
560 560
  *     Un tableau des informations (tailles, traitement, path...) accompagnant
@@ -1400,7 +1400,7 @@  discard block
 block discarded – undo
1400 1400
 	/**
1401 1401
 	 * Transforme une ressource GD en image au format ICO
1402 1402
 	 *
1403
-	 * @param array $gd_image_array
1403
+	 * @param Ressource[] $gd_image_array
1404 1404
 	 *     Tableau de ressources d'images GD
1405 1405
 	 * @return string
1406 1406
 	 *     Image au format ICO
Please login to merge, or discard this patch.
Spacing   +59 added lines, -59 removed lines patch added patch discarded remove patch
@@ -42,13 +42,13 @@  discard block
 block discarded – undo
42 42
 	$blue = dechex($blue);
43 43
 
44 44
 	if (strlen($red) == 1) {
45
-		$red = "0" . $red;
45
+		$red = "0".$red;
46 46
 	}
47 47
 	if (strlen($green) == 1) {
48
-		$green = "0" . $green;
48
+		$green = "0".$green;
49 49
 	}
50 50
 	if (strlen($blue) == 1) {
51
-		$blue = "0" . $blue;
51
+		$blue = "0".$blue;
52 52
 	}
53 53
 
54 54
 	return "$red$green$blue";
@@ -148,7 +148,7 @@  discard block
 block discarded – undo
148 148
 		$img = "<img src='$source' />";
149 149
 	} # gerer img src="data:....base64"
150 150
 	elseif (preg_match('@^data:image/(jpe?g|png|gif);base64,(.*)$@isS', $source, $regs)) {
151
-		$local = sous_repertoire(_DIR_VAR, 'image-data') . md5($regs[2]) . '.' . str_replace('jpeg', 'jpg', $regs[1]);
151
+		$local = sous_repertoire(_DIR_VAR, 'image-data').md5($regs[2]).'.'.str_replace('jpeg', 'jpg', $regs[1]);
152 152
 		if (!file_exists($local)) {
153 153
 			ecrire_fichier($local, base64_decode($regs[2]));
154 154
 		}
@@ -162,7 +162,7 @@  discard block
 block discarded – undo
162 162
 	// les protocoles web prennent au moins 3 lettres
163 163
 	if (tester_url_absolue($source)) {
164 164
 		include_spip('inc/distant');
165
-		$fichier = _DIR_RACINE . copie_locale($source);
165
+		$fichier = _DIR_RACINE.copie_locale($source);
166 166
 		if (!$fichier) {
167 167
 			return "";
168 168
 		}
@@ -256,9 +256,9 @@  discard block
 block discarded – undo
256 256
 			// on garde la terminaison initiale car image simplement copiee
257 257
 			// et on postfixe son nom avec un md5 du path
258 258
 			$terminaison_dest = $terminaison;
259
-			$fichier_dest .= '-' . substr(md5("$identifiant"), 0, 5);
259
+			$fichier_dest .= '-'.substr(md5("$identifiant"), 0, 5);
260 260
 		} else {
261
-			$fichier_dest .= '-' . substr(md5("$identifiant-$effet"), 0, 5);
261
+			$fichier_dest .= '-'.substr(md5("$identifiant-$effet"), 0, 5);
262 262
 		}
263 263
 		$cache = sous_repertoire(_DIR_VAR, $cache);
264 264
 		$cache = sous_repertoire($cache, $effet);
@@ -274,7 +274,7 @@  discard block
 block discarded – undo
274 274
 		$fichier_dest = substr($fichier_dest, 2);
275 275
 	}
276 276
 
277
-	$fichier_dest = $cache . $fichier_dest . "." . $terminaison_dest;
277
+	$fichier_dest = $cache.$fichier_dest.".".$terminaison_dest;
278 278
 
279 279
 	$GLOBALS["images_calculees"][] = $fichier_dest;
280 280
 
@@ -310,14 +310,14 @@  discard block
 block discarded – undo
310 310
 	}
311 311
 
312 312
 	if ($creer) {
313
-		spip_log("filtre image " . ($fonction_creation ? reset($fonction_creation) : '') . "[$effet] sur $fichier",
314
-			"images" . _LOG_DEBUG);
313
+		spip_log("filtre image ".($fonction_creation ? reset($fonction_creation) : '')."[$effet] sur $fichier",
314
+			"images"._LOG_DEBUG);
315 315
 	}
316 316
 
317 317
 	// TODO: si une image png est nommee .jpg, le reconnaitre avec le bon $f
318
-	$ret["fonction_imagecreatefrom"] = "_imagecreatefrom" . $term_fonction;
318
+	$ret["fonction_imagecreatefrom"] = "_imagecreatefrom".$term_fonction;
319 319
 	$ret["fichier"] = $fichier;
320
-	$ret["fonction_image"] = "_image_image" . $terminaison_dest;
320
+	$ret["fonction_image"] = "_image_image".$terminaison_dest;
321 321
 	$ret["fichier_dest"] = $fichier_dest;
322 322
 	$ret["format_source"] = ($terminaison != 'jpeg' ? $terminaison : 'jpg');
323 323
 	$ret["format_dest"] = $terminaison_dest;
@@ -441,7 +441,7 @@  discard block
 block discarded – undo
441 441
 	if (!function_exists('imagepng')) {
442 442
 		return false;
443 443
 	}
444
-	$tmp = $fichier . ".tmp";
444
+	$tmp = $fichier.".tmp";
445 445
 	$ret = imagepng($img, $tmp);
446 446
 	if (file_exists($tmp)) {
447 447
 		$taille_test = getimagesize($tmp);
@@ -476,7 +476,7 @@  discard block
 block discarded – undo
476 476
 	if (!function_exists('imagegif')) {
477 477
 		return false;
478 478
 	}
479
-	$tmp = $fichier . ".tmp";
479
+	$tmp = $fichier.".tmp";
480 480
 	$ret = imagegif($img, $tmp);
481 481
 	if (file_exists($tmp)) {
482 482
 		$taille_test = getimagesize($tmp);
@@ -516,7 +516,7 @@  discard block
 block discarded – undo
516 516
 	if (!function_exists('imagejpeg')) {
517 517
 		return false;
518 518
 	}
519
-	$tmp = $fichier . ".tmp";
519
+	$tmp = $fichier.".tmp";
520 520
 
521 521
 	// Enable interlancing
522 522
 	imageinterlace($img, true);
@@ -582,12 +582,12 @@  discard block
 block discarded – undo
582 582
  *     - false sinon.
583 583
  */
584 584
 function _image_gd_output($img, $valeurs, $qualite = _IMG_GD_QUALITE) {
585
-	$fonction = "_image_image" . $valeurs['format_dest'];
585
+	$fonction = "_image_image".$valeurs['format_dest'];
586 586
 	$ret = false;
587 587
 	#un flag pour reperer les images gravees
588 588
 	$lock =
589 589
 		!statut_effacer_images_temporaires('get') // si la fonction n'a pas ete activee, on grave tout
590
-	or (@file_exists($valeurs['fichier_dest']) and !@file_exists($valeurs['fichier_dest'] . '.src'));
590
+	or (@file_exists($valeurs['fichier_dest']) and !@file_exists($valeurs['fichier_dest'].'.src'));
591 591
 	if (
592 592
 		function_exists($fonction)
593 593
 		&& ($ret = $fonction($img, $valeurs['fichier_dest'], $qualite)) # on a reussi a creer l'image
@@ -598,7 +598,7 @@  discard block
 block discarded – undo
598 598
 			// dans tous les cas mettre a jour la taille de l'image finale
599 599
 			list($valeurs["hauteur_dest"], $valeurs["largeur_dest"]) = taille_image($valeurs['fichier_dest']);
600 600
 			$valeurs['date'] = @filemtime($valeurs['fichier_dest']); // pour la retrouver apres disparition
601
-			ecrire_fichier($valeurs['fichier_dest'] . '.src', serialize($valeurs), true);
601
+			ecrire_fichier($valeurs['fichier_dest'].'.src', serialize($valeurs), true);
602 602
 		}
603 603
 	}
604 604
 
@@ -617,7 +617,7 @@  discard block
 block discarded – undo
617 617
 function reconstruire_image_intermediaire($fichier_manquant) {
618 618
 	$reconstruire = array();
619 619
 	$fichier = $fichier_manquant;
620
-	while (strpos($fichier,"://")===false
620
+	while (strpos($fichier, "://") === false
621 621
 		and !@file_exists($fichier)
622 622
 		and lire_fichier($src = "$fichier.src", $source)
623 623
 		and $valeurs = unserialize($source)
@@ -654,7 +654,7 @@  discard block
 block discarded – undo
654 654
  *     Chemin du fichier d'image calculé
655 655
  **/
656 656
 function ramasse_miettes($fichier) {
657
-	if (strpos($fichier,"://")!==false
657
+	if (strpos($fichier, "://") !== false
658 658
 		or !lire_fichier($src = "$fichier.src", $source)
659 659
 		or !$valeurs = unserialize($source)
660 660
 	) {
@@ -710,7 +710,7 @@  discard block
 block discarded – undo
710 710
 	}
711 711
 	# si jamais le fichier final n'a pas ete calcule car suppose temporaire
712 712
 	# et qu'il ne s'agit pas d'une URL
713
-	if (strpos($fichier,"://")===false and !@file_exists($fichier)) {
713
+	if (strpos($fichier, "://") === false and !@file_exists($fichier)) {
714 714
 		reconstruire_image_intermediaire($fichier);
715 715
 	}
716 716
 	ramasse_miettes($fichier);
@@ -807,7 +807,7 @@  discard block
 block discarded – undo
807 807
 
808 808
 	// attributs deprecies. Transformer en CSS
809 809
 	if ($espace = extraire_attribut($tag, 'hspace')) {
810
-		$style = "margin:${espace}px;" . $style;
810
+		$style = "margin:${espace}px;".$style;
811 811
 		$tag = inserer_attribut($tag, 'hspace', '');
812 812
 	}
813 813
 
@@ -931,7 +931,7 @@  discard block
 block discarded – undo
931 931
 	$image = $valeurs['fichier'];
932 932
 	$format = $valeurs['format_source'];
933 933
 	$destdir = dirname($valeurs['fichier_dest']);
934
-	$destfile = basename($valeurs['fichier_dest'], "." . $valeurs["format_dest"]);
934
+	$destfile = basename($valeurs['fichier_dest'], ".".$valeurs["format_dest"]);
935 935
 
936 936
 	$format_sortie = $valeurs['format_dest'];
937 937
 
@@ -966,7 +966,7 @@  discard block
 block discarded – undo
966 966
 
967 967
 	// Si l'image est de la taille demandee (ou plus petite), simplement la retourner
968 968
 	if ($srcWidth and $srcWidth <= $maxWidth and $srcHeight <= $maxHeight) {
969
-		$vignette = $destination . '.' . $format;
969
+		$vignette = $destination.'.'.$format;
970 970
 		@copy($image, $vignette);
971 971
 	} // imagemagick en ligne de commande
972 972
 	elseif ($process == 'convert') {
@@ -974,9 +974,9 @@  discard block
 block discarded – undo
974 974
 			define('_CONVERT_COMMAND', 'convert');
975 975
 		} // Securite : mes_options.php peut preciser le chemin absolu
976 976
 		if (!defined('_RESIZE_COMMAND')) {
977
-			define('_RESIZE_COMMAND', _CONVERT_COMMAND . ' -quality ' . _IMG_CONVERT_QUALITE . ' -resize %xx%y! %src %dest');
977
+			define('_RESIZE_COMMAND', _CONVERT_COMMAND.' -quality '._IMG_CONVERT_QUALITE.' -resize %xx%y! %src %dest');
978 978
 		}
979
-		$vignette = $destination . "." . $format_sortie;
979
+		$vignette = $destination.".".$format_sortie;
980 980
 		$commande = str_replace(
981 981
 			array('%x', '%y', '%src', '%dest'),
982 982
 			array(
@@ -991,11 +991,11 @@  discard block
 block discarded – undo
991 991
 		if (!@file_exists($vignette)) {
992 992
 			spip_log("echec convert sur $vignette");
993 993
 
994
-			return;  // echec commande
994
+			return; // echec commande
995 995
 		}
996 996
 	} // php5 imagemagick
997 997
 	elseif ($process == 'imagick') {
998
-		$vignette = "$destination." . $format_sortie;
998
+		$vignette = "$destination.".$format_sortie;
999 999
 
1000 1000
 		if (!class_exists('Imagick')) {
1001 1001
 			spip_log("Classe Imagick absente !", _LOG_ERREUR);
@@ -1005,7 +1005,7 @@  discard block
 block discarded – undo
1005 1005
 		$imagick = new Imagick();
1006 1006
 		$imagick->readImage($image);
1007 1007
 		$imagick->resizeImage($destWidth, $destHeight, Imagick::FILTER_LANCZOS,
1008
-			1);//, IMAGICK_FILTER_LANCZOS, _IMG_IMAGICK_QUALITE / 100);
1008
+			1); //, IMAGICK_FILTER_LANCZOS, _IMG_IMAGICK_QUALITE / 100);
1009 1009
 		$imagick->writeImage($vignette);
1010 1010
 
1011 1011
 		if (!@file_exists($vignette)) {
@@ -1021,12 +1021,12 @@  discard block
 block discarded – undo
1021 1021
 		if (_PNMSCALE_COMMAND == '') {
1022 1022
 			return;
1023 1023
 		}
1024
-		$vignette = $destination . "." . $format_sortie;
1024
+		$vignette = $destination.".".$format_sortie;
1025 1025
 		$pnmtojpeg_command = str_replace("pnmscale", "pnmtojpeg", _PNMSCALE_COMMAND);
1026 1026
 		if ($format == "jpg") {
1027 1027
 
1028 1028
 			$jpegtopnm_command = str_replace("pnmscale", "jpegtopnm", _PNMSCALE_COMMAND);
1029
-			exec("$jpegtopnm_command $image | " . _PNMSCALE_COMMAND . " -width $destWidth | $pnmtojpeg_command > $vignette");
1029
+			exec("$jpegtopnm_command $image | "._PNMSCALE_COMMAND." -width $destWidth | $pnmtojpeg_command > $vignette");
1030 1030
 			if (!($s = @filesize($vignette))) {
1031 1031
 				spip_unlink($vignette);
1032 1032
 			}
@@ -1038,7 +1038,7 @@  discard block
 block discarded – undo
1038 1038
 		} else {
1039 1039
 			if ($format == "gif") {
1040 1040
 				$giftopnm_command = str_replace("pnmscale", "giftopnm", _PNMSCALE_COMMAND);
1041
-				exec("$giftopnm_command $image | " . _PNMSCALE_COMMAND . " -width $destWidth | $pnmtojpeg_command > $vignette");
1041
+				exec("$giftopnm_command $image | "._PNMSCALE_COMMAND." -width $destWidth | $pnmtojpeg_command > $vignette");
1042 1042
 				if (!($s = @filesize($vignette))) {
1043 1043
 					spip_unlink($vignette);
1044 1044
 				}
@@ -1050,7 +1050,7 @@  discard block
 block discarded – undo
1050 1050
 			} else {
1051 1051
 				if ($format == "png") {
1052 1052
 					$pngtopnm_command = str_replace("pnmscale", "pngtopnm", _PNMSCALE_COMMAND);
1053
-					exec("$pngtopnm_command $image | " . _PNMSCALE_COMMAND . " -width $destWidth | $pnmtojpeg_command > $vignette");
1053
+					exec("$pngtopnm_command $image | "._PNMSCALE_COMMAND." -width $destWidth | $pnmtojpeg_command > $vignette");
1054 1054
 					if (!($s = @filesize($vignette))) {
1055 1055
 						spip_unlink($vignette);
1056 1056
 					}
@@ -1070,7 +1070,7 @@  discard block
 block discarded – undo
1070 1070
 			return;
1071 1071
 		}
1072 1072
 		if (_IMG_GD_MAX_PIXELS && $srcWidth * $srcHeight > _IMG_GD_MAX_PIXELS) {
1073
-			spip_log("vignette gd1/gd2 impossible : " . $srcWidth * $srcHeight . "pixels");
1073
+			spip_log("vignette gd1/gd2 impossible : ".$srcWidth * $srcHeight."pixels");
1074 1074
 
1075 1075
 			return;
1076 1076
 		}
@@ -1357,7 +1357,7 @@  discard block
 block discarded – undo
1357 1357
 		// de l'image, de facon a tromper le cache du navigateur
1358 1358
 		// quand on fait supprimer/reuploader un logo
1359 1359
 		// (pas de filemtime si SAFE MODE)
1360
-		$date = test_espace_prive() ? ('?' . $date) : '';
1360
+		$date = test_espace_prive() ? ('?'.$date) : '';
1361 1361
 
1362 1362
 		return _image_ecrire_tag($image, array('src' => "$logo$date", 'width' => $destWidth, 'height' => $destHeight));
1363 1363
 	} else # SVG par exemple ? BMP, tiff ... les redacteurs osent tout!
@@ -1404,7 +1404,7 @@  discard block
 block discarded – undo
1404 1404
 	public static function LittleEndian2String($number, $minbytes = 1) {
1405 1405
 		$intstring = '';
1406 1406
 		while ($number > 0) {
1407
-			$intstring = $intstring . chr($number & 255);
1407
+			$intstring = $intstring.chr($number & 255);
1408 1408
 			$number >>= 8;
1409 1409
 		}
1410 1410
 
@@ -1437,9 +1437,9 @@  discard block
 block discarded – undo
1437 1437
 					$b = $argb['blue'];
1438 1438
 
1439 1439
 					if ($bpp[$key] == 32) {
1440
-						$icXOR[$key] .= chr($b) . chr($g) . chr($r) . chr($a);
1440
+						$icXOR[$key] .= chr($b).chr($g).chr($r).chr($a);
1441 1441
 					} elseif ($bpp[$key] == 24) {
1442
-						$icXOR[$key] .= chr($b) . chr($g) . chr($r);
1442
+						$icXOR[$key] .= chr($b).chr($g).chr($r);
1443 1443
 					}
1444 1444
 
1445 1445
 					if ($a < 128) {
@@ -1467,44 +1467,44 @@  discard block
 block discarded – undo
1467 1467
 
1468 1468
 			// BITMAPINFOHEADER - 40 bytes
1469 1469
 			$BitmapInfoHeader[$key] = '';
1470
-			$BitmapInfoHeader[$key] .= "\x28\x00\x00\x00";                // DWORD  biSize;
1471
-			$BitmapInfoHeader[$key] .= phpthumb_functions::LittleEndian2String($ImageWidths[$key], 4);    // LONG   biWidth;
1470
+			$BitmapInfoHeader[$key] .= "\x28\x00\x00\x00"; // DWORD  biSize;
1471
+			$BitmapInfoHeader[$key] .= phpthumb_functions::LittleEndian2String($ImageWidths[$key], 4); // LONG   biWidth;
1472 1472
 			// The biHeight member specifies the combined
1473 1473
 			// height of the XOR and AND masks.
1474 1474
 			$BitmapInfoHeader[$key] .= phpthumb_functions::LittleEndian2String($ImageHeights[$key] * 2, 4); // LONG   biHeight;
1475
-			$BitmapInfoHeader[$key] .= "\x01\x00";                    // WORD   biPlanes;
1476
-			$BitmapInfoHeader[$key] .= chr($bpp[$key]) . "\x00";              // wBitCount;
1477
-			$BitmapInfoHeader[$key] .= "\x00\x00\x00\x00";                // DWORD  biCompression;
1478
-			$BitmapInfoHeader[$key] .= phpthumb_functions::LittleEndian2String($biSizeImage, 4);      // DWORD  biSizeImage;
1479
-			$BitmapInfoHeader[$key] .= "\x00\x00\x00\x00";                // LONG   biXPelsPerMeter;
1480
-			$BitmapInfoHeader[$key] .= "\x00\x00\x00\x00";                // LONG   biYPelsPerMeter;
1481
-			$BitmapInfoHeader[$key] .= "\x00\x00\x00\x00";                // DWORD  biClrUsed;
1482
-			$BitmapInfoHeader[$key] .= "\x00\x00\x00\x00";                // DWORD  biClrImportant;
1475
+			$BitmapInfoHeader[$key] .= "\x01\x00"; // WORD   biPlanes;
1476
+			$BitmapInfoHeader[$key] .= chr($bpp[$key])."\x00"; // wBitCount;
1477
+			$BitmapInfoHeader[$key] .= "\x00\x00\x00\x00"; // DWORD  biCompression;
1478
+			$BitmapInfoHeader[$key] .= phpthumb_functions::LittleEndian2String($biSizeImage, 4); // DWORD  biSizeImage;
1479
+			$BitmapInfoHeader[$key] .= "\x00\x00\x00\x00"; // LONG   biXPelsPerMeter;
1480
+			$BitmapInfoHeader[$key] .= "\x00\x00\x00\x00"; // LONG   biYPelsPerMeter;
1481
+			$BitmapInfoHeader[$key] .= "\x00\x00\x00\x00"; // DWORD  biClrUsed;
1482
+			$BitmapInfoHeader[$key] .= "\x00\x00\x00\x00"; // DWORD  biClrImportant;
1483 1483
 		}
1484 1484
 
1485 1485
 
1486
-		$icondata = "\x00\x00";                    // idReserved;   // Reserved (must be 0)
1487
-		$icondata .= "\x01\x00";                    // idType;	   // Resource Type (1 for icons)
1488
-		$icondata .= phpthumb_functions::LittleEndian2String(count($gd_image_array), 2);  // idCount;	  // How many images?
1486
+		$icondata = "\x00\x00"; // idReserved;   // Reserved (must be 0)
1487
+		$icondata .= "\x01\x00"; // idType;	   // Resource Type (1 for icons)
1488
+		$icondata .= phpthumb_functions::LittleEndian2String(count($gd_image_array), 2); // idCount;	  // How many images?
1489 1489
 
1490 1490
 		$dwImageOffset = 6 + (count($gd_image_array) * 16);
1491 1491
 		foreach ($gd_image_array as $key => $gd_image) {
1492 1492
 			// ICONDIRENTRY   idEntries[1]; // An entry for each image (idCount of 'em)
1493 1493
 
1494
-			$icondata .= chr($ImageWidths[$key]);           // bWidth;		  // Width, in pixels, of the image
1495
-			$icondata .= chr($ImageHeights[$key]);          // bHeight;		 // Height, in pixels, of the image
1496
-			$icondata .= chr($totalcolors[$key]);           // bColorCount;	 // Number of colors in image (0 if >=8bpp)
1497
-			$icondata .= "\x00";                    // bReserved;	   // Reserved ( must be 0)
1494
+			$icondata .= chr($ImageWidths[$key]); // bWidth;		  // Width, in pixels, of the image
1495
+			$icondata .= chr($ImageHeights[$key]); // bHeight;		 // Height, in pixels, of the image
1496
+			$icondata .= chr($totalcolors[$key]); // bColorCount;	 // Number of colors in image (0 if >=8bpp)
1497
+			$icondata .= "\x00"; // bReserved;	   // Reserved ( must be 0)
1498 1498
 
1499
-			$icondata .= "\x01\x00";                  // wPlanes;		 // Color Planes
1500
-			$icondata .= chr($bpp[$key]) . "\x00";            // wBitCount;	   // Bits per pixel
1499
+			$icondata .= "\x01\x00"; // wPlanes;		 // Color Planes
1500
+			$icondata .= chr($bpp[$key])."\x00"; // wBitCount;	   // Bits per pixel
1501 1501
 
1502 1502
 			$dwBytesInRes = 40 + strlen($icXOR[$key]) + strlen($icAND[$key]);
1503 1503
 			$icondata .= phpthumb_functions::LittleEndian2String($dwBytesInRes,
1504
-				4);     // dwBytesInRes;	// How many bytes in this resource?
1504
+				4); // dwBytesInRes;	// How many bytes in this resource?
1505 1505
 
1506 1506
 			$icondata .= phpthumb_functions::LittleEndian2String($dwImageOffset,
1507
-				4);    // dwImageOffset;   // Where in the file is this image?
1507
+				4); // dwImageOffset;   // Where in the file is this image?
1508 1508
 			$dwImageOffset += strlen($BitmapInfoHeader[$key]);
1509 1509
 			$dwImageOffset += strlen($icXOR[$key]);
1510 1510
 			$dwImageOffset += strlen($icAND[$key]);
Please login to merge, or discard this patch.
ecrire/inc/filtres_images_mini.php 1 patch
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -122,7 +122,7 @@
 block discarded – undo
122 122
  * @param int $height_max
123 123
  *    Hauteur minimale de l'image à traiter (10000 par défaut)
124 124
  * @return
125
- *    Le tag html `<img src=... />` avec une class `filtre_inactif` ou pas
125
+ string    Le tag html `<img src=... />` avec une class `filtre_inactif` ou pas
126 126
  */
127 127
 function image_select($img, $width_min = 0, $height_min = 0, $width_max = 10000, $height_max = 1000) {
128 128
 	if (!$img) {
Please login to merge, or discard this patch.
ecrire/inc/flock.php 2 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -644,7 +644,7 @@
 block discarded – undo
644 644
  *
645 645
  * @param string $dir
646 646
  *     Répertoire à parcourir
647
- * @param int|string $pattern
647
+ * @param integer $pattern
648 648
  *     Expression régulière pour trouver des fichiers, tel que `[.]lock$`
649 649
  * @param int $maxfiles
650 650
  *     Nombre de fichiers maximums retournés
Please login to merge, or discard this patch.
Spacing   +19 added lines, -19 removed lines patch added patch discarded remove patch
@@ -122,7 +122,7 @@  discard block
 block discarded – undo
122 122
 		$contenu = @gzfile($fichier);
123 123
 	}
124 124
 
125
-	return is_array($contenu) ? join('', $contenu) : (string)$contenu;
125
+	return is_array($contenu) ? join('', $contenu) : (string) $contenu;
126 126
 }
127 127
 
128 128
 
@@ -315,9 +315,9 @@  discard block
 block discarded – undo
315 315
  */
316 316
 function ecrire_fichier_securise($fichier, $contenu, $ecrire_quand_meme = false, $truncate = true) {
317 317
 	if (substr($fichier, -4) !== '.php') {
318
-		spip_log('Erreur de programmation: ' . $fichier . ' doit finir par .php');
318
+		spip_log('Erreur de programmation: '.$fichier.' doit finir par .php');
319 319
 	}
320
-	$contenu = "<" . "?php die ('Acces interdit'); ?" . ">\n" . $contenu;
320
+	$contenu = "<"."?php die ('Acces interdit'); ?".">\n".$contenu;
321 321
 
322 322
 	return ecrire_fichier($fichier, $contenu, $ecrire_quand_meme, $truncate);
323 323
 }
@@ -340,7 +340,7 @@  discard block
 block discarded – undo
340 340
  */
341 341
 function lire_fichier_securise($fichier, &$contenu, $options = array()) {
342 342
 	if ($res = lire_fichier($fichier, $contenu, $options)) {
343
-		$contenu = substr($contenu, strlen("<" . "?php die ('Acces interdit'); ?" . ">\n"));
343
+		$contenu = substr($contenu, strlen("<"."?php die ('Acces interdit'); ?".">\n"));
344 344
 	}
345 345
 
346 346
 	return $res;
@@ -460,7 +460,7 @@  discard block
 block discarded – undo
460 460
 		$invalidate = @opcache_invalidate($filepath, true);
461 461
 		// si l'invalidation a echoue lever un flag
462 462
 		if (!$invalidate and !defined('_spip_attend_invalidation_opcode_cache')) {
463
-			define('_spip_attend_invalidation_opcode_cache',true);
463
+			define('_spip_attend_invalidation_opcode_cache', true);
464 464
 		}
465 465
 	}
466 466
 	// APC.
@@ -501,11 +501,11 @@  discard block
 block discarded – undo
501 501
 		$wait = $duree + 1;
502 502
 		if ($timestamp) {
503 503
 			$wait -= (time() - $timestamp);
504
-			if ($wait<0) {
504
+			if ($wait < 0) {
505 505
 				$wait = 0;
506 506
 			}
507 507
 		}
508
-		spip_log('Probleme de configuration opcache.revalidate_freq '. $duree .'s : on attend '.$wait.'s', _LOG_INFO_IMPORTANTE);
508
+		spip_log('Probleme de configuration opcache.revalidate_freq '.$duree.'s : on attend '.$wait.'s', _LOG_INFO_IMPORTANTE);
509 509
 		if ($wait) {
510 510
 			sleep($duree + 1);
511 511
 		}
@@ -533,9 +533,9 @@  discard block
 block discarded – undo
533 533
 		if ($item == '.' || $item == '..') {
534 534
 			continue;
535 535
 		}
536
-		if (!supprimer_repertoire($dir . "/" . $item)) {
537
-			@chmod($dir . "/" . $item, 0777);
538
-			if (!supprimer_repertoire($dir . "/" . $item)) {
536
+		if (!supprimer_repertoire($dir."/".$item)) {
537
+			@chmod($dir."/".$item, 0777);
538
+			if (!supprimer_repertoire($dir."/".$item)) {
539 539
 				return false;
540 540
 			}
541 541
 		};
@@ -580,7 +580,7 @@  discard block
 block discarded – undo
580 580
 	if (!strlen($subdir)) {
581 581
 		$n = strrpos($base, "/");
582 582
 		if ($n === false) {
583
-			return $nobase ? '' : ($base . '/');
583
+			return $nobase ? '' : ($base.'/');
584 584
 		}
585 585
 		$subdir = substr($base, $n + 1);
586 586
 		$base = substr($base, 0, $n + 1);
@@ -590,14 +590,14 @@  discard block
 block discarded – undo
590 590
 	}
591 591
 
592 592
 	$baseaff = $nobase ? '' : $base;
593
-	if (isset($dirs[$base . $subdir])) {
594
-		return $baseaff . $dirs[$base . $subdir];
593
+	if (isset($dirs[$base.$subdir])) {
594
+		return $baseaff.$dirs[$base.$subdir];
595 595
 	}
596 596
 
597
-	$path = $base . $subdir; # $path = 'IMG/distant/pdf' ou 'IMG/distant_pdf'
597
+	$path = $base.$subdir; # $path = 'IMG/distant/pdf' ou 'IMG/distant_pdf'
598 598
 
599 599
 	if (file_exists("$path/.ok")) {
600
-		return $baseaff . ($dirs[$base . $subdir] = "$subdir/");
600
+		return $baseaff.($dirs[$base.$subdir] = "$subdir/");
601 601
 	}
602 602
 
603 603
 	@mkdir($path, _SPIP_CHMOD);
@@ -607,7 +607,7 @@  discard block
 block discarded – undo
607 607
 		@touch("$path/.ok");
608 608
 		spip_log("creation $base$subdir/");
609 609
 
610
-		return $baseaff . ($dirs[$base . $subdir] = "$subdir/");
610
+		return $baseaff.($dirs[$base.$subdir] = "$subdir/");
611 611
 	}
612 612
 
613 613
 	// en cas d'echec c'est peut etre tout simplement que le disque est plein :
@@ -617,10 +617,10 @@  discard block
 block discarded – undo
617 617
 		return '';
618 618
 	}
619 619
 	if (!_DIR_RESTREINT) {
620
-		$base = preg_replace(',^' . _DIR_RACINE . ',', '', $base);
620
+		$base = preg_replace(',^'._DIR_RACINE.',', '', $base);
621 621
 	}
622 622
 	$base .= $subdir;
623
-	raler_fichier($base . '/.ok');
623
+	raler_fichier($base.'/.ok');
624 624
 }
625 625
 
626 626
 
@@ -688,7 +688,7 @@  discard block
 block discarded – undo
688 688
 							$beginning = $fichiers;
689 689
 							$end = preg_files("$f/", $pattern,
690 690
 								$maxfiles - $nbfiles, $recurs);
691
-							$fichiers = array_merge((array)$beginning, (array)$end);
691
+							$fichiers = array_merge((array) $beginning, (array) $end);
692 692
 							$nbfiles = count($fichiers);
693 693
 						}
694 694
 					}
Please login to merge, or discard this patch.
ecrire/inc/importer_csv.php 1 patch
Doc Comments   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -32,7 +32,7 @@  discard block
 block discarded – undo
32 32
  * Importer le charset d'une ligne
33 33
  *
34 34
  * @param string $texte
35
- * @return array
35
+ * @return string
36 36
  */
37 37
 function importer_csv_importcharset($texte) {
38 38
 	// le plus frequent, en particulier avec les trucs de ms@@@
@@ -66,7 +66,7 @@  discard block
 block discarded – undo
66 66
  * @param string $delim
67 67
  * @param string $enclos
68 68
  * @param int $len
69
- * @return array
69
+ * @return boolean
70 70
  */
71 71
 function inc_importer_csv_dist($file, $head = false, $delim = ", ", $enclos = '"', $len = 10000) {
72 72
 	$return = false;
Please login to merge, or discard this patch.
ecrire/inc/lang.php 2 patches
Doc Comments   +11 added lines, -1 removed lines patch added patch discarded remove patch
@@ -31,7 +31,7 @@  discard block
 block discarded – undo
31 31
  *
32 32
  * @param string $lang
33 33
  *     La langue à utiliser
34
- * @return string|bool
34
+ * @return false|string
35 35
  *     string : La langue qui a été utilisée si trouvée
36 36
  *     false : aucune langue ne correspondait à la demande
37 37
  **/
@@ -80,6 +80,9 @@  discard block
 block discarded – undo
80 80
 // retourne son 2e argument si c'est un index du premier
81 81
 // ou un index approchant sinon et si possible, 
82 82
 // la langue X etant consideree comme une approche de X_Y
83
+/**
84
+ * @return string
85
+ */
83 86
 function approcher_langue($trads, $lang = '') {
84 87
 
85 88
 	if (!$lang) {
@@ -175,6 +178,9 @@  discard block
 block discarded – undo
175 178
 // pour 'changer_lang' (langue de l'article, espace prive), c'est en Ajax
176 179
 // 
177 180
 // http://code.spip.net/@menu_langues
181
+/**
182
+ * @param string $nom_select
183
+ */
178 184
 function menu_langues($nom_select, $default = '') {
179 185
 	include_spip('inc/actions');
180 186
 
@@ -209,6 +215,10 @@  discard block
 block discarded – undo
209 215
 }
210 216
 
211 217
 // http://code.spip.net/@select_langues
218
+/**
219
+ * @param string $change
220
+ * @param string $options
221
+ */
212 222
 function select_langues($nom_select, $change, $options, $label = "") {
213 223
 	static $cpt = 0;
214 224
 	$id = "menu_langues" . $cpt++;
Please login to merge, or discard this patch.
Spacing   +10 added lines, -12 removed lines patch added patch discarded remove patch
@@ -37,8 +37,8 @@  discard block
 block discarded – undo
37 37
  **/
38 38
 function changer_langue($lang) {
39 39
 
40
-	$liste_langues = ',' . @$GLOBALS['meta']['langues_proposees']
41
-		. ',' . @$GLOBALS['meta']['langues_multilingue'] . ',';
40
+	$liste_langues = ','.@$GLOBALS['meta']['langues_proposees']
41
+		. ','.@$GLOBALS['meta']['langues_multilingue'].',';
42 42
 
43 43
 	// Si la langue demandee n'existe pas, on essaie d'autres variantes
44 44
 	// Exemple : 'pt-br' => 'pt_br' => 'pt'
@@ -189,7 +189,7 @@  discard block
 block discarded – undo
189 189
 	}
190 190
 	foreach ($langues as $l) {
191 191
 		$selected = ($l == $default) ? ' selected=\'selected\'' : '';
192
-		$ret .= "<option value='$l'$selected>[" . $l . "] " . traduire_nom_langue($l) . "</option>\n";
192
+		$ret .= "<option value='$l'$selected>[".$l."] ".traduire_nom_langue($l)."</option>\n";
193 193
 	}
194 194
 
195 195
 	if (!test_espace_prive()) {
@@ -204,23 +204,21 @@  discard block
 block discarded – undo
204 204
 
205 205
 	return generer_action_auteur('converser', $base, $cible,
206 206
 		(select_langues($nom_select, $change, $ret)
207
-			. "<noscript><div style='display:inline'><input type='submit' class='fondo' value='" . _T('bouton_changer') . "' /></div></noscript>"),
207
+			. "<noscript><div style='display:inline'><input type='submit' class='fondo' value='"._T('bouton_changer')."' /></div></noscript>"),
208 208
 		" method='post'");
209 209
 }
210 210
 
211 211
 // http://code.spip.net/@select_langues
212 212
 function select_langues($nom_select, $change, $options, $label = "") {
213 213
 	static $cpt = 0;
214
-	$id = "menu_langues" . $cpt++;
214
+	$id = "menu_langues".$cpt++;
215 215
 
216 216
 	return
217
-		"<label for='$id'>" . ($label ? $label : _T('info_langues')) . "</label> " .
217
+		"<label for='$id'>".($label ? $label : _T('info_langues'))."</label> ".
218 218
 		"<select name='$nom_select' id='$id' "
219 219
 		. ((!test_espace_prive()) ?
220
-			("class='forml menu_langues'") :
221
-			(($nom_select == 'var_lang_ecrire') ?
222
-				("class='lang_ecrire'") :
223
-				"class='fondl'"))
220
+			("class='forml menu_langues'") : (($nom_select == 'var_lang_ecrire') ?
221
+				("class='lang_ecrire'") : "class='fondl'"))
224 222
 		. $change
225 223
 		. ">\n"
226 224
 		. $options
@@ -342,7 +340,7 @@  discard block
 block discarded – undo
342 340
 		and (!isset($GLOBALS['spip_lang'])
343 341
 			or $GLOBALS['spip_lang'] != $GLOBALS['meta']['langue_site'])
344 342
 	) {
345
-		return changer_langue($GLOBALS['meta']['langue_site']);//@:install
343
+		return changer_langue($GLOBALS['meta']['langue_site']); //@:install
346 344
 	}
347 345
 	// en theorie là, la globale est définie, sinon c'est un problème.
348 346
 	if (!isset($GLOBALS['spip_lang'])) {
@@ -443,7 +441,7 @@  discard block
 block discarded – undo
443 441
 	if (!isset($GLOBALS['meta']['langue_site'])) {
444 442
 		// Initialisation : le francais si dispo, sinon la premiere langue trouvee
445 443
 		$GLOBALS['meta']['langue_site'] = $tout =
446
-			(!$all_langs or (strpos(',' . _LANGUE_PAR_DEFAUT . ',', ",$all_langs,") !== false))
444
+			(!$all_langs or (strpos(','._LANGUE_PAR_DEFAUT.',', ",$all_langs,") !== false))
447 445
 				? _LANGUE_PAR_DEFAUT : substr($all_langs, 0, strpos($all_langs, ','));
448 446
 		ecrire_meta('langue_site', $tout);
449 447
 	}
Please login to merge, or discard this patch.