Completed
Push — master ( 37aa61...be7234 )
by cam
01:24
created
ecrire/inc/layer.php 1 patch
Indentation   +45 added lines, -45 removed lines patch added patch discarded remove patch
@@ -10,7 +10,7 @@  discard block
 block discarded – undo
10 10
 \***************************************************************************/
11 11
 
12 12
 if (!defined('_ECRIRE_INC_VERSION')) {
13
-	return;
13
+    return;
14 14
 }
15 15
 
16 16
 /**
@@ -25,68 +25,68 @@  discard block
 block discarded – undo
25 25
  * @return string Code HTML du cadre dépliable
26 26
  **/
27 27
 function cadre_depliable($icone, $titre, $deplie, $contenu, $ids = '', $style_cadre = 'r') {
28
-	$bouton = bouton_block_depliable($titre, $deplie, $ids);
28
+    $bouton = bouton_block_depliable($titre, $deplie, $ids);
29 29
 
30
-	return
31
-		debut_cadre($style_cadre, $icone, '', $bouton, '', '', false)
32
-		. debut_block_depliable($deplie, $ids)
33
-		. "<div class='cadre_padding'>\n"
34
-		. $contenu
35
-		. "</div>\n"
36
-		. fin_block()
37
-		. fin_cadre();
30
+    return
31
+        debut_cadre($style_cadre, $icone, '', $bouton, '', '', false)
32
+        . debut_block_depliable($deplie, $ids)
33
+        . "<div class='cadre_padding'>\n"
34
+        . $contenu
35
+        . "</div>\n"
36
+        . fin_block()
37
+        . fin_cadre();
38 38
 }
39 39
 
40 40
 function block_parfois_visible($nom, $invite, $masque, $style = '', $visible = false) {
41
-	return "\n"
42
-	. bouton_block_depliable($invite, $visible, $nom)
43
-	. debut_block_depliable($visible, $nom)
44
-	. $masque
45
-	. fin_block();
41
+    return "\n"
42
+    . bouton_block_depliable($invite, $visible, $nom)
43
+    . debut_block_depliable($visible, $nom)
44
+    . $masque
45
+    . fin_block();
46 46
 }
47 47
 
48 48
 function debut_block_depliable($deplie, $id = '') {
49
-	$class = ' blocdeplie';
50
-	// si on n'accepte pas js, ne pas fermer
51
-	if (!$deplie) {
52
-		$class = ' blocreplie';
53
-	}
49
+    $class = ' blocdeplie';
50
+    // si on n'accepte pas js, ne pas fermer
51
+    if (!$deplie) {
52
+        $class = ' blocreplie';
53
+    }
54 54
 
55
-	return '<div ' . ($id ? "id='$id' " : '') . "class='bloc_depliable$class'>";
55
+    return '<div ' . ($id ? "id='$id' " : '') . "class='bloc_depliable$class'>";
56 56
 }
57 57
 
58 58
 function fin_block() {
59
-	return "<div class='nettoyeur'></div>\n</div>";
59
+    return "<div class='nettoyeur'></div>\n</div>";
60 60
 }
61 61
 
62 62
 // $texte : texte du bouton
63 63
 // $deplie : true (deplie) ou false (plie) ou -1 (inactif) ou 'incertain' pour que le bouton s'auto init au chargement de la page
64 64
 // $ids : id des div lies au bouton (facultatif, par defaut c'est le div.bloc_depliable qui suit)
65 65
 function bouton_block_depliable($texte, $deplie, $ids = '') {
66
-	$bouton_id = 'b' . substr(md5($texte . microtime()), 0, 8);
66
+    $bouton_id = 'b' . substr(md5($texte . microtime()), 0, 8);
67 67
 
68
-	$class = ($deplie === true) ? ' deplie' : (($deplie == -1) ? ' impliable' : ' replie');
69
-	if (strlen((string) $ids)) {
70
-		$cible = explode(',', (string) $ids);
71
-		$cible = '#' . implode(',#', $cible);
72
-	} else {
73
-		$cible = "#$bouton_id + div.bloc_depliable";
74
-	}
68
+    $class = ($deplie === true) ? ' deplie' : (($deplie == -1) ? ' impliable' : ' replie');
69
+    if (strlen((string) $ids)) {
70
+        $cible = explode(',', (string) $ids);
71
+        $cible = '#' . implode(',#', $cible);
72
+    } else {
73
+        $cible = "#$bouton_id + div.bloc_depliable";
74
+    }
75 75
 
76
-	$b = (str_contains((string) $texte, '<h') ? 'div' : 'h3');
76
+    $b = (str_contains((string) $texte, '<h') ? 'div' : 'h3');
77 77
 
78
-	return "<$b "
79
-	. ($bouton_id ? "id='$bouton_id' " : '')
80
-	. "class='titrem$class'"
81
-	. (($deplie === -1)
82
-		? ''
83
-		: " onmouseover=\"jQuery(this).depliant('$cible');\""
84
-	)
85
-	. '>'
86
-	// une ancre pour rendre accessible au clavier le depliage du sous bloc
87
-	. "<a href='#' onclick=\"return jQuery(this).depliant_clicancre('$cible');\" class='titremancre'></a>"
88
-	. "$texte</$b>"
89
-	. http_script(($deplie === 'incertain')
90
-		? "jQuery(function($){if ($('$cible').is(':visible')) { $('#$bouton_id').addClass('deplie').removeClass('replie'); }});"
91
-		: '');
78
+    return "<$b "
79
+    . ($bouton_id ? "id='$bouton_id' " : '')
80
+    . "class='titrem$class'"
81
+    . (($deplie === -1)
82
+        ? ''
83
+        : " onmouseover=\"jQuery(this).depliant('$cible');\""
84
+    )
85
+    . '>'
86
+    // une ancre pour rendre accessible au clavier le depliage du sous bloc
87
+    . "<a href='#' onclick=\"return jQuery(this).depliant_clicancre('$cible');\" class='titremancre'></a>"
88
+    . "$texte</$b>"
89
+    . http_script(($deplie === 'incertain')
90
+        ? "jQuery(function($){if ($('$cible').is(':visible')) { $('#$bouton_id').addClass('deplie').removeClass('replie'); }});"
91
+        : '');
92 92
 }
Please login to merge, or discard this patch.
ecrire/inc/editer.php 2 patches
Indentation   +413 added lines, -413 removed lines patch added patch discarded remove patch
@@ -16,7 +16,7 @@  discard block
 block discarded – undo
16 16
  **/
17 17
 
18 18
 if (!defined('_ECRIRE_INC_VERSION')) {
19
-	return;
19
+    return;
20 20
 }
21 21
 include_spip('base/abstract_sql');
22 22
 
@@ -58,56 +58,56 @@  discard block
 block discarded – undo
58 58
  *     Retour des traitements.
59 59
  **/
60 60
 function formulaires_editer_objet_traiter(
61
-	$type,
62
-	$id = 'new',
63
-	$id_parent = 0,
64
-	$lier_trad = 0,
65
-	$retour = '',
66
-	$config_fonc = 'articles_edit_config',
67
-	$row = [],
68
-	$hidden = ''
61
+    $type,
62
+    $id = 'new',
63
+    $id_parent = 0,
64
+    $lier_trad = 0,
65
+    $retour = '',
66
+    $config_fonc = 'articles_edit_config',
67
+    $row = [],
68
+    $hidden = ''
69 69
 ) {
70 70
 
71
-	$res = [];
72
-	// eviter la redirection forcee par l'action...
73
-	set_request('redirect');
74
-	if ($action_editer = charger_fonction("editer_$type", 'action', true)) {
75
-		[$id, $err] = $action_editer($id);
76
-	} else {
77
-		$action_editer = charger_fonction('editer_objet', 'action');
78
-		[$id, $err] = $action_editer($id, $type);
79
-	}
80
-	$id_table_objet = id_table_objet($type);
81
-	$res[$id_table_objet] = $id;
82
-	if ($err || !$id) {
83
-		$res['message_erreur'] = ($err ?: _T('erreur'));
84
-	} else {
85
-		// Un lien de trad a prendre en compte
86
-		if ($lier_trad) {
87
-			// referencer la traduction
88
-			$referencer_traduction = charger_fonction('referencer_traduction', 'action');
89
-			$referencer_traduction($type, $id, $lier_trad);
90
-			// actions de recopie de champs / liens sur le nouvel objet créé
91
-			$completer_traduction = charger_fonction('completer_traduction', 'inc');
92
-			$err = $completer_traduction($type, $id, $lier_trad);
93
-			if ($err) {
94
-				$res['message_erreur'] = $err;
95
-				return $res;
96
-			}
97
-		}
98
-
99
-		$res['message_ok'] = _T('info_modification_enregistree');
100
-		if ($retour) {
101
-			if (str_starts_with($retour, 'javascript:')) {
102
-				$res['message_ok'] .= '<script type="text/javascript">/*<![CDATA[*/' . substr($retour, 11) . '/*]]>*/</script>';
103
-				$res['editable'] = true;
104
-			} else {
105
-				$res['redirect'] = parametre_url($retour, $id_table_objet, $id);
106
-			}
107
-		}
108
-	}
109
-
110
-	return $res;
71
+    $res = [];
72
+    // eviter la redirection forcee par l'action...
73
+    set_request('redirect');
74
+    if ($action_editer = charger_fonction("editer_$type", 'action', true)) {
75
+        [$id, $err] = $action_editer($id);
76
+    } else {
77
+        $action_editer = charger_fonction('editer_objet', 'action');
78
+        [$id, $err] = $action_editer($id, $type);
79
+    }
80
+    $id_table_objet = id_table_objet($type);
81
+    $res[$id_table_objet] = $id;
82
+    if ($err || !$id) {
83
+        $res['message_erreur'] = ($err ?: _T('erreur'));
84
+    } else {
85
+        // Un lien de trad a prendre en compte
86
+        if ($lier_trad) {
87
+            // referencer la traduction
88
+            $referencer_traduction = charger_fonction('referencer_traduction', 'action');
89
+            $referencer_traduction($type, $id, $lier_trad);
90
+            // actions de recopie de champs / liens sur le nouvel objet créé
91
+            $completer_traduction = charger_fonction('completer_traduction', 'inc');
92
+            $err = $completer_traduction($type, $id, $lier_trad);
93
+            if ($err) {
94
+                $res['message_erreur'] = $err;
95
+                return $res;
96
+            }
97
+        }
98
+
99
+        $res['message_ok'] = _T('info_modification_enregistree');
100
+        if ($retour) {
101
+            if (str_starts_with($retour, 'javascript:')) {
102
+                $res['message_ok'] .= '<script type="text/javascript">/*<![CDATA[*/' . substr($retour, 11) . '/*]]>*/</script>';
103
+                $res['editable'] = true;
104
+            } else {
105
+                $res['redirect'] = parametre_url($retour, $id_table_objet, $id);
106
+            }
107
+        }
108
+    }
109
+
110
+    return $res;
111 111
 }
112 112
 
113 113
 /**
@@ -131,29 +131,29 @@  discard block
 block discarded – undo
131 131
  *     Tableau des erreurs
132 132
  **/
133 133
 function formulaires_editer_objet_verifier($type, $id = 'new', $oblis = []) {
134
-	$erreurs = [];
135
-	if ((int) $id) {
136
-		$conflits = controler_contenu($type, $id);
137
-		if ($conflits && (is_countable($conflits) ? count($conflits) : 0)) {
138
-			foreach ($conflits as $champ => $conflit) {
139
-				if (!isset($erreurs[$champ])) {
140
-					$erreurs[$champ] = '';
141
-				}
142
-				$erreurs[$champ] .= _T('alerte_modif_info_concourante') . "<br /><textarea readonly='readonly' class='forml'>" . entites_html($conflit['base']) . '</textarea>';
143
-			}
144
-		}
145
-	}
146
-	foreach ($oblis as $obli) {
147
-		$value = _request($obli);
148
-		if (is_null($value) || !(is_array($value) ? count($value) : strlen((string) $value))) {
149
-			if (!isset($erreurs[$obli])) {
150
-				$erreurs[$obli] = '';
151
-			}
152
-			$erreurs[$obli] .= _T('info_obligatoire');
153
-		}
154
-	}
155
-
156
-	return $erreurs;
134
+    $erreurs = [];
135
+    if ((int) $id) {
136
+        $conflits = controler_contenu($type, $id);
137
+        if ($conflits && (is_countable($conflits) ? count($conflits) : 0)) {
138
+            foreach ($conflits as $champ => $conflit) {
139
+                if (!isset($erreurs[$champ])) {
140
+                    $erreurs[$champ] = '';
141
+                }
142
+                $erreurs[$champ] .= _T('alerte_modif_info_concourante') . "<br /><textarea readonly='readonly' class='forml'>" . entites_html($conflit['base']) . '</textarea>';
143
+            }
144
+        }
145
+    }
146
+    foreach ($oblis as $obli) {
147
+        $value = _request($obli);
148
+        if (is_null($value) || !(is_array($value) ? count($value) : strlen((string) $value))) {
149
+            if (!isset($erreurs[$obli])) {
150
+                $erreurs[$obli] = '';
151
+            }
152
+            $erreurs[$obli] .= _T('info_obligatoire');
153
+        }
154
+    }
155
+
156
+    return $erreurs;
157 157
 }
158 158
 
159 159
 /**
@@ -198,150 +198,150 @@  discard block
 block discarded – undo
198 198
  *     Environnement du formulaire.
199 199
  **/
200 200
 function formulaires_editer_objet_charger(
201
-	$type,
202
-	$id = 'new',
203
-	$id_parent = 0,
204
-	$lier_trad = 0,
205
-	$retour = '',
206
-	$config_fonc = 'articles_edit_config',
207
-	$row = [],
208
-	$hidden = ''
201
+    $type,
202
+    $id = 'new',
203
+    $id_parent = 0,
204
+    $lier_trad = 0,
205
+    $retour = '',
206
+    $config_fonc = 'articles_edit_config',
207
+    $row = [],
208
+    $hidden = ''
209 209
 ) {
210 210
 
211
-	$table_objet = table_objet($type);
212
-	$table_objet_sql = table_objet_sql($type);
213
-	$id_table_objet = id_table_objet($type);
214
-	if (!is_array($row)) {
215
-		$row = [];
216
-	}
217
-
218
-	// on accepte pas une fonction de config inconnue si elle vient d'un modele
219
-	if (
220
-		$config_fonc
221
-		&& !in_array($config_fonc, ['articles_edit_config', 'rubriques_edit_config', 'auteurs_edit_config'])
222
-		&& $config_fonc !== $table_objet . '_edit_config'
223
-		&& ($args = test_formulaire_inclus_par_modele())
224
-		&& in_array($config_fonc, $args)
225
-	) {
226
-		$config_fonc = '';
227
-	}
228
-
229
-	$new = !is_numeric($id);
230
-	$lang_default = '';
231
-	// Appel direct dans un squelette
232
-	if (!$row) {
233
-		if (!$new || $lier_trad) {
234
-			if ($select = charger_fonction('precharger_' . $type, 'inc', true)) {
235
-				$row = $select($id, $id_parent, $lier_trad);
236
-				// si on a une fonction precharger, elle pu faire un reglage de langue
237
-				$lang_default = (empty($row['lang']) ? null : $row['lang']);
238
-			} else {
239
-				$row = sql_fetsel('*', $table_objet_sql, $id_table_objet . '=' . (int) $id);
240
-			}
241
-			if (!$new) {
242
-				$md5 = controles_md5($row ?: []);
243
-			}
244
-		}
245
-		if (!$row) {
246
-			$row = [];
247
-			$trouver_table = charger_fonction('trouver_table', 'base');
248
-			if ($desc = $trouver_table($table_objet)) {
249
-				foreach ($desc['field'] as $k => $v) {
250
-					$row[$k] = '';
251
-				}
252
-			}
253
-		}
254
-	}
255
-
256
-	// Gaffe: sans ceci, on ecrase systematiquement l'article d'origine
257
-	// (et donc: pas de lien de traduction)
258
-	$id = ($new || $lier_trad)
259
-		? 'oui'
260
-		: $row[$id_table_objet];
261
-	$row[$id_table_objet] = $id;
262
-
263
-	$contexte = $row;
264
-	if (is_numeric($id_parent) && strlen($id_parent) && (!isset($contexte['id_parent']) || $new)) {
265
-		if (!isset($contexte['id_parent'])) {
266
-			unset($contexte['id_rubrique']);
267
-		}
268
-		$contexte['id_parent'] = $id_parent;
269
-	} elseif (!isset($contexte['id_parent'])) {
270
-		// id_rubrique dans id_parent si possible
271
-		if (isset($contexte['id_rubrique'])) {
272
-			$contexte['id_parent'] = $contexte['id_rubrique'];
273
-			unset($contexte['id_rubrique']);
274
-		} else {
275
-			$contexte['id_parent'] = '';
276
-		}
277
-		if (
278
-			!$contexte['id_parent']
279
-			&& ($preselectionner_parent_nouvel_objet = charger_fonction('preselectionner_parent_nouvel_objet', 'inc', true))
280
-		) {
281
-			$contexte['id_parent'] = $preselectionner_parent_nouvel_objet($type, $row);
282
-		}
283
-	}
284
-
285
-	$config = [];
286
-	if ($config_fonc) {
287
-		$contexte['config'] = $config = $config_fonc($contexte);
288
-		if (!$lang_default) {
289
-			$lang_default = $config['langue'] ?? session_get('lang') ;
290
-		}
291
-	}
292
-	$config += [
293
-		'lignes' => 0,
294
-		'langue' => '',
295
-	];
296
-
297
-	$att_text = " class='textarea' "
298
-		. " rows='"
299
-		. ($config['lignes'] + 15)
300
-		. "' cols='40'";
301
-
302
-
303
-	// on veut conserver la langue de l'interface ;
304
-	// on passe cette donnee sous un autre nom, au cas ou le squelette
305
-	// voudrait l'exploiter
306
-	if (isset($contexte['lang'])) {
307
-		$contexte['langue'] = $contexte['lang'];
308
-		unset($contexte['lang']);
309
-	}
310
-
311
-	$contexte['_hidden'] = "<input type='hidden' name='editer_$type' value='oui' />\n" .
312
-		($lier_trad
313
-			 ? "\n<input type='hidden' name='lier_trad' value='" .
314
-				$lier_trad .
315
-				"' />" .
316
-				"\n<input type='hidden' name='changer_lang' value='" .
317
-				$lang_default .
318
-				"' />"
319
-			: '')
320
-		. $hidden
321
-		. ($md5 ?? '');
322
-
323
-	// preciser que le formulaire doit passer dans un pipeline
324
-	$contexte['_pipeline'] = ['editer_contenu_objet', ['type' => $type, 'id' => $id]];
325
-
326
-	// preciser que le formulaire doit etre securise auteur/action
327
-	// n'est plus utile lorsque l'action accepte l'id en argument direct
328
-	// on le garde pour compat
329
-	$contexte['_action'] = ["editer_$type", $id];
330
-
331
-	// et in fine placer l'autorisation
332
-	include_spip('inc/autoriser');
333
-	if ((int) $id) {
334
-		if (!autoriser('modifier', $type, (int) $id)) {
335
-			$contexte['editable'] = '';
336
-		}
337
-	}
338
-	else {
339
-		if (!autoriser('creer', $type, 0, null, ['id_parent' => $id_parent])) {
340
-			$contexte['editable'] = '';
341
-		}
342
-	}
343
-
344
-	return $contexte;
211
+    $table_objet = table_objet($type);
212
+    $table_objet_sql = table_objet_sql($type);
213
+    $id_table_objet = id_table_objet($type);
214
+    if (!is_array($row)) {
215
+        $row = [];
216
+    }
217
+
218
+    // on accepte pas une fonction de config inconnue si elle vient d'un modele
219
+    if (
220
+        $config_fonc
221
+        && !in_array($config_fonc, ['articles_edit_config', 'rubriques_edit_config', 'auteurs_edit_config'])
222
+        && $config_fonc !== $table_objet . '_edit_config'
223
+        && ($args = test_formulaire_inclus_par_modele())
224
+        && in_array($config_fonc, $args)
225
+    ) {
226
+        $config_fonc = '';
227
+    }
228
+
229
+    $new = !is_numeric($id);
230
+    $lang_default = '';
231
+    // Appel direct dans un squelette
232
+    if (!$row) {
233
+        if (!$new || $lier_trad) {
234
+            if ($select = charger_fonction('precharger_' . $type, 'inc', true)) {
235
+                $row = $select($id, $id_parent, $lier_trad);
236
+                // si on a une fonction precharger, elle pu faire un reglage de langue
237
+                $lang_default = (empty($row['lang']) ? null : $row['lang']);
238
+            } else {
239
+                $row = sql_fetsel('*', $table_objet_sql, $id_table_objet . '=' . (int) $id);
240
+            }
241
+            if (!$new) {
242
+                $md5 = controles_md5($row ?: []);
243
+            }
244
+        }
245
+        if (!$row) {
246
+            $row = [];
247
+            $trouver_table = charger_fonction('trouver_table', 'base');
248
+            if ($desc = $trouver_table($table_objet)) {
249
+                foreach ($desc['field'] as $k => $v) {
250
+                    $row[$k] = '';
251
+                }
252
+            }
253
+        }
254
+    }
255
+
256
+    // Gaffe: sans ceci, on ecrase systematiquement l'article d'origine
257
+    // (et donc: pas de lien de traduction)
258
+    $id = ($new || $lier_trad)
259
+        ? 'oui'
260
+        : $row[$id_table_objet];
261
+    $row[$id_table_objet] = $id;
262
+
263
+    $contexte = $row;
264
+    if (is_numeric($id_parent) && strlen($id_parent) && (!isset($contexte['id_parent']) || $new)) {
265
+        if (!isset($contexte['id_parent'])) {
266
+            unset($contexte['id_rubrique']);
267
+        }
268
+        $contexte['id_parent'] = $id_parent;
269
+    } elseif (!isset($contexte['id_parent'])) {
270
+        // id_rubrique dans id_parent si possible
271
+        if (isset($contexte['id_rubrique'])) {
272
+            $contexte['id_parent'] = $contexte['id_rubrique'];
273
+            unset($contexte['id_rubrique']);
274
+        } else {
275
+            $contexte['id_parent'] = '';
276
+        }
277
+        if (
278
+            !$contexte['id_parent']
279
+            && ($preselectionner_parent_nouvel_objet = charger_fonction('preselectionner_parent_nouvel_objet', 'inc', true))
280
+        ) {
281
+            $contexte['id_parent'] = $preselectionner_parent_nouvel_objet($type, $row);
282
+        }
283
+    }
284
+
285
+    $config = [];
286
+    if ($config_fonc) {
287
+        $contexte['config'] = $config = $config_fonc($contexte);
288
+        if (!$lang_default) {
289
+            $lang_default = $config['langue'] ?? session_get('lang') ;
290
+        }
291
+    }
292
+    $config += [
293
+        'lignes' => 0,
294
+        'langue' => '',
295
+    ];
296
+
297
+    $att_text = " class='textarea' "
298
+        . " rows='"
299
+        . ($config['lignes'] + 15)
300
+        . "' cols='40'";
301
+
302
+
303
+    // on veut conserver la langue de l'interface ;
304
+    // on passe cette donnee sous un autre nom, au cas ou le squelette
305
+    // voudrait l'exploiter
306
+    if (isset($contexte['lang'])) {
307
+        $contexte['langue'] = $contexte['lang'];
308
+        unset($contexte['lang']);
309
+    }
310
+
311
+    $contexte['_hidden'] = "<input type='hidden' name='editer_$type' value='oui' />\n" .
312
+        ($lier_trad
313
+             ? "\n<input type='hidden' name='lier_trad' value='" .
314
+                $lier_trad .
315
+                "' />" .
316
+                "\n<input type='hidden' name='changer_lang' value='" .
317
+                $lang_default .
318
+                "' />"
319
+            : '')
320
+        . $hidden
321
+        . ($md5 ?? '');
322
+
323
+    // preciser que le formulaire doit passer dans un pipeline
324
+    $contexte['_pipeline'] = ['editer_contenu_objet', ['type' => $type, 'id' => $id]];
325
+
326
+    // preciser que le formulaire doit etre securise auteur/action
327
+    // n'est plus utile lorsque l'action accepte l'id en argument direct
328
+    // on le garde pour compat
329
+    $contexte['_action'] = ["editer_$type", $id];
330
+
331
+    // et in fine placer l'autorisation
332
+    include_spip('inc/autoriser');
333
+    if ((int) $id) {
334
+        if (!autoriser('modifier', $type, (int) $id)) {
335
+            $contexte['editable'] = '';
336
+        }
337
+    }
338
+    else {
339
+        if (!autoriser('creer', $type, 0, null, ['id_parent' => $id_parent])) {
340
+            $contexte['editable'] = '';
341
+        }
342
+    }
343
+
344
+    return $contexte;
345 345
 }
346 346
 
347 347
 /**
@@ -352,29 +352,29 @@  discard block
 block discarded – undo
352 352
  * @return array
353 353
  */
354 354
 function coupe_trop_long($texte) {
355
-	$aider = charger_fonction('aider', 'inc');
356
-	if (strlen($texte) > 28 * 1024) {
357
-		$texte = str_replace("\r\n", "\n", $texte);
358
-		$pos = strpos($texte, "\n\n", 28 * 1024);  // coupe para > 28 ko
359
-		if ($pos > 0 && $pos < 32 * 1024) {
360
-			$debut = substr($texte, 0, $pos) . "\n\n<!--SPIP-->\n";
361
-			$suite = substr($texte, $pos + 2);
362
-		} else {
363
-			$pos = strpos($texte, ' ', 28 * 1024);  // sinon coupe espace
364
-			if (!($pos > 0 && $pos < 32 * 1024)) {
365
-				$pos = 28 * 1024;  // au pire (pas d'espace trouv'e)
366
-				$decalage = 0; // si y'a pas d'espace, il ne faut pas perdre le caract`ere
367
-			} else {
368
-				$decalage = 1;
369
-			}
370
-			$debut = substr($texte, 0, $pos + $decalage); // Il faut conserver l'espace s'il y en a un
371
-			$suite = substr($texte, $pos + $decalage);
372
-		}
373
-
374
-		return ([$debut, $suite]);
375
-	} else {
376
-		return ([$texte, '']);
377
-	}
355
+    $aider = charger_fonction('aider', 'inc');
356
+    if (strlen($texte) > 28 * 1024) {
357
+        $texte = str_replace("\r\n", "\n", $texte);
358
+        $pos = strpos($texte, "\n\n", 28 * 1024);  // coupe para > 28 ko
359
+        if ($pos > 0 && $pos < 32 * 1024) {
360
+            $debut = substr($texte, 0, $pos) . "\n\n<!--SPIP-->\n";
361
+            $suite = substr($texte, $pos + 2);
362
+        } else {
363
+            $pos = strpos($texte, ' ', 28 * 1024);  // sinon coupe espace
364
+            if (!($pos > 0 && $pos < 32 * 1024)) {
365
+                $pos = 28 * 1024;  // au pire (pas d'espace trouv'e)
366
+                $decalage = 0; // si y'a pas d'espace, il ne faut pas perdre le caract`ere
367
+            } else {
368
+                $decalage = 1;
369
+            }
370
+            $debut = substr($texte, 0, $pos + $decalage); // Il faut conserver l'espace s'il y en a un
371
+            $suite = substr($texte, $pos + $decalage);
372
+        }
373
+
374
+        return ([$debut, $suite]);
375
+    } else {
376
+        return ([$texte, '']);
377
+    }
378 378
 }
379 379
 
380 380
 /**
@@ -385,13 +385,13 @@  discard block
 block discarded – undo
385 385
  * @param int $longueur
386 386
  */
387 387
 function titre_automatique($champ_titre, $champs_contenu, $longueur = null) {
388
-	if (!_request($champ_titre)) {
389
-		$titrer_contenu = charger_fonction('titrer_contenu', 'inc');
390
-		$t = is_null($longueur) ? $titrer_contenu($champs_contenu) : $titrer_contenu($champs_contenu, null, $longueur);
391
-		if ($t) {
392
-			set_request($champ_titre, $t);
393
-		}
394
-	}
388
+    if (!_request($champ_titre)) {
389
+        $titrer_contenu = charger_fonction('titrer_contenu', 'inc');
390
+        $t = is_null($longueur) ? $titrer_contenu($champs_contenu) : $titrer_contenu($champs_contenu, null, $longueur);
391
+        if ($t) {
392
+            set_request($champ_titre, $t);
393
+        }
394
+    }
395 395
 }
396 396
 
397 397
 /**
@@ -411,20 +411,20 @@  discard block
 block discarded – undo
411 411
  * @return string
412 412
  */
413 413
 function inc_titrer_contenu_dist($champs_contenu, $c = null, $longueur = 50) {
414
-	// trouver un champ texte non vide
415
-	$t = '';
416
-	foreach ($champs_contenu as $champ) {
417
-		if ($t = _request($champ, $c)) {
418
-			break;
419
-		}
420
-	}
421
-
422
-	if ($t) {
423
-		include_spip('inc/texte_mini');
424
-		$t = couper($t, $longueur, '...');
425
-	}
426
-
427
-	return $t;
414
+    // trouver un champ texte non vide
415
+    $t = '';
416
+    foreach ($champs_contenu as $champ) {
417
+        if ($t = _request($champ, $c)) {
418
+            break;
419
+        }
420
+    }
421
+
422
+    if ($t) {
423
+        include_spip('inc/texte_mini');
424
+        $t = couper($t, $longueur, '...');
425
+    }
426
+
427
+    return $t;
428 428
 }
429 429
 
430 430
 /**
@@ -446,22 +446,22 @@  discard block
 block discarded – undo
446 446
  *      - array sinon couples ('$prefixe$colonne => md5)
447 447
  **/
448 448
 function controles_md5(array $data, string $prefixe = 'ctr_', string $format = 'html') {
449
-	$ctr = [];
450
-	foreach ($data as $key => $val) {
451
-		$m = md5($val ?? '');
452
-		$k = $prefixe . $key;
453
-
454
-		$ctr[$k] = match ($format) {
455
-			'html' => "<input type='hidden' value='$m' name='$k' />",
456
-			default => $m,
457
-		};
458
-	}
459
-
460
-	if ($format === 'html') {
461
-		return "\n\n<!-- controles md5 -->\n" . implode("\n", $ctr) . "\n\n";
462
-	} else {
463
-		return $ctr;
464
-	}
449
+    $ctr = [];
450
+    foreach ($data as $key => $val) {
451
+        $m = md5($val ?? '');
452
+        $k = $prefixe . $key;
453
+
454
+        $ctr[$k] = match ($format) {
455
+            'html' => "<input type='hidden' value='$m' name='$k' />",
456
+            default => $m,
457
+        };
458
+    }
459
+
460
+    if ($format === 'html') {
461
+        return "\n\n<!-- controles md5 -->\n" . implode("\n", $ctr) . "\n\n";
462
+    } else {
463
+        return $ctr;
464
+    }
465 465
 }
466 466
 
467 467
 /**
@@ -500,80 +500,80 @@  discard block
 block discarded – undo
500 500
  *     - post : le contenu posté
501 501
  **/
502 502
 function controler_contenu($type, $id, $options = [], $c = false, $serveur = '') {
503
-	include_spip('inc/filtres');
504
-
505
-	$table_objet = table_objet($type);
506
-	$spip_table_objet = table_objet_sql($type);
507
-	$trouver_table = charger_fonction('trouver_table', 'base');
508
-	$desc = $trouver_table($table_objet, $serveur);
509
-
510
-	// Appels incomplets (sans $c)
511
-	if (!is_array($c)) {
512
-		$c = [];
513
-		foreach ($desc['field'] as $champ => $ignore) {
514
-			if (_request($champ)) {
515
-				$c[$champ] = _request($champ);
516
-			}
517
-		}
518
-	}
519
-
520
-	// Securite : certaines variables ne sont jamais acceptees ici
521
-	// car elles ne relevent pas de autoriser(article, modifier) ;
522
-	// il faut passer par instituer_XX()
523
-	// TODO: faut-il passer ces variables interdites
524
-	// dans un fichier de description separe ?
525
-	unset($c['statut']);
526
-	unset($c['id_parent']);
527
-	unset($c['id_rubrique']);
528
-	unset($c['id_secteur']);
529
-
530
-	// Gerer les champs non vides
531
-	if (isset($options['nonvide']) && is_array($options['nonvide'])) {
532
-		foreach ($options['nonvide'] as $champ => $sinon) {
533
-			if ($c[$champ] === '') {
534
-				$c[$champ] = $sinon;
535
-			}
536
-		}
537
-	}
538
-
539
-	// N'accepter que les champs qui existent
540
-	// [TODO] ici aussi on peut valider les contenus en fonction du type
541
-	$champs = [];
542
-	foreach ($desc['field'] as $champ => $ignore) {
543
-		if (isset($c[$champ])) {
544
-			$champs[$champ] = $c[$champ];
545
-		}
546
-	}
547
-
548
-	// Nettoyer les valeurs
549
-	$champs = array_map('corriger_caracteres', $champs);
550
-
551
-	// Envoyer aux plugins
552
-	$champs = pipeline(
553
-		'pre_edition',
554
-		[
555
-			'args' => [
556
-				'table' => $spip_table_objet, // compatibilite
557
-				'table_objet' => $table_objet,
558
-				'spip_table_objet' => $spip_table_objet,
559
-				'type' => $type,
560
-				'id_objet' => $id,
561
-				'champs' => $options['champs'] ?? [], // [doc] c'est quoi ?
562
-				'action' => 'controler',
563
-				'serveur' => $serveur,
564
-			],
565
-			'data' => $champs
566
-		]
567
-	);
568
-
569
-	if (!$champs) {
570
-		return false;
571
-	}
572
-
573
-	// Verifier si les mises a jour sont pertinentes, datees, en conflit etc
574
-	$conflits = controler_md5($champs, $_POST, $type, $id, $serveur, $options['prefix'] ?? 'ctr_');
575
-
576
-	return $conflits;
503
+    include_spip('inc/filtres');
504
+
505
+    $table_objet = table_objet($type);
506
+    $spip_table_objet = table_objet_sql($type);
507
+    $trouver_table = charger_fonction('trouver_table', 'base');
508
+    $desc = $trouver_table($table_objet, $serveur);
509
+
510
+    // Appels incomplets (sans $c)
511
+    if (!is_array($c)) {
512
+        $c = [];
513
+        foreach ($desc['field'] as $champ => $ignore) {
514
+            if (_request($champ)) {
515
+                $c[$champ] = _request($champ);
516
+            }
517
+        }
518
+    }
519
+
520
+    // Securite : certaines variables ne sont jamais acceptees ici
521
+    // car elles ne relevent pas de autoriser(article, modifier) ;
522
+    // il faut passer par instituer_XX()
523
+    // TODO: faut-il passer ces variables interdites
524
+    // dans un fichier de description separe ?
525
+    unset($c['statut']);
526
+    unset($c['id_parent']);
527
+    unset($c['id_rubrique']);
528
+    unset($c['id_secteur']);
529
+
530
+    // Gerer les champs non vides
531
+    if (isset($options['nonvide']) && is_array($options['nonvide'])) {
532
+        foreach ($options['nonvide'] as $champ => $sinon) {
533
+            if ($c[$champ] === '') {
534
+                $c[$champ] = $sinon;
535
+            }
536
+        }
537
+    }
538
+
539
+    // N'accepter que les champs qui existent
540
+    // [TODO] ici aussi on peut valider les contenus en fonction du type
541
+    $champs = [];
542
+    foreach ($desc['field'] as $champ => $ignore) {
543
+        if (isset($c[$champ])) {
544
+            $champs[$champ] = $c[$champ];
545
+        }
546
+    }
547
+
548
+    // Nettoyer les valeurs
549
+    $champs = array_map('corriger_caracteres', $champs);
550
+
551
+    // Envoyer aux plugins
552
+    $champs = pipeline(
553
+        'pre_edition',
554
+        [
555
+            'args' => [
556
+                'table' => $spip_table_objet, // compatibilite
557
+                'table_objet' => $table_objet,
558
+                'spip_table_objet' => $spip_table_objet,
559
+                'type' => $type,
560
+                'id_objet' => $id,
561
+                'champs' => $options['champs'] ?? [], // [doc] c'est quoi ?
562
+                'action' => 'controler',
563
+                'serveur' => $serveur,
564
+            ],
565
+            'data' => $champs
566
+        ]
567
+    );
568
+
569
+    if (!$champs) {
570
+        return false;
571
+    }
572
+
573
+    // Verifier si les mises a jour sont pertinentes, datees, en conflit etc
574
+    $conflits = controler_md5($champs, $_POST, $type, $id, $serveur, $options['prefix'] ?? 'ctr_');
575
+
576
+    return $conflits;
577 577
 }
578 578
 
579 579
 
@@ -603,66 +603,66 @@  discard block
 block discarded – undo
603 603
  *     - post : le contenu posté
604 604
  **/
605 605
 function controler_md5(&$champs, $ctr, $type, $id, $serveur, $prefix = 'ctr_') {
606
-	$spip_table_objet = table_objet_sql($type);
607
-	$id_table_objet = id_table_objet($type);
608
-
609
-	// Controle des MD5 envoyes
610
-	// On elimine les donnees non modifiees par le formulaire (mais
611
-	// potentiellement modifiees entre temps par un autre utilisateur)
612
-	foreach ($champs as $key => $val) {
613
-		if (
614
-			isset($ctr[$prefix . $key])
615
-			&& ($m = $ctr[$prefix . $key])
616
-			&& (is_scalar($val) && $m == md5($val))
617
-		) {
618
-			unset($champs[$key]);
619
-		}
620
-	}
621
-	if (!$champs) {
622
-		return;
623
-	}
624
-
625
-	// On veut savoir si notre modif va avoir un impact
626
-	// par rapport aux donnees contenues dans la base
627
-	// (qui peuvent etre differentes de celles ayant servi a calculer le ctr)
628
-	$s = sql_fetsel(array_keys($champs), $spip_table_objet, "$id_table_objet=$id", $serveur);
629
-	$intact = true;
630
-	foreach ($champs as $ch => $val) {
631
-		$intact &= ($s[$ch] == $val);
632
-	}
633
-	if ($intact) {
634
-		return;
635
-	}
636
-
637
-	// Detection de conflits :
638
-	// On verifie si notre modif ne provient pas d'un formulaire
639
-	// genere a partir de donnees modifiees dans l'intervalle ; ici
640
-	// on compare a ce qui est dans la base, et on bloque en cas
641
-	// de conflit.
642
-	$ctrh = $ctrq = $conflits = [];
643
-	foreach (array_keys($champs) as $key) {
644
-		if (isset($ctr[$prefix . $key]) && ($m = $ctr[$prefix . $key])) {
645
-			$ctrh[$key] = $m;
646
-			$ctrq[] = $key;
647
-		}
648
-	}
649
-	if ($ctrq) {
650
-		$ctrq = sql_fetsel($ctrq, $spip_table_objet, "$id_table_objet=$id", $serveur);
651
-		foreach ($ctrh as $key => $m) {
652
-			if (
653
-				$m != md5((string) $ctrq[$key])
654
-				&& $champs[$key] !== $ctrq[$key]
655
-			) {
656
-				$conflits[$key] = [
657
-					'base' => $ctrq[$key],
658
-					'post' => $champs[$key]
659
-				];
660
-				unset($champs[$key]); # stocker quand meme les modifs ?
661
-			}
662
-		}
663
-	}
664
-
665
-	return $conflits;
606
+    $spip_table_objet = table_objet_sql($type);
607
+    $id_table_objet = id_table_objet($type);
608
+
609
+    // Controle des MD5 envoyes
610
+    // On elimine les donnees non modifiees par le formulaire (mais
611
+    // potentiellement modifiees entre temps par un autre utilisateur)
612
+    foreach ($champs as $key => $val) {
613
+        if (
614
+            isset($ctr[$prefix . $key])
615
+            && ($m = $ctr[$prefix . $key])
616
+            && (is_scalar($val) && $m == md5($val))
617
+        ) {
618
+            unset($champs[$key]);
619
+        }
620
+    }
621
+    if (!$champs) {
622
+        return;
623
+    }
624
+
625
+    // On veut savoir si notre modif va avoir un impact
626
+    // par rapport aux donnees contenues dans la base
627
+    // (qui peuvent etre differentes de celles ayant servi a calculer le ctr)
628
+    $s = sql_fetsel(array_keys($champs), $spip_table_objet, "$id_table_objet=$id", $serveur);
629
+    $intact = true;
630
+    foreach ($champs as $ch => $val) {
631
+        $intact &= ($s[$ch] == $val);
632
+    }
633
+    if ($intact) {
634
+        return;
635
+    }
636
+
637
+    // Detection de conflits :
638
+    // On verifie si notre modif ne provient pas d'un formulaire
639
+    // genere a partir de donnees modifiees dans l'intervalle ; ici
640
+    // on compare a ce qui est dans la base, et on bloque en cas
641
+    // de conflit.
642
+    $ctrh = $ctrq = $conflits = [];
643
+    foreach (array_keys($champs) as $key) {
644
+        if (isset($ctr[$prefix . $key]) && ($m = $ctr[$prefix . $key])) {
645
+            $ctrh[$key] = $m;
646
+            $ctrq[] = $key;
647
+        }
648
+    }
649
+    if ($ctrq) {
650
+        $ctrq = sql_fetsel($ctrq, $spip_table_objet, "$id_table_objet=$id", $serveur);
651
+        foreach ($ctrh as $key => $m) {
652
+            if (
653
+                $m != md5((string) $ctrq[$key])
654
+                && $champs[$key] !== $ctrq[$key]
655
+            ) {
656
+                $conflits[$key] = [
657
+                    'base' => $ctrq[$key],
658
+                    'post' => $champs[$key]
659
+                ];
660
+                unset($champs[$key]); # stocker quand meme les modifs ?
661
+            }
662
+        }
663
+    }
664
+
665
+    return $conflits;
666 666
 }
667 667
 
668 668
 /**
@@ -674,9 +674,9 @@  discard block
 block discarded – undo
674 674
  * @return string
675 675
  */
676 676
 function display_conflit_champ($x) {
677
-	if (strstr($x, "\n") || strlen($x) > 80) {
678
-		return "<textarea style='width:99%; height:10em;'>" . entites_html($x) . "</textarea>\n";
679
-	} else {
680
-		return "<input type='text' size='40' style='width:99%' value=\"" . entites_html($x) . "\" />\n";
681
-	}
677
+    if (strstr($x, "\n") || strlen($x) > 80) {
678
+        return "<textarea style='width:99%; height:10em;'>" . entites_html($x) . "</textarea>\n";
679
+    } else {
680
+        return "<input type='text' size='40' style='width:99%' value=\"" . entites_html($x) . "\" />\n";
681
+    }
682 682
 }
Please login to merge, or discard this patch.
Spacing   +23 added lines, -23 removed lines patch added patch discarded remove patch
@@ -99,7 +99,7 @@  discard block
 block discarded – undo
99 99
 		$res['message_ok'] = _T('info_modification_enregistree');
100 100
 		if ($retour) {
101 101
 			if (str_starts_with($retour, 'javascript:')) {
102
-				$res['message_ok'] .= '<script type="text/javascript">/*<![CDATA[*/' . substr($retour, 11) . '/*]]>*/</script>';
102
+				$res['message_ok'] .= '<script type="text/javascript">/*<![CDATA[*/'.substr($retour, 11).'/*]]>*/</script>';
103 103
 				$res['editable'] = true;
104 104
 			} else {
105 105
 				$res['redirect'] = parametre_url($retour, $id_table_objet, $id);
@@ -139,7 +139,7 @@  discard block
 block discarded – undo
139 139
 				if (!isset($erreurs[$champ])) {
140 140
 					$erreurs[$champ] = '';
141 141
 				}
142
-				$erreurs[$champ] .= _T('alerte_modif_info_concourante') . "<br /><textarea readonly='readonly' class='forml'>" . entites_html($conflit['base']) . '</textarea>';
142
+				$erreurs[$champ] .= _T('alerte_modif_info_concourante')."<br /><textarea readonly='readonly' class='forml'>".entites_html($conflit['base']).'</textarea>';
143 143
 			}
144 144
 		}
145 145
 	}
@@ -219,7 +219,7 @@  discard block
 block discarded – undo
219 219
 	if (
220 220
 		$config_fonc
221 221
 		&& !in_array($config_fonc, ['articles_edit_config', 'rubriques_edit_config', 'auteurs_edit_config'])
222
-		&& $config_fonc !== $table_objet . '_edit_config'
222
+		&& $config_fonc !== $table_objet.'_edit_config'
223 223
 		&& ($args = test_formulaire_inclus_par_modele())
224 224
 		&& in_array($config_fonc, $args)
225 225
 	) {
@@ -231,12 +231,12 @@  discard block
 block discarded – undo
231 231
 	// Appel direct dans un squelette
232 232
 	if (!$row) {
233 233
 		if (!$new || $lier_trad) {
234
-			if ($select = charger_fonction('precharger_' . $type, 'inc', true)) {
234
+			if ($select = charger_fonction('precharger_'.$type, 'inc', true)) {
235 235
 				$row = $select($id, $id_parent, $lier_trad);
236 236
 				// si on a une fonction precharger, elle pu faire un reglage de langue
237 237
 				$lang_default = (empty($row['lang']) ? null : $row['lang']);
238 238
 			} else {
239
-				$row = sql_fetsel('*', $table_objet_sql, $id_table_objet . '=' . (int) $id);
239
+				$row = sql_fetsel('*', $table_objet_sql, $id_table_objet.'='.(int) $id);
240 240
 			}
241 241
 			if (!$new) {
242 242
 				$md5 = controles_md5($row ?: []);
@@ -286,7 +286,7 @@  discard block
 block discarded – undo
286 286
 	if ($config_fonc) {
287 287
 		$contexte['config'] = $config = $config_fonc($contexte);
288 288
 		if (!$lang_default) {
289
-			$lang_default = $config['langue'] ?? session_get('lang') ;
289
+			$lang_default = $config['langue'] ?? session_get('lang');
290 290
 		}
291 291
 	}
292 292
 	$config += [
@@ -308,13 +308,13 @@  discard block
 block discarded – undo
308 308
 		unset($contexte['lang']);
309 309
 	}
310 310
 
311
-	$contexte['_hidden'] = "<input type='hidden' name='editer_$type' value='oui' />\n" .
311
+	$contexte['_hidden'] = "<input type='hidden' name='editer_$type' value='oui' />\n".
312 312
 		($lier_trad
313
-			 ? "\n<input type='hidden' name='lier_trad' value='" .
314
-				$lier_trad .
315
-				"' />" .
316
-				"\n<input type='hidden' name='changer_lang' value='" .
317
-				$lang_default .
313
+			 ? "\n<input type='hidden' name='lier_trad' value='".
314
+				$lier_trad.
315
+				"' />".
316
+				"\n<input type='hidden' name='changer_lang' value='".
317
+				$lang_default.
318 318
 				"' />"
319 319
 			: '')
320 320
 		. $hidden
@@ -355,14 +355,14 @@  discard block
 block discarded – undo
355 355
 	$aider = charger_fonction('aider', 'inc');
356 356
 	if (strlen($texte) > 28 * 1024) {
357 357
 		$texte = str_replace("\r\n", "\n", $texte);
358
-		$pos = strpos($texte, "\n\n", 28 * 1024);  // coupe para > 28 ko
358
+		$pos = strpos($texte, "\n\n", 28 * 1024); // coupe para > 28 ko
359 359
 		if ($pos > 0 && $pos < 32 * 1024) {
360
-			$debut = substr($texte, 0, $pos) . "\n\n<!--SPIP-->\n";
360
+			$debut = substr($texte, 0, $pos)."\n\n<!--SPIP-->\n";
361 361
 			$suite = substr($texte, $pos + 2);
362 362
 		} else {
363
-			$pos = strpos($texte, ' ', 28 * 1024);  // sinon coupe espace
363
+			$pos = strpos($texte, ' ', 28 * 1024); // sinon coupe espace
364 364
 			if (!($pos > 0 && $pos < 32 * 1024)) {
365
-				$pos = 28 * 1024;  // au pire (pas d'espace trouv'e)
365
+				$pos = 28 * 1024; // au pire (pas d'espace trouv'e)
366 366
 				$decalage = 0; // si y'a pas d'espace, il ne faut pas perdre le caract`ere
367 367
 			} else {
368 368
 				$decalage = 1;
@@ -449,7 +449,7 @@  discard block
 block discarded – undo
449 449
 	$ctr = [];
450 450
 	foreach ($data as $key => $val) {
451 451
 		$m = md5($val ?? '');
452
-		$k = $prefixe . $key;
452
+		$k = $prefixe.$key;
453 453
 
454 454
 		$ctr[$k] = match ($format) {
455 455
 			'html' => "<input type='hidden' value='$m' name='$k' />",
@@ -458,7 +458,7 @@  discard block
 block discarded – undo
458 458
 	}
459 459
 
460 460
 	if ($format === 'html') {
461
-		return "\n\n<!-- controles md5 -->\n" . implode("\n", $ctr) . "\n\n";
461
+		return "\n\n<!-- controles md5 -->\n".implode("\n", $ctr)."\n\n";
462 462
 	} else {
463 463
 		return $ctr;
464 464
 	}
@@ -611,8 +611,8 @@  discard block
 block discarded – undo
611 611
 	// potentiellement modifiees entre temps par un autre utilisateur)
612 612
 	foreach ($champs as $key => $val) {
613 613
 		if (
614
-			isset($ctr[$prefix . $key])
615
-			&& ($m = $ctr[$prefix . $key])
614
+			isset($ctr[$prefix.$key])
615
+			&& ($m = $ctr[$prefix.$key])
616 616
 			&& (is_scalar($val) && $m == md5($val))
617 617
 		) {
618 618
 			unset($champs[$key]);
@@ -641,7 +641,7 @@  discard block
 block discarded – undo
641 641
 	// de conflit.
642 642
 	$ctrh = $ctrq = $conflits = [];
643 643
 	foreach (array_keys($champs) as $key) {
644
-		if (isset($ctr[$prefix . $key]) && ($m = $ctr[$prefix . $key])) {
644
+		if (isset($ctr[$prefix.$key]) && ($m = $ctr[$prefix.$key])) {
645 645
 			$ctrh[$key] = $m;
646 646
 			$ctrq[] = $key;
647 647
 		}
@@ -675,8 +675,8 @@  discard block
 block discarded – undo
675 675
  */
676 676
 function display_conflit_champ($x) {
677 677
 	if (strstr($x, "\n") || strlen($x) > 80) {
678
-		return "<textarea style='width:99%; height:10em;'>" . entites_html($x) . "</textarea>\n";
678
+		return "<textarea style='width:99%; height:10em;'>".entites_html($x)."</textarea>\n";
679 679
 	} else {
680
-		return "<input type='text' size='40' style='width:99%' value=\"" . entites_html($x) . "\" />\n";
680
+		return "<input type='text' size='40' style='width:99%' value=\"".entites_html($x)."\" />\n";
681 681
 	}
682 682
 }
Please login to merge, or discard this patch.