Completed
Push — master ( 6705b8...d0b7f5 )
by cam
04:12
created
ecrire/base/objets.php 1 patch
Spacing   +29 added lines, -29 removed lines patch added patch discarded remove patch
@@ -703,7 +703,7 @@  discard block
 block discarded – undo
703 703
 		$infos['url_voir'] = $infos['type'];
704 704
 	}
705 705
 	if (!isset($infos['url_edit'])) {
706
-		$infos['url_edit'] = $infos['url_voir'] . ($infos['editable'] ? '_edit' : '');
706
+		$infos['url_edit'] = $infos['url_voir'].($infos['editable'] ? '_edit' : '');
707 707
 	}
708 708
 	if (!isset($infos['icone_objet'])) {
709 709
 		$infos['icone_objet'] = $infos['type'];
@@ -715,48 +715,48 @@  discard block
 block discarded – undo
715 715
 		$infos['texte_retour'] = 'icone_retour';
716 716
 	}
717 717
 	if (!isset($infos['texte_modifier'])) {
718
-		$infos['texte_modifier'] = $infos['type'] . ':' . 'icone_modifier_' . $infos['type'];
718
+		$infos['texte_modifier'] = $infos['type'].':'.'icone_modifier_'.$infos['type'];
719 719
 	}
720 720
 	if (!isset($infos['texte_creer'])) {
721
-		$infos['texte_creer'] = $infos['type'] . ':' . 'icone_creer_' . $infos['type'];
721
+		$infos['texte_creer'] = $infos['type'].':'.'icone_creer_'.$infos['type'];
722 722
 	}
723 723
 	if (!isset($infos['texte_creer_associer'])) {
724
-		$infos['texte_creer_associer'] = $infos['type'] . ':' . 'texte_creer_associer_' . $infos['type'];
724
+		$infos['texte_creer_associer'] = $infos['type'].':'.'texte_creer_associer_'.$infos['type'];
725 725
 	}
726 726
 	if (!isset($infos['texte_ajouter'])) {
727 727
 		// Ajouter un X
728
-		$infos['texte_ajouter'] = $infos['type'] . ':' . 'texte_ajouter_' . $infos['type'];
728
+		$infos['texte_ajouter'] = $infos['type'].':'.'texte_ajouter_'.$infos['type'];
729 729
 	}
730 730
 	if (!isset($infos['texte_objets'])) {
731
-		$infos['texte_objets'] = $infos['type'] . ':' . 'titre_' . $infos['table_objet'];
731
+		$infos['texte_objets'] = $infos['type'].':'.'titre_'.$infos['table_objet'];
732 732
 	}
733 733
 	if (!isset($infos['texte_objet'])) {
734
-		$infos['texte_objet'] = $infos['type'] . ':' . 'titre_' . $infos['type'];
734
+		$infos['texte_objet'] = $infos['type'].':'.'titre_'.$infos['type'];
735 735
 	}
736 736
 	if (!isset($infos['texte_logo_objet'])) {
737 737
 		// objet:titre_logo_objet "Logo de ce X"
738
-		$infos['texte_logo_objet'] = $infos['type'] . ':' . 'titre_logo_' . $infos['type'];
738
+		$infos['texte_logo_objet'] = $infos['type'].':'.'titre_logo_'.$infos['type'];
739 739
 	}
740 740
 	if (!isset($infos['texte_langue_objet'])) {
741 741
 		// objet:texte_langue_objet "Langue de ce X"
742
-		$infos['texte_langue_objet'] = $infos['type'] . ':' . 'titre_langue_' . $infos['type'];
742
+		$infos['texte_langue_objet'] = $infos['type'].':'.'titre_langue_'.$infos['type'];
743 743
 	}
744 744
 	if (!isset($infos['texte_definir_comme_traduction_objet'])) {
745 745
 		// "Ce X est une traduction du X numéro :"
746
-		$infos['texte_definir_comme_traduction_objet'] = $infos['type'] . ':' . 'texte_definir_comme_traduction_' . $infos['type'];
746
+		$infos['texte_definir_comme_traduction_objet'] = $infos['type'].':'.'texte_definir_comme_traduction_'.$infos['type'];
747 747
 	}
748 748
 
749 749
 	// objet:info_aucun_objet
750 750
 	if (!isset($infos['info_aucun_objet'])) {
751
-		$infos['info_aucun_objet'] = $infos['type'] . ':' . 'info_aucun_' . $infos['type'];
751
+		$infos['info_aucun_objet'] = $infos['type'].':'.'info_aucun_'.$infos['type'];
752 752
 	}
753 753
 	// objet:info_1_objet
754 754
 	if (!isset($infos['info_1_objet'])) {
755
-		$infos['info_1_objet'] = $infos['type'] . ':' . 'info_1_' . $infos['type'];
755
+		$infos['info_1_objet'] = $infos['type'].':'.'info_1_'.$infos['type'];
756 756
 	}
757 757
 	// objet:info_nb_objets
758 758
 	if (!isset($infos['info_nb_objets'])) {
759
-		$infos['info_nb_objets'] = $infos['type'] . ':' . 'info_nb_' . $infos['table_objet'];
759
+		$infos['info_nb_objets'] = $infos['type'].':'.'info_nb_'.$infos['table_objet'];
760 760
 	}
761 761
 
762 762
 	if (!isset($infos['champs_editables'])) {
@@ -956,7 +956,7 @@  discard block
 block discarded – undo
956 956
 		}
957 957
 		$ts = sql_alltable(null, $serveur); // toutes les tables "spip_" (ou prefixe perso)
958 958
 		$connexion = $GLOBALS['connexions'][$serveur ? $serveur : 0];
959
-		$spip = $connexion['prefixe'] . '_';
959
+		$spip = $connexion['prefixe'].'_';
960 960
 		foreach ($ts as $t) {
961 961
 			$t = substr($t, strlen($spip));
962 962
 			$tables[$serveur]["spip_$t"] = $t;
@@ -977,14 +977,14 @@  discard block
 block discarded – undo
977 977
  * @return array
978 978
  *     Couples (nom de la table SQL => même nom)
979 979
  **/
980
-function lister_toutes_tables($serveur){
980
+function lister_toutes_tables($serveur) {
981 981
 	static $tables = array();
982
-	if (!isset($tables[$serveur])){
982
+	if (!isset($tables[$serveur])) {
983 983
 		$tables[$serveur] = array();
984 984
 		if (!function_exists("sql_alltable"))
985 985
 			include_spip("base/abstract_sql");
986
-		$ts = sql_alltable('%',$serveur); // toutes les tables
987
-		foreach ($ts as $t){
986
+		$ts = sql_alltable('%', $serveur); // toutes les tables
987
+		foreach ($ts as $t) {
988 988
 			$tables[$serveur][$t] = $t;
989 989
 		}
990 990
 	}
@@ -1020,9 +1020,9 @@  discard block
 block discarded – undo
1020 1020
 	if ($serveur !== false) {
1021 1021
 		$t = lister_tables_spip($serveur);
1022 1022
 		$trouver_table = charger_fonction('trouver_table', 'base');
1023
-		$typetrim = rtrim($type, 's') . 's';
1023
+		$typetrim = rtrim($type, 's').'s';
1024 1024
 		if ((isset($t[$typetrim]) or in_array($typetrim, $t))
1025
-			and ($desc = $trouver_table(rtrim($type, 's') . 's', $serveur))
1025
+			and ($desc = $trouver_table(rtrim($type, 's').'s', $serveur))
1026 1026
 		) {
1027 1027
 			return $desc['id_table'];
1028 1028
 		} elseif ((isset($t[$type]) or in_array($type, $t))
@@ -1031,11 +1031,11 @@  discard block
 block discarded – undo
1031 1031
 			return $desc['id_table'];
1032 1032
 		}
1033 1033
 
1034
-		spip_log('table_objet(' . $type . ') calculee sans verification');
1034
+		spip_log('table_objet('.$type.') calculee sans verification');
1035 1035
 		#spip_log(debug_backtrace(),'db');
1036 1036
 	}
1037 1037
 
1038
-	return rtrim($type, 's') . 's'; # cas historique ne devant plus servir, sauf si $serveur=false
1038
+	return rtrim($type, 's').'s'; # cas historique ne devant plus servir, sauf si $serveur=false
1039 1039
 }
1040 1040
 
1041 1041
 /**
@@ -1112,7 +1112,7 @@  discard block
 block discarded – undo
1112 1112
 	if (
1113 1113
 		in_array($t, $ts)
1114 1114
 		or in_array($t, lister_toutes_tables($serveur))
1115
-	){
1115
+	) {
1116 1116
 		$desc = $trouver_table($t, $serveur);
1117 1117
 		if (isset($desc['key']['PRIMARY KEY'])) {
1118 1118
 			return $desc['key']['PRIMARY KEY'];
@@ -1215,7 +1215,7 @@  discard block
 block discarded – undo
1215 1215
 function objet_test_si_publie($objet, $id_objet, $serveur = '') {
1216 1216
 	// voir si une fonction est definie pour faire le boulot
1217 1217
 	// elle a la priorite dans ce cas
1218
-	if ($f = charger_fonction($objet . '_test_si_publie', 'base', true)) {
1218
+	if ($f = charger_fonction($objet.'_test_si_publie', 'base', true)) {
1219 1219
 		return $f($objet, $id_objet, $serveur);
1220 1220
 	}
1221 1221
 
@@ -1235,7 +1235,7 @@  discard block
 block discarded – undo
1235 1235
 		$boucle->sql_serveur = $serveur;
1236 1236
 		$boucle->select[] = $id_table_objet;
1237 1237
 		$boucle->from[$table_objet] = table_objet_sql($objet, $serveur);
1238
-		$boucle->where[] = $id_table . '.' . $id_table_objet . '=' . intval($id_objet);
1238
+		$boucle->where[] = $id_table.'.'.$id_table_objet.'='.intval($id_objet);
1239 1239
 
1240 1240
 		$boucle->descr['nom'] = 'objet_test_si_publie'; // eviter notice php
1241 1241
 		$boucle->descr['sourcefile'] = 'internal';
@@ -1363,7 +1363,7 @@  discard block
 block discarded – undo
1363 1363
 						? "{$parent_methode['source_champ']} = $id_objet"
1364 1364
 						: "${cle_objet} = $id_objet";
1365 1365
 					if (isset($parent_methode['source_champ_type'])) {
1366
-						$where[] = "{$parent_methode['source_champ_type']} = " . sql_quote($objet);
1366
+						$where[] = "{$parent_methode['source_champ_type']} = ".sql_quote($objet);
1367 1367
 					}
1368 1368
 					// -- Condition supplémentaire sur la détection du parent
1369 1369
 					if (isset($parent_methode['table_condition'])) {
@@ -1377,7 +1377,7 @@  discard block
 block discarded – undo
1377 1377
 			if (
1378 1378
 				!$condition_objet_invalide
1379 1379
 				and $where
1380
-				and ($lignes = sql_allfetsel( $is_table_lien ? '*' : $select, $table, $where))
1380
+				and ($lignes = sql_allfetsel($is_table_lien ? '*' : $select, $table, $where))
1381 1381
 			) {
1382 1382
 				foreach ($lignes as $ligne) {
1383 1383
 					// Si le type est fixe
@@ -1487,11 +1487,11 @@  discard block
 block discarded – undo
1487 1487
 			$where = array();
1488 1488
 			// -- L'identifiant du parent
1489 1489
 			if (isset($_methode_parent['champ'])) {
1490
-				$where[] = $_methode_parent['champ'] . ' = ' . $id_objet;
1490
+				$where[] = $_methode_parent['champ'].' = '.$id_objet;
1491 1491
 			}
1492 1492
 			// -- Si le parent est variable
1493 1493
 			if (isset($_methode_parent['champ_type'])) {
1494
-				$where[] = $_methode_parent['champ_type'] . ' = ' . sql_quote($objet);
1494
+				$where[] = $_methode_parent['champ_type'].' = '.sql_quote($objet);
1495 1495
 			}
1496 1496
 
1497 1497
 			// On détermine la table, le champ id des enfants et on complète éventuellement les conditions
Please login to merge, or discard this patch.