Completed
Push — master ( 7d1d75...0ae8e3 )
by cam
01:06
created
ecrire/inc/email_valide.php 1 patch
Indentation   +24 added lines, -24 removed lines patch added patch discarded remove patch
@@ -16,7 +16,7 @@  discard block
 block discarded – undo
16 16
  * @package SPIP\Core\Mail
17 17
  **/
18 18
 if (!defined('_ECRIRE_INC_VERSION')) {
19
-	return;
19
+    return;
20 20
 }
21 21
 
22 22
 
@@ -31,27 +31,27 @@  discard block
 block discarded – undo
31 31
  *      - la normalisation de la dernière adresse donnée sinon
32 32
  **/
33 33
 function inc_email_valide_dist($adresses) {
34
-	// eviter d'injecter n'importe quoi dans preg_match
35
-	if (!is_string($adresses)) {
36
-		return false;
37
-	}
38
-
39
-	// Si c'est un spammeur autant arreter tout de suite
40
-	if (preg_match(",[\n\r].*(MIME|multipart|Content-),i", $adresses)) {
41
-		spip_log("Tentative d'injection de mail : $adresses");
42
-
43
-		return false;
44
-	}
45
-
46
-	foreach (explode(',', $adresses) as $v) {
47
-		// nettoyer certains formats
48
-		// "Marie Toto <[email protected]>"
49
-		$adresse = trim(preg_replace(',^[^<>"]*<([^<>"]+)>$,i', "\\1", $v));
50
-		// RFC 822
51
-		if (!preg_match('#^[^()<>@,;:\\"/[:space:]]+(@([-_0-9a-z]+\.)*[-_0-9a-z]+)$#i', $adresse)) {
52
-			return false;
53
-		}
54
-	}
55
-
56
-	return $adresse;
34
+    // eviter d'injecter n'importe quoi dans preg_match
35
+    if (!is_string($adresses)) {
36
+        return false;
37
+    }
38
+
39
+    // Si c'est un spammeur autant arreter tout de suite
40
+    if (preg_match(",[\n\r].*(MIME|multipart|Content-),i", $adresses)) {
41
+        spip_log("Tentative d'injection de mail : $adresses");
42
+
43
+        return false;
44
+    }
45
+
46
+    foreach (explode(',', $adresses) as $v) {
47
+        // nettoyer certains formats
48
+        // "Marie Toto <[email protected]>"
49
+        $adresse = trim(preg_replace(',^[^<>"]*<([^<>"]+)>$,i', "\\1", $v));
50
+        // RFC 822
51
+        if (!preg_match('#^[^()<>@,;:\\"/[:space:]]+(@([-_0-9a-z]+\.)*[-_0-9a-z]+)$#i', $adresse)) {
52
+            return false;
53
+        }
54
+    }
55
+
56
+    return $adresse;
57 57
 }
Please login to merge, or discard this patch.
ecrire/inc/completer_traduction.php 1 patch
Indentation   +38 added lines, -38 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
 /**
@@ -29,51 +29,51 @@  discard block
 block discarded – undo
29 29
  * @return string Erreur éventuelle
30 30
  */
31 31
 function inc_completer_traduction_dist($objet, $id_objet, $id_trad) {
32
-	// dupliquer tous les liens sauf les auteurs : le nouvel auteur est celui qui traduit
33
-	// cf API editer_liens
34
-	include_spip('action/editer_liens');
35
-	objet_dupliquer_liens($objet, $id_trad, $id_objet, null, ['auteur']);
36
-	$_id_table = id_table_objet($objet);
32
+    // dupliquer tous les liens sauf les auteurs : le nouvel auteur est celui qui traduit
33
+    // cf API editer_liens
34
+    include_spip('action/editer_liens');
35
+    objet_dupliquer_liens($objet, $id_trad, $id_objet, null, ['auteur']);
36
+    $_id_table = id_table_objet($objet);
37 37
 
38
-	// recuperer le logo
39
-	$chercher_logo = charger_fonction('chercher_logo', 'inc');
40
-	include_spip('action/editer_logo');
41
-	foreach (['on', 'off'] as $etat) {
42
-		$logo = $chercher_logo($id_trad, $_id_table, $etat);
43
-		if ($logo and $file = reset($logo)) {
44
-			logo_modifier($objet, $id_objet, $etat, $file);
45
-		}
46
-	}
38
+    // recuperer le logo
39
+    $chercher_logo = charger_fonction('chercher_logo', 'inc');
40
+    include_spip('action/editer_logo');
41
+    foreach (['on', 'off'] as $etat) {
42
+        $logo = $chercher_logo($id_trad, $_id_table, $etat);
43
+        if ($logo and $file = reset($logo)) {
44
+            logo_modifier($objet, $id_objet, $etat, $file);
45
+        }
46
+    }
47 47
 
48
-	// dupliquer certains champs
49
-	$trouver_table = charger_fonction('trouver_table', 'base');
50
-	$desc = $trouver_table(table_objet_sql($objet));
51
-	$champs = $set = [];
48
+    // dupliquer certains champs
49
+    $trouver_table = charger_fonction('trouver_table', 'base');
50
+    $desc = $trouver_table(table_objet_sql($objet));
51
+    $champs = $set = [];
52 52
 
53
-	// un éventuel champ 'virtuel' (redirections)
54
-	if (!empty($desc['field']['virtuel'])) {
55
-		$champs[] = 'virtuel';
56
-	}
53
+    // un éventuel champ 'virtuel' (redirections)
54
+    if (!empty($desc['field']['virtuel'])) {
55
+        $champs[] = 'virtuel';
56
+    }
57 57
 
58
-	$data = sql_fetsel('*', $desc['table'], $_id_table . '=' . intval($id_trad));
58
+    $data = sql_fetsel('*', $desc['table'], $_id_table . '=' . intval($id_trad));
59 59
 
60
-	foreach ($champs as $c) {
61
-		$set[$c] = $data[$c];
62
-	}
60
+    foreach ($champs as $c) {
61
+        $set[$c] = $data[$c];
62
+    }
63 63
 
64
-	/*
64
+    /*
65 65
 	 * Le pipeline 'pre_edition' sera appelé avec l'action 'completer_traduction'.
66 66
 	 * Des plugins pourront ainsi compléter les champs d'un objet traduit lors d'une nouvelle traduction.
67 67
 	 */
68
-	$err = objet_modifier_champs(
69
-		$objet,
70
-		$id_objet,
71
-		[
72
-			'data' => $data,
73
-			'action' => 'completer_traduction',
74
-		],
75
-		$set
76
-	);
68
+    $err = objet_modifier_champs(
69
+        $objet,
70
+        $id_objet,
71
+        [
72
+            'data' => $data,
73
+            'action' => 'completer_traduction',
74
+        ],
75
+        $set
76
+    );
77 77
 
78
-	return $err;
78
+    return $err;
79 79
 }
Please login to merge, or discard this patch.
ecrire/inc/cvt_autosave.php 1 patch
Indentation   +73 added lines, -73 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
 /**
@@ -27,7 +27,7 @@  discard block
 block discarded – undo
27 27
  * @return string
28 28
  */
29 29
 function autosave_clean_value($val) {
30
-	return stripslashes(urldecode($val));
30
+    return stripslashes(urldecode($val));
31 31
 }
32 32
 
33 33
 /**
@@ -38,58 +38,58 @@  discard block
 block discarded – undo
38 38
  * @return array
39 39
  */
40 40
 function cvtautosave_formulaire_charger($flux) {
41
-	if (
42
-		is_array($flux['data'])
43
-		and isset($flux['data']['_autosave_id'])
44
-		and $cle_autosave = $flux['data']['_autosave_id']
45
-	) {
46
-		$form = $flux['args']['form'];
47
-		$je_suis_poste = $flux['args']['je_suis_poste'];
41
+    if (
42
+        is_array($flux['data'])
43
+        and isset($flux['data']['_autosave_id'])
44
+        and $cle_autosave = $flux['data']['_autosave_id']
45
+    ) {
46
+        $form = $flux['args']['form'];
47
+        $je_suis_poste = $flux['args']['je_suis_poste'];
48 48
 
49
-		$cle_autosave = serialize($cle_autosave);
50
-		$cle_autosave = $form . '_' . md5($cle_autosave);
49
+        $cle_autosave = serialize($cle_autosave);
50
+        $cle_autosave = $form . '_' . md5($cle_autosave);
51 51
 
52
-		// si on a un backup en session et qu'on est au premier chargement, non poste
53
-		// on restitue les donnees
54
-		if (
55
-			isset($GLOBALS['visiteur_session']['session_autosave_' . $cle_autosave])
56
-			and !$je_suis_poste
57
-		) {
58
-			parse_str($GLOBALS['visiteur_session']['session_autosave_' . $cle_autosave], $vars);
59
-			foreach ($vars as $key => $val) {
60
-				if (isset($flux['data'][$key])) {
61
-					$flux['data'][$key] = (is_string($val) ? autosave_clean_value($val) : array_map(
62
-						'autosave_clean_value',
63
-						$val
64
-					));
65
-				}
66
-			}
67
-		}
52
+        // si on a un backup en session et qu'on est au premier chargement, non poste
53
+        // on restitue les donnees
54
+        if (
55
+            isset($GLOBALS['visiteur_session']['session_autosave_' . $cle_autosave])
56
+            and !$je_suis_poste
57
+        ) {
58
+            parse_str($GLOBALS['visiteur_session']['session_autosave_' . $cle_autosave], $vars);
59
+            foreach ($vars as $key => $val) {
60
+                if (isset($flux['data'][$key])) {
61
+                    $flux['data'][$key] = (is_string($val) ? autosave_clean_value($val) : array_map(
62
+                        'autosave_clean_value',
63
+                        $val
64
+                    ));
65
+                }
66
+            }
67
+        }
68 68
 
69
-		// si on est dans le charger() qui suit le traiter(), l'autosave a normalement ete vide
70
-		// mais si il y a plusieurs sessions il peut y avoir concurrence et un retour de l'autosave
71
-		if ($je_suis_poste and _request('autosave') === $cle_autosave and function_exists('terminer_actualiser_sessions')) {
72
-			terminer_actualiser_sessions();
73
-			// et verifions si jamais l'autosave a fait un come back, dans ce cas on le revide
74
-			if (isset($GLOBALS['visiteur_session']['session_autosave_' . $cle_autosave])) {
75
-				session_set('session_autosave_' . $cle_autosave, null);
76
-				// en court sleep pour etre certain que la concurrence est finie
77
-				sleep(1);
78
-				terminer_actualiser_sessions();
79
-			}
80
-		}
69
+        // si on est dans le charger() qui suit le traiter(), l'autosave a normalement ete vide
70
+        // mais si il y a plusieurs sessions il peut y avoir concurrence et un retour de l'autosave
71
+        if ($je_suis_poste and _request('autosave') === $cle_autosave and function_exists('terminer_actualiser_sessions')) {
72
+            terminer_actualiser_sessions();
73
+            // et verifions si jamais l'autosave a fait un come back, dans ce cas on le revide
74
+            if (isset($GLOBALS['visiteur_session']['session_autosave_' . $cle_autosave])) {
75
+                session_set('session_autosave_' . $cle_autosave, null);
76
+                // en court sleep pour etre certain que la concurrence est finie
77
+                sleep(1);
78
+                terminer_actualiser_sessions();
79
+            }
80
+        }
81 81
 
82 82
 
83
-		/**
84
-		 * Envoyer le input hidden et le bout de js qui l'utilisera
85
-		 */
86
-		$flux['data']['_hidden'] .= "<input type='hidden' name='autosave' class='autosaveactive' value='$cle_autosave' />"
87
-			. '<script type="text/javascript">/*<![CDATA[*/if (window.jQuery) jQuery(function(){
83
+        /**
84
+         * Envoyer le input hidden et le bout de js qui l'utilisera
85
+         */
86
+        $flux['data']['_hidden'] .= "<input type='hidden' name='autosave' class='autosaveactive' value='$cle_autosave' />"
87
+            . '<script type="text/javascript">/*<![CDATA[*/if (window.jQuery) jQuery(function(){
88 88
 		  $("input.autosaveactive").closest("form:not(.autosaveon)").autosave({url:"' . $GLOBALS['meta']['adresse_site'] . '/"}).addClass("autosaveon");
89 89
 			});/*]]>*/</script>';
90
-	}
90
+    }
91 91
 
92
-	return $flux;
92
+    return $flux;
93 93
 }
94 94
 
95 95
 /**
@@ -103,33 +103,33 @@  discard block
 block discarded – undo
103 103
  * @return array
104 104
  */
105 105
 function cvtautosave_formulaire_traiter($flux) {
106
-	// si on poste 'autosave' c'est qu'on n'a plus besoin de sauvegarder :
107
-	// on elimine les donnees de la session
108
-	if ($cle_autosave = _request('autosave')) {
109
-		include_spip('inc/session');
110
-		session_set('session_autosave_' . $cle_autosave, null);
111
-	}
106
+    // si on poste 'autosave' c'est qu'on n'a plus besoin de sauvegarder :
107
+    // on elimine les donnees de la session
108
+    if ($cle_autosave = _request('autosave')) {
109
+        include_spip('inc/session');
110
+        session_set('session_autosave_' . $cle_autosave, null);
111
+    }
112 112
 
113
-	if (isset($GLOBALS['visiteur_session']) and $GLOBALS['visiteur_session']) {
114
-		// delai par defaut avant purge d'un backup de form : 72H
115
-		if (!defined('_AUTOSAVE_GB_DELAY')) {
116
-			define('_AUTOSAVE_GB_DELAY', 72 * 3600);
117
-		}
118
-		$time_too_old = time() - _AUTOSAVE_GB_DELAY;
119
-		// purger aussi toutes les vieilles autosave
120
-		$session = $GLOBALS['visiteur_session'];
121
-		foreach ($session as $k => $v) {
122
-			if (strncmp($k, 'session_autosave_', 17) == 0) {
123
-				$timestamp = 0;
124
-				if (preg_match(',&__timestamp=(\d+)$,', $v, $m)) {
125
-					$timestamp = intval($m[1]);
126
-				}
127
-				if ($timestamp < $time_too_old) {
128
-					session_set($k, null);
129
-				}
130
-			}
131
-		}
132
-	}
113
+    if (isset($GLOBALS['visiteur_session']) and $GLOBALS['visiteur_session']) {
114
+        // delai par defaut avant purge d'un backup de form : 72H
115
+        if (!defined('_AUTOSAVE_GB_DELAY')) {
116
+            define('_AUTOSAVE_GB_DELAY', 72 * 3600);
117
+        }
118
+        $time_too_old = time() - _AUTOSAVE_GB_DELAY;
119
+        // purger aussi toutes les vieilles autosave
120
+        $session = $GLOBALS['visiteur_session'];
121
+        foreach ($session as $k => $v) {
122
+            if (strncmp($k, 'session_autosave_', 17) == 0) {
123
+                $timestamp = 0;
124
+                if (preg_match(',&__timestamp=(\d+)$,', $v, $m)) {
125
+                    $timestamp = intval($m[1]);
126
+                }
127
+                if ($timestamp < $time_too_old) {
128
+                    session_set($k, null);
129
+                }
130
+            }
131
+        }
132
+    }
133 133
 
134
-	return $flux;
134
+    return $flux;
135 135
 }
Please login to merge, or discard this patch.
ecrire/balise/menu_lang_ecrire.php 1 patch
Indentation   +31 added lines, -31 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
 /**
@@ -37,7 +37,7 @@  discard block
 block discarded – undo
37 37
  *     Pile complétée du code compilé
38 38
  **/
39 39
 function balise_MENU_LANG_ECRIRE($p) {
40
-	return calculer_balise_dynamique($p, 'MENU_LANG_ECRIRE', ['lang']);
40
+    return calculer_balise_dynamique($p, 'MENU_LANG_ECRIRE', ['lang']);
41 41
 }
42 42
 
43 43
 /**
@@ -55,12 +55,12 @@  discard block
 block discarded – undo
55 55
  *   Liste (lang) des arguments collectés et fournis.
56 56
  */
57 57
 function balise_MENU_LANG_ECRIRE_stat($args, $context_compil) {
58
-	include_spip('inc/lang');
59
-	if (strpos($GLOBALS['meta']['langues_proposees'], ',') === false) {
60
-		return '';
61
-	}
58
+    include_spip('inc/lang');
59
+    if (strpos($GLOBALS['meta']['langues_proposees'], ',') === false) {
60
+        return '';
61
+    }
62 62
 
63
-	return $args;
63
+    return $args;
64 64
 }
65 65
 
66 66
 /**
@@ -76,7 +76,7 @@  discard block
 block discarded – undo
76 76
  *     Liste : Chemin du squelette, durée du cache, contexte
77 77
  **/
78 78
 function balise_MENU_LANG_ECRIRE_dyn($opt) {
79
-	return menu_lang_pour_tous('var_lang_ecrire', $opt);
79
+    return menu_lang_pour_tous('var_lang_ecrire', $opt);
80 80
 }
81 81
 
82 82
 /**
@@ -96,30 +96,30 @@  discard block
 block discarded – undo
96 96
  *     Liste : Chemin du squelette, durée du cache, contexte
97 97
  **/
98 98
 function menu_lang_pour_tous($nom, $default) {
99
-	include_spip('inc/lang');
99
+    include_spip('inc/lang');
100 100
 
101
-	if ($GLOBALS['spip_lang'] <> $default) {
102
-		$opt = lang_select($default);  # et remplace
103
-		if ($GLOBALS['spip_lang'] <> $default) {
104
-			$default = '';  # annule tout choix par defaut
105
-			if ($opt) {
106
-				lang_select();
107
-			}
108
-		}
109
-	}
101
+    if ($GLOBALS['spip_lang'] <> $default) {
102
+        $opt = lang_select($default);  # et remplace
103
+        if ($GLOBALS['spip_lang'] <> $default) {
104
+            $default = '';  # annule tout choix par defaut
105
+            if ($opt) {
106
+                lang_select();
107
+            }
108
+        }
109
+    }
110 110
 
111
-	# lien a partir de /
112
-	$cible = parametre_url(self(), 'lang', '', '&');
113
-	$post = generer_url_action('converser', 'redirect=' . rawurlencode($cible), '&');
111
+    # lien a partir de /
112
+    $cible = parametre_url(self(), 'lang', '', '&');
113
+    $post = generer_url_action('converser', 'redirect=' . rawurlencode($cible), '&');
114 114
 
115
-	return [
116
-		'formulaires/menu_lang',
117
-		3600,
118
-		[
119
-			'nom' => $nom,
120
-			'url' => $post,
121
-			'name' => $nom,
122
-			'default' => $default,
123
-		]
124
-	];
115
+    return [
116
+        'formulaires/menu_lang',
117
+        3600,
118
+        [
119
+            'nom' => $nom,
120
+            'url' => $post,
121
+            'name' => $nom,
122
+            'default' => $default,
123
+        ]
124
+    ];
125 125
 }
Please login to merge, or discard this patch.
ecrire/balise/menu_lang.php 1 patch
Indentation   +8 added lines, -8 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
 /**
@@ -37,7 +37,7 @@  discard block
 block discarded – undo
37 37
  *     Pile complétée du code compilé
38 38
  **/
39 39
 function balise_MENU_LANG($p) {
40
-	return calculer_balise_dynamique($p, 'MENU_LANG', ['lang']);
40
+    return calculer_balise_dynamique($p, 'MENU_LANG', ['lang']);
41 41
 }
42 42
 
43 43
 /**
@@ -55,11 +55,11 @@  discard block
 block discarded – undo
55 55
  *   Liste (lang) des arguments collectés et fournis.
56 56
  */
57 57
 function balise_MENU_LANG_stat($args, $context_compil) {
58
-	if (strpos($GLOBALS['meta']['langues_multilingue'], ',') === false) {
59
-		return '';
60
-	}
58
+    if (strpos($GLOBALS['meta']['langues_multilingue'], ',') === false) {
59
+        return '';
60
+    }
61 61
 
62
-	return $args;
62
+    return $args;
63 63
 }
64 64
 
65 65
 /**
@@ -75,7 +75,7 @@  discard block
 block discarded – undo
75 75
  *     Liste : Chemin du squelette, durée du cache, contexte
76 76
  **/
77 77
 function balise_MENU_LANG_dyn($opt) {
78
-	include_spip('balise/menu_lang_ecrire');
78
+    include_spip('balise/menu_lang_ecrire');
79 79
 
80
-	return menu_lang_pour_tous('var_lang', $opt);
80
+    return menu_lang_pour_tous('var_lang', $opt);
81 81
 }
Please login to merge, or discard this patch.
ecrire/balise/formulaire_admin.php 1 patch
Indentation   +148 added lines, -148 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
 /**
@@ -42,7 +42,7 @@  discard block
 block discarded – undo
42 42
  *     Pile complétée du code compilé
43 43
  **/
44 44
 function balise_FORMULAIRE_ADMIN($p) {
45
-	return calculer_balise_dynamique($p, 'FORMULAIRE_ADMIN', []);
45
+    return calculer_balise_dynamique($p, 'FORMULAIRE_ADMIN', []);
46 46
 }
47 47
 
48 48
 /**
@@ -59,7 +59,7 @@  discard block
 block discarded – undo
59 59
  *   - chaîne vide sinon.
60 60
  */
61 61
 function balise_FORMULAIRE_ADMIN_stat($args, $context_compil) {
62
-	return $args;
62
+    return $args;
63 63
 }
64 64
 
65 65
 
@@ -84,66 +84,66 @@  discard block
 block discarded – undo
84 84
  **/
85 85
 function balise_FORMULAIRE_ADMIN_dyn($float = '', $debug = '') {
86 86
 
87
-	static $dejafait = false;
87
+    static $dejafait = false;
88 88
 
89
-	if (empty($_COOKIE['spip_admin'])) {
90
-		return '';
91
-	}
89
+    if (empty($_COOKIE['spip_admin'])) {
90
+        return '';
91
+    }
92 92
 
93
-	if (!is_array($debug)) {
94
-		if ($dejafait) {
95
-			return '';
96
-		}
97
-	} else {
98
-		if ($dejafait) {
99
-			if (empty($debug['sourcefile'])) {
100
-				return '';
101
-			}
102
-			foreach ($debug['sourcefile'] as $k => $v) {
103
-				if (strpos($v, 'administration.') !== false) {
104
-					if (isset($debug['resultat'][$k . 'tout'])) {
105
-						return $debug['resultat'][$k . 'tout'];
106
-					}
107
-				}
108
-			}
93
+    if (!is_array($debug)) {
94
+        if ($dejafait) {
95
+            return '';
96
+        }
97
+    } else {
98
+        if ($dejafait) {
99
+            if (empty($debug['sourcefile'])) {
100
+                return '';
101
+            }
102
+            foreach ($debug['sourcefile'] as $k => $v) {
103
+                if (strpos($v, 'administration.') !== false) {
104
+                    if (isset($debug['resultat'][$k . 'tout'])) {
105
+                        return $debug['resultat'][$k . 'tout'];
106
+                    }
107
+                }
108
+            }
109 109
 
110
-			return '';
111
-		}
112
-	}
110
+            return '';
111
+        }
112
+    }
113 113
 
114
-	include_spip('inc/autoriser');
115
-	include_spip('base/abstract_sql');
114
+    include_spip('inc/autoriser');
115
+    include_spip('base/abstract_sql');
116 116
 
117 117
 
118
-	$dejafait = true;
118
+    $dejafait = true;
119 119
 
120
-	// Preparer le #ENV des boutons
120
+    // Preparer le #ENV des boutons
121 121
 
122
-	$env = admin_objet();
122
+    $env = admin_objet();
123 123
 
124
-	// Pas de "modifier ce..." ? -> donner "acces a l'espace prive"
125
-	if (!$env) {
126
-		$env['ecrire'] = _DIR_RESTREINT_ABS;
127
-	}
124
+    // Pas de "modifier ce..." ? -> donner "acces a l'espace prive"
125
+    if (!$env) {
126
+        $env['ecrire'] = _DIR_RESTREINT_ABS;
127
+    }
128 128
 
129
-	$env['divclass'] = $float;
130
-	$env['lang'] = admin_lang();
131
-	$env['calcul'] = (_request('var_mode') ? 'recalcul' : 'calcul');
132
-	$env['debug'] = ((defined('_VAR_PREVIEW') and _VAR_PREVIEW) ? '' : admin_debug());
133
-	$env['analyser'] = (!$env['debug'] and !$GLOBALS['xhtml']) ? '' : admin_valider();
134
-	$env['inclure'] = ((defined('_VAR_INCLURE') and _VAR_INCLURE) ? 'inclure' : '');
129
+    $env['divclass'] = $float;
130
+    $env['lang'] = admin_lang();
131
+    $env['calcul'] = (_request('var_mode') ? 'recalcul' : 'calcul');
132
+    $env['debug'] = ((defined('_VAR_PREVIEW') and _VAR_PREVIEW) ? '' : admin_debug());
133
+    $env['analyser'] = (!$env['debug'] and !$GLOBALS['xhtml']) ? '' : admin_valider();
134
+    $env['inclure'] = ((defined('_VAR_INCLURE') and _VAR_INCLURE) ? 'inclure' : '');
135 135
 
136
-	if (empty($GLOBALS['use_cache'])) {
137
-		$env['use_cache'] = ' *';
138
-	}
136
+    if (empty($GLOBALS['use_cache'])) {
137
+        $env['use_cache'] = ' *';
138
+    }
139 139
 
140
-	if (isset($debug['validation'])) {
141
-		$env['xhtml_error'] = $debug['validation'];
142
-	}
140
+    if (isset($debug['validation'])) {
141
+        $env['xhtml_error'] = $debug['validation'];
142
+    }
143 143
 
144
-	$env['_pipelines']['formulaire_admin'] = [];
144
+    $env['_pipelines']['formulaire_admin'] = [];
145 145
 
146
-	return ['formulaires/administration', 0, $env];
146
+    return ['formulaires/administration', 0, $env];
147 147
 }
148 148
 
149 149
 
@@ -161,47 +161,47 @@  discard block
 block discarded – undo
161 161
  *     Tableau de l'environnement calculé
162 162
  **/
163 163
 function admin_objet() {
164
-	include_spip('inc/urls');
165
-	$env = [];
166
-
167
-	$trouver_table = charger_fonction('trouver_table', 'base');
168
-	$objets = urls_liste_objets(false);
169
-	$objets = array_diff($objets, ['rubrique']);
170
-	$objets = array_reverse($objets);
171
-	array_unshift($objets, 'rubrique');
172
-	foreach ($objets as $obj) {
173
-		$type = $obj;
174
-		if (
175
-			$type == objet_type($type, false)
176
-			and $_id_type = id_table_objet($type)
177
-			and isset($GLOBALS['contexte'][$_id_type])
178
-			and $id = $GLOBALS['contexte'][$_id_type]
179
-			and !is_array($id)
180
-			and $id = intval($id)
181
-			and $desc = $trouver_table(table_objet_sql($type))
182
-		) {
183
-			$id = sql_getfetsel($_id_type, table_objet_sql($type), "$_id_type=" . intval($id));
184
-			if ($id) {
185
-				$env[$_id_type] = $id;
186
-				$env['objet'] = $type;
187
-				$env['id_objet'] = $id;
188
-				$env['voir_' . $obj] =
189
-					str_replace('&amp;', '&', generer_url_entite($id, $obj, '', '', false));
190
-				if (
191
-					isset($desc['field']['id_rubrique'])
192
-					and $type != 'rubrique'
193
-				) {
194
-					unset($env['id_rubrique']);
195
-					unset($env['voir_rubrique']);
196
-					if (admin_preview($type, $id, $desc)) {
197
-						$env['preview'] = parametre_url(self(), 'var_mode', 'preview', '&');
198
-					}
199
-				}
200
-			}
201
-		}
202
-	}
203
-
204
-	return $env;
164
+    include_spip('inc/urls');
165
+    $env = [];
166
+
167
+    $trouver_table = charger_fonction('trouver_table', 'base');
168
+    $objets = urls_liste_objets(false);
169
+    $objets = array_diff($objets, ['rubrique']);
170
+    $objets = array_reverse($objets);
171
+    array_unshift($objets, 'rubrique');
172
+    foreach ($objets as $obj) {
173
+        $type = $obj;
174
+        if (
175
+            $type == objet_type($type, false)
176
+            and $_id_type = id_table_objet($type)
177
+            and isset($GLOBALS['contexte'][$_id_type])
178
+            and $id = $GLOBALS['contexte'][$_id_type]
179
+            and !is_array($id)
180
+            and $id = intval($id)
181
+            and $desc = $trouver_table(table_objet_sql($type))
182
+        ) {
183
+            $id = sql_getfetsel($_id_type, table_objet_sql($type), "$_id_type=" . intval($id));
184
+            if ($id) {
185
+                $env[$_id_type] = $id;
186
+                $env['objet'] = $type;
187
+                $env['id_objet'] = $id;
188
+                $env['voir_' . $obj] =
189
+                    str_replace('&amp;', '&', generer_url_entite($id, $obj, '', '', false));
190
+                if (
191
+                    isset($desc['field']['id_rubrique'])
192
+                    and $type != 'rubrique'
193
+                ) {
194
+                    unset($env['id_rubrique']);
195
+                    unset($env['voir_rubrique']);
196
+                    if (admin_preview($type, $id, $desc)) {
197
+                        $env['preview'] = parametre_url(self(), 'var_mode', 'preview', '&');
198
+                    }
199
+                }
200
+            }
201
+        }
202
+    }
203
+
204
+    return $env;
205 205
 }
206 206
 
207 207
 
@@ -219,30 +219,30 @@  discard block
 block discarded – undo
219 219
  *     - Tableau d'un élément sinon.
220 220
  **/
221 221
 function admin_preview($type, $id, $desc = null) {
222
-	if (defined('_VAR_PREVIEW') and _VAR_PREVIEW) {
223
-		return '';
224
-	}
225
-
226
-	if (!$desc) {
227
-		$trouver_table = charger_fonction('trouver_table', 'base');
228
-		$desc = $trouver_table(table_objet_sql($type));
229
-	}
230
-	if (!$desc or !isset($desc['field']['statut'])) {
231
-		return '';
232
-	}
233
-
234
-	include_spip('inc/autoriser');
235
-	if (!autoriser('previsualiser')) {
236
-		return '';
237
-	}
238
-
239
-	$notpub = sql_in('statut', ['prop', 'prive']);
240
-
241
-	if ($type == 'article' and $GLOBALS['meta']['post_dates'] != 'oui') {
242
-		$notpub .= " OR (statut='publie' AND date>" . sql_quote(date('Y-m-d H:i:s')) . ')';
243
-	}
244
-
245
-	return sql_fetsel('1', table_objet_sql($type), id_table_objet($type) . '=' . $id . " AND ($notpub)");
222
+    if (defined('_VAR_PREVIEW') and _VAR_PREVIEW) {
223
+        return '';
224
+    }
225
+
226
+    if (!$desc) {
227
+        $trouver_table = charger_fonction('trouver_table', 'base');
228
+        $desc = $trouver_table(table_objet_sql($type));
229
+    }
230
+    if (!$desc or !isset($desc['field']['statut'])) {
231
+        return '';
232
+    }
233
+
234
+    include_spip('inc/autoriser');
235
+    if (!autoriser('previsualiser')) {
236
+        return '';
237
+    }
238
+
239
+    $notpub = sql_in('statut', ['prop', 'prive']);
240
+
241
+    if ($type == 'article' and $GLOBALS['meta']['post_dates'] != 'oui') {
242
+        $notpub .= " OR (statut='publie' AND date>" . sql_quote(date('Y-m-d H:i:s')) . ')';
243
+    }
244
+
245
+    return sql_fetsel('1', table_objet_sql($type), id_table_objet($type) . '=' . $id . " AND ($notpub)");
246 246
 }
247 247
 
248 248
 
@@ -253,25 +253,25 @@  discard block
 block discarded – undo
253 253
  *     Code de langue
254 254
  **/
255 255
 function admin_lang() {
256
-	$alang = '';
257
-	if (!empty($_COOKIE['spip_admin'])) {
258
-		$email_or_login = preg_replace(',^@,', '', $_COOKIE['spip_admin']);
259
-		$alang = sql_getfetsel('lang', 'spip_auteurs', 'email=' . sql_quote($email_or_login));
260
-		if (!$alang) {
261
-			$alang = sql_getfetsel('lang', 'spip_auteurs', 'login=' . sql_quote($email_or_login));
262
-		}
263
-	}
264
-	if (!$alang) {
265
-		return '';
266
-	}
267
-
268
-	$l = lang_select($alang);
269
-	$alang = $GLOBALS['spip_lang'];
270
-	if ($l) {
271
-		lang_select();
272
-	}
273
-
274
-	return $alang;
256
+    $alang = '';
257
+    if (!empty($_COOKIE['spip_admin'])) {
258
+        $email_or_login = preg_replace(',^@,', '', $_COOKIE['spip_admin']);
259
+        $alang = sql_getfetsel('lang', 'spip_auteurs', 'email=' . sql_quote($email_or_login));
260
+        if (!$alang) {
261
+            $alang = sql_getfetsel('lang', 'spip_auteurs', 'login=' . sql_quote($email_or_login));
262
+        }
263
+    }
264
+    if (!$alang) {
265
+        return '';
266
+    }
267
+
268
+    $l = lang_select($alang);
269
+    $alang = $GLOBALS['spip_lang'];
270
+    if ($l) {
271
+        lang_select();
272
+    }
273
+
274
+    return $alang;
275 275
 }
276 276
 
277 277
 /**
@@ -281,11 +281,11 @@  discard block
 block discarded – undo
281 281
  **/
282 282
 function admin_valider() {
283 283
 
284
-	return ((!isset($GLOBALS['xhtml']) or $GLOBALS['xhtml'] !== 'true') ?
285
-		(parametre_url(self(), 'var_mode', 'debug', '&')
286
-			. '&var_mode_affiche=validation') :
287
-		('http://validator.w3.org/check?uri='
288
-			. rawurlencode('http://' . $_SERVER['HTTP_HOST'] . nettoyer_uri())));
284
+    return ((!isset($GLOBALS['xhtml']) or $GLOBALS['xhtml'] !== 'true') ?
285
+        (parametre_url(self(), 'var_mode', 'debug', '&')
286
+            . '&var_mode_affiche=validation') :
287
+        ('http://validator.w3.org/check?uri='
288
+            . rawurlencode('http://' . $_SERVER['HTTP_HOST'] . nettoyer_uri())));
289 289
 }
290 290
 
291 291
 /**
@@ -294,14 +294,14 @@  discard block
 block discarded – undo
294 294
  * @return string
295 295
  **/
296 296
 function admin_debug() {
297
-	return ((
298
-			(isset($GLOBALS['forcer_debug']) and $GLOBALS['forcer_debug'])
299
-			or (isset($GLOBALS['bouton_admin_debug']) and $GLOBALS['bouton_admin_debug'])
300
-			or (
301
-				defined('_VAR_MODE') and _VAR_MODE == 'debug'
302
-				and isset($_COOKIE['spip_debug']) and $_COOKIE['spip_debug']
303
-			)
304
-		) and autoriser('debug')
305
-	)
306
-		? parametre_url(self(), 'var_mode', 'debug', '&') : '';
297
+    return ((
298
+            (isset($GLOBALS['forcer_debug']) and $GLOBALS['forcer_debug'])
299
+            or (isset($GLOBALS['bouton_admin_debug']) and $GLOBALS['bouton_admin_debug'])
300
+            or (
301
+                defined('_VAR_MODE') and _VAR_MODE == 'debug'
302
+                and isset($_COOKIE['spip_debug']) and $_COOKIE['spip_debug']
303
+            )
304
+        ) and autoriser('debug')
305
+    )
306
+        ? parametre_url(self(), 'var_mode', 'debug', '&') : '';
307 307
 }
Please login to merge, or discard this patch.
ecrire/balise/url_.php 1 patch
Indentation   +155 added lines, -155 removed lines patch added patch discarded remove patch
@@ -19,7 +19,7 @@  discard block
 block discarded – undo
19 19
  **/
20 20
 
21 21
 if (!defined('_ECRIRE_INC_VERSION')) {
22
-	return;
22
+    return;
23 23
 }
24 24
 
25 25
 /**
@@ -37,14 +37,14 @@  discard block
 block discarded – undo
37 37
  *     Code compilé
38 38
  **/
39 39
 function generer_generer_url($type, $p) {
40
-	$_id = interprete_argument_balise(1, $p);
40
+    $_id = interprete_argument_balise(1, $p);
41 41
 
42
-	if (!$_id) {
43
-		$primary = id_table_objet($type);
44
-		$_id = champ_sql($primary, $p);
45
-	}
42
+    if (!$_id) {
43
+        $primary = id_table_objet($type);
44
+        $_id = champ_sql($primary, $p);
45
+    }
46 46
 
47
-	return generer_generer_url_arg($type, $p, $_id);
47
+    return generer_generer_url_arg($type, $p, $_id);
48 48
 }
49 49
 
50 50
 /**
@@ -73,28 +73,28 @@  discard block
 block discarded – undo
73 73
  *     Code compilé
74 74
  **/
75 75
 function generer_generer_url_arg($type, $p, $_id) {
76
-	if ($s = trouver_nom_serveur_distant($p)) {
77
-		// si une fonction de generation des url a ete definie pour ce connect l'utiliser
78
-		if (function_exists($f = 'generer_generer_url_' . $s)) {
79
-			return $f($type, $_id, $s);
80
-		}
81
-		if (!$GLOBALS['connexions'][strtolower($s)]['spip_connect_version']) {
82
-			return null;
83
-		}
84
-		$s = _q($s);
85
-		# exception des urls de documents sur un serveur distant...
86
-		if ($type == 'document') {
87
-			return
88
-				"quete_meta('adresse_site', $s) . '/' .\n\t" .
89
-				"quete_meta('dir_img', $s) . \n\t" .
90
-				"quete_fichier($_id,$s)";
91
-		}
92
-		$s = ", '', '', $s, quete_meta('type_urls', $s)";
93
-	} else {
94
-		$s = ", '', '', true";
95
-	}
96
-
97
-	return "urlencode_1738(generer_url_entite($_id, '$type'$s))";
76
+    if ($s = trouver_nom_serveur_distant($p)) {
77
+        // si une fonction de generation des url a ete definie pour ce connect l'utiliser
78
+        if (function_exists($f = 'generer_generer_url_' . $s)) {
79
+            return $f($type, $_id, $s);
80
+        }
81
+        if (!$GLOBALS['connexions'][strtolower($s)]['spip_connect_version']) {
82
+            return null;
83
+        }
84
+        $s = _q($s);
85
+        # exception des urls de documents sur un serveur distant...
86
+        if ($type == 'document') {
87
+            return
88
+                "quete_meta('adresse_site', $s) . '/' .\n\t" .
89
+                "quete_meta('dir_img', $s) . \n\t" .
90
+                "quete_fichier($_id,$s)";
91
+        }
92
+        $s = ", '', '', $s, quete_meta('type_urls', $s)";
93
+    } else {
94
+        $s = ", '', '', true";
95
+    }
96
+
97
+    return "urlencode_1738(generer_url_entite($_id, '$type'$s))";
98 98
 }
99 99
 
100 100
 
@@ -119,27 +119,27 @@  discard block
 block discarded – undo
119 119
  */
120 120
 function balise_URL__dist($p) {
121 121
 
122
-	$nom = $p->nom_champ;
123
-	if ($nom === 'URL_') {
124
-		$msg = ['zbug_balise_sans_argument', ['balise' => ' URL_']];
125
-		erreur_squelette($msg, $p);
126
-		$p->interdire_scripts = false;
127
-
128
-		return $p;
129
-	} elseif ($f = charger_fonction($nom, 'balise', true)) {
130
-		return $f($p);
131
-	} else {
132
-		$nom = strtolower($nom);
133
-		$code = generer_generer_url(substr($nom, 4), $p);
134
-		$code = champ_sql($nom, $p, $code);
135
-		$p->code = $code;
136
-		if (!$p->etoile) {
137
-			$p->code = "vider_url($code)";
138
-		}
139
-		$p->interdire_scripts = false;
140
-
141
-		return $p;
142
-	}
122
+    $nom = $p->nom_champ;
123
+    if ($nom === 'URL_') {
124
+        $msg = ['zbug_balise_sans_argument', ['balise' => ' URL_']];
125
+        erreur_squelette($msg, $p);
126
+        $p->interdire_scripts = false;
127
+
128
+        return $p;
129
+    } elseif ($f = charger_fonction($nom, 'balise', true)) {
130
+        return $f($p);
131
+    } else {
132
+        $nom = strtolower($nom);
133
+        $code = generer_generer_url(substr($nom, 4), $p);
134
+        $code = champ_sql($nom, $p, $code);
135
+        $p->code = $code;
136
+        if (!$p->etoile) {
137
+            $p->code = "vider_url($code)";
138
+        }
139
+        $p->interdire_scripts = false;
140
+
141
+        return $p;
142
+    }
143 143
 }
144 144
 
145 145
 /**
@@ -163,20 +163,20 @@  discard block
 block discarded – undo
163 163
  */
164 164
 function balise_URL_ARTICLE_dist($p) {
165 165
 
166
-	// Cas particulier des boucles (SYNDIC_ARTICLES)
167
-	if ($p->type_requete == 'syndic_articles') {
168
-		$code = champ_sql('url', $p);
169
-	} else {
170
-		$code = generer_generer_url('article', $p);
171
-	}
166
+    // Cas particulier des boucles (SYNDIC_ARTICLES)
167
+    if ($p->type_requete == 'syndic_articles') {
168
+        $code = champ_sql('url', $p);
169
+    } else {
170
+        $code = generer_generer_url('article', $p);
171
+    }
172 172
 
173
-	$p->code = $code;
174
-	if (!$p->etoile) {
175
-		$p->code = "vider_url($code)";
176
-	}
177
-	$p->interdire_scripts = false;
173
+    $p->code = $code;
174
+    if (!$p->etoile) {
175
+        $p->code = "vider_url($code)";
176
+    }
177
+    $p->interdire_scripts = false;
178 178
 
179
-	return $p;
179
+    return $p;
180 180
 }
181 181
 
182 182
 /**
@@ -196,21 +196,21 @@  discard block
 block discarded – undo
196 196
  *     Pile complétée par le code à générer
197 197
  */
198 198
 function balise_URL_SITE_dist($p) {
199
-	$code = champ_sql('url_site', $p);
200
-	if (strpos($code, '@$Pile[0]') !== false) {
201
-		$code = generer_generer_url('site', $p);
202
-		if ($code === null) {
203
-			return null;
204
-		}
205
-	} else {
206
-		if (!$p->etoile) {
207
-			$code = "calculer_url($code,'','url', \$connect)";
208
-		}
209
-	}
210
-	$p->code = $code;
211
-	$p->interdire_scripts = false;
212
-
213
-	return $p;
199
+    $code = champ_sql('url_site', $p);
200
+    if (strpos($code, '@$Pile[0]') !== false) {
201
+        $code = generer_generer_url('site', $p);
202
+        if ($code === null) {
203
+            return null;
204
+        }
205
+    } else {
206
+        if (!$p->etoile) {
207
+            $code = "calculer_url($code,'','url', \$connect)";
208
+        }
209
+    }
210
+    $p->code = $code;
211
+    $p->interdire_scripts = false;
212
+
213
+    return $p;
214 214
 }
215 215
 
216 216
 // Autres balises URL_*, qui ne concernent pas une table
@@ -229,11 +229,11 @@  discard block
 block discarded – undo
229 229
  *     Pile complétée par le code à générer
230 230
  */
231 231
 function balise_URL_SITE_SPIP_dist($p) {
232
-	$p->code = "sinon(\$GLOBALS['meta']['adresse_site'],'.')";
233
-	$p->code = 'spip_htmlspecialchars(' . $p->code . ')';
234
-	$p->interdire_scripts = false;
232
+    $p->code = "sinon(\$GLOBALS['meta']['adresse_site'],'.')";
233
+    $p->code = 'spip_htmlspecialchars(' . $p->code . ')';
234
+    $p->interdire_scripts = false;
235 235
 
236
-	return $p;
236
+    return $p;
237 237
 }
238 238
 
239 239
 
@@ -262,42 +262,42 @@  discard block
 block discarded – undo
262 262
  */
263 263
 function balise_URL_PAGE_dist($p) {
264 264
 
265
-	$code = interprete_argument_balise(1, $p);
266
-	$args = interprete_argument_balise(2, $p);
267
-	if ($args == null) {
268
-		$args = "''";
269
-	}
270
-
271
-	if ($s = trouver_nom_serveur_distant($p)) {
272
-		// si une fonction de generation des url a ete definie pour ce connect l'utiliser
273
-		// elle devra aussi traiter le cas derogatoire type=page
274
-		if (function_exists($f = 'generer_generer_url_' . $s)) {
275
-			if ($args and $args !== "''") {
276
-				$code .= ", $args";
277
-			}
278
-			$code = $f('page', $code, $s);
279
-			$p->code = $code;
280
-			return $p;
281
-		}
282
-		$s = 'connect=' . addslashes($s);
283
-		$args = (($args and $args !== "''") ? "$args . '&$s'" : "'$s'");
284
-	}
285
-
286
-	if (!$code) {
287
-		$noentities = $p->etoile ? "'&'" : '';
288
-		$code = "url_de_base() . preg_replace(',^./,', '', self($noentities))";
289
-	} else {
290
-		if (!$args) {
291
-			$args = "''";
292
-		}
293
-		$noentities = $p->etoile ? ', true' : '';
294
-		$code = "generer_url_public($code, $args$noentities)";
295
-	}
296
-	$p->code = $code;
297
-	spip_log("Calcul url page : connect vaut $s ca donne :" . $p->code . " args $args", _LOG_INFO);
298
-
299
-	#$p->interdire_scripts = true;
300
-	return $p;
265
+    $code = interprete_argument_balise(1, $p);
266
+    $args = interprete_argument_balise(2, $p);
267
+    if ($args == null) {
268
+        $args = "''";
269
+    }
270
+
271
+    if ($s = trouver_nom_serveur_distant($p)) {
272
+        // si une fonction de generation des url a ete definie pour ce connect l'utiliser
273
+        // elle devra aussi traiter le cas derogatoire type=page
274
+        if (function_exists($f = 'generer_generer_url_' . $s)) {
275
+            if ($args and $args !== "''") {
276
+                $code .= ", $args";
277
+            }
278
+            $code = $f('page', $code, $s);
279
+            $p->code = $code;
280
+            return $p;
281
+        }
282
+        $s = 'connect=' . addslashes($s);
283
+        $args = (($args and $args !== "''") ? "$args . '&$s'" : "'$s'");
284
+    }
285
+
286
+    if (!$code) {
287
+        $noentities = $p->etoile ? "'&'" : '';
288
+        $code = "url_de_base() . preg_replace(',^./,', '', self($noentities))";
289
+    } else {
290
+        if (!$args) {
291
+            $args = "''";
292
+        }
293
+        $noentities = $p->etoile ? ', true' : '';
294
+        $code = "generer_url_public($code, $args$noentities)";
295
+    }
296
+    $p->code = $code;
297
+    spip_log("Calcul url page : connect vaut $s ca donne :" . $p->code . " args $args", _LOG_INFO);
298
+
299
+    #$p->interdire_scripts = true;
300
+    return $p;
301 301
 }
302 302
 
303 303
 
@@ -324,24 +324,24 @@  discard block
 block discarded – undo
324 324
  */
325 325
 function balise_URL_ECRIRE_dist($p) {
326 326
 
327
-	$code = interprete_argument_balise(1, $p);
328
-	if (!$code) {
329
-		$fonc = "''";
330
-	} else {
331
-		$fonc = $code;
332
-		$args = interprete_argument_balise(2, $p);
333
-		if ($args === null) {
334
-			$args = "''";
335
-		}
336
-		$noentities = $p->etoile ? ', true' : '';
337
-		if (($args != "''") or $noentities) {
338
-			$fonc .= ",$args$noentities";
339
-		}
340
-	}
341
-	$p->code = 'generer_url_ecrire(' . $fonc . ')';
342
-	$p->interdire_scripts = false;
343
-
344
-	return $p;
327
+    $code = interprete_argument_balise(1, $p);
328
+    if (!$code) {
329
+        $fonc = "''";
330
+    } else {
331
+        $fonc = $code;
332
+        $args = interprete_argument_balise(2, $p);
333
+        if ($args === null) {
334
+            $args = "''";
335
+        }
336
+        $noentities = $p->etoile ? ', true' : '';
337
+        if (($args != "''") or $noentities) {
338
+            $fonc .= ",$args$noentities";
339
+        }
340
+    }
341
+    $p->code = 'generer_url_ecrire(' . $fonc . ')';
342
+    $p->interdire_scripts = false;
343
+
344
+    return $p;
345 345
 }
346 346
 
347 347
 
@@ -367,24 +367,24 @@  discard block
 block discarded – undo
367 367
  *     Pile complétée par le code à générer
368 368
  */
369 369
 function balise_URL_ACTION_AUTEUR_dist($p) {
370
-	$p->descr['session'] = true;
371
-
372
-	$p->code = interprete_argument_balise(1, $p);
373
-
374
-	$args = interprete_argument_balise(2, $p);
375
-	if ($args != "''" && $args !== null) {
376
-		$p->code .= ',' . $args;
377
-	}
378
-	$redirect = interprete_argument_balise(3, $p);
379
-	if ($redirect != "''" && $redirect !== null) {
380
-		if ($args == "''" || $args === null) {
381
-			$p->code .= ",''";
382
-		}
383
-		$p->code .= ',' . $redirect;
384
-	}
385
-
386
-	$p->code = 'generer_action_auteur(' . $p->code . ')';
387
-	$p->interdire_scripts = false;
388
-
389
-	return $p;
370
+    $p->descr['session'] = true;
371
+
372
+    $p->code = interprete_argument_balise(1, $p);
373
+
374
+    $args = interprete_argument_balise(2, $p);
375
+    if ($args != "''" && $args !== null) {
376
+        $p->code .= ',' . $args;
377
+    }
378
+    $redirect = interprete_argument_balise(3, $p);
379
+    if ($redirect != "''" && $redirect !== null) {
380
+        if ($args == "''" || $args === null) {
381
+            $p->code .= ",''";
382
+        }
383
+        $p->code .= ',' . $redirect;
384
+    }
385
+
386
+    $p->code = 'generer_action_auteur(' . $p->code . ')';
387
+    $p->interdire_scripts = false;
388
+
389
+    return $p;
390 390
 }
Please login to merge, or discard this patch.
ecrire/balise/formulaire_ecrire_auteur.php 1 patch
Indentation   +38 added lines, -38 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('base/abstract_sql');
@@ -41,7 +41,7 @@  discard block
 block discarded – undo
41 41
  *     Pile complétée du code compilé
42 42
  **/
43 43
 function balise_FORMULAIRE_ECRIRE_AUTEUR($p) {
44
-	return calculer_balise_dynamique($p, 'FORMULAIRE_ECRIRE_AUTEUR', ['id_auteur', 'id_article', 'email']);
44
+    return calculer_balise_dynamique($p, 'FORMULAIRE_ECRIRE_AUTEUR', ['id_auteur', 'id_article', 'email']);
45 45
 }
46 46
 
47 47
 /**
@@ -59,44 +59,44 @@  discard block
 block discarded – undo
59 59
  *   - chaîne vide sinon (erreur ou non affichage).
60 60
  */
61 61
 function balise_FORMULAIRE_ECRIRE_AUTEUR_stat($args, $context_compil) {
62
-	include_spip('inc/filtres');
63
-	// Pas d'id_auteur ni d'id_article ? Erreur de contexte
64
-	$id = intval($args[1]);
65
-	if (!$args[0] and !$id) {
66
-		$msg = [
67
-			'zbug_champ_hors_motif',
68
-			[
69
-				'champ' => 'FORMULAIRE_ECRIRE_AUTEUR',
70
-				'motif' => 'AUTEURS/ARTICLES'
71
-			]
72
-		];
62
+    include_spip('inc/filtres');
63
+    // Pas d'id_auteur ni d'id_article ? Erreur de contexte
64
+    $id = intval($args[1]);
65
+    if (!$args[0] and !$id) {
66
+        $msg = [
67
+            'zbug_champ_hors_motif',
68
+            [
69
+                'champ' => 'FORMULAIRE_ECRIRE_AUTEUR',
70
+                'motif' => 'AUTEURS/ARTICLES'
71
+            ]
72
+        ];
73 73
 
74
-		erreur_squelette($msg, $context_compil);
74
+        erreur_squelette($msg, $context_compil);
75 75
 
76
-		return '';
77
-	}
78
-	// Si on est dans un contexte article,
79
-	// sortir tous les mails des auteurs de l'article
80
-	if (!$args[0] and $id) {
81
-		$r = '';
82
-		$s = sql_allfetsel(
83
-			'email',
84
-			'spip_auteurs AS A LEFT JOIN spip_auteurs_liens AS L ON (A.id_auteur=L.id_auteur AND L.objet=\'article\')',
85
-			"A.email != '' AND L.id_objet=$id"
86
-		);
87
-		foreach ($s as $row) {
88
-			if (email_valide($row['email'])) {
89
-				$r .= ', ' . $row['email'];
90
-			}
91
-		}
92
-		$args[2] = substr($r, 2);
93
-	}
76
+        return '';
77
+    }
78
+    // Si on est dans un contexte article,
79
+    // sortir tous les mails des auteurs de l'article
80
+    if (!$args[0] and $id) {
81
+        $r = '';
82
+        $s = sql_allfetsel(
83
+            'email',
84
+            'spip_auteurs AS A LEFT JOIN spip_auteurs_liens AS L ON (A.id_auteur=L.id_auteur AND L.objet=\'article\')',
85
+            "A.email != '' AND L.id_objet=$id"
86
+        );
87
+        foreach ($s as $row) {
88
+            if (email_valide($row['email'])) {
89
+                $r .= ', ' . $row['email'];
90
+            }
91
+        }
92
+        $args[2] = substr($r, 2);
93
+    }
94 94
 
95
-	// On ne peut pas ecrire a un auteur dont le mail n'est pas valide
96
-	if (!$args[2] or !email_valide($args[2])) {
97
-		return '';
98
-	}
95
+    // On ne peut pas ecrire a un auteur dont le mail n'est pas valide
96
+    if (!$args[2] or !email_valide($args[2])) {
97
+        return '';
98
+    }
99 99
 
100
-	// OK
101
-	return $args;
100
+    // OK
101
+    return $args;
102 102
 }
Please login to merge, or discard this patch.
ecrire/charsets/iso-8859-1.php 1 patch
Indentation   +128 added lines, -128 removed lines patch added patch discarded remove patch
@@ -11,134 +11,134 @@
 block discarded – undo
11 11
 // plage invalide en iso-8859-1 mais souvent utilisee quand meme (windows)
12 12
 // cf. http://openweb.eu.org/articles/caracteres_illegaux/
13 13
 // voir aussi copie de ces valeurs dans inc/charsets.php
14
-	128 => 8364,
15
-	129 => 129 /* ?? */,
16
-	130 => 8218,
17
-	131 => 402,
18
-	132 => 8222,
19
-	133 => 8230,
20
-	134 => 8224,
21
-	135 => 8225,
22
-	136 => 710,
23
-	137 => 8240,
24
-	138 => 352,
25
-	139 => 8249,
26
-	140 => 338,
27
-	141 => 141 /* ?? */,
28
-	142 => 381,
29
-	143 => 143 /* ?? */,
30
-	144 => 144 /* ?? */,
31
-	145 => 8216,
32
-	146 => 8217,
33
-	147 => 8220,
34
-	148 => 8221,
35
-	149 => 8226,
36
-	150 => 8211,
37
-	151 => 8212,
38
-	152 => 732,
39
-	153 => 8482,
40
-	154 => 353,
41
-	155 => 8250,
42
-	156 => 339,
43
-	157 => 157 /* ?? */,
44
-	158 => 382,
45
-	159 => 376,
14
+    128 => 8364,
15
+    129 => 129 /* ?? */,
16
+    130 => 8218,
17
+    131 => 402,
18
+    132 => 8222,
19
+    133 => 8230,
20
+    134 => 8224,
21
+    135 => 8225,
22
+    136 => 710,
23
+    137 => 8240,
24
+    138 => 352,
25
+    139 => 8249,
26
+    140 => 338,
27
+    141 => 141 /* ?? */,
28
+    142 => 381,
29
+    143 => 143 /* ?? */,
30
+    144 => 144 /* ?? */,
31
+    145 => 8216,
32
+    146 => 8217,
33
+    147 => 8220,
34
+    148 => 8221,
35
+    149 => 8226,
36
+    150 => 8211,
37
+    151 => 8212,
38
+    152 => 732,
39
+    153 => 8482,
40
+    154 => 353,
41
+    155 => 8250,
42
+    156 => 339,
43
+    157 => 157 /* ?? */,
44
+    158 => 382,
45
+    159 => 376,
46 46
 
47
-	160 => 160,
48
-	161 => 161,
49
-	162 => 162,
50
-	163 => 163,
51
-	164 => 164,
52
-	165 => 165,
53
-	166 => 166,
54
-	167 => 167,
55
-	168 => 168,
56
-	169 => 169,
57
-	170 => 170,
58
-	171 => 171,
59
-	172 => 172,
60
-	173 => 173,
61
-	174 => 174,
62
-	175 => 175,
63
-	176 => 176,
64
-	177 => 177,
65
-	178 => 178,
66
-	179 => 179,
67
-	180 => 180,
68
-	181 => 181,
69
-	182 => 182,
70
-	183 => 183,
71
-	184 => 184,
72
-	185 => 185,
73
-	186 => 186,
74
-	187 => 187,
75
-	188 => 188,
76
-	189 => 189,
77
-	190 => 190,
78
-	191 => 191,
79
-	192 => 192,
80
-	193 => 193,
81
-	194 => 194,
82
-	195 => 195,
83
-	196 => 196,
84
-	197 => 197,
85
-	198 => 198,
86
-	199 => 199,
87
-	200 => 200,
88
-	201 => 201,
89
-	202 => 202,
90
-	203 => 203,
91
-	204 => 204,
92
-	205 => 205,
93
-	206 => 206,
94
-	207 => 207,
95
-	208 => 208,
96
-	209 => 209,
97
-	210 => 210,
98
-	211 => 211,
99
-	212 => 212,
100
-	213 => 213,
101
-	214 => 214,
102
-	215 => 215,
103
-	216 => 216,
104
-	217 => 217,
105
-	218 => 218,
106
-	219 => 219,
107
-	220 => 220,
108
-	221 => 221,
109
-	222 => 222,
110
-	223 => 223,
111
-	224 => 224,
112
-	225 => 225,
113
-	226 => 226,
114
-	227 => 227,
115
-	228 => 228,
116
-	229 => 229,
117
-	230 => 230,
118
-	231 => 231,
119
-	232 => 232,
120
-	233 => 233,
121
-	234 => 234,
122
-	235 => 235,
123
-	236 => 236,
124
-	237 => 237,
125
-	238 => 238,
126
-	239 => 239,
127
-	240 => 240,
128
-	241 => 241,
129
-	242 => 242,
130
-	243 => 243,
131
-	244 => 244,
132
-	245 => 245,
133
-	246 => 246,
134
-	247 => 247,
135
-	248 => 248,
136
-	249 => 249,
137
-	250 => 250,
138
-	251 => 251,
139
-	252 => 252,
140
-	253 => 253,
141
-	254 => 254,
142
-	255 => 255
47
+    160 => 160,
48
+    161 => 161,
49
+    162 => 162,
50
+    163 => 163,
51
+    164 => 164,
52
+    165 => 165,
53
+    166 => 166,
54
+    167 => 167,
55
+    168 => 168,
56
+    169 => 169,
57
+    170 => 170,
58
+    171 => 171,
59
+    172 => 172,
60
+    173 => 173,
61
+    174 => 174,
62
+    175 => 175,
63
+    176 => 176,
64
+    177 => 177,
65
+    178 => 178,
66
+    179 => 179,
67
+    180 => 180,
68
+    181 => 181,
69
+    182 => 182,
70
+    183 => 183,
71
+    184 => 184,
72
+    185 => 185,
73
+    186 => 186,
74
+    187 => 187,
75
+    188 => 188,
76
+    189 => 189,
77
+    190 => 190,
78
+    191 => 191,
79
+    192 => 192,
80
+    193 => 193,
81
+    194 => 194,
82
+    195 => 195,
83
+    196 => 196,
84
+    197 => 197,
85
+    198 => 198,
86
+    199 => 199,
87
+    200 => 200,
88
+    201 => 201,
89
+    202 => 202,
90
+    203 => 203,
91
+    204 => 204,
92
+    205 => 205,
93
+    206 => 206,
94
+    207 => 207,
95
+    208 => 208,
96
+    209 => 209,
97
+    210 => 210,
98
+    211 => 211,
99
+    212 => 212,
100
+    213 => 213,
101
+    214 => 214,
102
+    215 => 215,
103
+    216 => 216,
104
+    217 => 217,
105
+    218 => 218,
106
+    219 => 219,
107
+    220 => 220,
108
+    221 => 221,
109
+    222 => 222,
110
+    223 => 223,
111
+    224 => 224,
112
+    225 => 225,
113
+    226 => 226,
114
+    227 => 227,
115
+    228 => 228,
116
+    229 => 229,
117
+    230 => 230,
118
+    231 => 231,
119
+    232 => 232,
120
+    233 => 233,
121
+    234 => 234,
122
+    235 => 235,
123
+    236 => 236,
124
+    237 => 237,
125
+    238 => 238,
126
+    239 => 239,
127
+    240 => 240,
128
+    241 => 241,
129
+    242 => 242,
130
+    243 => 243,
131
+    244 => 244,
132
+    245 => 245,
133
+    246 => 246,
134
+    247 => 247,
135
+    248 => 248,
136
+    249 => 249,
137
+    250 => 250,
138
+    251 => 251,
139
+    252 => 252,
140
+    253 => 253,
141
+    254 => 254,
142
+    255 => 255
143 143
 
144 144
 ];
Please login to merge, or discard this patch.