Completed
Push — master ( 8b5a3c...b0cbd6 )
by cam
01:56
created
ecrire/action/debloquer_edition.php 1 patch
Indentation   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -16,7 +16,7 @@  discard block
 block discarded – undo
16 16
  */
17 17
 
18 18
 if (!defined('_ECRIRE_INC_VERSION')) {
19
-	return;
19
+    return;
20 20
 }
21 21
 
22 22
 /**
@@ -30,17 +30,17 @@  discard block
 block discarded – undo
30 30
  */
31 31
 function action_debloquer_edition_dist() {
32 32
 
33
-	$securiser_action = charger_fonction('securiser_action', 'inc');
34
-	$arg = $securiser_action();
33
+    $securiser_action = charger_fonction('securiser_action', 'inc');
34
+    $arg = $securiser_action();
35 35
 
36
-	if ($arg) {
37
-		include_spip('inc/drapeau_edition');
38
-		if ($arg == 'tous') {
39
-			debloquer_tous($GLOBALS['visiteur_session']['id_auteur']);
40
-		} else {
41
-			$arg = explode('-', (string) $arg);
42
-			[$objet, $id_objet] = $arg;
43
-			debloquer_edition($GLOBALS['visiteur_session']['id_auteur'], $id_objet, $objet);
44
-		}
45
-	}
36
+    if ($arg) {
37
+        include_spip('inc/drapeau_edition');
38
+        if ($arg == 'tous') {
39
+            debloquer_tous($GLOBALS['visiteur_session']['id_auteur']);
40
+        } else {
41
+            $arg = explode('-', (string) $arg);
42
+            [$objet, $id_objet] = $arg;
43
+            debloquer_edition($GLOBALS['visiteur_session']['id_auteur'], $id_objet, $objet);
44
+        }
45
+    }
46 46
 }
Please login to merge, or discard this patch.
ecrire/action/calculer_taille_cache.php 1 patch
Indentation   +57 added lines, -57 removed lines patch added patch discarded remove patch
@@ -15,7 +15,7 @@  discard block
 block discarded – undo
15 15
  * @package SPIP\Core\Cache
16 16
  **/
17 17
 if (!defined('_ECRIRE_INC_VERSION')) {
18
-	return;
18
+    return;
19 19
 }
20 20
 
21 21
 
@@ -30,41 +30,41 @@  discard block
 block discarded – undo
30 30
  *     de l'action sécurisée.
31 31
  */
32 32
 function action_calculer_taille_cache_dist($arg = null) {
33
-	if (is_null($arg)) {
34
-		$securiser_action = charger_fonction('securiser_action', 'inc');
35
-		$arg = $securiser_action();
36
-	}
37
-	include_spip('inc/filtres');
33
+    if (is_null($arg)) {
34
+        $securiser_action = charger_fonction('securiser_action', 'inc');
35
+        $arg = $securiser_action();
36
+    }
37
+    include_spip('inc/filtres');
38 38
 
39
-	if ($arg == 'images') {
40
-		$taille = calculer_taille_dossier(_DIR_VAR);
41
-		$res = _T(
42
-			'ecrire:taille_cache_image',
43
-			[
44
-				'dir' => joli_repertoire(_DIR_VAR),
45
-				'taille' => '<b>' . (taille_en_octets($taille) > 0 ? taille_en_octets($taille) : '0 octet') . '</b>'
46
-			]
47
-		);
48
-	} else {
49
-		include_spip('inc/invalideur');
50
-		$taille =
51
-			calculer_taille_dossier(_DIR_CACHE_XML)
52
-			+ calculer_taille_dossier(_DIR_CACHE . 'skel/')
53
-			+ calculer_taille_dossier(_DIR_CACHE . 'wheels/')
54
-			+ calculer_taille_dossier(_DIR_CACHE . 'contextes/');
55
-		$taille += (int) taille_du_cache();
56
-		if ($taille <= 150000) {
57
-			$res = _T('taille_cache_vide');
58
-		} elseif ($taille <= 1024 * 1024) {
59
-			$res = _T('taille_cache_moins_de', ['octets' => taille_en_octets(1024 * 1024)]);
60
-		} else {
61
-			$res = _T('taille_cache_octets', ['octets' => taille_en_octets($taille)]);
62
-		}
63
-		$res = "<b>$res</b>";
64
-	}
39
+    if ($arg == 'images') {
40
+        $taille = calculer_taille_dossier(_DIR_VAR);
41
+        $res = _T(
42
+            'ecrire:taille_cache_image',
43
+            [
44
+                'dir' => joli_repertoire(_DIR_VAR),
45
+                'taille' => '<b>' . (taille_en_octets($taille) > 0 ? taille_en_octets($taille) : '0 octet') . '</b>'
46
+            ]
47
+        );
48
+    } else {
49
+        include_spip('inc/invalideur');
50
+        $taille =
51
+            calculer_taille_dossier(_DIR_CACHE_XML)
52
+            + calculer_taille_dossier(_DIR_CACHE . 'skel/')
53
+            + calculer_taille_dossier(_DIR_CACHE . 'wheels/')
54
+            + calculer_taille_dossier(_DIR_CACHE . 'contextes/');
55
+        $taille += (int) taille_du_cache();
56
+        if ($taille <= 150000) {
57
+            $res = _T('taille_cache_vide');
58
+        } elseif ($taille <= 1024 * 1024) {
59
+            $res = _T('taille_cache_moins_de', ['octets' => taille_en_octets(1024 * 1024)]);
60
+        } else {
61
+            $res = _T('taille_cache_octets', ['octets' => taille_en_octets($taille)]);
62
+        }
63
+        $res = "<b>$res</b>";
64
+    }
65 65
 
66
-	$res = "<p>$res</p>";
67
-	ajax_retour($res);
66
+    $res = "<p>$res</p>";
67
+    ajax_retour($res);
68 68
 }
69 69
 
70 70
 
@@ -75,28 +75,28 @@  discard block
 block discarded – undo
75 75
  * @return int Taille en octets
76 76
  */
77 77
 function calculer_taille_dossier($dir) {
78
-	if (!is_dir($dir) || !is_readable($dir)) {
79
-		return 0;
80
-	}
81
-	$handle = opendir($dir);
82
-	if (!$handle) {
83
-		return 0;
84
-	}
85
-	$taille = 0;
86
-	while (($fichier = @readdir($handle)) !== false) {
87
-		// Eviter ".", "..", ".htaccess", etc.
88
-		if ($fichier[0] == '.') {
89
-			continue;
90
-		}
91
-		if (is_file($d = "$dir/$fichier")) {
92
-			$taille += filesize($d);
93
-		} else {
94
-			if (is_dir($d)) {
95
-				$taille += calculer_taille_dossier($d);
96
-			}
97
-		}
98
-	}
99
-	closedir($handle);
78
+    if (!is_dir($dir) || !is_readable($dir)) {
79
+        return 0;
80
+    }
81
+    $handle = opendir($dir);
82
+    if (!$handle) {
83
+        return 0;
84
+    }
85
+    $taille = 0;
86
+    while (($fichier = @readdir($handle)) !== false) {
87
+        // Eviter ".", "..", ".htaccess", etc.
88
+        if ($fichier[0] == '.') {
89
+            continue;
90
+        }
91
+        if (is_file($d = "$dir/$fichier")) {
92
+            $taille += filesize($d);
93
+        } else {
94
+            if (is_dir($d)) {
95
+                $taille += calculer_taille_dossier($d);
96
+            }
97
+        }
98
+    }
99
+    closedir($handle);
100 100
 
101
-	return $taille;
101
+    return $taille;
102 102
 }
Please login to merge, or discard this patch.
ecrire/action/confirmer_inscription.php 1 patch
Indentation   +44 added lines, -44 removed lines patch added patch discarded remove patch
@@ -16,7 +16,7 @@  discard block
 block discarded – undo
16 16
  */
17 17
 
18 18
 if (!defined('_ECRIRE_INC_VERSION')) {
19
-	return;
19
+    return;
20 20
 }
21 21
 
22 22
 /**
@@ -27,51 +27,51 @@  discard block
 block discarded – undo
27 27
  * @return void
28 28
  */
29 29
 function action_confirmer_inscription_dist() {
30
-	$jeton = _request('jeton');
31
-	$email = _request('email');
30
+    $jeton = _request('jeton');
31
+    $email = _request('email');
32 32
 
33
-	include_spip('action/inscrire_auteur');
34
-	if (
35
-		($auteur = auteur_verifier_jeton($jeton))
36
-		&& $auteur['email'] == $email
37
-		&& $auteur['statut'] == 'nouveau'
38
-	) {
39
-		// d'abord on confirme son statut
40
-		$auteur = confirmer_statut_inscription($auteur);
33
+    include_spip('action/inscrire_auteur');
34
+    if (
35
+        ($auteur = auteur_verifier_jeton($jeton))
36
+        && $auteur['email'] == $email
37
+        && $auteur['statut'] == 'nouveau'
38
+    ) {
39
+        // d'abord on confirme son statut
40
+        $auteur = confirmer_statut_inscription($auteur);
41 41
 
42
-		// OK c'est un nouvel inscrit qui confirme :
43
-		// on le loge => ca va confirmer son statut et c'est plus sympa
44
-		include_spip('inc/auth');
45
-		auth_loger($auteur);
42
+        // OK c'est un nouvel inscrit qui confirme :
43
+        // on le loge => ca va confirmer son statut et c'est plus sympa
44
+        include_spip('inc/auth');
45
+        auth_loger($auteur);
46 46
 
47
-		// et on efface son jeton
48
-		auteur_effacer_jeton($auteur['id_auteur']);
47
+        // et on efface son jeton
48
+        auteur_effacer_jeton($auteur['id_auteur']);
49 49
 
50
-		// si pas de redirection demandee, rediriger vers public ou prive selon le statut de l'auteur
51
-		// TODO: ne semble pas marcher si inscrit non visiteur, a debug
52
-		if (!_request('redirect')) {
53
-			// on passe id_auteur explicite pour forcer une lecture en base de toutes les infos
54
-			if (autoriser('ecrire', '', '', $auteur['id_auteur'])) {
55
-				// poser un cookie admin aussi
56
-				$cookie = charger_fonction('cookie', 'action');
57
-				$cookie('@' . $GLOBALS['visiteur_session']['login']);
58
-				$GLOBALS['redirect'] = _DIR_RESTREINT_ABS;
59
-			} else {
60
-				$GLOBALS['redirect'] = $GLOBALS['meta']['adresse_site'];
61
-			}
62
-		}
63
-	} else {
64
-		// lien perime :
65
-		if (!empty($GLOBALS['visiteur_session']['id_auteur'])) {
66
-			// on passe id_auteur explicite pour forcer une lecture en base de toutes les infos
67
-			if (autoriser('ecrire', '', '', $GLOBALS['visiteur_session']['id_auteur'])) {
68
-				$GLOBALS['redirect'] = _DIR_RESTREINT_ABS;
69
-			} else {
70
-				$GLOBALS['redirect'] = $GLOBALS['meta']['adresse_site'];
71
-			}
72
-		} else {
73
-			// rediriger vers la page de login si pas encore loge
74
-			$GLOBALS['redirect'] = parametre_url(generer_url_public('login', '', false), 'url', _request('redirect'));
75
-		}
76
-	}
50
+        // si pas de redirection demandee, rediriger vers public ou prive selon le statut de l'auteur
51
+        // TODO: ne semble pas marcher si inscrit non visiteur, a debug
52
+        if (!_request('redirect')) {
53
+            // on passe id_auteur explicite pour forcer une lecture en base de toutes les infos
54
+            if (autoriser('ecrire', '', '', $auteur['id_auteur'])) {
55
+                // poser un cookie admin aussi
56
+                $cookie = charger_fonction('cookie', 'action');
57
+                $cookie('@' . $GLOBALS['visiteur_session']['login']);
58
+                $GLOBALS['redirect'] = _DIR_RESTREINT_ABS;
59
+            } else {
60
+                $GLOBALS['redirect'] = $GLOBALS['meta']['adresse_site'];
61
+            }
62
+        }
63
+    } else {
64
+        // lien perime :
65
+        if (!empty($GLOBALS['visiteur_session']['id_auteur'])) {
66
+            // on passe id_auteur explicite pour forcer une lecture en base de toutes les infos
67
+            if (autoriser('ecrire', '', '', $GLOBALS['visiteur_session']['id_auteur'])) {
68
+                $GLOBALS['redirect'] = _DIR_RESTREINT_ABS;
69
+            } else {
70
+                $GLOBALS['redirect'] = $GLOBALS['meta']['adresse_site'];
71
+            }
72
+        } else {
73
+            // rediriger vers la page de login si pas encore loge
74
+            $GLOBALS['redirect'] = parametre_url(generer_url_public('login', '', false), 'url', _request('redirect'));
75
+        }
76
+    }
77 77
 }
Please login to merge, or discard this patch.
ecrire/action/menu_rubriques.php 1 patch
Indentation   +155 added lines, -155 removed lines patch added patch discarded remove patch
@@ -16,7 +16,7 @@  discard block
 block discarded – undo
16 16
  **/
17 17
 
18 18
 if (!defined('_ECRIRE_INC_VERSION')) {
19
-	return;
19
+    return;
20 20
 }
21 21
 
22 22
 include_spip('inc/autoriser');
@@ -34,42 +34,42 @@  discard block
 block discarded – undo
34 34
  **/
35 35
 function action_menu_rubriques_dist() {
36 36
 
37
-	// si pas acces a ecrire, pas acces au menu
38
-	// on renvoi un 401 qui fait echouer la requete ajax silencieusement
39
-	if (!autoriser('ecrire')) {
40
-		$retour =
41
-		'<ul class="deroulant__sous-menu" data-profondeur="1">' .
42
-			'<li class="deroulant__item deroulant__item_plan plan_site" data-profondeur="1">' .
43
-				'<a class="deroulant__lien" href="' . generer_url_ecrire('accueil') . '" data-profondeur="1">' .
44
-					'<span class="libelle">' . _T('public:lien_connecter') . '</span>' .
45
-				'</a>' .
46
-			'</li>' .
47
-		'</ul>';
48
-		include_spip('inc/actions');
49
-		ajax_retour($retour);
50
-		exit;
51
-	}
52
-
53
-	if ($date = (int) _request('date')) {
54
-		header('Last-Modified: ' . gmdate('D, d M Y H:i:s', $date) . ' GMT');
55
-	}
56
-
57
-	$r = gen_liste_rubriques();
58
-	if (
59
-		!$r
60
-		&& isset($_SERVER['HTTP_IF_MODIFIED_SINCE'])
61
-		&& !strstr((string) $_SERVER['SERVER_SOFTWARE'], 'IIS/')
62
-	) {
63
-		include_spip('inc/headers');
64
-		header('Content-Type: text/html; charset=' . $GLOBALS['meta']['charset']);
65
-		http_response_code(304);
66
-		exit;
67
-	} else {
68
-		include_spip('inc/actions');
69
-		$ret = menu_rubriques();
70
-		ajax_retour($ret);
71
-		exit;
72
-	}
37
+    // si pas acces a ecrire, pas acces au menu
38
+    // on renvoi un 401 qui fait echouer la requete ajax silencieusement
39
+    if (!autoriser('ecrire')) {
40
+        $retour =
41
+        '<ul class="deroulant__sous-menu" data-profondeur="1">' .
42
+            '<li class="deroulant__item deroulant__item_plan plan_site" data-profondeur="1">' .
43
+                '<a class="deroulant__lien" href="' . generer_url_ecrire('accueil') . '" data-profondeur="1">' .
44
+                    '<span class="libelle">' . _T('public:lien_connecter') . '</span>' .
45
+                '</a>' .
46
+            '</li>' .
47
+        '</ul>';
48
+        include_spip('inc/actions');
49
+        ajax_retour($retour);
50
+        exit;
51
+    }
52
+
53
+    if ($date = (int) _request('date')) {
54
+        header('Last-Modified: ' . gmdate('D, d M Y H:i:s', $date) . ' GMT');
55
+    }
56
+
57
+    $r = gen_liste_rubriques();
58
+    if (
59
+        !$r
60
+        && isset($_SERVER['HTTP_IF_MODIFIED_SINCE'])
61
+        && !strstr((string) $_SERVER['SERVER_SOFTWARE'], 'IIS/')
62
+    ) {
63
+        include_spip('inc/headers');
64
+        header('Content-Type: text/html; charset=' . $GLOBALS['meta']['charset']);
65
+        http_response_code(304);
66
+        exit;
67
+    } else {
68
+        include_spip('inc/actions');
69
+        $ret = menu_rubriques();
70
+        ajax_retour($ret);
71
+        exit;
72
+    }
73 73
 }
74 74
 
75 75
 /**
@@ -83,44 +83,44 @@  discard block
 block discarded – undo
83 83
  *     Code HTML présentant la liste des rubriques
84 84
  **/
85 85
 function menu_rubriques($complet = true) {
86
-	$ret = '<li class="deroulant__item deroulant__item_tout toutsite" data-profondeur="1">'
87
-		. '<a class="deroulant__lien" href="' . generer_url_ecrire('plan') . '" data-profondeur="1">'
88
-		. '<span class="libelle">' . _T('info_tout_site') . '</span>'
89
-		. '</a>'
90
-		. '</li>';
91
-
92
-	if (!$complet) {
93
-		return "<ul class=\"deroulant__sous-menu\" data-profondeur=\"1\">$ret\n</ul>\n";
94
-	}
95
-
96
-	if (!isset($GLOBALS['db_art_cache'])) {
97
-		gen_liste_rubriques();
98
-	}
99
-	$arr_low = extraire_article(0, $GLOBALS['db_art_cache']);
100
-
101
-	$total_lignes = $i = count($arr_low);
102
-
103
-	if ($i > 0) {
104
-		$nb_col = min(8, ceil($total_lignes / 30));
105
-		if ($nb_col <= 1) {
106
-			$nb_col = ceil($total_lignes / 10);
107
-		}
108
-		foreach ($arr_low as $id_rubrique => $titre_rubrique) {
109
-			if (autoriser('voir', 'rubrique', $id_rubrique)) {
110
-				$ret .= bandeau_rubrique($id_rubrique, $titre_rubrique, $i);
111
-				$i++;
112
-			}
113
-		}
114
-
115
-		$class_cols = ($nb_col > 1 ? "cols-$nb_col" : '');
116
-		$ret = "<ul class=\"deroulant__sous-menu $class_cols\" data-profondeur=\"1\">"
117
-			. $ret
118
-			. "\n</ul>\n";
119
-	} else {
120
-		$ret = "<ul class=\"deroulant__sous-menu\" data-profondeur=\"1\">$ret\n</ul>\n";
121
-	}
122
-
123
-	return $ret;
86
+    $ret = '<li class="deroulant__item deroulant__item_tout toutsite" data-profondeur="1">'
87
+        . '<a class="deroulant__lien" href="' . generer_url_ecrire('plan') . '" data-profondeur="1">'
88
+        . '<span class="libelle">' . _T('info_tout_site') . '</span>'
89
+        . '</a>'
90
+        . '</li>';
91
+
92
+    if (!$complet) {
93
+        return "<ul class=\"deroulant__sous-menu\" data-profondeur=\"1\">$ret\n</ul>\n";
94
+    }
95
+
96
+    if (!isset($GLOBALS['db_art_cache'])) {
97
+        gen_liste_rubriques();
98
+    }
99
+    $arr_low = extraire_article(0, $GLOBALS['db_art_cache']);
100
+
101
+    $total_lignes = $i = count($arr_low);
102
+
103
+    if ($i > 0) {
104
+        $nb_col = min(8, ceil($total_lignes / 30));
105
+        if ($nb_col <= 1) {
106
+            $nb_col = ceil($total_lignes / 10);
107
+        }
108
+        foreach ($arr_low as $id_rubrique => $titre_rubrique) {
109
+            if (autoriser('voir', 'rubrique', $id_rubrique)) {
110
+                $ret .= bandeau_rubrique($id_rubrique, $titre_rubrique, $i);
111
+                $i++;
112
+            }
113
+        }
114
+
115
+        $class_cols = ($nb_col > 1 ? "cols-$nb_col" : '');
116
+        $ret = "<ul class=\"deroulant__sous-menu $class_cols\" data-profondeur=\"1\">"
117
+            . $ret
118
+            . "\n</ul>\n";
119
+    } else {
120
+        $ret = "<ul class=\"deroulant__sous-menu\" data-profondeur=\"1\">$ret\n</ul>\n";
121
+    }
122
+
123
+    return $ret;
124 124
 }
125 125
 
126 126
 /**
@@ -141,47 +141,47 @@  discard block
 block discarded – undo
141 141
  *     Code HTML présentant la liste des rubriques
142 142
  **/
143 143
 function bandeau_rubrique($id_rubrique, $titre_rubrique, $zdecal, $profondeur = 1) {
144
-	static $zmax = 6;
145
-	$profondeur_next = $profondeur + 1;
146
-
147
-	$nav = '<a class="deroulant__lien" href="' . generer_objet_url($id_rubrique, 'rubrique', '', '', false) . "\" data-profondeur=\"$profondeur\">"
148
-		. '<span class="libelle">' . supprimer_tags(preg_replace(',[\x00-\x1f]+,', ' ', $titre_rubrique)) . '</span>'
149
-		. "</a>\n";
150
-
151
-	// Limiter volontairement le nombre de sous-menus
152
-	if (!(--$zmax)) {
153
-		$zmax++;
154
-
155
-		return "\n<li class=\"deroulant__item\" data-profondeur=\"$profondeur\">$nav</li>";
156
-	}
157
-
158
-	$arr_rub = extraire_article($id_rubrique, $GLOBALS['db_art_cache']);
159
-	$i = count($arr_rub);
160
-	if (!$i) {
161
-		$zmax++;
162
-
163
-		return "\n<li class=\"deroulant__item\" data-profondeur=\"$profondeur\">$nav</li>";
164
-	}
165
-
166
-
167
-	$nb_col = 1;
168
-	if ($nb_rub = count($arr_rub)) {
169
-		$nb_col = min(10, max(1, ceil($nb_rub / 10)));
170
-	}
171
-	$class_cols = ($nb_col > 1 ? "cols-$nb_col" : '');
172
-	$ret = "<li class=\"deroulant__item deroulant__item_parent\" data-profondeur=\"$profondeur\">"
173
-	 . $nav
174
-	 . "<ul class=\"deroulant__sous-menu $class_cols\" data-profondeur=\"$profondeur_next\">";
175
-	foreach ($arr_rub as $id_rub => $titre_rub) {
176
-		if (autoriser('voir', 'rubrique', $id_rub)) {
177
-			$titre = supprimer_numero(typo($titre_rub));
178
-			$ret .= bandeau_rubrique($id_rub, $titre, $zdecal + $i, $profondeur_next);
179
-			$i++;
180
-		}
181
-	}
182
-	$zmax++;
183
-
184
-	return $ret . "</ul></li>\n";
144
+    static $zmax = 6;
145
+    $profondeur_next = $profondeur + 1;
146
+
147
+    $nav = '<a class="deroulant__lien" href="' . generer_objet_url($id_rubrique, 'rubrique', '', '', false) . "\" data-profondeur=\"$profondeur\">"
148
+        . '<span class="libelle">' . supprimer_tags(preg_replace(',[\x00-\x1f]+,', ' ', $titre_rubrique)) . '</span>'
149
+        . "</a>\n";
150
+
151
+    // Limiter volontairement le nombre de sous-menus
152
+    if (!(--$zmax)) {
153
+        $zmax++;
154
+
155
+        return "\n<li class=\"deroulant__item\" data-profondeur=\"$profondeur\">$nav</li>";
156
+    }
157
+
158
+    $arr_rub = extraire_article($id_rubrique, $GLOBALS['db_art_cache']);
159
+    $i = count($arr_rub);
160
+    if (!$i) {
161
+        $zmax++;
162
+
163
+        return "\n<li class=\"deroulant__item\" data-profondeur=\"$profondeur\">$nav</li>";
164
+    }
165
+
166
+
167
+    $nb_col = 1;
168
+    if ($nb_rub = count($arr_rub)) {
169
+        $nb_col = min(10, max(1, ceil($nb_rub / 10)));
170
+    }
171
+    $class_cols = ($nb_col > 1 ? "cols-$nb_col" : '');
172
+    $ret = "<li class=\"deroulant__item deroulant__item_parent\" data-profondeur=\"$profondeur\">"
173
+        . $nav
174
+        . "<ul class=\"deroulant__sous-menu $class_cols\" data-profondeur=\"$profondeur_next\">";
175
+    foreach ($arr_rub as $id_rub => $titre_rub) {
176
+        if (autoriser('voir', 'rubrique', $id_rub)) {
177
+            $titre = supprimer_numero(typo($titre_rub));
178
+            $ret .= bandeau_rubrique($id_rub, $titre, $zdecal + $i, $profondeur_next);
179
+            $i++;
180
+        }
181
+    }
182
+    $zmax++;
183
+
184
+    return $ret . "</ul></li>\n";
185 185
 }
186 186
 
187 187
 
@@ -199,7 +199,7 @@  discard block
 block discarded – undo
199 199
  *     Liste des rubriques enfants de la rubrique (et leur titre)
200 200
  **/
201 201
 function extraire_article($id_p, $t) {
202
-	return array_key_exists($id_p, $t) ? $t[$id_p] : [];
202
+    return array_key_exists($id_p, $t) ? $t[$id_p] : [];
203 203
 }
204 204
 
205 205
 /**
@@ -215,42 +215,42 @@  discard block
 block discarded – undo
215 215
  **/
216 216
 function gen_liste_rubriques() {
217 217
 
218
-	$cache = null;
219
-	include_spip('inc/config');
220
-	// ici, un petit fichier cache ne fait pas de mal
221
-	$last = lire_config('date_calcul_rubriques', 0);
222
-	if (lire_fichier(_CACHE_RUBRIQUES, $cache)) {
223
-		[$date, $GLOBALS['db_art_cache']] = @unserialize($cache);
224
-		if ($date == $last) {
225
-			return false;
226
-		} // c'etait en cache :-)
227
-	}
228
-	// se restreindre aux rubriques utilisees recemment +secteurs
229
-
230
-	$where = sql_in_select(
231
-		'id_rubrique',
232
-		'id_rubrique',
233
-		'spip_rubriques',
234
-		'',
235
-		'',
236
-		'id_parent=0 DESC, date DESC',
237
-		_CACHE_RUBRIQUES_MAX
238
-	);
239
-
240
-	// puis refaire la requete pour avoir l'ordre alphabetique
241
-
242
-	$res = sql_select('id_rubrique, titre, id_parent', 'spip_rubriques', $where, '', 'id_parent, 0+titre, titre');
243
-
244
-	// il ne faut pas filtrer le autoriser voir ici
245
-	// car on met le resultat en cache, commun a tout le monde
246
-	$GLOBALS['db_art_cache'] = [];
247
-	while ($r = sql_fetch($res)) {
248
-		$t = sinon($r['titre'], _T('ecrire:info_sans_titre'));
249
-		$GLOBALS['db_art_cache'][$r['id_parent']][$r['id_rubrique']] = supprimer_numero(typo($t));
250
-	}
251
-
252
-	$t = [$last ?: time(), $GLOBALS['db_art_cache']];
253
-	ecrire_fichier(_CACHE_RUBRIQUES, serialize($t));
254
-
255
-	return true;
218
+    $cache = null;
219
+    include_spip('inc/config');
220
+    // ici, un petit fichier cache ne fait pas de mal
221
+    $last = lire_config('date_calcul_rubriques', 0);
222
+    if (lire_fichier(_CACHE_RUBRIQUES, $cache)) {
223
+        [$date, $GLOBALS['db_art_cache']] = @unserialize($cache);
224
+        if ($date == $last) {
225
+            return false;
226
+        } // c'etait en cache :-)
227
+    }
228
+    // se restreindre aux rubriques utilisees recemment +secteurs
229
+
230
+    $where = sql_in_select(
231
+        'id_rubrique',
232
+        'id_rubrique',
233
+        'spip_rubriques',
234
+        '',
235
+        '',
236
+        'id_parent=0 DESC, date DESC',
237
+        _CACHE_RUBRIQUES_MAX
238
+    );
239
+
240
+    // puis refaire la requete pour avoir l'ordre alphabetique
241
+
242
+    $res = sql_select('id_rubrique, titre, id_parent', 'spip_rubriques', $where, '', 'id_parent, 0+titre, titre');
243
+
244
+    // il ne faut pas filtrer le autoriser voir ici
245
+    // car on met le resultat en cache, commun a tout le monde
246
+    $GLOBALS['db_art_cache'] = [];
247
+    while ($r = sql_fetch($res)) {
248
+        $t = sinon($r['titre'], _T('ecrire:info_sans_titre'));
249
+        $GLOBALS['db_art_cache'][$r['id_parent']][$r['id_rubrique']] = supprimer_numero(typo($t));
250
+    }
251
+
252
+    $t = [$last ?: time(), $GLOBALS['db_art_cache']];
253
+    ecrire_fichier(_CACHE_RUBRIQUES, serialize($t));
254
+
255
+    return true;
256 256
 }
Please login to merge, or discard this patch.
ecrire/action/auth.php 1 patch
Indentation   +22 added lines, -22 removed lines patch added patch discarded remove patch
@@ -16,7 +16,7 @@  discard block
 block discarded – undo
16 16
  **/
17 17
 
18 18
 if (!defined('_ECRIRE_INC_VERSION')) {
19
-	return;
19
+    return;
20 20
 }
21 21
 
22 22
 /**
@@ -24,25 +24,25 @@  discard block
 block discarded – undo
24 24
  */
25 25
 function action_auth_dist() {
26 26
 
27
-	$securiser_action = charger_fonction('securiser_action', 'inc');
28
-	$arg = $securiser_action();
29
-
30
-	if (!preg_match(',^(\w+)[/](.+)$,', (string) $arg, $r)) {
31
-		spip_log("action_auth_dist $arg pas compris");
32
-	} else {
33
-		$auth_methode = $r[1];
34
-		$login = $r[2];
35
-		include_spip('inc/auth');
36
-		$res = auth_terminer_identifier_login($auth_methode, $login);
37
-
38
-		if (is_string($res)) { // Erreur
39
-			$redirect = _request('redirect');
40
-			$redirect = parametre_url($redirect, 'var_erreur', $res, '&');
41
-			include_spip('inc/headers');
42
-			redirige_par_entete($redirect);
43
-		}
44
-
45
-		// sinon on loge l'auteur identifie, et on finit (redirection automatique)
46
-		auth_loger($res);
47
-	}
27
+    $securiser_action = charger_fonction('securiser_action', 'inc');
28
+    $arg = $securiser_action();
29
+
30
+    if (!preg_match(',^(\w+)[/](.+)$,', (string) $arg, $r)) {
31
+        spip_log("action_auth_dist $arg pas compris");
32
+    } else {
33
+        $auth_methode = $r[1];
34
+        $login = $r[2];
35
+        include_spip('inc/auth');
36
+        $res = auth_terminer_identifier_login($auth_methode, $login);
37
+
38
+        if (is_string($res)) { // Erreur
39
+            $redirect = _request('redirect');
40
+            $redirect = parametre_url($redirect, 'var_erreur', $res, '&');
41
+            include_spip('inc/headers');
42
+            redirige_par_entete($redirect);
43
+        }
44
+
45
+        // sinon on loge l'auteur identifie, et on finit (redirection automatique)
46
+        auth_loger($res);
47
+    }
48 48
 }
Please login to merge, or discard this patch.
ecrire/action/desinstaller_plugin.php 1 patch
Indentation   +25 added lines, -25 removed lines patch added patch discarded remove patch
@@ -16,7 +16,7 @@  discard block
 block discarded – undo
16 16
  */
17 17
 
18 18
 if (!defined('_ECRIRE_INC_VERSION')) {
19
-	return;
19
+    return;
20 20
 }
21 21
 
22 22
 /**
@@ -31,28 +31,28 @@  discard block
 block discarded – undo
31 31
  */
32 32
 function action_desinstaller_plugin_dist() {
33 33
 
34
-	$securiser_action = charger_fonction('securiser_action', 'inc');
35
-	$arg = $securiser_action();
36
-	[$dir_plugins, $plugin] = explode('::', (string) $arg);
37
-	$dir_type = '_DIR_PLUGINS';
38
-	if (defined('_DIR_PLUGINS_SUPPL') && $dir_plugins == _DIR_PLUGINS_SUPPL) {
39
-		$dir_type = '_DIR_PLUGINS_SUPPL';
40
-	}
41
-	$installer_plugins = charger_fonction('installer', 'plugins');
42
-	$infos = $installer_plugins($plugin, 'uninstall', $dir_type);
43
-	if ($infos && !$infos['install_test'][0]) {
44
-		include_spip('inc/plugin');
45
-		ecrire_plugin_actifs([$plugin], false, 'enleve');
46
-		$erreur = '';
47
-	} else {
48
-		$erreur = 'erreur_plugin_desinstalation_echouee';
49
-	}
50
-	if ($redirect = _request('redirect')) {
51
-		include_spip('inc/headers');
52
-		if ($erreur) {
53
-			$redirect = parametre_url($redirect, 'erreur', $erreur);
54
-		}
55
-		$redirect = str_replace('&amp;', '&', (string) $redirect);
56
-		redirige_par_entete($redirect);
57
-	}
34
+    $securiser_action = charger_fonction('securiser_action', 'inc');
35
+    $arg = $securiser_action();
36
+    [$dir_plugins, $plugin] = explode('::', (string) $arg);
37
+    $dir_type = '_DIR_PLUGINS';
38
+    if (defined('_DIR_PLUGINS_SUPPL') && $dir_plugins == _DIR_PLUGINS_SUPPL) {
39
+        $dir_type = '_DIR_PLUGINS_SUPPL';
40
+    }
41
+    $installer_plugins = charger_fonction('installer', 'plugins');
42
+    $infos = $installer_plugins($plugin, 'uninstall', $dir_type);
43
+    if ($infos && !$infos['install_test'][0]) {
44
+        include_spip('inc/plugin');
45
+        ecrire_plugin_actifs([$plugin], false, 'enleve');
46
+        $erreur = '';
47
+    } else {
48
+        $erreur = 'erreur_plugin_desinstalation_echouee';
49
+    }
50
+    if ($redirect = _request('redirect')) {
51
+        include_spip('inc/headers');
52
+        if ($erreur) {
53
+            $redirect = parametre_url($redirect, 'erreur', $erreur);
54
+        }
55
+        $redirect = str_replace('&amp;', '&', (string) $redirect);
56
+        redirige_par_entete($redirect);
57
+    }
58 58
 }
Please login to merge, or discard this patch.
ecrire/action/instituer_objet.php 1 patch
Indentation   +19 added lines, -19 removed lines patch added patch discarded remove patch
@@ -16,7 +16,7 @@  discard block
 block discarded – undo
16 16
  */
17 17
 
18 18
 if (!defined('_ECRIRE_INC_VERSION')) {
19
-	return;
19
+    return;
20 20
 }
21 21
 
22 22
 /**
@@ -28,24 +28,24 @@  discard block
 block discarded – undo
28 28
  */
29 29
 function action_instituer_objet_dist($arg = null) {
30 30
 
31
-	if (is_null($arg)) {
32
-		$securiser_action = charger_fonction('securiser_action', 'inc');
33
-		$arg = $securiser_action();
34
-	}
31
+    if (is_null($arg)) {
32
+        $securiser_action = charger_fonction('securiser_action', 'inc');
33
+        $arg = $securiser_action();
34
+    }
35 35
 
36
-	[$objet, $id_objet, $statut] = preg_split('/\W/', (string) $arg);
37
-	if (!$statut) {
38
-		$statut = _request('statut_nouv');
39
-	} // cas POST
40
-	if (!$statut) {
41
-		return;
42
-	} // impossible mais sait-on jamais
36
+    [$objet, $id_objet, $statut] = preg_split('/\W/', (string) $arg);
37
+    if (!$statut) {
38
+        $statut = _request('statut_nouv');
39
+    } // cas POST
40
+    if (!$statut) {
41
+        return;
42
+    } // impossible mais sait-on jamais
43 43
 
44
-	if (
45
-		($id_objet = (int) $id_objet)
46
-		&& autoriser('instituer', $objet, $id_objet, '', ['statut' => $statut])
47
-	) {
48
-		include_spip('action/editer_objet');
49
-		objet_modifier($objet, $id_objet, ['statut' => $statut]);
50
-	}
44
+    if (
45
+        ($id_objet = (int) $id_objet)
46
+        && autoriser('instituer', $objet, $id_objet, '', ['statut' => $statut])
47
+    ) {
48
+        include_spip('action/editer_objet');
49
+        objet_modifier($objet, $id_objet, ['statut' => $statut]);
50
+    }
51 51
 }
Please login to merge, or discard this patch.
ecrire/action/editer_rubrique.php 1 patch
Indentation   +218 added lines, -218 removed lines patch added patch discarded remove patch
@@ -15,7 +15,7 @@  discard block
 block discarded – undo
15 15
  * @package SPIP\Core\Rubriques\Edition
16 16
  */
17 17
 if (!defined('_ECRIRE_INC_VERSION')) {
18
-	return;
18
+    return;
19 19
 }
20 20
 
21 21
 include_spip('inc/rubriques');
@@ -37,34 +37,34 @@  discard block
 block discarded – undo
37 37
  */
38 38
 function action_editer_rubrique_dist($arg = null) {
39 39
 
40
-	if (is_null($arg)) {
41
-		$securiser_action = charger_fonction('securiser_action', 'inc');
42
-		$arg = $securiser_action();
43
-	}
44
-
45
-	if (!$id_rubrique = (int) $arg) {
46
-		if ($arg != 'oui') {
47
-			include_spip('inc/headers');
48
-			redirige_url_ecrire();
49
-		}
50
-		$id_rubrique = rubrique_inserer(_request('id_parent'));
51
-	}
52
-
53
-	$err = rubrique_modifier($id_rubrique);
54
-
55
-	if (_request('redirect')) {
56
-		$redirect = parametre_url(
57
-			urldecode((string) _request('redirect')),
58
-			'id_rubrique',
59
-			$id_rubrique,
60
-			'&'
61
-		);
62
-
63
-		include_spip('inc/headers');
64
-		redirige_par_entete($redirect);
65
-	}
66
-
67
-	return [$id_rubrique, $err];
40
+    if (is_null($arg)) {
41
+        $securiser_action = charger_fonction('securiser_action', 'inc');
42
+        $arg = $securiser_action();
43
+    }
44
+
45
+    if (!$id_rubrique = (int) $arg) {
46
+        if ($arg != 'oui') {
47
+            include_spip('inc/headers');
48
+            redirige_url_ecrire();
49
+        }
50
+        $id_rubrique = rubrique_inserer(_request('id_parent'));
51
+    }
52
+
53
+    $err = rubrique_modifier($id_rubrique);
54
+
55
+    if (_request('redirect')) {
56
+        $redirect = parametre_url(
57
+            urldecode((string) _request('redirect')),
58
+            'id_rubrique',
59
+            $id_rubrique,
60
+            '&'
61
+        );
62
+
63
+        include_spip('inc/headers');
64
+        redirige_par_entete($redirect);
65
+    }
66
+
67
+    return [$id_rubrique, $err];
68 68
 }
69 69
 
70 70
 
@@ -79,64 +79,64 @@  discard block
 block discarded – undo
79 79
  *     Identifiant de la rubrique crée
80 80
  */
81 81
 function rubrique_inserer($id_parent, $set = null) {
82
-	$champs = [
83
-		'titre' => _T('item_nouvelle_rubrique'),
84
-		'id_parent' => (int) $id_parent,
85
-		'statut' => 'prepa'
86
-	];
87
-
88
-	if ($set) {
89
-		$champs = array_merge($champs, $set);
90
-	}
91
-
92
-	// Envoyer aux plugins
93
-	$champs = pipeline(
94
-		'pre_insertion',
95
-		[
96
-			'args' => [
97
-				'table' => 'spip_rubriques',
98
-			],
99
-			'data' => $champs
100
-		]
101
-	);
102
-
103
-	$id_rubrique = sql_insertq('spip_rubriques', $champs);
104
-	pipeline(
105
-		'post_insertion',
106
-		[
107
-			'args' => [
108
-				'table' => 'spip_rubriques',
109
-				'id_objet' => $id_rubrique
110
-			],
111
-			'data' => $champs
112
-		]
113
-	);
114
-	propager_les_secteurs();
115
-	calculer_langues_rubriques();
116
-
117
-	// Appeler une notification
118
-	if ($notifications = charger_fonction('notifications', 'inc')) {
119
-		$notifications(
120
-			'rubrique_inserer',
121
-			$id_rubrique,
122
-			[
123
-				'id_parent' => $id_parent,
124
-				'champs' => $champs,
125
-			]
126
-		);
127
-		$notifications(
128
-			'objet_inserer',
129
-			$id_rubrique,
130
-			[
131
-				'objet' => 'rubrique',
132
-				'id_objet' => $id_rubrique,
133
-				'id_parent' => $id_parent,
134
-				'champs' => $champs,
135
-			]
136
-		);
137
-	}
138
-
139
-	return $id_rubrique;
82
+    $champs = [
83
+        'titre' => _T('item_nouvelle_rubrique'),
84
+        'id_parent' => (int) $id_parent,
85
+        'statut' => 'prepa'
86
+    ];
87
+
88
+    if ($set) {
89
+        $champs = array_merge($champs, $set);
90
+    }
91
+
92
+    // Envoyer aux plugins
93
+    $champs = pipeline(
94
+        'pre_insertion',
95
+        [
96
+            'args' => [
97
+                'table' => 'spip_rubriques',
98
+            ],
99
+            'data' => $champs
100
+        ]
101
+    );
102
+
103
+    $id_rubrique = sql_insertq('spip_rubriques', $champs);
104
+    pipeline(
105
+        'post_insertion',
106
+        [
107
+            'args' => [
108
+                'table' => 'spip_rubriques',
109
+                'id_objet' => $id_rubrique
110
+            ],
111
+            'data' => $champs
112
+        ]
113
+    );
114
+    propager_les_secteurs();
115
+    calculer_langues_rubriques();
116
+
117
+    // Appeler une notification
118
+    if ($notifications = charger_fonction('notifications', 'inc')) {
119
+        $notifications(
120
+            'rubrique_inserer',
121
+            $id_rubrique,
122
+            [
123
+                'id_parent' => $id_parent,
124
+                'champs' => $champs,
125
+            ]
126
+        );
127
+        $notifications(
128
+            'objet_inserer',
129
+            $id_rubrique,
130
+            [
131
+                'objet' => 'rubrique',
132
+                'id_objet' => $id_rubrique,
133
+                'id_parent' => $id_parent,
134
+                'champs' => $champs,
135
+            ]
136
+        );
137
+    }
138
+
139
+    return $id_rubrique;
140 140
 }
141 141
 
142 142
 /**
@@ -152,46 +152,46 @@  discard block
 block discarded – undo
152 152
  *     - chaîne : texte d'un message d'erreur
153 153
  */
154 154
 function rubrique_modifier($id_rubrique, $set = null) {
155
-	include_spip('inc/autoriser');
156
-	include_spip('inc/filtres');
157
-
158
-	include_spip('inc/modifier');
159
-	$c = collecter_requests(
160
-		// include list
161
-		objet_info('rubrique', 'champs_editables'),
162
-		// exclude list
163
-		['id_parent', 'confirme_deplace'],
164
-		// donnees eventuellement fournies
165
-		$set
166
-	);
167
-
168
-	if (
169
-		$err = objet_modifier_champs(
170
-			'rubrique',
171
-			$id_rubrique,
172
-			[
173
-			'data' => $set,
174
-			'nonvide' => ['titre' => _T('titre_nouvelle_rubrique') . ' ' . _T('info_numero_abbreviation') . $id_rubrique]
175
-			],
176
-			$c
177
-		)
178
-	) {
179
-		return $err;
180
-	}
181
-
182
-	$c = collecter_requests(['id_parent', 'confirme_deplace'], [], $set);
183
-	// Deplacer la rubrique
184
-	if (isset($c['id_parent'])) {
185
-		$err = rubrique_instituer($id_rubrique, $c);
186
-	}
187
-
188
-	// invalider les caches marques de cette rubrique
189
-	include_spip('inc/invalideur');
190
-	suivre_invalideur("id='rubrique/$id_rubrique'");
191
-	// et celui de menu_rubriques
192
-	effacer_meta('date_calcul_rubriques');
193
-
194
-	return $err;
155
+    include_spip('inc/autoriser');
156
+    include_spip('inc/filtres');
157
+
158
+    include_spip('inc/modifier');
159
+    $c = collecter_requests(
160
+        // include list
161
+        objet_info('rubrique', 'champs_editables'),
162
+        // exclude list
163
+        ['id_parent', 'confirme_deplace'],
164
+        // donnees eventuellement fournies
165
+        $set
166
+    );
167
+
168
+    if (
169
+        $err = objet_modifier_champs(
170
+            'rubrique',
171
+            $id_rubrique,
172
+            [
173
+            'data' => $set,
174
+            'nonvide' => ['titre' => _T('titre_nouvelle_rubrique') . ' ' . _T('info_numero_abbreviation') . $id_rubrique]
175
+            ],
176
+            $c
177
+        )
178
+    ) {
179
+        return $err;
180
+    }
181
+
182
+    $c = collecter_requests(['id_parent', 'confirme_deplace'], [], $set);
183
+    // Deplacer la rubrique
184
+    if (isset($c['id_parent'])) {
185
+        $err = rubrique_instituer($id_rubrique, $c);
186
+    }
187
+
188
+    // invalider les caches marques de cette rubrique
189
+    include_spip('inc/invalideur');
190
+    suivre_invalideur("id='rubrique/$id_rubrique'");
191
+    // et celui de menu_rubriques
192
+    effacer_meta('date_calcul_rubriques');
193
+
194
+    return $err;
195 195
 }
196 196
 
197 197
 /**
@@ -214,29 +214,29 @@  discard block
 block discarded – undo
214 214
  *     false si la confirmation du déplacement n'est pas présente
215 215
  */
216 216
 function editer_rubrique_breves($id_rubrique, $id_parent, $c = []) {
217
-	if (!sql_table_exists('spip_breves')) {
218
-		return true;
219
-	}
220
-
221
-	if (!sql_countsel('spip_breves', "id_rubrique=$id_rubrique")) {
222
-		return true;
223
-	}
224
-
225
-	if (empty($c['confirme_deplace']) || $c['confirme_deplace'] != 'oui') {
226
-		return false;
227
-	}
228
-
229
-	if (
230
-		$id_secteur = sql_getfetsel(
231
-			'id_secteur',
232
-			'spip_rubriques',
233
-			"id_rubrique=$id_parent"
234
-		)
235
-	) {
236
-		sql_updateq('spip_breves', ['id_rubrique' => $id_secteur], "id_rubrique=$id_rubrique");
237
-	}
238
-
239
-	return true;
217
+    if (!sql_table_exists('spip_breves')) {
218
+        return true;
219
+    }
220
+
221
+    if (!sql_countsel('spip_breves', "id_rubrique=$id_rubrique")) {
222
+        return true;
223
+    }
224
+
225
+    if (empty($c['confirme_deplace']) || $c['confirme_deplace'] != 'oui') {
226
+        return false;
227
+    }
228
+
229
+    if (
230
+        $id_secteur = sql_getfetsel(
231
+            'id_secteur',
232
+            'spip_rubriques',
233
+            "id_rubrique=$id_parent"
234
+        )
235
+    ) {
236
+        sql_updateq('spip_breves', ['id_rubrique' => $id_secteur], "id_rubrique=$id_rubrique");
237
+    }
238
+
239
+    return true;
240 240
 }
241 241
 
242 242
 
@@ -258,72 +258,72 @@  discard block
 block discarded – undo
258 258
  *     Chaîne : texte du message d'erreur
259 259
  */
260 260
 function rubrique_instituer($id_rubrique, $c) {
261
-	// traitement de la rubrique parente
262
-	// interdiction de deplacer vers ou a partir d'une rubrique
263
-	// qu'on n'administre pas.
264
-
265
-	if (null !== ($id_parent = $c['id_parent'])) {
266
-		$id_parent = (int) $id_parent;
267
-		$filles = calcul_branche_in($id_rubrique);
268
-		if (str_contains(",$id_parent,", (string) ",$filles,")) {
269
-			spip_log("La rubrique $id_rubrique ne peut etre fille de sa descendante $id_parent");
270
-		} else {
271
-			$s = sql_fetsel('id_parent, statut', 'spip_rubriques', "id_rubrique=$id_rubrique");
272
-			$old_parent = $s['id_parent'];
273
-
274
-			if (
275
-				!($id_parent != $old_parent
276
-				&& autoriser('publierdans', 'rubrique', $id_parent)
277
-				&& autoriser('creerrubriquedans', 'rubrique', $id_parent)
278
-				&& autoriser('publierdans', 'rubrique', $old_parent)
279
-				)
280
-			) {
281
-				if ($s['statut'] != 'prepa') {
282
-					spip_log("deplacement de $id_rubrique vers $id_parent refuse a " . $GLOBALS['visiteur_session']['id_auteur'] . ' ' . $GLOBALS['visiteur_session']['statut']);
283
-				}
284
-			} elseif (editer_rubrique_breves($id_rubrique, $id_parent, $c)) {
285
-				$statut_ancien = $s['statut'];
286
-				sql_updateq('spip_rubriques', ['id_parent' => $id_parent], "id_rubrique=$id_rubrique");
287
-
288
-
289
-				propager_les_secteurs();
290
-
291
-				// Deplacement d'une rubrique publiee ==> chgt general de leur statut
292
-				if ($statut_ancien == 'publie') {
293
-					calculer_rubriques_if($old_parent, ['id_rubrique' => $id_parent], ['statut_ancien' => $statut_ancien]);
294
-				}
295
-				// Creation ou deplacement d'une rubrique non publiee
296
-				// invalider le cache de leur menu
297
-				elseif (!$statut_ancien || $old_parent != $id_parent) {
298
-					effacer_meta('date_calcul_rubriques');
299
-				}
300
-
301
-				calculer_langues_rubriques();
302
-
303
-				// Appeler une notification
304
-				if ($notifications = charger_fonction('notifications', 'inc')) {
305
-					$notifications(
306
-						'rubrique_instituer',
307
-						$id_rubrique,
308
-						[
309
-							'statut_ancien' => $statut_ancien,
310
-							'id_parent_ancien' => $old_parent,
311
-						]
312
-					);
313
-					$notifications(
314
-						'objet_instituer',
315
-						$id_rubrique,
316
-						[
317
-							'objet' => 'rubrique',
318
-							'id_objet' => $id_rubrique,
319
-							'statut_ancien' => $statut_ancien,
320
-							'id_parent_ancien' => $old_parent,
321
-						]
322
-					);
323
-				}
324
-			}
325
-		}
326
-	}
327
-
328
-	return ''; // pas d'erreur
261
+    // traitement de la rubrique parente
262
+    // interdiction de deplacer vers ou a partir d'une rubrique
263
+    // qu'on n'administre pas.
264
+
265
+    if (null !== ($id_parent = $c['id_parent'])) {
266
+        $id_parent = (int) $id_parent;
267
+        $filles = calcul_branche_in($id_rubrique);
268
+        if (str_contains(",$id_parent,", (string) ",$filles,")) {
269
+            spip_log("La rubrique $id_rubrique ne peut etre fille de sa descendante $id_parent");
270
+        } else {
271
+            $s = sql_fetsel('id_parent, statut', 'spip_rubriques', "id_rubrique=$id_rubrique");
272
+            $old_parent = $s['id_parent'];
273
+
274
+            if (
275
+                !($id_parent != $old_parent
276
+                && autoriser('publierdans', 'rubrique', $id_parent)
277
+                && autoriser('creerrubriquedans', 'rubrique', $id_parent)
278
+                && autoriser('publierdans', 'rubrique', $old_parent)
279
+                )
280
+            ) {
281
+                if ($s['statut'] != 'prepa') {
282
+                    spip_log("deplacement de $id_rubrique vers $id_parent refuse a " . $GLOBALS['visiteur_session']['id_auteur'] . ' ' . $GLOBALS['visiteur_session']['statut']);
283
+                }
284
+            } elseif (editer_rubrique_breves($id_rubrique, $id_parent, $c)) {
285
+                $statut_ancien = $s['statut'];
286
+                sql_updateq('spip_rubriques', ['id_parent' => $id_parent], "id_rubrique=$id_rubrique");
287
+
288
+
289
+                propager_les_secteurs();
290
+
291
+                // Deplacement d'une rubrique publiee ==> chgt general de leur statut
292
+                if ($statut_ancien == 'publie') {
293
+                    calculer_rubriques_if($old_parent, ['id_rubrique' => $id_parent], ['statut_ancien' => $statut_ancien]);
294
+                }
295
+                // Creation ou deplacement d'une rubrique non publiee
296
+                // invalider le cache de leur menu
297
+                elseif (!$statut_ancien || $old_parent != $id_parent) {
298
+                    effacer_meta('date_calcul_rubriques');
299
+                }
300
+
301
+                calculer_langues_rubriques();
302
+
303
+                // Appeler une notification
304
+                if ($notifications = charger_fonction('notifications', 'inc')) {
305
+                    $notifications(
306
+                        'rubrique_instituer',
307
+                        $id_rubrique,
308
+                        [
309
+                            'statut_ancien' => $statut_ancien,
310
+                            'id_parent_ancien' => $old_parent,
311
+                        ]
312
+                    );
313
+                    $notifications(
314
+                        'objet_instituer',
315
+                        $id_rubrique,
316
+                        [
317
+                            'objet' => 'rubrique',
318
+                            'id_objet' => $id_rubrique,
319
+                            'statut_ancien' => $statut_ancien,
320
+                            'id_parent_ancien' => $old_parent,
321
+                        ]
322
+                    );
323
+                }
324
+            }
325
+        }
326
+    }
327
+
328
+    return ''; // pas d'erreur
329 329
 }
Please login to merge, or discard this patch.
ecrire/action/annuler_job.php 1 patch
Indentation   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -16,7 +16,7 @@  discard block
 block discarded – undo
16 16
  **/
17 17
 
18 18
 if (!defined('_ECRIRE_INC_VERSION')) {
19
-	return;
19
+    return;
20 20
 }
21 21
 
22 22
 /**
@@ -25,13 +25,13 @@  discard block
 block discarded – undo
25 25
  * @return void
26 26
  */
27 27
 function action_annuler_job_dist() {
28
-	$securiser_action = charger_fonction('securiser_action', 'inc');
29
-	$id_job = $securiser_action();
28
+    $securiser_action = charger_fonction('securiser_action', 'inc');
29
+    $id_job = $securiser_action();
30 30
 
31
-	if (
32
-		($id_job = (int) $id_job)
33
-		&& autoriser('annuler', 'job', $id_job)
34
-	) {
35
-		job_queue_remove($id_job);
36
-	}
31
+    if (
32
+        ($id_job = (int) $id_job)
33
+        && autoriser('annuler', 'job', $id_job)
34
+    ) {
35
+        job_queue_remove($id_job);
36
+    }
37 37
 }
Please login to merge, or discard this patch.