Completed
Push — master ( 7791a8...bbaeee )
by cam
05:04
created
ecrire/public/quete.php 3 patches
Doc Comments   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -28,9 +28,9 @@  discard block
 block discarded – undo
28 28
 /**
29 29
  * Retourne l'URL de redirection d'un article virtuel, seulement si il est publié
30 30
  *
31
- * @param $id_article
32
- * @param $connect
33
- * @return array|bool|null
31
+ * @param integer $id_article
32
+ * @param string $connect
33
+ * @return string
34 34
  */
35 35
 function quete_virtuel($id_article, $connect) {
36 36
 	return sql_getfetsel(
@@ -122,7 +122,7 @@  discard block
 block discarded – undo
122 122
  * @uses quete_parent_lang()
123 123
  *
124 124
  * @param int $id_article
125
- * @param $serveur
125
+ * @param string $serveur
126 126
  * @return int
127 127
  */
128 128
 function quete_rubrique($id_article, $serveur) {
@@ -293,7 +293,7 @@  discard block
 block discarded – undo
293 293
  *
294 294
  * @param int $id_document
295 295
  * @param string $serveur
296
- * @return array|bool|null
296
+ * @return string
297 297
  */
298 298
 function quete_fichier($id_document, $serveur = '') {
299 299
 	return sql_getfetsel('fichier', 'spip_documents', ('id_document=' . intval($id_document)), '', array(), '', '', $serveur);
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
-		array('id_article=' . intval($id_article), "statut='publie'"),
39
+		array('id_article='.intval($id_article), "statut='publie'"),
40 40
 		'',
41 41
 		'',
42 42
 		'',
@@ -78,7 +78,7 @@  discard block
 block discarded – undo
78 78
 			$cache_quete[$connect][$table][$id] = sql_fetsel(
79 79
 				$cache_quete[$connect][$table]['_select'],
80 80
 				$table,
81
-				$cache_quete[$connect][$table]['_id'] . '=' . intval($id),
81
+				$cache_quete[$connect][$table]['_id'].'='.intval($id),
82 82
 				'',
83 83
 				'',
84 84
 				'',
@@ -171,7 +171,7 @@  discard block
 block discarded – undo
171 171
 	return
172 172
 		(isset($GLOBALS['meta']['date_prochain_postdate'])
173 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)
174
+			? "$champ_date<".sql_quote(date('Y-m-d H:i:s', $GLOBALS['meta']['date_prochain_postdate']), $serveur)
175 175
 			: '1=1';
176 176
 }
177 177
 
@@ -229,7 +229,7 @@  discard block
 block discarded – undo
229 229
 				and $id_table = reset($objet)
230 230
 				and $objet = objet_type($id_table)
231 231
 			) {
232
-				$w = "$mstatut<>" . sql_quote($v);
232
+				$w = "$mstatut<>".sql_quote($v);
233 233
 
234 234
 				// retrouver l’id_auteur qui a filé un lien de prévisu éventuellement,
235 235
 				// sinon l’auteur en session
@@ -243,22 +243,22 @@  discard block
 block discarded – undo
243 243
 				}
244 244
 
245 245
 				// dans ce cas (admin en general), pas de filtrage sur ce statut
246
-				if (!autoriser('previsualiser' . $v, $objet, '', $id_auteur)) {
246
+				if (!autoriser('previsualiser'.$v, $objet, '', $id_auteur)) {
247 247
 					// si pas d'auteur identifie pas de sous-requete car pas d'article qui matche
248 248
 					if (!$id_auteur) {
249 249
 						$where[] = $w;
250 250
 					} else {
251 251
 						$primary = id_table_objet($objet);
252
-						$where[] = "($w OR $id_table.$primary IN (" . sql_get_select(
252
+						$where[] = "($w OR $id_table.$primary IN (".sql_get_select(
253 253
 								'ssss.id_objet',
254 254
 								'spip_auteurs_liens AS ssss',
255
-								'ssss.objet=' . sql_quote($objet) . ' AND ssss.id_auteur=' . intval($id_auteur),
255
+								'ssss.objet='.sql_quote($objet).' AND ssss.id_auteur='.intval($id_auteur),
256 256
 								'',
257 257
 								'',
258 258
 								'',
259 259
 								'',
260 260
 								$serveur
261
-							) . '))';
261
+							).'))';
262 262
 					}
263 263
 				}
264 264
 			} // ignorer ce statut si on ne sait pas comment le filtrer
@@ -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
 /**
@@ -372,9 +372,9 @@  discard block
 block discarded – undo
372 372
 				// qui permet de distinguer le changement de logo
373 373
 				// et placer un expire sur le dossier IMG/
374 374
 				$res = array(
375
-					$on['chemin'] . ($on['timestamp'] ? "?{$on['timestamp']}" : ''),
376
-					($off ? $off['chemin'] . ($off['timestamp'] ? "?{$off['timestamp']}" : '') : ''),
377
-					(!$taille ? '' : (' ' . $taille[3]))
375
+					$on['chemin'].($on['timestamp'] ? "?{$on['timestamp']}" : ''),
376
+					($off ? $off['chemin'].($off['timestamp'] ? "?{$off['timestamp']}" : '') : ''),
377
+					(!$taille ? '' : (' '.$taille[3]))
378 378
 				);
379 379
 				$res['src'] = $res[0];
380 380
 				$res['logo_on'] = $res[0];
@@ -470,7 +470,7 @@  discard block
 block discarded – undo
470 470
 	// si c'est une vignette type doc, la renvoyer direct
471 471
 	if (strcmp($logo, _DIR_PLUGINS) == 0
472 472
 		or strcmp($logo, _DIR_PLUGINS_DIST) == 0
473
-		or strcmp($logo, _DIR_RACINE . 'prive/') == 0
473
+		or strcmp($logo, _DIR_RACINE.'prive/') == 0
474 474
 	) {
475 475
 		return $logo;
476 476
 	}
@@ -589,8 +589,7 @@  discard block
 block discarded – undo
589 589
 	// qu'une fois (par squelette) et on conserve le resultat
590 590
 	// en static.
591 591
 	if (!isset($exposer[$m = md5(serialize($reference))][$prim])) {
592
-		$principal = isset($reference[$type]) ? $reference[$type] :
593
-			// cas de la pagination indecte @xx qui positionne la page avec l'id xx
592
+		$principal = isset($reference[$type]) ? $reference[$type] : // cas de la pagination indecte @xx qui positionne la page avec l'id xx
594 593
 			// et donne la reference dynamique @type=xx dans le contexte
595 594
 			(isset($reference["@$type"]) ? $reference["@$type"] : '');
596 595
 		// le parent fournit en argument est le parent de $id, pas celui de $principal
@@ -618,7 +617,7 @@  discard block
 block discarded – undo
618 617
 				$exposer[$m][$type][$principal] = true;
619 618
 				if ($type == 'id_mot') {
620 619
 					if (!$parent) {
621
-						$parent = sql_getfetsel('id_groupe', 'spip_mots', 'id_mot=' . intval($principal), '', '', '', '', $connect);
620
+						$parent = sql_getfetsel('id_groupe', 'spip_mots', 'id_mot='.intval($principal), '', '', '', '', $connect);
622 621
 					}
623 622
 					if ($parent) {
624 623
 						$exposer[$m]['id_groupe'][$parent] = true;
Please login to merge, or discard this 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,11 +105,11 @@  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);
112
-	return $id_parent ? $id_parent['id_parent'] : 0;
108
+    if (!$id_rubrique = intval($id_rubrique)) {
109
+        return 0;
110
+    }
111
+    $id_parent = quete_parent_lang('spip_rubriques', $id_rubrique, $connect);
112
+    return $id_parent ? $id_parent['id_parent'] : 0;
113 113
 }
114 114
 
115 115
 /**
@@ -125,9 +125,9 @@  discard block
 block discarded – undo
125 125
  * @return int
126 126
  */
127 127
 function quete_rubrique($id_article, $serveur) {
128
-	$id_parent = quete_parent_lang('spip_articles', $id_article, $serveur);
128
+    $id_parent = quete_parent_lang('spip_articles', $id_article, $serveur);
129 129
 
130
-	return $id_parent['id_rubrique'];
130
+    return $id_parent['id_rubrique'];
131 131
 }
132 132
 
133 133
 
@@ -141,13 +141,13 @@  discard block
 block discarded – undo
141 141
  * @return int
142 142
  */
143 143
 function quete_profondeur($id, $connect = '') {
144
-	$n = 0;
145
-	while ($id) {
146
-		$n++;
147
-		$id = quete_parent($id, $connect);
148
-	}
144
+    $n = 0;
145
+    while ($id) {
146
+        $n++;
147
+        $id = quete_parent($id, $connect);
148
+    }
149 149
 
150
-	return $n;
150
+    return $n;
151 151
 }
152 152
 
153 153
 
@@ -163,15 +163,15 @@  discard block
 block discarded – undo
163 163
  *     Morceau de la requête SQL testant la date
164 164
  */
165 165
 function quete_condition_postdates($champ_date, $serveur = '', $ignore_previsu = false) {
166
-	if (defined('_VAR_PREVIEW') and _VAR_PREVIEW and !$ignore_previsu) {
167
-		return '1=1';
168
-	}
169
-
170
-	return
171
-		(isset($GLOBALS['meta']['date_prochain_postdate'])
172
-			and $GLOBALS['meta']['date_prochain_postdate'] > time())
173
-			? "$champ_date<" . sql_quote(date('Y-m-d H:i:s', $GLOBALS['meta']['date_prochain_postdate']), $serveur)
174
-			: '1=1';
166
+    if (defined('_VAR_PREVIEW') and _VAR_PREVIEW and !$ignore_previsu) {
167
+        return '1=1';
168
+    }
169
+
170
+    return
171
+        (isset($GLOBALS['meta']['date_prochain_postdate'])
172
+            and $GLOBALS['meta']['date_prochain_postdate'] > time())
173
+            ? "$champ_date<" . sql_quote(date('Y-m-d H:i:s', $GLOBALS['meta']['date_prochain_postdate']), $serveur)
174
+            : '1=1';
175 175
 }
176 176
 
177 177
 
@@ -191,100 +191,100 @@  discard block
 block discarded – undo
191 191
  * @return array|string
192 192
  */
193 193
 function quete_condition_statut($mstatut, $previsu, $publie, $serveur = '', $ignore_previsu = false) {
194
-	static $cond = array();
195
-	$key = func_get_args();
196
-	$key = implode('-', $key);
197
-	if (isset($cond[$key])) {
198
-		return $cond[$key];
199
-	}
200
-
201
-	$liste_statuts = $publie;
202
-	if (defined('_VAR_PREVIEW') and _VAR_PREVIEW and !$ignore_previsu) {
203
-		$liste_statuts = $previsu;
204
-	}
205
-	$not = false;
206
-	if (strncmp($liste_statuts, '!', 1) == 0) {
207
-		$not = true;
208
-		$liste_statuts = substr($liste_statuts, 1);
209
-	}
210
-	// '' => ne rien afficher, '!'=> ne rien filtrer
211
-	if (!strlen($liste_statuts)) {
212
-		return $cond[$key] = ($not ? '1=1' : '0=1');
213
-	}
214
-
215
-	$liste_statuts = explode(',', $liste_statuts);
216
-	$where = array();
217
-	foreach ($liste_statuts as $k => $v) {
218
-		// filtrage /auteur pour limiter les objets d'un statut (prepa en general)
219
-		// a ceux de l'auteur identifie
220
-		if (strpos($v, '/') !== false) {
221
-			$v = explode('/', $v);
222
-			$filtre = end($v);
223
-			$v = reset($v);
224
-			$v = preg_replace(',\W,', '', $v);
225
-			if ($filtre == 'auteur'
226
-				and (strpos($mstatut, '.') !== false)
227
-				and $objet = explode('.', $mstatut)
228
-				and $id_table = reset($objet)
229
-				and $objet = objet_type($id_table)
230
-			) {
231
-				$w = "$mstatut<>" . sql_quote($v);
232
-
233
-				// retrouver l’id_auteur qui a filé un lien de prévisu éventuellement,
234
-				// sinon l’auteur en session
235
-				include_spip('inc/securiser_action');
236
-				if ($desc = decrire_token_previsu()) {
237
-					$id_auteur = $desc['id_auteur'];
238
-				} elseif (isset($GLOBALS['visiteur_session']['id_auteur'])) {
239
-					$id_auteur = intval($GLOBALS['visiteur_session']['id_auteur']);
240
-				} else {
241
-					$id_auteur = null;
242
-				}
243
-
244
-				// dans ce cas (admin en general), pas de filtrage sur ce statut
245
-				if (!autoriser('previsualiser' . $v, $objet, '', $id_auteur)) {
246
-					// si pas d'auteur identifie pas de sous-requete car pas d'article qui matche
247
-					if (!$id_auteur) {
248
-						$where[] = $w;
249
-					} else {
250
-						$primary = id_table_objet($objet);
251
-						$where[] = "($w OR $id_table.$primary IN (" . sql_get_select(
252
-								'ssss.id_objet',
253
-								'spip_auteurs_liens AS ssss',
254
-								'ssss.objet=' . sql_quote($objet) . ' AND ssss.id_auteur=' . intval($id_auteur),
255
-								'',
256
-								'',
257
-								'',
258
-								'',
259
-								$serveur
260
-							) . '))';
261
-					}
262
-				}
263
-			} // ignorer ce statut si on ne sait pas comment le filtrer
264
-			else {
265
-				$v = '';
266
-			}
267
-		}
268
-		// securite
269
-		$liste_statuts[$k] = preg_replace(',\W,', '', $v);
270
-	}
271
-	$liste_statuts = array_filter($liste_statuts);
272
-	if (count($liste_statuts) == 1) {
273
-		$where[] = array('=', $mstatut, sql_quote(reset($liste_statuts), $serveur));
274
-	} else {
275
-		$where[] = sql_in($mstatut, $liste_statuts, $not, $serveur);
276
-	}
277
-
278
-	while (count($where) > 1) {
279
-		$and = array('AND', array_pop($where), array_pop($where));
280
-		$where[] = $and;
281
-	}
282
-	$cond[$key] = reset($where);
283
-	if ($not) {
284
-		$cond[$key] = array('NOT', $cond[$key]);
285
-	}
286
-
287
-	return $cond[$key];
194
+    static $cond = array();
195
+    $key = func_get_args();
196
+    $key = implode('-', $key);
197
+    if (isset($cond[$key])) {
198
+        return $cond[$key];
199
+    }
200
+
201
+    $liste_statuts = $publie;
202
+    if (defined('_VAR_PREVIEW') and _VAR_PREVIEW and !$ignore_previsu) {
203
+        $liste_statuts = $previsu;
204
+    }
205
+    $not = false;
206
+    if (strncmp($liste_statuts, '!', 1) == 0) {
207
+        $not = true;
208
+        $liste_statuts = substr($liste_statuts, 1);
209
+    }
210
+    // '' => ne rien afficher, '!'=> ne rien filtrer
211
+    if (!strlen($liste_statuts)) {
212
+        return $cond[$key] = ($not ? '1=1' : '0=1');
213
+    }
214
+
215
+    $liste_statuts = explode(',', $liste_statuts);
216
+    $where = array();
217
+    foreach ($liste_statuts as $k => $v) {
218
+        // filtrage /auteur pour limiter les objets d'un statut (prepa en general)
219
+        // a ceux de l'auteur identifie
220
+        if (strpos($v, '/') !== false) {
221
+            $v = explode('/', $v);
222
+            $filtre = end($v);
223
+            $v = reset($v);
224
+            $v = preg_replace(',\W,', '', $v);
225
+            if ($filtre == 'auteur'
226
+                and (strpos($mstatut, '.') !== false)
227
+                and $objet = explode('.', $mstatut)
228
+                and $id_table = reset($objet)
229
+                and $objet = objet_type($id_table)
230
+            ) {
231
+                $w = "$mstatut<>" . sql_quote($v);
232
+
233
+                // retrouver l’id_auteur qui a filé un lien de prévisu éventuellement,
234
+                // sinon l’auteur en session
235
+                include_spip('inc/securiser_action');
236
+                if ($desc = decrire_token_previsu()) {
237
+                    $id_auteur = $desc['id_auteur'];
238
+                } elseif (isset($GLOBALS['visiteur_session']['id_auteur'])) {
239
+                    $id_auteur = intval($GLOBALS['visiteur_session']['id_auteur']);
240
+                } else {
241
+                    $id_auteur = null;
242
+                }
243
+
244
+                // dans ce cas (admin en general), pas de filtrage sur ce statut
245
+                if (!autoriser('previsualiser' . $v, $objet, '', $id_auteur)) {
246
+                    // si pas d'auteur identifie pas de sous-requete car pas d'article qui matche
247
+                    if (!$id_auteur) {
248
+                        $where[] = $w;
249
+                    } else {
250
+                        $primary = id_table_objet($objet);
251
+                        $where[] = "($w OR $id_table.$primary IN (" . sql_get_select(
252
+                                'ssss.id_objet',
253
+                                'spip_auteurs_liens AS ssss',
254
+                                'ssss.objet=' . sql_quote($objet) . ' AND ssss.id_auteur=' . intval($id_auteur),
255
+                                '',
256
+                                '',
257
+                                '',
258
+                                '',
259
+                                $serveur
260
+                            ) . '))';
261
+                    }
262
+                }
263
+            } // ignorer ce statut si on ne sait pas comment le filtrer
264
+            else {
265
+                $v = '';
266
+            }
267
+        }
268
+        // securite
269
+        $liste_statuts[$k] = preg_replace(',\W,', '', $v);
270
+    }
271
+    $liste_statuts = array_filter($liste_statuts);
272
+    if (count($liste_statuts) == 1) {
273
+        $where[] = array('=', $mstatut, sql_quote(reset($liste_statuts), $serveur));
274
+    } else {
275
+        $where[] = sql_in($mstatut, $liste_statuts, $not, $serveur);
276
+    }
277
+
278
+    while (count($where) > 1) {
279
+        $and = array('AND', array_pop($where), array_pop($where));
280
+        $where[] = $and;
281
+    }
282
+    $cond[$key] = reset($where);
283
+    if ($not) {
284
+        $cond[$key] = array('NOT', $cond[$key]);
285
+    }
286
+
287
+    return $cond[$key];
288 288
 }
289 289
 
290 290
 /**
@@ -295,7 +295,7 @@  discard block
 block discarded – undo
295 295
  * @return array|bool|null
296 296
  */
297 297
 function quete_fichier($id_document, $serveur = '') {
298
-	return sql_getfetsel('fichier', 'spip_documents', ('id_document=' . intval($id_document)), '', array(), '', '', $serveur);
298
+    return sql_getfetsel('fichier', 'spip_documents', ('id_document=' . intval($id_document)), '', array(), '', '', $serveur);
299 299
 }
300 300
 
301 301
 /**
@@ -306,7 +306,7 @@  discard block
 block discarded – undo
306 306
  * @return array|bool
307 307
  */
308 308
 function quete_document($id_document, $serveur = '') {
309
-	return sql_fetsel('*', 'spip_documents', ('id_document=' . intval($id_document)), '', array(), '', '', $serveur);
309
+    return sql_fetsel('*', 'spip_documents', ('id_document=' . intval($id_document)), '', array(), '', '', $serveur);
310 310
 }
311 311
 
312 312
 /**
@@ -317,7 +317,7 @@  discard block
 block discarded – undo
317 317
  * @return array|bool|null
318 318
  */
319 319
 function quete_meta($nom, $serveur) {
320
-	return sql_getfetsel('valeur', 'spip_meta', 'nom=' . sql_quote($nom), '', '', '', '', $serveur);
320
+    return sql_getfetsel('valeur', 'spip_meta', 'nom=' . sql_quote($nom), '', '', '', '', $serveur);
321 321
 }
322 322
 
323 323
 /**
@@ -343,64 +343,64 @@  discard block
 block discarded – undo
343 343
  *     Retourne soit un tableau, soit le chemin du fichier.
344 344
  */
345 345
 function quete_logo($cle_objet, $onoff, $id, $id_rubrique, $flag) {
346
-	include_spip('base/objets');
347
-	$nom = strtolower($onoff);
348
-
349
-	while (1) {
350
-		$objet = objet_type($cle_objet);
351
-
352
-		$on = quete_logo_objet($id, $objet, $nom);
353
-
354
-		if ($on) {
355
-			if ($flag) {
356
-				return basename($on['chemin']);
357
-			} else {
358
-				$taille = @spip_getimagesize($on['chemin']);
359
-
360
-				// Si on a déjà demandé un survol directement ($onoff = off)
361
-				// ou qu'on a demandé uniquement le normal ($onoff = on)
362
-				// alors on ne cherche pas du tout le survol ici
363
-				if ($onoff != 'ON') {
364
-					$off = '';
365
-				} else {
366
-					// Sinon, c'est qu'on demande normal ET survol à la fois, donc on cherche maintenant le survol
367
-					$off = quete_logo_objet($id, $objet, 'off');
368
-				}
369
-
370
-				// on retourne une url du type IMG/artonXX?timestamp
371
-				// qui permet de distinguer le changement de logo
372
-				// et placer un expire sur le dossier IMG/
373
-				$res = array(
374
-					$on['chemin'] . ($on['timestamp'] ? "?{$on['timestamp']}" : ''),
375
-					($off ? $off['chemin'] . ($off['timestamp'] ? "?{$off['timestamp']}" : '') : ''),
376
-					(!$taille ? '' : (' ' . $taille[3]))
377
-				);
378
-				$res['src'] = $res[0];
379
-				$res['logo_on'] = $res[0];
380
-				$res['logo_off'] = $res[1];
381
-				$res['width'] = ($taille ? $taille[0] : '');
382
-				$res['height'] = ($taille ? $taille[1] : '');
383
-
384
-				return $res;
385
-			}
386
-		} else {
387
-			if (defined('_LOGO_RUBRIQUE_DESACTIVER_HERITAGE')) {
388
-				return '';
389
-			} else {
390
-				if ($id_rubrique) {
391
-					$cle_objet = 'id_rubrique';
392
-					$id = $id_rubrique;
393
-					$id_rubrique = 0;
394
-				} else {
395
-					if ($id and $cle_objet == 'id_rubrique') {
396
-						$id = quete_parent($id);
397
-					} else {
398
-						return '';
399
-					}
400
-				}
401
-			}
402
-		}
403
-	}
346
+    include_spip('base/objets');
347
+    $nom = strtolower($onoff);
348
+
349
+    while (1) {
350
+        $objet = objet_type($cle_objet);
351
+
352
+        $on = quete_logo_objet($id, $objet, $nom);
353
+
354
+        if ($on) {
355
+            if ($flag) {
356
+                return basename($on['chemin']);
357
+            } else {
358
+                $taille = @spip_getimagesize($on['chemin']);
359
+
360
+                // Si on a déjà demandé un survol directement ($onoff = off)
361
+                // ou qu'on a demandé uniquement le normal ($onoff = on)
362
+                // alors on ne cherche pas du tout le survol ici
363
+                if ($onoff != 'ON') {
364
+                    $off = '';
365
+                } else {
366
+                    // Sinon, c'est qu'on demande normal ET survol à la fois, donc on cherche maintenant le survol
367
+                    $off = quete_logo_objet($id, $objet, 'off');
368
+                }
369
+
370
+                // on retourne une url du type IMG/artonXX?timestamp
371
+                // qui permet de distinguer le changement de logo
372
+                // et placer un expire sur le dossier IMG/
373
+                $res = array(
374
+                    $on['chemin'] . ($on['timestamp'] ? "?{$on['timestamp']}" : ''),
375
+                    ($off ? $off['chemin'] . ($off['timestamp'] ? "?{$off['timestamp']}" : '') : ''),
376
+                    (!$taille ? '' : (' ' . $taille[3]))
377
+                );
378
+                $res['src'] = $res[0];
379
+                $res['logo_on'] = $res[0];
380
+                $res['logo_off'] = $res[1];
381
+                $res['width'] = ($taille ? $taille[0] : '');
382
+                $res['height'] = ($taille ? $taille[1] : '');
383
+
384
+                return $res;
385
+            }
386
+        } else {
387
+            if (defined('_LOGO_RUBRIQUE_DESACTIVER_HERITAGE')) {
388
+                return '';
389
+            } else {
390
+                if ($id_rubrique) {
391
+                    $cle_objet = 'id_rubrique';
392
+                    $id = $id_rubrique;
393
+                    $id_rubrique = 0;
394
+                } else {
395
+                    if ($id and $cle_objet == 'id_rubrique') {
396
+                        $id = quete_parent($id);
397
+                    } else {
398
+                        return '';
399
+                    }
400
+                }
401
+            }
402
+        }
403
+    }
404 404
 }
405 405
 
406 406
 /**
@@ -414,37 +414,37 @@  discard block
 block discarded – undo
414 414
  * 		"on" ou "off" suivant le logo normal ou survol
415 415
  **/
416 416
 function quete_logo_objet($id_objet, $objet, $mode) {
417
-	static $chercher_logo;
418
-	if (is_null($chercher_logo)) {
419
-		$chercher_logo = charger_fonction('chercher_logo', 'inc');
420
-	}
421
-	$cle_objet = id_table_objet($objet);
422
-
423
-	// On cherche pas la méthode classique
424
-	$infos_logo = $chercher_logo($id_objet, $cle_objet, $mode);
425
-	// Si la méthode classique a trouvé quelque chose, on utilise le nouveau format
426
-	if (!empty($infos_logo)) {
427
-		$infos_logo = array(
428
-			'chemin' => $infos_logo[0],
429
-			'timestamp' => $infos_logo[4],
430
-		);
431
-	}
432
-
433
-	// On passe cette recherche de logo dans un pipeline
434
-	$infos_logo = pipeline(
435
-		'quete_logo_objet',
436
-		array(
437
-			'args' => array(
438
-				'id_objet' => $id_objet,
439
-				'objet' => $objet,
440
-				'cle_objet' => $cle_objet,
441
-				'mode' => $mode,
442
-			),
443
-			'data' => $infos_logo,
444
-		)
445
-	);
446
-
447
-	return $infos_logo;
417
+    static $chercher_logo;
418
+    if (is_null($chercher_logo)) {
419
+        $chercher_logo = charger_fonction('chercher_logo', 'inc');
420
+    }
421
+    $cle_objet = id_table_objet($objet);
422
+
423
+    // On cherche pas la méthode classique
424
+    $infos_logo = $chercher_logo($id_objet, $cle_objet, $mode);
425
+    // Si la méthode classique a trouvé quelque chose, on utilise le nouveau format
426
+    if (!empty($infos_logo)) {
427
+        $infos_logo = array(
428
+            'chemin' => $infos_logo[0],
429
+            'timestamp' => $infos_logo[4],
430
+        );
431
+    }
432
+
433
+    // On passe cette recherche de logo dans un pipeline
434
+    $infos_logo = pipeline(
435
+        'quete_logo_objet',
436
+        array(
437
+            'args' => array(
438
+                'id_objet' => $id_objet,
439
+                'objet' => $objet,
440
+                'cle_objet' => $cle_objet,
441
+                'mode' => $mode,
442
+            ),
443
+            'data' => $infos_logo,
444
+        )
445
+    );
446
+
447
+    return $infos_logo;
448 448
 }
449 449
 
450 450
 /**
@@ -457,24 +457,24 @@  discard block
 block discarded – undo
457 457
  * @return bool|string
458 458
  */
459 459
 function quete_logo_file($row, $connect = null) {
460
-	include_spip('inc/documents');
461
-	$logo = vignette_logo_document($row, $connect);
462
-	if (!$logo) {
463
-		$logo = image_du_document($row, $connect);
464
-	}
465
-	if (!$logo) {
466
-		$f = charger_fonction('vignette', 'inc');
467
-		$logo = $f($row['extension'], false);
468
-	}
469
-	// si c'est une vignette type doc, la renvoyer direct
470
-	if (strcmp($logo, _DIR_PLUGINS) == 0
471
-		or strcmp($logo, _DIR_PLUGINS_DIST) == 0
472
-		or strcmp($logo, _DIR_RACINE . 'prive/') == 0
473
-	) {
474
-		return $logo;
475
-	}
476
-
477
-	return get_spip_doc($logo);
460
+    include_spip('inc/documents');
461
+    $logo = vignette_logo_document($row, $connect);
462
+    if (!$logo) {
463
+        $logo = image_du_document($row, $connect);
464
+    }
465
+    if (!$logo) {
466
+        $f = charger_fonction('vignette', 'inc');
467
+        $logo = $f($row['extension'], false);
468
+    }
469
+    // si c'est une vignette type doc, la renvoyer direct
470
+    if (strcmp($logo, _DIR_PLUGINS) == 0
471
+        or strcmp($logo, _DIR_PLUGINS_DIST) == 0
472
+        or strcmp($logo, _DIR_RACINE . 'prive/') == 0
473
+    ) {
474
+        return $logo;
475
+    }
476
+
477
+    return get_spip_doc($logo);
478 478
 }
479 479
 
480 480
 /**
@@ -502,20 +502,20 @@  discard block
 block discarded – undo
502 502
  */
503 503
 function quete_logo_document($row, $lien, $align, $mode_logo, $x, $y, $connect = null) {
504 504
 
505
-	include_spip('inc/documents');
506
-	$logo = '';
507
-	if (!in_array($mode_logo, array('icone', 'apercu'))) {
508
-		$logo = vignette_logo_document($row, $connect);
509
-	}
510
-	// si on veut explicitement la vignette, ne rien renvoyer si il n'y en a pas
511
-	if ($mode_logo == 'vignette' and !$logo) {
512
-		return '';
513
-	}
514
-	if ($mode_logo == 'icone') {
515
-		$row['fichier'] = '';
516
-	}
517
-
518
-	return vignette_automatique($logo, $row, $lien, $x, $y, $align, null, $connect);
505
+    include_spip('inc/documents');
506
+    $logo = '';
507
+    if (!in_array($mode_logo, array('icone', 'apercu'))) {
508
+        $logo = vignette_logo_document($row, $connect);
509
+    }
510
+    // si on veut explicitement la vignette, ne rien renvoyer si il n'y en a pas
511
+    if ($mode_logo == 'vignette' and !$logo) {
512
+        return '';
513
+    }
514
+    if ($mode_logo == 'icone') {
515
+        $row['fichier'] = '';
516
+    }
517
+
518
+    return vignette_automatique($logo, $row, $lien, $x, $y, $align, null, $connect);
519 519
 }
520 520
 
521 521
 /**
@@ -527,19 +527,19 @@  discard block
 block discarded – undo
527 527
  */
528 528
 function quete_html_logo($logo, $align, $lien) {
529 529
 
530
-	if (!is_array($logo)) {
531
-		return '';
532
-	}
533
-
534
-	$contexte = [];
535
-	foreach ($logo as $k=>$v) {
536
-		if (!is_numeric($k)) {
537
-			$contexte[$k] = $v;
538
-		}
539
-	}
540
-	$contexte['align'] = $align;
541
-	$contexte['lien'] = $lien;
542
-	return recuperer_fond('modeles/logo', $contexte);
530
+    if (!is_array($logo)) {
531
+        return '';
532
+    }
533
+
534
+    $contexte = [];
535
+    foreach ($logo as $k=>$v) {
536
+        if (!is_numeric($k)) {
537
+            $contexte[$k] = $v;
538
+        }
539
+    }
540
+    $contexte['align'] = $align;
541
+    $contexte['lien'] = $lien;
542
+    return recuperer_fond('modeles/logo', $contexte);
543 543
 }
544 544
 
545 545
 /**
@@ -553,14 +553,14 @@  discard block
 block discarded – undo
553 553
  * @return string|false
554 554
  */
555 555
 function document_spip_externe($fichier, $connect) {
556
-	if ($connect) {
557
-		$site = quete_meta('adresse_site', $connect);
558
-		if ($site) {
559
-			$dir = quete_meta('dir_img', $connect);
560
-			return "$site/$dir$fichier";
561
-		}
562
-	}
563
-	return false;
556
+    if ($connect) {
557
+        $site = quete_meta('adresse_site', $connect);
558
+        if ($site) {
559
+            $dir = quete_meta('dir_img', $connect);
560
+            return "$site/$dir$fichier";
561
+        }
562
+    }
563
+    return false;
564 564
 }
565 565
 
566 566
 /**
@@ -573,23 +573,23 @@  discard block
 block discarded – undo
573 573
  * @return string
574 574
  */
575 575
 function vignette_logo_document($row, $connect = '') {
576
-	if (!$row['id_vignette']) {
577
-		return '';
578
-	}
579
-	$fichier = quete_fichier($row['id_vignette'], $connect);
580
-	if ($url = document_spip_externe($fichier, $connect)) {
581
-		return $url;
582
-	}
583
-
584
-	$f = get_spip_doc($fichier);
585
-	if ($f and @file_exists($f)) {
586
-		return $f;
587
-	}
588
-	if ($row['mode'] !== 'vignette') {
589
-		return '';
590
-	}
591
-
592
-	return generer_url_entite($row['id_document'], 'document', '', '', $connect);
576
+    if (!$row['id_vignette']) {
577
+        return '';
578
+    }
579
+    $fichier = quete_fichier($row['id_vignette'], $connect);
580
+    if ($url = document_spip_externe($fichier, $connect)) {
581
+        return $url;
582
+    }
583
+
584
+    $f = get_spip_doc($fichier);
585
+    if ($f and @file_exists($f)) {
586
+        return $f;
587
+    }
588
+    if ($row['mode'] !== 'vignette') {
589
+        return '';
590
+    }
591
+
592
+    return generer_url_entite($row['id_document'], 'document', '', '', $connect);
593 593
 }
594 594
 
595 595
 /**
@@ -605,68 +605,68 @@  discard block
 block discarded – undo
605 605
  * @return bool|string
606 606
  */
607 607
 function calcul_exposer($id, $prim, $reference, $parent, $type, $connect = '') {
608
-	static $exposer = array();
609
-
610
-	// Que faut-il exposer ? Tous les elements de $reference
611
-	// ainsi que leur hierarchie ; on ne fait donc ce calcul
612
-	// qu'une fois (par squelette) et on conserve le resultat
613
-	// en static.
614
-	if (!isset($exposer[$m = md5(serialize($reference))][$prim])) {
615
-		$principal = isset($reference[$type]) ? $reference[$type] :
616
-			// cas de la pagination indecte @xx qui positionne la page avec l'id xx
617
-			// et donne la reference dynamique @type=xx dans le contexte
618
-			(isset($reference["@$type"]) ? $reference["@$type"] : '');
619
-		// le parent fournit en argument est le parent de $id, pas celui de $principal
620
-		// il n'est donc pas utile
621
-		$parent = 0;
622
-		if (!$principal) { // regarder si un enfant est dans le contexte, auquel cas il expose peut etre le parent courant
623
-			$enfants = array('id_rubrique' => array('id_article'), 'id_groupe' => array('id_mot'));
624
-			if (isset($enfants[$type])) {
625
-				foreach ($enfants[$type] as $t) {
626
-					if (isset($reference[$t])
627
-						// cas de la reference donnee dynamiquement par la pagination
628
-						or isset($reference["@$t"])
629
-					) {
630
-						$type = $t;
631
-						$principal = isset($reference[$type]) ? $reference[$type] : $reference["@$type"];
632
-						continue;
633
-					}
634
-				}
635
-			}
636
-		}
637
-		$exposer[$m][$type] = array();
638
-		if ($principal) {
639
-			$principaux = is_array($principal) ? $principal : array($principal);
640
-			foreach ($principaux as $principal) {
641
-				$exposer[$m][$type][$principal] = true;
642
-				if ($type == 'id_mot') {
643
-					if (!$parent) {
644
-						$parent = sql_getfetsel('id_groupe', 'spip_mots', 'id_mot=' . intval($principal), '', '', '', '', $connect);
645
-					}
646
-					if ($parent) {
647
-						$exposer[$m]['id_groupe'][$parent] = true;
648
-					}
649
-				} else {
650
-					if ($type != 'id_groupe') {
651
-						if (!$parent) {
652
-							if ($type == 'id_rubrique') {
653
-								$parent = $principal;
654
-							}
655
-							if ($type == 'id_article') {
656
-								$parent = quete_rubrique($principal, $connect);
657
-							}
658
-						}
659
-						do {
660
-							$exposer[$m]['id_rubrique'][$parent] = true;
661
-						} while ($parent = quete_parent($parent, $connect));
662
-					}
663
-				}
664
-			}
665
-		}
666
-	}
667
-
668
-	// And the winner is...
669
-	return isset($exposer[$m][$prim]) ? isset($exposer[$m][$prim][$id]) : '';
608
+    static $exposer = array();
609
+
610
+    // Que faut-il exposer ? Tous les elements de $reference
611
+    // ainsi que leur hierarchie ; on ne fait donc ce calcul
612
+    // qu'une fois (par squelette) et on conserve le resultat
613
+    // en static.
614
+    if (!isset($exposer[$m = md5(serialize($reference))][$prim])) {
615
+        $principal = isset($reference[$type]) ? $reference[$type] :
616
+            // cas de la pagination indecte @xx qui positionne la page avec l'id xx
617
+            // et donne la reference dynamique @type=xx dans le contexte
618
+            (isset($reference["@$type"]) ? $reference["@$type"] : '');
619
+        // le parent fournit en argument est le parent de $id, pas celui de $principal
620
+        // il n'est donc pas utile
621
+        $parent = 0;
622
+        if (!$principal) { // regarder si un enfant est dans le contexte, auquel cas il expose peut etre le parent courant
623
+            $enfants = array('id_rubrique' => array('id_article'), 'id_groupe' => array('id_mot'));
624
+            if (isset($enfants[$type])) {
625
+                foreach ($enfants[$type] as $t) {
626
+                    if (isset($reference[$t])
627
+                        // cas de la reference donnee dynamiquement par la pagination
628
+                        or isset($reference["@$t"])
629
+                    ) {
630
+                        $type = $t;
631
+                        $principal = isset($reference[$type]) ? $reference[$type] : $reference["@$type"];
632
+                        continue;
633
+                    }
634
+                }
635
+            }
636
+        }
637
+        $exposer[$m][$type] = array();
638
+        if ($principal) {
639
+            $principaux = is_array($principal) ? $principal : array($principal);
640
+            foreach ($principaux as $principal) {
641
+                $exposer[$m][$type][$principal] = true;
642
+                if ($type == 'id_mot') {
643
+                    if (!$parent) {
644
+                        $parent = sql_getfetsel('id_groupe', 'spip_mots', 'id_mot=' . intval($principal), '', '', '', '', $connect);
645
+                    }
646
+                    if ($parent) {
647
+                        $exposer[$m]['id_groupe'][$parent] = true;
648
+                    }
649
+                } else {
650
+                    if ($type != 'id_groupe') {
651
+                        if (!$parent) {
652
+                            if ($type == 'id_rubrique') {
653
+                                $parent = $principal;
654
+                            }
655
+                            if ($type == 'id_article') {
656
+                                $parent = quete_rubrique($principal, $connect);
657
+                            }
658
+                        }
659
+                        do {
660
+                            $exposer[$m]['id_rubrique'][$parent] = true;
661
+                        } while ($parent = quete_parent($parent, $connect));
662
+                    }
663
+                }
664
+            }
665
+        }
666
+    }
667
+
668
+    // And the winner is...
669
+    return isset($exposer[$m][$prim]) ? isset($exposer[$m][$prim][$id]) : '';
670 670
 }
671 671
 
672 672
 /**
@@ -681,21 +681,21 @@  discard block
 block discarded – undo
681 681
  * @return int
682 682
  */
683 683
 function quete_debut_pagination($primary, $valeur, $pas, $iter) {
684
-	// on ne devrait pas arriver ici si la cle primaire est inexistante
685
-	// ou composee, mais verifions
686
-	if (!$primary or preg_match('/[,\s]/', $primary)) {
687
-		return 0;
688
-	}
689
-
690
-	$pos = 0;
691
-	while ($row = $iter->fetch() and $row[$primary] != $valeur) {
692
-		$pos++;
693
-	}
694
-	// si on a pas trouve
695
-	if (!$row or $row[$primary] != $valeur) {
696
-		return 0;
697
-	}
698
-
699
-	// sinon, calculer le bon numero de page
700
-	return floor($pos / $pas) * $pas;
684
+    // on ne devrait pas arriver ici si la cle primaire est inexistante
685
+    // ou composee, mais verifions
686
+    if (!$primary or preg_match('/[,\s]/', $primary)) {
687
+        return 0;
688
+    }
689
+
690
+    $pos = 0;
691
+    while ($row = $iter->fetch() and $row[$primary] != $valeur) {
692
+        $pos++;
693
+    }
694
+    // si on a pas trouve
695
+    if (!$row or $row[$primary] != $valeur) {
696
+        return 0;
697
+    }
698
+
699
+    // sinon, calculer le bon numero de page
700
+    return floor($pos / $pas) * $pas;
701 701
 }
Please login to merge, or discard this patch.
index.php 1 patch
Indentation   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -1,3 +1,3 @@
 block discarded – undo
1 1
 <?php
2
-	# appel SPIP
3
-	include('spip.php');
2
+    # appel SPIP
3
+    include('spip.php');
Please login to merge, or discard this patch.
prive/objets/liste/objets-trad_fonctions.php 2 patches
Indentation   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -11,24 +11,24 @@
 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 lister_traductions($id_trad, $objet) {
18
-	$table_objet_sql = table_objet_sql($objet);
19
-	$primary = id_table_objet($objet);
18
+    $table_objet_sql = table_objet_sql($objet);
19
+    $primary = id_table_objet($objet);
20 20
 
21
-	$select = "$primary as id,lang";
22
-	$where = 'id_trad=' . intval($id_trad);
23
-	$trouver_table = charger_fonction('trouver_table','base');
24
-	$desc = $trouver_table($table_objet_sql);
25
-	if (isset($desc['field']['statut'])) {
26
-		$select .= ',statut';
27
-		$where .= ' AND statut!='.sql_quote('poubelle');
28
-	}
21
+    $select = "$primary as id,lang";
22
+    $where = 'id_trad=' . intval($id_trad);
23
+    $trouver_table = charger_fonction('trouver_table','base');
24
+    $desc = $trouver_table($table_objet_sql);
25
+    if (isset($desc['field']['statut'])) {
26
+        $select .= ',statut';
27
+        $where .= ' AND statut!='.sql_quote('poubelle');
28
+    }
29 29
 
30
-	$rows = sql_allfetsel($select, $table_objet_sql, $where);
31
-	lang_select();
30
+    $rows = sql_allfetsel($select, $table_objet_sql, $where);
31
+    lang_select();
32 32
 
33
-	return $rows;
33
+    return $rows;
34 34
 }
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -19,8 +19,8 @@
 block discarded – undo
19 19
 	$primary = id_table_objet($objet);
20 20
 
21 21
 	$select = "$primary as id,lang";
22
-	$where = 'id_trad=' . intval($id_trad);
23
-	$trouver_table = charger_fonction('trouver_table','base');
22
+	$where = 'id_trad='.intval($id_trad);
23
+	$trouver_table = charger_fonction('trouver_table', 'base');
24 24
 	$desc = $trouver_table($table_objet_sql);
25 25
 	if (isset($desc['field']['statut'])) {
26 26
 		$select .= ',statut';
Please login to merge, or discard this patch.
prive/objets/liste/auteurs_lies_fonctions.php 1 patch
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -11,7 +11,7 @@
 block discarded – undo
11 11
 \***************************************************************************/
12 12
 
13 13
 if (!defined('_ECRIRE_INC_VERSION')) {
14
-	return;
14
+    return;
15 15
 }
16 16
 
17 17
 include_spip('prive/objets/liste/auteurs_fonctions');
Please login to merge, or discard this patch.
prive/objets/liste/objets-en-edition_fonctions.php 1 patch
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -11,7 +11,7 @@
 block discarded – undo
11 11
 \***************************************************************************/
12 12
 
13 13
 if (!defined('_ECRIRE_INC_VERSION')) {
14
-	return;
14
+    return;
15 15
 }
16 16
 
17 17
 include_spip('inc/drapeau_edition');
Please login to merge, or discard this patch.
prive/objets/liste/auteurs_fonctions.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -154,7 +154,7 @@
 block discarded – undo
154 154
 	) {
155 155
 		return parametre_url(parametre_url(generer_url_ecrire('message_edit', 'new=oui'), 'to', $id_auteur), 'redirect', self());
156 156
 	} elseif (strlen($email) and autoriser('voir', 'auteur', $id_auteur)) {
157
-		return 'mailto:' . $email;
157
+		return 'mailto:'.$email;
158 158
 	} else {
159 159
 		return '';
160 160
 	}
Please login to merge, or discard this patch.
Indentation   +74 added lines, -74 removed lines patch added patch discarded remove patch
@@ -16,7 +16,7 @@  discard block
 block discarded – undo
16 16
  * @package SPIP\Core\Fonctions
17 17
  **/
18 18
 if (!defined('_ECRIRE_INC_VERSION')) {
19
-	return;
19
+    return;
20 20
 }
21 21
 
22 22
 /**
@@ -29,29 +29,29 @@  discard block
 block discarded – undo
29 29
  * @param bool $left
30 30
  */
31 31
 function critere_compteur_articles_filtres_dist($idb, &$boucles, $crit, $left = false) {
32
-	$boucle = &$boucles[$idb];
32
+    $boucle = &$boucles[$idb];
33 33
 
34
-	$_statut = calculer_liste($crit->param[0], array(), $boucles, $boucle->id_parent);
34
+    $_statut = calculer_liste($crit->param[0], array(), $boucles, $boucle->id_parent);
35 35
 
36
-	$not = '';
37
-	if ($crit->not) {
38
-		$not = ", 'NOT'";
39
-	}
40
-	$boucle->from['LAA'] = 'spip_auteurs_liens';
41
-	$boucle->from_type['LAA'] = 'left';
42
-	$boucle->join['LAA'] = array("'auteurs'", "'id_auteur'", "'id_auteur'", "'LAA.objet=\'article\''");
36
+    $not = '';
37
+    if ($crit->not) {
38
+        $not = ", 'NOT'";
39
+    }
40
+    $boucle->from['LAA'] = 'spip_auteurs_liens';
41
+    $boucle->from_type['LAA'] = 'left';
42
+    $boucle->join['LAA'] = array("'auteurs'", "'id_auteur'", "'id_auteur'", "'LAA.objet=\'article\''");
43 43
 
44
-	$boucle->from['articles'] = 'spip_articles';
45
-	$boucle->from_type['articles'] = 'left';
46
-	$boucle->join['articles'] = array(
47
-		"'LAA'",
48
-		"'id_article'",
49
-		"'id_objet'",
50
-		"'(articles.statut IS NULL OR '.sql_in('articles.statut',_q($_statut)$not).')'"
51
-	);
44
+    $boucle->from['articles'] = 'spip_articles';
45
+    $boucle->from_type['articles'] = 'left';
46
+    $boucle->join['articles'] = array(
47
+        "'LAA'",
48
+        "'id_article'",
49
+        "'id_objet'",
50
+        "'(articles.statut IS NULL OR '.sql_in('articles.statut',_q($_statut)$not).')'"
51
+    );
52 52
 
53
-	$boucle->select[] = 'COUNT(articles.id_article) AS compteur_articles';
54
-	$boucle->group[] = 'auteurs.id_auteur';
53
+    $boucle->select[] = 'COUNT(articles.id_article) AS compteur_articles';
54
+    $boucle->group[] = 'auteurs.id_auteur';
55 55
 }
56 56
 
57 57
 /**
@@ -69,7 +69,7 @@  discard block
 block discarded – undo
69 69
  *     Pile complétée par le code à générer
70 70
  */
71 71
 function balise_COMPTEUR_ARTICLES_dist($p) {
72
-	return rindex_pile($p, 'compteur_articles', 'compteur_articles_filtres');
72
+    return rindex_pile($p, 'compteur_articles', 'compteur_articles_filtres');
73 73
 }
74 74
 
75 75
 
@@ -85,43 +85,43 @@  discard block
 block discarded – undo
85 85
  * @return string
86 86
  */
87 87
 function afficher_initiale($url, $initiale, $compteur, $debut, $pas) {
88
-	static $memo = null;
89
-	static $res = [];
90
-	$out = '';
91
-	if (!$memo
92
-		or (!$initiale and !$url)
93
-		or ($initiale !== $memo['initiale'])
94
-	) {
95
-		$newcompt = intval(floor(($compteur - 1) / $pas) * $pas);
96
-		// si fin de la pagination et une seule entree, ne pas l'afficher, ca ne sert a rien
97
-		if (!$initiale and !$url and !$memo['compteur']) {
98
-			$memo = null;
99
-		}
100
-		if ($memo) {
101
-			$on = (($memo['compteur'] <= $debut)
102
-				and (
103
-					$newcompt > $debut or ($newcompt == $debut and $newcompt == $memo['compteur'])
104
-				));
105
-			$res[] = lien_ou_expose($memo['url'], $memo['initiale'], $on, 'lien_pagination');
106
-		}
107
-		if ($initiale) {
108
-			$memo = array(
109
-				'entree' => isset($memo['entree']) ? $memo['entree'] + 1 : 0,
110
-				'initiale' => $initiale,
111
-				'url' => parametre_url($url, 'i', $initiale),
112
-				'compteur' => $newcompt
113
-			);
114
-		}
115
-	}
116
-	if (!$initiale and !$url) {
117
-		if (count($res) > 1) {
118
-			$out = implode(' ', $res);
119
-		}
120
-		$memo = null;
121
-		$res = [];
122
-	}
88
+    static $memo = null;
89
+    static $res = [];
90
+    $out = '';
91
+    if (!$memo
92
+        or (!$initiale and !$url)
93
+        or ($initiale !== $memo['initiale'])
94
+    ) {
95
+        $newcompt = intval(floor(($compteur - 1) / $pas) * $pas);
96
+        // si fin de la pagination et une seule entree, ne pas l'afficher, ca ne sert a rien
97
+        if (!$initiale and !$url and !$memo['compteur']) {
98
+            $memo = null;
99
+        }
100
+        if ($memo) {
101
+            $on = (($memo['compteur'] <= $debut)
102
+                and (
103
+                    $newcompt > $debut or ($newcompt == $debut and $newcompt == $memo['compteur'])
104
+                ));
105
+            $res[] = lien_ou_expose($memo['url'], $memo['initiale'], $on, 'lien_pagination');
106
+        }
107
+        if ($initiale) {
108
+            $memo = array(
109
+                'entree' => isset($memo['entree']) ? $memo['entree'] + 1 : 0,
110
+                'initiale' => $initiale,
111
+                'url' => parametre_url($url, 'i', $initiale),
112
+                'compteur' => $newcompt
113
+            );
114
+        }
115
+    }
116
+    if (!$initiale and !$url) {
117
+        if (count($res) > 1) {
118
+            $out = implode(' ', $res);
119
+        }
120
+        $memo = null;
121
+        $res = [];
122
+    }
123 123
 
124
-	return $out;
124
+    return $out;
125 125
 }
126 126
 
127 127
 /**
@@ -140,23 +140,23 @@  discard block
 block discarded – undo
140 140
  * @return string
141 141
  */
142 142
 function auteur_lien_messagerie($id_auteur, $en_ligne, $statut, $imessage, $email = '') {
143
-	static $time = null;
144
-	if (!in_array($statut, array('0minirezo', '1comite'))) {
145
-		return '';
146
-	}
143
+    static $time = null;
144
+    if (!in_array($statut, array('0minirezo', '1comite'))) {
145
+        return '';
146
+    }
147 147
 
148
-	if (is_null($time)) {
149
-		$time = time();
150
-	}
151
-	$parti = (($time - strtotime($en_ligne)) > 15 * 60);
148
+    if (is_null($time)) {
149
+        $time = time();
150
+    }
151
+    $parti = (($time - strtotime($en_ligne)) > 15 * 60);
152 152
 
153
-	if ($imessage != 'non' and !$parti // historique : est-ce que ca a encore un sens de limiter vu qu'on a la notification par email ?
154
-		and $GLOBALS['meta']['messagerie_agenda'] != 'non'
155
-	) {
156
-		return parametre_url(parametre_url(generer_url_ecrire('message_edit', 'new=oui'), 'to', $id_auteur), 'redirect', self());
157
-	} elseif (strlen($email) and autoriser('voir', 'auteur', $id_auteur)) {
158
-		return 'mailto:' . $email;
159
-	} else {
160
-		return '';
161
-	}
153
+    if ($imessage != 'non' and !$parti // historique : est-ce que ca a encore un sens de limiter vu qu'on a la notification par email ?
154
+        and $GLOBALS['meta']['messagerie_agenda'] != 'non'
155
+    ) {
156
+        return parametre_url(parametre_url(generer_url_ecrire('message_edit', 'new=oui'), 'to', $id_auteur), 'redirect', self());
157
+    } elseif (strlen($email) and autoriser('voir', 'auteur', $id_auteur)) {
158
+        return 'mailto:' . $email;
159
+    } else {
160
+        return '';
161
+    }
162 162
 }
Please login to merge, or discard this patch.
prive/objets/liste/articles_fonctions.php 1 patch
Indentation   +27 added lines, -27 removed lines patch added patch discarded remove patch
@@ -11,40 +11,40 @@
 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 defaut_tri_defined($defaut) {
18
-	if (!defined('_TRI_ARTICLES_RUBRIQUE')) {
19
-		return $defaut;
20
-	}
18
+    if (!defined('_TRI_ARTICLES_RUBRIQUE')) {
19
+        return $defaut;
20
+    }
21 21
 
22
-	$sens = 1;
23
-	$tri = trim(_TRI_ARTICLES_RUBRIQUE);
24
-	$tri = explode(' ', $tri);
25
-	if (strncasecmp(end($tri), 'DESC', 4) == 0) {
26
-		$sens = -1;
27
-		array_pop($tri);
28
-	} elseif (strncasecmp(end($tri), 'ASC', 3) == 0) {
29
-		$sens = 1;
30
-		array_pop($tri);
31
-	}
32
-	$tri = implode(' ', $tri);
33
-	$tri = array($tri => $sens);
34
-	foreach ($defaut as $n => $s) {
35
-		if (!isset($tri[$n])) {
36
-			$tri[$n] = $s;
37
-		}
38
-	}
22
+    $sens = 1;
23
+    $tri = trim(_TRI_ARTICLES_RUBRIQUE);
24
+    $tri = explode(' ', $tri);
25
+    if (strncasecmp(end($tri), 'DESC', 4) == 0) {
26
+        $sens = -1;
27
+        array_pop($tri);
28
+    } elseif (strncasecmp(end($tri), 'ASC', 3) == 0) {
29
+        $sens = 1;
30
+        array_pop($tri);
31
+    }
32
+    $tri = implode(' ', $tri);
33
+    $tri = array($tri => $sens);
34
+    foreach ($defaut as $n => $s) {
35
+        if (!isset($tri[$n])) {
36
+            $tri[$n] = $s;
37
+        }
38
+    }
39 39
 
40
-	return $tri;
40
+    return $tri;
41 41
 }
42 42
 
43 43
 function defaut_tri_par($par, $defaut) {
44
-	if (!defined('_TRI_ARTICLES_RUBRIQUE')) {
45
-		return $par;
46
-	}
47
-	$par = array_keys($defaut);
44
+    if (!defined('_TRI_ARTICLES_RUBRIQUE')) {
45
+        return $par;
46
+    }
47
+    $par = array_keys($defaut);
48 48
 
49
-	return reset($par);
49
+    return reset($par);
50 50
 }
Please login to merge, or discard this patch.
prive/ajax_item_pick_fonctions.php 1 patch
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,7 +1,7 @@
 block discarded – undo
1 1
 <?php
2 2
 
3 3
 if (!defined('_ECRIRE_INC_VERSION')) {
4
-	return;
4
+    return;
5 5
 }
6 6
 
7 7
 include_spip('formulaires/selecteur/selecteur_fonctions');
Please login to merge, or discard this patch.
prive/formulaires/inc-instituer_auteur_fonctions.php 1 patch
Indentation   +25 added lines, -25 removed lines patch added patch discarded remove patch
@@ -6,7 +6,7 @@  discard block
 block discarded – undo
6 6
  * @package SPIP\Core\Formulaires
7 7
  **/
8 8
 if (!defined('_ECRIRE_INC_VERSION')) {
9
-	return;
9
+    return;
10 10
 }
11 11
 
12 12
 /**
@@ -23,31 +23,31 @@  discard block
 block discarded – undo
23 23
  *     Code HTML et javascript
24 24
  */
25 25
 function choisir_rubriques_admin_restreint(
26
-	$id_auteur,
27
-	$label = '',
28
-	$sel_css = '#liste_rubriques_restreintes',
29
-	$img_remove = ''
26
+    $id_auteur,
27
+    $label = '',
28
+    $sel_css = '#liste_rubriques_restreintes',
29
+    $img_remove = ''
30 30
 ) {
31
-	global $spip_lang;
32
-	$res = '';
33
-	// Ajouter une rubrique a un administrateur restreint
34
-	if ($chercher_rubrique = charger_fonction('chercher_rubrique', 'inc')
35
-		and $a = $chercher_rubrique(0, 'auteur', false)
36
-	) {
37
-		if ($img_remove) {
38
-			$img_remove = addslashes("<a href=\"#\" onclick=\"jQuery(this).parent().remove();return false;\" class=\"removelink\">$img_remove</a>");
39
-		}
31
+    global $spip_lang;
32
+    $res = '';
33
+    // Ajouter une rubrique a un administrateur restreint
34
+    if ($chercher_rubrique = charger_fonction('chercher_rubrique', 'inc')
35
+        and $a = $chercher_rubrique(0, 'auteur', false)
36
+    ) {
37
+        if ($img_remove) {
38
+            $img_remove = addslashes("<a href=\"#\" onclick=\"jQuery(this).parent().remove();return false;\" class=\"removelink\">$img_remove</a>");
39
+        }
40 40
 
41
-		$res =
42
-			"\n<div id='ajax_rubrique'>\n"
43
-			. "<label>$label</label>\n"
44
-			. "<input name='id_auteur' value='$id_auteur' type='hidden' />\n"
45
-			. $a
46
-			. "</div>\n"
41
+        $res =
42
+            "\n<div id='ajax_rubrique'>\n"
43
+            . "<label>$label</label>\n"
44
+            . "<input name='id_auteur' value='$id_auteur' type='hidden' />\n"
45
+            . $a
46
+            . "</div>\n"
47 47
 
48
-			// onchange = pour le menu
49
-			// l'evenement doit etre provoque a la main par le selecteur ajax
50
-			. "<script type='text/javascript'>/*<![CDATA[*/
48
+            // onchange = pour le menu
49
+            // l'evenement doit etre provoque a la main par le selecteur ajax
50
+            . "<script type='text/javascript'>/*<![CDATA[*/
51 51
 jQuery(function($){
52 52
 	$('#id_parent').on('change', function(){
53 53
 		var id_parent = parseInt(this.value);
@@ -66,7 +66,7 @@  discard block
 block discarded – undo
66 66
 	.attr('name','noname');
67 67
 });
68 68
 /*]]>*/</script>";
69
-	}
69
+    }
70 70
 
71
-	return $res;
71
+    return $res;
72 72
 }
Please login to merge, or discard this patch.