Completed
Push — master ( a56a38...81a660 )
by cam
01:36
created
ecrire/action/cookie.php 2 patches
Indentation   +85 added lines, -85 removed lines patch added patch discarded remove patch
@@ -17,7 +17,7 @@  discard block
 block discarded – undo
17 17
  */
18 18
 
19 19
 if (!defined('_ECRIRE_INC_VERSION')) {
20
-	return;
20
+    return;
21 21
 }
22 22
 
23 23
 include_spip('inc/actions');
@@ -33,93 +33,93 @@  discard block
 block discarded – undo
33 33
  * @return void
34 34
  */
35 35
 function action_cookie_dist($set_cookie_admin = null, $change_session = null) {
36
-	$redirect_echec = $redirect = null;
37
-	$test_echec_cookie = null;
38
-	$url = '';
39
-	if (is_null($set_cookie_admin)) {
40
-		$set_cookie_admin = _request('cookie_admin');
41
-		$change_session = _request('change_session');
42
-		$test_echec_cookie = _request('test_echec_cookie');
36
+    $redirect_echec = $redirect = null;
37
+    $test_echec_cookie = null;
38
+    $url = '';
39
+    if (is_null($set_cookie_admin)) {
40
+        $set_cookie_admin = _request('cookie_admin');
41
+        $change_session = _request('change_session');
42
+        $test_echec_cookie = _request('test_echec_cookie');
43 43
 
44
-		// La cible de notre operation de connexion
45
-		$url = securiser_redirect_action(_request('url'));
46
-		$redirect = $url ?: generer_url_ecrire('accueil');
47
-		$redirect_echec = _request('url_echec');
48
-		if (!isset($redirect_echec)) {
49
-			if (strpos($redirect, (string) _DIR_RESTREINT_ABS) !== false) {
50
-				$redirect_echec = generer_url_public('login', '', true);
51
-			} else {
52
-				$redirect_echec = $redirect;
53
-			}
54
-		}
55
-	}
44
+        // La cible de notre operation de connexion
45
+        $url = securiser_redirect_action(_request('url'));
46
+        $redirect = $url ?: generer_url_ecrire('accueil');
47
+        $redirect_echec = _request('url_echec');
48
+        if (!isset($redirect_echec)) {
49
+            if (strpos($redirect, (string) _DIR_RESTREINT_ABS) !== false) {
50
+                $redirect_echec = generer_url_public('login', '', true);
51
+            } else {
52
+                $redirect_echec = $redirect;
53
+            }
54
+        }
55
+    }
56 56
 
57 57
 
58
-	// rejoue le cookie pour renouveler spip_session
59
-	if ($change_session == 'oui') {
60
-		$session = charger_fonction('session', 'inc');
61
-		$session(true);
62
-		spip_log('statut 204 pour ' . $_SERVER['REQUEST_URI']);
63
-		http_response_code(204); // No Content
64
-		return;
65
-	}
58
+    // rejoue le cookie pour renouveler spip_session
59
+    if ($change_session == 'oui') {
60
+        $session = charger_fonction('session', 'inc');
61
+        $session(true);
62
+        spip_log('statut 204 pour ' . $_SERVER['REQUEST_URI']);
63
+        http_response_code(204); // No Content
64
+        return;
65
+    }
66 66
 
67
-	// tentative de connexion en auth_http
68
-	if (_request('essai_auth_http') and !$GLOBALS['ignore_auth_http']) {
69
-		include_spip('inc/auth');
70
-		if (
71
-			@$_SERVER['PHP_AUTH_USER']
72
-			and @$_SERVER['PHP_AUTH_PW']
73
-			and $auteur = lire_php_auth($_SERVER['PHP_AUTH_USER'], $_SERVER['PHP_AUTH_PW'])
74
-		) {
75
-			auth_loger($auteur);
76
-			redirige_par_entete(parametre_url($redirect, 't', time(), '&'));
77
-		} else {
78
-			ask_php_auth(
79
-				_T('info_connexion_refusee'),
80
-				_T('login_login_pass_incorrect'),
81
-				_T('login_retour_site'),
82
-				'url=' . rawurlencode($redirect),
83
-				_T('login_nouvelle_tentative'),
84
-				(strpos($url, (string) _DIR_RESTREINT_ABS) !== false)
85
-			);
86
-		}
87
-	} else {
88
-		// en cas de login sur bonjour=oui, on tente de poser un cookie
89
-		// puis de passer au login qui diagnostiquera l'echec de cookie
90
-		// le cas echeant.
91
-		if ($test_echec_cookie == 'oui') {
92
-			spip_setcookie('spip_session', 'test_echec_cookie');
93
-			if ($redirect) {
94
-				$redirect = parametre_url(
95
-					parametre_url($redirect_echec, 'var_echec_cookie', 'oui', '&'),
96
-					'url',
97
-					rawurlencode($redirect),
98
-					'&'
99
-				);
100
-			}
101
-		} else {
102
-			$cook = $_COOKIE['spip_admin'] ?? '';
103
-			// Suppression cookie d'admin ?
104
-			if ($set_cookie_admin == 'non') {
105
-				if ($cook) {
106
-					spip_setcookie('spip_admin', $cook, [
107
-						'expires' => time() - 3600 * 24
108
-					]);
109
-				}
110
-			} // Ajout de cookie d'admin
111
-			else {
112
-				if ($set_cookie_admin and _DUREE_COOKIE_ADMIN) {
113
-					spip_setcookie('spip_admin', $set_cookie_admin, [
114
-						'expires' => time() + max(_DUREE_COOKIE_ADMIN, 2 * _RENOUVELLE_ALEA)
115
-					]);
116
-				}
117
-			}
118
-		}
119
-	}
67
+    // tentative de connexion en auth_http
68
+    if (_request('essai_auth_http') and !$GLOBALS['ignore_auth_http']) {
69
+        include_spip('inc/auth');
70
+        if (
71
+            @$_SERVER['PHP_AUTH_USER']
72
+            and @$_SERVER['PHP_AUTH_PW']
73
+            and $auteur = lire_php_auth($_SERVER['PHP_AUTH_USER'], $_SERVER['PHP_AUTH_PW'])
74
+        ) {
75
+            auth_loger($auteur);
76
+            redirige_par_entete(parametre_url($redirect, 't', time(), '&'));
77
+        } else {
78
+            ask_php_auth(
79
+                _T('info_connexion_refusee'),
80
+                _T('login_login_pass_incorrect'),
81
+                _T('login_retour_site'),
82
+                'url=' . rawurlencode($redirect),
83
+                _T('login_nouvelle_tentative'),
84
+                (strpos($url, (string) _DIR_RESTREINT_ABS) !== false)
85
+            );
86
+        }
87
+    } else {
88
+        // en cas de login sur bonjour=oui, on tente de poser un cookie
89
+        // puis de passer au login qui diagnostiquera l'echec de cookie
90
+        // le cas echeant.
91
+        if ($test_echec_cookie == 'oui') {
92
+            spip_setcookie('spip_session', 'test_echec_cookie');
93
+            if ($redirect) {
94
+                $redirect = parametre_url(
95
+                    parametre_url($redirect_echec, 'var_echec_cookie', 'oui', '&'),
96
+                    'url',
97
+                    rawurlencode($redirect),
98
+                    '&'
99
+                );
100
+            }
101
+        } else {
102
+            $cook = $_COOKIE['spip_admin'] ?? '';
103
+            // Suppression cookie d'admin ?
104
+            if ($set_cookie_admin == 'non') {
105
+                if ($cook) {
106
+                    spip_setcookie('spip_admin', $cook, [
107
+                        'expires' => time() - 3600 * 24
108
+                    ]);
109
+                }
110
+            } // Ajout de cookie d'admin
111
+            else {
112
+                if ($set_cookie_admin and _DUREE_COOKIE_ADMIN) {
113
+                    spip_setcookie('spip_admin', $set_cookie_admin, [
114
+                        'expires' => time() + max(_DUREE_COOKIE_ADMIN, 2 * _RENOUVELLE_ALEA)
115
+                    ]);
116
+                }
117
+            }
118
+        }
119
+    }
120 120
 
121
-	// Redirection finale
122
-	if ($redirect) {
123
-		redirige_par_entete($redirect, true);
124
-	}
121
+    // Redirection finale
122
+    if ($redirect) {
123
+        redirige_par_entete($redirect, true);
124
+    }
125 125
 }
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -59,7 +59,7 @@  discard block
 block discarded – undo
59 59
 	if ($change_session == 'oui') {
60 60
 		$session = charger_fonction('session', 'inc');
61 61
 		$session(true);
62
-		spip_log('statut 204 pour ' . $_SERVER['REQUEST_URI']);
62
+		spip_log('statut 204 pour '.$_SERVER['REQUEST_URI']);
63 63
 		http_response_code(204); // No Content
64 64
 		return;
65 65
 	}
@@ -79,7 +79,7 @@  discard block
 block discarded – undo
79 79
 				_T('info_connexion_refusee'),
80 80
 				_T('login_login_pass_incorrect'),
81 81
 				_T('login_retour_site'),
82
-				'url=' . rawurlencode($redirect),
82
+				'url='.rawurlencode($redirect),
83 83
 				_T('login_nouvelle_tentative'),
84 84
 				(strpos($url, (string) _DIR_RESTREINT_ABS) !== false)
85 85
 			);
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
@@ -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
 /**
@@ -32,28 +32,28 @@  discard block
 block discarded – undo
32 32
  */
33 33
 function action_desinstaller_plugin_dist() {
34 34
 
35
-	$securiser_action = charger_fonction('securiser_action', 'inc');
36
-	$arg = $securiser_action();
37
-	[$dir_plugins, $plugin] = explode('::', $arg);
38
-	$dir_type = '_DIR_PLUGINS';
39
-	if (defined('_DIR_PLUGINS_SUPPL') and $dir_plugins == _DIR_PLUGINS_SUPPL) {
40
-		$dir_type = '_DIR_PLUGINS_SUPPL';
41
-	}
42
-	$installer_plugins = charger_fonction('installer', 'plugins');
43
-	$infos = $installer_plugins($plugin, 'uninstall', $dir_type);
44
-	if ($infos and !$infos['install_test'][0]) {
45
-		include_spip('inc/plugin');
46
-		ecrire_plugin_actifs([$plugin], false, 'enleve');
47
-		$erreur = '';
48
-	} else {
49
-		$erreur = 'erreur_plugin_desinstalation_echouee';
50
-	}
51
-	if ($redirect = _request('redirect')) {
52
-		include_spip('inc/headers');
53
-		if ($erreur) {
54
-			$redirect = parametre_url($redirect, 'erreur', $erreur);
55
-		}
56
-		$redirect = str_replace('&', '&', $redirect);
57
-		redirige_par_entete($redirect);
58
-	}
35
+    $securiser_action = charger_fonction('securiser_action', 'inc');
36
+    $arg = $securiser_action();
37
+    [$dir_plugins, $plugin] = explode('::', $arg);
38
+    $dir_type = '_DIR_PLUGINS';
39
+    if (defined('_DIR_PLUGINS_SUPPL') and $dir_plugins == _DIR_PLUGINS_SUPPL) {
40
+        $dir_type = '_DIR_PLUGINS_SUPPL';
41
+    }
42
+    $installer_plugins = charger_fonction('installer', 'plugins');
43
+    $infos = $installer_plugins($plugin, 'uninstall', $dir_type);
44
+    if ($infos and !$infos['install_test'][0]) {
45
+        include_spip('inc/plugin');
46
+        ecrire_plugin_actifs([$plugin], false, 'enleve');
47
+        $erreur = '';
48
+    } else {
49
+        $erreur = 'erreur_plugin_desinstalation_echouee';
50
+    }
51
+    if ($redirect = _request('redirect')) {
52
+        include_spip('inc/headers');
53
+        if ($erreur) {
54
+            $redirect = parametre_url($redirect, 'erreur', $erreur);
55
+        }
56
+        $redirect = str_replace('&', '&', $redirect);
57
+        redirige_par_entete($redirect);
58
+    }
59 59
 }
Please login to merge, or discard this patch.
ecrire/balise/url_logout.php 2 patches
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
 /**
@@ -36,7 +36,7 @@  discard block
 block discarded – undo
36 36
  *     Pile complétée du code compilé
37 37
  **/
38 38
 function balise_URL_LOGOUT($p) {
39
-	return calculer_balise_dynamique($p, 'URL_LOGOUT', []);
39
+    return calculer_balise_dynamique($p, 'URL_LOGOUT', []);
40 40
 }
41 41
 
42 42
 
@@ -52,9 +52,9 @@  discard block
 block discarded – undo
52 52
  *   Liste (url) des arguments collectés.
53 53
  */
54 54
 function balise_URL_LOGOUT_stat($args, $context_compil) {
55
-	$url = $args[0] ?? '';
55
+    $url = $args[0] ?? '';
56 56
 
57
-	return [$url];
57
+    return [$url];
58 58
 }
59 59
 
60 60
 /**
@@ -69,9 +69,9 @@  discard block
 block discarded – undo
69 69
  **/
70 70
 function balise_URL_LOGOUT_dyn($cible) {
71 71
 
72
-	if (empty($GLOBALS['visiteur_session']['login']) and empty($GLOBALS['visiteur_session']['statut'])) {
73
-		return '';
74
-	}
72
+    if (empty($GLOBALS['visiteur_session']['login']) and empty($GLOBALS['visiteur_session']['statut'])) {
73
+        return '';
74
+    }
75 75
 
76
-	return generer_url_action('logout', 'logout=public&url=' . rawurlencode($cible ?: self('&')));
76
+    return generer_url_action('logout', 'logout=public&url=' . rawurlencode($cible ?: self('&')));
77 77
 }
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -73,5 +73,5 @@
 block discarded – undo
73 73
 		return '';
74 74
 	}
75 75
 
76
-	return generer_url_action('logout', 'logout=public&url=' . rawurlencode($cible ?: self('&')));
76
+	return generer_url_action('logout', 'logout=public&url='.rawurlencode($cible ?: self('&')));
77 77
 }
Please login to merge, or discard this patch.
ecrire/exec/base_repair.php 1 patch
Indentation   +22 added lines, -22 removed lines patch added patch discarded remove patch
@@ -23,7 +23,7 @@  discard block
 block discarded – undo
23 23
  */
24 24
 
25 25
 if (!defined('_ECRIRE_INC_VERSION')) {
26
-	return;
26
+    return;
27 27
 }
28 28
 
29 29
 
@@ -31,25 +31,25 @@  discard block
 block discarded – undo
31 31
  * Réparer la base de données
32 32
  */
33 33
 function exec_base_repair_dist() {
34
-	$action = null;
35
-	$ok = false;
36
-	if (!spip_connect()) {
37
-		$message = _T('titre_probleme_technique');
38
-	} else {
39
-		$version_sql = sql_version();
40
-		if (!$version_sql) {
41
-			$message = _T('avis_erreur_connexion_mysql');
42
-		} else {
43
-			$message = _T('texte_requetes_echouent');
44
-			$ok = true;
45
-		}
46
-		$action = _T('texte_tenter_reparation');
47
-	}
48
-	if ($ok) {
49
-		$admin = charger_fonction('admin', 'inc');
50
-		echo $admin('repair', $action, $message, true);
51
-	} else {
52
-		include_spip('inc/minipres');
53
-		echo minipres(_T('titre_reparation'), "<p>$message</p>");
54
-	}
34
+    $action = null;
35
+    $ok = false;
36
+    if (!spip_connect()) {
37
+        $message = _T('titre_probleme_technique');
38
+    } else {
39
+        $version_sql = sql_version();
40
+        if (!$version_sql) {
41
+            $message = _T('avis_erreur_connexion_mysql');
42
+        } else {
43
+            $message = _T('texte_requetes_echouent');
44
+            $ok = true;
45
+        }
46
+        $action = _T('texte_tenter_reparation');
47
+    }
48
+    if ($ok) {
49
+        $admin = charger_fonction('admin', 'inc');
50
+        echo $admin('repair', $action, $message, true);
51
+    } else {
52
+        include_spip('inc/minipres');
53
+        echo minipres(_T('titre_reparation'), "<p>$message</p>");
54
+    }
55 55
 }
Please login to merge, or discard this patch.
ecrire/exec/demande_mise_a_jour.php 2 patches
Indentation   +24 added lines, -24 removed lines patch added patch discarded remove patch
@@ -20,7 +20,7 @@  discard block
 block discarded – undo
20 20
  */
21 21
 
22 22
 if (!defined('_ECRIRE_INC_VERSION')) {
23
-	return;
23
+    return;
24 24
 }
25 25
 
26 26
 
@@ -28,29 +28,29 @@  discard block
 block discarded – undo
28 28
  * Demander à mettre à jour la base de données
29 29
  */
30 30
 function exec_demande_mise_a_jour_dist() {
31
-	// on fait la verif du path avant tout,
32
-	// et l'installation des qu'on est dans la colonne principale
33
-	// si jamais la liste des plugins actifs change, il faut faire un refresh du hit
34
-	// pour etre sur que les bons fichiers seront charges lors de l'install
35
-	include_spip('inc/plugin');
36
-	if (actualise_plugins_actifs()) {
37
-		include_spip('inc/headers');
38
-		redirige_par_entete(self());
39
-	}
31
+    // on fait la verif du path avant tout,
32
+    // et l'installation des qu'on est dans la colonne principale
33
+    // si jamais la liste des plugins actifs change, il faut faire un refresh du hit
34
+    // pour etre sur que les bons fichiers seront charges lors de l'install
35
+    include_spip('inc/plugin');
36
+    if (actualise_plugins_actifs()) {
37
+        include_spip('inc/headers');
38
+        redirige_par_entete(self());
39
+    }
40 40
 
41
-	include_spip('inc/presentation');
42
-	include_spip('inc/filtres_boites');
43
-	$commencer_page = charger_fonction('commencer_page', 'inc');
44
-	echo $commencer_page('', '', '', '', true, false, false);
41
+    include_spip('inc/presentation');
42
+    include_spip('inc/filtres_boites');
43
+    $commencer_page = charger_fonction('commencer_page', 'inc');
44
+    echo $commencer_page('', '', '', '', true, false, false);
45 45
 
46
-	echo debut_grand_cadre();
47
-	echo boite_ouvrir(_T('info_message_technique'), 'notice');
48
-	echo '<p>' . _T('info_procedure_maj_version') . '</p>',
49
-		'<p>' . _T('info_administrateur_site_01') . '</p>';
50
-	echo bouton_action(_T('bouton_mettre_a_jour_base'), generer_url_ecrire('upgrade', 'reinstall=non'));
51
-	echo boite_fermer();
52
-	// masquer les erreurs sql sur cette page car proviennent de la base pas a jour !
53
-	echo '<style type="text/css">#debug-nav {display: none;}</style>';
54
-	echo fin_grand_cadre();
55
-	echo fin_page();
46
+    echo debut_grand_cadre();
47
+    echo boite_ouvrir(_T('info_message_technique'), 'notice');
48
+    echo '<p>' . _T('info_procedure_maj_version') . '</p>',
49
+        '<p>' . _T('info_administrateur_site_01') . '</p>';
50
+    echo bouton_action(_T('bouton_mettre_a_jour_base'), generer_url_ecrire('upgrade', 'reinstall=non'));
51
+    echo boite_fermer();
52
+    // masquer les erreurs sql sur cette page car proviennent de la base pas a jour !
53
+    echo '<style type="text/css">#debug-nav {display: none;}</style>';
54
+    echo fin_grand_cadre();
55
+    echo fin_page();
56 56
 }
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -45,8 +45,8 @@
 block discarded – undo
45 45
 
46 46
 	echo debut_grand_cadre();
47 47
 	echo boite_ouvrir(_T('info_message_technique'), 'notice');
48
-	echo '<p>' . _T('info_procedure_maj_version') . '</p>',
49
-		'<p>' . _T('info_administrateur_site_01') . '</p>';
48
+	echo '<p>'._T('info_procedure_maj_version').'</p>',
49
+		'<p>'._T('info_administrateur_site_01').'</p>';
50 50
 	echo bouton_action(_T('bouton_mettre_a_jour_base'), generer_url_ecrire('upgrade', 'reinstall=non'));
51 51
 	echo boite_fermer();
52 52
 	// masquer les erreurs sql sur cette page car proviennent de la base pas a jour !
Please login to merge, or discard this patch.
ecrire/exec/404.php 2 patches
Indentation   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -17,7 +17,7 @@  discard block
 block discarded – undo
17 17
  */
18 18
 
19 19
 if (!defined('_ECRIRE_INC_VERSION')) {
20
-	return;
20
+    return;
21 21
 }
22 22
 
23 23
 /**
@@ -25,25 +25,25 @@  discard block
 block discarded – undo
25 25
  */
26 26
 function exec_404_dist() {
27 27
 
28
-	$exec = _request('exec');
28
+    $exec = _request('exec');
29 29
 
30
-	$titre = "exec_$exec";
31
-	$navigation = '';
32
-	$extra = '';
30
+    $titre = "exec_$exec";
31
+    $navigation = '';
32
+    $extra = '';
33 33
 
34
-	include_spip('inc/presentation'); // alleger les inclusions avec un inc/presentation_mini
35
-	$commencer_page = charger_fonction('commencer_page', 'inc');
36
-	echo $commencer_page($titre);
34
+    include_spip('inc/presentation'); // alleger les inclusions avec un inc/presentation_mini
35
+    $commencer_page = charger_fonction('commencer_page', 'inc');
36
+    echo $commencer_page($titre);
37 37
 
38
-	echo debut_gauche();
39
-	echo pipeline('affiche_gauche', ['args' => ['exec' => '404', 'exec_erreur' => $exec], 'data' => '']);
38
+    echo debut_gauche();
39
+    echo pipeline('affiche_gauche', ['args' => ['exec' => '404', 'exec_erreur' => $exec], 'data' => '']);
40 40
 
41
-	echo creer_colonne_droite();
42
-	echo pipeline('affiche_droite', ['args' => ['exec' => '404', 'exec_erreur' => $exec], 'data' => '']);
41
+    echo creer_colonne_droite();
42
+    echo pipeline('affiche_droite', ['args' => ['exec' => '404', 'exec_erreur' => $exec], 'data' => '']);
43 43
 
44
-	echo debut_droite();
45
-	echo "<h1 class='grostitre'>" . _T('fichier_introuvable', ['fichier' => $exec]) . '</h1>';
46
-	echo pipeline('affiche_milieu', ['args' => ['exec' => '404', 'exec_erreur' => $exec], 'data' => '']);
44
+    echo debut_droite();
45
+    echo "<h1 class='grostitre'>" . _T('fichier_introuvable', ['fichier' => $exec]) . '</h1>';
46
+    echo pipeline('affiche_milieu', ['args' => ['exec' => '404', 'exec_erreur' => $exec], 'data' => '']);
47 47
 
48
-	echo fin_gauche(), fin_page();
48
+    echo fin_gauche(), fin_page();
49 49
 }
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -42,7 +42,7 @@
 block discarded – undo
42 42
 	echo pipeline('affiche_droite', ['args' => ['exec' => '404', 'exec_erreur' => $exec], 'data' => '']);
43 43
 
44 44
 	echo debut_droite();
45
-	echo "<h1 class='grostitre'>" . _T('fichier_introuvable', ['fichier' => $exec]) . '</h1>';
45
+	echo "<h1 class='grostitre'>"._T('fichier_introuvable', ['fichier' => $exec]).'</h1>';
46 46
 	echo pipeline('affiche_milieu', ['args' => ['exec' => '404', 'exec_erreur' => $exec], 'data' => '']);
47 47
 
48 48
 	echo fin_gauche(), fin_page();
Please login to merge, or discard this patch.
ecrire/inc/csv.php 2 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -87,12 +87,12 @@
 block discarded – undo
87 87
 	}
88 88
 	// si une seule colonne, en faire le titre
89 89
 	if (preg_match("/^([^$sep]+)$sep+\$/", $entete, $l)) {
90
-		$caption = "\n||" . $l[1] . '|';
90
+		$caption = "\n||".$l[1].'|';
91 91
 		[$entete, $corps] = explode("\n", $corps, 2);
92 92
 	}
93 93
 	// si premiere colonne vide, le raccourci doit quand meme produire <th...
94 94
 	if ($entete[0] == $sep) {
95
-		$entete = ' ' . $entete;
95
+		$entete = ' '.$entete;
96 96
 	}
97 97
 
98 98
 	$lignes = explode("\n", $corps);
Please login to merge, or discard this patch.
Indentation   +107 added lines, -107 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
 /**
@@ -32,117 +32,117 @@  discard block
 block discarded – undo
32 32
  **/
33 33
 function analyse_csv($t) {
34 34
 
35
-	// Quel est le séparateur ?
36
-	$virg = substr_count($t, ',');
37
-	$pvirg = substr_count($t, ';');
38
-	$tab = substr_count($t, "\t");
39
-	if ($virg > $pvirg) {
40
-		$sep = ',';
41
-		$hs = '&#44;';
42
-	} else {
43
-		$sep = ';';
44
-		$hs = '&#59;';
45
-		$virg = $pvirg;
46
-	}
47
-	// un certain nombre de tab => le séparateur est tab
48
-	if ($tab > $virg / 10) {
49
-		$sep = "\t";
50
-		$hs = "\t";
51
-	}
35
+    // Quel est le séparateur ?
36
+    $virg = substr_count($t, ',');
37
+    $pvirg = substr_count($t, ';');
38
+    $tab = substr_count($t, "\t");
39
+    if ($virg > $pvirg) {
40
+        $sep = ',';
41
+        $hs = '&#44;';
42
+    } else {
43
+        $sep = ';';
44
+        $hs = '&#59;';
45
+        $virg = $pvirg;
46
+    }
47
+    // un certain nombre de tab => le séparateur est tab
48
+    if ($tab > $virg / 10) {
49
+        $sep = "\t";
50
+        $hs = "\t";
51
+    }
52 52
 
53
-	// un separateur suivi de 3 guillemets attention !
54
-	// attention au ; ou , suceptible d'etre confondu avec un separateur
55
-	// on substitue un # et on remplacera a la fin
56
-	$t = preg_replace("/([\n$sep])\"\"\"/", '\\1"&#34#', $t);
57
-	$t = str_replace('""', '&#34#', $t);
58
-	preg_match_all('/"[^"]*"/', $t, $r);
59
-	foreach ($r[0] as $cell) {
60
-		$t = str_replace(
61
-			$cell,
62
-			str_replace(
63
-				$sep,
64
-				$hs,
65
-				str_replace(
66
-					"\n",
67
-					'``**``', // échapper les saut de lignes, on les remettra après.
68
-					substr($cell, 1, -1)
69
-				)
70
-			),
71
-			$t
72
-		);
73
-	}
53
+    // un separateur suivi de 3 guillemets attention !
54
+    // attention au ; ou , suceptible d'etre confondu avec un separateur
55
+    // on substitue un # et on remplacera a la fin
56
+    $t = preg_replace("/([\n$sep])\"\"\"/", '\\1"&#34#', $t);
57
+    $t = str_replace('""', '&#34#', $t);
58
+    preg_match_all('/"[^"]*"/', $t, $r);
59
+    foreach ($r[0] as $cell) {
60
+        $t = str_replace(
61
+            $cell,
62
+            str_replace(
63
+                $sep,
64
+                $hs,
65
+                str_replace(
66
+                    "\n",
67
+                    '``**``', // échapper les saut de lignes, on les remettra après.
68
+                    substr($cell, 1, -1)
69
+                )
70
+            ),
71
+            $t
72
+        );
73
+    }
74 74
 
75
-	$t = preg_replace(
76
-		'/\r?\n/',
77
-		"\n",
78
-		preg_replace('/[\r\n]+/', "\n", $t)
79
-	);
75
+    $t = preg_replace(
76
+        '/\r?\n/',
77
+        "\n",
78
+        preg_replace('/[\r\n]+/', "\n", $t)
79
+    );
80 80
 
81
-	[$entete, $corps] = explode("\n", $t, 2);
82
-	$caption = '';
83
-	// sauter la ligne de tete formee seulement de separateurs
84
-	if (substr_count($entete, $sep) === strlen($entete)) {
85
-		[$entete, $corps] = explode("\n", $corps, 2);
86
-	}
87
-	// si une seule colonne, en faire le titre
88
-	if (preg_match("/^([^$sep]+)$sep+\$/", $entete, $l)) {
89
-		$caption = "\n||" . $l[1] . '|';
90
-		[$entete, $corps] = explode("\n", $corps, 2);
91
-	}
92
-	// si premiere colonne vide, le raccourci doit quand meme produire <th...
93
-	if ($entete[0] == $sep) {
94
-		$entete = ' ' . $entete;
95
-	}
81
+    [$entete, $corps] = explode("\n", $t, 2);
82
+    $caption = '';
83
+    // sauter la ligne de tete formee seulement de separateurs
84
+    if (substr_count($entete, $sep) === strlen($entete)) {
85
+        [$entete, $corps] = explode("\n", $corps, 2);
86
+    }
87
+    // si une seule colonne, en faire le titre
88
+    if (preg_match("/^([^$sep]+)$sep+\$/", $entete, $l)) {
89
+        $caption = "\n||" . $l[1] . '|';
90
+        [$entete, $corps] = explode("\n", $corps, 2);
91
+    }
92
+    // si premiere colonne vide, le raccourci doit quand meme produire <th...
93
+    if ($entete[0] == $sep) {
94
+        $entete = ' ' . $entete;
95
+    }
96 96
 
97
-	$lignes = explode("\n", $corps);
97
+    $lignes = explode("\n", $corps);
98 98
 
99
-	// retrait des lignes vides finales
100
-	while (
101
-		$lignes !== [] && preg_match("/^$sep*$/", $lignes[count($lignes) - 1])
102
-	) {
103
-		unset($lignes[count($lignes) - 1]);
104
-	}
105
-	//  calcul du  nombre de colonne a chaque ligne
106
-	$nbcols = [];
107
-	$max = $mil = substr_count($entete, $sep);
108
-	foreach ($lignes as $k => $v) {
109
-		if ($max !== ($nbcols[$k] = substr_count($v, $sep))) {
110
-			if ($max > $nbcols[$k]) {
111
-				$mil = $nbcols[$k];
112
-			} else {
113
-				$mil = $max;
114
-				$max = $nbcols[$k];
115
-			}
116
-		}
117
-	}
118
-	// Si pas le meme nombre, cadrer au nombre max
119
-	if ($mil !== $max) {
120
-		foreach ($nbcols as $k => $v) {
121
-			if ($v < $max) {
122
-				$lignes[$k] .= str_repeat($sep, $max - $v);
123
-			}
124
-		}
125
-	}
126
-	// et retirer les colonnes integralement vides
127
-	while (true) {
128
-		$nbcols = ($entete[strlen($entete) - 1] === $sep);
129
-		foreach ($lignes as $v) {
130
-			$nbcols &= ($v[strlen($v) - 1] === $sep);
131
-		}
132
-		if (!$nbcols) {
133
-			break;
134
-		}
135
-		$entete = substr($entete, 0, -1);
136
-		foreach ($lignes as $k => $v) {
137
-			$lignes[$k] = substr($v, 0, -1);
138
-		}
139
-	}
99
+    // retrait des lignes vides finales
100
+    while (
101
+        $lignes !== [] && preg_match("/^$sep*$/", $lignes[count($lignes) - 1])
102
+    ) {
103
+        unset($lignes[count($lignes) - 1]);
104
+    }
105
+    //  calcul du  nombre de colonne a chaque ligne
106
+    $nbcols = [];
107
+    $max = $mil = substr_count($entete, $sep);
108
+    foreach ($lignes as $k => $v) {
109
+        if ($max !== ($nbcols[$k] = substr_count($v, $sep))) {
110
+            if ($max > $nbcols[$k]) {
111
+                $mil = $nbcols[$k];
112
+            } else {
113
+                $mil = $max;
114
+                $max = $nbcols[$k];
115
+            }
116
+        }
117
+    }
118
+    // Si pas le meme nombre, cadrer au nombre max
119
+    if ($mil !== $max) {
120
+        foreach ($nbcols as $k => $v) {
121
+            if ($v < $max) {
122
+                $lignes[$k] .= str_repeat($sep, $max - $v);
123
+            }
124
+        }
125
+    }
126
+    // et retirer les colonnes integralement vides
127
+    while (true) {
128
+        $nbcols = ($entete[strlen($entete) - 1] === $sep);
129
+        foreach ($lignes as $v) {
130
+            $nbcols &= ($v[strlen($v) - 1] === $sep);
131
+        }
132
+        if (!$nbcols) {
133
+            break;
134
+        }
135
+        $entete = substr($entete, 0, -1);
136
+        foreach ($lignes as $k => $v) {
137
+            $lignes[$k] = substr($v, 0, -1);
138
+        }
139
+    }
140 140
 
141
-	foreach ($lignes as &$l) {
142
-		$l = str_replace('&#34#', '"', $l);
143
-		$l = str_replace('``**``', "\n", $l);
144
-		$l = explode($sep, $l);
145
-	}
141
+    foreach ($lignes as &$l) {
142
+        $l = str_replace('&#34#', '"', $l);
143
+        $l = str_replace('``**``', "\n", $l);
144
+        $l = explode($sep, $l);
145
+    }
146 146
 
147
-	return [explode($sep, $entete), $lignes, $caption];
147
+    return [explode($sep, $entete), $lignes, $caption];
148 148
 }
Please login to merge, or discard this patch.
ecrire/inc/invalideur.php 2 patches
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -45,7 +45,7 @@  discard block
 block discarded – undo
45 45
 	$n = 0;
46 46
 	$time = $GLOBALS['meta']['cache_mark'] ?? 0;
47 47
 	for ($i = 0; $i < 256; $i++) {
48
-		$dir = _DIR_CACHE . sprintf('%02s', dechex($i));
48
+		$dir = _DIR_CACHE.sprintf('%02s', dechex($i));
49 49
 		if (@is_dir($dir) and is_readable($dir) and $d = opendir($dir)) {
50 50
 			while (($f = readdir($d)) !== false) {
51 51
 				if (preg_match(',^[[0-9a-f]+\.cache$,S', $f) and $a = stat("$dir/$f")) {
@@ -102,7 +102,7 @@  discard block
 block discarded – undo
102 102
 
103 103
 	// stocker la date_modif_$objet (ne sert a rien pour le moment)
104 104
 	if (isset($objet)) {
105
-		ecrire_meta('derniere_modif_' . $objet, time());
105
+		ecrire_meta('derniere_modif_'.$objet, time());
106 106
 	}
107 107
 
108 108
 	// si $derniere_modif_invalide est un array('article', 'rubrique')
@@ -145,7 +145,7 @@  discard block
 block discarded – undo
145 145
 
146 146
 	// sur certains sites on veut absolument garder certains caches référencés dans un CDN
147 147
 	// on peut donc inhiber la purge de ces répertoires pour eviter tout probleme
148
-	if (file_exists(rtrim($dir, '/') . '/inhib_purger_repertoire.txt')) {
148
+	if (file_exists(rtrim($dir, '/').'/inhib_purger_repertoire.txt')) {
149 149
 		return 0;
150 150
 	}
151 151
 
@@ -208,7 +208,7 @@  discard block
 block discarded – undo
208 208
 		)
209 209
 	) {
210 210
 		// supprimer le fichier (de facon propre)
211
-		supprimer_fichier(_DIR_CACHE . $cache);
211
+		supprimer_fichier(_DIR_CACHE.$cache);
212 212
 	} else {
213 213
 		spip_log("Nom de fichier cache incorrect : $cache");
214 214
 	}
Please login to merge, or discard this patch.
Indentation   +138 added lines, -138 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/serial');
@@ -27,7 +27,7 @@  discard block
 block discarded – undo
27 27
  * en droit de l'éliminer
28 28
  */
29 29
 if (!defined('_AGE_CACHE_ATIME')) {
30
-	define('_AGE_CACHE_ATIME', 3600);
30
+    define('_AGE_CACHE_ATIME', 3600);
31 31
 }
32 32
 
33 33
 
@@ -40,31 +40,31 @@  discard block
 block discarded – undo
40 40
  * @return int Taille approximative en octets
41 41
  **/
42 42
 function taille_du_cache() {
43
-	# check dirs until we reach > 500 files
44
-	$t = 0;
45
-	$n = 0;
46
-	$time = $GLOBALS['meta']['cache_mark'] ?? 0;
47
-	for ($i = 0; $i < 256; $i++) {
48
-		$dir = _DIR_CACHE . sprintf('%02s', dechex($i));
49
-		if (@is_dir($dir) and is_readable($dir) and $d = opendir($dir)) {
50
-			while (($f = readdir($d)) !== false) {
51
-				if (preg_match(',^[[0-9a-f]+\.cache$,S', $f) and $a = stat("$dir/$f")) {
52
-					$n++;
53
-					if ($a['mtime'] >= $time) {
54
-						if ($a['blocks'] > 0) {
55
-							$t += 512 * $a['blocks'];
56
-						} else {
57
-							$t += $a['size'];
58
-						}
59
-					}
60
-				}
61
-			}
62
-		}
63
-		if ($n > 500) {
64
-			return intval(256 * $t / (1 + $i));
65
-		}
66
-	}
67
-	return $t;
43
+    # check dirs until we reach > 500 files
44
+    $t = 0;
45
+    $n = 0;
46
+    $time = $GLOBALS['meta']['cache_mark'] ?? 0;
47
+    for ($i = 0; $i < 256; $i++) {
48
+        $dir = _DIR_CACHE . sprintf('%02s', dechex($i));
49
+        if (@is_dir($dir) and is_readable($dir) and $d = opendir($dir)) {
50
+            while (($f = readdir($d)) !== false) {
51
+                if (preg_match(',^[[0-9a-f]+\.cache$,S', $f) and $a = stat("$dir/$f")) {
52
+                    $n++;
53
+                    if ($a['mtime'] >= $time) {
54
+                        if ($a['blocks'] > 0) {
55
+                            $t += 512 * $a['blocks'];
56
+                        } else {
57
+                            $t += $a['size'];
58
+                        }
59
+                    }
60
+                }
61
+            }
62
+        }
63
+        if ($n > 500) {
64
+            return intval(256 * $t / (1 + $i));
65
+        }
66
+    }
67
+    return $t;
68 68
 }
69 69
 
70 70
 
@@ -91,30 +91,30 @@  discard block
 block discarded – undo
91 91
  *     Inutilisé
92 92
  **/
93 93
 function inc_suivre_invalideur_dist($cond, $modif = true) {
94
-	if (!$modif) {
95
-		return;
96
-	}
97
-
98
-	// determiner l'objet modifie : forum, article, etc
99
-	if (preg_match(',["\']([a-z_]+)[/"\'],', $cond, $r)) {
100
-		$objet = objet_type($r[1]);
101
-	}
102
-
103
-	// stocker la date_modif_$objet (ne sert a rien pour le moment)
104
-	if (isset($objet)) {
105
-		ecrire_meta('derniere_modif_' . $objet, time());
106
-	}
107
-
108
-	// si $derniere_modif_invalide est un array('article', 'rubrique')
109
-	// n'affecter la meta que si un de ces objets est modifie
110
-	if (is_array($GLOBALS['derniere_modif_invalide'])) {
111
-		if (in_array($objet, $GLOBALS['derniere_modif_invalide'])) {
112
-			ecrire_meta('derniere_modif', time());
113
-		}
114
-	} // sinon, cas standard, toujours affecter la meta
115
-	else {
116
-		ecrire_meta('derniere_modif', time());
117
-	}
94
+    if (!$modif) {
95
+        return;
96
+    }
97
+
98
+    // determiner l'objet modifie : forum, article, etc
99
+    if (preg_match(',["\']([a-z_]+)[/"\'],', $cond, $r)) {
100
+        $objet = objet_type($r[1]);
101
+    }
102
+
103
+    // stocker la date_modif_$objet (ne sert a rien pour le moment)
104
+    if (isset($objet)) {
105
+        ecrire_meta('derniere_modif_' . $objet, time());
106
+    }
107
+
108
+    // si $derniere_modif_invalide est un array('article', 'rubrique')
109
+    // n'affecter la meta que si un de ces objets est modifie
110
+    if (is_array($GLOBALS['derniere_modif_invalide'])) {
111
+        if (in_array($objet, $GLOBALS['derniere_modif_invalide'])) {
112
+            ecrire_meta('derniere_modif', time());
113
+        }
114
+    } // sinon, cas standard, toujours affecter la meta
115
+    else {
116
+        ecrire_meta('derniere_modif', time());
117
+    }
118 118
 }
119 119
 
120 120
 
@@ -139,57 +139,57 @@  discard block
 block discarded – undo
139 139
  *     Nombre de fichiers supprimés
140 140
  **/
141 141
 function purger_repertoire($dir, $options = []) {
142
-	if (!is_dir($dir) or !is_readable($dir)) {
143
-		return 0;
144
-	}
145
-
146
-	// sur certains sites on veut absolument garder certains caches référencés dans un CDN
147
-	// on peut donc inhiber la purge de ces répertoires pour eviter tout probleme
148
-	if (file_exists(rtrim($dir, '/') . '/inhib_purger_repertoire.txt')) {
149
-		return 0;
150
-	}
151
-
152
-	$handle = opendir($dir);
153
-	if (!$handle) {
154
-		return 0;
155
-	}
156
-
157
-	$total = 0;
158
-
159
-	while (($fichier = @readdir($handle)) !== false) {
160
-		// Eviter ".", "..", ".htaccess", ".svn" etc & CACHEDIR.TAG
161
-		if ($fichier[0] == '.' or $fichier == 'CACHEDIR.TAG') {
162
-			continue;
163
-		}
164
-		$chemin = "$dir/$fichier";
165
-		if (is_file($chemin)) {
166
-			if (
167
-				(!isset($options['atime']) or (@fileatime($chemin) < $options['atime']))
168
-				and (!isset($options['mtime']) or (@filemtime($chemin) < $options['mtime']))
169
-			) {
170
-				supprimer_fichier($chemin);
171
-				$total++;
172
-			}
173
-		} else {
174
-			if (is_dir($chemin)) {
175
-				$opts = $options;
176
-				if (isset($options['limit'])) {
177
-					$opts['limit'] = $options['limit'] - $total;
178
-				}
179
-				$total += purger_repertoire($chemin, $opts);
180
-				if (isset($options['subdir']) && $options['subdir']) {
181
-					spip_unlink($chemin);
182
-				}
183
-			}
184
-		}
185
-
186
-		if (isset($options['limit']) and $total >= $options['limit']) {
187
-			break;
188
-		}
189
-	}
190
-	closedir($handle);
191
-
192
-	return $total;
142
+    if (!is_dir($dir) or !is_readable($dir)) {
143
+        return 0;
144
+    }
145
+
146
+    // sur certains sites on veut absolument garder certains caches référencés dans un CDN
147
+    // on peut donc inhiber la purge de ces répertoires pour eviter tout probleme
148
+    if (file_exists(rtrim($dir, '/') . '/inhib_purger_repertoire.txt')) {
149
+        return 0;
150
+    }
151
+
152
+    $handle = opendir($dir);
153
+    if (!$handle) {
154
+        return 0;
155
+    }
156
+
157
+    $total = 0;
158
+
159
+    while (($fichier = @readdir($handle)) !== false) {
160
+        // Eviter ".", "..", ".htaccess", ".svn" etc & CACHEDIR.TAG
161
+        if ($fichier[0] == '.' or $fichier == 'CACHEDIR.TAG') {
162
+            continue;
163
+        }
164
+        $chemin = "$dir/$fichier";
165
+        if (is_file($chemin)) {
166
+            if (
167
+                (!isset($options['atime']) or (@fileatime($chemin) < $options['atime']))
168
+                and (!isset($options['mtime']) or (@filemtime($chemin) < $options['mtime']))
169
+            ) {
170
+                supprimer_fichier($chemin);
171
+                $total++;
172
+            }
173
+        } else {
174
+            if (is_dir($chemin)) {
175
+                $opts = $options;
176
+                if (isset($options['limit'])) {
177
+                    $opts['limit'] = $options['limit'] - $total;
178
+                }
179
+                $total += purger_repertoire($chemin, $opts);
180
+                if (isset($options['subdir']) && $options['subdir']) {
181
+                    spip_unlink($chemin);
182
+                }
183
+            }
184
+        }
185
+
186
+        if (isset($options['limit']) and $total >= $options['limit']) {
187
+            break;
188
+        }
189
+    }
190
+    closedir($handle);
191
+
192
+    return $total;
193 193
 }
194 194
 
195 195
 
@@ -200,26 +200,26 @@  discard block
 block discarded – undo
200 200
 // Securite : est sur que c'est un cache
201 201
 function retire_cache($cache) {
202 202
 
203
-	if (
204
-		preg_match(
205
-			',^([0-9a-f]/)?([0-9]+/)?[0-9a-f]+\.cache(\.gz)?$,i',
206
-			$cache
207
-		)
208
-	) {
209
-		// supprimer le fichier (de facon propre)
210
-		supprimer_fichier(_DIR_CACHE . $cache);
211
-	} else {
212
-		spip_log("Nom de fichier cache incorrect : $cache");
213
-	}
203
+    if (
204
+        preg_match(
205
+            ',^([0-9a-f]/)?([0-9]+/)?[0-9a-f]+\.cache(\.gz)?$,i',
206
+            $cache
207
+        )
208
+    ) {
209
+        // supprimer le fichier (de facon propre)
210
+        supprimer_fichier(_DIR_CACHE . $cache);
211
+    } else {
212
+        spip_log("Nom de fichier cache incorrect : $cache");
213
+    }
214 214
 }
215 215
 
216 216
 // Supprimer les caches marques "x"
217 217
 // A priori dans cette version la fonction ne sera pas appelee, car
218 218
 // la meta est toujours false ; mais evitons un bug si elle est appellee
219 219
 function inc_retire_caches_dist($chemin = '') {
220
-	if (isset($GLOBALS['meta']['invalider_caches'])) {
221
-		effacer_meta('invalider_caches');
222
-	} # concurrence
220
+    if (isset($GLOBALS['meta']['invalider_caches'])) {
221
+        effacer_meta('invalider_caches');
222
+    } # concurrence
223 223
 }
224 224
 
225 225
 #######################################################################
@@ -230,9 +230,9 @@  discard block
 block discarded – undo
230 230
 ##
231 231
 
232 232
 function retire_caches($chemin = '') {
233
-	if ($retire_caches = charger_fonction('retire_caches', 'inc', true)) {
234
-		return $retire_caches($chemin);
235
-	}
233
+    if ($retire_caches = charger_fonction('retire_caches', 'inc', true)) {
234
+        return $retire_caches($chemin);
235
+    }
236 236
 }
237 237
 
238 238
 
@@ -240,10 +240,10 @@  discard block
 block discarded – undo
240 240
 // (note: si absente, n'est pas appellee)
241 241
 
242 242
 function calcul_invalideurs($corps, $primary, &$boucles, $id_boucle) {
243
-	if ($calcul_invalideurs = charger_fonction('calcul_invalideurs', 'inc', true)) {
244
-		return $calcul_invalideurs($corps, $primary, $boucles, $id_boucle);
245
-	}
246
-	return $corps;
243
+    if ($calcul_invalideurs = charger_fonction('calcul_invalideurs', 'inc', true)) {
244
+        return $calcul_invalideurs($corps, $primary, $boucles, $id_boucle);
245
+    }
246
+    return $corps;
247 247
 }
248 248
 
249 249
 
@@ -252,41 +252,41 @@  discard block
 block discarded – undo
252 252
 // invoquee quand on vide tout le cache en bloc (action/purger)
253 253
 //
254 254
 function supprime_invalideurs() {
255
-	if ($supprime_invalideurs = charger_fonction('supprime_invalideurs', 'inc', true)) {
256
-		return $supprime_invalideurs();
257
-	}
255
+    if ($supprime_invalideurs = charger_fonction('supprime_invalideurs', 'inc', true)) {
256
+        return $supprime_invalideurs();
257
+    }
258 258
 }
259 259
 
260 260
 
261 261
 // Calcul des pages : noter dans la base les liens d'invalidation
262 262
 function maj_invalideurs($fichier, &$page) {
263
-	if ($maj_invalideurs = charger_fonction('maj_invalideurs', 'inc', true)) {
264
-		return $maj_invalideurs($fichier, $page);
265
-	}
263
+    if ($maj_invalideurs = charger_fonction('maj_invalideurs', 'inc', true)) {
264
+        return $maj_invalideurs($fichier, $page);
265
+    }
266 266
 }
267 267
 
268 268
 
269 269
 // les invalideurs sont de la forme "objet/id_objet"
270 270
 function insere_invalideur($inval, $fichier) {
271
-	if ($insere_invalideur = charger_fonction('insere_invalideur', 'inc', true)) {
272
-		return $insere_invalideur($inval, $fichier);
273
-	}
271
+    if ($insere_invalideur = charger_fonction('insere_invalideur', 'inc', true)) {
272
+        return $insere_invalideur($inval, $fichier);
273
+    }
274 274
 }
275 275
 
276 276
 //
277 277
 // Marquer les fichiers caches invalides comme etant a supprimer
278 278
 //
279 279
 function applique_invalideur($depart) {
280
-	if ($applique_invalideur = charger_fonction('applique_invalideur', 'inc', true)) {
281
-		return $applique_invalideur($depart);
282
-	}
280
+    if ($applique_invalideur = charger_fonction('applique_invalideur', 'inc', true)) {
281
+        return $applique_invalideur($depart);
282
+    }
283 283
 }
284 284
 
285 285
 //
286 286
 // Invalider les caches liés à telle condition
287 287
 //
288 288
 function suivre_invalideur($cond, $modif = true) {
289
-	if ($suivre_invalideur = charger_fonction('suivre_invalideur', 'inc', true)) {
290
-		return $suivre_invalideur($cond, $modif);
291
-	}
289
+    if ($suivre_invalideur = charger_fonction('suivre_invalideur', 'inc', true)) {
290
+        return $suivre_invalideur($cond, $modif);
291
+    }
292 292
 }
Please login to merge, or discard this patch.
ecrire/inc/plonger.php 2 patches
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -35,9 +35,9 @@  discard block
 block discarded – undo
35 35
 	$res = sql_select(
36 36
 		'rub1.id_rubrique, rub1.titre, rub1.id_parent, rub1.lang, rub1.langue_choisie, rub2.id_rubrique AS id_enfant',
37 37
 		'spip_rubriques AS rub1 LEFT JOIN spip_rubriques AS rub2 ON (rub1.id_rubrique = rub2.id_parent)',
38
-		'rub1.id_parent = ' . sql_quote($id_rubrique) . '
39
-			AND rub1.id_rubrique!=' . sql_quote($exclu) . '
40
-			AND (rub2.id_rubrique IS NULL OR rub2.id_rubrique!=' . sql_quote($exclu) . ')',
38
+		'rub1.id_parent = '.sql_quote($id_rubrique).'
39
+			AND rub1.id_rubrique!=' . sql_quote($exclu).'
40
+			AND (rub2.id_rubrique IS NULL OR rub2.id_rubrique!=' . sql_quote($exclu).')',
41 41
 		'',
42 42
 		'0+rub1.titre,rub1.titre'
43 43
 	);
@@ -50,7 +50,7 @@  discard block
 block discarded – undo
50 50
 				if ($row['langue_choisie'] != 'oui') {
51 51
 					$t .= ' <small title="'
52 52
 						. traduire_nom_langue($row['lang'])
53
-						. '">[' . $row['lang'] . ']</small>';
53
+						. '">['.$row['lang'].']</small>';
54 54
 				}
55 55
 				$ordre[$row['id_rubrique']] = $t;
56 56
 			}
@@ -58,14 +58,14 @@  discard block
 block discarded – undo
58 58
 	}
59 59
 	$next = $list[$col] ?? 0;
60 60
 	if ($ordre) {
61
-		$rec = generer_url_ecrire('plonger', "rac=$idom&exclus=$exclu&do=$do&col=" . ($col + 1));
61
+		$rec = generer_url_ecrire('plonger', "rac=$idom&exclus=$exclu&do=$do&col=".($col + 1));
62 62
 		$info = generer_url_ecrire('informer', "type=rubrique&rac=$idom&do=$do&id=");
63
-		$args = "'$idom',this,$col,'" . $GLOBALS['spip_lang_left'] . "','$info',event";
63
+		$args = "'$idom',this,$col,'".$GLOBALS['spip_lang_left']."','$info',event";
64 64
 
65 65
 		foreach ($ordre as $id => $titrebrut) {
66 66
 			$titre = supprimer_numero($titrebrut);
67 67
 
68
-			$classe1 = 'petit-item ' . ($id_rubrique ? 'petite-rubrique' : 'petit-secteur');
68
+			$classe1 = 'petit-item '.($id_rubrique ? 'petite-rubrique' : 'petit-secteur');
69 69
 			if (isset($rub[$id]['enfants'])) {
70 70
 				$classe2 = " class='rub-ouverte'";
71 71
 				$url = "\nhref='$rec&amp;id=$id'";
@@ -74,7 +74,7 @@  discard block
 block discarded – undo
74 74
 				$url = "\nhref='javascript:void(0)'";
75 75
 			}
76 76
 
77
-			$js_func = $do . '_selection_titre';
77
+			$js_func = $do.'_selection_titre';
78 78
 			$click = "\nonclick=\"changerhighlight(this.parentNode.parentNode.parentNode);\nreturn "
79 79
 				. (!is_array($list) ? ' false'
80 80
 					: "aff_selection_provisoire($id,$args)")
@@ -101,17 +101,17 @@  discard block
 block discarded – undo
101 101
 		}
102 102
 	}
103 103
 
104
-	$idom2 = $idom . '_col_' . ($col + 1);
104
+	$idom2 = $idom.'_col_'.($col + 1);
105 105
 	$left = ($col * 250);
106 106
 
107 107
 	return http_img_pack(
108 108
 		'loader.svg',
109 109
 		'',
110
-		"class='loader' style='visibility: hidden; position: absolute; " . $GLOBALS['spip_lang_left'] . ': '
110
+		"class='loader' style='visibility: hidden; position: absolute; ".$GLOBALS['spip_lang_left'].': '
111 111
 		. ($left - 30)
112 112
 		. "px; top: 2px; z-index: 2;' id='img_$idom2'"
113 113
 	)
114
-	. "<div style='width: 250px; height: 100%; overflow: auto; position: absolute; top: 0px; " . $GLOBALS['spip_lang_left'] . ': '
114
+	. "<div style='width: 250px; height: 100%; overflow: auto; position: absolute; top: 0px; ".$GLOBALS['spip_lang_left'].': '
115 115
 	. ($left - 250)
116 116
 	. "px;'>"
117 117
 	. $ret
Please login to merge, or discard this patch.
Indentation   +88 added lines, -88 removed lines patch added patch discarded remove patch
@@ -11,112 +11,112 @@
 block discarded – undo
11 11
 \***************************************************************************/
12 12
 
13 13
 if (!defined('_ECRIRE_INC_VERSION')) {
14
-	return;
14
+    return;
15 15
 }
16 16
 
17 17
 include_spip('inc/texte');
18 18
 
19 19
 function inc_plonger_dist($id_rubrique, $idom = '', $list = [], $col = 1, $exclu = 0, $do = 'aff') {
20 20
 
21
-	if ($list) {
22
-		$id_rubrique = $list[$col - 1];
23
-	}
21
+    if ($list) {
22
+        $id_rubrique = $list[$col - 1];
23
+    }
24 24
 
25
-	$ret = '';
25
+    $ret = '';
26 26
 
27
-	# recherche les filles et petites-filles de la rubrique donnee
28
-	# en excluant une eventuelle rubrique interdite (par exemple, lorsqu'on
29
-	# deplace une rubrique, on peut la deplacer partout a partir de la
30
-	# racine... sauf vers elle-meme ou sa propre branche)
31
-	$ordre = [];
32
-	$rub = [];
27
+    # recherche les filles et petites-filles de la rubrique donnee
28
+    # en excluant une eventuelle rubrique interdite (par exemple, lorsqu'on
29
+    # deplace une rubrique, on peut la deplacer partout a partir de la
30
+    # racine... sauf vers elle-meme ou sa propre branche)
31
+    $ordre = [];
32
+    $rub = [];
33 33
 
34
-	$res = sql_select(
35
-		'rub1.id_rubrique, rub1.titre, rub1.id_parent, rub1.lang, rub1.langue_choisie, rub2.id_rubrique AS id_enfant',
36
-		'spip_rubriques AS rub1 LEFT JOIN spip_rubriques AS rub2 ON (rub1.id_rubrique = rub2.id_parent)',
37
-		'rub1.id_parent = ' . sql_quote($id_rubrique) . '
34
+    $res = sql_select(
35
+        'rub1.id_rubrique, rub1.titre, rub1.id_parent, rub1.lang, rub1.langue_choisie, rub2.id_rubrique AS id_enfant',
36
+        'spip_rubriques AS rub1 LEFT JOIN spip_rubriques AS rub2 ON (rub1.id_rubrique = rub2.id_parent)',
37
+        'rub1.id_parent = ' . sql_quote($id_rubrique) . '
38 38
 			AND rub1.id_rubrique!=' . sql_quote($exclu) . '
39 39
 			AND (rub2.id_rubrique IS NULL OR rub2.id_rubrique!=' . sql_quote($exclu) . ')',
40
-		'',
41
-		'0+rub1.titre,rub1.titre'
42
-	);
40
+        '',
41
+        '0+rub1.titre,rub1.titre'
42
+    );
43 43
 
44
-	while ($row = sql_fetch($res)) {
45
-		if (autoriser('voir', 'rubrique', $row['id_rubrique'])) {
46
-			$rub[$row['id_rubrique']]['enfants'] = $row['id_enfant'];
47
-			if ($row['id_parent'] == $id_rubrique) {
48
-				$t = trim(typo(supprimer_numero($row['titre'])));
49
-				if ($row['langue_choisie'] != 'oui') {
50
-					$t .= ' <small title="'
51
-						. traduire_nom_langue($row['lang'])
52
-						. '">[' . $row['lang'] . ']</small>';
53
-				}
54
-				$ordre[$row['id_rubrique']] = $t;
55
-			}
56
-		}
57
-	}
58
-	$next = $list[$col] ?? 0;
59
-	if ($ordre) {
60
-		$rec = generer_url_ecrire('plonger', "rac=$idom&exclus=$exclu&do=$do&col=" . ($col + 1));
61
-		$info = generer_url_ecrire('informer', "type=rubrique&rac=$idom&do=$do&id=");
62
-		$args = "'$idom',this,$col,'" . $GLOBALS['spip_lang_left'] . "','$info',event";
44
+    while ($row = sql_fetch($res)) {
45
+        if (autoriser('voir', 'rubrique', $row['id_rubrique'])) {
46
+            $rub[$row['id_rubrique']]['enfants'] = $row['id_enfant'];
47
+            if ($row['id_parent'] == $id_rubrique) {
48
+                $t = trim(typo(supprimer_numero($row['titre'])));
49
+                if ($row['langue_choisie'] != 'oui') {
50
+                    $t .= ' <small title="'
51
+                        . traduire_nom_langue($row['lang'])
52
+                        . '">[' . $row['lang'] . ']</small>';
53
+                }
54
+                $ordre[$row['id_rubrique']] = $t;
55
+            }
56
+        }
57
+    }
58
+    $next = $list[$col] ?? 0;
59
+    if ($ordre) {
60
+        $rec = generer_url_ecrire('plonger', "rac=$idom&exclus=$exclu&do=$do&col=" . ($col + 1));
61
+        $info = generer_url_ecrire('informer', "type=rubrique&rac=$idom&do=$do&id=");
62
+        $args = "'$idom',this,$col,'" . $GLOBALS['spip_lang_left'] . "','$info',event";
63 63
 
64
-		foreach ($ordre as $id => $titrebrut) {
65
-			$titre = supprimer_numero($titrebrut);
64
+        foreach ($ordre as $id => $titrebrut) {
65
+            $titre = supprimer_numero($titrebrut);
66 66
 
67
-			$classe1 = 'petit-item ' . ($id_rubrique ? 'petite-rubrique' : 'petit-secteur');
68
-			if (isset($rub[$id]['enfants'])) {
69
-				$classe2 = " class='rub-ouverte'";
70
-				$url = "\nhref='$rec&amp;id=$id'";
71
-			} else {
72
-				$classe2 = $url = '';
73
-				$url = "\nhref='javascript:void(0)'";
74
-			}
67
+            $classe1 = 'petit-item ' . ($id_rubrique ? 'petite-rubrique' : 'petit-secteur');
68
+            if (isset($rub[$id]['enfants'])) {
69
+                $classe2 = " class='rub-ouverte'";
70
+                $url = "\nhref='$rec&amp;id=$id'";
71
+            } else {
72
+                $classe2 = $url = '';
73
+                $url = "\nhref='javascript:void(0)'";
74
+            }
75 75
 
76
-			$js_func = $do . '_selection_titre';
77
-			$click = "\nonclick=\"changerhighlight(this.parentNode.parentNode.parentNode);\nreturn "
78
-				. (!is_array($list) ? ' false'
79
-					: "aff_selection_provisoire($id,$args)")
76
+            $js_func = $do . '_selection_titre';
77
+            $click = "\nonclick=\"changerhighlight(this.parentNode.parentNode.parentNode);\nreturn "
78
+                . (!is_array($list) ? ' false'
79
+                    : "aff_selection_provisoire($id,$args)")
80 80
 # ce lien provoque la selection (directe) de la rubrique cliquee
81 81
 # et l'affichage de son titre dans le bandeau
82
-				. "\"\nondblclick=\""
83
-				. "$js_func(this."
84
-				. 'firstChild.nodeValue,'
85
-				. $id
86
-				. ",'selection_rubrique','id_parent');"
87
-				. "\nreturn aff_selection_provisoire($id,$args);"
88
-				. '"';
82
+                . "\"\nondblclick=\""
83
+                . "$js_func(this."
84
+                . 'firstChild.nodeValue,'
85
+                . $id
86
+                . ",'selection_rubrique','id_parent');"
87
+                . "\nreturn aff_selection_provisoire($id,$args);"
88
+                . '"';
89 89
 
90
-			$ret .= "<div class='"
91
-				. (($id == $next) ? 'item on' : 'item')
92
-				. "'><div class='"
93
-				. $classe1
94
-				. "'><div$classe2><a"
95
-				. $url
96
-				. $click
97
-				. '>'
98
-				. $titre
99
-				. '</a></div></div></div>';
100
-		}
101
-	}
90
+            $ret .= "<div class='"
91
+                . (($id == $next) ? 'item on' : 'item')
92
+                . "'><div class='"
93
+                . $classe1
94
+                . "'><div$classe2><a"
95
+                . $url
96
+                . $click
97
+                . '>'
98
+                . $titre
99
+                . '</a></div></div></div>';
100
+        }
101
+    }
102 102
 
103
-	$idom2 = $idom . '_col_' . ($col + 1);
104
-	$left = ($col * 250);
103
+    $idom2 = $idom . '_col_' . ($col + 1);
104
+    $left = ($col * 250);
105 105
 
106
-	return http_img_pack(
107
-		'loader.svg',
108
-		'',
109
-		"class='loader' style='visibility: hidden; position: absolute; " . $GLOBALS['spip_lang_left'] . ': '
110
-		. ($left - 30)
111
-		. "px; top: 2px; z-index: 2;' id='img_$idom2'"
112
-	)
113
-	. "<div style='width: 250px; height: 100%; overflow: auto; position: absolute; top: 0px; " . $GLOBALS['spip_lang_left'] . ': '
114
-	. ($left - 250)
115
-	. "px;'>"
116
-	. $ret
117
-	. "\n</div>\n<div id='$idom2'>"
118
-	. ($next
119
-		? inc_plonger_dist($id_rubrique, $idom, $list, $col + 1, $exclu)
120
-		: '')
121
-	. "\n</div>";
106
+    return http_img_pack(
107
+        'loader.svg',
108
+        '',
109
+        "class='loader' style='visibility: hidden; position: absolute; " . $GLOBALS['spip_lang_left'] . ': '
110
+        . ($left - 30)
111
+        . "px; top: 2px; z-index: 2;' id='img_$idom2'"
112
+    )
113
+    . "<div style='width: 250px; height: 100%; overflow: auto; position: absolute; top: 0px; " . $GLOBALS['spip_lang_left'] . ': '
114
+    . ($left - 250)
115
+    . "px;'>"
116
+    . $ret
117
+    . "\n</div>\n<div id='$idom2'>"
118
+    . ($next
119
+        ? inc_plonger_dist($id_rubrique, $idom, $list, $col + 1, $exclu)
120
+        : '')
121
+    . "\n</div>";
122 122
 }
Please login to merge, or discard this patch.