Completed
Push — master ( ec6233...9f2fe8 )
by cam
01:28
created
prive/formulaires/configurer_previsualiseur.php 2 patches
Indentation   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -11,28 +11,28 @@
 block discarded – undo
11 11
 \***************************************************************************/
12 12
 
13 13
 if (!defined('_ECRIRE_INC_VERSION')) {
14
-	return;
14
+    return;
15 15
 }
16 16
 include_spip('inc/presentation');
17 17
 
18 18
 function formulaires_configurer_previsualiseur_charger_dist() {
19
-	$valeurs = [];
20
-	$valeurs['preview'] = explode(',', $GLOBALS['meta']['preview']);
19
+    $valeurs = [];
20
+    $valeurs['preview'] = explode(',', $GLOBALS['meta']['preview']);
21 21
 
22
-	return $valeurs;
22
+    return $valeurs;
23 23
 }
24 24
 
25 25
 
26 26
 function formulaires_configurer_previsualiseur_traiter_dist() {
27
-	$res = ['editable' => true];
27
+    $res = ['editable' => true];
28 28
 
29
-	if ($i = _request('preview') and is_array($i)) {
30
-		$i = ',' . implode(',', $i) . ',';
31
-	}
29
+    if ($i = _request('preview') and is_array($i)) {
30
+        $i = ',' . implode(',', $i) . ',';
31
+    }
32 32
 
33
-	ecrire_meta('preview', $i);
33
+    ecrire_meta('preview', $i);
34 34
 
35
-	$res['message_ok'] = _T('config_info_enregistree');
35
+    $res['message_ok'] = _T('config_info_enregistree');
36 36
 
37
-	return $res;
37
+    return $res;
38 38
 }
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -27,7 +27,7 @@
 block discarded – undo
27 27
 	$res = ['editable' => true];
28 28
 
29 29
 	if ($i = _request('preview') and is_array($i)) {
30
-		$i = ',' . implode(',', $i) . ',';
30
+		$i = ','.implode(',', $i).',';
31 31
 	}
32 32
 
33 33
 	ecrire_meta('preview', $i);
Please login to merge, or discard this patch.
prive/formulaires/rediriger_article.php 2 patches
Indentation   +45 added lines, -45 removed lines patch added patch discarded remove patch
@@ -11,65 +11,65 @@
 block discarded – undo
11 11
 \***************************************************************************/
12 12
 
13 13
 if (!defined('_ECRIRE_INC_VERSION')) {
14
-	return;
14
+    return;
15 15
 }
16 16
 
17 17
 function formulaires_rediriger_article_charger_dist($id_article, $retour = '') {
18 18
 
19
-	include_spip('inc/autoriser');
20
-	if (!autoriser('modifier', 'article', $id_article)) {
21
-		return false;
22
-	}
23
-
24
-	$row = sql_fetsel('id_article,virtuel', 'spip_articles', 'id_article=' . intval($id_article));
25
-	if (!$row['id_article']) {
26
-		return false;
27
-	}
28
-	include_spip('inc/lien');
29
-	$redirection = virtuel_redirige($row['virtuel']);
30
-
31
-	if (
32
-		!$redirection
33
-		and $GLOBALS['meta']['articles_redirection'] != 'oui'
34
-	) {
35
-		return false;
36
-	}
37
-
38
-
39
-	include_spip('inc/texte');
40
-	$valeurs = [
41
-		'redirection' => $redirection,
42
-		'id' => $id_article,
43
-		'_afficher_url' => ($redirection ? propre("[->$redirection]") : ''),
44
-	];
45
-
46
-	return $valeurs;
19
+    include_spip('inc/autoriser');
20
+    if (!autoriser('modifier', 'article', $id_article)) {
21
+        return false;
22
+    }
23
+
24
+    $row = sql_fetsel('id_article,virtuel', 'spip_articles', 'id_article=' . intval($id_article));
25
+    if (!$row['id_article']) {
26
+        return false;
27
+    }
28
+    include_spip('inc/lien');
29
+    $redirection = virtuel_redirige($row['virtuel']);
30
+
31
+    if (
32
+        !$redirection
33
+        and $GLOBALS['meta']['articles_redirection'] != 'oui'
34
+    ) {
35
+        return false;
36
+    }
37
+
38
+
39
+    include_spip('inc/texte');
40
+    $valeurs = [
41
+        'redirection' => $redirection,
42
+        'id' => $id_article,
43
+        '_afficher_url' => ($redirection ? propre("[->$redirection]") : ''),
44
+    ];
45
+
46
+    return $valeurs;
47 47
 }
48 48
 
49 49
 function formulaires_rediriger_article_verifier_dist($id_article, $retour = '') {
50
-	$erreurs = [];
50
+    $erreurs = [];
51 51
 
52
-	if (($redirection = _request('redirection')) == $id_article || $redirection == 'art' . $id_article) {
53
-		$erreurs['redirection'] = _T('info_redirection_boucle');
54
-	}
52
+    if (($redirection = _request('redirection')) == $id_article || $redirection == 'art' . $id_article) {
53
+        $erreurs['redirection'] = _T('info_redirection_boucle');
54
+    }
55 55
 
56
-	return $erreurs;
56
+    return $erreurs;
57 57
 }
58 58
 
59 59
 function formulaires_rediriger_article_traiter_dist($id_article, $retour = '') {
60 60
 
61
-	$url = preg_replace(',^\s*https?://$,i', '', rtrim(_request('redirection')));
62
-	if ($url) {
63
-		$url = corriger_caracteres($url);
64
-	}
61
+    $url = preg_replace(',^\s*https?://$,i', '', rtrim(_request('redirection')));
62
+    if ($url) {
63
+        $url = corriger_caracteres($url);
64
+    }
65 65
 
66
-	include_spip('action/editer_article');
67
-	article_modifier($id_article, ['virtuel' => $url]);
66
+    include_spip('action/editer_article');
67
+    article_modifier($id_article, ['virtuel' => $url]);
68 68
 
69
-	$js = _AJAX ? '<script type="text/javascript">if (window.ajaxReload) ajaxReload("wysiwyg");</script>' : '';
69
+    $js = _AJAX ? '<script type="text/javascript">if (window.ajaxReload) ajaxReload("wysiwyg");</script>' : '';
70 70
 
71
-	return [
72
-		'message_ok' => ($url ? _T('info_redirection_activee') : _T('info_redirection_desactivee')) . $js,
73
-		'editable' => true
74
-	];
71
+    return [
72
+        'message_ok' => ($url ? _T('info_redirection_activee') : _T('info_redirection_desactivee')) . $js,
73
+        'editable' => true
74
+    ];
75 75
 }
Please login to merge, or discard this patch.
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -21,7 +21,7 @@  discard block
 block discarded – undo
21 21
 		return false;
22 22
 	}
23 23
 
24
-	$row = sql_fetsel('id_article,virtuel', 'spip_articles', 'id_article=' . intval($id_article));
24
+	$row = sql_fetsel('id_article,virtuel', 'spip_articles', 'id_article='.intval($id_article));
25 25
 	if (!$row['id_article']) {
26 26
 		return false;
27 27
 	}
@@ -49,7 +49,7 @@  discard block
 block discarded – undo
49 49
 function formulaires_rediriger_article_verifier_dist($id_article, $retour = '') {
50 50
 	$erreurs = [];
51 51
 
52
-	if (($redirection = _request('redirection')) == $id_article || $redirection == 'art' . $id_article) {
52
+	if (($redirection = _request('redirection')) == $id_article || $redirection == 'art'.$id_article) {
53 53
 		$erreurs['redirection'] = _T('info_redirection_boucle');
54 54
 	}
55 55
 
@@ -69,7 +69,7 @@  discard block
 block discarded – undo
69 69
 	$js = _AJAX ? '<script type="text/javascript">if (window.ajaxReload) ajaxReload("wysiwyg");</script>' : '';
70 70
 
71 71
 	return [
72
-		'message_ok' => ($url ? _T('info_redirection_activee') : _T('info_redirection_desactivee')) . $js,
72
+		'message_ok' => ($url ? _T('info_redirection_activee') : _T('info_redirection_desactivee')).$js,
73 73
 		'editable' => true
74 74
 	];
75 75
 }
Please login to merge, or discard this patch.
prive/formulaires/configurer_logos.php 1 patch
Indentation   +27 added lines, -27 removed lines patch added patch discarded remove patch
@@ -11,38 +11,38 @@
 block discarded – undo
11 11
 \***************************************************************************/
12 12
 
13 13
 if (!defined('_ECRIRE_INC_VERSION')) {
14
-	return;
14
+    return;
15 15
 }
16 16
 
17 17
 function formulaires_configurer_logos_charger_dist() {
18
-	$valeurs = [];
19
-	foreach (
20
-		[
21
-		'activer_logos',
22
-		'activer_logos_survol'
23
-		] as $m
24
-	) {
25
-		$valeurs[$m] = $GLOBALS['meta'][$m];
26
-	}
27
-
28
-	return $valeurs;
18
+    $valeurs = [];
19
+    foreach (
20
+        [
21
+        'activer_logos',
22
+        'activer_logos_survol'
23
+        ] as $m
24
+    ) {
25
+        $valeurs[$m] = $GLOBALS['meta'][$m];
26
+    }
27
+
28
+    return $valeurs;
29 29
 }
30 30
 
31 31
 
32 32
 function formulaires_configurer_logos_traiter_dist() {
33
-	$res = ['editable' => true];
34
-	foreach (
35
-		[
36
-		'activer_logos',
37
-		'activer_logos_survol',
38
-		] as $m
39
-	) {
40
-		if (!is_null($v = _request($m))) {
41
-			ecrire_meta($m, $v == 'oui' ? 'oui' : 'non');
42
-		}
43
-	}
44
-
45
-	$res['message_ok'] = _T('config_info_enregistree');
46
-
47
-	return $res;
33
+    $res = ['editable' => true];
34
+    foreach (
35
+        [
36
+        'activer_logos',
37
+        'activer_logos_survol',
38
+        ] as $m
39
+    ) {
40
+        if (!is_null($v = _request($m))) {
41
+            ecrire_meta($m, $v == 'oui' ? 'oui' : 'non');
42
+        }
43
+    }
44
+
45
+    $res['message_ok'] = _T('config_info_enregistree');
46
+
47
+    return $res;
48 48
 }
Please login to merge, or discard this patch.
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' => isset($desc['texte_changer_statut']) ? $desc['texte_changer_statut'] : 'texte_article_statut',
109
-		'_aide' => isset($desc['aide_changer_statut']) ? $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' => isset($desc['texte_changer_statut']) ? $desc['texte_changer_statut'] : 'texte_article_statut',
109
+        '_aide' => isset($desc['aide_changer_statut']) ? $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' => isset($desc['texte_changer_statut']) ? $desc['texte_changer_statut'] : 'texte_article_statut',
109 109
 		'_aide' => isset($desc['aide_changer_statut']) ? $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/configurer_preferences_menus.php 1 patch
Indentation   +30 added lines, -30 removed lines patch added patch discarded remove patch
@@ -30,13 +30,13 @@  discard block
 block discarded – undo
30 30
  *     Environnement du formulaire
31 31
  **/
32 32
 function formulaires_configurer_preferences_menus_charger_dist() {
33
-	// travailler sur des meta fraîches
34
-	include_spip('inc/meta');
35
-	lire_metas();
36
-	$valeurs = [];
37
-	$valeurs['activer_menudev'] = table_valeur($GLOBALS['visiteur_session'], 'prefs/activer_menudev', 'non');
38
-	$valeurs['menus_favoris'] = obtenir_menus_favoris();
39
-	return $valeurs;
33
+    // travailler sur des meta fraîches
34
+    include_spip('inc/meta');
35
+    lire_metas();
36
+    $valeurs = [];
37
+    $valeurs['activer_menudev'] = table_valeur($GLOBALS['visiteur_session'], 'prefs/activer_menudev', 'non');
38
+    $valeurs['menus_favoris'] = obtenir_menus_favoris();
39
+    return $valeurs;
40 40
 }
41 41
 
42 42
 /**
@@ -47,32 +47,32 @@  discard block
 block discarded – undo
47 47
  **/
48 48
 function formulaires_configurer_preferences_menus_traiter_dist() {
49 49
 
50
-	$activer_menudev = _request('activer_menudev');
51
-	$menus_favoris = _request('menus_favoris');
52
-	$menus_favoris = array_filter($menus_favoris);
53
-	$menus_favoris = array_map('intval', $menus_favoris);
50
+    $activer_menudev = _request('activer_menudev');
51
+    $menus_favoris = _request('menus_favoris');
52
+    $menus_favoris = array_filter($menus_favoris);
53
+    $menus_favoris = array_map('intval', $menus_favoris);
54 54
 
55
-	if (_request('reset')) {
56
-		$menus_favoris = [];
57
-		set_request('menus_favoris', null);
58
-	}
55
+    if (_request('reset')) {
56
+        $menus_favoris = [];
57
+        set_request('menus_favoris', null);
58
+    }
59 59
 
60
-	// si le menu dev change, ou les menus favoris, on recharge toute la page.
61
-	if (
62
-		table_valeur($GLOBALS['visiteur_session'], 'prefs/activer_menudev') != $activer_menudev
63
-		or $menus_favoris != obtenir_menus_favoris()
64
-	) {
65
-		refuser_traiter_formulaire_ajax();
60
+    // si le menu dev change, ou les menus favoris, on recharge toute la page.
61
+    if (
62
+        table_valeur($GLOBALS['visiteur_session'], 'prefs/activer_menudev') != $activer_menudev
63
+        or $menus_favoris != obtenir_menus_favoris()
64
+    ) {
65
+        refuser_traiter_formulaire_ajax();
66 66
 
67
-		$GLOBALS['visiteur_session']['prefs']['activer_menudev'] = $activer_menudev;
68
-		$GLOBALS['visiteur_session']['prefs']['menus_favoris'] = $menus_favoris;
67
+        $GLOBALS['visiteur_session']['prefs']['activer_menudev'] = $activer_menudev;
68
+        $GLOBALS['visiteur_session']['prefs']['menus_favoris'] = $menus_favoris;
69 69
 
70
-		if (intval($GLOBALS['visiteur_session']['id_auteur'])) {
71
-			include_spip('action/editer_auteur');
72
-			$c = ['prefs' => serialize($GLOBALS['visiteur_session']['prefs'])];
73
-			auteur_modifier($GLOBALS['visiteur_session']['id_auteur'], $c);
74
-		}
75
-	}
70
+        if (intval($GLOBALS['visiteur_session']['id_auteur'])) {
71
+            include_spip('action/editer_auteur');
72
+            $c = ['prefs' => serialize($GLOBALS['visiteur_session']['prefs'])];
73
+            auteur_modifier($GLOBALS['visiteur_session']['id_auteur'], $c);
74
+        }
75
+    }
76 76
 
77
-	return ['message_ok' => _T('config_info_enregistree'), 'editable' => true];
77
+    return ['message_ok' => _T('config_info_enregistree'), 'editable' => true];
78 78
 }
Please login to merge, or discard this patch.
ecrire/typographie/fr.php 2 patches
Indentation   +59 added lines, -59 removed lines patch added patch discarded remove patch
@@ -11,74 +11,74 @@
 block discarded – undo
11 11
 \***************************************************************************/
12 12
 
13 13
 if (!defined('_ECRIRE_INC_VERSION')) {
14
-	return;
14
+    return;
15 15
 }
16 16
 
17 17
 // Correction typographique francaise
18 18
 
19 19
 function typographie_fr_dist($letexte) {
20 20
 
21
-	static $trans;
21
+    static $trans;
22 22
 
23
-	// Nettoyer 160 = nbsp ; 187 = raquo ; 171 = laquo ; 176 = deg ;
24
-	// 147 = ldquo; 148 = rdquo; ' = zouli apostrophe
25
-	if (!$trans) {
26
-		$trans = [
27
-			"'" => '&#8217;',
28
-			'&nbsp;' => '~',
29
-			'&raquo;' => '&#187;',
30
-			'&laquo;' => '&#171;',
31
-			'&rdquo;' => '&#8221;',
32
-			'&ldquo;' => '&#8220;',
33
-			'&deg;' => '&#176;'
34
-		];
35
-		$chars = [160 => '~', 187 => '&#187;', 171 => '&#171;', 148 => '&#8221;', 147 => '&#8220;', 176 => '&#176;'];
36
-		$chars_trans = array_keys($chars);
37
-		$chars = array_values($chars);
38
-		$chars_trans = implode(' ', array_map('chr', $chars_trans));
39
-		$chars_trans = unicode2charset(charset2unicode($chars_trans, 'iso-8859-1', 'forcer'));
40
-		$chars_trans = explode(' ', $chars_trans);
41
-		foreach ($chars as $k => $r) {
42
-			$trans[$chars_trans[$k]] = $r;
43
-		}
44
-	}
23
+    // Nettoyer 160 = nbsp ; 187 = raquo ; 171 = laquo ; 176 = deg ;
24
+    // 147 = ldquo; 148 = rdquo; ' = zouli apostrophe
25
+    if (!$trans) {
26
+        $trans = [
27
+            "'" => '&#8217;',
28
+            '&nbsp;' => '~',
29
+            '&raquo;' => '&#187;',
30
+            '&laquo;' => '&#171;',
31
+            '&rdquo;' => '&#8221;',
32
+            '&ldquo;' => '&#8220;',
33
+            '&deg;' => '&#176;'
34
+        ];
35
+        $chars = [160 => '~', 187 => '&#187;', 171 => '&#171;', 148 => '&#8221;', 147 => '&#8220;', 176 => '&#176;'];
36
+        $chars_trans = array_keys($chars);
37
+        $chars = array_values($chars);
38
+        $chars_trans = implode(' ', array_map('chr', $chars_trans));
39
+        $chars_trans = unicode2charset(charset2unicode($chars_trans, 'iso-8859-1', 'forcer'));
40
+        $chars_trans = explode(' ', $chars_trans);
41
+        foreach ($chars as $k => $r) {
42
+            $trans[$chars_trans[$k]] = $r;
43
+        }
44
+    }
45 45
 
46
-	$letexte = strtr($letexte, $trans);
46
+    $letexte = strtr($letexte, $trans);
47 47
 
48
-	$cherche1 = [
49
-		/* 1 */
50
-		'/((?:^|[^\#0-9a-zA-Z\&])[\#0-9a-zA-Z]*)\;/S',
51
-		/* 2 */
52
-		'/&#187;| --?,|(?::(?!:)| %)(?:\W|$)/S',
53
-		/* 3 */
54
-		'/([^[<(!?.])([!?][!?\.]*)/iS',
55
-		/* 4 */
56
-		'/&#171;|(?:M(?:M?\.|mes?|r\.?)|[MnN]&#176;) /S'
57
-	];
58
-	$remplace1 = [
59
-		/* 1 */
60
-		'\1~;',
61
-		/* 2 */
62
-		'~\0',
63
-		/* 3 */
64
-		'\1~\2',
65
-		/* 4 */
66
-		'\0~'
67
-	];
68
-	$letexte = preg_replace($cherche1, $remplace1, $letexte);
69
-	$letexte = preg_replace('/ *~+ */S', '~', $letexte);
48
+    $cherche1 = [
49
+        /* 1 */
50
+        '/((?:^|[^\#0-9a-zA-Z\&])[\#0-9a-zA-Z]*)\;/S',
51
+        /* 2 */
52
+        '/&#187;| --?,|(?::(?!:)| %)(?:\W|$)/S',
53
+        /* 3 */
54
+        '/([^[<(!?.])([!?][!?\.]*)/iS',
55
+        /* 4 */
56
+        '/&#171;|(?:M(?:M?\.|mes?|r\.?)|[MnN]&#176;) /S'
57
+    ];
58
+    $remplace1 = [
59
+        /* 1 */
60
+        '\1~;',
61
+        /* 2 */
62
+        '~\0',
63
+        /* 3 */
64
+        '\1~\2',
65
+        /* 4 */
66
+        '\0~'
67
+    ];
68
+    $letexte = preg_replace($cherche1, $remplace1, $letexte);
69
+    $letexte = preg_replace('/ *~+ */S', '~', $letexte);
70 70
 
71
-	$cherche2 = [
72
-		'/([^-\n]|^)--([^-]|$)/S',
73
-		',(' . _PROTOCOLES_STD . ')~((://[^"\'\s\[\]\}\)<>]+)~([?]))?,S',
74
-		'/~/'
75
-	];
76
-	$remplace2 = [
77
-		'\1&mdash;\2',
78
-		'\1\3\4',
79
-		'&nbsp;'
80
-	];
81
-	$letexte = preg_replace($cherche2, $remplace2, $letexte);
71
+    $cherche2 = [
72
+        '/([^-\n]|^)--([^-]|$)/S',
73
+        ',(' . _PROTOCOLES_STD . ')~((://[^"\'\s\[\]\}\)<>]+)~([?]))?,S',
74
+        '/~/'
75
+    ];
76
+    $remplace2 = [
77
+        '\1&mdash;\2',
78
+        '\1\3\4',
79
+        '&nbsp;'
80
+    ];
81
+    $letexte = preg_replace($cherche2, $remplace2, $letexte);
82 82
 
83
-	return $letexte;
83
+    return $letexte;
84 84
 }
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -70,7 +70,7 @@
 block discarded – undo
70 70
 
71 71
 	$cherche2 = [
72 72
 		'/([^-\n]|^)--([^-]|$)/S',
73
-		',(' . _PROTOCOLES_STD . ')~((://[^"\'\s\[\]\}\)<>]+)~([?]))?,S',
73
+		',('._PROTOCOLES_STD.')~((://[^"\'\s\[\]\}\)<>]+)~([?]))?,S',
74 74
 		'/~/'
75 75
 	];
76 76
 	$remplace2 = [
Please login to merge, or discard this patch.
ecrire/typographie/en.php 1 patch
Indentation   +22 added lines, -22 removed lines patch added patch discarded remove patch
@@ -11,37 +11,37 @@
 block discarded – undo
11 11
 \***************************************************************************/
12 12
 
13 13
 if (!defined('_ECRIRE_INC_VERSION')) {
14
-	return;
14
+    return;
15 15
 }
16 16
 
17 17
 // rien sauf les "~" et "-,"
18 18
 
19 19
 function typographie_en_dist($letexte) {
20 20
 
21
-	// zouli apostrophe
22
-	$letexte = str_replace("'", '&#8217;', $letexte);
21
+    // zouli apostrophe
22
+    $letexte = str_replace("'", '&#8217;', $letexte);
23 23
 
24
-	$cherche1 = [
25
-		'/ --?,/S'
26
-	];
27
-	$remplace1 = [
28
-		'~\0'
29
-	];
30
-	$letexte = preg_replace($cherche1, $remplace1, $letexte);
24
+    $cherche1 = [
25
+        '/ --?,/S'
26
+    ];
27
+    $remplace1 = [
28
+        '~\0'
29
+    ];
30
+    $letexte = preg_replace($cherche1, $remplace1, $letexte);
31 31
 
32
-	$letexte = str_replace('&nbsp;', '~', $letexte);
33
-	$letexte = preg_replace('/ *~+ */', '~', $letexte);
32
+    $letexte = str_replace('&nbsp;', '~', $letexte);
33
+    $letexte = preg_replace('/ *~+ */', '~', $letexte);
34 34
 
35
-	$cherche2 = [
36
-		'/([^-\n]|^)--([^-]|$)/',
37
-		'/~/'
38
-	];
39
-	$remplace2 = [
40
-		'\1&mdash;\2',
41
-		'&nbsp;'
42
-	];
35
+    $cherche2 = [
36
+        '/([^-\n]|^)--([^-]|$)/',
37
+        '/~/'
38
+    ];
39
+    $remplace2 = [
40
+        '\1&mdash;\2',
41
+        '&nbsp;'
42
+    ];
43 43
 
44
-	$letexte = preg_replace($cherche2, $remplace2, $letexte);
44
+    $letexte = preg_replace($cherche2, $remplace2, $letexte);
45 45
 
46
-	return $letexte;
46
+    return $letexte;
47 47
 }
Please login to merge, or discard this patch.
ecrire/public/quete.php 2 patches
Indentation   +408 added lines, -408 removed lines patch added patch discarded remove patch
@@ -19,7 +19,7 @@  discard block
 block discarded – undo
19 19
  **/
20 20
 
21 21
 if (!defined('_ECRIRE_INC_VERSION')) {
22
-	return;
22
+    return;
23 23
 }
24 24
 
25 25
 
@@ -33,16 +33,16 @@  discard block
 block discarded – undo
33 33
  * @return array|bool|null
34 34
  */
35 35
 function quete_virtuel($id_article, $connect) {
36
-	return sql_getfetsel(
37
-		'virtuel',
38
-		'spip_articles',
39
-		['id_article=' . intval($id_article), "statut='publie'"],
40
-		'',
41
-		'',
42
-		'',
43
-		'',
44
-		$connect
45
-	);
36
+    return sql_getfetsel(
37
+        'virtuel',
38
+        'spip_articles',
39
+        ['id_article=' . intval($id_article), "statut='publie'"],
40
+        '',
41
+        '',
42
+        '',
43
+        '',
44
+        $connect
45
+    );
46 46
 }
47 47
 
48 48
 /**
@@ -57,41 +57,41 @@  discard block
 block discarded – undo
57 57
  * @return array
58 58
  */
59 59
 function quete_parent_lang($table, $id, $connect = '') {
60
-	static $cache_quete = [];
61
-
62
-	if (!isset($cache_quete[$connect][$table][$id])) {
63
-		if (!isset($cache_quete[$connect][$table]['_select'])) {
64
-			$trouver_table = charger_fonction('trouver_table', 'base');
65
-			if (
66
-				!$desc = $trouver_table(
67
-					$table,
68
-					$connect
69
-				) or !isset($desc['field']['id_rubrique'])
70
-			) {
71
-				// pas de parent rubrique, on passe
72
-				$cache_quete[$connect][$table]['_select'] = false;
73
-			} else {
74
-				$select = ($table == 'spip_rubriques' ? 'id_parent' : 'id_rubrique');
75
-				$select .= isset($desc['field']['lang']) ? ', lang' : '';
76
-				$cache_quete[$connect][$table]['_select'] = $select;
77
-				$cache_quete[$connect][$table]['_id'] = id_table_objet(objet_type($table));
78
-			}
79
-		}
80
-		if ($cache_quete[$connect][$table]['_select']) {
81
-			$cache_quete[$connect][$table][$id] = sql_fetsel(
82
-				$cache_quete[$connect][$table]['_select'],
83
-				$table,
84
-				$cache_quete[$connect][$table]['_id'] . '=' . intval($id),
85
-				'',
86
-				'',
87
-				'',
88
-				'',
89
-				$connect
90
-			);
91
-		}
92
-	}
93
-
94
-	return isset($cache_quete[$connect][$table][$id]) ? $cache_quete[$connect][$table][$id] : null;
60
+    static $cache_quete = [];
61
+
62
+    if (!isset($cache_quete[$connect][$table][$id])) {
63
+        if (!isset($cache_quete[$connect][$table]['_select'])) {
64
+            $trouver_table = charger_fonction('trouver_table', 'base');
65
+            if (
66
+                !$desc = $trouver_table(
67
+                    $table,
68
+                    $connect
69
+                ) or !isset($desc['field']['id_rubrique'])
70
+            ) {
71
+                // pas de parent rubrique, on passe
72
+                $cache_quete[$connect][$table]['_select'] = false;
73
+            } else {
74
+                $select = ($table == 'spip_rubriques' ? 'id_parent' : 'id_rubrique');
75
+                $select .= isset($desc['field']['lang']) ? ', lang' : '';
76
+                $cache_quete[$connect][$table]['_select'] = $select;
77
+                $cache_quete[$connect][$table]['_id'] = id_table_objet(objet_type($table));
78
+            }
79
+        }
80
+        if ($cache_quete[$connect][$table]['_select']) {
81
+            $cache_quete[$connect][$table][$id] = sql_fetsel(
82
+                $cache_quete[$connect][$table]['_select'],
83
+                $table,
84
+                $cache_quete[$connect][$table]['_id'] . '=' . intval($id),
85
+                '',
86
+                '',
87
+                '',
88
+                '',
89
+                $connect
90
+            );
91
+        }
92
+    }
93
+
94
+    return isset($cache_quete[$connect][$table][$id]) ? $cache_quete[$connect][$table][$id] : null;
95 95
 }
96 96
 
97 97
 
@@ -108,11 +108,11 @@  discard block
 block discarded – undo
108 108
  * @return int
109 109
  */
110 110
 function quete_parent($id_rubrique, $connect = '') {
111
-	if (!$id_rubrique = intval($id_rubrique)) {
112
-		return 0;
113
-	}
114
-	$id_parent = quete_parent_lang('spip_rubriques', $id_rubrique, $connect);
115
-	return $id_parent ? $id_parent['id_parent'] : 0;
111
+    if (!$id_rubrique = intval($id_rubrique)) {
112
+        return 0;
113
+    }
114
+    $id_parent = quete_parent_lang('spip_rubriques', $id_rubrique, $connect);
115
+    return $id_parent ? $id_parent['id_parent'] : 0;
116 116
 }
117 117
 
118 118
 /**
@@ -128,9 +128,9 @@  discard block
 block discarded – undo
128 128
  * @return int
129 129
  */
130 130
 function quete_rubrique($id_article, $serveur) {
131
-	$id_parent = quete_parent_lang('spip_articles', $id_article, $serveur);
131
+    $id_parent = quete_parent_lang('spip_articles', $id_article, $serveur);
132 132
 
133
-	return $id_parent['id_rubrique'];
133
+    return $id_parent['id_rubrique'];
134 134
 }
135 135
 
136 136
 
@@ -144,13 +144,13 @@  discard block
 block discarded – undo
144 144
  * @return int
145 145
  */
146 146
 function quete_profondeur($id, $connect = '') {
147
-	$n = 0;
148
-	while ($id) {
149
-		$n++;
150
-		$id = quete_parent($id, $connect);
151
-	}
147
+    $n = 0;
148
+    while ($id) {
149
+        $n++;
150
+        $id = quete_parent($id, $connect);
151
+    }
152 152
 
153
-	return $n;
153
+    return $n;
154 154
 }
155 155
 
156 156
 
@@ -166,15 +166,15 @@  discard block
 block discarded – undo
166 166
  *     Morceau de la requête SQL testant la date
167 167
  */
168 168
 function quete_condition_postdates($champ_date, $serveur = '', $ignore_previsu = false) {
169
-	if (defined('_VAR_PREVIEW') and _VAR_PREVIEW and !$ignore_previsu) {
170
-		return '1=1';
171
-	}
172
-
173
-	return
174
-		(isset($GLOBALS['meta']['date_prochain_postdate'])
175
-			and $GLOBALS['meta']['date_prochain_postdate'] > time())
176
-			? "$champ_date<" . sql_quote(date('Y-m-d H:i:s', $GLOBALS['meta']['date_prochain_postdate']), $serveur)
177
-			: '1=1';
169
+    if (defined('_VAR_PREVIEW') and _VAR_PREVIEW and !$ignore_previsu) {
170
+        return '1=1';
171
+    }
172
+
173
+    return
174
+        (isset($GLOBALS['meta']['date_prochain_postdate'])
175
+            and $GLOBALS['meta']['date_prochain_postdate'] > time())
176
+            ? "$champ_date<" . sql_quote(date('Y-m-d H:i:s', $GLOBALS['meta']['date_prochain_postdate']), $serveur)
177
+            : '1=1';
178 178
 }
179 179
 
180 180
 
@@ -194,101 +194,101 @@  discard block
 block discarded – undo
194 194
  * @return array|string
195 195
  */
196 196
 function quete_condition_statut($mstatut, $previsu, $publie, $serveur = '', $ignore_previsu = false) {
197
-	static $cond = [];
198
-	$key = func_get_args();
199
-	$key = implode('-', $key);
200
-	if (isset($cond[$key])) {
201
-		return $cond[$key];
202
-	}
203
-
204
-	$liste_statuts = $publie;
205
-	if (defined('_VAR_PREVIEW') and _VAR_PREVIEW and !$ignore_previsu) {
206
-		$liste_statuts = $previsu;
207
-	}
208
-	$not = false;
209
-	if (strncmp($liste_statuts, '!', 1) == 0) {
210
-		$not = true;
211
-		$liste_statuts = substr($liste_statuts, 1);
212
-	}
213
-	// '' => ne rien afficher, '!'=> ne rien filtrer
214
-	if (!strlen($liste_statuts)) {
215
-		return $cond[$key] = ($not ? '1=1' : '0=1');
216
-	}
217
-
218
-	$liste_statuts = explode(',', $liste_statuts);
219
-	$where = [];
220
-	foreach ($liste_statuts as $k => $v) {
221
-		// filtrage /auteur pour limiter les objets d'un statut (prepa en general)
222
-		// a ceux de l'auteur identifie
223
-		if (strpos($v, '/') !== false) {
224
-			$v = explode('/', $v);
225
-			$filtre = end($v);
226
-			$v = reset($v);
227
-			$v = preg_replace(',\W,', '', $v);
228
-			if (
229
-				$filtre == 'auteur'
230
-				and (strpos($mstatut, '.') !== false)
231
-				and $objet = explode('.', $mstatut)
232
-				and $id_table = reset($objet)
233
-				and $objet = objet_type($id_table)
234
-			) {
235
-				$w = "$mstatut<>" . sql_quote($v);
236
-
237
-				// retrouver l’id_auteur qui a filé un lien de prévisu éventuellement,
238
-				// sinon l’auteur en session
239
-				include_spip('inc/securiser_action');
240
-				if ($desc = decrire_token_previsu()) {
241
-					$id_auteur = $desc['id_auteur'];
242
-				} elseif (isset($GLOBALS['visiteur_session']['id_auteur'])) {
243
-					$id_auteur = intval($GLOBALS['visiteur_session']['id_auteur']);
244
-				} else {
245
-					$id_auteur = null;
246
-				}
247
-
248
-				// dans ce cas (admin en general), pas de filtrage sur ce statut
249
-				if (!autoriser('previsualiser' . $v, $objet, '', $id_auteur)) {
250
-					// si pas d'auteur identifie pas de sous-requete car pas d'article qui matche
251
-					if (!$id_auteur) {
252
-						$where[] = $w;
253
-					} else {
254
-						$primary = id_table_objet($objet);
255
-						$where[] = "($w OR $id_table.$primary IN (" . sql_get_select(
256
-							'ssss.id_objet',
257
-							'spip_auteurs_liens AS ssss',
258
-							'ssss.objet=' . sql_quote($objet) . ' AND ssss.id_auteur=' . intval($id_auteur),
259
-							'',
260
-							'',
261
-							'',
262
-							'',
263
-							$serveur
264
-						) . '))';
265
-					}
266
-				}
267
-			} // ignorer ce statut si on ne sait pas comment le filtrer
268
-			else {
269
-				$v = '';
270
-			}
271
-		}
272
-		// securite
273
-		$liste_statuts[$k] = preg_replace(',\W,', '', $v);
274
-	}
275
-	$liste_statuts = array_filter($liste_statuts);
276
-	if (count($liste_statuts) == 1) {
277
-		$where[] = ['=', $mstatut, sql_quote(reset($liste_statuts), $serveur)];
278
-	} else {
279
-		$where[] = sql_in($mstatut, $liste_statuts, $not, $serveur);
280
-	}
281
-
282
-	while (count($where) > 1) {
283
-		$and = ['AND', array_pop($where), array_pop($where)];
284
-		$where[] = $and;
285
-	}
286
-	$cond[$key] = reset($where);
287
-	if ($not) {
288
-		$cond[$key] = ['NOT', $cond[$key]];
289
-	}
290
-
291
-	return $cond[$key];
197
+    static $cond = [];
198
+    $key = func_get_args();
199
+    $key = implode('-', $key);
200
+    if (isset($cond[$key])) {
201
+        return $cond[$key];
202
+    }
203
+
204
+    $liste_statuts = $publie;
205
+    if (defined('_VAR_PREVIEW') and _VAR_PREVIEW and !$ignore_previsu) {
206
+        $liste_statuts = $previsu;
207
+    }
208
+    $not = false;
209
+    if (strncmp($liste_statuts, '!', 1) == 0) {
210
+        $not = true;
211
+        $liste_statuts = substr($liste_statuts, 1);
212
+    }
213
+    // '' => ne rien afficher, '!'=> ne rien filtrer
214
+    if (!strlen($liste_statuts)) {
215
+        return $cond[$key] = ($not ? '1=1' : '0=1');
216
+    }
217
+
218
+    $liste_statuts = explode(',', $liste_statuts);
219
+    $where = [];
220
+    foreach ($liste_statuts as $k => $v) {
221
+        // filtrage /auteur pour limiter les objets d'un statut (prepa en general)
222
+        // a ceux de l'auteur identifie
223
+        if (strpos($v, '/') !== false) {
224
+            $v = explode('/', $v);
225
+            $filtre = end($v);
226
+            $v = reset($v);
227
+            $v = preg_replace(',\W,', '', $v);
228
+            if (
229
+                $filtre == 'auteur'
230
+                and (strpos($mstatut, '.') !== false)
231
+                and $objet = explode('.', $mstatut)
232
+                and $id_table = reset($objet)
233
+                and $objet = objet_type($id_table)
234
+            ) {
235
+                $w = "$mstatut<>" . sql_quote($v);
236
+
237
+                // retrouver l’id_auteur qui a filé un lien de prévisu éventuellement,
238
+                // sinon l’auteur en session
239
+                include_spip('inc/securiser_action');
240
+                if ($desc = decrire_token_previsu()) {
241
+                    $id_auteur = $desc['id_auteur'];
242
+                } elseif (isset($GLOBALS['visiteur_session']['id_auteur'])) {
243
+                    $id_auteur = intval($GLOBALS['visiteur_session']['id_auteur']);
244
+                } else {
245
+                    $id_auteur = null;
246
+                }
247
+
248
+                // dans ce cas (admin en general), pas de filtrage sur ce statut
249
+                if (!autoriser('previsualiser' . $v, $objet, '', $id_auteur)) {
250
+                    // si pas d'auteur identifie pas de sous-requete car pas d'article qui matche
251
+                    if (!$id_auteur) {
252
+                        $where[] = $w;
253
+                    } else {
254
+                        $primary = id_table_objet($objet);
255
+                        $where[] = "($w OR $id_table.$primary IN (" . sql_get_select(
256
+                            'ssss.id_objet',
257
+                            'spip_auteurs_liens AS ssss',
258
+                            'ssss.objet=' . sql_quote($objet) . ' AND ssss.id_auteur=' . intval($id_auteur),
259
+                            '',
260
+                            '',
261
+                            '',
262
+                            '',
263
+                            $serveur
264
+                        ) . '))';
265
+                    }
266
+                }
267
+            } // ignorer ce statut si on ne sait pas comment le filtrer
268
+            else {
269
+                $v = '';
270
+            }
271
+        }
272
+        // securite
273
+        $liste_statuts[$k] = preg_replace(',\W,', '', $v);
274
+    }
275
+    $liste_statuts = array_filter($liste_statuts);
276
+    if (count($liste_statuts) == 1) {
277
+        $where[] = ['=', $mstatut, sql_quote(reset($liste_statuts), $serveur)];
278
+    } else {
279
+        $where[] = sql_in($mstatut, $liste_statuts, $not, $serveur);
280
+    }
281
+
282
+    while (count($where) > 1) {
283
+        $and = ['AND', array_pop($where), array_pop($where)];
284
+        $where[] = $and;
285
+    }
286
+    $cond[$key] = reset($where);
287
+    if ($not) {
288
+        $cond[$key] = ['NOT', $cond[$key]];
289
+    }
290
+
291
+    return $cond[$key];
292 292
 }
293 293
 
294 294
 /**
@@ -299,7 +299,7 @@  discard block
 block discarded – undo
299 299
  * @return array|bool|null
300 300
  */
301 301
 function quete_fichier($id_document, $serveur = '') {
302
-	return sql_getfetsel('fichier', 'spip_documents', ('id_document=' . intval($id_document)), '', [], '', '', $serveur);
302
+    return sql_getfetsel('fichier', 'spip_documents', ('id_document=' . intval($id_document)), '', [], '', '', $serveur);
303 303
 }
304 304
 
305 305
 /**
@@ -310,7 +310,7 @@  discard block
 block discarded – undo
310 310
  * @return array|bool
311 311
  */
312 312
 function quete_document($id_document, $serveur = '') {
313
-	return sql_fetsel('*', 'spip_documents', ('id_document=' . intval($id_document)), '', [], '', '', $serveur);
313
+    return sql_fetsel('*', 'spip_documents', ('id_document=' . intval($id_document)), '', [], '', '', $serveur);
314 314
 }
315 315
 
316 316
 /**
@@ -321,7 +321,7 @@  discard block
 block discarded – undo
321 321
  * @return array|bool|null
322 322
  */
323 323
 function quete_meta($nom, $serveur) {
324
-	return sql_getfetsel('valeur', 'spip_meta', 'nom=' . sql_quote($nom), '', '', '', '', $serveur);
324
+    return sql_getfetsel('valeur', 'spip_meta', 'nom=' . sql_quote($nom), '', '', '', '', $serveur);
325 325
 }
326 326
 
327 327
 /**
@@ -347,66 +347,66 @@  discard block
 block discarded – undo
347 347
  *     Retourne soit un tableau, soit le chemin du fichier.
348 348
  */
349 349
 function quete_logo($cle_objet, $onoff, $id, $id_rubrique, $flag) {
350
-	include_spip('base/objets');
351
-	$nom = strtolower($onoff);
352
-
353
-	$cle_objet = id_table_objet($cle_objet);
354
-
355
-	while (1) {
356
-		$objet = objet_type($cle_objet);
357
-
358
-		$on = quete_logo_objet($id, $objet, $nom);
359
-
360
-		if ($on) {
361
-			if ($flag) {
362
-				return basename($on['chemin']);
363
-			} else {
364
-				$taille = @spip_getimagesize($on['chemin']);
365
-
366
-				// Si on a déjà demandé un survol directement ($onoff = off)
367
-				// ou qu'on a demandé uniquement le normal ($onoff = on)
368
-				// alors on ne cherche pas du tout le survol ici
369
-				if ($onoff != 'ON') {
370
-					$off = '';
371
-				} else {
372
-					// Sinon, c'est qu'on demande normal ET survol à la fois, donc on cherche maintenant le survol
373
-					$off = quete_logo_objet($id, $objet, 'off');
374
-				}
375
-
376
-				// on retourne une url du type IMG/artonXX?timestamp
377
-				// qui permet de distinguer le changement de logo
378
-				// et placer un expire sur le dossier IMG/
379
-				$res = [
380
-					$on['chemin'] . ($on['timestamp'] ? "?{$on['timestamp']}" : ''),
381
-					($off ? $off['chemin'] . ($off['timestamp'] ? "?{$off['timestamp']}" : '') : ''),
382
-					(!$taille ? '' : (' ' . $taille[3]))
383
-				];
384
-				$res['src'] = $res[0];
385
-				$res['logo_on'] = $res[0];
386
-				$res['logo_off'] = $res[1];
387
-				$res['width'] = ($taille ? $taille[0] : '');
388
-				$res['height'] = ($taille ? $taille[1] : '');
389
-
390
-				return $res;
391
-			}
392
-		} else {
393
-			if (defined('_LOGO_RUBRIQUE_DESACTIVER_HERITAGE')) {
394
-				return '';
395
-			} else {
396
-				if ($id_rubrique) {
397
-					$cle_objet = 'id_rubrique';
398
-					$id = $id_rubrique;
399
-					$id_rubrique = 0;
400
-				} else {
401
-					if ($id and $cle_objet == 'id_rubrique') {
402
-						$id = quete_parent($id);
403
-					} else {
404
-						return '';
405
-					}
406
-				}
407
-			}
408
-		}
409
-	}
350
+    include_spip('base/objets');
351
+    $nom = strtolower($onoff);
352
+
353
+    $cle_objet = id_table_objet($cle_objet);
354
+
355
+    while (1) {
356
+        $objet = objet_type($cle_objet);
357
+
358
+        $on = quete_logo_objet($id, $objet, $nom);
359
+
360
+        if ($on) {
361
+            if ($flag) {
362
+                return basename($on['chemin']);
363
+            } else {
364
+                $taille = @spip_getimagesize($on['chemin']);
365
+
366
+                // Si on a déjà demandé un survol directement ($onoff = off)
367
+                // ou qu'on a demandé uniquement le normal ($onoff = on)
368
+                // alors on ne cherche pas du tout le survol ici
369
+                if ($onoff != 'ON') {
370
+                    $off = '';
371
+                } else {
372
+                    // Sinon, c'est qu'on demande normal ET survol à la fois, donc on cherche maintenant le survol
373
+                    $off = quete_logo_objet($id, $objet, 'off');
374
+                }
375
+
376
+                // on retourne une url du type IMG/artonXX?timestamp
377
+                // qui permet de distinguer le changement de logo
378
+                // et placer un expire sur le dossier IMG/
379
+                $res = [
380
+                    $on['chemin'] . ($on['timestamp'] ? "?{$on['timestamp']}" : ''),
381
+                    ($off ? $off['chemin'] . ($off['timestamp'] ? "?{$off['timestamp']}" : '') : ''),
382
+                    (!$taille ? '' : (' ' . $taille[3]))
383
+                ];
384
+                $res['src'] = $res[0];
385
+                $res['logo_on'] = $res[0];
386
+                $res['logo_off'] = $res[1];
387
+                $res['width'] = ($taille ? $taille[0] : '');
388
+                $res['height'] = ($taille ? $taille[1] : '');
389
+
390
+                return $res;
391
+            }
392
+        } else {
393
+            if (defined('_LOGO_RUBRIQUE_DESACTIVER_HERITAGE')) {
394
+                return '';
395
+            } else {
396
+                if ($id_rubrique) {
397
+                    $cle_objet = 'id_rubrique';
398
+                    $id = $id_rubrique;
399
+                    $id_rubrique = 0;
400
+                } else {
401
+                    if ($id and $cle_objet == 'id_rubrique') {
402
+                        $id = quete_parent($id);
403
+                    } else {
404
+                        return '';
405
+                    }
406
+                }
407
+            }
408
+        }
409
+    }
410 410
 }
411 411
 
412 412
 /**
@@ -420,37 +420,37 @@  discard block
 block discarded – undo
420 420
  * 		"on" ou "off" suivant le logo normal ou survol
421 421
  **/
422 422
 function quete_logo_objet($id_objet, $objet, $mode) {
423
-	static $chercher_logo;
424
-	if (is_null($chercher_logo)) {
425
-		$chercher_logo = charger_fonction('chercher_logo', 'inc');
426
-	}
427
-	$cle_objet = id_table_objet($objet);
428
-
429
-	// On cherche pas la méthode classique
430
-	$infos_logo = $chercher_logo($id_objet, $cle_objet, $mode);
431
-	// Si la méthode classique a trouvé quelque chose, on utilise le nouveau format
432
-	if (!empty($infos_logo)) {
433
-		$infos_logo = [
434
-			'chemin' => $infos_logo[0],
435
-			'timestamp' => $infos_logo[4],
436
-		];
437
-	}
438
-
439
-	// On passe cette recherche de logo dans un pipeline
440
-	$infos_logo = pipeline(
441
-		'quete_logo_objet',
442
-		[
443
-			'args' => [
444
-				'id_objet' => $id_objet,
445
-				'objet' => $objet,
446
-				'cle_objet' => $cle_objet,
447
-				'mode' => $mode,
448
-			],
449
-			'data' => $infos_logo,
450
-		]
451
-	);
452
-
453
-	return $infos_logo;
423
+    static $chercher_logo;
424
+    if (is_null($chercher_logo)) {
425
+        $chercher_logo = charger_fonction('chercher_logo', 'inc');
426
+    }
427
+    $cle_objet = id_table_objet($objet);
428
+
429
+    // On cherche pas la méthode classique
430
+    $infos_logo = $chercher_logo($id_objet, $cle_objet, $mode);
431
+    // Si la méthode classique a trouvé quelque chose, on utilise le nouveau format
432
+    if (!empty($infos_logo)) {
433
+        $infos_logo = [
434
+            'chemin' => $infos_logo[0],
435
+            'timestamp' => $infos_logo[4],
436
+        ];
437
+    }
438
+
439
+    // On passe cette recherche de logo dans un pipeline
440
+    $infos_logo = pipeline(
441
+        'quete_logo_objet',
442
+        [
443
+            'args' => [
444
+                'id_objet' => $id_objet,
445
+                'objet' => $objet,
446
+                'cle_objet' => $cle_objet,
447
+                'mode' => $mode,
448
+            ],
449
+            'data' => $infos_logo,
450
+        ]
451
+    );
452
+
453
+    return $infos_logo;
454 454
 }
455 455
 
456 456
 /**
@@ -463,25 +463,25 @@  discard block
 block discarded – undo
463 463
  * @return bool|string
464 464
  */
465 465
 function quete_logo_file($row, $connect = null) {
466
-	include_spip('inc/documents');
467
-	$logo = vignette_logo_document($row, $connect);
468
-	if (!$logo) {
469
-		$logo = image_du_document($row, $connect);
470
-	}
471
-	if (!$logo) {
472
-		$f = charger_fonction('vignette', 'inc');
473
-		$logo = $f($row['extension'], false);
474
-	}
475
-	// si c'est une vignette type doc, la renvoyer direct
476
-	if (
477
-		strcmp($logo, _DIR_PLUGINS) == 0
478
-		or strcmp($logo, _DIR_PLUGINS_DIST) == 0
479
-		or strcmp($logo, _DIR_RACINE . 'prive/') == 0
480
-	) {
481
-		return $logo;
482
-	}
483
-
484
-	return get_spip_doc($logo);
466
+    include_spip('inc/documents');
467
+    $logo = vignette_logo_document($row, $connect);
468
+    if (!$logo) {
469
+        $logo = image_du_document($row, $connect);
470
+    }
471
+    if (!$logo) {
472
+        $f = charger_fonction('vignette', 'inc');
473
+        $logo = $f($row['extension'], false);
474
+    }
475
+    // si c'est une vignette type doc, la renvoyer direct
476
+    if (
477
+        strcmp($logo, _DIR_PLUGINS) == 0
478
+        or strcmp($logo, _DIR_PLUGINS_DIST) == 0
479
+        or strcmp($logo, _DIR_RACINE . 'prive/') == 0
480
+    ) {
481
+        return $logo;
482
+    }
483
+
484
+    return get_spip_doc($logo);
485 485
 }
486 486
 
487 487
 /**
@@ -509,20 +509,20 @@  discard block
 block discarded – undo
509 509
  */
510 510
 function quete_logo_document($row, $lien, $align, $mode_logo, $x, $y, $connect = null) {
511 511
 
512
-	include_spip('inc/documents');
513
-	$logo = '';
514
-	if (!in_array($mode_logo, ['icone', 'apercu'])) {
515
-		$logo = vignette_logo_document($row, $connect);
516
-	}
517
-	// si on veut explicitement la vignette, ne rien renvoyer si il n'y en a pas
518
-	if ($mode_logo == 'vignette' and !$logo) {
519
-		return '';
520
-	}
521
-	if ($mode_logo == 'icone') {
522
-		$row['fichier'] = '';
523
-	}
524
-
525
-	return vignette_automatique($logo, $row, $lien, $x, $y, $align, null, $connect);
512
+    include_spip('inc/documents');
513
+    $logo = '';
514
+    if (!in_array($mode_logo, ['icone', 'apercu'])) {
515
+        $logo = vignette_logo_document($row, $connect);
516
+    }
517
+    // si on veut explicitement la vignette, ne rien renvoyer si il n'y en a pas
518
+    if ($mode_logo == 'vignette' and !$logo) {
519
+        return '';
520
+    }
521
+    if ($mode_logo == 'icone') {
522
+        $row['fichier'] = '';
523
+    }
524
+
525
+    return vignette_automatique($logo, $row, $lien, $x, $y, $align, null, $connect);
526 526
 }
527 527
 
528 528
 /**
@@ -534,19 +534,19 @@  discard block
 block discarded – undo
534 534
  */
535 535
 function quete_html_logo($logo, $align, $lien) {
536 536
 
537
-	if (!is_array($logo)) {
538
-		return '';
539
-	}
540
-
541
-	$contexte = [];
542
-	foreach ($logo as $k => $v) {
543
-		if (!is_numeric($k)) {
544
-			$contexte[$k] = $v;
545
-		}
546
-	}
547
-	$contexte['align'] = $align;
548
-	$contexte['lien'] = $lien;
549
-	return recuperer_fond('modeles/logo', $contexte);
537
+    if (!is_array($logo)) {
538
+        return '';
539
+    }
540
+
541
+    $contexte = [];
542
+    foreach ($logo as $k => $v) {
543
+        if (!is_numeric($k)) {
544
+            $contexte[$k] = $v;
545
+        }
546
+    }
547
+    $contexte['align'] = $align;
548
+    $contexte['lien'] = $lien;
549
+    return recuperer_fond('modeles/logo', $contexte);
550 550
 }
551 551
 
552 552
 /**
@@ -560,14 +560,14 @@  discard block
 block discarded – undo
560 560
  * @return string|false
561 561
  */
562 562
 function document_spip_externe($fichier, $connect) {
563
-	if ($connect) {
564
-		$site = quete_meta('adresse_site', $connect);
565
-		if ($site) {
566
-			$dir = quete_meta('dir_img', $connect);
567
-			return "$site/$dir$fichier";
568
-		}
569
-	}
570
-	return false;
563
+    if ($connect) {
564
+        $site = quete_meta('adresse_site', $connect);
565
+        if ($site) {
566
+            $dir = quete_meta('dir_img', $connect);
567
+            return "$site/$dir$fichier";
568
+        }
569
+    }
570
+    return false;
571 571
 }
572 572
 
573 573
 /**
@@ -580,23 +580,23 @@  discard block
 block discarded – undo
580 580
  * @return string
581 581
  */
582 582
 function vignette_logo_document($row, $connect = '') {
583
-	if (!$row['id_vignette']) {
584
-		return '';
585
-	}
586
-	$fichier = quete_fichier($row['id_vignette'], $connect);
587
-	if ($url = document_spip_externe($fichier, $connect)) {
588
-		return $url;
589
-	}
590
-
591
-	$f = get_spip_doc($fichier);
592
-	if ($f and @file_exists($f)) {
593
-		return $f;
594
-	}
595
-	if ($row['mode'] !== 'vignette') {
596
-		return '';
597
-	}
598
-
599
-	return generer_url_entite($row['id_document'], 'document', '', '', $connect);
583
+    if (!$row['id_vignette']) {
584
+        return '';
585
+    }
586
+    $fichier = quete_fichier($row['id_vignette'], $connect);
587
+    if ($url = document_spip_externe($fichier, $connect)) {
588
+        return $url;
589
+    }
590
+
591
+    $f = get_spip_doc($fichier);
592
+    if ($f and @file_exists($f)) {
593
+        return $f;
594
+    }
595
+    if ($row['mode'] !== 'vignette') {
596
+        return '';
597
+    }
598
+
599
+    return generer_url_entite($row['id_document'], 'document', '', '', $connect);
600 600
 }
601 601
 
602 602
 /**
@@ -612,69 +612,69 @@  discard block
 block discarded – undo
612 612
  * @return bool|string
613 613
  */
614 614
 function calcul_exposer($id, $prim, $reference, $parent, $type, $connect = '') {
615
-	static $exposer = [];
616
-
617
-	// Que faut-il exposer ? Tous les elements de $reference
618
-	// ainsi que leur hierarchie ; on ne fait donc ce calcul
619
-	// qu'une fois (par squelette) et on conserve le resultat
620
-	// en static.
621
-	if (!isset($exposer[$m = md5(serialize($reference))][$prim])) {
622
-		$principal = isset($reference[$type]) ? $reference[$type] :
623
-			// cas de la pagination indecte @xx qui positionne la page avec l'id xx
624
-			// et donne la reference dynamique @type=xx dans le contexte
625
-			(isset($reference["@$type"]) ? $reference["@$type"] : '');
626
-		// le parent fournit en argument est le parent de $id, pas celui de $principal
627
-		// il n'est donc pas utile
628
-		$parent = 0;
629
-		if (!$principal) { // regarder si un enfant est dans le contexte, auquel cas il expose peut etre le parent courant
630
-			$enfants = ['id_rubrique' => ['id_article'], 'id_groupe' => ['id_mot']];
631
-			if (isset($enfants[$type])) {
632
-				foreach ($enfants[$type] as $t) {
633
-					if (
634
-						isset($reference[$t])
635
-						// cas de la reference donnee dynamiquement par la pagination
636
-						or isset($reference["@$t"])
637
-					) {
638
-						$type = $t;
639
-						$principal = isset($reference[$type]) ? $reference[$type] : $reference["@$type"];
640
-						continue;
641
-					}
642
-				}
643
-			}
644
-		}
645
-		$exposer[$m][$type] = [];
646
-		if ($principal) {
647
-			$principaux = is_array($principal) ? $principal : [$principal];
648
-			foreach ($principaux as $principal) {
649
-				$exposer[$m][$type][$principal] = true;
650
-				if ($type == 'id_mot') {
651
-					if (!$parent) {
652
-						$parent = sql_getfetsel('id_groupe', 'spip_mots', 'id_mot=' . intval($principal), '', '', '', '', $connect);
653
-					}
654
-					if ($parent) {
655
-						$exposer[$m]['id_groupe'][$parent] = true;
656
-					}
657
-				} else {
658
-					if ($type != 'id_groupe') {
659
-						if (!$parent) {
660
-							if ($type == 'id_rubrique') {
661
-								$parent = $principal;
662
-							}
663
-							if ($type == 'id_article') {
664
-								$parent = quete_rubrique($principal, $connect);
665
-							}
666
-						}
667
-						do {
668
-							$exposer[$m]['id_rubrique'][$parent] = true;
669
-						} while ($parent = quete_parent($parent, $connect));
670
-					}
671
-				}
672
-			}
673
-		}
674
-	}
675
-
676
-	// And the winner is...
677
-	return isset($exposer[$m][$prim]) ? isset($exposer[$m][$prim][$id]) : '';
615
+    static $exposer = [];
616
+
617
+    // Que faut-il exposer ? Tous les elements de $reference
618
+    // ainsi que leur hierarchie ; on ne fait donc ce calcul
619
+    // qu'une fois (par squelette) et on conserve le resultat
620
+    // en static.
621
+    if (!isset($exposer[$m = md5(serialize($reference))][$prim])) {
622
+        $principal = isset($reference[$type]) ? $reference[$type] :
623
+            // cas de la pagination indecte @xx qui positionne la page avec l'id xx
624
+            // et donne la reference dynamique @type=xx dans le contexte
625
+            (isset($reference["@$type"]) ? $reference["@$type"] : '');
626
+        // le parent fournit en argument est le parent de $id, pas celui de $principal
627
+        // il n'est donc pas utile
628
+        $parent = 0;
629
+        if (!$principal) { // regarder si un enfant est dans le contexte, auquel cas il expose peut etre le parent courant
630
+            $enfants = ['id_rubrique' => ['id_article'], 'id_groupe' => ['id_mot']];
631
+            if (isset($enfants[$type])) {
632
+                foreach ($enfants[$type] as $t) {
633
+                    if (
634
+                        isset($reference[$t])
635
+                        // cas de la reference donnee dynamiquement par la pagination
636
+                        or isset($reference["@$t"])
637
+                    ) {
638
+                        $type = $t;
639
+                        $principal = isset($reference[$type]) ? $reference[$type] : $reference["@$type"];
640
+                        continue;
641
+                    }
642
+                }
643
+            }
644
+        }
645
+        $exposer[$m][$type] = [];
646
+        if ($principal) {
647
+            $principaux = is_array($principal) ? $principal : [$principal];
648
+            foreach ($principaux as $principal) {
649
+                $exposer[$m][$type][$principal] = true;
650
+                if ($type == 'id_mot') {
651
+                    if (!$parent) {
652
+                        $parent = sql_getfetsel('id_groupe', 'spip_mots', 'id_mot=' . intval($principal), '', '', '', '', $connect);
653
+                    }
654
+                    if ($parent) {
655
+                        $exposer[$m]['id_groupe'][$parent] = true;
656
+                    }
657
+                } else {
658
+                    if ($type != 'id_groupe') {
659
+                        if (!$parent) {
660
+                            if ($type == 'id_rubrique') {
661
+                                $parent = $principal;
662
+                            }
663
+                            if ($type == 'id_article') {
664
+                                $parent = quete_rubrique($principal, $connect);
665
+                            }
666
+                        }
667
+                        do {
668
+                            $exposer[$m]['id_rubrique'][$parent] = true;
669
+                        } while ($parent = quete_parent($parent, $connect));
670
+                    }
671
+                }
672
+            }
673
+        }
674
+    }
675
+
676
+    // And the winner is...
677
+    return isset($exposer[$m][$prim]) ? isset($exposer[$m][$prim][$id]) : '';
678 678
 }
679 679
 
680 680
 /**
@@ -689,21 +689,21 @@  discard block
 block discarded – undo
689 689
  * @return int
690 690
  */
691 691
 function quete_debut_pagination($primary, $valeur, $pas, $iter) {
692
-	// on ne devrait pas arriver ici si la cle primaire est inexistante
693
-	// ou composee, mais verifions
694
-	if (!$primary or preg_match('/[,\s]/', $primary)) {
695
-		return 0;
696
-	}
697
-
698
-	$pos = 0;
699
-	while ($row = $iter->fetch() and $row[$primary] != $valeur) {
700
-		$pos++;
701
-	}
702
-	// si on a pas trouve
703
-	if (!$row or $row[$primary] != $valeur) {
704
-		return 0;
705
-	}
706
-
707
-	// sinon, calculer le bon numero de page
708
-	return floor($pos / $pas) * $pas;
692
+    // on ne devrait pas arriver ici si la cle primaire est inexistante
693
+    // ou composee, mais verifions
694
+    if (!$primary or preg_match('/[,\s]/', $primary)) {
695
+        return 0;
696
+    }
697
+
698
+    $pos = 0;
699
+    while ($row = $iter->fetch() and $row[$primary] != $valeur) {
700
+        $pos++;
701
+    }
702
+    // si on a pas trouve
703
+    if (!$row or $row[$primary] != $valeur) {
704
+        return 0;
705
+    }
706
+
707
+    // sinon, calculer le bon numero de page
708
+    return floor($pos / $pas) * $pas;
709 709
 }
Please login to merge, or discard this patch.
Spacing   +17 added lines, -18 removed lines patch added patch discarded remove patch
@@ -36,7 +36,7 @@  discard block
 block discarded – undo
36 36
 	return sql_getfetsel(
37 37
 		'virtuel',
38 38
 		'spip_articles',
39
-		['id_article=' . intval($id_article), "statut='publie'"],
39
+		['id_article='.intval($id_article), "statut='publie'"],
40 40
 		'',
41 41
 		'',
42 42
 		'',
@@ -81,7 +81,7 @@  discard block
 block discarded – undo
81 81
 			$cache_quete[$connect][$table][$id] = sql_fetsel(
82 82
 				$cache_quete[$connect][$table]['_select'],
83 83
 				$table,
84
-				$cache_quete[$connect][$table]['_id'] . '=' . intval($id),
84
+				$cache_quete[$connect][$table]['_id'].'='.intval($id),
85 85
 				'',
86 86
 				'',
87 87
 				'',
@@ -173,7 +173,7 @@  discard block
 block discarded – undo
173 173
 	return
174 174
 		(isset($GLOBALS['meta']['date_prochain_postdate'])
175 175
 			and $GLOBALS['meta']['date_prochain_postdate'] > time())
176
-			? "$champ_date<" . sql_quote(date('Y-m-d H:i:s', $GLOBALS['meta']['date_prochain_postdate']), $serveur)
176
+			? "$champ_date<".sql_quote(date('Y-m-d H:i:s', $GLOBALS['meta']['date_prochain_postdate']), $serveur)
177 177
 			: '1=1';
178 178
 }
179 179
 
@@ -232,7 +232,7 @@  discard block
 block discarded – undo
232 232
 				and $id_table = reset($objet)
233 233
 				and $objet = objet_type($id_table)
234 234
 			) {
235
-				$w = "$mstatut<>" . sql_quote($v);
235
+				$w = "$mstatut<>".sql_quote($v);
236 236
 
237 237
 				// retrouver l’id_auteur qui a filé un lien de prévisu éventuellement,
238 238
 				// sinon l’auteur en session
@@ -246,22 +246,22 @@  discard block
 block discarded – undo
246 246
 				}
247 247
 
248 248
 				// dans ce cas (admin en general), pas de filtrage sur ce statut
249
-				if (!autoriser('previsualiser' . $v, $objet, '', $id_auteur)) {
249
+				if (!autoriser('previsualiser'.$v, $objet, '', $id_auteur)) {
250 250
 					// si pas d'auteur identifie pas de sous-requete car pas d'article qui matche
251 251
 					if (!$id_auteur) {
252 252
 						$where[] = $w;
253 253
 					} else {
254 254
 						$primary = id_table_objet($objet);
255
-						$where[] = "($w OR $id_table.$primary IN (" . sql_get_select(
255
+						$where[] = "($w OR $id_table.$primary IN (".sql_get_select(
256 256
 							'ssss.id_objet',
257 257
 							'spip_auteurs_liens AS ssss',
258
-							'ssss.objet=' . sql_quote($objet) . ' AND ssss.id_auteur=' . intval($id_auteur),
258
+							'ssss.objet='.sql_quote($objet).' AND ssss.id_auteur='.intval($id_auteur),
259 259
 							'',
260 260
 							'',
261 261
 							'',
262 262
 							'',
263 263
 							$serveur
264
-						) . '))';
264
+						).'))';
265 265
 					}
266 266
 				}
267 267
 			} // ignorer ce statut si on ne sait pas comment le filtrer
@@ -299,7 +299,7 @@  discard block
 block discarded – undo
299 299
  * @return array|bool|null
300 300
  */
301 301
 function quete_fichier($id_document, $serveur = '') {
302
-	return sql_getfetsel('fichier', 'spip_documents', ('id_document=' . intval($id_document)), '', [], '', '', $serveur);
302
+	return sql_getfetsel('fichier', 'spip_documents', ('id_document='.intval($id_document)), '', [], '', '', $serveur);
303 303
 }
304 304
 
305 305
 /**
@@ -310,7 +310,7 @@  discard block
 block discarded – undo
310 310
  * @return array|bool
311 311
  */
312 312
 function quete_document($id_document, $serveur = '') {
313
-	return sql_fetsel('*', 'spip_documents', ('id_document=' . intval($id_document)), '', [], '', '', $serveur);
313
+	return sql_fetsel('*', 'spip_documents', ('id_document='.intval($id_document)), '', [], '', '', $serveur);
314 314
 }
315 315
 
316 316
 /**
@@ -321,7 +321,7 @@  discard block
 block discarded – undo
321 321
  * @return array|bool|null
322 322
  */
323 323
 function quete_meta($nom, $serveur) {
324
-	return sql_getfetsel('valeur', 'spip_meta', 'nom=' . sql_quote($nom), '', '', '', '', $serveur);
324
+	return sql_getfetsel('valeur', 'spip_meta', 'nom='.sql_quote($nom), '', '', '', '', $serveur);
325 325
 }
326 326
 
327 327
 /**
@@ -377,9 +377,9 @@  discard block
 block discarded – undo
377 377
 				// qui permet de distinguer le changement de logo
378 378
 				// et placer un expire sur le dossier IMG/
379 379
 				$res = [
380
-					$on['chemin'] . ($on['timestamp'] ? "?{$on['timestamp']}" : ''),
381
-					($off ? $off['chemin'] . ($off['timestamp'] ? "?{$off['timestamp']}" : '') : ''),
382
-					(!$taille ? '' : (' ' . $taille[3]))
380
+					$on['chemin'].($on['timestamp'] ? "?{$on['timestamp']}" : ''),
381
+					($off ? $off['chemin'].($off['timestamp'] ? "?{$off['timestamp']}" : '') : ''),
382
+					(!$taille ? '' : (' '.$taille[3]))
383 383
 				];
384 384
 				$res['src'] = $res[0];
385 385
 				$res['logo_on'] = $res[0];
@@ -476,7 +476,7 @@  discard block
 block discarded – undo
476 476
 	if (
477 477
 		strcmp($logo, _DIR_PLUGINS) == 0
478 478
 		or strcmp($logo, _DIR_PLUGINS_DIST) == 0
479
-		or strcmp($logo, _DIR_RACINE . 'prive/') == 0
479
+		or strcmp($logo, _DIR_RACINE.'prive/') == 0
480 480
 	) {
481 481
 		return $logo;
482 482
 	}
@@ -619,8 +619,7 @@  discard block
 block discarded – undo
619 619
 	// qu'une fois (par squelette) et on conserve le resultat
620 620
 	// en static.
621 621
 	if (!isset($exposer[$m = md5(serialize($reference))][$prim])) {
622
-		$principal = isset($reference[$type]) ? $reference[$type] :
623
-			// cas de la pagination indecte @xx qui positionne la page avec l'id xx
622
+		$principal = isset($reference[$type]) ? $reference[$type] : // cas de la pagination indecte @xx qui positionne la page avec l'id xx
624 623
 			// et donne la reference dynamique @type=xx dans le contexte
625 624
 			(isset($reference["@$type"]) ? $reference["@$type"] : '');
626 625
 		// le parent fournit en argument est le parent de $id, pas celui de $principal
@@ -649,7 +648,7 @@  discard block
 block discarded – undo
649 648
 				$exposer[$m][$type][$principal] = true;
650 649
 				if ($type == 'id_mot') {
651 650
 					if (!$parent) {
652
-						$parent = sql_getfetsel('id_groupe', 'spip_mots', 'id_mot=' . intval($principal), '', '', '', '', $connect);
651
+						$parent = sql_getfetsel('id_groupe', 'spip_mots', 'id_mot='.intval($principal), '', '', '', '', $connect);
653 652
 					}
654 653
 					if ($parent) {
655 654
 						$exposer[$m]['id_groupe'][$parent] = true;
Please login to merge, or discard this patch.
ecrire/public/decompiler.php 2 patches
Indentation   +177 added lines, -177 removed lines patch added patch discarded remove patch
@@ -11,130 +11,130 @@  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
 // Decompilation de l'arbre de syntaxe abstraite d'un squelette SPIP
18 18
 
19 19
 function decompiler_boucle($struct, $fmt = '', $prof = 0) {
20
-	$nom = $struct->id_boucle;
21
-	$preaff = decompiler_($struct->preaff, $fmt, $prof);
22
-	$avant = decompiler_($struct->avant, $fmt, $prof);
23
-	$apres = decompiler_($struct->apres, $fmt, $prof);
24
-	$altern = decompiler_($struct->altern, $fmt, $prof);
25
-	$milieu = decompiler_($struct->milieu, $fmt, $prof);
26
-	$postaff = decompiler_($struct->postaff, $fmt, $prof);
27
-
28
-	$type = $struct->sql_serveur ? "$struct->sql_serveur:" : '';
29
-	$type .= ($struct->type_requete ? $struct->type_requete :
30
-		$struct->table_optionnelle);
31
-
32
-	if ($struct->jointures_explicites) {
33
-		$type .= ' ' . $struct->jointures_explicites;
34
-	}
35
-	if ($struct->table_optionnelle) {
36
-		$type .= '?';
37
-	}
38
-	// Revoir le cas de la boucle recursive
39
-
40
-	$crit = $struct->param;
41
-	if ($crit and !is_array($crit[0])) {
42
-		$type = strtolower($type) . array_shift($crit);
43
-	}
44
-	$crit = decompiler_criteres($struct, $fmt, $prof);
45
-
46
-	$f = 'format_boucle_' . $fmt;
47
-
48
-	return $f($preaff, $avant, $nom, $type, $crit, $milieu, $apres, $altern, $postaff, $prof);
20
+    $nom = $struct->id_boucle;
21
+    $preaff = decompiler_($struct->preaff, $fmt, $prof);
22
+    $avant = decompiler_($struct->avant, $fmt, $prof);
23
+    $apres = decompiler_($struct->apres, $fmt, $prof);
24
+    $altern = decompiler_($struct->altern, $fmt, $prof);
25
+    $milieu = decompiler_($struct->milieu, $fmt, $prof);
26
+    $postaff = decompiler_($struct->postaff, $fmt, $prof);
27
+
28
+    $type = $struct->sql_serveur ? "$struct->sql_serveur:" : '';
29
+    $type .= ($struct->type_requete ? $struct->type_requete :
30
+        $struct->table_optionnelle);
31
+
32
+    if ($struct->jointures_explicites) {
33
+        $type .= ' ' . $struct->jointures_explicites;
34
+    }
35
+    if ($struct->table_optionnelle) {
36
+        $type .= '?';
37
+    }
38
+    // Revoir le cas de la boucle recursive
39
+
40
+    $crit = $struct->param;
41
+    if ($crit and !is_array($crit[0])) {
42
+        $type = strtolower($type) . array_shift($crit);
43
+    }
44
+    $crit = decompiler_criteres($struct, $fmt, $prof);
45
+
46
+    $f = 'format_boucle_' . $fmt;
47
+
48
+    return $f($preaff, $avant, $nom, $type, $crit, $milieu, $apres, $altern, $postaff, $prof);
49 49
 }
50 50
 
51 51
 function decompiler_include($struct, $fmt = '', $prof = 0) {
52
-	$res = [];
53
-	foreach ($struct->param ? $struct->param : [] as $couple) {
54
-		array_shift($couple);
55
-		foreach ($couple as $v) {
56
-			$res[] = decompiler_($v, $fmt, $prof);
57
-		}
58
-	}
59
-	$file = is_string($struct->texte) ? $struct->texte :
60
-		decompiler_($struct->texte, $fmt, $prof);
61
-	$f = 'format_inclure_' . $fmt;
62
-
63
-	return $f($file, $res, $prof);
52
+    $res = [];
53
+    foreach ($struct->param ? $struct->param : [] as $couple) {
54
+        array_shift($couple);
55
+        foreach ($couple as $v) {
56
+            $res[] = decompiler_($v, $fmt, $prof);
57
+        }
58
+    }
59
+    $file = is_string($struct->texte) ? $struct->texte :
60
+        decompiler_($struct->texte, $fmt, $prof);
61
+    $f = 'format_inclure_' . $fmt;
62
+
63
+    return $f($file, $res, $prof);
64 64
 }
65 65
 
66 66
 function decompiler_texte($struct, $fmt = '', $prof = 0) {
67
-	$f = 'format_texte_' . $fmt;
67
+    $f = 'format_texte_' . $fmt;
68 68
 
69
-	return strlen($struct->texte) ? $f($struct->texte, $prof) : '';
69
+    return strlen($struct->texte) ? $f($struct->texte, $prof) : '';
70 70
 }
71 71
 
72 72
 function decompiler_polyglotte($struct, $fmt = '', $prof = 0) {
73
-	$f = 'format_polyglotte_' . $fmt;
73
+    $f = 'format_polyglotte_' . $fmt;
74 74
 
75
-	return $f($struct->traductions, $prof);
75
+    return $f($struct->traductions, $prof);
76 76
 }
77 77
 
78 78
 function decompiler_idiome($struct, $fmt = '', $prof = 0) {
79
-	$args = [];
80
-	foreach ($struct->arg as $k => $v) {
81
-		$args[$k] = public_decompiler($v, $fmt, $prof);
82
-	}
79
+    $args = [];
80
+    foreach ($struct->arg as $k => $v) {
81
+        $args[$k] = public_decompiler($v, $fmt, $prof);
82
+    }
83 83
 
84
-	$filtres = decompiler_liste($struct->param, $fmt, $prof);
84
+    $filtres = decompiler_liste($struct->param, $fmt, $prof);
85 85
 
86
-	$f = 'format_idiome_' . $fmt;
86
+    $f = 'format_idiome_' . $fmt;
87 87
 
88
-	return $f($struct->nom_champ, $struct->module, $args, $filtres, $prof);
88
+    return $f($struct->nom_champ, $struct->module, $args, $filtres, $prof);
89 89
 }
90 90
 
91 91
 function decompiler_champ($struct, $fmt = '', $prof = 0) {
92
-	$avant = decompiler_($struct->avant, $fmt, $prof);
93
-	$apres = decompiler_($struct->apres, $fmt, $prof);
94
-	$args = $filtres = '';
95
-	if ($p = $struct->param) {
96
-		if ($p[0][0] === '') {
97
-			$args = decompiler_liste([array_shift($p)], $fmt, $prof);
98
-		}
99
-		$filtres = decompiler_liste($p, $fmt, $prof);
100
-	}
101
-	$f = 'format_champ_' . $fmt;
102
-
103
-	return $f($struct->nom_champ, $struct->nom_boucle, $struct->etoile, $avant, $apres, $args, $filtres, $prof);
92
+    $avant = decompiler_($struct->avant, $fmt, $prof);
93
+    $apres = decompiler_($struct->apres, $fmt, $prof);
94
+    $args = $filtres = '';
95
+    if ($p = $struct->param) {
96
+        if ($p[0][0] === '') {
97
+            $args = decompiler_liste([array_shift($p)], $fmt, $prof);
98
+        }
99
+        $filtres = decompiler_liste($p, $fmt, $prof);
100
+    }
101
+    $f = 'format_champ_' . $fmt;
102
+
103
+    return $f($struct->nom_champ, $struct->nom_boucle, $struct->etoile, $avant, $apres, $args, $filtres, $prof);
104 104
 }
105 105
 
106 106
 function decompiler_liste($sources, $fmt = '', $prof = 0) {
107
-	if (!is_array($sources)) {
108
-		return '';
109
-	}
110
-	$f = 'format_liste_' . $fmt;
111
-	$res = '';
112
-	foreach ($sources as $arg) {
113
-		if (!is_array($arg)) {
114
-			continue; // ne devrait pas arriver.
115
-		} else {
116
-			$r = array_shift($arg);
117
-		}
118
-		$args = [];
119
-		foreach ($arg as $v) {
120
-			// cas des arguments entoures de ' ou "
121
-			if (
122
-				(count($v) == 1)
123
-				and $v[0]->type == 'texte'
124
-				and (strlen($v[0]->apres) == 1)
125
-				and $v[0]->apres == $v[0]->avant
126
-			) {
127
-				$args[] = $v[0]->avant . $v[0]->texte . $v[0]->apres;
128
-			} else {
129
-				$args[] = decompiler_($v, $fmt, 0 - $prof);
130
-			}
131
-		}
132
-		if (($r !== '') or $args) {
133
-			$res .= $f($r, $args, $prof);
134
-		}
135
-	}
136
-
137
-	return $res;
107
+    if (!is_array($sources)) {
108
+        return '';
109
+    }
110
+    $f = 'format_liste_' . $fmt;
111
+    $res = '';
112
+    foreach ($sources as $arg) {
113
+        if (!is_array($arg)) {
114
+            continue; // ne devrait pas arriver.
115
+        } else {
116
+            $r = array_shift($arg);
117
+        }
118
+        $args = [];
119
+        foreach ($arg as $v) {
120
+            // cas des arguments entoures de ' ou "
121
+            if (
122
+                (count($v) == 1)
123
+                and $v[0]->type == 'texte'
124
+                and (strlen($v[0]->apres) == 1)
125
+                and $v[0]->apres == $v[0]->avant
126
+            ) {
127
+                $args[] = $v[0]->avant . $v[0]->texte . $v[0]->apres;
128
+            } else {
129
+                $args[] = decompiler_($v, $fmt, 0 - $prof);
130
+            }
131
+        }
132
+        if (($r !== '') or $args) {
133
+            $res .= $f($r, $args, $prof);
134
+        }
135
+    }
136
+
137
+    return $res;
138 138
 }
139 139
 
140 140
 // Decompilation des criteres: on triche et on deroge:
@@ -142,93 +142,93 @@  discard block
 block discarded – undo
142 142
 // - le champ apres signale le critere {"separateur"} ou {'separateur'}
143 143
 // - les champs sont implicitement etendus (crochets implicites mais interdits)
144 144
 function decompiler_criteres($boucle, $fmt = '', $prof = 0) {
145
-	$sources = $boucle->param;
146
-	if (!is_array($sources)) {
147
-		return '';
148
-	}
149
-	$res = '';
150
-	$f = 'format_critere_' . $fmt;
151
-	foreach ($sources as $crit) {
152
-		if (!is_array($crit)) {
153
-			continue;
154
-		} // boucle recursive
155
-		array_shift($crit);
156
-		$args = [];
157
-		foreach ($crit as $i => $v) {
158
-			if (
159
-				(count($v) == 1)
160
-				and $v[0]->type == 'texte'
161
-				and $v[0]->apres
162
-			) {
163
-				$args[] = [['texte', ($v[0]->apres . $v[0]->texte . $v[0]->apres)]];
164
-			} else {
165
-				$res2 = [];
166
-				foreach ($v as $k => $p) {
167
-					if (
168
-						isset($p->type)
169
-						and function_exists($d = 'decompiler_' . $p->type)
170
-					) {
171
-						$r = $d($p, $fmt, (0 - $prof), @$v[$k + 1]);
172
-						$res2[] = [$p->type, $r];
173
-					} else {
174
-						spip_log("critere $i / $k mal forme");
175
-					}
176
-				}
177
-				$args[] = $res2;
178
-			}
179
-		}
180
-		$res .= $f($args);
181
-	}
182
-
183
-	return $res;
145
+    $sources = $boucle->param;
146
+    if (!is_array($sources)) {
147
+        return '';
148
+    }
149
+    $res = '';
150
+    $f = 'format_critere_' . $fmt;
151
+    foreach ($sources as $crit) {
152
+        if (!is_array($crit)) {
153
+            continue;
154
+        } // boucle recursive
155
+        array_shift($crit);
156
+        $args = [];
157
+        foreach ($crit as $i => $v) {
158
+            if (
159
+                (count($v) == 1)
160
+                and $v[0]->type == 'texte'
161
+                and $v[0]->apres
162
+            ) {
163
+                $args[] = [['texte', ($v[0]->apres . $v[0]->texte . $v[0]->apres)]];
164
+            } else {
165
+                $res2 = [];
166
+                foreach ($v as $k => $p) {
167
+                    if (
168
+                        isset($p->type)
169
+                        and function_exists($d = 'decompiler_' . $p->type)
170
+                    ) {
171
+                        $r = $d($p, $fmt, (0 - $prof), @$v[$k + 1]);
172
+                        $res2[] = [$p->type, $r];
173
+                    } else {
174
+                        spip_log("critere $i / $k mal forme");
175
+                    }
176
+                }
177
+                $args[] = $res2;
178
+            }
179
+        }
180
+        $res .= $f($args);
181
+    }
182
+
183
+    return $res;
184 184
 }
185 185
 
186 186
 
187 187
 function decompiler_($liste, $fmt = '', $prof = 0) {
188
-	if (!is_array($liste)) {
189
-		return '';
190
-	}
191
-	$prof2 = ($prof < 0) ? ($prof - 1) : ($prof + 1);
192
-	$contenu = [];
193
-	foreach ($liste as $k => $p) {
194
-		if (!isset($p->type)) {
195
-			continue;
196
-		} #??????
197
-		$d = 'decompiler_' . $p->type;
198
-		$next = isset($liste[$k + 1]) ? $liste[$k + 1] : false;
199
-		// Forcer le champ etendu si son source (pas les reecritures)
200
-		// contenait des args et s'il est suivi d'espaces,
201
-		// le champ simple les eliminant est un bug helas perenne.
202
-
203
-		if (
204
-			$next
205
-			and ($next->type == 'texte')
206
-			and $p->type == 'champ'
207
-			and !$p->apres
208
-			and !$p->avant
209
-			and $p->fonctions
210
-		) {
211
-			$n = strlen($next->texte) - strlen(ltrim($next->texte));
212
-			if ($n) {
213
-				$champ = new Texte();
214
-				$champ->texte = substr($next->texte, 0, $n);
215
-				$champ->ligne = $p->ligne;
216
-				$p->apres = [$champ];
217
-				$next->texte = substr($next->texte, $n);
218
-			}
219
-		}
220
-		$contenu[] = [$d($p, $fmt, $prof2), $p->type];
221
-	}
222
-	$f = 'format_suite_' . $fmt;
223
-
224
-	return $f($contenu);
188
+    if (!is_array($liste)) {
189
+        return '';
190
+    }
191
+    $prof2 = ($prof < 0) ? ($prof - 1) : ($prof + 1);
192
+    $contenu = [];
193
+    foreach ($liste as $k => $p) {
194
+        if (!isset($p->type)) {
195
+            continue;
196
+        } #??????
197
+        $d = 'decompiler_' . $p->type;
198
+        $next = isset($liste[$k + 1]) ? $liste[$k + 1] : false;
199
+        // Forcer le champ etendu si son source (pas les reecritures)
200
+        // contenait des args et s'il est suivi d'espaces,
201
+        // le champ simple les eliminant est un bug helas perenne.
202
+
203
+        if (
204
+            $next
205
+            and ($next->type == 'texte')
206
+            and $p->type == 'champ'
207
+            and !$p->apres
208
+            and !$p->avant
209
+            and $p->fonctions
210
+        ) {
211
+            $n = strlen($next->texte) - strlen(ltrim($next->texte));
212
+            if ($n) {
213
+                $champ = new Texte();
214
+                $champ->texte = substr($next->texte, 0, $n);
215
+                $champ->ligne = $p->ligne;
216
+                $p->apres = [$champ];
217
+                $next->texte = substr($next->texte, $n);
218
+            }
219
+        }
220
+        $contenu[] = [$d($p, $fmt, $prof2), $p->type];
221
+    }
222
+    $f = 'format_suite_' . $fmt;
223
+
224
+    return $f($contenu);
225 225
 }
226 226
 
227 227
 function public_decompiler($liste, $fmt = '', $prof = 0, $quoi = '') {
228
-	if (!include_spip('public/format_' . $fmt)) {
229
-		return "'$fmt'?";
230
-	}
231
-	$f = 'decompiler_' . $quoi;
228
+    if (!include_spip('public/format_' . $fmt)) {
229
+        return "'$fmt'?";
230
+    }
231
+    $f = 'decompiler_' . $quoi;
232 232
 
233
-	return $f($liste, $fmt, $prof);
233
+    return $f($liste, $fmt, $prof);
234 234
 }
Please login to merge, or discard this patch.
Spacing   +19 added lines, -21 removed lines patch added patch discarded remove patch
@@ -26,11 +26,10 @@  discard block
 block discarded – undo
26 26
 	$postaff = decompiler_($struct->postaff, $fmt, $prof);
27 27
 
28 28
 	$type = $struct->sql_serveur ? "$struct->sql_serveur:" : '';
29
-	$type .= ($struct->type_requete ? $struct->type_requete :
30
-		$struct->table_optionnelle);
29
+	$type .= ($struct->type_requete ? $struct->type_requete : $struct->table_optionnelle);
31 30
 
32 31
 	if ($struct->jointures_explicites) {
33
-		$type .= ' ' . $struct->jointures_explicites;
32
+		$type .= ' '.$struct->jointures_explicites;
34 33
 	}
35 34
 	if ($struct->table_optionnelle) {
36 35
 		$type .= '?';
@@ -39,11 +38,11 @@  discard block
 block discarded – undo
39 38
 
40 39
 	$crit = $struct->param;
41 40
 	if ($crit and !is_array($crit[0])) {
42
-		$type = strtolower($type) . array_shift($crit);
41
+		$type = strtolower($type).array_shift($crit);
43 42
 	}
44 43
 	$crit = decompiler_criteres($struct, $fmt, $prof);
45 44
 
46
-	$f = 'format_boucle_' . $fmt;
45
+	$f = 'format_boucle_'.$fmt;
47 46
 
48 47
 	return $f($preaff, $avant, $nom, $type, $crit, $milieu, $apres, $altern, $postaff, $prof);
49 48
 }
@@ -56,21 +55,20 @@  discard block
 block discarded – undo
56 55
 			$res[] = decompiler_($v, $fmt, $prof);
57 56
 		}
58 57
 	}
59
-	$file = is_string($struct->texte) ? $struct->texte :
60
-		decompiler_($struct->texte, $fmt, $prof);
61
-	$f = 'format_inclure_' . $fmt;
58
+	$file = is_string($struct->texte) ? $struct->texte : decompiler_($struct->texte, $fmt, $prof);
59
+	$f = 'format_inclure_'.$fmt;
62 60
 
63 61
 	return $f($file, $res, $prof);
64 62
 }
65 63
 
66 64
 function decompiler_texte($struct, $fmt = '', $prof = 0) {
67
-	$f = 'format_texte_' . $fmt;
65
+	$f = 'format_texte_'.$fmt;
68 66
 
69 67
 	return strlen($struct->texte) ? $f($struct->texte, $prof) : '';
70 68
 }
71 69
 
72 70
 function decompiler_polyglotte($struct, $fmt = '', $prof = 0) {
73
-	$f = 'format_polyglotte_' . $fmt;
71
+	$f = 'format_polyglotte_'.$fmt;
74 72
 
75 73
 	return $f($struct->traductions, $prof);
76 74
 }
@@ -83,7 +81,7 @@  discard block
 block discarded – undo
83 81
 
84 82
 	$filtres = decompiler_liste($struct->param, $fmt, $prof);
85 83
 
86
-	$f = 'format_idiome_' . $fmt;
84
+	$f = 'format_idiome_'.$fmt;
87 85
 
88 86
 	return $f($struct->nom_champ, $struct->module, $args, $filtres, $prof);
89 87
 }
@@ -98,7 +96,7 @@  discard block
 block discarded – undo
98 96
 		}
99 97
 		$filtres = decompiler_liste($p, $fmt, $prof);
100 98
 	}
101
-	$f = 'format_champ_' . $fmt;
99
+	$f = 'format_champ_'.$fmt;
102 100
 
103 101
 	return $f($struct->nom_champ, $struct->nom_boucle, $struct->etoile, $avant, $apres, $args, $filtres, $prof);
104 102
 }
@@ -107,7 +105,7 @@  discard block
 block discarded – undo
107 105
 	if (!is_array($sources)) {
108 106
 		return '';
109 107
 	}
110
-	$f = 'format_liste_' . $fmt;
108
+	$f = 'format_liste_'.$fmt;
111 109
 	$res = '';
112 110
 	foreach ($sources as $arg) {
113 111
 		if (!is_array($arg)) {
@@ -124,7 +122,7 @@  discard block
 block discarded – undo
124 122
 				and (strlen($v[0]->apres) == 1)
125 123
 				and $v[0]->apres == $v[0]->avant
126 124
 			) {
127
-				$args[] = $v[0]->avant . $v[0]->texte . $v[0]->apres;
125
+				$args[] = $v[0]->avant.$v[0]->texte.$v[0]->apres;
128 126
 			} else {
129 127
 				$args[] = decompiler_($v, $fmt, 0 - $prof);
130 128
 			}
@@ -147,7 +145,7 @@  discard block
 block discarded – undo
147 145
 		return '';
148 146
 	}
149 147
 	$res = '';
150
-	$f = 'format_critere_' . $fmt;
148
+	$f = 'format_critere_'.$fmt;
151 149
 	foreach ($sources as $crit) {
152 150
 		if (!is_array($crit)) {
153 151
 			continue;
@@ -160,13 +158,13 @@  discard block
 block discarded – undo
160 158
 				and $v[0]->type == 'texte'
161 159
 				and $v[0]->apres
162 160
 			) {
163
-				$args[] = [['texte', ($v[0]->apres . $v[0]->texte . $v[0]->apres)]];
161
+				$args[] = [['texte', ($v[0]->apres.$v[0]->texte.$v[0]->apres)]];
164 162
 			} else {
165 163
 				$res2 = [];
166 164
 				foreach ($v as $k => $p) {
167 165
 					if (
168 166
 						isset($p->type)
169
-						and function_exists($d = 'decompiler_' . $p->type)
167
+						and function_exists($d = 'decompiler_'.$p->type)
170 168
 					) {
171 169
 						$r = $d($p, $fmt, (0 - $prof), @$v[$k + 1]);
172 170
 						$res2[] = [$p->type, $r];
@@ -194,7 +192,7 @@  discard block
 block discarded – undo
194 192
 		if (!isset($p->type)) {
195 193
 			continue;
196 194
 		} #??????
197
-		$d = 'decompiler_' . $p->type;
195
+		$d = 'decompiler_'.$p->type;
198 196
 		$next = isset($liste[$k + 1]) ? $liste[$k + 1] : false;
199 197
 		// Forcer le champ etendu si son source (pas les reecritures)
200 198
 		// contenait des args et s'il est suivi d'espaces,
@@ -219,16 +217,16 @@  discard block
 block discarded – undo
219 217
 		}
220 218
 		$contenu[] = [$d($p, $fmt, $prof2), $p->type];
221 219
 	}
222
-	$f = 'format_suite_' . $fmt;
220
+	$f = 'format_suite_'.$fmt;
223 221
 
224 222
 	return $f($contenu);
225 223
 }
226 224
 
227 225
 function public_decompiler($liste, $fmt = '', $prof = 0, $quoi = '') {
228
-	if (!include_spip('public/format_' . $fmt)) {
226
+	if (!include_spip('public/format_'.$fmt)) {
229 227
 		return "'$fmt'?";
230 228
 	}
231
-	$f = 'decompiler_' . $quoi;
229
+	$f = 'decompiler_'.$quoi;
232 230
 
233 231
 	return $f($liste, $fmt, $prof);
234 232
 }
Please login to merge, or discard this patch.