Completed
Push — master ( 81a660...8ce9c8 )
by cam
01:32
created
ecrire/inc/envoyer_mail.php 1 patch
Indentation   +151 added lines, -151 removed lines patch added patch discarded remove patch
@@ -16,7 +16,7 @@  discard block
 block discarded – undo
16 16
  * @package SPIP\Core\Mail
17 17
  **/
18 18
 if (!defined('_ECRIRE_INC_VERSION')) {
19
-	return;
19
+    return;
20 20
 }
21 21
 
22 22
 include_spip('inc/charsets');
@@ -32,7 +32,7 @@  discard block
 block discarded – undo
32 32
  * @return string
33 33
  */
34 34
 function nettoyer_titre_email($titre) {
35
-	return str_replace("\n", ' ', nettoyer_caracteres_mail(textebrut(corriger_typo($titre))));
35
+    return str_replace("\n", ' ', nettoyer_caracteres_mail(textebrut(corriger_typo($titre))));
36 36
 }
37 37
 
38 38
 /**
@@ -48,23 +48,23 @@  discard block
 block discarded – undo
48 48
  */
49 49
 function nettoyer_caracteres_mail($t) {
50 50
 
51
-	$t = filtrer_entites($t);
51
+    $t = filtrer_entites($t);
52 52
 
53
-	if ($GLOBALS['meta']['charset'] <> 'utf-8') {
54
-		$t = str_replace(
55
-			['&#8217;', '&#8220;', '&#8221;'],
56
-			["'", '"', '"'],
57
-			$t
58
-		);
59
-	}
53
+    if ($GLOBALS['meta']['charset'] <> 'utf-8') {
54
+        $t = str_replace(
55
+            ['&#8217;', '&#8220;', '&#8221;'],
56
+            ["'", '"', '"'],
57
+            $t
58
+        );
59
+    }
60 60
 
61
-	$t = str_replace(
62
-		['&mdash;', '&endash;'],
63
-		['--', '-'],
64
-		$t
65
-	);
61
+    $t = str_replace(
62
+        ['&mdash;', '&endash;'],
63
+        ['--', '-'],
64
+        $t
65
+    );
66 66
 
67
-	return $t;
67
+    return $t;
68 68
 }
69 69
 
70 70
 /**
@@ -97,87 +97,87 @@  discard block
 block discarded – undo
97 97
  */
98 98
 function inc_envoyer_mail_dist($destinataire, $sujet, $corps, $from = '', $headers = '') {
99 99
 
100
-	if (!email_valide($destinataire)) {
101
-		return false;
102
-	}
103
-	if ($destinataire == _T('info_mail_fournisseur')) {
104
-		return false;
105
-	} // tres fort
106
-
107
-	// Fournir si possible un Message-Id: conforme au RFC1036,
108
-	// sinon SpamAssassin denoncera un MSGID_FROM_MTA_HEADER
109
-
110
-	$email_envoi = $GLOBALS['meta']['email_envoi'];
111
-	if (!email_valide($email_envoi)) {
112
-		spip_log('Meta email_envoi invalide. Le mail sera probablement vu comme spam.');
113
-		$email_envoi = $destinataire;
114
-	}
115
-
116
-	$parts = '';
117
-	if (is_array($corps)) {
118
-		$texte = $corps['texte'];
119
-		$from = ($corps['from'] ?? $from);
120
-		$headers = ($corps['headers'] ?? $headers);
121
-		if (is_array($headers)) {
122
-			$headers = implode("\n", $headers);
123
-		}
124
-		if (isset($corps['pieces_jointes']) and function_exists('mail_embarquer_pieces_jointes')) {
125
-			$parts = mail_embarquer_pieces_jointes($corps['pieces_jointes']);
126
-		}
127
-	} else {
128
-		$texte = $corps;
129
-	}
130
-
131
-	if (!$from) {
132
-		$from = $email_envoi;
133
-	}
134
-
135
-	// ceci est la RegExp NO_REAL_NAME faisant hurler SpamAssassin
136
-	if (preg_match('/^["\s]*\<?\S+\@\S+\>?\s*$/', $from)) {
137
-		$from .= ' (' . str_replace(')', '', translitteration(str_replace('@', ' at ', $from))) . ')';
138
-	}
139
-
140
-	// nettoyer les &eacute; &#8217, &emdash; etc...
141
-	// les 'cliquer ici' etc sont a eviter;  voir:
142
-	// http://mta.org.ua/spamassassin-2.55/stuff/wiki.CustomRulesets/20050914/rules/french_rules.cf
143
-	$texte = nettoyer_caracteres_mail($texte);
144
-	$sujet = nettoyer_caracteres_mail($sujet);
145
-
146
-	// encoder le sujet si possible selon la RFC
147
-	if (init_mb_string()) {
148
-		# un bug de mb_string casse mb_encode_mimeheader si l'encoding interne
149
-		# est UTF-8 et le charset iso-8859-1 (constate php5-mac ; php4.3-debian)
150
-		$charset = $GLOBALS['meta']['charset'];
151
-		mb_internal_encoding($charset);
152
-		$sujet = mb_encode_mimeheader($sujet, $charset, 'Q', "\n");
153
-		mb_internal_encoding('utf-8');
154
-	}
155
-
156
-	$headers = $headers ?? '';
157
-	if (function_exists('wordwrap') && (preg_match(',multipart/mixed,', $headers) == 0)) {
158
-		$texte = wordwrap($texte);
159
-	}
160
-
161
-	[$headers, $texte] = mail_normaliser_headers($headers, $from, $destinataire, $texte, $parts);
162
-
163
-	if (_OS_SERVEUR == 'windows') {
164
-		$texte = preg_replace("@\r*\n@", "\r\n", $texte);
165
-		$headers = preg_replace("@\r*\n@", "\r\n", $headers);
166
-		$sujet = preg_replace("@\r*\n@", "\r\n", $sujet);
167
-	}
168
-
169
-	spip_log("mail $destinataire\n$sujet\n$headers", 'mails');
170
-	// mode TEST : forcer l'email
171
-	if (defined('_TEST_EMAIL_DEST')) {
172
-		if (!_TEST_EMAIL_DEST) {
173
-			return false;
174
-		} else {
175
-			$texte = "Dest : $destinataire\r\n" . $texte;
176
-			$destinataire = _TEST_EMAIL_DEST;
177
-		}
178
-	}
179
-
180
-	return @mail($destinataire, $sujet, $texte, $headers);
100
+    if (!email_valide($destinataire)) {
101
+        return false;
102
+    }
103
+    if ($destinataire == _T('info_mail_fournisseur')) {
104
+        return false;
105
+    } // tres fort
106
+
107
+    // Fournir si possible un Message-Id: conforme au RFC1036,
108
+    // sinon SpamAssassin denoncera un MSGID_FROM_MTA_HEADER
109
+
110
+    $email_envoi = $GLOBALS['meta']['email_envoi'];
111
+    if (!email_valide($email_envoi)) {
112
+        spip_log('Meta email_envoi invalide. Le mail sera probablement vu comme spam.');
113
+        $email_envoi = $destinataire;
114
+    }
115
+
116
+    $parts = '';
117
+    if (is_array($corps)) {
118
+        $texte = $corps['texte'];
119
+        $from = ($corps['from'] ?? $from);
120
+        $headers = ($corps['headers'] ?? $headers);
121
+        if (is_array($headers)) {
122
+            $headers = implode("\n", $headers);
123
+        }
124
+        if (isset($corps['pieces_jointes']) and function_exists('mail_embarquer_pieces_jointes')) {
125
+            $parts = mail_embarquer_pieces_jointes($corps['pieces_jointes']);
126
+        }
127
+    } else {
128
+        $texte = $corps;
129
+    }
130
+
131
+    if (!$from) {
132
+        $from = $email_envoi;
133
+    }
134
+
135
+    // ceci est la RegExp NO_REAL_NAME faisant hurler SpamAssassin
136
+    if (preg_match('/^["\s]*\<?\S+\@\S+\>?\s*$/', $from)) {
137
+        $from .= ' (' . str_replace(')', '', translitteration(str_replace('@', ' at ', $from))) . ')';
138
+    }
139
+
140
+    // nettoyer les &eacute; &#8217, &emdash; etc...
141
+    // les 'cliquer ici' etc sont a eviter;  voir:
142
+    // http://mta.org.ua/spamassassin-2.55/stuff/wiki.CustomRulesets/20050914/rules/french_rules.cf
143
+    $texte = nettoyer_caracteres_mail($texte);
144
+    $sujet = nettoyer_caracteres_mail($sujet);
145
+
146
+    // encoder le sujet si possible selon la RFC
147
+    if (init_mb_string()) {
148
+        # un bug de mb_string casse mb_encode_mimeheader si l'encoding interne
149
+        # est UTF-8 et le charset iso-8859-1 (constate php5-mac ; php4.3-debian)
150
+        $charset = $GLOBALS['meta']['charset'];
151
+        mb_internal_encoding($charset);
152
+        $sujet = mb_encode_mimeheader($sujet, $charset, 'Q', "\n");
153
+        mb_internal_encoding('utf-8');
154
+    }
155
+
156
+    $headers = $headers ?? '';
157
+    if (function_exists('wordwrap') && (preg_match(',multipart/mixed,', $headers) == 0)) {
158
+        $texte = wordwrap($texte);
159
+    }
160
+
161
+    [$headers, $texte] = mail_normaliser_headers($headers, $from, $destinataire, $texte, $parts);
162
+
163
+    if (_OS_SERVEUR == 'windows') {
164
+        $texte = preg_replace("@\r*\n@", "\r\n", $texte);
165
+        $headers = preg_replace("@\r*\n@", "\r\n", $headers);
166
+        $sujet = preg_replace("@\r*\n@", "\r\n", $sujet);
167
+    }
168
+
169
+    spip_log("mail $destinataire\n$sujet\n$headers", 'mails');
170
+    // mode TEST : forcer l'email
171
+    if (defined('_TEST_EMAIL_DEST')) {
172
+        if (!_TEST_EMAIL_DEST) {
173
+            return false;
174
+        } else {
175
+            $texte = "Dest : $destinataire\r\n" . $texte;
176
+            $destinataire = _TEST_EMAIL_DEST;
177
+        }
178
+    }
179
+
180
+    return @mail($destinataire, $sujet, $texte, $headers);
181 181
 }
182 182
 
183 183
 /**
@@ -191,58 +191,58 @@  discard block
 block discarded – undo
191 191
  * @return array
192 192
  */
193 193
 function mail_normaliser_headers($headers, $from, $to, $texte, $parts = '') {
194
-	$charset = $GLOBALS['meta']['charset'];
195
-
196
-	// Ajouter le Content-Type et consort s'il n'y est pas deja
197
-	if (strpos($headers, 'Content-Type: ') === false) {
198
-		$type =
199
-			"Content-Type: text/plain;charset=\"$charset\";\n" .
200
-			"Content-Transfer-Encoding: 8bit\n";
201
-	} else {
202
-		$type = '';
203
-	}
204
-
205
-	// calculer un identifiant unique
206
-	// Marie Toto <[email protected]> => @toto.com
207
-	if (preg_match('/@[^\s>]+/', $from, $domain)) {
208
-		$domain = $domain[0];
209
-	}
210
-	else {
211
-		$domain = '@unknown-' . md5($from) . '.org';
212
-	}
213
-	$uniq = random_int(0, mt_getrandmax()) . '_' . md5($to . $texte) . $domain;
214
-
215
-	// Si multi-part, s'en servir comme borne ...
216
-	if ($parts) {
217
-		$texte = "--$uniq\n$type\n" . $texte . "\n";
218
-		foreach ($parts as $part) {
219
-			$n = strlen($part[1]) . ($part[0] ? "\n" : '');
220
-			$e = join("\n", $part[0]);
221
-			$texte .= "\n--$uniq\nContent-Length: $n$e\n\n" . $part[1];
222
-		}
223
-		$texte .= "\n\n--$uniq--\n";
224
-		// Si boundary n'est pas entre guillemets,
225
-		// elle est comprise mais le charset est ignoree !
226
-		$type = "Content-Type: multipart/mixed; boundary=\"$uniq\"\n";
227
-	}
228
-
229
-	// .. et s'en servir pour plaire a SpamAssassin
230
-
231
-	$mid = 'Message-Id: <' . $uniq . '>';
232
-
233
-	// indispensable pour les sites qui collent d'office From: serveur-http
234
-	// sauf si deja mis par l'envoyeur
235
-	$rep = (strpos($headers, 'Reply-To:') !== false) ? '' : "Reply-To: $from\n";
236
-
237
-	// Nettoyer les en-tetes envoyees
238
-	// Ajouter le \n final
239
-	if (strlen($headers = trim($headers))) {
240
-		$headers .= "\n";
241
-	}
242
-
243
-	// Et mentionner l'indeboulonable nomenclature ratee
244
-
245
-	$headers .= "From: $from\n$type$rep$mid\nMIME-Version: 1.0\n";
246
-
247
-	return [$headers, $texte];
194
+    $charset = $GLOBALS['meta']['charset'];
195
+
196
+    // Ajouter le Content-Type et consort s'il n'y est pas deja
197
+    if (strpos($headers, 'Content-Type: ') === false) {
198
+        $type =
199
+            "Content-Type: text/plain;charset=\"$charset\";\n" .
200
+            "Content-Transfer-Encoding: 8bit\n";
201
+    } else {
202
+        $type = '';
203
+    }
204
+
205
+    // calculer un identifiant unique
206
+    // Marie Toto <[email protected]> => @toto.com
207
+    if (preg_match('/@[^\s>]+/', $from, $domain)) {
208
+        $domain = $domain[0];
209
+    }
210
+    else {
211
+        $domain = '@unknown-' . md5($from) . '.org';
212
+    }
213
+    $uniq = random_int(0, mt_getrandmax()) . '_' . md5($to . $texte) . $domain;
214
+
215
+    // Si multi-part, s'en servir comme borne ...
216
+    if ($parts) {
217
+        $texte = "--$uniq\n$type\n" . $texte . "\n";
218
+        foreach ($parts as $part) {
219
+            $n = strlen($part[1]) . ($part[0] ? "\n" : '');
220
+            $e = join("\n", $part[0]);
221
+            $texte .= "\n--$uniq\nContent-Length: $n$e\n\n" . $part[1];
222
+        }
223
+        $texte .= "\n\n--$uniq--\n";
224
+        // Si boundary n'est pas entre guillemets,
225
+        // elle est comprise mais le charset est ignoree !
226
+        $type = "Content-Type: multipart/mixed; boundary=\"$uniq\"\n";
227
+    }
228
+
229
+    // .. et s'en servir pour plaire a SpamAssassin
230
+
231
+    $mid = 'Message-Id: <' . $uniq . '>';
232
+
233
+    // indispensable pour les sites qui collent d'office From: serveur-http
234
+    // sauf si deja mis par l'envoyeur
235
+    $rep = (strpos($headers, 'Reply-To:') !== false) ? '' : "Reply-To: $from\n";
236
+
237
+    // Nettoyer les en-tetes envoyees
238
+    // Ajouter le \n final
239
+    if (strlen($headers = trim($headers))) {
240
+        $headers .= "\n";
241
+    }
242
+
243
+    // Et mentionner l'indeboulonable nomenclature ratee
244
+
245
+    $headers .= "From: $from\n$type$rep$mid\nMIME-Version: 1.0\n";
246
+
247
+    return [$headers, $texte];
248 248
 }
Please login to merge, or discard this patch.
ecrire/inc/editer.php 1 patch
Indentation   +442 added lines, -442 removed lines patch added patch discarded remove patch
@@ -17,7 +17,7 @@  discard block
 block discarded – undo
17 17
  **/
18 18
 
19 19
 if (!defined('_ECRIRE_INC_VERSION')) {
20
-	return;
20
+    return;
21 21
 }
22 22
 include_spip('base/abstract_sql');
23 23
 
@@ -59,56 +59,56 @@  discard block
 block discarded – undo
59 59
  *     Retour des traitements.
60 60
  **/
61 61
 function formulaires_editer_objet_traiter(
62
-	$type,
63
-	$id = 'new',
64
-	$id_parent = 0,
65
-	$lier_trad = 0,
66
-	$retour = '',
67
-	$config_fonc = 'articles_edit_config',
68
-	$row = [],
69
-	$hidden = ''
62
+    $type,
63
+    $id = 'new',
64
+    $id_parent = 0,
65
+    $lier_trad = 0,
66
+    $retour = '',
67
+    $config_fonc = 'articles_edit_config',
68
+    $row = [],
69
+    $hidden = ''
70 70
 ) {
71 71
 
72
-	$res = [];
73
-	// eviter la redirection forcee par l'action...
74
-	set_request('redirect');
75
-	if ($action_editer = charger_fonction("editer_$type", 'action', true)) {
76
-		[$id, $err] = $action_editer($id);
77
-	} else {
78
-		$action_editer = charger_fonction('editer_objet', 'action');
79
-		[$id, $err] = $action_editer($id, $type);
80
-	}
81
-	$id_table_objet = id_table_objet($type);
82
-	$res[$id_table_objet] = $id;
83
-	if ($err or !$id) {
84
-		$res['message_erreur'] = ($err ?: _T('erreur'));
85
-	} else {
86
-		// Un lien de trad a prendre en compte
87
-		if ($lier_trad) {
88
-			// referencer la traduction
89
-			$referencer_traduction = charger_fonction('referencer_traduction', 'action');
90
-			$referencer_traduction($type, $id, $lier_trad);
91
-			// actions de recopie de champs / liens sur le nouvel objet créé
92
-			$completer_traduction = charger_fonction('completer_traduction', 'inc');
93
-			$err = $completer_traduction($type, $id, $lier_trad);
94
-			if ($err) {
95
-				$res['message_erreur'] = $err;
96
-				return $res;
97
-			}
98
-		}
99
-
100
-		$res['message_ok'] = _T('info_modification_enregistree');
101
-		if ($retour) {
102
-			if (strncmp($retour, 'javascript:', 11) == 0) {
103
-				$res['message_ok'] .= '<script type="text/javascript">/*<![CDATA[*/' . substr($retour, 11) . '/*]]>*/</script>';
104
-				$res['editable'] = true;
105
-			} else {
106
-				$res['redirect'] = parametre_url($retour, $id_table_objet, $id);
107
-			}
108
-		}
109
-	}
110
-
111
-	return $res;
72
+    $res = [];
73
+    // eviter la redirection forcee par l'action...
74
+    set_request('redirect');
75
+    if ($action_editer = charger_fonction("editer_$type", 'action', true)) {
76
+        [$id, $err] = $action_editer($id);
77
+    } else {
78
+        $action_editer = charger_fonction('editer_objet', 'action');
79
+        [$id, $err] = $action_editer($id, $type);
80
+    }
81
+    $id_table_objet = id_table_objet($type);
82
+    $res[$id_table_objet] = $id;
83
+    if ($err or !$id) {
84
+        $res['message_erreur'] = ($err ?: _T('erreur'));
85
+    } else {
86
+        // Un lien de trad a prendre en compte
87
+        if ($lier_trad) {
88
+            // referencer la traduction
89
+            $referencer_traduction = charger_fonction('referencer_traduction', 'action');
90
+            $referencer_traduction($type, $id, $lier_trad);
91
+            // actions de recopie de champs / liens sur le nouvel objet créé
92
+            $completer_traduction = charger_fonction('completer_traduction', 'inc');
93
+            $err = $completer_traduction($type, $id, $lier_trad);
94
+            if ($err) {
95
+                $res['message_erreur'] = $err;
96
+                return $res;
97
+            }
98
+        }
99
+
100
+        $res['message_ok'] = _T('info_modification_enregistree');
101
+        if ($retour) {
102
+            if (strncmp($retour, 'javascript:', 11) == 0) {
103
+                $res['message_ok'] .= '<script type="text/javascript">/*<![CDATA[*/' . substr($retour, 11) . '/*]]>*/</script>';
104
+                $res['editable'] = true;
105
+            } else {
106
+                $res['redirect'] = parametre_url($retour, $id_table_objet, $id);
107
+            }
108
+        }
109
+    }
110
+
111
+    return $res;
112 112
 }
113 113
 
114 114
 /**
@@ -132,29 +132,29 @@  discard block
 block discarded – undo
132 132
  *     Tableau des erreurs
133 133
  **/
134 134
 function formulaires_editer_objet_verifier($type, $id = 'new', $oblis = []) {
135
-	$erreurs = [];
136
-	if (intval($id)) {
137
-		$conflits = controler_contenu($type, $id);
138
-		if ($conflits and is_countable($conflits) ? count($conflits) : 0) {
139
-			foreach ($conflits as $champ => $conflit) {
140
-				if (!isset($erreurs[$champ])) {
141
-					$erreurs[$champ] = '';
142
-				}
143
-				$erreurs[$champ] .= _T('alerte_modif_info_concourante') . "<br /><textarea readonly='readonly' class='forml'>" . entites_html($conflit['base']) . '</textarea>';
144
-			}
145
-		}
146
-	}
147
-	foreach ($oblis as $obli) {
148
-		$value = _request($obli);
149
-		if (is_null($value) or !(is_array($value) ? count($value) : strlen($value))) {
150
-			if (!isset($erreurs[$obli])) {
151
-				$erreurs[$obli] = '';
152
-			}
153
-			$erreurs[$obli] .= _T('info_obligatoire');
154
-		}
155
-	}
156
-
157
-	return $erreurs;
135
+    $erreurs = [];
136
+    if (intval($id)) {
137
+        $conflits = controler_contenu($type, $id);
138
+        if ($conflits and is_countable($conflits) ? count($conflits) : 0) {
139
+            foreach ($conflits as $champ => $conflit) {
140
+                if (!isset($erreurs[$champ])) {
141
+                    $erreurs[$champ] = '';
142
+                }
143
+                $erreurs[$champ] .= _T('alerte_modif_info_concourante') . "<br /><textarea readonly='readonly' class='forml'>" . entites_html($conflit['base']) . '</textarea>';
144
+            }
145
+        }
146
+    }
147
+    foreach ($oblis as $obli) {
148
+        $value = _request($obli);
149
+        if (is_null($value) or !(is_array($value) ? count($value) : strlen($value))) {
150
+            if (!isset($erreurs[$obli])) {
151
+                $erreurs[$obli] = '';
152
+            }
153
+            $erreurs[$obli] .= _T('info_obligatoire');
154
+        }
155
+    }
156
+
157
+    return $erreurs;
158 158
 }
159 159
 
160 160
 /**
@@ -199,154 +199,154 @@  discard block
 block discarded – undo
199 199
  *     Environnement du formulaire.
200 200
  **/
201 201
 function formulaires_editer_objet_charger(
202
-	$type,
203
-	$id = 'new',
204
-	$id_parent = 0,
205
-	$lier_trad = 0,
206
-	$retour = '',
207
-	$config_fonc = 'articles_edit_config',
208
-	$row = [],
209
-	$hidden = ''
202
+    $type,
203
+    $id = 'new',
204
+    $id_parent = 0,
205
+    $lier_trad = 0,
206
+    $retour = '',
207
+    $config_fonc = 'articles_edit_config',
208
+    $row = [],
209
+    $hidden = ''
210 210
 ) {
211 211
 
212
-	$table_objet = table_objet($type);
213
-	$table_objet_sql = table_objet_sql($type);
214
-	$id_table_objet = id_table_objet($type);
215
-	if (!is_array($row)) {
216
-		$row = [];
217
-	}
218
-
219
-	// on accepte pas une fonction de config inconnue si elle vient d'un modele
220
-	if (
221
-		$config_fonc
222
-		and !in_array($config_fonc, ['articles_edit_config', 'rubriques_edit_config', 'auteurs_edit_config'])
223
-		and $config_fonc !== $table_objet . '_edit_config'
224
-	) {
225
-		if (
226
-			$args = test_formulaire_inclus_par_modele()
227
-			and in_array($config_fonc, $args)
228
-		) {
229
-			$config_fonc = '';
230
-		}
231
-	}
232
-
233
-	$new = !is_numeric($id);
234
-	$lang_default = '';
235
-	// Appel direct dans un squelette
236
-	if (!$row) {
237
-		if (!$new or $lier_trad) {
238
-			if ($select = charger_fonction('precharger_' . $type, 'inc', true)) {
239
-				$row = $select($id, $id_parent, $lier_trad);
240
-				// si on a une fonction precharger, elle pu faire un reglage de langue
241
-				$lang_default = (!empty($row['lang']) ? $row['lang'] : null);
242
-			} else {
243
-				$row = sql_fetsel('*', $table_objet_sql, $id_table_objet . '=' . intval($id));
244
-			}
245
-			if (!$new) {
246
-				$md5 = controles_md5($row ?: []);
247
-			}
248
-		}
249
-		if (!$row) {
250
-			$row = [];
251
-			$trouver_table = charger_fonction('trouver_table', 'base');
252
-			if ($desc = $trouver_table($table_objet)) {
253
-				foreach ($desc['field'] as $k => $v) {
254
-					$row[$k] = '';
255
-				}
256
-			}
257
-		}
258
-	}
259
-
260
-	// Gaffe: sans ceci, on ecrase systematiquement l'article d'origine
261
-	// (et donc: pas de lien de traduction)
262
-	$id = ($new or $lier_trad)
263
-		? 'oui'
264
-		: $row[$id_table_objet];
265
-	$row[$id_table_objet] = $id;
266
-
267
-	$contexte = $row;
268
-	if (is_numeric($id_parent) && strlen($id_parent) && (!isset($contexte['id_parent']) or $new)) {
269
-		if (!isset($contexte['id_parent'])) {
270
-			unset($contexte['id_rubrique']);
271
-		}
272
-		$contexte['id_parent'] = $id_parent;
273
-	} elseif (!isset($contexte['id_parent'])) {
274
-		// id_rubrique dans id_parent si possible
275
-		if (isset($contexte['id_rubrique'])) {
276
-			$contexte['id_parent'] = $contexte['id_rubrique'];
277
-			unset($contexte['id_rubrique']);
278
-		} else {
279
-			$contexte['id_parent'] = '';
280
-		}
281
-		if (
282
-			!$contexte['id_parent']
283
-			and $preselectionner_parent_nouvel_objet = charger_fonction('preselectionner_parent_nouvel_objet', 'inc', true)
284
-		) {
285
-			$contexte['id_parent'] = $preselectionner_parent_nouvel_objet($type, $row);
286
-		}
287
-	}
288
-
289
-	$config = [];
290
-	if ($config_fonc) {
291
-		$contexte['config'] = $config = $config_fonc($contexte);
292
-		if (!$lang_default) {
293
-			$lang_default = $config['langue'] ?? session_get('lang') ;
294
-		}
295
-	}
296
-	$config = $config + [
297
-		'lignes' => 0,
298
-		'langue' => '',
299
-	];
300
-
301
-	$att_text = " class='textarea' "
302
-		. " rows='"
303
-		. ($config['lignes'] + 15)
304
-		. "' cols='40'";
305
-	if (isset($contexte['texte'])) {
306
-		[$contexte['texte'], $contexte['_texte_trop_long']] = editer_texte_recolle($contexte['texte'], $att_text);
307
-	}
308
-
309
-	// on veut conserver la langue de l'interface ;
310
-	// on passe cette donnee sous un autre nom, au cas ou le squelette
311
-	// voudrait l'exploiter
312
-	if (isset($contexte['lang'])) {
313
-		$contexte['langue'] = $contexte['lang'];
314
-		unset($contexte['lang']);
315
-	}
316
-
317
-	$contexte['_hidden'] = "<input type='hidden' name='editer_$type' value='oui' />\n" .
318
-		(!$lier_trad ? '' :
319
-			("\n<input type='hidden' name='lier_trad' value='" .
320
-				$lier_trad .
321
-				"' />" .
322
-				"\n<input type='hidden' name='changer_lang' value='" .
323
-				$lang_default .
324
-				"' />"))
325
-		. $hidden
326
-		. ($md5 ?? '');
327
-
328
-	// preciser que le formulaire doit passer dans un pipeline
329
-	$contexte['_pipeline'] = ['editer_contenu_objet', ['type' => $type, 'id' => $id]];
330
-
331
-	// preciser que le formulaire doit etre securise auteur/action
332
-	// n'est plus utile lorsque l'action accepte l'id en argument direct
333
-	// on le garde pour compat
334
-	$contexte['_action'] = ["editer_$type", $id];
335
-
336
-	// et in fine placer l'autorisation
337
-	include_spip('inc/autoriser');
338
-	if (intval($id)) {
339
-		if (!autoriser('modifier', $type, intval($id))) {
340
-			$contexte['editable'] = '';
341
-		}
342
-	}
343
-	else {
344
-		if (!autoriser('creer', $type, 0, null, ['id_parent' => $id_parent])) {
345
-			$contexte['editable'] = '';
346
-		}
347
-	}
348
-
349
-	return $contexte;
212
+    $table_objet = table_objet($type);
213
+    $table_objet_sql = table_objet_sql($type);
214
+    $id_table_objet = id_table_objet($type);
215
+    if (!is_array($row)) {
216
+        $row = [];
217
+    }
218
+
219
+    // on accepte pas une fonction de config inconnue si elle vient d'un modele
220
+    if (
221
+        $config_fonc
222
+        and !in_array($config_fonc, ['articles_edit_config', 'rubriques_edit_config', 'auteurs_edit_config'])
223
+        and $config_fonc !== $table_objet . '_edit_config'
224
+    ) {
225
+        if (
226
+            $args = test_formulaire_inclus_par_modele()
227
+            and in_array($config_fonc, $args)
228
+        ) {
229
+            $config_fonc = '';
230
+        }
231
+    }
232
+
233
+    $new = !is_numeric($id);
234
+    $lang_default = '';
235
+    // Appel direct dans un squelette
236
+    if (!$row) {
237
+        if (!$new or $lier_trad) {
238
+            if ($select = charger_fonction('precharger_' . $type, 'inc', true)) {
239
+                $row = $select($id, $id_parent, $lier_trad);
240
+                // si on a une fonction precharger, elle pu faire un reglage de langue
241
+                $lang_default = (!empty($row['lang']) ? $row['lang'] : null);
242
+            } else {
243
+                $row = sql_fetsel('*', $table_objet_sql, $id_table_objet . '=' . intval($id));
244
+            }
245
+            if (!$new) {
246
+                $md5 = controles_md5($row ?: []);
247
+            }
248
+        }
249
+        if (!$row) {
250
+            $row = [];
251
+            $trouver_table = charger_fonction('trouver_table', 'base');
252
+            if ($desc = $trouver_table($table_objet)) {
253
+                foreach ($desc['field'] as $k => $v) {
254
+                    $row[$k] = '';
255
+                }
256
+            }
257
+        }
258
+    }
259
+
260
+    // Gaffe: sans ceci, on ecrase systematiquement l'article d'origine
261
+    // (et donc: pas de lien de traduction)
262
+    $id = ($new or $lier_trad)
263
+        ? 'oui'
264
+        : $row[$id_table_objet];
265
+    $row[$id_table_objet] = $id;
266
+
267
+    $contexte = $row;
268
+    if (is_numeric($id_parent) && strlen($id_parent) && (!isset($contexte['id_parent']) or $new)) {
269
+        if (!isset($contexte['id_parent'])) {
270
+            unset($contexte['id_rubrique']);
271
+        }
272
+        $contexte['id_parent'] = $id_parent;
273
+    } elseif (!isset($contexte['id_parent'])) {
274
+        // id_rubrique dans id_parent si possible
275
+        if (isset($contexte['id_rubrique'])) {
276
+            $contexte['id_parent'] = $contexte['id_rubrique'];
277
+            unset($contexte['id_rubrique']);
278
+        } else {
279
+            $contexte['id_parent'] = '';
280
+        }
281
+        if (
282
+            !$contexte['id_parent']
283
+            and $preselectionner_parent_nouvel_objet = charger_fonction('preselectionner_parent_nouvel_objet', 'inc', true)
284
+        ) {
285
+            $contexte['id_parent'] = $preselectionner_parent_nouvel_objet($type, $row);
286
+        }
287
+    }
288
+
289
+    $config = [];
290
+    if ($config_fonc) {
291
+        $contexte['config'] = $config = $config_fonc($contexte);
292
+        if (!$lang_default) {
293
+            $lang_default = $config['langue'] ?? session_get('lang') ;
294
+        }
295
+    }
296
+    $config = $config + [
297
+        'lignes' => 0,
298
+        'langue' => '',
299
+    ];
300
+
301
+    $att_text = " class='textarea' "
302
+        . " rows='"
303
+        . ($config['lignes'] + 15)
304
+        . "' cols='40'";
305
+    if (isset($contexte['texte'])) {
306
+        [$contexte['texte'], $contexte['_texte_trop_long']] = editer_texte_recolle($contexte['texte'], $att_text);
307
+    }
308
+
309
+    // on veut conserver la langue de l'interface ;
310
+    // on passe cette donnee sous un autre nom, au cas ou le squelette
311
+    // voudrait l'exploiter
312
+    if (isset($contexte['lang'])) {
313
+        $contexte['langue'] = $contexte['lang'];
314
+        unset($contexte['lang']);
315
+    }
316
+
317
+    $contexte['_hidden'] = "<input type='hidden' name='editer_$type' value='oui' />\n" .
318
+        (!$lier_trad ? '' :
319
+            ("\n<input type='hidden' name='lier_trad' value='" .
320
+                $lier_trad .
321
+                "' />" .
322
+                "\n<input type='hidden' name='changer_lang' value='" .
323
+                $lang_default .
324
+                "' />"))
325
+        . $hidden
326
+        . ($md5 ?? '');
327
+
328
+    // preciser que le formulaire doit passer dans un pipeline
329
+    $contexte['_pipeline'] = ['editer_contenu_objet', ['type' => $type, 'id' => $id]];
330
+
331
+    // preciser que le formulaire doit etre securise auteur/action
332
+    // n'est plus utile lorsque l'action accepte l'id en argument direct
333
+    // on le garde pour compat
334
+    $contexte['_action'] = ["editer_$type", $id];
335
+
336
+    // et in fine placer l'autorisation
337
+    include_spip('inc/autoriser');
338
+    if (intval($id)) {
339
+        if (!autoriser('modifier', $type, intval($id))) {
340
+            $contexte['editable'] = '';
341
+        }
342
+    }
343
+    else {
344
+        if (!autoriser('creer', $type, 0, null, ['id_parent' => $id_parent])) {
345
+            $contexte['editable'] = '';
346
+        }
347
+    }
348
+
349
+    return $contexte;
350 350
 }
351 351
 
352 352
 /**
@@ -357,29 +357,29 @@  discard block
 block discarded – undo
357 357
  * @return array
358 358
  */
359 359
 function coupe_trop_long($texte) {
360
-	$aider = charger_fonction('aider', 'inc');
361
-	if (strlen($texte) > 28 * 1024) {
362
-		$texte = str_replace("\r\n", "\n", $texte);
363
-		$pos = strpos($texte, "\n\n", 28 * 1024);  // coupe para > 28 ko
364
-		if ($pos > 0 and $pos < 32 * 1024) {
365
-			$debut = substr($texte, 0, $pos) . "\n\n<!--SPIP-->\n";
366
-			$suite = substr($texte, $pos + 2);
367
-		} else {
368
-			$pos = strpos($texte, ' ', 28 * 1024);  // sinon coupe espace
369
-			if (!($pos > 0 and $pos < 32 * 1024)) {
370
-				$pos = 28 * 1024;  // au pire (pas d'espace trouv'e)
371
-				$decalage = 0; // si y'a pas d'espace, il ne faut pas perdre le caract`ere
372
-			} else {
373
-				$decalage = 1;
374
-			}
375
-			$debut = substr($texte, 0, $pos + $decalage); // Il faut conserver l'espace s'il y en a un
376
-			$suite = substr($texte, $pos + $decalage);
377
-		}
378
-
379
-		return ([$debut, $suite]);
380
-	} else {
381
-		return ([$texte, '']);
382
-	}
360
+    $aider = charger_fonction('aider', 'inc');
361
+    if (strlen($texte) > 28 * 1024) {
362
+        $texte = str_replace("\r\n", "\n", $texte);
363
+        $pos = strpos($texte, "\n\n", 28 * 1024);  // coupe para > 28 ko
364
+        if ($pos > 0 and $pos < 32 * 1024) {
365
+            $debut = substr($texte, 0, $pos) . "\n\n<!--SPIP-->\n";
366
+            $suite = substr($texte, $pos + 2);
367
+        } else {
368
+            $pos = strpos($texte, ' ', 28 * 1024);  // sinon coupe espace
369
+            if (!($pos > 0 and $pos < 32 * 1024)) {
370
+                $pos = 28 * 1024;  // au pire (pas d'espace trouv'e)
371
+                $decalage = 0; // si y'a pas d'espace, il ne faut pas perdre le caract`ere
372
+            } else {
373
+                $decalage = 1;
374
+            }
375
+            $debut = substr($texte, 0, $pos + $decalage); // Il faut conserver l'espace s'il y en a un
376
+            $suite = substr($texte, $pos + $decalage);
377
+        }
378
+
379
+        return ([$debut, $suite]);
380
+    } else {
381
+        return ([$texte, '']);
382
+    }
383 383
 }
384 384
 
385 385
 /**
@@ -390,25 +390,25 @@  discard block
 block discarded – undo
390 390
  * @return array
391 391
  */
392 392
 function editer_texte_recolle($texte, $att_text) {
393
-	if (
394
-		(strlen($texte) < 29 * 1024)
395
-		or (include_spip('inc/layer') and ($GLOBALS['browser_name'] != 'MSIE'))
396
-	) {
397
-		return [$texte, ''];
398
-	}
399
-
400
-	include_spip('inc/barre');
401
-	$textes_supplement = "<br /><span style='color: red'>" . _T('info_texte_long') . "</span>\n";
402
-	$nombre = 0;
403
-
404
-	while (strlen($texte) > 29 * 1024) {
405
-		$nombre++;
406
-		[$texte1, $texte] = coupe_trop_long($texte);
407
-		$textes_supplement .= '<br />' .
408
-			"<textarea id='texte$nombre' name='texte_plus[$nombre]'$att_text>$texte1</textarea>\n";
409
-	}
410
-
411
-	return [$texte, $textes_supplement];
393
+    if (
394
+        (strlen($texte) < 29 * 1024)
395
+        or (include_spip('inc/layer') and ($GLOBALS['browser_name'] != 'MSIE'))
396
+    ) {
397
+        return [$texte, ''];
398
+    }
399
+
400
+    include_spip('inc/barre');
401
+    $textes_supplement = "<br /><span style='color: red'>" . _T('info_texte_long') . "</span>\n";
402
+    $nombre = 0;
403
+
404
+    while (strlen($texte) > 29 * 1024) {
405
+        $nombre++;
406
+        [$texte1, $texte] = coupe_trop_long($texte);
407
+        $textes_supplement .= '<br />' .
408
+            "<textarea id='texte$nombre' name='texte_plus[$nombre]'$att_text>$texte1</textarea>\n";
409
+    }
410
+
411
+    return [$texte, $textes_supplement];
412 412
 }
413 413
 
414 414
 /**
@@ -419,17 +419,17 @@  discard block
 block discarded – undo
419 419
  * @param int $longueur
420 420
  */
421 421
 function titre_automatique($champ_titre, $champs_contenu, $longueur = null) {
422
-	if (!_request($champ_titre)) {
423
-		$titrer_contenu = charger_fonction('titrer_contenu', 'inc');
424
-		if (!is_null($longueur)) {
425
-			$t = $titrer_contenu($champs_contenu, null, $longueur);
426
-		} else {
427
-			$t = $titrer_contenu($champs_contenu);
428
-		}
429
-		if ($t) {
430
-			set_request($champ_titre, $t);
431
-		}
432
-	}
422
+    if (!_request($champ_titre)) {
423
+        $titrer_contenu = charger_fonction('titrer_contenu', 'inc');
424
+        if (!is_null($longueur)) {
425
+            $t = $titrer_contenu($champs_contenu, null, $longueur);
426
+        } else {
427
+            $t = $titrer_contenu($champs_contenu);
428
+        }
429
+        if ($t) {
430
+            set_request($champ_titre, $t);
431
+        }
432
+    }
433 433
 }
434 434
 
435 435
 /**
@@ -449,20 +449,20 @@  discard block
 block discarded – undo
449 449
  * @return string
450 450
  */
451 451
 function inc_titrer_contenu_dist($champs_contenu, $c = null, $longueur = 50) {
452
-	// trouver un champ texte non vide
453
-	$t = '';
454
-	foreach ($champs_contenu as $champ) {
455
-		if ($t = _request($champ, $c)) {
456
-			break;
457
-		}
458
-	}
459
-
460
-	if ($t) {
461
-		include_spip('inc/texte_mini');
462
-		$t = couper($t, $longueur, '...');
463
-	}
464
-
465
-	return $t;
452
+    // trouver un champ texte non vide
453
+    $t = '';
454
+    foreach ($champs_contenu as $champ) {
455
+        if ($t = _request($champ, $c)) {
456
+            break;
457
+        }
458
+    }
459
+
460
+    if ($t) {
461
+        include_spip('inc/texte_mini');
462
+        $t = couper($t, $longueur, '...');
463
+    }
464
+
465
+    return $t;
466 466
 }
467 467
 
468 468
 /**
@@ -484,26 +484,26 @@  discard block
 block discarded – undo
484 484
  *      - array sinon couples ('$prefixe$colonne => md5)
485 485
  **/
486 486
 function controles_md5(array $data, string $prefixe = 'ctr_', string $format = 'html') {
487
-	$ctr = [];
488
-	foreach ($data as $key => $val) {
489
-		$m = md5($val ?? '');
490
-		$k = $prefixe . $key;
491
-
492
-		switch ($format) {
493
-			case 'html':
494
-				$ctr[$k] = "<input type='hidden' value='$m' name='$k' />";
495
-				break;
496
-			default:
497
-				$ctr[$k] = $m;
498
-				break;
499
-		}
500
-	}
501
-
502
-	if ($format === 'html') {
503
-		return "\n\n<!-- controles md5 -->\n" . join("\n", $ctr) . "\n\n";
504
-	} else {
505
-		return $ctr;
506
-	}
487
+    $ctr = [];
488
+    foreach ($data as $key => $val) {
489
+        $m = md5($val ?? '');
490
+        $k = $prefixe . $key;
491
+
492
+        switch ($format) {
493
+            case 'html':
494
+                $ctr[$k] = "<input type='hidden' value='$m' name='$k' />";
495
+                break;
496
+            default:
497
+                $ctr[$k] = $m;
498
+                break;
499
+        }
500
+    }
501
+
502
+    if ($format === 'html') {
503
+        return "\n\n<!-- controles md5 -->\n" . join("\n", $ctr) . "\n\n";
504
+    } else {
505
+        return $ctr;
506
+    }
507 507
 }
508 508
 
509 509
 /**
@@ -542,80 +542,80 @@  discard block
 block discarded – undo
542 542
  *     - post : le contenu posté
543 543
  **/
544 544
 function controler_contenu($type, $id, $options = [], $c = false, $serveur = '') {
545
-	include_spip('inc/filtres');
546
-
547
-	$table_objet = table_objet($type);
548
-	$spip_table_objet = table_objet_sql($type);
549
-	$trouver_table = charger_fonction('trouver_table', 'base');
550
-	$desc = $trouver_table($table_objet, $serveur);
551
-
552
-	// Appels incomplets (sans $c)
553
-	if (!is_array($c)) {
554
-		$c = [];
555
-		foreach ($desc['field'] as $champ => $ignore) {
556
-			if (_request($champ)) {
557
-				$c[$champ] = _request($champ);
558
-			}
559
-		}
560
-	}
561
-
562
-	// Securite : certaines variables ne sont jamais acceptees ici
563
-	// car elles ne relevent pas de autoriser(article, modifier) ;
564
-	// il faut passer par instituer_XX()
565
-	// TODO: faut-il passer ces variables interdites
566
-	// dans un fichier de description separe ?
567
-	unset($c['statut']);
568
-	unset($c['id_parent']);
569
-	unset($c['id_rubrique']);
570
-	unset($c['id_secteur']);
571
-
572
-	// Gerer les champs non vides
573
-	if (isset($options['nonvide']) and is_array($options['nonvide'])) {
574
-		foreach ($options['nonvide'] as $champ => $sinon) {
575
-			if ($c[$champ] === '') {
576
-				$c[$champ] = $sinon;
577
-			}
578
-		}
579
-	}
580
-
581
-	// N'accepter que les champs qui existent
582
-	// [TODO] ici aussi on peut valider les contenus en fonction du type
583
-	$champs = [];
584
-	foreach ($desc['field'] as $champ => $ignore) {
585
-		if (isset($c[$champ])) {
586
-			$champs[$champ] = $c[$champ];
587
-		}
588
-	}
589
-
590
-	// Nettoyer les valeurs
591
-	$champs = array_map('corriger_caracteres', $champs);
592
-
593
-	// Envoyer aux plugins
594
-	$champs = pipeline(
595
-		'pre_edition',
596
-		[
597
-			'args' => [
598
-				'table' => $spip_table_objet, // compatibilite
599
-				'table_objet' => $table_objet,
600
-				'spip_table_objet' => $spip_table_objet,
601
-				'type' => $type,
602
-				'id_objet' => $id,
603
-				'champs' => $options['champs'] ?? [], // [doc] c'est quoi ?
604
-				'action' => 'controler',
605
-				'serveur' => $serveur,
606
-			],
607
-			'data' => $champs
608
-		]
609
-	);
610
-
611
-	if (!$champs) {
612
-		return false;
613
-	}
614
-
615
-	// Verifier si les mises a jour sont pertinentes, datees, en conflit etc
616
-	$conflits = controler_md5($champs, $_POST, $type, $id, $serveur, $options['prefix'] ?? 'ctr_');
617
-
618
-	return $conflits;
545
+    include_spip('inc/filtres');
546
+
547
+    $table_objet = table_objet($type);
548
+    $spip_table_objet = table_objet_sql($type);
549
+    $trouver_table = charger_fonction('trouver_table', 'base');
550
+    $desc = $trouver_table($table_objet, $serveur);
551
+
552
+    // Appels incomplets (sans $c)
553
+    if (!is_array($c)) {
554
+        $c = [];
555
+        foreach ($desc['field'] as $champ => $ignore) {
556
+            if (_request($champ)) {
557
+                $c[$champ] = _request($champ);
558
+            }
559
+        }
560
+    }
561
+
562
+    // Securite : certaines variables ne sont jamais acceptees ici
563
+    // car elles ne relevent pas de autoriser(article, modifier) ;
564
+    // il faut passer par instituer_XX()
565
+    // TODO: faut-il passer ces variables interdites
566
+    // dans un fichier de description separe ?
567
+    unset($c['statut']);
568
+    unset($c['id_parent']);
569
+    unset($c['id_rubrique']);
570
+    unset($c['id_secteur']);
571
+
572
+    // Gerer les champs non vides
573
+    if (isset($options['nonvide']) and is_array($options['nonvide'])) {
574
+        foreach ($options['nonvide'] as $champ => $sinon) {
575
+            if ($c[$champ] === '') {
576
+                $c[$champ] = $sinon;
577
+            }
578
+        }
579
+    }
580
+
581
+    // N'accepter que les champs qui existent
582
+    // [TODO] ici aussi on peut valider les contenus en fonction du type
583
+    $champs = [];
584
+    foreach ($desc['field'] as $champ => $ignore) {
585
+        if (isset($c[$champ])) {
586
+            $champs[$champ] = $c[$champ];
587
+        }
588
+    }
589
+
590
+    // Nettoyer les valeurs
591
+    $champs = array_map('corriger_caracteres', $champs);
592
+
593
+    // Envoyer aux plugins
594
+    $champs = pipeline(
595
+        'pre_edition',
596
+        [
597
+            'args' => [
598
+                'table' => $spip_table_objet, // compatibilite
599
+                'table_objet' => $table_objet,
600
+                'spip_table_objet' => $spip_table_objet,
601
+                'type' => $type,
602
+                'id_objet' => $id,
603
+                'champs' => $options['champs'] ?? [], // [doc] c'est quoi ?
604
+                'action' => 'controler',
605
+                'serveur' => $serveur,
606
+            ],
607
+            'data' => $champs
608
+        ]
609
+    );
610
+
611
+    if (!$champs) {
612
+        return false;
613
+    }
614
+
615
+    // Verifier si les mises a jour sont pertinentes, datees, en conflit etc
616
+    $conflits = controler_md5($champs, $_POST, $type, $id, $serveur, $options['prefix'] ?? 'ctr_');
617
+
618
+    return $conflits;
619 619
 }
620 620
 
621 621
 
@@ -645,64 +645,64 @@  discard block
 block discarded – undo
645 645
  *     - post : le contenu posté
646 646
  **/
647 647
 function controler_md5(&$champs, $ctr, $type, $id, $serveur, $prefix = 'ctr_') {
648
-	$spip_table_objet = table_objet_sql($type);
649
-	$id_table_objet = id_table_objet($type);
650
-
651
-	// Controle des MD5 envoyes
652
-	// On elimine les donnees non modifiees par le formulaire (mais
653
-	// potentiellement modifiees entre temps par un autre utilisateur)
654
-	foreach ($champs as $key => $val) {
655
-		if (isset($ctr[$prefix . $key]) and $m = $ctr[$prefix . $key]) {
656
-			if (is_scalar($val) and $m == md5($val)) {
657
-				unset($champs[$key]);
658
-			}
659
-		}
660
-	}
661
-	if (!$champs) {
662
-		return;
663
-	}
664
-
665
-	// On veut savoir si notre modif va avoir un impact
666
-	// par rapport aux donnees contenues dans la base
667
-	// (qui peuvent etre differentes de celles ayant servi a calculer le ctr)
668
-	$s = sql_fetsel(array_keys($champs), $spip_table_objet, "$id_table_objet=$id", $serveur);
669
-	$intact = true;
670
-	foreach ($champs as $ch => $val) {
671
-		$intact &= ($s[$ch] == $val);
672
-	}
673
-	if ($intact) {
674
-		return;
675
-	}
676
-
677
-	// Detection de conflits :
678
-	// On verifie si notre modif ne provient pas d'un formulaire
679
-	// genere a partir de donnees modifiees dans l'intervalle ; ici
680
-	// on compare a ce qui est dans la base, et on bloque en cas
681
-	// de conflit.
682
-	$ctrh = $ctrq = $conflits = [];
683
-	foreach (array_keys($champs) as $key) {
684
-		if (isset($ctr[$prefix . $key]) and $m = $ctr[$prefix . $key]) {
685
-			$ctrh[$key] = $m;
686
-			$ctrq[] = $key;
687
-		}
688
-	}
689
-	if ($ctrq) {
690
-		$ctrq = sql_fetsel($ctrq, $spip_table_objet, "$id_table_objet=$id", $serveur);
691
-		foreach ($ctrh as $key => $m) {
692
-			if (
693
-				$m != md5($ctrq[$key])
694
-				and $champs[$key] !== $ctrq[$key]
695
-			) {
696
-				$conflits[$key] = [
697
-					'base' => $ctrq[$key],
698
-					'post' => $champs[$key]
699
-				];
700
-				unset($champs[$key]); # stocker quand meme les modifs ?
701
-			}
702
-		}
703
-	}
704
-
705
-	return $conflits;
648
+    $spip_table_objet = table_objet_sql($type);
649
+    $id_table_objet = id_table_objet($type);
650
+
651
+    // Controle des MD5 envoyes
652
+    // On elimine les donnees non modifiees par le formulaire (mais
653
+    // potentiellement modifiees entre temps par un autre utilisateur)
654
+    foreach ($champs as $key => $val) {
655
+        if (isset($ctr[$prefix . $key]) and $m = $ctr[$prefix . $key]) {
656
+            if (is_scalar($val) and $m == md5($val)) {
657
+                unset($champs[$key]);
658
+            }
659
+        }
660
+    }
661
+    if (!$champs) {
662
+        return;
663
+    }
664
+
665
+    // On veut savoir si notre modif va avoir un impact
666
+    // par rapport aux donnees contenues dans la base
667
+    // (qui peuvent etre differentes de celles ayant servi a calculer le ctr)
668
+    $s = sql_fetsel(array_keys($champs), $spip_table_objet, "$id_table_objet=$id", $serveur);
669
+    $intact = true;
670
+    foreach ($champs as $ch => $val) {
671
+        $intact &= ($s[$ch] == $val);
672
+    }
673
+    if ($intact) {
674
+        return;
675
+    }
676
+
677
+    // Detection de conflits :
678
+    // On verifie si notre modif ne provient pas d'un formulaire
679
+    // genere a partir de donnees modifiees dans l'intervalle ; ici
680
+    // on compare a ce qui est dans la base, et on bloque en cas
681
+    // de conflit.
682
+    $ctrh = $ctrq = $conflits = [];
683
+    foreach (array_keys($champs) as $key) {
684
+        if (isset($ctr[$prefix . $key]) and $m = $ctr[$prefix . $key]) {
685
+            $ctrh[$key] = $m;
686
+            $ctrq[] = $key;
687
+        }
688
+    }
689
+    if ($ctrq) {
690
+        $ctrq = sql_fetsel($ctrq, $spip_table_objet, "$id_table_objet=$id", $serveur);
691
+        foreach ($ctrh as $key => $m) {
692
+            if (
693
+                $m != md5($ctrq[$key])
694
+                and $champs[$key] !== $ctrq[$key]
695
+            ) {
696
+                $conflits[$key] = [
697
+                    'base' => $ctrq[$key],
698
+                    'post' => $champs[$key]
699
+                ];
700
+                unset($champs[$key]); # stocker quand meme les modifs ?
701
+            }
702
+        }
703
+    }
704
+
705
+    return $conflits;
706 706
 }
707 707
 
708 708
 /**
@@ -714,9 +714,9 @@  discard block
 block discarded – undo
714 714
  * @return string
715 715
  */
716 716
 function display_conflit_champ($x) {
717
-	if (strstr($x, "\n") or strlen($x) > 80) {
718
-		return "<textarea style='width:99%; height:10em;'>" . entites_html($x) . "</textarea>\n";
719
-	} else {
720
-		return "<input type='text' size='40' style='width:99%' value=\"" . entites_html($x) . "\" />\n";
721
-	}
717
+    if (strstr($x, "\n") or strlen($x) > 80) {
718
+        return "<textarea style='width:99%; height:10em;'>" . entites_html($x) . "</textarea>\n";
719
+    } else {
720
+        return "<input type='text' size='40' style='width:99%' value=\"" . entites_html($x) . "\" />\n";
721
+    }
722 722
 }
Please login to merge, or discard this patch.
ecrire/inc/drapeau_edition.php 1 patch
Indentation   +109 added lines, -109 removed lines patch added patch discarded remove patch
@@ -30,7 +30,7 @@  discard block
 block discarded – undo
30 30
  * @package SPIP\Core\Drapeaux\Edition
31 31
  **/
32 32
 if (!defined('_ECRIRE_INC_VERSION')) {
33
-	return;
33
+    return;
34 34
 }
35 35
 
36 36
 
@@ -45,46 +45,46 @@  discard block
 block discarded – undo
45 45
  *     `[ type d'objet ][id_objet][id_auteur][nom de l'auteur] = time()`
46 46
  **/
47 47
 function lire_tableau_edition() {
48
-	$edition = @unserialize($GLOBALS['meta']['drapeau_edition']);
49
-	if (!$edition) {
50
-		return [];
51
-	}
52
-	$changed = false;
48
+    $edition = @unserialize($GLOBALS['meta']['drapeau_edition']);
49
+    if (!$edition) {
50
+        return [];
51
+    }
52
+    $changed = false;
53 53
 
54
-	$bon_pour_le_service = time() - 3600;
55
-	// parcourir le tableau et virer les vieux
56
-	foreach ($edition as $objet => $data) {
57
-		if (!is_array($data)) {
58
-			unset($edition[$objet]);
59
-		} // vieille version
60
-		else {
61
-			foreach ($data as $id => $tab) {
62
-				if (!is_array($tab)) {
63
-					unset($edition[$objet][$tab]);
64
-				} // vieille version
65
-				else {
66
-					foreach ($tab as $n => $duo) {
67
-						if (current($duo) < $bon_pour_le_service) {
68
-							unset($edition[$objet][$id][$n]);
69
-							$changed = true;
70
-						}
71
-					}
72
-				}
73
-				if (!$edition[$objet][$id]) {
74
-					unset($edition[$objet][$id]);
75
-				}
76
-			}
77
-		}
78
-		if (!$edition[$objet]) {
79
-			unset($edition[$objet]);
80
-		}
81
-	}
54
+    $bon_pour_le_service = time() - 3600;
55
+    // parcourir le tableau et virer les vieux
56
+    foreach ($edition as $objet => $data) {
57
+        if (!is_array($data)) {
58
+            unset($edition[$objet]);
59
+        } // vieille version
60
+        else {
61
+            foreach ($data as $id => $tab) {
62
+                if (!is_array($tab)) {
63
+                    unset($edition[$objet][$tab]);
64
+                } // vieille version
65
+                else {
66
+                    foreach ($tab as $n => $duo) {
67
+                        if (current($duo) < $bon_pour_le_service) {
68
+                            unset($edition[$objet][$id][$n]);
69
+                            $changed = true;
70
+                        }
71
+                    }
72
+                }
73
+                if (!$edition[$objet][$id]) {
74
+                    unset($edition[$objet][$id]);
75
+                }
76
+            }
77
+        }
78
+        if (!$edition[$objet]) {
79
+            unset($edition[$objet]);
80
+        }
81
+    }
82 82
 
83
-	if ($changed) {
84
-		ecrire_tableau_edition($edition);
85
-	}
83
+    if ($changed) {
84
+        ecrire_tableau_edition($edition);
85
+    }
86 86
 
87
-	return $edition;
87
+    return $edition;
88 88
 }
89 89
 
90 90
 /**
@@ -97,7 +97,7 @@  discard block
 block discarded – undo
97 97
  *     `[ type d'objet ][id_objet][id_auteur][nom de l'auteur] = time()`
98 98
  **/
99 99
 function ecrire_tableau_edition($edition) {
100
-	ecrire_meta('drapeau_edition', serialize($edition));
100
+    ecrire_meta('drapeau_edition', serialize($edition));
101 101
 }
102 102
 
103 103
 /**
@@ -117,22 +117,22 @@  discard block
 block discarded – undo
117 117
  *     Type d'objet édité
118 118
  */
119 119
 function signale_edition($id, $auteur, $type = 'article') {
120
-	include_spip('base/objets');
121
-	include_spip('inc/filtres');
122
-	if (objet_info($type, 'editable') !== 'oui') {
123
-		return;
124
-	}
120
+    include_spip('base/objets');
121
+    include_spip('inc/filtres');
122
+    if (objet_info($type, 'editable') !== 'oui') {
123
+        return;
124
+    }
125 125
 
126
-	$edition = lire_tableau_edition();
126
+    $edition = lire_tableau_edition();
127 127
 	
128
-	$nom = $auteur['nom'] ?? $GLOBALS['ip'];
129
-	$id_a = $auteur['id_auteur'] ?? $GLOBALS['ip'];
128
+    $nom = $auteur['nom'] ?? $GLOBALS['ip'];
129
+    $id_a = $auteur['id_auteur'] ?? $GLOBALS['ip'];
130 130
 
131
-	if (!isset($edition[$type][$id]) or !is_array($edition[$type][$id])) {
132
-		$edition[$type][$id] = [];
133
-	}
134
-	$edition[$type][$id][$id_a][$nom] = time();
135
-	ecrire_tableau_edition($edition);
131
+    if (!isset($edition[$type][$id]) or !is_array($edition[$type][$id])) {
132
+        $edition[$type][$id] = [];
133
+    }
134
+    $edition[$type][$id][$id_a][$nom] = time();
135
+    ecrire_tableau_edition($edition);
136 136
 }
137 137
 
138 138
 /**
@@ -149,9 +149,9 @@  discard block
 block discarded – undo
149 149
  */
150 150
 function qui_edite($id, $type = 'article') {
151 151
 
152
-	$edition = lire_tableau_edition();
152
+    $edition = lire_tableau_edition();
153 153
 
154
-	return empty($edition[$type][$id]) ? [] : $edition[$type][$id];
154
+    return empty($edition[$type][$id]) ? [] : $edition[$type][$id];
155 155
 }
156 156
 
157 157
 /**
@@ -165,23 +165,23 @@  discard block
 block discarded – undo
165 165
  *     Liste de tableaux `['nom_auteur_modif' => x|y|z, 'date_diff' => n]`
166 166
  */
167 167
 function mention_qui_edite($id, $type = 'article'): array {
168
-	$modif = qui_edite($id, $type);
169
-	unset($modif[$GLOBALS['visiteur_session']['id_auteur']]);
168
+    $modif = qui_edite($id, $type);
169
+    unset($modif[$GLOBALS['visiteur_session']['id_auteur']]);
170 170
 
171
-	if ($modif) {
172
-		$quand = 0;
173
-		foreach ($modif as $duo) {
174
-			$auteurs[] = typo(key($duo));
175
-			$quand = max($quand, current($duo));
176
-		}
171
+    if ($modif) {
172
+        $quand = 0;
173
+        foreach ($modif as $duo) {
174
+            $auteurs[] = typo(key($duo));
175
+            $quand = max($quand, current($duo));
176
+        }
177 177
 
178
-		// format lie a la chaine de langue 'avis_article_modifie'
179
-		return [
180
-			'nom_auteur_modif' => join(' | ', $auteurs),
181
-			'date_diff' => ceil((time() - $quand) / 60)
182
-		];
183
-	}
184
-	return [];
178
+        // format lie a la chaine de langue 'avis_article_modifie'
179
+        return [
180
+            'nom_auteur_modif' => join(' | ', $auteurs),
181
+            'date_diff' => ceil((time() - $quand) / 60)
182
+        ];
183
+    }
184
+    return [];
185 185
 }
186 186
 
187 187
 /**
@@ -195,25 +195,25 @@  discard block
 block discarded – undo
195 195
  *     Liste de tableaux `['objet' => x, 'id_objet' => n]`
196 196
  */
197 197
 function liste_drapeau_edition($id_auteur) {
198
-	$edition = lire_tableau_edition();
199
-	$objets_ouverts = [];
198
+    $edition = lire_tableau_edition();
199
+    $objets_ouverts = [];
200 200
 
201
-	foreach ($edition as $objet => $data) {
202
-		foreach ($data as $id => $auteurs) {
203
-			if (
204
-				isset($auteurs[$id_auteur])
205
-				and is_array($auteurs[$id_auteur]) // precaution
206
-				and (array_pop($auteurs[$id_auteur]) > time() - 3600)
207
-			) {
208
-				$objets_ouverts[] = [
209
-					'objet' => $objet,
210
-					'id_objet' => $id,
211
-				];
212
-			}
213
-		}
214
-	}
201
+    foreach ($edition as $objet => $data) {
202
+        foreach ($data as $id => $auteurs) {
203
+            if (
204
+                isset($auteurs[$id_auteur])
205
+                and is_array($auteurs[$id_auteur]) // precaution
206
+                and (array_pop($auteurs[$id_auteur]) > time() - 3600)
207
+            ) {
208
+                $objets_ouverts[] = [
209
+                    'objet' => $objet,
210
+                    'id_objet' => $id,
211
+                ];
212
+            }
213
+        }
214
+    }
215 215
 
216
-	return $objets_ouverts;
216
+    return $objets_ouverts;
217 217
 }
218 218
 
219 219
 /**
@@ -226,15 +226,15 @@  discard block
 block discarded – undo
226 226
  * @return void
227 227
  */
228 228
 function debloquer_tous($id_auteur) {
229
-	$edition = lire_tableau_edition();
230
-	foreach ($edition as $objet => $data) {
231
-		foreach ($data as $id => $auteurs) {
232
-			if (isset($auteurs[$id_auteur])) {
233
-				unset($edition[$objet][$id][$id_auteur]);
234
-				ecrire_tableau_edition($edition);
235
-			}
236
-		}
237
-	}
229
+    $edition = lire_tableau_edition();
230
+    foreach ($edition as $objet => $data) {
231
+        foreach ($data as $id => $auteurs) {
232
+            if (isset($auteurs[$id_auteur])) {
233
+                unset($edition[$objet][$id][$id_auteur]);
234
+                ecrire_tableau_edition($edition);
235
+            }
236
+        }
237
+    }
238 238
 }
239 239
 
240 240
 /**
@@ -252,19 +252,19 @@  discard block
 block discarded – undo
252 252
  * @return void
253 253
  */
254 254
 function debloquer_edition($id_auteur, $id_objet, $type = 'article') {
255
-	$edition = lire_tableau_edition();
255
+    $edition = lire_tableau_edition();
256 256
 
257
-	foreach ($edition as $objet => $data) {
258
-		if ($objet == $type) {
259
-			foreach ($data as $id => $auteurs) {
260
-				if (
261
-					$id == $id_objet
262
-					and isset($auteurs[$id_auteur])
263
-				) {
264
-					unset($edition[$objet][$id][$id_auteur]);
265
-					ecrire_tableau_edition($edition);
266
-				}
267
-			}
268
-		}
269
-	}
257
+    foreach ($edition as $objet => $data) {
258
+        if ($objet == $type) {
259
+            foreach ($data as $id => $auteurs) {
260
+                if (
261
+                    $id == $id_objet
262
+                    and isset($auteurs[$id_auteur])
263
+                ) {
264
+                    unset($edition[$objet][$id][$id_auteur]);
265
+                    ecrire_tableau_edition($edition);
266
+                }
267
+            }
268
+        }
269
+    }
270 270
 }
Please login to merge, or discard this patch.
ecrire/inc/informer.php 1 patch
Indentation   +61 added lines, -61 removed lines patch added patch discarded remove patch
@@ -11,77 +11,77 @@
 block discarded – undo
11 11
 \***************************************************************************/
12 12
 
13 13
 if (!defined('_ECRIRE_INC_VERSION')) {
14
-	return;
14
+    return;
15 15
 }
16 16
 
17 17
 # Les information d'une rubrique selectionnee dans le mini navigateur
18 18
 
19 19
 function inc_informer_dist($id, $col, $exclus, $rac, $type, $do = 'aff') {
20
-	include_spip('inc/texte');
21
-	$titre = $descriptif = '';
22
-	if ($type === 'rubrique') {
23
-		$row = sql_fetsel('titre, descriptif', 'spip_rubriques', 'id_rubrique = ' . intval($id));
24
-		if ($row) {
25
-			$titre = typo($row['titre']);
26
-			$descriptif = propre($row['descriptif']);
27
-		} else {
28
-			$titre = _T('info_racine_site');
29
-		}
30
-	}
20
+    include_spip('inc/texte');
21
+    $titre = $descriptif = '';
22
+    if ($type === 'rubrique') {
23
+        $row = sql_fetsel('titre, descriptif', 'spip_rubriques', 'id_rubrique = ' . intval($id));
24
+        if ($row) {
25
+            $titre = typo($row['titre']);
26
+            $descriptif = propre($row['descriptif']);
27
+        } else {
28
+            $titre = _T('info_racine_site');
29
+        }
30
+    }
31 31
 
32
-	$res = '';
33
-	if (
34
-		$type === 'rubrique'
35
-		and intval($GLOBALS['visiteur_session']['prefs']['display'] ?? 0) !== 1
36
-		and isset($GLOBALS['meta']['image_process'])
37
-	) {
38
-		if ($GLOBALS['meta']['image_process'] !== 'non') {
39
-			$chercher_logo = charger_fonction('chercher_logo', 'inc');
40
-			if ($res = $chercher_logo($id, 'id_rubrique', 'on')) {
41
-				[$fid, $dir, $nom, $format] = $res;
42
-				include_spip('inc/filtres_images_mini');
43
-				$res = image_reduire("<img src='$fid' alt='' />", 100, 48);
44
-				if ($res) {
45
-					$res = "<div class='informer__media' style='float: " . $GLOBALS['spip_lang_right'] . '; margin-' . $GLOBALS['spip_lang_right'] . ": -5px; margin-top: -5px;'>$res</div>";
46
-				}
47
-			}
48
-		}
49
-	}
32
+    $res = '';
33
+    if (
34
+        $type === 'rubrique'
35
+        and intval($GLOBALS['visiteur_session']['prefs']['display'] ?? 0) !== 1
36
+        and isset($GLOBALS['meta']['image_process'])
37
+    ) {
38
+        if ($GLOBALS['meta']['image_process'] !== 'non') {
39
+            $chercher_logo = charger_fonction('chercher_logo', 'inc');
40
+            if ($res = $chercher_logo($id, 'id_rubrique', 'on')) {
41
+                [$fid, $dir, $nom, $format] = $res;
42
+                include_spip('inc/filtres_images_mini');
43
+                $res = image_reduire("<img src='$fid' alt='' />", 100, 48);
44
+                if ($res) {
45
+                    $res = "<div class='informer__media' style='float: " . $GLOBALS['spip_lang_right'] . '; margin-' . $GLOBALS['spip_lang_right'] . ": -5px; margin-top: -5px;'>$res</div>";
46
+                }
47
+            }
48
+        }
49
+    }
50 50
 
51
-	$rac = spip_htmlentities($rac, ENT_QUOTES);
52
-	$do = spip_htmlentities($do, ENT_QUOTES);
53
-	$id = intval($id);
51
+    $rac = spip_htmlentities($rac, ENT_QUOTES);
52
+    $do = spip_htmlentities($do, ENT_QUOTES);
53
+    $id = intval($id);
54 54
 
55 55
 # ce lien provoque la selection (directe) de la rubrique cliquee
56 56
 # et l'affichage de son titre dans le bandeau
57
-	$titre = strtr(
58
-		str_replace(
59
-			"'",
60
-			'&#8217;',
61
-			str_replace('"', '&#34;', textebrut($titre))
62
-		),
63
-		"\n\r",
64
-		'  '
65
-	);
57
+    $titre = strtr(
58
+        str_replace(
59
+            "'",
60
+            '&#8217;',
61
+            str_replace('"', '&#34;', textebrut($titre))
62
+        ),
63
+        "\n\r",
64
+        '  '
65
+    );
66 66
 
67
-	$js_func = $do . '_selection_titre';
67
+    $js_func = $do . '_selection_titre';
68 68
 
69
-	return "<div style='display: none;'>"
70
-	. "<input type='text' id='" . $rac . "_sel' value='$id' />"
71
-	. "<input type='text' id='" . $rac . "_sel2' value=\""
72
-	. entites_html($titre)
73
-	. '" />'
74
-	. '</div>'
75
-	. "<div class='informer' style='padding: 5px; border-top: 0px;'>"
76
-	. '<div class="informer__item">'
77
-	. (!$res ? '' : $res)
78
-	. "<p class='informer__titre'><b>" . safehtml($titre) . '</b></p>'
79
-	. (!$descriptif ? '' : "<div class='informer__descriptif'>" . safehtml($descriptif) . '</div>')
80
-	. '</div>'
81
-	. "<div class='informer__action' style='clear:both; text-align: " . $GLOBALS['spip_lang_right'] . ";'>"
82
-	. "<input type='submit' class='fondo btn submit' value='"
83
-	. _T('bouton_choisir')
84
-	. "'\nonclick=\"$js_func('$titre',$id,'selection_rubrique','id_parent'); return false;\" />"
85
-	. '</div>'
86
-	. '</div>';
69
+    return "<div style='display: none;'>"
70
+    . "<input type='text' id='" . $rac . "_sel' value='$id' />"
71
+    . "<input type='text' id='" . $rac . "_sel2' value=\""
72
+    . entites_html($titre)
73
+    . '" />'
74
+    . '</div>'
75
+    . "<div class='informer' style='padding: 5px; border-top: 0px;'>"
76
+    . '<div class="informer__item">'
77
+    . (!$res ? '' : $res)
78
+    . "<p class='informer__titre'><b>" . safehtml($titre) . '</b></p>'
79
+    . (!$descriptif ? '' : "<div class='informer__descriptif'>" . safehtml($descriptif) . '</div>')
80
+    . '</div>'
81
+    . "<div class='informer__action' style='clear:both; text-align: " . $GLOBALS['spip_lang_right'] . ";'>"
82
+    . "<input type='submit' class='fondo btn submit' value='"
83
+    . _T('bouton_choisir')
84
+    . "'\nonclick=\"$js_func('$titre',$id,'selection_rubrique','id_parent'); return false;\" />"
85
+    . '</div>'
86
+    . '</div>';
87 87
 }
Please login to merge, or discard this patch.
ecrire/index.php 1 patch
Indentation   +76 added lines, -76 removed lines patch added patch discarded remove patch
@@ -19,7 +19,7 @@  discard block
 block discarded – undo
19 19
 /** Drapeau indiquant que l'on est dans l'espace privé */
20 20
 define('_ESPACE_PRIVE', true);
21 21
 if (!defined('_ECRIRE_INC_VERSION')) {
22
-	include 'inc_version.php';
22
+    include 'inc_version.php';
23 23
 }
24 24
 
25 25
 include_spip('inc/cookie');
@@ -35,18 +35,18 @@  discard block
 block discarded – undo
35 35
 // alors il faut blinder les variables d'URL
36 36
 //
37 37
 if (autoriser_sans_cookie($exec, false)) {
38
-	if (!isset($reinstall)) {
39
-		$reinstall = 'non';
40
-	}
41
-	$var_auth = true;
38
+    if (!isset($reinstall)) {
39
+        $reinstall = 'non';
40
+    }
41
+    $var_auth = true;
42 42
 } else {
43
-	// Authentification, redefinissable
44
-	$auth = charger_fonction('auth', 'inc');
45
-	$var_auth = $auth();
46
-	if ($var_auth) {
47
-		echo auth_echec($var_auth);
48
-		exit;
49
-	}
43
+    // Authentification, redefinissable
44
+    $auth = charger_fonction('auth', 'inc');
45
+    $var_auth = $auth();
46
+    if ($var_auth) {
47
+        echo auth_echec($var_auth);
48
+        exit;
49
+    }
50 50
 }
51 51
 
52 52
 // initialiser a la langue par defaut
@@ -57,29 +57,29 @@  discard block
 block discarded – undo
57 57
 
58 58
 
59 59
 if (_request('action') or _request('var_ajax') or _request('formulaire_action')) {
60
-	if (!autoriser_sans_cookie($exec)) {
61
-		// Charger l'aiguilleur qui va mettre sur la bonne voie les traitements derogatoires
62
-		include_spip('public/aiguiller');
63
-		if (
64
-			// cas des appels actions ?action=xxx
65
-			traiter_appels_actions()
66
-			or
67
-			// cas des hits ajax sur les inclusions ajax
68
-			traiter_appels_inclusions_ajax()
69
-			or
70
-			// cas des formulaires charger/verifier/traiter
71
-			traiter_formulaires_dynamiques()
72
-		) {
73
-			exit;
74
-		} // le hit est fini !
75
-	}
60
+    if (!autoriser_sans_cookie($exec)) {
61
+        // Charger l'aiguilleur qui va mettre sur la bonne voie les traitements derogatoires
62
+        include_spip('public/aiguiller');
63
+        if (
64
+            // cas des appels actions ?action=xxx
65
+            traiter_appels_actions()
66
+            or
67
+            // cas des hits ajax sur les inclusions ajax
68
+            traiter_appels_inclusions_ajax()
69
+            or
70
+            // cas des formulaires charger/verifier/traiter
71
+            traiter_formulaires_dynamiques()
72
+        ) {
73
+            exit;
74
+        } // le hit est fini !
75
+    }
76 76
 }
77 77
 // securiser les redirect du back-office
78 78
 if (_request('redirect')) {
79
-	if (!function_exists('securiser_redirect_action')) {
80
-		include_spip('public/aiguiller');
81
-	}
82
-	set_request('redirect', securiser_redirect_action(_request('redirect')));
79
+    if (!function_exists('securiser_redirect_action')) {
80
+        include_spip('public/aiguiller');
81
+    }
82
+    set_request('redirect', securiser_redirect_action(_request('redirect')));
83 83
 }
84 84
 
85 85
 
@@ -89,12 +89,12 @@  discard block
 block discarded – undo
89 89
 
90 90
 // Controle de la version, sauf si on est deja en train de s'en occuper
91 91
 if (
92
-	!$reinstall == 'oui'
93
-	and !_AJAX
94
-	and isset($GLOBALS['meta']['version_installee'])
95
-	and ($GLOBALS['spip_version_base'] != (str_replace(',', '.', $GLOBALS['meta']['version_installee'])))
92
+    !$reinstall == 'oui'
93
+    and !_AJAX
94
+    and isset($GLOBALS['meta']['version_installee'])
95
+    and ($GLOBALS['spip_version_base'] != (str_replace(',', '.', $GLOBALS['meta']['version_installee'])))
96 96
 ) {
97
-	$exec = 'demande_mise_a_jour';
97
+    $exec = 'demande_mise_a_jour';
98 98
 }
99 99
 
100 100
 // Quand une action d'administration est en cours (meta "admin"),
@@ -104,39 +104,39 @@  discard block
 block discarded – undo
104 104
 // sinon c'est qu'elle a ete interrompue et il faut la reprendre
105 105
 
106 106
 elseif (isset($GLOBALS['meta']['admin'])) {
107
-	if (preg_match('/^(.*)_(\d+)_/', $GLOBALS['meta']['admin'], $l)) {
108
-		[, $var_f, $n] = $l;
109
-	}
110
-	if (
111
-		_AJAX
112
-		or !(
113
-			isset($_COOKIE['spip_admin'])
114
-			or (isset($GLOBALS['visiteur_session']) and $GLOBALS['visiteur_session']['statut'] == '0minirezo')
115
-		)
116
-	) {
117
-		spip_log('Quand la meta admin vaut ' .
118
-			$GLOBALS['meta']['admin'] .
119
-			' seul un admin peut se connecter et sans AJAX.' .
120
-			' En cas de probleme, detruire cette meta.');
121
-		die(_T('info_travaux_texte'));
122
-	}
123
-	if ($n) {
124
-		[, $var_f, $n] = $l;
125
-		if (tester_url_ecrire("base_$var_f")) {
126
-			$var_f = "base_$var_f";
127
-		}
128
-		if ($var_f != $exec) {
129
-			spip_log("Le script $var_f lance par auteur$n se substitue a l'exec $exec");
130
-			$exec = $var_f;
131
-			set_request('exec', $exec);
132
-		}
133
-	}
107
+    if (preg_match('/^(.*)_(\d+)_/', $GLOBALS['meta']['admin'], $l)) {
108
+        [, $var_f, $n] = $l;
109
+    }
110
+    if (
111
+        _AJAX
112
+        or !(
113
+            isset($_COOKIE['spip_admin'])
114
+            or (isset($GLOBALS['visiteur_session']) and $GLOBALS['visiteur_session']['statut'] == '0minirezo')
115
+        )
116
+    ) {
117
+        spip_log('Quand la meta admin vaut ' .
118
+            $GLOBALS['meta']['admin'] .
119
+            ' seul un admin peut se connecter et sans AJAX.' .
120
+            ' En cas de probleme, detruire cette meta.');
121
+        die(_T('info_travaux_texte'));
122
+    }
123
+    if ($n) {
124
+        [, $var_f, $n] = $l;
125
+        if (tester_url_ecrire("base_$var_f")) {
126
+            $var_f = "base_$var_f";
127
+        }
128
+        if ($var_f != $exec) {
129
+            spip_log("Le script $var_f lance par auteur$n se substitue a l'exec $exec");
130
+            $exec = $var_f;
131
+            set_request('exec', $exec);
132
+        }
133
+    }
134 134
 }
135 135
 // si nom pas plausible, prendre le script par defaut
136 136
 // attention aux deux cas 404/403 qui commencent par un 4 !
137 137
 elseif (!preg_match(',^[a-z4_][0-9a-z_-]*$,i', $exec)) {
138
-	$exec = 'accueil';
139
-	set_request('exec', $exec);
138
+    $exec = 'accueil';
139
+    set_request('exec', $exec);
140 140
 }
141 141
 
142 142
 //  si la langue est specifiee par cookie et ne correspond pas
@@ -144,19 +144,19 @@  discard block
 block discarded – undo
144 144
 // on appelle directement la fonction, car un appel d'action peut conduire a une boucle infinie
145 145
 // si le cookie n'est pas pose correctement dans l'action
146 146
 if (
147
-	!$var_auth and isset($_COOKIE['spip_lang_ecrire'])
148
-	and $_COOKIE['spip_lang_ecrire'] <> $GLOBALS['visiteur_session']['lang']
147
+    !$var_auth and isset($_COOKIE['spip_lang_ecrire'])
148
+    and $_COOKIE['spip_lang_ecrire'] <> $GLOBALS['visiteur_session']['lang']
149 149
 ) {
150
-	include_spip('action/converser');
151
-	action_converser_post($GLOBALS['visiteur_session']['lang'], true);
150
+    include_spip('action/converser');
151
+    action_converser_post($GLOBALS['visiteur_session']['lang'], true);
152 152
 }
153 153
 
154 154
 if ($var_f = tester_url_ecrire($exec)) {
155
-	$var_f = charger_fonction($var_f);
156
-	$var_f(); // at last
155
+    $var_f = charger_fonction($var_f);
156
+    $var_f(); // at last
157 157
 } else {
158
-	// Rien de connu: rerouter vers exec=404 au lieu d'echouer
159
-	// ce qui permet de laisser la main a un plugin
160
-	$var_f = charger_fonction('404');
161
-	$var_f($exec);
158
+    // Rien de connu: rerouter vers exec=404 au lieu d'echouer
159
+    // ce qui permet de laisser la main a un plugin
160
+    $var_f = charger_fonction('404');
161
+    $var_f($exec);
162 162
 }
Please login to merge, or discard this patch.
ecrire/inc/filtres_alertes.php 1 patch
Indentation   +82 added lines, -82 removed lines patch added patch discarded remove patch
@@ -18,7 +18,7 @@  discard block
 block discarded – undo
18 18
  **/
19 19
 
20 20
 if (!defined('_ECRIRE_INC_VERSION')) {
21
-	return;
21
+    return;
22 22
 }
23 23
 
24 24
 /**
@@ -43,22 +43,22 @@  discard block
 block discarded – undo
43 43
  *     Pile complétée par le code à générer
44 44
  */
45 45
 function balise_ALERTE_MESSAGE_dist($p) {
46
-	$_texte = interprete_argument_balise(1, $p);
47
-	$_titre = interprete_argument_balise(2, $p);
48
-	$_class = interprete_argument_balise(3, $p);
49
-	$_role  = interprete_argument_balise(4, $p);
50
-	$_id    = interprete_argument_balise(5, $p);
51
-	$_texte = ($_texte ?: "''");
52
-	$_titre = ($_titre ? ", $_titre" : ', null');
53
-	$_class = ($_class ? ", $_class" : ', null');
54
-	$_role  = ($_role  ? ", $_role"  : ', null');
55
-	$_id    = ($_id    ? ", $_id"    : ', null');
46
+    $_texte = interprete_argument_balise(1, $p);
47
+    $_titre = interprete_argument_balise(2, $p);
48
+    $_class = interprete_argument_balise(3, $p);
49
+    $_role  = interprete_argument_balise(4, $p);
50
+    $_id    = interprete_argument_balise(5, $p);
51
+    $_texte = ($_texte ?: "''");
52
+    $_titre = ($_titre ? ", $_titre" : ', null');
53
+    $_class = ($_class ? ", $_class" : ', null');
54
+    $_role  = ($_role  ? ", $_role"  : ', null');
55
+    $_id    = ($_id    ? ", $_id"    : ', null');
56 56
 
57
-	$f = chercher_filtre('message_alerte');
58
-	$p->code = "$f($_texte$_titre$_class$_role$_id)";
59
-	$p->interdire_scripts = false;
57
+    $f = chercher_filtre('message_alerte');
58
+    $p->code = "$f($_texte$_titre$_class$_role$_id)";
59
+    $p->interdire_scripts = false;
60 60
 
61
-	return $p;
61
+    return $p;
62 62
 }
63 63
 
64 64
 /**
@@ -86,20 +86,20 @@  discard block
 block discarded – undo
86 86
  *     Pile complétée par le code à générer
87 87
  */
88 88
 function balise_ALERTE_OUVRIR_dist($p) {
89
-	$_titre = interprete_argument_balise(1, $p);
90
-	$_class = interprete_argument_balise(2, $p);
91
-	$_role  = interprete_argument_balise(3, $p);
92
-	$_id    = interprete_argument_balise(4, $p);
93
-	$_titre = ($_titre ? "$_titre"   : 'null');
94
-	$_class = ($_class ? ", $_class" : ', null');
95
-	$_role  = ($_role  ? ", $_role"  : ', null');
96
-	$_id    = ($_id    ? ", $_id"    : ', null');
89
+    $_titre = interprete_argument_balise(1, $p);
90
+    $_class = interprete_argument_balise(2, $p);
91
+    $_role  = interprete_argument_balise(3, $p);
92
+    $_id    = interprete_argument_balise(4, $p);
93
+    $_titre = ($_titre ? "$_titre"   : 'null');
94
+    $_class = ($_class ? ", $_class" : ', null');
95
+    $_role  = ($_role  ? ", $_role"  : ', null');
96
+    $_id    = ($_id    ? ", $_id"    : ', null');
97 97
 
98
-	$f = chercher_filtre('message_alerte_ouvrir');
99
-	$p->code = "$f($_titre$_class$_role$_id)";
100
-	$p->interdire_scripts = false;
98
+    $f = chercher_filtre('message_alerte_ouvrir');
99
+    $p->code = "$f($_titre$_class$_role$_id)";
100
+    $p->interdire_scripts = false;
101 101
 
102
-	return $p;
102
+    return $p;
103 103
 }
104 104
 
105 105
 /**
@@ -121,11 +121,11 @@  discard block
 block discarded – undo
121 121
  *     Pile complétée par le code à générer
122 122
  */
123 123
 function balise_ALERTE_FERMER_dist($p) {
124
-	$f = chercher_filtre('message_alerte_fermer');
125
-	$p->code = "$f()";
126
-	$p->interdire_scripts = false;
124
+    $f = chercher_filtre('message_alerte_fermer');
125
+    $p->code = "$f()";
126
+    $p->interdire_scripts = false;
127 127
 
128
-	return $p;
128
+    return $p;
129 129
 }
130 130
 
131 131
 /**
@@ -160,14 +160,14 @@  discard block
 block discarded – undo
160 160
  */
161 161
 function message_alerte(string $texte, ?string $titre = null, ?string $class = null, ?string $role = null, ?string $id = null): string {
162 162
 
163
-	$message_alerte_ouvrir = chercher_filtre('message_alerte_ouvrir');
164
-	$message_alerte_fermer = chercher_filtre('message_alerte_fermer');
165
-	$message =
166
-		$message_alerte_ouvrir($titre, $class, $role, $id) .
167
-		$texte .
168
-		$message_alerte_fermer();
163
+    $message_alerte_ouvrir = chercher_filtre('message_alerte_ouvrir');
164
+    $message_alerte_fermer = chercher_filtre('message_alerte_fermer');
165
+    $message =
166
+        $message_alerte_ouvrir($titre, $class, $role, $id) .
167
+        $texte .
168
+        $message_alerte_fermer();
169 169
 
170
-	return $message;
170
+    return $message;
171 171
 }
172 172
 
173 173
 /**
@@ -198,56 +198,56 @@  discard block
 block discarded – undo
198 198
  */
199 199
 function message_alerte_ouvrir(?string $titre = null, ?string $class = null, ?string $role = null, ?string $id = null): string {
200 200
 
201
-	$prive = test_espace_prive();
201
+    $prive = test_espace_prive();
202 202
 
203
-	// Valeurs par défaut
204
-	$titre = trim($titre ?? '');
205
-	$role ??= 'alert'; // fallback uniquement si null
206
-	$class ??= 'notice'; // fallback uniquement si null
203
+    // Valeurs par défaut
204
+    $titre = trim($titre ?? '');
205
+    $role ??= 'alert'; // fallback uniquement si null
206
+    $class ??= 'notice'; // fallback uniquement si null
207 207
 
208
-	// Type d'alerte : le chercher dans les classes, nettoyer celles-ci, puis le réinjecter
209
-	$types = [
210
-		'notice',
211
-		'error',
212
-		'success',
213
-		'info',
214
-	];
215
-	$type  = array_intersect(explode(' ', $class), $types);
216
-	$type  = reset($type);
217
-	$class = trim(str_replace($types, '', $class) . " $type");
208
+    // Type d'alerte : le chercher dans les classes, nettoyer celles-ci, puis le réinjecter
209
+    $types = [
210
+        'notice',
211
+        'error',
212
+        'success',
213
+        'info',
214
+    ];
215
+    $type  = array_intersect(explode(' ', $class), $types);
216
+    $type  = reset($type);
217
+    $class = trim(str_replace($types, '', $class) . " $type");
218 218
 
219
-	// Classes
220
-	$class_racine = 'msg-alert';
221
-	$clearfix     = ($prive ? 'clearfix' : '');
222
-	$class_alerte = "$class_racine $class";
223
-	$class_texte  = "{$class_racine}__text $clearfix";
224
-	$class_titre  = "{$class_racine}__heading";
219
+    // Classes
220
+    $class_racine = 'msg-alert';
221
+    $clearfix     = ($prive ? 'clearfix' : '');
222
+    $class_alerte = "$class_racine $class";
223
+    $class_texte  = "{$class_racine}__text $clearfix";
224
+    $class_titre  = "{$class_racine}__heading";
225 225
 
226
-	// Titre : markup
227
-	$titre = trim($titre);
228
-	if (strlen($titre)) {
229
-		include_spip('inc/filtres');
230
-		// Si besoin on encapsule le titre : un h3 dans le privé, un simple div sinon.
231
-		$cherche_tag = ($prive ? '<h' : '<');
232
-		$wrap_tag    = ($prive ? '<h3>' : '<div>');
233
-		if (strpos($titre, $cherche_tag) !== 0) {
234
-			$titre = wrap($titre, $wrap_tag);
235
-		}
236
-		// puis on ajoute la classe
237
-		$titre = ajouter_class($titre, $class_titre);
238
-	}
226
+    // Titre : markup
227
+    $titre = trim($titre);
228
+    if (strlen($titre)) {
229
+        include_spip('inc/filtres');
230
+        // Si besoin on encapsule le titre : un h3 dans le privé, un simple div sinon.
231
+        $cherche_tag = ($prive ? '<h' : '<');
232
+        $wrap_tag    = ($prive ? '<h3>' : '<div>');
233
+        if (strpos($titre, $cherche_tag) !== 0) {
234
+            $titre = wrap($titre, $wrap_tag);
235
+        }
236
+        // puis on ajoute la classe
237
+        $titre = ajouter_class($titre, $class_titre);
238
+    }
239 239
 
240
-	// Attributs
241
-	$attr_role = ($role ? "role=\"$role\"" : '');
242
-	$attr_id   = ($id   ? "id=\"$id\"" : '');
243
-	$attr_data = ($type ? "data-alert=\"$type\"" : '');
240
+    // Attributs
241
+    $attr_role = ($role ? "role=\"$role\"" : '');
242
+    $attr_id   = ($id   ? "id=\"$id\"" : '');
243
+    $attr_data = ($type ? "data-alert=\"$type\"" : '');
244 244
 
245
-	$message =
246
-		"<div class=\"$class_alerte\" $attr_role $attr_id $attr_data>"
247
-			. $titre
248
-			. "<div class=\"$class_texte\">";
245
+    $message =
246
+        "<div class=\"$class_alerte\" $attr_role $attr_id $attr_data>"
247
+            . $titre
248
+            . "<div class=\"$class_texte\">";
249 249
 
250
-	return $message;
250
+    return $message;
251 251
 }
252 252
 
253 253
 /**
@@ -261,5 +261,5 @@  discard block
 block discarded – undo
261 261
  *     HTML de fin de l'alerte
262 262
  */
263 263
 function message_alerte_fermer(): string {
264
-	return '</div></div>';
264
+    return '</div></div>';
265 265
 }
Please login to merge, or discard this patch.
ecrire/action/editer_logo.php 1 patch
Indentation   +223 added lines, -223 removed lines patch added patch discarded remove patch
@@ -17,7 +17,7 @@  discard block
 block discarded – undo
17 17
  */
18 18
 
19 19
 if (!defined('_ECRIRE_INC_VERSION')) {
20
-	return;
20
+    return;
21 21
 }
22 22
 
23 23
 
@@ -30,36 +30,36 @@  discard block
 block discarded – undo
30 30
  *     `on` ou `off`
31 31
  */
32 32
 function logo_supprimer($objet, $id_objet, $etat) {
33
-	$chercher_logo = charger_fonction('chercher_logo', 'inc');
34
-	$objet = objet_type($objet);
35
-	$primary = id_table_objet($objet);
36
-	include_spip('inc/chercher_logo');
37
-
38
-	// existe-t-il deja un logo ?
39
-	$logo = $chercher_logo($id_objet, $primary, $etat);
40
-	if ($logo) {
41
-		# TODO : deprecated, a supprimer -> anciens logos IMG/artonxx.png pas en base
42
-		if ((is_countable($logo) ? count($logo) : 0) < 6) {
43
-			spip_log('Supprimer ancien logo ' . json_encode($logo, JSON_THROW_ON_ERROR), 'logo');
44
-			spip_unlink($logo[0]);
45
-		}
46
-		elseif (
47
-			$doc = $logo[5]
48
-			and isset($doc['id_document'])
49
-			and $id_document = $doc['id_document']
50
-		) {
51
-			include_spip('action/editer_liens');
52
-			// supprimer le lien dans la base
53
-			objet_dissocier(['document' => $id_document], [$objet => $id_objet], ['role' => '*']);
54
-
55
-			// verifier si il reste des liens avec d'autres objets et sinon supprimer
56
-			$liens = objet_trouver_liens(['document' => $id_document], '*');
57
-			if (!count($liens)) {
58
-				$supprimer_document = charger_fonction('supprimer_document', 'action');
59
-				$supprimer_document($doc['id_document']);
60
-			}
61
-		}
62
-	}
33
+    $chercher_logo = charger_fonction('chercher_logo', 'inc');
34
+    $objet = objet_type($objet);
35
+    $primary = id_table_objet($objet);
36
+    include_spip('inc/chercher_logo');
37
+
38
+    // existe-t-il deja un logo ?
39
+    $logo = $chercher_logo($id_objet, $primary, $etat);
40
+    if ($logo) {
41
+        # TODO : deprecated, a supprimer -> anciens logos IMG/artonxx.png pas en base
42
+        if ((is_countable($logo) ? count($logo) : 0) < 6) {
43
+            spip_log('Supprimer ancien logo ' . json_encode($logo, JSON_THROW_ON_ERROR), 'logo');
44
+            spip_unlink($logo[0]);
45
+        }
46
+        elseif (
47
+            $doc = $logo[5]
48
+            and isset($doc['id_document'])
49
+            and $id_document = $doc['id_document']
50
+        ) {
51
+            include_spip('action/editer_liens');
52
+            // supprimer le lien dans la base
53
+            objet_dissocier(['document' => $id_document], [$objet => $id_objet], ['role' => '*']);
54
+
55
+            // verifier si il reste des liens avec d'autres objets et sinon supprimer
56
+            $liens = objet_trouver_liens(['document' => $id_document], '*');
57
+            if (!count($liens)) {
58
+                $supprimer_document = charger_fonction('supprimer_document', 'action');
59
+                $supprimer_document($doc['id_document']);
60
+            }
61
+        }
62
+    }
63 63
 }
64 64
 
65 65
 /**
@@ -76,200 +76,200 @@  discard block
 block discarded – undo
76 76
  *     Erreur, sinon ''
77 77
  */
78 78
 function logo_modifier($objet, $id_objet, $etat, $source) {
79
-	$chercher_logo = charger_fonction('chercher_logo', 'inc');
80
-	$objet = objet_type($objet);
81
-	$primary = id_table_objet($objet);
82
-	include_spip('inc/chercher_logo');
83
-
84
-	$mode = preg_replace(',\W,', '', $etat);
85
-	if (!$mode) {
86
-		spip_log("logo_modifier : etat $etat invalide", 'logo');
87
-		$erreur = 'etat invalide';
88
-
89
-		return $erreur;
90
-	}
91
-	// chercher dans la base
92
-	$mode_document = 'logo' . $mode;
93
-
94
-	include_spip('inc/documents');
95
-	$erreur = '';
96
-
97
-	if (!$source) {
98
-		spip_log('spip_image_ajouter : source inconnue', 'logo');
99
-		$erreur = 'source inconnue';
100
-
101
-		return $erreur;
102
-	}
103
-
104
-	// fichier dans upload/
105
-	if (is_string($source)) {
106
-		$tmp_name = false;
107
-		if (file_exists($source)) {
108
-			$tmp_name = $source;
109
-		} elseif (file_exists($f = determine_upload() . $source)) {
110
-			$tmp_name = $f;
111
-		}
112
-		if (!$tmp_name) {
113
-			spip_log('spip_image_ajouter : source inconnue', 'logo');
114
-			$erreur = 'source inconnue';
115
-
116
-			return $erreur;
117
-		}
118
-		$source = [
119
-			'tmp_name' => $tmp_name,
120
-			'name' => basename($tmp_name),
121
-		];
122
-	} elseif ($erreur = check_upload_error($source['error'], '', true)) {
123
-		return $erreur;
124
-	}
125
-
126
-	// supprimer le logo eventueel existant
127
-	// TODO : si un logo existe, le modifier plutot que supprimer + reinserer (mais il faut gerer le cas ou il est utilise par plusieurs objets, donc pas si simple)
128
-	// mais de toute facon l'interface actuelle oblige a supprimer + reinserer
129
-	if (empty($GLOBALS['logo_migrer_en_base'])) {
130
-		logo_supprimer($objet, $id_objet, $etat);
131
-	}
132
-
133
-
134
-	include_spip('inc/autoriser');
135
-	$source['mode'] = $mode_document;
136
-	$ajouter_documents = charger_fonction('ajouter_documents', 'action');
137
-	autoriser_exception('associerdocuments', $objet, $id_objet);
138
-	$ajoutes = $ajouter_documents('new', [$source], $objet, $id_objet, $mode_document);
139
-	autoriser_exception('associerdocuments', $objet, $id_objet, false);
140
-
141
-	$id_document = reset($ajoutes);
142
-
143
-	if (!is_numeric($id_document)) {
144
-		$erreur = ($id_document ?: 'Erreur inconnue');
145
-		spip_log("Erreur ajout logo : $erreur pour source=" . json_encode($source, JSON_THROW_ON_ERROR), 'logo');
146
-		return $erreur;
147
-	}
148
-
149
-	return ''; // tout est bon, pas d'erreur
79
+    $chercher_logo = charger_fonction('chercher_logo', 'inc');
80
+    $objet = objet_type($objet);
81
+    $primary = id_table_objet($objet);
82
+    include_spip('inc/chercher_logo');
83
+
84
+    $mode = preg_replace(',\W,', '', $etat);
85
+    if (!$mode) {
86
+        spip_log("logo_modifier : etat $etat invalide", 'logo');
87
+        $erreur = 'etat invalide';
88
+
89
+        return $erreur;
90
+    }
91
+    // chercher dans la base
92
+    $mode_document = 'logo' . $mode;
93
+
94
+    include_spip('inc/documents');
95
+    $erreur = '';
96
+
97
+    if (!$source) {
98
+        spip_log('spip_image_ajouter : source inconnue', 'logo');
99
+        $erreur = 'source inconnue';
100
+
101
+        return $erreur;
102
+    }
103
+
104
+    // fichier dans upload/
105
+    if (is_string($source)) {
106
+        $tmp_name = false;
107
+        if (file_exists($source)) {
108
+            $tmp_name = $source;
109
+        } elseif (file_exists($f = determine_upload() . $source)) {
110
+            $tmp_name = $f;
111
+        }
112
+        if (!$tmp_name) {
113
+            spip_log('spip_image_ajouter : source inconnue', 'logo');
114
+            $erreur = 'source inconnue';
115
+
116
+            return $erreur;
117
+        }
118
+        $source = [
119
+            'tmp_name' => $tmp_name,
120
+            'name' => basename($tmp_name),
121
+        ];
122
+    } elseif ($erreur = check_upload_error($source['error'], '', true)) {
123
+        return $erreur;
124
+    }
125
+
126
+    // supprimer le logo eventueel existant
127
+    // TODO : si un logo existe, le modifier plutot que supprimer + reinserer (mais il faut gerer le cas ou il est utilise par plusieurs objets, donc pas si simple)
128
+    // mais de toute facon l'interface actuelle oblige a supprimer + reinserer
129
+    if (empty($GLOBALS['logo_migrer_en_base'])) {
130
+        logo_supprimer($objet, $id_objet, $etat);
131
+    }
132
+
133
+
134
+    include_spip('inc/autoriser');
135
+    $source['mode'] = $mode_document;
136
+    $ajouter_documents = charger_fonction('ajouter_documents', 'action');
137
+    autoriser_exception('associerdocuments', $objet, $id_objet);
138
+    $ajoutes = $ajouter_documents('new', [$source], $objet, $id_objet, $mode_document);
139
+    autoriser_exception('associerdocuments', $objet, $id_objet, false);
140
+
141
+    $id_document = reset($ajoutes);
142
+
143
+    if (!is_numeric($id_document)) {
144
+        $erreur = ($id_document ?: 'Erreur inconnue');
145
+        spip_log("Erreur ajout logo : $erreur pour source=" . json_encode($source, JSON_THROW_ON_ERROR), 'logo');
146
+        return $erreur;
147
+    }
148
+
149
+    return ''; // tout est bon, pas d'erreur
150 150
 }
151 151
 
152 152
 function logo_migrer_en_base($objet, $time_limit) {
153 153
 
154
-	$dir_logos_erreurs = sous_repertoire(_DIR_IMG, 'logo_erreurs');
155
-	$dir_logos = sous_repertoire(_DIR_IMG, 'logo');
156
-	$formats_logos = ['jpg', 'png', 'svg', 'gif'];
157
-	if (isset($GLOBALS['formats_logos'])) {
158
-		$formats_logos = $GLOBALS['formats_logos'];
159
-	}
160
-
161
-
162
-	$trouver_table = charger_fonction('trouver_table', 'base');
163
-	$chercher_logo = charger_fonction('chercher_logo', 'inc');
164
-	include_spip('inc/chercher_logo');
165
-	$_id_objet = id_table_objet($objet);
166
-	$table = table_objet_sql($objet);
167
-	$type = type_du_logo($_id_objet);
168
-	$desc = $trouver_table($table);
169
-
170
-	// on desactive les revisions
171
-	$liste_objets_versionnes = $GLOBALS['meta']['objets_versions'] ?? '';
172
-	unset($GLOBALS['meta']['objets_versions']);
173
-	// et le signalement des editions
174
-	$articles_modif = $GLOBALS['meta']['articles_modif'] ?? '';
175
-	$GLOBALS['meta']['articles_modif'] = 'non';
176
-
177
-	foreach (['on', 'off'] as $mode) {
178
-		$nom_base = $type . $mode;
179
-		$dir = (defined('_DIR_LOGOS') ? _DIR_LOGOS : _DIR_IMG);
180
-
181
-		$files = glob($dir . $nom_base . '*');
182
-		// est-ce que c'est une nouvelle tentative de migration ?
183
-		// dans ce cas les logos sont deja dans IMG/logo/
184
-		if (!(is_countable($files) ? count($files) : 0)) {
185
-			$files = glob($dir_logos . $nom_base . '*');
186
-			if (is_countable($files) ? count($files) : 0) {
187
-				// mais il faut verifier si ils ont pas deja ete migres pour tout ou partie
188
-				$filescheck = [];
189
-				foreach ($files as $file) {
190
-					$short = basename(dirname($file)) . DIRECTORY_SEPARATOR . basename($file);
191
-					$filescheck[$short] = $file;
192
-				}
193
-				// trouver ceux deja migres
194
-				$deja = sql_allfetsel('fichier', 'spip_documents', sql_in('fichier', array_keys($filescheck)) . " AND mode LIKE 'logo%'");
195
-				if (is_countable($deja) ? count($deja) : 0) {
196
-					$deja = array_column($deja, 'fichier');
197
-					$restant = array_diff(array_keys($filescheck), $deja);
198
-					$files = [];
199
-					if (count($restant)) {
200
-						foreach ($restant as $r) {
201
-							$files[] = $filescheck[$r];
202
-						}
203
-					}
204
-				}
205
-				// et si il en reste on peut y aller...
206
-				// mais il faut modifier $dir qui sert de base dans la suite
207
-				if (is_countable($files) ? count($files) : 0) {
208
-					$dir = $dir_logos;
209
-				}
210
-			}
211
-		}
212
-
213
-		$count = (is_countable($files) ? count($files) : 0);
214
-		spip_log("logo_migrer_en_base $objet $mode : " . $count . ' logos restant', 'maj' . _LOG_INFO_IMPORTANTE);
215
-
216
-		$deja = [];
217
-		foreach ($files as $file) {
218
-			$logo = substr($file, strlen($dir . $nom_base));
219
-			$logo = explode('.', $logo);
220
-			if (
221
-				is_numeric($logo[0])
222
-				and ($id_objet = intval($logo[0]) or in_array($objet, ['site', 'rubrique']))
223
-			) {
224
-				if (!isset($deja[$id_objet])) {
225
-					$logo = $chercher_logo($id_objet, $_id_objet, $mode);
226
-					// if no logo in base
227
-					if (!$logo or (is_countable($logo) ? count($logo) : 0) < 6) {
228
-						foreach ($formats_logos as $format) {
229
-							if (@file_exists($d = ($dir . ($nom = $nom_base . intval($id_objet) . '.' . $format)))) {
230
-								if (isset($desc['field']['date_modif'])) {
231
-									$date_modif = sql_getfetsel('date_modif', $table, "$_id_objet=$id_objet");
232
-								} else {
233
-									$date_modif = null;
234
-								}
235
-								// s'assurer que le logo a les bon droits au passage (evite un echec en cas de sanitization d'un svg)
236
-								@chmod($d, _SPIP_CHMOD & 0666);
237
-								// logo_modifier commence par supprimer le logo existant, donc on le deplace pour pas le perdre
238
-								@rename($d, $dir_logos . $nom);
239
-								// et on le declare comme nouveau logo
240
-								logo_modifier($objet, $id_objet, $mode, $dir_logos . $nom);
241
-								if ($date_modif) {
242
-									sql_updateq($table, ['date_modif' => $date_modif], "$_id_objet=$id_objet");
243
-								}
244
-								break;
245
-							}
246
-						}
247
-					}
248
-					$deja[$id_objet] = true;
249
-				}
250
-			}
251
-			// si le fichier est encore la on le move : rien a faire ici
252
-			// (sauf si c'est une re-migration : il est deja dans logo/ donc il bouge pas)
253
-			if ($dir !== $dir_logos and file_exists($file)) {
254
-				@rename($file, $dir_logos_erreurs . basename($file));
255
-			}
256
-
257
-			$count--;
258
-			if ($count % 250 === 0) {
259
-				spip_log("logo_migrer_en_base $objet $mode : " . $count . ' logos restant', 'maj' . _LOG_INFO_IMPORTANTE);
260
-			}
261
-
262
-			if ($time_limit and time() > $time_limit) {
263
-				effacer_meta('drapeau_edition');
264
-				return;
265
-			}
266
-		}
267
-	}
268
-
269
-	if ($liste_objets_versionnes) {
270
-		$GLOBALS['meta']['objets_versions'] = $liste_objets_versionnes;
271
-	}
272
-	$GLOBALS['meta']['articles_modif'] = $articles_modif;
273
-
274
-	effacer_meta('drapeau_edition');
154
+    $dir_logos_erreurs = sous_repertoire(_DIR_IMG, 'logo_erreurs');
155
+    $dir_logos = sous_repertoire(_DIR_IMG, 'logo');
156
+    $formats_logos = ['jpg', 'png', 'svg', 'gif'];
157
+    if (isset($GLOBALS['formats_logos'])) {
158
+        $formats_logos = $GLOBALS['formats_logos'];
159
+    }
160
+
161
+
162
+    $trouver_table = charger_fonction('trouver_table', 'base');
163
+    $chercher_logo = charger_fonction('chercher_logo', 'inc');
164
+    include_spip('inc/chercher_logo');
165
+    $_id_objet = id_table_objet($objet);
166
+    $table = table_objet_sql($objet);
167
+    $type = type_du_logo($_id_objet);
168
+    $desc = $trouver_table($table);
169
+
170
+    // on desactive les revisions
171
+    $liste_objets_versionnes = $GLOBALS['meta']['objets_versions'] ?? '';
172
+    unset($GLOBALS['meta']['objets_versions']);
173
+    // et le signalement des editions
174
+    $articles_modif = $GLOBALS['meta']['articles_modif'] ?? '';
175
+    $GLOBALS['meta']['articles_modif'] = 'non';
176
+
177
+    foreach (['on', 'off'] as $mode) {
178
+        $nom_base = $type . $mode;
179
+        $dir = (defined('_DIR_LOGOS') ? _DIR_LOGOS : _DIR_IMG);
180
+
181
+        $files = glob($dir . $nom_base . '*');
182
+        // est-ce que c'est une nouvelle tentative de migration ?
183
+        // dans ce cas les logos sont deja dans IMG/logo/
184
+        if (!(is_countable($files) ? count($files) : 0)) {
185
+            $files = glob($dir_logos . $nom_base . '*');
186
+            if (is_countable($files) ? count($files) : 0) {
187
+                // mais il faut verifier si ils ont pas deja ete migres pour tout ou partie
188
+                $filescheck = [];
189
+                foreach ($files as $file) {
190
+                    $short = basename(dirname($file)) . DIRECTORY_SEPARATOR . basename($file);
191
+                    $filescheck[$short] = $file;
192
+                }
193
+                // trouver ceux deja migres
194
+                $deja = sql_allfetsel('fichier', 'spip_documents', sql_in('fichier', array_keys($filescheck)) . " AND mode LIKE 'logo%'");
195
+                if (is_countable($deja) ? count($deja) : 0) {
196
+                    $deja = array_column($deja, 'fichier');
197
+                    $restant = array_diff(array_keys($filescheck), $deja);
198
+                    $files = [];
199
+                    if (count($restant)) {
200
+                        foreach ($restant as $r) {
201
+                            $files[] = $filescheck[$r];
202
+                        }
203
+                    }
204
+                }
205
+                // et si il en reste on peut y aller...
206
+                // mais il faut modifier $dir qui sert de base dans la suite
207
+                if (is_countable($files) ? count($files) : 0) {
208
+                    $dir = $dir_logos;
209
+                }
210
+            }
211
+        }
212
+
213
+        $count = (is_countable($files) ? count($files) : 0);
214
+        spip_log("logo_migrer_en_base $objet $mode : " . $count . ' logos restant', 'maj' . _LOG_INFO_IMPORTANTE);
215
+
216
+        $deja = [];
217
+        foreach ($files as $file) {
218
+            $logo = substr($file, strlen($dir . $nom_base));
219
+            $logo = explode('.', $logo);
220
+            if (
221
+                is_numeric($logo[0])
222
+                and ($id_objet = intval($logo[0]) or in_array($objet, ['site', 'rubrique']))
223
+            ) {
224
+                if (!isset($deja[$id_objet])) {
225
+                    $logo = $chercher_logo($id_objet, $_id_objet, $mode);
226
+                    // if no logo in base
227
+                    if (!$logo or (is_countable($logo) ? count($logo) : 0) < 6) {
228
+                        foreach ($formats_logos as $format) {
229
+                            if (@file_exists($d = ($dir . ($nom = $nom_base . intval($id_objet) . '.' . $format)))) {
230
+                                if (isset($desc['field']['date_modif'])) {
231
+                                    $date_modif = sql_getfetsel('date_modif', $table, "$_id_objet=$id_objet");
232
+                                } else {
233
+                                    $date_modif = null;
234
+                                }
235
+                                // s'assurer que le logo a les bon droits au passage (evite un echec en cas de sanitization d'un svg)
236
+                                @chmod($d, _SPIP_CHMOD & 0666);
237
+                                // logo_modifier commence par supprimer le logo existant, donc on le deplace pour pas le perdre
238
+                                @rename($d, $dir_logos . $nom);
239
+                                // et on le declare comme nouveau logo
240
+                                logo_modifier($objet, $id_objet, $mode, $dir_logos . $nom);
241
+                                if ($date_modif) {
242
+                                    sql_updateq($table, ['date_modif' => $date_modif], "$_id_objet=$id_objet");
243
+                                }
244
+                                break;
245
+                            }
246
+                        }
247
+                    }
248
+                    $deja[$id_objet] = true;
249
+                }
250
+            }
251
+            // si le fichier est encore la on le move : rien a faire ici
252
+            // (sauf si c'est une re-migration : il est deja dans logo/ donc il bouge pas)
253
+            if ($dir !== $dir_logos and file_exists($file)) {
254
+                @rename($file, $dir_logos_erreurs . basename($file));
255
+            }
256
+
257
+            $count--;
258
+            if ($count % 250 === 0) {
259
+                spip_log("logo_migrer_en_base $objet $mode : " . $count . ' logos restant', 'maj' . _LOG_INFO_IMPORTANTE);
260
+            }
261
+
262
+            if ($time_limit and time() > $time_limit) {
263
+                effacer_meta('drapeau_edition');
264
+                return;
265
+            }
266
+        }
267
+    }
268
+
269
+    if ($liste_objets_versionnes) {
270
+        $GLOBALS['meta']['objets_versions'] = $liste_objets_versionnes;
271
+    }
272
+    $GLOBALS['meta']['articles_modif'] = $articles_modif;
273
+
274
+    effacer_meta('drapeau_edition');
275 275
 }
Please login to merge, or discard this patch.
ecrire/inc/autoriser.php 1 patch
Indentation   +683 added lines, -683 removed lines patch added patch discarded remove patch
@@ -16,7 +16,7 @@  discard block
 block discarded – undo
16 16
  * @package SPIP\Core\Autorisations
17 17
  **/
18 18
 if (!defined('_ECRIRE_INC_VERSION')) {
19
-	return;
19
+    return;
20 20
 }
21 21
 
22 22
 include_spip('base/abstract_sql');
@@ -38,89 +38,89 @@  discard block
 block discarded – undo
38 38
 
39 39
 
40 40
 if (!function_exists('autoriser')) {
41
-	/**
42
-	 * Autoriser une action
43
-	 *
44
-	 * Teste si une personne (par défaut le visiteur en cours) peut effectuer
45
-	 * une certaine action. Cette fonction est le point d'entrée de toutes
46
-	 * les autorisations.
47
-	 *
48
-	 * La fonction se charge d'appeler des fonctions d'autorisations spécifiques
49
-	 * aux actions demandées si elles existent. Elle cherche donc les fonctions
50
-	 * dans cet ordre :
51
-	 *
52
-	 * - autoriser_{type}_{faire}, sinon avec _dist
53
-	 * - autoriser_{type}, sinon avec _dist
54
-	 * - autoriser_{faire}, sinon avec _dist
55
-	 * - autoriser_{defaut}, sinon avec _dist
56
-	 *
57
-	 * Seul le premier argument est obligatoire.
58
-	 *
59
-	 * @note
60
-	 *     Le paramètre `$type` attend par défaut un type d'objet éditorial, et à ce titre,
61
-	 *     la valeur transmise se verra appliquer la fonction 'objet_type' pour uniformiser
62
-	 *     cette valeur.
63
-	 *
64
-	 *     Si ce paramètre n'a rien n'a voir avec un objet éditorial, par exemple
65
-	 *     'statistiques', un souligné avant le terme est ajouté afin d'indiquer
66
-	 *     explicitement à la fonction autoriser de ne pas transformer la chaîne en type
67
-	 *     d'objet. Cela donne pour cet exemple : `autoriser('detruire', '_statistiques')`
68
-	 *
69
-	 * @note
70
-	 *     Le paramètre `$type`, en plus de l'uniformisation en type d'objet, se voit retirer
71
-	 *     tous les soulignés du terme. Ainsi le type d'objet `livre_art` deviendra `livreart`
72
-	 *     et SPIP cherchera une fonction `autoriser_livreart_{faire}`. Ceci permet
73
-	 *     d'éviter une possible confusion si une fonction `autoriser_livre_art` existait :
74
-	 *     quel serait le type, quel serait l'action ?
75
-	 *
76
-	 *     Pour résumer, si le type d'objet éditorial a un souligné, tel que 'livre_art',
77
-	 *     la fonction d'autorisation correspondante ne l'aura pas.
78
-	 *     Exemple : `function autoriser_livreart_modifier_dist(...){...}`
79
-	 *
80
-	 * @api
81
-	 * @see autoriser_dist()
82
-	 * @see objet_type()
83
-	 *
84
-	 * @param string $faire
85
-	 *   une action ('modifier', 'publier'...)
86
-	 * @param string|null $type
87
-	 *   Type d’objet ou élément sur lequel appliquer l’action.
88
-	 *   - null: indifférent à tout type d’élément ou objet éditorial
89
-	 *   - string: objet éditorial (objet_type() est appliqué pour homogénéiser l’entrée)
90
-	 *   - _string: autre élément (avec un souligné en premier caractère, désactive objet_type()).
91
-	 *   Les soulignés seront retirés (cf. la note).
92
-	 * @param string|int|null $id
93
-	 *   id de l'objet ou élément sur lequel on veut agir, si pertinent.
94
-	 *   - null: non utile pour l’autorisation
95
-	 *   - int: identifiant numérique (cas de tous les objets éditoriaux de SPIP)
96
-	 *   - string: identifiant textuel
97
-	 * @param null|int|array $qui
98
-	 *   - si null on prend alors visiteur_session
99
-	 *   - un id_auteur (on regarde dans la base)
100
-	 *   - un tableau auteur complet, y compris [restreint]
101
-	 * @param array $opt
102
-	 *   options sous forme de tableau associatif
103
-	 * @return bool
104
-	 *   true si la personne peut effectuer l'action
105
-	 */
106
-	function autoriser(string $faire, ?string $type = '', $id = null, $qui = null, array $opt = []): bool {
107
-		// Charger les fonctions d'autorisation supplementaires
108
-		static $pipe;
109
-		if (!isset($pipe)) {
110
-			$pipe = 1;
111
-			pipeline('autoriser');
112
-		}
113
-
114
-		return autoriser_dist($faire, $type, $id, $qui, $opt);
115
-	}
41
+    /**
42
+     * Autoriser une action
43
+     *
44
+     * Teste si une personne (par défaut le visiteur en cours) peut effectuer
45
+     * une certaine action. Cette fonction est le point d'entrée de toutes
46
+     * les autorisations.
47
+     *
48
+     * La fonction se charge d'appeler des fonctions d'autorisations spécifiques
49
+     * aux actions demandées si elles existent. Elle cherche donc les fonctions
50
+     * dans cet ordre :
51
+     *
52
+     * - autoriser_{type}_{faire}, sinon avec _dist
53
+     * - autoriser_{type}, sinon avec _dist
54
+     * - autoriser_{faire}, sinon avec _dist
55
+     * - autoriser_{defaut}, sinon avec _dist
56
+     *
57
+     * Seul le premier argument est obligatoire.
58
+     *
59
+     * @note
60
+     *     Le paramètre `$type` attend par défaut un type d'objet éditorial, et à ce titre,
61
+     *     la valeur transmise se verra appliquer la fonction 'objet_type' pour uniformiser
62
+     *     cette valeur.
63
+     *
64
+     *     Si ce paramètre n'a rien n'a voir avec un objet éditorial, par exemple
65
+     *     'statistiques', un souligné avant le terme est ajouté afin d'indiquer
66
+     *     explicitement à la fonction autoriser de ne pas transformer la chaîne en type
67
+     *     d'objet. Cela donne pour cet exemple : `autoriser('detruire', '_statistiques')`
68
+     *
69
+     * @note
70
+     *     Le paramètre `$type`, en plus de l'uniformisation en type d'objet, se voit retirer
71
+     *     tous les soulignés du terme. Ainsi le type d'objet `livre_art` deviendra `livreart`
72
+     *     et SPIP cherchera une fonction `autoriser_livreart_{faire}`. Ceci permet
73
+     *     d'éviter une possible confusion si une fonction `autoriser_livre_art` existait :
74
+     *     quel serait le type, quel serait l'action ?
75
+     *
76
+     *     Pour résumer, si le type d'objet éditorial a un souligné, tel que 'livre_art',
77
+     *     la fonction d'autorisation correspondante ne l'aura pas.
78
+     *     Exemple : `function autoriser_livreart_modifier_dist(...){...}`
79
+     *
80
+     * @api
81
+     * @see autoriser_dist()
82
+     * @see objet_type()
83
+     *
84
+     * @param string $faire
85
+     *   une action ('modifier', 'publier'...)
86
+     * @param string|null $type
87
+     *   Type d’objet ou élément sur lequel appliquer l’action.
88
+     *   - null: indifférent à tout type d’élément ou objet éditorial
89
+     *   - string: objet éditorial (objet_type() est appliqué pour homogénéiser l’entrée)
90
+     *   - _string: autre élément (avec un souligné en premier caractère, désactive objet_type()).
91
+     *   Les soulignés seront retirés (cf. la note).
92
+     * @param string|int|null $id
93
+     *   id de l'objet ou élément sur lequel on veut agir, si pertinent.
94
+     *   - null: non utile pour l’autorisation
95
+     *   - int: identifiant numérique (cas de tous les objets éditoriaux de SPIP)
96
+     *   - string: identifiant textuel
97
+     * @param null|int|array $qui
98
+     *   - si null on prend alors visiteur_session
99
+     *   - un id_auteur (on regarde dans la base)
100
+     *   - un tableau auteur complet, y compris [restreint]
101
+     * @param array $opt
102
+     *   options sous forme de tableau associatif
103
+     * @return bool
104
+     *   true si la personne peut effectuer l'action
105
+     */
106
+    function autoriser(string $faire, ?string $type = '', $id = null, $qui = null, array $opt = []): bool {
107
+        // Charger les fonctions d'autorisation supplementaires
108
+        static $pipe;
109
+        if (!isset($pipe)) {
110
+            $pipe = 1;
111
+            pipeline('autoriser');
112
+        }
113
+
114
+        return autoriser_dist($faire, $type, $id, $qui, $opt);
115
+    }
116 116
 }
117 117
 
118 118
 
119 119
 // mes_fonctions peut aussi declarer des autorisations, il faut donc le charger
120 120
 // mais apres la fonction autoriser()
121 121
 if ($f = find_in_path('mes_fonctions.php')) {
122
-	global $dossier_squelettes;
123
-	include_once(_ROOT_CWD . $f);
122
+    global $dossier_squelettes;
123
+    include_once(_ROOT_CWD . $f);
124 124
 }
125 125
 
126 126
 
@@ -151,85 +151,85 @@  discard block
 block discarded – undo
151 151
  */
152 152
 function autoriser_dist(string $faire, ?string $type = '', $id = null, $qui = null, array $opt = []): bool {
153 153
 
154
-	if ($type === null) {
155
-		$type = '';
156
-	}
157
-
158
-	// Qui ? visiteur_session ?
159
-	// si null ou '' (appel depuis #AUTORISER) on prend l'auteur loge
160
-	if ($qui === null or $qui === '') {
161
-		$qui = $GLOBALS['visiteur_session'] ?: [];
162
-		$qui = array_merge(['statut' => '', 'id_auteur' => 0, 'webmestre' => 'non'], $qui);
163
-	} elseif (is_numeric($qui)) {
164
-		$qui = sql_fetsel('*', 'spip_auteurs', 'id_auteur=' . $qui);
165
-		if (!$qui) {
166
-			return false;
167
-		}
168
-	}
169
-
170
-	// Admins restreints, on construit ici (pas generique mais...)
171
-	// le tableau de toutes leurs rubriques (y compris les sous-rubriques)
172
-	if (_ADMINS_RESTREINTS and is_array($qui)) {
173
-		$qui['restreint'] = isset($qui['id_auteur']) ? liste_rubriques_auteur($qui['id_auteur']) : [];
174
-	}
175
-
176
-	spip_log(
177
-		"autoriser $faire $type $id (" . ($qui['nom'] ?? '') . ') ?',
178
-		'autoriser' . _LOG_DEBUG
179
-	);
180
-
181
-	// passer par objet_type pour avoir les alias
182
-	// sauf si _ est le premier caractère.
183
-	if ($type and $type[0] !== '_') {
184
-		$type = objet_type($type, false);
185
-	}
186
-	// et supprimer les _
187
-	$type = str_replace('_', '', (string) $type);
188
-
189
-	// Si une exception a ete decretee plus haut dans le code, l'appliquer
190
-	if (
191
-		(isset($GLOBALS['autoriser_exception'][$faire][$type][$id]) and autoriser_exception($faire, $type, $id, 'verifier'))
192
-		or (isset($GLOBALS['autoriser_exception'][$faire][$type]['*']) and autoriser_exception($faire, $type, '*', 'verifier'))
193
-	) {
194
-		spip_log("autoriser ($faire, $type, $id, " . ($qui['nom'] ?? '') . ') : OK Exception', 'autoriser' . _LOG_DEBUG);
195
-		return true;
196
-	}
197
-
198
-	// Chercher une fonction d'autorisation
199
-	// Dans l'ordre on va chercher autoriser_type_faire[_dist], autoriser_type[_dist],
200
-	// autoriser_faire[_dist], autoriser_defaut[_dist]
201
-	$fonctions = $type
202
-		? [
203
-			'autoriser_' . $type . '_' . $faire,
204
-			'autoriser_' . $type . '_' . $faire . '_dist',
205
-			'autoriser_' . $type,
206
-			'autoriser_' . $type . '_dist',
207
-			'autoriser_' . $faire,
208
-			'autoriser_' . $faire . '_dist',
209
-			'autoriser_defaut',
210
-			'autoriser_defaut_dist'
211
-		]
212
-		: [
213
-			'autoriser_' . $faire,
214
-			'autoriser_' . $faire . '_dist',
215
-			'autoriser_defaut',
216
-			'autoriser_defaut_dist'
217
-		];
218
-
219
-	$a = false;
220
-	foreach ($fonctions as $f) {
221
-		if (function_exists($f)) {
222
-			$a = $f($faire, $type, $id, $qui, $opt);
223
-			break;
224
-		}
225
-	}
226
-
227
-	spip_log(
228
-		"$f($faire, $type, $id, " . ($qui['nom'] ?? '') . ') : ' . ($a ? 'OK' : 'niet'),
229
-		'autoriser' . _LOG_DEBUG
230
-	);
231
-
232
-	return $a;
154
+    if ($type === null) {
155
+        $type = '';
156
+    }
157
+
158
+    // Qui ? visiteur_session ?
159
+    // si null ou '' (appel depuis #AUTORISER) on prend l'auteur loge
160
+    if ($qui === null or $qui === '') {
161
+        $qui = $GLOBALS['visiteur_session'] ?: [];
162
+        $qui = array_merge(['statut' => '', 'id_auteur' => 0, 'webmestre' => 'non'], $qui);
163
+    } elseif (is_numeric($qui)) {
164
+        $qui = sql_fetsel('*', 'spip_auteurs', 'id_auteur=' . $qui);
165
+        if (!$qui) {
166
+            return false;
167
+        }
168
+    }
169
+
170
+    // Admins restreints, on construit ici (pas generique mais...)
171
+    // le tableau de toutes leurs rubriques (y compris les sous-rubriques)
172
+    if (_ADMINS_RESTREINTS and is_array($qui)) {
173
+        $qui['restreint'] = isset($qui['id_auteur']) ? liste_rubriques_auteur($qui['id_auteur']) : [];
174
+    }
175
+
176
+    spip_log(
177
+        "autoriser $faire $type $id (" . ($qui['nom'] ?? '') . ') ?',
178
+        'autoriser' . _LOG_DEBUG
179
+    );
180
+
181
+    // passer par objet_type pour avoir les alias
182
+    // sauf si _ est le premier caractère.
183
+    if ($type and $type[0] !== '_') {
184
+        $type = objet_type($type, false);
185
+    }
186
+    // et supprimer les _
187
+    $type = str_replace('_', '', (string) $type);
188
+
189
+    // Si une exception a ete decretee plus haut dans le code, l'appliquer
190
+    if (
191
+        (isset($GLOBALS['autoriser_exception'][$faire][$type][$id]) and autoriser_exception($faire, $type, $id, 'verifier'))
192
+        or (isset($GLOBALS['autoriser_exception'][$faire][$type]['*']) and autoriser_exception($faire, $type, '*', 'verifier'))
193
+    ) {
194
+        spip_log("autoriser ($faire, $type, $id, " . ($qui['nom'] ?? '') . ') : OK Exception', 'autoriser' . _LOG_DEBUG);
195
+        return true;
196
+    }
197
+
198
+    // Chercher une fonction d'autorisation
199
+    // Dans l'ordre on va chercher autoriser_type_faire[_dist], autoriser_type[_dist],
200
+    // autoriser_faire[_dist], autoriser_defaut[_dist]
201
+    $fonctions = $type
202
+        ? [
203
+            'autoriser_' . $type . '_' . $faire,
204
+            'autoriser_' . $type . '_' . $faire . '_dist',
205
+            'autoriser_' . $type,
206
+            'autoriser_' . $type . '_dist',
207
+            'autoriser_' . $faire,
208
+            'autoriser_' . $faire . '_dist',
209
+            'autoriser_defaut',
210
+            'autoriser_defaut_dist'
211
+        ]
212
+        : [
213
+            'autoriser_' . $faire,
214
+            'autoriser_' . $faire . '_dist',
215
+            'autoriser_defaut',
216
+            'autoriser_defaut_dist'
217
+        ];
218
+
219
+    $a = false;
220
+    foreach ($fonctions as $f) {
221
+        if (function_exists($f)) {
222
+            $a = $f($faire, $type, $id, $qui, $opt);
223
+            break;
224
+        }
225
+    }
226
+
227
+    spip_log(
228
+        "$f($faire, $type, $id, " . ($qui['nom'] ?? '') . ') : ' . ($a ? 'OK' : 'niet'),
229
+        'autoriser' . _LOG_DEBUG
230
+    );
231
+
232
+    return $a;
233 233
 }
234 234
 
235 235
 // une globale pour aller au plus vite dans la fonction generique ci dessus
@@ -249,33 +249,33 @@  discard block
 block discarded – undo
249 249
  * @return bool
250 250
  */
251 251
 function autoriser_exception(string $faire, ?string $type = '', $id = null, $autoriser = true): bool {
252
-	// une static innaccessible par url pour verifier que la globale est positionnee a bon escient
253
-	static $autorisation;
254
-	// Tolérance avec certains appels
255
-	if ($type === null) {
256
-		$type = '';
257
-	}
258
-	if ($id === null) {
259
-		$id = 0;
260
-	}
261
-	if ($autoriser === 'verifier') {
262
-		return isset($autorisation[$faire][$type][$id]);
263
-	}
264
-	if ($autoriser === true) {
265
-		$GLOBALS['autoriser_exception'][$faire][$type][$id] = $autorisation[$faire][$type][$id] = true;
266
-	}
267
-	if ($autoriser === false) {
268
-		if ($id === '*') {
269
-			unset($GLOBALS['autoriser_exception'][$faire][$type]);
270
-			unset($autorisation[$faire][$type]);
271
-		}
272
-		else {
273
-			unset($GLOBALS['autoriser_exception'][$faire][$type][$id]);
274
-			unset($autorisation[$faire][$type][$id]);
275
-		}
276
-	}
277
-
278
-	return false;
252
+    // une static innaccessible par url pour verifier que la globale est positionnee a bon escient
253
+    static $autorisation;
254
+    // Tolérance avec certains appels
255
+    if ($type === null) {
256
+        $type = '';
257
+    }
258
+    if ($id === null) {
259
+        $id = 0;
260
+    }
261
+    if ($autoriser === 'verifier') {
262
+        return isset($autorisation[$faire][$type][$id]);
263
+    }
264
+    if ($autoriser === true) {
265
+        $GLOBALS['autoriser_exception'][$faire][$type][$id] = $autorisation[$faire][$type][$id] = true;
266
+    }
267
+    if ($autoriser === false) {
268
+        if ($id === '*') {
269
+            unset($GLOBALS['autoriser_exception'][$faire][$type]);
270
+            unset($autorisation[$faire][$type]);
271
+        }
272
+        else {
273
+            unset($GLOBALS['autoriser_exception'][$faire][$type][$id]);
274
+            unset($autorisation[$faire][$type][$id]);
275
+        }
276
+    }
277
+
278
+    return false;
279 279
 }
280 280
 
281 281
 
@@ -294,9 +294,9 @@  discard block
 block discarded – undo
294 294
  * @return bool true s'il a le droit, false sinon
295 295
  **/
296 296
 function autoriser_defaut_dist(string $faire, string $type, $id, array $qui, array $opt): bool {
297
-	return
298
-		$qui['statut'] === '0minirezo'
299
-		and !$qui['restreint'];
297
+    return
298
+        $qui['statut'] === '0minirezo'
299
+        and !$qui['restreint'];
300 300
 }
301 301
 
302 302
 /**
@@ -316,10 +316,10 @@  discard block
 block discarded – undo
316 316
  * @return bool true s'il a le droit, false sinon
317 317
  */
318 318
 function autoriser_loger_dist(string $faire, string $type, $id, array $qui, array $opt): bool {
319
-	if ($qui['statut'] === '5poubelle') {
320
-		return false;
321
-	}
322
-	return true;
319
+    if ($qui['statut'] === '5poubelle') {
320
+        return false;
321
+    }
322
+    return true;
323 323
 }
324 324
 
325 325
 /**
@@ -335,7 +335,7 @@  discard block
 block discarded – undo
335 335
  * @return bool true s'il a le droit, false sinon
336 336
  **/
337 337
 function autoriser_ecrire_dist(string $faire, string $type, $id, array $qui, array $opt): bool {
338
-	return isset($qui['statut']) and in_array($qui['statut'], ['0minirezo', '1comite']);
338
+    return isset($qui['statut']) and in_array($qui['statut'], ['0minirezo', '1comite']);
339 339
 }
340 340
 
341 341
 /**
@@ -354,7 +354,7 @@  discard block
 block discarded – undo
354 354
  * @return bool true s'il a le droit, false sinon
355 355
  **/
356 356
 function autoriser_creer_dist(string $faire, string $type, $id, array $qui, array $opt): bool {
357
-	return in_array($qui['statut'], ['0minirezo', '1comite']);
357
+    return in_array($qui['statut'], ['0minirezo', '1comite']);
358 358
 }
359 359
 
360 360
 /**
@@ -374,18 +374,18 @@  discard block
 block discarded – undo
374 374
  **/
375 375
 function autoriser_previsualiser_dist(string $faire, string $type, $id, array $qui, array $opt): bool {
376 376
 
377
-	// Le visiteur a-t-il un statut prevu par la config ?
378
-	if (strpos($GLOBALS['meta']['preview'], ',' . $qui['statut'] . ',') !== false) {
379
-		return test_previsualiser_objet_champ($type, $id, $qui, $opt);
380
-	}
377
+    // Le visiteur a-t-il un statut prevu par la config ?
378
+    if (strpos($GLOBALS['meta']['preview'], ',' . $qui['statut'] . ',') !== false) {
379
+        return test_previsualiser_objet_champ($type, $id, $qui, $opt);
380
+    }
381 381
 
382
-	// A-t-on un token de prévisualisation valable ?
383
-	include_spip('inc/securiser_action');
384
-	if (decrire_token_previsu()) {
385
-		return true;
386
-	}
382
+    // A-t-on un token de prévisualisation valable ?
383
+    include_spip('inc/securiser_action');
384
+    if (decrire_token_previsu()) {
385
+        return true;
386
+    }
387 387
 
388
-	return false;
388
+    return false;
389 389
 }
390 390
 
391 391
 /**
@@ -414,58 +414,58 @@  discard block
 block discarded – undo
414 414
  */
415 415
 function test_previsualiser_objet_champ(string $type = '', $id = null, array $qui = [], array $opt = []): bool {
416 416
 
417
-	// si pas de type et statut fourni, c'est une autorisation generale => OK
418
-	if (!$type) {
419
-		return true;
420
-	}
421
-
422
-	include_spip('base/objets');
423
-	$infos = lister_tables_objets_sql(table_objet_sql($type));
424
-	if (isset($infos['statut'])) {
425
-		foreach ($infos['statut'] as $c) {
426
-			if (isset($c['publie'])) {
427
-				if (!isset($c['previsu'])) {
428
-					return false;
429
-				} // pas de previsu definie => NIET
430
-				$champ = $c['champ'];
431
-				if (!isset($opt[$champ])) {
432
-					return false;
433
-				} // pas de champ passe a la demande => NIET
434
-				$previsu = explode(',', $c['previsu']);
435
-				// regarder si ce statut est autorise pour l'auteur
436
-				if (in_array($opt[$champ] . '/auteur', $previsu)) {
437
-					// retrouver l’id_auteur qui a filé un lien de prévisu éventuellement,
438
-					// sinon l’auteur en session
439
-					include_spip('inc/securiser_action');
440
-					if ($desc = decrire_token_previsu()) {
441
-						$id_auteur = $desc['id_auteur'];
442
-					} elseif (isset($GLOBALS['visiteur_session']['id_auteur'])) {
443
-						$id_auteur = intval($GLOBALS['visiteur_session']['id_auteur']);
444
-					} else {
445
-						$id_auteur = null;
446
-					}
447
-
448
-					if (!$id_auteur) {
449
-						return false;
450
-					} elseif (autoriser('previsualiser' . $opt[$champ], $type, 0, $id_auteur)) {
451
-						// dans ce cas (admin en general), pas de filtrage sur ce statut
452
-					} elseif (
453
-						!sql_countsel(
454
-							'spip_auteurs_liens',
455
-							'id_auteur=' . intval($id_auteur) . ' AND objet=' . sql_quote($type) . ' AND id_objet=' . intval($id)
456
-						)
457
-					) {
458
-						return false;
459
-					} // pas auteur de cet objet => NIET
460
-				} elseif (!in_array($opt[$champ], $previsu)) {
461
-					// le statut n'est pas dans ceux definis par la previsu => NIET
462
-					return false;
463
-				}
464
-			}
465
-		}
466
-	}
467
-
468
-	return true;
417
+    // si pas de type et statut fourni, c'est une autorisation generale => OK
418
+    if (!$type) {
419
+        return true;
420
+    }
421
+
422
+    include_spip('base/objets');
423
+    $infos = lister_tables_objets_sql(table_objet_sql($type));
424
+    if (isset($infos['statut'])) {
425
+        foreach ($infos['statut'] as $c) {
426
+            if (isset($c['publie'])) {
427
+                if (!isset($c['previsu'])) {
428
+                    return false;
429
+                } // pas de previsu definie => NIET
430
+                $champ = $c['champ'];
431
+                if (!isset($opt[$champ])) {
432
+                    return false;
433
+                } // pas de champ passe a la demande => NIET
434
+                $previsu = explode(',', $c['previsu']);
435
+                // regarder si ce statut est autorise pour l'auteur
436
+                if (in_array($opt[$champ] . '/auteur', $previsu)) {
437
+                    // retrouver l’id_auteur qui a filé un lien de prévisu éventuellement,
438
+                    // sinon l’auteur en session
439
+                    include_spip('inc/securiser_action');
440
+                    if ($desc = decrire_token_previsu()) {
441
+                        $id_auteur = $desc['id_auteur'];
442
+                    } elseif (isset($GLOBALS['visiteur_session']['id_auteur'])) {
443
+                        $id_auteur = intval($GLOBALS['visiteur_session']['id_auteur']);
444
+                    } else {
445
+                        $id_auteur = null;
446
+                    }
447
+
448
+                    if (!$id_auteur) {
449
+                        return false;
450
+                    } elseif (autoriser('previsualiser' . $opt[$champ], $type, 0, $id_auteur)) {
451
+                        // dans ce cas (admin en general), pas de filtrage sur ce statut
452
+                    } elseif (
453
+                        !sql_countsel(
454
+                            'spip_auteurs_liens',
455
+                            'id_auteur=' . intval($id_auteur) . ' AND objet=' . sql_quote($type) . ' AND id_objet=' . intval($id)
456
+                        )
457
+                    ) {
458
+                        return false;
459
+                    } // pas auteur de cet objet => NIET
460
+                } elseif (!in_array($opt[$champ], $previsu)) {
461
+                    // le statut n'est pas dans ceux definis par la previsu => NIET
462
+                    return false;
463
+                }
464
+            }
465
+        }
466
+    }
467
+
468
+    return true;
469 469
 }
470 470
 
471 471
 /**
@@ -481,51 +481,51 @@  discard block
 block discarded – undo
481 481
  * @return bool true s'il a le droit, false sinon
482 482
  **/
483 483
 function autoriser_changerlangue_dist(string $faire, string $type, $id, array $qui, array $opt): bool {
484
-	$multi_objets = explode(',', lire_config('multi_objets'));
485
-	$gerer_trad_objets = explode(',', lire_config('gerer_trad_objets'));
486
-	$table = table_objet_sql($type);
487
-	if (
488
-		in_array($table, $multi_objets)
489
-		or in_array($table, $gerer_trad_objets)
490
-	) { // affichage du formulaire si la configuration l'accepte
491
-		$multi_secteurs = lire_config('multi_secteurs');
492
-		$champs = objet_info($type, 'field');
493
-		if (
494
-			$multi_secteurs === 'oui'
495
-			and array_key_exists('id_rubrique', $champs)
496
-		) {
497
-			// multilinguisme par secteur et objet rattaché à une rubrique
498
-			$primary = id_table_objet($type);
499
-			if ($table != 'spip_rubriques') {
500
-				$id_rubrique = sql_getfetsel('id_rubrique', "$table", "$primary=" . intval($id));
501
-			} else {
502
-				$id_rubrique = $id;
503
-			}
504
-			$id_secteur = sql_getfetsel('id_secteur', 'spip_rubriques', 'id_rubrique=' . intval($id_rubrique));
505
-			if (!$id_secteur > 0) {
506
-				$id_secteur = $id_rubrique;
507
-			}
508
-			$langue_secteur = sql_getfetsel('lang', 'spip_rubriques', 'id_rubrique=' . intval($id_secteur));
509
-			$langue_objet = sql_getfetsel('lang', "$table", "$primary=" . intval($id));
510
-			if ($langue_secteur != $langue_objet) {
511
-				// configuration incohérente, on laisse l'utilisateur corriger la situation
512
-				return true;
513
-			}
514
-			if ($table != 'spip_rubriques') { // le choix de la langue se fait seulement sur les rubriques
515
-				return false;
516
-			} else {
517
-				$id_parent = sql_getfetsel('id_parent', 'spip_rubriques', 'id_rubrique=' . intval($id));
518
-				if ($id_parent != 0) {
519
-					// sous-rubriques : pas de choix de langue
520
-					return false;
521
-				}
522
-			}
523
-		}
524
-	} else {
525
-		return false;
526
-	}
527
-
528
-	return autoriser('modifier', $type, $id, $qui, $opt);
484
+    $multi_objets = explode(',', lire_config('multi_objets'));
485
+    $gerer_trad_objets = explode(',', lire_config('gerer_trad_objets'));
486
+    $table = table_objet_sql($type);
487
+    if (
488
+        in_array($table, $multi_objets)
489
+        or in_array($table, $gerer_trad_objets)
490
+    ) { // affichage du formulaire si la configuration l'accepte
491
+        $multi_secteurs = lire_config('multi_secteurs');
492
+        $champs = objet_info($type, 'field');
493
+        if (
494
+            $multi_secteurs === 'oui'
495
+            and array_key_exists('id_rubrique', $champs)
496
+        ) {
497
+            // multilinguisme par secteur et objet rattaché à une rubrique
498
+            $primary = id_table_objet($type);
499
+            if ($table != 'spip_rubriques') {
500
+                $id_rubrique = sql_getfetsel('id_rubrique', "$table", "$primary=" . intval($id));
501
+            } else {
502
+                $id_rubrique = $id;
503
+            }
504
+            $id_secteur = sql_getfetsel('id_secteur', 'spip_rubriques', 'id_rubrique=' . intval($id_rubrique));
505
+            if (!$id_secteur > 0) {
506
+                $id_secteur = $id_rubrique;
507
+            }
508
+            $langue_secteur = sql_getfetsel('lang', 'spip_rubriques', 'id_rubrique=' . intval($id_secteur));
509
+            $langue_objet = sql_getfetsel('lang', "$table", "$primary=" . intval($id));
510
+            if ($langue_secteur != $langue_objet) {
511
+                // configuration incohérente, on laisse l'utilisateur corriger la situation
512
+                return true;
513
+            }
514
+            if ($table != 'spip_rubriques') { // le choix de la langue se fait seulement sur les rubriques
515
+                return false;
516
+            } else {
517
+                $id_parent = sql_getfetsel('id_parent', 'spip_rubriques', 'id_rubrique=' . intval($id));
518
+                if ($id_parent != 0) {
519
+                    // sous-rubriques : pas de choix de langue
520
+                    return false;
521
+                }
522
+            }
523
+        }
524
+    } else {
525
+        return false;
526
+    }
527
+
528
+    return autoriser('modifier', $type, $id, $qui, $opt);
529 529
 }
530 530
 
531 531
 /**
@@ -541,7 +541,7 @@  discard block
 block discarded – undo
541 541
  * @return bool true s'il a le droit, false sinon
542 542
  **/
543 543
 function autoriser_changertraduction_dist(string $faire, string $type, $id, array $qui, array $opt): bool {
544
-	return autoriser('modifier', $type, $id, $qui, $opt);
544
+    return autoriser('modifier', $type, $id, $qui, $opt);
545 545
 }
546 546
 
547 547
 /**
@@ -557,41 +557,41 @@  discard block
 block discarded – undo
557 557
  * @return bool true s'il a le droit, false sinon
558 558
  **/
559 559
 function autoriser_dater_dist(string $faire, string $type, $id, array $qui, array $opt): bool {
560
-	$table = table_objet($type);
561
-	$trouver_table = charger_fonction('trouver_table', 'base');
562
-	$desc = $trouver_table($table);
563
-	if (!$desc) {
564
-		return false;
565
-	}
566
-
567
-	if (!isset($opt['statut'])) {
568
-		if (isset($desc['field']['statut'])) {
569
-			$statut = sql_getfetsel('statut', $desc['table'], id_table_objet($type) . '=' . intval($id));
570
-		} else {
571
-			$statut = 'publie';
572
-		} // pas de statut => publie
573
-	} else {
574
-		$statut = $opt['statut'];
575
-	}
576
-
577
-	// Liste des statuts publiés pour cet objet
578
-	if (isset($desc['statut'][0]['publie'])) {
579
-		$statuts_publies = explode(',', $desc['statut'][0]['publie']);
580
-	}
581
-	// Sinon en dur le statut "publie"
582
-	else {
583
-		$statuts_publies = ['publie'];
584
-	}
585
-
586
-	if (
587
-		in_array($statut, $statuts_publies)
588
-		// Ou cas particulier géré en dur ici pour les articles
589
-		or ($statut === 'prop' and $type === 'article' and $GLOBALS['meta']['post_dates'] === 'non')
590
-	) {
591
-		return autoriser('modifier', $type, $id);
592
-	}
593
-
594
-	return false;
560
+    $table = table_objet($type);
561
+    $trouver_table = charger_fonction('trouver_table', 'base');
562
+    $desc = $trouver_table($table);
563
+    if (!$desc) {
564
+        return false;
565
+    }
566
+
567
+    if (!isset($opt['statut'])) {
568
+        if (isset($desc['field']['statut'])) {
569
+            $statut = sql_getfetsel('statut', $desc['table'], id_table_objet($type) . '=' . intval($id));
570
+        } else {
571
+            $statut = 'publie';
572
+        } // pas de statut => publie
573
+    } else {
574
+        $statut = $opt['statut'];
575
+    }
576
+
577
+    // Liste des statuts publiés pour cet objet
578
+    if (isset($desc['statut'][0]['publie'])) {
579
+        $statuts_publies = explode(',', $desc['statut'][0]['publie']);
580
+    }
581
+    // Sinon en dur le statut "publie"
582
+    else {
583
+        $statuts_publies = ['publie'];
584
+    }
585
+
586
+    if (
587
+        in_array($statut, $statuts_publies)
588
+        // Ou cas particulier géré en dur ici pour les articles
589
+        or ($statut === 'prop' and $type === 'article' and $GLOBALS['meta']['post_dates'] === 'non')
590
+    ) {
591
+        return autoriser('modifier', $type, $id);
592
+    }
593
+
594
+    return false;
595 595
 }
596 596
 
597 597
 /**
@@ -610,7 +610,7 @@  discard block
 block discarded – undo
610 610
  * @return bool true s'il a le droit, false sinon
611 611
  **/
612 612
 function autoriser_instituer_dist(string $faire, string $type, $id, array $qui, array $opt): bool {
613
-	return autoriser('modifier', $type, $id, $qui, $opt);
613
+    return autoriser('modifier', $type, $id, $qui, $opt);
614 614
 }
615 615
 
616 616
 /**
@@ -628,12 +628,12 @@  discard block
 block discarded – undo
628 628
  * @return bool true s'il a le droit, false sinon
629 629
  **/
630 630
 function autoriser_rubrique_publierdans_dist(string $faire, string $type, $id, array $qui, array $opt): bool {
631
-	return
632
-		($qui['statut'] === '0minirezo')
633
-		and (
634
-			!$qui['restreint'] or !$id
635
-			or in_array($id, $qui['restreint'])
636
-		);
631
+    return
632
+        ($qui['statut'] === '0minirezo')
633
+        and (
634
+            !$qui['restreint'] or !$id
635
+            or in_array($id, $qui['restreint'])
636
+        );
637 637
 }
638 638
 
639 639
 /**
@@ -651,12 +651,12 @@  discard block
 block discarded – undo
651 651
  * @return bool true s'il a le droit, false sinon
652 652
  **/
653 653
 function autoriser_rubrique_creer_dist(string $faire, string $type, $id, array $qui, array $opt): bool {
654
-	if (!empty($opt['id_parent'])) {
655
-		return autoriser('creerrubriquedans', 'rubrique', $opt['id_parent'], $qui);
656
-	}
657
-	else {
658
-		return autoriser('defaut', null, 0, $qui, $opt);
659
-	}
654
+    if (!empty($opt['id_parent'])) {
655
+        return autoriser('creerrubriquedans', 'rubrique', $opt['id_parent'], $qui);
656
+    }
657
+    else {
658
+        return autoriser('defaut', null, 0, $qui, $opt);
659
+    }
660 660
 }
661 661
 
662 662
 /**
@@ -674,10 +674,10 @@  discard block
 block discarded – undo
674 674
  * @return bool true s'il a le droit, false sinon
675 675
  **/
676 676
 function autoriser_rubrique_creerrubriquedans_dist(string $faire, string $type, $id, array $qui, array $opt): bool {
677
-	return
678
-		($id or ($qui['statut'] === '0minirezo' and !$qui['restreint']))
679
-		and autoriser('voir', 'rubrique', $id)
680
-		and autoriser('publierdans', 'rubrique', $id);
677
+    return
678
+        ($id or ($qui['statut'] === '0minirezo' and !$qui['restreint']))
679
+        and autoriser('voir', 'rubrique', $id)
680
+        and autoriser('publierdans', 'rubrique', $id);
681 681
 }
682 682
 
683 683
 /**
@@ -695,10 +695,10 @@  discard block
 block discarded – undo
695 695
  * @return bool true s'il a le droit, false sinon
696 696
  **/
697 697
 function autoriser_rubrique_creerarticledans_dist(string $faire, string $type, $id, array $qui, array $opt): bool {
698
-	return
699
-		$id
700
-		and autoriser('voir', 'rubrique', $id)
701
-		and autoriser('creer', 'article');
698
+    return
699
+        $id
700
+        and autoriser('voir', 'rubrique', $id)
701
+        and autoriser('creer', 'article');
702 702
 }
703 703
 
704 704
 
@@ -717,8 +717,8 @@  discard block
 block discarded – undo
717 717
  * @return bool true s'il a le droit, false sinon
718 718
  **/
719 719
 function autoriser_rubrique_modifier_dist(string $faire, string $type, $id, array $qui, array $opt): bool {
720
-	return
721
-		autoriser('publierdans', 'rubrique', $id, $qui, $opt);
720
+    return
721
+        autoriser('publierdans', 'rubrique', $id, $qui, $opt);
722 722
 }
723 723
 
724 724
 /**
@@ -736,29 +736,29 @@  discard block
 block discarded – undo
736 736
  * @return bool true s'il a le droit, false sinon
737 737
  **/
738 738
 function autoriser_rubrique_supprimer_dist(string $faire, string $type, $id, array $qui, array $opt): bool {
739
-	if (!$id = intval($id)) {
740
-		return false;
741
-	}
739
+    if (!$id = intval($id)) {
740
+        return false;
741
+    }
742 742
 
743
-	if (sql_countsel('spip_rubriques', 'id_parent=' . intval($id))) {
744
-		return false;
745
-	}
743
+    if (sql_countsel('spip_rubriques', 'id_parent=' . intval($id))) {
744
+        return false;
745
+    }
746 746
 
747
-	if (sql_countsel('spip_articles', 'id_rubrique=' . intval($id) . " AND (statut<>'poubelle')")) {
748
-		return false;
749
-	}
747
+    if (sql_countsel('spip_articles', 'id_rubrique=' . intval($id) . " AND (statut<>'poubelle')")) {
748
+        return false;
749
+    }
750 750
 
751
-	$compte = pipeline(
752
-		'objet_compte_enfants',
753
-		['args' => ['objet' => 'rubrique', 'id_objet' => $id], 'data' => []]
754
-	);
755
-	foreach ($compte as $objet => $n) {
756
-		if ($n) {
757
-			return false;
758
-		}
759
-	}
751
+    $compte = pipeline(
752
+        'objet_compte_enfants',
753
+        ['args' => ['objet' => 'rubrique', 'id_objet' => $id], 'data' => []]
754
+    );
755
+    foreach ($compte as $objet => $n) {
756
+        if ($n) {
757
+            return false;
758
+        }
759
+    }
760 760
 
761
-	return autoriser('modifier', 'rubrique', $id);
761
+    return autoriser('modifier', 'rubrique', $id);
762 762
 }
763 763
 
764 764
 
@@ -778,23 +778,23 @@  discard block
 block discarded – undo
778 778
  * @return bool true s'il a le droit, false sinon
779 779
  **/
780 780
 function autoriser_article_modifier_dist(string $faire, string $type, $id, array $qui, array $opt): bool {
781
-	if (!$id) {
782
-		return false;
783
-	}
784
-	$r = sql_fetsel('id_rubrique,statut', 'spip_articles', 'id_article=' . sql_quote($id));
785
-
786
-	return
787
-		$r
788
-		and
789
-		(
790
-			autoriser('publierdans', 'rubrique', $r['id_rubrique'], $qui, $opt)
791
-			or (
792
-				(!isset($opt['statut']) or !in_array($opt['statut'], ['publie', 'refuse'], true))
793
-				and in_array($qui['statut'], ['0minirezo', '1comite'])
794
-				and in_array($r['statut'], ['prop', 'prepa', 'poubelle'])
795
-				and auteurs_objet('article', $id, 'id_auteur=' . $qui['id_auteur'])
796
-			)
797
-		);
781
+    if (!$id) {
782
+        return false;
783
+    }
784
+    $r = sql_fetsel('id_rubrique,statut', 'spip_articles', 'id_article=' . sql_quote($id));
785
+
786
+    return
787
+        $r
788
+        and
789
+        (
790
+            autoriser('publierdans', 'rubrique', $r['id_rubrique'], $qui, $opt)
791
+            or (
792
+                (!isset($opt['statut']) or !in_array($opt['statut'], ['publie', 'refuse'], true))
793
+                and in_array($qui['statut'], ['0minirezo', '1comite'])
794
+                and in_array($r['statut'], ['prop', 'prepa', 'poubelle'])
795
+                and auteurs_objet('article', $id, 'id_auteur=' . $qui['id_auteur'])
796
+            )
797
+        );
798 798
 }
799 799
 
800 800
 /**
@@ -812,13 +812,13 @@  discard block
 block discarded – undo
812 812
  * @return bool true s'il a le droit, false sinon
813 813
  **/
814 814
 function autoriser_article_creer_dist(string $faire, string $type, $id, array $qui, array $opt): bool {
815
-	if (!empty($opt['id_parent'])) {
816
-		// creerarticledans rappelle autoriser(creer,article) sans id, donc on verifiera condition du else aussi
817
-		return autoriser('creerarticledans', 'rubrique', $opt['id_parent'], $qui);
818
-	}
819
-	else {
820
-		return (sql_countsel('spip_rubriques') > 0 and in_array($qui['statut'], ['0minirezo', '1comite']));
821
-	}
815
+    if (!empty($opt['id_parent'])) {
816
+        // creerarticledans rappelle autoriser(creer,article) sans id, donc on verifiera condition du else aussi
817
+        return autoriser('creerarticledans', 'rubrique', $opt['id_parent'], $qui);
818
+    }
819
+    else {
820
+        return (sql_countsel('spip_rubriques') > 0 and in_array($qui['statut'], ['0minirezo', '1comite']));
821
+    }
822 822
 }
823 823
 
824 824
 /**
@@ -840,28 +840,28 @@  discard block
 block discarded – undo
840 840
  * @return bool true s'il a le droit, false sinon
841 841
  */
842 842
 function autoriser_article_voir_dist(string $faire, string $type, $id, array $qui, array $opt): bool {
843
-	if ($qui['statut'] === '0minirezo') {
844
-		return true;
845
-	}
846
-	// cas des articles : depend du statut de l'article et de l'auteur
847
-	if (isset($opt['statut'])) {
848
-		$statut = $opt['statut'];
849
-	} else {
850
-		if (!$id) {
851
-			return false;
852
-		}
853
-		$statut = sql_getfetsel('statut', 'spip_articles', 'id_article=' . intval($id));
854
-	}
855
-
856
-	return
857
-		// si on est pas auteur de l'article,
858
-		// seuls les propose et publies sont visibles
859
-		in_array($statut, ['prop', 'publie'])
860
-		// sinon si on est auteur, on a le droit de le voir, evidemment !
861
-		or
862
-		($id
863
-			and $qui['id_auteur']
864
-			and auteurs_objet('article', $id, 'id_auteur=' . $qui['id_auteur']));
843
+    if ($qui['statut'] === '0minirezo') {
844
+        return true;
845
+    }
846
+    // cas des articles : depend du statut de l'article et de l'auteur
847
+    if (isset($opt['statut'])) {
848
+        $statut = $opt['statut'];
849
+    } else {
850
+        if (!$id) {
851
+            return false;
852
+        }
853
+        $statut = sql_getfetsel('statut', 'spip_articles', 'id_article=' . intval($id));
854
+    }
855
+
856
+    return
857
+        // si on est pas auteur de l'article,
858
+        // seuls les propose et publies sont visibles
859
+        in_array($statut, ['prop', 'publie'])
860
+        // sinon si on est auteur, on a le droit de le voir, evidemment !
861
+        or
862
+        ($id
863
+            and $qui['id_auteur']
864
+            and auteurs_objet('article', $id, 'id_auteur=' . $qui['id_auteur']));
865 865
 }
866 866
 
867 867
 
@@ -880,24 +880,24 @@  discard block
 block discarded – undo
880 880
  * @return bool true s'il a le droit, false sinon
881 881
  **/
882 882
 function autoriser_voir_dist(string $faire, string $type, $id, array $qui, array $opt): bool {
883
-	# securite, mais on aurait pas du arriver ici !
884
-	if (
885
-		function_exists($f = 'autoriser_' . $type . '_voir')
886
-		or function_exists($f = 'autoriser_' . $type . '_voir_dist')
887
-	) {
888
-		return $f($faire, $type, $id, $qui, $opt);
889
-	}
883
+    # securite, mais on aurait pas du arriver ici !
884
+    if (
885
+        function_exists($f = 'autoriser_' . $type . '_voir')
886
+        or function_exists($f = 'autoriser_' . $type . '_voir_dist')
887
+    ) {
888
+        return $f($faire, $type, $id, $qui, $opt);
889
+    }
890 890
 
891
-	if ($qui['statut'] === '0minirezo') {
892
-		return true;
893
-	}
894
-	// admins et redacteurs peuvent voir un auteur
895
-	if ($type === 'auteur') {
896
-		return in_array($qui['statut'], ['0minirezo', '1comite']);
897
-	}
898
-	// sinon par defaut tout est visible
899
-	// sauf cas particuliers traites separemment (ie article)
900
-	return true;
891
+    if ($qui['statut'] === '0minirezo') {
892
+        return true;
893
+    }
894
+    // admins et redacteurs peuvent voir un auteur
895
+    if ($type === 'auteur') {
896
+        return in_array($qui['statut'], ['0minirezo', '1comite']);
897
+    }
898
+    // sinon par defaut tout est visible
899
+    // sauf cas particuliers traites separemment (ie article)
900
+    return true;
901 901
 }
902 902
 
903 903
 
@@ -920,12 +920,12 @@  discard block
 block discarded – undo
920 920
  * @return bool true s'il a le droit, false sinon
921 921
  **/
922 922
 function autoriser_webmestre_dist(string $faire, string $type, $id, array $qui, array $opt): bool {
923
-	return
924
-		(defined('_ID_WEBMESTRES') ?
925
-			in_array($qui['id_auteur'], explode(':', _ID_WEBMESTRES))
926
-			: $qui['webmestre'] === 'oui')
927
-		and $qui['statut'] === '0minirezo'
928
-		and !$qui['restreint'];
923
+    return
924
+        (defined('_ID_WEBMESTRES') ?
925
+            in_array($qui['id_auteur'], explode(':', _ID_WEBMESTRES))
926
+            : $qui['webmestre'] === 'oui')
927
+        and $qui['statut'] === '0minirezo'
928
+        and !$qui['restreint'];
929 929
 }
930 930
 
931 931
 /**
@@ -943,9 +943,9 @@  discard block
 block discarded – undo
943 943
  * @return bool true s'il a le droit, false sinon
944 944
  **/
945 945
 function autoriser_configurer_dist(string $faire, string $type, $id, array $qui, array $opt): bool {
946
-	return
947
-		$qui['statut'] === '0minirezo'
948
-		and !$qui['restreint'];
946
+    return
947
+        $qui['statut'] === '0minirezo'
948
+        and !$qui['restreint'];
949 949
 }
950 950
 
951 951
 /**
@@ -963,8 +963,8 @@  discard block
 block discarded – undo
963 963
  * @return bool true s'il a le droit, false sinon
964 964
  **/
965 965
 function autoriser_sauvegarder_dist(string $faire, string $type, $id, array $qui, array $opt): bool {
966
-	return
967
-		$qui['statut'] === '0minirezo';
966
+    return
967
+        $qui['statut'] === '0minirezo';
968 968
 }
969 969
 
970 970
 /**
@@ -982,7 +982,7 @@  discard block
 block discarded – undo
982 982
  * @return bool true s'il a le droit, false sinon
983 983
  **/
984 984
 function autoriser_detruire_dist(string $faire, string $type, $id, array $qui, array $opt): bool {
985
-	return autoriser('webmestre', null, 0, $qui, $opt);
985
+    return autoriser('webmestre', null, 0, $qui, $opt);
986 986
 }
987 987
 
988 988
 /**
@@ -1001,23 +1001,23 @@  discard block
 block discarded – undo
1001 1001
  * @return bool true s'il a le droit, false sinon
1002 1002
  **/
1003 1003
 function autoriser_auteur_previsualiser_dist(string $faire, string $type, $id, array $qui, array $opt): bool {
1004
-	// les admins peuvent "previsualiser" une page auteur
1005
-	if (
1006
-		$qui['statut'] === '0minirezo'
1007
-		and !$qui['restreint']
1008
-	) {
1009
-		return true;
1010
-	} elseif ($id === 0) {
1011
-		return false;
1012
-	}
1013
-	// "Voir en ligne" si l'auteur a un article publie
1014
-	$n = sql_fetsel(
1015
-		'A.id_article',
1016
-		'spip_auteurs_liens AS L LEFT JOIN spip_articles AS A ON (L.objet=\'article\' AND L.id_objet=A.id_article)',
1017
-		"A.statut='publie' AND L.id_auteur=" . sql_quote($id)
1018
-	);
1004
+    // les admins peuvent "previsualiser" une page auteur
1005
+    if (
1006
+        $qui['statut'] === '0minirezo'
1007
+        and !$qui['restreint']
1008
+    ) {
1009
+        return true;
1010
+    } elseif ($id === 0) {
1011
+        return false;
1012
+    }
1013
+    // "Voir en ligne" si l'auteur a un article publie
1014
+    $n = sql_fetsel(
1015
+        'A.id_article',
1016
+        'spip_auteurs_liens AS L LEFT JOIN spip_articles AS A ON (L.objet=\'article\' AND L.id_objet=A.id_article)',
1017
+        "A.statut='publie' AND L.id_auteur=" . sql_quote($id)
1018
+    );
1019 1019
 
1020
-	return $n ? true : false;
1020
+    return $n ? true : false;
1021 1021
 }
1022 1022
 
1023 1023
 
@@ -1046,7 +1046,7 @@  discard block
 block discarded – undo
1046 1046
  * @return bool true s'il a le droit, false sinon
1047 1047
  **/
1048 1048
 function autoriser_auteur_creer_dist(string $faire, string $type, $id, array $qui, array $opt): bool {
1049
-	return ($qui['statut'] === '0minirezo');
1049
+    return ($qui['statut'] === '0minirezo');
1050 1050
 }
1051 1051
 
1052 1052
 
@@ -1067,75 +1067,75 @@  discard block
 block discarded – undo
1067 1067
  * @return bool true s'il a le droit, false sinon
1068 1068
  **/
1069 1069
 function autoriser_auteur_modifier_dist(string $faire, string $type, $id, array $qui, array $opt): bool {
1070
-	$id = intval($id);
1071
-
1072
-	// Si pas admin : seulement le droit de modifier ses donnees perso, mais pas statut ni login
1073
-	// la modif de l'email doit etre verifiee ou notifiee si possible, mais c'est a l'interface de gerer ca
1074
-	if (!in_array($qui['statut'], ['0minirezo'])) {
1075
-		if (
1076
-			$id == $qui['id_auteur']
1077
-			&& empty($opt['statut'])
1078
-			&& empty($opt['webmestre'])
1079
-			&& empty($opt['restreintes'])
1080
-			&& empty($opt['login'])
1081
-		) {
1082
-			return true;
1083
-		}
1084
-		return false;
1085
-	}
1086
-
1087
-	// Un admin restreint peut modifier/creer un auteur non-admin mais il
1088
-	// n'a le droit ni de le promouvoir admin, ni de changer les rubriques
1089
-	if ($qui['restreint']) {
1090
-		if (isset($opt['webmestre']) and $opt['webmestre']) {
1091
-			return false;
1092
-		} elseif (
1093
-			(isset($opt['statut']) and ($opt['statut'] === '0minirezo'))
1094
-			or (isset($opt['restreintes']) and $opt['restreintes'])
1095
-		) {
1096
-			return false;
1097
-		} else {
1098
-			if ($id == $qui['id_auteur']) {
1099
-				if (isset($opt['statut']) and $opt['statut']) {
1100
-					return false;
1101
-				} else {
1102
-					return true;
1103
-				}
1104
-			} else {
1105
-				if ($id_auteur = intval($id)) {
1106
-					$t = sql_fetsel('statut', 'spip_auteurs', "id_auteur=$id_auteur");
1107
-					if ($t and $t['statut'] != '0minirezo') {
1108
-						return true;
1109
-					} else {
1110
-						return false;
1111
-					}
1112
-				} // id = 0 => creation
1113
-				else {
1114
-					return true;
1115
-				}
1116
-			}
1117
-		}
1118
-	}
1119
-
1120
-	// Un admin complet fait ce qu'il veut
1121
-	// sauf se degrader
1122
-	if ($id == $qui['id_auteur'] && (isset($opt['statut']) and $opt['statut'])) {
1123
-		return false;
1124
-	} elseif (
1125
-		isset($opt['webmestre'])
1126
-				and $opt['webmestre']
1127
-				and (defined('_ID_WEBMESTRES')
1128
-				or !autoriser('webmestre'))
1129
-	) {
1130
-		// et toucher au statut webmestre si il ne l'est pas lui meme
1131
-		// ou si les webmestres sont fixes par constante (securite)
1132
-		return false;
1133
-	} // et modifier un webmestre si il ne l'est pas lui meme
1134
-	elseif (intval($id) and !autoriser('webmestre') and autoriser('webmestre', '', 0, $id)) {
1135
-		return false;
1136
-	} else {
1137
-		return true;
1138
-	}
1070
+    $id = intval($id);
1071
+
1072
+    // Si pas admin : seulement le droit de modifier ses donnees perso, mais pas statut ni login
1073
+    // la modif de l'email doit etre verifiee ou notifiee si possible, mais c'est a l'interface de gerer ca
1074
+    if (!in_array($qui['statut'], ['0minirezo'])) {
1075
+        if (
1076
+            $id == $qui['id_auteur']
1077
+            && empty($opt['statut'])
1078
+            && empty($opt['webmestre'])
1079
+            && empty($opt['restreintes'])
1080
+            && empty($opt['login'])
1081
+        ) {
1082
+            return true;
1083
+        }
1084
+        return false;
1085
+    }
1086
+
1087
+    // Un admin restreint peut modifier/creer un auteur non-admin mais il
1088
+    // n'a le droit ni de le promouvoir admin, ni de changer les rubriques
1089
+    if ($qui['restreint']) {
1090
+        if (isset($opt['webmestre']) and $opt['webmestre']) {
1091
+            return false;
1092
+        } elseif (
1093
+            (isset($opt['statut']) and ($opt['statut'] === '0minirezo'))
1094
+            or (isset($opt['restreintes']) and $opt['restreintes'])
1095
+        ) {
1096
+            return false;
1097
+        } else {
1098
+            if ($id == $qui['id_auteur']) {
1099
+                if (isset($opt['statut']) and $opt['statut']) {
1100
+                    return false;
1101
+                } else {
1102
+                    return true;
1103
+                }
1104
+            } else {
1105
+                if ($id_auteur = intval($id)) {
1106
+                    $t = sql_fetsel('statut', 'spip_auteurs', "id_auteur=$id_auteur");
1107
+                    if ($t and $t['statut'] != '0minirezo') {
1108
+                        return true;
1109
+                    } else {
1110
+                        return false;
1111
+                    }
1112
+                } // id = 0 => creation
1113
+                else {
1114
+                    return true;
1115
+                }
1116
+            }
1117
+        }
1118
+    }
1119
+
1120
+    // Un admin complet fait ce qu'il veut
1121
+    // sauf se degrader
1122
+    if ($id == $qui['id_auteur'] && (isset($opt['statut']) and $opt['statut'])) {
1123
+        return false;
1124
+    } elseif (
1125
+        isset($opt['webmestre'])
1126
+                and $opt['webmestre']
1127
+                and (defined('_ID_WEBMESTRES')
1128
+                or !autoriser('webmestre'))
1129
+    ) {
1130
+        // et toucher au statut webmestre si il ne l'est pas lui meme
1131
+        // ou si les webmestres sont fixes par constante (securite)
1132
+        return false;
1133
+    } // et modifier un webmestre si il ne l'est pas lui meme
1134
+    elseif (intval($id) and !autoriser('webmestre') and autoriser('webmestre', '', 0, $id)) {
1135
+        return false;
1136
+    } else {
1137
+        return true;
1138
+    }
1139 1139
 }
1140 1140
 
1141 1141
 
@@ -1154,7 +1154,7 @@  discard block
 block discarded – undo
1154 1154
  * @return bool true s'il a le droit, false sinon
1155 1155
  **/
1156 1156
 function autoriser_associerauteurs_dist(string $faire, string $type, $id, array $qui, array $opt): bool {
1157
-	return autoriser('modifier', $type, $id, $qui, $opt);
1157
+    return autoriser('modifier', $type, $id, $qui, $opt);
1158 1158
 }
1159 1159
 
1160 1160
 
@@ -1173,7 +1173,7 @@  discard block
 block discarded – undo
1173 1173
  * @return bool true s'il a le droit, false sinon
1174 1174
  **/
1175 1175
 function autoriser_chargerftp_dist(string $faire, string $type, $id, array $qui, array $opt): bool {
1176
-	return $qui['statut'] === '0minirezo';
1176
+    return $qui['statut'] === '0minirezo';
1177 1177
 }
1178 1178
 
1179 1179
 /**
@@ -1191,7 +1191,7 @@  discard block
 block discarded – undo
1191 1191
  * @return bool true s'il a le droit, false sinon
1192 1192
  **/
1193 1193
 function autoriser_debug_dist(string $faire, string $type, $id, array $qui, array $opt): bool {
1194
-	return $qui['statut'] === '0minirezo';
1194
+    return $qui['statut'] === '0minirezo';
1195 1195
 }
1196 1196
 
1197 1197
 /**
@@ -1208,54 +1208,54 @@  discard block
 block discarded – undo
1208 1208
  * @return array          Liste des rubriques
1209 1209
  **/
1210 1210
 function liste_rubriques_auteur($id_auteur, $raz = false) {
1211
-	static $restreint = [];
1212
-
1213
-	if (!$id_auteur = intval($id_auteur)) {
1214
-		return [];
1215
-	}
1216
-	if ($raz) {
1217
-		unset($restreint[$id_auteur]);
1218
-	} elseif (isset($restreint[$id_auteur])) {
1219
-		return $restreint[$id_auteur];
1220
-	}
1221
-
1222
-	$rubriques = [];
1223
-	if (
1224
-		(!isset($GLOBALS['meta']['version_installee'])
1225
-		or $GLOBALS['meta']['version_installee'] > 16428)
1226
-		and $r = sql_allfetsel(
1227
-			'id_objet',
1228
-			'spip_auteurs_liens',
1229
-			'id_auteur=' . intval($id_auteur) . " AND objet='rubrique' AND id_objet!=0"
1230
-		)
1231
-		and is_countable($r) ? count($r) : 0
1232
-	) {
1233
-		$r = array_column($r, 'id_objet');
1234
-
1235
-		// recuperer toute la branche, au format chaine enumeration
1236
-		include_spip('inc/rubriques');
1237
-		$r = calcul_branche_in($r);
1238
-		$r = explode(',', $r);
1239
-
1240
-		// passer les rubriques en index, elimine les doublons
1241
-		$r = array_flip($r);
1242
-		// recuperer les index seuls
1243
-		$r = array_keys($r);
1244
-		// combiner pour avoir un tableau id_rubrique=>id_rubrique
1245
-		// est-ce vraiment utile ? (on preserve la forme donnee par le code precedent)
1246
-		$rubriques = array_combine($r, $r);
1247
-	}
1248
-
1249
-	// Affecter l'auteur session le cas echeant
1250
-	if (
1251
-		isset($GLOBALS['visiteur_session']['id_auteur'])
1252
-		and $GLOBALS['visiteur_session']['id_auteur'] == $id_auteur
1253
-	) {
1254
-		$GLOBALS['visiteur_session']['restreint'] = $rubriques;
1255
-	}
1256
-
1257
-
1258
-	return $restreint[$id_auteur] = $rubriques;
1211
+    static $restreint = [];
1212
+
1213
+    if (!$id_auteur = intval($id_auteur)) {
1214
+        return [];
1215
+    }
1216
+    if ($raz) {
1217
+        unset($restreint[$id_auteur]);
1218
+    } elseif (isset($restreint[$id_auteur])) {
1219
+        return $restreint[$id_auteur];
1220
+    }
1221
+
1222
+    $rubriques = [];
1223
+    if (
1224
+        (!isset($GLOBALS['meta']['version_installee'])
1225
+        or $GLOBALS['meta']['version_installee'] > 16428)
1226
+        and $r = sql_allfetsel(
1227
+            'id_objet',
1228
+            'spip_auteurs_liens',
1229
+            'id_auteur=' . intval($id_auteur) . " AND objet='rubrique' AND id_objet!=0"
1230
+        )
1231
+        and is_countable($r) ? count($r) : 0
1232
+    ) {
1233
+        $r = array_column($r, 'id_objet');
1234
+
1235
+        // recuperer toute la branche, au format chaine enumeration
1236
+        include_spip('inc/rubriques');
1237
+        $r = calcul_branche_in($r);
1238
+        $r = explode(',', $r);
1239
+
1240
+        // passer les rubriques en index, elimine les doublons
1241
+        $r = array_flip($r);
1242
+        // recuperer les index seuls
1243
+        $r = array_keys($r);
1244
+        // combiner pour avoir un tableau id_rubrique=>id_rubrique
1245
+        // est-ce vraiment utile ? (on preserve la forme donnee par le code precedent)
1246
+        $rubriques = array_combine($r, $r);
1247
+    }
1248
+
1249
+    // Affecter l'auteur session le cas echeant
1250
+    if (
1251
+        isset($GLOBALS['visiteur_session']['id_auteur'])
1252
+        and $GLOBALS['visiteur_session']['id_auteur'] == $id_auteur
1253
+    ) {
1254
+        $GLOBALS['visiteur_session']['restreint'] = $rubriques;
1255
+    }
1256
+
1257
+
1258
+    return $restreint[$id_auteur] = $rubriques;
1259 1259
 }
1260 1260
 
1261 1261
 /**
@@ -1273,7 +1273,7 @@  discard block
 block discarded – undo
1273 1273
  * @return bool true s'il a le droit, false sinon
1274 1274
  **/
1275 1275
 function autoriser_rubrique_previsualiser_dist(string $faire, string $type, $id, array $qui, array $opt): bool {
1276
-	return autoriser('previsualiser');
1276
+    return autoriser('previsualiser');
1277 1277
 }
1278 1278
 
1279 1279
 /**
@@ -1291,7 +1291,7 @@  discard block
 block discarded – undo
1291 1291
  * @return bool true s'il a le droit, false sinon
1292 1292
  **/
1293 1293
 function autoriser_rubrique_iconifier_dist(string $faire, string $type, $id, array $qui, array $opt): bool {
1294
-	return autoriser('publierdans', 'rubrique', $id, $qui, $opt);
1294
+    return autoriser('publierdans', 'rubrique', $id, $qui, $opt);
1295 1295
 }
1296 1296
 
1297 1297
 /**
@@ -1309,9 +1309,9 @@  discard block
 block discarded – undo
1309 1309
  * @return bool true s'il a le droit, false sinon
1310 1310
  **/
1311 1311
 function autoriser_auteur_iconifier_dist(string $faire, string $type, $id, array $qui, array $opt): bool {
1312
-	$id = intval($id);
1313
-	return (($id == $qui['id_auteur']) or
1314
-		(($qui['statut'] === '0minirezo') and !$qui['restreint']));
1312
+    $id = intval($id);
1313
+    return (($id == $qui['id_auteur']) or
1314
+        (($qui['statut'] === '0minirezo') and !$qui['restreint']));
1315 1315
 }
1316 1316
 
1317 1317
 /**
@@ -1329,8 +1329,8 @@  discard block
 block discarded – undo
1329 1329
  * @return bool true s'il a le droit, false sinon
1330 1330
  **/
1331 1331
 function autoriser_iconifier_dist(string $faire, string $type, $id, array $qui, array $opt): bool {
1332
-	// par defaut, on a le droit d'iconifier si on a le droit de modifier
1333
-	return autoriser('modifier', $type, $id, $qui, $opt);
1332
+    // par defaut, on a le droit d'iconifier si on a le droit de modifier
1333
+    return autoriser('modifier', $type, $id, $qui, $opt);
1334 1334
 }
1335 1335
 
1336 1336
 
@@ -1350,7 +1350,7 @@  discard block
 block discarded – undo
1350 1350
  * @return true
1351 1351
  **/
1352 1352
 function autoriser_ok_dist(string $faire, string $type, $id, array $qui, array $opt): bool {
1353
-	return true;
1353
+    return true;
1354 1354
 }
1355 1355
 
1356 1356
 /**
@@ -1369,7 +1369,7 @@  discard block
 block discarded – undo
1369 1369
  * @return false
1370 1370
  **/
1371 1371
 function autoriser_niet_dist(string $faire, string $type, $id, array $qui, array $opt): bool {
1372
-	return false;
1372
+    return false;
1373 1373
 }
1374 1374
 
1375 1375
 /**
@@ -1387,11 +1387,11 @@  discard block
 block discarded – undo
1387 1387
  * @return bool true s'il a le droit, false sinon
1388 1388
  **/
1389 1389
 function autoriser_base_reparer_dist(string $faire, string $type, $id, array $qui, array $opt): bool {
1390
-	if (!autoriser('detruire') or _request('reinstall')) {
1391
-		return false;
1392
-	}
1390
+    if (!autoriser('detruire') or _request('reinstall')) {
1391
+        return false;
1392
+    }
1393 1393
 
1394
-	return true;
1394
+    return true;
1395 1395
 }
1396 1396
 
1397 1397
 /**
@@ -1409,7 +1409,7 @@  discard block
 block discarded – undo
1409 1409
  * @return true
1410 1410
  **/
1411 1411
 function autoriser_infosperso_dist(string $faire, string $type, $id, array $qui, array $opt): bool {
1412
-	return true;
1412
+    return true;
1413 1413
 }
1414 1414
 
1415 1415
 /**
@@ -1427,7 +1427,7 @@  discard block
 block discarded – undo
1427 1427
  * @return true
1428 1428
  **/
1429 1429
 function autoriser_langage_configurer_dist(string $faire, string $type, $id, array $qui, array $opt): bool {
1430
-	return true;
1430
+    return true;
1431 1431
 }
1432 1432
 
1433 1433
 /**
@@ -1445,7 +1445,7 @@  discard block
 block discarded – undo
1445 1445
  * @return bool true s'il a le droit, false sinon
1446 1446
  **/
1447 1447
 function autoriser_configurerlangage_dist(string $faire, string $type, $id, array $qui, array $opt): bool {
1448
-	return autoriser('configurer', '_langage', $id, $qui, $opt);
1448
+    return autoriser('configurer', '_langage', $id, $qui, $opt);
1449 1449
 }
1450 1450
 
1451 1451
 /**
@@ -1463,7 +1463,7 @@  discard block
 block discarded – undo
1463 1463
  * @return true
1464 1464
  **/
1465 1465
 function autoriser_preferences_configurer_dist(string $faire, string $type, $id, array $qui, array $opt): bool {
1466
-	return true;
1466
+    return true;
1467 1467
 }
1468 1468
 
1469 1469
 /**
@@ -1481,7 +1481,7 @@  discard block
 block discarded – undo
1481 1481
  * @return bool true s'il a le droit, false sinon
1482 1482
  **/
1483 1483
 function autoriser_configurerpreferences_dist(string $faire, string $type, $id, array $qui, array $opt): bool {
1484
-	return autoriser('configurer', '_preferences', $id, $qui, $opt);
1484
+    return autoriser('configurer', '_preferences', $id, $qui, $opt);
1485 1485
 }
1486 1486
 
1487 1487
 /**
@@ -1499,8 +1499,8 @@  discard block
 block discarded – undo
1499 1499
  * @return bool true s'il a le droit, false sinon
1500 1500
  **/
1501 1501
 function autoriser_menudeveloppement_menugrandeentree_dist(string $faire, string $type, $id, array $qui, array $opt): bool {
1502
-	return (isset($GLOBALS['visiteur_session']['prefs']['activer_menudev'])
1503
-		and $GLOBALS['visiteur_session']['prefs']['activer_menudev'] === 'oui');
1502
+    return (isset($GLOBALS['visiteur_session']['prefs']['activer_menudev'])
1503
+        and $GLOBALS['visiteur_session']['prefs']['activer_menudev'] === 'oui');
1504 1504
 }
1505 1505
 
1506 1506
 /**
@@ -1519,7 +1519,7 @@  discard block
 block discarded – undo
1519 1519
  * @return true
1520 1520
  **/
1521 1521
 function autoriser_menugrandeentree_dist(string $faire, string $type, $id, array $qui, array $opt): bool {
1522
-	return true;
1522
+    return true;
1523 1523
 }
1524 1524
 
1525 1525
 /**
@@ -1537,7 +1537,7 @@  discard block
 block discarded – undo
1537 1537
  * @return true
1538 1538
  **/
1539 1539
 function autoriser_auteurs_voir_dist(string $faire, string $type, $id, array $qui, array $opt): bool {
1540
-	return true;
1540
+    return true;
1541 1541
 }
1542 1542
 
1543 1543
 /**
@@ -1555,7 +1555,7 @@  discard block
 block discarded – undo
1555 1555
  * @return bool true s'il a le droit, false sinon
1556 1556
  **/
1557 1557
 function autoriser_auteurs_menu_dist(string $faire, string $type, $id, array $qui, array $opt): bool {
1558
-	return autoriser('voir', '_auteurs', $id, $qui, $opt);
1558
+    return autoriser('voir', '_auteurs', $id, $qui, $opt);
1559 1559
 }
1560 1560
 
1561 1561
 /**
@@ -1573,7 +1573,7 @@  discard block
 block discarded – undo
1573 1573
  * @return true
1574 1574
  **/
1575 1575
 function autoriser_articles_voir_dist(string $faire, string $type, $id, array $qui, array $opt): bool {
1576
-	return true;
1576
+    return true;
1577 1577
 }
1578 1578
 
1579 1579
 /**
@@ -1591,7 +1591,7 @@  discard block
 block discarded – undo
1591 1591
  * @return bool true s'il a le droit, false sinon
1592 1592
  **/
1593 1593
 function autoriser_articles_menu_dist(string $faire, string $type, $id, array $qui, array $opt): bool {
1594
-	return autoriser('voir', '_articles', $id, $qui, $opt);
1594
+    return autoriser('voir', '_articles', $id, $qui, $opt);
1595 1595
 }
1596 1596
 
1597 1597
 /**
@@ -1609,7 +1609,7 @@  discard block
 block discarded – undo
1609 1609
  * @return true
1610 1610
  **/
1611 1611
 function autoriser_rubriques_voir_dist(string $faire, string $type, $id, array $qui, array $opt): bool {
1612
-	return true;
1612
+    return true;
1613 1613
 }
1614 1614
 
1615 1615
 /**
@@ -1627,7 +1627,7 @@  discard block
 block discarded – undo
1627 1627
  * @return bool true s'il a le droit, false sinon
1628 1628
  **/
1629 1629
 function autoriser_rubriques_menu_dist(string $faire, string $type, $id, array $qui, array $opt): bool {
1630
-	return autoriser('voir', '_rubriques', $id, $qui, $opt);
1630
+    return autoriser('voir', '_rubriques', $id, $qui, $opt);
1631 1631
 }
1632 1632
 
1633 1633
 /**
@@ -1645,7 +1645,7 @@  discard block
 block discarded – undo
1645 1645
  * @return bool true s'il a le droit, false sinon
1646 1646
  **/
1647 1647
 function autoriser_articlecreer_menu_dist(string $faire, string $type, $id, array $qui, array $opt): bool {
1648
-	return verifier_table_non_vide();
1648
+    return verifier_table_non_vide();
1649 1649
 }
1650 1650
 
1651 1651
 
@@ -1666,7 +1666,7 @@  discard block
 block discarded – undo
1666 1666
  * @return bool true s'il a le droit, false sinon
1667 1667
  **/
1668 1668
 function autoriser_auteurcreer_menu_dist(string $faire, string $type, $id, array $qui, array $opt): bool {
1669
-	return autoriser('creer', 'auteur', $id, $qui, $opt);
1669
+    return autoriser('creer', 'auteur', $id, $qui, $opt);
1670 1670
 }
1671 1671
 
1672 1672
 /**
@@ -1684,13 +1684,13 @@  discard block
 block discarded – undo
1684 1684
  * @return bool true s'il a le droit, false sinon
1685 1685
  **/
1686 1686
 function autoriser_visiteurs_menu_dist(string $faire, string $type, $id, array $qui, array $opt): bool {
1687
-	include_spip('base/abstract_sql');
1688
-	return
1689
-		$qui['statut'] === '0minirezo' and !$qui['restreint']
1690
-		and (
1691
-			$GLOBALS['meta']['accepter_visiteurs'] != 'non'
1692
-			or sql_countsel('spip_auteurs', 'statut in ("6forum", "nouveau")') > 0
1693
-		);
1687
+    include_spip('base/abstract_sql');
1688
+    return
1689
+        $qui['statut'] === '0minirezo' and !$qui['restreint']
1690
+        and (
1691
+            $GLOBALS['meta']['accepter_visiteurs'] != 'non'
1692
+            or sql_countsel('spip_auteurs', 'statut in ("6forum", "nouveau")') > 0
1693
+        );
1694 1694
 }
1695 1695
 
1696 1696
 /**
@@ -1708,7 +1708,7 @@  discard block
 block discarded – undo
1708 1708
  * @return bool true s'il a le droit, false sinon
1709 1709
  **/
1710 1710
 function autoriser_suiviedito_menu_dist(string $faire, string $type, $id, array $qui, array $opt): bool {
1711
-	return $qui['statut'] === '0minirezo';
1711
+    return $qui['statut'] === '0minirezo';
1712 1712
 }
1713 1713
 
1714 1714
 /**
@@ -1726,7 +1726,7 @@  discard block
 block discarded – undo
1726 1726
  * @return bool true s'il a le droit, false sinon
1727 1727
  **/
1728 1728
 function autoriser_synchro_menu_dist(string $faire, string $type, $id, array $qui, array $opt): bool {
1729
-	return $qui['statut'] === '0minirezo';
1729
+    return $qui['statut'] === '0minirezo';
1730 1730
 }
1731 1731
 
1732 1732
 /**
@@ -1744,7 +1744,7 @@  discard block
 block discarded – undo
1744 1744
  * @return bool true s'il a le droit, false sinon
1745 1745
  **/
1746 1746
 function autoriser_configurerinteractions_menu_dist(string $faire, string $type, $id, array $qui, array $opt): bool {
1747
-	return autoriser('configurer', '_interactions', $id, $qui, $opt);
1747
+    return autoriser('configurer', '_interactions', $id, $qui, $opt);
1748 1748
 }
1749 1749
 
1750 1750
 /**
@@ -1762,7 +1762,7 @@  discard block
 block discarded – undo
1762 1762
  * @return bool true s'il a le droit, false sinon
1763 1763
  **/
1764 1764
 function autoriser_configurerlangue_menu_dist(string $faire, string $type, $id, array $qui, array $opt): bool {
1765
-	return autoriser('configurer', '_langue', $id, $qui, $opt);
1765
+    return autoriser('configurer', '_langue', $id, $qui, $opt);
1766 1766
 }
1767 1767
 
1768 1768
 /**
@@ -1780,7 +1780,7 @@  discard block
 block discarded – undo
1780 1780
  * @return bool true s'il a le droit, false sinon
1781 1781
  **/
1782 1782
 function autoriser_configurermultilinguisme_menu_dist(string $faire, string $type, $id, array $qui, array $opt): bool {
1783
-	return autoriser('configurer', '_multilinguisme', $id, $qui, $opt);
1783
+    return autoriser('configurer', '_multilinguisme', $id, $qui, $opt);
1784 1784
 }
1785 1785
 
1786 1786
 /**
@@ -1798,7 +1798,7 @@  discard block
 block discarded – undo
1798 1798
  * @return bool true s'il a le droit, false sinon
1799 1799
  **/
1800 1800
 function autoriser_configurercontenu_menu_dist(string $faire, string $type, $id, array $qui, array $opt): bool {
1801
-	return autoriser('configurer', '_contenu', $id, $qui, $opt);
1801
+    return autoriser('configurer', '_contenu', $id, $qui, $opt);
1802 1802
 }
1803 1803
 
1804 1804
 /**
@@ -1816,7 +1816,7 @@  discard block
 block discarded – undo
1816 1816
  * @return bool true s'il a le droit, false sinon
1817 1817
  **/
1818 1818
 function autoriser_configureravancees_menu_dist(string $faire, string $type, $id, array $qui, array $opt): bool {
1819
-	return autoriser('configurer', '_avancees', $id, $qui, $opt);
1819
+    return autoriser('configurer', '_avancees', $id, $qui, $opt);
1820 1820
 }
1821 1821
 
1822 1822
 /**
@@ -1834,7 +1834,7 @@  discard block
 block discarded – undo
1834 1834
  * @return bool true s'il a le droit, false sinon
1835 1835
  **/
1836 1836
 function autoriser_adminplugin_menu_dist(string $faire, string $type, $id, array $qui, array $opt): bool {
1837
-	return autoriser('configurer', '_plugins', $id, $qui, $opt);
1837
+    return autoriser('configurer', '_plugins', $id, $qui, $opt);
1838 1838
 }
1839 1839
 
1840 1840
 /**
@@ -1852,7 +1852,7 @@  discard block
 block discarded – undo
1852 1852
  * @return bool true s'il a le droit, false sinon
1853 1853
  **/
1854 1854
 function autoriser_admintech_menu_dist(string $faire, string $type, $id, array $qui, array $opt): bool {
1855
-	return autoriser('detruire', $type, $id, $qui, $opt);
1855
+    return autoriser('detruire', $type, $id, $qui, $opt);
1856 1856
 }
1857 1857
 
1858 1858
 /**
@@ -1870,7 +1870,7 @@  discard block
 block discarded – undo
1870 1870
  * @return bool true s'il a le droit, false sinon
1871 1871
  **/
1872 1872
 function autoriser_queue_purger_dist(string $faire, string $type, $id, array $qui, array $opt): bool {
1873
-	return autoriser('webmestre');
1873
+    return autoriser('webmestre');
1874 1874
 }
1875 1875
 
1876 1876
 
@@ -1890,11 +1890,11 @@  discard block
 block discarded – undo
1890 1890
  * @return bool true s'il a le droit, false sinon
1891 1891
  **/
1892 1892
 function autoriser_echafauder_dist(string $faire, string $type, $id, array $qui, array $opt): bool {
1893
-	if (test_espace_prive()) {
1894
-		return intval($qui['id_auteur']) ? true : false;
1895
-	} else {
1896
-		return autoriser('webmestre', '', $id, $qui, $opt);
1897
-	}
1893
+    if (test_espace_prive()) {
1894
+        return intval($qui['id_auteur']) ? true : false;
1895
+    } else {
1896
+        return autoriser('webmestre', '', $id, $qui, $opt);
1897
+    }
1898 1898
 }
1899 1899
 
1900 1900
 
@@ -1909,27 +1909,27 @@  discard block
 block discarded – undo
1909 1909
  *     Identifiants d'auteurs
1910 1910
  */
1911 1911
 function auteurs_objet($objet, $id_objet, $cond = '') {
1912
-	$objet = objet_type($objet);
1913
-	$where = [
1914
-		'objet=' . sql_quote($objet),
1915
-		'id_objet=' . intval($id_objet)
1916
-	];
1917
-	if (!empty($cond)) {
1918
-		if (is_array($cond)) {
1919
-			$where = array_merge($where, $cond);
1920
-		} else {
1921
-			$where[] = $cond;
1922
-		}
1923
-	}
1924
-	$auteurs = sql_allfetsel(
1925
-		'id_auteur',
1926
-		'spip_auteurs_liens',
1927
-		$where
1928
-	);
1929
-	if (is_array($auteurs)) {
1930
-		return array_column($auteurs, 'id_auteur');
1931
-	}
1932
-	return [];
1912
+    $objet = objet_type($objet);
1913
+    $where = [
1914
+        'objet=' . sql_quote($objet),
1915
+        'id_objet=' . intval($id_objet)
1916
+    ];
1917
+    if (!empty($cond)) {
1918
+        if (is_array($cond)) {
1919
+            $where = array_merge($where, $cond);
1920
+        } else {
1921
+            $where[] = $cond;
1922
+        }
1923
+    }
1924
+    $auteurs = sql_allfetsel(
1925
+        'id_auteur',
1926
+        'spip_auteurs_liens',
1927
+        $where
1928
+    );
1929
+    if (is_array($auteurs)) {
1930
+        return array_column($auteurs, 'id_auteur');
1931
+    }
1932
+    return [];
1933 1933
 }
1934 1934
 
1935 1935
 /**
@@ -1944,11 +1944,11 @@  discard block
 block discarded – undo
1944 1944
  *     - false : serveur SQL indisponible
1945 1945
  */
1946 1946
 function auteurs_article($id_article, $cond = '') {
1947
-	return sql_allfetsel(
1948
-		'id_auteur',
1949
-		'spip_auteurs_liens',
1950
-		"objet='article' AND id_objet=" . intval($id_article) . ($cond ? " AND $cond" : '')
1951
-	);
1947
+    return sql_allfetsel(
1948
+        'id_auteur',
1949
+        'spip_auteurs_liens',
1950
+        "objet='article' AND id_objet=" . intval($id_article) . ($cond ? " AND $cond" : '')
1951
+    );
1952 1952
 }
1953 1953
 
1954 1954
 
@@ -1962,7 +1962,7 @@  discard block
 block discarded – undo
1962 1962
  */
1963 1963
 function acces_restreint_rubrique($id_rubrique) {
1964 1964
 
1965
-	return (isset($GLOBALS['connect_id_rubrique'][$id_rubrique]));
1965
+    return (isset($GLOBALS['connect_id_rubrique'][$id_rubrique]));
1966 1966
 }
1967 1967
 
1968 1968
 
@@ -1975,12 +1975,12 @@  discard block
 block discarded – undo
1975 1975
  * @return bool             true si un parent existe
1976 1976
  */
1977 1977
 function verifier_table_non_vide($table = 'spip_rubriques') {
1978
-	static $done = [];
1979
-	if (!isset($done[$table])) {
1980
-		$done[$table] = sql_countsel($table) > 0;
1981
-	}
1978
+    static $done = [];
1979
+    if (!isset($done[$table])) {
1980
+        $done[$table] = sql_countsel($table) > 0;
1981
+    }
1982 1982
 
1983
-	return $done[$table];
1983
+    return $done[$table];
1984 1984
 }
1985 1985
 
1986 1986
 /**
@@ -2007,15 +2007,15 @@  discard block
 block discarded – undo
2007 2007
  */
2008 2008
 function autoriser_inscrireauteur_dist($faire, $quoi, $id, $qui, $opt) {
2009 2009
 
2010
-	$s = array_search($quoi, $GLOBALS['liste_des_statuts']);
2011
-	switch ($s) {
2012
-		case 'info_redacteurs':
2013
-			return ($GLOBALS['meta']['accepter_inscriptions'] === 'oui');
2014
-		case 'info_visiteurs':
2015
-			return ($GLOBALS['meta']['accepter_visiteurs'] === 'oui' or $GLOBALS['meta']['forums_publics'] === 'abo');
2016
-	}
2010
+    $s = array_search($quoi, $GLOBALS['liste_des_statuts']);
2011
+    switch ($s) {
2012
+        case 'info_redacteurs':
2013
+            return ($GLOBALS['meta']['accepter_inscriptions'] === 'oui');
2014
+        case 'info_visiteurs':
2015
+            return ($GLOBALS['meta']['accepter_visiteurs'] === 'oui' or $GLOBALS['meta']['forums_publics'] === 'abo');
2016
+    }
2017 2017
 
2018
-	return false;
2018
+    return false;
2019 2019
 }
2020 2020
 
2021 2021
 /**
@@ -2033,7 +2033,7 @@  discard block
 block discarded – undo
2033 2033
  * @return bool true s'il a le droit, false sinon
2034 2034
  **/
2035 2035
 function autoriser_inscription_relancer_dist(string $faire, string $type, $id, array $qui, array $opt): bool {
2036
-	return $qui['statut'] === '0minirezo' and !$qui['restreint'];
2036
+    return $qui['statut'] === '0minirezo' and !$qui['restreint'];
2037 2037
 }
2038 2038
 
2039 2039
 /**
@@ -2051,5 +2051,5 @@  discard block
 block discarded – undo
2051 2051
  * @return bool true s'il a le droit, false sinon
2052 2052
  **/
2053 2053
 function autoriser_phpinfos_dist(string $faire, string $type, $id, array $qui, array $opt): bool {
2054
-	return autoriser('webmestre');
2054
+    return autoriser('webmestre');
2055 2055
 }
Please login to merge, or discard this patch.
ecrire/lang/ecrire_ay.php 1 patch
Indentation   +190 added lines, -190 removed lines patch added patch discarded remove patch
@@ -4,211 +4,211 @@
 block discarded – undo
4 4
 // ** ne pas modifier le fichier **
5 5
 
6 6
 if (!defined('_ECRIRE_INC_VERSION')) {
7
-	return;
7
+    return;
8 8
 }
9 9
 
10 10
 $GLOBALS[$GLOBALS['idx_lang']] = array(
11 11
 
12
-	// A
13
-	'activer_plugin' => 'Plugin uk naktayaña
12
+    // A
13
+    'activer_plugin' => 'Plugin uk naktayaña
14 14
 ',
15
-	'aide_non_disponible' => 'Aka yanapa naktatxa janiw aka arunx wakitakiti.',
16
-	'auteur' => 'Qillqiri:',
17
-	'avis_acces_interdit' => 'Mantawx jark’ata.',
18
-	'avis_article_modifie' => 'Amuyam @nom_auteur_modif@ aka qillqatax irnaqataw @date_diff@ ninkharata.',
19
-	'avis_aucun_resultat' => 'Janiw askichat utjkiti.
15
+    'aide_non_disponible' => 'Aka yanapa naktatxa janiw aka arunx wakitakiti.',
16
+    'auteur' => 'Qillqiri:',
17
+    'avis_acces_interdit' => 'Mantawx jark’ata.',
18
+    'avis_article_modifie' => 'Amuyam @nom_auteur_modif@ aka qillqatax irnaqataw @date_diff@ ninkharata.',
19
+    'avis_aucun_resultat' => 'Janiw askichat utjkiti.
20 20
 ',
21
-	'avis_chemin_invalide_1' => 'Thakhix ajllita',
22
-	'avis_chemin_invalide_2' => 'Jan jamakiw iyaw satakiti. Nayrt’ir laphi uñnaqar kutt’am ukatsti jikit yatiyawinak qhanstayam.',
23
-	'avis_connexion_echec_1' => 'Chinuwix jalanuqirirux janiw walt’kiti MySQL.',
24
-	'avis_connexion_echec_2' => 'Arkir laphi uñnaqar kutt’am ukatsti jikit yatiyawinaka mayamp uñjam.',
25
-	'avis_connexion_echec_3' => '&lt;b&gt;Amuyam:&lt;/b&gt; Walja jalanuqirinakana, munasiwa &lt;b&gt;mayiña&lt;/b&gt; mantawitx naktata yatqalltawiru MySQL janir apnaqasa. Janitix chinusiñ puyrktaxa mayampi uñjam lartax ukja.',
26
-	'avis_connexion_ldap_echec_1' => 'Jalanuqirirux chinuwi ukaxa LDAP janiw walt’kiti.',
27
-	'avis_connexion_ldap_echec_2' => 'Nayrir laphi uñnaqar kutt’am ukatsti jikit yatiyawinak qhanstayam.',
28
-	'avis_connexion_ldap_echec_3' => 'Mayakipawjam, askichir ukax jan apnaqamti LDAP apnaqirinak apayaniñataki.',
29
-	'avis_deplacement_rubrique' => '¡AMUYAM! Aka t’aqan utjiwa @contient_breves@ breve@scb@. Janitix yäqtaxa,  iyaw sat casilla uk naktayam.',
30
-	'avis_erreur_connexion_mysql' => 'Chinuw pantjata MySQL',
31
-	'avis_espace_interdit' => '<b>Ch’usawx jark’ata</b> <div>SPIP ukax uchantataxiwa</div>',
32
-	'avis_lecture_noms_bases_1' => 'Uchantat pirwa yatiyawinakatxa uchantir prugramaxa janiw liykiti.',
33
-	'avis_lecture_noms_bases_3' => 'Payir lurawinxa, inas mä pirwa apnaqiri sutimampi apnaqasispa:',
34
-	'avis_non_acces_page' => 'Aka laphi uñnaqarux janiw mantañaniktati.',
35
-	'avis_operation_echec' => 'Lurawix janiw walt’kiti.',
36
-	'avis_operation_impossible' => 'Lurawix janipuni',
37
-	'avis_suppression_base' => '¡AMUYAM, apaqat yatiyawinakax janiw askichaskaspati!',
21
+    'avis_chemin_invalide_1' => 'Thakhix ajllita',
22
+    'avis_chemin_invalide_2' => 'Jan jamakiw iyaw satakiti. Nayrt’ir laphi uñnaqar kutt’am ukatsti jikit yatiyawinak qhanstayam.',
23
+    'avis_connexion_echec_1' => 'Chinuwix jalanuqirirux janiw walt’kiti MySQL.',
24
+    'avis_connexion_echec_2' => 'Arkir laphi uñnaqar kutt’am ukatsti jikit yatiyawinaka mayamp uñjam.',
25
+    'avis_connexion_echec_3' => '&lt;b&gt;Amuyam:&lt;/b&gt; Walja jalanuqirinakana, munasiwa &lt;b&gt;mayiña&lt;/b&gt; mantawitx naktata yatqalltawiru MySQL janir apnaqasa. Janitix chinusiñ puyrktaxa mayampi uñjam lartax ukja.',
26
+    'avis_connexion_ldap_echec_1' => 'Jalanuqirirux chinuwi ukaxa LDAP janiw walt’kiti.',
27
+    'avis_connexion_ldap_echec_2' => 'Nayrir laphi uñnaqar kutt’am ukatsti jikit yatiyawinak qhanstayam.',
28
+    'avis_connexion_ldap_echec_3' => 'Mayakipawjam, askichir ukax jan apnaqamti LDAP apnaqirinak apayaniñataki.',
29
+    'avis_deplacement_rubrique' => '¡AMUYAM! Aka t’aqan utjiwa @contient_breves@ breve@scb@. Janitix yäqtaxa,  iyaw sat casilla uk naktayam.',
30
+    'avis_erreur_connexion_mysql' => 'Chinuw pantjata MySQL',
31
+    'avis_espace_interdit' => '<b>Ch’usawx jark’ata</b> <div>SPIP ukax uchantataxiwa</div>',
32
+    'avis_lecture_noms_bases_1' => 'Uchantat pirwa yatiyawinakatxa uchantir prugramaxa janiw liykiti.',
33
+    'avis_lecture_noms_bases_3' => 'Payir lurawinxa, inas mä pirwa apnaqiri sutimampi apnaqasispa:',
34
+    'avis_non_acces_page' => 'Aka laphi uñnaqarux janiw mantañaniktati.',
35
+    'avis_operation_echec' => 'Lurawix janiw walt’kiti.',
36
+    'avis_operation_impossible' => 'Lurawix janipuni',
37
+    'avis_suppression_base' => '¡AMUYAM, apaqat yatiyawinakax janiw askichaskaspati!',
38 38
 
39
-	// B
40
-	'bouton_acces_ldap' => 'Mä mantaw yapaña LDAP',
41
-	'bouton_ajouter' => 'Yapaña',
42
-	'bouton_annuler' => 'Jiwt’ayaña',
43
-	'bouton_demande_publication' => 'Aka qillqat yatiyañ mayiña',
44
-	'bouton_desactive_tout' => 'Taqpach jiwt’ayaña',
45
-	'bouton_effacer_tout' => '¡Taqpach chhaqhayaña!',
46
-	'bouton_envoyer_message' => 'Qhananchat yatiyaw: apayaña',
47
-	'bouton_modifier' => 'Mayjachaña',
48
-	'bouton_radio_afficher' => 'Uñachayaña',
49
-	'bouton_radio_apparaitre_liste_redacteurs_connectes' => 'Chint’at tanta qillqirinakan uñstaña',
50
-	'bouton_radio_envoi_annonces_adresse' => 'Yatiyawinak utjawir apayaña:',
51
-	'bouton_radio_envoi_liste_nouveautes' => 'Machaq tanta yatiyawinak apayaña',
52
-	'bouton_radio_non_apparaitre_liste_redacteurs_connectes' => 'Tanta qillqirinakan jan uñstaña',
53
-	'bouton_radio_non_envoi_annonces_editoriales' => 'Yatiyawinak qhanstat jan apayaña',
54
-	'bouton_redirection' => 'Irpxatawi',
55
-	'bouton_relancer_installation' => 'Mayamp uchantaw yatiyaña',
56
-	'bouton_suivant' => 'Jutiri',
57
-	'bouton_tenter_recuperation' => 'Askichañ yant’aña',
58
-	'bouton_test_proxy' => 'proxy uk yant’aña',
59
-	'bouton_vider_cache' => 'caché uk ch’usachaña',
39
+    // B
40
+    'bouton_acces_ldap' => 'Mä mantaw yapaña LDAP',
41
+    'bouton_ajouter' => 'Yapaña',
42
+    'bouton_annuler' => 'Jiwt’ayaña',
43
+    'bouton_demande_publication' => 'Aka qillqat yatiyañ mayiña',
44
+    'bouton_desactive_tout' => 'Taqpach jiwt’ayaña',
45
+    'bouton_effacer_tout' => '¡Taqpach chhaqhayaña!',
46
+    'bouton_envoyer_message' => 'Qhananchat yatiyaw: apayaña',
47
+    'bouton_modifier' => 'Mayjachaña',
48
+    'bouton_radio_afficher' => 'Uñachayaña',
49
+    'bouton_radio_apparaitre_liste_redacteurs_connectes' => 'Chint’at tanta qillqirinakan uñstaña',
50
+    'bouton_radio_envoi_annonces_adresse' => 'Yatiyawinak utjawir apayaña:',
51
+    'bouton_radio_envoi_liste_nouveautes' => 'Machaq tanta yatiyawinak apayaña',
52
+    'bouton_radio_non_apparaitre_liste_redacteurs_connectes' => 'Tanta qillqirinakan jan uñstaña',
53
+    'bouton_radio_non_envoi_annonces_editoriales' => 'Yatiyawinak qhanstat jan apayaña',
54
+    'bouton_redirection' => 'Irpxatawi',
55
+    'bouton_relancer_installation' => 'Mayamp uchantaw yatiyaña',
56
+    'bouton_suivant' => 'Jutiri',
57
+    'bouton_tenter_recuperation' => 'Askichañ yant’aña',
58
+    'bouton_test_proxy' => 'proxy uk yant’aña',
59
+    'bouton_vider_cache' => 'caché uk ch’usachaña',
60 60
 
61
-	// C
62
-	'cache_modifiable_webmestre' => 'Aka amuykipawix mayxt’ataspaw webmistress qamawit ukata.',
61
+    // C
62
+    'cache_modifiable_webmestre' => 'Aka amuykipawix mayxt’ataspaw webmistress qamawit ukata.',
63 63
 
64
-	// D
65
-	'date_mot_heures' => 'urasa
64
+    // D
65
+    'date_mot_heures' => 'urasa
66 66
 ',
67 67
 
68
-	// E
69
-	'email' => 'aruskipayiri',
70
-	'email_2' => 'aruskipayiri:
68
+    // E
69
+    'email' => 'aruskipayiri',
70
+    'email_2' => 'aruskipayiri:
71 71
 ',
72
-	'entree_adresse_annuaire' => 'Marpachat utjawi',
73
-	'entree_adresse_email' => 'Aruskipayirima',
74
-	'entree_base_donnee_1' => 'Pirwat yatiyawinakaxa utjawi',
75
-	'entree_biographie' => 'Mä juk’a jakawipat qillqa, juk’a arunakampi...',
76
-	'entree_chemin_acces' => '<b>Mantaña</b> mantañ thakhixa:',
77
-	'entree_cle_pgp' => 'Impt’atama PGP',
78
-	'entree_contenu_rubrique' => '(T’aqan utjawipa, qawqha arunakampi)',
79
-	'entree_identifiants_connexion' => 'Chinuw uñacht’ayirinakama...',
80
-	'entree_informations_connexion_ldap' => 'Aka phuqañ laphina yatiyawinak conexión ukata jach’a q’ipimaru LDAP. Uka yatiyawinakxa yatiyanitamwa apnaqir apnaqawita jan ukjax red ukata',
81
-	'entree_infos_perso' => '¿Khititasa?',
82
-	'entree_interieur_rubrique' => 'T’aqata maqhana...',
83
-	'entree_liens_sites' => '<b>Chinu jach’a sawu </b>(aytata, qamaw tumpañataki, ...)',
84
-	'entree_login' => 'Sutichatama',
85
-	'entree_login_connexion_1' => 'Chinu uñacht’ayirima',
86
-	'entree_mot_passe' => 'Imt’awima',
87
-	'entree_mot_passe_1' => 'Chinu imt’awima',
88
-	'entree_mot_passe_2' => '(Awisax FTP imt’atamar ukankiwa ukatsti awisax ch’usak jayti)',
89
-	'entree_nom_fichier' => 'K’ipit sutipa uk uchantaña @texte_compresse@:',
90
-	'entree_nom_pseudo' => 'Sutima jan ukax sutinchama',
91
-	'entree_nom_pseudo_1' => 'Sutima jan ukax sutinchama',
92
-	'entree_nom_site' => 'Qamawiman sutipa',
93
-	'entree_nouveau_passe' => 'Machaq imt’awima',
94
-	'entree_passe_ldap' => 'Imt’awima',
95
-	'entree_port_annuaire' => 'Marpachat thakhin jakhu',
96
-	'entree_signature' => 'Iyawsa',
97
-	'entree_titre_obligatoire' => '<b>Sutinchata</b> [Obligatorio]<br />',
98
-	'entree_url' => 'Utjawi(URL) qamawimata',
99
-	'erreur_plugin_fichier_absent' => 'Jan utjaw q’ipi
72
+    'entree_adresse_annuaire' => 'Marpachat utjawi',
73
+    'entree_adresse_email' => 'Aruskipayirima',
74
+    'entree_base_donnee_1' => 'Pirwat yatiyawinakaxa utjawi',
75
+    'entree_biographie' => 'Mä juk’a jakawipat qillqa, juk’a arunakampi...',
76
+    'entree_chemin_acces' => '<b>Mantaña</b> mantañ thakhixa:',
77
+    'entree_cle_pgp' => 'Impt’atama PGP',
78
+    'entree_contenu_rubrique' => '(T’aqan utjawipa, qawqha arunakampi)',
79
+    'entree_identifiants_connexion' => 'Chinuw uñacht’ayirinakama...',
80
+    'entree_informations_connexion_ldap' => 'Aka phuqañ laphina yatiyawinak conexión ukata jach’a q’ipimaru LDAP. Uka yatiyawinakxa yatiyanitamwa apnaqir apnaqawita jan ukjax red ukata',
81
+    'entree_infos_perso' => '¿Khititasa?',
82
+    'entree_interieur_rubrique' => 'T’aqata maqhana...',
83
+    'entree_liens_sites' => '<b>Chinu jach’a sawu </b>(aytata, qamaw tumpañataki, ...)',
84
+    'entree_login' => 'Sutichatama',
85
+    'entree_login_connexion_1' => 'Chinu uñacht’ayirima',
86
+    'entree_mot_passe' => 'Imt’awima',
87
+    'entree_mot_passe_1' => 'Chinu imt’awima',
88
+    'entree_mot_passe_2' => '(Awisax FTP imt’atamar ukankiwa ukatsti awisax ch’usak jayti)',
89
+    'entree_nom_fichier' => 'K’ipit sutipa uk uchantaña @texte_compresse@:',
90
+    'entree_nom_pseudo' => 'Sutima jan ukax sutinchama',
91
+    'entree_nom_pseudo_1' => 'Sutima jan ukax sutinchama',
92
+    'entree_nom_site' => 'Qamawiman sutipa',
93
+    'entree_nouveau_passe' => 'Machaq imt’awima',
94
+    'entree_passe_ldap' => 'Imt’awima',
95
+    'entree_port_annuaire' => 'Marpachat thakhin jakhu',
96
+    'entree_signature' => 'Iyawsa',
97
+    'entree_titre_obligatoire' => '<b>Sutinchata</b> [Obligatorio]<br />',
98
+    'entree_url' => 'Utjawi(URL) qamawimata',
99
+    'erreur_plugin_fichier_absent' => 'Jan utjaw q’ipi
100 100
 ',
101
-	'erreur_plugin_fichier_def_absent' => 'Qhanstayat q’ipix janiw utjkiti',
102
-	'erreur_plugin_nom_fonction_interdit' => 'Lurt’awit sutix jark’ata',
103
-	'erreur_plugin_nom_manquant' => 'Jan utjawi plugin ukan sutipa',
104
-	'erreur_plugin_prefix_manquant' => 'Sutinakat ch’usawj pluguin ukat jan qhanstata',
105
-	'erreur_plugin_tag_plugin_absent' => 'Janiw utjkiti &lt;plugin&gt; qhanstayawin q’ipita',
106
-	'erreur_plugin_version_manquant' => 'Pluguin ukat uñjata jan utjkiti',
101
+    'erreur_plugin_fichier_def_absent' => 'Qhanstayat q’ipix janiw utjkiti',
102
+    'erreur_plugin_nom_fonction_interdit' => 'Lurt’awit sutix jark’ata',
103
+    'erreur_plugin_nom_manquant' => 'Jan utjawi plugin ukan sutipa',
104
+    'erreur_plugin_prefix_manquant' => 'Sutinakat ch’usawj pluguin ukat jan qhanstata',
105
+    'erreur_plugin_tag_plugin_absent' => 'Janiw utjkiti &lt;plugin&gt; qhanstayawin q’ipita',
106
+    'erreur_plugin_version_manquant' => 'Pluguin ukat uñjata jan utjkiti',
107 107
 
108
-	// I
109
-	'ical_info1' => 'Aka qamawinxa kunayman lurawinak chinusiñataki utji qamaw utjawipampi',
110
-	'ical_info2' => 'Aka taqpach lurawinakxat juk’amp yatxatañatakix, yatxatañatakix jan pächasimti <a href="@spipnet@">illqanakawi</a>.', # MODIF
111
-	'ical_info_calendrier' => 'Pä pachachimpuw utjtam. Mayirix qamawit mä laphi uñnaqawa kunanti taqpach yatiyat qillqatank yatiyi: jumakiw uñjtax uka mä suti imt’awi ukata, ukatxa mayjt’ayasmaw kuna pachtix munktax ukja imt’awim mayjt’ayasa.',
112
-	'ical_methode_http' => 'Apaqaña',
113
-	'ical_methode_webcal' => 'Kikipawi (webcal://)', # MODIF
114
-	'ical_texte_prive' => 'Aka sapa maynit pacha chimpuxa, aka qamawit jark’ata lurawinak yatiytam (lurawinaka ukatsti sapa maynit aytatanaka, qillqatanaka ukatsti jisk’aptat amtanaka...)',
115
-	'ical_texte_public' => 'Aka pacha chimpux uñchukiytam qamawit lurawinaka (qillqatanak ukatsti jisk’aptatanak yatiyata).',
116
-	'ical_texte_rss' => 'Machaq yatiyawinak aka qamawitxa apxasismaw kawkir q’ipinak liyt’irimpi XML/RSS (Rich Site Summary) utt’ayataru. Ukhamaraki SPIP ukax liyt’aspaw machaq yatiyat yatiyawinaka yaqha qamawinakana kawkinti turkakipaw utt’ayatampi lurapxi (apxasit qamawinaka). ',
117
-	'ical_titre_js' => 'Javascript',
118
-	'ical_titre_mailing' => 'Aruskipayirit tanta',
119
-	'ical_titre_rss' => 'Apxasit q’ipinaka',
120
-	'icone_activer_cookie' => '“Cookie” uk naktayaña yatiyawinakata',
121
-	'icone_admin_plugin' => 'Pluguin ukanakat apnaqawi',
122
-	'icone_afficher_auteurs' => 'Qillqirinaka uñachayaña',
123
-	'icone_afficher_visiteurs' => 'Tumpirinaka uñachayaña',
124
-	'icone_arret_discussion' => 'Aka aruskipawin jan mayamp arst’añati',
125
-	'icone_calendrier' => 'Pachachimpu',
126
-	'icone_creer_auteur' => 'Mä machaq qillqiri uñstayaña ukatsti aka qillqatar mayacht’aña',
127
-	'icone_creer_rubrique_2' => 'Mä machaq t’aqa uñstayaña',
128
-	'icone_modifier_article' => 'Aka qillqata mayjt’ayaña',
129
-	'icone_modifier_rubrique' => 'Aka t’aqa mayjt’ayaña',
130
-	'icone_retour' => 'Kutiña',
131
-	'icone_retour_article' => 'Qillqatar kutiña',
132
-	'icone_supprimer_cookie' => '\\&quot;Cookie\\&quot; uk apaqaña yatiyawinakata ',
133
-	'icone_supprimer_rubrique' => 'Aka t’aqa a paqayaña',
134
-	'icone_supprimer_signature' => 'Aka iyawsa apaqaña',
135
-	'icone_valider_signature' => 'Aka iyaws iyaw saña',
136
-	'image_administrer_rubrique' => 'Aka t’aqa apnaqasmawa',
137
-	'impossible_modifier_login_auteur' => 'Impossible de modifier le login.', # MODIF
138
-	'impossible_modifier_pass_auteur' => 'Impossible de modifier le mot de passe.', # MODIF
139
-	'info_1_article' => '1 qillqata',
140
-	'info_administrateur' => 'Apnaqiri',
141
-	'info_administrateur_1' => 'Apnaqiri',
142
-	'info_administrateur_2' => 'Qamawita (<i>amuyump luram</i>)',
143
-	'info_administrateur_site_02' => 'Aka chinunx limt’am',
144
-	'info_administrateurs' => 'Apnaqirinaka',
145
-	'info_administrer_rubrique' => 'Aka t’aqxa apnaqasmawa',
146
-	'info_adresse' => 'utjawiru:',
147
-	'info_adresse_url' => 'Utjawi (URL) jach’a qamaw utata',
148
-	'info_aide_en_ligne' => 'SPIP naktatat yanapa',
149
-	'info_ajouter_rubrique' => 'Apnaqañatakix yaqha t’aqa yapaña',
150
-	'info_annonce_nouveautes' => 'Machaq yatiyawinaka yatiyaña',
151
-	'info_article' => 'qillqata
108
+    // I
109
+    'ical_info1' => 'Aka qamawinxa kunayman lurawinak chinusiñataki utji qamaw utjawipampi',
110
+    'ical_info2' => 'Aka taqpach lurawinakxat juk’amp yatxatañatakix, yatxatañatakix jan pächasimti <a href="@spipnet@">illqanakawi</a>.', # MODIF
111
+    'ical_info_calendrier' => 'Pä pachachimpuw utjtam. Mayirix qamawit mä laphi uñnaqawa kunanti taqpach yatiyat qillqatank yatiyi: jumakiw uñjtax uka mä suti imt’awi ukata, ukatxa mayjt’ayasmaw kuna pachtix munktax ukja imt’awim mayjt’ayasa.',
112
+    'ical_methode_http' => 'Apaqaña',
113
+    'ical_methode_webcal' => 'Kikipawi (webcal://)', # MODIF
114
+    'ical_texte_prive' => 'Aka sapa maynit pacha chimpuxa, aka qamawit jark’ata lurawinak yatiytam (lurawinaka ukatsti sapa maynit aytatanaka, qillqatanaka ukatsti jisk’aptat amtanaka...)',
115
+    'ical_texte_public' => 'Aka pacha chimpux uñchukiytam qamawit lurawinaka (qillqatanak ukatsti jisk’aptatanak yatiyata).',
116
+    'ical_texte_rss' => 'Machaq yatiyawinak aka qamawitxa apxasismaw kawkir q’ipinak liyt’irimpi XML/RSS (Rich Site Summary) utt’ayataru. Ukhamaraki SPIP ukax liyt’aspaw machaq yatiyat yatiyawinaka yaqha qamawinakana kawkinti turkakipaw utt’ayatampi lurapxi (apxasit qamawinaka). ',
117
+    'ical_titre_js' => 'Javascript',
118
+    'ical_titre_mailing' => 'Aruskipayirit tanta',
119
+    'ical_titre_rss' => 'Apxasit q’ipinaka',
120
+    'icone_activer_cookie' => '“Cookie” uk naktayaña yatiyawinakata',
121
+    'icone_admin_plugin' => 'Pluguin ukanakat apnaqawi',
122
+    'icone_afficher_auteurs' => 'Qillqirinaka uñachayaña',
123
+    'icone_afficher_visiteurs' => 'Tumpirinaka uñachayaña',
124
+    'icone_arret_discussion' => 'Aka aruskipawin jan mayamp arst’añati',
125
+    'icone_calendrier' => 'Pachachimpu',
126
+    'icone_creer_auteur' => 'Mä machaq qillqiri uñstayaña ukatsti aka qillqatar mayacht’aña',
127
+    'icone_creer_rubrique_2' => 'Mä machaq t’aqa uñstayaña',
128
+    'icone_modifier_article' => 'Aka qillqata mayjt’ayaña',
129
+    'icone_modifier_rubrique' => 'Aka t’aqa mayjt’ayaña',
130
+    'icone_retour' => 'Kutiña',
131
+    'icone_retour_article' => 'Qillqatar kutiña',
132
+    'icone_supprimer_cookie' => '\\&quot;Cookie\\&quot; uk apaqaña yatiyawinakata ',
133
+    'icone_supprimer_rubrique' => 'Aka t’aqa a paqayaña',
134
+    'icone_supprimer_signature' => 'Aka iyawsa apaqaña',
135
+    'icone_valider_signature' => 'Aka iyaws iyaw saña',
136
+    'image_administrer_rubrique' => 'Aka t’aqa apnaqasmawa',
137
+    'impossible_modifier_login_auteur' => 'Impossible de modifier le login.', # MODIF
138
+    'impossible_modifier_pass_auteur' => 'Impossible de modifier le mot de passe.', # MODIF
139
+    'info_1_article' => '1 qillqata',
140
+    'info_administrateur' => 'Apnaqiri',
141
+    'info_administrateur_1' => 'Apnaqiri',
142
+    'info_administrateur_2' => 'Qamawita (<i>amuyump luram</i>)',
143
+    'info_administrateur_site_02' => 'Aka chinunx limt’am',
144
+    'info_administrateurs' => 'Apnaqirinaka',
145
+    'info_administrer_rubrique' => 'Aka t’aqxa apnaqasmawa',
146
+    'info_adresse' => 'utjawiru:',
147
+    'info_adresse_url' => 'Utjawi (URL) jach’a qamaw utata',
148
+    'info_aide_en_ligne' => 'SPIP naktatat yanapa',
149
+    'info_ajouter_rubrique' => 'Apnaqañatakix yaqha t’aqa yapaña',
150
+    'info_annonce_nouveautes' => 'Machaq yatiyawinaka yatiyaña',
151
+    'info_article' => 'qillqata
152 152
 ',
153
-	'info_article_2' => 'qillqatanaka',
154
-	'info_article_a_paraitre' => 'Qillqatanak jutir urumpi yatiyataru',
155
-	'info_articles_02' => 'qillqatanaka',
156
-	'info_articles_2' => 'Qillqatanaka',
157
-	'info_articles_auteur' => 'Aka qillqirit qillqatanaka',
158
-	'info_articles_trouves' => 'Qillqatanak jikita',
159
-	'info_attente_validation' => 'Qillqatanakax iyaw sañataki suyaski',
160
-	'info_aujourdhui' => 'jichhüru:',
161
-	'info_auteur_gere_toutes_rubriques_2' => 'Je gère <b>toutes les rubriques</b>', # MODIF
162
-	'info_auteurs' => 'Qillqirinaka',
163
-	'info_auteurs_par_tri' => 'Qillqirinaka@partri@',
164
-	'info_auteurs_trouves' => 'Qillqirinaka jikita',
165
-	'info_authentification_externe' => 'Anqax chiqpach siriwi',
166
-	'info_avertissement' => 'Amuyam',
167
-	'info_base_installee' => 'Ch’akha ch’akha pirwa yatiyawinakamatxa uchantataxiwa',
168
-	'info_chapeau' => 'Qalltawi',
169
-	'info_chapeau_2' => 'Qalltawi:',
170
-	'info_chemin_acces_1' => 'Ajlliñatakiwa:  &lt;b&gt;&lt;/b&gt;mantañ thakhita jach’a q’ipina&lt;/b&gt;',
171
-	'info_chemin_acces_annuaire' => 'Ajllañatakiwa:  &lt;b&gt;Mantañ thakhi jach’a q’ipina&lt;/b&gt;',
172
-	'info_choix_base' => 'Kimsir sarawi:',
173
-	'info_classement_1' => '° ukjaru @liste@',
174
-	'info_classement_2' => '° ukjaru @liste@ 
153
+    'info_article_2' => 'qillqatanaka',
154
+    'info_article_a_paraitre' => 'Qillqatanak jutir urumpi yatiyataru',
155
+    'info_articles_02' => 'qillqatanaka',
156
+    'info_articles_2' => 'Qillqatanaka',
157
+    'info_articles_auteur' => 'Aka qillqirit qillqatanaka',
158
+    'info_articles_trouves' => 'Qillqatanak jikita',
159
+    'info_attente_validation' => 'Qillqatanakax iyaw sañataki suyaski',
160
+    'info_aujourdhui' => 'jichhüru:',
161
+    'info_auteur_gere_toutes_rubriques_2' => 'Je gère <b>toutes les rubriques</b>', # MODIF
162
+    'info_auteurs' => 'Qillqirinaka',
163
+    'info_auteurs_par_tri' => 'Qillqirinaka@partri@',
164
+    'info_auteurs_trouves' => 'Qillqirinaka jikita',
165
+    'info_authentification_externe' => 'Anqax chiqpach siriwi',
166
+    'info_avertissement' => 'Amuyam',
167
+    'info_base_installee' => 'Ch’akha ch’akha pirwa yatiyawinakamatxa uchantataxiwa',
168
+    'info_chapeau' => 'Qalltawi',
169
+    'info_chapeau_2' => 'Qalltawi:',
170
+    'info_chemin_acces_1' => 'Ajlliñatakiwa:  &lt;b&gt;&lt;/b&gt;mantañ thakhita jach’a q’ipina&lt;/b&gt;',
171
+    'info_chemin_acces_annuaire' => 'Ajllañatakiwa:  &lt;b&gt;Mantañ thakhi jach’a q’ipina&lt;/b&gt;',
172
+    'info_choix_base' => 'Kimsir sarawi:',
173
+    'info_classement_1' => '° ukjaru @liste@',
174
+    'info_classement_2' => '° ukjaru @liste@ 
175 175
 ',
176
-	'info_code_acces' => '¡Mantañ chimpunakam jan armasimti!',
177
-	'info_config_suivi_explication' => 'Tanta aruskipayiriru aka qamawitxa qillqayasismaw. Aruskipayiritxa qillqatanakat yatiyawinak qatuqata ukatsti jisk’aptat amtatanak yatiyatawiru.',
178
-	'info_confirmer_passe' => 'Machaq imt’aw iyaw saña: ',
179
-	'info_connexion_base' => 'Payir sarawi: &lt;b&gt;chinuñ yant’awi base ukaru&lt;/b&gt;',
180
-	'info_connexion_ldap_ok' => 'LDAP chinuwix lurt’xiwa.</b><p> jutir sarawir sarantasmawa.</p>', # MODIF
181
-	'info_connexion_mysql' => 'Mayir sarawi: <b> MySQL chinuwima</b>',
182
-	'info_connexion_ok' => 'Chinuwix lurt’xiwa.',
183
-	'info_contact' => 'Jikxatata',
184
-	'info_contenu_articles' => 'Qillqatanakat utjawi',
185
-	'info_creation_paragraphe' => ' (Tanta amuyunak uñstayañatakix, ch’usa siqinak jaytam)', # MODIF
186
-	'info_creation_rubrique' => 'Janir qillqatanak qillt’asinxa, &lt;br /&gt; mä t’aqa uñstayañama.&lt;br /&gt;',
187
-	'info_creation_tables' => 'Pusir sarawi: &lt;b&gt;base ukat uyu uyunakat uñstayawi&lt;/b&gt; ',
188
-	'info_creer_base' => '&lt;b&gt;uñstayaña&lt;/b&gt; mä machaq yatiyawinak pirwa: ',
189
-	'info_dans_rubrique' => 'T’aqanxa...',
190
-	'info_date_publication_anterieure' => 'Nayrt’ir uru aka qillqawita',
191
-	'info_date_referencement' => 'APXASIW URU AKA QAMAWITA:',
192
-	'info_derniere_etape' => 'Qhipa sarawi: ¡tukuytanwa!',
193
-	'info_descriptif' => 'Uñt’ayawi:',
194
-	'info_discussion_cours' => 'Amuyt’awinakax lurasiskiw',
195
-	'info_ecrire_article' => 'Janir qillqatanak qillqasinxa, mä t’aqa uñstayañamawa.',
196
-	'info_email_envoi' => 'Apaw aruskipayirit utjawipa (ajlliñatakiwa)',
197
-	'info_email_webmestre' => 'Aruskipayirit utjawipa webmaster ukata (ajlliñatakiwa)', # MODIF
198
-	'info_envoi_email_automatique' => 'Aruskipayirinakat justup apayawi',
199
-	'info_envoyer_maintenant' => 'Jichhaki apayaña',
200
-	'info_etape_suivante' => 'Arkir sarawir sarantaña',
201
-	'info_etape_suivante_1' => 'Arkir sarawir sarantasmawa',
202
-	'info_etape_suivante_2' => 'Arkir sarawir sarantasmawa',
203
-	'info_exportation_base' => 'base ukax apsusispaw @archive@ uka tuqiru',
204
-	'info_facilite_suivi_activite' => 'Qillqa lurawit uñch’ukiw jasachañatakix, SPIP ukax aruskipayirit apayaspa, mä tanta qillqirinakar ukhama yatiyatawinakataki yatiyawinaka ukatak mayiwinaka, ukhamarak qillqatanakat iyaw sawi.', # MODIF
205
-	'info_fichiers_authent' => 'Chiqpach sirit q’ipinaka «.htpasswd» ',
206
-	'info_forums_abo_invites' => 'Qamawimax aruskipañawinakaniw qullqimp qillqatanakatakikiwa; Aka jach’a uta qamawinxa tumpirinakaru qillqayasiñataki jawthapiyi.',
207
-	'info_gauche_auteurs' => 'Akanxa taqpach qamawit qillqirinakaw uñsti. Kunjamaskis ukxa jisk’a saltan kulurapampiw   uñacht’ayi (apnaqiri = ch’uxña, qillqiri = q’illu).',
208
-	'info_gauche_auteurs_exterieurs' => 'Anqajankir qillqirinakax, qamawir jan mantañaniwa, mä laram jisk’a saltampiw uñacht’ayataski; mä wayaqamp chhaqayatakis.', # MODIF
209
-	'info_gauche_messagerie' => 'Yatiyawirix yatiyasiwa, amtayirinak uñstyaña yatiyaw tantaru kuns apaniñapataki jan ukjax yatiyawinak yatiyaña ( apnaqir qutu ukar mayachatakis ukjax)
176
+    'info_code_acces' => '¡Mantañ chimpunakam jan armasimti!',
177
+    'info_config_suivi_explication' => 'Tanta aruskipayiriru aka qamawitxa qillqayasismaw. Aruskipayiritxa qillqatanakat yatiyawinak qatuqata ukatsti jisk’aptat amtatanak yatiyatawiru.',
178
+    'info_confirmer_passe' => 'Machaq imt’aw iyaw saña: ',
179
+    'info_connexion_base' => 'Payir sarawi: &lt;b&gt;chinuñ yant’awi base ukaru&lt;/b&gt;',
180
+    'info_connexion_ldap_ok' => 'LDAP chinuwix lurt’xiwa.</b><p> jutir sarawir sarantasmawa.</p>', # MODIF
181
+    'info_connexion_mysql' => 'Mayir sarawi: <b> MySQL chinuwima</b>',
182
+    'info_connexion_ok' => 'Chinuwix lurt’xiwa.',
183
+    'info_contact' => 'Jikxatata',
184
+    'info_contenu_articles' => 'Qillqatanakat utjawi',
185
+    'info_creation_paragraphe' => ' (Tanta amuyunak uñstayañatakix, ch’usa siqinak jaytam)', # MODIF
186
+    'info_creation_rubrique' => 'Janir qillqatanak qillt’asinxa, &lt;br /&gt; mä t’aqa uñstayañama.&lt;br /&gt;',
187
+    'info_creation_tables' => 'Pusir sarawi: &lt;b&gt;base ukat uyu uyunakat uñstayawi&lt;/b&gt; ',
188
+    'info_creer_base' => '&lt;b&gt;uñstayaña&lt;/b&gt; mä machaq yatiyawinak pirwa: ',
189
+    'info_dans_rubrique' => 'T’aqanxa...',
190
+    'info_date_publication_anterieure' => 'Nayrt’ir uru aka qillqawita',
191
+    'info_date_referencement' => 'APXASIW URU AKA QAMAWITA:',
192
+    'info_derniere_etape' => 'Qhipa sarawi: ¡tukuytanwa!',
193
+    'info_descriptif' => 'Uñt’ayawi:',
194
+    'info_discussion_cours' => 'Amuyt’awinakax lurasiskiw',
195
+    'info_ecrire_article' => 'Janir qillqatanak qillqasinxa, mä t’aqa uñstayañamawa.',
196
+    'info_email_envoi' => 'Apaw aruskipayirit utjawipa (ajlliñatakiwa)',
197
+    'info_email_webmestre' => 'Aruskipayirit utjawipa webmaster ukata (ajlliñatakiwa)', # MODIF
198
+    'info_envoi_email_automatique' => 'Aruskipayirinakat justup apayawi',
199
+    'info_envoyer_maintenant' => 'Jichhaki apayaña',
200
+    'info_etape_suivante' => 'Arkir sarawir sarantaña',
201
+    'info_etape_suivante_1' => 'Arkir sarawir sarantasmawa',
202
+    'info_etape_suivante_2' => 'Arkir sarawir sarantasmawa',
203
+    'info_exportation_base' => 'base ukax apsusispaw @archive@ uka tuqiru',
204
+    'info_facilite_suivi_activite' => 'Qillqa lurawit uñch’ukiw jasachañatakix, SPIP ukax aruskipayirit apayaspa, mä tanta qillqirinakar ukhama yatiyatawinakataki yatiyawinaka ukatak mayiwinaka, ukhamarak qillqatanakat iyaw sawi.', # MODIF
205
+    'info_fichiers_authent' => 'Chiqpach sirit q’ipinaka «.htpasswd» ',
206
+    'info_forums_abo_invites' => 'Qamawimax aruskipañawinakaniw qullqimp qillqatanakatakikiwa; Aka jach’a uta qamawinxa tumpirinakaru qillqayasiñataki jawthapiyi.',
207
+    'info_gauche_auteurs' => 'Akanxa taqpach qamawit qillqirinakaw uñsti. Kunjamaskis ukxa jisk’a saltan kulurapampiw   uñacht’ayi (apnaqiri = ch’uxña, qillqiri = q’illu).',
208
+    'info_gauche_auteurs_exterieurs' => 'Anqajankir qillqirinakax, qamawir jan mantañaniwa, mä laram jisk’a saltampiw uñacht’ayataski; mä wayaqamp chhaqayatakis.', # MODIF
209
+    'info_gauche_messagerie' => 'Yatiyawirix yatiyasiwa, amtayirinak uñstyaña yatiyaw tantaru kuns apaniñapataki jan ukjax yatiyawinak yatiyaña ( apnaqir qutu ukar mayachatakis ukjax)
210 210
 ',
211
-	'info_gauche_statistiques_referers' => 'Aka Web qamawix tantanak uñicht’ayi &lt;i&gt;referers&lt;/i&gt;, qamawinakan chinunak utjkis ukhamarak juman qamawimar apapxi, masurutakiki ukhamarak jichhurutakiki; aka tantaxa sapa pä tunka urasanaka ch’usaru uskuña.',
212
-	'info_gauche_visiteurs_enregistres' => 'Akanxa jach’a qamaw utan qillqatanakakiw jikxatasi (aruskipañawinak qillqayasiyampi)',
213
-	'info_identification_publique' => 'Uñacht’ayawima...'
211
+    'info_gauche_statistiques_referers' => 'Aka Web qamawix tantanak uñicht’ayi &lt;i&gt;referers&lt;/i&gt;, qamawinakan chinunak utjkis ukhamarak juman qamawimar apapxi, masurutakiki ukhamarak jichhurutakiki; aka tantaxa sapa pä tunka urasanaka ch’usaru uskuña.',
212
+    'info_gauche_visiteurs_enregistres' => 'Akanxa jach’a qamaw utan qillqatanakakiw jikxatasi (aruskipañawinak qillqayasiyampi)',
213
+    'info_identification_publique' => 'Uñacht’ayawima...'
214 214
 );
Please login to merge, or discard this patch.