Completed
Push — spip-3.0 ( 484b62...e817f1 )
by cam
34:33
created
ecrire/balise/formulaire_ecrire_auteur.php 1 patch
Indentation   +32 added lines, -32 removed lines patch added patch discarded remove patch
@@ -20,42 +20,42 @@
 block discarded – undo
20 20
 
21 21
 // http://doc.spip.org/@balise_FORMULAIRE_ECRIRE_AUTEUR
22 22
 function balise_FORMULAIRE_ECRIRE_AUTEUR ($p) {
23
-	return calculer_balise_dynamique($p,'FORMULAIRE_ECRIRE_AUTEUR', array('id_auteur', 'id_article', 'email'));
23
+    return calculer_balise_dynamique($p,'FORMULAIRE_ECRIRE_AUTEUR', array('id_auteur', 'id_article', 'email'));
24 24
 }
25 25
 
26 26
 // http://doc.spip.org/@balise_FORMULAIRE_ECRIRE_AUTEUR_stat
27 27
 function balise_FORMULAIRE_ECRIRE_AUTEUR_stat($args, $context_compil) {
28
-	include_spip('inc/filtres');
29
-	// Pas d'id_auteur ni d'id_article ? Erreur de contexte
30
-	$id = intval($args[1]);
31
-	if (!$args[0] AND !$id) {
32
-		$msg = array('zbug_champ_hors_motif',
33
-				array ('champ' => 'FORMULAIRE_ECRIRE_AUTEUR',
34
-					'motif' => 'AUTEURS/ARTICLES'));
35
-
36
-		erreur_squelette($msg, $context_compil);
37
-		return '';
38
-	}
39
-	// Si on est dans un contexte article,
40
-	// sortir tous les mails des auteurs de l'article
41
-	if (!$args[0] AND $id) {
42
-		$r = '';
43
-		$s = sql_allfetsel('email',
44
-				   'spip_auteurs AS A LEFT JOIN spip_auteurs_liens AS L ON (A.id_auteur=L.id_auteur AND L.objet=\'article\')',
45
-				   "A.email != '' AND L.id_objet=$id");
46
-		foreach($s as $row) {
47
-			if (email_valide($row['email']))
48
-				$r .= ', '.$row['email'];
49
-		}
50
-		$args[2] = substr($r, 2);
51
-	}
52
-
53
-	// On ne peut pas ecrire a un auteur dont le mail n'est pas valide
54
-	if (!$args[2] OR !email_valide($args[2]))
55
-		return '';
56
-
57
-	// OK
58
-	return $args;
28
+    include_spip('inc/filtres');
29
+    // Pas d'id_auteur ni d'id_article ? Erreur de contexte
30
+    $id = intval($args[1]);
31
+    if (!$args[0] AND !$id) {
32
+        $msg = array('zbug_champ_hors_motif',
33
+                array ('champ' => 'FORMULAIRE_ECRIRE_AUTEUR',
34
+                    'motif' => 'AUTEURS/ARTICLES'));
35
+
36
+        erreur_squelette($msg, $context_compil);
37
+        return '';
38
+    }
39
+    // Si on est dans un contexte article,
40
+    // sortir tous les mails des auteurs de l'article
41
+    if (!$args[0] AND $id) {
42
+        $r = '';
43
+        $s = sql_allfetsel('email',
44
+                    'spip_auteurs AS A LEFT JOIN spip_auteurs_liens AS L ON (A.id_auteur=L.id_auteur AND L.objet=\'article\')',
45
+                    "A.email != '' AND L.id_objet=$id");
46
+        foreach($s as $row) {
47
+            if (email_valide($row['email']))
48
+                $r .= ', '.$row['email'];
49
+        }
50
+        $args[2] = substr($r, 2);
51
+    }
52
+
53
+    // On ne peut pas ecrire a un auteur dont le mail n'est pas valide
54
+    if (!$args[2] OR !email_valide($args[2]))
55
+        return '';
56
+
57
+    // OK
58
+    return $args;
59 59
 }
60 60
 
61 61
 ?>
Please login to merge, or discard this patch.
ecrire/balise/url_logout.php 1 patch
Indentation   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -19,15 +19,15 @@
 block discarded – undo
19 19
 // $args[0] = url destination apres logout [(#URL_LOGOUT{url})]
20 20
 // http://doc.spip.org/@balise_URL_LOGOUT_stat
21 21
 function balise_URL_LOGOUT_stat ($args, $context_compil) {
22
-	$url = isset($args[0]) ? $args[0] : '';
23
-	return array($url);
22
+    $url = isset($args[0]) ? $args[0] : '';
23
+    return array($url);
24 24
 }
25 25
 
26 26
 // http://doc.spip.org/@balise_URL_LOGOUT_dyn
27 27
 function balise_URL_LOGOUT_dyn($cible) {
28 28
 
29
-	if (!$GLOBALS['visiteur_session']['login'] AND !$GLOBALS['visiteur_session']['statut']) return '';
29
+    if (!$GLOBALS['visiteur_session']['login'] AND !$GLOBALS['visiteur_session']['statut']) return '';
30 30
 
31
-	return generer_url_action('logout',"logout=public&url=" . rawurlencode($cible ? $cible : self('&')));
31
+    return generer_url_action('logout',"logout=public&url=" . rawurlencode($cible ? $cible : self('&')));
32 32
 }
33 33
 ?>
Please login to merge, or discard this patch.
ecrire/balise/configurer_metas.php 1 patch
Indentation   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -22,7 +22,7 @@  discard block
 block discarded – undo
22 22
 
23 23
 function balise_CONFIGURER_METAS_dist($p) {
24 24
 
25
-	return calculer_balise_dynamique($p, $p->nom_champ, array());
25
+    return calculer_balise_dynamique($p, $p->nom_champ, array());
26 26
 }
27 27
 
28 28
 // A l'execution on dispose du nom du squelette, on verifie qu'il existe.
@@ -31,12 +31,12 @@  discard block
 block discarded – undo
31 31
 
32 32
 function balise_CONFIGURER_METAS_dyn($form) {
33 33
 
34
-	include_spip('balise/formulaire_');
35
-	if (!existe_formulaire($form)) return '';
36
-	$args = func_get_args();
37
-	$contexte = balise_FORMULAIRE__contexte('configurer_metas', $args);
38
-	if (!is_array($contexte)) return $contexte;
39
-	return array('formulaires/' . $form, 3600, $contexte);
34
+    include_spip('balise/formulaire_');
35
+    if (!existe_formulaire($form)) return '';
36
+    $args = func_get_args();
37
+    $contexte = balise_FORMULAIRE__contexte('configurer_metas', $args);
38
+    if (!is_array($contexte)) return $contexte;
39
+    return array('formulaires/' . $form, 3600, $contexte);
40 40
 }
41 41
 
42 42
 ?>
Please login to merge, or discard this patch.
ecrire/balise/formulaire_admin.php 1 patch
Indentation   +110 added lines, -110 removed lines patch added patch discarded remove patch
@@ -14,14 +14,14 @@  discard block
 block discarded – undo
14 14
 
15 15
 // http://doc.spip.org/@balise_FORMULAIRE_ADMIN
16 16
 function balise_FORMULAIRE_ADMIN ($p) {
17
-	return calculer_balise_dynamique($p,'FORMULAIRE_ADMIN', array());
17
+    return calculer_balise_dynamique($p,'FORMULAIRE_ADMIN', array());
18 18
 }
19 19
 
20 20
 # on ne peut rien dire au moment de l'execution du squelette
21 21
 
22 22
 // http://doc.spip.org/@balise_FORMULAIRE_ADMIN_stat
23 23
 function balise_FORMULAIRE_ADMIN_stat($args, $context_compil) {
24
-	return $args;
24
+    return $args;
25 25
 }
26 26
 
27 27
 # les boutons admin sont mis d'autorite si absents
@@ -34,57 +34,57 @@  discard block
 block discarded – undo
34 34
 // http://doc.spip.org/@balise_FORMULAIRE_ADMIN_dyn
35 35
 function balise_FORMULAIRE_ADMIN_dyn($float='', $debug='') {
36 36
 
37
-	global $use_cache;
38
-	static $dejafait = false;
37
+    global $use_cache;
38
+    static $dejafait = false;
39 39
 
40
-	if (!@$_COOKIE['spip_admin'])
41
-		return '';
40
+    if (!@$_COOKIE['spip_admin'])
41
+        return '';
42 42
 
43
-	if (!is_array($debug)) {
44
-		if ($dejafait)
45
-			return '';
46
-	} else {
47
-		if ($dejafait) {
48
-			if (empty($debug['sourcefile'])) return '';
49
-			foreach($debug['sourcefile'] as $k => $v) {
50
-				if (strpos($v,'administration.') !== false)
51
-					return $debug['resultat'][$k . 'tout'];
52
-			}
53
-			return '';
54
-		}
55
-	}
43
+    if (!is_array($debug)) {
44
+        if ($dejafait)
45
+            return '';
46
+    } else {
47
+        if ($dejafait) {
48
+            if (empty($debug['sourcefile'])) return '';
49
+            foreach($debug['sourcefile'] as $k => $v) {
50
+                if (strpos($v,'administration.') !== false)
51
+                    return $debug['resultat'][$k . 'tout'];
52
+            }
53
+            return '';
54
+        }
55
+    }
56 56
 
57
-	include_spip('inc/autoriser');
58
-	include_spip('base/abstract_sql');
57
+    include_spip('inc/autoriser');
58
+    include_spip('base/abstract_sql');
59 59
 
60 60
 
61
-	$dejafait = true;
61
+    $dejafait = true;
62 62
 
63
-	// Preparer le #ENV des boutons
63
+    // Preparer le #ENV des boutons
64 64
 
65
-	$env = admin_objet();
65
+    $env = admin_objet();
66 66
 
67
-	// Pas de "modifier ce..." ? -> donner "acces a l'espace prive"
68
-	if (!$env)
69
-		$env['ecrire'] = _DIR_RESTREINT_ABS;
67
+    // Pas de "modifier ce..." ? -> donner "acces a l'espace prive"
68
+    if (!$env)
69
+        $env['ecrire'] = _DIR_RESTREINT_ABS;
70 70
 
71
-	$env['divclass'] = $float;
72
-	$env['lang'] = admin_lang();
73
-	$env['calcul'] = (_request('var_mode') ? 'recalcul' : 'calcul');
74
-	$env['debug'] = ((defined('_VAR_PREVIEW') AND _VAR_PREVIEW) ? "" : admin_debug());
75
-	$env['analyser'] = (!$env['debug'] AND !$GLOBALS['xhtml']) ? '' : admin_valider();
76
-	$env['inclure'] = ((defined('_VAR_INCLURE') AND _VAR_INCLURE)?'inclure':'');
71
+    $env['divclass'] = $float;
72
+    $env['lang'] = admin_lang();
73
+    $env['calcul'] = (_request('var_mode') ? 'recalcul' : 'calcul');
74
+    $env['debug'] = ((defined('_VAR_PREVIEW') AND _VAR_PREVIEW) ? "" : admin_debug());
75
+    $env['analyser'] = (!$env['debug'] AND !$GLOBALS['xhtml']) ? '' : admin_valider();
76
+    $env['inclure'] = ((defined('_VAR_INCLURE') AND _VAR_INCLURE)?'inclure':'');
77 77
 
78
-	if (!$use_cache)
79
-		$env['use_cache'] = ' *';
78
+    if (!$use_cache)
79
+        $env['use_cache'] = ' *';
80 80
 		
81
-	if (isset($debug['validation'])) {
82
-		$env['xhtml_error'] = $debug['validation'];
83
-	}
81
+    if (isset($debug['validation'])) {
82
+        $env['xhtml_error'] = $debug['validation'];
83
+    }
84 84
 	
85
-	$env['_pipelines']['formulaire_admin']=array();
85
+    $env['_pipelines']['formulaire_admin']=array();
86 86
 
87
-	return array('formulaires/administration', 0, $env);
87
+    return array('formulaires/administration', 0, $env);
88 88
 }
89 89
 
90 90
 // Afficher le bouton 'Modifier ce...' 
@@ -95,65 +95,65 @@  discard block
 block discarded – undo
95 95
 // http://doc.spip.org/@admin_objet
96 96
 function admin_objet()
97 97
 {
98
-	include_spip('inc/urls');
99
-	$env = array();
100
-
101
-	$trouver_table = charger_fonction('trouver_table','base');
102
-	$objets = urls_liste_objets(false);
103
-	$objets = array_diff($objets, array('rubrique'));
104
-	$objets = array_reverse($objets);
105
-	array_unshift($objets, 'rubrique');
106
-	foreach ($objets as $obj) {
107
-		$type = $obj;
108
-		if ($type==objet_type($type,false)
109
-			AND $_id_type = id_table_objet($type)
110
-			AND isset($GLOBALS['contexte'][$_id_type])
111
-			AND $id = $GLOBALS['contexte'][$_id_type]
112
-			AND !is_array($id)
113
-			AND $id=intval($id)) {
114
-			$id = sql_getfetsel($_id_type, table_objet_sql($type), "$_id_type=".intval($id));
115
-			if ($id) {
116
-				$env[$_id_type] = $id;
117
-				$env['objet'] = $type;
118
-				$env['id_objet'] = $id;
119
-				$env['voir_'.$obj] =
120
-				  str_replace('&', '&', generer_url_entite($id,$obj,'','',false));
121
-				if ($desc = $trouver_table(table_objet_sql($type))
122
-					AND isset($desc['field']['id_rubrique'])
123
-					AND $type != 'rubrique') {
124
-					unset($env['id_rubrique']);
125
-					unset($env['voir_rubrique']);
126
-					if (admin_preview($type, $id, $desc))
127
-						$env['preview']=parametre_url(self(),'var_mode','preview','&');
128
-				}
129
-			}
130
-		}
131
-	}
132
-	return $env;
98
+    include_spip('inc/urls');
99
+    $env = array();
100
+
101
+    $trouver_table = charger_fonction('trouver_table','base');
102
+    $objets = urls_liste_objets(false);
103
+    $objets = array_diff($objets, array('rubrique'));
104
+    $objets = array_reverse($objets);
105
+    array_unshift($objets, 'rubrique');
106
+    foreach ($objets as $obj) {
107
+        $type = $obj;
108
+        if ($type==objet_type($type,false)
109
+            AND $_id_type = id_table_objet($type)
110
+            AND isset($GLOBALS['contexte'][$_id_type])
111
+            AND $id = $GLOBALS['contexte'][$_id_type]
112
+            AND !is_array($id)
113
+            AND $id=intval($id)) {
114
+            $id = sql_getfetsel($_id_type, table_objet_sql($type), "$_id_type=".intval($id));
115
+            if ($id) {
116
+                $env[$_id_type] = $id;
117
+                $env['objet'] = $type;
118
+                $env['id_objet'] = $id;
119
+                $env['voir_'.$obj] =
120
+                    str_replace('&', '&', generer_url_entite($id,$obj,'','',false));
121
+                if ($desc = $trouver_table(table_objet_sql($type))
122
+                    AND isset($desc['field']['id_rubrique'])
123
+                    AND $type != 'rubrique') {
124
+                    unset($env['id_rubrique']);
125
+                    unset($env['voir_rubrique']);
126
+                    if (admin_preview($type, $id, $desc))
127
+                        $env['preview']=parametre_url(self(),'var_mode','preview','&');
128
+                }
129
+            }
130
+        }
131
+    }
132
+    return $env;
133 133
 }
134 134
 
135 135
 
136 136
 // http://doc.spip.org/@admin_preview
137 137
 function admin_preview($type, $id, $desc=null)
138 138
 {
139
-	if (defined('_VAR_PREVIEW') AND _VAR_PREVIEW) return '';
139
+    if (defined('_VAR_PREVIEW') AND _VAR_PREVIEW) return '';
140 140
 
141
-	if (!$desc) {
142
-		$trouver_table = charger_fonction('trouver_table','base');
143
-		$desc = $trouver_table(table_objet_sql($type));
144
-	}
145
-	if (!$desc OR !isset($desc['field']['statut']))
146
-		return '';
141
+    if (!$desc) {
142
+        $trouver_table = charger_fonction('trouver_table','base');
143
+        $desc = $trouver_table(table_objet_sql($type));
144
+    }
145
+    if (!$desc OR !isset($desc['field']['statut']))
146
+        return '';
147 147
 
148
-	include_spip('inc/autoriser');
149
-	if (!autoriser('previsualiser')) return '';
148
+    include_spip('inc/autoriser');
149
+    if (!autoriser('previsualiser')) return '';
150 150
 
151
-	$notpub = sql_in("statut", array('prop', 'prive'));
151
+    $notpub = sql_in("statut", array('prop', 'prive'));
152 152
 
153
-	if  ($type == 'article' AND $GLOBALS['meta']['post_dates'] != 'oui')
154
-		$notpub .= " OR (statut='publie' AND date>".sql_quote(date('Y-m-d H:i:s')).")";
153
+    if  ($type == 'article' AND $GLOBALS['meta']['post_dates'] != 'oui')
154
+        $notpub .= " OR (statut='publie' AND date>".sql_quote(date('Y-m-d H:i:s')).")";
155 155
 
156
-	return sql_fetsel('1', table_objet_sql($type), id_table_objet($type)."=".$id." AND ($notpub)");
156
+    return sql_fetsel('1', table_objet_sql($type), id_table_objet($type)."=".$id." AND ($notpub)");
157 157
 }
158 158
 
159 159
 //
@@ -163,40 +163,40 @@  discard block
 block discarded – undo
163 163
 // http://doc.spip.org/@admin_lang
164 164
 function admin_lang()
165 165
 {
166
-	$alang = sql_getfetsel('lang', 'spip_auteurs', "login=" . sql_quote(preg_replace(',^@,','',@$_COOKIE['spip_admin'])));
167
-	if (!$alang) return '';
166
+    $alang = sql_getfetsel('lang', 'spip_auteurs', "login=" . sql_quote(preg_replace(',^@,','',@$_COOKIE['spip_admin'])));
167
+    if (!$alang) return '';
168 168
 
169
-	$l = lang_select($alang);
170
-	$alang = $GLOBALS['spip_lang'];
171
-	if ($l) lang_select();
172
-	return $alang;
169
+    $l = lang_select($alang);
170
+    $alang = $GLOBALS['spip_lang'];
171
+    if ($l) lang_select();
172
+    return $alang;
173 173
 }
174 174
 
175 175
 // http://doc.spip.org/@admin_valider
176 176
 function admin_valider()
177 177
 {
178
-	global $xhtml;
178
+    global $xhtml;
179 179
 
180
-	return ((@$xhtml !== 'true') ?
181
-		(parametre_url(self(), 'var_mode', 'debug', '&')
182
-			.'&var_mode_affiche=validation') :
183
-		('http://validator.w3.org/check?uri='
184
-		 . rawurlencode("http://" . $_SERVER['HTTP_HOST'] . nettoyer_uri())));
180
+    return ((@$xhtml !== 'true') ?
181
+        (parametre_url(self(), 'var_mode', 'debug', '&')
182
+            .'&var_mode_affiche=validation') :
183
+        ('http://validator.w3.org/check?uri='
184
+            . rawurlencode("http://" . $_SERVER['HTTP_HOST'] . nettoyer_uri())));
185 185
 }
186 186
 
187 187
 // http://doc.spip.org/@admin_debug
188 188
 function admin_debug()
189 189
 {
190
-	return ((
191
-			(isset($GLOBALS['forcer_debug']) AND $GLOBALS['forcer_debug'])
192
-			OR (isset($GLOBALS['bouton_admin_debug']) AND $GLOBALS['bouton_admin_debug'])
193
-			OR (
194
-				defined('_VAR_MODE') AND _VAR_MODE == 'debug'
195
-				AND $_COOKIE['spip_debug']
196
-			)
197
-		) AND autoriser('debug')
198
-	  )
199
-	  ? parametre_url(self(),'var_mode', 'debug', '&'): '';
190
+    return ((
191
+            (isset($GLOBALS['forcer_debug']) AND $GLOBALS['forcer_debug'])
192
+            OR (isset($GLOBALS['bouton_admin_debug']) AND $GLOBALS['bouton_admin_debug'])
193
+            OR (
194
+                defined('_VAR_MODE') AND _VAR_MODE == 'debug'
195
+                AND $_COOKIE['spip_debug']
196
+            )
197
+        ) AND autoriser('debug')
198
+        )
199
+      ? parametre_url(self(),'var_mode', 'debug', '&'): '';
200 200
 }
201 201
 
202 202
 ?>
Please login to merge, or discard this patch.
ecrire/balise/formulaire_inscription.php 1 patch
Indentation   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -25,7 +25,7 @@  discard block
 block discarded – undo
25 25
  */
26 26
 function balise_FORMULAIRE_INSCRIPTION ($p) {
27 27
 
28
-	return calculer_balise_dynamique($p, 'FORMULAIRE_INSCRIPTION', array());
28
+    return calculer_balise_dynamique($p, 'FORMULAIRE_INSCRIPTION', array());
29 29
 }
30 30
 
31 31
 /**
@@ -40,10 +40,10 @@  discard block
 block discarded – undo
40 40
  * @return array|string
41 41
  */
42 42
 function balise_FORMULAIRE_INSCRIPTION_stat($args, $context_compil) {
43
-	list($mode, $id) = $args;
44
-	include_spip('action/inscrire_auteur');
45
-	$mode = tester_statut_inscription($mode, $id);
46
-	return $mode ? array($mode, $id) : '';
43
+    list($mode, $id) = $args;
44
+    include_spip('action/inscrire_auteur');
45
+    $mode = tester_statut_inscription($mode, $id);
46
+    return $mode ? array($mode, $id) : '';
47 47
 }
48 48
 
49 49
 ?>
Please login to merge, or discard this patch.
ecrire/balise/url_.php 1 patch
Indentation   +132 added lines, -132 removed lines patch added patch discarded remove patch
@@ -26,95 +26,95 @@  discard block
 block discarded – undo
26 26
 
27 27
 // http://doc.spip.org/@generer_generer_url
28 28
 function generer_generer_url($type, $p){
29
-	$_id = interprete_argument_balise(1,$p);
29
+    $_id = interprete_argument_balise(1,$p);
30 30
 
31
-	if (!$_id) {
32
-		$primary = id_table_objet($type);
33
-		$_id = champ_sql($primary, $p);
34
-	}
31
+    if (!$_id) {
32
+        $primary = id_table_objet($type);
33
+        $_id = champ_sql($primary, $p);
34
+    }
35 35
 
36
-	return generer_generer_url_arg($type, $p, $_id);
36
+    return generer_generer_url_arg($type, $p, $_id);
37 37
 }
38 38
 	
39 39
 function generer_generer_url_arg($type, $p, $_id)
40 40
 {
41
-	if ($s = trouver_nom_serveur_distant($p)) {
41
+    if ($s = trouver_nom_serveur_distant($p)) {
42 42
 
43 43
 // si une fonction de generation des url a ete definie pour ce connect l'utiliser
44
-		if (function_exists($f = 'generer_generer_url_'.$s)){
45
-			return $f($type, $_id, $s);
46
-		}
47
-		if (!$GLOBALS['connexions'][strtolower($s)]['spip_connect_version']) {
48
-			return NULL;
49
-		}
50
-		$s = _q($s);
51
-		# exception des urls de documents sur un serveur distant...
52
-		if ($type == 'document') {
53
-			return 
54
-			"quete_meta('adresse_site', $s) . '/' .\n\t" .
55
-			"quete_meta('dir_img', $s) . \n\t" .
56
-			"quete_fichier($_id,$s)";
57
-		}
58
-		$s = ", '', '', $s, quete_meta('type_urls', $s)";
59
-	}
60
-	else 
61
-		$s = ", '', '', true";
62
-	return "urlencode_1738(generer_url_entite($_id, '$type'$s))";
44
+        if (function_exists($f = 'generer_generer_url_'.$s)){
45
+            return $f($type, $_id, $s);
46
+        }
47
+        if (!$GLOBALS['connexions'][strtolower($s)]['spip_connect_version']) {
48
+            return NULL;
49
+        }
50
+        $s = _q($s);
51
+        # exception des urls de documents sur un serveur distant...
52
+        if ($type == 'document') {
53
+            return 
54
+            "quete_meta('adresse_site', $s) . '/' .\n\t" .
55
+            "quete_meta('dir_img', $s) . \n\t" .
56
+            "quete_fichier($_id,$s)";
57
+        }
58
+        $s = ", '', '', $s, quete_meta('type_urls', $s)";
59
+    }
60
+    else 
61
+        $s = ", '', '', true";
62
+    return "urlencode_1738(generer_url_entite($_id, '$type'$s))";
63 63
 }
64 64
 
65 65
 
66 66
 // http://doc.spip.org/@balise_URL__dist
67 67
 function balise_URL__dist($p) {
68 68
 
69
-	$nom = $p->nom_champ;
70
-	if ($nom === 'URL_') {
71
-		$msg = array('zbug_balise_sans_argument', array('balise' => ' URL_'));
72
-		erreur_squelette($msg, $p);
73
-		$p->interdire_scripts = false;
74
-		return $p;
75
-	} elseif ($f = charger_fonction($nom, 'balise', true)) {
76
-		return $f($p);
77
-	}else {
78
-		$nom = strtolower($nom);
79
-		$code = generer_generer_url(substr($nom,4), $p);
80
-		$code = champ_sql($nom, $p, $code);
81
-		$p->code = $code;
82
-		if (!$p->etoile)
83
-			$p->code = "vider_url($code)";
84
-		$p->interdire_scripts = false;
85
-		return $p;
86
-	}
69
+    $nom = $p->nom_champ;
70
+    if ($nom === 'URL_') {
71
+        $msg = array('zbug_balise_sans_argument', array('balise' => ' URL_'));
72
+        erreur_squelette($msg, $p);
73
+        $p->interdire_scripts = false;
74
+        return $p;
75
+    } elseif ($f = charger_fonction($nom, 'balise', true)) {
76
+        return $f($p);
77
+    }else {
78
+        $nom = strtolower($nom);
79
+        $code = generer_generer_url(substr($nom,4), $p);
80
+        $code = champ_sql($nom, $p, $code);
81
+        $p->code = $code;
82
+        if (!$p->etoile)
83
+            $p->code = "vider_url($code)";
84
+        $p->interdire_scripts = false;
85
+        return $p;
86
+    }
87 87
 }
88 88
 
89 89
 // http://doc.spip.org/@balise_URL_ARTICLE_dist
90 90
 function balise_URL_ARTICLE_dist($p) {
91 91
 
92
-	// Cas particulier des boucles (SYNDIC_ARTICLES)
93
-	if ($p->type_requete == 'syndic_articles') {
94
-		$code = champ_sql('url', $p);
95
-	} else  $code = generer_generer_url('article', $p);
92
+    // Cas particulier des boucles (SYNDIC_ARTICLES)
93
+    if ($p->type_requete == 'syndic_articles') {
94
+        $code = champ_sql('url', $p);
95
+    } else  $code = generer_generer_url('article', $p);
96 96
 
97
-	$p->code = $code;
98
-	if (!$p->etoile)
99
-		$p->code = "vider_url($code)";
100
-	$p->interdire_scripts = false;
101
-	return $p;
97
+    $p->code = $code;
98
+    if (!$p->etoile)
99
+        $p->code = "vider_url($code)";
100
+    $p->interdire_scripts = false;
101
+    return $p;
102 102
 }
103 103
 
104 104
 // http://doc.spip.org/@balise_URL_SITE_dist
105 105
 function balise_URL_SITE_dist($p)
106 106
 {
107
-	$code = champ_sql('url_site', $p);
108
-	if (strpos($code, '@$Pile[0]') !== false) {
109
-		$code = generer_generer_url('site', $p);
110
-		if ($code === NULL) return NULL;
111
-	} else {
112
-		if (!$p->etoile)
113
-			$code = "calculer_url($code,'','url', \$connect)";
114
-	}
115
-	$p->code = $code;
116
-	$p->interdire_scripts = false;
117
-	return $p;
107
+    $code = champ_sql('url_site', $p);
108
+    if (strpos($code, '@$Pile[0]') !== false) {
109
+        $code = generer_generer_url('site', $p);
110
+        if ($code === NULL) return NULL;
111
+    } else {
112
+        if (!$p->etoile)
113
+            $code = "calculer_url($code,'','url', \$connect)";
114
+    }
115
+    $p->code = $code;
116
+    $p->interdire_scripts = false;
117
+    return $p;
118 118
 }
119 119
 
120 120
 // Autres balises URL_*, qui ne concernent pas une table
@@ -122,10 +122,10 @@  discard block
 block discarded – undo
122 122
 
123 123
 // http://doc.spip.org/@balise_URL_SITE_SPIP_dist
124 124
 function balise_URL_SITE_SPIP_dist($p) {
125
-	$p->code = "sinon(\$GLOBALS['meta']['adresse_site'],'.')";
126
-	$p->code = "spip_htmlspecialchars(".$p->code.")";
127
-	$p->interdire_scripts = false;
128
-	return $p;
125
+    $p->code = "sinon(\$GLOBALS['meta']['adresse_site'],'.')";
126
+    $p->code = "spip_htmlspecialchars(".$p->code.")";
127
+    $p->interdire_scripts = false;
128
+    return $p;
129 129
 }
130 130
 
131 131
 //
@@ -137,36 +137,36 @@  discard block
 block discarded – undo
137 137
 // http://doc.spip.org/@balise_URL_PAGE_dist
138 138
 function balise_URL_PAGE_dist($p) {
139 139
 
140
-	$code = interprete_argument_balise(1,$p);
141
-	$args = interprete_argument_balise(2,$p);
142
-	if ($args == NULL)
143
-		$args = "''";
144
-
145
-	if ($s = trouver_nom_serveur_distant($p)) {
146
-		// si une fonction de generation des url a ete definie pour ce connect l'utiliser
147
-		// elle devra aussi traiter le cas derogatoire type=page
148
-		if (function_exists($f = 'generer_generer_url_'.$s)){
149
-			if ($args AND $args!=="''") $code .= ", $args";
150
-			$code = $f('page', $code, $s);
151
-			return $p;
152
-		}
153
-		$s = 'connect=' .  addslashes($s);
154
-		$args = (($args AND $args!=="''") ? "$args . '&$s'" : "'$s'");
155
-	}
156
-
157
-	if (!$code) {
158
-		$noentities = $p->etoile ? "'&'" : '';
159
-		$code = "url_de_base() . preg_replace(',^./,', '', self($noentities))";
160
-	} else{
161
-	  	if (!$args) $args = "''";
162
-		$noentities = $p->etoile ? ", true" : '';
163
-		$code = "generer_url_public($code, $args$noentities)";
164
-	}
165
-	$p->code = $code;
166
-	spip_log("connect vaut $s ca donne " .  $p->code . " args $args");
167
-
168
-	#$p->interdire_scripts = true;
169
-	return $p;
140
+    $code = interprete_argument_balise(1,$p);
141
+    $args = interprete_argument_balise(2,$p);
142
+    if ($args == NULL)
143
+        $args = "''";
144
+
145
+    if ($s = trouver_nom_serveur_distant($p)) {
146
+        // si une fonction de generation des url a ete definie pour ce connect l'utiliser
147
+        // elle devra aussi traiter le cas derogatoire type=page
148
+        if (function_exists($f = 'generer_generer_url_'.$s)){
149
+            if ($args AND $args!=="''") $code .= ", $args";
150
+            $code = $f('page', $code, $s);
151
+            return $p;
152
+        }
153
+        $s = 'connect=' .  addslashes($s);
154
+        $args = (($args AND $args!=="''") ? "$args . '&$s'" : "'$s'");
155
+    }
156
+
157
+    if (!$code) {
158
+        $noentities = $p->etoile ? "'&'" : '';
159
+        $code = "url_de_base() . preg_replace(',^./,', '', self($noentities))";
160
+    } else{
161
+            if (!$args) $args = "''";
162
+        $noentities = $p->etoile ? ", true" : '';
163
+        $code = "generer_url_public($code, $args$noentities)";
164
+    }
165
+    $p->code = $code;
166
+    spip_log("connect vaut $s ca donne " .  $p->code . " args $args");
167
+
168
+    #$p->interdire_scripts = true;
169
+    return $p;
170 170
 }
171 171
 
172 172
 //
@@ -175,24 +175,24 @@  discard block
 block discarded – undo
175 175
 // http://doc.spip.org/@balise_URL_ECRIRE_dist
176 176
 function balise_URL_ECRIRE_dist($p) {
177 177
 
178
-	$code = interprete_argument_balise(1,$p);
179
-	if (!$code) {
180
-		$fonc = "''";
181
-	}
182
-	else {
183
-		$fonc = $code;
184
-		$args = interprete_argument_balise(2,$p);
185
-		if ($args === NULL) {
186
-			$args = "''";
187
-		}
188
-		$noentities = $p->etoile ? ", true" : '';
189
-		if (($args != "''")  OR $noentities) {
190
-			$fonc .= ",$args$noentities";
191
-		}
192
-	}
193
-	$p->code = 'generer_url_ecrire(' . $fonc .')';
194
-	$p->interdire_scripts = false;
195
-	return $p;
178
+    $code = interprete_argument_balise(1,$p);
179
+    if (!$code) {
180
+        $fonc = "''";
181
+    }
182
+    else {
183
+        $fonc = $code;
184
+        $args = interprete_argument_balise(2,$p);
185
+        if ($args === NULL) {
186
+            $args = "''";
187
+        }
188
+        $noentities = $p->etoile ? ", true" : '';
189
+        if (($args != "''")  OR $noentities) {
190
+            $fonc .= ",$args$noentities";
191
+        }
192
+    }
193
+    $p->code = 'generer_url_ecrire(' . $fonc .')';
194
+    $p->interdire_scripts = false;
195
+    return $p;
196 196
 }
197 197
 
198 198
 //
@@ -200,21 +200,21 @@  discard block
 block discarded – undo
200 200
 //
201 201
 // http://doc.spip.org/@balise_URL_ACTION_AUTEUR_dist
202 202
 function balise_URL_ACTION_AUTEUR_dist($p) {
203
-	$p->descr['session'] = true;
204
-
205
-	$p->code = interprete_argument_balise(1,$p);
206
-	$args = interprete_argument_balise(2,$p);
207
-	if ($args != "''" && $args!==NULL)
208
-		$p->code .= ",".$args;
209
-	$redirect = interprete_argument_balise(3,$p);
210
-	if ($redirect != "''" && $redirect!==NULL) {
211
-		if ($args == "''" || $args===NULL)
212
-			$p->code .= ",''";
213
-		$p->code .= ",".$redirect;
214
-	}
215
-
216
-	$p->code = "generer_action_auteur(" . $p->code . ")";
217
-	$p->interdire_scripts = false;
218
-	return $p;
203
+    $p->descr['session'] = true;
204
+
205
+    $p->code = interprete_argument_balise(1,$p);
206
+    $args = interprete_argument_balise(2,$p);
207
+    if ($args != "''" && $args!==NULL)
208
+        $p->code .= ",".$args;
209
+    $redirect = interprete_argument_balise(3,$p);
210
+    if ($redirect != "''" && $redirect!==NULL) {
211
+        if ($args == "''" || $args===NULL)
212
+            $p->code .= ",''";
213
+        $p->code .= ",".$redirect;
214
+    }
215
+
216
+    $p->code = "generer_action_auteur(" . $p->code . ")";
217
+    $p->interdire_scripts = false;
218
+    return $p;
219 219
 }
220 220
 ?>
Please login to merge, or discard this patch.
ecrire/balise/logo_.php 1 patch
Indentation   +87 added lines, -87 removed lines patch added patch discarded remove patch
@@ -20,102 +20,102 @@
 block discarded – undo
20 20
 // http://doc.spip.org/@balise_LOGO__dist
21 21
 function balise_LOGO__dist ($p) {
22 22
 
23
-	preg_match(",^LOGO_([A-Z_]+?)(|_NORMAL|_SURVOL|_RUBRIQUE)$,i", $p->nom_champ, $regs);
24
-	$type = strtolower($regs[1]);
25
-	$suite_logo = $regs[2];
26
-
27
-	// cas de #LOGO_SITE_SPIP
28
-	if ($type == 'site_spip') {
29
-		$type = 'site';
30
-		$_id_objet = "\"'0'\"";
31
-	}
32
-
33
-	$id_objet = id_table_objet($type);
34
-	if (!isset($_id_objet) OR !$_id_objet)
35
-		$_id_objet = champ_sql($id_objet, $p);
36
-
37
-	$fichier = ($p->etoile === '**') ? -1 : 0;
38
-	$coord = array();
39
-	$align = $lien = '';
40
-	$mode_logo = '';
41
-
42
-	if ($p->param AND !$p->param[0][0]) {
43
-		$params = $p->param[0];
44
-		array_shift($params);
45
-		foreach($params as $a) {
46
-			if ($a[0]->type === 'texte') {
47
-				$n = $a[0]->texte;
48
-				if (is_numeric($n))
49
-					$coord[]= $n;
50
-				elseif (in_array($n,array('top','left','right','center','bottom')))
51
-					$align = $n;
52
-				elseif (in_array($n,array('auto','icone','apercu','vignette')))
53
-					$mode_logo = $n;
54
-			}
55
-			else $lien =  calculer_liste($a, $p->descr, $p->boucles, $p->id_boucle);
56
-
57
-		}
58
-	}
59
-
60
-	$coord_x = !$coord  ? 0 : intval(array_shift($coord));
61
-	$coord_y = !$coord  ? 0 : intval(array_shift($coord));
23
+    preg_match(",^LOGO_([A-Z_]+?)(|_NORMAL|_SURVOL|_RUBRIQUE)$,i", $p->nom_champ, $regs);
24
+    $type = strtolower($regs[1]);
25
+    $suite_logo = $regs[2];
26
+
27
+    // cas de #LOGO_SITE_SPIP
28
+    if ($type == 'site_spip') {
29
+        $type = 'site';
30
+        $_id_objet = "\"'0'\"";
31
+    }
32
+
33
+    $id_objet = id_table_objet($type);
34
+    if (!isset($_id_objet) OR !$_id_objet)
35
+        $_id_objet = champ_sql($id_objet, $p);
36
+
37
+    $fichier = ($p->etoile === '**') ? -1 : 0;
38
+    $coord = array();
39
+    $align = $lien = '';
40
+    $mode_logo = '';
41
+
42
+    if ($p->param AND !$p->param[0][0]) {
43
+        $params = $p->param[0];
44
+        array_shift($params);
45
+        foreach($params as $a) {
46
+            if ($a[0]->type === 'texte') {
47
+                $n = $a[0]->texte;
48
+                if (is_numeric($n))
49
+                    $coord[]= $n;
50
+                elseif (in_array($n,array('top','left','right','center','bottom')))
51
+                    $align = $n;
52
+                elseif (in_array($n,array('auto','icone','apercu','vignette')))
53
+                    $mode_logo = $n;
54
+            }
55
+            else $lien =  calculer_liste($a, $p->descr, $p->boucles, $p->id_boucle);
56
+
57
+        }
58
+    }
59
+
60
+    $coord_x = !$coord  ? 0 : intval(array_shift($coord));
61
+    $coord_y = !$coord  ? 0 : intval(array_shift($coord));
62 62
 	
63
-	if ($p->etoile === '*') {
64
-		include_spip('balise/url_');
65
-		$lien = generer_generer_url_arg($type, $p, $_id_objet);
66
-	}
67
-
68
-	$connect = $p->id_boucle ?$p->boucles[$p->id_boucle]->sql_serveur :'';
69
-	if ($type == 'document') {
70
-		$qconnect = _q($connect);
71
-		$doc = "quete_document($_id_objet, $qconnect)";
72
-		if ($fichier)
73
-			$code = "quete_logo_file($doc, $qconnect)";
74
-		else $code = "quete_logo_document($doc, " . ($lien ? $lien : "''") . ", '$align', '$mode_logo', $coord_x, $coord_y, $qconnect)";
75
-		// (x=non-faux ? y : '') pour affecter x en retournant y
76
-		if ($p->descr['documents'])
77
-		  $code = '(($doublons["documents"] .= ",". '
78
-		    . $_id_objet
79
-		    . ") ? $code : '')";
80
-	}
81
-	elseif ($connect) {
82
-		$code = "''";
83
-		spip_log("Les logos distants ne sont pas prevus");
84
-	} else {
85
-		$code = logo_survol($id_objet, $_id_objet, $type, $align, $fichier, $lien, $p, $suite_logo);
86
-	}
87
-
88
-	// demande de reduction sur logo avec ecriture spip 2.1 : #LOGO_xxx{200, 0}
89
-	if ($coord_x OR $coord_y) {
90
-		$code = "filtrer('image_graver',filtrer('image_reduire',".$code.", '$coord_x', '$coord_y'))"; 
91
-	} 
92
-
93
-	$p->code = $code;
94
-	$p->interdire_scripts = false;
95
-	return $p;
63
+    if ($p->etoile === '*') {
64
+        include_spip('balise/url_');
65
+        $lien = generer_generer_url_arg($type, $p, $_id_objet);
66
+    }
67
+
68
+    $connect = $p->id_boucle ?$p->boucles[$p->id_boucle]->sql_serveur :'';
69
+    if ($type == 'document') {
70
+        $qconnect = _q($connect);
71
+        $doc = "quete_document($_id_objet, $qconnect)";
72
+        if ($fichier)
73
+            $code = "quete_logo_file($doc, $qconnect)";
74
+        else $code = "quete_logo_document($doc, " . ($lien ? $lien : "''") . ", '$align', '$mode_logo', $coord_x, $coord_y, $qconnect)";
75
+        // (x=non-faux ? y : '') pour affecter x en retournant y
76
+        if ($p->descr['documents'])
77
+            $code = '(($doublons["documents"] .= ",". '
78
+            . $_id_objet
79
+            . ") ? $code : '')";
80
+    }
81
+    elseif ($connect) {
82
+        $code = "''";
83
+        spip_log("Les logos distants ne sont pas prevus");
84
+    } else {
85
+        $code = logo_survol($id_objet, $_id_objet, $type, $align, $fichier, $lien, $p, $suite_logo);
86
+    }
87
+
88
+    // demande de reduction sur logo avec ecriture spip 2.1 : #LOGO_xxx{200, 0}
89
+    if ($coord_x OR $coord_y) {
90
+        $code = "filtrer('image_graver',filtrer('image_reduire',".$code.", '$coord_x', '$coord_y'))"; 
91
+    } 
92
+
93
+    $p->code = $code;
94
+    $p->interdire_scripts = false;
95
+    return $p;
96 96
 }
97 97
 
98 98
 function logo_survol($id_objet, $_id_objet, $type, $align, $fichier, $lien, $p, $suite)
99 99
 {
100
-	$code = "quete_logo('$id_objet', '" .
101
-		(($suite == '_SURVOL') ? 'off' : 
102
-		(($suite == '_NORMAL') ? 'on' : 'ON')) .
103
-		"', $_id_objet," .
104
-		(($suite == '_RUBRIQUE') ? 
105
-		champ_sql("id_rubrique", $p) :
106
-		(($type == 'rubrique') ? "quete_parent($_id_objet)" : "''")) .
107
-		", " . intval($fichier) . ")";
100
+    $code = "quete_logo('$id_objet', '" .
101
+        (($suite == '_SURVOL') ? 'off' : 
102
+        (($suite == '_NORMAL') ? 'on' : 'ON')) .
103
+        "', $_id_objet," .
104
+        (($suite == '_RUBRIQUE') ? 
105
+        champ_sql("id_rubrique", $p) :
106
+        (($type == 'rubrique') ? "quete_parent($_id_objet)" : "''")) .
107
+        ", " . intval($fichier) . ")";
108 108
 
109
-	if ($fichier) return $code;
109
+    if ($fichier) return $code;
110 110
 
111
-	$code = "\n((!is_array(\$l = $code)) ? '':\n (" .
112
-		     '"<img class=\"spip_logos\" alt=\"\"' .
113
-		    ($align ? " align=\\\"$align\\\"" : '')
114
-		    . ' src=\"$l[0]\"" . $l[2] .  ($l[1] ? " onmouseover=\"this.src=\'$l[1]\'\" onmouseout=\"this.src=\'$l[0]\'\"" : "") . \' />\'))';
111
+    $code = "\n((!is_array(\$l = $code)) ? '':\n (" .
112
+                '"<img class=\"spip_logos\" alt=\"\"' .
113
+            ($align ? " align=\\\"$align\\\"" : '')
114
+            . ' src=\"$l[0]\"" . $l[2] .  ($l[1] ? " onmouseover=\"this.src=\'$l[1]\'\" onmouseout=\"this.src=\'$l[0]\'\"" : "") . \' />\'))';
115 115
 
116
-	if (!$lien) return $code;
116
+    if (!$lien) return $code;
117 117
 
118
-	return ('(strlen($logo='.$code.')?\'<a href="\' .' . $lien . ' . \'">\' . $logo . \'</a>\':\'\')');
118
+    return ('(strlen($logo='.$code.')?\'<a href="\' .' . $lien . ' . \'">\' . $logo . \'</a>\':\'\')');
119 119
 
120 120
 }
121 121
 
Please login to merge, or discard this patch.
ecrire/balise/login_public.php 1 patch
Indentation   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -15,7 +15,7 @@  discard block
 block discarded – undo
15 15
 
16 16
 // http://doc.spip.org/@balise_LOGIN_PUBLIC
17 17
 function balise_LOGIN_PUBLIC ($p, $nom='LOGIN_PUBLIC') {
18
-	return calculer_balise_dynamique($p, $nom, array('url'));
18
+    return calculer_balise_dynamique($p, $nom, array('url'));
19 19
 }
20 20
 
21 21
 # retourner:
@@ -26,17 +26,17 @@  discard block
 block discarded – undo
26 26
 
27 27
 // http://doc.spip.org/@balise_LOGIN_PUBLIC_stat
28 28
 function balise_LOGIN_PUBLIC_stat ($args, $context_compil) {
29
-	return array(isset($args[1]) ? $args[1] : $args[0], (isset($args[2]) ? $args[2] : ''));
29
+    return array(isset($args[1]) ? $args[1] : $args[0], (isset($args[2]) ? $args[2] : ''));
30 30
 }
31 31
 
32 32
 // http://doc.spip.org/@balise_LOGIN_PUBLIC_dyn
33 33
 function balise_LOGIN_PUBLIC_dyn($url, $login) {
34
-	include_spip('balise/formulaire_');
35
-	if (!$url 		# pas d'url passee en filtre ou dans le contexte
36
-	AND !$url = _request('url') # ni d'url passee par l'utilisateur
37
-	)
38
-		$url = parametre_url(self(), '', '', '&');
39
-	return balise_FORMULAIRE__dyn('login',$url,$login,false);
34
+    include_spip('balise/formulaire_');
35
+    if (!$url 		# pas d'url passee en filtre ou dans le contexte
36
+    AND !$url = _request('url') # ni d'url passee par l'utilisateur
37
+    )
38
+        $url = parametre_url(self(), '', '', '&');
39
+    return balise_FORMULAIRE__dyn('login',$url,$login,false);
40 40
 }
41 41
 
42 42
 ?>
Please login to merge, or discard this patch.
ecrire/balise/login_prive.php 1 patch
Indentation   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -15,7 +15,7 @@  discard block
 block discarded – undo
15 15
 
16 16
 // http://doc.spip.org/@balise_LOGIN_PRIVE
17 17
 function balise_LOGIN_PRIVE ($p) {
18
-	return calculer_balise_dynamique($p, 'LOGIN_PRIVE', array('url'));
18
+    return calculer_balise_dynamique($p, 'LOGIN_PRIVE', array('url'));
19 19
 }
20 20
 
21 21
 # retourner:
@@ -26,16 +26,16 @@  discard block
 block discarded – undo
26 26
 
27 27
 // http://doc.spip.org/@balise_LOGIN_PRIVE_stat
28 28
 function balise_LOGIN_PRIVE_stat ($args, $context_compil) {
29
-	return array(isset($args[1]) ? $args[1] : $args[0], (isset($args[2]) ? $args[2] : ''));
29
+    return array(isset($args[1]) ? $args[1] : $args[0], (isset($args[2]) ? $args[2] : ''));
30 30
 }
31 31
 
32 32
 // http://doc.spip.org/@balise_LOGIN_PRIVE_dyn
33 33
 function balise_LOGIN_PRIVE_dyn($url, $login) {
34
-	include_spip('balise/formulaire_');
35
-	if (!$url 		# pas d'url passee en filtre ou dans le contexte
36
-	AND !$url = _request('url') # ni d'url passee par l'utilisateur
37
-	)
38
-		$url = generer_url_ecrire('accueil','',true);
39
-	return balise_FORMULAIRE__dyn('login',$url,$login,true);
34
+    include_spip('balise/formulaire_');
35
+    if (!$url 		# pas d'url passee en filtre ou dans le contexte
36
+    AND !$url = _request('url') # ni d'url passee par l'utilisateur
37
+    )
38
+        $url = generer_url_ecrire('accueil','',true);
39
+    return balise_FORMULAIRE__dyn('login',$url,$login,true);
40 40
 }
41 41
 ?>
Please login to merge, or discard this patch.