Completed
Push — master ( 09b169...f4bae9 )
by cam
01:17
created
ecrire/action/editer_objet.php 1 patch
Spacing   +24 added lines, -24 removed lines patch added patch discarded remove patch
@@ -75,12 +75,12 @@  discard block
 block discarded – undo
75 75
  * @return mixed|string
76 76
  */
77 77
 function objet_modifier($objet, $id, $set = null) {
78
-	if (($t=objet_type($objet)) !== $objet) {
79
-		spip_log("objet_modifier: appel avec type $objet invalide au lieu de $t", "editer" . _LOG_INFO_IMPORTANTE);
78
+	if (($t = objet_type($objet)) !== $objet) {
79
+		spip_log("objet_modifier: appel avec type $objet invalide au lieu de $t", "editer"._LOG_INFO_IMPORTANTE);
80 80
 		$objet = $t;
81 81
 	}
82
-	if (include_spip('action/editer_' . $objet)
83
-		and function_exists($modifier = $objet . "_modifier")
82
+	if (include_spip('action/editer_'.$objet)
83
+		and function_exists($modifier = $objet."_modifier")
84 84
 	) {
85 85
 		return $modifier($id, $set);
86 86
 	}
@@ -89,7 +89,7 @@  discard block
 block discarded – undo
89 89
 	$trouver_table = charger_fonction('trouver_table', 'base');
90 90
 	$desc = $trouver_table($table_sql);
91 91
 	if (!$desc or !isset($desc['field'])) {
92
-		spip_log("Objet $objet inconnu dans objet_modifier", "editer" . _LOG_ERREUR);
92
+		spip_log("Objet $objet inconnu dans objet_modifier", "editer"._LOG_ERREUR);
93 93
 
94 94
 		return _L("Erreur objet $objet inconnu");
95 95
 	}
@@ -163,12 +163,12 @@  discard block
 block discarded – undo
163 163
  * @return bool|int
164 164
  */
165 165
 function objet_inserer($objet, $id_parent = null, $set = null) {
166
-	if (($t=objet_type($objet)) !== $objet) {
167
-		spip_log("objet_inserer: appel avec type $objet invalide au lieu de $t", "editer" . _LOG_INFO_IMPORTANTE);
166
+	if (($t = objet_type($objet)) !== $objet) {
167
+		spip_log("objet_inserer: appel avec type $objet invalide au lieu de $t", "editer"._LOG_INFO_IMPORTANTE);
168 168
 		$objet = $t;
169 169
 	}
170
-	if (include_spip('action/editer_' . $objet)
171
-		and function_exists($inserer = $objet . "_inserer")
170
+	if (include_spip('action/editer_'.$objet)
171
+		and function_exists($inserer = $objet."_inserer")
172 172
 	) {
173 173
 		return $inserer($id_parent, $set);
174 174
 	}
@@ -189,7 +189,7 @@  discard block
 block discarded – undo
189 189
 			$row = sql_fetsel("id_rubrique, id_secteur, lang", "spip_rubriques", "id_parent=0", '', '0+titre,titre', "1");
190 190
 			$id_rubrique = $row['id_rubrique'];
191 191
 		} else {
192
-			$row = sql_fetsel("lang, id_secteur", "spip_rubriques", "id_rubrique=" . intval($id_rubrique));
192
+			$row = sql_fetsel("lang, id_secteur", "spip_rubriques", "id_rubrique=".intval($id_rubrique));
193 193
 		}
194 194
 
195 195
 		$champs['id_rubrique'] = $id_rubrique;
@@ -297,12 +297,12 @@  discard block
 block discarded – undo
297 297
  * @return string
298 298
  */
299 299
 function objet_instituer($objet, $id, $c, $calcul_rub = true) {
300
-	if (($t=objet_type($objet)) !== $objet) {
301
-		spip_log("objet_instituer: appel avec type $objet invalide au lieu de $t", "editer" . _LOG_INFO_IMPORTANTE);
300
+	if (($t = objet_type($objet)) !== $objet) {
301
+		spip_log("objet_instituer: appel avec type $objet invalide au lieu de $t", "editer"._LOG_INFO_IMPORTANTE);
302 302
 		$objet = $t;
303 303
 	}
304
-	if (include_spip('action/editer_' . $objet)
305
-		and function_exists($instituer = $objet . "_instituer")
304
+	if (include_spip('action/editer_'.$objet)
305
+		and function_exists($instituer = $objet."_instituer")
306 306
 	) {
307 307
 		return $instituer($id, $c, $calcul_rub);
308 308
 	}
@@ -331,7 +331,7 @@  discard block
 block discarded – undo
331 331
 	$sel[] = ($champ_date ? "$champ_date as date" : "'' as date");
332 332
 	$sel[] = (isset($desc['field']['id_rubrique']) ? 'id_rubrique' : "0 as id_rubrique");
333 333
 
334
-	$row = sql_fetsel($sel, $table_sql, id_table_objet($objet) . '=' . intval($id));
334
+	$row = sql_fetsel($sel, $table_sql, id_table_objet($objet).'='.intval($id));
335 335
 
336 336
 	$id_rubrique = $row['id_rubrique'];
337 337
 	$statut_ancien = $statut = $row['statut'];
@@ -353,7 +353,7 @@  discard block
 block discarded – undo
353 353
 			if ($s != 'publie' and autoriser('modifier', $objet, $id)) {
354 354
 				$statut = $champs['statut'] = $s;
355 355
 			} else {
356
-				spip_log("editer_objet $objet #$id refus " . json_encode($c), 'editer' . _LOG_INFO_IMPORTANTE);
356
+				spip_log("editer_objet $objet #$id refus ".json_encode($c), 'editer'._LOG_INFO_IMPORTANTE);
357 357
 			}
358 358
 		}
359 359
 
@@ -381,7 +381,7 @@  discard block
 block discarded – undo
381 381
 		and isset($c['id_parent'])
382 382
 		and $id_parent = $c['id_parent']
383 383
 		and $id_parent != $id_rubrique
384
-		and (sql_fetsel('1', "spip_rubriques", "id_rubrique=" . intval($id_parent)))
384
+		and (sql_fetsel('1', "spip_rubriques", "id_rubrique=".intval($id_parent)))
385 385
 	) {
386 386
 		$champs['id_rubrique'] = $id_parent;
387 387
 
@@ -476,7 +476,7 @@  discard block
 block discarded – undo
476 476
 	// changer aussi son secteur et sa langue (si heritee)
477 477
 	if (isset($champs['id_rubrique'])) {
478 478
 
479
-		$row_rub = sql_fetsel("id_secteur, lang", "spip_rubriques", "id_rubrique=" . sql_quote($champs['id_rubrique']));
479
+		$row_rub = sql_fetsel("id_secteur, lang", "spip_rubriques", "id_rubrique=".sql_quote($champs['id_rubrique']));
480 480
 		$langue = $row_rub['lang'];
481 481
 
482 482
 		if (isset($desc['field']['id_secteur'])) {
@@ -485,7 +485,7 @@  discard block
 block discarded – undo
485 485
 
486 486
 		if (isset($desc['field']['lang']) and isset($desc['field']['langue_choisie'])) {
487 487
 			if (sql_fetsel('1', $table_sql,
488
-				id_table_objet($objet) . "=" . intval($id) . " AND langue_choisie<>'oui' AND lang<>" . sql_quote($langue))) {
488
+				id_table_objet($objet)."=".intval($id)." AND langue_choisie<>'oui' AND lang<>".sql_quote($langue))) {
489 489
 				$champs['lang'] = $langue;
490 490
 			}
491 491
 		}
@@ -494,7 +494,7 @@  discard block
 block discarded – undo
494 494
 	if (!$champs) {
495 495
 		return;
496 496
 	}
497
-	sql_updateq($table_sql, $champs, id_table_objet($objet) . '=' . intval($id));
497
+	sql_updateq($table_sql, $champs, id_table_objet($objet).'='.intval($id));
498 498
 
499 499
 	// Changer le statut des rubriques concernees
500 500
 	if ($cond) {
@@ -537,8 +537,8 @@  discard block
 block discarded – undo
537 537
  *     string|int : valeur du champ demande pour l'objet demande
538 538
  */
539 539
 function objet_lire($objet, $valeur_id, $options = array()) {
540
-	if (($t=objet_type($objet)) !== $objet) {
541
-		spip_log("objet_lire: appel avec type $objet invalide au lieu de $t", "editer" . _LOG_INFO_IMPORTANTE);
540
+	if (($t = objet_type($objet)) !== $objet) {
541
+		spip_log("objet_lire: appel avec type $objet invalide au lieu de $t", "editer"._LOG_INFO_IMPORTANTE);
542 542
 		$objet = $t;
543 543
 	}
544 544
 
@@ -558,7 +558,7 @@  discard block
 block discarded – undo
558 558
 	  or (isset($options['force']) and $options['force'])) {
559 559
 		// Il est possible pour un type d'objet de fournir une fonction de lecture de tous les champs d'un objet.
560 560
 		if (
561
-			include_spip('action/editer_' . $objet)
561
+			include_spip('action/editer_'.$objet)
562 562
 			and function_exists($lire = "${objet}_lire_champs")
563 563
 		) {
564 564
 			$valeurs = $lire($objet, $valeur_id, $champ_id);
@@ -568,7 +568,7 @@  discard block
 block discarded – undo
568 568
 
569 569
 			// La condition est appliquée sur le champ désigné par l'utilisateur.
570 570
 			$where = array(
571
-				"${champ_id}=" . sql_quote($valeur_id)
571
+				"${champ_id}=".sql_quote($valeur_id)
572 572
 			);
573 573
 
574 574
 			// Acquisition de tous les champs de l'objet : si l'accès SQL retourne une erreur on renvoie un tableau vide.
Please login to merge, or discard this patch.