Completed
Push — master ( 31be05...1c2a9a )
by cam
04:17
created
ecrire/balise/logo_.php 3 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -148,7 +148,7 @@
 block discarded – undo
148 148
  * @param int $fichier
149 149
  *     - -1 pour retourner juste le chemin de l'image
150 150
  *     - 0 pour retourner le code HTML de l'image
151
- * @param string $lien
151
+ * @param string $_lien
152 152
  *     Lien pour encadrer l'image avec si présent
153 153
  * @param Champ $p
154 154
  *     Pile au niveau de la balise
Please login to merge, or discard this patch.
Indentation   +95 added lines, -95 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
 
@@ -54,84 +54,84 @@  discard block
 block discarded – undo
54 54
  */
55 55
 function balise_LOGO__dist($p) {
56 56
 
57
-	preg_match(',^LOGO_([A-Z_]+?)(|_NORMAL|_SURVOL|_RUBRIQUE)$,i', $p->nom_champ, $regs);
58
-	$type = strtolower($regs[1]);
59
-	$suite_logo = $regs[2];
60
-
61
-	// cas de #LOGO_SITE_SPIP
62
-	if ($type == 'site_spip') {
63
-		$type = 'site';
64
-		$_id_objet = "\"'0'\"";
65
-	}
66
-
67
-	$id_objet = id_table_objet($type);
68
-	if (!isset($_id_objet)) {
69
-		$_id_objet = champ_sql($id_objet, $p);
70
-	}
71
-
72
-	$fichier = ($p->etoile === '**') ? -1 : 0;
73
-	$coord = array();
74
-	$align = $lien = '';
75
-	$mode_logo = '';
76
-
77
-	if ($p->param and !$p->param[0][0]) {
78
-		$params = $p->param[0];
79
-		array_shift($params);
80
-		foreach ($params as $a) {
81
-			if ($a[0]->type === 'texte') {
82
-				$n = $a[0]->texte;
83
-				if (is_numeric($n)) {
84
-					$coord[] = $n;
85
-				} elseif (in_array($n, array('top', 'left', 'right', 'center', 'bottom'))) {
86
-					$align = $n;
87
-				} elseif (in_array($n, array('auto', 'icone', 'apercu', 'vignette'))) {
88
-					$mode_logo = $n;
89
-				}
90
-			} else {
91
-				$lien = calculer_liste($a, $p->descr, $p->boucles, $p->id_boucle);
92
-			}
93
-		}
94
-	}
95
-
96
-	$coord_x = !$coord ? 0 : intval(array_shift($coord));
97
-	$coord_y = !$coord ? 0 : intval(array_shift($coord));
98
-
99
-	if ($p->etoile === '*') {
100
-		include_spip('balise/url_');
101
-		$lien = generer_generer_url_arg($type, $p, $_id_objet);
102
-	}
103
-
104
-	$connect = $p->id_boucle ? $p->boucles[$p->id_boucle]->sql_serveur : '';
105
-	if ($type == 'document') {
106
-		$qconnect = _q($connect);
107
-		$doc = "quete_document($_id_objet, $qconnect)";
108
-		if ($fichier) {
109
-			$code = "quete_logo_file($doc, $qconnect)";
110
-		} else {
111
-			$code = "quete_logo_document($doc, " . ($lien ? $lien : "''") . ", '$align', '$mode_logo', $coord_x, $coord_y, $qconnect)";
112
-		}
113
-		// (x=non-faux ? y : '') pour affecter x en retournant y
114
-		if ($p->descr['documents']) {
115
-			$code = '(($doublons["documents"] .= ",". '
116
-				. $_id_objet
117
-				. ") ? $code : '')";
118
-		}
119
-	} elseif ($connect) {
120
-		$code = "''";
121
-		spip_log('Les logos distants ne sont pas prevus');
122
-	} else {
123
-		$code = logo_survol($id_objet, $_id_objet, $type, $align, $fichier, $lien, $p, $suite_logo);
124
-	}
125
-
126
-	// demande de reduction sur logo avec ecriture spip 2.1 : #LOGO_xxx{200, 0}
127
-	if ($coord_x or $coord_y) {
128
-		$code = "filtrer('image_graver',filtrer('image_reduire'," . $code . ", '$coord_x', '$coord_y'))";
129
-	}
130
-
131
-	$p->code = $code;
132
-	$p->interdire_scripts = false;
133
-
134
-	return $p;
57
+    preg_match(',^LOGO_([A-Z_]+?)(|_NORMAL|_SURVOL|_RUBRIQUE)$,i', $p->nom_champ, $regs);
58
+    $type = strtolower($regs[1]);
59
+    $suite_logo = $regs[2];
60
+
61
+    // cas de #LOGO_SITE_SPIP
62
+    if ($type == 'site_spip') {
63
+        $type = 'site';
64
+        $_id_objet = "\"'0'\"";
65
+    }
66
+
67
+    $id_objet = id_table_objet($type);
68
+    if (!isset($_id_objet)) {
69
+        $_id_objet = champ_sql($id_objet, $p);
70
+    }
71
+
72
+    $fichier = ($p->etoile === '**') ? -1 : 0;
73
+    $coord = array();
74
+    $align = $lien = '';
75
+    $mode_logo = '';
76
+
77
+    if ($p->param and !$p->param[0][0]) {
78
+        $params = $p->param[0];
79
+        array_shift($params);
80
+        foreach ($params as $a) {
81
+            if ($a[0]->type === 'texte') {
82
+                $n = $a[0]->texte;
83
+                if (is_numeric($n)) {
84
+                    $coord[] = $n;
85
+                } elseif (in_array($n, array('top', 'left', 'right', 'center', 'bottom'))) {
86
+                    $align = $n;
87
+                } elseif (in_array($n, array('auto', 'icone', 'apercu', 'vignette'))) {
88
+                    $mode_logo = $n;
89
+                }
90
+            } else {
91
+                $lien = calculer_liste($a, $p->descr, $p->boucles, $p->id_boucle);
92
+            }
93
+        }
94
+    }
95
+
96
+    $coord_x = !$coord ? 0 : intval(array_shift($coord));
97
+    $coord_y = !$coord ? 0 : intval(array_shift($coord));
98
+
99
+    if ($p->etoile === '*') {
100
+        include_spip('balise/url_');
101
+        $lien = generer_generer_url_arg($type, $p, $_id_objet);
102
+    }
103
+
104
+    $connect = $p->id_boucle ? $p->boucles[$p->id_boucle]->sql_serveur : '';
105
+    if ($type == 'document') {
106
+        $qconnect = _q($connect);
107
+        $doc = "quete_document($_id_objet, $qconnect)";
108
+        if ($fichier) {
109
+            $code = "quete_logo_file($doc, $qconnect)";
110
+        } else {
111
+            $code = "quete_logo_document($doc, " . ($lien ? $lien : "''") . ", '$align', '$mode_logo', $coord_x, $coord_y, $qconnect)";
112
+        }
113
+        // (x=non-faux ? y : '') pour affecter x en retournant y
114
+        if ($p->descr['documents']) {
115
+            $code = '(($doublons["documents"] .= ",". '
116
+                . $_id_objet
117
+                . ") ? $code : '')";
118
+        }
119
+    } elseif ($connect) {
120
+        $code = "''";
121
+        spip_log('Les logos distants ne sont pas prevus');
122
+    } else {
123
+        $code = logo_survol($id_objet, $_id_objet, $type, $align, $fichier, $lien, $p, $suite_logo);
124
+    }
125
+
126
+    // demande de reduction sur logo avec ecriture spip 2.1 : #LOGO_xxx{200, 0}
127
+    if ($coord_x or $coord_y) {
128
+        $code = "filtrer('image_graver',filtrer('image_reduire'," . $code . ", '$coord_x', '$coord_y'))";
129
+    }
130
+
131
+    $p->code = $code;
132
+    $p->interdire_scripts = false;
133
+
134
+    return $p;
135 135
 }
136 136
 
137 137
 /**
@@ -158,20 +158,20 @@  discard block
 block discarded – undo
158 158
  *     Code compilé retournant le chemin du logo ou le code HTML du logo.
159 159
  **/
160 160
 function logo_survol($id_objet, $_id_objet, $type, $align, $fichier, $_lien, $p, $suite) {
161
-	$code = "quete_logo('$id_objet', '" .
162
-		(($suite == '_SURVOL') ? 'off' :
163
-			(($suite == '_NORMAL') ? 'on' : 'ON')) .
164
-		"', $_id_objet," .
165
-		(($suite == '_RUBRIQUE') ?
166
-			champ_sql('id_rubrique', $p) :
167
-			(($type == 'rubrique') ? "quete_parent($_id_objet)" : "''")) .
168
-		', ' . intval($fichier) . ')';
169
-
170
-	if ($fichier) {
171
-		return $code;
172
-	}
173
-
174
-	$align = preg_replace(",\W,", "", $align);
175
-
176
-	return "quete_html_logo($code, '$align', " .($_lien ? $_lien : "''") .")";
161
+    $code = "quete_logo('$id_objet', '" .
162
+        (($suite == '_SURVOL') ? 'off' :
163
+            (($suite == '_NORMAL') ? 'on' : 'ON')) .
164
+        "', $_id_objet," .
165
+        (($suite == '_RUBRIQUE') ?
166
+            champ_sql('id_rubrique', $p) :
167
+            (($type == 'rubrique') ? "quete_parent($_id_objet)" : "''")) .
168
+        ', ' . intval($fichier) . ')';
169
+
170
+    if ($fichier) {
171
+        return $code;
172
+    }
173
+
174
+    $align = preg_replace(",\W,", "", $align);
175
+
176
+    return "quete_html_logo($code, '$align', " .($_lien ? $_lien : "''") .")";
177 177
 }
Please login to merge, or discard this patch.
Spacing   +8 added lines, -10 removed lines patch added patch discarded remove patch
@@ -108,7 +108,7 @@  discard block
 block discarded – undo
108 108
 		if ($fichier) {
109 109
 			$code = "quete_logo_file($doc, $qconnect)";
110 110
 		} else {
111
-			$code = "quete_logo_document($doc, " . ($lien ? $lien : "''") . ", '$align', '$mode_logo', $coord_x, $coord_y, $qconnect)";
111
+			$code = "quete_logo_document($doc, ".($lien ? $lien : "''").", '$align', '$mode_logo', $coord_x, $coord_y, $qconnect)";
112 112
 		}
113 113
 		// (x=non-faux ? y : '') pour affecter x en retournant y
114 114
 		if ($p->descr['documents']) {
@@ -125,7 +125,7 @@  discard block
 block discarded – undo
125 125
 
126 126
 	// demande de reduction sur logo avec ecriture spip 2.1 : #LOGO_xxx{200, 0}
127 127
 	if ($coord_x or $coord_y) {
128
-		$code = "filtrer('image_graver',filtrer('image_reduire'," . $code . ", '$coord_x', '$coord_y'))";
128
+		$code = "filtrer('image_graver',filtrer('image_reduire',".$code.", '$coord_x', '$coord_y'))";
129 129
 	}
130 130
 
131 131
 	$p->code = $code;
@@ -158,14 +158,12 @@  discard block
 block discarded – undo
158 158
  *     Code compilé retournant le chemin du logo ou le code HTML du logo.
159 159
  **/
160 160
 function logo_survol($id_objet, $_id_objet, $type, $align, $fichier, $_lien, $p, $suite) {
161
-	$code = "quete_logo('$id_objet', '" .
162
-		(($suite == '_SURVOL') ? 'off' :
163
-			(($suite == '_NORMAL') ? 'on' : 'ON')) .
164
-		"', $_id_objet," .
161
+	$code = "quete_logo('$id_objet', '".
162
+		(($suite == '_SURVOL') ? 'off' : (($suite == '_NORMAL') ? 'on' : 'ON')).
163
+		"', $_id_objet,".
165 164
 		(($suite == '_RUBRIQUE') ?
166
-			champ_sql('id_rubrique', $p) :
167
-			(($type == 'rubrique') ? "quete_parent($_id_objet)" : "''")) .
168
-		', ' . intval($fichier) . ')';
165
+			champ_sql('id_rubrique', $p) : (($type == 'rubrique') ? "quete_parent($_id_objet)" : "''")).
166
+		', '.intval($fichier).')';
169 167
 
170 168
 	if ($fichier) {
171 169
 		return $code;
@@ -173,5 +171,5 @@  discard block
 block discarded – undo
173 171
 
174 172
 	$align = preg_replace(",\W,", "", $align);
175 173
 
176
-	return "quete_html_logo($code, '$align', " .($_lien ? $_lien : "''") .")";
174
+	return "quete_html_logo($code, '$align', ".($_lien ? $_lien : "''").")";
177 175
 }
Please login to merge, or discard this patch.
ecrire/public/quete.php 1 patch
Indentation   +400 added lines, -400 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
-		array('id_article=' . intval($id_article), "statut='publie'"),
40
-		'',
41
-		'',
42
-		'',
43
-		'',
44
-		$connect
45
-	);
36
+    return sql_getfetsel(
37
+        'virtuel',
38
+        'spip_articles',
39
+        array('id_article=' . intval($id_article), "statut='publie'"),
40
+        '',
41
+        '',
42
+        '',
43
+        '',
44
+        $connect
45
+    );
46 46
 }
47 47
 
48 48
 /**
@@ -57,38 +57,38 @@  discard block
 block discarded – undo
57 57
  * @return array
58 58
  */
59 59
 function quete_parent_lang($table, $id, $connect = '') {
60
-	static $cache_quete = array();
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 (!$desc = $trouver_table($table,
66
-					$connect) or !isset($desc['field']['id_rubrique'])
67
-			) {
68
-				// pas de parent rubrique, on passe
69
-				$cache_quete[$connect][$table]['_select'] = false;
70
-			} else {
71
-				$select = ($table == 'spip_rubriques' ? 'id_parent' : 'id_rubrique');
72
-				$select .= isset($desc['field']['lang']) ? ', lang' : '';
73
-				$cache_quete[$connect][$table]['_select'] = $select;
74
-				$cache_quete[$connect][$table]['_id'] = id_table_objet(objet_type($table));
75
-			}
76
-		}
77
-		if ($cache_quete[$connect][$table]['_select']) {
78
-			$cache_quete[$connect][$table][$id] = sql_fetsel(
79
-				$cache_quete[$connect][$table]['_select'],
80
-				$table,
81
-				$cache_quete[$connect][$table]['_id'] . '=' . intval($id),
82
-				'',
83
-				'',
84
-				'',
85
-				'',
86
-				$connect
87
-			);
88
-		}
89
-	}
90
-
91
-	return isset($cache_quete[$connect][$table][$id]) ? $cache_quete[$connect][$table][$id] : null;
60
+    static $cache_quete = array();
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 (!$desc = $trouver_table($table,
66
+                    $connect) or !isset($desc['field']['id_rubrique'])
67
+            ) {
68
+                // pas de parent rubrique, on passe
69
+                $cache_quete[$connect][$table]['_select'] = false;
70
+            } else {
71
+                $select = ($table == 'spip_rubriques' ? 'id_parent' : 'id_rubrique');
72
+                $select .= isset($desc['field']['lang']) ? ', lang' : '';
73
+                $cache_quete[$connect][$table]['_select'] = $select;
74
+                $cache_quete[$connect][$table]['_id'] = id_table_objet(objet_type($table));
75
+            }
76
+        }
77
+        if ($cache_quete[$connect][$table]['_select']) {
78
+            $cache_quete[$connect][$table][$id] = sql_fetsel(
79
+                $cache_quete[$connect][$table]['_select'],
80
+                $table,
81
+                $cache_quete[$connect][$table]['_id'] . '=' . intval($id),
82
+                '',
83
+                '',
84
+                '',
85
+                '',
86
+                $connect
87
+            );
88
+        }
89
+    }
90
+
91
+    return isset($cache_quete[$connect][$table][$id]) ? $cache_quete[$connect][$table][$id] : null;
92 92
 }
93 93
 
94 94
 
@@ -105,12 +105,12 @@  discard block
 block discarded – undo
105 105
  * @return int
106 106
  */
107 107
 function quete_parent($id_rubrique, $connect = '') {
108
-	if (!$id_rubrique = intval($id_rubrique)) {
109
-		return 0;
110
-	}
111
-	$id_parent = quete_parent_lang('spip_rubriques', $id_rubrique, $connect);
108
+    if (!$id_rubrique = intval($id_rubrique)) {
109
+        return 0;
110
+    }
111
+    $id_parent = quete_parent_lang('spip_rubriques', $id_rubrique, $connect);
112 112
 
113
-	return $id_parent['id_parent'];
113
+    return $id_parent['id_parent'];
114 114
 }
115 115
 
116 116
 /**
@@ -126,9 +126,9 @@  discard block
 block discarded – undo
126 126
  * @return int
127 127
  */
128 128
 function quete_rubrique($id_article, $serveur) {
129
-	$id_parent = quete_parent_lang('spip_articles', $id_article, $serveur);
129
+    $id_parent = quete_parent_lang('spip_articles', $id_article, $serveur);
130 130
 
131
-	return $id_parent['id_rubrique'];
131
+    return $id_parent['id_rubrique'];
132 132
 }
133 133
 
134 134
 
@@ -142,13 +142,13 @@  discard block
 block discarded – undo
142 142
  * @return int
143 143
  */
144 144
 function quete_profondeur($id, $connect = '') {
145
-	$n = 0;
146
-	while ($id) {
147
-		$n++;
148
-		$id = quete_parent($id, $connect);
149
-	}
145
+    $n = 0;
146
+    while ($id) {
147
+        $n++;
148
+        $id = quete_parent($id, $connect);
149
+    }
150 150
 
151
-	return $n;
151
+    return $n;
152 152
 }
153 153
 
154 154
 
@@ -164,15 +164,15 @@  discard block
 block discarded – undo
164 164
  *     Morceau de la requête SQL testant la date
165 165
  */
166 166
 function quete_condition_postdates($champ_date, $serveur = '', $ignore_previsu = false) {
167
-	if (defined('_VAR_PREVIEW') and _VAR_PREVIEW and !$ignore_previsu) {
168
-		return '1=1';
169
-	}
170
-
171
-	return
172
-		(isset($GLOBALS['meta']['date_prochain_postdate'])
173
-			and $GLOBALS['meta']['date_prochain_postdate'] > time())
174
-			? "$champ_date<" . sql_quote(date('Y-m-d H:i:s', $GLOBALS['meta']['date_prochain_postdate']), $serveur)
175
-			: '1=1';
167
+    if (defined('_VAR_PREVIEW') and _VAR_PREVIEW and !$ignore_previsu) {
168
+        return '1=1';
169
+    }
170
+
171
+    return
172
+        (isset($GLOBALS['meta']['date_prochain_postdate'])
173
+            and $GLOBALS['meta']['date_prochain_postdate'] > time())
174
+            ? "$champ_date<" . sql_quote(date('Y-m-d H:i:s', $GLOBALS['meta']['date_prochain_postdate']), $serveur)
175
+            : '1=1';
176 176
 }
177 177
 
178 178
 
@@ -192,100 +192,100 @@  discard block
 block discarded – undo
192 192
  * @return array|string
193 193
  */
194 194
 function quete_condition_statut($mstatut, $previsu, $publie, $serveur = '', $ignore_previsu = false) {
195
-	static $cond = array();
196
-	$key = func_get_args();
197
-	$key = implode('-', $key);
198
-	if (isset($cond[$key])) {
199
-		return $cond[$key];
200
-	}
201
-
202
-	$liste_statuts = $publie;
203
-	if (defined('_VAR_PREVIEW') and _VAR_PREVIEW and !$ignore_previsu) {
204
-		$liste_statuts = $previsu;
205
-	}
206
-	$not = false;
207
-	if (strncmp($liste_statuts, '!', 1) == 0) {
208
-		$not = true;
209
-		$liste_statuts = substr($liste_statuts, 1);
210
-	}
211
-	// '' => ne rien afficher, '!'=> ne rien filtrer
212
-	if (!strlen($liste_statuts)) {
213
-		return $cond[$key] = ($not ? '1=1' : '0=1');
214
-	}
215
-
216
-	$liste_statuts = explode(',', $liste_statuts);
217
-	$where = array();
218
-	foreach ($liste_statuts as $k => $v) {
219
-		// filtrage /auteur pour limiter les objets d'un statut (prepa en general)
220
-		// a ceux de l'auteur identifie
221
-		if (strpos($v, '/') !== false) {
222
-			$v = explode('/', $v);
223
-			$filtre = end($v);
224
-			$v = reset($v);
225
-			$v = preg_replace(',\W,', '', $v);
226
-			if ($filtre == 'auteur'
227
-				and (strpos($mstatut, '.') !== false)
228
-				and $objet = explode('.', $mstatut)
229
-				and $id_table = reset($objet)
230
-				and $objet = objet_type($id_table)
231
-			) {
232
-				$w = "$mstatut<>" . sql_quote($v);
233
-
234
-				// retrouver l’id_auteur qui a filé un lien de prévisu éventuellement,
235
-				// sinon l’auteur en session
236
-				include_spip('inc/securiser_action');
237
-				if ($desc = decrire_token_previsu()) {
238
-					$id_auteur = $desc['id_auteur'];
239
-				} elseif (isset($GLOBALS['visiteur_session']['id_auteur'])) {
240
-					$id_auteur = intval($GLOBALS['visiteur_session']['id_auteur']);
241
-				} else {
242
-					$id_auteur = null;
243
-				}
244
-
245
-				// dans ce cas (admin en general), pas de filtrage sur ce statut
246
-				if (!autoriser('previsualiser' . $v, $objet, '', $id_auteur)) {
247
-					// si pas d'auteur identifie pas de sous-requete car pas d'article qui matche
248
-					if (!$id_auteur) {
249
-						$where[] = $w;
250
-					} else {
251
-						$primary = id_table_objet($objet);
252
-						$where[] = "($w OR $id_table.$primary IN (" . sql_get_select(
253
-								'ssss.id_objet',
254
-								'spip_auteurs_liens AS ssss',
255
-								'ssss.objet=' . sql_quote($objet) . ' AND ssss.id_auteur=' . intval($id_auteur),
256
-								'',
257
-								'',
258
-								'',
259
-								'',
260
-								$serveur
261
-							) . '))';
262
-					}
263
-				}
264
-			} // ignorer ce statut si on ne sait pas comment le filtrer
265
-			else {
266
-				$v = '';
267
-			}
268
-		}
269
-		// securite
270
-		$liste_statuts[$k] = preg_replace(',\W,', '', $v);
271
-	}
272
-	$liste_statuts = array_filter($liste_statuts);
273
-	if (count($liste_statuts) == 1) {
274
-		$where[] = array('=', $mstatut, sql_quote(reset($liste_statuts), $serveur));
275
-	} else {
276
-		$where[] = sql_in($mstatut, $liste_statuts, $not, $serveur);
277
-	}
278
-
279
-	while (count($where) > 1) {
280
-		$and = array('AND', array_pop($where), array_pop($where));
281
-		$where[] = $and;
282
-	}
283
-	$cond[$key] = reset($where);
284
-	if ($not) {
285
-		$cond[$key] = array('NOT', $cond[$key]);
286
-	}
287
-
288
-	return $cond[$key];
195
+    static $cond = array();
196
+    $key = func_get_args();
197
+    $key = implode('-', $key);
198
+    if (isset($cond[$key])) {
199
+        return $cond[$key];
200
+    }
201
+
202
+    $liste_statuts = $publie;
203
+    if (defined('_VAR_PREVIEW') and _VAR_PREVIEW and !$ignore_previsu) {
204
+        $liste_statuts = $previsu;
205
+    }
206
+    $not = false;
207
+    if (strncmp($liste_statuts, '!', 1) == 0) {
208
+        $not = true;
209
+        $liste_statuts = substr($liste_statuts, 1);
210
+    }
211
+    // '' => ne rien afficher, '!'=> ne rien filtrer
212
+    if (!strlen($liste_statuts)) {
213
+        return $cond[$key] = ($not ? '1=1' : '0=1');
214
+    }
215
+
216
+    $liste_statuts = explode(',', $liste_statuts);
217
+    $where = array();
218
+    foreach ($liste_statuts as $k => $v) {
219
+        // filtrage /auteur pour limiter les objets d'un statut (prepa en general)
220
+        // a ceux de l'auteur identifie
221
+        if (strpos($v, '/') !== false) {
222
+            $v = explode('/', $v);
223
+            $filtre = end($v);
224
+            $v = reset($v);
225
+            $v = preg_replace(',\W,', '', $v);
226
+            if ($filtre == 'auteur'
227
+                and (strpos($mstatut, '.') !== false)
228
+                and $objet = explode('.', $mstatut)
229
+                and $id_table = reset($objet)
230
+                and $objet = objet_type($id_table)
231
+            ) {
232
+                $w = "$mstatut<>" . sql_quote($v);
233
+
234
+                // retrouver l’id_auteur qui a filé un lien de prévisu éventuellement,
235
+                // sinon l’auteur en session
236
+                include_spip('inc/securiser_action');
237
+                if ($desc = decrire_token_previsu()) {
238
+                    $id_auteur = $desc['id_auteur'];
239
+                } elseif (isset($GLOBALS['visiteur_session']['id_auteur'])) {
240
+                    $id_auteur = intval($GLOBALS['visiteur_session']['id_auteur']);
241
+                } else {
242
+                    $id_auteur = null;
243
+                }
244
+
245
+                // dans ce cas (admin en general), pas de filtrage sur ce statut
246
+                if (!autoriser('previsualiser' . $v, $objet, '', $id_auteur)) {
247
+                    // si pas d'auteur identifie pas de sous-requete car pas d'article qui matche
248
+                    if (!$id_auteur) {
249
+                        $where[] = $w;
250
+                    } else {
251
+                        $primary = id_table_objet($objet);
252
+                        $where[] = "($w OR $id_table.$primary IN (" . sql_get_select(
253
+                                'ssss.id_objet',
254
+                                'spip_auteurs_liens AS ssss',
255
+                                'ssss.objet=' . sql_quote($objet) . ' AND ssss.id_auteur=' . intval($id_auteur),
256
+                                '',
257
+                                '',
258
+                                '',
259
+                                '',
260
+                                $serveur
261
+                            ) . '))';
262
+                    }
263
+                }
264
+            } // ignorer ce statut si on ne sait pas comment le filtrer
265
+            else {
266
+                $v = '';
267
+            }
268
+        }
269
+        // securite
270
+        $liste_statuts[$k] = preg_replace(',\W,', '', $v);
271
+    }
272
+    $liste_statuts = array_filter($liste_statuts);
273
+    if (count($liste_statuts) == 1) {
274
+        $where[] = array('=', $mstatut, sql_quote(reset($liste_statuts), $serveur));
275
+    } else {
276
+        $where[] = sql_in($mstatut, $liste_statuts, $not, $serveur);
277
+    }
278
+
279
+    while (count($where) > 1) {
280
+        $and = array('AND', array_pop($where), array_pop($where));
281
+        $where[] = $and;
282
+    }
283
+    $cond[$key] = reset($where);
284
+    if ($not) {
285
+        $cond[$key] = array('NOT', $cond[$key]);
286
+    }
287
+
288
+    return $cond[$key];
289 289
 }
290 290
 
291 291
 /**
@@ -296,7 +296,7 @@  discard block
 block discarded – undo
296 296
  * @return array|bool|null
297 297
  */
298 298
 function quete_fichier($id_document, $serveur = '') {
299
-	return sql_getfetsel('fichier', 'spip_documents', ('id_document=' . intval($id_document)), '', array(), '', '', $serveur);
299
+    return sql_getfetsel('fichier', 'spip_documents', ('id_document=' . intval($id_document)), '', array(), '', '', $serveur);
300 300
 }
301 301
 
302 302
 /**
@@ -307,7 +307,7 @@  discard block
 block discarded – undo
307 307
  * @return array|bool
308 308
  */
309 309
 function quete_document($id_document, $serveur = '') {
310
-	return sql_fetsel('*', 'spip_documents', ('id_document=' . intval($id_document)), '', array(), '', '', $serveur);
310
+    return sql_fetsel('*', 'spip_documents', ('id_document=' . intval($id_document)), '', array(), '', '', $serveur);
311 311
 }
312 312
 
313 313
 /**
@@ -318,7 +318,7 @@  discard block
 block discarded – undo
318 318
  * @return array|bool|null
319 319
  */
320 320
 function quete_meta($nom, $serveur) {
321
-	return sql_getfetsel('valeur', 'spip_meta', 'nom=' . sql_quote($nom), '', '', '', '', $serveur);
321
+    return sql_getfetsel('valeur', 'spip_meta', 'nom=' . sql_quote($nom), '', '', '', '', $serveur);
322 322
 }
323 323
 
324 324
 /**
@@ -344,64 +344,64 @@  discard block
 block discarded – undo
344 344
  *     Retourne soit un tableau, soit le chemin du fichier.
345 345
  */
346 346
 function quete_logo($cle_objet, $onoff, $id, $id_rubrique, $flag) {
347
-	include_spip('base/objets');
348
-	$nom = strtolower($onoff);
349
-
350
-	while (1) {
351
-		$objet = objet_type($cle_objet);
352
-
353
-		$on = quete_logo_objet($id, $objet, $nom);
354
-
355
-		if ($on) {
356
-			if ($flag) {
357
-				return basename($on['chemin']);
358
-			} else {
359
-				$taille = @spip_getimagesize($on['chemin']);
360
-
361
-				// Si on a déjà demandé un survol directement ($onoff = off)
362
-				// ou qu'on a demandé uniquement le normal ($onoff = on)
363
-				// alors on ne cherche pas du tout le survol ici
364
-				if ($onoff != 'ON') {
365
-					$off = '';
366
-				} else {
367
-					// Sinon, c'est qu'on demande normal ET survol à la fois, donc on cherche maintenant le survol
368
-					$off = quete_logo_objet($id, $objet, 'off');
369
-				}
370
-
371
-				// on retourne une url du type IMG/artonXX?timestamp
372
-				// qui permet de distinguer le changement de logo
373
-				// et placer un expire sur le dossier IMG/
374
-				$res = array(
375
-					$on['chemin'] . ($on['timestamp'] ? "?{$on['timestamp']}" : ''),
376
-					($off ? $off['chemin'] . ($off['timestamp'] ? "?{$off['timestamp']}" : '') : ''),
377
-					(!$taille ? '' : (' ' . $taille[3]))
378
-				);
379
-				$res['src'] = $res[0];
380
-				$res['logo_on'] = $res[0];
381
-				$res['logo_off'] = $res[1];
382
-				$res['width'] = ($taille ? $taille[0] : '');
383
-				$res['height'] = ($taille ? $taille[1] : '');
384
-
385
-				return $res;
386
-			}
387
-		} else {
388
-			if (defined('_LOGO_RUBRIQUE_DESACTIVER_HERITAGE')) {
389
-				return '';
390
-			} else {
391
-				if ($id_rubrique) {
392
-					$cle_objet = 'id_rubrique';
393
-					$id = $id_rubrique;
394
-					$id_rubrique = 0;
395
-				} else {
396
-					if ($id and $cle_objet == 'id_rubrique') {
397
-						$id = quete_parent($id);
398
-					} else {
399
-						return '';
400
-					}
401
-				}
402
-			}
403
-		}
404
-	}
347
+    include_spip('base/objets');
348
+    $nom = strtolower($onoff);
349
+
350
+    while (1) {
351
+        $objet = objet_type($cle_objet);
352
+
353
+        $on = quete_logo_objet($id, $objet, $nom);
354
+
355
+        if ($on) {
356
+            if ($flag) {
357
+                return basename($on['chemin']);
358
+            } else {
359
+                $taille = @spip_getimagesize($on['chemin']);
360
+
361
+                // Si on a déjà demandé un survol directement ($onoff = off)
362
+                // ou qu'on a demandé uniquement le normal ($onoff = on)
363
+                // alors on ne cherche pas du tout le survol ici
364
+                if ($onoff != 'ON') {
365
+                    $off = '';
366
+                } else {
367
+                    // Sinon, c'est qu'on demande normal ET survol à la fois, donc on cherche maintenant le survol
368
+                    $off = quete_logo_objet($id, $objet, 'off');
369
+                }
370
+
371
+                // on retourne une url du type IMG/artonXX?timestamp
372
+                // qui permet de distinguer le changement de logo
373
+                // et placer un expire sur le dossier IMG/
374
+                $res = array(
375
+                    $on['chemin'] . ($on['timestamp'] ? "?{$on['timestamp']}" : ''),
376
+                    ($off ? $off['chemin'] . ($off['timestamp'] ? "?{$off['timestamp']}" : '') : ''),
377
+                    (!$taille ? '' : (' ' . $taille[3]))
378
+                );
379
+                $res['src'] = $res[0];
380
+                $res['logo_on'] = $res[0];
381
+                $res['logo_off'] = $res[1];
382
+                $res['width'] = ($taille ? $taille[0] : '');
383
+                $res['height'] = ($taille ? $taille[1] : '');
384
+
385
+                return $res;
386
+            }
387
+        } else {
388
+            if (defined('_LOGO_RUBRIQUE_DESACTIVER_HERITAGE')) {
389
+                return '';
390
+            } else {
391
+                if ($id_rubrique) {
392
+                    $cle_objet = 'id_rubrique';
393
+                    $id = $id_rubrique;
394
+                    $id_rubrique = 0;
395
+                } else {
396
+                    if ($id and $cle_objet == 'id_rubrique') {
397
+                        $id = quete_parent($id);
398
+                    } else {
399
+                        return '';
400
+                    }
401
+                }
402
+            }
403
+        }
404
+    }
405 405
 }
406 406
 
407 407
 /**
@@ -415,37 +415,37 @@  discard block
 block discarded – undo
415 415
  * 		"on" ou "off" suivant le logo normal ou survol
416 416
  **/
417 417
 function quete_logo_objet($id_objet, $objet, $mode) {
418
-	static $chercher_logo;
419
-	if (is_null($chercher_logo)) {
420
-		$chercher_logo = charger_fonction('chercher_logo', 'inc');
421
-	}
422
-	$cle_objet = id_table_objet($objet);
423
-
424
-	// On cherche pas la méthode classique
425
-	$infos_logo = $chercher_logo($id_objet, $cle_objet, $mode);
426
-	// Si la méthode classique a trouvé quelque chose, on utilise le nouveau format
427
-	if (!empty($infos_logo)) {
428
-		$infos_logo = array(
429
-			'chemin' => $infos_logo[0],
430
-			'timestamp' => $infos_logo[4],
431
-		);
432
-	}
433
-
434
-	// On passe cette recherche de logo dans un pipeline
435
-	$infos_logo = pipeline(
436
-		'quete_logo_objet',
437
-		array(
438
-			'args' => array(
439
-				'id_objet' => $id_objet,
440
-				'objet' => $objet,
441
-				'cle_objet' => $cle_objet,
442
-				'mode' => $mode,
443
-			),
444
-			'data' => $infos_logo,
445
-		)
446
-	);
447
-
448
-	return $infos_logo;
418
+    static $chercher_logo;
419
+    if (is_null($chercher_logo)) {
420
+        $chercher_logo = charger_fonction('chercher_logo', 'inc');
421
+    }
422
+    $cle_objet = id_table_objet($objet);
423
+
424
+    // On cherche pas la méthode classique
425
+    $infos_logo = $chercher_logo($id_objet, $cle_objet, $mode);
426
+    // Si la méthode classique a trouvé quelque chose, on utilise le nouveau format
427
+    if (!empty($infos_logo)) {
428
+        $infos_logo = array(
429
+            'chemin' => $infos_logo[0],
430
+            'timestamp' => $infos_logo[4],
431
+        );
432
+    }
433
+
434
+    // On passe cette recherche de logo dans un pipeline
435
+    $infos_logo = pipeline(
436
+        'quete_logo_objet',
437
+        array(
438
+            'args' => array(
439
+                'id_objet' => $id_objet,
440
+                'objet' => $objet,
441
+                'cle_objet' => $cle_objet,
442
+                'mode' => $mode,
443
+            ),
444
+            'data' => $infos_logo,
445
+        )
446
+    );
447
+
448
+    return $infos_logo;
449 449
 }
450 450
 
451 451
 /**
@@ -458,24 +458,24 @@  discard block
 block discarded – undo
458 458
  * @return bool|string
459 459
  */
460 460
 function quete_logo_file($row, $connect = null) {
461
-	include_spip('inc/documents');
462
-	$logo = vignette_logo_document($row, $connect);
463
-	if (!$logo) {
464
-		$logo = image_du_document($row, $connect);
465
-	}
466
-	if (!$logo) {
467
-		$f = charger_fonction('vignette', 'inc');
468
-		$logo = $f($row['extension'], false);
469
-	}
470
-	// si c'est une vignette type doc, la renvoyer direct
471
-	if (strcmp($logo, _DIR_PLUGINS) == 0
472
-		or strcmp($logo, _DIR_PLUGINS_DIST) == 0
473
-		or strcmp($logo, _DIR_RACINE . 'prive/') == 0
474
-	) {
475
-		return $logo;
476
-	}
477
-
478
-	return get_spip_doc($logo);
461
+    include_spip('inc/documents');
462
+    $logo = vignette_logo_document($row, $connect);
463
+    if (!$logo) {
464
+        $logo = image_du_document($row, $connect);
465
+    }
466
+    if (!$logo) {
467
+        $f = charger_fonction('vignette', 'inc');
468
+        $logo = $f($row['extension'], false);
469
+    }
470
+    // si c'est une vignette type doc, la renvoyer direct
471
+    if (strcmp($logo, _DIR_PLUGINS) == 0
472
+        or strcmp($logo, _DIR_PLUGINS_DIST) == 0
473
+        or strcmp($logo, _DIR_RACINE . 'prive/') == 0
474
+    ) {
475
+        return $logo;
476
+    }
477
+
478
+    return get_spip_doc($logo);
479 479
 }
480 480
 
481 481
 /**
@@ -503,20 +503,20 @@  discard block
 block discarded – undo
503 503
  */
504 504
 function quete_logo_document($row, $lien, $align, $mode_logo, $x, $y, $connect = null) {
505 505
 
506
-	include_spip('inc/documents');
507
-	$logo = '';
508
-	if (!in_array($mode_logo, array('icone', 'apercu'))) {
509
-		$logo = vignette_logo_document($row, $connect);
510
-	}
511
-	// si on veut explicitement la vignette, ne rien renvoyer si il n'y en a pas
512
-	if ($mode_logo == 'vignette' and !$logo) {
513
-		return '';
514
-	}
515
-	if ($mode_logo == 'icone') {
516
-		$row['fichier'] = '';
517
-	}
518
-
519
-	return vignette_automatique($logo, $row, $lien, $x, $y, $align, null, $connect);
506
+    include_spip('inc/documents');
507
+    $logo = '';
508
+    if (!in_array($mode_logo, array('icone', 'apercu'))) {
509
+        $logo = vignette_logo_document($row, $connect);
510
+    }
511
+    // si on veut explicitement la vignette, ne rien renvoyer si il n'y en a pas
512
+    if ($mode_logo == 'vignette' and !$logo) {
513
+        return '';
514
+    }
515
+    if ($mode_logo == 'icone') {
516
+        $row['fichier'] = '';
517
+    }
518
+
519
+    return vignette_automatique($logo, $row, $lien, $x, $y, $align, null, $connect);
520 520
 }
521 521
 
522 522
 /**
@@ -528,19 +528,19 @@  discard block
 block discarded – undo
528 528
  */
529 529
 function quete_html_logo($logo, $align, $lien) {
530 530
 
531
-	if (!is_array($logo)) {
532
-		return '';
533
-	}
534
-
535
-	$contexte = [];
536
-	foreach ($logo as $k=>$v) {
537
-		if (!is_numeric($k)) {
538
-			$contexte[$k] = $v;
539
-		}
540
-	}
541
-	$contexte['align'] = $align;
542
-	$contexte['lien'] = $lien;
543
-	return recuperer_fond('modeles/logo', $contexte);
531
+    if (!is_array($logo)) {
532
+        return '';
533
+    }
534
+
535
+    $contexte = [];
536
+    foreach ($logo as $k=>$v) {
537
+        if (!is_numeric($k)) {
538
+            $contexte[$k] = $v;
539
+        }
540
+    }
541
+    $contexte['align'] = $align;
542
+    $contexte['lien'] = $lien;
543
+    return recuperer_fond('modeles/logo', $contexte);
544 544
 }
545 545
 
546 546
 /**
@@ -554,14 +554,14 @@  discard block
 block discarded – undo
554 554
  * @return string|false
555 555
  */
556 556
 function document_spip_externe($fichier, $connect) {
557
-	if ($connect) {
558
-		$site = quete_meta('adresse_site', $connect);
559
-		if ($site) {
560
-			$dir = quete_meta('dir_img', $connect);
561
-			return "$site/$dir$fichier";
562
-		}
563
-	}
564
-	return false;
557
+    if ($connect) {
558
+        $site = quete_meta('adresse_site', $connect);
559
+        if ($site) {
560
+            $dir = quete_meta('dir_img', $connect);
561
+            return "$site/$dir$fichier";
562
+        }
563
+    }
564
+    return false;
565 565
 }
566 566
 
567 567
 /**
@@ -574,23 +574,23 @@  discard block
 block discarded – undo
574 574
  * @return string
575 575
  */
576 576
 function vignette_logo_document($row, $connect = '') {
577
-	if (!$row['id_vignette']) {
578
-		return '';
579
-	}
580
-	$fichier = quete_fichier($row['id_vignette'], $connect);
581
-	if ($url = document_spip_externe($fichier, $connect)) {
582
-		return $url;
583
-	}
584
-
585
-	$f = get_spip_doc($fichier);
586
-	if ($f and @file_exists($f)) {
587
-		return $f;
588
-	}
589
-	if ($row['mode'] !== 'vignette') {
590
-		return '';
591
-	}
592
-
593
-	return generer_url_entite($row['id_document'], 'document', '', '', $connect);
577
+    if (!$row['id_vignette']) {
578
+        return '';
579
+    }
580
+    $fichier = quete_fichier($row['id_vignette'], $connect);
581
+    if ($url = document_spip_externe($fichier, $connect)) {
582
+        return $url;
583
+    }
584
+
585
+    $f = get_spip_doc($fichier);
586
+    if ($f and @file_exists($f)) {
587
+        return $f;
588
+    }
589
+    if ($row['mode'] !== 'vignette') {
590
+        return '';
591
+    }
592
+
593
+    return generer_url_entite($row['id_document'], 'document', '', '', $connect);
594 594
 }
595 595
 
596 596
 /**
@@ -606,68 +606,68 @@  discard block
 block discarded – undo
606 606
  * @return bool|string
607 607
  */
608 608
 function calcul_exposer($id, $prim, $reference, $parent, $type, $connect = '') {
609
-	static $exposer = array();
610
-
611
-	// Que faut-il exposer ? Tous les elements de $reference
612
-	// ainsi que leur hierarchie ; on ne fait donc ce calcul
613
-	// qu'une fois (par squelette) et on conserve le resultat
614
-	// en static.
615
-	if (!isset($exposer[$m = md5(serialize($reference))][$prim])) {
616
-		$principal = isset($reference[$type]) ? $reference[$type] :
617
-			// cas de la pagination indecte @xx qui positionne la page avec l'id xx
618
-			// et donne la reference dynamique @type=xx dans le contexte
619
-			(isset($reference["@$type"]) ? $reference["@$type"] : '');
620
-		// le parent fournit en argument est le parent de $id, pas celui de $principal
621
-		// il n'est donc pas utile
622
-		$parent = 0;
623
-		if (!$principal) { // regarder si un enfant est dans le contexte, auquel cas il expose peut etre le parent courant
624
-			$enfants = array('id_rubrique' => array('id_article'), 'id_groupe' => array('id_mot'));
625
-			if (isset($enfants[$type])) {
626
-				foreach ($enfants[$type] as $t) {
627
-					if (isset($reference[$t])
628
-						// cas de la reference donnee dynamiquement par la pagination
629
-						or isset($reference["@$t"])
630
-					) {
631
-						$type = $t;
632
-						$principal = isset($reference[$type]) ? $reference[$type] : $reference["@$type"];
633
-						continue;
634
-					}
635
-				}
636
-			}
637
-		}
638
-		$exposer[$m][$type] = array();
639
-		if ($principal) {
640
-			$principaux = is_array($principal) ? $principal : array($principal);
641
-			foreach ($principaux as $principal) {
642
-				$exposer[$m][$type][$principal] = true;
643
-				if ($type == 'id_mot') {
644
-					if (!$parent) {
645
-						$parent = sql_getfetsel('id_groupe', 'spip_mots', 'id_mot=' . intval($principal), '', '', '', '', $connect);
646
-					}
647
-					if ($parent) {
648
-						$exposer[$m]['id_groupe'][$parent] = true;
649
-					}
650
-				} else {
651
-					if ($type != 'id_groupe') {
652
-						if (!$parent) {
653
-							if ($type == 'id_rubrique') {
654
-								$parent = $principal;
655
-							}
656
-							if ($type == 'id_article') {
657
-								$parent = quete_rubrique($principal, $connect);
658
-							}
659
-						}
660
-						do {
661
-							$exposer[$m]['id_rubrique'][$parent] = true;
662
-						} while ($parent = quete_parent($parent, $connect));
663
-					}
664
-				}
665
-			}
666
-		}
667
-	}
668
-
669
-	// And the winner is...
670
-	return isset($exposer[$m][$prim]) ? isset($exposer[$m][$prim][$id]) : '';
609
+    static $exposer = array();
610
+
611
+    // Que faut-il exposer ? Tous les elements de $reference
612
+    // ainsi que leur hierarchie ; on ne fait donc ce calcul
613
+    // qu'une fois (par squelette) et on conserve le resultat
614
+    // en static.
615
+    if (!isset($exposer[$m = md5(serialize($reference))][$prim])) {
616
+        $principal = isset($reference[$type]) ? $reference[$type] :
617
+            // cas de la pagination indecte @xx qui positionne la page avec l'id xx
618
+            // et donne la reference dynamique @type=xx dans le contexte
619
+            (isset($reference["@$type"]) ? $reference["@$type"] : '');
620
+        // le parent fournit en argument est le parent de $id, pas celui de $principal
621
+        // il n'est donc pas utile
622
+        $parent = 0;
623
+        if (!$principal) { // regarder si un enfant est dans le contexte, auquel cas il expose peut etre le parent courant
624
+            $enfants = array('id_rubrique' => array('id_article'), 'id_groupe' => array('id_mot'));
625
+            if (isset($enfants[$type])) {
626
+                foreach ($enfants[$type] as $t) {
627
+                    if (isset($reference[$t])
628
+                        // cas de la reference donnee dynamiquement par la pagination
629
+                        or isset($reference["@$t"])
630
+                    ) {
631
+                        $type = $t;
632
+                        $principal = isset($reference[$type]) ? $reference[$type] : $reference["@$type"];
633
+                        continue;
634
+                    }
635
+                }
636
+            }
637
+        }
638
+        $exposer[$m][$type] = array();
639
+        if ($principal) {
640
+            $principaux = is_array($principal) ? $principal : array($principal);
641
+            foreach ($principaux as $principal) {
642
+                $exposer[$m][$type][$principal] = true;
643
+                if ($type == 'id_mot') {
644
+                    if (!$parent) {
645
+                        $parent = sql_getfetsel('id_groupe', 'spip_mots', 'id_mot=' . intval($principal), '', '', '', '', $connect);
646
+                    }
647
+                    if ($parent) {
648
+                        $exposer[$m]['id_groupe'][$parent] = true;
649
+                    }
650
+                } else {
651
+                    if ($type != 'id_groupe') {
652
+                        if (!$parent) {
653
+                            if ($type == 'id_rubrique') {
654
+                                $parent = $principal;
655
+                            }
656
+                            if ($type == 'id_article') {
657
+                                $parent = quete_rubrique($principal, $connect);
658
+                            }
659
+                        }
660
+                        do {
661
+                            $exposer[$m]['id_rubrique'][$parent] = true;
662
+                        } while ($parent = quete_parent($parent, $connect));
663
+                    }
664
+                }
665
+            }
666
+        }
667
+    }
668
+
669
+    // And the winner is...
670
+    return isset($exposer[$m][$prim]) ? isset($exposer[$m][$prim][$id]) : '';
671 671
 }
672 672
 
673 673
 /**
@@ -682,21 +682,21 @@  discard block
 block discarded – undo
682 682
  * @return int
683 683
  */
684 684
 function quete_debut_pagination($primary, $valeur, $pas, $iter) {
685
-	// on ne devrait pas arriver ici si la cle primaire est inexistante
686
-	// ou composee, mais verifions
687
-	if (!$primary or preg_match('/[,\s]/', $primary)) {
688
-		return 0;
689
-	}
690
-
691
-	$pos = 0;
692
-	while ($row = $iter->fetch() and $row[$primary] != $valeur) {
693
-		$pos++;
694
-	}
695
-	// si on a pas trouve
696
-	if ($row[$primary] != $valeur) {
697
-		return 0;
698
-	}
699
-
700
-	// sinon, calculer le bon numero de page
701
-	return floor($pos / $pas) * $pas;
685
+    // on ne devrait pas arriver ici si la cle primaire est inexistante
686
+    // ou composee, mais verifions
687
+    if (!$primary or preg_match('/[,\s]/', $primary)) {
688
+        return 0;
689
+    }
690
+
691
+    $pos = 0;
692
+    while ($row = $iter->fetch() and $row[$primary] != $valeur) {
693
+        $pos++;
694
+    }
695
+    // si on a pas trouve
696
+    if ($row[$primary] != $valeur) {
697
+        return 0;
698
+    }
699
+
700
+    // sinon, calculer le bon numero de page
701
+    return floor($pos / $pas) * $pas;
702 702
 }
Please login to merge, or discard this patch.