Completed
Push — master ( 72a024...b38d7e )
by cam
01:50
created
prive/formulaires/instituer_objet.php 2 patches
Indentation   +108 added lines, -108 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
 include_spip('inc/editer');
@@ -32,17 +32,17 @@  discard block
 block discarded – undo
32 32
  * @return array
33 33
  */
34 34
 function lister_statuts_proposes($desc, $publiable = true) {
35
-	if (!isset($desc['statut_textes_instituer'])) {
36
-		return false;
37
-	}
35
+    if (!isset($desc['statut_textes_instituer'])) {
36
+        return false;
37
+    }
38 38
 
39
-	$l = $desc['statut_textes_instituer'];
40
-	if (!$publiable) {
41
-		unset($l['publie']);
42
-		unset($l['refuse']);
43
-	}
39
+    $l = $desc['statut_textes_instituer'];
40
+    if (!$publiable) {
41
+        unset($l['publie']);
42
+        unset($l['refuse']);
43
+    }
44 44
 
45
-	return $l;
45
+    return $l;
46 46
 }
47 47
 
48 48
 /**
@@ -64,54 +64,54 @@  discard block
 block discarded – undo
64 64
  *     Environnement du formulaire ou false si aucun affichage à faire.
65 65
  */
66 66
 function formulaires_instituer_objet_charger_dist($objet, $id_objet, $retour = '', $editable = true) {
67
-	$editable = ($editable ? true : false);
68
-
69
-	$table = table_objet_sql($objet);
70
-	$desc = lister_tables_objets_sql($table);
71
-
72
-	if (!isset($desc['statut_textes_instituer'])) {
73
-		return false;
74
-	}
75
-
76
-	if (!autoriser('modifier', $objet, $id_objet)) {
77
-		$editable = false;
78
-	}
79
-
80
-	// charger le contenu de l'objet
81
-	// dont son champ statut
82
-	$v = formulaires_editer_objet_charger($objet, $id_objet, 0, 0, '', '');
83
-
84
-	$publiable = true;
85
-	$statuts = lister_statuts_proposes($desc);
86
-	// tester si on a le droit de publier, si un statut publie existe
87
-	if (isset($statuts['publie'])) {
88
-		if (!autoriser('instituer', $objet, $id_objet, null, ['statut' => 'publie'])) {
89
-			if ($v['statut'] == 'publie') {
90
-				$editable = false;
91
-			} else {
92
-				$publiable = false;
93
-			}
94
-		}
95
-	}
96
-	$statuts = lister_statuts_proposes($desc, $editable ? $publiable : true);
97
-	if (count($statuts) == 1 and isset($statuts[$v['statut']])) {
98
-		$editable = false;
99
-	}
100
-
101
-	$valeurs = [
102
-		'editable' => $editable,
103
-		'statut' => $v['statut'],
104
-		'_objet' => $objet,
105
-		'_id_objet' => $id_objet,
106
-		'_statuts' => $statuts,
107
-		'_publiable' => $publiable,
108
-		'_label' => $desc['texte_changer_statut'] ?? 'texte_article_statut',
109
-		'_aide' => $desc['aide_changer_statut'] ?? '',
110
-		'_hidden' => "<input type='hidden' name='statut_old' value='" . $v['statut'] . "' />",
111
-	];
112
-
113
-	#if (!count($valeurs['statuts']))
114
-	return $valeurs;
67
+    $editable = ($editable ? true : false);
68
+
69
+    $table = table_objet_sql($objet);
70
+    $desc = lister_tables_objets_sql($table);
71
+
72
+    if (!isset($desc['statut_textes_instituer'])) {
73
+        return false;
74
+    }
75
+
76
+    if (!autoriser('modifier', $objet, $id_objet)) {
77
+        $editable = false;
78
+    }
79
+
80
+    // charger le contenu de l'objet
81
+    // dont son champ statut
82
+    $v = formulaires_editer_objet_charger($objet, $id_objet, 0, 0, '', '');
83
+
84
+    $publiable = true;
85
+    $statuts = lister_statuts_proposes($desc);
86
+    // tester si on a le droit de publier, si un statut publie existe
87
+    if (isset($statuts['publie'])) {
88
+        if (!autoriser('instituer', $objet, $id_objet, null, ['statut' => 'publie'])) {
89
+            if ($v['statut'] == 'publie') {
90
+                $editable = false;
91
+            } else {
92
+                $publiable = false;
93
+            }
94
+        }
95
+    }
96
+    $statuts = lister_statuts_proposes($desc, $editable ? $publiable : true);
97
+    if (count($statuts) == 1 and isset($statuts[$v['statut']])) {
98
+        $editable = false;
99
+    }
100
+
101
+    $valeurs = [
102
+        'editable' => $editable,
103
+        'statut' => $v['statut'],
104
+        '_objet' => $objet,
105
+        '_id_objet' => $id_objet,
106
+        '_statuts' => $statuts,
107
+        '_publiable' => $publiable,
108
+        '_label' => $desc['texte_changer_statut'] ?? 'texte_article_statut',
109
+        '_aide' => $desc['aide_changer_statut'] ?? '',
110
+        '_hidden' => "<input type='hidden' name='statut_old' value='" . $v['statut'] . "' />",
111
+    ];
112
+
113
+    #if (!count($valeurs['statuts']))
114
+    return $valeurs;
115 115
 }
116 116
 
117 117
 /**
@@ -131,35 +131,35 @@  discard block
 block discarded – undo
131 131
  *     Tableau des erreurs
132 132
  */
133 133
 function formulaires_instituer_objet_verifier_dist($objet, $id_objet, $retour = '', $editable = true) {
134
-	$erreurs = [];
135
-	// charger le contenu de l'objet
136
-	// dont son champ statut
137
-	$v = formulaires_editer_objet_charger($objet, $id_objet, 0, 0, '', '');
138
-
139
-	if ($v['statut'] !== _request('statut_old')) {
140
-		$erreurs['statut'] = _T('instituer_erreur_statut_a_change');
141
-	} else {
142
-		$table = table_objet_sql($objet);
143
-		$desc = lister_tables_objets_sql($table);
144
-
145
-		$publiable = true;
146
-		if (
147
-			isset($v['id_rubrique'])
148
-			and !autoriser('publierdans', 'rubrique', $v['id_rubrique'])
149
-		) {
150
-			$publiable = false;
151
-		}
152
-		$l = lister_statuts_proposes($desc, $publiable);
153
-		$statut = _request('statut');
154
-		if (
155
-			!isset($l[$statut])
156
-			or !autoriser('instituer', $objet, $id_objet, '', ['statut' => $statut])
157
-		) {
158
-			$erreurs['statut'] = _T('instituer_erreur_statut_non_autorise');
159
-		}
160
-	}
161
-
162
-	return $erreurs;
134
+    $erreurs = [];
135
+    // charger le contenu de l'objet
136
+    // dont son champ statut
137
+    $v = formulaires_editer_objet_charger($objet, $id_objet, 0, 0, '', '');
138
+
139
+    if ($v['statut'] !== _request('statut_old')) {
140
+        $erreurs['statut'] = _T('instituer_erreur_statut_a_change');
141
+    } else {
142
+        $table = table_objet_sql($objet);
143
+        $desc = lister_tables_objets_sql($table);
144
+
145
+        $publiable = true;
146
+        if (
147
+            isset($v['id_rubrique'])
148
+            and !autoriser('publierdans', 'rubrique', $v['id_rubrique'])
149
+        ) {
150
+            $publiable = false;
151
+        }
152
+        $l = lister_statuts_proposes($desc, $publiable);
153
+        $statut = _request('statut');
154
+        if (
155
+            !isset($l[$statut])
156
+            or !autoriser('instituer', $objet, $id_objet, '', ['statut' => $statut])
157
+        ) {
158
+            $erreurs['statut'] = _T('instituer_erreur_statut_non_autorise');
159
+        }
160
+    }
161
+
162
+    return $erreurs;
163 163
 }
164 164
 
165 165
 /**
@@ -178,25 +178,25 @@  discard block
 block discarded – undo
178 178
  */
179 179
 function formulaires_instituer_objet_traiter_dist($objet, $id_objet, $retour = '', $editable = true) {
180 180
 
181
-	$c = ['statut' => _request('statut')];
182
-	// si on a envoye une 'date_posterieure', l'enregistrer
183
-	// todo dans le HTML
184
-	if ($d = _request('date_posterieure')) {
185
-		$c['date'] = $d;
186
-	}
187
-
188
-
189
-	include_spip('action/editer_objet');
190
-	if ($err = objet_instituer($objet, $id_objet, $c)) {
191
-		$res = ['message_erreur' => $err];
192
-	} else {
193
-		$res = ['message_ok' => _T('info_modification_enregistree')];
194
-		if ($retour) {
195
-			$res['redirect'] = $retour;
196
-		}
197
-		set_request('statut');
198
-		set_request('date_posterieure');
199
-	}
200
-
201
-	return $res;
181
+    $c = ['statut' => _request('statut')];
182
+    // si on a envoye une 'date_posterieure', l'enregistrer
183
+    // todo dans le HTML
184
+    if ($d = _request('date_posterieure')) {
185
+        $c['date'] = $d;
186
+    }
187
+
188
+
189
+    include_spip('action/editer_objet');
190
+    if ($err = objet_instituer($objet, $id_objet, $c)) {
191
+        $res = ['message_erreur' => $err];
192
+    } else {
193
+        $res = ['message_ok' => _T('info_modification_enregistree')];
194
+        if ($retour) {
195
+            $res['redirect'] = $retour;
196
+        }
197
+        set_request('statut');
198
+        set_request('date_posterieure');
199
+    }
200
+
201
+    return $res;
202 202
 }
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -107,7 +107,7 @@
 block discarded – undo
107 107
 		'_publiable' => $publiable,
108 108
 		'_label' => $desc['texte_changer_statut'] ?? 'texte_article_statut',
109 109
 		'_aide' => $desc['aide_changer_statut'] ?? '',
110
-		'_hidden' => "<input type='hidden' name='statut_old' value='" . $v['statut'] . "' />",
110
+		'_hidden' => "<input type='hidden' name='statut_old' value='".$v['statut']."' />",
111 111
 	];
112 112
 
113 113
 	#if (!count($valeurs['statuts']))
Please login to merge, or discard this patch.
prive/formulaires/editer_liens.php 2 patches
Indentation   +352 added lines, -352 removed lines patch added patch discarded remove patch
@@ -16,7 +16,7 @@  discard block
 block discarded – undo
16 16
  * @package SPIP\Core\Formulaires
17 17
  **/
18 18
 if (!defined('_ECRIRE_INC_VERSION')) {
19
-	return;
19
+    return;
20 20
 }
21 21
 
22 22
 
@@ -36,25 +36,25 @@  discard block
 block discarded – undo
36 36
  *   ($table_source,$objet,$id_objet,$objet_lien)
37 37
  */
38 38
 function determine_source_lien_objet($a, $b, $c) {
39
-	$table_source = $objet_lien = $objet = $id_objet = null;
40
-	// auteurs, article, 23 :
41
-	// associer des auteurs à l'article 23, sur la table pivot spip_auteurs_liens
42
-	if (is_numeric($c) and !is_numeric($b)) {
43
-		$table_source = table_objet($a);
44
-		$objet_lien = objet_type($a);
45
-		$objet = objet_type($b);
46
-		$id_objet = $c;
47
-	}
48
-	// article, 23, auteurs
49
-	// associer des auteurs à l'article 23, sur la table pivot spip_articles_liens
50
-	if (is_numeric($b) and !is_numeric($c)) {
51
-		$table_source = table_objet($c);
52
-		$objet_lien = objet_type($a);
53
-		$objet = objet_type($a);
54
-		$id_objet = $b;
55
-	}
56
-
57
-	return [$table_source, $objet, $id_objet, $objet_lien];
39
+    $table_source = $objet_lien = $objet = $id_objet = null;
40
+    // auteurs, article, 23 :
41
+    // associer des auteurs à l'article 23, sur la table pivot spip_auteurs_liens
42
+    if (is_numeric($c) and !is_numeric($b)) {
43
+        $table_source = table_objet($a);
44
+        $objet_lien = objet_type($a);
45
+        $objet = objet_type($b);
46
+        $id_objet = $c;
47
+    }
48
+    // article, 23, auteurs
49
+    // associer des auteurs à l'article 23, sur la table pivot spip_articles_liens
50
+    if (is_numeric($b) and !is_numeric($c)) {
51
+        $table_source = table_objet($c);
52
+        $objet_lien = objet_type($a);
53
+        $objet = objet_type($a);
54
+        $id_objet = $b;
55
+    }
56
+
57
+    return [$table_source, $objet, $id_objet, $objet_lien];
58 58
 }
59 59
 
60 60
 /**
@@ -80,93 +80,93 @@  discard block
 block discarded – undo
80 80
  */
81 81
 function formulaires_editer_liens_charger_dist($a, $b, $c, $options = []) {
82 82
 
83
-	// compat avec ancienne signature ou le 4eme argument est $editable
84
-	if (!is_array($options)) {
85
-		$options = ['editable' => $options];
86
-	} elseif (!isset($options['editable'])) {
87
-		$options['editable'] = true;
88
-	}
89
-
90
-	$editable = $options['editable'];
91
-
92
-	[$table_source, $objet, $id_objet, $objet_lien] = determine_source_lien_objet($a, $b, $c);
93
-	if (!$table_source or !$objet or !$objet_lien or !$id_objet) {
94
-		return false;
95
-	}
96
-
97
-	$objet_source = objet_type($table_source);
98
-	$table_sql_source = table_objet_sql($objet_source);
99
-
100
-	// verifier existence de la table xxx_liens
101
-	include_spip('action/editer_liens');
102
-	if (!objet_associable($objet_lien)) {
103
-		return false;
104
-	}
105
-
106
-	// L'éditabilité :) est définie par un test permanent (par exemple "associermots") ET le 4ème argument
107
-	include_spip('inc/autoriser');
108
-	$editable = ($editable and autoriser('associer' . $table_source, $objet, $id_objet)
109
-		and autoriser('modifier', $objet, $id_objet));
110
-
111
-	if (
112
-		!$editable and !count(objet_trouver_liens(
113
-			[$objet_lien => '*'],
114
-			[($objet_lien == $objet_source ? $objet : $objet_source) => $id_objet]
115
-		))
116
-	) {
117
-		return false;
118
-	}
119
-
120
-	// squelettes de vue et de d'association
121
-	// ils sont différents si des rôles sont définis.
122
-	$skel_vue = $table_source . '_lies';
123
-	$skel_ajout = $table_source . '_associer';
124
-
125
-	// description des roles
126
-	include_spip('inc/roles');
127
-	if ($roles = roles_presents($objet_source, $objet)) {
128
-		// on demande de nouveaux squelettes en conséquence
129
-		$skel_vue = $table_source . '_roles_lies';
130
-		$skel_ajout = $table_source . '_roles_associer';
131
-	}
132
-
133
-	$oups = _request('_oups') ?? '';
134
-	if ($oups) {
135
-		if (unserialize(base64_decode($oups))) {
136
-			// on est bon, rien a faire
137
-		} elseif (unserialize($oups)) {
138
-			// il faut encoder
139
-			$oups = base64_encode($oups);
140
-		} else {
141
-			$oups = '';
142
-		}
143
-	}
144
-	$valeurs = [
145
-		'id' => "$table_source-$objet-$id_objet-$objet_lien", // identifiant unique pour les id du form
146
-		'_vue_liee' => $skel_vue,
147
-		'_vue_ajout' => $skel_ajout,
148
-		'_objet_lien' => $objet_lien,
149
-		'id_lien_ajoute' => _request('id_lien_ajoute'),
150
-		'objet' => $objet,
151
-		'id_objet' => $id_objet,
152
-		'objet_source' => $objet_source,
153
-		'table_source' => $table_source,
154
-		'recherche' => '',
155
-		'visible' => 0,
156
-		'ajouter_lien' => '',
157
-		'supprimer_lien' => '',
158
-		'qualifier_lien' => '',
159
-		'ordonner_lien' => '',
160
-		'desordonner_liens' => '',
161
-		'_roles' => $roles, # description des roles
162
-		'_oups' => $oups,
163
-		'editable' => $editable,
164
-	];
165
-
166
-	// les options non definies dans $valeurs sont passees telles quelles au formulaire html
167
-	$valeurs = array_merge($options, $valeurs);
168
-
169
-	return $valeurs;
83
+    // compat avec ancienne signature ou le 4eme argument est $editable
84
+    if (!is_array($options)) {
85
+        $options = ['editable' => $options];
86
+    } elseif (!isset($options['editable'])) {
87
+        $options['editable'] = true;
88
+    }
89
+
90
+    $editable = $options['editable'];
91
+
92
+    [$table_source, $objet, $id_objet, $objet_lien] = determine_source_lien_objet($a, $b, $c);
93
+    if (!$table_source or !$objet or !$objet_lien or !$id_objet) {
94
+        return false;
95
+    }
96
+
97
+    $objet_source = objet_type($table_source);
98
+    $table_sql_source = table_objet_sql($objet_source);
99
+
100
+    // verifier existence de la table xxx_liens
101
+    include_spip('action/editer_liens');
102
+    if (!objet_associable($objet_lien)) {
103
+        return false;
104
+    }
105
+
106
+    // L'éditabilité :) est définie par un test permanent (par exemple "associermots") ET le 4ème argument
107
+    include_spip('inc/autoriser');
108
+    $editable = ($editable and autoriser('associer' . $table_source, $objet, $id_objet)
109
+        and autoriser('modifier', $objet, $id_objet));
110
+
111
+    if (
112
+        !$editable and !count(objet_trouver_liens(
113
+            [$objet_lien => '*'],
114
+            [($objet_lien == $objet_source ? $objet : $objet_source) => $id_objet]
115
+        ))
116
+    ) {
117
+        return false;
118
+    }
119
+
120
+    // squelettes de vue et de d'association
121
+    // ils sont différents si des rôles sont définis.
122
+    $skel_vue = $table_source . '_lies';
123
+    $skel_ajout = $table_source . '_associer';
124
+
125
+    // description des roles
126
+    include_spip('inc/roles');
127
+    if ($roles = roles_presents($objet_source, $objet)) {
128
+        // on demande de nouveaux squelettes en conséquence
129
+        $skel_vue = $table_source . '_roles_lies';
130
+        $skel_ajout = $table_source . '_roles_associer';
131
+    }
132
+
133
+    $oups = _request('_oups') ?? '';
134
+    if ($oups) {
135
+        if (unserialize(base64_decode($oups))) {
136
+            // on est bon, rien a faire
137
+        } elseif (unserialize($oups)) {
138
+            // il faut encoder
139
+            $oups = base64_encode($oups);
140
+        } else {
141
+            $oups = '';
142
+        }
143
+    }
144
+    $valeurs = [
145
+        'id' => "$table_source-$objet-$id_objet-$objet_lien", // identifiant unique pour les id du form
146
+        '_vue_liee' => $skel_vue,
147
+        '_vue_ajout' => $skel_ajout,
148
+        '_objet_lien' => $objet_lien,
149
+        'id_lien_ajoute' => _request('id_lien_ajoute'),
150
+        'objet' => $objet,
151
+        'id_objet' => $id_objet,
152
+        'objet_source' => $objet_source,
153
+        'table_source' => $table_source,
154
+        'recherche' => '',
155
+        'visible' => 0,
156
+        'ajouter_lien' => '',
157
+        'supprimer_lien' => '',
158
+        'qualifier_lien' => '',
159
+        'ordonner_lien' => '',
160
+        'desordonner_liens' => '',
161
+        '_roles' => $roles, # description des roles
162
+        '_oups' => $oups,
163
+        'editable' => $editable,
164
+    ];
165
+
166
+    // les options non definies dans $valeurs sont passees telles quelles au formulaire html
167
+    $valeurs = array_merge($options, $valeurs);
168
+
169
+    return $valeurs;
170 170
 }
171 171
 
172 172
 /**
@@ -210,165 +210,165 @@  discard block
 block discarded – undo
210 210
  * @return array
211 211
  */
212 212
 function formulaires_editer_liens_traiter_dist($a, $b, $c, $options = []) {
213
-	// compat avec ancienne signature ou le 4eme argument est $editable
214
-	if (!is_array($options)) {
215
-		$options = ['editable' => $options];
216
-	} elseif (!isset($options['editable'])) {
217
-		$options['editable'] = true;
218
-	}
219
-
220
-	$editable = $options['editable'];
221
-
222
-	$res = ['editable' => $editable ? true : false];
223
-	[$table_source, $objet, $id_objet, $objet_lien] = determine_source_lien_objet($a, $b, $c);
224
-	if (!$table_source or !$objet or !$objet_lien) {
225
-		return $res;
226
-	}
227
-
228
-
229
-	if (_request('tout_voir')) {
230
-		set_request('recherche', '');
231
-	}
232
-
233
-	include_spip('inc/autoriser');
234
-	if (autoriser('modifier', $objet, $id_objet)) {
235
-		// annuler les suppressions du coup d'avant !
236
-		if (
237
-			_request('annuler_oups')
238
-			and $oups = _request('_oups')
239
-			and $oups = base64_decode($oups)
240
-			and $oups = unserialize($oups)
241
-		) {
242
-			if ($oups_objets = charger_fonction("editer_liens_oups_{$table_source}_{$objet}_{$objet_lien}", 'action', true)) {
243
-				$oups_objets($oups);
244
-			} else {
245
-				$objet_source = objet_type($table_source);
246
-				include_spip('action/editer_liens');
247
-				foreach ($oups as $oup) {
248
-					if ($objet_lien == $objet_source) {
249
-						objet_associer([$objet_source => $oup[$objet_source]], [$objet => $oup[$objet]], $oup);
250
-					} else {
251
-						objet_associer([$objet => $oup[$objet]], [$objet_source => $oup[$objet_source]], $oup);
252
-					}
253
-				}
254
-			}
255
-			# oups ne persiste que pour la derniere action, si suppression
256
-			set_request('_oups');
257
-		}
258
-
259
-		$supprimer = _request('supprimer_lien');
260
-		$ajouter = _request('ajouter_lien');
261
-		$ordonner = _request('ordonner_lien');
262
-
263
-		if (_request('desordonner_liens')) {
264
-			include_spip('action/editer_liens');
265
-			objet_qualifier_liens([$objet_lien => '*'], [$objet => $id_objet], ['rang_lien' => 0]);
266
-		}
267
-
268
-		// il est possible de preciser dans une seule variable un remplacement :
269
-		// remplacer_lien[old][new]
270
-		if ($remplacer = _request('remplacer_lien')) {
271
-			foreach ($remplacer as $k => $v) {
272
-				if ($old = lien_verifier_action($k, '')) {
273
-					foreach (is_array($v) ? $v : [$v] as $kn => $vn) {
274
-						if ($new = lien_verifier_action($kn, $vn)) {
275
-							$supprimer[$old] = 'x';
276
-							$ajouter[$new] = '+';
277
-						}
278
-					}
279
-				}
280
-			}
281
-		}
282
-
283
-		if ($supprimer) {
284
-			if (
285
-				$supprimer_objets = charger_fonction(
286
-					"editer_liens_supprimer_{$table_source}_{$objet}_{$objet_lien}",
287
-					'action',
288
-					true
289
-				)
290
-			) {
291
-				$oups = $supprimer_objets($supprimer);
292
-			} else {
293
-				include_spip('action/editer_liens');
294
-				$oups = [];
295
-
296
-				foreach ($supprimer as $k => $v) {
297
-					if ($lien = lien_verifier_action($k, $v)) {
298
-						$lien = explode('-', $lien);
299
-						[$objet_source, $ids, $objet_lie, $idl, $role] = array_pad($lien, 5, null);
300
-						// appliquer une condition sur le rôle si défini ('*' pour tous les roles)
301
-						$cond = (!is_null($role) ? ['role' => $role] : []);
302
-						if ($objet_lien == $objet_source) {
303
-							$oups = array_merge(
304
-								$oups,
305
-								objet_trouver_liens([$objet_source => $ids], [$objet_lie => $idl], $cond)
306
-							);
307
-							objet_dissocier([$objet_source => $ids], [$objet_lie => $idl], $cond);
308
-						} else {
309
-							$oups = array_merge(
310
-								$oups,
311
-								objet_trouver_liens([$objet_lie => $idl], [$objet_source => $ids], $cond)
312
-							);
313
-							objet_dissocier([$objet_lie => $idl], [$objet_source => $ids], $cond);
314
-						}
315
-					}
316
-				}
317
-			}
318
-			set_request('_oups', $oups ? base64_encode(serialize($oups)) : null);
319
-		}
320
-
321
-		if ($ajouter) {
322
-			if (
323
-				$ajouter_objets = charger_fonction("editer_liens_ajouter_{$table_source}_{$objet}_{$objet_lien}", 'action', true)
324
-			) {
325
-				$ajout_ok = $ajouter_objets($ajouter);
326
-			} else {
327
-				$ajout_ok = false;
328
-				include_spip('action/editer_liens');
329
-				foreach ($ajouter as $k => $v) {
330
-					if ($lien = lien_verifier_action($k, $v)) {
331
-						$ajout_ok = true;
332
-						[$objet1, $ids, $objet2, $idl] = explode('-', $lien);
333
-						$qualifs = lien_retrouver_qualif($objet_lien, $lien);
334
-						if ($objet_lien == $objet1) {
335
-							lien_ajouter_liaisons($objet1, $ids, $objet2, $idl, $qualifs);
336
-						} else {
337
-							lien_ajouter_liaisons($objet2, $idl, $objet1, $ids, $qualifs);
338
-						}
339
-						set_request('id_lien_ajoute', $ids);
340
-					}
341
-				}
342
-			}
343
-			# oups ne persiste que pour la derniere action, si suppression
344
-			# une suppression suivie d'un ajout dans le meme hit est un remplacement
345
-			# non annulable !
346
-			if ($ajout_ok) {
347
-				set_request('_oups');
348
-			}
349
-		}
350
-
351
-		if ($ordonner) {
352
-			include_spip('action/editer_liens');
353
-			foreach ($ordonner as $k => $rang_lien) {
354
-				if ($lien = lien_verifier_action($k, '')) {
355
-					[$objet1, $ids, $objet2, $idl] = explode('-', $lien);
356
-					$qualif = ['rang_lien' => $rang_lien];
357
-
358
-					if ($objet_lien == $objet1) {
359
-						objet_qualifier_liens([$objet1 => $ids], [$objet2 => $idl], $qualif);
360
-					} else {
361
-						objet_qualifier_liens([$objet2 => $idl], [$objet1 => $ids], $qualif);
362
-					}
363
-					set_request('id_lien_ajoute', $ids);
364
-					set_request('_oups');
365
-				}
366
-			}
367
-		}
368
-	}
369
-
370
-
371
-	return $res;
213
+    // compat avec ancienne signature ou le 4eme argument est $editable
214
+    if (!is_array($options)) {
215
+        $options = ['editable' => $options];
216
+    } elseif (!isset($options['editable'])) {
217
+        $options['editable'] = true;
218
+    }
219
+
220
+    $editable = $options['editable'];
221
+
222
+    $res = ['editable' => $editable ? true : false];
223
+    [$table_source, $objet, $id_objet, $objet_lien] = determine_source_lien_objet($a, $b, $c);
224
+    if (!$table_source or !$objet or !$objet_lien) {
225
+        return $res;
226
+    }
227
+
228
+
229
+    if (_request('tout_voir')) {
230
+        set_request('recherche', '');
231
+    }
232
+
233
+    include_spip('inc/autoriser');
234
+    if (autoriser('modifier', $objet, $id_objet)) {
235
+        // annuler les suppressions du coup d'avant !
236
+        if (
237
+            _request('annuler_oups')
238
+            and $oups = _request('_oups')
239
+            and $oups = base64_decode($oups)
240
+            and $oups = unserialize($oups)
241
+        ) {
242
+            if ($oups_objets = charger_fonction("editer_liens_oups_{$table_source}_{$objet}_{$objet_lien}", 'action', true)) {
243
+                $oups_objets($oups);
244
+            } else {
245
+                $objet_source = objet_type($table_source);
246
+                include_spip('action/editer_liens');
247
+                foreach ($oups as $oup) {
248
+                    if ($objet_lien == $objet_source) {
249
+                        objet_associer([$objet_source => $oup[$objet_source]], [$objet => $oup[$objet]], $oup);
250
+                    } else {
251
+                        objet_associer([$objet => $oup[$objet]], [$objet_source => $oup[$objet_source]], $oup);
252
+                    }
253
+                }
254
+            }
255
+            # oups ne persiste que pour la derniere action, si suppression
256
+            set_request('_oups');
257
+        }
258
+
259
+        $supprimer = _request('supprimer_lien');
260
+        $ajouter = _request('ajouter_lien');
261
+        $ordonner = _request('ordonner_lien');
262
+
263
+        if (_request('desordonner_liens')) {
264
+            include_spip('action/editer_liens');
265
+            objet_qualifier_liens([$objet_lien => '*'], [$objet => $id_objet], ['rang_lien' => 0]);
266
+        }
267
+
268
+        // il est possible de preciser dans une seule variable un remplacement :
269
+        // remplacer_lien[old][new]
270
+        if ($remplacer = _request('remplacer_lien')) {
271
+            foreach ($remplacer as $k => $v) {
272
+                if ($old = lien_verifier_action($k, '')) {
273
+                    foreach (is_array($v) ? $v : [$v] as $kn => $vn) {
274
+                        if ($new = lien_verifier_action($kn, $vn)) {
275
+                            $supprimer[$old] = 'x';
276
+                            $ajouter[$new] = '+';
277
+                        }
278
+                    }
279
+                }
280
+            }
281
+        }
282
+
283
+        if ($supprimer) {
284
+            if (
285
+                $supprimer_objets = charger_fonction(
286
+                    "editer_liens_supprimer_{$table_source}_{$objet}_{$objet_lien}",
287
+                    'action',
288
+                    true
289
+                )
290
+            ) {
291
+                $oups = $supprimer_objets($supprimer);
292
+            } else {
293
+                include_spip('action/editer_liens');
294
+                $oups = [];
295
+
296
+                foreach ($supprimer as $k => $v) {
297
+                    if ($lien = lien_verifier_action($k, $v)) {
298
+                        $lien = explode('-', $lien);
299
+                        [$objet_source, $ids, $objet_lie, $idl, $role] = array_pad($lien, 5, null);
300
+                        // appliquer une condition sur le rôle si défini ('*' pour tous les roles)
301
+                        $cond = (!is_null($role) ? ['role' => $role] : []);
302
+                        if ($objet_lien == $objet_source) {
303
+                            $oups = array_merge(
304
+                                $oups,
305
+                                objet_trouver_liens([$objet_source => $ids], [$objet_lie => $idl], $cond)
306
+                            );
307
+                            objet_dissocier([$objet_source => $ids], [$objet_lie => $idl], $cond);
308
+                        } else {
309
+                            $oups = array_merge(
310
+                                $oups,
311
+                                objet_trouver_liens([$objet_lie => $idl], [$objet_source => $ids], $cond)
312
+                            );
313
+                            objet_dissocier([$objet_lie => $idl], [$objet_source => $ids], $cond);
314
+                        }
315
+                    }
316
+                }
317
+            }
318
+            set_request('_oups', $oups ? base64_encode(serialize($oups)) : null);
319
+        }
320
+
321
+        if ($ajouter) {
322
+            if (
323
+                $ajouter_objets = charger_fonction("editer_liens_ajouter_{$table_source}_{$objet}_{$objet_lien}", 'action', true)
324
+            ) {
325
+                $ajout_ok = $ajouter_objets($ajouter);
326
+            } else {
327
+                $ajout_ok = false;
328
+                include_spip('action/editer_liens');
329
+                foreach ($ajouter as $k => $v) {
330
+                    if ($lien = lien_verifier_action($k, $v)) {
331
+                        $ajout_ok = true;
332
+                        [$objet1, $ids, $objet2, $idl] = explode('-', $lien);
333
+                        $qualifs = lien_retrouver_qualif($objet_lien, $lien);
334
+                        if ($objet_lien == $objet1) {
335
+                            lien_ajouter_liaisons($objet1, $ids, $objet2, $idl, $qualifs);
336
+                        } else {
337
+                            lien_ajouter_liaisons($objet2, $idl, $objet1, $ids, $qualifs);
338
+                        }
339
+                        set_request('id_lien_ajoute', $ids);
340
+                    }
341
+                }
342
+            }
343
+            # oups ne persiste que pour la derniere action, si suppression
344
+            # une suppression suivie d'un ajout dans le meme hit est un remplacement
345
+            # non annulable !
346
+            if ($ajout_ok) {
347
+                set_request('_oups');
348
+            }
349
+        }
350
+
351
+        if ($ordonner) {
352
+            include_spip('action/editer_liens');
353
+            foreach ($ordonner as $k => $rang_lien) {
354
+                if ($lien = lien_verifier_action($k, '')) {
355
+                    [$objet1, $ids, $objet2, $idl] = explode('-', $lien);
356
+                    $qualif = ['rang_lien' => $rang_lien];
357
+
358
+                    if ($objet_lien == $objet1) {
359
+                        objet_qualifier_liens([$objet1 => $ids], [$objet2 => $idl], $qualif);
360
+                    } else {
361
+                        objet_qualifier_liens([$objet2 => $idl], [$objet1 => $ids], $qualif);
362
+                    }
363
+                    set_request('id_lien_ajoute', $ids);
364
+                    set_request('_oups');
365
+                }
366
+            }
367
+        }
368
+    }
369
+
370
+
371
+    return $res;
372 372
 }
373 373
 
374 374
 
@@ -391,24 +391,24 @@  discard block
 block discarded – undo
391 391
  * @return string Action demandée si trouvée, sinon ''
392 392
  */
393 393
 function lien_verifier_action($k, $v) {
394
-	$action = '';
395
-	if (preg_match(',^\w+-[\w*]+-[\w*]+-[\w*]+(-[\w*])?,', $k)) {
396
-		$action = $k;
397
-	}
398
-	if (preg_match(',^\w+-[\w*]+-[\w*]+-[\w*]+(-[\w*])?,', $v)) {
399
-		if (is_numeric($k)) {
400
-			$action = $v;
401
-		}
402
-		if (_request($k)) {
403
-			$action = $v;
404
-		}
405
-	}
406
-	// ajout un role null fictif (plus pratique) si pas défini
407
-	if ($action and count(explode('-', $action)) == 4) {
408
-		$action .= '-';
409
-	}
410
-
411
-	return $action;
394
+    $action = '';
395
+    if (preg_match(',^\w+-[\w*]+-[\w*]+-[\w*]+(-[\w*])?,', $k)) {
396
+        $action = $k;
397
+    }
398
+    if (preg_match(',^\w+-[\w*]+-[\w*]+-[\w*]+(-[\w*])?,', $v)) {
399
+        if (is_numeric($k)) {
400
+            $action = $v;
401
+        }
402
+        if (_request($k)) {
403
+            $action = $v;
404
+        }
405
+    }
406
+    // ajout un role null fictif (plus pratique) si pas défini
407
+    if ($action and count(explode('-', $action)) == 4) {
408
+        $action .= '-';
409
+    }
410
+
411
+    return $action;
412 412
 }
413 413
 
414 414
 
@@ -424,66 +424,66 @@  discard block
 block discarded – undo
424 424
  *   Liste des qualifs pour chaque lien. Tableau vide s'il n'y en a pas.
425 425
  **/
426 426
 function lien_retrouver_qualif($objet_lien, $lien) {
427
-	// un role est défini dans la liaison
428
-	$defs = explode('-', $lien);
429
-	[$objet1, , $objet2, , $role] = array_pad($defs, 5, null);
430
-	if ($objet_lien == $objet1) {
431
-		$colonne_role = roles_colonne($objet1, $objet2);
432
-	} else {
433
-		$colonne_role = roles_colonne($objet2, $objet1);
434
-	}
435
-
436
-	// cas ou le role est defini en 5e argument de l'action sur le lien (suppression, ajout rapide sans autre attribut)
437
-	if ($role) {
438
-		return [
439
-			// un seul lien avec ce role
440
-			[$colonne_role => $role]
441
-		];
442
-	}
443
-
444
-	// retrouver les rôles postés pour cette liaison, s'il y en a.
445
-	$qualifier_lien = _request('qualifier_lien');
446
-	if (!$qualifier_lien or !is_array($qualifier_lien)) {
447
-		return [];
448
-	}
449
-
450
-	// pas avec l'action complete (incluant le role)
451
-	$qualif = [];
452
-	if (
453
-		(!isset($qualifier_lien[$lien]) or !$qualif = $qualifier_lien[$lien])
454
-		and count($defs) == 5
455
-	) {
456
-		// on tente avec l'action sans le role
457
-		array_pop($defs);
458
-		$lien = implode('-', $defs);
459
-		if (!isset($qualifier_lien[$lien]) or !$qualif = $qualifier_lien[$lien]) {
460
-			$qualif = [];
461
-		}
462
-	}
463
-
464
-	// $qualif de la forme array(role=>array(...),valeur=>array(...),....)
465
-	// on le reforme en array(array(role=>..,valeur=>..,..),array(role=>..,valeur=>..,..),...)
466
-	$qualifs = [];
467
-	while (is_countable($qualif) ? count($qualif) : 0) {
468
-		$q = [];
469
-		foreach ($qualif as $att => $values) {
470
-			if (is_array($values)) {
471
-				$q[$att] = array_shift($qualif[$att]);
472
-				if (!(is_countable($qualif[$att]) ? count($qualif[$att]) : 0)) {
473
-					unset($qualif[$att]);
474
-				}
475
-			} else {
476
-				$q[$att] = $values;
477
-				unset($qualif[$att]);
478
-			}
479
-		}
480
-		// pas de rôle vide
481
-		if (!$colonne_role or !isset($q[$colonne_role]) or $q[$colonne_role]) {
482
-			$qualifs[] = $q;
483
-		}
484
-	}
485
-
486
-	return $qualifs;
427
+    // un role est défini dans la liaison
428
+    $defs = explode('-', $lien);
429
+    [$objet1, , $objet2, , $role] = array_pad($defs, 5, null);
430
+    if ($objet_lien == $objet1) {
431
+        $colonne_role = roles_colonne($objet1, $objet2);
432
+    } else {
433
+        $colonne_role = roles_colonne($objet2, $objet1);
434
+    }
435
+
436
+    // cas ou le role est defini en 5e argument de l'action sur le lien (suppression, ajout rapide sans autre attribut)
437
+    if ($role) {
438
+        return [
439
+            // un seul lien avec ce role
440
+            [$colonne_role => $role]
441
+        ];
442
+    }
443
+
444
+    // retrouver les rôles postés pour cette liaison, s'il y en a.
445
+    $qualifier_lien = _request('qualifier_lien');
446
+    if (!$qualifier_lien or !is_array($qualifier_lien)) {
447
+        return [];
448
+    }
449
+
450
+    // pas avec l'action complete (incluant le role)
451
+    $qualif = [];
452
+    if (
453
+        (!isset($qualifier_lien[$lien]) or !$qualif = $qualifier_lien[$lien])
454
+        and count($defs) == 5
455
+    ) {
456
+        // on tente avec l'action sans le role
457
+        array_pop($defs);
458
+        $lien = implode('-', $defs);
459
+        if (!isset($qualifier_lien[$lien]) or !$qualif = $qualifier_lien[$lien]) {
460
+            $qualif = [];
461
+        }
462
+    }
463
+
464
+    // $qualif de la forme array(role=>array(...),valeur=>array(...),....)
465
+    // on le reforme en array(array(role=>..,valeur=>..,..),array(role=>..,valeur=>..,..),...)
466
+    $qualifs = [];
467
+    while (is_countable($qualif) ? count($qualif) : 0) {
468
+        $q = [];
469
+        foreach ($qualif as $att => $values) {
470
+            if (is_array($values)) {
471
+                $q[$att] = array_shift($qualif[$att]);
472
+                if (!(is_countable($qualif[$att]) ? count($qualif[$att]) : 0)) {
473
+                    unset($qualif[$att]);
474
+                }
475
+            } else {
476
+                $q[$att] = $values;
477
+                unset($qualif[$att]);
478
+            }
479
+        }
480
+        // pas de rôle vide
481
+        if (!$colonne_role or !isset($q[$colonne_role]) or $q[$colonne_role]) {
482
+            $qualifs[] = $q;
483
+        }
484
+    }
485
+
486
+    return $qualifs;
487 487
 }
488 488
 
489 489
 /**
@@ -502,12 +502,12 @@  discard block
 block discarded – undo
502 502
  **/
503 503
 function lien_ajouter_liaisons($objet_source, $ids, $objet_lien, $idl, $qualifs) {
504 504
 
505
-	// retrouver la colonne de roles s'il y en a a lier
506
-	if (is_array($qualifs) and count($qualifs)) {
507
-		foreach ($qualifs as $qualif) {
508
-			objet_associer([$objet_source => $ids], [$objet_lien => $idl], $qualif);
509
-		}
510
-	} else {
511
-		objet_associer([$objet_source => $ids], [$objet_lien => $idl]);
512
-	}
505
+    // retrouver la colonne de roles s'il y en a a lier
506
+    if (is_array($qualifs) and count($qualifs)) {
507
+        foreach ($qualifs as $qualif) {
508
+            objet_associer([$objet_source => $ids], [$objet_lien => $idl], $qualif);
509
+        }
510
+    } else {
511
+        objet_associer([$objet_source => $ids], [$objet_lien => $idl]);
512
+    }
513 513
 }
Please login to merge, or discard this patch.
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -105,7 +105,7 @@  discard block
 block discarded – undo
105 105
 
106 106
 	// L'éditabilité :) est définie par un test permanent (par exemple "associermots") ET le 4ème argument
107 107
 	include_spip('inc/autoriser');
108
-	$editable = ($editable and autoriser('associer' . $table_source, $objet, $id_objet)
108
+	$editable = ($editable and autoriser('associer'.$table_source, $objet, $id_objet)
109 109
 		and autoriser('modifier', $objet, $id_objet));
110 110
 
111 111
 	if (
@@ -119,15 +119,15 @@  discard block
 block discarded – undo
119 119
 
120 120
 	// squelettes de vue et de d'association
121 121
 	// ils sont différents si des rôles sont définis.
122
-	$skel_vue = $table_source . '_lies';
123
-	$skel_ajout = $table_source . '_associer';
122
+	$skel_vue = $table_source.'_lies';
123
+	$skel_ajout = $table_source.'_associer';
124 124
 
125 125
 	// description des roles
126 126
 	include_spip('inc/roles');
127 127
 	if ($roles = roles_presents($objet_source, $objet)) {
128 128
 		// on demande de nouveaux squelettes en conséquence
129
-		$skel_vue = $table_source . '_roles_lies';
130
-		$skel_ajout = $table_source . '_roles_associer';
129
+		$skel_vue = $table_source.'_roles_lies';
130
+		$skel_ajout = $table_source.'_roles_associer';
131 131
 	}
132 132
 
133 133
 	$oups = _request('_oups') ?? '';
@@ -426,7 +426,7 @@  discard block
 block discarded – undo
426 426
 function lien_retrouver_qualif($objet_lien, $lien) {
427 427
 	// un role est défini dans la liaison
428 428
 	$defs = explode('-', $lien);
429
-	[$objet1, , $objet2, , $role] = array_pad($defs, 5, null);
429
+	[$objet1,, $objet2,, $role] = array_pad($defs, 5, null);
430 430
 	if ($objet_lien == $objet1) {
431 431
 		$colonne_role = roles_colonne($objet1, $objet2);
432 432
 	} else {
Please login to merge, or discard this patch.
prive/formulaires/dater.php 2 patches
Indentation   +266 added lines, -266 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
 
@@ -45,136 +45,136 @@  discard block
 block discarded – undo
45 45
  **/
46 46
 function formulaires_dater_charger_dist($objet, $id_objet, $retour = '', $options = []) {
47 47
 
48
-	$jour = null;
49
-	$mois = null;
50
-	$annee = null;
51
-	$heure = null;
52
-	$minute = null;
53
-	$objet = objet_type($objet);
54
-	if (!$objet or !intval($id_objet)) {
55
-		return false;
56
-	}
57
-
58
-	if (!is_array($options)) {
59
-		$options = unserialize($options);
60
-	}
61
-
62
-	$_id_objet = id_table_objet($objet);
63
-	$table = table_objet($objet);
64
-	$trouver_table = charger_fonction('trouver_table', 'base');
65
-	$desc = $trouver_table($table);
66
-
67
-	if (!$desc) {
68
-		return false;
69
-	}
70
-
71
-	$champ_date = $desc['date'] ?: 'date';
72
-	if (isset($options['champ_date']) and $options['champ_date']) {
73
-		$champ_date = $options['champ_date'];
74
-	}
75
-	if (!isset($desc['field'][$champ_date])) {
76
-		return false;
77
-	}
78
-
79
-	$valeurs = [
80
-		'objet' => $objet,
81
-		'id_objet' => $id_objet,
82
-		'id' => $id_objet,
83
-	];
84
-
85
-
86
-	$select = "$champ_date as date";
87
-	$champ_date_redac = 'date_redac';
88
-	if (isset($options['champ_date_redac']) and $options['champ_date_redac']) {
89
-		$champ_date_redac = $options['champ_date_redac'];
90
-	}
91
-	if (isset($desc['field'][$champ_date_redac])) {
92
-		$select .= ",$champ_date_redac as date_redac";
93
-	}
94
-	if (isset($desc['field']['statut'])) {
95
-		$select .= ',statut';
96
-	}
97
-
98
-
99
-	$row = sql_fetsel($select, $desc['table'], "$_id_objet=" . intval($id_objet));
100
-	$statut = $row['statut'] ?? 'publie'; // pas de statut => publie
101
-
102
-	$valeurs['editable'] = autoriser('dater', $objet, $id_objet, null, ['statut' => $statut]);
103
-
104
-	$possedeDateRedac = false;
105
-
106
-	if (
107
-		isset($row['date_redac']) and
108
-		$regs = recup_date($row['date_redac'], false)
109
-	) {
110
-		$annee_redac = $regs[0];
111
-		$mois_redac = $regs[1];
112
-		$jour_redac = $regs[2];
113
-		$heure_redac = $regs[3];
114
-		$minute_redac = $regs[4];
115
-		$possedeDateRedac = true;
116
-		// attention : les vrai dates de l'annee 1 sont stockee avec +9000 => 9001
117
-		// mais reviennent ici en annee 1 par recup_date
118
-		// on verifie donc que le intval($row['date_redac']) qui ressort l'annee
119
-		// est bien lui aussi <=1 : dans ce cas c'est une date sql 'nulle' ou presque, selon
120
-		// le gestionnnaire sql utilise (0001-01-01 pour PG par exemple)
121
-		if (intval($row['date_redac']) <= 1 and ($annee_redac <= 1) and ($mois_redac <= 1) and ($jour_redac <= 1)) {
122
-			$possedeDateRedac = false;
123
-		}
124
-	} else {
125
-		$annee_redac = $mois_redac = $jour_redac = $heure_redac = $minute_redac = 0;
126
-	}
127
-
128
-	if ($regs = recup_date($row['date'], false)) {
129
-		$annee = $regs[0];
130
-		$mois = $regs[1];
131
-		$jour = $regs[2];
132
-		$heure = $regs[3];
133
-		$minute = $regs[4];
134
-	}
135
-
136
-	// attention, si la variable s'appelle date ou date_redac, le compilo va
137
-	// la normaliser, ce qu'on ne veut pas ici.
138
-	$valeurs['afficher_date_redac'] = ($possedeDateRedac ? $row['date_redac'] : '');
139
-	$valeurs['date_redac_jour'] = dater_formater_saisie_jour($jour_redac, $mois_redac, $annee_redac);
140
-	$valeurs['date_redac_heure'] = "$heure_redac:$minute_redac";
141
-
142
-	$valeurs['afficher_date'] = $row['date'];
143
-	$valeurs['date_jour'] = dater_formater_saisie_jour($jour, $mois, $annee);
144
-	$valeurs['date_heure'] = "$heure:$minute";
145
-
146
-	$valeurs['sans_redac'] = !$possedeDateRedac;
147
-
148
-	if (isset($options['date_redac'])) {
149
-		$valeurs['_editer_date_anterieure'] = $options['date_redac'];
150
-	} else {
151
-		$valeurs['_editer_date_anterieure'] = ($objet == 'article' and ($GLOBALS['meta']['articles_redac'] != 'non' or $possedeDateRedac));
152
-	}
153
-	$valeurs['_label_date'] = (($statut == 'publie') ?
154
-		_T('texte_date_publication_objet') : _T('texte_date_creation_objet'));
155
-	if (isset($options['label_date']) and $options['label_date']) {
156
-		$valeurs['_label_date'] = $options['label_date'];
157
-	}
158
-	if (isset($options['label_date_redac']) and $options['label_date_redac']) {
159
-		$valeurs['_label_date_redac'] = $options['label_date_redac'];
160
-	}
161
-	if (isset($options['texte_sans_date_redac']) and $options['texte_sans_date_redac']) {
162
-		$valeurs['_texte_sans_date_redac'] = $options['texte_sans_date_redac'];
163
-	}
164
-	if (isset($options['class']) and $options['class']) {
165
-		$valeurs['_class'] = $options['class'];
166
-	}
167
-
168
-	$valeurs['_saisie_en_cours'] = (_request('_saisie_en_cours') !== null or _request('date_jour') !== null);
169
-
170
-	// cas ou l'on ne peut pas dater mais on peut modifier la date de redac anterieure
171
-	// https://core.spip.net/issues/3494
172
-	$valeurs['_editer_date'] = $valeurs['editable'];
173
-	if ($valeurs['_editer_date_anterieure'] and !$valeurs['editable']) {
174
-		$valeurs['editable'] = autoriser('modifier', $objet, $id_objet);
175
-	}
176
-
177
-	return $valeurs;
48
+    $jour = null;
49
+    $mois = null;
50
+    $annee = null;
51
+    $heure = null;
52
+    $minute = null;
53
+    $objet = objet_type($objet);
54
+    if (!$objet or !intval($id_objet)) {
55
+        return false;
56
+    }
57
+
58
+    if (!is_array($options)) {
59
+        $options = unserialize($options);
60
+    }
61
+
62
+    $_id_objet = id_table_objet($objet);
63
+    $table = table_objet($objet);
64
+    $trouver_table = charger_fonction('trouver_table', 'base');
65
+    $desc = $trouver_table($table);
66
+
67
+    if (!$desc) {
68
+        return false;
69
+    }
70
+
71
+    $champ_date = $desc['date'] ?: 'date';
72
+    if (isset($options['champ_date']) and $options['champ_date']) {
73
+        $champ_date = $options['champ_date'];
74
+    }
75
+    if (!isset($desc['field'][$champ_date])) {
76
+        return false;
77
+    }
78
+
79
+    $valeurs = [
80
+        'objet' => $objet,
81
+        'id_objet' => $id_objet,
82
+        'id' => $id_objet,
83
+    ];
84
+
85
+
86
+    $select = "$champ_date as date";
87
+    $champ_date_redac = 'date_redac';
88
+    if (isset($options['champ_date_redac']) and $options['champ_date_redac']) {
89
+        $champ_date_redac = $options['champ_date_redac'];
90
+    }
91
+    if (isset($desc['field'][$champ_date_redac])) {
92
+        $select .= ",$champ_date_redac as date_redac";
93
+    }
94
+    if (isset($desc['field']['statut'])) {
95
+        $select .= ',statut';
96
+    }
97
+
98
+
99
+    $row = sql_fetsel($select, $desc['table'], "$_id_objet=" . intval($id_objet));
100
+    $statut = $row['statut'] ?? 'publie'; // pas de statut => publie
101
+
102
+    $valeurs['editable'] = autoriser('dater', $objet, $id_objet, null, ['statut' => $statut]);
103
+
104
+    $possedeDateRedac = false;
105
+
106
+    if (
107
+        isset($row['date_redac']) and
108
+        $regs = recup_date($row['date_redac'], false)
109
+    ) {
110
+        $annee_redac = $regs[0];
111
+        $mois_redac = $regs[1];
112
+        $jour_redac = $regs[2];
113
+        $heure_redac = $regs[3];
114
+        $minute_redac = $regs[4];
115
+        $possedeDateRedac = true;
116
+        // attention : les vrai dates de l'annee 1 sont stockee avec +9000 => 9001
117
+        // mais reviennent ici en annee 1 par recup_date
118
+        // on verifie donc que le intval($row['date_redac']) qui ressort l'annee
119
+        // est bien lui aussi <=1 : dans ce cas c'est une date sql 'nulle' ou presque, selon
120
+        // le gestionnnaire sql utilise (0001-01-01 pour PG par exemple)
121
+        if (intval($row['date_redac']) <= 1 and ($annee_redac <= 1) and ($mois_redac <= 1) and ($jour_redac <= 1)) {
122
+            $possedeDateRedac = false;
123
+        }
124
+    } else {
125
+        $annee_redac = $mois_redac = $jour_redac = $heure_redac = $minute_redac = 0;
126
+    }
127
+
128
+    if ($regs = recup_date($row['date'], false)) {
129
+        $annee = $regs[0];
130
+        $mois = $regs[1];
131
+        $jour = $regs[2];
132
+        $heure = $regs[3];
133
+        $minute = $regs[4];
134
+    }
135
+
136
+    // attention, si la variable s'appelle date ou date_redac, le compilo va
137
+    // la normaliser, ce qu'on ne veut pas ici.
138
+    $valeurs['afficher_date_redac'] = ($possedeDateRedac ? $row['date_redac'] : '');
139
+    $valeurs['date_redac_jour'] = dater_formater_saisie_jour($jour_redac, $mois_redac, $annee_redac);
140
+    $valeurs['date_redac_heure'] = "$heure_redac:$minute_redac";
141
+
142
+    $valeurs['afficher_date'] = $row['date'];
143
+    $valeurs['date_jour'] = dater_formater_saisie_jour($jour, $mois, $annee);
144
+    $valeurs['date_heure'] = "$heure:$minute";
145
+
146
+    $valeurs['sans_redac'] = !$possedeDateRedac;
147
+
148
+    if (isset($options['date_redac'])) {
149
+        $valeurs['_editer_date_anterieure'] = $options['date_redac'];
150
+    } else {
151
+        $valeurs['_editer_date_anterieure'] = ($objet == 'article' and ($GLOBALS['meta']['articles_redac'] != 'non' or $possedeDateRedac));
152
+    }
153
+    $valeurs['_label_date'] = (($statut == 'publie') ?
154
+        _T('texte_date_publication_objet') : _T('texte_date_creation_objet'));
155
+    if (isset($options['label_date']) and $options['label_date']) {
156
+        $valeurs['_label_date'] = $options['label_date'];
157
+    }
158
+    if (isset($options['label_date_redac']) and $options['label_date_redac']) {
159
+        $valeurs['_label_date_redac'] = $options['label_date_redac'];
160
+    }
161
+    if (isset($options['texte_sans_date_redac']) and $options['texte_sans_date_redac']) {
162
+        $valeurs['_texte_sans_date_redac'] = $options['texte_sans_date_redac'];
163
+    }
164
+    if (isset($options['class']) and $options['class']) {
165
+        $valeurs['_class'] = $options['class'];
166
+    }
167
+
168
+    $valeurs['_saisie_en_cours'] = (_request('_saisie_en_cours') !== null or _request('date_jour') !== null);
169
+
170
+    // cas ou l'on ne peut pas dater mais on peut modifier la date de redac anterieure
171
+    // https://core.spip.net/issues/3494
172
+    $valeurs['_editer_date'] = $valeurs['editable'];
173
+    if ($valeurs['_editer_date_anterieure'] and !$valeurs['editable']) {
174
+        $valeurs['editable'] = autoriser('modifier', $objet, $id_objet);
175
+    }
176
+
177
+    return $valeurs;
178 178
 }
179 179
 
180 180
 /**
@@ -192,20 +192,20 @@  discard block
 block discarded – undo
192 192
  *     Date formatée tel que `02/10/2012`
193 193
  **/
194 194
 function dater_formater_saisie_jour($jour, $mois, $annee, $sep = '/') {
195
-	$annee = str_pad($annee, 4, '0', STR_PAD_LEFT);
196
-	if (intval($jour)) {
197
-		$jour = str_pad($jour, 2, '0', STR_PAD_LEFT);
198
-		$mois = str_pad($mois, 2, '0', STR_PAD_LEFT);
195
+    $annee = str_pad($annee, 4, '0', STR_PAD_LEFT);
196
+    if (intval($jour)) {
197
+        $jour = str_pad($jour, 2, '0', STR_PAD_LEFT);
198
+        $mois = str_pad($mois, 2, '0', STR_PAD_LEFT);
199 199
 
200
-		return "$jour$sep$mois$sep$annee";
201
-	}
202
-	if (intval($mois)) {
203
-		$mois = str_pad($mois, 2, '0', STR_PAD_LEFT);
200
+        return "$jour$sep$mois$sep$annee";
201
+    }
202
+    if (intval($mois)) {
203
+        $mois = str_pad($mois, 2, '0', STR_PAD_LEFT);
204 204
 
205
-		return "$mois$sep$annee";
206
-	}
205
+        return "$mois$sep$annee";
206
+    }
207 207
 
208
-	return $annee;
208
+    return $annee;
209 209
 }
210 210
 
211 211
 /**
@@ -224,7 +224,7 @@  discard block
 block discarded – undo
224 224
  *     Hash du formulaire
225 225
  **/
226 226
 function formulaires_dater_identifier_dist($objet, $id_objet, $retour = '', $options = []) {
227
-	return serialize([$objet, $id_objet]);
227
+    return serialize([$objet, $id_objet]);
228 228
 }
229 229
 
230 230
 /**
@@ -242,30 +242,30 @@  discard block
 block discarded – undo
242 242
  *     Tableau des erreurs
243 243
  */
244 244
 function formulaires_dater_verifier_dist($objet, $id_objet, $retour = '', $options = []) {
245
-	$erreurs = [];
246
-
247
-	// ouvrir le formulaire en edition ?
248
-	if (_request('_saisie_en_cours')) {
249
-		$erreurs['message_erreur'] = '';
250
-
251
-		return $erreurs;
252
-	}
253
-
254
-	if (_request('changer')) {
255
-		foreach (['date', 'date_redac'] as $k) {
256
-			if ($v = _request($k . '_jour') and !dater_recuperer_date_saisie($v, $k)) {
257
-				$erreurs[$k] = _T('format_date_incorrecte');
258
-			} elseif ($v = _request($k . '_heure') and !dater_recuperer_heure_saisie($v)) {
259
-				$erreurs[$k] = _T('format_heure_incorrecte');
260
-			}
261
-		}
262
-
263
-		if (!_request('date_jour')) {
264
-			$erreurs['date'] = _T('info_obligatoire');
265
-		}
266
-	}
267
-
268
-	return $erreurs;
245
+    $erreurs = [];
246
+
247
+    // ouvrir le formulaire en edition ?
248
+    if (_request('_saisie_en_cours')) {
249
+        $erreurs['message_erreur'] = '';
250
+
251
+        return $erreurs;
252
+    }
253
+
254
+    if (_request('changer')) {
255
+        foreach (['date', 'date_redac'] as $k) {
256
+            if ($v = _request($k . '_jour') and !dater_recuperer_date_saisie($v, $k)) {
257
+                $erreurs[$k] = _T('format_date_incorrecte');
258
+            } elseif ($v = _request($k . '_heure') and !dater_recuperer_heure_saisie($v)) {
259
+                $erreurs[$k] = _T('format_heure_incorrecte');
260
+            }
261
+        }
262
+
263
+        if (!_request('date_jour')) {
264
+            $erreurs['date'] = _T('info_obligatoire');
265
+        }
266
+    }
267
+
268
+    return $erreurs;
269 269
 }
270 270
 
271 271
 /**
@@ -283,79 +283,79 @@  discard block
 block discarded – undo
283 283
  *     Retours des traitements
284 284
  */
285 285
 function formulaires_dater_traiter_dist($objet, $id_objet, $retour = '', $options = []) {
286
-	$res = ['editable' => ' '];
287
-
288
-	if (_request('changer')) {
289
-		$table = table_objet($objet);
290
-		$trouver_table = charger_fonction('trouver_table', 'base');
291
-		$desc = $trouver_table($table);
292
-
293
-		if (!$desc) {
294
-			return ['message_erreur' => _L('erreur')];
295
-		} #impossible en principe
296
-
297
-		$champ_date = $desc['date'] ?: 'date';
298
-		if (isset($options['champ_date']) and $options['champ_date']) {
299
-			$champ_date = $options['champ_date'];
300
-		}
301
-
302
-		$set = [];
303
-
304
-		$charger = charger_fonction('charger', 'formulaires/dater/');
305
-		$v = $charger($objet, $id_objet, $retour, $options);
306
-
307
-		if ($v['_editer_date']) {
308
-			if (!$d = dater_recuperer_date_saisie(_request('date_jour'))) {
309
-				$d = [date('Y'), date('m'), date('d')];
310
-			}
311
-			if (!$h = dater_recuperer_heure_saisie(_request('date_heure'))) {
312
-				$h = [0, 0];
313
-			}
314
-
315
-			$set[$champ_date] = sql_format_date($d[0], $d[1], $d[2], $h[0], $h[1]);
316
-		}
317
-
318
-		$champ_date_redac = 'date_redac';
319
-		if (isset($options['champ_date_redac']) and $options['champ_date_redac']) {
320
-			$champ_date_redac = $options['champ_date_redac'];
321
-		}
322
-		if (isset($desc['field'][$champ_date_redac]) and $v['_editer_date_anterieure']) {
323
-			if (!_request('date_redac_jour') or _request('sans_redac')) {
324
-				$set[$champ_date_redac] = sql_format_date(0, 0, 0, 0, 0, 0);
325
-			} else {
326
-				if (!$d = dater_recuperer_date_saisie(_request('date_redac_jour'), 'date_redac')) {
327
-					$d = [date('Y'), date('m'), date('d')];
328
-				}
329
-				if (!$h = dater_recuperer_heure_saisie(_request('date_redac_heure'))) {
330
-					$h = [0, 0];
331
-				}
332
-				$set[$champ_date_redac] = sql_format_date($d[0], $d[1], $d[2], $h[0], $h[1]);
333
-			}
334
-		}
335
-
336
-		if (count($set)) {
337
-			$publie_avant = objet_test_si_publie($objet, $id_objet);
338
-			include_spip('action/editer_objet');
339
-			objet_modifier($objet, $id_objet, $set);
340
-			$publie_apres = objet_test_si_publie($objet, $id_objet);
341
-			if ($publie_avant !== $publie_apres) {
342
-				// on refuse ajax pour forcer le rechargement de la page ici
343
-				// on refera traiter une 2eme fois, mais c'est sans consequence
344
-				refuser_traiter_formulaire_ajax();
345
-			}
346
-		}
347
-	}
348
-
349
-	if ($retour) {
350
-		$res['redirect'] = $retour;
351
-	}
352
-
353
-	set_request('date_jour');
354
-	set_request('date_redac_jour');
355
-	set_request('date_heure');
356
-	set_request('date_redac_heure');
357
-
358
-	return $res;
286
+    $res = ['editable' => ' '];
287
+
288
+    if (_request('changer')) {
289
+        $table = table_objet($objet);
290
+        $trouver_table = charger_fonction('trouver_table', 'base');
291
+        $desc = $trouver_table($table);
292
+
293
+        if (!$desc) {
294
+            return ['message_erreur' => _L('erreur')];
295
+        } #impossible en principe
296
+
297
+        $champ_date = $desc['date'] ?: 'date';
298
+        if (isset($options['champ_date']) and $options['champ_date']) {
299
+            $champ_date = $options['champ_date'];
300
+        }
301
+
302
+        $set = [];
303
+
304
+        $charger = charger_fonction('charger', 'formulaires/dater/');
305
+        $v = $charger($objet, $id_objet, $retour, $options);
306
+
307
+        if ($v['_editer_date']) {
308
+            if (!$d = dater_recuperer_date_saisie(_request('date_jour'))) {
309
+                $d = [date('Y'), date('m'), date('d')];
310
+            }
311
+            if (!$h = dater_recuperer_heure_saisie(_request('date_heure'))) {
312
+                $h = [0, 0];
313
+            }
314
+
315
+            $set[$champ_date] = sql_format_date($d[0], $d[1], $d[2], $h[0], $h[1]);
316
+        }
317
+
318
+        $champ_date_redac = 'date_redac';
319
+        if (isset($options['champ_date_redac']) and $options['champ_date_redac']) {
320
+            $champ_date_redac = $options['champ_date_redac'];
321
+        }
322
+        if (isset($desc['field'][$champ_date_redac]) and $v['_editer_date_anterieure']) {
323
+            if (!_request('date_redac_jour') or _request('sans_redac')) {
324
+                $set[$champ_date_redac] = sql_format_date(0, 0, 0, 0, 0, 0);
325
+            } else {
326
+                if (!$d = dater_recuperer_date_saisie(_request('date_redac_jour'), 'date_redac')) {
327
+                    $d = [date('Y'), date('m'), date('d')];
328
+                }
329
+                if (!$h = dater_recuperer_heure_saisie(_request('date_redac_heure'))) {
330
+                    $h = [0, 0];
331
+                }
332
+                $set[$champ_date_redac] = sql_format_date($d[0], $d[1], $d[2], $h[0], $h[1]);
333
+            }
334
+        }
335
+
336
+        if (count($set)) {
337
+            $publie_avant = objet_test_si_publie($objet, $id_objet);
338
+            include_spip('action/editer_objet');
339
+            objet_modifier($objet, $id_objet, $set);
340
+            $publie_apres = objet_test_si_publie($objet, $id_objet);
341
+            if ($publie_avant !== $publie_apres) {
342
+                // on refuse ajax pour forcer le rechargement de la page ici
343
+                // on refera traiter une 2eme fois, mais c'est sans consequence
344
+                refuser_traiter_formulaire_ajax();
345
+            }
346
+        }
347
+    }
348
+
349
+    if ($retour) {
350
+        $res['redirect'] = $retour;
351
+    }
352
+
353
+    set_request('date_jour');
354
+    set_request('date_redac_jour');
355
+    set_request('date_heure');
356
+    set_request('date_redac_heure');
357
+
358
+    return $res;
359 359
 }
360 360
 
361 361
 /**
@@ -366,24 +366,24 @@  discard block
 block discarded – undo
366 366
  * @return array|string Chaîne vide si date invalide, tableau (année, mois, jour) sinon.
367 367
  */
368 368
 function dater_recuperer_date_saisie($post, $quoi = 'date') {
369
-	if (!preg_match('#^(?:(?:([0-9]{1,2})[/-])?([0-9]{1,2})[/-])?([0-9]{4}|[0-9]{1,2})#', $post, $regs)) {
370
-		return '';
371
-	}
372
-	if ($quoi == 'date_redac') {
373
-		if ($regs[3] <> '' and $regs[3] < 1001) {
374
-			$regs[3] += 9000;
375
-		}
376
-
377
-		return [$regs[3], $regs[2], $regs[1]];
378
-	} else {
379
-		if (
380
-			checkdate(intval($regs[2]), intval($regs[1]), intval($regs[3]))
381
-			and $t = mktime(0, 0, 0, $regs[2], $regs[1], $regs[3])
382
-		) {
383
-			return [date('Y', $t), date('m', $t), date('d', $t)];
384
-		}
385
-		return '';
386
-	}
369
+    if (!preg_match('#^(?:(?:([0-9]{1,2})[/-])?([0-9]{1,2})[/-])?([0-9]{4}|[0-9]{1,2})#', $post, $regs)) {
370
+        return '';
371
+    }
372
+    if ($quoi == 'date_redac') {
373
+        if ($regs[3] <> '' and $regs[3] < 1001) {
374
+            $regs[3] += 9000;
375
+        }
376
+
377
+        return [$regs[3], $regs[2], $regs[1]];
378
+    } else {
379
+        if (
380
+            checkdate(intval($regs[2]), intval($regs[1]), intval($regs[3]))
381
+            and $t = mktime(0, 0, 0, $regs[2], $regs[1], $regs[3])
382
+        ) {
383
+            return [date('Y', $t), date('m', $t), date('d', $t)];
384
+        }
385
+        return '';
386
+    }
387 387
 }
388 388
 
389 389
 /**
@@ -393,12 +393,12 @@  discard block
 block discarded – undo
393 393
  * @return array
394 394
  */
395 395
 function dater_recuperer_heure_saisie($post) {
396
-	if (!preg_match('#([0-9]{1,2})(?:[h:](?:([0-9]{1,2}))?)?#', $post, $regs)) {
397
-		return '';
398
-	}
399
-	if ($regs[1] > 23 or $regs[2] > 59) {
400
-		return '';
401
-	}
402
-
403
-	return [$regs[1], $regs[2]];
396
+    if (!preg_match('#([0-9]{1,2})(?:[h:](?:([0-9]{1,2}))?)?#', $post, $regs)) {
397
+        return '';
398
+    }
399
+    if ($regs[1] > 23 or $regs[2] > 59) {
400
+        return '';
401
+    }
402
+
403
+    return [$regs[1], $regs[2]];
404 404
 }
Please login to merge, or discard this patch.
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -96,7 +96,7 @@  discard block
 block discarded – undo
96 96
 	}
97 97
 
98 98
 
99
-	$row = sql_fetsel($select, $desc['table'], "$_id_objet=" . intval($id_objet));
99
+	$row = sql_fetsel($select, $desc['table'], "$_id_objet=".intval($id_objet));
100 100
 	$statut = $row['statut'] ?? 'publie'; // pas de statut => publie
101 101
 
102 102
 	$valeurs['editable'] = autoriser('dater', $objet, $id_objet, null, ['statut' => $statut]);
@@ -253,9 +253,9 @@  discard block
 block discarded – undo
253 253
 
254 254
 	if (_request('changer')) {
255 255
 		foreach (['date', 'date_redac'] as $k) {
256
-			if ($v = _request($k . '_jour') and !dater_recuperer_date_saisie($v, $k)) {
256
+			if ($v = _request($k.'_jour') and !dater_recuperer_date_saisie($v, $k)) {
257 257
 				$erreurs[$k] = _T('format_date_incorrecte');
258
-			} elseif ($v = _request($k . '_heure') and !dater_recuperer_heure_saisie($v)) {
258
+			} elseif ($v = _request($k.'_heure') and !dater_recuperer_heure_saisie($v)) {
259 259
 				$erreurs[$k] = _T('format_heure_incorrecte');
260 260
 			}
261 261
 		}
Please login to merge, or discard this patch.
ecrire/inc/filtres_selecteur_generique.php 2 patches
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -158,7 +158,7 @@  discard block
 block discarded – undo
158 158
 
159 159
 	// si id numerique et un seul objet possible, pas d'ambiguite
160 160
 	if (is_numeric($ref) and count($objets) === 1) {
161
-		$ref = reset($objets) . $ref;
161
+		$ref = reset($objets).$ref;
162 162
 	}
163 163
 
164 164
 	// Si la référence ne correspond à rien, c'est fini
@@ -166,7 +166,7 @@  discard block
 block discarded – undo
166 166
 		return json_export(false);
167 167
 	}
168 168
 	// Sinon on récupère les infos utiles
169
-	[$type, , $id, , , , ] = array_pad($match, 7, null);
169
+	[$type,, $id,,,,] = array_pad($match, 7, null);
170 170
 
171 171
 	// On regarde si le type trouvé fait partie des objets sélectionnables
172 172
 	if (!in_array(table_objet($type), $objets)) {
@@ -211,8 +211,8 @@  discard block
 block discarded – undo
211 211
 		$types = (is_array($types) ? array_filter($types) : []);
212 212
 
213 213
 		// recuperer tous les freres et soeurs de la rubrique visee
214
-		$id_parent = sql_getfetsel('id_parent', 'spip_rubriques', 'id_rubrique=' . intval($id_rubrique));
215
-		$fratrie = sql_allfetsel('id_rubrique', 'spip_rubriques', 'id_parent=' . intval($id_parent));
214
+		$id_parent = sql_getfetsel('id_parent', 'spip_rubriques', 'id_rubrique='.intval($id_rubrique));
215
+		$fratrie = sql_allfetsel('id_rubrique', 'spip_rubriques', 'id_parent='.intval($id_parent));
216 216
 		$fratrie = array_column($fratrie, 'id_rubrique');
217 217
 		$has = sql_allfetsel('DISTINCT id_parent', 'spip_rubriques', sql_in('id_parent', $fratrie));
218 218
 		$has = array_column($has, 'id_parent');
Please login to merge, or discard this patch.
Indentation   +144 added lines, -144 removed lines patch added patch discarded remove patch
@@ -7,7 +7,7 @@  discard block
 block discarded – undo
7 7
  **/
8 8
 
9 9
 if (!defined('_ECRIRE_INC_VERSION')) {
10
-	return;
10
+    return;
11 11
 }
12 12
 
13 13
 /**
@@ -28,51 +28,51 @@  discard block
 block discarded – undo
28 28
  *     - afficher : tableau des objets à afficher (mais pas forcément sélectionnables)
29 29
  */
30 30
 function selecteur_lister_objets($includelist = [], $excludelist = []) {
31
-	static $liste_selecteurs, $liste_parents;
32
-
33
-	if (!$liste_selecteurs) {
34
-		$liste_selecteurs = find_all_in_path('formulaires/selecteur/', 'hierarchie-[\w]+[.]html$');
35
-	}
36
-	$objets_selectionner = [];
37
-	foreach ($liste_selecteurs as $fichier => $chemin) {
38
-		$objets_selectionner[] = preg_replace('/^hierarchie-([\w]+)[.]html$/', '$1', $fichier);
39
-	}
40
-
41
-	// S'il y a une whitelist on ne garde que ce qui est dedans
42
-	if (!empty($includelist)) {
43
-		$includelist = array_map('table_objet', $includelist);
44
-		$objets_selectionner = array_intersect($objets_selectionner, $includelist);
45
-	}
46
-	// On supprime ce qui est dans la liste d’exclusion
47
-	$excludelist = array_map('table_objet', $excludelist);
48
-	// On enlève toujours la racine
49
-	$excludelist[] = 'racine';
50
-	$objets_selectionner = array_diff($objets_selectionner, $excludelist);
51
-
52
-	// Ensuite on cherche ce qu'on doit afficher : au moins ceux qu'on peut sélectionner
53
-	$objets_afficher = $objets_selectionner;
54
-
55
-	// Il faut alors chercher d'éventuels parents obligatoires en plus :
56
-	// lister-trucs-bidules.html => on doit afficher des "trucs" pour trouver des "bidules"
57
-	if (!$liste_parents) {
58
-		$liste_parents = find_all_in_path('formulaires/selecteur/', 'lister-[\w]+-[\w]+[.]html$');
59
-	}
60
-	foreach ($liste_parents as $fichier => $chemin) {
61
-		preg_match('/^lister-([\w]+)-([\w]+)[.]html$/', $fichier, $captures);
62
-		$parent = $captures[1];
63
-		$type = $captures[2];
64
-		// Si le type fait partie de ce qu'on doit afficher alors on ajoute aussi le parent à l'affichage
65
-		if (in_array($type, $objets_afficher)) {
66
-			$objets_afficher[] = $parent;
67
-		}
68
-	}
69
-
70
-	$objets = [
71
-		'selectionner' => array_unique($objets_selectionner),
72
-		'afficher' => array_unique($objets_afficher),
73
-	];
74
-
75
-	return $objets;
31
+    static $liste_selecteurs, $liste_parents;
32
+
33
+    if (!$liste_selecteurs) {
34
+        $liste_selecteurs = find_all_in_path('formulaires/selecteur/', 'hierarchie-[\w]+[.]html$');
35
+    }
36
+    $objets_selectionner = [];
37
+    foreach ($liste_selecteurs as $fichier => $chemin) {
38
+        $objets_selectionner[] = preg_replace('/^hierarchie-([\w]+)[.]html$/', '$1', $fichier);
39
+    }
40
+
41
+    // S'il y a une whitelist on ne garde que ce qui est dedans
42
+    if (!empty($includelist)) {
43
+        $includelist = array_map('table_objet', $includelist);
44
+        $objets_selectionner = array_intersect($objets_selectionner, $includelist);
45
+    }
46
+    // On supprime ce qui est dans la liste d’exclusion
47
+    $excludelist = array_map('table_objet', $excludelist);
48
+    // On enlève toujours la racine
49
+    $excludelist[] = 'racine';
50
+    $objets_selectionner = array_diff($objets_selectionner, $excludelist);
51
+
52
+    // Ensuite on cherche ce qu'on doit afficher : au moins ceux qu'on peut sélectionner
53
+    $objets_afficher = $objets_selectionner;
54
+
55
+    // Il faut alors chercher d'éventuels parents obligatoires en plus :
56
+    // lister-trucs-bidules.html => on doit afficher des "trucs" pour trouver des "bidules"
57
+    if (!$liste_parents) {
58
+        $liste_parents = find_all_in_path('formulaires/selecteur/', 'lister-[\w]+-[\w]+[.]html$');
59
+    }
60
+    foreach ($liste_parents as $fichier => $chemin) {
61
+        preg_match('/^lister-([\w]+)-([\w]+)[.]html$/', $fichier, $captures);
62
+        $parent = $captures[1];
63
+        $type = $captures[2];
64
+        // Si le type fait partie de ce qu'on doit afficher alors on ajoute aussi le parent à l'affichage
65
+        if (in_array($type, $objets_afficher)) {
66
+            $objets_afficher[] = $parent;
67
+        }
68
+    }
69
+
70
+    $objets = [
71
+        'selectionner' => array_unique($objets_selectionner),
72
+        'afficher' => array_unique($objets_afficher),
73
+    ];
74
+
75
+    return $objets;
76 76
 }
77 77
 
78 78
 /**
@@ -99,31 +99,31 @@  discard block
 block discarded – undo
99 99
  *     liste des couples (objets => id_objet) ou liste des identifiants d'un type d'objet.
100 100
  **/
101 101
 function picker_selected($selected, $type = '') {
102
-	$select = [];
103
-	$type = preg_replace(',\W,', '', $type);
104
-
105
-	if ($selected and !is_array($selected)) {
106
-		$selected = explode(',', $selected);
107
-	}
108
-
109
-	if (is_array($selected)) {
110
-		foreach ($selected as $value) {
111
-			// Si c'est le bon format déjà
112
-			if (preg_match('/^([\w]+)[|]([0-9]+)$/', $value, $captures)) {
113
-				$objet = $captures[1];
114
-				$id_objet = intval($captures[2]);
115
-
116
-				// Si on cherche un type et que c'est le bon, on renvoit un tableau que d'identifiants
117
-				if (is_string($type) and $type == $objet and ($id_objet or in_array($objet, ['racine', 'rubrique']))) {
118
-					$select[] = $id_objet;
119
-				} elseif (!$type and ($id_objet or in_array($objet, ['racine', 'rubrique']))) {
120
-					$select[] = ['objet' => $objet, 'id_objet' => $id_objet];
121
-				}
122
-			}
123
-		}
124
-	}
125
-
126
-	return $select;
102
+    $select = [];
103
+    $type = preg_replace(',\W,', '', $type);
104
+
105
+    if ($selected and !is_array($selected)) {
106
+        $selected = explode(',', $selected);
107
+    }
108
+
109
+    if (is_array($selected)) {
110
+        foreach ($selected as $value) {
111
+            // Si c'est le bon format déjà
112
+            if (preg_match('/^([\w]+)[|]([0-9]+)$/', $value, $captures)) {
113
+                $objet = $captures[1];
114
+                $id_objet = intval($captures[2]);
115
+
116
+                // Si on cherche un type et que c'est le bon, on renvoit un tableau que d'identifiants
117
+                if (is_string($type) and $type == $objet and ($id_objet or in_array($objet, ['racine', 'rubrique']))) {
118
+                    $select[] = $id_objet;
119
+                } elseif (!$type and ($id_objet or in_array($objet, ['racine', 'rubrique']))) {
120
+                    $select[] = ['objet' => $objet, 'id_objet' => $id_objet];
121
+                }
122
+            }
123
+        }
124
+    }
125
+
126
+    return $select;
127 127
 }
128 128
 
129 129
 /**
@@ -140,49 +140,49 @@  discard block
 block discarded – undo
140 140
  *     Booléen indiquant si les articles sont sélectionnables
141 141
  */
142 142
 function picker_identifie_id_rapide($ref, $rubriques_ou_objets = false, $articles = false) {
143
-	include_spip('inc/json');
144
-	include_spip('inc/lien');
145
-
146
-	// On construit un tableau des objets sélectionnables suivant les paramètres
147
-	$objets = [];
148
-	if ($rubriques_ou_objets and is_array($rubriques_ou_objets)) {
149
-		$objets = $rubriques_ou_objets;
150
-	} else {
151
-		if ($rubriques_ou_objets) {
152
-			$objets[] = 'rubriques';
153
-		}
154
-		if ($articles) {
155
-			$objets[] = 'articles';
156
-		}
157
-	}
158
-
159
-	// si id numerique et un seul objet possible, pas d'ambiguite
160
-	if (is_numeric($ref) and count($objets) === 1) {
161
-		$ref = reset($objets) . $ref;
162
-	}
163
-
164
-	// Si la référence ne correspond à rien, c'est fini
165
-	if (!($match = typer_raccourci($ref))) {
166
-		return json_export(false);
167
-	}
168
-	// Sinon on récupère les infos utiles
169
-	[$type, , $id, , , , ] = array_pad($match, 7, null);
170
-
171
-	// On regarde si le type trouvé fait partie des objets sélectionnables
172
-	if (!in_array(table_objet($type), $objets)) {
173
-		return json_export(false);
174
-	}
175
-
176
-	// Maintenant que tout est bon, on cherche les informations sur cet objet
177
-	include_spip('inc/filtres');
178
-	if (!$titre = generer_objet_info($id, $type, 'titre')) {
179
-		return json_export(false);
180
-	}
181
-
182
-	// On simplifie le texte
183
-	$titre = attribut_html($titre);
184
-
185
-	return json_export(['type' => $type, 'id' => "$type|$id", 'titre' => $titre]);
143
+    include_spip('inc/json');
144
+    include_spip('inc/lien');
145
+
146
+    // On construit un tableau des objets sélectionnables suivant les paramètres
147
+    $objets = [];
148
+    if ($rubriques_ou_objets and is_array($rubriques_ou_objets)) {
149
+        $objets = $rubriques_ou_objets;
150
+    } else {
151
+        if ($rubriques_ou_objets) {
152
+            $objets[] = 'rubriques';
153
+        }
154
+        if ($articles) {
155
+            $objets[] = 'articles';
156
+        }
157
+    }
158
+
159
+    // si id numerique et un seul objet possible, pas d'ambiguite
160
+    if (is_numeric($ref) and count($objets) === 1) {
161
+        $ref = reset($objets) . $ref;
162
+    }
163
+
164
+    // Si la référence ne correspond à rien, c'est fini
165
+    if (!($match = typer_raccourci($ref))) {
166
+        return json_export(false);
167
+    }
168
+    // Sinon on récupère les infos utiles
169
+    [$type, , $id, , , , ] = array_pad($match, 7, null);
170
+
171
+    // On regarde si le type trouvé fait partie des objets sélectionnables
172
+    if (!in_array(table_objet($type), $objets)) {
173
+        return json_export(false);
174
+    }
175
+
176
+    // Maintenant que tout est bon, on cherche les informations sur cet objet
177
+    include_spip('inc/filtres');
178
+    if (!$titre = generer_objet_info($id, $type, 'titre')) {
179
+        return json_export(false);
180
+    }
181
+
182
+    // On simplifie le texte
183
+    $titre = attribut_html($titre);
184
+
185
+    return json_export(['type' => $type, 'id' => "$type|$id", 'titre' => $titre]);
186 186
 }
187 187
 
188 188
 /**
@@ -205,34 +205,34 @@  discard block
 block discarded – undo
205 205
  *     Comme le filtre `oui` : espace (` `) si rubrique à afficher, chaîne vide sinon.
206 206
  */
207 207
 function test_enfants_rubrique($id_rubrique, $types = []) {
208
-	static $has_child = [];
209
-
210
-	if (!isset($has_child[$id_rubrique])) {
211
-		$types = (is_array($types) ? array_filter($types) : []);
212
-
213
-		// recuperer tous les freres et soeurs de la rubrique visee
214
-		$id_parent = sql_getfetsel('id_parent', 'spip_rubriques', 'id_rubrique=' . intval($id_rubrique));
215
-		$fratrie = sql_allfetsel('id_rubrique', 'spip_rubriques', 'id_parent=' . intval($id_parent));
216
-		$fratrie = array_column($fratrie, 'id_rubrique');
217
-		$has = sql_allfetsel('DISTINCT id_parent', 'spip_rubriques', sql_in('id_parent', $fratrie));
218
-		$has = array_column($has, 'id_parent');
219
-		$fratrie = array_diff($fratrie, $has);
220
-
221
-		while (count($fratrie) and is_array($types) and count($types)) {
222
-			$type = array_shift($types);
223
-			$h = sql_allfetsel('DISTINCT id_rubrique', table_objet_sql($type), sql_in('id_rubrique', $fratrie));
224
-			$h = array_column($h, 'id_rubrique');
225
-			$has = array_merge($has, $h);
226
-			$fratrie = array_diff($fratrie, $h);
227
-		}
228
-
229
-		if (count($has)) {
230
-			$has_child = $has_child + array_combine($has, array_pad([], count($has), true));
231
-		}
232
-		if (count($fratrie)) {
233
-			$has_child = $has_child + array_combine($fratrie, array_pad([], count($fratrie), false));
234
-		}
235
-	}
236
-
237
-	return $has_child[$id_rubrique] ? ' ' : '';
208
+    static $has_child = [];
209
+
210
+    if (!isset($has_child[$id_rubrique])) {
211
+        $types = (is_array($types) ? array_filter($types) : []);
212
+
213
+        // recuperer tous les freres et soeurs de la rubrique visee
214
+        $id_parent = sql_getfetsel('id_parent', 'spip_rubriques', 'id_rubrique=' . intval($id_rubrique));
215
+        $fratrie = sql_allfetsel('id_rubrique', 'spip_rubriques', 'id_parent=' . intval($id_parent));
216
+        $fratrie = array_column($fratrie, 'id_rubrique');
217
+        $has = sql_allfetsel('DISTINCT id_parent', 'spip_rubriques', sql_in('id_parent', $fratrie));
218
+        $has = array_column($has, 'id_parent');
219
+        $fratrie = array_diff($fratrie, $has);
220
+
221
+        while (count($fratrie) and is_array($types) and count($types)) {
222
+            $type = array_shift($types);
223
+            $h = sql_allfetsel('DISTINCT id_rubrique', table_objet_sql($type), sql_in('id_rubrique', $fratrie));
224
+            $h = array_column($h, 'id_rubrique');
225
+            $has = array_merge($has, $h);
226
+            $fratrie = array_diff($fratrie, $h);
227
+        }
228
+
229
+        if (count($has)) {
230
+            $has_child = $has_child + array_combine($has, array_pad([], count($has), true));
231
+        }
232
+        if (count($fratrie)) {
233
+            $has_child = $has_child + array_combine($fratrie, array_pad([], count($fratrie), false));
234
+        }
235
+    }
236
+
237
+    return $has_child[$id_rubrique] ? ' ' : '';
238 238
 }
Please login to merge, or discard this patch.
ecrire/lang/ecrire_en.php 1 patch
Indentation   +836 added lines, -836 removed lines patch added patch discarded remove patch
@@ -4,429 +4,429 @@  discard block
 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' => 'Enable plugin',
14
-	'affichage' => 'Display',
15
-	'aide_non_disponible' => 'This part of the online help is not yet available in this language.',
16
-	'annuler_recherche' => 'Cancel the search',
17
-	'auteur' => 'Author:',
18
-	'avis_acces_interdit' => 'Access forbidden.',
19
-	'avis_acces_interdit_prive' => 'You are not allowed to access the page <b>@exec@</b>.',
20
-	'avis_article_modifie' => 'Warning: @nom_auteur_modif@ modified this article @date_diff@ minutes ago',
21
-	'avis_aucun_resultat' => 'No results found.',
22
-	'avis_base_inaccessible' => 'Impossible to connect to the database @base@.',
23
-	'avis_chemin_invalide_1' => 'The path you selected',
24
-	'avis_chemin_invalide_2' => 'does not seem to be valid. Please go back to previous page and check the information you provided.',
25
-	'avis_connexion_echec_1' => 'Connection to the SQL server failed.',
26
-	'avis_connexion_echec_2' => 'Go back to the previous page, and check the information you provided.',
27
-	'avis_connexion_echec_3' => '<b>N.B.</b> On many servers, you must <b>request</b> activation of your access to the SQL database before you can use it. If you cannot connect to your database, check that activation has been done.',
28
-	'avis_connexion_erreur_creer_base' => 'The database could not be created.',
29
-	'avis_connexion_erreur_nom_base' => 'The database’s name should only contain letters, digits and hyphens.',
30
-	'avis_connexion_ldap_echec_1' => 'Connection to the LDAP server failed.',
31
-	'avis_connexion_ldap_echec_2' => 'Go back to the previous page, and check the information you provided.',
32
-	'avis_connexion_ldap_echec_3' => 'Alternatively, do not use LDAP support to import users.',
33
-	'avis_deplacement_rubrique' => 'Warning! This section contains @contient_breves@ news item@scb@: if you move it, please check this box to confirm.',
34
-	'avis_erreur_connexion_mysql' => 'SQL connection error',
35
-	'avis_espace_interdit' => '<b>Forbidden area</b> <div>SPIP is already installed.</div>',
36
-	'avis_lecture_noms_bases_1' => 'The installer could not read the names of any databases already installed.',
37
-	'avis_lecture_noms_bases_2' => 'Either no database is available, or the option listing databases was disabled for security reasons (which is the case with various hosting services).',
38
-	'avis_lecture_noms_bases_3' => 'In the second case, a database named after your login might already be available:',
39
-	'avis_non_acces_page' => 'You do not have access to this page.',
40
-	'avis_operation_echec' => 'The operation failed.',
41
-	'avis_operation_impossible' => 'Operation impossible',
42
-	'avis_suppression_base' => 'WARNING: data deletion is irreversible',
12
+    // A
13
+    'activer_plugin' => 'Enable plugin',
14
+    'affichage' => 'Display',
15
+    'aide_non_disponible' => 'This part of the online help is not yet available in this language.',
16
+    'annuler_recherche' => 'Cancel the search',
17
+    'auteur' => 'Author:',
18
+    'avis_acces_interdit' => 'Access forbidden.',
19
+    'avis_acces_interdit_prive' => 'You are not allowed to access the page <b>@exec@</b>.',
20
+    'avis_article_modifie' => 'Warning: @nom_auteur_modif@ modified this article @date_diff@ minutes ago',
21
+    'avis_aucun_resultat' => 'No results found.',
22
+    'avis_base_inaccessible' => 'Impossible to connect to the database @base@.',
23
+    'avis_chemin_invalide_1' => 'The path you selected',
24
+    'avis_chemin_invalide_2' => 'does not seem to be valid. Please go back to previous page and check the information you provided.',
25
+    'avis_connexion_echec_1' => 'Connection to the SQL server failed.',
26
+    'avis_connexion_echec_2' => 'Go back to the previous page, and check the information you provided.',
27
+    'avis_connexion_echec_3' => '<b>N.B.</b> On many servers, you must <b>request</b> activation of your access to the SQL database before you can use it. If you cannot connect to your database, check that activation has been done.',
28
+    'avis_connexion_erreur_creer_base' => 'The database could not be created.',
29
+    'avis_connexion_erreur_nom_base' => 'The database’s name should only contain letters, digits and hyphens.',
30
+    'avis_connexion_ldap_echec_1' => 'Connection to the LDAP server failed.',
31
+    'avis_connexion_ldap_echec_2' => 'Go back to the previous page, and check the information you provided.',
32
+    'avis_connexion_ldap_echec_3' => 'Alternatively, do not use LDAP support to import users.',
33
+    'avis_deplacement_rubrique' => 'Warning! This section contains @contient_breves@ news item@scb@: if you move it, please check this box to confirm.',
34
+    'avis_erreur_connexion_mysql' => 'SQL connection error',
35
+    'avis_espace_interdit' => '<b>Forbidden area</b> <div>SPIP is already installed.</div>',
36
+    'avis_lecture_noms_bases_1' => 'The installer could not read the names of any databases already installed.',
37
+    'avis_lecture_noms_bases_2' => 'Either no database is available, or the option listing databases was disabled for security reasons (which is the case with various hosting services).',
38
+    'avis_lecture_noms_bases_3' => 'In the second case, a database named after your login might already be available:',
39
+    'avis_non_acces_page' => 'You do not have access to this page.',
40
+    'avis_operation_echec' => 'The operation failed.',
41
+    'avis_operation_impossible' => 'Operation impossible',
42
+    'avis_suppression_base' => 'WARNING: data deletion is irreversible',
43 43
 
44
-	// B
45
-	'bouton_acces_ldap' => 'Add LDAP access',
46
-	'bouton_ajouter' => 'Add',
47
-	'bouton_annuler' => 'Cancel',
48
-	'bouton_cache_activer' => 'Re-activate the cache',
49
-	'bouton_cache_desactiver' => 'Disable the cache momentarily',
50
-	'bouton_demande_publication' => 'Request publication of this article',
51
-	'bouton_desactive_tout' => 'Disable all',
52
-	'bouton_desinstaller' => 'Uninstall',
53
-	'bouton_effacer_tout' => 'Delete ALL',
54
-	'bouton_envoyer_message' => 'Message complete: send',
55
-	'bouton_fermer' => 'Close',
56
-	'bouton_mettre_a_jour_base' => 'Update the database',
57
-	'bouton_modifier' => 'Modify',
58
-	'bouton_radio_afficher' => 'Show',
59
-	'bouton_radio_apparaitre_liste_redacteurs_connectes' => 'Appear in the list of editors online',
60
-	'bouton_radio_envoi_annonces_adresse' => 'Send announcements to:',
61
-	'bouton_radio_envoi_liste_nouveautes' => 'Send news update list',
62
-	'bouton_radio_non_apparaitre_liste_redacteurs_connectes' => 'Do not appear in the list of editors online',
63
-	'bouton_radio_non_envoi_annonces_editoriales' => 'Do not send any editorial announcements',
64
-	'bouton_redirection' => 'REDIRECT',
65
-	'bouton_reinitialiser_aux_valeurs_par_defaut' => 'Reset to default values',
66
-	'bouton_relancer_inscription' => 'Re-launch registration',
67
-	'bouton_relancer_inscriptions' => 'Re-launch registrations',
68
-	'bouton_relancer_installation' => 'Recommence installation',
69
-	'bouton_reset_password' => 'Create a new password and send by e-mail',
70
-	'bouton_suivant' => 'Next',
71
-	'bouton_tenter_recuperation' => 'Attempt to repair',
72
-	'bouton_test_proxy' => 'Test the proxy',
73
-	'bouton_vider_cache' => 'Empty the cache',
44
+    // B
45
+    'bouton_acces_ldap' => 'Add LDAP access',
46
+    'bouton_ajouter' => 'Add',
47
+    'bouton_annuler' => 'Cancel',
48
+    'bouton_cache_activer' => 'Re-activate the cache',
49
+    'bouton_cache_desactiver' => 'Disable the cache momentarily',
50
+    'bouton_demande_publication' => 'Request publication of this article',
51
+    'bouton_desactive_tout' => 'Disable all',
52
+    'bouton_desinstaller' => 'Uninstall',
53
+    'bouton_effacer_tout' => 'Delete ALL',
54
+    'bouton_envoyer_message' => 'Message complete: send',
55
+    'bouton_fermer' => 'Close',
56
+    'bouton_mettre_a_jour_base' => 'Update the database',
57
+    'bouton_modifier' => 'Modify',
58
+    'bouton_radio_afficher' => 'Show',
59
+    'bouton_radio_apparaitre_liste_redacteurs_connectes' => 'Appear in the list of editors online',
60
+    'bouton_radio_envoi_annonces_adresse' => 'Send announcements to:',
61
+    'bouton_radio_envoi_liste_nouveautes' => 'Send news update list',
62
+    'bouton_radio_non_apparaitre_liste_redacteurs_connectes' => 'Do not appear in the list of editors online',
63
+    'bouton_radio_non_envoi_annonces_editoriales' => 'Do not send any editorial announcements',
64
+    'bouton_redirection' => 'REDIRECT',
65
+    'bouton_reinitialiser_aux_valeurs_par_defaut' => 'Reset to default values',
66
+    'bouton_relancer_inscription' => 'Re-launch registration',
67
+    'bouton_relancer_inscriptions' => 'Re-launch registrations',
68
+    'bouton_relancer_installation' => 'Recommence installation',
69
+    'bouton_reset_password' => 'Create a new password and send by e-mail',
70
+    'bouton_suivant' => 'Next',
71
+    'bouton_tenter_recuperation' => 'Attempt to repair',
72
+    'bouton_test_proxy' => 'Test the proxy',
73
+    'bouton_vider_cache' => 'Empty the cache',
74 74
 
75
-	// C
76
-	'cache_modifiable_webmestre' => 'This parameter can be modified by the webmaster.',
77
-	'calendrier_synchro' => 'If you use a calendar application compatible with <b>iCal</b>, you can synchronise it with information from this site.',
78
-	'config_activer_champs' => 'Activate the following fields',
79
-	'config_choix_base_sup' => 'Choose a database on this server',
80
-	'config_erreur_base_sup' => 'SPIP does not have access to the list of databases available',
81
-	'config_info_base_sup' => 'If you need to query other databases using SPIP, whether on this SQL server or elsewhere, use this form to declare them. If you leave any fields empty, connection details to the main database will be used.',
82
-	'config_info_base_sup_disponibles' => 'Additional databases to which queries may be sent:',
83
-	'config_info_enregistree' => 'The new configuration has been saved',
84
-	'config_info_logos' => 'Each element of the site can have its own logo as well as a "mouseover" logo',
85
-	'config_info_logos_utiliser' => 'Use logos',
86
-	'config_info_logos_utiliser_non' => 'Do not use logos',
87
-	'config_info_logos_utiliser_survol' => 'Use "mouseover" logos',
88
-	'config_info_logos_utiliser_survol_non' => 'Do not use "mouseover" logos',
89
-	'config_info_redirection' => 'By activating this option you can create virtual articles, which are simply links to articles published on other sites, not necessarily using SPIP.',
90
-	'config_redirection' => 'Virtual articles',
91
-	'config_titre_base_sup' => 'Declaration of an additional database',
92
-	'config_titre_base_sup_choix' => 'Choose an additional database',
93
-	'connexion_ldap' => 'Connection:',
94
-	'creer_et_associer_un_auteur' => 'Create and associate an author',
75
+    // C
76
+    'cache_modifiable_webmestre' => 'This parameter can be modified by the webmaster.',
77
+    'calendrier_synchro' => 'If you use a calendar application compatible with <b>iCal</b>, you can synchronise it with information from this site.',
78
+    'config_activer_champs' => 'Activate the following fields',
79
+    'config_choix_base_sup' => 'Choose a database on this server',
80
+    'config_erreur_base_sup' => 'SPIP does not have access to the list of databases available',
81
+    'config_info_base_sup' => 'If you need to query other databases using SPIP, whether on this SQL server or elsewhere, use this form to declare them. If you leave any fields empty, connection details to the main database will be used.',
82
+    'config_info_base_sup_disponibles' => 'Additional databases to which queries may be sent:',
83
+    'config_info_enregistree' => 'The new configuration has been saved',
84
+    'config_info_logos' => 'Each element of the site can have its own logo as well as a "mouseover" logo',
85
+    'config_info_logos_utiliser' => 'Use logos',
86
+    'config_info_logos_utiliser_non' => 'Do not use logos',
87
+    'config_info_logos_utiliser_survol' => 'Use "mouseover" logos',
88
+    'config_info_logos_utiliser_survol_non' => 'Do not use "mouseover" logos',
89
+    'config_info_redirection' => 'By activating this option you can create virtual articles, which are simply links to articles published on other sites, not necessarily using SPIP.',
90
+    'config_redirection' => 'Virtual articles',
91
+    'config_titre_base_sup' => 'Declaration of an additional database',
92
+    'config_titre_base_sup_choix' => 'Choose an additional database',
93
+    'connexion_ldap' => 'Connection:',
94
+    'creer_et_associer_un_auteur' => 'Create and associate an author',
95 95
 
96
-	// D
97
-	'date_mot_heures' => 'H',
96
+    // D
97
+    'date_mot_heures' => 'H',
98 98
 
99
-	// E
100
-	'ecran_connexion_couleur_principale' => 'Main colour',
101
-	'ecran_connexion_image_fond' => 'Background image',
102
-	'ecran_connexion_image_fond_explication' => 'Use an image (JPEG format, 1920x1080 pixels)',
103
-	'ecran_connexion_image_revenir_couleur_defaut' => 'Back to the default colour',
104
-	'ecran_connexion_titre' => 'Connection screen',
105
-	'ecran_securite' => '+ safety screen @version@',
106
-	'email' => 'email',
107
-	'email_2' => 'email:',
108
-	'en_savoir_plus' => 'Learn more',
109
-	'entree_adresse_annuaire' => 'Directory address',
110
-	'entree_adresse_email' => 'Your email address',
111
-	'entree_adresse_email_2' => 'E-mail address',
112
-	'entree_base_donnee_1' => 'Database address',
113
-	'entree_base_donnee_2' => '(This address is often your site’s URL, although sometimes it will be "localhost", and sometimes it should be left blank.)',
114
-	'entree_biographie' => 'Brief biography',
115
-	'entree_chemin_acces' => '<b>Enter</b> the path:',
116
-	'entree_cle_pgp' => 'Your PGP key',
117
-	'entree_cle_pgp_2' => 'PGP key',
118
-	'entree_contenu_rubrique' => '(Brief description of the content of this section.)',
119
-	'entree_identifiants_connexion' => 'Your connection identifiers...',
120
-	'entree_identifiants_connexion_2' => 'Connection identifiers',
121
-	'entree_informations_connexion_ldap' => 'Please fill this form with the LDAP connection information provided by your system or network administrator.',
122
-	'entree_infos_perso' => 'Who are you?',
123
-	'entree_infos_perso_2' => 'Who is the author?',
124
-	'entree_interieur_rubrique' => 'In the section:',
125
-	'entree_liens_sites' => '<b>Hyperlink</b> (reference, site to visit etc.)',
126
-	'entree_login' => 'Your login',
127
-	'entree_login_connexion_1' => 'Connection login',
128
-	'entree_login_connexion_2' => '(Sometimes matches your FTP account login and sometimes left empty)',
129
-	'entree_mot_passe' => 'Your password',
130
-	'entree_mot_passe_1' => 'Password',
131
-	'entree_mot_passe_2' => '(Sometimes matches your FTP access password and sometimes left empty)',
132
-	'entree_nom_fichier' => 'Please enter the filename @texte_compresse@:',
133
-	'entree_nom_pseudo' => 'Your name or alias',
134
-	'entree_nom_pseudo_1' => '(Your name or alias)',
135
-	'entree_nom_pseudo_2' => 'Name or alias',
136
-	'entree_nom_site' => 'Website’s name',
137
-	'entree_nom_site_2' => 'Author’s website’s name',
138
-	'entree_nouveau_passe' => 'New password',
139
-	'entree_passe_ldap' => 'Password',
140
-	'entree_port_annuaire' => 'Port number of the directory',
141
-	'entree_signature' => 'Signature',
142
-	'entree_titre_obligatoire' => '<b>Title</b> [Required]<br />',
143
-	'entree_url' => 'Website’s URL',
144
-	'entree_url_2' => 'Website’s URL',
145
-	'erreur_connect_deja_existant' => 'A server by that name already exists',
146
-	'erreur_contenu_suspect' => 'Text escaped',
147
-	'erreur_email_deja_existant' => 'This email address has already been registered.',
148
-	'erreur_nom_connect_incorrect' => 'Server name not allowed',
149
-	'erreur_plugin_attribut_balise_manquant' => 'Missing attribute @attribut@ in tag @balise@',
150
-	'erreur_plugin_desinstalation_echouee' => 'Uninstallation of the plugin failed. However, you may deactivate it.',
151
-	'erreur_plugin_fichier_absent' => 'File missing',
152
-	'erreur_plugin_fichier_def_absent' => 'Definition file missing',
153
-	'erreur_plugin_nom_fonction_interdit' => 'Prohibited function name',
154
-	'erreur_plugin_nom_manquant' => 'Missing plugin name',
155
-	'erreur_plugin_prefix_manquant' => 'Namespace undefined for this plugin',
156
-	'erreur_plugin_tag_plugin_absent' => '&lt;plugin&gt; missing in the definition file',
157
-	'erreur_plugin_version_manquant' => 'Plugin version missing',
158
-	'erreur_type_fichier' => 'Wrong file type',
99
+    // E
100
+    'ecran_connexion_couleur_principale' => 'Main colour',
101
+    'ecran_connexion_image_fond' => 'Background image',
102
+    'ecran_connexion_image_fond_explication' => 'Use an image (JPEG format, 1920x1080 pixels)',
103
+    'ecran_connexion_image_revenir_couleur_defaut' => 'Back to the default colour',
104
+    'ecran_connexion_titre' => 'Connection screen',
105
+    'ecran_securite' => '+ safety screen @version@',
106
+    'email' => 'email',
107
+    'email_2' => 'email:',
108
+    'en_savoir_plus' => 'Learn more',
109
+    'entree_adresse_annuaire' => 'Directory address',
110
+    'entree_adresse_email' => 'Your email address',
111
+    'entree_adresse_email_2' => 'E-mail address',
112
+    'entree_base_donnee_1' => 'Database address',
113
+    'entree_base_donnee_2' => '(This address is often your site’s URL, although sometimes it will be "localhost", and sometimes it should be left blank.)',
114
+    'entree_biographie' => 'Brief biography',
115
+    'entree_chemin_acces' => '<b>Enter</b> the path:',
116
+    'entree_cle_pgp' => 'Your PGP key',
117
+    'entree_cle_pgp_2' => 'PGP key',
118
+    'entree_contenu_rubrique' => '(Brief description of the content of this section.)',
119
+    'entree_identifiants_connexion' => 'Your connection identifiers...',
120
+    'entree_identifiants_connexion_2' => 'Connection identifiers',
121
+    'entree_informations_connexion_ldap' => 'Please fill this form with the LDAP connection information provided by your system or network administrator.',
122
+    'entree_infos_perso' => 'Who are you?',
123
+    'entree_infos_perso_2' => 'Who is the author?',
124
+    'entree_interieur_rubrique' => 'In the section:',
125
+    'entree_liens_sites' => '<b>Hyperlink</b> (reference, site to visit etc.)',
126
+    'entree_login' => 'Your login',
127
+    'entree_login_connexion_1' => 'Connection login',
128
+    'entree_login_connexion_2' => '(Sometimes matches your FTP account login and sometimes left empty)',
129
+    'entree_mot_passe' => 'Your password',
130
+    'entree_mot_passe_1' => 'Password',
131
+    'entree_mot_passe_2' => '(Sometimes matches your FTP access password and sometimes left empty)',
132
+    'entree_nom_fichier' => 'Please enter the filename @texte_compresse@:',
133
+    'entree_nom_pseudo' => 'Your name or alias',
134
+    'entree_nom_pseudo_1' => '(Your name or alias)',
135
+    'entree_nom_pseudo_2' => 'Name or alias',
136
+    'entree_nom_site' => 'Website’s name',
137
+    'entree_nom_site_2' => 'Author’s website’s name',
138
+    'entree_nouveau_passe' => 'New password',
139
+    'entree_passe_ldap' => 'Password',
140
+    'entree_port_annuaire' => 'Port number of the directory',
141
+    'entree_signature' => 'Signature',
142
+    'entree_titre_obligatoire' => '<b>Title</b> [Required]<br />',
143
+    'entree_url' => 'Website’s URL',
144
+    'entree_url_2' => 'Website’s URL',
145
+    'erreur_connect_deja_existant' => 'A server by that name already exists',
146
+    'erreur_contenu_suspect' => 'Text escaped',
147
+    'erreur_email_deja_existant' => 'This email address has already been registered.',
148
+    'erreur_nom_connect_incorrect' => 'Server name not allowed',
149
+    'erreur_plugin_attribut_balise_manquant' => 'Missing attribute @attribut@ in tag @balise@',
150
+    'erreur_plugin_desinstalation_echouee' => 'Uninstallation of the plugin failed. However, you may deactivate it.',
151
+    'erreur_plugin_fichier_absent' => 'File missing',
152
+    'erreur_plugin_fichier_def_absent' => 'Definition file missing',
153
+    'erreur_plugin_nom_fonction_interdit' => 'Prohibited function name',
154
+    'erreur_plugin_nom_manquant' => 'Missing plugin name',
155
+    'erreur_plugin_prefix_manquant' => 'Namespace undefined for this plugin',
156
+    'erreur_plugin_tag_plugin_absent' => '&lt;plugin&gt; missing in the definition file',
157
+    'erreur_plugin_version_manquant' => 'Plugin version missing',
158
+    'erreur_type_fichier' => 'Wrong file type',
159 159
 
160
-	// H
161
-	'htaccess_a_simuler' => 'Warning: your HTTP server configuration ignores @htaccess@ files. To ensure good security, you should change the configuration for this. Alternatively, you should make sure that the constants @constantes@ (definable in the file mes_options.php) have as values directories outside @document_root@.',
162
-	'htaccess_inoperant' => 'inoperative htaccess',
160
+    // H
161
+    'htaccess_a_simuler' => 'Warning: your HTTP server configuration ignores @htaccess@ files. To ensure good security, you should change the configuration for this. Alternatively, you should make sure that the constants @constantes@ (definable in the file mes_options.php) have as values directories outside @document_root@.',
162
+    'htaccess_inoperant' => 'inoperative htaccess',
163 163
 
164
-	// I
165
-	'ical_info1' => 'This page offers several tools to be kept  up-to-date with website’s activity.',
166
-	'ical_info2' => 'For more information, do not hesitate to visit <a href="@spipnet@">SPIP’s documentation</a>.',
167
-	'ical_info_calendrier' => 'Two calendars are available. The first is a general, public calendar showing  articles as they are published. The second is personal and contains editorial announcements as well as your latest private messages: it is reserved for you via a personal key that you can modify at any time by renewing your password.',
168
-	'ical_methode_http' => 'Downloading',
169
-	'ical_methode_webcal' => 'Synchronisation (webcal://)',
170
-	'ical_texte_js' => 'A line of javascript allows you to easily display the most recent articles published on this site on any other site belonging to you.',
171
-	'ical_texte_prive' => 'This calendar, which is strictly personal, informs you of the private editorial activity of this site (tasks, personal appointments, articles and news items submitted etc.).',
172
-	'ical_texte_public' => 'This calendar allows you to follow the public activity of this site (newly-published articles and news items).',
173
-	'ical_texte_rss' => 'You can syndicate the latest news from this site in any XML/RSS (Rich Site Summary) reader. This is also the format that allows SPIP to read the latest news published by other sites using a compatible exchange format (syndicated sites).',
174
-	'ical_titre_js' => 'Javascript',
175
-	'ical_titre_mailing' => 'Mailing-list',
176
-	'ical_titre_rss' => 'Syndication files',
177
-	'icone_accueil' => 'Home',
178
-	'icone_activer_cookie' => 'Place a cookie',
179
-	'icone_activite' => 'Feedback',
180
-	'icone_admin_plugin' => 'Manage plugins',
181
-	'icone_administration' => 'Maintenance',
182
-	'icone_afficher_auteurs' => 'Show authors',
183
-	'icone_afficher_visiteurs' => 'Show visitors',
184
-	'icone_arret_discussion' => 'Stop participating in this discussion',
185
-	'icone_calendrier' => 'Calendar',
186
-	'icone_configuration' => 'Configuration',
187
-	'icone_creer_auteur' => 'Create a new author and link him/her to this article',
188
-	'icone_creer_mot_cle' => 'Create a new keyword and link it to this article',
189
-	'icone_creer_rubrique_2' => 'Create a new section',
190
-	'icone_developpement' => 'Development',
191
-	'icone_edition' => 'Edit',
192
-	'icone_ma_langue' => 'My language',
193
-	'icone_mes_infos' => 'My details',
194
-	'icone_mes_preferences' => 'Preferences',
195
-	'icone_modifier_article' => 'Edit this article',
196
-	'icone_modifier_rubrique' => 'Edit this section',
197
-	'icone_publication' => 'Publish',
198
-	'icone_relancer_signataire' => 'Contact the signatory again',
199
-	'icone_retour' => 'Back',
200
-	'icone_retour_article' => 'Back to the article',
201
-	'icone_squelette' => 'Templates',
202
-	'icone_suivi_publication' => 'Publication follow up ',
203
-	'icone_supprimer_cookie' => 'Delete cookie',
204
-	'icone_supprimer_rubrique' => 'Delete this section',
205
-	'icone_supprimer_signature' => 'Delete this signature',
206
-	'icone_valider_signature' => 'Validate this signature',
207
-	'image_administrer_rubrique' => 'You can manage this section',
208
-	'impossible_modifier_login_auteur' => 'Login cannot be changed.',
209
-	'impossible_modifier_pass_auteur' => 'Password cannot be changed.',
210
-	'info_1_article' => '1 article',
211
-	'info_1_auteur' => '1 author',
212
-	'info_1_message' => '1 message',
213
-	'info_1_mot_cle' => '1 keyword',
214
-	'info_1_rubrique' => '1 section',
215
-	'info_1_visiteur' => '1 visitor',
216
-	'info_activer_cookie' => 'You can activate an <b>administration cookie</b>, which lets you switch easily between the public website and the admin area.',
217
-	'info_activer_menu_developpement' => 'Show the Development menu',
218
-	'info_admin_etre_webmestre' => 'Give me web administrator rights',
219
-	'info_admin_je_suis_webmestre' => 'I am a <b>webmaster</b>',
220
-	'info_admin_statuer_webmestre' => 'Give webmaster rights to this administrator ',
221
-	'info_admin_webmestre' => 'This administrator is <b>webmaster</b>',
222
-	'info_administrateur' => 'Administrator',
223
-	'info_administrateur_1' => 'Administrator',
224
-	'info_administrateur_2' => 'of the site (<i>use with caution</i>)',
225
-	'info_administrateur_site_01' => 'If you are a site administrator, please',
226
-	'info_administrateur_site_02' => 'click on this link',
227
-	'info_administrateurs' => 'Administrators',
228
-	'info_administrer_rubrique' => 'You can manage this section',
229
-	'info_adresse' => 'to this address:',
230
-	'info_adresse_desinscription' => 'Unsubscription address:',
231
-	'info_adresse_url' => 'URL of the public site',
232
-	'info_afficher_par_nb' => 'Show ',
233
-	'info_aide_en_ligne' => 'SPIP Online Help',
234
-	'info_ajout_image' => 'When you add images as attached documents to an article,
164
+    // I
165
+    'ical_info1' => 'This page offers several tools to be kept  up-to-date with website’s activity.',
166
+    'ical_info2' => 'For more information, do not hesitate to visit <a href="@spipnet@">SPIP’s documentation</a>.',
167
+    'ical_info_calendrier' => 'Two calendars are available. The first is a general, public calendar showing  articles as they are published. The second is personal and contains editorial announcements as well as your latest private messages: it is reserved for you via a personal key that you can modify at any time by renewing your password.',
168
+    'ical_methode_http' => 'Downloading',
169
+    'ical_methode_webcal' => 'Synchronisation (webcal://)',
170
+    'ical_texte_js' => 'A line of javascript allows you to easily display the most recent articles published on this site on any other site belonging to you.',
171
+    'ical_texte_prive' => 'This calendar, which is strictly personal, informs you of the private editorial activity of this site (tasks, personal appointments, articles and news items submitted etc.).',
172
+    'ical_texte_public' => 'This calendar allows you to follow the public activity of this site (newly-published articles and news items).',
173
+    'ical_texte_rss' => 'You can syndicate the latest news from this site in any XML/RSS (Rich Site Summary) reader. This is also the format that allows SPIP to read the latest news published by other sites using a compatible exchange format (syndicated sites).',
174
+    'ical_titre_js' => 'Javascript',
175
+    'ical_titre_mailing' => 'Mailing-list',
176
+    'ical_titre_rss' => 'Syndication files',
177
+    'icone_accueil' => 'Home',
178
+    'icone_activer_cookie' => 'Place a cookie',
179
+    'icone_activite' => 'Feedback',
180
+    'icone_admin_plugin' => 'Manage plugins',
181
+    'icone_administration' => 'Maintenance',
182
+    'icone_afficher_auteurs' => 'Show authors',
183
+    'icone_afficher_visiteurs' => 'Show visitors',
184
+    'icone_arret_discussion' => 'Stop participating in this discussion',
185
+    'icone_calendrier' => 'Calendar',
186
+    'icone_configuration' => 'Configuration',
187
+    'icone_creer_auteur' => 'Create a new author and link him/her to this article',
188
+    'icone_creer_mot_cle' => 'Create a new keyword and link it to this article',
189
+    'icone_creer_rubrique_2' => 'Create a new section',
190
+    'icone_developpement' => 'Development',
191
+    'icone_edition' => 'Edit',
192
+    'icone_ma_langue' => 'My language',
193
+    'icone_mes_infos' => 'My details',
194
+    'icone_mes_preferences' => 'Preferences',
195
+    'icone_modifier_article' => 'Edit this article',
196
+    'icone_modifier_rubrique' => 'Edit this section',
197
+    'icone_publication' => 'Publish',
198
+    'icone_relancer_signataire' => 'Contact the signatory again',
199
+    'icone_retour' => 'Back',
200
+    'icone_retour_article' => 'Back to the article',
201
+    'icone_squelette' => 'Templates',
202
+    'icone_suivi_publication' => 'Publication follow up ',
203
+    'icone_supprimer_cookie' => 'Delete cookie',
204
+    'icone_supprimer_rubrique' => 'Delete this section',
205
+    'icone_supprimer_signature' => 'Delete this signature',
206
+    'icone_valider_signature' => 'Validate this signature',
207
+    'image_administrer_rubrique' => 'You can manage this section',
208
+    'impossible_modifier_login_auteur' => 'Login cannot be changed.',
209
+    'impossible_modifier_pass_auteur' => 'Password cannot be changed.',
210
+    'info_1_article' => '1 article',
211
+    'info_1_auteur' => '1 author',
212
+    'info_1_message' => '1 message',
213
+    'info_1_mot_cle' => '1 keyword',
214
+    'info_1_rubrique' => '1 section',
215
+    'info_1_visiteur' => '1 visitor',
216
+    'info_activer_cookie' => 'You can activate an <b>administration cookie</b>, which lets you switch easily between the public website and the admin area.',
217
+    'info_activer_menu_developpement' => 'Show the Development menu',
218
+    'info_admin_etre_webmestre' => 'Give me web administrator rights',
219
+    'info_admin_je_suis_webmestre' => 'I am a <b>webmaster</b>',
220
+    'info_admin_statuer_webmestre' => 'Give webmaster rights to this administrator ',
221
+    'info_admin_webmestre' => 'This administrator is <b>webmaster</b>',
222
+    'info_administrateur' => 'Administrator',
223
+    'info_administrateur_1' => 'Administrator',
224
+    'info_administrateur_2' => 'of the site (<i>use with caution</i>)',
225
+    'info_administrateur_site_01' => 'If you are a site administrator, please',
226
+    'info_administrateur_site_02' => 'click on this link',
227
+    'info_administrateurs' => 'Administrators',
228
+    'info_administrer_rubrique' => 'You can manage this section',
229
+    'info_adresse' => 'to this address:',
230
+    'info_adresse_desinscription' => 'Unsubscription address:',
231
+    'info_adresse_url' => 'URL of the public site',
232
+    'info_afficher_par_nb' => 'Show ',
233
+    'info_aide_en_ligne' => 'SPIP Online Help',
234
+    'info_ajout_image' => 'When you add images as attached documents to an article,
235 235
   SPIP can automatically create thumbnails from
236 236
   inserted images. This will allow, for instance, the automated
237 237
   creation of a gallery or portfolio.',
238
-	'info_ajouter_rubrique' => 'Add another section to manage:',
239
-	'info_annonce_nouveautes' => 'Latest news announcements',
240
-	'info_article' => 'article',
241
-	'info_article_2' => 'articles',
242
-	'info_article_a_paraitre' => 'Post-dated articles set for publication',
243
-	'info_articles_02' => 'articles',
244
-	'info_articles_2' => 'Articles',
245
-	'info_articles_auteur' => 'Articles by this author',
246
-	'info_articles_miens' => 'My articles',
247
-	'info_articles_tous' => 'All the articles',
248
-	'info_articles_trouves' => 'Articles found',
249
-	'info_attente_validation' => 'Your articles awaiting validation',
250
-	'info_aucun_article' => 'No articles',
251
-	'info_aucun_auteur' => 'No authors',
252
-	'info_aucun_message' => 'No messages',
253
-	'info_aucun_rubrique' => 'No sections',
254
-	'info_aujourdhui' => 'today:',
255
-	'info_auteur_gere_rubriques' => 'This author manages the following sections:',
256
-	'info_auteur_gere_toutes_rubriques' => 'This author manage <b>all the sections</b>',
257
-	'info_auteur_gere_toutes_rubriques_2' => 'I manage <b>all the sections</b>',
258
-	'info_auteurs' => 'Authors',
259
-	'info_auteurs_par_tri' => 'Authors@partri@',
260
-	'info_auteurs_trouves' => 'Authors found',
261
-	'info_authentification_externe' => 'External authentication',
262
-	'info_avertissement' => 'Warning',
263
-	'info_barre_outils' => 'with its toolbar?',
264
-	'info_base_installee' => 'Your database structure has been installed.',
265
-	'info_bio' => 'Biography',
266
-	'info_cache_desactive' => 'The cache is temporarily disabled',
267
-	'info_chapeau' => 'Introduction',
268
-	'info_chapeau_2' => 'Introduction:',
269
-	'info_chemin_acces_1' => 'Options: <b>Access path in directory</b>',
270
-	'info_chemin_acces_2' => 'You must now configure the access path to the directory information. This information is essential to read the user profiles stored in the directory.',
271
-	'info_chemin_acces_annuaire' => 'Options: <b>Access path in directory</b>',
272
-	'info_choix_base' => 'Third step:',
273
-	'info_classement_1' => ' out of @liste@',
274
-	'info_classement_2' => ' out of @liste@',
275
-	'info_code_acces' => 'Do not forget your own access codes!',
276
-	'info_config_suivi' => 'If this address corresponds to a mailing list, you can indicate the subscription address for this list. This may be a URL (e.g. a webpage enabling subscription online), or an email address with a specific subject (for instance: <tt>@adresse_suivi@?subject=subscribe</tt>):',
277
-	'info_config_suivi_explication' => 'You can subscribe to the mailing-list for this site. You will then receive email announcements concerning articles and news items submitted for publication.',
278
-	'info_confirmer_passe' => 'Confirm new password:',
279
-	'info_conflit_edition_avis_non_sauvegarde' => 'Caution: the following fields have been modified elsewhere. Your changes to these fields have therefore not been saved.',
280
-	'info_conflit_edition_differences' => 'Differences:',
281
-	'info_conflit_edition_version_enregistree' => 'Saved version:',
282
-	'info_conflit_edition_votre_version' => 'Your version:',
283
-	'info_connexion_base' => 'Trying to connect to database',
284
-	'info_connexion_base_donnee' => 'Connection to your database',
285
-	'info_connexion_ldap_ok' => '<b>LDAP connection succeeded.</b><p> You can go to the next step.</p>',
286
-	'info_connexion_mysql' => 'Your SQL connection',
287
-	'info_connexion_ok' => 'Connection succeeded.',
288
-	'info_contact' => 'Contact',
289
-	'info_contenu_articles' => 'Article content',
290
-	'info_contributions' => 'Contributions',
291
-	'info_creation_paragraphe' => 'To create paragraphs, just leave blank lines.',
292
-	'info_creation_rubrique' => 'Before writing any articles,<br /> you must create at least one section.<br />',
293
-	'info_creation_tables' => 'Creating the database tables',
294
-	'info_creer_base' => '<b>Create</b> a new database:',
295
-	'info_dans_rubrique' => 'In section:',
296
-	'info_date_publication_anterieure' => 'Previously published on:',
297
-	'info_date_referencement' => 'THIS SITE REFERENCED ON:',
298
-	'info_derniere_etape' => 'Done!',
299
-	'info_descriptif' => 'Description:',
300
-	'info_desinstaller_plugin' => ' deactivates the plugin and deletes the data',
301
-	'info_discussion_cours' => 'Current discussions',
302
-	'info_ecrire_article' => 'Before writing any articles, you must create at least one section.',
303
-	'info_email_envoi' => 'Sender’s email address (optional)',
304
-	'info_email_envoi_txt' => 'Enter the sender’s email address used for sending emails (by default, the recipient’s address is used as the sender’s address) :',
305
-	'info_email_webmestre' => 'Webmaster’s email address',
306
-	'info_envoi_email_automatique' => 'Automated mailing',
307
-	'info_envoyer_maintenant' => 'Send now',
308
-	'info_etape_suivante' => 'Go to the next step',
309
-	'info_etape_suivante_1' => 'You can move on to the next step.',
310
-	'info_etape_suivante_2' => 'You can move on to the next step.',
311
-	'info_exceptions_proxy' => 'Exceptions for the proxy',
312
-	'info_exportation_base' => 'export database to @archive@',
313
-	'info_facilite_suivi_activite' => 'To simplify monitoring of the site’s editorial;
238
+    'info_ajouter_rubrique' => 'Add another section to manage:',
239
+    'info_annonce_nouveautes' => 'Latest news announcements',
240
+    'info_article' => 'article',
241
+    'info_article_2' => 'articles',
242
+    'info_article_a_paraitre' => 'Post-dated articles set for publication',
243
+    'info_articles_02' => 'articles',
244
+    'info_articles_2' => 'Articles',
245
+    'info_articles_auteur' => 'Articles by this author',
246
+    'info_articles_miens' => 'My articles',
247
+    'info_articles_tous' => 'All the articles',
248
+    'info_articles_trouves' => 'Articles found',
249
+    'info_attente_validation' => 'Your articles awaiting validation',
250
+    'info_aucun_article' => 'No articles',
251
+    'info_aucun_auteur' => 'No authors',
252
+    'info_aucun_message' => 'No messages',
253
+    'info_aucun_rubrique' => 'No sections',
254
+    'info_aujourdhui' => 'today:',
255
+    'info_auteur_gere_rubriques' => 'This author manages the following sections:',
256
+    'info_auteur_gere_toutes_rubriques' => 'This author manage <b>all the sections</b>',
257
+    'info_auteur_gere_toutes_rubriques_2' => 'I manage <b>all the sections</b>',
258
+    'info_auteurs' => 'Authors',
259
+    'info_auteurs_par_tri' => 'Authors@partri@',
260
+    'info_auteurs_trouves' => 'Authors found',
261
+    'info_authentification_externe' => 'External authentication',
262
+    'info_avertissement' => 'Warning',
263
+    'info_barre_outils' => 'with its toolbar?',
264
+    'info_base_installee' => 'Your database structure has been installed.',
265
+    'info_bio' => 'Biography',
266
+    'info_cache_desactive' => 'The cache is temporarily disabled',
267
+    'info_chapeau' => 'Introduction',
268
+    'info_chapeau_2' => 'Introduction:',
269
+    'info_chemin_acces_1' => 'Options: <b>Access path in directory</b>',
270
+    'info_chemin_acces_2' => 'You must now configure the access path to the directory information. This information is essential to read the user profiles stored in the directory.',
271
+    'info_chemin_acces_annuaire' => 'Options: <b>Access path in directory</b>',
272
+    'info_choix_base' => 'Third step:',
273
+    'info_classement_1' => ' out of @liste@',
274
+    'info_classement_2' => ' out of @liste@',
275
+    'info_code_acces' => 'Do not forget your own access codes!',
276
+    'info_config_suivi' => 'If this address corresponds to a mailing list, you can indicate the subscription address for this list. This may be a URL (e.g. a webpage enabling subscription online), or an email address with a specific subject (for instance: <tt>@adresse_suivi@?subject=subscribe</tt>):',
277
+    'info_config_suivi_explication' => 'You can subscribe to the mailing-list for this site. You will then receive email announcements concerning articles and news items submitted for publication.',
278
+    'info_confirmer_passe' => 'Confirm new password:',
279
+    'info_conflit_edition_avis_non_sauvegarde' => 'Caution: the following fields have been modified elsewhere. Your changes to these fields have therefore not been saved.',
280
+    'info_conflit_edition_differences' => 'Differences:',
281
+    'info_conflit_edition_version_enregistree' => 'Saved version:',
282
+    'info_conflit_edition_votre_version' => 'Your version:',
283
+    'info_connexion_base' => 'Trying to connect to database',
284
+    'info_connexion_base_donnee' => 'Connection to your database',
285
+    'info_connexion_ldap_ok' => '<b>LDAP connection succeeded.</b><p> You can go to the next step.</p>',
286
+    'info_connexion_mysql' => 'Your SQL connection',
287
+    'info_connexion_ok' => 'Connection succeeded.',
288
+    'info_contact' => 'Contact',
289
+    'info_contenu_articles' => 'Article content',
290
+    'info_contributions' => 'Contributions',
291
+    'info_creation_paragraphe' => 'To create paragraphs, just leave blank lines.',
292
+    'info_creation_rubrique' => 'Before writing any articles,<br /> you must create at least one section.<br />',
293
+    'info_creation_tables' => 'Creating the database tables',
294
+    'info_creer_base' => '<b>Create</b> a new database:',
295
+    'info_dans_rubrique' => 'In section:',
296
+    'info_date_publication_anterieure' => 'Previously published on:',
297
+    'info_date_referencement' => 'THIS SITE REFERENCED ON:',
298
+    'info_derniere_etape' => 'Done!',
299
+    'info_descriptif' => 'Description:',
300
+    'info_desinstaller_plugin' => ' deactivates the plugin and deletes the data',
301
+    'info_discussion_cours' => 'Current discussions',
302
+    'info_ecrire_article' => 'Before writing any articles, you must create at least one section.',
303
+    'info_email_envoi' => 'Sender’s email address (optional)',
304
+    'info_email_envoi_txt' => 'Enter the sender’s email address used for sending emails (by default, the recipient’s address is used as the sender’s address) :',
305
+    'info_email_webmestre' => 'Webmaster’s email address',
306
+    'info_envoi_email_automatique' => 'Automated mailing',
307
+    'info_envoyer_maintenant' => 'Send now',
308
+    'info_etape_suivante' => 'Go to the next step',
309
+    'info_etape_suivante_1' => 'You can move on to the next step.',
310
+    'info_etape_suivante_2' => 'You can move on to the next step.',
311
+    'info_exceptions_proxy' => 'Exceptions for the proxy',
312
+    'info_exportation_base' => 'export database to @archive@',
313
+    'info_facilite_suivi_activite' => 'To simplify monitoring of the site’s editorial;
314 314
   activities, SPIP can send rmail notifications, e.g. to an editors’ mailing list,
315 315
   of publication requests and article validations.',
316
-	'info_fichiers_authent' => 'Authentication file ".htpasswd"',
317
-	'info_forums_abo_invites' => 'Your site contains forums by subscription; visitors may register for them on the public site.',
318
-	'info_gauche_admin_tech' => '<b>Only webmasters have access to this page.</b><p> It provides access to various
316
+    'info_fichiers_authent' => 'Authentication file ".htpasswd"',
317
+    'info_forums_abo_invites' => 'Your site contains forums by subscription; visitors may register for them on the public site.',
318
+    'info_gauche_admin_tech' => '<b>Only webmasters have access to this page.</b><p> It provides access to various
319 319
 maintenance tasks. Some of them require a specific authentication process
320 320
 via FTP.</p>',
321
-	'info_gauche_admin_vider' => '<b>Only webmasters have access to this page.</b><p> It provides access to various
321
+    'info_gauche_admin_vider' => '<b>Only webmasters have access to this page.</b><p> It provides access to various
322 322
 maintenance tasks. Some of them require a specific authentication process
323 323
 via FTP.</p>',
324
-	'info_gauche_auteurs' => 'All the site authors are listed here.
324
+    'info_gauche_auteurs' => 'All the site authors are listed here.
325 325
  The status of each is indicated by the colour of their icon (administrator = green; editor = yellow).',
326
-	'info_gauche_auteurs_exterieurs' => 'Visiting authors, without any access to the site, are indicated by a blue icon; deleted authors by a grey icon.',
327
-	'info_gauche_messagerie' => 'Internal messaging lets you exchange messages between editors, keep memos (for personal use) or, display announcements on the admin area’s homepage (if you are an administrator).',
328
-	'info_gauche_statistiques_referers' => 'This page displays the list of <i>referrers</i>, i.e. websites containing links to your own site, for yesterday and today. The list is reset every 24 hours.',
329
-	'info_gauche_visiteurs_enregistres' => 'You will find here the visitors registered
326
+    'info_gauche_auteurs_exterieurs' => 'Visiting authors, without any access to the site, are indicated by a blue icon; deleted authors by a grey icon.',
327
+    'info_gauche_messagerie' => 'Internal messaging lets you exchange messages between editors, keep memos (for personal use) or, display announcements on the admin area’s homepage (if you are an administrator).',
328
+    'info_gauche_statistiques_referers' => 'This page displays the list of <i>referrers</i>, i.e. websites containing links to your own site, for yesterday and today. The list is reset every 24 hours.',
329
+    'info_gauche_visiteurs_enregistres' => 'You will find here the visitors registered
330 330
  for the public area of the site (subscription-only forums).',
331
-	'info_generation_miniatures_images' => 'Generation of thumbnail images',
332
-	'info_gerer_trad_objets' => '@objets@: manage translation links',
333
-	'info_hebergeur_desactiver_envoi_email' => 'Some hosts disable automated mail sending
331
+    'info_generation_miniatures_images' => 'Generation of thumbnail images',
332
+    'info_gerer_trad_objets' => '@objets@: manage translation links',
333
+    'info_hebergeur_desactiver_envoi_email' => 'Some hosts disable automated mail sending
334 334
 		on their servers. In this case the following features
335 335
 		of SPIP cannot be implemented.',
336
-	'info_hier' => 'yesterday:',
337
-	'info_identification_publique' => 'Your public identity...',
338
-	'info_image_process' => 'Select the best method to create thumbnails by clicking on the corresponding picture.',
339
-	'info_image_process2' => 'If you can’t see any images, then your server is not configured to use such tools. If you want to use these features, contact your provider’s technical support and ask for the «GD» or «Imagick» extensions to be installed.',
340
-	'info_images_auto' => 'Images calculated automatically',
341
-	'info_informations_personnelles' => 'Personal information',
342
-	'info_inscription' => 'Registered on',
343
-	'info_inscription_automatique' => 'Automatic registration for new editors',
344
-	'info_jeu_caractere' => 'Character set for the site',
345
-	'info_jours' => 'days',
346
-	'info_laisser_champs_vides' => 'leave these fields empty)',
347
-	'info_langues' => 'Site languages',
348
-	'info_ldap_ok' => 'LDAP authentication is installed.',
349
-	'info_lien_hypertexte' => 'Hyperlink:',
350
-	'info_liste_nouveautes_envoyee' => 'The news update list has been sent',
351
-	'info_liste_redacteurs_connectes' => 'List of editors online',
352
-	'info_login_existant' => 'This login already exists.',
353
-	'info_login_trop_court' => 'Login too short.',
354
-	'info_login_trop_court_car_pluriel' => 'Your login must contain at least @nb@ characters.',
355
-	'info_logos' => 'Logos',
356
-	'info_maximum' => 'maximum:',
357
-	'info_meme_rubrique' => 'In this section',
358
-	'info_message_en_redaction' => 'Your draft messages',
359
-	'info_message_technique' => 'Technical message:',
360
-	'info_messagerie_interne' => 'Internal messaging',
361
-	'info_mise_a_niveau_base' => 'SQL database upgrade',
362
-	'info_mise_a_niveau_base_2' => '{{Warning!}} You have installed an {older} SPIP version, prior to the one
336
+    'info_hier' => 'yesterday:',
337
+    'info_identification_publique' => 'Your public identity...',
338
+    'info_image_process' => 'Select the best method to create thumbnails by clicking on the corresponding picture.',
339
+    'info_image_process2' => 'If you can’t see any images, then your server is not configured to use such tools. If you want to use these features, contact your provider’s technical support and ask for the «GD» or «Imagick» extensions to be installed.',
340
+    'info_images_auto' => 'Images calculated automatically',
341
+    'info_informations_personnelles' => 'Personal information',
342
+    'info_inscription' => 'Registered on',
343
+    'info_inscription_automatique' => 'Automatic registration for new editors',
344
+    'info_jeu_caractere' => 'Character set for the site',
345
+    'info_jours' => 'days',
346
+    'info_laisser_champs_vides' => 'leave these fields empty)',
347
+    'info_langues' => 'Site languages',
348
+    'info_ldap_ok' => 'LDAP authentication is installed.',
349
+    'info_lien_hypertexte' => 'Hyperlink:',
350
+    'info_liste_nouveautes_envoyee' => 'The news update list has been sent',
351
+    'info_liste_redacteurs_connectes' => 'List of editors online',
352
+    'info_login_existant' => 'This login already exists.',
353
+    'info_login_trop_court' => 'Login too short.',
354
+    'info_login_trop_court_car_pluriel' => 'Your login must contain at least @nb@ characters.',
355
+    'info_logos' => 'Logos',
356
+    'info_maximum' => 'maximum:',
357
+    'info_meme_rubrique' => 'In this section',
358
+    'info_message_en_redaction' => 'Your draft messages',
359
+    'info_message_technique' => 'Technical message:',
360
+    'info_messagerie_interne' => 'Internal messaging',
361
+    'info_mise_a_niveau_base' => 'SQL database upgrade',
362
+    'info_mise_a_niveau_base_2' => '{{Warning!}} You have installed an {older} SPIP version, prior to the one
363 363
   originally installed on this website: your database is at risk of being corrupted
364 364
   and your site might not work properly anymore.<br />{{Please, re-install
365 365
   SPIP files.}}',
366
-	'info_modification_enregistree' => 'Your changes have been saved',
367
-	'info_modifier_auteur' => 'Edit author details:',
368
-	'info_modifier_rubrique' => 'Edit the section:',
369
-	'info_modifier_titre' => 'Edit: @titre@',
370
-	'info_mon_site_spip' => 'My SPIP site',
371
-	'info_moyenne' => 'average:',
372
-	'info_multi_cet_article' => 'Language for this article:',
373
-	'info_multi_langues_choisies' => 'Please select the languages to be made available to the editors of your site.
366
+    'info_modification_enregistree' => 'Your changes have been saved',
367
+    'info_modifier_auteur' => 'Edit author details:',
368
+    'info_modifier_rubrique' => 'Edit the section:',
369
+    'info_modifier_titre' => 'Edit: @titre@',
370
+    'info_mon_site_spip' => 'My SPIP site',
371
+    'info_moyenne' => 'average:',
372
+    'info_multi_cet_article' => 'Language for this article:',
373
+    'info_multi_langues_choisies' => 'Please select the languages to be made available to the editors of your site.
374 374
   Languages already used on your site (at the top of the list) cannot be disabled.',
375
-	'info_multi_objets' => '@objets@: activate the language menu',
376
-	'info_multi_secteurs' => '... only for root-level sections?',
377
-	'info_nb_articles' => '@nb@ articles',
378
-	'info_nb_auteurs' => '@nb@ authors',
379
-	'info_nb_messages' => '@nb@ messages',
380
-	'info_nb_mots_cles' => '@nb@ keywords',
381
-	'info_nb_rubriques' => '@nb@ sections',
382
-	'info_nb_visiteurs' => '@nb@ visitors',
383
-	'info_nom' => 'Name',
384
-	'info_nom_destinataire' => 'Name of recipient',
385
-	'info_nom_pas_conforme' => 'html tags are not allowed',
386
-	'info_nom_site' => 'Name of your site',
387
-	'info_nombre_articles' => '@nb_articles@ articles,',
388
-	'info_nombre_rubriques' => '@nb_rubriques@ sections,',
389
-	'info_nombre_sites' => '@nb_sites@ sites,',
390
-	'info_non_deplacer' => 'Do not move...',
391
-	'info_non_envoi_annonce_dernieres_nouveautes' => 'SPIP can send a site newsletter (list of newly-published articles and news items).
375
+    'info_multi_objets' => '@objets@: activate the language menu',
376
+    'info_multi_secteurs' => '... only for root-level sections?',
377
+    'info_nb_articles' => '@nb@ articles',
378
+    'info_nb_auteurs' => '@nb@ authors',
379
+    'info_nb_messages' => '@nb@ messages',
380
+    'info_nb_mots_cles' => '@nb@ keywords',
381
+    'info_nb_rubriques' => '@nb@ sections',
382
+    'info_nb_visiteurs' => '@nb@ visitors',
383
+    'info_nom' => 'Name',
384
+    'info_nom_destinataire' => 'Name of recipient',
385
+    'info_nom_pas_conforme' => 'html tags are not allowed',
386
+    'info_nom_site' => 'Name of your site',
387
+    'info_nombre_articles' => '@nb_articles@ articles,',
388
+    'info_nombre_rubriques' => '@nb_rubriques@ sections,',
389
+    'info_nombre_sites' => '@nb_sites@ sites,',
390
+    'info_non_deplacer' => 'Do not move...',
391
+    'info_non_envoi_annonce_dernieres_nouveautes' => 'SPIP can send a site newsletter (list of newly-published articles and news items).
392 392
   .',
393
-	'info_non_envoi_liste_nouveautes' => 'Do not send newsletter',
394
-	'info_non_modifiable' => 'cannot be modified',
395
-	'info_non_suppression_mot_cle' => 'I do not want to delete this keyword.',
396
-	'info_notes' => 'Footnotes',
397
-	'info_nouvel_article' => 'New article',
398
-	'info_nouvelle_traduction' => 'New translation:',
399
-	'info_numero_article' => 'ARTICLE NUMBER:',
400
-	'info_obligatoire_02' => '(Required)',
401
-	'info_option_accepter_visiteurs' => 'Allow visitor registration via the public site',
402
-	'info_option_ne_pas_accepter_visiteurs' => 'Disable visitor registration',
403
-	'info_options_avancees' => 'ADVANCED OPTIONS',
404
-	'info_ou' => 'or...',
405
-	'info_page_interdite' => 'Forbidden page',
406
-	'info_par_nom' => 'by name',
407
-	'info_par_nombre_article' => 'by number of articles',
408
-	'info_par_statut' => 'by status',
409
-	'info_par_tri' => '’(by @tri@)’',
410
-	'info_passe_trop_court' => 'Password too short.',
411
-	'info_passe_trop_court_car_pluriel' => 'Your password must contain at least @nb@ characters.',
412
-	'info_passes_identiques' => 'The two passwords are not identical.',
413
-	'info_plus_cinq_car' => 'more than 5 characters',
414
-	'info_plus_cinq_car_2' => '(More than 5 characters)',
415
-	'info_plus_trois_car' => '(More than 3 characters)',
416
-	'info_popularite' => 'popularity: @popularite@; visits: @visites@',
417
-	'info_post_scriptum' => 'Postscript',
418
-	'info_post_scriptum_2' => 'Postscript:',
419
-	'info_pour' => 'for',
420
-	'info_preview_texte' => 'It is possible to preview the site’s  various editorial elements with at least the "submitted" status, as well as the"editing in progress" elements of which you are the author. Should this preview mode be restricted to administrators, open to all authors, or disabled completely?',
421
-	'info_procedez_par_etape' => 'please proceed step by step',
422
-	'info_procedure_maj_version' => 'the upgrade procedure must be run to adapt
393
+    'info_non_envoi_liste_nouveautes' => 'Do not send newsletter',
394
+    'info_non_modifiable' => 'cannot be modified',
395
+    'info_non_suppression_mot_cle' => 'I do not want to delete this keyword.',
396
+    'info_notes' => 'Footnotes',
397
+    'info_nouvel_article' => 'New article',
398
+    'info_nouvelle_traduction' => 'New translation:',
399
+    'info_numero_article' => 'ARTICLE NUMBER:',
400
+    'info_obligatoire_02' => '(Required)',
401
+    'info_option_accepter_visiteurs' => 'Allow visitor registration via the public site',
402
+    'info_option_ne_pas_accepter_visiteurs' => 'Disable visitor registration',
403
+    'info_options_avancees' => 'ADVANCED OPTIONS',
404
+    'info_ou' => 'or...',
405
+    'info_page_interdite' => 'Forbidden page',
406
+    'info_par_nom' => 'by name',
407
+    'info_par_nombre_article' => 'by number of articles',
408
+    'info_par_statut' => 'by status',
409
+    'info_par_tri' => '’(by @tri@)’',
410
+    'info_passe_trop_court' => 'Password too short.',
411
+    'info_passe_trop_court_car_pluriel' => 'Your password must contain at least @nb@ characters.',
412
+    'info_passes_identiques' => 'The two passwords are not identical.',
413
+    'info_plus_cinq_car' => 'more than 5 characters',
414
+    'info_plus_cinq_car_2' => '(More than 5 characters)',
415
+    'info_plus_trois_car' => '(More than 3 characters)',
416
+    'info_popularite' => 'popularity: @popularite@; visits: @visites@',
417
+    'info_post_scriptum' => 'Postscript',
418
+    'info_post_scriptum_2' => 'Postscript:',
419
+    'info_pour' => 'for',
420
+    'info_preview_texte' => 'It is possible to preview the site’s  various editorial elements with at least the "submitted" status, as well as the"editing in progress" elements of which you are the author. Should this preview mode be restricted to administrators, open to all authors, or disabled completely?',
421
+    'info_procedez_par_etape' => 'please proceed step by step',
422
+    'info_procedure_maj_version' => 'the upgrade procedure must be run to adapt
423 423
  the database to this new version of SPIP.',
424
-	'info_proxy_ok' => 'Proxy test successful.',
425
-	'info_ps' => 'P.S.',
426
-	'info_publier' => 'publish',
427
-	'info_publies' => 'Your articles published online',
428
-	'info_question_accepter_visiteurs' => 'If your website’s templates allows visitors to register with no access to the admin area, please activate the following option:',
429
-	'info_question_inscription_nouveaux_redacteurs' => 'Do you wish to allow new editors to register
424
+    'info_proxy_ok' => 'Proxy test successful.',
425
+    'info_ps' => 'P.S.',
426
+    'info_publier' => 'publish',
427
+    'info_publies' => 'Your articles published online',
428
+    'info_question_accepter_visiteurs' => 'If your website’s templates allows visitors to register with no access to the admin area, please activate the following option:',
429
+    'info_question_inscription_nouveaux_redacteurs' => 'Do you wish to allow new editors to register
430 430
  from the public website? If you agree with this, visitors will be able to  register
431 431
   using an automatic form, and then access the admin area to
432 432
   write their own articles. <div class="notice">During the registration process, users usually receive an automatic email
@@ -434,403 +434,403 @@  discard block
 block discarded – undo
434 434
   service providers disallow sending emails from their
435 435
   servers: in that case, automated registration is not
436 436
   possible.</div>',
437
-	'info_qui_edite' => '@nom_auteur_modif@ worked on the contents @date_diff@ minutes ago',
438
-	'info_racine_site' => 'Site root',
439
-	'info_recharger_page' => 'Please wait a few moments, then reload this page.',
440
-	'info_recherche_auteur_zero' => 'No results for "@cherche_auteur@".',
441
-	'info_recommencer' => 'Please try again.',
442
-	'info_redacteur_1' => 'Editor',
443
-	'info_redacteur_2' => 'with access to the admin area (<i>recommended</i>)',
444
-	'info_redacteurs' => 'Editors',
445
-	'info_redaction_en_cours' => 'EDITING IN PROGRESS',
446
-	'info_redirection' => 'Redirection',
447
-	'info_redirection_activee' => 'Redirection is enabled.',
448
-	'info_redirection_boucle' => 'You are trying to redirect the article toward itself. ',
449
-	'info_redirection_desactivee' => 'Redirection is deleted.',
450
-	'info_refuses' => 'Your rejected articles ',
451
-	'info_reglage_ldap' => 'Options: <b>Adjusting LDAP import</b>',
452
-	'info_renvoi_article' => '<b>Redirection.</b> This article redirects to:',
453
-	'info_reserve_admin' => 'Only administrators can modify this address.',
454
-	'info_restreindre_rubrique' => 'Restrict management to section:',
455
-	'info_resultat_recherche' => 'Search results:',
456
-	'info_rubriques' => 'Sections',
457
-	'info_rubriques_02' => 'sections',
458
-	'info_rubriques_trouvees' => 'Sections found',
459
-	'info_sans_titre' => 'Untitled',
460
-	'info_selection_chemin_acces' => '<b>Select</b> the access path in the directory:',
461
-	'info_signatures' => 'signatures',
462
-	'info_site' => 'Site',
463
-	'info_site_2' => 'site:',
464
-	'info_site_min' => 'site',
465
-	'info_site_reference_2' => 'Referenced site',
466
-	'info_site_web' => 'Web site:',
467
-	'info_sites' => 'sites',
468
-	'info_sites_lies_mot' => 'Referenced sites with this keyword',
469
-	'info_sites_proxy' => 'Using a proxy',
470
-	'info_sites_trouves' => 'Sites found',
471
-	'info_sous_titre' => 'Subtitle:',
472
-	'info_statut_administrateur' => 'Administrator',
473
-	'info_statut_auteur' => 'This author’s status:',
474
-	'info_statut_auteur_2' => 'I am',
475
-	'info_statut_auteur_a_confirmer' => 'Registration to be confirmed',
476
-	'info_statut_auteur_autre' => 'Other status:',
477
-	'info_statut_redacteur' => 'Editor',
478
-	'info_statut_utilisateurs_1' => 'Default status for imported users',
479
-	'info_statut_utilisateurs_2' => 'Choose the status to be attributed to persons present in the LDAP directory when they connect for the first time. You can modify this value for each individual author later on.',
480
-	'info_suivi_activite' => 'Follow editorial activity',
481
-	'info_surtitre' => 'Top title:',
482
-	'info_syndication_integrale_1' => 'Your site provides syndication files (see "<a href="@url@">@titre@</a>").',
483
-	'info_syndication_integrale_2' => 'Do you wish to send whole articles or only a summary of a few hundred characters?',
484
-	'info_table_prefix' => 'It is possible to change the prefix of the names of the database tables. (you need to do this if you are installing several sites in the same database). The prefix must be written in unaccented, lower-case letters without any spaces.',
485
-	'info_taille_maximale_images' => 'SPIP will test for the maximum image size (in millions of pixels) which it can process.<br /> Images bigger than this will not be reduced.',
486
-	'info_taille_maximale_vignette' => 'Maximum size for vignettes generated by the system:',
487
-	'info_terminer_installation' => 'You can now finish the standard installation process.',
488
-	'info_texte' => 'Text',
489
-	'info_texte_explicatif' => 'Explanation',
490
-	'info_texte_long' => '(The text is long: it will appear in several parts which will be reassembled after validation.)',
491
-	'info_texte_message' => 'Text of your message:',
492
-	'info_texte_message_02' => 'Message text',
493
-	'info_titre' => 'Title:',
494
-	'info_total' => 'total:',
495
-	'info_tous_articles_en_redaction' => 'All articles in progress',
496
-	'info_tous_articles_presents' => 'All articles published in this section',
497
-	'info_tous_articles_refuses' => 'All refused articles',
498
-	'info_tous_les' => 'every:',
499
-	'info_tout_site' => 'The entire site',
500
-	'info_tout_site2' => 'The article has not been translated into this language.',
501
-	'info_tout_site3' => 'The article has been translated into this language, but changes have since been made to the reference article. The translation needs updating.',
502
-	'info_tout_site4' => 'The article has been translated into this language, and the translation is up-to-date.',
503
-	'info_tout_site5' => 'Original article.',
504
-	'info_tout_site6' => '<b>Warning:</b> only original articles are displayed.
437
+    'info_qui_edite' => '@nom_auteur_modif@ worked on the contents @date_diff@ minutes ago',
438
+    'info_racine_site' => 'Site root',
439
+    'info_recharger_page' => 'Please wait a few moments, then reload this page.',
440
+    'info_recherche_auteur_zero' => 'No results for "@cherche_auteur@".',
441
+    'info_recommencer' => 'Please try again.',
442
+    'info_redacteur_1' => 'Editor',
443
+    'info_redacteur_2' => 'with access to the admin area (<i>recommended</i>)',
444
+    'info_redacteurs' => 'Editors',
445
+    'info_redaction_en_cours' => 'EDITING IN PROGRESS',
446
+    'info_redirection' => 'Redirection',
447
+    'info_redirection_activee' => 'Redirection is enabled.',
448
+    'info_redirection_boucle' => 'You are trying to redirect the article toward itself. ',
449
+    'info_redirection_desactivee' => 'Redirection is deleted.',
450
+    'info_refuses' => 'Your rejected articles ',
451
+    'info_reglage_ldap' => 'Options: <b>Adjusting LDAP import</b>',
452
+    'info_renvoi_article' => '<b>Redirection.</b> This article redirects to:',
453
+    'info_reserve_admin' => 'Only administrators can modify this address.',
454
+    'info_restreindre_rubrique' => 'Restrict management to section:',
455
+    'info_resultat_recherche' => 'Search results:',
456
+    'info_rubriques' => 'Sections',
457
+    'info_rubriques_02' => 'sections',
458
+    'info_rubriques_trouvees' => 'Sections found',
459
+    'info_sans_titre' => 'Untitled',
460
+    'info_selection_chemin_acces' => '<b>Select</b> the access path in the directory:',
461
+    'info_signatures' => 'signatures',
462
+    'info_site' => 'Site',
463
+    'info_site_2' => 'site:',
464
+    'info_site_min' => 'site',
465
+    'info_site_reference_2' => 'Referenced site',
466
+    'info_site_web' => 'Web site:',
467
+    'info_sites' => 'sites',
468
+    'info_sites_lies_mot' => 'Referenced sites with this keyword',
469
+    'info_sites_proxy' => 'Using a proxy',
470
+    'info_sites_trouves' => 'Sites found',
471
+    'info_sous_titre' => 'Subtitle:',
472
+    'info_statut_administrateur' => 'Administrator',
473
+    'info_statut_auteur' => 'This author’s status:',
474
+    'info_statut_auteur_2' => 'I am',
475
+    'info_statut_auteur_a_confirmer' => 'Registration to be confirmed',
476
+    'info_statut_auteur_autre' => 'Other status:',
477
+    'info_statut_redacteur' => 'Editor',
478
+    'info_statut_utilisateurs_1' => 'Default status for imported users',
479
+    'info_statut_utilisateurs_2' => 'Choose the status to be attributed to persons present in the LDAP directory when they connect for the first time. You can modify this value for each individual author later on.',
480
+    'info_suivi_activite' => 'Follow editorial activity',
481
+    'info_surtitre' => 'Top title:',
482
+    'info_syndication_integrale_1' => 'Your site provides syndication files (see "<a href="@url@">@titre@</a>").',
483
+    'info_syndication_integrale_2' => 'Do you wish to send whole articles or only a summary of a few hundred characters?',
484
+    'info_table_prefix' => 'It is possible to change the prefix of the names of the database tables. (you need to do this if you are installing several sites in the same database). The prefix must be written in unaccented, lower-case letters without any spaces.',
485
+    'info_taille_maximale_images' => 'SPIP will test for the maximum image size (in millions of pixels) which it can process.<br /> Images bigger than this will not be reduced.',
486
+    'info_taille_maximale_vignette' => 'Maximum size for vignettes generated by the system:',
487
+    'info_terminer_installation' => 'You can now finish the standard installation process.',
488
+    'info_texte' => 'Text',
489
+    'info_texte_explicatif' => 'Explanation',
490
+    'info_texte_long' => '(The text is long: it will appear in several parts which will be reassembled after validation.)',
491
+    'info_texte_message' => 'Text of your message:',
492
+    'info_texte_message_02' => 'Message text',
493
+    'info_titre' => 'Title:',
494
+    'info_total' => 'total:',
495
+    'info_tous_articles_en_redaction' => 'All articles in progress',
496
+    'info_tous_articles_presents' => 'All articles published in this section',
497
+    'info_tous_articles_refuses' => 'All refused articles',
498
+    'info_tous_les' => 'every:',
499
+    'info_tout_site' => 'The entire site',
500
+    'info_tout_site2' => 'The article has not been translated into this language.',
501
+    'info_tout_site3' => 'The article has been translated into this language, but changes have since been made to the reference article. The translation needs updating.',
502
+    'info_tout_site4' => 'The article has been translated into this language, and the translation is up-to-date.',
503
+    'info_tout_site5' => 'Original article.',
504
+    'info_tout_site6' => '<b>Warning:</b> only original articles are displayed.
505 505
 Translations are linked to the original,
506 506
 and their status is colour-coded:',
507
-	'info_traductions' => 'Translations',
508
-	'info_travail_colaboratif' => 'Collaborative work on articles',
509
-	'info_un_article' => 'an article,',
510
-	'info_un_site' => 'a site,',
511
-	'info_une_rubrique' => 'a section,',
512
-	'info_une_rubrique_02' => '1 section',
513
-	'info_url' => 'URL:',
514
-	'info_url_proxy' => 'Proxy URL',
515
-	'info_url_proxy_pas_conforme' => 'Proxy’s URL not valid.',
516
-	'info_url_site_pas_conforme' => 'the website URL is invalid.',
517
-	'info_url_test_proxy' => 'Test URL',
518
-	'info_urlref' => 'Hyperlink:',
519
-	'info_utilisation_spip' => 'SPIP is now ready for use',
520
-	'info_visites_par_mois' => 'Monthly display:',
521
-	'info_visiteur_1' => 'Visitor',
522
-	'info_visiteur_2' => 'to the public site',
523
-	'info_visiteurs' => 'Visitors',
524
-	'info_visiteurs_02' => 'Public site visitors',
525
-	'info_webmestre_forces' => 'The web administrators are currently defined in <tt>@file_options@</tt>.',
526
-	'install_adresse_base_hebergeur' => 'Database address attributed by the hosting provider',
527
-	'install_connect_ok' => 'The new database has been declared using the server name @connect@.',
528
-	'install_echec_annonce' => 'This installation will probably fail, or damage your site.',
529
-	'install_extension_mbstring' => 'SPIP does not work with:',
530
-	'install_extension_php_obligatoire' => 'SPIP requires the php extension:',
531
-	'install_login_base_hebergeur' => 'Login attributed by the service provider',
532
-	'install_nom_base_hebergeur' => 'Database name attributed by the service provider:',
533
-	'install_pas_table' => 'The database has no tables',
534
-	'install_pass_base_hebergeur' => 'Password attributed by your hosting service ',
535
-	'install_php_version' => 'This version of PHP @version@ is too old (minimum = @minimum@)',
536
-	'install_select_langue' => 'Select a language, then click on "next" to start installation.',
537
-	'install_select_type_db' => 'Indicate the type of database:',
538
-	'install_select_type_mysql' => 'MySQL',
539
-	'install_select_type_pg' => 'PostgreSQL',
540
-	'install_select_type_sqlite2' => 'SQLite 2',
541
-	'install_select_type_sqlite3' => 'SQLite 3',
542
-	'install_serveur_hebergeur' => 'Database server attributed by the hosting provider',
543
-	'install_table_prefix_hebergeur' => 'Table prefix attributed by your hosting provider:',
544
-	'install_tables_base' => 'Tables in the database',
545
-	'install_types_db_connus' => 'SPIP can use <b>MySQL</b> (the most common) and <b>SQLite</b>.',
546
-	'install_types_db_connus_avertissement' => 'The support of <b>PostgreSQL</b is actually proposed as experimental',
547
-	'instituer_erreur_statut_a_change' => 'The status has already been modified',
548
-	'instituer_erreur_statut_non_autorise' => 'You cannot select this status',
549
-	'intem_redacteur' => 'editor',
550
-	'intitule_licence' => 'Licence',
551
-	'item_accepter_inscriptions' => 'Allow registration',
552
-	'item_activer_messages_avertissement' => 'Activate warning messages',
553
-	'item_administrateur_2' => 'administrator',
554
-	'item_afficher_calendrier' => 'Display in calendar',
555
-	'item_autoriser_syndication_integrale' => 'Include entire articles in syndication feeds',
556
-	'item_choix_administrateurs' => 'administrators',
557
-	'item_choix_generation_miniature' => 'Generate thumbnails automatically.',
558
-	'item_choix_non_generation_miniature' => 'Do not generate thumbnails.',
559
-	'item_choix_redacteurs' => 'editors',
560
-	'item_choix_visiteurs' => 'visitors to the public site',
561
-	'item_creer_fichiers_authent' => 'Create .htpasswd files',
562
-	'item_login' => 'Login',
563
-	'item_messagerie_agenda' => 'Activate messaging system and calendars',
564
-	'item_mots_cles_association_articles' => 'articles',
565
-	'item_mots_cles_association_rubriques' => 'sections',
566
-	'item_mots_cles_association_sites' => 'referenced or syndicated sites.',
567
-	'item_non' => 'No',
568
-	'item_non_accepter_inscriptions' => 'Disable registration',
569
-	'item_non_activer_messages_avertissement' => 'No warning messages',
570
-	'item_non_afficher_calendrier' => 'Do not show in calendar',
571
-	'item_non_autoriser_syndication_integrale' => 'Only send a summary',
572
-	'item_non_creer_fichiers_authent' => 'Do not create these files',
573
-	'item_non_messagerie_agenda' => 'Disable the messaging system and calendars',
574
-	'item_non_publier_articles' => 'Do not publish articles before their specified publication date.',
575
-	'item_nouvel_auteur' => 'New author',
576
-	'item_nouvelle_rubrique' => 'New section',
577
-	'item_oui' => 'Yes',
578
-	'item_publier_articles' => 'Publish articles, irrespective of publication date.',
579
-	'item_reponse_article' => 'Reply to the article',
580
-	'item_visiteur' => 'visitor',
507
+    'info_traductions' => 'Translations',
508
+    'info_travail_colaboratif' => 'Collaborative work on articles',
509
+    'info_un_article' => 'an article,',
510
+    'info_un_site' => 'a site,',
511
+    'info_une_rubrique' => 'a section,',
512
+    'info_une_rubrique_02' => '1 section',
513
+    'info_url' => 'URL:',
514
+    'info_url_proxy' => 'Proxy URL',
515
+    'info_url_proxy_pas_conforme' => 'Proxy’s URL not valid.',
516
+    'info_url_site_pas_conforme' => 'the website URL is invalid.',
517
+    'info_url_test_proxy' => 'Test URL',
518
+    'info_urlref' => 'Hyperlink:',
519
+    'info_utilisation_spip' => 'SPIP is now ready for use',
520
+    'info_visites_par_mois' => 'Monthly display:',
521
+    'info_visiteur_1' => 'Visitor',
522
+    'info_visiteur_2' => 'to the public site',
523
+    'info_visiteurs' => 'Visitors',
524
+    'info_visiteurs_02' => 'Public site visitors',
525
+    'info_webmestre_forces' => 'The web administrators are currently defined in <tt>@file_options@</tt>.',
526
+    'install_adresse_base_hebergeur' => 'Database address attributed by the hosting provider',
527
+    'install_connect_ok' => 'The new database has been declared using the server name @connect@.',
528
+    'install_echec_annonce' => 'This installation will probably fail, or damage your site.',
529
+    'install_extension_mbstring' => 'SPIP does not work with:',
530
+    'install_extension_php_obligatoire' => 'SPIP requires the php extension:',
531
+    'install_login_base_hebergeur' => 'Login attributed by the service provider',
532
+    'install_nom_base_hebergeur' => 'Database name attributed by the service provider:',
533
+    'install_pas_table' => 'The database has no tables',
534
+    'install_pass_base_hebergeur' => 'Password attributed by your hosting service ',
535
+    'install_php_version' => 'This version of PHP @version@ is too old (minimum = @minimum@)',
536
+    'install_select_langue' => 'Select a language, then click on "next" to start installation.',
537
+    'install_select_type_db' => 'Indicate the type of database:',
538
+    'install_select_type_mysql' => 'MySQL',
539
+    'install_select_type_pg' => 'PostgreSQL',
540
+    'install_select_type_sqlite2' => 'SQLite 2',
541
+    'install_select_type_sqlite3' => 'SQLite 3',
542
+    'install_serveur_hebergeur' => 'Database server attributed by the hosting provider',
543
+    'install_table_prefix_hebergeur' => 'Table prefix attributed by your hosting provider:',
544
+    'install_tables_base' => 'Tables in the database',
545
+    'install_types_db_connus' => 'SPIP can use <b>MySQL</b> (the most common) and <b>SQLite</b>.',
546
+    'install_types_db_connus_avertissement' => 'The support of <b>PostgreSQL</b is actually proposed as experimental',
547
+    'instituer_erreur_statut_a_change' => 'The status has already been modified',
548
+    'instituer_erreur_statut_non_autorise' => 'You cannot select this status',
549
+    'intem_redacteur' => 'editor',
550
+    'intitule_licence' => 'Licence',
551
+    'item_accepter_inscriptions' => 'Allow registration',
552
+    'item_activer_messages_avertissement' => 'Activate warning messages',
553
+    'item_administrateur_2' => 'administrator',
554
+    'item_afficher_calendrier' => 'Display in calendar',
555
+    'item_autoriser_syndication_integrale' => 'Include entire articles in syndication feeds',
556
+    'item_choix_administrateurs' => 'administrators',
557
+    'item_choix_generation_miniature' => 'Generate thumbnails automatically.',
558
+    'item_choix_non_generation_miniature' => 'Do not generate thumbnails.',
559
+    'item_choix_redacteurs' => 'editors',
560
+    'item_choix_visiteurs' => 'visitors to the public site',
561
+    'item_creer_fichiers_authent' => 'Create .htpasswd files',
562
+    'item_login' => 'Login',
563
+    'item_messagerie_agenda' => 'Activate messaging system and calendars',
564
+    'item_mots_cles_association_articles' => 'articles',
565
+    'item_mots_cles_association_rubriques' => 'sections',
566
+    'item_mots_cles_association_sites' => 'referenced or syndicated sites.',
567
+    'item_non' => 'No',
568
+    'item_non_accepter_inscriptions' => 'Disable registration',
569
+    'item_non_activer_messages_avertissement' => 'No warning messages',
570
+    'item_non_afficher_calendrier' => 'Do not show in calendar',
571
+    'item_non_autoriser_syndication_integrale' => 'Only send a summary',
572
+    'item_non_creer_fichiers_authent' => 'Do not create these files',
573
+    'item_non_messagerie_agenda' => 'Disable the messaging system and calendars',
574
+    'item_non_publier_articles' => 'Do not publish articles before their specified publication date.',
575
+    'item_nouvel_auteur' => 'New author',
576
+    'item_nouvelle_rubrique' => 'New section',
577
+    'item_oui' => 'Yes',
578
+    'item_publier_articles' => 'Publish articles, irrespective of publication date.',
579
+    'item_reponse_article' => 'Reply to the article',
580
+    'item_visiteur' => 'visitor',
581 581
 
582
-	// J
583
-	'jour_non_connu_nc' => 'unknown',
582
+    // J
583
+    'jour_non_connu_nc' => 'unknown',
584 584
 
585
-	// L
586
-	'label_bando_outils' => 'Toolbar',
587
-	'label_bando_outils_afficher' => 'Show the tools',
588
-	'label_bando_outils_masquer' => 'Hide the tools',
589
-	'label_choix_langue' => 'Choose your language',
590
-	'label_nom_fichier_connect' => 'Indicate the name for this server',
591
-	'label_slogan_site' => 'Website slogan',
592
-	'label_taille_ecran' => 'Screen width',
593
-	'label_texte_et_icones_navigation' => 'Navigation menu',
594
-	'label_texte_et_icones_page' => 'Page display',
595
-	'ldap_correspondance' => 'inherit field @champ@',
596
-	'ldap_correspondance_1' => 'Inherit LDAP fields',
597
-	'ldap_correspondance_2' => 'For each of these SPIP fields, enter the name of the corresponding LDAP field. Leave blank if you don’t want it filled, separate with spaces or commas to try several LDAP fields.',
598
-	'lien_ajouter_auteur' => 'Add this author',
599
-	'lien_ajouter_une_rubrique' => 'Add this section',
600
-	'lien_email' => 'email',
601
-	'lien_nom_site' => 'SITE NAME:',
602
-	'lien_rapide_contenu' => 'Go to the content',
603
-	'lien_rapide_navigation' => 'Go to the navigation',
604
-	'lien_rapide_recherche' => 'Go to the search',
605
-	'lien_retirer_auteur' => 'Remove author',
606
-	'lien_retirer_rubrique' => 'Remove the section',
607
-	'lien_retirer_tous_auteurs' => 'Remove all authors',
608
-	'lien_retirer_toutes_rubriques' => 'Remove all sections',
609
-	'lien_site' => 'site',
610
-	'lien_tout_decocher' => 'Uncheck all',
611
-	'lien_tout_deplier' => 'Expand all',
612
-	'lien_tout_replier' => 'Collapse all',
613
-	'lien_tout_supprimer' => 'Delete all',
614
-	'lien_trier_nom' => 'Sort by name',
615
-	'lien_trier_nombre_articles' => 'Sort by total articles',
616
-	'lien_trier_statut' => 'Sort by status',
617
-	'lien_voir_en_ligne' => 'VIEW ONLINE:',
618
-	'logo_article' => 'Article’s logo',
619
-	'logo_auteur' => 'Author’s logo',
620
-	'logo_rubrique' => 'Section’s logo',
621
-	'logo_site' => 'Website’s logo',
622
-	'logo_standard_rubrique' => 'Default sections’ logo',
623
-	'logo_survol' => 'Mouseover logo',
585
+    // L
586
+    'label_bando_outils' => 'Toolbar',
587
+    'label_bando_outils_afficher' => 'Show the tools',
588
+    'label_bando_outils_masquer' => 'Hide the tools',
589
+    'label_choix_langue' => 'Choose your language',
590
+    'label_nom_fichier_connect' => 'Indicate the name for this server',
591
+    'label_slogan_site' => 'Website slogan',
592
+    'label_taille_ecran' => 'Screen width',
593
+    'label_texte_et_icones_navigation' => 'Navigation menu',
594
+    'label_texte_et_icones_page' => 'Page display',
595
+    'ldap_correspondance' => 'inherit field @champ@',
596
+    'ldap_correspondance_1' => 'Inherit LDAP fields',
597
+    'ldap_correspondance_2' => 'For each of these SPIP fields, enter the name of the corresponding LDAP field. Leave blank if you don’t want it filled, separate with spaces or commas to try several LDAP fields.',
598
+    'lien_ajouter_auteur' => 'Add this author',
599
+    'lien_ajouter_une_rubrique' => 'Add this section',
600
+    'lien_email' => 'email',
601
+    'lien_nom_site' => 'SITE NAME:',
602
+    'lien_rapide_contenu' => 'Go to the content',
603
+    'lien_rapide_navigation' => 'Go to the navigation',
604
+    'lien_rapide_recherche' => 'Go to the search',
605
+    'lien_retirer_auteur' => 'Remove author',
606
+    'lien_retirer_rubrique' => 'Remove the section',
607
+    'lien_retirer_tous_auteurs' => 'Remove all authors',
608
+    'lien_retirer_toutes_rubriques' => 'Remove all sections',
609
+    'lien_site' => 'site',
610
+    'lien_tout_decocher' => 'Uncheck all',
611
+    'lien_tout_deplier' => 'Expand all',
612
+    'lien_tout_replier' => 'Collapse all',
613
+    'lien_tout_supprimer' => 'Delete all',
614
+    'lien_trier_nom' => 'Sort by name',
615
+    'lien_trier_nombre_articles' => 'Sort by total articles',
616
+    'lien_trier_statut' => 'Sort by status',
617
+    'lien_voir_en_ligne' => 'VIEW ONLINE:',
618
+    'logo_article' => 'Article’s logo',
619
+    'logo_auteur' => 'Author’s logo',
620
+    'logo_rubrique' => 'Section’s logo',
621
+    'logo_site' => 'Website’s logo',
622
+    'logo_standard_rubrique' => 'Default sections’ logo',
623
+    'logo_survol' => 'Mouseover logo',
624 624
 
625
-	// M
626
-	'menu_aide_installation_choix_base' => 'Choosing your database',
627
-	'module_fichier_langue' => 'Language file',
628
-	'module_raccourci' => 'Shortcut',
629
-	'module_texte_affiche' => 'Displayed text',
630
-	'module_texte_explicatif' => 'You can insert thse shortcuts in your website templates. They will be automatically translated into any languages for which a language file exists.',
631
-	'module_texte_traduction' => 'The language file « @module@ » is available in:',
632
-	'mois_non_connu' => 'unknown',
625
+    // M
626
+    'menu_aide_installation_choix_base' => 'Choosing your database',
627
+    'module_fichier_langue' => 'Language file',
628
+    'module_raccourci' => 'Shortcut',
629
+    'module_texte_affiche' => 'Displayed text',
630
+    'module_texte_explicatif' => 'You can insert thse shortcuts in your website templates. They will be automatically translated into any languages for which a language file exists.',
631
+    'module_texte_traduction' => 'The language file « @module@ » is available in:',
632
+    'mois_non_connu' => 'unknown',
633 633
 
634
-	// N
635
-	'nouvelle_version_spip' => 'SPIP upgrade @version@ is available',
636
-	'nouvelle_version_spip_majeure' => 'A new SPIP version @version@ is available',
634
+    // N
635
+    'nouvelle_version_spip' => 'SPIP upgrade @version@ is available',
636
+    'nouvelle_version_spip_majeure' => 'A new SPIP version @version@ is available',
637 637
 
638
-	// O
639
-	'onglet_contenu' => 'Contents',
640
-	'onglet_declarer_une_autre_base' => 'Declare another database',
641
-	'onglet_discuter' => 'Discuss',
642
-	'onglet_interactivite' => 'Interactivity',
643
-	'onglet_proprietes' => 'Properties',
644
-	'onglet_repartition_actuelle' => 'now',
645
-	'onglet_sous_rubriques' => 'Subsections',
638
+    // O
639
+    'onglet_contenu' => 'Contents',
640
+    'onglet_declarer_une_autre_base' => 'Declare another database',
641
+    'onglet_discuter' => 'Discuss',
642
+    'onglet_interactivite' => 'Interactivity',
643
+    'onglet_proprietes' => 'Properties',
644
+    'onglet_repartition_actuelle' => 'now',
645
+    'onglet_sous_rubriques' => 'Subsections',
646 646
 
647
-	// P
648
-	'page_pas_proxy' => 'This page must not go through the proxy',
649
-	'pas_de_proxy_pour' => 'If necessary, indicate to which machines or domains this proxy should not apply (for example: @exemple@)',
650
-	'phpinfo' => 'PHP configuration',
651
-	'plugin_charge_paquet' => 'Loading the archive file @name@',
652
-	'plugin_charger' => 'Download',
653
-	'plugin_erreur_charger' => 'error: @zip@ cannot be loaded',
654
-	'plugin_erreur_droit1' => 'Cannot write to directory <code>@dest@</code>.',
655
-	'plugin_erreur_droit2' => 'Please check write permissions for this directory (and create the directory if necessary). Alternatively, install the files by FTP.',
656
-	'plugin_erreur_zip' => 'pclzip failure: error @status@',
657
-	'plugin_etat_developpement' => 'under development',
658
-	'plugin_etat_experimental' => 'experimental',
659
-	'plugin_etat_stable' => 'stable',
660
-	'plugin_etat_test' => 'being tested',
661
-	'plugin_impossible_activer' => 'Impossible to activate the plugin @plugin@',
662
-	'plugin_info_automatique1' => 'If you wish to allow automatic plugin installation, please:',
663
-	'plugin_info_automatique1_lib' => 'If you want to let this library to be installed automatically, please:',
664
-	'plugin_info_automatique2' => 'Create a directory <code>@rep@</code> ;',
665
-	'plugin_info_automatique3' => 'Check that the server has the proper permissions to write to this directory.',
666
-	'plugin_info_automatique_creer' => 'to create at the root of the website.',
667
-	'plugin_info_automatique_exemples' => 'examples:',
668
-	'plugin_info_automatique_ftp' => 'You may install plugins by FTP in the  <tt>@rep@</tt> directory',
669
-	'plugin_info_automatique_lib' => 'Some plugins need to be able to load files into the <code>lib/</code> directory. This directory should be created at the website root.',
670
-	'plugin_info_automatique_liste' => 'Your plugin lists:',
671
-	'plugin_info_automatique_liste_officielle' => 'official plugins',
672
-	'plugin_info_automatique_liste_update' => 'Update lists',
673
-	'plugin_info_automatique_ou' => 'or...',
674
-	'plugin_info_automatique_select' => 'Select a plugin below: SPIP will load it and will install it in the <code>@rep@</code> directory. If the plugin already exists, it will be updated.',
675
-	'plugin_info_credit' => 'Credits',
676
-	'plugin_info_erreur_xml' => 'Incorrect declaration of the plugin',
677
-	'plugin_info_install_ok' => 'Installation successful',
678
-	'plugin_info_necessite' => 'Requires:',
679
-	'plugin_info_non_compatible_spip' => 'This plugin is incompatible with this version of SPIP',
680
-	'plugin_info_plugins_dist_1' => 'The following plugins are loaded and activated in the @plugins_dist@ directory.',
681
-	'plugin_info_plugins_dist_2' => 'They cannot be disabled.',
682
-	'plugin_info_telecharger' => 'load from @url@ and install to @rep@',
683
-	'plugin_info_upgrade_ok' => 'Successful update',
684
-	'plugin_librairies_installees' => 'Libraries installed',
685
-	'plugin_necessite_extension_php' => 'Requires the PHP extension @plugin@ version @version@.',
686
-	'plugin_necessite_extension_php_sans_version' => 'Requires the PHP extension @plugin@',
687
-	'plugin_necessite_lib' => 'This plugin requires the library @lib@',
688
-	'plugin_necessite_php' => 'Requires @plugin@ version @version@.',
689
-	'plugin_necessite_plugin' => 'Version @version@ of the plugin @plugin@ is required.',
690
-	'plugin_necessite_plugin_sans_version' => 'Requires the plugin @plugin@',
691
-	'plugin_necessite_spip' => 'SPIP version @version@ or newer is required.',
692
-	'plugin_source' => 'source: ',
693
-	'plugin_titre_automatique' => 'Automatic installation',
694
-	'plugin_titre_automatique_ajouter' => 'Add plugins',
695
-	'plugin_titre_installation' => '@plugin@ plugin installation',
696
-	'plugin_titre_modifier' => 'My plugins',
697
-	'plugin_utilise_extension_php' => 'The version of the PHP extension @plugin@ must be @version@.',
698
-	'plugin_utilise_php' => '@plugin@ version must be @version@.',
699
-	'plugin_utilise_plugin' => 'The version of the plugin @plugin@ must be @version@.',
700
-	'plugin_zip_active' => 'Continue in order to activate',
701
-	'plugin_zip_adresse' => 'To load a zipped plugin file, or a list of plugins, enter the path below.',
702
-	'plugin_zip_adresse_champ' => 'Path of the plugin or list ',
703
-	'plugin_zip_content' => 'It contains the following files(@taille@),<br />ready to be installed in the <code>@rep@</code> directory',
704
-	'plugin_zip_installe_finie' => 'The file @zip@ has been unpacked and installed.',
705
-	'plugin_zip_installe_rep_finie' => 'The file @zip@ has been unpacked and installed in the @rep@ directory',
706
-	'plugin_zip_installer' => 'You may now install it.',
707
-	'plugin_zip_telecharge' => 'The file @zip@ has been loaded',
708
-	'plugins_actif_aucun' => 'No plugins active.',
709
-	'plugins_actif_un' => 'One plugin active',
710
-	'plugins_actifs' => '@count@ active plugins.',
711
-	'plugins_actifs_liste' => 'Enabled',
712
-	'plugins_compte' => '@count@ plugins',
713
-	'plugins_disponible_un' => 'One plugin available',
714
-	'plugins_disponibles' => '@count@ plugins available.',
715
-	'plugins_erreur' => 'Error in the plugins: @plugins@',
716
-	'plugins_liste' => 'List of plugins',
717
-	'plugins_liste_dist' => 'Locked plugins',
718
-	'plugins_recents' => 'Recent plugins',
719
-	'plugins_tous_liste' => 'All',
720
-	'plugins_vue_hierarchie' => 'Hierarchy',
721
-	'plugins_vue_liste' => 'List',
722
-	'protocole_ldap' => 'Protocol version:',
647
+    // P
648
+    'page_pas_proxy' => 'This page must not go through the proxy',
649
+    'pas_de_proxy_pour' => 'If necessary, indicate to which machines or domains this proxy should not apply (for example: @exemple@)',
650
+    'phpinfo' => 'PHP configuration',
651
+    'plugin_charge_paquet' => 'Loading the archive file @name@',
652
+    'plugin_charger' => 'Download',
653
+    'plugin_erreur_charger' => 'error: @zip@ cannot be loaded',
654
+    'plugin_erreur_droit1' => 'Cannot write to directory <code>@dest@</code>.',
655
+    'plugin_erreur_droit2' => 'Please check write permissions for this directory (and create the directory if necessary). Alternatively, install the files by FTP.',
656
+    'plugin_erreur_zip' => 'pclzip failure: error @status@',
657
+    'plugin_etat_developpement' => 'under development',
658
+    'plugin_etat_experimental' => 'experimental',
659
+    'plugin_etat_stable' => 'stable',
660
+    'plugin_etat_test' => 'being tested',
661
+    'plugin_impossible_activer' => 'Impossible to activate the plugin @plugin@',
662
+    'plugin_info_automatique1' => 'If you wish to allow automatic plugin installation, please:',
663
+    'plugin_info_automatique1_lib' => 'If you want to let this library to be installed automatically, please:',
664
+    'plugin_info_automatique2' => 'Create a directory <code>@rep@</code> ;',
665
+    'plugin_info_automatique3' => 'Check that the server has the proper permissions to write to this directory.',
666
+    'plugin_info_automatique_creer' => 'to create at the root of the website.',
667
+    'plugin_info_automatique_exemples' => 'examples:',
668
+    'plugin_info_automatique_ftp' => 'You may install plugins by FTP in the  <tt>@rep@</tt> directory',
669
+    'plugin_info_automatique_lib' => 'Some plugins need to be able to load files into the <code>lib/</code> directory. This directory should be created at the website root.',
670
+    'plugin_info_automatique_liste' => 'Your plugin lists:',
671
+    'plugin_info_automatique_liste_officielle' => 'official plugins',
672
+    'plugin_info_automatique_liste_update' => 'Update lists',
673
+    'plugin_info_automatique_ou' => 'or...',
674
+    'plugin_info_automatique_select' => 'Select a plugin below: SPIP will load it and will install it in the <code>@rep@</code> directory. If the plugin already exists, it will be updated.',
675
+    'plugin_info_credit' => 'Credits',
676
+    'plugin_info_erreur_xml' => 'Incorrect declaration of the plugin',
677
+    'plugin_info_install_ok' => 'Installation successful',
678
+    'plugin_info_necessite' => 'Requires:',
679
+    'plugin_info_non_compatible_spip' => 'This plugin is incompatible with this version of SPIP',
680
+    'plugin_info_plugins_dist_1' => 'The following plugins are loaded and activated in the @plugins_dist@ directory.',
681
+    'plugin_info_plugins_dist_2' => 'They cannot be disabled.',
682
+    'plugin_info_telecharger' => 'load from @url@ and install to @rep@',
683
+    'plugin_info_upgrade_ok' => 'Successful update',
684
+    'plugin_librairies_installees' => 'Libraries installed',
685
+    'plugin_necessite_extension_php' => 'Requires the PHP extension @plugin@ version @version@.',
686
+    'plugin_necessite_extension_php_sans_version' => 'Requires the PHP extension @plugin@',
687
+    'plugin_necessite_lib' => 'This plugin requires the library @lib@',
688
+    'plugin_necessite_php' => 'Requires @plugin@ version @version@.',
689
+    'plugin_necessite_plugin' => 'Version @version@ of the plugin @plugin@ is required.',
690
+    'plugin_necessite_plugin_sans_version' => 'Requires the plugin @plugin@',
691
+    'plugin_necessite_spip' => 'SPIP version @version@ or newer is required.',
692
+    'plugin_source' => 'source: ',
693
+    'plugin_titre_automatique' => 'Automatic installation',
694
+    'plugin_titre_automatique_ajouter' => 'Add plugins',
695
+    'plugin_titre_installation' => '@plugin@ plugin installation',
696
+    'plugin_titre_modifier' => 'My plugins',
697
+    'plugin_utilise_extension_php' => 'The version of the PHP extension @plugin@ must be @version@.',
698
+    'plugin_utilise_php' => '@plugin@ version must be @version@.',
699
+    'plugin_utilise_plugin' => 'The version of the plugin @plugin@ must be @version@.',
700
+    'plugin_zip_active' => 'Continue in order to activate',
701
+    'plugin_zip_adresse' => 'To load a zipped plugin file, or a list of plugins, enter the path below.',
702
+    'plugin_zip_adresse_champ' => 'Path of the plugin or list ',
703
+    'plugin_zip_content' => 'It contains the following files(@taille@),<br />ready to be installed in the <code>@rep@</code> directory',
704
+    'plugin_zip_installe_finie' => 'The file @zip@ has been unpacked and installed.',
705
+    'plugin_zip_installe_rep_finie' => 'The file @zip@ has been unpacked and installed in the @rep@ directory',
706
+    'plugin_zip_installer' => 'You may now install it.',
707
+    'plugin_zip_telecharge' => 'The file @zip@ has been loaded',
708
+    'plugins_actif_aucun' => 'No plugins active.',
709
+    'plugins_actif_un' => 'One plugin active',
710
+    'plugins_actifs' => '@count@ active plugins.',
711
+    'plugins_actifs_liste' => 'Enabled',
712
+    'plugins_compte' => '@count@ plugins',
713
+    'plugins_disponible_un' => 'One plugin available',
714
+    'plugins_disponibles' => '@count@ plugins available.',
715
+    'plugins_erreur' => 'Error in the plugins: @plugins@',
716
+    'plugins_liste' => 'List of plugins',
717
+    'plugins_liste_dist' => 'Locked plugins',
718
+    'plugins_recents' => 'Recent plugins',
719
+    'plugins_tous_liste' => 'All',
720
+    'plugins_vue_hierarchie' => 'Hierarchy',
721
+    'plugins_vue_liste' => 'List',
722
+    'protocole_ldap' => 'Protocol version:',
723 723
 
724
-	// Q
725
-	'queue_executer_maintenant' => 'Run now',
726
-	'queue_info_purger' => 'You can delete all pending tasks and reset the list with periodic tasks',
727
-	'queue_nb_jobs_in_queue' => '@nb@ pending tasks',
728
-	'queue_next_job_in_nb_sec' => 'Next task in @nb@ s',
729
-	'queue_no_job_in_queue' => 'No pending tasks',
730
-	'queue_one_job_in_queue' => '1 pending task',
731
-	'queue_priorite_tache' => 'priority',
732
-	'queue_purger_queue' => 'Reset the tasks queue',
733
-	'queue_titre' => 'Background tasks',
724
+    // Q
725
+    'queue_executer_maintenant' => 'Run now',
726
+    'queue_info_purger' => 'You can delete all pending tasks and reset the list with periodic tasks',
727
+    'queue_nb_jobs_in_queue' => '@nb@ pending tasks',
728
+    'queue_next_job_in_nb_sec' => 'Next task in @nb@ s',
729
+    'queue_no_job_in_queue' => 'No pending tasks',
730
+    'queue_one_job_in_queue' => '1 pending task',
731
+    'queue_priorite_tache' => 'priority',
732
+    'queue_purger_queue' => 'Reset the tasks queue',
733
+    'queue_titre' => 'Background tasks',
734 734
 
735
-	// R
736
-	'repertoire_plugins' => 'Directory:',
737
-	'required' => '(Required)',
735
+    // R
736
+    'repertoire_plugins' => 'Directory:',
737
+    'required' => '(Required)',
738 738
 
739
-	// S
740
-	'sans_heure' => 'time not specified',
741
-	'statut_admin_restreint' => 'restricted admin',
742
-	'statut_webmestre' => 'webmaster',
739
+    // S
740
+    'sans_heure' => 'time not specified',
741
+    'statut_admin_restreint' => 'restricted admin',
742
+    'statut_webmestre' => 'webmaster',
743 743
 
744
-	// T
745
-	'tache_cron_asap' => 'CRON task @function@ (ASAP)',
746
-	'tache_cron_secondes' => 'CRON task @function@ (every @nb@ s)',
747
-	'taille_cache_image' => 'The images calculated automatically by SPIP (thumbnails, titles transformed into graphics, mathematical formulae in TeX format, etc.) take up a total of @taille@ in the @dir@ directory.',
748
-	'taille_cache_infinie' => 'This site does not have any fixed limit for the size of the cache.',
749
-	'taille_cache_maxi' => 'SPIP will try to limit the size of the cache directory to approximately <b>@octets@</b>.',
750
-	'taille_cache_moins_de' => 'The cache size is less than @octets@.',
751
-	'taille_cache_octets' => 'The size of the cache is currently around @octets@.',
752
-	'taille_cache_vide' => 'The cache is empty.',
753
-	'taille_repertoire_cache' => 'Current cache size ',
754
-	'text_article_propose_publication' => 'Article submitted for publication.',
755
-	'texte_acces_ldap_anonyme_1' => 'Some LDAP servers do not allow anonymous access. In this case you must indicate an initial access identifier for future directory searches. However, in most cases the following fields can be left empty.',
756
-	'texte_admin_effacer_01' => 'This command deletes <i>all</i> content in the database,
744
+    // T
745
+    'tache_cron_asap' => 'CRON task @function@ (ASAP)',
746
+    'tache_cron_secondes' => 'CRON task @function@ (every @nb@ s)',
747
+    'taille_cache_image' => 'The images calculated automatically by SPIP (thumbnails, titles transformed into graphics, mathematical formulae in TeX format, etc.) take up a total of @taille@ in the @dir@ directory.',
748
+    'taille_cache_infinie' => 'This site does not have any fixed limit for the size of the cache.',
749
+    'taille_cache_maxi' => 'SPIP will try to limit the size of the cache directory to approximately <b>@octets@</b>.',
750
+    'taille_cache_moins_de' => 'The cache size is less than @octets@.',
751
+    'taille_cache_octets' => 'The size of the cache is currently around @octets@.',
752
+    'taille_cache_vide' => 'The cache is empty.',
753
+    'taille_repertoire_cache' => 'Current cache size ',
754
+    'text_article_propose_publication' => 'Article submitted for publication.',
755
+    'texte_acces_ldap_anonyme_1' => 'Some LDAP servers do not allow anonymous access. In this case you must indicate an initial access identifier for future directory searches. However, in most cases the following fields can be left empty.',
756
+    'texte_admin_effacer_01' => 'This command deletes <i>all</i> content in the database,
757 757
 including <i>all</i> the access parameters for editors and administrators. After using it, you must
758 758
 reinstall SPIP, create a new database and a new administrator account.',
759
-	'texte_adresse_annuaire_1' => '(If your directory is installed on the same machine as your website, it is probably «localhost».)',
760
-	'texte_ajout_auteur' => 'The following author was added to the article:',
761
-	'texte_annuaire_ldap_1' => 'If you have access to a LDAP directory server, you can use it to import users automatically into SPIP.',
762
-	'texte_article_statut' => 'Article status:',
763
-	'texte_article_virtuel' => 'Virtual article',
764
-	'texte_article_virtuel_reference' => '<b>Virtual article:</b> an article on your SPIP website which redirects to another URL. To remove redirection, delete the URL.',
765
-	'texte_aucun_resultat_auteur' => 'No results for "@cherche_auteur@".',
766
-	'texte_auteur_messagerie' => 'This site can update the list of editors online in real time, which allows you to be contacted by other users. You can opt not to appear in this list (you are then "invisible" to other users).',
767
-	'texte_auteurs' => 'THE AUTHORS',
768
-	'texte_choix_base_1' => 'Select your database:',
769
-	'texte_choix_base_2' => 'The SQL server contains several databases.',
770
-	'texte_choix_base_3' => '<b>Select</b> below the one attributed by your hosting provider:',
771
-	'texte_choix_table_prefix' => 'Prefix for tables:',
772
-	'texte_compte_element' => '@count@ element',
773
-	'texte_compte_elements' => '@count@ elements',
774
-	'texte_conflit_edition_correction' => 'Please compare differences between the two versions. You can also copy your changes and start over.',
775
-	'texte_connexion_mysql' => 'Consult the information provided by your hosting service. It should contain the connection codes for the SQL server.',
776
-	'texte_contenu_article' => '(Brief description of the article.)',
777
-	'texte_contenu_articles' => 'Depending on the layout chosen for your site, you can decide
759
+    'texte_adresse_annuaire_1' => '(If your directory is installed on the same machine as your website, it is probably «localhost».)',
760
+    'texte_ajout_auteur' => 'The following author was added to the article:',
761
+    'texte_annuaire_ldap_1' => 'If you have access to a LDAP directory server, you can use it to import users automatically into SPIP.',
762
+    'texte_article_statut' => 'Article status:',
763
+    'texte_article_virtuel' => 'Virtual article',
764
+    'texte_article_virtuel_reference' => '<b>Virtual article:</b> an article on your SPIP website which redirects to another URL. To remove redirection, delete the URL.',
765
+    'texte_aucun_resultat_auteur' => 'No results for "@cherche_auteur@".',
766
+    'texte_auteur_messagerie' => 'This site can update the list of editors online in real time, which allows you to be contacted by other users. You can opt not to appear in this list (you are then "invisible" to other users).',
767
+    'texte_auteurs' => 'THE AUTHORS',
768
+    'texte_choix_base_1' => 'Select your database:',
769
+    'texte_choix_base_2' => 'The SQL server contains several databases.',
770
+    'texte_choix_base_3' => '<b>Select</b> below the one attributed by your hosting provider:',
771
+    'texte_choix_table_prefix' => 'Prefix for tables:',
772
+    'texte_compte_element' => '@count@ element',
773
+    'texte_compte_elements' => '@count@ elements',
774
+    'texte_conflit_edition_correction' => 'Please compare differences between the two versions. You can also copy your changes and start over.',
775
+    'texte_connexion_mysql' => 'Consult the information provided by your hosting service. It should contain the connection codes for the SQL server.',
776
+    'texte_contenu_article' => '(Brief description of the article.)',
777
+    'texte_contenu_articles' => 'Depending on the layout chosen for your site, you can decide
778 778
   that some article options are not to be used.
779 779
   Use the following list to choose which options should be available.',
780
-	'texte_crash_base' => 'If your database
780
+    'texte_crash_base' => 'If your database
781 781
    crashed, you can try to repair it
782 782
    automatically.',
783
-	'texte_creer_rubrique' => 'Before writing any articles,<br /> you must create a section.',
784
-	'texte_date_creation_article' => 'ARTICLE CREATION DATE:',
785
-	'texte_date_creation_objet' => 'Creation date:', # on ajoute le ":"
786
-	'texte_date_publication_anterieure' => 'Date first published:',
787
-	'texte_date_publication_anterieure_nonaffichee' => 'Hide previous publication date.',
788
-	'texte_date_publication_article' => 'PUBLISHED ON:',
789
-	'texte_date_publication_objet' => 'Published on:',
790
-	'texte_definir_comme_traduction_rubrique' => 'This section is a translation of section number:',
791
-	'texte_descriptif_rapide' => 'Brief description',
792
-	'texte_effacer_base' => 'Delete the SPIP database',
793
-	'texte_effacer_statistiques' => 'Delete the statistics',
794
-	'texte_en_cours_validation' => 'The following articles and news have been submitted for evaluation.',
795
-	'texte_enrichir_mise_a_jour' => 'You can enrich the layout of your text by using "typographical shortcuts".',
796
-	'texte_fichier_authent' => '<b>Should SPIP create the special files <tt>.htpasswd</tt>
783
+    'texte_creer_rubrique' => 'Before writing any articles,<br /> you must create a section.',
784
+    'texte_date_creation_article' => 'ARTICLE CREATION DATE:',
785
+    'texte_date_creation_objet' => 'Creation date:', # on ajoute le ":"
786
+    'texte_date_publication_anterieure' => 'Date first published:',
787
+    'texte_date_publication_anterieure_nonaffichee' => 'Hide previous publication date.',
788
+    'texte_date_publication_article' => 'PUBLISHED ON:',
789
+    'texte_date_publication_objet' => 'Published on:',
790
+    'texte_definir_comme_traduction_rubrique' => 'This section is a translation of section number:',
791
+    'texte_descriptif_rapide' => 'Brief description',
792
+    'texte_effacer_base' => 'Delete the SPIP database',
793
+    'texte_effacer_statistiques' => 'Delete the statistics',
794
+    'texte_en_cours_validation' => 'The following articles and news have been submitted for evaluation.',
795
+    'texte_enrichir_mise_a_jour' => 'You can enrich the layout of your text by using "typographical shortcuts".',
796
+    'texte_fichier_authent' => '<b>Should SPIP create the special files <tt>.htpasswd</tt>
797 797
   and <tt>.htpasswd-admin</tt> in the directory @dossier@?</b>
798 798
 <p>These files can be used to restrict access to authors and administrators to other parts of your site (for instance, external statistical programme).</p><p>If you have no need of such files, you can keep this option with its default value (no file creation).</p>',
799
-	'texte_informations_personnelles_1' => 'The system will now  create your personal account for this site.',
800
-	'texte_informations_personnelles_2' => '(Note: if it is a reinstallation, if your former access is still working, you can',
801
-	'texte_introductif_article' => '(Introductory text for the article.)',
802
-	'texte_jeu_caractere' => 'We advise using the universal alphabet (<tt>utf-8</tt>) on your site. This will make it possible to display text in any language. All modern browsers are fully comptabile with this character set.',
803
-	'texte_jeu_caractere_3' => 'Your site currently uses this character set:',
804
-	'texte_jeu_caractere_4' => 'If that does not correspond to your current data (this may occur after restoring your database from a backup), or if <em>you are setting up this site</em> and wish to use a different character set, please indicate the character set here:',
805
-	'texte_login_ldap_1' => '(Keep empty for anonymous access or enter complete path, for instance «<tt>uid=smith, ou=users, dc=my-domain, dc=com</tt>».)',
806
-	'texte_login_precaution' => 'Warning! This is the login which you are currently using.
799
+    'texte_informations_personnelles_1' => 'The system will now  create your personal account for this site.',
800
+    'texte_informations_personnelles_2' => '(Note: if it is a reinstallation, if your former access is still working, you can',
801
+    'texte_introductif_article' => '(Introductory text for the article.)',
802
+    'texte_jeu_caractere' => 'We advise using the universal alphabet (<tt>utf-8</tt>) on your site. This will make it possible to display text in any language. All modern browsers are fully comptabile with this character set.',
803
+    'texte_jeu_caractere_3' => 'Your site currently uses this character set:',
804
+    'texte_jeu_caractere_4' => 'If that does not correspond to your current data (this may occur after restoring your database from a backup), or if <em>you are setting up this site</em> and wish to use a different character set, please indicate the character set here:',
805
+    'texte_login_ldap_1' => '(Keep empty for anonymous access or enter complete path, for instance «<tt>uid=smith, ou=users, dc=my-domain, dc=com</tt>».)',
806
+    'texte_login_precaution' => 'Warning! This is the login which you are currently using.
807 807
  Use this form with caution...',
808
-	'texte_messagerie_agenda' => 'A messaging system lets website’s authors communicate directly into the admin area. It is linked to a calendar.',
809
-	'texte_mise_a_niveau_base_1' => 'You have just updated SPIP files.
808
+    'texte_messagerie_agenda' => 'A messaging system lets website’s authors communicate directly into the admin area. It is linked to a calendar.',
809
+    'texte_mise_a_niveau_base_1' => 'You have just updated SPIP files.
810 810
  Now you must upgrade the site
811 811
  database.',
812
-	'texte_modifier_article' => 'Edit this article:',
813
-	'texte_multilinguisme' => 'If you want to manage objects in several languages​​, with complex navigation, you can add a language selection menu to these objects, depending on the organization of your site.',
814
-	'texte_multilinguisme_trad' => 'You can also enable a system for managing links between the various translations of certain objects.',
815
-	'texte_non_compresse' => '<i>uncompressed</i> (your server does not support this feature)',
816
-	'texte_nouvelle_version_spip_1' => 'You have just installed a new version of SPIP.',
817
-	'texte_nouvelle_version_spip_2' => 'This new version requires a more thorough update than usual. If you are the webmaster of this site, please delete the file @connect@ and restart installation in order to update your database connection parameters. <p>(PS.: if you have forgotten your connection parameters, take a look at the file @connect@ before deleting it!)</p>',
818
-	'texte_operation_echec' => 'Go back to the previous page, select another database or create a new one. Verify the information provided by your hosting service.',
819
-	'texte_plus_trois_car' => 'more than 3 characters',
820
-	'texte_plusieurs_articles' => 'Several authors were found for "@cherche_auteur@":',
821
-	'texte_port_annuaire' => '(Default value is generally suitable.)',
822
-	'texte_presente_plugin' => 'This page shows the plugins available on this site. Activate the plugins you require by ticking the corresponding box.',
823
-	'texte_proposer_publication' => 'When your article is finished,<br /> you can submit it for publication.',
824
-	'texte_proxy' => 'In some cases (e.g. intranet, protected network), it is necessary to use an <i>HTTP proxy</i> to reach external sites (SPIP documentation, syndicated sites, etc.). If this is the case, enter its address in the form @proxy_en_cours@. In most cases you can leave this box empty.',
825
-	'texte_publication_articles_post_dates' => 'Which behaviour should SPIP adopt for articles whose
812
+    'texte_modifier_article' => 'Edit this article:',
813
+    'texte_multilinguisme' => 'If you want to manage objects in several languages​​, with complex navigation, you can add a language selection menu to these objects, depending on the organization of your site.',
814
+    'texte_multilinguisme_trad' => 'You can also enable a system for managing links between the various translations of certain objects.',
815
+    'texte_non_compresse' => '<i>uncompressed</i> (your server does not support this feature)',
816
+    'texte_nouvelle_version_spip_1' => 'You have just installed a new version of SPIP.',
817
+    'texte_nouvelle_version_spip_2' => 'This new version requires a more thorough update than usual. If you are the webmaster of this site, please delete the file @connect@ and restart installation in order to update your database connection parameters. <p>(PS.: if you have forgotten your connection parameters, take a look at the file @connect@ before deleting it!)</p>',
818
+    'texte_operation_echec' => 'Go back to the previous page, select another database or create a new one. Verify the information provided by your hosting service.',
819
+    'texte_plus_trois_car' => 'more than 3 characters',
820
+    'texte_plusieurs_articles' => 'Several authors were found for "@cherche_auteur@":',
821
+    'texte_port_annuaire' => '(Default value is generally suitable.)',
822
+    'texte_presente_plugin' => 'This page shows the plugins available on this site. Activate the plugins you require by ticking the corresponding box.',
823
+    'texte_proposer_publication' => 'When your article is finished,<br /> you can submit it for publication.',
824
+    'texte_proxy' => 'In some cases (e.g. intranet, protected network), it is necessary to use an <i>HTTP proxy</i> to reach external sites (SPIP documentation, syndicated sites, etc.). If this is the case, enter its address in the form @proxy_en_cours@. In most cases you can leave this box empty.',
825
+    'texte_publication_articles_post_dates' => 'Which behaviour should SPIP adopt for articles whose
826 826
   publication date has been set in
827 827
   the future?',
828
-	'texte_rappel_selection_champs' => '[Remember to select this field correctly.]',
829
-	'texte_recalcul_page' => 'If you want
828
+    'texte_rappel_selection_champs' => '[Remember to select this field correctly.]',
829
+    'texte_recalcul_page' => 'If you want
830 830
 to re-process a single page, it is easier to view that page from the public site and click "Re-process this page".',
831
-	'texte_recuperer_base' => 'Repair the database',
832
-	'texte_reference_mais_redirige' => 'article referenced in your SPIP site, but redirected to another URL.',
833
-	'texte_requetes_echouent' => '<b>When some SQL queries fail
831
+    'texte_recuperer_base' => 'Repair the database',
832
+    'texte_reference_mais_redirige' => 'article referenced in your SPIP site, but redirected to another URL.',
833
+    'texte_requetes_echouent' => '<b>When some SQL queries fail
834 834
   systematically, without apparent reason, it is possible
835 835
   that the database itself
836 836
   is the culprit.</b><p>
@@ -841,87 +841,87 @@  discard block
 block discarded – undo
841 841
   clues as to where the problem lies.</p><p>
842 842
   If the problem persists, contact your 
843 843
   service provider.</p>',
844
-	'texte_selection_langue_principale' => 'You can choose the website’s "primary language". This does not mean that you can only write articles in that language, but it will be used to determine
844
+    'texte_selection_langue_principale' => 'You can choose the website’s "primary language". This does not mean that you can only write articles in that language, but it will be used to determine
845 845
 
846 846
 <ul><li> the default date/time format on the public website,</li>
847 847
 <li> the nature of the typographical engine which will be used by SPIP for rendering text,</li>
848 848
 <li> the language in use in public website’s forms,</li>
849 849
 <li> the default language in use in the admin area.</li></ul>',
850
-	'texte_sous_titre' => 'Subtitle',
851
-	'texte_statistiques_visites' => '(dark bars = Sunday, dark curve: average visits)',
852
-	'texte_statut_attente_validation' => 'awaiting validation',
853
-	'texte_statut_publies' => 'published online',
854
-	'texte_statut_refuses' => 'rejected',
855
-	'texte_suppression_fichiers' => 'Use this command to purge all the files
850
+    'texte_sous_titre' => 'Subtitle',
851
+    'texte_statistiques_visites' => '(dark bars = Sunday, dark curve: average visits)',
852
+    'texte_statut_attente_validation' => 'awaiting validation',
853
+    'texte_statut_publies' => 'published online',
854
+    'texte_statut_refuses' => 'rejected',
855
+    'texte_suppression_fichiers' => 'Use this command to purge all the files
856 856
 in the SPIP cache. This will force recalculation of every page on the site, useful after
857 857
 significant modifications to the site’s graphics or structure.',
858
-	'texte_sur_titre' => 'Lead-in title',
859
-	'texte_table_ok' => ': this table is OK.',
860
-	'texte_tentative_recuperation' => 'Attempting to repair',
861
-	'texte_tenter_reparation' => 'Attempt to repair the database',
862
-	'texte_test_proxy' => 'To test this proxy, enter the address of a website
858
+    'texte_sur_titre' => 'Lead-in title',
859
+    'texte_table_ok' => ': this table is OK.',
860
+    'texte_tentative_recuperation' => 'Attempting to repair',
861
+    'texte_tenter_reparation' => 'Attempt to repair the database',
862
+    'texte_test_proxy' => 'To test this proxy, enter the address of a website
863 863
     for verification.',
864
-	'texte_titre_02' => 'Subject:',
865
-	'texte_titre_obligatoire' => '<b>Title</b> [Required]',
866
-	'texte_travail_article' => '@nom_auteur_modif@ edited this article @date_diff@ minutes ago',
867
-	'texte_travail_collaboratif' => 'If several editors often work on the same article, the system can mark recently "opened" articles in order to avoid multiple simultaneous editing.
864
+    'texte_titre_02' => 'Subject:',
865
+    'texte_titre_obligatoire' => '<b>Title</b> [Required]',
866
+    'texte_travail_article' => '@nom_auteur_modif@ edited this article @date_diff@ minutes ago',
867
+    'texte_travail_collaboratif' => 'If several editors often work on the same article, the system can mark recently "opened" articles in order to avoid multiple simultaneous editing.
868 868
   This option is disabled by default to avoid displaying unnecessary warning
869 869
   messages.',
870
-	'texte_vide' => 'empty',
871
-	'texte_vider_cache' => 'Empty the cache',
872
-	'titre_admin_tech' => 'Technical maintenance',
873
-	'titre_admin_vider' => 'Technical maintenance',
874
-	'titre_ajouter_un_auteur' => 'Add an author',
875
-	'titre_ajouter_un_mot' => 'Add a keyword',
876
-	'titre_cadre_afficher_article' => 'Show the articles:',
877
-	'titre_cadre_afficher_traductions' => 'Display the translation status for these languages:',
878
-	'titre_cadre_ajouter_auteur' => 'ADD AN AUTHOR:',
879
-	'titre_cadre_interieur_rubrique' => 'In section',
880
-	'titre_cadre_numero_auteur' => 'AUTHOR NUMBER',
881
-	'titre_cadre_numero_objet' => '@objet@ NUMBER:',
882
-	'titre_cadre_signature_obligatoire' => '<b>Signature</b> [Required]<br />',
883
-	'titre_config_contenu_notifications' => 'Notifications',
884
-	'titre_config_contenu_prive' => 'In the admin area',
885
-	'titre_config_contenu_public' => 'On the public site',
886
-	'titre_config_fonctions' => 'Site configuration',
887
-	'titre_config_langage' => 'Configure the language',
888
-	'titre_configuration' => 'Site configuration',
889
-	'titre_configurer_preferences' => 'Configure your preferences',
890
-	'titre_configurer_preferences_menus' => 'Settings of your menus preferences',
891
-	'titre_conflit_edition' => 'Conflict while editing',
892
-	'titre_connexion_ldap' => 'Options: <b>Your LDAP connection</b>',
893
-	'titre_groupe_mots' => 'KEYWORD GROUP:',
894
-	'titre_identite_site' => 'Site identity',
895
-	'titre_langue_article' => 'Article language',
896
-	'titre_langue_rubrique' => 'Section language',
897
-	'titre_langue_trad_article' => 'ARTICLE LANGUAGE AND TRANSLATIONS',
898
-	'titre_les_articles' => 'ARTICLES',
899
-	'titre_messagerie_agenda' => 'Messaging system and calendar',
900
-	'titre_naviguer_dans_le_site' => 'Browse the site...',
901
-	'titre_nouvelle_rubrique' => 'New section',
902
-	'titre_numero_rubrique' => 'SECTION NUMBER:',
903
-	'titre_page_articles_edit' => 'Modify: @titre@',
904
-	'titre_page_articles_page' => 'Articles',
905
-	'titre_page_articles_tous' => 'The entire site',
906
-	'titre_page_calendrier' => 'Calendar @nom_mois@ @annee@',
907
-	'titre_page_config_contenu' => 'Site configuration',
908
-	'titre_page_delete_all' => 'total and irreversible deletion',
909
-	'titre_page_recherche' => 'Search results @recherche@',
910
-	'titre_page_statistiques_referers' => 'Statistics (incoming links)',
911
-	'titre_page_upgrade' => 'SPIP upgrade',
912
-	'titre_preference_menus_favoris' => 'Favourites menu',
913
-	'titre_publication_articles_post_dates' => 'Publication of post dated articles',
914
-	'titre_reparation' => 'Repair',
915
-	'titre_suivi_petition' => 'Petitions follow-up',
916
-	'tls_ldap' => 'Transport Layer Security :',
917
-	'trad_article_traduction' => 'All the versions of this article:',
918
-	'trad_delier' => 'Stop linking to these translations',
919
-	'trad_lier' => 'This article is a translation of article number:',
920
-	'trad_new' => 'Write a new translation',
870
+    'texte_vide' => 'empty',
871
+    'texte_vider_cache' => 'Empty the cache',
872
+    'titre_admin_tech' => 'Technical maintenance',
873
+    'titre_admin_vider' => 'Technical maintenance',
874
+    'titre_ajouter_un_auteur' => 'Add an author',
875
+    'titre_ajouter_un_mot' => 'Add a keyword',
876
+    'titre_cadre_afficher_article' => 'Show the articles:',
877
+    'titre_cadre_afficher_traductions' => 'Display the translation status for these languages:',
878
+    'titre_cadre_ajouter_auteur' => 'ADD AN AUTHOR:',
879
+    'titre_cadre_interieur_rubrique' => 'In section',
880
+    'titre_cadre_numero_auteur' => 'AUTHOR NUMBER',
881
+    'titre_cadre_numero_objet' => '@objet@ NUMBER:',
882
+    'titre_cadre_signature_obligatoire' => '<b>Signature</b> [Required]<br />',
883
+    'titre_config_contenu_notifications' => 'Notifications',
884
+    'titre_config_contenu_prive' => 'In the admin area',
885
+    'titre_config_contenu_public' => 'On the public site',
886
+    'titre_config_fonctions' => 'Site configuration',
887
+    'titre_config_langage' => 'Configure the language',
888
+    'titre_configuration' => 'Site configuration',
889
+    'titre_configurer_preferences' => 'Configure your preferences',
890
+    'titre_configurer_preferences_menus' => 'Settings of your menus preferences',
891
+    'titre_conflit_edition' => 'Conflict while editing',
892
+    'titre_connexion_ldap' => 'Options: <b>Your LDAP connection</b>',
893
+    'titre_groupe_mots' => 'KEYWORD GROUP:',
894
+    'titre_identite_site' => 'Site identity',
895
+    'titre_langue_article' => 'Article language',
896
+    'titre_langue_rubrique' => 'Section language',
897
+    'titre_langue_trad_article' => 'ARTICLE LANGUAGE AND TRANSLATIONS',
898
+    'titre_les_articles' => 'ARTICLES',
899
+    'titre_messagerie_agenda' => 'Messaging system and calendar',
900
+    'titre_naviguer_dans_le_site' => 'Browse the site...',
901
+    'titre_nouvelle_rubrique' => 'New section',
902
+    'titre_numero_rubrique' => 'SECTION NUMBER:',
903
+    'titre_page_articles_edit' => 'Modify: @titre@',
904
+    'titre_page_articles_page' => 'Articles',
905
+    'titre_page_articles_tous' => 'The entire site',
906
+    'titre_page_calendrier' => 'Calendar @nom_mois@ @annee@',
907
+    'titre_page_config_contenu' => 'Site configuration',
908
+    'titre_page_delete_all' => 'total and irreversible deletion',
909
+    'titre_page_recherche' => 'Search results @recherche@',
910
+    'titre_page_statistiques_referers' => 'Statistics (incoming links)',
911
+    'titre_page_upgrade' => 'SPIP upgrade',
912
+    'titre_preference_menus_favoris' => 'Favourites menu',
913
+    'titre_publication_articles_post_dates' => 'Publication of post dated articles',
914
+    'titre_reparation' => 'Repair',
915
+    'titre_suivi_petition' => 'Petitions follow-up',
916
+    'tls_ldap' => 'Transport Layer Security :',
917
+    'trad_article_traduction' => 'All the versions of this article:',
918
+    'trad_delier' => 'Stop linking to these translations',
919
+    'trad_lier' => 'This article is a translation of article number:',
920
+    'trad_new' => 'Write a new translation',
921 921
 
922
-	// U
923
-	'utf8_convert_erreur_orig' => 'Error: the character set @charset@ is not supported.',
922
+    // U
923
+    'utf8_convert_erreur_orig' => 'Error: the character set @charset@ is not supported.',
924 924
 
925
-	// V
926
-	'version' => 'Version:'
925
+    // V
926
+    'version' => 'Version:'
927 927
 );
Please login to merge, or discard this patch.
ecrire/notifications/instituerarticle.php 1 patch
Indentation   +44 added lines, -44 removed lines patch added patch discarded remove patch
@@ -11,53 +11,53 @@
 block discarded – undo
11 11
 \***************************************************************************/
12 12
 
13 13
 if (!defined('_ECRIRE_INC_VERSION')) {
14
-	return;
14
+    return;
15 15
 }
16 16
 
17 17
 // Fonction appelee par divers pipelines
18 18
 function notifications_instituerarticle_dist($quoi, $id_article, $options) {
19 19
 
20
-	// ne devrait jamais se produire
21
-	if ($options['statut'] == $options['statut_ancien']) {
22
-		spip_log('statut inchange', 'notifications');
23
-
24
-		return;
25
-	}
26
-
27
-	include_spip('inc/texte');
28
-
29
-	$modele = '';
30
-	if ($options['statut'] == 'publie') {
31
-		if (
32
-			$GLOBALS['meta']['post_dates'] == 'non'
33
-			and strtotime($options['date']) > time()
34
-		) {
35
-			$modele = 'notifications/article_valide';
36
-		} else {
37
-			$modele = 'notifications/article_publie';
38
-		}
39
-	}
40
-
41
-	if ($options['statut'] == 'prop' and $options['statut_ancien'] != 'publie') {
42
-		$modele = 'notifications/article_propose';
43
-	}
44
-
45
-	if ($modele) {
46
-		$destinataires = [];
47
-		if ($GLOBALS['meta']['suivi_edito'] == 'oui') {
48
-			$destinataires = explode(',', $GLOBALS['meta']['adresse_suivi']);
49
-		}
50
-
51
-
52
-		$destinataires = pipeline(
53
-			'notifications_destinataires',
54
-			[
55
-				'args' => ['quoi' => $quoi, 'id' => $id_article, 'options' => $options],
56
-				'data' => $destinataires
57
-			]
58
-		);
59
-
60
-		$texte = email_notification_article($id_article, $modele);
61
-		notifications_envoyer_mails($destinataires, $texte);
62
-	}
20
+    // ne devrait jamais se produire
21
+    if ($options['statut'] == $options['statut_ancien']) {
22
+        spip_log('statut inchange', 'notifications');
23
+
24
+        return;
25
+    }
26
+
27
+    include_spip('inc/texte');
28
+
29
+    $modele = '';
30
+    if ($options['statut'] == 'publie') {
31
+        if (
32
+            $GLOBALS['meta']['post_dates'] == 'non'
33
+            and strtotime($options['date']) > time()
34
+        ) {
35
+            $modele = 'notifications/article_valide';
36
+        } else {
37
+            $modele = 'notifications/article_publie';
38
+        }
39
+    }
40
+
41
+    if ($options['statut'] == 'prop' and $options['statut_ancien'] != 'publie') {
42
+        $modele = 'notifications/article_propose';
43
+    }
44
+
45
+    if ($modele) {
46
+        $destinataires = [];
47
+        if ($GLOBALS['meta']['suivi_edito'] == 'oui') {
48
+            $destinataires = explode(',', $GLOBALS['meta']['adresse_suivi']);
49
+        }
50
+
51
+
52
+        $destinataires = pipeline(
53
+            'notifications_destinataires',
54
+            [
55
+                'args' => ['quoi' => $quoi, 'id' => $id_article, 'options' => $options],
56
+                'data' => $destinataires
57
+            ]
58
+        );
59
+
60
+        $texte = email_notification_article($id_article, $modele);
61
+        notifications_envoyer_mails($destinataires, $texte);
62
+    }
63 63
 }
Please login to merge, or discard this patch.
ecrire/req/sqlite3.php 1 patch
Indentation   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -11,7 +11,7 @@  discard block
 block discarded – undo
11 11
 \***************************************************************************/
12 12
 
13 13
 if (!defined('_ECRIRE_INC_VERSION')) {
14
-	return;
14
+    return;
15 15
 }
16 16
 
17 17
 
@@ -21,18 +21,18 @@  discard block
 block discarded – undo
21 21
 
22 22
 
23 23
 function req_sqlite3_dist($addr, $port, $login, $pass, $db = '', $prefixe = '') {
24
-	return req_sqlite_dist($addr, $port, $login, $pass, $db, $prefixe, $sqlite_version = 3);
24
+    return req_sqlite_dist($addr, $port, $login, $pass, $db, $prefixe, $sqlite_version = 3);
25 25
 }
26 26
 
27 27
 
28 28
 function spip_sqlite3_constantes() {
29
-	if (!defined('SPIP_SQLITE3_ASSOC')) {
30
-		define('SPIP_SQLITE3_ASSOC', PDO::FETCH_ASSOC);
31
-		define('SPIP_SQLITE3_NUM', PDO::FETCH_NUM);
32
-		define('SPIP_SQLITE3_BOTH', PDO::FETCH_BOTH);
33
-	}
29
+    if (!defined('SPIP_SQLITE3_ASSOC')) {
30
+        define('SPIP_SQLITE3_ASSOC', PDO::FETCH_ASSOC);
31
+        define('SPIP_SQLITE3_NUM', PDO::FETCH_NUM);
32
+        define('SPIP_SQLITE3_BOTH', PDO::FETCH_BOTH);
33
+    }
34 34
 }
35 35
 
36 36
 function spip_versions_sqlite3() {
37
-	return _sqlite_charger_version(3) ? 3 : false;
37
+    return _sqlite_charger_version(3) ? 3 : false;
38 38
 }
Please login to merge, or discard this patch.
ecrire/req/pg.exp.php 2 patches
Indentation   +1179 added lines, -1179 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
 define('_DEFAULT_DB', 'spip');
@@ -31,159 +31,159 @@  discard block
 block discarded – undo
31 31
 // si ca ne marche toujours pas, echec.
32 32
 
33 33
 function req_pg_dist($addr, $port, $login, $pass, $db = '', $prefixe = '') {
34
-	static $last_connect = [];
35
-	if (!extension_loaded('pgsql')) {
36
-		return false;
37
-	}
38
-
39
-	// si provient de selectdb
40
-	if (empty($addr) && empty($port) && empty($login) && empty($pass)) {
41
-		foreach (['addr', 'port', 'login', 'pass', 'prefixe'] as $a) {
42
-			${$a} = $last_connect[$a];
43
-		}
44
-	}
45
-	[$host, $p] = array_pad(explode(';', $addr), 2, null);
46
-	if ($p > 0) {
47
-		$port = " port=$p";
48
-	} else {
49
-		$port = '';
50
-	}
51
-	$erreurs = [];
52
-	if ($db) {
53
-		@$link = pg_connect("host=$host$port dbname=$db user=$login password='$pass'", PGSQL_CONNECT_FORCE_NEW);
54
-	} elseif (!@$link = pg_connect("host=$host$port user=$login password='$pass'", PGSQL_CONNECT_FORCE_NEW)) {
55
-		$erreurs[] = pg_last_error();
56
-		if (@$link = pg_connect("host=$host$port dbname=$login user=$login password='$pass'", PGSQL_CONNECT_FORCE_NEW)) {
57
-			$db = $login;
58
-		} else {
59
-			$erreurs[] = pg_last_error();
60
-			$db = _DEFAULT_DB;
61
-			$link = pg_connect("host=$host$port dbname=$db user=$login password='$pass'", PGSQL_CONNECT_FORCE_NEW);
62
-		}
63
-	}
64
-	if (!$link) {
65
-		$erreurs[] = pg_last_error();
66
-		foreach ($erreurs as $e) {
67
-			spip_log('Echec pg_connect. Erreur : ' . $e, 'pg.' . _LOG_HS);
68
-		}
69
-
70
-		return false;
71
-	}
72
-
73
-	if ($link) {
74
-		$last_connect = [
75
-			'addr' => $addr,
76
-			'port' => $port,
77
-			'login' => $login,
78
-			'pass' => $pass,
79
-			'db' => $db,
80
-			'prefixe' => $prefixe,
81
-		];
82
-	}
83
-
84
-	spip_log(
85
-		"Connexion vers $host, base $db, prefixe $prefixe " . ($link ? 'operationnelle' : 'impossible'),
86
-		'pg.' . _LOG_DEBUG
87
-	);
88
-
89
-	return !$link ? false : [
90
-		'db' => $db,
91
-		'prefixe' => $prefixe ?: $db,
92
-		'link' => $link,
93
-	];
34
+    static $last_connect = [];
35
+    if (!extension_loaded('pgsql')) {
36
+        return false;
37
+    }
38
+
39
+    // si provient de selectdb
40
+    if (empty($addr) && empty($port) && empty($login) && empty($pass)) {
41
+        foreach (['addr', 'port', 'login', 'pass', 'prefixe'] as $a) {
42
+            ${$a} = $last_connect[$a];
43
+        }
44
+    }
45
+    [$host, $p] = array_pad(explode(';', $addr), 2, null);
46
+    if ($p > 0) {
47
+        $port = " port=$p";
48
+    } else {
49
+        $port = '';
50
+    }
51
+    $erreurs = [];
52
+    if ($db) {
53
+        @$link = pg_connect("host=$host$port dbname=$db user=$login password='$pass'", PGSQL_CONNECT_FORCE_NEW);
54
+    } elseif (!@$link = pg_connect("host=$host$port user=$login password='$pass'", PGSQL_CONNECT_FORCE_NEW)) {
55
+        $erreurs[] = pg_last_error();
56
+        if (@$link = pg_connect("host=$host$port dbname=$login user=$login password='$pass'", PGSQL_CONNECT_FORCE_NEW)) {
57
+            $db = $login;
58
+        } else {
59
+            $erreurs[] = pg_last_error();
60
+            $db = _DEFAULT_DB;
61
+            $link = pg_connect("host=$host$port dbname=$db user=$login password='$pass'", PGSQL_CONNECT_FORCE_NEW);
62
+        }
63
+    }
64
+    if (!$link) {
65
+        $erreurs[] = pg_last_error();
66
+        foreach ($erreurs as $e) {
67
+            spip_log('Echec pg_connect. Erreur : ' . $e, 'pg.' . _LOG_HS);
68
+        }
69
+
70
+        return false;
71
+    }
72
+
73
+    if ($link) {
74
+        $last_connect = [
75
+            'addr' => $addr,
76
+            'port' => $port,
77
+            'login' => $login,
78
+            'pass' => $pass,
79
+            'db' => $db,
80
+            'prefixe' => $prefixe,
81
+        ];
82
+    }
83
+
84
+    spip_log(
85
+        "Connexion vers $host, base $db, prefixe $prefixe " . ($link ? 'operationnelle' : 'impossible'),
86
+        'pg.' . _LOG_DEBUG
87
+    );
88
+
89
+    return !$link ? false : [
90
+        'db' => $db,
91
+        'prefixe' => $prefixe ?: $db,
92
+        'link' => $link,
93
+    ];
94 94
 }
95 95
 
96 96
 $GLOBALS['spip_pg_functions_1'] = [
97
-	'alter' => 'spip_pg_alter',
98
-	'count' => 'spip_pg_count',
99
-	'countsel' => 'spip_pg_countsel',
100
-	'create' => 'spip_pg_create',
101
-	'create_base' => 'spip_pg_create_base',
102
-	'create_view' => 'spip_pg_create_view',
103
-	'date_proche' => 'spip_pg_date_proche',
104
-	'delete' => 'spip_pg_delete',
105
-	'drop_table' => 'spip_pg_drop_table',
106
-	'drop_view' => 'spip_pg_drop_view',
107
-	'errno' => 'spip_pg_errno',
108
-	'error' => 'spip_pg_error',
109
-	'explain' => 'spip_pg_explain',
110
-	'fetch' => 'spip_pg_fetch',
111
-	'seek' => 'spip_pg_seek',
112
-	'free' => 'spip_pg_free',
113
-	'hex' => 'spip_pg_hex',
114
-	'in' => 'spip_pg_in',
115
-	'insert' => 'spip_pg_insert',
116
-	'insertq' => 'spip_pg_insertq',
117
-	'insertq_multi' => 'spip_pg_insertq_multi',
118
-	'listdbs' => 'spip_pg_listdbs',
119
-	'multi' => 'spip_pg_multi',
120
-	'optimize' => 'spip_pg_optimize',
121
-	'query' => 'spip_pg_query',
122
-	'quote' => 'spip_pg_quote',
123
-	'replace' => 'spip_pg_replace',
124
-	'replace_multi' => 'spip_pg_replace_multi',
125
-	'select' => 'spip_pg_select',
126
-	'selectdb' => 'spip_pg_selectdb',
127
-	'set_connect_charset' => 'spip_pg_set_connect_charset',
128
-	'showbase' => 'spip_pg_showbase',
129
-	'showtable' => 'spip_pg_showtable',
130
-	'update' => 'spip_pg_update',
131
-	'updateq' => 'spip_pg_updateq',
97
+    'alter' => 'spip_pg_alter',
98
+    'count' => 'spip_pg_count',
99
+    'countsel' => 'spip_pg_countsel',
100
+    'create' => 'spip_pg_create',
101
+    'create_base' => 'spip_pg_create_base',
102
+    'create_view' => 'spip_pg_create_view',
103
+    'date_proche' => 'spip_pg_date_proche',
104
+    'delete' => 'spip_pg_delete',
105
+    'drop_table' => 'spip_pg_drop_table',
106
+    'drop_view' => 'spip_pg_drop_view',
107
+    'errno' => 'spip_pg_errno',
108
+    'error' => 'spip_pg_error',
109
+    'explain' => 'spip_pg_explain',
110
+    'fetch' => 'spip_pg_fetch',
111
+    'seek' => 'spip_pg_seek',
112
+    'free' => 'spip_pg_free',
113
+    'hex' => 'spip_pg_hex',
114
+    'in' => 'spip_pg_in',
115
+    'insert' => 'spip_pg_insert',
116
+    'insertq' => 'spip_pg_insertq',
117
+    'insertq_multi' => 'spip_pg_insertq_multi',
118
+    'listdbs' => 'spip_pg_listdbs',
119
+    'multi' => 'spip_pg_multi',
120
+    'optimize' => 'spip_pg_optimize',
121
+    'query' => 'spip_pg_query',
122
+    'quote' => 'spip_pg_quote',
123
+    'replace' => 'spip_pg_replace',
124
+    'replace_multi' => 'spip_pg_replace_multi',
125
+    'select' => 'spip_pg_select',
126
+    'selectdb' => 'spip_pg_selectdb',
127
+    'set_connect_charset' => 'spip_pg_set_connect_charset',
128
+    'showbase' => 'spip_pg_showbase',
129
+    'showtable' => 'spip_pg_showtable',
130
+    'update' => 'spip_pg_update',
131
+    'updateq' => 'spip_pg_updateq',
132 132
 ];
133 133
 
134 134
 // Par ou ca passe une fois les traductions faites
135 135
 function spip_pg_trace_query($query, $serveur = '') {
136
-	$connexion = &$GLOBALS['connexions'][$serveur ? strtolower($serveur) : 0];
137
-	$prefixe = $connexion['prefixe'];
138
-	$link = $connexion['link'];
139
-	$db = $connexion['db'];
140
-
141
-	if (isset($_GET['var_profile'])) {
142
-		include_spip('public/tracer');
143
-		$t = trace_query_start();
144
-		$e = '';
145
-	} else {
146
-		$t = 0;
147
-	}
148
-
149
-	$connexion['last'] = $query;
150
-	$r = spip_pg_query_simple($link, $query);
151
-
152
-	// Log de l'erreur eventuelle
153
-	if ($e = spip_pg_errno($serveur)) {
154
-		$e .= spip_pg_error($query, $serveur);
155
-	} // et du fautif
156
-	return $t ? trace_query_end($query, $t, $r, $e, $serveur) : $r;
136
+    $connexion = &$GLOBALS['connexions'][$serveur ? strtolower($serveur) : 0];
137
+    $prefixe = $connexion['prefixe'];
138
+    $link = $connexion['link'];
139
+    $db = $connexion['db'];
140
+
141
+    if (isset($_GET['var_profile'])) {
142
+        include_spip('public/tracer');
143
+        $t = trace_query_start();
144
+        $e = '';
145
+    } else {
146
+        $t = 0;
147
+    }
148
+
149
+    $connexion['last'] = $query;
150
+    $r = spip_pg_query_simple($link, $query);
151
+
152
+    // Log de l'erreur eventuelle
153
+    if ($e = spip_pg_errno($serveur)) {
154
+        $e .= spip_pg_error($query, $serveur);
155
+    } // et du fautif
156
+    return $t ? trace_query_end($query, $t, $r, $e, $serveur) : $r;
157 157
 }
158 158
 
159 159
 // Fonction de requete generale quand on est sur que c'est SQL standard.
160 160
 // Elle change juste le noms des tables ($table_prefix) dans le FROM etc
161 161
 
162 162
 function spip_pg_query($query, $serveur = '', $requeter = true) {
163
-	$connexion = &$GLOBALS['connexions'][$serveur ? strtolower($serveur) : 0];
164
-	$prefixe = $connexion['prefixe'];
165
-	$link = $connexion['link'];
166
-	$db = $connexion['db'];
167
-
168
-	if (preg_match('/\s(SET|VALUES|WHERE|DATABASE)\s/i', $query, $regs)) {
169
-		$suite = strstr($query, (string) $regs[0]);
170
-		$query = substr($query, 0, -strlen($suite));
171
-	} else {
172
-		$suite = '';
173
-	}
174
-	$query = preg_replace('/([,\s])spip_/', '\1' . $prefixe . '_', $query) . $suite;
175
-
176
-	// renvoyer la requete inerte si demandee
177
-	if (!$requeter) {
178
-		return $query;
179
-	}
180
-
181
-	return spip_pg_trace_query($query, $serveur);
163
+    $connexion = &$GLOBALS['connexions'][$serveur ? strtolower($serveur) : 0];
164
+    $prefixe = $connexion['prefixe'];
165
+    $link = $connexion['link'];
166
+    $db = $connexion['db'];
167
+
168
+    if (preg_match('/\s(SET|VALUES|WHERE|DATABASE)\s/i', $query, $regs)) {
169
+        $suite = strstr($query, (string) $regs[0]);
170
+        $query = substr($query, 0, -strlen($suite));
171
+    } else {
172
+        $suite = '';
173
+    }
174
+    $query = preg_replace('/([,\s])spip_/', '\1' . $prefixe . '_', $query) . $suite;
175
+
176
+    // renvoyer la requete inerte si demandee
177
+    if (!$requeter) {
178
+        return $query;
179
+    }
180
+
181
+    return spip_pg_trace_query($query, $serveur);
182 182
 }
183 183
 
184 184
 function spip_pg_query_simple($link, $query) {
185
-	#spip_log(var_export($query,true), 'pg.'._LOG_DEBUG);
186
-	return pg_query($link, $query);
185
+    #spip_log(var_export($query,true), 'pg.'._LOG_DEBUG);
186
+    return pg_query($link, $query);
187 187
 }
188 188
 
189 189
 /*
@@ -195,196 +195,196 @@  discard block
 block discarded – undo
195 195
  * de requetes showtable intempestives
196 196
  */
197 197
 function spip_pg_ajouter_champs_timestamp($table, $couples, $desc = '', $serveur = '') {
198
-	static $tables = [];
199
-
200
-	if (!isset($tables[$table])) {
201
-		if (!$desc) {
202
-			$trouver_table = charger_fonction('trouver_table', 'base');
203
-			$desc = $trouver_table($table, $serveur);
204
-			// si pas de description, on ne fait rien, ou on die() ?
205
-			if (!$desc) {
206
-				return $couples;
207
-			}
208
-		}
209
-
210
-		// recherche des champs avec simplement 'TIMESTAMP'
211
-		// cependant, il faudra peut etre etendre
212
-		// avec la gestion de DEFAULT et ON UPDATE
213
-		// mais ceux-ci ne sont pas utilises dans le core
214
-		$tables[$table] = [];
215
-		foreach ($desc['field'] as $k => $v) {
216
-			$v = strtolower(ltrim($v));
217
-			// ne pas ajouter de timestamp now() si un default est specifie
218
-			if (strpos($v, 'timestamp') === 0 and strpos($v, 'default') === false) {
219
-				$tables[$table][] = $k;
220
-			}
221
-		}
222
-	}
223
-
224
-	// ajout des champs type 'timestamp' absents
225
-	foreach ($tables[$table] as $maj) {
226
-		if (!array_key_exists($maj, $couples)) {
227
-			$couples[$maj] = 'NOW()';
228
-		}
229
-	}
230
-
231
-	return $couples;
198
+    static $tables = [];
199
+
200
+    if (!isset($tables[$table])) {
201
+        if (!$desc) {
202
+            $trouver_table = charger_fonction('trouver_table', 'base');
203
+            $desc = $trouver_table($table, $serveur);
204
+            // si pas de description, on ne fait rien, ou on die() ?
205
+            if (!$desc) {
206
+                return $couples;
207
+            }
208
+        }
209
+
210
+        // recherche des champs avec simplement 'TIMESTAMP'
211
+        // cependant, il faudra peut etre etendre
212
+        // avec la gestion de DEFAULT et ON UPDATE
213
+        // mais ceux-ci ne sont pas utilises dans le core
214
+        $tables[$table] = [];
215
+        foreach ($desc['field'] as $k => $v) {
216
+            $v = strtolower(ltrim($v));
217
+            // ne pas ajouter de timestamp now() si un default est specifie
218
+            if (strpos($v, 'timestamp') === 0 and strpos($v, 'default') === false) {
219
+                $tables[$table][] = $k;
220
+            }
221
+        }
222
+    }
223
+
224
+    // ajout des champs type 'timestamp' absents
225
+    foreach ($tables[$table] as $maj) {
226
+        if (!array_key_exists($maj, $couples)) {
227
+            $couples[$maj] = 'NOW()';
228
+        }
229
+    }
230
+
231
+    return $couples;
232 232
 }
233 233
 
234 234
 
235 235
 // Alter en PG ne traite pas les index
236 236
 function spip_pg_alter($query, $serveur = '', $requeter = true) {
237
-	// il faudrait une regexp pour eviter de spliter ADD PRIMARY KEY (colA, colB)
238
-	// tout en cassant en deux alter distincts "ADD PRIMARY KEY (colA, colB), ADD INDEX (chose)"...
239
-	// ou revoir l'api de sql_alter en creant un
240
-	// sql_alter_table($table,array($actions));
241
-	if (!preg_match('/\s*((\s*IGNORE)?\s*TABLE\s*([^\s]*))\s*(.*)?/is', $query, $regs)) {
242
-		spip_log("$query mal comprise", 'pg.' . _LOG_ERREUR);
243
-
244
-		return false;
245
-	}
246
-	$debut = $regs[1];
247
-	$table = $regs[3];
248
-	$suite = $regs[4];
249
-	$todo = explode(',', $suite);
250
-	// on remet les morceaux dechires ensembles... que c'est laid !
251
-	$todo2 = [];
252
-	$i = 0;
253
-	$ouverte = false;
254
-	while ($do = array_shift($todo)) {
255
-		$todo2[$i] = isset($todo2[$i]) ? $todo2[$i] . ',' . $do : $do;
256
-		$o = (false !== strpos($do, '('));
257
-		$f = (false !== strpos($do, ')'));
258
-		if ($o and !$f) {
259
-			$ouverte = true;
260
-		} elseif ($f) {
261
-			$ouverte = false;
262
-		}
263
-		if (!$ouverte) {
264
-			$i++;
265
-		}
266
-	}
267
-	$todo = $todo2;
268
-	$query = $debut . ' ' . array_shift($todo);
269
-
270
-	if (!preg_match('/^\s*(IGNORE\s*)?TABLE\s+(\w+)\s+(ADD|DROP|CHANGE|MODIFY|RENAME)\s*(.*)$/is', $query, $r)) {
271
-		spip_log("$query incompris", 'pg.' . _LOG_ERREUR);
272
-	} else {
273
-		if ($r[1]) {
274
-			spip_log("j'ignore IGNORE dans $query", 'pg.' . _LOG_AVERTISSEMENT);
275
-		}
276
-		$f = 'spip_pg_alter_' . strtolower($r[3]);
277
-		if (function_exists($f)) {
278
-			$f($r[2], $r[4], $serveur, $requeter);
279
-		} else {
280
-			spip_log("$query non prevu", 'pg.' . _LOG_ERREUR);
281
-		}
282
-	}
283
-	// Alter a plusieurs args. Faudrait optimiser.
284
-	if ($todo) {
285
-		spip_pg_alter("TABLE $table " . join(',', $todo));
286
-	}
237
+    // il faudrait une regexp pour eviter de spliter ADD PRIMARY KEY (colA, colB)
238
+    // tout en cassant en deux alter distincts "ADD PRIMARY KEY (colA, colB), ADD INDEX (chose)"...
239
+    // ou revoir l'api de sql_alter en creant un
240
+    // sql_alter_table($table,array($actions));
241
+    if (!preg_match('/\s*((\s*IGNORE)?\s*TABLE\s*([^\s]*))\s*(.*)?/is', $query, $regs)) {
242
+        spip_log("$query mal comprise", 'pg.' . _LOG_ERREUR);
243
+
244
+        return false;
245
+    }
246
+    $debut = $regs[1];
247
+    $table = $regs[3];
248
+    $suite = $regs[4];
249
+    $todo = explode(',', $suite);
250
+    // on remet les morceaux dechires ensembles... que c'est laid !
251
+    $todo2 = [];
252
+    $i = 0;
253
+    $ouverte = false;
254
+    while ($do = array_shift($todo)) {
255
+        $todo2[$i] = isset($todo2[$i]) ? $todo2[$i] . ',' . $do : $do;
256
+        $o = (false !== strpos($do, '('));
257
+        $f = (false !== strpos($do, ')'));
258
+        if ($o and !$f) {
259
+            $ouverte = true;
260
+        } elseif ($f) {
261
+            $ouverte = false;
262
+        }
263
+        if (!$ouverte) {
264
+            $i++;
265
+        }
266
+    }
267
+    $todo = $todo2;
268
+    $query = $debut . ' ' . array_shift($todo);
269
+
270
+    if (!preg_match('/^\s*(IGNORE\s*)?TABLE\s+(\w+)\s+(ADD|DROP|CHANGE|MODIFY|RENAME)\s*(.*)$/is', $query, $r)) {
271
+        spip_log("$query incompris", 'pg.' . _LOG_ERREUR);
272
+    } else {
273
+        if ($r[1]) {
274
+            spip_log("j'ignore IGNORE dans $query", 'pg.' . _LOG_AVERTISSEMENT);
275
+        }
276
+        $f = 'spip_pg_alter_' . strtolower($r[3]);
277
+        if (function_exists($f)) {
278
+            $f($r[2], $r[4], $serveur, $requeter);
279
+        } else {
280
+            spip_log("$query non prevu", 'pg.' . _LOG_ERREUR);
281
+        }
282
+    }
283
+    // Alter a plusieurs args. Faudrait optimiser.
284
+    if ($todo) {
285
+        spip_pg_alter("TABLE $table " . join(',', $todo));
286
+    }
287 287
 }
288 288
 
289 289
 function spip_pg_alter_change($table, $arg, $serveur = '', $requeter = true) {
290
-	if (!preg_match('/^`?(\w+)`?\s+`?(\w+)`?\s+(.*?)\s*(DEFAULT .*?)?(NOT\s+NULL)?\s*(DEFAULT .*?)?$/i', $arg, $r)) {
291
-		spip_log("alter change: $arg  incompris", 'pg.' . _LOG_ERREUR);
292
-	} else {
293
-		[, $old, $new, $type, $default, $null, $def2] = $r;
294
-		$actions = ["ALTER $old TYPE " . mysql2pg_type($type)];
295
-		if ($null) {
296
-			$actions[] = "ALTER $old SET NOT NULL";
297
-		} else {
298
-			$actions[] = "ALTER $old DROP NOT NULL";
299
-		}
300
-
301
-		if ($d = ($default ?: $def2)) {
302
-			$actions[] = "ALTER $old SET $d";
303
-		} else {
304
-			$actions[] = "ALTER $old DROP DEFAULT";
305
-		}
306
-
307
-		spip_pg_query("ALTER TABLE $table " . join(', ', $actions));
308
-
309
-		if ($old != $new) {
310
-			spip_pg_query("ALTER TABLE $table RENAME $old TO $new", $serveur);
311
-		}
312
-	}
290
+    if (!preg_match('/^`?(\w+)`?\s+`?(\w+)`?\s+(.*?)\s*(DEFAULT .*?)?(NOT\s+NULL)?\s*(DEFAULT .*?)?$/i', $arg, $r)) {
291
+        spip_log("alter change: $arg  incompris", 'pg.' . _LOG_ERREUR);
292
+    } else {
293
+        [, $old, $new, $type, $default, $null, $def2] = $r;
294
+        $actions = ["ALTER $old TYPE " . mysql2pg_type($type)];
295
+        if ($null) {
296
+            $actions[] = "ALTER $old SET NOT NULL";
297
+        } else {
298
+            $actions[] = "ALTER $old DROP NOT NULL";
299
+        }
300
+
301
+        if ($d = ($default ?: $def2)) {
302
+            $actions[] = "ALTER $old SET $d";
303
+        } else {
304
+            $actions[] = "ALTER $old DROP DEFAULT";
305
+        }
306
+
307
+        spip_pg_query("ALTER TABLE $table " . join(', ', $actions));
308
+
309
+        if ($old != $new) {
310
+            spip_pg_query("ALTER TABLE $table RENAME $old TO $new", $serveur);
311
+        }
312
+    }
313 313
 }
314 314
 
315 315
 function spip_pg_alter_add($table, $arg, $serveur = '', $requeter = true) {
316
-	$nom_index = null;
317
-	if (!preg_match('/^(COLUMN|INDEX|KEY|PRIMARY\s+KEY|)\s*(.*)$/', $arg, $r)) {
318
-		spip_log("alter add $arg  incompris", 'pg.' . _LOG_ERREUR);
319
-
320
-		return null;
321
-	}
322
-	if (!$r[1] or $r[1] == 'COLUMN') {
323
-		preg_match('/`?(\w+)`?(.*)/', $r[2], $m);
324
-		if (preg_match('/^(.*)(BEFORE|AFTER|FIRST)(.*)$/is', $m[2], $n)) {
325
-			$m[2] = $n[1];
326
-		}
327
-
328
-		return spip_pg_query("ALTER TABLE $table ADD " . $m[1] . ' ' . mysql2pg_type($m[2]), $serveur, $requeter);
329
-	} elseif ($r[1][0] == 'P') {
330
-		// la primary peut etre sur plusieurs champs
331
-		$r[2] = trim(str_replace('`', '', $r[2]));
332
-		$m = ($r[2][0] == '(') ? substr($r[2], 1, -1) : $r[2];
333
-
334
-		return spip_pg_query(
335
-			"ALTER TABLE $table ADD CONSTRAINT $table" . '_pkey PRIMARY KEY (' . $m . ')',
336
-			$serveur,
337
-			$requeter
338
-		);
339
-	} else {
340
-		preg_match('/([^\s,]*)\s*(.*)?/', $r[2], $m);
341
-		// peut etre "(colonne)" ou "nom_index (colonnes)"
342
-		// bug potentiel si qqn met "(colonne, colonne)"
343
-		//
344
-		// nom_index (colonnes)
345
-		if ($m[2]) {
346
-			$colonnes = substr($m[2], 1, -1);
347
-			$nom_index = $m[1];
348
-		} else {
349
-			// (colonne)
350
-			if ($m[1][0] == '(') {
351
-				$colonnes = substr($m[1], 1, -1);
352
-				if (false !== strpos(',', $colonnes)) {
353
-					spip_log('PG : Erreur, impossible de creer un index sur plusieurs colonnes'
354
-						. " sans qu'il ait de nom ($table, ($colonnes))", 'pg.' . _LOG_ERREUR);
355
-				} else {
356
-					$nom_index = $colonnes;
357
-				}
358
-			} // nom_index
359
-			else {
360
-				$nom_index = $colonnes = $m[1];
361
-			}
362
-		}
363
-
364
-		return spip_pg_create_index($nom_index, $table, $colonnes, $serveur, $requeter);
365
-	}
316
+    $nom_index = null;
317
+    if (!preg_match('/^(COLUMN|INDEX|KEY|PRIMARY\s+KEY|)\s*(.*)$/', $arg, $r)) {
318
+        spip_log("alter add $arg  incompris", 'pg.' . _LOG_ERREUR);
319
+
320
+        return null;
321
+    }
322
+    if (!$r[1] or $r[1] == 'COLUMN') {
323
+        preg_match('/`?(\w+)`?(.*)/', $r[2], $m);
324
+        if (preg_match('/^(.*)(BEFORE|AFTER|FIRST)(.*)$/is', $m[2], $n)) {
325
+            $m[2] = $n[1];
326
+        }
327
+
328
+        return spip_pg_query("ALTER TABLE $table ADD " . $m[1] . ' ' . mysql2pg_type($m[2]), $serveur, $requeter);
329
+    } elseif ($r[1][0] == 'P') {
330
+        // la primary peut etre sur plusieurs champs
331
+        $r[2] = trim(str_replace('`', '', $r[2]));
332
+        $m = ($r[2][0] == '(') ? substr($r[2], 1, -1) : $r[2];
333
+
334
+        return spip_pg_query(
335
+            "ALTER TABLE $table ADD CONSTRAINT $table" . '_pkey PRIMARY KEY (' . $m . ')',
336
+            $serveur,
337
+            $requeter
338
+        );
339
+    } else {
340
+        preg_match('/([^\s,]*)\s*(.*)?/', $r[2], $m);
341
+        // peut etre "(colonne)" ou "nom_index (colonnes)"
342
+        // bug potentiel si qqn met "(colonne, colonne)"
343
+        //
344
+        // nom_index (colonnes)
345
+        if ($m[2]) {
346
+            $colonnes = substr($m[2], 1, -1);
347
+            $nom_index = $m[1];
348
+        } else {
349
+            // (colonne)
350
+            if ($m[1][0] == '(') {
351
+                $colonnes = substr($m[1], 1, -1);
352
+                if (false !== strpos(',', $colonnes)) {
353
+                    spip_log('PG : Erreur, impossible de creer un index sur plusieurs colonnes'
354
+                        . " sans qu'il ait de nom ($table, ($colonnes))", 'pg.' . _LOG_ERREUR);
355
+                } else {
356
+                    $nom_index = $colonnes;
357
+                }
358
+            } // nom_index
359
+            else {
360
+                $nom_index = $colonnes = $m[1];
361
+            }
362
+        }
363
+
364
+        return spip_pg_create_index($nom_index, $table, $colonnes, $serveur, $requeter);
365
+    }
366 366
 }
367 367
 
368 368
 function spip_pg_alter_drop($table, $arg, $serveur = '', $requeter = true) {
369
-	if (!preg_match('/^(COLUMN|INDEX|KEY|PRIMARY\s+KEY|)\s*`?(\w*)`?/', $arg, $r)) {
370
-		spip_log("alter drop: $arg  incompris", 'pg.' . _LOG_ERREUR);
371
-	} else {
372
-		if (!$r[1] or $r[1] == 'COLUMN') {
373
-			return spip_pg_query("ALTER TABLE $table DROP " . $r[2], $serveur);
374
-		} elseif ($r[1][0] == 'P') {
375
-			return spip_pg_query("ALTER TABLE $table DROP CONSTRAINT $table" . '_pkey', $serveur);
376
-		} else {
377
-			return spip_pg_query('DROP INDEX ' . $table . '_' . $r[2], $serveur);
378
-		}
379
-	}
369
+    if (!preg_match('/^(COLUMN|INDEX|KEY|PRIMARY\s+KEY|)\s*`?(\w*)`?/', $arg, $r)) {
370
+        spip_log("alter drop: $arg  incompris", 'pg.' . _LOG_ERREUR);
371
+    } else {
372
+        if (!$r[1] or $r[1] == 'COLUMN') {
373
+            return spip_pg_query("ALTER TABLE $table DROP " . $r[2], $serveur);
374
+        } elseif ($r[1][0] == 'P') {
375
+            return spip_pg_query("ALTER TABLE $table DROP CONSTRAINT $table" . '_pkey', $serveur);
376
+        } else {
377
+            return spip_pg_query('DROP INDEX ' . $table . '_' . $r[2], $serveur);
378
+        }
379
+    }
380 380
 }
381 381
 
382 382
 function spip_pg_alter_modify($table, $arg, $serveur = '', $requeter = true) {
383
-	if (!preg_match('/^`?(\w+)`?\s+(.*)$/', $arg, $r)) {
384
-		spip_log("alter modify: $arg  incompris", 'pg.' . _LOG_ERREUR);
385
-	} else {
386
-		return spip_pg_alter_change($table, $r[1] . ' ' . $arg, $serveur = '', $requeter = true);
387
-	}
383
+    if (!preg_match('/^`?(\w+)`?\s+(.*)$/', $arg, $r)) {
384
+        spip_log("alter modify: $arg  incompris", 'pg.' . _LOG_ERREUR);
385
+    } else {
386
+        return spip_pg_alter_change($table, $r[1] . ' ' . $arg, $serveur = '', $requeter = true);
387
+    }
388 388
 }
389 389
 
390 390
 // attention (en pg) :
@@ -392,17 +392,17 @@  discard block
 block discarded – undo
392 392
 // - alter table A rename X to Y = changer le nom de la colonne X en Y
393 393
 // pour l'instant, traiter simplement RENAME TO X
394 394
 function spip_pg_alter_rename($table, $arg, $serveur = '', $requeter = true) {
395
-	$rename = '';
396
-	// si TO, mais pas au debut
397
-	if (!stripos($arg, 'TO ')) {
398
-		$rename = $arg;
399
-	} elseif (preg_match('/^(TO)\s*`?(\w*)`?/', $arg, $r)) {
400
-		$rename = $r[2];
401
-	} else {
402
-		spip_log("alter rename: $arg  incompris", 'pg.' . _LOG_ERREUR);
403
-	}
404
-
405
-	return $rename ? spip_pg_query("ALTER TABLE $table RENAME TO $rename") : false;
395
+    $rename = '';
396
+    // si TO, mais pas au debut
397
+    if (!stripos($arg, 'TO ')) {
398
+        $rename = $arg;
399
+    } elseif (preg_match('/^(TO)\s*`?(\w*)`?/', $arg, $r)) {
400
+        $rename = $r[2];
401
+    } else {
402
+        spip_log("alter rename: $arg  incompris", 'pg.' . _LOG_ERREUR);
403
+    }
404
+
405
+    return $rename ? spip_pg_query("ALTER TABLE $table RENAME TO $rename") : false;
406 406
 }
407 407
 
408 408
 
@@ -418,59 +418,59 @@  discard block
 block discarded – undo
418 418
  * @return bool ou requete
419 419
  */
420 420
 function spip_pg_create_index($nom, $table, $champs, $serveur = '', $requeter = true) {
421
-	if (!($nom or $table or $champs)) {
422
-		spip_log(
423
-			"Champ manquant pour creer un index pg ($nom, $table, (" . @join(',', $champs) . '))',
424
-			'pg.' . _LOG_ERREUR
425
-		);
426
-
427
-		return false;
428
-	}
429
-
430
-	$nom = str_replace('`', '', $nom);
431
-	$champs = str_replace('`', '', $champs);
432
-
433
-	// PG ne differentie pas noms des index en fonction des tables
434
-	// il faut donc creer des noms uniques d'index pour une base pg
435
-	$nom = $table . '_' . $nom;
436
-	// enlever d'eventuelles parentheses deja presentes sur champs
437
-	if (!is_array($champs)) {
438
-		if ($champs[0] == '(') {
439
-			$champs = substr($champs, 1, -1);
440
-		}
441
-		$champs = [$champs];
442
-	}
443
-	$query = "CREATE INDEX $nom ON $table (" . join(',', $champs) . ')';
444
-	if (!$requeter) {
445
-		return $query;
446
-	}
447
-	$res = spip_pg_query($query, $serveur, $requeter);
448
-
449
-	return $res;
421
+    if (!($nom or $table or $champs)) {
422
+        spip_log(
423
+            "Champ manquant pour creer un index pg ($nom, $table, (" . @join(',', $champs) . '))',
424
+            'pg.' . _LOG_ERREUR
425
+        );
426
+
427
+        return false;
428
+    }
429
+
430
+    $nom = str_replace('`', '', $nom);
431
+    $champs = str_replace('`', '', $champs);
432
+
433
+    // PG ne differentie pas noms des index en fonction des tables
434
+    // il faut donc creer des noms uniques d'index pour une base pg
435
+    $nom = $table . '_' . $nom;
436
+    // enlever d'eventuelles parentheses deja presentes sur champs
437
+    if (!is_array($champs)) {
438
+        if ($champs[0] == '(') {
439
+            $champs = substr($champs, 1, -1);
440
+        }
441
+        $champs = [$champs];
442
+    }
443
+    $query = "CREATE INDEX $nom ON $table (" . join(',', $champs) . ')';
444
+    if (!$requeter) {
445
+        return $query;
446
+    }
447
+    $res = spip_pg_query($query, $serveur, $requeter);
448
+
449
+    return $res;
450 450
 }
451 451
 
452 452
 
453 453
 function spip_pg_explain($query, $serveur = '', $requeter = true) {
454
-	if (strpos(ltrim($query), 'SELECT') !== 0) {
455
-		return [];
456
-	}
457
-	$connexion = &$GLOBALS['connexions'][$serveur ? strtolower($serveur) : 0];
458
-	$prefixe = $connexion['prefixe'];
459
-	$link = $connexion['link'];
460
-	if (preg_match('/\s(SET|VALUES|WHERE)\s/i', $query, $regs)) {
461
-		$suite = strstr($query, (string) $regs[0]);
462
-		$query = substr($query, 0, -strlen($suite));
463
-	} else {
464
-		$suite = '';
465
-	}
466
-	$query = 'EXPLAIN ' . preg_replace('/([,\s])spip_/', '\1' . $prefixe . '_', $query) . $suite;
467
-
468
-	if (!$requeter) {
469
-		return $query;
470
-	}
471
-	$r = spip_pg_query_simple($link, $query);
472
-
473
-	return spip_pg_fetch($r, null, $serveur);
454
+    if (strpos(ltrim($query), 'SELECT') !== 0) {
455
+        return [];
456
+    }
457
+    $connexion = &$GLOBALS['connexions'][$serveur ? strtolower($serveur) : 0];
458
+    $prefixe = $connexion['prefixe'];
459
+    $link = $connexion['link'];
460
+    if (preg_match('/\s(SET|VALUES|WHERE)\s/i', $query, $regs)) {
461
+        $suite = strstr($query, (string) $regs[0]);
462
+        $query = substr($query, 0, -strlen($suite));
463
+    } else {
464
+        $suite = '';
465
+    }
466
+    $query = 'EXPLAIN ' . preg_replace('/([,\s])spip_/', '\1' . $prefixe . '_', $query) . $suite;
467
+
468
+    if (!$requeter) {
469
+        return $query;
470
+    }
471
+    $r = spip_pg_query_simple($link, $query);
472
+
473
+    return spip_pg_fetch($r, null, $serveur);
474 474
 }
475 475
 
476 476
 
@@ -489,92 +489,92 @@  discard block
 block discarded – undo
489 489
  *     - False en cas d'erreur.
490 490
  **/
491 491
 function spip_pg_selectdb($db, $serveur = '', $requeter = true) {
492
-	// se connecter a la base indiquee
493
-	// avec les identifiants connus
494
-	$index = $serveur ? strtolower($serveur) : 0;
495
-
496
-	if ($link = spip_connect_db('', '', '', '', $db, 'pg', '', '')) {
497
-		if (($db == $link['db']) && $GLOBALS['connexions'][$index] = $link) {
498
-			return $db;
499
-		}
500
-	} else {
501
-		return false;
502
-	}
492
+    // se connecter a la base indiquee
493
+    // avec les identifiants connus
494
+    $index = $serveur ? strtolower($serveur) : 0;
495
+
496
+    if ($link = spip_connect_db('', '', '', '', $db, 'pg', '', '')) {
497
+        if (($db == $link['db']) && $GLOBALS['connexions'][$index] = $link) {
498
+            return $db;
499
+        }
500
+    } else {
501
+        return false;
502
+    }
503 503
 }
504 504
 
505 505
 // Qu'une seule base pour le moment
506 506
 
507 507
 function spip_pg_listdbs($serveur) {
508
-	$connexion = &$GLOBALS['connexions'][$serveur ? strtolower($serveur) : 0];
509
-	$link = $connexion['link'];
510
-	$dbs = [];
511
-	$res = spip_pg_query_simple($link, 'select * From pg_database');
512
-	while ($row = pg_fetch_array($res, null, PGSQL_NUM)) {
513
-		$dbs[] = reset($row);
514
-	}
515
-
516
-	return $dbs;
508
+    $connexion = &$GLOBALS['connexions'][$serveur ? strtolower($serveur) : 0];
509
+    $link = $connexion['link'];
510
+    $dbs = [];
511
+    $res = spip_pg_query_simple($link, 'select * From pg_database');
512
+    while ($row = pg_fetch_array($res, null, PGSQL_NUM)) {
513
+        $dbs[] = reset($row);
514
+    }
515
+
516
+    return $dbs;
517 517
 }
518 518
 
519 519
 function spip_pg_select(
520
-	$select,
521
-	$from,
522
-	$where = '',
523
-	$groupby = [],
524
-	$orderby = '',
525
-	$limit = '',
526
-	$having = '',
527
-	$serveur = '',
528
-	$requeter = true
520
+    $select,
521
+    $from,
522
+    $where = '',
523
+    $groupby = [],
524
+    $orderby = '',
525
+    $limit = '',
526
+    $having = '',
527
+    $serveur = '',
528
+    $requeter = true
529 529
 ) {
530 530
 
531
-	$connexion = &$GLOBALS['connexions'][$serveur ? strtolower($serveur) : 0];
532
-	$prefixe = $connexion['prefixe'];
533
-	$link = $connexion['link'];
534
-	$db = $connexion['db'];
535
-
536
-	$limit = preg_match('/^\s*(([0-9]+),)?\s*([0-9]+)\s*$/', $limit, $limatch);
537
-	if ($limit) {
538
-		$offset = $limatch[2];
539
-		$count = $limatch[3];
540
-	}
541
-
542
-	$select = spip_pg_frommysql($select);
543
-
544
-	// si pas de tri explicitement demande, le GROUP BY ne
545
-	// contient que la clef primaire.
546
-	// lui ajouter alors le champ de tri par defaut
547
-	if (preg_match('/FIELD\(([a-z]+\.[a-z]+),/i', $orderby[0], $groupbyplus)) {
548
-		$groupby[] = $groupbyplus[1];
549
-	}
550
-
551
-	$orderby = spip_pg_orderby($orderby, $select);
552
-
553
-	if ($having) {
554
-		if (is_array($having)) {
555
-			$having = join("\n\tAND ", array_map('calculer_pg_where', $having));
556
-		}
557
-	}
558
-	$from = spip_pg_from($from, $prefixe);
559
-	$query = 'SELECT ' . $select
560
-		. (!$from ? '' : "\nFROM $from")
561
-		. (!$where ? '' : ("\nWHERE " . (!is_array($where) ? calculer_pg_where($where) : (join(
562
-			"\n\tAND ",
563
-			array_map('calculer_pg_where', $where)
564
-		)))))
565
-		. spip_pg_groupby($groupby, $from, $select)
566
-		. (!$having ? '' : "\nHAVING $having")
567
-		. ($orderby ? ("\nORDER BY $orderby") : '')
568
-		. (!$limit ? '' : (" LIMIT $count" . (!$offset ? '' : " OFFSET $offset")));
569
-
570
-	// renvoyer la requete inerte si demandee
571
-	if ($requeter === false) {
572
-		return $query;
573
-	}
574
-
575
-	$r = spip_pg_trace_query($query, $serveur);
576
-
577
-	return $r ?: $query;
531
+    $connexion = &$GLOBALS['connexions'][$serveur ? strtolower($serveur) : 0];
532
+    $prefixe = $connexion['prefixe'];
533
+    $link = $connexion['link'];
534
+    $db = $connexion['db'];
535
+
536
+    $limit = preg_match('/^\s*(([0-9]+),)?\s*([0-9]+)\s*$/', $limit, $limatch);
537
+    if ($limit) {
538
+        $offset = $limatch[2];
539
+        $count = $limatch[3];
540
+    }
541
+
542
+    $select = spip_pg_frommysql($select);
543
+
544
+    // si pas de tri explicitement demande, le GROUP BY ne
545
+    // contient que la clef primaire.
546
+    // lui ajouter alors le champ de tri par defaut
547
+    if (preg_match('/FIELD\(([a-z]+\.[a-z]+),/i', $orderby[0], $groupbyplus)) {
548
+        $groupby[] = $groupbyplus[1];
549
+    }
550
+
551
+    $orderby = spip_pg_orderby($orderby, $select);
552
+
553
+    if ($having) {
554
+        if (is_array($having)) {
555
+            $having = join("\n\tAND ", array_map('calculer_pg_where', $having));
556
+        }
557
+    }
558
+    $from = spip_pg_from($from, $prefixe);
559
+    $query = 'SELECT ' . $select
560
+        . (!$from ? '' : "\nFROM $from")
561
+        . (!$where ? '' : ("\nWHERE " . (!is_array($where) ? calculer_pg_where($where) : (join(
562
+            "\n\tAND ",
563
+            array_map('calculer_pg_where', $where)
564
+        )))))
565
+        . spip_pg_groupby($groupby, $from, $select)
566
+        . (!$having ? '' : "\nHAVING $having")
567
+        . ($orderby ? ("\nORDER BY $orderby") : '')
568
+        . (!$limit ? '' : (" LIMIT $count" . (!$offset ? '' : " OFFSET $offset")));
569
+
570
+    // renvoyer la requete inerte si demandee
571
+    if ($requeter === false) {
572
+        return $query;
573
+    }
574
+
575
+    $r = spip_pg_trace_query($query, $serveur);
576
+
577
+    return $r ?: $query;
578 578
 ;
579 579
 }
580 580
 
@@ -582,26 +582,26 @@  discard block
 block discarded – undo
582 582
 // car le reste de la requete utilise les alias (AS) systematiquement
583 583
 
584 584
 function spip_pg_from($from, $prefixe) {
585
-	if (is_array($from)) {
586
-		$from = spip_pg_select_as($from);
587
-	}
585
+    if (is_array($from)) {
586
+        $from = spip_pg_select_as($from);
587
+    }
588 588
 
589
-	return !$prefixe ? $from : preg_replace('/(\b)spip_/', '\1' . $prefixe . '_', $from);
589
+    return !$prefixe ? $from : preg_replace('/(\b)spip_/', '\1' . $prefixe . '_', $from);
590 590
 }
591 591
 
592 592
 function spip_pg_orderby($order, $select) {
593
-	$res = [];
594
-	$arg = (is_array($order) ? $order : preg_split('/\s*,\s*/', $order));
595
-
596
-	foreach ($arg as $v) {
597
-		if (preg_match('/(case\s+.*?else\s+0\s+end)\s*AS\s+' . $v . '/', $select, $m)) {
598
-			$res[] = $m[1];
599
-		} else {
600
-			$res[] = $v;
601
-		}
602
-	}
603
-
604
-	return spip_pg_frommysql(join(',', $res));
593
+    $res = [];
594
+    $arg = (is_array($order) ? $order : preg_split('/\s*,\s*/', $order));
595
+
596
+    foreach ($arg as $v) {
597
+        if (preg_match('/(case\s+.*?else\s+0\s+end)\s*AS\s+' . $v . '/', $select, $m)) {
598
+            $res[] = $m[1];
599
+        } else {
600
+            $res[] = $v;
601
+        }
602
+    }
603
+
604
+    return spip_pg_frommysql(join(',', $res));
605 605
 }
606 606
 
607 607
 // Conversion a l'arrach' des jointures MySQL en jointures PG
@@ -609,56 +609,56 @@  discard block
 block discarded – undo
609 609
 // et pour enlever les repetitions (sans incidence de perf, mais ca fait sale)
610 610
 
611 611
 function spip_pg_groupby($groupby, $from, $select) {
612
-	$join = strpos($from, ',');
613
-	// ismplifier avant de decouper
614
-	if (is_string($select)) { // fct SQL sur colonne et constante apostrophee ==> la colonne
615
-	$select = preg_replace('/\w+\(\s*([^(),\']*),\s*\'[^\']*\'[^)]*\)/', '\\1', $select);
616
-	}
617
-
618
-	if ($join or $groupby) {
619
-		$join = is_array($select) ? $select : explode(', ', $select);
620
-	}
621
-	if ($join) {
622
-		// enlever les 0 as points, '', ...
623
-		foreach ($join as $k => $v) {
624
-			$v = str_replace('DISTINCT ', '', $v);
625
-			// fct SQL sur colonne et constante apostrophee ==> la colonne
626
-			$v = preg_replace('/\w+\(\s*([^(),\']*),\s*\'[^\']*\'[^)]*\)/', '\\1', $v);
627
-			$v = preg_replace('/CAST\(\s*([^(),\' ]*\s+)as\s*\w+\)/', '\\1', $v);
628
-			// resultat d'agregat ne sont pas a mettre dans le groupby
629
-			$v = preg_replace('/(SUM|COUNT|MAX|MIN|UPPER)\([^)]+\)(\s*AS\s+\w+)\s*,?/i', '', $v);
630
-			// idem sans AS (fetch numerique)
631
-			$v = preg_replace('/(SUM|COUNT|MAX|MIN|UPPER)\([^)]+\)\s*,?/i', '', $v);
632
-			// des AS simples : on garde le cote droit du AS
633
-			$v = preg_replace('/^.*\sAS\s+(\w+)\s*$/i', '\\1', $v);
634
-			// ne reste plus que les vrais colonnes, ou des constantes a virer
635
-			if (preg_match(',^[\'"],', $v) or is_numeric($v)) {
636
-				unset($join[$k]);
637
-			} else {
638
-				$join[$k] = trim($v);
639
-			}
640
-		}
641
-		$join = array_diff($join, ['']);
642
-		$join = implode(',', $join);
643
-	}
644
-	if (is_array($groupby)) {
645
-		$groupby = join(',', $groupby);
646
-	}
647
-	if ($join) {
648
-		$groupby = $groupby ? "$groupby, $join" : $join;
649
-	}
650
-	if (!$groupby) {
651
-		return '';
652
-	}
653
-
654
-	$groupby = spip_pg_frommysql($groupby);
655
-	// Ne pas mettre dans le Group-By des valeurs numeriques
656
-	// issue de prepare_recherche
657
-	$groupby = preg_replace('/^\s*\d+\s+AS\s+\w+\s*,?\s*/i', '', $groupby);
658
-	$groupby = preg_replace('/,\s*\d+\s+AS\s+\w+\s*/i', '', $groupby);
659
-	$groupby = preg_replace('/\s+AS\s+\w+\s*/i', '', $groupby);
660
-
661
-	return "\nGROUP BY $groupby";
612
+    $join = strpos($from, ',');
613
+    // ismplifier avant de decouper
614
+    if (is_string($select)) { // fct SQL sur colonne et constante apostrophee ==> la colonne
615
+    $select = preg_replace('/\w+\(\s*([^(),\']*),\s*\'[^\']*\'[^)]*\)/', '\\1', $select);
616
+    }
617
+
618
+    if ($join or $groupby) {
619
+        $join = is_array($select) ? $select : explode(', ', $select);
620
+    }
621
+    if ($join) {
622
+        // enlever les 0 as points, '', ...
623
+        foreach ($join as $k => $v) {
624
+            $v = str_replace('DISTINCT ', '', $v);
625
+            // fct SQL sur colonne et constante apostrophee ==> la colonne
626
+            $v = preg_replace('/\w+\(\s*([^(),\']*),\s*\'[^\']*\'[^)]*\)/', '\\1', $v);
627
+            $v = preg_replace('/CAST\(\s*([^(),\' ]*\s+)as\s*\w+\)/', '\\1', $v);
628
+            // resultat d'agregat ne sont pas a mettre dans le groupby
629
+            $v = preg_replace('/(SUM|COUNT|MAX|MIN|UPPER)\([^)]+\)(\s*AS\s+\w+)\s*,?/i', '', $v);
630
+            // idem sans AS (fetch numerique)
631
+            $v = preg_replace('/(SUM|COUNT|MAX|MIN|UPPER)\([^)]+\)\s*,?/i', '', $v);
632
+            // des AS simples : on garde le cote droit du AS
633
+            $v = preg_replace('/^.*\sAS\s+(\w+)\s*$/i', '\\1', $v);
634
+            // ne reste plus que les vrais colonnes, ou des constantes a virer
635
+            if (preg_match(',^[\'"],', $v) or is_numeric($v)) {
636
+                unset($join[$k]);
637
+            } else {
638
+                $join[$k] = trim($v);
639
+            }
640
+        }
641
+        $join = array_diff($join, ['']);
642
+        $join = implode(',', $join);
643
+    }
644
+    if (is_array($groupby)) {
645
+        $groupby = join(',', $groupby);
646
+    }
647
+    if ($join) {
648
+        $groupby = $groupby ? "$groupby, $join" : $join;
649
+    }
650
+    if (!$groupby) {
651
+        return '';
652
+    }
653
+
654
+    $groupby = spip_pg_frommysql($groupby);
655
+    // Ne pas mettre dans le Group-By des valeurs numeriques
656
+    // issue de prepare_recherche
657
+    $groupby = preg_replace('/^\s*\d+\s+AS\s+\w+\s*,?\s*/i', '', $groupby);
658
+    $groupby = preg_replace('/,\s*\d+\s+AS\s+\w+\s*/i', '', $groupby);
659
+    $groupby = preg_replace('/\s+AS\s+\w+\s*/i', '', $groupby);
660
+
661
+    return "\nGROUP BY $groupby";
662 662
 }
663 663
 
664 664
 // Conversion des operateurs MySQL en PG
@@ -669,492 +669,492 @@  discard block
 block discarded – undo
669 669
 // A ameliorer.
670 670
 
671 671
 function spip_pg_frommysql($arg) {
672
-	if (is_array($arg)) {
673
-		$arg = join(', ', $arg);
674
-	}
675
-
676
-	$res = spip_pg_fromfield($arg);
677
-
678
-	$res = preg_replace('/\brand[(][)]/i', 'random()', $res);
679
-
680
-	$res = preg_replace(
681
-		'/\b0\.0[+]([a-zA-Z0-9_.]+)\s*/',
682
-		'CAST(substring(\1, \'^ *[0-9.]+\') as float)',
683
-		$res
684
-	);
685
-	$res = preg_replace(
686
-		'/\b0[+]([a-zA-Z0-9_.]+)\s*/',
687
-		'CAST(substring(\1, \'^ *[0-9]+\') as int)',
688
-		$res
689
-	);
690
-	$res = preg_replace(
691
-		'/\bconv[(]([^,]*)[^)]*[)]/i',
692
-		'CAST(substring(\1, \'^ *[0-9]+\') as int)',
693
-		$res
694
-	);
695
-
696
-	$res = preg_replace(
697
-		'/UNIX_TIMESTAMP\s*[(]\s*[)]/',
698
-		' EXTRACT(epoch FROM NOW())',
699
-		$res
700
-	);
701
-
702
-	// la fonction md5(integer) n'est pas connu en pg
703
-	// il faut donc forcer les types en text (cas de md5(id_article))
704
-	$res = preg_replace(
705
-		'/md5\s*[(]([^)]*)[)]/i',
706
-		'MD5(CAST(\1 AS text))',
707
-		$res
708
-	);
709
-
710
-	$res = preg_replace(
711
-		'/UNIX_TIMESTAMP\s*[(]([^)]*)[)]/',
712
-		' EXTRACT(epoch FROM \1)',
713
-		$res
714
-	);
715
-
716
-	$res = preg_replace(
717
-		'/\bDAYOFMONTH\s*[(]([^()]*([(][^()]*[)][^()]*)*[^)]*)[)]/',
718
-		' EXTRACT(day FROM \1)',
719
-		$res
720
-	);
721
-
722
-	$res = preg_replace(
723
-		'/\bMONTH\s*[(]([^()]*([(][^)]*[)][^()]*)*[^)]*)[)]/',
724
-		' EXTRACT(month FROM \1)',
725
-		$res
726
-	);
727
-
728
-	$res = preg_replace(
729
-		'/\bYEAR\s*[(]([^()]*([(][^)]*[)][^()]*)*[^)]*)[)]/',
730
-		' EXTRACT(year FROM \1)',
731
-		$res
732
-	);
733
-
734
-	$res = preg_replace(
735
-		'/TO_DAYS\s*[(]([^()]*([(][^)]*[)][()]*)*)[)]/',
736
-		' EXTRACT(day FROM \1 - \'0001-01-01\')',
737
-		$res
738
-	);
739
-
740
-	$res = preg_replace('/(EXTRACT[(][^ ]* FROM *)"([^"]*)"/', '\1\'\2\'', $res);
741
-
742
-	$res = preg_replace('/DATE_FORMAT\s*[(]([^,]*),\s*\'%Y%m%d\'[)]/', 'to_char(\1, \'YYYYMMDD\')', $res);
743
-
744
-	$res = preg_replace('/DATE_FORMAT\s*[(]([^,]*),\s*\'%Y%m\'[)]/', 'to_char(\1, \'YYYYMM\')', $res);
745
-
746
-	$res = preg_replace('/DATE_SUB\s*[(]([^,]*),/', '(\1 -', $res);
747
-	$res = preg_replace('/DATE_ADD\s*[(]([^,]*),/', '(\1 +', $res);
748
-	$res = preg_replace('/INTERVAL\s+(\d+\s+\w+)/', 'INTERVAL \'\1\'', $res);
749
-	$res = preg_replace('/([+<>-]=?)\s*(\'\d+-\d+-\d+\s+\d+:\d+(:\d+)\')/', '\1 timestamp \2', $res);
750
-	$res = preg_replace('/(\'\d+-\d+-\d+\s+\d+:\d+:\d+\')\s*([+<>-]=?)/', 'timestamp \1 \2', $res);
751
-
752
-	$res = preg_replace('/([+<>-]=?)\s*(\'\d+-\d+-\d+\')/', '\1 timestamp \2', $res);
753
-	$res = preg_replace('/(\'\d+-\d+-\d+\')\s*([+<>-]=?)/', 'timestamp \1 \2', $res);
754
-
755
-	$res = preg_replace('/(timestamp .\d+)-00-/', '\1-01-', $res);
756
-	$res = preg_replace('/(timestamp .\d+-\d+)-00/', '\1-01', $res);
672
+    if (is_array($arg)) {
673
+        $arg = join(', ', $arg);
674
+    }
675
+
676
+    $res = spip_pg_fromfield($arg);
677
+
678
+    $res = preg_replace('/\brand[(][)]/i', 'random()', $res);
679
+
680
+    $res = preg_replace(
681
+        '/\b0\.0[+]([a-zA-Z0-9_.]+)\s*/',
682
+        'CAST(substring(\1, \'^ *[0-9.]+\') as float)',
683
+        $res
684
+    );
685
+    $res = preg_replace(
686
+        '/\b0[+]([a-zA-Z0-9_.]+)\s*/',
687
+        'CAST(substring(\1, \'^ *[0-9]+\') as int)',
688
+        $res
689
+    );
690
+    $res = preg_replace(
691
+        '/\bconv[(]([^,]*)[^)]*[)]/i',
692
+        'CAST(substring(\1, \'^ *[0-9]+\') as int)',
693
+        $res
694
+    );
695
+
696
+    $res = preg_replace(
697
+        '/UNIX_TIMESTAMP\s*[(]\s*[)]/',
698
+        ' EXTRACT(epoch FROM NOW())',
699
+        $res
700
+    );
701
+
702
+    // la fonction md5(integer) n'est pas connu en pg
703
+    // il faut donc forcer les types en text (cas de md5(id_article))
704
+    $res = preg_replace(
705
+        '/md5\s*[(]([^)]*)[)]/i',
706
+        'MD5(CAST(\1 AS text))',
707
+        $res
708
+    );
709
+
710
+    $res = preg_replace(
711
+        '/UNIX_TIMESTAMP\s*[(]([^)]*)[)]/',
712
+        ' EXTRACT(epoch FROM \1)',
713
+        $res
714
+    );
715
+
716
+    $res = preg_replace(
717
+        '/\bDAYOFMONTH\s*[(]([^()]*([(][^()]*[)][^()]*)*[^)]*)[)]/',
718
+        ' EXTRACT(day FROM \1)',
719
+        $res
720
+    );
721
+
722
+    $res = preg_replace(
723
+        '/\bMONTH\s*[(]([^()]*([(][^)]*[)][^()]*)*[^)]*)[)]/',
724
+        ' EXTRACT(month FROM \1)',
725
+        $res
726
+    );
727
+
728
+    $res = preg_replace(
729
+        '/\bYEAR\s*[(]([^()]*([(][^)]*[)][^()]*)*[^)]*)[)]/',
730
+        ' EXTRACT(year FROM \1)',
731
+        $res
732
+    );
733
+
734
+    $res = preg_replace(
735
+        '/TO_DAYS\s*[(]([^()]*([(][^)]*[)][()]*)*)[)]/',
736
+        ' EXTRACT(day FROM \1 - \'0001-01-01\')',
737
+        $res
738
+    );
739
+
740
+    $res = preg_replace('/(EXTRACT[(][^ ]* FROM *)"([^"]*)"/', '\1\'\2\'', $res);
741
+
742
+    $res = preg_replace('/DATE_FORMAT\s*[(]([^,]*),\s*\'%Y%m%d\'[)]/', 'to_char(\1, \'YYYYMMDD\')', $res);
743
+
744
+    $res = preg_replace('/DATE_FORMAT\s*[(]([^,]*),\s*\'%Y%m\'[)]/', 'to_char(\1, \'YYYYMM\')', $res);
745
+
746
+    $res = preg_replace('/DATE_SUB\s*[(]([^,]*),/', '(\1 -', $res);
747
+    $res = preg_replace('/DATE_ADD\s*[(]([^,]*),/', '(\1 +', $res);
748
+    $res = preg_replace('/INTERVAL\s+(\d+\s+\w+)/', 'INTERVAL \'\1\'', $res);
749
+    $res = preg_replace('/([+<>-]=?)\s*(\'\d+-\d+-\d+\s+\d+:\d+(:\d+)\')/', '\1 timestamp \2', $res);
750
+    $res = preg_replace('/(\'\d+-\d+-\d+\s+\d+:\d+:\d+\')\s*([+<>-]=?)/', 'timestamp \1 \2', $res);
751
+
752
+    $res = preg_replace('/([+<>-]=?)\s*(\'\d+-\d+-\d+\')/', '\1 timestamp \2', $res);
753
+    $res = preg_replace('/(\'\d+-\d+-\d+\')\s*([+<>-]=?)/', 'timestamp \1 \2', $res);
754
+
755
+    $res = preg_replace('/(timestamp .\d+)-00-/', '\1-01-', $res);
756
+    $res = preg_replace('/(timestamp .\d+-\d+)-00/', '\1-01', $res);
757 757
 # correct en theorie mais produit des debordements arithmetiques
758 758
 #	$res = preg_replace("/(EXTRACT[(][^ ]* FROM *)(timestamp *'[^']*' *[+-] *timestamp *'[^']*') *[)]/", '\2', $res);
759
-	$res = preg_replace("/(EXTRACT[(][^ ]* FROM *)('[^']*')/", '\1 timestamp \2', $res);
760
-	$res = preg_replace('/\sLIKE\s+/', ' ILIKE ', $res);
759
+    $res = preg_replace("/(EXTRACT[(][^ ]* FROM *)('[^']*')/", '\1 timestamp \2', $res);
760
+    $res = preg_replace('/\sLIKE\s+/', ' ILIKE ', $res);
761 761
 
762
-	return str_replace('REGEXP', '~', $res);
762
+    return str_replace('REGEXP', '~', $res);
763 763
 }
764 764
 
765 765
 function spip_pg_fromfield($arg) {
766
-	while (preg_match('/^(.*?)FIELD\s*\(([^,]*)((,[^,)]*)*)\)/', $arg, $m)) {
767
-		preg_match_all('/,([^,]*)/', $m[3], $r, PREG_PATTERN_ORDER);
768
-		$res = '';
769
-		$n = 0;
770
-		$index = $m[2];
771
-		foreach ($r[1] as $v) {
772
-			$n++;
773
-			$res .= "\nwhen $index=$v then $n";
774
-		}
775
-		$arg = $m[1] . "case $res else 0 end "
776
-			. substr($arg, strlen($m[0]));
777
-	}
778
-
779
-	return $arg;
766
+    while (preg_match('/^(.*?)FIELD\s*\(([^,]*)((,[^,)]*)*)\)/', $arg, $m)) {
767
+        preg_match_all('/,([^,]*)/', $m[3], $r, PREG_PATTERN_ORDER);
768
+        $res = '';
769
+        $n = 0;
770
+        $index = $m[2];
771
+        foreach ($r[1] as $v) {
772
+            $n++;
773
+            $res .= "\nwhen $index=$v then $n";
774
+        }
775
+        $arg = $m[1] . "case $res else 0 end "
776
+            . substr($arg, strlen($m[0]));
777
+    }
778
+
779
+    return $arg;
780 780
 }
781 781
 
782 782
 function calculer_pg_where($v) {
783
-	if (!is_array($v)) {
784
-		return spip_pg_frommysql($v);
785
-	}
786
-
787
-	$op = str_replace('REGEXP', '~', array_shift($v));
788
-	if (!($n = count($v))) {
789
-		return $op;
790
-	} else {
791
-		$arg = calculer_pg_where(array_shift($v));
792
-		if ($n == 1) {
793
-			return "$op($arg)";
794
-		} else {
795
-			$arg2 = calculer_pg_where(array_shift($v));
796
-			if ($n == 2) {
797
-				return "($arg $op $arg2)";
798
-			} else {
799
-				return "($arg $op ($arg2) : $v[0])";
800
-			}
801
-		}
802
-	}
783
+    if (!is_array($v)) {
784
+        return spip_pg_frommysql($v);
785
+    }
786
+
787
+    $op = str_replace('REGEXP', '~', array_shift($v));
788
+    if (!($n = count($v))) {
789
+        return $op;
790
+    } else {
791
+        $arg = calculer_pg_where(array_shift($v));
792
+        if ($n == 1) {
793
+            return "$op($arg)";
794
+        } else {
795
+            $arg2 = calculer_pg_where(array_shift($v));
796
+            if ($n == 2) {
797
+                return "($arg $op $arg2)";
798
+            } else {
799
+                return "($arg $op ($arg2) : $v[0])";
800
+            }
801
+        }
802
+    }
803 803
 }
804 804
 
805 805
 
806 806
 function calculer_pg_expression($expression, $v, $join = 'AND') {
807
-	if (empty($v)) {
808
-		return '';
809
-	}
807
+    if (empty($v)) {
808
+        return '';
809
+    }
810 810
 
811
-	$exp = "\n$expression ";
811
+    $exp = "\n$expression ";
812 812
 
813
-	if (!is_array($v)) {
814
-		$v = [$v];
815
-	}
813
+    if (!is_array($v)) {
814
+        $v = [$v];
815
+    }
816 816
 
817
-	if (strtoupper($join) === 'AND') {
818
-		return $exp . join("\n\t$join ", array_map('calculer_pg_where', $v));
819
-	} else {
820
-		return $exp . join($join, $v);
821
-	}
817
+    if (strtoupper($join) === 'AND') {
818
+        return $exp . join("\n\t$join ", array_map('calculer_pg_where', $v));
819
+    } else {
820
+        return $exp . join($join, $v);
821
+    }
822 822
 }
823 823
 
824 824
 function spip_pg_select_as($args) {
825
-	$argsas = '';
826
-	foreach ($args as $k => $v) {
827
-		if (substr($k, -1) == '@') {
828
-			// c'est une jointure qui se refere au from precedent
829
-			// pas de virgule
830
-			$argsas .= '  ' . $v;
831
-		} else {
832
-			$as = '';
833
-			//  spip_log("$k : $v", _LOG_DEBUG);
834
-			if (!is_numeric($k)) {
835
-				if (preg_match('/\.(.*)$/', $k, $r)) {
836
-					$v = $k;
837
-				} elseif ($v != $k) {
838
-					$p = strpos($v, ' ');
839
-					if ($p) {
840
-						$v = substr($v, 0, $p) . " AS $k" . substr($v, $p);
841
-					} else {
842
-						$as = " AS $k";
843
-					}
844
-				}
845
-			}
846
-			// spip_log("subs $k : $v avec $as", _LOG_DEBUG);
847
-			// if (strpos($v, 'JOIN') === false)  $argsas .= ', ';
848
-			$argsas .= ', ' . $v . $as;
849
-		}
850
-	}
851
-
852
-	return substr($argsas, 2);
825
+    $argsas = '';
826
+    foreach ($args as $k => $v) {
827
+        if (substr($k, -1) == '@') {
828
+            // c'est une jointure qui se refere au from precedent
829
+            // pas de virgule
830
+            $argsas .= '  ' . $v;
831
+        } else {
832
+            $as = '';
833
+            //  spip_log("$k : $v", _LOG_DEBUG);
834
+            if (!is_numeric($k)) {
835
+                if (preg_match('/\.(.*)$/', $k, $r)) {
836
+                    $v = $k;
837
+                } elseif ($v != $k) {
838
+                    $p = strpos($v, ' ');
839
+                    if ($p) {
840
+                        $v = substr($v, 0, $p) . " AS $k" . substr($v, $p);
841
+                    } else {
842
+                        $as = " AS $k";
843
+                    }
844
+                }
845
+            }
846
+            // spip_log("subs $k : $v avec $as", _LOG_DEBUG);
847
+            // if (strpos($v, 'JOIN') === false)  $argsas .= ', ';
848
+            $argsas .= ', ' . $v . $as;
849
+        }
850
+    }
851
+
852
+    return substr($argsas, 2);
853 853
 }
854 854
 
855 855
 function spip_pg_fetch($res, $t = '', $serveur = '', $requeter = true) {
856 856
 
857
-	if ($res) {
858
-		$res = pg_fetch_array($res, null, PGSQL_ASSOC);
859
-	}
857
+    if ($res) {
858
+        $res = pg_fetch_array($res, null, PGSQL_ASSOC);
859
+    }
860 860
 
861
-	return $res;
861
+    return $res;
862 862
 }
863 863
 
864 864
 function spip_pg_seek($r, $row_number, $serveur = '', $requeter = true) {
865
-	if ($r) {
866
-		return pg_result_seek($r, $row_number);
867
-	}
865
+    if ($r) {
866
+        return pg_result_seek($r, $row_number);
867
+    }
868 868
 }
869 869
 
870 870
 
871 871
 function spip_pg_countsel(
872
-	$from = [],
873
-	$where = [],
874
-	$groupby = [],
875
-	$having = [],
876
-	$serveur = '',
877
-	$requeter = true
872
+    $from = [],
873
+    $where = [],
874
+    $groupby = [],
875
+    $having = [],
876
+    $serveur = '',
877
+    $requeter = true
878 878
 ) {
879
-	$c = !$groupby ? '*' : ('DISTINCT ' . (is_string($groupby) ? $groupby : join(',', $groupby)));
880
-	$r = spip_pg_select("COUNT($c)", $from, $where, '', '', '', $having, $serveur, $requeter);
881
-	if (!$requeter) {
882
-		return $r;
883
-	}
884
-	if (!is_resource($r)) {
885
-		return 0;
886
-	}
887
-	[$c] = pg_fetch_array($r, null, PGSQL_NUM);
888
-
889
-	return $c;
879
+    $c = !$groupby ? '*' : ('DISTINCT ' . (is_string($groupby) ? $groupby : join(',', $groupby)));
880
+    $r = spip_pg_select("COUNT($c)", $from, $where, '', '', '', $having, $serveur, $requeter);
881
+    if (!$requeter) {
882
+        return $r;
883
+    }
884
+    if (!is_resource($r)) {
885
+        return 0;
886
+    }
887
+    [$c] = pg_fetch_array($r, null, PGSQL_NUM);
888
+
889
+    return $c;
890 890
 }
891 891
 
892 892
 function spip_pg_count($res, $serveur = '', $requeter = true) {
893
-	return !$res ? 0 : pg_numrows($res);
893
+    return !$res ? 0 : pg_numrows($res);
894 894
 }
895 895
 
896 896
 function spip_pg_free($res, $serveur = '', $requeter = true) {
897
-	// rien a faire en postgres
897
+    // rien a faire en postgres
898 898
 }
899 899
 
900 900
 function spip_pg_delete($table, $where = '', $serveur = '', $requeter = true) {
901 901
 
902
-	$connexion = &$GLOBALS['connexions'][$serveur ? strtolower($serveur) : 0];
903
-	$table = prefixer_table_spip($table, $connexion['prefixe']);
902
+    $connexion = &$GLOBALS['connexions'][$serveur ? strtolower($serveur) : 0];
903
+    $table = prefixer_table_spip($table, $connexion['prefixe']);
904 904
 
905
-	$query = calculer_pg_expression('DELETE FROM', $table, ',')
906
-		. calculer_pg_expression('WHERE', $where, 'AND');
905
+    $query = calculer_pg_expression('DELETE FROM', $table, ',')
906
+        . calculer_pg_expression('WHERE', $where, 'AND');
907 907
 
908
-	// renvoyer la requete inerte si demandee
909
-	if (!$requeter) {
910
-		return $query;
911
-	}
908
+    // renvoyer la requete inerte si demandee
909
+    if (!$requeter) {
910
+        return $query;
911
+    }
912 912
 
913
-	$res = spip_pg_trace_query($query, $serveur);
914
-	if ($res) {
915
-		return pg_affected_rows($res);
916
-	} else {
917
-		return false;
918
-	}
913
+    $res = spip_pg_trace_query($query, $serveur);
914
+    if ($res) {
915
+        return pg_affected_rows($res);
916
+    } else {
917
+        return false;
918
+    }
919 919
 }
920 920
 
921 921
 function spip_pg_insert($table, $champs, $valeurs, $desc = [], $serveur = '', $requeter = true) {
922
-	$connexion = &$GLOBALS['connexions'][$serveur ? strtolower($serveur) : 0];
923
-	$prefixe = $connexion['prefixe'];
924
-	$link = $connexion['link'];
925
-
926
-	if (!$desc) {
927
-		$desc = description_table($table, $serveur);
928
-	}
929
-	$seq = spip_pg_sequence($table, true);
930
-	// si pas de cle primaire dans l'insertion, renvoyer curval
931
-	if (!preg_match(",\b$seq\b,", $champs)) {
932
-		$seq = spip_pg_sequence($table);
933
-		$seq = prefixer_table_spip($seq, $prefixe);
934
-		$seq = "currval('$seq')";
935
-	}
936
-
937
-	$table = prefixer_table_spip($table, $prefixe);
938
-	$ret = !$seq ? '' : (" RETURNING $seq");
939
-	$ins = (strlen($champs) < 3)
940
-		? ' DEFAULT VALUES'
941
-		: "$champs VALUES $valeurs";
942
-	$q = "INSERT INTO $table $ins $ret";
943
-	if (!$requeter) {
944
-		return $q;
945
-	}
946
-	$connexion['last'] = $q;
947
-	$r = spip_pg_query_simple($link, $q);
922
+    $connexion = &$GLOBALS['connexions'][$serveur ? strtolower($serveur) : 0];
923
+    $prefixe = $connexion['prefixe'];
924
+    $link = $connexion['link'];
925
+
926
+    if (!$desc) {
927
+        $desc = description_table($table, $serveur);
928
+    }
929
+    $seq = spip_pg_sequence($table, true);
930
+    // si pas de cle primaire dans l'insertion, renvoyer curval
931
+    if (!preg_match(",\b$seq\b,", $champs)) {
932
+        $seq = spip_pg_sequence($table);
933
+        $seq = prefixer_table_spip($seq, $prefixe);
934
+        $seq = "currval('$seq')";
935
+    }
936
+
937
+    $table = prefixer_table_spip($table, $prefixe);
938
+    $ret = !$seq ? '' : (" RETURNING $seq");
939
+    $ins = (strlen($champs) < 3)
940
+        ? ' DEFAULT VALUES'
941
+        : "$champs VALUES $valeurs";
942
+    $q = "INSERT INTO $table $ins $ret";
943
+    if (!$requeter) {
944
+        return $q;
945
+    }
946
+    $connexion['last'] = $q;
947
+    $r = spip_pg_query_simple($link, $q);
948 948
 #	spip_log($q,'pg.'._LOG_DEBUG);
949
-	if ($r) {
950
-		if (!$ret) {
951
-			return 0;
952
-		}
953
-		if ($r2 = pg_fetch_array($r, null, PGSQL_NUM)) {
954
-			return $r2[0];
955
-		}
956
-	}
957
-
958
-	return false;
949
+    if ($r) {
950
+        if (!$ret) {
951
+            return 0;
952
+        }
953
+        if ($r2 = pg_fetch_array($r, null, PGSQL_NUM)) {
954
+            return $r2[0];
955
+        }
956
+    }
957
+
958
+    return false;
959 959
 }
960 960
 
961 961
 function spip_pg_insertq($table, $couples = [], $desc = [], $serveur = '', $requeter = true) {
962 962
 
963
-	if (!$desc) {
964
-		$desc = description_table($table, $serveur);
965
-	}
966
-	if (!$desc) {
967
-		die("$table insertion sans description");
968
-	}
969
-	$fields = $desc['field'];
970
-
971
-	foreach ($couples as $champ => $val) {
972
-		$couples[$champ] = spip_pg_cite($val, $fields[$champ]);
973
-	}
974
-
975
-	// recherche de champs 'timestamp' pour mise a jour auto de ceux-ci
976
-	$couples = spip_pg_ajouter_champs_timestamp($table, $couples, $desc, $serveur);
977
-
978
-	return spip_pg_insert(
979
-		$table,
980
-		'(' . join(',', array_keys($couples)) . ')',
981
-		'(' . join(',', $couples) . ')',
982
-		$desc,
983
-		$serveur,
984
-		$requeter
985
-	);
963
+    if (!$desc) {
964
+        $desc = description_table($table, $serveur);
965
+    }
966
+    if (!$desc) {
967
+        die("$table insertion sans description");
968
+    }
969
+    $fields = $desc['field'];
970
+
971
+    foreach ($couples as $champ => $val) {
972
+        $couples[$champ] = spip_pg_cite($val, $fields[$champ]);
973
+    }
974
+
975
+    // recherche de champs 'timestamp' pour mise a jour auto de ceux-ci
976
+    $couples = spip_pg_ajouter_champs_timestamp($table, $couples, $desc, $serveur);
977
+
978
+    return spip_pg_insert(
979
+        $table,
980
+        '(' . join(',', array_keys($couples)) . ')',
981
+        '(' . join(',', $couples) . ')',
982
+        $desc,
983
+        $serveur,
984
+        $requeter
985
+    );
986 986
 }
987 987
 
988 988
 
989 989
 function spip_pg_insertq_multi($table, $tab_couples = [], $desc = [], $serveur = '', $requeter = true) {
990 990
 
991
-	if (!$desc) {
992
-		$desc = description_table($table, $serveur);
993
-	}
994
-	if (!$desc) {
995
-		die("$table insertion sans description");
996
-	}
997
-	$fields = $desc['field'] ?? [];
998
-
999
-	// recherche de champs 'timestamp' pour mise a jour auto de ceux-ci
1000
-	// une premiere fois pour ajouter maj dans les cles
1001
-	$c = $tab_couples[0] ?? [];
1002
-	$les_cles = spip_pg_ajouter_champs_timestamp($table, $c, $desc, $serveur);
1003
-
1004
-	$cles = '(' . join(',', array_keys($les_cles)) . ')';
1005
-	$valeurs = [];
1006
-	foreach ($tab_couples as $couples) {
1007
-		foreach ($couples as $champ => $val) {
1008
-			$couples[$champ] = spip_pg_cite($val, $fields[$champ]);
1009
-		}
1010
-		// recherche de champs 'timestamp' pour mise a jour auto de ceux-ci
1011
-		$couples = spip_pg_ajouter_champs_timestamp($table, $couples, $desc, $serveur);
1012
-
1013
-		$valeurs[] = '(' . join(',', $couples) . ')';
1014
-	}
1015
-	$valeurs = implode(', ', $valeurs);
1016
-
1017
-	return spip_pg_insert($table, $cles, $valeurs, $desc, $serveur, $requeter);
991
+    if (!$desc) {
992
+        $desc = description_table($table, $serveur);
993
+    }
994
+    if (!$desc) {
995
+        die("$table insertion sans description");
996
+    }
997
+    $fields = $desc['field'] ?? [];
998
+
999
+    // recherche de champs 'timestamp' pour mise a jour auto de ceux-ci
1000
+    // une premiere fois pour ajouter maj dans les cles
1001
+    $c = $tab_couples[0] ?? [];
1002
+    $les_cles = spip_pg_ajouter_champs_timestamp($table, $c, $desc, $serveur);
1003
+
1004
+    $cles = '(' . join(',', array_keys($les_cles)) . ')';
1005
+    $valeurs = [];
1006
+    foreach ($tab_couples as $couples) {
1007
+        foreach ($couples as $champ => $val) {
1008
+            $couples[$champ] = spip_pg_cite($val, $fields[$champ]);
1009
+        }
1010
+        // recherche de champs 'timestamp' pour mise a jour auto de ceux-ci
1011
+        $couples = spip_pg_ajouter_champs_timestamp($table, $couples, $desc, $serveur);
1012
+
1013
+        $valeurs[] = '(' . join(',', $couples) . ')';
1014
+    }
1015
+    $valeurs = implode(', ', $valeurs);
1016
+
1017
+    return spip_pg_insert($table, $cles, $valeurs, $desc, $serveur, $requeter);
1018 1018
 }
1019 1019
 
1020 1020
 
1021 1021
 function spip_pg_update($table, $couples, $where = '', $desc = '', $serveur = '', $requeter = true) {
1022 1022
 
1023
-	if (!$couples) {
1024
-		return;
1025
-	}
1026
-	$connexion = $GLOBALS['connexions'][$serveur ? strtolower($serveur) : 0];
1027
-	$table = prefixer_table_spip($table, $connexion['prefixe']);
1023
+    if (!$couples) {
1024
+        return;
1025
+    }
1026
+    $connexion = $GLOBALS['connexions'][$serveur ? strtolower($serveur) : 0];
1027
+    $table = prefixer_table_spip($table, $connexion['prefixe']);
1028 1028
 
1029
-	// recherche de champs 'timestamp' pour mise a jour auto de ceux-ci
1030
-	$couples = spip_pg_ajouter_champs_timestamp($table, $couples, $desc, $serveur);
1029
+    // recherche de champs 'timestamp' pour mise a jour auto de ceux-ci
1030
+    $couples = spip_pg_ajouter_champs_timestamp($table, $couples, $desc, $serveur);
1031 1031
 
1032
-	$set = [];
1033
-	foreach ($couples as $champ => $val) {
1034
-		$set[] = $champ . '=' . $val;
1035
-	}
1032
+    $set = [];
1033
+    foreach ($couples as $champ => $val) {
1034
+        $set[] = $champ . '=' . $val;
1035
+    }
1036 1036
 
1037
-	$query = calculer_pg_expression('UPDATE', $table, ',')
1038
-		. calculer_pg_expression('SET', $set, ',')
1039
-		. calculer_pg_expression('WHERE', $where, 'AND');
1037
+    $query = calculer_pg_expression('UPDATE', $table, ',')
1038
+        . calculer_pg_expression('SET', $set, ',')
1039
+        . calculer_pg_expression('WHERE', $where, 'AND');
1040 1040
 
1041
-	// renvoyer la requete inerte si demandee
1042
-	if (!$requeter) {
1043
-		return $query;
1044
-	}
1041
+    // renvoyer la requete inerte si demandee
1042
+    if (!$requeter) {
1043
+        return $query;
1044
+    }
1045 1045
 
1046
-	return spip_pg_trace_query($query, $serveur);
1046
+    return spip_pg_trace_query($query, $serveur);
1047 1047
 }
1048 1048
 
1049 1049
 // idem, mais les valeurs sont des constantes a mettre entre apostrophes
1050 1050
 // sauf les expressions de date lorsqu'il s'agit de fonctions SQL (NOW etc)
1051 1051
 function spip_pg_updateq($table, $couples, $where = '', $desc = [], $serveur = '', $requeter = true) {
1052
-	if (!$couples) {
1053
-		return;
1054
-	}
1055
-	if (!$desc) {
1056
-		$desc = description_table($table, $serveur);
1057
-	}
1058
-	$fields = $desc['field'];
1059
-	foreach ($couples as $k => $val) {
1060
-		$couples[$k] = spip_pg_cite($val, $fields[$k]);
1061
-	}
1062
-
1063
-	return spip_pg_update($table, $couples, $where, $desc, $serveur, $requeter);
1052
+    if (!$couples) {
1053
+        return;
1054
+    }
1055
+    if (!$desc) {
1056
+        $desc = description_table($table, $serveur);
1057
+    }
1058
+    $fields = $desc['field'];
1059
+    foreach ($couples as $k => $val) {
1060
+        $couples[$k] = spip_pg_cite($val, $fields[$k]);
1061
+    }
1062
+
1063
+    return spip_pg_update($table, $couples, $where, $desc, $serveur, $requeter);
1064 1064
 }
1065 1065
 
1066 1066
 
1067 1067
 function spip_pg_replace($table, $values, $desc, $serveur = '', $requeter = true) {
1068
-	if (!$values) {
1069
-		spip_log("replace vide $table", 'pg.' . _LOG_AVERTISSEMENT);
1070
-
1071
-		return 0;
1072
-	}
1073
-	$connexion = &$GLOBALS['connexions'][$serveur ? strtolower($serveur) : 0];
1074
-	$prefixe = $connexion['prefixe'];
1075
-	$link = $connexion['link'];
1076
-
1077
-	if (!$desc) {
1078
-		$desc = description_table($table, $serveur);
1079
-	}
1080
-	if (!$desc) {
1081
-		die("$table insertion sans description");
1082
-	}
1083
-	$prim = $desc['key']['PRIMARY KEY'];
1084
-	$ids = preg_split('/,\s*/', $prim);
1085
-	$noprims = $prims = [];
1086
-	foreach ($values as $k => $v) {
1087
-		$values[$k] = $v = spip_pg_cite($v, $desc['field'][$k]);
1088
-
1089
-		if (!in_array($k, $ids)) {
1090
-			$noprims[$k] = "$k=$v";
1091
-		} else {
1092
-			$prims[$k] = "$k=$v";
1093
-		}
1094
-	}
1095
-
1096
-	// recherche de champs 'timestamp' pour mise a jour auto de ceux-ci
1097
-	$values = spip_pg_ajouter_champs_timestamp($table, $values, $desc, $serveur);
1098
-
1099
-	$where = join(' AND ', $prims);
1100
-	if (!$where) {
1101
-		return spip_pg_insert(
1102
-			$table,
1103
-			'(' . join(',', array_keys($values)) . ')',
1104
-			'(' . join(',', $values) . ')',
1105
-			$desc,
1106
-			$serveur
1107
-		);
1108
-	}
1109
-	$couples = join(',', $noprims);
1110
-
1111
-	$seq = spip_pg_sequence($table);
1112
-	$table = prefixer_table_spip($table, $prefixe);
1113
-	$seq = prefixer_table_spip($seq, $prefixe);
1114
-
1115
-	$connexion['last'] = $q = "UPDATE $table SET $couples WHERE $where";
1116
-	if ($couples) {
1117
-		$couples = spip_pg_query_simple($link, $q);
1068
+    if (!$values) {
1069
+        spip_log("replace vide $table", 'pg.' . _LOG_AVERTISSEMENT);
1070
+
1071
+        return 0;
1072
+    }
1073
+    $connexion = &$GLOBALS['connexions'][$serveur ? strtolower($serveur) : 0];
1074
+    $prefixe = $connexion['prefixe'];
1075
+    $link = $connexion['link'];
1076
+
1077
+    if (!$desc) {
1078
+        $desc = description_table($table, $serveur);
1079
+    }
1080
+    if (!$desc) {
1081
+        die("$table insertion sans description");
1082
+    }
1083
+    $prim = $desc['key']['PRIMARY KEY'];
1084
+    $ids = preg_split('/,\s*/', $prim);
1085
+    $noprims = $prims = [];
1086
+    foreach ($values as $k => $v) {
1087
+        $values[$k] = $v = spip_pg_cite($v, $desc['field'][$k]);
1088
+
1089
+        if (!in_array($k, $ids)) {
1090
+            $noprims[$k] = "$k=$v";
1091
+        } else {
1092
+            $prims[$k] = "$k=$v";
1093
+        }
1094
+    }
1095
+
1096
+    // recherche de champs 'timestamp' pour mise a jour auto de ceux-ci
1097
+    $values = spip_pg_ajouter_champs_timestamp($table, $values, $desc, $serveur);
1098
+
1099
+    $where = join(' AND ', $prims);
1100
+    if (!$where) {
1101
+        return spip_pg_insert(
1102
+            $table,
1103
+            '(' . join(',', array_keys($values)) . ')',
1104
+            '(' . join(',', $values) . ')',
1105
+            $desc,
1106
+            $serveur
1107
+        );
1108
+    }
1109
+    $couples = join(',', $noprims);
1110
+
1111
+    $seq = spip_pg_sequence($table);
1112
+    $table = prefixer_table_spip($table, $prefixe);
1113
+    $seq = prefixer_table_spip($seq, $prefixe);
1114
+
1115
+    $connexion['last'] = $q = "UPDATE $table SET $couples WHERE $where";
1116
+    if ($couples) {
1117
+        $couples = spip_pg_query_simple($link, $q);
1118 1118
 #	  spip_log($q,'pg.'._LOG_DEBUG);
1119
-		if (!$couples) {
1120
-			return false;
1121
-		}
1122
-		$couples = pg_affected_rows($couples);
1123
-	}
1124
-	if (!$couples) {
1125
-		$ret = !$seq ? '' :
1126
-			(" RETURNING nextval('$seq') < $prim");
1127
-		$connexion['last'] = $q = "INSERT INTO $table (" . join(',', array_keys($values)) . ') VALUES (' . join(
1128
-			',',
1129
-			$values
1130
-		) . ")$ret";
1131
-		$couples = spip_pg_query_simple($link, $q);
1132
-		if (!$couples) {
1133
-			return false;
1134
-		} elseif ($ret) {
1135
-			$r = pg_fetch_array($couples, null, PGSQL_NUM);
1136
-			if ($r[0]) {
1137
-				$connexion['last'] = $q = "SELECT setval('$seq', $prim) from $table";
1138
-				// Le code de SPIP met parfois la sequence a 0 (dans l'import)
1139
-				// MySQL n'en dit rien, on fait pareil pour PG
1140
-				$r = @pg_query($link, $q);
1141
-			}
1142
-		}
1143
-	}
1144
-
1145
-	return $couples;
1119
+        if (!$couples) {
1120
+            return false;
1121
+        }
1122
+        $couples = pg_affected_rows($couples);
1123
+    }
1124
+    if (!$couples) {
1125
+        $ret = !$seq ? '' :
1126
+            (" RETURNING nextval('$seq') < $prim");
1127
+        $connexion['last'] = $q = "INSERT INTO $table (" . join(',', array_keys($values)) . ') VALUES (' . join(
1128
+            ',',
1129
+            $values
1130
+        ) . ")$ret";
1131
+        $couples = spip_pg_query_simple($link, $q);
1132
+        if (!$couples) {
1133
+            return false;
1134
+        } elseif ($ret) {
1135
+            $r = pg_fetch_array($couples, null, PGSQL_NUM);
1136
+            if ($r[0]) {
1137
+                $connexion['last'] = $q = "SELECT setval('$seq', $prim) from $table";
1138
+                // Le code de SPIP met parfois la sequence a 0 (dans l'import)
1139
+                // MySQL n'en dit rien, on fait pareil pour PG
1140
+                $r = @pg_query($link, $q);
1141
+            }
1142
+        }
1143
+    }
1144
+
1145
+    return $couples;
1146 1146
 }
1147 1147
 
1148 1148
 
1149 1149
 function spip_pg_replace_multi($table, $tab_couples, $desc = [], $serveur = '', $requeter = true) {
1150
-	$retour = null;
1151
-	// boucler pour traiter chaque requete independemment
1152
-	foreach ($tab_couples as $couples) {
1153
-		$retour = spip_pg_replace($table, $couples, $desc, $serveur, $requeter);
1154
-	}
1155
-
1156
-	// renvoie le dernier id
1157
-	return $retour;
1150
+    $retour = null;
1151
+    // boucler pour traiter chaque requete independemment
1152
+    foreach ($tab_couples as $couples) {
1153
+        $retour = spip_pg_replace($table, $couples, $desc, $serveur, $requeter);
1154
+    }
1155
+
1156
+    // renvoie le dernier id
1157
+    return $retour;
1158 1158
 }
1159 1159
 
1160 1160
 
@@ -1163,149 +1163,149 @@  discard block
 block discarded – undo
1163 1163
 
1164 1164
 function spip_pg_sequence($table, $raw = false) {
1165 1165
 
1166
-	include_spip('base/serial');
1167
-	if (!isset($GLOBALS['tables_principales'][$table])) {
1168
-		return false;
1169
-	}
1170
-	$desc = $GLOBALS['tables_principales'][$table];
1171
-	$prim = @$desc['key']['PRIMARY KEY'];
1172
-	if (
1173
-		!preg_match('/^\w+$/', $prim)
1174
-		or strpos($desc['field'][$prim], 'int') === false
1175
-	) {
1176
-		return '';
1177
-	} else {
1178
-		return $raw ? $prim : $table . '_' . $prim . '_seq';
1179
-	}
1166
+    include_spip('base/serial');
1167
+    if (!isset($GLOBALS['tables_principales'][$table])) {
1168
+        return false;
1169
+    }
1170
+    $desc = $GLOBALS['tables_principales'][$table];
1171
+    $prim = @$desc['key']['PRIMARY KEY'];
1172
+    if (
1173
+        !preg_match('/^\w+$/', $prim)
1174
+        or strpos($desc['field'][$prim], 'int') === false
1175
+    ) {
1176
+        return '';
1177
+    } else {
1178
+        return $raw ? $prim : $table . '_' . $prim . '_seq';
1179
+    }
1180 1180
 }
1181 1181
 
1182 1182
 // Explicite les conversions de Mysql d'une valeur $v de type $t
1183 1183
 // Dans le cas d'un champ date, pas d'apostrophe, c'est une syntaxe ad hoc
1184 1184
 
1185 1185
 function spip_pg_cite($v, $t) {
1186
-	if (is_null($v)) {
1187
-		return 'NULL';
1188
-	} // null php se traduit en NULL SQL
1189
-
1190
-	if (sql_test_date($t)) {
1191
-		if ($v and (strpos('0123456789', (string) $v[0]) === false)) {
1192
-			return spip_pg_frommysql($v);
1193
-		} else {
1194
-			if (strncmp($v, '0000', 4) == 0) {
1195
-				$v = '0001' . substr($v, 4);
1196
-			}
1197
-			if (strpos($v, '-00-00') === 4) {
1198
-				$v = substr($v, 0, 4) . '-01-01' . substr($v, 10);
1199
-			}
1200
-
1201
-			return "timestamp '$v'";
1202
-		}
1203
-	} elseif (!sql_test_int($t)) {
1204
-		return ("'" . pg_escape_string($v) . "'");
1205
-	} elseif (is_numeric($v) or (strpos($v, 'CAST(') === 0)) {
1206
-		return $v;
1207
-	} elseif ($v[0] == '0' and $v[1] !== 'x' and ctype_xdigit(substr($v, 1))) {
1208
-		return substr($v, 1);
1209
-	} else {
1210
-		spip_log("Warning: '$v'  n'est pas de type $t", 'pg.' . _LOG_AVERTISSEMENT);
1211
-
1212
-		return intval($v);
1213
-	}
1186
+    if (is_null($v)) {
1187
+        return 'NULL';
1188
+    } // null php se traduit en NULL SQL
1189
+
1190
+    if (sql_test_date($t)) {
1191
+        if ($v and (strpos('0123456789', (string) $v[0]) === false)) {
1192
+            return spip_pg_frommysql($v);
1193
+        } else {
1194
+            if (strncmp($v, '0000', 4) == 0) {
1195
+                $v = '0001' . substr($v, 4);
1196
+            }
1197
+            if (strpos($v, '-00-00') === 4) {
1198
+                $v = substr($v, 0, 4) . '-01-01' . substr($v, 10);
1199
+            }
1200
+
1201
+            return "timestamp '$v'";
1202
+        }
1203
+    } elseif (!sql_test_int($t)) {
1204
+        return ("'" . pg_escape_string($v) . "'");
1205
+    } elseif (is_numeric($v) or (strpos($v, 'CAST(') === 0)) {
1206
+        return $v;
1207
+    } elseif ($v[0] == '0' and $v[1] !== 'x' and ctype_xdigit(substr($v, 1))) {
1208
+        return substr($v, 1);
1209
+    } else {
1210
+        spip_log("Warning: '$v'  n'est pas de type $t", 'pg.' . _LOG_AVERTISSEMENT);
1211
+
1212
+        return intval($v);
1213
+    }
1214 1214
 }
1215 1215
 
1216 1216
 function spip_pg_hex($v) {
1217
-	return "CAST(x'" . $v . "' as bigint)";
1217
+    return "CAST(x'" . $v . "' as bigint)";
1218 1218
 }
1219 1219
 
1220 1220
 function spip_pg_quote($v, $type = '') {
1221
-	if (!is_array($v)) {
1222
-		return spip_pg_cite($v, $type);
1223
-	}
1224
-	// si c'est un tableau, le parcourir en propageant le type
1225
-	foreach ($v as $k => $r) {
1226
-		$v[$k] = spip_pg_quote($r, $type);
1227
-	}
1228
-
1229
-	return join(',', $v);
1221
+    if (!is_array($v)) {
1222
+        return spip_pg_cite($v, $type);
1223
+    }
1224
+    // si c'est un tableau, le parcourir en propageant le type
1225
+    foreach ($v as $k => $r) {
1226
+        $v[$k] = spip_pg_quote($r, $type);
1227
+    }
1228
+
1229
+    return join(',', $v);
1230 1230
 }
1231 1231
 
1232 1232
 function spip_pg_date_proche($champ, $interval, $unite) {
1233
-	return '('
1234
-	. $champ
1235
-	. (($interval <= 0) ? '>' : '<')
1236
-	. (($interval <= 0) ? 'DATE_SUB' : 'DATE_ADD')
1237
-	. '('
1238
-	. sql_quote(date('Y-m-d H:i:s'))
1239
-	. ', INTERVAL '
1240
-	. (($interval > 0) ? $interval : (0 - $interval))
1241
-	. ' '
1242
-	. $unite
1243
-	. '))';
1233
+    return '('
1234
+    . $champ
1235
+    . (($interval <= 0) ? '>' : '<')
1236
+    . (($interval <= 0) ? 'DATE_SUB' : 'DATE_ADD')
1237
+    . '('
1238
+    . sql_quote(date('Y-m-d H:i:s'))
1239
+    . ', INTERVAL '
1240
+    . (($interval > 0) ? $interval : (0 - $interval))
1241
+    . ' '
1242
+    . $unite
1243
+    . '))';
1244 1244
 }
1245 1245
 
1246 1246
 function spip_pg_in($val, $valeurs, $not = '', $serveur = '') {
1247 1247
 //
1248 1248
 // IN (...) souvent limite a 255  elements, d'ou cette fonction assistante
1249 1249
 //
1250
-	// s'il n'y a pas de valeur, eviter de produire un IN vide: PG rale.
1251
-	if (!$valeurs) {
1252
-		return $not ? '0=0' : '0=1';
1253
-	}
1254
-	if (strpos($valeurs, "CAST(x'") !== false) {
1255
-		return "($val=" . join("OR $val=", explode(',', $valeurs)) . ')';
1256
-	}
1257
-	$n = $i = 0;
1258
-	$in_sql = '';
1259
-	while ($n = strpos($valeurs, ',', $n + 1)) {
1260
-		if ((++$i) >= 255) {
1261
-			$in_sql .= "($val $not IN (" .
1262
-				substr($valeurs, 0, $n) .
1263
-				"))\n" .
1264
-				($not ? "AND\t" : "OR\t");
1265
-			$valeurs = substr($valeurs, $n + 1);
1266
-			$i = $n = 0;
1267
-		}
1268
-	}
1269
-	$in_sql .= "($val $not IN ($valeurs))";
1270
-
1271
-	return "($in_sql)";
1250
+    // s'il n'y a pas de valeur, eviter de produire un IN vide: PG rale.
1251
+    if (!$valeurs) {
1252
+        return $not ? '0=0' : '0=1';
1253
+    }
1254
+    if (strpos($valeurs, "CAST(x'") !== false) {
1255
+        return "($val=" . join("OR $val=", explode(',', $valeurs)) . ')';
1256
+    }
1257
+    $n = $i = 0;
1258
+    $in_sql = '';
1259
+    while ($n = strpos($valeurs, ',', $n + 1)) {
1260
+        if ((++$i) >= 255) {
1261
+            $in_sql .= "($val $not IN (" .
1262
+                substr($valeurs, 0, $n) .
1263
+                "))\n" .
1264
+                ($not ? "AND\t" : "OR\t");
1265
+            $valeurs = substr($valeurs, $n + 1);
1266
+            $i = $n = 0;
1267
+        }
1268
+    }
1269
+    $in_sql .= "($val $not IN ($valeurs))";
1270
+
1271
+    return "($in_sql)";
1272 1272
 }
1273 1273
 
1274 1274
 function spip_pg_error($query = '', $serveur = '', $requeter = true) {
1275
-	$link = $GLOBALS['connexions'][$serveur ? strtolower($serveur) : 0]['link'];
1276
-	$s = $link ? pg_last_error($link) : pg_last_error();
1277
-	if ($s) {
1278
-		$s = str_replace('ERROR', 'errcode: 1000 ', $s);
1279
-		spip_log("$s - $query", 'pg.' . _LOG_ERREUR);
1280
-	}
1281
-
1282
-	return $s;
1275
+    $link = $GLOBALS['connexions'][$serveur ? strtolower($serveur) : 0]['link'];
1276
+    $s = $link ? pg_last_error($link) : pg_last_error();
1277
+    if ($s) {
1278
+        $s = str_replace('ERROR', 'errcode: 1000 ', $s);
1279
+        spip_log("$s - $query", 'pg.' . _LOG_ERREUR);
1280
+    }
1281
+
1282
+    return $s;
1283 1283
 }
1284 1284
 
1285 1285
 function spip_pg_errno($serveur = '') {
1286
-	// il faudrait avoir la derniere ressource retournee et utiliser
1287
-	// http://fr2.php.net/manual/fr/function.pg-result-error.php
1288
-	return 0;
1286
+    // il faudrait avoir la derniere ressource retournee et utiliser
1287
+    // http://fr2.php.net/manual/fr/function.pg-result-error.php
1288
+    return 0;
1289 1289
 }
1290 1290
 
1291 1291
 function spip_pg_drop_table($table, $exist = '', $serveur = '', $requeter = true) {
1292
-	if ($exist) {
1293
-		$exist = ' IF EXISTS';
1294
-	}
1295
-	if (spip_pg_query("DROP TABLE$exist $table", $serveur, $requeter)) {
1296
-		return true;
1297
-	} else {
1298
-		return false;
1299
-	}
1292
+    if ($exist) {
1293
+        $exist = ' IF EXISTS';
1294
+    }
1295
+    if (spip_pg_query("DROP TABLE$exist $table", $serveur, $requeter)) {
1296
+        return true;
1297
+    } else {
1298
+        return false;
1299
+    }
1300 1300
 }
1301 1301
 
1302 1302
 // supprime une vue
1303 1303
 function spip_pg_drop_view($view, $exist = '', $serveur = '', $requeter = true) {
1304
-	if ($exist) {
1305
-		$exist = ' IF EXISTS';
1306
-	}
1304
+    if ($exist) {
1305
+        $exist = ' IF EXISTS';
1306
+    }
1307 1307
 
1308
-	return spip_pg_query("DROP VIEW$exist $view", $serveur, $requeter);
1308
+    return spip_pg_query("DROP VIEW$exist $view", $serveur, $requeter);
1309 1309
 }
1310 1310
 
1311 1311
 /**
@@ -1322,40 +1322,40 @@  discard block
 block discarded – undo
1322 1322
  *     Ressource à utiliser avec sql_fetch()
1323 1323
  **/
1324 1324
 function spip_pg_showbase($match, $serveur = '', $requeter = true) {
1325
-	$connexion = &$GLOBALS['connexions'][$serveur ? strtolower($serveur) : 0];
1326
-	$link = $connexion['link'];
1327
-	$connexion['last'] = $q = 'SELECT tablename FROM pg_tables WHERE tablename ILIKE ' . _q($match);
1325
+    $connexion = &$GLOBALS['connexions'][$serveur ? strtolower($serveur) : 0];
1326
+    $link = $connexion['link'];
1327
+    $connexion['last'] = $q = 'SELECT tablename FROM pg_tables WHERE tablename ILIKE ' . _q($match);
1328 1328
 
1329
-	return spip_pg_query_simple($link, $q);
1329
+    return spip_pg_query_simple($link, $q);
1330 1330
 }
1331 1331
 
1332 1332
 function spip_pg_showtable($nom_table, $serveur = '', $requeter = true) {
1333
-	$connexion = &$GLOBALS['connexions'][$serveur ? strtolower($serveur) : 0];
1334
-	$link = $connexion['link'];
1335
-	$connexion['last'] = $q = 'SELECT column_name, column_default, data_type FROM information_schema.columns WHERE table_name ILIKE ' . _q($nom_table);
1336
-
1337
-	$res = spip_pg_query_simple($link, $q);
1338
-	if (!$res) {
1339
-		return false;
1340
-	}
1341
-
1342
-	// etrangement, $res peut ne rien contenir, mais arriver ici...
1343
-	// il faut en tenir compte dans le return
1344
-	$fields = [];
1345
-	while ($field = pg_fetch_array($res, null, PGSQL_NUM)) {
1346
-		$fields[$field[0]] = $field[2] . (!$field[1] ? '' : (' DEFAULT ' . $field[1]));
1347
-	}
1348
-	$connexion['last'] = $q = 'SELECT indexdef FROM pg_indexes WHERE tablename ILIKE ' . _q($nom_table);
1349
-	$res = spip_pg_query_simple($link, $q);
1350
-	$keys = [];
1351
-	while ($index = pg_fetch_array($res, null, PGSQL_NUM)) {
1352
-		if (preg_match('/CREATE\s+(UNIQUE\s+)?INDEX\s([^\s]+).*\((.*)\)$/', $index[0], $r)) {
1353
-			$nom = str_replace($nom_table . '_', '', $r[2]);
1354
-			$keys[($r[1] ? 'PRIMARY KEY' : ('KEY ' . $nom))] = $r[3];
1355
-		}
1356
-	}
1357
-
1358
-	return count($fields) ? ['field' => $fields, 'key' => $keys] : false;
1333
+    $connexion = &$GLOBALS['connexions'][$serveur ? strtolower($serveur) : 0];
1334
+    $link = $connexion['link'];
1335
+    $connexion['last'] = $q = 'SELECT column_name, column_default, data_type FROM information_schema.columns WHERE table_name ILIKE ' . _q($nom_table);
1336
+
1337
+    $res = spip_pg_query_simple($link, $q);
1338
+    if (!$res) {
1339
+        return false;
1340
+    }
1341
+
1342
+    // etrangement, $res peut ne rien contenir, mais arriver ici...
1343
+    // il faut en tenir compte dans le return
1344
+    $fields = [];
1345
+    while ($field = pg_fetch_array($res, null, PGSQL_NUM)) {
1346
+        $fields[$field[0]] = $field[2] . (!$field[1] ? '' : (' DEFAULT ' . $field[1]));
1347
+    }
1348
+    $connexion['last'] = $q = 'SELECT indexdef FROM pg_indexes WHERE tablename ILIKE ' . _q($nom_table);
1349
+    $res = spip_pg_query_simple($link, $q);
1350
+    $keys = [];
1351
+    while ($index = pg_fetch_array($res, null, PGSQL_NUM)) {
1352
+        if (preg_match('/CREATE\s+(UNIQUE\s+)?INDEX\s([^\s]+).*\((.*)\)$/', $index[0], $r)) {
1353
+            $nom = str_replace($nom_table . '_', '', $r[2]);
1354
+            $keys[($r[1] ? 'PRIMARY KEY' : ('KEY ' . $nom))] = $r[3];
1355
+        }
1356
+    }
1357
+
1358
+    return count($fields) ? ['field' => $fields, 'key' => $keys] : false;
1359 1359
 }
1360 1360
 
1361 1361
 // Fonction de creation d'une table SQL nommee $nom
@@ -1366,116 +1366,116 @@  discard block
 block discarded – undo
1366 1366
 // Le nom des index est prefixe par celui de la table pour eviter les conflits
1367 1367
 function spip_pg_create($nom, $champs, $cles, $autoinc = false, $temporary = false, $serveur = '', $requeter = true) {
1368 1368
 
1369
-	$connexion = $GLOBALS['connexions'][$serveur ? strtolower($serveur) : 0];
1370
-	$link = $connexion['link'];
1371
-	$nom = prefixer_table_spip($nom, $connexion['prefixe']);
1372
-
1373
-	$query = $prim = $prim_name = $v = $s = $p = '';
1374
-	$keys = [];
1375
-
1376
-	// certains plugins declarent les tables  (permet leur inclusion dans le dump)
1377
-	// sans les renseigner (laisse le compilo recuperer la description)
1378
-	if (!is_array($champs) || !is_array($cles)) {
1379
-		return;
1380
-	}
1381
-
1382
-	foreach ($cles as $k => $v) {
1383
-		if (strpos($k, 'KEY ') === 0) {
1384
-			$n = str_replace('`', '', $k);
1385
-			$v = str_replace('`', '"', $v);
1386
-			$i = $nom . preg_replace('/KEY +/', '_', $n);
1387
-			if ($k != $n) {
1388
-				$i = "\"$i\"";
1389
-			}
1390
-			$keys[] = "CREATE INDEX $i ON $nom ($v);";
1391
-		} elseif (strpos($k, 'UNIQUE ') === 0) {
1392
-			$k = preg_replace('/^UNIQUE +/', '', $k);
1393
-			$prim .= "$s\n\t\tCONSTRAINT " . str_replace('`', '"', $k) . " UNIQUE ($v)";
1394
-		} else {
1395
-			$prim .= "$s\n\t\t" . str_replace('`', '"', $k) . " ($v)";
1396
-		}
1397
-		if ($k == 'PRIMARY KEY') {
1398
-			$prim_name = $v;
1399
-		}
1400
-		$s = ',';
1401
-	}
1402
-	$s = '';
1403
-
1404
-	$character_set = '';
1405
-	if (@$GLOBALS['meta']['charset_sql_base']) {
1406
-		$character_set .= ' CHARACTER SET ' . $GLOBALS['meta']['charset_sql_base'];
1407
-	}
1408
-	if (@$GLOBALS['meta']['charset_collation_sql_base']) {
1409
-		$character_set .= ' COLLATE ' . $GLOBALS['meta']['charset_collation_sql_base'];
1410
-	}
1411
-
1412
-	foreach ($champs as $k => $v) {
1413
-		$k = str_replace('`', '"', $k);
1414
-		if (preg_match(',([a-z]*\s*(\(\s*[0-9]*\s*\))?(\s*binary)?),i', $v, $defs)) {
1415
-			if (preg_match(',(char|text),i', $defs[1]) and !preg_match(',binary,i', $defs[1])) {
1416
-				$v = $defs[1] . $character_set . ' ' . substr($v, strlen($defs[1]));
1417
-			}
1418
-		}
1419
-
1420
-		$query .= "$s\n\t\t$k "
1421
-			. (($autoinc && ($prim_name == $k) && preg_match(',\b(big|small|medium|tiny)?int\b,i', $v))
1422
-				? ' bigserial'
1423
-				: mysql2pg_type($v)
1424
-			);
1425
-		$s = ',';
1426
-	}
1427
-	$temporary = $temporary ? 'TEMPORARY' : '';
1428
-
1429
-	// En l'absence de "if not exists" en PG, on neutralise les erreurs
1430
-
1431
-	$q = "CREATE $temporary TABLE $nom ($query" . ($prim ? ",$prim" : '') . ')' .
1432
-		($character_set ? " DEFAULT $character_set" : '')
1433
-		. "\n";
1434
-
1435
-	if (!$requeter) {
1436
-		return $q;
1437
-	}
1438
-	$connexion['last'] = $q;
1439
-	$r = @pg_query($link, $q);
1440
-
1441
-	if (!$r) {
1442
-		spip_log("Impossible de creer cette table: $q", 'pg.' . _LOG_ERREUR);
1443
-	} else {
1444
-		foreach ($keys as $index) {
1445
-			pg_query($link, $index);
1446
-		}
1447
-	}
1448
-
1449
-	return $r;
1369
+    $connexion = $GLOBALS['connexions'][$serveur ? strtolower($serveur) : 0];
1370
+    $link = $connexion['link'];
1371
+    $nom = prefixer_table_spip($nom, $connexion['prefixe']);
1372
+
1373
+    $query = $prim = $prim_name = $v = $s = $p = '';
1374
+    $keys = [];
1375
+
1376
+    // certains plugins declarent les tables  (permet leur inclusion dans le dump)
1377
+    // sans les renseigner (laisse le compilo recuperer la description)
1378
+    if (!is_array($champs) || !is_array($cles)) {
1379
+        return;
1380
+    }
1381
+
1382
+    foreach ($cles as $k => $v) {
1383
+        if (strpos($k, 'KEY ') === 0) {
1384
+            $n = str_replace('`', '', $k);
1385
+            $v = str_replace('`', '"', $v);
1386
+            $i = $nom . preg_replace('/KEY +/', '_', $n);
1387
+            if ($k != $n) {
1388
+                $i = "\"$i\"";
1389
+            }
1390
+            $keys[] = "CREATE INDEX $i ON $nom ($v);";
1391
+        } elseif (strpos($k, 'UNIQUE ') === 0) {
1392
+            $k = preg_replace('/^UNIQUE +/', '', $k);
1393
+            $prim .= "$s\n\t\tCONSTRAINT " . str_replace('`', '"', $k) . " UNIQUE ($v)";
1394
+        } else {
1395
+            $prim .= "$s\n\t\t" . str_replace('`', '"', $k) . " ($v)";
1396
+        }
1397
+        if ($k == 'PRIMARY KEY') {
1398
+            $prim_name = $v;
1399
+        }
1400
+        $s = ',';
1401
+    }
1402
+    $s = '';
1403
+
1404
+    $character_set = '';
1405
+    if (@$GLOBALS['meta']['charset_sql_base']) {
1406
+        $character_set .= ' CHARACTER SET ' . $GLOBALS['meta']['charset_sql_base'];
1407
+    }
1408
+    if (@$GLOBALS['meta']['charset_collation_sql_base']) {
1409
+        $character_set .= ' COLLATE ' . $GLOBALS['meta']['charset_collation_sql_base'];
1410
+    }
1411
+
1412
+    foreach ($champs as $k => $v) {
1413
+        $k = str_replace('`', '"', $k);
1414
+        if (preg_match(',([a-z]*\s*(\(\s*[0-9]*\s*\))?(\s*binary)?),i', $v, $defs)) {
1415
+            if (preg_match(',(char|text),i', $defs[1]) and !preg_match(',binary,i', $defs[1])) {
1416
+                $v = $defs[1] . $character_set . ' ' . substr($v, strlen($defs[1]));
1417
+            }
1418
+        }
1419
+
1420
+        $query .= "$s\n\t\t$k "
1421
+            . (($autoinc && ($prim_name == $k) && preg_match(',\b(big|small|medium|tiny)?int\b,i', $v))
1422
+                ? ' bigserial'
1423
+                : mysql2pg_type($v)
1424
+            );
1425
+        $s = ',';
1426
+    }
1427
+    $temporary = $temporary ? 'TEMPORARY' : '';
1428
+
1429
+    // En l'absence de "if not exists" en PG, on neutralise les erreurs
1430
+
1431
+    $q = "CREATE $temporary TABLE $nom ($query" . ($prim ? ",$prim" : '') . ')' .
1432
+        ($character_set ? " DEFAULT $character_set" : '')
1433
+        . "\n";
1434
+
1435
+    if (!$requeter) {
1436
+        return $q;
1437
+    }
1438
+    $connexion['last'] = $q;
1439
+    $r = @pg_query($link, $q);
1440
+
1441
+    if (!$r) {
1442
+        spip_log("Impossible de creer cette table: $q", 'pg.' . _LOG_ERREUR);
1443
+    } else {
1444
+        foreach ($keys as $index) {
1445
+            pg_query($link, $index);
1446
+        }
1447
+    }
1448
+
1449
+    return $r;
1450 1450
 }
1451 1451
 
1452 1452
 
1453 1453
 function spip_pg_create_base($nom, $serveur = '', $requeter = true) {
1454
-	return spip_pg_query("CREATE DATABASE $nom", $serveur, $requeter);
1454
+    return spip_pg_query("CREATE DATABASE $nom", $serveur, $requeter);
1455 1455
 }
1456 1456
 
1457 1457
 // Fonction de creation d'une vue SQL nommee $nom
1458 1458
 function spip_pg_create_view($nom, $query_select, $serveur = '', $requeter = true) {
1459
-	if (!$query_select) {
1460
-		return false;
1461
-	}
1462
-	// vue deja presente
1463
-	if (sql_showtable($nom, false, $serveur)) {
1464
-		if ($requeter) {
1465
-			spip_log("Echec creation d'une vue sql ($nom) car celle-ci existe deja (serveur:$serveur)", 'pg.' . _LOG_ERREUR);
1466
-		}
1459
+    if (!$query_select) {
1460
+        return false;
1461
+    }
1462
+    // vue deja presente
1463
+    if (sql_showtable($nom, false, $serveur)) {
1464
+        if ($requeter) {
1465
+            spip_log("Echec creation d'une vue sql ($nom) car celle-ci existe deja (serveur:$serveur)", 'pg.' . _LOG_ERREUR);
1466
+        }
1467 1467
 
1468
-		return false;
1469
-	}
1468
+        return false;
1469
+    }
1470 1470
 
1471
-	$query = "CREATE VIEW $nom AS " . $query_select;
1471
+    $query = "CREATE VIEW $nom AS " . $query_select;
1472 1472
 
1473
-	return spip_pg_query($query, $serveur, $requeter);
1473
+    return spip_pg_query($query, $serveur, $requeter);
1474 1474
 }
1475 1475
 
1476 1476
 
1477 1477
 function spip_pg_set_connect_charset($charset, $serveur = '', $requeter = true) {
1478
-	spip_log('changement de charset sql a ecrire en PG', 'pg.' . _LOG_ERREUR);
1478
+    spip_log('changement de charset sql a ecrire en PG', 'pg.' . _LOG_ERREUR);
1479 1479
 }
1480 1480
 
1481 1481
 
@@ -1488,50 +1488,50 @@  discard block
 block discarded – undo
1488 1488
  * @return bool|string true / false / requete
1489 1489
  **/
1490 1490
 function spip_pg_optimize($table, $serveur = '', $requeter = true) {
1491
-	return spip_pg_query('VACUUM ' . $table, $serveur, $requeter);
1491
+    return spip_pg_query('VACUUM ' . $table, $serveur, $requeter);
1492 1492
 }
1493 1493
 
1494 1494
 // Selectionner la sous-chaine dans $objet
1495 1495
 // correspondant a $lang. Cf balise Multi de Spip
1496 1496
 
1497 1497
 function spip_pg_multi($objet, $lang) {
1498
-	$r = 'regexp_replace('
1499
-		. $objet
1500
-		. ",'<multi>.*[[]"
1501
-		. $lang
1502
-		. "[]]([^[]*).*</multi>', E'\\\\1') AS multi";
1498
+    $r = 'regexp_replace('
1499
+        . $objet
1500
+        . ",'<multi>.*[[]"
1501
+        . $lang
1502
+        . "[]]([^[]*).*</multi>', E'\\\\1') AS multi";
1503 1503
 
1504
-	return $r;
1504
+    return $r;
1505 1505
 }
1506 1506
 
1507 1507
 // Palanquee d'idiosyncrasies MySQL dans les creations de table
1508 1508
 // A completer par les autres, mais essayer de reduire en amont.
1509 1509
 
1510 1510
 function mysql2pg_type($v) {
1511
-	$remplace = [
1512
-		'/auto_increment/i' => '', // non reconnu
1513
-		'/bigint/i' => 'bigint',
1514
-		'/mediumint/i' => 'mediumint',
1515
-		'/smallint/i' => 'smallint',
1516
-		'/tinyint/i' => 'int',
1517
-		'/int\s*[(]\s*\d+\s*[)]/i' => 'int',
1518
-		'/longtext/i' => 'text',
1519
-		'/mediumtext/i' => 'text',
1520
-		'/tinytext/i' => 'text',
1521
-		'/longblob/i' => 'text',
1522
-		'/0000-00-00/' => '0001-01-01',
1523
-		'/datetime/i' => 'timestamp',
1524
-		'/unsigned/i' => '',
1525
-		'/double/i' => 'double precision',
1526
-		'/VARCHAR\((\d+)\)\s+BINARY/i' => 'varchar(\1)',
1527
-		'/ENUM *[(][^)]*[)]/i' => 'varchar(255)',
1528
-		'/(timestamp .* )ON .*$/is' => '\\1',
1529
-	];
1530
-
1531
-	return preg_replace(array_keys($remplace), array_values($remplace), $v);
1511
+    $remplace = [
1512
+        '/auto_increment/i' => '', // non reconnu
1513
+        '/bigint/i' => 'bigint',
1514
+        '/mediumint/i' => 'mediumint',
1515
+        '/smallint/i' => 'smallint',
1516
+        '/tinyint/i' => 'int',
1517
+        '/int\s*[(]\s*\d+\s*[)]/i' => 'int',
1518
+        '/longtext/i' => 'text',
1519
+        '/mediumtext/i' => 'text',
1520
+        '/tinytext/i' => 'text',
1521
+        '/longblob/i' => 'text',
1522
+        '/0000-00-00/' => '0001-01-01',
1523
+        '/datetime/i' => 'timestamp',
1524
+        '/unsigned/i' => '',
1525
+        '/double/i' => 'double precision',
1526
+        '/VARCHAR\((\d+)\)\s+BINARY/i' => 'varchar(\1)',
1527
+        '/ENUM *[(][^)]*[)]/i' => 'varchar(255)',
1528
+        '/(timestamp .* )ON .*$/is' => '\\1',
1529
+    ];
1530
+
1531
+    return preg_replace(array_keys($remplace), array_values($remplace), $v);
1532 1532
 }
1533 1533
 
1534 1534
 // Renvoie false si on n'a pas les fonctions pg (pour l'install)
1535 1535
 function spip_versions_pg() {
1536
-	return function_exists('pg_connect');
1536
+    return function_exists('pg_connect');
1537 1537
 }
Please login to merge, or discard this patch.
Spacing   +83 added lines, -84 removed lines patch added patch discarded remove patch
@@ -64,7 +64,7 @@  discard block
 block discarded – undo
64 64
 	if (!$link) {
65 65
 		$erreurs[] = pg_last_error();
66 66
 		foreach ($erreurs as $e) {
67
-			spip_log('Echec pg_connect. Erreur : ' . $e, 'pg.' . _LOG_HS);
67
+			spip_log('Echec pg_connect. Erreur : '.$e, 'pg.'._LOG_HS);
68 68
 		}
69 69
 
70 70
 		return false;
@@ -82,8 +82,8 @@  discard block
 block discarded – undo
82 82
 	}
83 83
 
84 84
 	spip_log(
85
-		"Connexion vers $host, base $db, prefixe $prefixe " . ($link ? 'operationnelle' : 'impossible'),
86
-		'pg.' . _LOG_DEBUG
85
+		"Connexion vers $host, base $db, prefixe $prefixe ".($link ? 'operationnelle' : 'impossible'),
86
+		'pg.'._LOG_DEBUG
87 87
 	);
88 88
 
89 89
 	return !$link ? false : [
@@ -171,7 +171,7 @@  discard block
 block discarded – undo
171 171
 	} else {
172 172
 		$suite = '';
173 173
 	}
174
-	$query = preg_replace('/([,\s])spip_/', '\1' . $prefixe . '_', $query) . $suite;
174
+	$query = preg_replace('/([,\s])spip_/', '\1'.$prefixe.'_', $query).$suite;
175 175
 
176 176
 	// renvoyer la requete inerte si demandee
177 177
 	if (!$requeter) {
@@ -239,7 +239,7 @@  discard block
 block discarded – undo
239 239
 	// ou revoir l'api de sql_alter en creant un
240 240
 	// sql_alter_table($table,array($actions));
241 241
 	if (!preg_match('/\s*((\s*IGNORE)?\s*TABLE\s*([^\s]*))\s*(.*)?/is', $query, $regs)) {
242
-		spip_log("$query mal comprise", 'pg.' . _LOG_ERREUR);
242
+		spip_log("$query mal comprise", 'pg.'._LOG_ERREUR);
243 243
 
244 244
 		return false;
245 245
 	}
@@ -252,7 +252,7 @@  discard block
 block discarded – undo
252 252
 	$i = 0;
253 253
 	$ouverte = false;
254 254
 	while ($do = array_shift($todo)) {
255
-		$todo2[$i] = isset($todo2[$i]) ? $todo2[$i] . ',' . $do : $do;
255
+		$todo2[$i] = isset($todo2[$i]) ? $todo2[$i].','.$do : $do;
256 256
 		$o = (false !== strpos($do, '('));
257 257
 		$f = (false !== strpos($do, ')'));
258 258
 		if ($o and !$f) {
@@ -265,33 +265,33 @@  discard block
 block discarded – undo
265 265
 		}
266 266
 	}
267 267
 	$todo = $todo2;
268
-	$query = $debut . ' ' . array_shift($todo);
268
+	$query = $debut.' '.array_shift($todo);
269 269
 
270 270
 	if (!preg_match('/^\s*(IGNORE\s*)?TABLE\s+(\w+)\s+(ADD|DROP|CHANGE|MODIFY|RENAME)\s*(.*)$/is', $query, $r)) {
271
-		spip_log("$query incompris", 'pg.' . _LOG_ERREUR);
271
+		spip_log("$query incompris", 'pg.'._LOG_ERREUR);
272 272
 	} else {
273 273
 		if ($r[1]) {
274
-			spip_log("j'ignore IGNORE dans $query", 'pg.' . _LOG_AVERTISSEMENT);
274
+			spip_log("j'ignore IGNORE dans $query", 'pg.'._LOG_AVERTISSEMENT);
275 275
 		}
276
-		$f = 'spip_pg_alter_' . strtolower($r[3]);
276
+		$f = 'spip_pg_alter_'.strtolower($r[3]);
277 277
 		if (function_exists($f)) {
278 278
 			$f($r[2], $r[4], $serveur, $requeter);
279 279
 		} else {
280
-			spip_log("$query non prevu", 'pg.' . _LOG_ERREUR);
280
+			spip_log("$query non prevu", 'pg.'._LOG_ERREUR);
281 281
 		}
282 282
 	}
283 283
 	// Alter a plusieurs args. Faudrait optimiser.
284 284
 	if ($todo) {
285
-		spip_pg_alter("TABLE $table " . join(',', $todo));
285
+		spip_pg_alter("TABLE $table ".join(',', $todo));
286 286
 	}
287 287
 }
288 288
 
289 289
 function spip_pg_alter_change($table, $arg, $serveur = '', $requeter = true) {
290 290
 	if (!preg_match('/^`?(\w+)`?\s+`?(\w+)`?\s+(.*?)\s*(DEFAULT .*?)?(NOT\s+NULL)?\s*(DEFAULT .*?)?$/i', $arg, $r)) {
291
-		spip_log("alter change: $arg  incompris", 'pg.' . _LOG_ERREUR);
291
+		spip_log("alter change: $arg  incompris", 'pg.'._LOG_ERREUR);
292 292
 	} else {
293 293
 		[, $old, $new, $type, $default, $null, $def2] = $r;
294
-		$actions = ["ALTER $old TYPE " . mysql2pg_type($type)];
294
+		$actions = ["ALTER $old TYPE ".mysql2pg_type($type)];
295 295
 		if ($null) {
296 296
 			$actions[] = "ALTER $old SET NOT NULL";
297 297
 		} else {
@@ -304,7 +304,7 @@  discard block
 block discarded – undo
304 304
 			$actions[] = "ALTER $old DROP DEFAULT";
305 305
 		}
306 306
 
307
-		spip_pg_query("ALTER TABLE $table " . join(', ', $actions));
307
+		spip_pg_query("ALTER TABLE $table ".join(', ', $actions));
308 308
 
309 309
 		if ($old != $new) {
310 310
 			spip_pg_query("ALTER TABLE $table RENAME $old TO $new", $serveur);
@@ -315,7 +315,7 @@  discard block
 block discarded – undo
315 315
 function spip_pg_alter_add($table, $arg, $serveur = '', $requeter = true) {
316 316
 	$nom_index = null;
317 317
 	if (!preg_match('/^(COLUMN|INDEX|KEY|PRIMARY\s+KEY|)\s*(.*)$/', $arg, $r)) {
318
-		spip_log("alter add $arg  incompris", 'pg.' . _LOG_ERREUR);
318
+		spip_log("alter add $arg  incompris", 'pg.'._LOG_ERREUR);
319 319
 
320 320
 		return null;
321 321
 	}
@@ -325,14 +325,14 @@  discard block
 block discarded – undo
325 325
 			$m[2] = $n[1];
326 326
 		}
327 327
 
328
-		return spip_pg_query("ALTER TABLE $table ADD " . $m[1] . ' ' . mysql2pg_type($m[2]), $serveur, $requeter);
328
+		return spip_pg_query("ALTER TABLE $table ADD ".$m[1].' '.mysql2pg_type($m[2]), $serveur, $requeter);
329 329
 	} elseif ($r[1][0] == 'P') {
330 330
 		// la primary peut etre sur plusieurs champs
331 331
 		$r[2] = trim(str_replace('`', '', $r[2]));
332 332
 		$m = ($r[2][0] == '(') ? substr($r[2], 1, -1) : $r[2];
333 333
 
334 334
 		return spip_pg_query(
335
-			"ALTER TABLE $table ADD CONSTRAINT $table" . '_pkey PRIMARY KEY (' . $m . ')',
335
+			"ALTER TABLE $table ADD CONSTRAINT $table".'_pkey PRIMARY KEY ('.$m.')',
336 336
 			$serveur,
337 337
 			$requeter
338 338
 		);
@@ -351,7 +351,7 @@  discard block
 block discarded – undo
351 351
 				$colonnes = substr($m[1], 1, -1);
352 352
 				if (false !== strpos(',', $colonnes)) {
353 353
 					spip_log('PG : Erreur, impossible de creer un index sur plusieurs colonnes'
354
-						. " sans qu'il ait de nom ($table, ($colonnes))", 'pg.' . _LOG_ERREUR);
354
+						. " sans qu'il ait de nom ($table, ($colonnes))", 'pg.'._LOG_ERREUR);
355 355
 				} else {
356 356
 					$nom_index = $colonnes;
357 357
 				}
@@ -367,23 +367,23 @@  discard block
 block discarded – undo
367 367
 
368 368
 function spip_pg_alter_drop($table, $arg, $serveur = '', $requeter = true) {
369 369
 	if (!preg_match('/^(COLUMN|INDEX|KEY|PRIMARY\s+KEY|)\s*`?(\w*)`?/', $arg, $r)) {
370
-		spip_log("alter drop: $arg  incompris", 'pg.' . _LOG_ERREUR);
370
+		spip_log("alter drop: $arg  incompris", 'pg.'._LOG_ERREUR);
371 371
 	} else {
372 372
 		if (!$r[1] or $r[1] == 'COLUMN') {
373
-			return spip_pg_query("ALTER TABLE $table DROP " . $r[2], $serveur);
373
+			return spip_pg_query("ALTER TABLE $table DROP ".$r[2], $serveur);
374 374
 		} elseif ($r[1][0] == 'P') {
375
-			return spip_pg_query("ALTER TABLE $table DROP CONSTRAINT $table" . '_pkey', $serveur);
375
+			return spip_pg_query("ALTER TABLE $table DROP CONSTRAINT $table".'_pkey', $serveur);
376 376
 		} else {
377
-			return spip_pg_query('DROP INDEX ' . $table . '_' . $r[2], $serveur);
377
+			return spip_pg_query('DROP INDEX '.$table.'_'.$r[2], $serveur);
378 378
 		}
379 379
 	}
380 380
 }
381 381
 
382 382
 function spip_pg_alter_modify($table, $arg, $serveur = '', $requeter = true) {
383 383
 	if (!preg_match('/^`?(\w+)`?\s+(.*)$/', $arg, $r)) {
384
-		spip_log("alter modify: $arg  incompris", 'pg.' . _LOG_ERREUR);
384
+		spip_log("alter modify: $arg  incompris", 'pg.'._LOG_ERREUR);
385 385
 	} else {
386
-		return spip_pg_alter_change($table, $r[1] . ' ' . $arg, $serveur = '', $requeter = true);
386
+		return spip_pg_alter_change($table, $r[1].' '.$arg, $serveur = '', $requeter = true);
387 387
 	}
388 388
 }
389 389
 
@@ -399,7 +399,7 @@  discard block
 block discarded – undo
399 399
 	} elseif (preg_match('/^(TO)\s*`?(\w*)`?/', $arg, $r)) {
400 400
 		$rename = $r[2];
401 401
 	} else {
402
-		spip_log("alter rename: $arg  incompris", 'pg.' . _LOG_ERREUR);
402
+		spip_log("alter rename: $arg  incompris", 'pg.'._LOG_ERREUR);
403 403
 	}
404 404
 
405 405
 	return $rename ? spip_pg_query("ALTER TABLE $table RENAME TO $rename") : false;
@@ -420,8 +420,8 @@  discard block
 block discarded – undo
420 420
 function spip_pg_create_index($nom, $table, $champs, $serveur = '', $requeter = true) {
421 421
 	if (!($nom or $table or $champs)) {
422 422
 		spip_log(
423
-			"Champ manquant pour creer un index pg ($nom, $table, (" . @join(',', $champs) . '))',
424
-			'pg.' . _LOG_ERREUR
423
+			"Champ manquant pour creer un index pg ($nom, $table, (".@join(',', $champs).'))',
424
+			'pg.'._LOG_ERREUR
425 425
 		);
426 426
 
427 427
 		return false;
@@ -432,7 +432,7 @@  discard block
 block discarded – undo
432 432
 
433 433
 	// PG ne differentie pas noms des index en fonction des tables
434 434
 	// il faut donc creer des noms uniques d'index pour une base pg
435
-	$nom = $table . '_' . $nom;
435
+	$nom = $table.'_'.$nom;
436 436
 	// enlever d'eventuelles parentheses deja presentes sur champs
437 437
 	if (!is_array($champs)) {
438 438
 		if ($champs[0] == '(') {
@@ -440,7 +440,7 @@  discard block
 block discarded – undo
440 440
 		}
441 441
 		$champs = [$champs];
442 442
 	}
443
-	$query = "CREATE INDEX $nom ON $table (" . join(',', $champs) . ')';
443
+	$query = "CREATE INDEX $nom ON $table (".join(',', $champs).')';
444 444
 	if (!$requeter) {
445 445
 		return $query;
446 446
 	}
@@ -463,7 +463,7 @@  discard block
 block discarded – undo
463 463
 	} else {
464 464
 		$suite = '';
465 465
 	}
466
-	$query = 'EXPLAIN ' . preg_replace('/([,\s])spip_/', '\1' . $prefixe . '_', $query) . $suite;
466
+	$query = 'EXPLAIN '.preg_replace('/([,\s])spip_/', '\1'.$prefixe.'_', $query).$suite;
467 467
 
468 468
 	if (!$requeter) {
469 469
 		return $query;
@@ -556,16 +556,16 @@  discard block
 block discarded – undo
556 556
 		}
557 557
 	}
558 558
 	$from = spip_pg_from($from, $prefixe);
559
-	$query = 'SELECT ' . $select
559
+	$query = 'SELECT '.$select
560 560
 		. (!$from ? '' : "\nFROM $from")
561
-		. (!$where ? '' : ("\nWHERE " . (!is_array($where) ? calculer_pg_where($where) : (join(
561
+		. (!$where ? '' : ("\nWHERE ".(!is_array($where) ? calculer_pg_where($where) : (join(
562 562
 			"\n\tAND ",
563 563
 			array_map('calculer_pg_where', $where)
564 564
 		)))))
565 565
 		. spip_pg_groupby($groupby, $from, $select)
566 566
 		. (!$having ? '' : "\nHAVING $having")
567 567
 		. ($orderby ? ("\nORDER BY $orderby") : '')
568
-		. (!$limit ? '' : (" LIMIT $count" . (!$offset ? '' : " OFFSET $offset")));
568
+		. (!$limit ? '' : (" LIMIT $count".(!$offset ? '' : " OFFSET $offset")));
569 569
 
570 570
 	// renvoyer la requete inerte si demandee
571 571
 	if ($requeter === false) {
@@ -586,7 +586,7 @@  discard block
 block discarded – undo
586 586
 		$from = spip_pg_select_as($from);
587 587
 	}
588 588
 
589
-	return !$prefixe ? $from : preg_replace('/(\b)spip_/', '\1' . $prefixe . '_', $from);
589
+	return !$prefixe ? $from : preg_replace('/(\b)spip_/', '\1'.$prefixe.'_', $from);
590 590
 }
591 591
 
592 592
 function spip_pg_orderby($order, $select) {
@@ -594,7 +594,7 @@  discard block
 block discarded – undo
594 594
 	$arg = (is_array($order) ? $order : preg_split('/\s*,\s*/', $order));
595 595
 
596 596
 	foreach ($arg as $v) {
597
-		if (preg_match('/(case\s+.*?else\s+0\s+end)\s*AS\s+' . $v . '/', $select, $m)) {
597
+		if (preg_match('/(case\s+.*?else\s+0\s+end)\s*AS\s+'.$v.'/', $select, $m)) {
598 598
 			$res[] = $m[1];
599 599
 		} else {
600 600
 			$res[] = $v;
@@ -772,7 +772,7 @@  discard block
 block discarded – undo
772 772
 			$n++;
773 773
 			$res .= "\nwhen $index=$v then $n";
774 774
 		}
775
-		$arg = $m[1] . "case $res else 0 end "
775
+		$arg = $m[1]."case $res else 0 end "
776 776
 			. substr($arg, strlen($m[0]));
777 777
 	}
778 778
 
@@ -815,9 +815,9 @@  discard block
 block discarded – undo
815 815
 	}
816 816
 
817 817
 	if (strtoupper($join) === 'AND') {
818
-		return $exp . join("\n\t$join ", array_map('calculer_pg_where', $v));
818
+		return $exp.join("\n\t$join ", array_map('calculer_pg_where', $v));
819 819
 	} else {
820
-		return $exp . join($join, $v);
820
+		return $exp.join($join, $v);
821 821
 	}
822 822
 }
823 823
 
@@ -827,7 +827,7 @@  discard block
 block discarded – undo
827 827
 		if (substr($k, -1) == '@') {
828 828
 			// c'est une jointure qui se refere au from precedent
829 829
 			// pas de virgule
830
-			$argsas .= '  ' . $v;
830
+			$argsas .= '  '.$v;
831 831
 		} else {
832 832
 			$as = '';
833 833
 			//  spip_log("$k : $v", _LOG_DEBUG);
@@ -837,7 +837,7 @@  discard block
 block discarded – undo
837 837
 				} elseif ($v != $k) {
838 838
 					$p = strpos($v, ' ');
839 839
 					if ($p) {
840
-						$v = substr($v, 0, $p) . " AS $k" . substr($v, $p);
840
+						$v = substr($v, 0, $p)." AS $k".substr($v, $p);
841 841
 					} else {
842 842
 						$as = " AS $k";
843 843
 					}
@@ -845,7 +845,7 @@  discard block
 block discarded – undo
845 845
 			}
846 846
 			// spip_log("subs $k : $v avec $as", _LOG_DEBUG);
847 847
 			// if (strpos($v, 'JOIN') === false)  $argsas .= ', ';
848
-			$argsas .= ', ' . $v . $as;
848
+			$argsas .= ', '.$v.$as;
849 849
 		}
850 850
 	}
851 851
 
@@ -876,7 +876,7 @@  discard block
 block discarded – undo
876 876
 	$serveur = '',
877 877
 	$requeter = true
878 878
 ) {
879
-	$c = !$groupby ? '*' : ('DISTINCT ' . (is_string($groupby) ? $groupby : join(',', $groupby)));
879
+	$c = !$groupby ? '*' : ('DISTINCT '.(is_string($groupby) ? $groupby : join(',', $groupby)));
880 880
 	$r = spip_pg_select("COUNT($c)", $from, $where, '', '', '', $having, $serveur, $requeter);
881 881
 	if (!$requeter) {
882 882
 		return $r;
@@ -977,8 +977,8 @@  discard block
 block discarded – undo
977 977
 
978 978
 	return spip_pg_insert(
979 979
 		$table,
980
-		'(' . join(',', array_keys($couples)) . ')',
981
-		'(' . join(',', $couples) . ')',
980
+		'('.join(',', array_keys($couples)).')',
981
+		'('.join(',', $couples).')',
982 982
 		$desc,
983 983
 		$serveur,
984 984
 		$requeter
@@ -1001,7 +1001,7 @@  discard block
 block discarded – undo
1001 1001
 	$c = $tab_couples[0] ?? [];
1002 1002
 	$les_cles = spip_pg_ajouter_champs_timestamp($table, $c, $desc, $serveur);
1003 1003
 
1004
-	$cles = '(' . join(',', array_keys($les_cles)) . ')';
1004
+	$cles = '('.join(',', array_keys($les_cles)).')';
1005 1005
 	$valeurs = [];
1006 1006
 	foreach ($tab_couples as $couples) {
1007 1007
 		foreach ($couples as $champ => $val) {
@@ -1010,7 +1010,7 @@  discard block
 block discarded – undo
1010 1010
 		// recherche de champs 'timestamp' pour mise a jour auto de ceux-ci
1011 1011
 		$couples = spip_pg_ajouter_champs_timestamp($table, $couples, $desc, $serveur);
1012 1012
 
1013
-		$valeurs[] = '(' . join(',', $couples) . ')';
1013
+		$valeurs[] = '('.join(',', $couples).')';
1014 1014
 	}
1015 1015
 	$valeurs = implode(', ', $valeurs);
1016 1016
 
@@ -1031,7 +1031,7 @@  discard block
 block discarded – undo
1031 1031
 
1032 1032
 	$set = [];
1033 1033
 	foreach ($couples as $champ => $val) {
1034
-		$set[] = $champ . '=' . $val;
1034
+		$set[] = $champ.'='.$val;
1035 1035
 	}
1036 1036
 
1037 1037
 	$query = calculer_pg_expression('UPDATE', $table, ',')
@@ -1066,7 +1066,7 @@  discard block
 block discarded – undo
1066 1066
 
1067 1067
 function spip_pg_replace($table, $values, $desc, $serveur = '', $requeter = true) {
1068 1068
 	if (!$values) {
1069
-		spip_log("replace vide $table", 'pg.' . _LOG_AVERTISSEMENT);
1069
+		spip_log("replace vide $table", 'pg.'._LOG_AVERTISSEMENT);
1070 1070
 
1071 1071
 		return 0;
1072 1072
 	}
@@ -1100,8 +1100,8 @@  discard block
 block discarded – undo
1100 1100
 	if (!$where) {
1101 1101
 		return spip_pg_insert(
1102 1102
 			$table,
1103
-			'(' . join(',', array_keys($values)) . ')',
1104
-			'(' . join(',', $values) . ')',
1103
+			'('.join(',', array_keys($values)).')',
1104
+			'('.join(',', $values).')',
1105 1105
 			$desc,
1106 1106
 			$serveur
1107 1107
 		);
@@ -1122,12 +1122,11 @@  discard block
 block discarded – undo
1122 1122
 		$couples = pg_affected_rows($couples);
1123 1123
 	}
1124 1124
 	if (!$couples) {
1125
-		$ret = !$seq ? '' :
1126
-			(" RETURNING nextval('$seq') < $prim");
1127
-		$connexion['last'] = $q = "INSERT INTO $table (" . join(',', array_keys($values)) . ') VALUES (' . join(
1125
+		$ret = !$seq ? '' : (" RETURNING nextval('$seq') < $prim");
1126
+		$connexion['last'] = $q = "INSERT INTO $table (".join(',', array_keys($values)).') VALUES ('.join(
1128 1127
 			',',
1129 1128
 			$values
1130
-		) . ")$ret";
1129
+		).")$ret";
1131 1130
 		$couples = spip_pg_query_simple($link, $q);
1132 1131
 		if (!$couples) {
1133 1132
 			return false;
@@ -1175,7 +1174,7 @@  discard block
 block discarded – undo
1175 1174
 	) {
1176 1175
 		return '';
1177 1176
 	} else {
1178
-		return $raw ? $prim : $table . '_' . $prim . '_seq';
1177
+		return $raw ? $prim : $table.'_'.$prim.'_seq';
1179 1178
 	}
1180 1179
 }
1181 1180
 
@@ -1192,29 +1191,29 @@  discard block
 block discarded – undo
1192 1191
 			return spip_pg_frommysql($v);
1193 1192
 		} else {
1194 1193
 			if (strncmp($v, '0000', 4) == 0) {
1195
-				$v = '0001' . substr($v, 4);
1194
+				$v = '0001'.substr($v, 4);
1196 1195
 			}
1197 1196
 			if (strpos($v, '-00-00') === 4) {
1198
-				$v = substr($v, 0, 4) . '-01-01' . substr($v, 10);
1197
+				$v = substr($v, 0, 4).'-01-01'.substr($v, 10);
1199 1198
 			}
1200 1199
 
1201 1200
 			return "timestamp '$v'";
1202 1201
 		}
1203 1202
 	} elseif (!sql_test_int($t)) {
1204
-		return ("'" . pg_escape_string($v) . "'");
1203
+		return ("'".pg_escape_string($v)."'");
1205 1204
 	} elseif (is_numeric($v) or (strpos($v, 'CAST(') === 0)) {
1206 1205
 		return $v;
1207 1206
 	} elseif ($v[0] == '0' and $v[1] !== 'x' and ctype_xdigit(substr($v, 1))) {
1208 1207
 		return substr($v, 1);
1209 1208
 	} else {
1210
-		spip_log("Warning: '$v'  n'est pas de type $t", 'pg.' . _LOG_AVERTISSEMENT);
1209
+		spip_log("Warning: '$v'  n'est pas de type $t", 'pg.'._LOG_AVERTISSEMENT);
1211 1210
 
1212 1211
 		return intval($v);
1213 1212
 	}
1214 1213
 }
1215 1214
 
1216 1215
 function spip_pg_hex($v) {
1217
-	return "CAST(x'" . $v . "' as bigint)";
1216
+	return "CAST(x'".$v."' as bigint)";
1218 1217
 }
1219 1218
 
1220 1219
 function spip_pg_quote($v, $type = '') {
@@ -1252,15 +1251,15 @@  discard block
 block discarded – undo
1252 1251
 		return $not ? '0=0' : '0=1';
1253 1252
 	}
1254 1253
 	if (strpos($valeurs, "CAST(x'") !== false) {
1255
-		return "($val=" . join("OR $val=", explode(',', $valeurs)) . ')';
1254
+		return "($val=".join("OR $val=", explode(',', $valeurs)).')';
1256 1255
 	}
1257 1256
 	$n = $i = 0;
1258 1257
 	$in_sql = '';
1259 1258
 	while ($n = strpos($valeurs, ',', $n + 1)) {
1260 1259
 		if ((++$i) >= 255) {
1261
-			$in_sql .= "($val $not IN (" .
1262
-				substr($valeurs, 0, $n) .
1263
-				"))\n" .
1260
+			$in_sql .= "($val $not IN (".
1261
+				substr($valeurs, 0, $n).
1262
+				"))\n".
1264 1263
 				($not ? "AND\t" : "OR\t");
1265 1264
 			$valeurs = substr($valeurs, $n + 1);
1266 1265
 			$i = $n = 0;
@@ -1276,7 +1275,7 @@  discard block
 block discarded – undo
1276 1275
 	$s = $link ? pg_last_error($link) : pg_last_error();
1277 1276
 	if ($s) {
1278 1277
 		$s = str_replace('ERROR', 'errcode: 1000 ', $s);
1279
-		spip_log("$s - $query", 'pg.' . _LOG_ERREUR);
1278
+		spip_log("$s - $query", 'pg.'._LOG_ERREUR);
1280 1279
 	}
1281 1280
 
1282 1281
 	return $s;
@@ -1324,7 +1323,7 @@  discard block
 block discarded – undo
1324 1323
 function spip_pg_showbase($match, $serveur = '', $requeter = true) {
1325 1324
 	$connexion = &$GLOBALS['connexions'][$serveur ? strtolower($serveur) : 0];
1326 1325
 	$link = $connexion['link'];
1327
-	$connexion['last'] = $q = 'SELECT tablename FROM pg_tables WHERE tablename ILIKE ' . _q($match);
1326
+	$connexion['last'] = $q = 'SELECT tablename FROM pg_tables WHERE tablename ILIKE '._q($match);
1328 1327
 
1329 1328
 	return spip_pg_query_simple($link, $q);
1330 1329
 }
@@ -1332,7 +1331,7 @@  discard block
 block discarded – undo
1332 1331
 function spip_pg_showtable($nom_table, $serveur = '', $requeter = true) {
1333 1332
 	$connexion = &$GLOBALS['connexions'][$serveur ? strtolower($serveur) : 0];
1334 1333
 	$link = $connexion['link'];
1335
-	$connexion['last'] = $q = 'SELECT column_name, column_default, data_type FROM information_schema.columns WHERE table_name ILIKE ' . _q($nom_table);
1334
+	$connexion['last'] = $q = 'SELECT column_name, column_default, data_type FROM information_schema.columns WHERE table_name ILIKE '._q($nom_table);
1336 1335
 
1337 1336
 	$res = spip_pg_query_simple($link, $q);
1338 1337
 	if (!$res) {
@@ -1343,15 +1342,15 @@  discard block
 block discarded – undo
1343 1342
 	// il faut en tenir compte dans le return
1344 1343
 	$fields = [];
1345 1344
 	while ($field = pg_fetch_array($res, null, PGSQL_NUM)) {
1346
-		$fields[$field[0]] = $field[2] . (!$field[1] ? '' : (' DEFAULT ' . $field[1]));
1345
+		$fields[$field[0]] = $field[2].(!$field[1] ? '' : (' DEFAULT '.$field[1]));
1347 1346
 	}
1348
-	$connexion['last'] = $q = 'SELECT indexdef FROM pg_indexes WHERE tablename ILIKE ' . _q($nom_table);
1347
+	$connexion['last'] = $q = 'SELECT indexdef FROM pg_indexes WHERE tablename ILIKE '._q($nom_table);
1349 1348
 	$res = spip_pg_query_simple($link, $q);
1350 1349
 	$keys = [];
1351 1350
 	while ($index = pg_fetch_array($res, null, PGSQL_NUM)) {
1352 1351
 		if (preg_match('/CREATE\s+(UNIQUE\s+)?INDEX\s([^\s]+).*\((.*)\)$/', $index[0], $r)) {
1353
-			$nom = str_replace($nom_table . '_', '', $r[2]);
1354
-			$keys[($r[1] ? 'PRIMARY KEY' : ('KEY ' . $nom))] = $r[3];
1352
+			$nom = str_replace($nom_table.'_', '', $r[2]);
1353
+			$keys[($r[1] ? 'PRIMARY KEY' : ('KEY '.$nom))] = $r[3];
1355 1354
 		}
1356 1355
 	}
1357 1356
 
@@ -1383,16 +1382,16 @@  discard block
 block discarded – undo
1383 1382
 		if (strpos($k, 'KEY ') === 0) {
1384 1383
 			$n = str_replace('`', '', $k);
1385 1384
 			$v = str_replace('`', '"', $v);
1386
-			$i = $nom . preg_replace('/KEY +/', '_', $n);
1385
+			$i = $nom.preg_replace('/KEY +/', '_', $n);
1387 1386
 			if ($k != $n) {
1388 1387
 				$i = "\"$i\"";
1389 1388
 			}
1390 1389
 			$keys[] = "CREATE INDEX $i ON $nom ($v);";
1391 1390
 		} elseif (strpos($k, 'UNIQUE ') === 0) {
1392 1391
 			$k = preg_replace('/^UNIQUE +/', '', $k);
1393
-			$prim .= "$s\n\t\tCONSTRAINT " . str_replace('`', '"', $k) . " UNIQUE ($v)";
1392
+			$prim .= "$s\n\t\tCONSTRAINT ".str_replace('`', '"', $k)." UNIQUE ($v)";
1394 1393
 		} else {
1395
-			$prim .= "$s\n\t\t" . str_replace('`', '"', $k) . " ($v)";
1394
+			$prim .= "$s\n\t\t".str_replace('`', '"', $k)." ($v)";
1396 1395
 		}
1397 1396
 		if ($k == 'PRIMARY KEY') {
1398 1397
 			$prim_name = $v;
@@ -1403,17 +1402,17 @@  discard block
 block discarded – undo
1403 1402
 
1404 1403
 	$character_set = '';
1405 1404
 	if (@$GLOBALS['meta']['charset_sql_base']) {
1406
-		$character_set .= ' CHARACTER SET ' . $GLOBALS['meta']['charset_sql_base'];
1405
+		$character_set .= ' CHARACTER SET '.$GLOBALS['meta']['charset_sql_base'];
1407 1406
 	}
1408 1407
 	if (@$GLOBALS['meta']['charset_collation_sql_base']) {
1409
-		$character_set .= ' COLLATE ' . $GLOBALS['meta']['charset_collation_sql_base'];
1408
+		$character_set .= ' COLLATE '.$GLOBALS['meta']['charset_collation_sql_base'];
1410 1409
 	}
1411 1410
 
1412 1411
 	foreach ($champs as $k => $v) {
1413 1412
 		$k = str_replace('`', '"', $k);
1414 1413
 		if (preg_match(',([a-z]*\s*(\(\s*[0-9]*\s*\))?(\s*binary)?),i', $v, $defs)) {
1415 1414
 			if (preg_match(',(char|text),i', $defs[1]) and !preg_match(',binary,i', $defs[1])) {
1416
-				$v = $defs[1] . $character_set . ' ' . substr($v, strlen($defs[1]));
1415
+				$v = $defs[1].$character_set.' '.substr($v, strlen($defs[1]));
1417 1416
 			}
1418 1417
 		}
1419 1418
 
@@ -1428,7 +1427,7 @@  discard block
 block discarded – undo
1428 1427
 
1429 1428
 	// En l'absence de "if not exists" en PG, on neutralise les erreurs
1430 1429
 
1431
-	$q = "CREATE $temporary TABLE $nom ($query" . ($prim ? ",$prim" : '') . ')' .
1430
+	$q = "CREATE $temporary TABLE $nom ($query".($prim ? ",$prim" : '').')'.
1432 1431
 		($character_set ? " DEFAULT $character_set" : '')
1433 1432
 		. "\n";
1434 1433
 
@@ -1439,7 +1438,7 @@  discard block
 block discarded – undo
1439 1438
 	$r = @pg_query($link, $q);
1440 1439
 
1441 1440
 	if (!$r) {
1442
-		spip_log("Impossible de creer cette table: $q", 'pg.' . _LOG_ERREUR);
1441
+		spip_log("Impossible de creer cette table: $q", 'pg.'._LOG_ERREUR);
1443 1442
 	} else {
1444 1443
 		foreach ($keys as $index) {
1445 1444
 			pg_query($link, $index);
@@ -1462,20 +1461,20 @@  discard block
 block discarded – undo
1462 1461
 	// vue deja presente
1463 1462
 	if (sql_showtable($nom, false, $serveur)) {
1464 1463
 		if ($requeter) {
1465
-			spip_log("Echec creation d'une vue sql ($nom) car celle-ci existe deja (serveur:$serveur)", 'pg.' . _LOG_ERREUR);
1464
+			spip_log("Echec creation d'une vue sql ($nom) car celle-ci existe deja (serveur:$serveur)", 'pg.'._LOG_ERREUR);
1466 1465
 		}
1467 1466
 
1468 1467
 		return false;
1469 1468
 	}
1470 1469
 
1471
-	$query = "CREATE VIEW $nom AS " . $query_select;
1470
+	$query = "CREATE VIEW $nom AS ".$query_select;
1472 1471
 
1473 1472
 	return spip_pg_query($query, $serveur, $requeter);
1474 1473
 }
1475 1474
 
1476 1475
 
1477 1476
 function spip_pg_set_connect_charset($charset, $serveur = '', $requeter = true) {
1478
-	spip_log('changement de charset sql a ecrire en PG', 'pg.' . _LOG_ERREUR);
1477
+	spip_log('changement de charset sql a ecrire en PG', 'pg.'._LOG_ERREUR);
1479 1478
 }
1480 1479
 
1481 1480
 
@@ -1488,7 +1487,7 @@  discard block
 block discarded – undo
1488 1487
  * @return bool|string true / false / requete
1489 1488
  **/
1490 1489
 function spip_pg_optimize($table, $serveur = '', $requeter = true) {
1491
-	return spip_pg_query('VACUUM ' . $table, $serveur, $requeter);
1490
+	return spip_pg_query('VACUUM '.$table, $serveur, $requeter);
1492 1491
 }
1493 1492
 
1494 1493
 // Selectionner la sous-chaine dans $objet
Please login to merge, or discard this patch.
ecrire/plugins/afficher_plugin.php 2 patches
Spacing   +34 added lines, -35 removed lines patch added patch discarded remove patch
@@ -63,9 +63,9 @@  discard block
 block discarded – undo
63 63
 			" class='picto_err'",
64 64
 			_T('plugin_info_erreur_xml')
65 65
 		)
66
-			. "<div class='erreur'>" . join('<br >', $info['erreur']) . '</div>';
66
+			. "<div class='erreur'>".join('<br >', $info['erreur']).'</div>';
67 67
 		$checkable = false;
68
-	} elseif (isset($GLOBALS['erreurs_activation_raw'][$dir_plugins . $plug_file])) {
68
+	} elseif (isset($GLOBALS['erreurs_activation_raw'][$dir_plugins.$plug_file])) {
69 69
 		$class_li .= ' error';
70 70
 		$erreur = http_img_pack(
71 71
 			'plugin-err-32.png',
@@ -73,10 +73,10 @@  discard block
 block discarded – undo
73 73
 			" class='picto_err'",
74 74
 			_T('plugin_impossible_activer', ['plugin' => $nom])
75 75
 		)
76
-			. "<div class='erreur'>" . implode(
76
+			. "<div class='erreur'>".implode(
77 77
 				'<br />',
78
-				$GLOBALS['erreurs_activation_raw'][$dir_plugins . $plug_file]
79
-			) . '</div>';
78
+				$GLOBALS['erreurs_activation_raw'][$dir_plugins.$plug_file]
79
+			).'</div>';
80 80
 	} else {
81 81
 		$cfg = $actif ? plugin_bouton_config($plug_file, $info, $dir_plugins) : '';
82 82
 		if (defined('_DEV_VERSION_SPIP_COMPAT') and !plugin_version_compatible($info['compatibilite'], $GLOBALS['spip_version_branche'])) {
@@ -93,11 +93,11 @@  discard block
 block discarded – undo
93 93
 	// numerotons les occurrences d'un meme prefix
94 94
 	$versions[$prefix] = $id = isset($versions[$prefix]) ? intval($versions[$prefix]) + 1 : '';
95 95
 
96
-	$class_li .= ($actif ? ' actif' : '') . ($expose ? ' on' : '');
96
+	$class_li .= ($actif ? ' actif' : '').($expose ? ' on' : '');
97 97
 
98 98
 	return "<li id='$prefix$id' class='$class_li'>"
99 99
 	. ((!$checkable and !$checked)
100
-		? '' : plugin_checkbox(++$id_input, $dir_plugins . $plug_file, $checked))
100
+		? '' : plugin_checkbox(++$id_input, $dir_plugins.$plug_file, $checked))
101 101
 	. plugin_resume($info, $dir_plugins, $plug_file, $url_page)
102 102
 	. $cfg
103 103
 	. $erreur
@@ -116,9 +116,9 @@  discard block
 block discarded – undo
116 116
 	// si paquet.xml fournit un squelette, le prendre
117 117
 	if (isset($infos['config']) and $infos['config']) {
118 118
 		return recuperer_fond(
119
-			"$dir$nom/" . $infos['config'],
119
+			"$dir$nom/".$infos['config'],
120 120
 			[
121
-				'script' => 'configurer_' . $prefix,
121
+				'script' => 'configurer_'.$prefix,
122 122
 				'nom' => $nom
123 123
 			]
124 124
 		);
@@ -137,7 +137,7 @@  discard block
 block discarded – undo
137 137
 	return recuperer_fond(
138 138
 		'prive/squelettes/inclure/cfg',
139 139
 		[
140
-			'script' => 'configurer_' . $prefix,
140
+			'script' => 'configurer_'.$prefix,
141 141
 			'nom' => $nom
142 142
 		]
143 143
 	);
@@ -153,7 +153,7 @@  discard block
 block discarded – undo
153 153
 	. "<input type='checkbox' name='s$name' id='label_$id_input'"
154 154
 	. ($actif ? " checked='checked'" : '')
155 155
 	. " class='checkbox'  value='O' />"
156
-	. "\n<label for='label_$id_input'>" . _T('activer_plugin') . '</label>'
156
+	. "\n<label for='label_$id_input'>"._T('activer_plugin').'</label>'
157 157
 	. '</div>';
158 158
 }
159 159
 
@@ -208,11 +208,11 @@  discard block
 block discarded – undo
208 208
 	. "<h3><a href='$url' rel='info'>"
209 209
 	. $nom
210 210
 	. '</a></h3>'
211
-	. " <span class='version'>" . $info['version'] . '</span>'
211
+	. " <span class='version'>".$info['version'].'</span>'
212 212
 	. " <span class='etat'> - "
213 213
 	. plugin_etat_en_clair($info['etat'])
214 214
 	. '</span>'
215
-	. "<div class='short'>" . $slogan . '</div>'
215
+	. "<div class='short'>".$slogan.'</div>'
216 216
 	. $i
217 217
 	. '</div>';
218 218
 }
@@ -227,7 +227,7 @@  discard block
 block discarded – undo
227 227
 	$text2 = _T('info_desinstaller_plugin');
228 228
 	$file = basename($plug_file);
229 229
 
230
-	return "<div class='actions'>[" .
230
+	return "<div class='actions'>[".
231 231
 	"<a href='$action'
232 232
 		onclick='return confirm(\"$text $nom ?\\n$text2\")'>"
233 233
 	. $text
@@ -249,7 +249,7 @@  discard block
 block discarded – undo
249 249
 		$etat = 'developpement';
250 250
 	}
251 251
 
252
-	return _T('plugin_etat_' . $etat);
252
+	return _T('plugin_etat_'.$etat);
253 253
 }
254 254
 
255 255
 function plugin_propre($texte, $module = '', $propre = 'propre') {
@@ -258,7 +258,7 @@  discard block
 block discarded – undo
258 258
 		$module = substr($module, strlen(_DIR_RACINE));
259 259
 	}
260 260
 	if (preg_match('|^\w+_[\w_]+$|', $texte)) {
261
-		$texte = _T(($module ? "$module:" : '') . $texte, [], ['force' => false]);
261
+		$texte = _T(($module ? "$module:" : '').$texte, [], ['force' => false]);
262 262
 	}
263 263
 
264 264
 	return $propre($texte);
@@ -291,9 +291,9 @@  discard block
 block discarded – undo
291 291
 		isset($info['documentation'])
292 292
 		and $lien = $info['documentation']
293 293
 	) {
294
-		$description .= "<p><em class='site'><a href='$lien' class='spip_out'>" . _T('en_savoir_plus') . '</a></em></p>';
294
+		$description .= "<p><em class='site'><a href='$lien' class='spip_out'>"._T('en_savoir_plus').'</a></em></p>';
295 295
 	}
296
-	$s .= "<dd class='desc'>" . $description . "</dd>\n";
296
+	$s .= "<dd class='desc'>".$description."</dd>\n";
297 297
 
298 298
 	if (isset($info['auteur'])) {
299 299
 		if (is_array($info['auteur'])) {
@@ -303,19 +303,19 @@  discard block
 block discarded – undo
303 303
 			$a = trim($info['auteur']);
304 304
 		}
305 305
 		if ($a) {
306
-			$s .= "<dt class='auteurs'>" . _T('public:par_auteur') . "</dt><dd class='auteurs'>" . PtoBR(propre(
306
+			$s .= "<dt class='auteurs'>"._T('public:par_auteur')."</dt><dd class='auteurs'>".PtoBR(propre(
307 307
 				$a,
308 308
 				$dir
309
-			)) . "</dd>\n";
309
+			))."</dd>\n";
310 310
 		}
311 311
 	}
312 312
 
313 313
 	if (isset($info['credit'])) {
314 314
 		if ($a = formater_credits($info['credit'], ', ')) {
315
-			$s .= "<dt class='credits'>" . _T('plugin_info_credit') . "</dt><dd class='credits'>" . PtoBR(propre(
315
+			$s .= "<dt class='credits'>"._T('plugin_info_credit')."</dt><dd class='credits'>".PtoBR(propre(
316 316
 				$a,
317 317
 				$dir
318
-			)) . "</dd>\n";
318
+			))."</dd>\n";
319 319
 		}
320 320
 	}
321 321
 
@@ -327,10 +327,10 @@  discard block
 block discarded – undo
327 327
 			$a = trim($info['licence']);
328 328
 		}
329 329
 		if ($a) {
330
-			$s .= "<dt class='licence'>" . _T('intitule_licence') . "</dt><dd class='licence'>" . PtoBR(propre(
330
+			$s .= "<dt class='licence'>"._T('intitule_licence')."</dt><dd class='licence'>".PtoBR(propre(
331 331
 				$a,
332 332
 				$dir
333
-			)) . "</dd>\n";
333
+			))."</dd>\n";
334 334
 		}
335 335
 	}
336 336
 
@@ -341,25 +341,24 @@  discard block
 block discarded – undo
341 341
 	//
342 342
 	$infotech = [];
343 343
 
344
-	$version = '<dt>' . _T('version') . '</dt><dd>' . $info['version'];
344
+	$version = '<dt>'._T('version').'</dt><dd>'.$info['version'];
345 345
 	// Version VCS
346
-	if ($vcs = version_vcs_courante($dir_plugins . $plug_file)) {
347
-		$version .= ' ' . $vcs;
346
+	if ($vcs = version_vcs_courante($dir_plugins.$plug_file)) {
347
+		$version .= ' '.$vcs;
348 348
 	}
349 349
 	$version .= '</dd>';
350 350
 	$infotech[] = $version;
351
-	$infotech[] = '<dt>' . _T('repertoire_plugins') . '</dt><dd>' . joli_repertoire("$dir_plugins$plug_file") . '</dd>';
351
+	$infotech[] = '<dt>'._T('repertoire_plugins').'</dt><dd>'.joli_repertoire("$dir_plugins$plug_file").'</dd>';
352 352
 	// source zip le cas echeant
353
-	$infotech[] = (lire_fichier($dir_plugins . $plug_file . '/install.log', $log)
353
+	$infotech[] = (lire_fichier($dir_plugins.$plug_file.'/install.log', $log)
354 354
 		and preg_match(',^source:(.*)$,m', $log, $r))
355
-		? '<dt>' . _T('plugin_source') . '</dt><dd>' . trim($r[1]) . '</dd>'
355
+		? '<dt>'._T('plugin_source').'</dt><dd>'.trim($r[1]).'</dd>'
356 356
 		: '';
357 357
 
358
-	$infotech[] = !$info['necessite'] ? '' :
359
-		('<dt>' . _T('plugin_info_necessite') . '</dt><dd>' . join(
358
+	$infotech[] = !$info['necessite'] ? '' : ('<dt>'._T('plugin_info_necessite').'</dt><dd>'.join(
360 359
 			' ',
361 360
 			array_map('array_shift', $info['necessite'])
362
-		) . '</dd>');
361
+		).'</dd>');
363 362
 
364 363
 	$s .= "<dl class='tech'>"
365 364
 		. join('', $infotech)
@@ -380,8 +379,8 @@  discard block
 block discarded – undo
380 379
 		$texte .=
381 380
 			(!is_array($_credit))
382 381
 				? PtoBR(propre($_credit))
383
-				: ($_credit['url'] ? '<a href="' . $_credit['url'] . '">' : '') .
384
-				$_credit['nom'] .
382
+				: ($_credit['url'] ? '<a href="'.$_credit['url'].'">' : '').
383
+				$_credit['nom'].
385 384
 				($_credit['url'] ? '</a>' : '');
386 385
 	}
387 386
 
Please login to merge, or discard this patch.
Indentation   +303 added lines, -303 removed lines patch added patch discarded remove patch
@@ -17,212 +17,212 @@  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('inc/charsets');
23 23
 include_spip('inc/texte');
24 24
 include_spip('inc/plugin'); // pour plugin_est_installe
25 25
 
26 26
 function plugins_afficher_plugin_dist(
27
-	$url_page,
28
-	$plug_file,
29
-	$checked,
30
-	$actif,
31
-	$expose = false,
32
-	$class_li = 'item',
33
-	$dir_plugins = _DIR_PLUGINS
27
+    $url_page,
28
+    $plug_file,
29
+    $checked,
30
+    $actif,
31
+    $expose = false,
32
+    $class_li = 'item',
33
+    $dir_plugins = _DIR_PLUGINS
34 34
 ) {
35 35
 
36
-	static $id_input = 0;
37
-	static $versions = [];
38
-
39
-	$force_reload = (_request('var_mode') == 'recalcul');
40
-	$get_infos = charger_fonction('get_infos', 'plugins');
41
-	$info = $get_infos($plug_file, $force_reload, $dir_plugins);
42
-	$prefix = $info['prefix'];
43
-	$cfg = '';
44
-	$checkable = ($dir_plugins !== _DIR_PLUGINS_DIST);
45
-	$nom = plugin_nom($info, $dir_plugins, $plug_file);
46
-	$erreur = '';
47
-
48
-	if (!plugin_version_compatible($info['compatibilite'], $GLOBALS['spip_version_branche'], 'spip')) {
49
-		$info['slogan'] = _T('plugin_info_non_compatible_spip');
50
-		$erreur = http_img_pack(
51
-			'plugin-dis-32.png',
52
-			_T('plugin_info_non_compatible_spip'),
53
-			" class='picto_err'",
54
-			_T('plugin_info_non_compatible_spip')
55
-		);
56
-		$class_li .= ' disabled';
57
-		$checkable = false;
58
-	} elseif (isset($info['erreur'])) {
59
-		$class_li .= ' error';
60
-		$erreur = http_img_pack(
61
-			'plugin-err-32.png',
62
-			_T('plugin_info_erreur_xml'),
63
-			" class='picto_err'",
64
-			_T('plugin_info_erreur_xml')
65
-		)
66
-			. "<div class='erreur'>" . join('<br >', $info['erreur']) . '</div>';
67
-		$checkable = false;
68
-	} elseif (isset($GLOBALS['erreurs_activation_raw'][$dir_plugins . $plug_file])) {
69
-		$class_li .= ' error';
70
-		$erreur = http_img_pack(
71
-			'plugin-err-32.png',
72
-			_T('plugin_impossible_activer', ['plugin' => $nom]),
73
-			" class='picto_err'",
74
-			_T('plugin_impossible_activer', ['plugin' => $nom])
75
-		)
76
-			. "<div class='erreur'>" . implode(
77
-				'<br />',
78
-				$GLOBALS['erreurs_activation_raw'][$dir_plugins . $plug_file]
79
-			) . '</div>';
80
-	} else {
81
-		$cfg = $actif ? plugin_bouton_config($plug_file, $info, $dir_plugins) : '';
82
-		if (defined('_DEV_VERSION_SPIP_COMPAT') and !plugin_version_compatible($info['compatibilite'], $GLOBALS['spip_version_branche'])) {
83
-			//$info['slogan'] = _T('plugin_info_non_compatible_spip');
84
-			$erreur = http_img_pack(
85
-				'plugin-dis-32.png',
86
-				_T('plugin_info_non_compatible_spip'),
87
-				" class='picto_err picto_compat_forcee'",
88
-				_L('Version incompatible : compatibilité forcée')
89
-			);
90
-		}
91
-	}
92
-
93
-	// numerotons les occurrences d'un meme prefix
94
-	$versions[$prefix] = $id = isset($versions[$prefix]) ? intval($versions[$prefix]) + 1 : '';
95
-
96
-	$class_li .= ($actif ? ' actif' : '') . ($expose ? ' on' : '');
97
-
98
-	return "<li id='$prefix$id' class='$class_li'>"
99
-	. ((!$checkable and !$checked)
100
-		? '' : plugin_checkbox(++$id_input, $dir_plugins . $plug_file, $checked))
101
-	. plugin_resume($info, $dir_plugins, $plug_file, $url_page)
102
-	. $cfg
103
-	. $erreur
104
-	. (($dir_plugins !== _DIR_PLUGINS_DIST and plugin_est_installe($plug_file))
105
-		? plugin_desintalle($plug_file, $nom, $dir_plugins) : '')
106
-	. "<div class='details'>" // pour l'ajax de exec/info_plugin
107
-	. (!$expose ? '' : affiche_bloc_plugin($plug_file, $info, $dir_plugins))
108
-	. '</div>'
109
-	. '</li>';
36
+    static $id_input = 0;
37
+    static $versions = [];
38
+
39
+    $force_reload = (_request('var_mode') == 'recalcul');
40
+    $get_infos = charger_fonction('get_infos', 'plugins');
41
+    $info = $get_infos($plug_file, $force_reload, $dir_plugins);
42
+    $prefix = $info['prefix'];
43
+    $cfg = '';
44
+    $checkable = ($dir_plugins !== _DIR_PLUGINS_DIST);
45
+    $nom = plugin_nom($info, $dir_plugins, $plug_file);
46
+    $erreur = '';
47
+
48
+    if (!plugin_version_compatible($info['compatibilite'], $GLOBALS['spip_version_branche'], 'spip')) {
49
+        $info['slogan'] = _T('plugin_info_non_compatible_spip');
50
+        $erreur = http_img_pack(
51
+            'plugin-dis-32.png',
52
+            _T('plugin_info_non_compatible_spip'),
53
+            " class='picto_err'",
54
+            _T('plugin_info_non_compatible_spip')
55
+        );
56
+        $class_li .= ' disabled';
57
+        $checkable = false;
58
+    } elseif (isset($info['erreur'])) {
59
+        $class_li .= ' error';
60
+        $erreur = http_img_pack(
61
+            'plugin-err-32.png',
62
+            _T('plugin_info_erreur_xml'),
63
+            " class='picto_err'",
64
+            _T('plugin_info_erreur_xml')
65
+        )
66
+            . "<div class='erreur'>" . join('<br >', $info['erreur']) . '</div>';
67
+        $checkable = false;
68
+    } elseif (isset($GLOBALS['erreurs_activation_raw'][$dir_plugins . $plug_file])) {
69
+        $class_li .= ' error';
70
+        $erreur = http_img_pack(
71
+            'plugin-err-32.png',
72
+            _T('plugin_impossible_activer', ['plugin' => $nom]),
73
+            " class='picto_err'",
74
+            _T('plugin_impossible_activer', ['plugin' => $nom])
75
+        )
76
+            . "<div class='erreur'>" . implode(
77
+                '<br />',
78
+                $GLOBALS['erreurs_activation_raw'][$dir_plugins . $plug_file]
79
+            ) . '</div>';
80
+    } else {
81
+        $cfg = $actif ? plugin_bouton_config($plug_file, $info, $dir_plugins) : '';
82
+        if (defined('_DEV_VERSION_SPIP_COMPAT') and !plugin_version_compatible($info['compatibilite'], $GLOBALS['spip_version_branche'])) {
83
+            //$info['slogan'] = _T('plugin_info_non_compatible_spip');
84
+            $erreur = http_img_pack(
85
+                'plugin-dis-32.png',
86
+                _T('plugin_info_non_compatible_spip'),
87
+                " class='picto_err picto_compat_forcee'",
88
+                _L('Version incompatible : compatibilité forcée')
89
+            );
90
+        }
91
+    }
92
+
93
+    // numerotons les occurrences d'un meme prefix
94
+    $versions[$prefix] = $id = isset($versions[$prefix]) ? intval($versions[$prefix]) + 1 : '';
95
+
96
+    $class_li .= ($actif ? ' actif' : '') . ($expose ? ' on' : '');
97
+
98
+    return "<li id='$prefix$id' class='$class_li'>"
99
+    . ((!$checkable and !$checked)
100
+        ? '' : plugin_checkbox(++$id_input, $dir_plugins . $plug_file, $checked))
101
+    . plugin_resume($info, $dir_plugins, $plug_file, $url_page)
102
+    . $cfg
103
+    . $erreur
104
+    . (($dir_plugins !== _DIR_PLUGINS_DIST and plugin_est_installe($plug_file))
105
+        ? plugin_desintalle($plug_file, $nom, $dir_plugins) : '')
106
+    . "<div class='details'>" // pour l'ajax de exec/info_plugin
107
+    . (!$expose ? '' : affiche_bloc_plugin($plug_file, $info, $dir_plugins))
108
+    . '</div>'
109
+    . '</li>';
110 110
 }
111 111
 
112 112
 function plugin_bouton_config($nom, $infos, $dir) {
113
-	// la verification se base sur le filesystem
114
-	// il faut donc n'utiliser que des minuscules, par convention
115
-	$prefix = strtolower($infos['prefix']);
116
-	// si paquet.xml fournit un squelette, le prendre
117
-	if (isset($infos['config']) and $infos['config']) {
118
-		return recuperer_fond(
119
-			"$dir$nom/" . $infos['config'],
120
-			[
121
-				'script' => 'configurer_' . $prefix,
122
-				'nom' => $nom
123
-			]
124
-		);
125
-	}
126
-
127
-	// sinon prendre le squelette std sur le nom std
128
-	return recuperer_fond(
129
-		'prive/squelettes/inclure/cfg',
130
-		[
131
-			'script' => 'configurer_' . $prefix,
132
-			'nom' => $nom
133
-		]
134
-	);
113
+    // la verification se base sur le filesystem
114
+    // il faut donc n'utiliser que des minuscules, par convention
115
+    $prefix = strtolower($infos['prefix']);
116
+    // si paquet.xml fournit un squelette, le prendre
117
+    if (isset($infos['config']) and $infos['config']) {
118
+        return recuperer_fond(
119
+            "$dir$nom/" . $infos['config'],
120
+            [
121
+                'script' => 'configurer_' . $prefix,
122
+                'nom' => $nom
123
+            ]
124
+        );
125
+    }
126
+
127
+    // sinon prendre le squelette std sur le nom std
128
+    return recuperer_fond(
129
+        'prive/squelettes/inclure/cfg',
130
+        [
131
+            'script' => 'configurer_' . $prefix,
132
+            'nom' => $nom
133
+        ]
134
+    );
135 135
 }
136 136
 
137 137
 // checkbox pour activer ou desactiver
138 138
 // si ce n'est pas une extension
139 139
 
140 140
 function plugin_checkbox($id_input, $file, $actif) {
141
-	$name = substr(md5($file), 0, 16);
142
-
143
-	return "<div class='check'>\n"
144
-	. "<input type='checkbox' name='s$name' id='label_$id_input'"
145
-	. ($actif ? " checked='checked'" : '')
146
-	. " class='checkbox'  value='O' />"
147
-	. "\n<label for='label_$id_input'>" . _T('activer_plugin') . '</label>'
148
-	. '</div>';
141
+    $name = substr(md5($file), 0, 16);
142
+
143
+    return "<div class='check'>\n"
144
+    . "<input type='checkbox' name='s$name' id='label_$id_input'"
145
+    . ($actif ? " checked='checked'" : '')
146
+    . " class='checkbox'  value='O' />"
147
+    . "\n<label for='label_$id_input'>" . _T('activer_plugin') . '</label>'
148
+    . '</div>';
149 149
 }
150 150
 
151 151
 function plugin_nom($info, $dir_plugins, $plug_file) {
152
-	$prefix = $info['prefix'];
153
-	$dir = "$dir_plugins$plug_file";
154
-	// Si dtd paquet, on traite le nom soit par son item de langue soit par sa valeur immediate a l'index "nom"
155
-	if ($info['dtd'] == 'paquet') {
156
-		$nom = plugin_typo("{$prefix}_nom", "$dir/lang/paquet-$prefix");
157
-		if (!$nom) {
158
-			$nom = typo($info['nom']);
159
-		}
160
-	} else {
161
-		$nom = typo(attribut_html($info['nom']));
162
-	}
163
-
164
-	return trim($nom);
152
+    $prefix = $info['prefix'];
153
+    $dir = "$dir_plugins$plug_file";
154
+    // Si dtd paquet, on traite le nom soit par son item de langue soit par sa valeur immediate a l'index "nom"
155
+    if ($info['dtd'] == 'paquet') {
156
+        $nom = plugin_typo("{$prefix}_nom", "$dir/lang/paquet-$prefix");
157
+        if (!$nom) {
158
+            $nom = typo($info['nom']);
159
+        }
160
+    } else {
161
+        $nom = typo(attribut_html($info['nom']));
162
+    }
163
+
164
+    return trim($nom);
165 165
 }
166 166
 
167 167
 // Cartouche Resume
168 168
 function plugin_resume($info, $dir_plugins, $plug_file, $url_page) {
169
-	$prefix = $info['prefix'];
170
-	$dir = "$dir_plugins$plug_file";
171
-	$slogan = PtoBR(plugin_propre($info['slogan'], "$dir/lang/paquet-$prefix"));
172
-	// une seule ligne dans le slogan : couper si besoin
173
-	if (($p = strpos($slogan, '<br />')) !== false) {
174
-		$slogan = substr($slogan, 0, $p);
175
-	}
176
-	// couper par securite
177
-	$slogan = couper($slogan, 80);
178
-
179
-	$nom = plugin_nom($info, $dir_plugins, $plug_file);
180
-
181
-	$url = parametre_url($url_page, 'plugin', substr($dir, strlen(_DIR_RACINE)));
182
-
183
-	$icon_class = 'icon';
184
-	$img = '';
185
-	if (isset($info['logo']) and $i = trim($info['logo'])) {
186
-		$img = http_img_pack("$dir/$i", '', " width='32' height='32'", '', ['variante_svg_si_possible' => true, 'chemin_image' => false]);
187
-		if (!extraire_attribut($img, 'src')) {
188
-			$img = '';
189
-		}
190
-	}
191
-	if (!$img) {
192
-		$img = http_img_pack('plugin-xx.svg', '', " width='32' height='32'");
193
-		$icon_class .= ' no-logo';
194
-	}
195
-
196
-	$i = "<div class='$icon_class'><a href='$url' rel='info'>$img</a></div>";
197
-
198
-	return "<div class='resume'>"
199
-	. "<h3><a href='$url' rel='info'>"
200
-	. $nom
201
-	. '</a></h3>'
202
-	. " <span class='version'>" . $info['version'] . '</span>'
203
-	. " <span class='etat'> - "
204
-	. plugin_etat_en_clair($info['etat'])
205
-	. '</span>'
206
-	. "<div class='short'>" . $slogan . '</div>'
207
-	. $i
208
-	. '</div>';
169
+    $prefix = $info['prefix'];
170
+    $dir = "$dir_plugins$plug_file";
171
+    $slogan = PtoBR(plugin_propre($info['slogan'], "$dir/lang/paquet-$prefix"));
172
+    // une seule ligne dans le slogan : couper si besoin
173
+    if (($p = strpos($slogan, '<br />')) !== false) {
174
+        $slogan = substr($slogan, 0, $p);
175
+    }
176
+    // couper par securite
177
+    $slogan = couper($slogan, 80);
178
+
179
+    $nom = plugin_nom($info, $dir_plugins, $plug_file);
180
+
181
+    $url = parametre_url($url_page, 'plugin', substr($dir, strlen(_DIR_RACINE)));
182
+
183
+    $icon_class = 'icon';
184
+    $img = '';
185
+    if (isset($info['logo']) and $i = trim($info['logo'])) {
186
+        $img = http_img_pack("$dir/$i", '', " width='32' height='32'", '', ['variante_svg_si_possible' => true, 'chemin_image' => false]);
187
+        if (!extraire_attribut($img, 'src')) {
188
+            $img = '';
189
+        }
190
+    }
191
+    if (!$img) {
192
+        $img = http_img_pack('plugin-xx.svg', '', " width='32' height='32'");
193
+        $icon_class .= ' no-logo';
194
+    }
195
+
196
+    $i = "<div class='$icon_class'><a href='$url' rel='info'>$img</a></div>";
197
+
198
+    return "<div class='resume'>"
199
+    . "<h3><a href='$url' rel='info'>"
200
+    . $nom
201
+    . '</a></h3>'
202
+    . " <span class='version'>" . $info['version'] . '</span>'
203
+    . " <span class='etat'> - "
204
+    . plugin_etat_en_clair($info['etat'])
205
+    . '</span>'
206
+    . "<div class='short'>" . $slogan . '</div>'
207
+    . $i
208
+    . '</div>';
209 209
 }
210 210
 
211 211
 function plugin_desintalle($plug_file, $nom, $dir_plugins = null) {
212
-	if (!$dir_plugins) {
213
-		$dir_plugins = _DIR_PLUGINS;
214
-	}
212
+    if (!$dir_plugins) {
213
+        $dir_plugins = _DIR_PLUGINS;
214
+    }
215 215
 
216
-	$action = redirige_action_auteur('desinstaller_plugin', "$dir_plugins::$plug_file", 'admin_plugin');
217
-	$text = _T('bouton_desinstaller');
218
-	$text2 = _T('info_desinstaller_plugin');
219
-	$file = basename($plug_file);
216
+    $action = redirige_action_auteur('desinstaller_plugin', "$dir_plugins::$plug_file", 'admin_plugin');
217
+    $text = _T('bouton_desinstaller');
218
+    $text2 = _T('info_desinstaller_plugin');
219
+    $file = basename($plug_file);
220 220
 
221
-	return "<div class='actions'>[" .
222
-	"<a href='$action'
221
+    return "<div class='actions'>[" .
222
+    "<a href='$action'
223 223
 		onclick='return confirm(\"$text $nom ?\\n$text2\")'>"
224
-	. $text
225
-	. '</a>]</div>';
224
+    . $text
225
+    . '</a>]</div>';
226 226
 }
227 227
 
228 228
 /**
@@ -236,145 +236,145 @@  discard block
 block discarded – undo
236 236
  *     Traduction de l'état dans la langue en cours
237 237
  **/
238 238
 function plugin_etat_en_clair($etat) {
239
-	if (!in_array($etat, ['stable', 'test', 'experimental'])) {
240
-		$etat = 'developpement';
241
-	}
239
+    if (!in_array($etat, ['stable', 'test', 'experimental'])) {
240
+        $etat = 'developpement';
241
+    }
242 242
 
243
-	return _T('plugin_etat_' . $etat);
243
+    return _T('plugin_etat_' . $etat);
244 244
 }
245 245
 
246 246
 function plugin_propre($texte, $module = '', $propre = 'propre') {
247
-	// retirer le retour a la racine du module, car le find_in_path se fait depuis la racine
248
-	if (_DIR_RACINE and strncmp($module, _DIR_RACINE, strlen(_DIR_RACINE)) == 0) {
249
-		$module = substr($module, strlen(_DIR_RACINE));
250
-	}
251
-	if (preg_match('|^\w+_[\w_]+$|', $texte)) {
252
-		$texte = _T(($module ? "$module:" : '') . $texte, [], ['force' => false]);
253
-	}
254
-
255
-	return $propre($texte);
247
+    // retirer le retour a la racine du module, car le find_in_path se fait depuis la racine
248
+    if (_DIR_RACINE and strncmp($module, _DIR_RACINE, strlen(_DIR_RACINE)) == 0) {
249
+        $module = substr($module, strlen(_DIR_RACINE));
250
+    }
251
+    if (preg_match('|^\w+_[\w_]+$|', $texte)) {
252
+        $texte = _T(($module ? "$module:" : '') . $texte, [], ['force' => false]);
253
+    }
254
+
255
+    return $propre($texte);
256 256
 }
257 257
 
258 258
 function plugin_typo($texte, $module = '') {
259
-	return plugin_propre($texte, $module, 'typo');
259
+    return plugin_propre($texte, $module, 'typo');
260 260
 }
261 261
 
262 262
 
263 263
 function affiche_bloc_plugin($plug_file, $info, $dir_plugins = null) {
264
-	$log = null;
265
-	if (!$dir_plugins) {
266
-		$dir_plugins = _DIR_PLUGINS;
267
-	}
268
-
269
-	$prefix = $info['prefix'];
270
-	$dir = "$dir_plugins$plug_file/lang/paquet-$prefix";
271
-
272
-	$s = '';
273
-	// TODO: le traiter_multi ici n'est pas beau
274
-	// cf. description du plugin/_stable_/ortho/plugin.xml
275
-	// concerne les anciens plugin.xml donc on devrait plus en avoir besoin
276
-	$description = '';
277
-	if (isset($info['description'])) {
278
-		$description = plugin_propre($info['description'], $dir);
279
-	}
280
-
281
-	if (
282
-		isset($info['documentation'])
283
-		and $lien = $info['documentation']
284
-	) {
285
-		$description .= "<p><em class='site'><a href='$lien' class='spip_out'>" . _T('en_savoir_plus') . '</a></em></p>';
286
-	}
287
-	$s .= "<dd class='desc'>" . $description . "</dd>\n";
288
-
289
-	if (isset($info['auteur'])) {
290
-		if (is_array($info['auteur'])) {
291
-			$a = formater_credits($info['auteur'], ', ');
292
-		} // pour compat mais ne doit plus arriver
293
-		else {
294
-			$a = trim($info['auteur']);
295
-		}
296
-		if ($a) {
297
-			$s .= "<dt class='auteurs'>" . _T('public:par_auteur') . "</dt><dd class='auteurs'>" . PtoBR(propre(
298
-				$a,
299
-				$dir
300
-			)) . "</dd>\n";
301
-		}
302
-	}
303
-
304
-	if (isset($info['credit'])) {
305
-		if ($a = formater_credits($info['credit'], ', ')) {
306
-			$s .= "<dt class='credits'>" . _T('plugin_info_credit') . "</dt><dd class='credits'>" . PtoBR(propre(
307
-				$a,
308
-				$dir
309
-			)) . "</dd>\n";
310
-		}
311
-	}
312
-
313
-	if (isset($info['licence'])) {
314
-		if (is_array($info['licence'])) {
315
-			$a = formater_credits($info['licence'], ', ');
316
-		} // pour compat mais ne doit plus arriver
317
-		else {
318
-			$a = trim($info['licence']);
319
-		}
320
-		if ($a) {
321
-			$s .= "<dt class='licence'>" . _T('intitule_licence') . "</dt><dd class='licence'>" . PtoBR(propre(
322
-				$a,
323
-				$dir
324
-			)) . "</dd>\n";
325
-		}
326
-	}
327
-
328
-	$s = "<dl class='description'>$s</dl>";
329
-
330
-	//
331
-	// Ajouter les infos techniques
332
-	//
333
-	$infotech = [];
334
-
335
-	$version = '<dt>' . _T('version') . '</dt><dd>' . $info['version'];
336
-	// Version VCS
337
-	if ($vcs = version_vcs_courante($dir_plugins . $plug_file)) {
338
-		$version .= ' ' . $vcs;
339
-	}
340
-	$version .= '</dd>';
341
-	$infotech[] = $version;
342
-	$infotech[] = '<dt>' . _T('repertoire_plugins') . '</dt><dd>' . joli_repertoire("$dir_plugins$plug_file") . '</dd>';
343
-	// source zip le cas echeant
344
-	$infotech[] = (lire_fichier($dir_plugins . $plug_file . '/install.log', $log)
345
-		and preg_match(',^source:(.*)$,m', $log, $r))
346
-		? '<dt>' . _T('plugin_source') . '</dt><dd>' . trim($r[1]) . '</dd>'
347
-		: '';
348
-
349
-	$infotech[] = !$info['necessite'] ? '' :
350
-		('<dt>' . _T('plugin_info_necessite') . '</dt><dd>' . join(
351
-			' ',
352
-			array_map('array_shift', $info['necessite'])
353
-		) . '</dd>');
354
-
355
-	$s .= "<dl class='tech'>"
356
-		. join('', $infotech)
357
-		. '</dl>';
358
-
359
-
360
-	return $s;
264
+    $log = null;
265
+    if (!$dir_plugins) {
266
+        $dir_plugins = _DIR_PLUGINS;
267
+    }
268
+
269
+    $prefix = $info['prefix'];
270
+    $dir = "$dir_plugins$plug_file/lang/paquet-$prefix";
271
+
272
+    $s = '';
273
+    // TODO: le traiter_multi ici n'est pas beau
274
+    // cf. description du plugin/_stable_/ortho/plugin.xml
275
+    // concerne les anciens plugin.xml donc on devrait plus en avoir besoin
276
+    $description = '';
277
+    if (isset($info['description'])) {
278
+        $description = plugin_propre($info['description'], $dir);
279
+    }
280
+
281
+    if (
282
+        isset($info['documentation'])
283
+        and $lien = $info['documentation']
284
+    ) {
285
+        $description .= "<p><em class='site'><a href='$lien' class='spip_out'>" . _T('en_savoir_plus') . '</a></em></p>';
286
+    }
287
+    $s .= "<dd class='desc'>" . $description . "</dd>\n";
288
+
289
+    if (isset($info['auteur'])) {
290
+        if (is_array($info['auteur'])) {
291
+            $a = formater_credits($info['auteur'], ', ');
292
+        } // pour compat mais ne doit plus arriver
293
+        else {
294
+            $a = trim($info['auteur']);
295
+        }
296
+        if ($a) {
297
+            $s .= "<dt class='auteurs'>" . _T('public:par_auteur') . "</dt><dd class='auteurs'>" . PtoBR(propre(
298
+                $a,
299
+                $dir
300
+            )) . "</dd>\n";
301
+        }
302
+    }
303
+
304
+    if (isset($info['credit'])) {
305
+        if ($a = formater_credits($info['credit'], ', ')) {
306
+            $s .= "<dt class='credits'>" . _T('plugin_info_credit') . "</dt><dd class='credits'>" . PtoBR(propre(
307
+                $a,
308
+                $dir
309
+            )) . "</dd>\n";
310
+        }
311
+    }
312
+
313
+    if (isset($info['licence'])) {
314
+        if (is_array($info['licence'])) {
315
+            $a = formater_credits($info['licence'], ', ');
316
+        } // pour compat mais ne doit plus arriver
317
+        else {
318
+            $a = trim($info['licence']);
319
+        }
320
+        if ($a) {
321
+            $s .= "<dt class='licence'>" . _T('intitule_licence') . "</dt><dd class='licence'>" . PtoBR(propre(
322
+                $a,
323
+                $dir
324
+            )) . "</dd>\n";
325
+        }
326
+    }
327
+
328
+    $s = "<dl class='description'>$s</dl>";
329
+
330
+    //
331
+    // Ajouter les infos techniques
332
+    //
333
+    $infotech = [];
334
+
335
+    $version = '<dt>' . _T('version') . '</dt><dd>' . $info['version'];
336
+    // Version VCS
337
+    if ($vcs = version_vcs_courante($dir_plugins . $plug_file)) {
338
+        $version .= ' ' . $vcs;
339
+    }
340
+    $version .= '</dd>';
341
+    $infotech[] = $version;
342
+    $infotech[] = '<dt>' . _T('repertoire_plugins') . '</dt><dd>' . joli_repertoire("$dir_plugins$plug_file") . '</dd>';
343
+    // source zip le cas echeant
344
+    $infotech[] = (lire_fichier($dir_plugins . $plug_file . '/install.log', $log)
345
+        and preg_match(',^source:(.*)$,m', $log, $r))
346
+        ? '<dt>' . _T('plugin_source') . '</dt><dd>' . trim($r[1]) . '</dd>'
347
+        : '';
348
+
349
+    $infotech[] = !$info['necessite'] ? '' :
350
+        ('<dt>' . _T('plugin_info_necessite') . '</dt><dd>' . join(
351
+            ' ',
352
+            array_map('array_shift', $info['necessite'])
353
+        ) . '</dd>');
354
+
355
+    $s .= "<dl class='tech'>"
356
+        . join('', $infotech)
357
+        . '</dl>';
358
+
359
+
360
+    return $s;
361 361
 }
362 362
 
363 363
 function formater_credits($infos, $sep = ', ') {
364
-	$texte = '';
365
-
366
-	foreach ($infos as $_credit) {
367
-		if ($texte) {
368
-			$texte .= $sep;
369
-		}
370
-		// Si le credit en cours n'est pas un array c'est donc un copyright
371
-		$texte .=
372
-			(!is_array($_credit))
373
-				? PtoBR(propre($_credit))
374
-				: ($_credit['url'] ? '<a href="' . $_credit['url'] . '">' : '') .
375
-				$_credit['nom'] .
376
-				($_credit['url'] ? '</a>' : '');
377
-	}
378
-
379
-	return $texte;
364
+    $texte = '';
365
+
366
+    foreach ($infos as $_credit) {
367
+        if ($texte) {
368
+            $texte .= $sep;
369
+        }
370
+        // Si le credit en cours n'est pas un array c'est donc un copyright
371
+        $texte .=
372
+            (!is_array($_credit))
373
+                ? PtoBR(propre($_credit))
374
+                : ($_credit['url'] ? '<a href="' . $_credit['url'] . '">' : '') .
375
+                $_credit['nom'] .
376
+                ($_credit['url'] ? '</a>' : '');
377
+    }
378
+
379
+    return $texte;
380 380
 }
Please login to merge, or discard this patch.