Completed
Push — master ( bffbd4...6caf58 )
by cam
05:15
created
ecrire/inc/editer.php 1 patch
Spacing   +37 added lines, -38 removed lines patch added patch discarded remove patch
@@ -100,7 +100,7 @@  discard block
 block discarded – undo
100 100
 		$res['message_ok'] = _T('info_modification_enregistree');
101 101
 		if ($retour) {
102 102
 			if (strncmp($retour, 'javascript:', 11) == 0) {
103
-				$res['message_ok'] .= '<script type="text/javascript">/*<![CDATA[*/' . substr($retour, 11) . '/*]]>*/</script>';
103
+				$res['message_ok'] .= '<script type="text/javascript">/*<![CDATA[*/'.substr($retour, 11).'/*]]>*/</script>';
104 104
 				$res['editable'] = true;
105 105
 			} else {
106 106
 				$res['redirect'] = parametre_url($retour, $id_table_objet, $id);
@@ -140,7 +140,7 @@  discard block
 block discarded – undo
140 140
 				if (!isset($erreurs[$champ])) {
141 141
 					$erreurs[$champ] = '';
142 142
 				}
143
-				$erreurs[$champ] .= _T('alerte_modif_info_concourante') . "<br /><textarea readonly='readonly' class='forml'>" . entites_html($conflit['base']) . '</textarea>';
143
+				$erreurs[$champ] .= _T('alerte_modif_info_concourante')."<br /><textarea readonly='readonly' class='forml'>".entites_html($conflit['base']).'</textarea>';
144 144
 			}
145 145
 		}
146 146
 	}
@@ -215,7 +215,7 @@  discard block
 block discarded – undo
215 215
 	// on accepte pas une fonction de config inconnue si elle vient d'un modele
216 216
 	if ($config_fonc
217 217
 	  and !in_array($config_fonc, ['articles_edit_config', 'rubriques_edit_config', 'auteurs_edit_config'])
218
-	  and $config_fonc !== $table_objet . '_edit_config') {
218
+	  and $config_fonc !== $table_objet.'_edit_config') {
219 219
 		if ($args = test_formulaire_inclus_par_modele()
220 220
 		  and in_array($config_fonc, $args)) {
221 221
 			$config_fonc = '';
@@ -227,12 +227,12 @@  discard block
 block discarded – undo
227 227
 	// Appel direct dans un squelette
228 228
 	if (!$row) {
229 229
 		if (!$new or $lier_trad) {
230
-			if ($select = charger_fonction('precharger_' . $type, 'inc', true)) {
230
+			if ($select = charger_fonction('precharger_'.$type, 'inc', true)) {
231 231
 				$row = $select($id, $id_parent, $lier_trad);
232 232
 				// si on a une fonction precharger, elle pu faire un reglage de langue
233 233
 				$lang_default = (!empty($row['lang']) ? $row['lang'] : null);
234 234
 			} else {
235
-				$row = sql_fetsel('*', $table_objet_sql, $id_table_objet . '=' . intval($id));
235
+				$row = sql_fetsel('*', $table_objet_sql, $id_table_objet.'='.intval($id));
236 236
 			}
237 237
 			if (!$new) {
238 238
 				$md5 = controles_md5($row);
@@ -281,7 +281,7 @@  discard block
 block discarded – undo
281 281
 	if ($config_fonc) {
282 282
 		$contexte['config'] = $config = $config_fonc($contexte);
283 283
 		if (!$lang_default) {
284
-			$lang_default = $config['langue'] ?? session_get('lang') ;
284
+			$lang_default = $config['langue'] ?? session_get('lang');
285 285
 		}
286 286
 	}
287 287
 	$config = $config + array(
@@ -305,13 +305,12 @@  discard block
 block discarded – undo
305 305
 		unset($contexte['lang']);
306 306
 	}
307 307
 
308
-	$contexte['_hidden'] = "<input type='hidden' name='editer_$type' value='oui' />\n" .
309
-		(!$lier_trad ? '' :
310
-			("\n<input type='hidden' name='lier_trad' value='" .
311
-				$lier_trad .
312
-				"' />" .
313
-				"\n<input type='hidden' name='changer_lang' value='" .
314
-				$lang_default .
308
+	$contexte['_hidden'] = "<input type='hidden' name='editer_$type' value='oui' />\n".
309
+		(!$lier_trad ? '' : ("\n<input type='hidden' name='lier_trad' value='".
310
+				$lier_trad.
311
+				"' />".
312
+				"\n<input type='hidden' name='changer_lang' value='".
313
+				$lang_default.
315 314
 				"' />"))
316 315
 		. $hidden
317 316
 		. (isset($md5) ? $md5 : '');
@@ -325,8 +324,8 @@  discard block
 block discarded – undo
325 324
 	$contexte['_action'] = array("editer_$type", $id);
326 325
 
327 326
 	// et in fine placer l'autorisation
328
-	if (intval($id)){
329
-		if (!autoriser('modifier', $type, intval($id))){
327
+	if (intval($id)) {
328
+		if (!autoriser('modifier', $type, intval($id))) {
330 329
 			$valeurs['editable'] = '';
331 330
 		}
332 331
 	}
@@ -350,14 +349,14 @@  discard block
 block discarded – undo
350 349
 	$aider = charger_fonction('aider', 'inc');
351 350
 	if (strlen($texte) > 28 * 1024) {
352 351
 		$texte = str_replace("\r\n", "\n", $texte);
353
-		$pos = strpos($texte, "\n\n", 28 * 1024);  // coupe para > 28 ko
352
+		$pos = strpos($texte, "\n\n", 28 * 1024); // coupe para > 28 ko
354 353
 		if ($pos > 0 and $pos < 32 * 1024) {
355
-			$debut = substr($texte, 0, $pos) . "\n\n<!--SPIP-->\n";
354
+			$debut = substr($texte, 0, $pos)."\n\n<!--SPIP-->\n";
356 355
 			$suite = substr($texte, $pos + 2);
357 356
 		} else {
358
-			$pos = strpos($texte, ' ', 28 * 1024);  // sinon coupe espace
357
+			$pos = strpos($texte, ' ', 28 * 1024); // sinon coupe espace
359 358
 			if (!($pos > 0 and $pos < 32 * 1024)) {
360
-				$pos = 28 * 1024;  // au pire (pas d'espace trouv'e)
359
+				$pos = 28 * 1024; // au pire (pas d'espace trouv'e)
361 360
 				$decalage = 0; // si y'a pas d'espace, il ne faut pas perdre le caract`ere
362 361
 			} else {
363 362
 				$decalage = 1;
@@ -387,13 +386,13 @@  discard block
 block discarded – undo
387 386
 	}
388 387
 
389 388
 	include_spip('inc/barre');
390
-	$textes_supplement = "<br /><span style='color: red'>" . _T('info_texte_long') . "</span>\n";
389
+	$textes_supplement = "<br /><span style='color: red'>"._T('info_texte_long')."</span>\n";
391 390
 	$nombre = 0;
392 391
 
393 392
 	while (strlen($texte) > 29 * 1024) {
394 393
 		$nombre++;
395 394
 		list($texte1, $texte) = coupe_trop_long($texte);
396
-		$textes_supplement .= '<br />' .
395
+		$textes_supplement .= '<br />'.
397 396
 			"<textarea id='texte$nombre' name='texte_plus[$nombre]'$att_text>$texte1</textarea>\n";
398 397
 	}
399 398
 
@@ -481,7 +480,7 @@  discard block
 block discarded – undo
481 480
 	$ctr = array();
482 481
 	foreach ($data as $key => $val) {
483 482
 		$m = md5($val);
484
-		$k = $prefixe . $key;
483
+		$k = $prefixe.$key;
485 484
 
486 485
 		switch ($format) {
487 486
 			case 'html':
@@ -494,7 +493,7 @@  discard block
 block discarded – undo
494 493
 	}
495 494
 
496 495
 	if ($format == 'html') {
497
-		return "\n\n<!-- controles md5 -->\n" . join("\n", $ctr) . "\n\n";
496
+		return "\n\n<!-- controles md5 -->\n".join("\n", $ctr)."\n\n";
498 497
 	} else {
499 498
 		return $ctr;
500 499
 	}
@@ -645,7 +644,7 @@  discard block
 block discarded – undo
645 644
 	// On elimine les donnees non modifiees par le formulaire (mais
646 645
 	// potentiellement modifiees entre temps par un autre utilisateur)
647 646
 	foreach ($champs as $key => $val) {
648
-		if (isset($ctr[$prefix . $key]) and $m = $ctr[$prefix . $key]) {
647
+		if (isset($ctr[$prefix.$key]) and $m = $ctr[$prefix.$key]) {
649 648
 			if (is_scalar($val) and $m == md5($val)) {
650 649
 				unset($champs[$key]);
651 650
 			}
@@ -674,7 +673,7 @@  discard block
 block discarded – undo
674 673
 	// de conflit.
675 674
 	$ctrh = $ctrq = $conflits = array();
676 675
 	foreach (array_keys($champs) as $key) {
677
-		if (isset($ctr[$prefix . $key]) and $m = $ctr[$prefix . $key]) {
676
+		if (isset($ctr[$prefix.$key]) and $m = $ctr[$prefix.$key]) {
678 677
 			$ctrh[$key] = $m;
679 678
 			$ctrq[] = $key;
680 679
 		}
@@ -707,9 +706,9 @@  discard block
 block discarded – undo
707 706
  */
708 707
 function display_conflit_champ($x) {
709 708
 	if (strstr($x, "\n") or strlen($x) > 80) {
710
-		return "<textarea style='width:99%; height:10em;'>" . entites_html($x) . "</textarea>\n";
709
+		return "<textarea style='width:99%; height:10em;'>".entites_html($x)."</textarea>\n";
711 710
 	} else {
712
-		return "<input type='text' size='40' style='width:99%' value=\"" . entites_html($x) . "\" />\n";
711
+		return "<input type='text' size='40' style='width:99%' value=\"".entites_html($x)."\" />\n";
713 712
 	}
714 713
 }
715 714
 
@@ -749,11 +748,11 @@  discard block
 block discarded – undo
749 748
 		) : $champ;
750 749
 
751 750
 		$diffs[] = "<h2>$titre</h2>\n"
752
-			. '<h3>' . _T('info_conflit_edition_differences') . "</h3>\n"
753
-			. "<div style='max-height:8em; overflow: auto; width:99%;'>" . $d . "</div>\n"
754
-			. '<h4>' . _T('info_conflit_edition_votre_version') . '</h4>'
751
+			. '<h3>'._T('info_conflit_edition_differences')."</h3>\n"
752
+			. "<div style='max-height:8em; overflow: auto; width:99%;'>".$d."</div>\n"
753
+			. '<h4>'._T('info_conflit_edition_votre_version').'</h4>'
755 754
 			. display_conflit_champ($a['post'])
756
-			. '<h4>' . _T('info_conflit_edition_version_enregistree') . '</h4>'
755
+			. '<h4>'._T('info_conflit_edition_version_enregistree').'</h4>'
757 756
 			. display_conflit_champ($base);
758 757
 	}
759 758
 
@@ -761,16 +760,16 @@  discard block
 block discarded – undo
761 760
 		$id = uniqid(rand());
762 761
 		$redirect = "<form action='$redirect' method='get'
763 762
 			id='$id'
764
-			style='float:" . $GLOBALS['spip_lang_right'] . "; margin-top:2em;'>\n"
763
+			style='float:".$GLOBALS['spip_lang_right']."; margin-top:2em;'>\n"
765 764
 			. form_hidden($redirect)
766
-			. "<input type='submit' value='" . _T('icone_retour') . "' />
765
+			. "<input type='submit' value='"._T('icone_retour')."' />
767 766
 		</form>\n";
768 767
 
769 768
 		// pour les documents, on est probablement en ajax : il faut ajaxer
770 769
 		if (_AJAX) {
771 770
 			$redirect .= '<script type="text/javascript">'
772
-				. 'setTimeout(function(){$("#' . $id . '")
773
-			.ajaxForm({target:$("#' . $id . '").parent()});
771
+				. 'setTimeout(function(){$("#'.$id.'")
772
+			.ajaxForm({target:$("#' . $id.'").parent()});
774 773
 			}, 200);'
775 774
 				. "</script>\n";
776 775
 		}
@@ -789,9 +788,9 @@  discard block
 block discarded – undo
789 788
 .diff-para-deplace .diff-supprime { background: #ffb8b8; border: 1px solid #808080; }
790 789
 .diff-para-deplace .diff-deplace { background: #b8b8ff; border: 1px solid #808080; }
791 790
 </style>'
792
-		. '<p>' . _T('info_conflit_edition_avis_non_sauvegarde') . '</p>'
793
-		. '<p>' . _T('texte_conflit_edition_correction') . '</p>'
794
-		. "<div style='text-align:" . $GLOBALS['spip_lang_left'] . ";'>"
791
+		. '<p>'._T('info_conflit_edition_avis_non_sauvegarde').'</p>'
792
+		. '<p>'._T('texte_conflit_edition_correction').'</p>'
793
+		. "<div style='text-align:".$GLOBALS['spip_lang_left'].";'>"
795 794
 		. join("\n", $diffs)
796 795
 		. "</div>\n"
797 796
 
Please login to merge, or discard this patch.