Completed
Pull Request — master (#39)
by
unknown
07:42
created
ecrire/inc/filtres_boites.php 2 patches
Indentation   +41 added lines, -41 removed lines patch added patch discarded remove patch
@@ -18,7 +18,7 @@  discard block
 block discarded – undo
18 18
  **/
19 19
 
20 20
 if (!defined('_ECRIRE_INC_VERSION')) {
21
-	return;
21
+    return;
22 22
 }
23 23
 
24 24
 
@@ -44,18 +44,18 @@  discard block
 block discarded – undo
44 44
  *     Pile complétée par le code à générer
45 45
  */
46 46
 function balise_BOITE_OUVRIR_dist($p) {
47
-	$_titre = interprete_argument_balise(1, $p);
48
-	$_class = interprete_argument_balise(2, $p);
49
-	$_head_class = interprete_argument_balise(3, $p);
50
-	$_titre = ($_titre ? $_titre : "''");
51
-	$_class = ($_class ? ", $_class" : ", 'simple'");
52
-	$_head_class = ($_head_class ? ", $_head_class" : '');
53
-
54
-	$f = chercher_filtre('boite_ouvrir');
55
-	$p->code = "$f($_titre$_class$_head_class)";
56
-	$p->interdire_scripts = false;
57
-
58
-	return $p;
47
+    $_titre = interprete_argument_balise(1, $p);
48
+    $_class = interprete_argument_balise(2, $p);
49
+    $_head_class = interprete_argument_balise(3, $p);
50
+    $_titre = ($_titre ? $_titre : "''");
51
+    $_class = ($_class ? ", $_class" : ", 'simple'");
52
+    $_head_class = ($_head_class ? ", $_head_class" : '');
53
+
54
+    $f = chercher_filtre('boite_ouvrir');
55
+    $p->code = "$f($_titre$_class$_head_class)";
56
+    $p->interdire_scripts = false;
57
+
58
+    return $p;
59 59
 }
60 60
 
61 61
 /**
@@ -75,14 +75,14 @@  discard block
 block discarded – undo
75 75
  *     Pile complétée par le code à générer
76 76
  */
77 77
 function balise_BOITE_PIED_dist($p) {
78
-	$_class = interprete_argument_balise(1, $p);
79
-	$_class = ($_class ? "$_class" : '');
78
+    $_class = interprete_argument_balise(1, $p);
79
+    $_class = ($_class ? "$_class" : '');
80 80
 
81
-	$f = chercher_filtre('boite_pied');
82
-	$p->code = "$f($_class)";
83
-	$p->interdire_scripts = false;
81
+    $f = chercher_filtre('boite_pied');
82
+    $p->code = "$f($_class)";
83
+    $p->interdire_scripts = false;
84 84
 
85
-	return $p;
85
+    return $p;
86 86
 }
87 87
 
88 88
 
@@ -102,11 +102,11 @@  discard block
 block discarded – undo
102 102
  *     Pile complétée par le code à générer
103 103
  */
104 104
 function balise_BOITE_FERMER_dist($p) {
105
-	$f = chercher_filtre('boite_fermer');
106
-	$p->code = "$f()";
107
-	$p->interdire_scripts = false;
105
+    $f = chercher_filtre('boite_fermer');
106
+    $p->code = "$f()";
107
+    $p->interdire_scripts = false;
108 108
 
109
-	return $p;
109
+    return $p;
110 110
 }
111 111
 
112 112
 /**
@@ -128,18 +128,18 @@  discard block
 block discarded – undo
128 128
  *     HTML du début de la boîte
129 129
  */
130 130
 function boite_ouvrir($titre, $class = '', $head_class = '', $id = '') {
131
-	$class = "box $class";
132
-	$head_class = "clearfix hd $head_class";
133
-	// dans l'espace prive, titrer en h3 si pas de balise <hn>
134
-	if (test_espace_prive() and strlen($titre) and strpos($titre, '<h') === false) {
135
-		$titre = "<h3>$titre</h3>";
136
-	}
137
-
138
-	return '<div class="' . $class . ($id ? "\" id=\"$id" : '') . '">'
139
-	. '<b class="top"><b class="tl"></b><b class="tr"></b></b>'
140
-	. '<div class="inner">'
141
-	. ($titre ? '<div class="clearfix ' . $head_class . '">' . $titre . '<!--/hd--></div>' : '')
142
-	. '<div class="clearfix bd">';
131
+    $class = "box $class";
132
+    $head_class = "clearfix hd $head_class";
133
+    // dans l'espace prive, titrer en h3 si pas de balise <hn>
134
+    if (test_espace_prive() and strlen($titre) and strpos($titre, '<h') === false) {
135
+        $titre = "<h3>$titre</h3>";
136
+    }
137
+
138
+    return '<div class="' . $class . ($id ? "\" id=\"$id" : '') . '">'
139
+    . '<b class="top"><b class="tl"></b><b class="tr"></b></b>'
140
+    . '<div class="inner">'
141
+    . ($titre ? '<div class="clearfix ' . $head_class . '">' . $titre . '<!--/hd--></div>' : '')
142
+    . '<div class="clearfix bd">';
143 143
 }
144 144
 
145 145
 
@@ -156,10 +156,10 @@  discard block
 block discarded – undo
156 156
  *     HTML de transition vers le pied de la boîte
157 157
  */
158 158
 function boite_pied($class = 'act') {
159
-	$class = "ft $class";
159
+    $class = "ft $class";
160 160
 
161
-	return '</div>'
162
-	. '<div class="cleafix ' . $class . '">';
161
+    return '</div>'
162
+    . '<div class="cleafix ' . $class . '">';
163 163
 }
164 164
 
165 165
 
@@ -174,7 +174,7 @@  discard block
 block discarded – undo
174 174
  *     HTML de fin de la boîte
175 175
  */
176 176
 function boite_fermer() {
177
-	return '</div></div>'
178
-	. '<b class="bottom"><b class="bl"></b><b class="br"></b></b>'
179
-	. '</div>';
177
+    return '</div></div>'
178
+    . '<b class="bottom"><b class="bl"></b><b class="br"></b></b>'
179
+    . '</div>';
180 180
 }
Please login to merge, or discard this patch.
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -135,10 +135,10 @@  discard block
 block discarded – undo
135 135
 		$titre = "<h3>$titre</h3>";
136 136
 	}
137 137
 
138
-	return '<div class="' . $class . ($id ? "\" id=\"$id" : '') . '">'
138
+	return '<div class="'.$class.($id ? "\" id=\"$id" : '').'">'
139 139
 	. '<b class="top"><b class="tl"></b><b class="tr"></b></b>'
140 140
 	. '<div class="inner">'
141
-	. ($titre ? '<div class="clearfix ' . $head_class . '">' . $titre . '<!--/hd--></div>' : '')
141
+	. ($titre ? '<div class="clearfix '.$head_class.'">'.$titre.'<!--/hd--></div>' : '')
142 142
 	. '<div class="clearfix bd">';
143 143
 }
144 144
 
@@ -159,7 +159,7 @@  discard block
 block discarded – undo
159 159
 	$class = "ft $class";
160 160
 
161 161
 	return '</div>'
162
-	. '<div class="cleafix ' . $class . '">';
162
+	. '<div class="cleafix '.$class.'">';
163 163
 }
164 164
 
165 165
 
Please login to merge, or discard this patch.
ecrire/inc/drapeau_edition.php 1 patch
Indentation   +109 added lines, -109 removed lines patch added patch discarded remove patch
@@ -30,7 +30,7 @@  discard block
 block discarded – undo
30 30
  * @package SPIP\Core\Drapeaux\Edition
31 31
  **/
32 32
 if (!defined('_ECRIRE_INC_VERSION')) {
33
-	return;
33
+    return;
34 34
 }
35 35
 
36 36
 
@@ -45,46 +45,46 @@  discard block
 block discarded – undo
45 45
  *     `[ type d'objet ][id_objet][id_auteur][nom de l'auteur] = time()`
46 46
  **/
47 47
 function lire_tableau_edition() {
48
-	$edition = @unserialize($GLOBALS['meta']['drapeau_edition']);
49
-	if (!$edition) {
50
-		return array();
51
-	}
52
-	$changed = false;
48
+    $edition = @unserialize($GLOBALS['meta']['drapeau_edition']);
49
+    if (!$edition) {
50
+        return array();
51
+    }
52
+    $changed = false;
53 53
 
54
-	$bon_pour_le_service = time() - 3600;
55
-	// parcourir le tableau et virer les vieux
56
-	foreach ($edition as $objet => $data) {
57
-		if (!is_array($data)) {
58
-			unset($edition[$objet]);
59
-		} // vieille version
60
-		else {
61
-			foreach ($data as $id => $tab) {
62
-				if (!is_array($tab)) {
63
-					unset($edition[$objet][$tab]);
64
-				} // vieille version
65
-				else {
66
-					foreach ($tab as $n => $duo) {
67
-						if (current($duo) < $bon_pour_le_service) {
68
-							unset($edition[$objet][$id][$n]);
69
-							$changed = true;
70
-						}
71
-					}
72
-				}
73
-				if (!$edition[$objet][$id]) {
74
-					unset($edition[$objet][$id]);
75
-				}
76
-			}
77
-		}
78
-		if (!$edition[$objet]) {
79
-			unset($edition[$objet]);
80
-		}
81
-	}
54
+    $bon_pour_le_service = time() - 3600;
55
+    // parcourir le tableau et virer les vieux
56
+    foreach ($edition as $objet => $data) {
57
+        if (!is_array($data)) {
58
+            unset($edition[$objet]);
59
+        } // vieille version
60
+        else {
61
+            foreach ($data as $id => $tab) {
62
+                if (!is_array($tab)) {
63
+                    unset($edition[$objet][$tab]);
64
+                } // vieille version
65
+                else {
66
+                    foreach ($tab as $n => $duo) {
67
+                        if (current($duo) < $bon_pour_le_service) {
68
+                            unset($edition[$objet][$id][$n]);
69
+                            $changed = true;
70
+                        }
71
+                    }
72
+                }
73
+                if (!$edition[$objet][$id]) {
74
+                    unset($edition[$objet][$id]);
75
+                }
76
+            }
77
+        }
78
+        if (!$edition[$objet]) {
79
+            unset($edition[$objet]);
80
+        }
81
+    }
82 82
 
83
-	if ($changed) {
84
-		ecrire_tableau_edition($edition);
85
-	}
83
+    if ($changed) {
84
+        ecrire_tableau_edition($edition);
85
+    }
86 86
 
87
-	return $edition;
87
+    return $edition;
88 88
 }
89 89
 
90 90
 /**
@@ -97,7 +97,7 @@  discard block
 block discarded – undo
97 97
  *     `[ type d'objet ][id_objet][id_auteur][nom de l'auteur] = time()`
98 98
  **/
99 99
 function ecrire_tableau_edition($edition) {
100
-	ecrire_meta('drapeau_edition', serialize($edition));
100
+    ecrire_meta('drapeau_edition', serialize($edition));
101 101
 }
102 102
 
103 103
 /**
@@ -117,24 +117,24 @@  discard block
 block discarded – undo
117 117
  *     Type d'objet édité
118 118
  */
119 119
 function signale_edition($id, $auteur, $type = 'article') {
120
-	include_spip('base/objets');
121
-	include_spip('inc/filtres');
122
-	if (objet_info($type, 'editable') !== 'oui') {
123
-		return;
124
-	}
120
+    include_spip('base/objets');
121
+    include_spip('inc/filtres');
122
+    if (objet_info($type, 'editable') !== 'oui') {
123
+        return;
124
+    }
125 125
 
126
-	$edition = lire_tableau_edition();
127
-	if (isset($auteur['id_auteur']) and $id_a = $auteur['id_auteur']) {
128
-		$nom = $auteur['nom'];
129
-	} else {
130
-		$nom = $id_a = $GLOBALS['ip'];
131
-	}
126
+    $edition = lire_tableau_edition();
127
+    if (isset($auteur['id_auteur']) and $id_a = $auteur['id_auteur']) {
128
+        $nom = $auteur['nom'];
129
+    } else {
130
+        $nom = $id_a = $GLOBALS['ip'];
131
+    }
132 132
 
133
-	if (!isset($edition[$type][$id]) or !is_array($edition[$type][$id])) {
134
-		$edition[$type][$id] = array();
135
-	}
136
-	$edition[$type][$id][$id_a][$nom] = time();
137
-	ecrire_tableau_edition($edition);
133
+    if (!isset($edition[$type][$id]) or !is_array($edition[$type][$id])) {
134
+        $edition[$type][$id] = array();
135
+    }
136
+    $edition[$type][$id][$id_a][$nom] = time();
137
+    ecrire_tableau_edition($edition);
138 138
 }
139 139
 
140 140
 /**
@@ -151,9 +151,9 @@  discard block
 block discarded – undo
151 151
  */
152 152
 function qui_edite($id, $type = 'article') {
153 153
 
154
-	$edition = lire_tableau_edition();
154
+    $edition = lire_tableau_edition();
155 155
 
156
-	return empty($edition[$type][$id]) ? array() : $edition[$type][$id];
156
+    return empty($edition[$type][$id]) ? array() : $edition[$type][$id];
157 157
 }
158 158
 
159 159
 /**
@@ -167,22 +167,22 @@  discard block
 block discarded – undo
167 167
  *     Liste de tableaux `['nom_auteur_modif' => x|y|z, 'date_diff' => n]`
168 168
  */
169 169
 function mention_qui_edite($id, $type = 'article') {
170
-	$modif = qui_edite($id, $type);
171
-	unset($modif[$GLOBALS['visiteur_session']['id_auteur']]);
170
+    $modif = qui_edite($id, $type);
171
+    unset($modif[$GLOBALS['visiteur_session']['id_auteur']]);
172 172
 
173
-	if ($modif) {
174
-		$quand = 0;
175
-		foreach ($modif as $duo) {
176
-			$auteurs[] = typo(key($duo));
177
-			$quand = max($quand, current($duo));
178
-		}
173
+    if ($modif) {
174
+        $quand = 0;
175
+        foreach ($modif as $duo) {
176
+            $auteurs[] = typo(key($duo));
177
+            $quand = max($quand, current($duo));
178
+        }
179 179
 
180
-		// format lie a la chaine de langue 'avis_article_modifie'
181
-		return array(
182
-			'nom_auteur_modif' => join(' | ', $auteurs),
183
-			'date_diff' => ceil((time() - $quand) / 60)
184
-		);
185
-	}
180
+        // format lie a la chaine de langue 'avis_article_modifie'
181
+        return array(
182
+            'nom_auteur_modif' => join(' | ', $auteurs),
183
+            'date_diff' => ceil((time() - $quand) / 60)
184
+        );
185
+    }
186 186
 }
187 187
 
188 188
 /**
@@ -196,24 +196,24 @@  discard block
 block discarded – undo
196 196
  *     Liste de tableaux `['objet' => x, 'id_objet' => n]`
197 197
  */
198 198
 function liste_drapeau_edition($id_auteur) {
199
-	$edition = lire_tableau_edition();
200
-	$objets_ouverts = array();
199
+    $edition = lire_tableau_edition();
200
+    $objets_ouverts = array();
201 201
 
202
-	foreach ($edition as $objet => $data) {
203
-		foreach ($data as $id => $auteurs) {
204
-			if (isset($auteurs[$id_auteur])
205
-				and is_array($auteurs[$id_auteur]) // precaution
206
-				and (array_pop($auteurs[$id_auteur]) > time() - 3600)
207
-			) {
208
-				$objets_ouverts[] = array(
209
-					'objet' => $objet,
210
-					'id_objet' => $id,
211
-				);
212
-			}
213
-		}
214
-	}
202
+    foreach ($edition as $objet => $data) {
203
+        foreach ($data as $id => $auteurs) {
204
+            if (isset($auteurs[$id_auteur])
205
+                and is_array($auteurs[$id_auteur]) // precaution
206
+                and (array_pop($auteurs[$id_auteur]) > time() - 3600)
207
+            ) {
208
+                $objets_ouverts[] = array(
209
+                    'objet' => $objet,
210
+                    'id_objet' => $id,
211
+                );
212
+            }
213
+        }
214
+    }
215 215
 
216
-	return $objets_ouverts;
216
+    return $objets_ouverts;
217 217
 }
218 218
 
219 219
 /**
@@ -226,15 +226,15 @@  discard block
 block discarded – undo
226 226
  * @return void
227 227
  */
228 228
 function debloquer_tous($id_auteur) {
229
-	$edition = lire_tableau_edition();
230
-	foreach ($edition as $objet => $data) {
231
-		foreach ($data as $id => $auteurs) {
232
-			if (isset($auteurs[$id_auteur])) {
233
-				unset($edition[$objet][$id][$id_auteur]);
234
-				ecrire_tableau_edition($edition);
235
-			}
236
-		}
237
-	}
229
+    $edition = lire_tableau_edition();
230
+    foreach ($edition as $objet => $data) {
231
+        foreach ($data as $id => $auteurs) {
232
+            if (isset($auteurs[$id_auteur])) {
233
+                unset($edition[$objet][$id][$id_auteur]);
234
+                ecrire_tableau_edition($edition);
235
+            }
236
+        }
237
+    }
238 238
 }
239 239
 
240 240
 /**
@@ -252,18 +252,18 @@  discard block
 block discarded – undo
252 252
  * @return void
253 253
  */
254 254
 function debloquer_edition($id_auteur, $id_objet, $type = 'article') {
255
-	$edition = lire_tableau_edition();
255
+    $edition = lire_tableau_edition();
256 256
 
257
-	foreach ($edition as $objet => $data) {
258
-		if ($objet == $type) {
259
-			foreach ($data as $id => $auteurs) {
260
-				if ($id == $id_objet
261
-					and isset($auteurs[$id_auteur])
262
-				) {
263
-					unset($edition[$objet][$id][$id_auteur]);
264
-					ecrire_tableau_edition($edition);
265
-				}
266
-			}
267
-		}
268
-	}
257
+    foreach ($edition as $objet => $data) {
258
+        if ($objet == $type) {
259
+            foreach ($data as $id => $auteurs) {
260
+                if ($id == $id_objet
261
+                    and isset($auteurs[$id_auteur])
262
+                ) {
263
+                    unset($edition[$objet][$id][$id_auteur]);
264
+                    ecrire_tableau_edition($edition);
265
+                }
266
+            }
267
+        }
268
+    }
269 269
 }
Please login to merge, or discard this patch.
ecrire/inc/precharger_objet.php 2 patches
Indentation   +121 added lines, -121 removed lines patch added patch discarded remove patch
@@ -17,7 +17,7 @@  discard block
 block discarded – undo
17 17
  **/
18 18
 
19 19
 if (!defined('_ECRIRE_INC_VERSION')) {
20
-	return;
20
+    return;
21 21
 }
22 22
 
23 23
 include_spip('inc/autoriser'); // necessaire si appel de l'espace public
@@ -45,69 +45,69 @@  discard block
 block discarded – undo
45 45
  **/
46 46
 function precharger_objet($type, $id_objet, $id_rubrique = 0, $lier_trad = 0, $champ_titre = 'titre') {
47 47
 
48
-	$table = table_objet_sql($type);
49
-	$_id_objet = id_table_objet($table);
50
-
51
-	// si l'objet existe deja, on retourne simplement ses valeurs
52
-	if (is_numeric($id_objet)) {
53
-		return sql_fetsel("*", $table, "$_id_objet=$id_objet");
54
-	}
55
-
56
-	// ici, on demande une creation.
57
-	// on prerempli certains elements : les champs si traduction,
58
-	// les id_rubrique et id_secteur si l'objet a ces champs
59
-	$desc = lister_tables_objets_sql($table);
60
-	# il faudrait calculer $champ_titre ici
61
-	$is_rubrique = isset($desc['field']['id_rubrique']);
62
-	$is_secteur = isset($desc['field']['id_secteur']);
63
-
64
-	// si demande de traduction
65
-	// on recupere les valeurs de la traduction
66
-	if ($lier_trad) {
67
-		if ($select = charger_fonction("precharger_traduction_" . $type, 'inc', true)) {
68
-			$row = $select($id_objet, $id_rubrique, $lier_trad);
69
-		} else {
70
-			$row = precharger_traduction_objet($type, $id_objet, $id_rubrique, $lier_trad, $champ_titre);
71
-		}
72
-	} else {
73
-		$row[$champ_titre] = '';
74
-		if ($is_rubrique) {
75
-			$row['id_rubrique'] = $id_rubrique;
76
-		}
77
-	}
78
-
79
-	// calcul de la rubrique
80
-	# note : comment faire pour des traductions sur l'objet rubriques ?
81
-	if ($is_rubrique) {
82
-		// appel du script a la racine, faut choisir 
83
-		// admin restreint ==> sa premiere rubrique
84
-		// autre ==> la derniere rubrique cree
85
-		if (!$row['id_rubrique']) {
86
-			if ($GLOBALS['connect_id_rubrique']) {
87
-				$row['id_rubrique'] = $id_rubrique = current($GLOBALS['connect_id_rubrique']);
88
-			} else {
89
-				$row_rub = sql_fetsel("id_rubrique", "spip_rubriques", "", "", "id_rubrique DESC", 1);
90
-				$row['id_rubrique'] = $id_rubrique = $row_rub['id_rubrique'];
91
-			}
92
-			if (!autoriser('creerarticledans', 'rubrique', $row['id_rubrique'])) {
93
-				// manque de chance, la rubrique n'est pas autorisee, on cherche un des secteurs autorises
94
-				$res = sql_select("id_rubrique", "spip_rubriques", "id_parent=0");
95
-				while (!autoriser('creerarticledans', 'rubrique', $row['id_rubrique']) && $row_rub = sql_fetch($res)) {
96
-					$row['id_rubrique'] = $row_rub['id_rubrique'];
97
-				}
98
-			}
99
-		}
100
-	}
101
-
102
-	// recuperer le secteur, pour affecter les bons champs extras
103
-	if ($id_rubrique and $is_secteur) {
104
-		if (!$row['id_secteur']) {
105
-			$row_rub = sql_getfetsel("id_secteur", "spip_rubriques", "id_rubrique=" . sql_quote($id_rubrique));
106
-			$row['id_secteur'] = $row_rub;
107
-		}
108
-	}
109
-
110
-	return $row;
48
+    $table = table_objet_sql($type);
49
+    $_id_objet = id_table_objet($table);
50
+
51
+    // si l'objet existe deja, on retourne simplement ses valeurs
52
+    if (is_numeric($id_objet)) {
53
+        return sql_fetsel("*", $table, "$_id_objet=$id_objet");
54
+    }
55
+
56
+    // ici, on demande une creation.
57
+    // on prerempli certains elements : les champs si traduction,
58
+    // les id_rubrique et id_secteur si l'objet a ces champs
59
+    $desc = lister_tables_objets_sql($table);
60
+    # il faudrait calculer $champ_titre ici
61
+    $is_rubrique = isset($desc['field']['id_rubrique']);
62
+    $is_secteur = isset($desc['field']['id_secteur']);
63
+
64
+    // si demande de traduction
65
+    // on recupere les valeurs de la traduction
66
+    if ($lier_trad) {
67
+        if ($select = charger_fonction("precharger_traduction_" . $type, 'inc', true)) {
68
+            $row = $select($id_objet, $id_rubrique, $lier_trad);
69
+        } else {
70
+            $row = precharger_traduction_objet($type, $id_objet, $id_rubrique, $lier_trad, $champ_titre);
71
+        }
72
+    } else {
73
+        $row[$champ_titre] = '';
74
+        if ($is_rubrique) {
75
+            $row['id_rubrique'] = $id_rubrique;
76
+        }
77
+    }
78
+
79
+    // calcul de la rubrique
80
+    # note : comment faire pour des traductions sur l'objet rubriques ?
81
+    if ($is_rubrique) {
82
+        // appel du script a la racine, faut choisir 
83
+        // admin restreint ==> sa premiere rubrique
84
+        // autre ==> la derniere rubrique cree
85
+        if (!$row['id_rubrique']) {
86
+            if ($GLOBALS['connect_id_rubrique']) {
87
+                $row['id_rubrique'] = $id_rubrique = current($GLOBALS['connect_id_rubrique']);
88
+            } else {
89
+                $row_rub = sql_fetsel("id_rubrique", "spip_rubriques", "", "", "id_rubrique DESC", 1);
90
+                $row['id_rubrique'] = $id_rubrique = $row_rub['id_rubrique'];
91
+            }
92
+            if (!autoriser('creerarticledans', 'rubrique', $row['id_rubrique'])) {
93
+                // manque de chance, la rubrique n'est pas autorisee, on cherche un des secteurs autorises
94
+                $res = sql_select("id_rubrique", "spip_rubriques", "id_parent=0");
95
+                while (!autoriser('creerarticledans', 'rubrique', $row['id_rubrique']) && $row_rub = sql_fetch($res)) {
96
+                    $row['id_rubrique'] = $row_rub['id_rubrique'];
97
+                }
98
+            }
99
+        }
100
+    }
101
+
102
+    // recuperer le secteur, pour affecter les bons champs extras
103
+    if ($id_rubrique and $is_secteur) {
104
+        if (!$row['id_secteur']) {
105
+            $row_rub = sql_getfetsel("id_secteur", "spip_rubriques", "id_rubrique=" . sql_quote($id_rubrique));
106
+            $row['id_secteur'] = $row_rub;
107
+        }
108
+    }
109
+
110
+    return $row;
111 111
 }
112 112
 
113 113
 
@@ -129,61 +129,61 @@  discard block
 block discarded – undo
129 129
  *     Couples clés / valeurs des champs du formulaire à charger
130 130
  **/
131 131
 function precharger_traduction_objet($type, $id_objet, $id_rubrique = 0, $lier_trad = 0, $champ_titre = 'titre') {
132
-	$table = table_objet_sql($type);
133
-	$_id_objet = id_table_objet($table);
134
-
135
-	// Recuperer les donnees de l'objet original
136
-	$row = sql_fetsel("*", $table, "$_id_objet=$lier_trad");
137
-	if ($row) {
138
-		include_spip('inc/filtres');
139
-		$row[$champ_titre] = filtrer_entites(objet_T($type, 'info_nouvelle_traduction')) . ' ' . $row[$champ_titre];
140
-	} else {
141
-		$row = array();
142
-	}
143
-
144
-	// on met l'objet dans une rubrique si l'objet le peut
145
-	$desc = lister_tables_objets_sql($table);
146
-	$is_rubrique = isset($desc['field']['id_rubrique']);
147
-
148
-	if ($is_rubrique) {
149
-		if ($id_rubrique) {
150
-			$row['id_rubrique'] = $id_rubrique;
151
-
152
-			return $row;
153
-		}
154
-		$id_rubrique = $row['id_rubrique'];
155
-
156
-
157
-		// Regler la langue, si possible, sur celle du redacteur
158
-		// Cela implique souvent de choisir une rubrique ou un secteur
159
-		if (in_array($GLOBALS['spip_lang'],
160
-			explode(',', $GLOBALS['meta']['langues_multilingue']))) {
161
-
162
-			// Si le menu de langues est autorise sur l'objet,
163
-			// on peut changer la langue quelle que soit la rubrique
164
-			// donc on reste dans la meme rubrique
165
-			if (in_array($table, explode(',', $GLOBALS['meta']['multi_objets']))) {
166
-				$row['id_rubrique'] = $row['id_rubrique']; # explicite :-)
167
-
168
-				// Sinon, chercher la rubrique la plus adaptee pour
169
-				// accueillir l'objet dans la langue du traducteur
170
-			} elseif ($is_rubrique and $GLOBALS['meta']['multi_rubriques'] == 'oui') {
171
-				if ($GLOBALS['meta']['multi_secteurs'] == 'oui') {
172
-					$id_parent = 0;
173
-				} else {
174
-					// on cherche une rubrique soeur dans la bonne langue
175
-					$row_rub = sql_fetsel("id_parent", "spip_rubriques", "id_rubrique=$id_rubrique");
176
-					$id_parent = $row_rub['id_parent'];
177
-				}
178
-
179
-				$row_rub = sql_fetsel("id_rubrique", "spip_rubriques",
180
-					"lang='" . $GLOBALS['spip_lang'] . "' AND id_parent=$id_parent");
181
-				if ($row_rub) {
182
-					$row['id_rubrique'] = $row_rub['id_rubrique'];
183
-				}
184
-			}
185
-		}
186
-	}
187
-
188
-	return $row;
132
+    $table = table_objet_sql($type);
133
+    $_id_objet = id_table_objet($table);
134
+
135
+    // Recuperer les donnees de l'objet original
136
+    $row = sql_fetsel("*", $table, "$_id_objet=$lier_trad");
137
+    if ($row) {
138
+        include_spip('inc/filtres');
139
+        $row[$champ_titre] = filtrer_entites(objet_T($type, 'info_nouvelle_traduction')) . ' ' . $row[$champ_titre];
140
+    } else {
141
+        $row = array();
142
+    }
143
+
144
+    // on met l'objet dans une rubrique si l'objet le peut
145
+    $desc = lister_tables_objets_sql($table);
146
+    $is_rubrique = isset($desc['field']['id_rubrique']);
147
+
148
+    if ($is_rubrique) {
149
+        if ($id_rubrique) {
150
+            $row['id_rubrique'] = $id_rubrique;
151
+
152
+            return $row;
153
+        }
154
+        $id_rubrique = $row['id_rubrique'];
155
+
156
+
157
+        // Regler la langue, si possible, sur celle du redacteur
158
+        // Cela implique souvent de choisir une rubrique ou un secteur
159
+        if (in_array($GLOBALS['spip_lang'],
160
+            explode(',', $GLOBALS['meta']['langues_multilingue']))) {
161
+
162
+            // Si le menu de langues est autorise sur l'objet,
163
+            // on peut changer la langue quelle que soit la rubrique
164
+            // donc on reste dans la meme rubrique
165
+            if (in_array($table, explode(',', $GLOBALS['meta']['multi_objets']))) {
166
+                $row['id_rubrique'] = $row['id_rubrique']; # explicite :-)
167
+
168
+                // Sinon, chercher la rubrique la plus adaptee pour
169
+                // accueillir l'objet dans la langue du traducteur
170
+            } elseif ($is_rubrique and $GLOBALS['meta']['multi_rubriques'] == 'oui') {
171
+                if ($GLOBALS['meta']['multi_secteurs'] == 'oui') {
172
+                    $id_parent = 0;
173
+                } else {
174
+                    // on cherche une rubrique soeur dans la bonne langue
175
+                    $row_rub = sql_fetsel("id_parent", "spip_rubriques", "id_rubrique=$id_rubrique");
176
+                    $id_parent = $row_rub['id_parent'];
177
+                }
178
+
179
+                $row_rub = sql_fetsel("id_rubrique", "spip_rubriques",
180
+                    "lang='" . $GLOBALS['spip_lang'] . "' AND id_parent=$id_parent");
181
+                if ($row_rub) {
182
+                    $row['id_rubrique'] = $row_rub['id_rubrique'];
183
+                }
184
+            }
185
+        }
186
+    }
187
+
188
+    return $row;
189 189
 }
Please login to merge, or discard this patch.
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -64,7 +64,7 @@  discard block
 block discarded – undo
64 64
 	// si demande de traduction
65 65
 	// on recupere les valeurs de la traduction
66 66
 	if ($lier_trad) {
67
-		if ($select = charger_fonction("precharger_traduction_" . $type, 'inc', true)) {
67
+		if ($select = charger_fonction("precharger_traduction_".$type, 'inc', true)) {
68 68
 			$row = $select($id_objet, $id_rubrique, $lier_trad);
69 69
 		} else {
70 70
 			$row = precharger_traduction_objet($type, $id_objet, $id_rubrique, $lier_trad, $champ_titre);
@@ -102,7 +102,7 @@  discard block
 block discarded – undo
102 102
 	// recuperer le secteur, pour affecter les bons champs extras
103 103
 	if ($id_rubrique and $is_secteur) {
104 104
 		if (!$row['id_secteur']) {
105
-			$row_rub = sql_getfetsel("id_secteur", "spip_rubriques", "id_rubrique=" . sql_quote($id_rubrique));
105
+			$row_rub = sql_getfetsel("id_secteur", "spip_rubriques", "id_rubrique=".sql_quote($id_rubrique));
106 106
 			$row['id_secteur'] = $row_rub;
107 107
 		}
108 108
 	}
@@ -136,7 +136,7 @@  discard block
 block discarded – undo
136 136
 	$row = sql_fetsel("*", $table, "$_id_objet=$lier_trad");
137 137
 	if ($row) {
138 138
 		include_spip('inc/filtres');
139
-		$row[$champ_titre] = filtrer_entites(objet_T($type, 'info_nouvelle_traduction')) . ' ' . $row[$champ_titre];
139
+		$row[$champ_titre] = filtrer_entites(objet_T($type, 'info_nouvelle_traduction')).' '.$row[$champ_titre];
140 140
 	} else {
141 141
 		$row = array();
142 142
 	}
@@ -177,7 +177,7 @@  discard block
 block discarded – undo
177 177
 				}
178 178
 
179 179
 				$row_rub = sql_fetsel("id_rubrique", "spip_rubriques",
180
-					"lang='" . $GLOBALS['spip_lang'] . "' AND id_parent=$id_parent");
180
+					"lang='".$GLOBALS['spip_lang']."' AND id_parent=$id_parent");
181 181
 				if ($row_rub) {
182 182
 					$row['id_rubrique'] = $row_rub['id_rubrique'];
183 183
 				}
Please login to merge, or discard this patch.
ecrire/inc/couleurs.php 2 patches
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
 /**
@@ -38,103 +38,103 @@  discard block
 block discarded – undo
38 38
  * @return array|string
39 39
  */
40 40
 function inc_couleurs_dist($choix = null, $ajouter = false) {
41
-	static $couleurs_spip = array(
42
-		// Saumon
43
-		4 => array(
44
-			"couleur_foncee" => "#CDA261",
45
-			"couleur_claire" => "#FFDDAA",
46
-			"couleur_lien" => "#AA6A09",
47
-			"couleur_lien_off" => "#B79562"
48
-		),
49
-		// Orange
50
-		3 => array(
51
-			"couleur_foncee" => "#fa9a00",
52
-			"couleur_claire" => "#ffc000",
53
-			"couleur_lien" => "#FF5B00",
54
-			"couleur_lien_off" => "#B49280"
55
-		),
56
-		// Rouge
57
-		8 => array(
58
-			"couleur_foncee" => "#DF4543",
59
-			"couleur_claire" => "#FAACB0",
60
-			"couleur_lien" => "#D0000A",
61
-			"couleur_lien_off" => "#D96067"
62
-		),
63
-		// Framboise
64
-		2 => array(
65
-			"couleur_foncee" =>  "#D51B60",
66
-			"couleur_claire" => "#EF91B4",
67
-			"couleur_lien" => "#db1762",
68
-			"couleur_lien_off" => "#E29FB6"
69
-		),
70
-		// Vert de gris
71
-		7 => array(
72
-			"couleur_foncee" => "#999966",
73
-			"couleur_claire" => "#CCCC99",
74
-			"couleur_lien" => "#666633",
75
-			"couleur_lien_off" => "#999966"
76
-		),
77
-		// Vert
78
-		1 => array(
79
-			"couleur_foncee" => "#9DBA00",
80
-			"couleur_claire" => "#C5E41C",
81
-			"couleur_lien" => "#657701",
82
-			"couleur_lien_off" => "#A6C113"
83
-		),
84
-		//  Bleu pastel
85
-		5 => array(
86
-			"couleur_foncee" => "#5da7c5",
87
-			"couleur_claire" => "#97d2e1",
88
-			"couleur_lien" => "#116587",
89
-			"couleur_lien_off" => "#81B7CD"
90
-		),
91
-		// Violet
92
-		9 => array(
93
-			"couleur_foncee" => "#8F8FBD",
94
-			"couleur_claire" => "#C4C4DD",
95
-			"couleur_lien" => "#6071A5",
96
-			"couleur_lien_off" => "#5C5C8C"
97
-		),
98
-		//  Gris
99
-		6 => array(
100
-			"couleur_foncee" => "#85909A",
101
-			"couleur_claire" => "#C0CAD4",
102
-			"couleur_lien" => "#3B5063",
103
-			"couleur_lien_off" => "#6D8499"
104
-		),
105
-		//  Gris
106
-		10 => array(
107
-			"couleur_foncee" => "#909090",
108
-			"couleur_claire" => "#D3D3D3",
109
-			"couleur_lien" => "#808080",
110
-			"couleur_lien_off" => "#909090"
111
-		),
112
-	);
41
+    static $couleurs_spip = array(
42
+        // Saumon
43
+        4 => array(
44
+            "couleur_foncee" => "#CDA261",
45
+            "couleur_claire" => "#FFDDAA",
46
+            "couleur_lien" => "#AA6A09",
47
+            "couleur_lien_off" => "#B79562"
48
+        ),
49
+        // Orange
50
+        3 => array(
51
+            "couleur_foncee" => "#fa9a00",
52
+            "couleur_claire" => "#ffc000",
53
+            "couleur_lien" => "#FF5B00",
54
+            "couleur_lien_off" => "#B49280"
55
+        ),
56
+        // Rouge
57
+        8 => array(
58
+            "couleur_foncee" => "#DF4543",
59
+            "couleur_claire" => "#FAACB0",
60
+            "couleur_lien" => "#D0000A",
61
+            "couleur_lien_off" => "#D96067"
62
+        ),
63
+        // Framboise
64
+        2 => array(
65
+            "couleur_foncee" =>  "#D51B60",
66
+            "couleur_claire" => "#EF91B4",
67
+            "couleur_lien" => "#db1762",
68
+            "couleur_lien_off" => "#E29FB6"
69
+        ),
70
+        // Vert de gris
71
+        7 => array(
72
+            "couleur_foncee" => "#999966",
73
+            "couleur_claire" => "#CCCC99",
74
+            "couleur_lien" => "#666633",
75
+            "couleur_lien_off" => "#999966"
76
+        ),
77
+        // Vert
78
+        1 => array(
79
+            "couleur_foncee" => "#9DBA00",
80
+            "couleur_claire" => "#C5E41C",
81
+            "couleur_lien" => "#657701",
82
+            "couleur_lien_off" => "#A6C113"
83
+        ),
84
+        //  Bleu pastel
85
+        5 => array(
86
+            "couleur_foncee" => "#5da7c5",
87
+            "couleur_claire" => "#97d2e1",
88
+            "couleur_lien" => "#116587",
89
+            "couleur_lien_off" => "#81B7CD"
90
+        ),
91
+        // Violet
92
+        9 => array(
93
+            "couleur_foncee" => "#8F8FBD",
94
+            "couleur_claire" => "#C4C4DD",
95
+            "couleur_lien" => "#6071A5",
96
+            "couleur_lien_off" => "#5C5C8C"
97
+        ),
98
+        //  Gris
99
+        6 => array(
100
+            "couleur_foncee" => "#85909A",
101
+            "couleur_claire" => "#C0CAD4",
102
+            "couleur_lien" => "#3B5063",
103
+            "couleur_lien_off" => "#6D8499"
104
+        ),
105
+        //  Gris
106
+        10 => array(
107
+            "couleur_foncee" => "#909090",
108
+            "couleur_claire" => "#D3D3D3",
109
+            "couleur_lien" => "#808080",
110
+            "couleur_lien_off" => "#909090"
111
+        ),
112
+    );
113 113
 
114
-	if (is_numeric($choix)) {
115
-		// Compatibilite ascendante (plug-ins notamment)
116
-		$GLOBALS["couleur_claire"] = $couleurs_spip[$choix]['couleur_claire'];
117
-		$GLOBALS["couleur_foncee"] = $couleurs_spip[$choix]['couleur_foncee'];
118
-		$GLOBALS["couleur_lien"] = $couleurs_spip[$choix]['couleur_lien'];
119
-		$GLOBALS["couleur_lien_off"] = $couleurs_spip[$choix]['couleur_lien_off'];
114
+    if (is_numeric($choix)) {
115
+        // Compatibilite ascendante (plug-ins notamment)
116
+        $GLOBALS["couleur_claire"] = $couleurs_spip[$choix]['couleur_claire'];
117
+        $GLOBALS["couleur_foncee"] = $couleurs_spip[$choix]['couleur_foncee'];
118
+        $GLOBALS["couleur_lien"] = $couleurs_spip[$choix]['couleur_lien'];
119
+        $GLOBALS["couleur_lien_off"] = $couleurs_spip[$choix]['couleur_lien_off'];
120 120
 
121
-		return
122
-			"couleur_claire=" . substr($couleurs_spip[$choix]['couleur_claire'], 1) .
123
-			'&couleur_foncee=' . substr($couleurs_spip[$choix]['couleur_foncee'], 1);
124
-	} else {
125
-		if (is_array($choix)) {
126
-			if ($ajouter) {
127
-				foreach ($choix as $c) {
128
-					$couleurs_spip[] = $c;
129
-				}
121
+        return
122
+            "couleur_claire=" . substr($couleurs_spip[$choix]['couleur_claire'], 1) .
123
+            '&couleur_foncee=' . substr($couleurs_spip[$choix]['couleur_foncee'], 1);
124
+    } else {
125
+        if (is_array($choix)) {
126
+            if ($ajouter) {
127
+                foreach ($choix as $c) {
128
+                    $couleurs_spip[] = $c;
129
+                }
130 130
 
131
-				return $couleurs_spip;
132
-			} else {
133
-				return $couleurs_spip = $choix;
134
-			}
135
-		}
131
+                return $couleurs_spip;
132
+            } else {
133
+                return $couleurs_spip = $choix;
134
+            }
135
+        }
136 136
 
137
-	}
137
+    }
138 138
 
139
-	return $couleurs_spip;
139
+    return $couleurs_spip;
140 140
 }
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -119,8 +119,8 @@
 block discarded – undo
119 119
 		$GLOBALS["couleur_lien_off"] = $couleurs_spip[$choix]['couleur_lien_off'];
120 120
 
121 121
 		return
122
-			"couleur_claire=" . substr($couleurs_spip[$choix]['couleur_claire'], 1) .
123
-			'&couleur_foncee=' . substr($couleurs_spip[$choix]['couleur_foncee'], 1);
122
+			"couleur_claire=".substr($couleurs_spip[$choix]['couleur_claire'], 1).
123
+			'&couleur_foncee='.substr($couleurs_spip[$choix]['couleur_foncee'], 1);
124 124
 	} else {
125 125
 		if (is_array($choix)) {
126 126
 			if ($ajouter) {
Please login to merge, or discard this patch.
ecrire/inc/notifications.php 2 patches
Indentation   +104 added lines, -104 removed lines patch added patch discarded remove patch
@@ -16,7 +16,7 @@  discard block
 block discarded – undo
16 16
  * @package SPIP\Core\Notifications
17 17
  **/
18 18
 if (!defined('_ECRIRE_INC_VERSION')) {
19
-	return;
19
+    return;
20 20
 }
21 21
 
22 22
 
@@ -33,16 +33,16 @@  discard block
 block discarded – undo
33 33
  */
34 34
 function inc_notifications_dist($quoi, $id = 0, $options = array()) {
35 35
 
36
-	// charger les fichiers qui veulent ajouter des definitions
37
-	// ou faire des trucs aussi dans le pipeline, ca fait deux api pour le prix d'une ...
38
-	pipeline('notifications', array('args' => array('quoi' => $quoi, 'id' => $id, 'options' => $options)));
36
+    // charger les fichiers qui veulent ajouter des definitions
37
+    // ou faire des trucs aussi dans le pipeline, ca fait deux api pour le prix d'une ...
38
+    pipeline('notifications', array('args' => array('quoi' => $quoi, 'id' => $id, 'options' => $options)));
39 39
 
40
-	if ($notification = charger_fonction($quoi, 'notifications', true)) {
41
-		spip_log("$notification($quoi,$id"
42
-			. ($options ? "," . serialize($options) : "")
43
-			. ")", 'notifications');
44
-		$notification($quoi, $id, $options);
45
-	}
40
+    if ($notification = charger_fonction($quoi, 'notifications', true)) {
41
+        spip_log("$notification($quoi,$id"
42
+            . ($options ? "," . serialize($options) : "")
43
+            . ")", 'notifications');
44
+        $notification($quoi, $id, $options);
45
+    }
46 46
 }
47 47
 
48 48
 /**
@@ -56,14 +56,14 @@  discard block
 block discarded – undo
56 56
  * @param array $exclure
57 57
  */
58 58
 function notifications_nettoyer_emails(&$emails, $exclure = array()) {
59
-	// filtrer et unifier
60
-	$emails = array_unique(array_filter(array_map('email_valide', array_map('trim', $emails))));
61
-	if ($exclure and count($exclure)) {
62
-		// nettoyer les exclusions d'abord
63
-		notifications_nettoyer_emails($exclure);
64
-		// faire un diff
65
-		$emails = array_diff($emails, $exclure);
66
-	}
59
+    // filtrer et unifier
60
+    $emails = array_unique(array_filter(array_map('email_valide', array_map('trim', $emails))));
61
+    if ($exclure and count($exclure)) {
62
+        // nettoyer les exclusions d'abord
63
+        notifications_nettoyer_emails($exclure);
64
+        // faire un diff
65
+        $emails = array_diff($emails, $exclure);
66
+    }
67 67
 }
68 68
 
69 69
 /**
@@ -78,77 +78,77 @@  discard block
 block discarded – undo
78 78
  * @param string $headers
79 79
  */
80 80
 function notifications_envoyer_mails($emails, $texte, $sujet = "", $from = "", $headers = "") {
81
-	// rien a faire si pas de texte !
82
-	if (!strlen($texte)) {
83
-		return;
84
-	}
85
-
86
-	// si on ne specifie qu'un email, le mettre dans un tableau
87
-	if (!is_array($emails)) {
88
-		$emails = explode(',', $emails);
89
-	}
90
-
91
-	notifications_nettoyer_emails($emails);
92
-
93
-	// tester si le mail est deja en html
94
-	if (strpos($texte, "<") !== false // eviter les tests suivants si possible
95
-		and $ttrim = trim($texte)
96
-		and substr($ttrim, 0, 1) == "<"
97
-		and substr($ttrim, -1, 1) == ">"
98
-		and stripos($ttrim, "</html>") !== false
99
-	) {
100
-
101
-		if (!strlen($sujet)) {
102
-			// dans ce cas on ruse un peu : extraire le sujet du title
103
-			if (preg_match(",<title>(.*)</title>,Uims", $texte, $m)) {
104
-				$sujet = $m[1];
105
-			} else {
106
-				// fallback, on prend le body si on le trouve
107
-				if (preg_match(",<body[^>]*>(.*)</body>,Uims", $texte, $m)) {
108
-					$ttrim = $m[1];
109
-				}
110
-
111
-				// et on extrait la premiere ligne de vrai texte...
112
-				// nettoyer le html et les retours chariots
113
-				$ttrim = textebrut($ttrim);
114
-				$ttrim = str_replace("\r\n", "\r", $ttrim);
115
-				$ttrim = str_replace("\r", "\n", $ttrim);
116
-				// decouper
117
-				$ttrim = explode("\n", trim($ttrim));
118
-				// extraire la premiere ligne de texte brut
119
-				$sujet = array_shift($ttrim);
120
-			}
121
-		}
122
-
123
-		// si besoin on ajoute le content-type dans les headers
124
-		if (stripos($headers, "Content-Type") === false) {
125
-			$headers .= "Content-Type: text/html\n";
126
-		}
127
-	}
128
-
129
-	// si le sujet est vide, extraire la premiere ligne du corps
130
-	// du mail qui est donc du texte
131
-	if (!strlen($sujet)) {
132
-		// nettoyer un peu les retours chariots
133
-		$texte = str_replace("\r\n", "\r", $texte);
134
-		$texte = str_replace("\r", "\n", $texte);
135
-		// decouper
136
-		$texte = explode("\n", trim($texte));
137
-		// extraire la premiere ligne
138
-		$sujet = array_shift($texte);
139
-		$texte = trim(implode("\n", $texte));
140
-	}
141
-
142
-	$envoyer_mail = charger_fonction('envoyer_mail', 'inc');
143
-	foreach ($emails as $email) {
144
-		// passer dans un pipeline qui permet un ajout eventuel
145
-		// (url de suivi des notifications par exemple)
146
-		$envoi = pipeline('notifications_envoyer_mails', array('email' => $email, 'sujet' => $sujet, 'texte' => $texte));
147
-		$email = $envoi['email'];
148
-
149
-		job_queue_add('envoyer_mail', ">$email : " . $envoi['sujet'],
150
-			array($email, $envoi['sujet'], $envoi['texte'], $from, $headers), 'inc/');
151
-	}
81
+    // rien a faire si pas de texte !
82
+    if (!strlen($texte)) {
83
+        return;
84
+    }
85
+
86
+    // si on ne specifie qu'un email, le mettre dans un tableau
87
+    if (!is_array($emails)) {
88
+        $emails = explode(',', $emails);
89
+    }
90
+
91
+    notifications_nettoyer_emails($emails);
92
+
93
+    // tester si le mail est deja en html
94
+    if (strpos($texte, "<") !== false // eviter les tests suivants si possible
95
+        and $ttrim = trim($texte)
96
+        and substr($ttrim, 0, 1) == "<"
97
+        and substr($ttrim, -1, 1) == ">"
98
+        and stripos($ttrim, "</html>") !== false
99
+    ) {
100
+
101
+        if (!strlen($sujet)) {
102
+            // dans ce cas on ruse un peu : extraire le sujet du title
103
+            if (preg_match(",<title>(.*)</title>,Uims", $texte, $m)) {
104
+                $sujet = $m[1];
105
+            } else {
106
+                // fallback, on prend le body si on le trouve
107
+                if (preg_match(",<body[^>]*>(.*)</body>,Uims", $texte, $m)) {
108
+                    $ttrim = $m[1];
109
+                }
110
+
111
+                // et on extrait la premiere ligne de vrai texte...
112
+                // nettoyer le html et les retours chariots
113
+                $ttrim = textebrut($ttrim);
114
+                $ttrim = str_replace("\r\n", "\r", $ttrim);
115
+                $ttrim = str_replace("\r", "\n", $ttrim);
116
+                // decouper
117
+                $ttrim = explode("\n", trim($ttrim));
118
+                // extraire la premiere ligne de texte brut
119
+                $sujet = array_shift($ttrim);
120
+            }
121
+        }
122
+
123
+        // si besoin on ajoute le content-type dans les headers
124
+        if (stripos($headers, "Content-Type") === false) {
125
+            $headers .= "Content-Type: text/html\n";
126
+        }
127
+    }
128
+
129
+    // si le sujet est vide, extraire la premiere ligne du corps
130
+    // du mail qui est donc du texte
131
+    if (!strlen($sujet)) {
132
+        // nettoyer un peu les retours chariots
133
+        $texte = str_replace("\r\n", "\r", $texte);
134
+        $texte = str_replace("\r", "\n", $texte);
135
+        // decouper
136
+        $texte = explode("\n", trim($texte));
137
+        // extraire la premiere ligne
138
+        $sujet = array_shift($texte);
139
+        $texte = trim(implode("\n", $texte));
140
+    }
141
+
142
+    $envoyer_mail = charger_fonction('envoyer_mail', 'inc');
143
+    foreach ($emails as $email) {
144
+        // passer dans un pipeline qui permet un ajout eventuel
145
+        // (url de suivi des notifications par exemple)
146
+        $envoi = pipeline('notifications_envoyer_mails', array('email' => $email, 'sujet' => $sujet, 'texte' => $texte));
147
+        $email = $envoi['email'];
148
+
149
+        job_queue_add('envoyer_mail', ">$email : " . $envoi['sujet'],
150
+            array($email, $envoi['sujet'], $envoi['texte'], $from, $headers), 'inc/');
151
+    }
152 152
 
153 153
 }
154 154
 
@@ -165,10 +165,10 @@  discard block
 block discarded – undo
165 165
  * @return string
166 166
  */
167 167
 function email_notification_objet($id_objet, $type_objet, $modele) {
168
-	$envoyer_mail = charger_fonction('envoyer_mail', 'inc'); // pour nettoyer_titre_email
169
-	$id_type = id_table_objet($type_objet);
168
+    $envoyer_mail = charger_fonction('envoyer_mail', 'inc'); // pour nettoyer_titre_email
169
+    $id_type = id_table_objet($type_objet);
170 170
 
171
-	return recuperer_fond($modele, array($id_type => $id_objet, "id" => $id_objet));
171
+    return recuperer_fond($modele, array($id_type => $id_objet, "id" => $id_objet));
172 172
 }
173 173
 
174 174
 /**
@@ -183,9 +183,9 @@  discard block
 block discarded – undo
183 183
  * @return string
184 184
  */
185 185
 function email_notification_article($id_article, $modele) {
186
-	$envoyer_mail = charger_fonction('envoyer_mail', 'inc'); // pour nettoyer_titre_email
186
+    $envoyer_mail = charger_fonction('envoyer_mail', 'inc'); // pour nettoyer_titre_email
187 187
 
188
-	return recuperer_fond($modele, array('id_article' => $id_article));
188
+    return recuperer_fond($modele, array('id_article' => $id_article));
189 189
 }
190 190
 
191 191
 /**
@@ -195,11 +195,11 @@  discard block
 block discarded – undo
195 195
  * @param int $id_article
196 196
  **/
197 197
 function notifier_publication_article($id_article) {
198
-	if ($GLOBALS['meta']["suivi_edito"] == "oui") {
199
-		$adresse_suivi = $GLOBALS['meta']["adresse_suivi"];
200
-		$texte = email_notification_article($id_article, "notifications/article_publie");
201
-		notifications_envoyer_mails($adresse_suivi, $texte);
202
-	}
198
+    if ($GLOBALS['meta']["suivi_edito"] == "oui") {
199
+        $adresse_suivi = $GLOBALS['meta']["adresse_suivi"];
200
+        $texte = email_notification_article($id_article, "notifications/article_publie");
201
+        notifications_envoyer_mails($adresse_suivi, $texte);
202
+    }
203 203
 }
204 204
 
205 205
 /**
@@ -209,9 +209,9 @@  discard block
 block discarded – undo
209 209
  * @param int $id_article
210 210
  **/
211 211
 function notifier_proposition_article($id_article) {
212
-	if ($GLOBALS['meta']["suivi_edito"] == "oui") {
213
-		$adresse_suivi = $GLOBALS['meta']["adresse_suivi"];
214
-		$texte = email_notification_article($id_article, "notifications/article_propose");
215
-		notifications_envoyer_mails($adresse_suivi, $texte);
216
-	}
212
+    if ($GLOBALS['meta']["suivi_edito"] == "oui") {
213
+        $adresse_suivi = $GLOBALS['meta']["adresse_suivi"];
214
+        $texte = email_notification_article($id_article, "notifications/article_propose");
215
+        notifications_envoyer_mails($adresse_suivi, $texte);
216
+    }
217 217
 }
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -39,7 +39,7 @@  discard block
 block discarded – undo
39 39
 
40 40
 	if ($notification = charger_fonction($quoi, 'notifications', true)) {
41 41
 		spip_log("$notification($quoi,$id"
42
-			. ($options ? "," . serialize($options) : "")
42
+			. ($options ? ",".serialize($options) : "")
43 43
 			. ")", 'notifications');
44 44
 		$notification($quoi, $id, $options);
45 45
 	}
@@ -146,7 +146,7 @@  discard block
 block discarded – undo
146 146
 		$envoi = pipeline('notifications_envoyer_mails', array('email' => $email, 'sujet' => $sujet, 'texte' => $texte));
147 147
 		$email = $envoi['email'];
148 148
 
149
-		job_queue_add('envoyer_mail', ">$email : " . $envoi['sujet'],
149
+		job_queue_add('envoyer_mail', ">$email : ".$envoi['sujet'],
150 150
 			array($email, $envoi['sujet'], $envoi['texte'], $from, $headers), 'inc/');
151 151
 	}
152 152
 
Please login to merge, or discard this patch.
ecrire/inc/surligne.php 2 patches
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -53,7 +53,7 @@  discard block
 block discarded – undo
53 53
 function surligner_mots($page, $surcharge_surligne = '') {
54 54
 	$surlignejs_engines = array(
55 55
 		array(
56
-			"," . str_replace(array("/", "."), array("\/", "\."), $GLOBALS['meta']['adresse_site']) . ",i",
56
+			",".str_replace(array("/", "."), array("\/", "\."), $GLOBALS['meta']['adresse_site']).",i",
57 57
 			",recherche=([^&]+),i"
58 58
 		), //SPIP
59 59
 		array(",^http://(www\.)?google\.,i", ",q=([^&]+),i"), // Google
@@ -89,20 +89,20 @@  discard block
 block discarded – undo
89 89
 			//good referrer found or var_recherche is not null
90 90
 			include_spip('inc/filtres');
91 91
 			$script = "
92
-      <script type='text/javascript' src='" . url_absolue(find_in_path('javascript/SearchHighlight.js')) . "'></script>
92
+      <script type='text/javascript' src='" . url_absolue(find_in_path('javascript/SearchHighlight.js'))."'></script>
93 93
       <script type='text/javascript'>/*<![CDATA[*/
94 94
       if (window.jQuery)
95 95
         (function(\$){\$(function(){
96 96
           \$(document).SearchHighlight({
97
-            tag_name:'" . (html5_permis() ? 'mark' : 'span') . "',
97
+            tag_name:'" . (html5_permis() ? 'mark' : 'span')."',
98 98
             style_name:'spip_surligne',
99 99
             exact:'whole',
100 100
             style_name_suffix:false,
101
-            engines:[/^" . str_replace(array("/", "."), array("\/", "\."), $GLOBALS['meta']['adresse_site']) . "/i,/recherche=([^&]+)/i],
101
+            engines:[/^" . str_replace(array("/", "."), array("\/", "\."), $GLOBALS['meta']['adresse_site'])."/i,/recherche=([^&]+)/i],
102 102
             highlight:'.surlignable',
103 103
             nohighlight:'.pas_surlignable'" .
104 104
 				($surcharge_surligne ? ",
105
-            keys:'$surcharge_surligne'" : "") . ",
105
+            keys:'$surcharge_surligne'" : "").",
106 106
             min_length: 3
107 107
           })
108 108
         });
Please login to merge, or discard this patch.
Indentation   +46 added lines, -46 removed lines patch added patch discarded remove patch
@@ -16,7 +16,7 @@  discard block
 block discarded – undo
16 16
  * @package SPIP\Core\Surligne
17 17
  **/
18 18
 if (!defined('_ECRIRE_INC_VERSION')) {
19
-	return;
19
+    return;
20 20
 }
21 21
 
22 22
 /**
@@ -35,44 +35,44 @@  discard block
 block discarded – undo
35 35
  *     Page HTML
36 36
  **/
37 37
 function surligner_mots($page, $surcharge_surligne = '') {
38
-	$surlignejs_engines = array(
39
-		array(
40
-			"," . str_replace(array("/", "."), array("\/", "\."), $GLOBALS['meta']['adresse_site']) . ",i",
41
-			",recherche=([^&]+),i"
42
-		), //SPIP
43
-		array(",^http://(www\.)?google\.,i", ",q=([^&]+),i"), // Google
44
-		array(",^http://(www\.)?search\.yahoo\.,i", ",p=([^&]+),i"), // Yahoo
45
-		array(",^http://(www\.)?search\.msn\.,i", ",q=([^&]+),i"), // MSN
46
-		array(",^http://(www\.)?search\.live\.,i", ",query=([^&]+),i"), // MSN Live
47
-		array(",^http://(www\.)?search\.aol\.,i", ",userQuery=([^&]+),i"), // AOL
48
-		array(",^http://(www\.)?ask\.com,i", ",q=([^&]+),i"), // Ask.com
49
-		array(",^http://(www\.)?altavista\.,i", ",q=([^&]+),i"), // AltaVista
50
-		array(",^http://(www\.)?feedster\.,i", ",q=([^&]+),i"), // Feedster
51
-		array(",^http://(www\.)?search\.lycos\.,i", ",q=([^&]+),i"), // Lycos
52
-		array(",^http://(www\.)?alltheweb\.,i", ",q=([^&]+),i"), // AllTheWeb
53
-		array(",^http://(www\.)?technorati\.com,i", ",([^\?\/]+)(?:\?.*)$,i"), // Technorati
54
-	);
38
+    $surlignejs_engines = array(
39
+        array(
40
+            "," . str_replace(array("/", "."), array("\/", "\."), $GLOBALS['meta']['adresse_site']) . ",i",
41
+            ",recherche=([^&]+),i"
42
+        ), //SPIP
43
+        array(",^http://(www\.)?google\.,i", ",q=([^&]+),i"), // Google
44
+        array(",^http://(www\.)?search\.yahoo\.,i", ",p=([^&]+),i"), // Yahoo
45
+        array(",^http://(www\.)?search\.msn\.,i", ",q=([^&]+),i"), // MSN
46
+        array(",^http://(www\.)?search\.live\.,i", ",query=([^&]+),i"), // MSN Live
47
+        array(",^http://(www\.)?search\.aol\.,i", ",userQuery=([^&]+),i"), // AOL
48
+        array(",^http://(www\.)?ask\.com,i", ",q=([^&]+),i"), // Ask.com
49
+        array(",^http://(www\.)?altavista\.,i", ",q=([^&]+),i"), // AltaVista
50
+        array(",^http://(www\.)?feedster\.,i", ",q=([^&]+),i"), // Feedster
51
+        array(",^http://(www\.)?search\.lycos\.,i", ",q=([^&]+),i"), // Lycos
52
+        array(",^http://(www\.)?alltheweb\.,i", ",q=([^&]+),i"), // AllTheWeb
53
+        array(",^http://(www\.)?technorati\.com,i", ",([^\?\/]+)(?:\?.*)$,i"), // Technorati
54
+    );
55 55
 
56 56
 
57
-	$ref = isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : null;
58
-	//avoid a js injection
59
-	if ($surcharge_surligne) {
60
-		$surcharge_surligne = preg_replace(",(?<!\\\\)((?:(?>\\\\){2})*)('),", "$1\\\\$2", $surcharge_surligne);
61
-		$surcharge_surligne = str_replace("\\", "\\\\", $surcharge_surligne);
62
-		if ($GLOBALS['meta']['charset'] == 'utf-8') {
63
-			include_spip('inc/charsets');
64
-			if (!is_utf8($surcharge_surligne)) {
65
-				$surcharge_surligne = utf8_encode($surcharge_surligne);
66
-			}
67
-		}
68
-		$surcharge_surligne = preg_replace(',\*$,', '', trim($surcharge_surligne)); # supprimer un * final
69
-	}
70
-	foreach ($surlignejs_engines as $engine) {
71
-		if ($surcharge_surligne || (preg_match($engine[0], $ref) && preg_match($engine[1], $ref))) {
57
+    $ref = isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : null;
58
+    //avoid a js injection
59
+    if ($surcharge_surligne) {
60
+        $surcharge_surligne = preg_replace(",(?<!\\\\)((?:(?>\\\\){2})*)('),", "$1\\\\$2", $surcharge_surligne);
61
+        $surcharge_surligne = str_replace("\\", "\\\\", $surcharge_surligne);
62
+        if ($GLOBALS['meta']['charset'] == 'utf-8') {
63
+            include_spip('inc/charsets');
64
+            if (!is_utf8($surcharge_surligne)) {
65
+                $surcharge_surligne = utf8_encode($surcharge_surligne);
66
+            }
67
+        }
68
+        $surcharge_surligne = preg_replace(',\*$,', '', trim($surcharge_surligne)); # supprimer un * final
69
+    }
70
+    foreach ($surlignejs_engines as $engine) {
71
+        if ($surcharge_surligne || (preg_match($engine[0], $ref) && preg_match($engine[1], $ref))) {
72 72
 
73
-			//good referrer found or var_recherche is not null
74
-			include_spip('inc/filtres');
75
-			$script = "
73
+            //good referrer found or var_recherche is not null
74
+            include_spip('inc/filtres');
75
+            $script = "
76 76
       <script type='text/javascript' src='" . url_absolue(find_in_path('javascript/SearchHighlight.js')) . "'></script>
77 77
       <script type='text/javascript'>/*<![CDATA[*/
78 78
       if (window.jQuery)
@@ -85,7 +85,7 @@  discard block
 block discarded – undo
85 85
             engines:[/^" . str_replace(array("/", "."), array("\/", "\."), $GLOBALS['meta']['adresse_site']) . "/i,/recherche=([^&]+)/i],
86 86
             highlight:'.surlignable',
87 87
             nohighlight:'.pas_surlignable'" .
88
-				($surcharge_surligne ? ",
88
+                ($surcharge_surligne ? ",
89 89
             keys:'$surcharge_surligne'" : "") . ",
90 90
             min_length: 3
91 91
           })
@@ -93,14 +93,14 @@  discard block
 block discarded – undo
93 93
       })(jQuery);
94 94
       /*]]>*/</script>
95 95
       ";
96
-			// on l'insere juste avant </head>, sinon tout en bas
97
-			if (is_null($l = strpos($page, '</head>'))) {
98
-				$l = strlen($page);
99
-			}
100
-			$page = substr_replace($page, $script, $l, 0);
101
-			break;
102
-		}
103
-	}
96
+            // on l'insere juste avant </head>, sinon tout en bas
97
+            if (is_null($l = strpos($page, '</head>'))) {
98
+                $l = strlen($page);
99
+            }
100
+            $page = substr_replace($page, $script, $l, 0);
101
+            break;
102
+        }
103
+    }
104 104
 
105
-	return $page;
105
+    return $page;
106 106
 }
Please login to merge, or discard this patch.
ecrire/inc/documents.php 4 patches
Indentation   +167 added lines, -167 removed lines patch added patch discarded remove patch
@@ -17,7 +17,7 @@  discard block
 block discarded – undo
17 17
  */
18 18
 
19 19
 if (!defined('_ECRIRE_INC_VERSION')) {
20
-	return;
20
+    return;
21 21
 }
22 22
 
23 23
 /**
@@ -30,11 +30,11 @@  discard block
 block discarded – undo
30 30
  * @return string
31 31
  */
32 32
 function set_spip_doc($fichier) {
33
-	if (strpos($fichier, _DIR_IMG) === 0) {
34
-		return substr($fichier, strlen(_DIR_IMG));
35
-	} else {
36
-		return $fichier;
37
-	} // ex: fichier distant
33
+    if (strpos($fichier, _DIR_IMG) === 0) {
34
+        return substr($fichier, strlen(_DIR_IMG));
35
+    } else {
36
+        return $fichier;
37
+    } // ex: fichier distant
38 38
 }
39 39
 
40 40
 /**
@@ -46,24 +46,24 @@  discard block
 block discarded – undo
46 46
  * @return bool|string
47 47
  */
48 48
 function get_spip_doc($fichier) {
49
-	// fichier distant
50
-	if (tester_url_absolue($fichier)) {
51
-		return $fichier;
52
-	}
53
-
54
-	// gestion d'erreurs, fichier=''
55
-	if (!strlen($fichier)) {
56
-		return false;
57
-	}
58
-
59
-	$fichier = (
60
-		strncmp($fichier, _DIR_IMG, strlen(_DIR_IMG)) != 0
61
-	)
62
-		? _DIR_IMG . $fichier
63
-		: $fichier;
64
-
65
-	// fichier normal
66
-	return $fichier;
49
+    // fichier distant
50
+    if (tester_url_absolue($fichier)) {
51
+        return $fichier;
52
+    }
53
+
54
+    // gestion d'erreurs, fichier=''
55
+    if (!strlen($fichier)) {
56
+        return false;
57
+    }
58
+
59
+    $fichier = (
60
+        strncmp($fichier, _DIR_IMG, strlen(_DIR_IMG)) != 0
61
+    )
62
+        ? _DIR_IMG . $fichier
63
+        : $fichier;
64
+
65
+    // fichier normal
66
+    return $fichier;
67 67
 }
68 68
 
69 69
 /**
@@ -77,21 +77,21 @@  discard block
 block discarded – undo
77 77
  * @return string
78 78
  */
79 79
 function creer_repertoire_documents($ext) {
80
-	$rep = sous_repertoire(_DIR_IMG, $ext);
80
+    $rep = sous_repertoire(_DIR_IMG, $ext);
81 81
 
82
-	if (!$ext or !$rep) {
83
-		spip_log("creer_repertoire_documents '$rep' interdit");
84
-		exit;
85
-	}
82
+    if (!$ext or !$rep) {
83
+        spip_log("creer_repertoire_documents '$rep' interdit");
84
+        exit;
85
+    }
86 86
 
87
-	// Cette variable de configuration peut etre posee par un plugin
88
-	// par exemple acces_restreint
89
-	if (isset($GLOBALS['meta']["creer_htaccess"]) and $GLOBALS['meta']["creer_htaccess"] == 'oui') {
90
-		include_spip('inc/acces');
91
-		verifier_htaccess($rep);
92
-	}
87
+    // Cette variable de configuration peut etre posee par un plugin
88
+    // par exemple acces_restreint
89
+    if (isset($GLOBALS['meta']["creer_htaccess"]) and $GLOBALS['meta']["creer_htaccess"] == 'oui') {
90
+        include_spip('inc/acces');
91
+        verifier_htaccess($rep);
92
+    }
93 93
 
94
-	return $rep;
94
+    return $rep;
95 95
 }
96 96
 
97 97
 /**
@@ -100,21 +100,21 @@  discard block
 block discarded – undo
100 100
  * @param string $nom
101 101
  */
102 102
 function effacer_repertoire_temporaire($nom) {
103
-	if ($d = opendir($nom)) {
104
-		while (($f = readdir($d)) !== false) {
105
-			if (is_file("$nom/$f")) {
106
-				spip_unlink("$nom/$f");
107
-			} else {
108
-				if ($f <> '.' and $f <> '..'
109
-					and is_dir("$nom/$f")
110
-				) {
111
-					effacer_repertoire_temporaire("$nom/$f");
112
-				}
113
-			}
114
-		}
115
-	}
116
-	closedir($d);
117
-	@rmdir($nom);
103
+    if ($d = opendir($nom)) {
104
+        while (($f = readdir($d)) !== false) {
105
+            if (is_file("$nom/$f")) {
106
+                spip_unlink("$nom/$f");
107
+            } else {
108
+                if ($f <> '.' and $f <> '..'
109
+                    and is_dir("$nom/$f")
110
+                ) {
111
+                    effacer_repertoire_temporaire("$nom/$f");
112
+                }
113
+            }
114
+        }
115
+    }
116
+    closedir($d);
117
+    @rmdir($nom);
118 118
 }
119 119
 
120 120
 //
@@ -129,28 +129,28 @@  discard block
 block discarded – undo
129 129
  */
130 130
 function copier_document($ext, $orig, $source) {
131 131
 
132
-	$orig = preg_replace(',\.\.+,', '.', $orig); // pas de .. dans le nom du doc
133
-	$dir = creer_repertoire_documents($ext);
134
-	$dest = preg_replace("/[^.=\w-]+/", "_",
135
-		translitteration(preg_replace("/\.([^.]+)$/", "",
136
-			preg_replace("/<[^>]*>/", '', basename($orig)))));
132
+    $orig = preg_replace(',\.\.+,', '.', $orig); // pas de .. dans le nom du doc
133
+    $dir = creer_repertoire_documents($ext);
134
+    $dest = preg_replace("/[^.=\w-]+/", "_",
135
+        translitteration(preg_replace("/\.([^.]+)$/", "",
136
+            preg_replace("/<[^>]*>/", '', basename($orig)))));
137 137
 
138
-	// ne pas accepter de noms de la forme -r90.jpg qui sont reserves
139
-	// pour les images transformees par rotation (action/documenter)
140
-	$dest = preg_replace(',-r(90|180|270)$,', '', $dest);
138
+    // ne pas accepter de noms de la forme -r90.jpg qui sont reserves
139
+    // pour les images transformees par rotation (action/documenter)
140
+    $dest = preg_replace(',-r(90|180|270)$,', '', $dest);
141 141
 
142
-	// Si le document "source" est deja au bon endroit, ne rien faire
143
-	if ($source == ($dir . $dest . '.' . $ext)) {
144
-		return $source;
145
-	}
142
+    // Si le document "source" est deja au bon endroit, ne rien faire
143
+    if ($source == ($dir . $dest . '.' . $ext)) {
144
+        return $source;
145
+    }
146 146
 
147
-	// sinon tourner jusqu'a trouver un numero correct
148
-	$n = 0;
149
-	while (@file_exists($newFile = $dir . $dest . ($n++ ? ('-' . $n) : '') . '.' . $ext)) {
150
-		;
151
-	}
147
+    // sinon tourner jusqu'a trouver un numero correct
148
+    $n = 0;
149
+    while (@file_exists($newFile = $dir . $dest . ($n++ ? ('-' . $n) : '') . '.' . $ext)) {
150
+        ;
151
+    }
152 152
 
153
-	return deplacer_fichier_upload($source, $newFile);
153
+    return deplacer_fichier_upload($source, $newFile);
154 154
 }
155 155
 
156 156
 /**
@@ -165,28 +165,28 @@  discard block
 block discarded – undo
165 165
  * @return bool|string
166 166
  */
167 167
 function determine_upload($type = '') {
168
-	if (!function_exists('autoriser')) {
169
-		include_spip('inc/autoriser');
170
-	}
171
-
172
-	if (!autoriser('chargerftp')
173
-		or $type == 'logos'
174
-	) # on ne le permet pas pour les logos
175
-	{
176
-		return false;
177
-	}
178
-
179
-	$repertoire = _DIR_TRANSFERT;
180
-	if (!@is_dir($repertoire)) {
181
-		$repertoire = str_replace(_DIR_TMP, '', $repertoire);
182
-		$repertoire = sous_repertoire(_DIR_TMP, $repertoire);
183
-	}
184
-
185
-	if (!$GLOBALS['visiteur_session']['restreint']) {
186
-		return $repertoire;
187
-	} else {
188
-		return sous_repertoire($repertoire, $GLOBALS['visiteur_session']['login']);
189
-	}
168
+    if (!function_exists('autoriser')) {
169
+        include_spip('inc/autoriser');
170
+    }
171
+
172
+    if (!autoriser('chargerftp')
173
+        or $type == 'logos'
174
+    ) # on ne le permet pas pour les logos
175
+    {
176
+        return false;
177
+    }
178
+
179
+    $repertoire = _DIR_TRANSFERT;
180
+    if (!@is_dir($repertoire)) {
181
+        $repertoire = str_replace(_DIR_TMP, '', $repertoire);
182
+        $repertoire = sous_repertoire(_DIR_TMP, $repertoire);
183
+    }
184
+
185
+    if (!$GLOBALS['visiteur_session']['restreint']) {
186
+        return $repertoire;
187
+    } else {
188
+        return sous_repertoire($repertoire, $GLOBALS['visiteur_session']['login']);
189
+    }
190 190
 }
191 191
 
192 192
 /**
@@ -205,35 +205,35 @@  discard block
 block discarded – undo
205 205
  * @return bool|mixed|string
206 206
  */
207 207
 function deplacer_fichier_upload($source, $dest, $move = false) {
208
-	// Securite
209
-	if (substr($dest, 0, strlen(_DIR_RACINE)) == _DIR_RACINE) {
210
-		$dest = _DIR_RACINE . preg_replace(',\.\.+,', '.', substr($dest, strlen(_DIR_RACINE)));
211
-	} else {
212
-		$dest = preg_replace(',\.\.+,', '.', $dest);
213
-	}
214
-
215
-	if ($move) {
216
-		$ok = @rename($source, $dest);
217
-	} else {
218
-		$ok = @copy($source, $dest);
219
-	}
220
-	if (!$ok) {
221
-		$ok = @move_uploaded_file($source, $dest);
222
-	}
223
-	if ($ok) {
224
-		@chmod($dest, _SPIP_CHMOD & ~0111);
225
-	} else {
226
-		$f = @fopen($dest, 'w');
227
-		if ($f) {
228
-			fclose($f);
229
-		} else {
230
-			include_spip('inc/flock');
231
-			raler_fichier($dest);
232
-		}
233
-		spip_unlink($dest);
234
-	}
235
-
236
-	return $ok ? $dest : false;
208
+    // Securite
209
+    if (substr($dest, 0, strlen(_DIR_RACINE)) == _DIR_RACINE) {
210
+        $dest = _DIR_RACINE . preg_replace(',\.\.+,', '.', substr($dest, strlen(_DIR_RACINE)));
211
+    } else {
212
+        $dest = preg_replace(',\.\.+,', '.', $dest);
213
+    }
214
+
215
+    if ($move) {
216
+        $ok = @rename($source, $dest);
217
+    } else {
218
+        $ok = @copy($source, $dest);
219
+    }
220
+    if (!$ok) {
221
+        $ok = @move_uploaded_file($source, $dest);
222
+    }
223
+    if ($ok) {
224
+        @chmod($dest, _SPIP_CHMOD & ~0111);
225
+    } else {
226
+        $f = @fopen($dest, 'w');
227
+        if ($f) {
228
+            fclose($f);
229
+        } else {
230
+            include_spip('inc/flock');
231
+            raler_fichier($dest);
232
+        }
233
+        spip_unlink($dest);
234
+    }
235
+
236
+    return $ok ? $dest : false;
237 237
 }
238 238
 
239 239
 
@@ -257,51 +257,51 @@  discard block
 block discarded – undo
257 257
  */
258 258
 function check_upload_error($error, $msg = '', $return = false) {
259 259
 
260
-	if (!$error) {
261
-		return false;
262
-	}
263
-
264
-	spip_log("Erreur upload $error -- cf. http://php.net/manual/fr/features.file-upload.errors.php");
265
-
266
-	switch ($error) {
267
-
268
-		case 4: /* UPLOAD_ERR_NO_FILE */
269
-			return true;
270
-
271
-		# on peut affiner les differents messages d'erreur
272
-		case 1: /* UPLOAD_ERR_INI_SIZE */
273
-			$msg = _T('upload_limit',
274
-				array('max' => ini_get('upload_max_filesize')));
275
-			break;
276
-		case 2: /* UPLOAD_ERR_FORM_SIZE */
277
-			$msg = _T('upload_limit',
278
-				array('max' => ini_get('upload_max_filesize')));
279
-			break;
280
-		case 3: /* UPLOAD_ERR_PARTIAL  */
281
-			$msg = _T('upload_limit',
282
-				array('max' => ini_get('upload_max_filesize')));
283
-			break;
284
-
285
-		default: /* autre */
286
-			if (!$msg) {
287
-				$msg = _T('pass_erreur') . ' ' . $error
288
-					. '<br />' . propre("[->http://php.net/manual/fr/features.file-upload.errors.php]");
289
-			}
290
-			break;
291
-	}
292
-
293
-	spip_log("erreur upload $error");
294
-	if ($return) {
295
-		return $msg;
296
-	}
297
-
298
-	if (_request("iframe") == "iframe") {
299
-		echo "<div class='upload_answer upload_error'>$msg</div>";
300
-		exit;
301
-	}
302
-
303
-	include_spip('inc/minipres');
304
-	echo minipres($msg,
305
-		"<div style='text-align: " . $GLOBALS['spip_lang_right'] . "'><a href='" . rawurldecode($GLOBALS['redirect']) . "'><button type='button'>" . _T('ecrire:bouton_suivant') . "</button></a></div>");
306
-	exit;
260
+    if (!$error) {
261
+        return false;
262
+    }
263
+
264
+    spip_log("Erreur upload $error -- cf. http://php.net/manual/fr/features.file-upload.errors.php");
265
+
266
+    switch ($error) {
267
+
268
+        case 4: /* UPLOAD_ERR_NO_FILE */
269
+            return true;
270
+
271
+        # on peut affiner les differents messages d'erreur
272
+        case 1: /* UPLOAD_ERR_INI_SIZE */
273
+            $msg = _T('upload_limit',
274
+                array('max' => ini_get('upload_max_filesize')));
275
+            break;
276
+        case 2: /* UPLOAD_ERR_FORM_SIZE */
277
+            $msg = _T('upload_limit',
278
+                array('max' => ini_get('upload_max_filesize')));
279
+            break;
280
+        case 3: /* UPLOAD_ERR_PARTIAL  */
281
+            $msg = _T('upload_limit',
282
+                array('max' => ini_get('upload_max_filesize')));
283
+            break;
284
+
285
+        default: /* autre */
286
+            if (!$msg) {
287
+                $msg = _T('pass_erreur') . ' ' . $error
288
+                    . '<br />' . propre("[->http://php.net/manual/fr/features.file-upload.errors.php]");
289
+            }
290
+            break;
291
+    }
292
+
293
+    spip_log("erreur upload $error");
294
+    if ($return) {
295
+        return $msg;
296
+    }
297
+
298
+    if (_request("iframe") == "iframe") {
299
+        echo "<div class='upload_answer upload_error'>$msg</div>";
300
+        exit;
301
+    }
302
+
303
+    include_spip('inc/minipres');
304
+    echo minipres($msg,
305
+        "<div style='text-align: " . $GLOBALS['spip_lang_right'] . "'><a href='" . rawurldecode($GLOBALS['redirect']) . "'><button type='button'>" . _T('ecrire:bouton_suivant') . "</button></a></div>");
306
+    exit;
307 307
 }
Please login to merge, or discard this patch.
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -171,10 +171,12 @@
 block discarded – undo
171 171
 
172 172
 	if (!autoriser('chargerftp')
173 173
 		or $type == 'logos'
174
-	) # on ne le permet pas pour les logos
174
+	) {
175
+	    # on ne le permet pas pour les logos
175 176
 	{
176 177
 		return false;
177 178
 	}
179
+	}
178 180
 
179 181
 	$repertoire = _DIR_TRANSFERT;
180 182
 	if (!@is_dir($repertoire)) {
Please login to merge, or discard this patch.
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -140,13 +140,13 @@  discard block
 block discarded – undo
140 140
 	$dest = preg_replace(',-r(90|180|270)$,', '', $dest);
141 141
 
142 142
 	// Si le document "source" est deja au bon endroit, ne rien faire
143
-	if ($source == ($dir . $dest . '.' . $ext)) {
143
+	if ($source == ($dir.$dest.'.'.$ext)) {
144 144
 		return $source;
145 145
 	}
146 146
 
147 147
 	// sinon tourner jusqu'a trouver un numero correct
148 148
 	$n = 0;
149
-	while (@file_exists($newFile = $dir . $dest . ($n++ ? ('-' . $n) : '') . '.' . $ext)) {
149
+	while (@file_exists($newFile = $dir.$dest.($n++ ? ('-'.$n) : '').'.'.$ext)) {
150 150
 		;
151 151
 	}
152 152
 
@@ -207,7 +207,7 @@  discard block
 block discarded – undo
207 207
 function deplacer_fichier_upload($source, $dest, $move = false) {
208 208
 	// Securite
209 209
 	if (substr($dest, 0, strlen(_DIR_RACINE)) == _DIR_RACINE) {
210
-		$dest = _DIR_RACINE . preg_replace(',\.\.+,', '.', substr($dest, strlen(_DIR_RACINE)));
210
+		$dest = _DIR_RACINE.preg_replace(',\.\.+,', '.', substr($dest, strlen(_DIR_RACINE)));
211 211
 	} else {
212 212
 		$dest = preg_replace(',\.\.+,', '.', $dest);
213 213
 	}
@@ -284,8 +284,8 @@  discard block
 block discarded – undo
284 284
 
285 285
 		default: /* autre */
286 286
 			if (!$msg) {
287
-				$msg = _T('pass_erreur') . ' ' . $error
288
-					. '<br />' . propre("[->http://php.net/manual/fr/features.file-upload.errors.php]");
287
+				$msg = _T('pass_erreur').' '.$error
288
+					. '<br />'.propre("[->http://php.net/manual/fr/features.file-upload.errors.php]");
289 289
 			}
290 290
 			break;
291 291
 	}
@@ -302,6 +302,6 @@  discard block
 block discarded – undo
302 302
 
303 303
 	include_spip('inc/minipres');
304 304
 	echo minipres($msg,
305
-		"<div style='text-align: " . $GLOBALS['spip_lang_right'] . "'><a href='" . rawurldecode($GLOBALS['redirect']) . "'><button type='button'>" . _T('ecrire:bouton_suivant') . "</button></a></div>");
305
+		"<div style='text-align: ".$GLOBALS['spip_lang_right']."'><a href='".rawurldecode($GLOBALS['redirect'])."'><button type='button'>"._T('ecrire:bouton_suivant')."</button></a></div>");
306 306
 	exit;
307 307
 }
Please login to merge, or discard this patch.
Doc Comments   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -43,7 +43,7 @@  discard block
 block discarded – undo
43 43
  * @uses _DIR_IMG
44 44
  *
45 45
  * @param string $fichier
46
- * @return bool|string
46
+ * @return string|false
47 47
  */
48 48
 function get_spip_doc($fichier) {
49 49
 	// fichier distant
@@ -125,7 +125,7 @@  discard block
 block discarded – undo
125 125
  * @param string $ext
126 126
  * @param string $orig
127 127
  * @param string $source
128
- * @return bool|mixed|string
128
+ * @return string|false
129 129
  */
130 130
 function copier_document($ext, $orig, $source) {
131 131
 
@@ -162,7 +162,7 @@  discard block
 block discarded – undo
162 162
  * @uses sous_repertoire()
163 163
  *
164 164
  * @param string $type
165
- * @return bool|string
165
+ * @return string
166 166
  */
167 167
 function determine_upload($type = '') {
168 168
 	if (!function_exists('autoriser')) {
@@ -202,7 +202,7 @@  discard block
 block discarded – undo
202 202
  * @param bool $move
203 203
  *     - `true` : on déplace le fichier source vers le fichier de destination
204 204
  *     - `false` : valeur par défaut. On ne fait que copier le fichier source vers la destination.
205
- * @return bool|mixed|string
205
+ * @return string|false
206 206
  */
207 207
 function deplacer_fichier_upload($source, $dest, $move = false) {
208 208
 	// Securite
Please login to merge, or discard this patch.
ecrire/inc/boutons.php 2 patches
Indentation   +79 added lines, -79 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
 /**
@@ -25,51 +25,51 @@  discard block
 block discarded – undo
25 25
  * privée ou dans un de ses sous menus
26 26
  */
27 27
 class Bouton {
28
-	/** @var string L'icone à mettre dans le bouton */
29
-	public $icone;
30
-
31
-	/** @var string Le nom de l'entrée d'i18n associé */
32
-	public $libelle;
33
-
34
-	/** @var null|string L'URL de la page (null => ?exec=nom) */
35
-	public $url = null;
36
-
37
-	/** @var null|string|array Arguments supplementaires de l'URL */
38
-	public $urlArg = null;
39
-
40
-	/** @var null|string URL du javascript */
41
-	public $url2 = null;
42
-
43
-	/** @var null|string Pour ouvrir dans une fenetre a part */
44
-	public $target = null;
45
-
46
-	/** @var null|mixed Sous-barre de boutons / onglets */
47
-	public $sousmenu = null;
48
-
49
-	/**
50
-	 * Définit un bouton
51
-	 *
52
-	 * @param string $icone
53
-	 *    L'icone à mettre dans le bouton
54
-	 * @param string $libelle
55
-	 *    Le nom de l'entrée i18n associé
56
-	 * @param null|string $url
57
-	 *    L'URL de la page
58
-	 * @param null|string|array $urlArg
59
-	 *    Arguments supplémentaires de l'URL
60
-	 * @param null|string $url2
61
-	 *    URL du javascript
62
-	 * @param null|mixed $target
63
-	 *    Pour ouvrir une fenêtre à part
64
-	 */
65
-	public function __construct($icone, $libelle, $url = null, $urlArg = null, $url2 = null, $target = null) {
66
-		$this->icone = $icone;
67
-		$this->libelle = $libelle;
68
-		$this->url = $url;
69
-		$this->urlArg = $urlArg;
70
-		$this->url2 = $url2;
71
-		$this->target = $target;
72
-	}
28
+    /** @var string L'icone à mettre dans le bouton */
29
+    public $icone;
30
+
31
+    /** @var string Le nom de l'entrée d'i18n associé */
32
+    public $libelle;
33
+
34
+    /** @var null|string L'URL de la page (null => ?exec=nom) */
35
+    public $url = null;
36
+
37
+    /** @var null|string|array Arguments supplementaires de l'URL */
38
+    public $urlArg = null;
39
+
40
+    /** @var null|string URL du javascript */
41
+    public $url2 = null;
42
+
43
+    /** @var null|string Pour ouvrir dans une fenetre a part */
44
+    public $target = null;
45
+
46
+    /** @var null|mixed Sous-barre de boutons / onglets */
47
+    public $sousmenu = null;
48
+
49
+    /**
50
+     * Définit un bouton
51
+     *
52
+     * @param string $icone
53
+     *    L'icone à mettre dans le bouton
54
+     * @param string $libelle
55
+     *    Le nom de l'entrée i18n associé
56
+     * @param null|string $url
57
+     *    L'URL de la page
58
+     * @param null|string|array $urlArg
59
+     *    Arguments supplémentaires de l'URL
60
+     * @param null|string $url2
61
+     *    URL du javascript
62
+     * @param null|mixed $target
63
+     *    Pour ouvrir une fenêtre à part
64
+     */
65
+    public function __construct($icone, $libelle, $url = null, $urlArg = null, $url2 = null, $target = null) {
66
+        $this->icone = $icone;
67
+        $this->libelle = $libelle;
68
+        $this->url = $url;
69
+        $this->urlArg = $urlArg;
70
+        $this->url2 = $url2;
71
+        $this->target = $target;
72
+    }
73 73
 }
74 74
 
75 75
 
@@ -86,32 +86,32 @@  discard block
 block discarded – undo
86 86
  */
87 87
 function definir_barre_onglets($script) {
88 88
 
89
-	$onglets = array();
90
-	$liste_onglets = array();
91
-
92
-	// ajouter les onglets issus des plugin via paquet.xml
93
-	if (function_exists('onglets_plugins')) {
94
-		$liste_onglets = onglets_plugins();
95
-	}
96
-
97
-
98
-	foreach ($liste_onglets as $id => $infos) {
99
-		if (($parent = $infos['parent'])
100
-			&& $parent == $script
101
-			&& autoriser('onglet', "_$id")
102
-		) {
103
-			$onglets[$id] = new Bouton(
104
-				isset($infos['icone']) ? find_in_theme($infos['icone']) : '',  // icone
105
-				$infos['titre'],  // titre
106
-				(isset($infos['action']) and $infos['action'])
107
-					? generer_url_ecrire($infos['action'],
108
-					(isset($infos['parametres']) and $infos['parametres']) ? $infos['parametres'] : '')
109
-					: null
110
-			);
111
-		}
112
-	}
113
-
114
-	return pipeline('ajouter_onglets', array('data' => $onglets, 'args' => $script));
89
+    $onglets = array();
90
+    $liste_onglets = array();
91
+
92
+    // ajouter les onglets issus des plugin via paquet.xml
93
+    if (function_exists('onglets_plugins')) {
94
+        $liste_onglets = onglets_plugins();
95
+    }
96
+
97
+
98
+    foreach ($liste_onglets as $id => $infos) {
99
+        if (($parent = $infos['parent'])
100
+            && $parent == $script
101
+            && autoriser('onglet', "_$id")
102
+        ) {
103
+            $onglets[$id] = new Bouton(
104
+                isset($infos['icone']) ? find_in_theme($infos['icone']) : '',  // icone
105
+                $infos['titre'],  // titre
106
+                (isset($infos['action']) and $infos['action'])
107
+                    ? generer_url_ecrire($infos['action'],
108
+                    (isset($infos['parametres']) and $infos['parametres']) ? $infos['parametres'] : '')
109
+                    : null
110
+            );
111
+        }
112
+    }
113
+
114
+    return pipeline('ajouter_onglets', array('data' => $onglets, 'args' => $script));
115 115
 }
116 116
 
117 117
 
@@ -130,14 +130,14 @@  discard block
 block discarded – undo
130 130
  * @return string
131 131
  */
132 132
 function barre_onglets($rubrique, $ongletCourant, $class = "barre_onglet") {
133
-	include_spip('inc/presentation');
133
+    include_spip('inc/presentation');
134 134
 
135
-	$res = '';
135
+    $res = '';
136 136
 
137
-	foreach (definir_barre_onglets($rubrique) as $exec => $onglet) {
138
-		$url = $onglet->url ? $onglet->url : generer_url_ecrire($exec);
139
-		$res .= onglet(_T($onglet->libelle), $url, $exec, $ongletCourant, $onglet->icone);
140
-	}
137
+    foreach (definir_barre_onglets($rubrique) as $exec => $onglet) {
138
+        $url = $onglet->url ? $onglet->url : generer_url_ecrire($exec);
139
+        $res .= onglet(_T($onglet->libelle), $url, $exec, $ongletCourant, $onglet->icone);
140
+    }
141 141
 
142
-	return !$res ? '' : (debut_onglet($class) . $res . fin_onglet());
142
+    return !$res ? '' : (debut_onglet($class) . $res . fin_onglet());
143 143
 }
Please login to merge, or discard this patch.
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -101,8 +101,8 @@  discard block
 block discarded – undo
101 101
 			&& autoriser('onglet', "_$id")
102 102
 		) {
103 103
 			$onglets[$id] = new Bouton(
104
-				isset($infos['icone']) ? find_in_theme($infos['icone']) : '',  // icone
105
-				$infos['titre'],  // titre
104
+				isset($infos['icone']) ? find_in_theme($infos['icone']) : '', // icone
105
+				$infos['titre'], // titre
106 106
 				(isset($infos['action']) and $infos['action'])
107 107
 					? generer_url_ecrire($infos['action'],
108 108
 					(isset($infos['parametres']) and $infos['parametres']) ? $infos['parametres'] : '')
@@ -139,5 +139,5 @@  discard block
 block discarded – undo
139 139
 		$res .= onglet(_T($onglet->libelle), $url, $exec, $ongletCourant, $onglet->icone);
140 140
 	}
141 141
 
142
-	return !$res ? '' : (debut_onglet($class) . $res . fin_onglet());
142
+	return !$res ? '' : (debut_onglet($class).$res.fin_onglet());
143 143
 }
Please login to merge, or discard this patch.
ecrire/inc/selectionner.php 2 patches
Indentation   +87 added lines, -87 removed lines patch added patch discarded remove patch
@@ -17,7 +17,7 @@  discard block
 block discarded – undo
17 17
  **/
18 18
 
19 19
 if (!defined('_ECRIRE_INC_VERSION')) {
20
-	return;
20
+    return;
21 21
 }
22 22
 
23 23
 include_spip('inc/filtres');
@@ -46,47 +46,47 @@  discard block
 block discarded – undo
46 46
  **/
47 47
 function inc_selectionner_dist($sel, $idom = "", $exclus = 0, $aff_racine = false, $recur = true, $do = 'aff') {
48 48
 
49
-	if ($recur) {
50
-		$recur = mini_hier($sel);
51
-	} else {
52
-		$sel = 0;
53
-	}
49
+    if ($recur) {
50
+        $recur = mini_hier($sel);
51
+    } else {
52
+        $sel = 0;
53
+    }
54 54
 
55
-	if ($aff_racine) {
56
-		$info = generer_url_ecrire('informer', "type=rubrique&rac=$idom&do=$do&id=");
57
-		$idom3 = $idom . "_selection";
55
+    if ($aff_racine) {
56
+        $info = generer_url_ecrire('informer', "type=rubrique&rac=$idom&do=$do&id=");
57
+        $idom3 = $idom . "_selection";
58 58
 
59
-		$onClick = "jQuery(this).parent().addClass('on');jQuery('#choix_parent_principal .on').removeClass('on'); aff_selection(0, '$idom3', '$info', event);return false;";
59
+        $onClick = "jQuery(this).parent().addClass('on');jQuery('#choix_parent_principal .on').removeClass('on'); aff_selection(0, '$idom3', '$info', event);return false;";
60 60
 
61
-		$ondbClick = strtr(str_replace("'", "&#8217;",
62
-			str_replace('"', "&#34;",
63
-				textebrut(_T('info_racine_site')))),
64
-			"\n\r", "  ");
61
+        $ondbClick = strtr(str_replace("'", "&#8217;",
62
+            str_replace('"', "&#34;",
63
+                textebrut(_T('info_racine_site')))),
64
+            "\n\r", "  ");
65 65
 
66
-		$js_func = $do . '_selection_titre';
67
-		$ondbClick = "$js_func('$ondbClick',0,'selection_rubrique','id_parent');";
66
+        $js_func = $do . '_selection_titre';
67
+        $ondbClick = "$js_func('$ondbClick',0,'selection_rubrique','id_parent');";
68 68
 
69
-		$aff_racine = "<div class='petite-racine item'>"
70
-			. "<a href='#'"
71
-			. "onclick=\""
72
-			. $onClick
73
-			. "\"\nondbclick=\""
74
-			. $ondbClick
75
-			. $onClick
76
-			. "\">"
77
-			. _T("info_racine_site")
78
-			. "</a></div>";
79
-	}
69
+        $aff_racine = "<div class='petite-racine item'>"
70
+            . "<a href='#'"
71
+            . "onclick=\""
72
+            . $onClick
73
+            . "\"\nondbclick=\""
74
+            . $ondbClick
75
+            . $onClick
76
+            . "\">"
77
+            . _T("info_racine_site")
78
+            . "</a></div>";
79
+    }
80 80
 
81
-	$url_init = generer_url_ecrire('plonger', "rac=$idom&exclus=$exclus&id=0&col=1&do=$do");
81
+    $url_init = generer_url_ecrire('plonger', "rac=$idom&exclus=$exclus&id=0&col=1&do=$do");
82 82
 
83
-	$plonger = charger_fonction('plonger', 'inc');
84
-	$plonger_r = $plonger($sel, $idom, $recur, 1, $exclus, $do);
83
+    $plonger = charger_fonction('plonger', 'inc');
84
+    $plonger_r = $plonger($sel, $idom, $recur, 1, $exclus, $do);
85 85
 
86
-	// url completee par la fonction JS onkeypress_rechercher
87
-	$url = generer_url_ecrire('rechercher', "exclus=$exclus&rac=$idom&do=$do&type=");
86
+    // url completee par la fonction JS onkeypress_rechercher
87
+    $url = generer_url_ecrire('rechercher', "exclus=$exclus&rac=$idom&do=$do&type=");
88 88
 
89
-	return construire_selectionner_hierarchie($idom, $plonger_r, $aff_racine, $url, 'id_parent', $url_init);
89
+    return construire_selectionner_hierarchie($idom, $plonger_r, $aff_racine, $url, 'id_parent', $url_init);
90 90
 }
91 91
 
92 92
 /**
@@ -104,55 +104,55 @@  discard block
 block discarded – undo
104 104
  **/
105 105
 function construire_selectionner_hierarchie($idom, $liste, $racine, $url, $name, $url_init = '') {
106 106
 
107
-	$idom1 = $idom . "_champ_recherche";
108
-	$idom2 = $idom . "_principal";
109
-	$idom3 = $idom . "_selection";
110
-	$idom4 = $idom . "_col_1";
111
-	$idom5 = 'img_' . $idom4;
112
-	$idom6 = $idom . "_fonc";
113
-
114
-	return "<div id='$idom'>"
115
-	. "<a id='$idom6' style='visibility: hidden;'"
116
-	. ($url_init ? "\nhref='$url_init'" : '')
117
-	. "></a>"
118
-	. "<div class='recherche_rapide_parent'>"
119
-	. http_img_pack("searching.gif", "*",
120
-		"style='visibility: hidden;float:" . $GLOBALS['spip_lang_right'] . "' id='$idom5'")
121
-	. ""
122
-	. "<input style='width: 100px;float:" . $GLOBALS['spip_lang_right'] . ";' type='search' id='$idom1'"
123
-	// eliminer Return car il provoque la soumission (balise unique)
124
-	// et eliminer Tab pour la navigation au clavier
125
-	// ce serait encore mieux de ne le faire que s'il y a encore plusieurs
126
-	// resultats retournes par la recherche
127
-	. "\nonkeypress=\"k=event.keyCode;if (k==13 || k==3 || k==9){return false;}\""
128
-	// lancer la recherche apres le filtrage ci-dessus sauf sur le tab (navigation au clavier)
129
-	. "\nonkeyup=\"if(event.keyCode==9){return false;};return onkey_rechercher(this.value,"
130
-	// la destination de la recherche
131
-	. "'$idom4'"
107
+    $idom1 = $idom . "_champ_recherche";
108
+    $idom2 = $idom . "_principal";
109
+    $idom3 = $idom . "_selection";
110
+    $idom4 = $idom . "_col_1";
111
+    $idom5 = 'img_' . $idom4;
112
+    $idom6 = $idom . "_fonc";
113
+
114
+    return "<div id='$idom'>"
115
+    . "<a id='$idom6' style='visibility: hidden;'"
116
+    . ($url_init ? "\nhref='$url_init'" : '')
117
+    . "></a>"
118
+    . "<div class='recherche_rapide_parent'>"
119
+    . http_img_pack("searching.gif", "*",
120
+        "style='visibility: hidden;float:" . $GLOBALS['spip_lang_right'] . "' id='$idom5'")
121
+    . ""
122
+    . "<input style='width: 100px;float:" . $GLOBALS['spip_lang_right'] . ";' type='search' id='$idom1'"
123
+    // eliminer Return car il provoque la soumission (balise unique)
124
+    // et eliminer Tab pour la navigation au clavier
125
+    // ce serait encore mieux de ne le faire que s'il y a encore plusieurs
126
+    // resultats retournes par la recherche
127
+    . "\nonkeypress=\"k=event.keyCode;if (k==13 || k==3 || k==9){return false;}\""
128
+    // lancer la recherche apres le filtrage ci-dessus sauf sur le tab (navigation au clavier)
129
+    . "\nonkeyup=\"if(event.keyCode==9){return false;};return onkey_rechercher(this.value,"
130
+    // la destination de la recherche
131
+    . "'$idom4'"
132 132
 #	. "this.parentNode.parentNode.parentNode.parentNode.nextSibling.firstChild.id"
133
-	. ",'"
134
-	// l'url effectuant la recherche
135
-	. $url
136
-	. "',"
137
-	// le noeud contenant un gif anime
138
-	// . "'idom5'"
139
-	. "this.parentNode.previousSibling.firstChild"
140
-	. ",'"
141
-	// la valeur de l'attribut Name a remplir
142
-	. $name
143
-	. "','"
144
-	// noeud invisible memorisant l'URL initiale (pour re-initialisation)
145
-	. $idom6
146
-	. "')\""
147
-	. " />"
148
-	. "\n</div>"
149
-	. ($racine ? "<div>$racine</div>" : "")
150
-	. "<div id='"
151
-	. $idom2
152
-	. "'><div id='$idom4'"
153
-	. " class=''>"
154
-	. $liste
155
-	. "</div></div>\n<div id='$idom3'></div></div>\n";
133
+    . ",'"
134
+    // l'url effectuant la recherche
135
+    . $url
136
+    . "',"
137
+    // le noeud contenant un gif anime
138
+    // . "'idom5'"
139
+    . "this.parentNode.previousSibling.firstChild"
140
+    . ",'"
141
+    // la valeur de l'attribut Name a remplir
142
+    . $name
143
+    . "','"
144
+    // noeud invisible memorisant l'URL initiale (pour re-initialisation)
145
+    . $idom6
146
+    . "')\""
147
+    . " />"
148
+    . "\n</div>"
149
+    . ($racine ? "<div>$racine</div>" : "")
150
+    . "<div id='"
151
+    . $idom2
152
+    . "'><div id='$idom4'"
153
+    . " class=''>"
154
+    . $liste
155
+    . "</div></div>\n<div id='$idom3'></div></div>\n";
156 156
 }
157 157
 
158 158
 /**
@@ -164,11 +164,11 @@  discard block
 block discarded – undo
164 164
  **/
165 165
 function mini_hier($id_rubrique) {
166 166
 
167
-	$liste = $id_rubrique;
168
-	$id_rubrique = intval($id_rubrique);
169
-	while ($id_rubrique = sql_getfetsel("id_parent", "spip_rubriques", "id_rubrique = " . $id_rubrique)) {
170
-		$liste = $id_rubrique . ",$liste";
171
-	}
167
+    $liste = $id_rubrique;
168
+    $id_rubrique = intval($id_rubrique);
169
+    while ($id_rubrique = sql_getfetsel("id_parent", "spip_rubriques", "id_rubrique = " . $id_rubrique)) {
170
+        $liste = $id_rubrique . ",$liste";
171
+    }
172 172
 
173
-	return explode(',', "0,$liste");
173
+    return explode(',', "0,$liste");
174 174
 }
Please login to merge, or discard this patch.
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -54,7 +54,7 @@  discard block
 block discarded – undo
54 54
 
55 55
 	if ($aff_racine) {
56 56
 		$info = generer_url_ecrire('informer', "type=rubrique&rac=$idom&do=$do&id=");
57
-		$idom3 = $idom . "_selection";
57
+		$idom3 = $idom."_selection";
58 58
 
59 59
 		$onClick = "jQuery(this).parent().addClass('on');jQuery('#choix_parent_principal .on').removeClass('on'); aff_selection(0, '$idom3', '$info', event);return false;";
60 60
 
@@ -63,7 +63,7 @@  discard block
 block discarded – undo
63 63
 				textebrut(_T('info_racine_site')))),
64 64
 			"\n\r", "  ");
65 65
 
66
-		$js_func = $do . '_selection_titre';
66
+		$js_func = $do.'_selection_titre';
67 67
 		$ondbClick = "$js_func('$ondbClick',0,'selection_rubrique','id_parent');";
68 68
 
69 69
 		$aff_racine = "<div class='petite-racine item'>"
@@ -104,12 +104,12 @@  discard block
 block discarded – undo
104 104
  **/
105 105
 function construire_selectionner_hierarchie($idom, $liste, $racine, $url, $name, $url_init = '') {
106 106
 
107
-	$idom1 = $idom . "_champ_recherche";
108
-	$idom2 = $idom . "_principal";
109
-	$idom3 = $idom . "_selection";
110
-	$idom4 = $idom . "_col_1";
111
-	$idom5 = 'img_' . $idom4;
112
-	$idom6 = $idom . "_fonc";
107
+	$idom1 = $idom."_champ_recherche";
108
+	$idom2 = $idom."_principal";
109
+	$idom3 = $idom."_selection";
110
+	$idom4 = $idom."_col_1";
111
+	$idom5 = 'img_'.$idom4;
112
+	$idom6 = $idom."_fonc";
113 113
 
114 114
 	return "<div id='$idom'>"
115 115
 	. "<a id='$idom6' style='visibility: hidden;'"
@@ -117,9 +117,9 @@  discard block
 block discarded – undo
117 117
 	. "></a>"
118 118
 	. "<div class='recherche_rapide_parent'>"
119 119
 	. http_img_pack("searching.gif", "*",
120
-		"style='visibility: hidden;float:" . $GLOBALS['spip_lang_right'] . "' id='$idom5'")
120
+		"style='visibility: hidden;float:".$GLOBALS['spip_lang_right']."' id='$idom5'")
121 121
 	. ""
122
-	. "<input style='width: 100px;float:" . $GLOBALS['spip_lang_right'] . ";' type='search' id='$idom1'"
122
+	. "<input style='width: 100px;float:".$GLOBALS['spip_lang_right'].";' type='search' id='$idom1'"
123 123
 	// eliminer Return car il provoque la soumission (balise unique)
124 124
 	// et eliminer Tab pour la navigation au clavier
125 125
 	// ce serait encore mieux de ne le faire que s'il y a encore plusieurs
@@ -166,8 +166,8 @@  discard block
 block discarded – undo
166 166
 
167 167
 	$liste = $id_rubrique;
168 168
 	$id_rubrique = intval($id_rubrique);
169
-	while ($id_rubrique = sql_getfetsel("id_parent", "spip_rubriques", "id_rubrique = " . $id_rubrique)) {
170
-		$liste = $id_rubrique . ",$liste";
169
+	while ($id_rubrique = sql_getfetsel("id_parent", "spip_rubriques", "id_rubrique = ".$id_rubrique)) {
170
+		$liste = $id_rubrique.",$liste";
171 171
 	}
172 172
 
173 173
 	return explode(',', "0,$liste");
Please login to merge, or discard this patch.