Completed
Push — master ( 44fd31...388bf1 )
by cam
01:38
created
ecrire/exec/selectionner.php 1 patch
Indentation   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -16,7 +16,7 @@  discard block
 block discarded – undo
16 16
  * @package SPIP\Core\Rubriques
17 17
  **/
18 18
 if (!defined('_ECRIRE_INC_VERSION')) {
19
-	return;
19
+    return;
20 20
 }
21 21
 
22 22
 include_spip('inc/actions');
@@ -28,21 +28,21 @@  discard block
 block discarded – undo
28 28
  * @uses ajax_retour()
29 29
  **/
30 30
 function exec_selectionner_dist() {
31
-	$id = intval(_request('id'));
32
-	$exclus = intval(_request('exclus'));
33
-	$type = _request('type');
34
-	$rac = _request('racine');
35
-	$do = _request('do');
36
-	if (preg_match('/^\w*$/', $do)) {
37
-		if (!$do) {
38
-			$do = 'aff';
39
-		}
31
+    $id = intval(_request('id'));
32
+    $exclus = intval(_request('exclus'));
33
+    $type = _request('type');
34
+    $rac = _request('racine');
35
+    $do = _request('do');
36
+    if (preg_match('/^\w*$/', $do)) {
37
+        if (!$do) {
38
+            $do = 'aff';
39
+        }
40 40
 
41
-		$selectionner = charger_fonction('selectionner', 'inc');
41
+        $selectionner = charger_fonction('selectionner', 'inc');
42 42
 
43
-		$r = $selectionner($id, 'choix_parent', $exclus, $rac, $type != 'breve', $do);
44
-	} else {
45
-		$r = '';
46
-	}
47
-	ajax_retour($r);
43
+        $r = $selectionner($id, 'choix_parent', $exclus, $rac, $type != 'breve', $do);
44
+    } else {
45
+        $r = '';
46
+    }
47
+    ajax_retour($r);
48 48
 }
Please login to merge, or discard this patch.
ecrire/exec/base_delete_all.php 2 patches
Indentation   +30 added lines, -30 removed lines patch added patch discarded remove patch
@@ -17,40 +17,40 @@
 block discarded – undo
17 17
  */
18 18
 
19 19
 if (!defined('_ECRIRE_INC_VERSION')) {
20
-	return;
20
+    return;
21 21
 }
22 22
 
23 23
 /**
24 24
  * Exec de la page de destruction des tables de SPIP
25 25
  **/
26 26
 function exec_base_delete_all_dist() {
27
-	include_spip('inc/autoriser');
28
-	if (!autoriser('detruire')) {
29
-		include_spip('inc/minipres');
30
-		echo minipres();
31
-	} else {
32
-		include_spip('base/dump');
33
-		$res = base_lister_toutes_tables('', [], [], true);
34
-		if (!$res) {
35
-			include_spip('inc/minipres');
36
-			spip_log('Erreur base de donnees');
37
-			echo minipres(
38
-				_T('info_travaux_titre'),
39
-				_T('titre_probleme_technique') . '<p><tt>' . sql_errno() . ' ' . sql_error() . '</tt></p>'
40
-			);
41
-		} else {
42
-			$res = base_saisie_tables('delete', $res);
43
-			include_spip('inc/headers');
44
-			$res = "\n<ol style='text-align:left'><li>\n" .
45
-				join("</li>\n<li>", $res) .
46
-				'</li></ol>';
47
-			$admin = charger_fonction('admin', 'inc');
48
-			$res = $admin('delete_all', _T('titre_page_delete_all'), $res);
49
-			if (!$res) {
50
-				redirige_url_ecrire('install', '');
51
-			} else {
52
-				echo $res;
53
-			}
54
-		}
55
-	}
27
+    include_spip('inc/autoriser');
28
+    if (!autoriser('detruire')) {
29
+        include_spip('inc/minipres');
30
+        echo minipres();
31
+    } else {
32
+        include_spip('base/dump');
33
+        $res = base_lister_toutes_tables('', [], [], true);
34
+        if (!$res) {
35
+            include_spip('inc/minipres');
36
+            spip_log('Erreur base de donnees');
37
+            echo minipres(
38
+                _T('info_travaux_titre'),
39
+                _T('titre_probleme_technique') . '<p><tt>' . sql_errno() . ' ' . sql_error() . '</tt></p>'
40
+            );
41
+        } else {
42
+            $res = base_saisie_tables('delete', $res);
43
+            include_spip('inc/headers');
44
+            $res = "\n<ol style='text-align:left'><li>\n" .
45
+                join("</li>\n<li>", $res) .
46
+                '</li></ol>';
47
+            $admin = charger_fonction('admin', 'inc');
48
+            $res = $admin('delete_all', _T('titre_page_delete_all'), $res);
49
+            if (!$res) {
50
+                redirige_url_ecrire('install', '');
51
+            } else {
52
+                echo $res;
53
+            }
54
+        }
55
+    }
56 56
 }
Please login to merge, or discard this patch.
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -36,13 +36,13 @@
 block discarded – undo
36 36
 			spip_log('Erreur base de donnees');
37 37
 			echo minipres(
38 38
 				_T('info_travaux_titre'),
39
-				_T('titre_probleme_technique') . '<p><tt>' . sql_errno() . ' ' . sql_error() . '</tt></p>'
39
+				_T('titre_probleme_technique').'<p><tt>'.sql_errno().' '.sql_error().'</tt></p>'
40 40
 			);
41 41
 		} else {
42 42
 			$res = base_saisie_tables('delete', $res);
43 43
 			include_spip('inc/headers');
44
-			$res = "\n<ol style='text-align:left'><li>\n" .
45
-				join("</li>\n<li>", $res) .
44
+			$res = "\n<ol style='text-align:left'><li>\n".
45
+				join("</li>\n<li>", $res).
46 46
 				'</li></ol>';
47 47
 			$admin = charger_fonction('admin', 'inc');
48 48
 			$res = $admin('delete_all', _T('titre_page_delete_all'), $res);
Please login to merge, or discard this patch.
ecrire/exec/fond.php 2 patches
Indentation   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -21,7 +21,7 @@  discard block
 block discarded – undo
21 21
  */
22 22
 
23 23
 if (!defined('_ECRIRE_INC_VERSION')) {
24
-	return;
24
+    return;
25 25
 }
26 26
 
27 27
 
@@ -29,16 +29,16 @@  discard block
 block discarded – undo
29 29
 $GLOBALS['delais'] = 0;// pas de cache !
30 30
 // Securite
31 31
 if (strstr($fond, '/')) {
32
-	if (
33
-		!include_spip('inc/autoriser')
34
-		or !autoriser('webmestre')
35
-	) {
36
-		include_spip('inc/minipres');
37
-		echo minipres();
38
-		exit;
39
-	}
32
+    if (
33
+        !include_spip('inc/autoriser')
34
+        or !autoriser('webmestre')
35
+    ) {
36
+        include_spip('inc/minipres');
37
+        echo minipres();
38
+        exit;
39
+    }
40 40
 } else {
41
-	$fond = "prive/squelettes/$fond";
41
+    $fond = "prive/squelettes/$fond";
42 42
 }
43 43
 
44 44
 // quelques inclusions et ini prealables
@@ -50,8 +50,8 @@  discard block
 block discarded – undo
50 50
  * @todo supprimer cette fonction vide ?
51 51
  **/
52 52
 function shutdown_error() {
53
-	// si on arrive ici avec un tampon non ferme : erreur fatale
54
-	/*	if (ob_get_level()){
53
+    // si on arrive ici avec un tampon non ferme : erreur fatale
54
+    /*	if (ob_get_level()){
55 55
 			// envoyer tous les tampons
56 56
 			while (ob_get_level())
57 57
 				ob_end_flush();
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -26,7 +26,7 @@
 block discarded – undo
26 26
 
27 27
 
28 28
 $fond = _request('exec');
29
-$GLOBALS['delais'] = 0;// pas de cache !
29
+$GLOBALS['delais'] = 0; // pas de cache !
30 30
 // Securite
31 31
 if (strstr($fond, '/')) {
32 32
 	if (
Please login to merge, or discard this patch.
ecrire/action/activer_plugins.php 2 patches
Indentation   +46 added lines, -46 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
 /**
@@ -28,49 +28,49 @@  discard block
 block discarded – undo
28 28
  * @return void
29 29
  */
30 30
 function enregistre_modif_plugin() {
31
-	include_spip('inc/plugin');
32
-	// recuperer les plugins dans l'ordre des $_POST
33
-	$test = [];
34
-	foreach (liste_plugin_files() as $file) {
35
-		$test['s' . substr(md5(_DIR_PLUGINS . $file), 0, 16)] = $file;
36
-	}
37
-	if (defined('_DIR_PLUGINS_SUPPL')) {
38
-		foreach (liste_plugin_files(_DIR_PLUGINS_SUPPL) as $file) {
39
-			$test['s' . substr(md5(_DIR_PLUGINS_SUPPL . $file), 0, 16)] = $file;
40
-		}
41
-	}
31
+    include_spip('inc/plugin');
32
+    // recuperer les plugins dans l'ordre des $_POST
33
+    $test = [];
34
+    foreach (liste_plugin_files() as $file) {
35
+        $test['s' . substr(md5(_DIR_PLUGINS . $file), 0, 16)] = $file;
36
+    }
37
+    if (defined('_DIR_PLUGINS_SUPPL')) {
38
+        foreach (liste_plugin_files(_DIR_PLUGINS_SUPPL) as $file) {
39
+            $test['s' . substr(md5(_DIR_PLUGINS_SUPPL . $file), 0, 16)] = $file;
40
+        }
41
+    }
42 42
 
43
-	$plugin = [];
43
+    $plugin = [];
44 44
 
45
-	foreach ($_POST as $choix => $val) {
46
-		if (isset($test[$choix]) && $val == 'O') {
47
-			$plugin[] = $test[$choix];
48
-		}
49
-	}
45
+    foreach ($_POST as $choix => $val) {
46
+        if (isset($test[$choix]) && $val == 'O') {
47
+            $plugin[] = $test[$choix];
48
+        }
49
+    }
50 50
 
51
-	spip_log("Changement des plugins actifs par l'auteur " . $GLOBALS['visiteur_session']['id_auteur'] . ': ' . join(
52
-		',',
53
-		$plugin
54
-	));
55
-	ecrire_plugin_actifs($plugin);
51
+    spip_log("Changement des plugins actifs par l'auteur " . $GLOBALS['visiteur_session']['id_auteur'] . ': ' . join(
52
+        ',',
53
+        $plugin
54
+    ));
55
+    ecrire_plugin_actifs($plugin);
56 56
 
57
-	// Chaque fois que l'on valide des plugins, on memorise la liste de ces plugins comme etant "interessants", avec un score initial, qui sera decremente a chaque tour : ainsi un plugin active pourra reter visible a l'ecran, jusqu'a ce qu'il tombe dans l'oubli.
58
-	$plugins_interessants = @unserialize($GLOBALS['meta']['plugins_interessants']);
59
-	if (!is_array($plugins_interessants)) {
60
-		$plugins_interessants = [];
61
-	}
57
+    // Chaque fois que l'on valide des plugins, on memorise la liste de ces plugins comme etant "interessants", avec un score initial, qui sera decremente a chaque tour : ainsi un plugin active pourra reter visible a l'ecran, jusqu'a ce qu'il tombe dans l'oubli.
58
+    $plugins_interessants = @unserialize($GLOBALS['meta']['plugins_interessants']);
59
+    if (!is_array($plugins_interessants)) {
60
+        $plugins_interessants = [];
61
+    }
62 62
 
63
-	$plugins_interessants2 = [];
63
+    $plugins_interessants2 = [];
64 64
 
65
-	foreach ($plugins_interessants as $plug => $score) {
66
-		if ($score > 1) {
67
-			$plugins_interessants2[$plug] = $score - 1;
68
-		}
69
-	}
70
-	foreach ($plugin as $plug) {
71
-		$plugins_interessants2[$plug] = 10;
72
-	} // score initial
73
-	ecrire_meta('plugins_interessants', serialize($plugins_interessants2));
65
+    foreach ($plugins_interessants as $plug => $score) {
66
+        if ($score > 1) {
67
+            $plugins_interessants2[$plug] = $score - 1;
68
+        }
69
+    }
70
+    foreach ($plugin as $plug) {
71
+        $plugins_interessants2[$plug] = 10;
72
+    } // score initial
73
+    ecrire_meta('plugins_interessants', serialize($plugins_interessants2));
74 74
 }
75 75
 
76 76
 /**
@@ -82,13 +82,13 @@  discard block
 block discarded – undo
82 82
  */
83 83
 function action_activer_plugins_dist() {
84 84
 
85
-	$securiser_action = charger_fonction('securiser_action', 'inc');
86
-	$securiser_action();
85
+    $securiser_action = charger_fonction('securiser_action', 'inc');
86
+    $securiser_action();
87 87
 
88
-	if (!autoriser('configurer', '_plugins')) {
89
-		die('erreur');
90
-	}
91
-	// forcer la maj des meta pour les cas de modif de numero de version base via phpmyadmin
92
-	lire_metas();
93
-	enregistre_modif_plugin();
88
+    if (!autoriser('configurer', '_plugins')) {
89
+        die('erreur');
90
+    }
91
+    // forcer la maj des meta pour les cas de modif de numero de version base via phpmyadmin
92
+    lire_metas();
93
+    enregistre_modif_plugin();
94 94
 }
Please login to merge, or discard this patch.
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -32,11 +32,11 @@  discard block
 block discarded – undo
32 32
 	// recuperer les plugins dans l'ordre des $_POST
33 33
 	$test = [];
34 34
 	foreach (liste_plugin_files() as $file) {
35
-		$test['s' . substr(md5(_DIR_PLUGINS . $file), 0, 16)] = $file;
35
+		$test['s'.substr(md5(_DIR_PLUGINS.$file), 0, 16)] = $file;
36 36
 	}
37 37
 	if (defined('_DIR_PLUGINS_SUPPL')) {
38 38
 		foreach (liste_plugin_files(_DIR_PLUGINS_SUPPL) as $file) {
39
-			$test['s' . substr(md5(_DIR_PLUGINS_SUPPL . $file), 0, 16)] = $file;
39
+			$test['s'.substr(md5(_DIR_PLUGINS_SUPPL.$file), 0, 16)] = $file;
40 40
 		}
41 41
 	}
42 42
 
@@ -48,7 +48,7 @@  discard block
 block discarded – undo
48 48
 		}
49 49
 	}
50 50
 
51
-	spip_log("Changement des plugins actifs par l'auteur " . $GLOBALS['visiteur_session']['id_auteur'] . ': ' . join(
51
+	spip_log("Changement des plugins actifs par l'auteur ".$GLOBALS['visiteur_session']['id_auteur'].': '.join(
52 52
 		',',
53 53
 		$plugin
54 54
 	));
Please login to merge, or discard this patch.
ecrire/action/calculer_taille_cache.php 2 patches
Indentation   +57 added lines, -57 removed lines patch added patch discarded remove patch
@@ -16,7 +16,7 @@  discard block
 block discarded – undo
16 16
  * @package SPIP\Core\Cache
17 17
  **/
18 18
 if (!defined('_ECRIRE_INC_VERSION')) {
19
-	return;
19
+    return;
20 20
 }
21 21
 
22 22
 
@@ -31,41 +31,41 @@  discard block
 block discarded – undo
31 31
  *     de l'action sécurisée.
32 32
  */
33 33
 function action_calculer_taille_cache_dist($arg = null) {
34
-	if (is_null($arg)) {
35
-		$securiser_action = charger_fonction('securiser_action', 'inc');
36
-		$arg = $securiser_action();
37
-	}
38
-	include_spip('inc/filtres');
34
+    if (is_null($arg)) {
35
+        $securiser_action = charger_fonction('securiser_action', 'inc');
36
+        $arg = $securiser_action();
37
+    }
38
+    include_spip('inc/filtres');
39 39
 
40
-	if ($arg == 'images') {
41
-		$taille = calculer_taille_dossier(_DIR_VAR);
42
-		$res = _T(
43
-			'ecrire:taille_cache_image',
44
-			[
45
-				'dir' => joli_repertoire(_DIR_VAR),
46
-				'taille' => '<b>' . (taille_en_octets($taille) > 0 ? taille_en_octets($taille) : '0 octet') . '</b>'
47
-			]
48
-		);
49
-	} else {
50
-		include_spip('inc/invalideur');
51
-		$taille =
52
-			calculer_taille_dossier(_DIR_CACHE_XML)
53
-			+ calculer_taille_dossier(_DIR_CACHE . 'skel/')
54
-			+ calculer_taille_dossier(_DIR_CACHE . 'wheels/')
55
-			+ calculer_taille_dossier(_DIR_CACHE . 'contextes/');
56
-		$taille += intval(taille_du_cache());
57
-		if ($taille <= 150000) {
58
-			$res = _T('taille_cache_vide');
59
-		} elseif ($taille <= 1024 * 1024) {
60
-			$res = _T('taille_cache_moins_de', ['octets' => taille_en_octets(1024 * 1024)]);
61
-		} else {
62
-			$res = _T('taille_cache_octets', ['octets' => taille_en_octets($taille)]);
63
-		}
64
-		$res = "<b>$res</b>";
65
-	}
40
+    if ($arg == 'images') {
41
+        $taille = calculer_taille_dossier(_DIR_VAR);
42
+        $res = _T(
43
+            'ecrire:taille_cache_image',
44
+            [
45
+                'dir' => joli_repertoire(_DIR_VAR),
46
+                'taille' => '<b>' . (taille_en_octets($taille) > 0 ? taille_en_octets($taille) : '0 octet') . '</b>'
47
+            ]
48
+        );
49
+    } else {
50
+        include_spip('inc/invalideur');
51
+        $taille =
52
+            calculer_taille_dossier(_DIR_CACHE_XML)
53
+            + calculer_taille_dossier(_DIR_CACHE . 'skel/')
54
+            + calculer_taille_dossier(_DIR_CACHE . 'wheels/')
55
+            + calculer_taille_dossier(_DIR_CACHE . 'contextes/');
56
+        $taille += intval(taille_du_cache());
57
+        if ($taille <= 150000) {
58
+            $res = _T('taille_cache_vide');
59
+        } elseif ($taille <= 1024 * 1024) {
60
+            $res = _T('taille_cache_moins_de', ['octets' => taille_en_octets(1024 * 1024)]);
61
+        } else {
62
+            $res = _T('taille_cache_octets', ['octets' => taille_en_octets($taille)]);
63
+        }
64
+        $res = "<b>$res</b>";
65
+    }
66 66
 
67
-	$res = "<p>$res</p>";
68
-	ajax_retour($res);
67
+    $res = "<p>$res</p>";
68
+    ajax_retour($res);
69 69
 }
70 70
 
71 71
 
@@ -76,28 +76,28 @@  discard block
 block discarded – undo
76 76
  * @return int Taille en octets
77 77
  */
78 78
 function calculer_taille_dossier($dir) {
79
-	if (!is_dir($dir) or !is_readable($dir)) {
80
-		return 0;
81
-	}
82
-	$handle = opendir($dir);
83
-	if (!$handle) {
84
-		return 0;
85
-	}
86
-	$taille = 0;
87
-	while (($fichier = @readdir($handle)) !== false) {
88
-		// Eviter ".", "..", ".htaccess", etc.
89
-		if ($fichier[0] == '.') {
90
-			continue;
91
-		}
92
-		if (is_file($d = "$dir/$fichier")) {
93
-			$taille += filesize($d);
94
-		} else {
95
-			if (is_dir($d)) {
96
-				$taille += calculer_taille_dossier($d);
97
-			}
98
-		}
99
-	}
100
-	closedir($handle);
79
+    if (!is_dir($dir) or !is_readable($dir)) {
80
+        return 0;
81
+    }
82
+    $handle = opendir($dir);
83
+    if (!$handle) {
84
+        return 0;
85
+    }
86
+    $taille = 0;
87
+    while (($fichier = @readdir($handle)) !== false) {
88
+        // Eviter ".", "..", ".htaccess", etc.
89
+        if ($fichier[0] == '.') {
90
+            continue;
91
+        }
92
+        if (is_file($d = "$dir/$fichier")) {
93
+            $taille += filesize($d);
94
+        } else {
95
+            if (is_dir($d)) {
96
+                $taille += calculer_taille_dossier($d);
97
+            }
98
+        }
99
+    }
100
+    closedir($handle);
101 101
 
102
-	return $taille;
102
+    return $taille;
103 103
 }
Please login to merge, or discard this patch.
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -43,16 +43,16 @@
 block discarded – undo
43 43
 			'ecrire:taille_cache_image',
44 44
 			[
45 45
 				'dir' => joli_repertoire(_DIR_VAR),
46
-				'taille' => '<b>' . (taille_en_octets($taille) > 0 ? taille_en_octets($taille) : '0 octet') . '</b>'
46
+				'taille' => '<b>'.(taille_en_octets($taille) > 0 ? taille_en_octets($taille) : '0 octet').'</b>'
47 47
 			]
48 48
 		);
49 49
 	} else {
50 50
 		include_spip('inc/invalideur');
51 51
 		$taille =
52 52
 			calculer_taille_dossier(_DIR_CACHE_XML)
53
-			+ calculer_taille_dossier(_DIR_CACHE . 'skel/')
54
-			+ calculer_taille_dossier(_DIR_CACHE . 'wheels/')
55
-			+ calculer_taille_dossier(_DIR_CACHE . 'contextes/');
53
+			+ calculer_taille_dossier(_DIR_CACHE.'skel/')
54
+			+ calculer_taille_dossier(_DIR_CACHE.'wheels/')
55
+			+ calculer_taille_dossier(_DIR_CACHE.'contextes/');
56 56
 		$taille += intval(taille_du_cache());
57 57
 		if ($taille <= 150000) {
58 58
 			$res = _T('taille_cache_vide');
Please login to merge, or discard this patch.
ecrire/action/converser.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -60,7 +60,7 @@
 block discarded – undo
60 60
 		action_converser_post($lang);
61 61
 	} elseif ($lang = _request('var_lang_ecrire')) {
62 62
 		if ($update_session) {
63
-			sql_updateq('spip_auteurs', ['lang' => $lang], 'id_auteur = ' . $GLOBALS['visiteur_session']['id_auteur']);
63
+			sql_updateq('spip_auteurs', ['lang' => $lang], 'id_auteur = '.$GLOBALS['visiteur_session']['id_auteur']);
64 64
 			$GLOBALS['visiteur_session']['lang'] = $lang;
65 65
 			$session = charger_fonction('session', 'inc');
66 66
 			if ($spip_session = $session($GLOBALS['visiteur_session'])) {
Please login to merge, or discard this patch.
Indentation   +43 added lines, -43 removed lines patch added patch discarded remove patch
@@ -16,7 +16,7 @@  discard block
 block discarded – undo
16 16
  * @package SPIP\Core\Langue
17 17
  **/
18 18
 if (!defined('_ECRIRE_INC_VERSION')) {
19
-	return;
19
+    return;
20 20
 }
21 21
 
22 22
 include_spip('inc/cookie');
@@ -30,21 +30,21 @@  discard block
 block discarded – undo
30 30
  * @return void
31 31
  */
32 32
 function action_converser_dist() {
33
-	$update_session = false;
34
-	if (_request('arg') and spip_connect()) {
35
-		$securiser_action = charger_fonction('securiser_action', 'inc');
36
-		$securiser_action();
37
-		$update_session = true;
38
-	}
33
+    $update_session = false;
34
+    if (_request('arg') and spip_connect()) {
35
+        $securiser_action = charger_fonction('securiser_action', 'inc');
36
+        $securiser_action();
37
+        $update_session = true;
38
+    }
39 39
 
40
-	$lang = action_converser_changer_langue($update_session);
41
-	$redirect = rawurldecode(_request('redirect'));
40
+    $lang = action_converser_changer_langue($update_session);
41
+    $redirect = rawurldecode(_request('redirect'));
42 42
 
43
-	if (!$redirect) {
44
-		$redirect = _DIR_RESTREINT_ABS;
45
-	}
46
-	$redirect = parametre_url($redirect, 'lang', $lang, '&');
47
-	redirige_par_entete($redirect, true);
43
+    if (!$redirect) {
44
+        $redirect = _DIR_RESTREINT_ABS;
45
+    }
46
+    $redirect = parametre_url($redirect, 'lang', $lang, '&');
47
+    redirige_par_entete($redirect, true);
48 48
 }
49 49
 
50 50
 /**
@@ -56,23 +56,23 @@  discard block
 block discarded – undo
56 56
  * @return string
57 57
  */
58 58
 function action_converser_changer_langue($update_session) {
59
-	if ($lang = _request('var_lang')) {
60
-		action_converser_post($lang);
61
-	} elseif ($lang = _request('var_lang_ecrire')) {
62
-		if ($update_session) {
63
-			sql_updateq('spip_auteurs', ['lang' => $lang], 'id_auteur = ' . $GLOBALS['visiteur_session']['id_auteur']);
64
-			$GLOBALS['visiteur_session']['lang'] = $lang;
65
-			$session = charger_fonction('session', 'inc');
66
-			if ($spip_session = $session($GLOBALS['visiteur_session'])) {
67
-				spip_setcookie('spip_session', $spip_session, [
68
-					'expires' => time() + 3600 * 24 * 14
69
-				]);
70
-			}
71
-		}
72
-		action_converser_post($lang, true);
73
-	}
59
+    if ($lang = _request('var_lang')) {
60
+        action_converser_post($lang);
61
+    } elseif ($lang = _request('var_lang_ecrire')) {
62
+        if ($update_session) {
63
+            sql_updateq('spip_auteurs', ['lang' => $lang], 'id_auteur = ' . $GLOBALS['visiteur_session']['id_auteur']);
64
+            $GLOBALS['visiteur_session']['lang'] = $lang;
65
+            $session = charger_fonction('session', 'inc');
66
+            if ($spip_session = $session($GLOBALS['visiteur_session'])) {
67
+                spip_setcookie('spip_session', $spip_session, [
68
+                    'expires' => time() + 3600 * 24 * 14
69
+                ]);
70
+            }
71
+        }
72
+        action_converser_post($lang, true);
73
+    }
74 74
 
75
-	return $lang;
75
+    return $lang;
76 76
 }
77 77
 
78 78
 /**
@@ -83,17 +83,17 @@  discard block
 block discarded – undo
83 83
  * @return void
84 84
  */
85 85
 function action_converser_post($lang, $ecrire = false) {
86
-	if ($lang) {
87
-		include_spip('inc/lang');
88
-		if (changer_langue($lang)) {
89
-			spip_setcookie('spip_lang', $_COOKIE['spip_lang'] = $lang, [
90
-				'expires' => time() + 365 * 24 * 3600
91
-			]);
92
-			if ($ecrire) {
93
-				spip_setcookie('spip_lang_ecrire', $_COOKIE['spip_lang_ecrire'] = $lang, [
94
-					'expires' => time() + 365 * 24 * 3600
95
-				]);
96
-			}
97
-		}
98
-	}
86
+    if ($lang) {
87
+        include_spip('inc/lang');
88
+        if (changer_langue($lang)) {
89
+            spip_setcookie('spip_lang', $_COOKIE['spip_lang'] = $lang, [
90
+                'expires' => time() + 365 * 24 * 3600
91
+            ]);
92
+            if ($ecrire) {
93
+                spip_setcookie('spip_lang_ecrire', $_COOKIE['spip_lang_ecrire'] = $lang, [
94
+                    'expires' => time() + 365 * 24 * 3600
95
+                ]);
96
+            }
97
+        }
98
+    }
99 99
 }
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
@@ -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
 /**
@@ -26,13 +26,13 @@  discard block
 block discarded – undo
26 26
  * @return void
27 27
  */
28 28
 function action_annuler_job_dist() {
29
-	$securiser_action = charger_fonction('securiser_action', 'inc');
30
-	$id_job = $securiser_action();
29
+    $securiser_action = charger_fonction('securiser_action', 'inc');
30
+    $id_job = $securiser_action();
31 31
 
32
-	if (
33
-		$id_job = intval($id_job)
34
-		and autoriser('annuler', 'job', $id_job)
35
-	) {
36
-		job_queue_remove($id_job);
37
-	}
32
+    if (
33
+        $id_job = intval($id_job)
34
+        and autoriser('annuler', 'job', $id_job)
35
+    ) {
36
+        job_queue_remove($id_job);
37
+    }
38 38
 }
Please login to merge, or discard this patch.
ecrire/action/tester.php 2 patches
Spacing   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -43,7 +43,7 @@  discard block
 block discarded – undo
43 43
 			} else {
44 44
 				# Attention GD sait lire le gif mais pas forcement l'ecrire
45 45
 				if (function_exists('ImageCreateFromGIF')) {
46
-					$srcImage = @ImageCreateFromGIF(_ROOT_IMG_PACK . 'test.gif');
46
+					$srcImage = @ImageCreateFromGIF(_ROOT_IMG_PACK.'test.gif');
47 47
 					if ($srcImage) {
48 48
 						$gd_formats_read_gif = ',gif';
49 49
 						ImageDestroy($srcImage);
@@ -67,28 +67,28 @@  discard block
 block discarded – undo
67 67
 			# les formats disponibles en ecriture... (cf. inc_logos)
68 68
 
69 69
 			if (function_exists('ImageCreateFromJPEG')) {
70
-				$srcImage = @ImageCreateFromJPEG(_ROOT_IMG_PACK . 'test.jpg');
70
+				$srcImage = @ImageCreateFromJPEG(_ROOT_IMG_PACK.'test.jpg');
71 71
 				if ($srcImage) {
72 72
 					$gd_formats[] = 'jpg';
73 73
 					ImageDestroy($srcImage);
74 74
 				}
75 75
 			}
76 76
 			if (function_exists('ImageCreateFromGIF')) {
77
-				$srcImage = @ImageCreateFromGIF(_ROOT_IMG_PACK . 'test.gif');
77
+				$srcImage = @ImageCreateFromGIF(_ROOT_IMG_PACK.'test.gif');
78 78
 				if ($srcImage) {
79 79
 					$gd_formats[] = 'gif';
80 80
 					ImageDestroy($srcImage);
81 81
 				}
82 82
 			}
83 83
 			if (function_exists('ImageCreateFromPNG')) {
84
-				$srcImage = @ImageCreateFromPNG(_ROOT_IMG_PACK . 'test.png');
84
+				$srcImage = @ImageCreateFromPNG(_ROOT_IMG_PACK.'test.png');
85 85
 				if ($srcImage) {
86 86
 					$gd_formats[] = 'png';
87 87
 					ImageDestroy($srcImage);
88 88
 				}
89 89
 			}
90 90
 			if (function_exists('ImageCreateFromWEBP')) {
91
-				$srcImage = @ImageCreateFromWEBP(_ROOT_IMG_PACK . 'test.webp');
91
+				$srcImage = @ImageCreateFromWEBP(_ROOT_IMG_PACK.'test.webp');
92 92
 				if ($srcImage) {
93 93
 					$gd_formats[] = 'webp';
94 94
 					ImageDestroy($srcImage);
@@ -96,10 +96,10 @@  discard block
 block discarded – undo
96 96
 			}
97 97
 		}
98 98
 
99
-		if (! empty($gd_formats)) {
99
+		if (!empty($gd_formats)) {
100 100
 			$gd_formats = join(',', $gd_formats);
101 101
 		}
102
-		ecrire_meta('gd_formats_read', $gd_formats . $gd_formats_read_gif);
102
+		ecrire_meta('gd_formats_read', $gd_formats.$gd_formats_read_gif);
103 103
 		ecrire_meta('gd_formats', $gd_formats);
104 104
 	} // verifier les formats netpbm
105 105
 	else {
@@ -123,9 +123,9 @@  discard block
 block discarded – undo
123 123
 				_PNMSCALE_COMMAND
124 124
 			);
125 125
 
126
-			$vignette = _ROOT_IMG_PACK . 'test.jpg';
127
-			$dest = _DIR_VAR . 'test-jpg.jpg';
128
-			$commande = "$jpegtopnm_command $vignette | " . _PNMSCALE_COMMAND . " -width 10 | $pnmtojpeg_command > $dest";
126
+			$vignette = _ROOT_IMG_PACK.'test.jpg';
127
+			$dest = _DIR_VAR.'test-jpg.jpg';
128
+			$commande = "$jpegtopnm_command $vignette | "._PNMSCALE_COMMAND." -width 10 | $pnmtojpeg_command > $dest";
129 129
 			spip_log($commande);
130 130
 			exec($commande);
131 131
 			if ($taille = @getimagesize($dest)) {
@@ -135,9 +135,9 @@  discard block
 block discarded – undo
135 135
 			}
136 136
 			$giftopnm_command = str_replace('pnmscale', 'giftopnm', _PNMSCALE_COMMAND);
137 137
 			$pnmtojpeg_command = str_replace('pnmscale', 'pnmtojpeg', _PNMSCALE_COMMAND);
138
-			$vignette = _ROOT_IMG_PACK . 'test.gif';
139
-			$dest = _DIR_VAR . 'test-gif.jpg';
140
-			$commande = "$giftopnm_command $vignette | " . _PNMSCALE_COMMAND . " -width 10 | $pnmtojpeg_command > $dest";
138
+			$vignette = _ROOT_IMG_PACK.'test.gif';
139
+			$dest = _DIR_VAR.'test-gif.jpg';
140
+			$commande = "$giftopnm_command $vignette | "._PNMSCALE_COMMAND." -width 10 | $pnmtojpeg_command > $dest";
141 141
 			spip_log($commande);
142 142
 			exec($commande);
143 143
 			if ($taille = @getimagesize($dest)) {
@@ -147,9 +147,9 @@  discard block
 block discarded – undo
147 147
 			}
148 148
 
149 149
 			$pngtopnm_command = str_replace('pnmscale', 'pngtopnm', _PNMSCALE_COMMAND);
150
-			$vignette = _ROOT_IMG_PACK . 'test.png';
151
-			$dest = _DIR_VAR . 'test-gif.jpg';
152
-			$commande = "$pngtopnm_command $vignette | " . _PNMSCALE_COMMAND . " -width 10 | $pnmtojpeg_command > $dest";
150
+			$vignette = _ROOT_IMG_PACK.'test.png';
151
+			$dest = _DIR_VAR.'test-gif.jpg';
152
+			$commande = "$pngtopnm_command $vignette | "._PNMSCALE_COMMAND." -width 10 | $pnmtojpeg_command > $dest";
153 153
 			spip_log($commande);
154 154
 			exec($commande);
155 155
 			if ($taille = @getimagesize($dest)) {
@@ -173,9 +173,9 @@  discard block
 block discarded – undo
173 173
 		include_spip('inc/filtres');
174 174
 		include_spip('inc/filtres_images_mini');
175 175
 		$taille_preview = 150;
176
-		$image = _image_valeurs_trans(_DIR_IMG_PACK . 'test_image.jpg', "reduire-$taille_preview-$taille_preview", 'jpg');
176
+		$image = _image_valeurs_trans(_DIR_IMG_PACK.'test_image.jpg', "reduire-$taille_preview-$taille_preview", 'jpg');
177 177
 
178
-		$image['fichier_dest'] = _DIR_VAR . "test_$arg";
178
+		$image['fichier_dest'] = _DIR_VAR."test_$arg";
179 179
 
180 180
 		if (
181 181
 			$preview = _image_creer_vignette($image, $taille_preview, $taille_preview, $arg, true)
Please login to merge, or discard this patch.
Indentation   +152 added lines, -152 removed lines patch added patch discarded remove patch
@@ -17,7 +17,7 @@  discard block
 block discarded – undo
17 17
  */
18 18
 
19 19
 if (!defined('_ECRIRE_INC_VERSION')) {
20
-	return;
20
+    return;
21 21
 }
22 22
 
23 23
 /**
@@ -30,155 +30,155 @@  discard block
 block discarded – undo
30 30
  * redirige sur l'image ainsi créée (sinon sur une image d'echec).
31 31
  **/
32 32
 function action_tester_dist() {
33
-	$arg = _request('arg');
34
-
35
-	$gd_formats = [];
36
-	$gd_formats_read_gif = '';
37
-	// verifier les formats acceptes par GD
38
-	if ($arg == 'gd1') {
39
-		// Si GD est installe et php >= 4.0.2
40
-		if (function_exists('imagetypes')) {
41
-			if (imagetypes() & IMG_GIF) {
42
-				$gd_formats[] = 'gif';
43
-			} else {
44
-				# Attention GD sait lire le gif mais pas forcement l'ecrire
45
-				if (function_exists('ImageCreateFromGIF')) {
46
-					$srcImage = @ImageCreateFromGIF(_ROOT_IMG_PACK . 'test.gif');
47
-					if ($srcImage) {
48
-						$gd_formats_read_gif = ',gif';
49
-						ImageDestroy($srcImage);
50
-					}
51
-				}
52
-			}
53
-
54
-			if (imagetypes() & IMG_JPG) {
55
-				$gd_formats[] = 'jpg';
56
-			}
57
-			if (imagetypes() & IMG_PNG) {
58
-				$gd_formats[] = 'png';
59
-			}
60
-			if (imagetypes() & IMG_WEBP) {
61
-				$gd_formats[] = 'webp';
62
-			}
63
-		} else {
64
-			# ancienne methode de detection des formats, qui en plus
65
-			# est bugguee car elle teste les formats en lecture
66
-			# alors que la valeur deduite sert a identifier
67
-			# les formats disponibles en ecriture... (cf. inc_logos)
68
-
69
-			if (function_exists('ImageCreateFromJPEG')) {
70
-				$srcImage = @ImageCreateFromJPEG(_ROOT_IMG_PACK . 'test.jpg');
71
-				if ($srcImage) {
72
-					$gd_formats[] = 'jpg';
73
-					ImageDestroy($srcImage);
74
-				}
75
-			}
76
-			if (function_exists('ImageCreateFromGIF')) {
77
-				$srcImage = @ImageCreateFromGIF(_ROOT_IMG_PACK . 'test.gif');
78
-				if ($srcImage) {
79
-					$gd_formats[] = 'gif';
80
-					ImageDestroy($srcImage);
81
-				}
82
-			}
83
-			if (function_exists('ImageCreateFromPNG')) {
84
-				$srcImage = @ImageCreateFromPNG(_ROOT_IMG_PACK . 'test.png');
85
-				if ($srcImage) {
86
-					$gd_formats[] = 'png';
87
-					ImageDestroy($srcImage);
88
-				}
89
-			}
90
-			if (function_exists('ImageCreateFromWEBP')) {
91
-				$srcImage = @ImageCreateFromWEBP(_ROOT_IMG_PACK . 'test.webp');
92
-				if ($srcImage) {
93
-					$gd_formats[] = 'webp';
94
-					ImageDestroy($srcImage);
95
-				}
96
-			}
97
-		}
98
-
99
-		if (! empty($gd_formats)) {
100
-			$gd_formats = join(',', $gd_formats);
101
-		}
102
-		ecrire_meta('gd_formats_read', $gd_formats . $gd_formats_read_gif);
103
-		ecrire_meta('gd_formats', $gd_formats);
104
-	} // verifier les formats netpbm
105
-	else {
106
-		if ($arg == 'netpbm') {
107
-			if (!defined('_PNMSCALE_COMMAND')) {
108
-				define('_PNMSCALE_COMMAND', 'pnmscale');
109
-			} // Securite : mes_options.php peut preciser le chemin absolu
110
-			if (_PNMSCALE_COMMAND == '') {
111
-				return;
112
-			}
113
-			$netpbm_formats = [];
114
-
115
-			$jpegtopnm_command = str_replace(
116
-				'pnmscale',
117
-				'jpegtopnm',
118
-				_PNMSCALE_COMMAND
119
-			);
120
-			$pnmtojpeg_command = str_replace(
121
-				'pnmscale',
122
-				'pnmtojpeg',
123
-				_PNMSCALE_COMMAND
124
-			);
125
-
126
-			$vignette = _ROOT_IMG_PACK . 'test.jpg';
127
-			$dest = _DIR_VAR . 'test-jpg.jpg';
128
-			$commande = "$jpegtopnm_command $vignette | " . _PNMSCALE_COMMAND . " -width 10 | $pnmtojpeg_command > $dest";
129
-			spip_log($commande);
130
-			exec($commande);
131
-			if ($taille = @getimagesize($dest)) {
132
-				if ($taille[1] == 10) {
133
-					$netpbm_formats[] = 'jpg';
134
-				}
135
-			}
136
-			$giftopnm_command = str_replace('pnmscale', 'giftopnm', _PNMSCALE_COMMAND);
137
-			$pnmtojpeg_command = str_replace('pnmscale', 'pnmtojpeg', _PNMSCALE_COMMAND);
138
-			$vignette = _ROOT_IMG_PACK . 'test.gif';
139
-			$dest = _DIR_VAR . 'test-gif.jpg';
140
-			$commande = "$giftopnm_command $vignette | " . _PNMSCALE_COMMAND . " -width 10 | $pnmtojpeg_command > $dest";
141
-			spip_log($commande);
142
-			exec($commande);
143
-			if ($taille = @getimagesize($dest)) {
144
-				if ($taille[1] == 10) {
145
-					$netpbm_formats[] = 'gif';
146
-				}
147
-			}
148
-
149
-			$pngtopnm_command = str_replace('pnmscale', 'pngtopnm', _PNMSCALE_COMMAND);
150
-			$vignette = _ROOT_IMG_PACK . 'test.png';
151
-			$dest = _DIR_VAR . 'test-gif.jpg';
152
-			$commande = "$pngtopnm_command $vignette | " . _PNMSCALE_COMMAND . " -width 10 | $pnmtojpeg_command > $dest";
153
-			spip_log($commande);
154
-			exec($commande);
155
-			if ($taille = @getimagesize($dest)) {
156
-				if ($taille[1] == 10) {
157
-					$netpbm_formats[] = 'png';
158
-				}
159
-			}
160
-
161
-			ecrire_meta('netpbm_formats', join(',', $netpbm_formats ?: []));
162
-		}
163
-	}
164
-
165
-	// et maintenant envoyer la vignette de tests
166
-	if (in_array($arg, ['gd1', 'gd2', 'imagick', 'convert', 'netpbm'])) {
167
-		include_spip('inc/filtres');
168
-		include_spip('inc/filtres_images_mini');
169
-		$taille_preview = 150;
170
-		$image = _image_valeurs_trans(_DIR_IMG_PACK . 'test_image.jpg', "reduire-$taille_preview-$taille_preview", 'jpg');
171
-
172
-		$image['fichier_dest'] = _DIR_VAR . "test_$arg";
173
-
174
-		if (
175
-			$preview = _image_creer_vignette($image, $taille_preview, $taille_preview, $arg, true)
176
-			and ($preview['width'] * $preview['height'] > 0)
177
-		) {
178
-			redirige_par_entete($preview['fichier']);
179
-		}
180
-	}
181
-
182
-	# image echec
183
-	redirige_par_entete(chemin_image('echec-reducteur-xx.svg'));
33
+    $arg = _request('arg');
34
+
35
+    $gd_formats = [];
36
+    $gd_formats_read_gif = '';
37
+    // verifier les formats acceptes par GD
38
+    if ($arg == 'gd1') {
39
+        // Si GD est installe et php >= 4.0.2
40
+        if (function_exists('imagetypes')) {
41
+            if (imagetypes() & IMG_GIF) {
42
+                $gd_formats[] = 'gif';
43
+            } else {
44
+                # Attention GD sait lire le gif mais pas forcement l'ecrire
45
+                if (function_exists('ImageCreateFromGIF')) {
46
+                    $srcImage = @ImageCreateFromGIF(_ROOT_IMG_PACK . 'test.gif');
47
+                    if ($srcImage) {
48
+                        $gd_formats_read_gif = ',gif';
49
+                        ImageDestroy($srcImage);
50
+                    }
51
+                }
52
+            }
53
+
54
+            if (imagetypes() & IMG_JPG) {
55
+                $gd_formats[] = 'jpg';
56
+            }
57
+            if (imagetypes() & IMG_PNG) {
58
+                $gd_formats[] = 'png';
59
+            }
60
+            if (imagetypes() & IMG_WEBP) {
61
+                $gd_formats[] = 'webp';
62
+            }
63
+        } else {
64
+            # ancienne methode de detection des formats, qui en plus
65
+            # est bugguee car elle teste les formats en lecture
66
+            # alors que la valeur deduite sert a identifier
67
+            # les formats disponibles en ecriture... (cf. inc_logos)
68
+
69
+            if (function_exists('ImageCreateFromJPEG')) {
70
+                $srcImage = @ImageCreateFromJPEG(_ROOT_IMG_PACK . 'test.jpg');
71
+                if ($srcImage) {
72
+                    $gd_formats[] = 'jpg';
73
+                    ImageDestroy($srcImage);
74
+                }
75
+            }
76
+            if (function_exists('ImageCreateFromGIF')) {
77
+                $srcImage = @ImageCreateFromGIF(_ROOT_IMG_PACK . 'test.gif');
78
+                if ($srcImage) {
79
+                    $gd_formats[] = 'gif';
80
+                    ImageDestroy($srcImage);
81
+                }
82
+            }
83
+            if (function_exists('ImageCreateFromPNG')) {
84
+                $srcImage = @ImageCreateFromPNG(_ROOT_IMG_PACK . 'test.png');
85
+                if ($srcImage) {
86
+                    $gd_formats[] = 'png';
87
+                    ImageDestroy($srcImage);
88
+                }
89
+            }
90
+            if (function_exists('ImageCreateFromWEBP')) {
91
+                $srcImage = @ImageCreateFromWEBP(_ROOT_IMG_PACK . 'test.webp');
92
+                if ($srcImage) {
93
+                    $gd_formats[] = 'webp';
94
+                    ImageDestroy($srcImage);
95
+                }
96
+            }
97
+        }
98
+
99
+        if (! empty($gd_formats)) {
100
+            $gd_formats = join(',', $gd_formats);
101
+        }
102
+        ecrire_meta('gd_formats_read', $gd_formats . $gd_formats_read_gif);
103
+        ecrire_meta('gd_formats', $gd_formats);
104
+    } // verifier les formats netpbm
105
+    else {
106
+        if ($arg == 'netpbm') {
107
+            if (!defined('_PNMSCALE_COMMAND')) {
108
+                define('_PNMSCALE_COMMAND', 'pnmscale');
109
+            } // Securite : mes_options.php peut preciser le chemin absolu
110
+            if (_PNMSCALE_COMMAND == '') {
111
+                return;
112
+            }
113
+            $netpbm_formats = [];
114
+
115
+            $jpegtopnm_command = str_replace(
116
+                'pnmscale',
117
+                'jpegtopnm',
118
+                _PNMSCALE_COMMAND
119
+            );
120
+            $pnmtojpeg_command = str_replace(
121
+                'pnmscale',
122
+                'pnmtojpeg',
123
+                _PNMSCALE_COMMAND
124
+            );
125
+
126
+            $vignette = _ROOT_IMG_PACK . 'test.jpg';
127
+            $dest = _DIR_VAR . 'test-jpg.jpg';
128
+            $commande = "$jpegtopnm_command $vignette | " . _PNMSCALE_COMMAND . " -width 10 | $pnmtojpeg_command > $dest";
129
+            spip_log($commande);
130
+            exec($commande);
131
+            if ($taille = @getimagesize($dest)) {
132
+                if ($taille[1] == 10) {
133
+                    $netpbm_formats[] = 'jpg';
134
+                }
135
+            }
136
+            $giftopnm_command = str_replace('pnmscale', 'giftopnm', _PNMSCALE_COMMAND);
137
+            $pnmtojpeg_command = str_replace('pnmscale', 'pnmtojpeg', _PNMSCALE_COMMAND);
138
+            $vignette = _ROOT_IMG_PACK . 'test.gif';
139
+            $dest = _DIR_VAR . 'test-gif.jpg';
140
+            $commande = "$giftopnm_command $vignette | " . _PNMSCALE_COMMAND . " -width 10 | $pnmtojpeg_command > $dest";
141
+            spip_log($commande);
142
+            exec($commande);
143
+            if ($taille = @getimagesize($dest)) {
144
+                if ($taille[1] == 10) {
145
+                    $netpbm_formats[] = 'gif';
146
+                }
147
+            }
148
+
149
+            $pngtopnm_command = str_replace('pnmscale', 'pngtopnm', _PNMSCALE_COMMAND);
150
+            $vignette = _ROOT_IMG_PACK . 'test.png';
151
+            $dest = _DIR_VAR . 'test-gif.jpg';
152
+            $commande = "$pngtopnm_command $vignette | " . _PNMSCALE_COMMAND . " -width 10 | $pnmtojpeg_command > $dest";
153
+            spip_log($commande);
154
+            exec($commande);
155
+            if ($taille = @getimagesize($dest)) {
156
+                if ($taille[1] == 10) {
157
+                    $netpbm_formats[] = 'png';
158
+                }
159
+            }
160
+
161
+            ecrire_meta('netpbm_formats', join(',', $netpbm_formats ?: []));
162
+        }
163
+    }
164
+
165
+    // et maintenant envoyer la vignette de tests
166
+    if (in_array($arg, ['gd1', 'gd2', 'imagick', 'convert', 'netpbm'])) {
167
+        include_spip('inc/filtres');
168
+        include_spip('inc/filtres_images_mini');
169
+        $taille_preview = 150;
170
+        $image = _image_valeurs_trans(_DIR_IMG_PACK . 'test_image.jpg', "reduire-$taille_preview-$taille_preview", 'jpg');
171
+
172
+        $image['fichier_dest'] = _DIR_VAR . "test_$arg";
173
+
174
+        if (
175
+            $preview = _image_creer_vignette($image, $taille_preview, $taille_preview, $arg, true)
176
+            and ($preview['width'] * $preview['height'] > 0)
177
+        ) {
178
+            redirige_par_entete($preview['fichier']);
179
+        }
180
+    }
181
+
182
+    # image echec
183
+    redirige_par_entete(chemin_image('echec-reducteur-xx.svg'));
184 184
 }
Please login to merge, or discard this patch.
ecrire/action/logout.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -89,7 +89,7 @@
 block discarded – undo
89 89
 				_T('login_deconnexion_ok'),
90 90
 				_T('login_verifiez_navigateur'),
91 91
 				_T('login_retour_public'),
92
-				'redirect=' . _DIR_RESTREINT_ABS,
92
+				'redirect='._DIR_RESTREINT_ABS,
93 93
 				_T('login_test_navigateur'),
94 94
 				true
95 95
 			);
Please login to merge, or discard this patch.
Indentation   +80 added lines, -80 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/cookie');
@@ -34,73 +34,73 @@  discard block
 block discarded – undo
34 34
  *
35 35
  */
36 36
 function action_logout_dist() {
37
-	$logout = _request('logout');
38
-	$url = securiser_redirect_action(_request('url'));
39
-	// cas particulier, logout dans l'espace public
40
-	if ($logout == 'public' and !$url) {
41
-		$url = url_de_base();
42
-	}
37
+    $logout = _request('logout');
38
+    $url = securiser_redirect_action(_request('url'));
39
+    // cas particulier, logout dans l'espace public
40
+    if ($logout == 'public' and !$url) {
41
+        $url = url_de_base();
42
+    }
43 43
 
44
-	// seul le loge peut se deloger (mais id_auteur peut valoir 0 apres une restauration avortee)
45
-	if (
46
-		isset($GLOBALS['visiteur_session']['id_auteur'])
47
-		and is_numeric($GLOBALS['visiteur_session']['id_auteur'])
48
-		// des sessions anonymes avec id_auteur=0 existent, mais elle n'ont pas de statut : double check
49
-		and isset($GLOBALS['visiteur_session']['statut'])
50
-	) {
51
-		// il faut un jeton pour fermer la session (eviter les CSRF)
52
-		if (
53
-			!$jeton = _request('jeton')
54
-			or !verifier_jeton_logout($jeton, $GLOBALS['visiteur_session'])
55
-		) {
56
-			$jeton = generer_jeton_logout($GLOBALS['visiteur_session']);
57
-			$action = generer_url_action('logout', "jeton=$jeton");
58
-			$action = parametre_url($action, 'logout', _request('logout'));
59
-			$action = parametre_url($action, 'url', _request('url'));
60
-			include_spip('inc/minipres');
61
-			include_spip('inc/filtres');
62
-			$texte = bouton_action(_T('spip:icone_deconnecter'), $action);
63
-			$texte = "<div class='boutons'>$texte</div>";
64
-			$texte .= '<script type="text/javascript">document.write("<style>body{visibility:hidden;}</style>");window.document.forms[0].submit();</script>';
65
-			$res = minipres(_T('spip:icone_deconnecter'), $texte, ['all_inline' => true]);
66
-			echo $res;
44
+    // seul le loge peut se deloger (mais id_auteur peut valoir 0 apres une restauration avortee)
45
+    if (
46
+        isset($GLOBALS['visiteur_session']['id_auteur'])
47
+        and is_numeric($GLOBALS['visiteur_session']['id_auteur'])
48
+        // des sessions anonymes avec id_auteur=0 existent, mais elle n'ont pas de statut : double check
49
+        and isset($GLOBALS['visiteur_session']['statut'])
50
+    ) {
51
+        // il faut un jeton pour fermer la session (eviter les CSRF)
52
+        if (
53
+            !$jeton = _request('jeton')
54
+            or !verifier_jeton_logout($jeton, $GLOBALS['visiteur_session'])
55
+        ) {
56
+            $jeton = generer_jeton_logout($GLOBALS['visiteur_session']);
57
+            $action = generer_url_action('logout', "jeton=$jeton");
58
+            $action = parametre_url($action, 'logout', _request('logout'));
59
+            $action = parametre_url($action, 'url', _request('url'));
60
+            include_spip('inc/minipres');
61
+            include_spip('inc/filtres');
62
+            $texte = bouton_action(_T('spip:icone_deconnecter'), $action);
63
+            $texte = "<div class='boutons'>$texte</div>";
64
+            $texte .= '<script type="text/javascript">document.write("<style>body{visibility:hidden;}</style>");window.document.forms[0].submit();</script>';
65
+            $res = minipres(_T('spip:icone_deconnecter'), $texte, ['all_inline' => true]);
66
+            echo $res;
67 67
 
68
-			return;
69
-		}
68
+            return;
69
+        }
70 70
 
71
-		include_spip('inc/auth');
72
-		auth_trace($GLOBALS['visiteur_session'], '0000-00-00 00:00:00');
73
-		// le logout explicite vaut destruction de toutes les sessions
74
-		if (isset($_COOKIE['spip_session'])) {
75
-			$session = charger_fonction('session', 'inc');
76
-			$session($GLOBALS['visiteur_session']['id_auteur']);
77
-			spip_setcookie('spip_session', $_COOKIE['spip_session'], [
78
-				'expires' => time() - 3600
79
-			]);
80
-		}
81
-		// si authentification http, et que la personne est loge,
82
-		// pour se deconnecter, il faut proposer un nouveau formulaire de connexion http
83
-		if (
84
-			isset($_SERVER['PHP_AUTH_USER'])
85
-			and !$GLOBALS['ignore_auth_http']
86
-			and $GLOBALS['auth_can_disconnect']
87
-		) {
88
-			ask_php_auth(
89
-				_T('login_deconnexion_ok'),
90
-				_T('login_verifiez_navigateur'),
91
-				_T('login_retour_public'),
92
-				'redirect=' . _DIR_RESTREINT_ABS,
93
-				_T('login_test_navigateur'),
94
-				true
95
-			);
96
-		}
97
-	}
71
+        include_spip('inc/auth');
72
+        auth_trace($GLOBALS['visiteur_session'], '0000-00-00 00:00:00');
73
+        // le logout explicite vaut destruction de toutes les sessions
74
+        if (isset($_COOKIE['spip_session'])) {
75
+            $session = charger_fonction('session', 'inc');
76
+            $session($GLOBALS['visiteur_session']['id_auteur']);
77
+            spip_setcookie('spip_session', $_COOKIE['spip_session'], [
78
+                'expires' => time() - 3600
79
+            ]);
80
+        }
81
+        // si authentification http, et que la personne est loge,
82
+        // pour se deconnecter, il faut proposer un nouveau formulaire de connexion http
83
+        if (
84
+            isset($_SERVER['PHP_AUTH_USER'])
85
+            and !$GLOBALS['ignore_auth_http']
86
+            and $GLOBALS['auth_can_disconnect']
87
+        ) {
88
+            ask_php_auth(
89
+                _T('login_deconnexion_ok'),
90
+                _T('login_verifiez_navigateur'),
91
+                _T('login_retour_public'),
92
+                'redirect=' . _DIR_RESTREINT_ABS,
93
+                _T('login_test_navigateur'),
94
+                true
95
+            );
96
+        }
97
+    }
98 98
 
99
-	// Rediriger en contrant le cache navigateur (Safari3)
100
-	include_spip('inc/headers');
101
-	redirige_par_entete($url
102
-		? parametre_url($url, 'var_hasard', uniqid(random_int(0, mt_getrandmax())), '&')
103
-		: generer_url_public('login'));
99
+    // Rediriger en contrant le cache navigateur (Safari3)
100
+    include_spip('inc/headers');
101
+    redirige_par_entete($url
102
+        ? parametre_url($url, 'var_hasard', uniqid(random_int(0, mt_getrandmax())), '&')
103
+        : generer_url_public('login'));
104 104
 }
105 105
 
106 106
 /**
@@ -111,17 +111,17 @@  discard block
 block discarded – undo
111 111
  * @return string
112 112
  */
113 113
 function generer_jeton_logout($session, $alea = null) {
114
-	if (is_null($alea)) {
115
-		include_spip('inc/acces');
116
-		$alea = charger_aleas();
117
-	}
114
+    if (is_null($alea)) {
115
+        include_spip('inc/acces');
116
+        $alea = charger_aleas();
117
+    }
118 118
 
119
-	$jeton = md5($session['date_session']
120
-		. $session['id_auteur']
121
-		. $session['statut']
122
-		. $alea);
119
+    $jeton = md5($session['date_session']
120
+        . $session['id_auteur']
121
+        . $session['statut']
122
+        . $alea);
123 123
 
124
-	return $jeton;
124
+    return $jeton;
125 125
 }
126 126
 
127 127
 /**
@@ -135,13 +135,13 @@  discard block
 block discarded – undo
135 135
  * @return bool
136 136
  */
137 137
 function verifier_jeton_logout($jeton, $session) {
138
-	if (generer_jeton_logout($session) === $jeton) {
139
-		return true;
140
-	}
138
+    if (generer_jeton_logout($session) === $jeton) {
139
+        return true;
140
+    }
141 141
 
142
-	if (generer_jeton_logout($session, $GLOBALS['meta']['alea_ephemere_ancien']) === $jeton) {
143
-		return true;
144
-	}
142
+    if (generer_jeton_logout($session, $GLOBALS['meta']['alea_ephemere_ancien']) === $jeton) {
143
+        return true;
144
+    }
145 145
 
146
-	return false;
146
+    return false;
147 147
 }
Please login to merge, or discard this patch.