Completed
Push — master ( 6a6422...ff2ac0 )
by cam
01:15
created
ecrire/iterateur/sql.php 1 patch
Indentation   +189 added lines, -189 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,195 +28,195 @@  discard block
 block discarded – undo
28 28
  */
29 29
 class IterateurSQL implements Iterator {
30 30
 
31
-	/**
32
-	 * ressource sql
33
-	 *
34
-	 * @var resource|bool
35
-	 */
36
-	protected $sqlresult = false;
37
-
38
-	/**
39
-	 * row sql courante
40
-	 *
41
-	 * @var array|null
42
-	 */
43
-	protected $row = null;
44
-
45
-	protected $firstseek = false;
46
-
47
-	/**
48
-	 * Erreur presente ?
49
-	 *
50
-	 * @var bool
51
-	 **/
52
-	public $err = false;
53
-
54
-	/**
55
-	 * Calcul du total des elements
56
-	 *
57
-	 * @var int|null
58
-	 **/
59
-	public $total = null;
60
-
61
-	/**
62
-	 * selectionner les donnees, ie faire la requete SQL
63
-	 *
64
-	 * @return void
65
-	 */
66
-	protected function select() {
67
-		$this->row = null;
68
-		$v = &$this->command;
69
-		$this->sqlresult = calculer_select($v['select'], $v['from'], $v['type'], $v['where'], $v['join'], $v['groupby'],
70
-			$v['orderby'], $v['limit'], $v['having'], $v['table'], $v['id'], $v['connect'], $this->info);
71
-		$this->err = !$this->sqlresult;
72
-		$this->firstseek = false;
73
-		$this->pos = -1;
74
-
75
-		// pas d'init a priori, le calcul ne sera fait qu'en cas de besoin (provoque une double requete souvent inutile en sqlite)
76
-		//$this->total = $this->count();
77
-	}
78
-
79
-	/*
31
+    /**
32
+     * ressource sql
33
+     *
34
+     * @var resource|bool
35
+     */
36
+    protected $sqlresult = false;
37
+
38
+    /**
39
+     * row sql courante
40
+     *
41
+     * @var array|null
42
+     */
43
+    protected $row = null;
44
+
45
+    protected $firstseek = false;
46
+
47
+    /**
48
+     * Erreur presente ?
49
+     *
50
+     * @var bool
51
+     **/
52
+    public $err = false;
53
+
54
+    /**
55
+     * Calcul du total des elements
56
+     *
57
+     * @var int|null
58
+     **/
59
+    public $total = null;
60
+
61
+    /**
62
+     * selectionner les donnees, ie faire la requete SQL
63
+     *
64
+     * @return void
65
+     */
66
+    protected function select() {
67
+        $this->row = null;
68
+        $v = &$this->command;
69
+        $this->sqlresult = calculer_select($v['select'], $v['from'], $v['type'], $v['where'], $v['join'], $v['groupby'],
70
+            $v['orderby'], $v['limit'], $v['having'], $v['table'], $v['id'], $v['connect'], $this->info);
71
+        $this->err = !$this->sqlresult;
72
+        $this->firstseek = false;
73
+        $this->pos = -1;
74
+
75
+        // pas d'init a priori, le calcul ne sera fait qu'en cas de besoin (provoque une double requete souvent inutile en sqlite)
76
+        //$this->total = $this->count();
77
+    }
78
+
79
+    /*
80 80
 	 * array command: les commandes d'initialisation
81 81
 	 * array info: les infos sur le squelette
82 82
 	 */
83
-	public function __construct($command, $info = array()) {
84
-		$this->type = 'SQL';
85
-		$this->command = $command;
86
-		$this->info = $info;
87
-		$this->select();
88
-	}
89
-
90
-	/**
91
-	 * Rembobiner
92
-	 *
93
-	 * @return bool
94
-	 */
95
-	public function rewind() {
96
-		return ($this->pos > 0)
97
-			? $this->seek(0)
98
-			: true;
99
-	}
100
-
101
-	/**
102
-	 * Verifier l'etat de l'iterateur
103
-	 *
104
-	 * @return bool
105
-	 */
106
-	public function valid() {
107
-		if ($this->err) {
108
-			return false;
109
-		}
110
-		if (!$this->firstseek) {
111
-			$this->next();
112
-		}
113
-
114
-		return is_array($this->row);
115
-	}
116
-
117
-	/**
118
-	 * Valeurs sur la position courante
119
-	 *
120
-	 * @return array
121
-	 */
122
-	public function current() {
123
-		return $this->row;
124
-	}
125
-
126
-	public function key() {
127
-		return $this->pos;
128
-	}
129
-
130
-	/**
131
-	 * Sauter a une position absolue
132
-	 *
133
-	 * @param int $n
134
-	 * @param null|string $continue
135
-	 * @return bool
136
-	 */
137
-	public function seek($n = 0, $continue = null) {
138
-		if (!sql_seek($this->sqlresult, $n, $this->command['connect'], $continue)) {
139
-			// SQLite ne sait pas seek(), il faut relancer la query
140
-			// si la position courante est apres la position visee
141
-			// il faut relancer la requete
142
-			if ($this->pos > $n) {
143
-				$this->free();
144
-				$this->select();
145
-				$this->valid();
146
-			}
147
-			// et utiliser la methode par defaut pour se deplacer au bon endroit
148
-			// (sera fait en cas d'echec de cette fonction)
149
-			return false;
150
-		}
151
-		$this->row = sql_fetch($this->sqlresult, $this->command['connect']);
152
-		$this->pos = min($n, $this->count());
153
-
154
-		return true;
155
-	}
156
-
157
-	/**
158
-	 * Avancer d'un cran
159
-	 *
160
-	 * @return void
161
-	 */
162
-	public function next() {
163
-		$this->row = sql_fetch($this->sqlresult, $this->command['connect']);
164
-		$this->pos++;
165
-		$this->firstseek |= true;
166
-	}
167
-
168
-	/**
169
-	 * Avancer et retourner les donnees pour le nouvel element
170
-	 *
171
-	 * @return array|bool|null
172
-	 */
173
-	public function fetch() {
174
-		if ($this->valid()) {
175
-			$r = $this->current();
176
-			$this->next();
177
-		} else {
178
-			$r = false;
179
-		}
180
-
181
-		return $r;
182
-	}
183
-
184
-	/**
185
-	 * liberer les ressources
186
-	 *
187
-	 * @return bool
188
-	 */
189
-	public function free() {
190
-		if (!$this->sqlresult) {
191
-			return true;
192
-		}
193
-		$a = sql_free($this->sqlresult, $this->command['connect']);
194
-		$this->sqlresult = null;
195
-
196
-		return $a;
197
-	}
198
-
199
-	/**
200
-	 * Compter le nombre de resultats
201
-	 *
202
-	 * @return int
203
-	 */
204
-	public function count() {
205
-		if (is_null($this->total)) {
206
-			if (!$this->sqlresult) {
207
-				$this->total = 0;
208
-			} else {
209
-				# cas count(*)
210
-				if (in_array('count(*)', $this->command['select'])) {
211
-					$this->valid();
212
-					$s = $this->current();
213
-					$this->total = $s['count(*)'];
214
-				} else {
215
-					$this->total = sql_count($this->sqlresult, $this->command['connect']);
216
-				}
217
-			}
218
-		}
219
-
220
-		return $this->total;
221
-	}
83
+    public function __construct($command, $info = array()) {
84
+        $this->type = 'SQL';
85
+        $this->command = $command;
86
+        $this->info = $info;
87
+        $this->select();
88
+    }
89
+
90
+    /**
91
+     * Rembobiner
92
+     *
93
+     * @return bool
94
+     */
95
+    public function rewind() {
96
+        return ($this->pos > 0)
97
+            ? $this->seek(0)
98
+            : true;
99
+    }
100
+
101
+    /**
102
+     * Verifier l'etat de l'iterateur
103
+     *
104
+     * @return bool
105
+     */
106
+    public function valid() {
107
+        if ($this->err) {
108
+            return false;
109
+        }
110
+        if (!$this->firstseek) {
111
+            $this->next();
112
+        }
113
+
114
+        return is_array($this->row);
115
+    }
116
+
117
+    /**
118
+     * Valeurs sur la position courante
119
+     *
120
+     * @return array
121
+     */
122
+    public function current() {
123
+        return $this->row;
124
+    }
125
+
126
+    public function key() {
127
+        return $this->pos;
128
+    }
129
+
130
+    /**
131
+     * Sauter a une position absolue
132
+     *
133
+     * @param int $n
134
+     * @param null|string $continue
135
+     * @return bool
136
+     */
137
+    public function seek($n = 0, $continue = null) {
138
+        if (!sql_seek($this->sqlresult, $n, $this->command['connect'], $continue)) {
139
+            // SQLite ne sait pas seek(), il faut relancer la query
140
+            // si la position courante est apres la position visee
141
+            // il faut relancer la requete
142
+            if ($this->pos > $n) {
143
+                $this->free();
144
+                $this->select();
145
+                $this->valid();
146
+            }
147
+            // et utiliser la methode par defaut pour se deplacer au bon endroit
148
+            // (sera fait en cas d'echec de cette fonction)
149
+            return false;
150
+        }
151
+        $this->row = sql_fetch($this->sqlresult, $this->command['connect']);
152
+        $this->pos = min($n, $this->count());
153
+
154
+        return true;
155
+    }
156
+
157
+    /**
158
+     * Avancer d'un cran
159
+     *
160
+     * @return void
161
+     */
162
+    public function next() {
163
+        $this->row = sql_fetch($this->sqlresult, $this->command['connect']);
164
+        $this->pos++;
165
+        $this->firstseek |= true;
166
+    }
167
+
168
+    /**
169
+     * Avancer et retourner les donnees pour le nouvel element
170
+     *
171
+     * @return array|bool|null
172
+     */
173
+    public function fetch() {
174
+        if ($this->valid()) {
175
+            $r = $this->current();
176
+            $this->next();
177
+        } else {
178
+            $r = false;
179
+        }
180
+
181
+        return $r;
182
+    }
183
+
184
+    /**
185
+     * liberer les ressources
186
+     *
187
+     * @return bool
188
+     */
189
+    public function free() {
190
+        if (!$this->sqlresult) {
191
+            return true;
192
+        }
193
+        $a = sql_free($this->sqlresult, $this->command['connect']);
194
+        $this->sqlresult = null;
195
+
196
+        return $a;
197
+    }
198
+
199
+    /**
200
+     * Compter le nombre de resultats
201
+     *
202
+     * @return int
203
+     */
204
+    public function count() {
205
+        if (is_null($this->total)) {
206
+            if (!$this->sqlresult) {
207
+                $this->total = 0;
208
+            } else {
209
+                # cas count(*)
210
+                if (in_array('count(*)', $this->command['select'])) {
211
+                    $this->valid();
212
+                    $s = $this->current();
213
+                    $this->total = $s['count(*)'];
214
+                } else {
215
+                    $this->total = sql_count($this->sqlresult, $this->command['connect']);
216
+                }
217
+            }
218
+        }
219
+
220
+        return $this->total;
221
+    }
222 222
 }
Please login to merge, or discard this patch.
ecrire/action/calculer_taille_cache.php 1 patch
Indentation   +56 added lines, -56 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,40 +31,40 @@  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('ecrire:taille_cache_image',
43
-			array(
44
-				'dir' => joli_repertoire(_DIR_VAR),
45
-				'taille' => "<b>" . (taille_en_octets($taille) > 0 ? taille_en_octets($taille) : "0 octet") . "</b>"
46
-			)
47
-		);
48
-	} else {
49
-		include_spip('inc/invalideur');
50
-		$taille =
51
-			calculer_taille_dossier(_DIR_CACHE_XML)
52
-			+ calculer_taille_dossier(_DIR_CACHE . 'skel/')
53
-			+ calculer_taille_dossier(_DIR_CACHE . 'wheels/')
54
-			+ calculer_taille_dossier(_DIR_CACHE . 'contextes/');
55
-		$taille += intval(taille_du_cache());
56
-		if ($taille <= 150000) {
57
-			$res = _T('taille_cache_vide');
58
-		} elseif ($taille <= 1024 * 1024) {
59
-			$res = _T('taille_cache_moins_de', array('octets' => taille_en_octets(1024 * 1024)));
60
-		} else {
61
-			$res = _T('taille_cache_octets', array('octets' => taille_en_octets($taille)));
62
-		}
63
-		$res = "<b>$res</b>";
64
-	}
40
+    if ($arg == 'images') {
41
+        $taille = calculer_taille_dossier(_DIR_VAR);
42
+        $res = _T('ecrire:taille_cache_image',
43
+            array(
44
+                'dir' => joli_repertoire(_DIR_VAR),
45
+                'taille' => "<b>" . (taille_en_octets($taille) > 0 ? taille_en_octets($taille) : "0 octet") . "</b>"
46
+            )
47
+        );
48
+    } else {
49
+        include_spip('inc/invalideur');
50
+        $taille =
51
+            calculer_taille_dossier(_DIR_CACHE_XML)
52
+            + calculer_taille_dossier(_DIR_CACHE . 'skel/')
53
+            + calculer_taille_dossier(_DIR_CACHE . 'wheels/')
54
+            + calculer_taille_dossier(_DIR_CACHE . 'contextes/');
55
+        $taille += intval(taille_du_cache());
56
+        if ($taille <= 150000) {
57
+            $res = _T('taille_cache_vide');
58
+        } elseif ($taille <= 1024 * 1024) {
59
+            $res = _T('taille_cache_moins_de', array('octets' => taille_en_octets(1024 * 1024)));
60
+        } else {
61
+            $res = _T('taille_cache_octets', array('octets' => taille_en_octets($taille)));
62
+        }
63
+        $res = "<b>$res</b>";
64
+    }
65 65
 
66
-	$res = "<p>$res</p>";
67
-	ajax_retour($res);
66
+    $res = "<p>$res</p>";
67
+    ajax_retour($res);
68 68
 }
69 69
 
70 70
 
@@ -75,28 +75,28 @@  discard block
 block discarded – undo
75 75
  * @return int Taille en octets
76 76
  */
77 77
 function calculer_taille_dossier($dir) {
78
-	if (!is_dir($dir) or !is_readable($dir)) {
79
-		return 0;
80
-	}
81
-	$handle = opendir($dir);
82
-	if (!$handle) {
83
-		return 0;
84
-	}
85
-	$taille = 0;
86
-	while (($fichier = @readdir($handle)) !== false) {
87
-		// Eviter ".", "..", ".htaccess", etc.
88
-		if ($fichier[0] == '.') {
89
-			continue;
90
-		}
91
-		if (is_file($d = "$dir/$fichier")) {
92
-			$taille += filesize($d);
93
-		} else {
94
-			if (is_dir($d)) {
95
-				$taille += calculer_taille_dossier($d);
96
-			}
97
-		}
98
-	}
99
-	closedir($handle);
78
+    if (!is_dir($dir) or !is_readable($dir)) {
79
+        return 0;
80
+    }
81
+    $handle = opendir($dir);
82
+    if (!$handle) {
83
+        return 0;
84
+    }
85
+    $taille = 0;
86
+    while (($fichier = @readdir($handle)) !== false) {
87
+        // Eviter ".", "..", ".htaccess", etc.
88
+        if ($fichier[0] == '.') {
89
+            continue;
90
+        }
91
+        if (is_file($d = "$dir/$fichier")) {
92
+            $taille += filesize($d);
93
+        } else {
94
+            if (is_dir($d)) {
95
+                $taille += calculer_taille_dossier($d);
96
+            }
97
+        }
98
+    }
99
+    closedir($handle);
100 100
 
101
-	return $taille;
101
+    return $taille;
102 102
 }
Please login to merge, or discard this patch.
ecrire/action/tester_taille.php 1 patch
Indentation   +77 added lines, -77 removed lines patch added patch discarded remove patch
@@ -18,7 +18,7 @@  discard block
 block discarded – undo
18 18
  */
19 19
 
20 20
 if (!defined('_ECRIRE_INC_VERSION')) {
21
-	return;
21
+    return;
22 22
 }
23 23
 include_spip('inc/headers');
24 24
 
@@ -35,12 +35,12 @@  discard block
 block discarded – undo
35 35
  *     Sortie du buffer
36 36
  **/
37 37
 function action_tester_taille_error_handler($output) {
38
-	// on est ici, donc echec lors de la creation de l'image
39
-	if (!empty($GLOBALS['redirect'])) {
40
-		return redirige_formulaire($GLOBALS['redirect']);
41
-	}
38
+    // on est ici, donc echec lors de la creation de l'image
39
+    if (!empty($GLOBALS['redirect'])) {
40
+        return redirige_formulaire($GLOBALS['redirect']);
41
+    }
42 42
 
43
-	return $output;
43
+    return $output;
44 44
 }
45 45
 
46 46
 
@@ -58,75 +58,75 @@  discard block
 block discarded – undo
58 58
  **/
59 59
 function action_tester_taille_dist() {
60 60
 
61
-	if (!autoriser('configurer')) {
62
-		return;
63
-	}
64
-
65
-	$taille = _request('arg');
66
-	$taille = explode('-', $taille);
67
-
68
-	$GLOBALS['taille_max'] = end($taille);
69
-	$GLOBALS['taille_min'] = 0;
70
-	if (count($taille) > 1) {
71
-		$GLOBALS['taille_min'] = reset($taille);
72
-	}
73
-
74
-	// si l'intervalle est assez petit, on garde la valeur min
75
-	if ($GLOBALS['taille_max'] * $GLOBALS['taille_max'] - $GLOBALS['taille_min'] * $GLOBALS['taille_min'] < 50000) {
76
-		$t = ($GLOBALS['taille_min'] * $GLOBALS['taille_min']);
77
-		if ($GLOBALS['taille_min'] !== $GLOBALS['taille_max']) {
78
-			$t = $t * 0.9; // marge de securite
79
-			echo round($t / 1000000, 3) . ' Mpx';
80
-		} else {
81
-			// c'est un cas "on a reussi la borne max initiale, donc on a pas de limite connue"
82
-			$t = 0;
83
-			echo "&infin;";
84
-		}
85
-		ecrire_meta('max_taille_vignettes', $t, 'non');
86
-		die();
87
-	}
88
-
89
-	$taille = $GLOBALS['taille_test'] = round(($GLOBALS['taille_max'] + $GLOBALS['taille_min']) / 2);
90
-
91
-	include_spip('inc/filtres');
92
-	// des inclusions representatives d'un hit prive et/ou public pour la conso memoire
93
-	include_spip('public/assembler');
94
-	include_spip('public/balises');
95
-	include_spip('public/boucles');
96
-	include_spip('public/cacher');
97
-	include_spip('public/compiler');
98
-	include_spip('public/composer');
99
-	include_spip('public/criteres');
100
-	include_spip('public/interfaces');
101
-	include_spip('public/parametrer');
102
-	include_spip('public/phraser_html');
103
-	include_spip('public/references');
104
-
105
-	include_spip('inc/presentation');
106
-	include_spip('inc/charsets');
107
-	include_spip('inc/documents');
108
-	include_spip('inc/header');
109
-	propre("<doc1>"); // charger propre avec le trairement d'un modele
110
-
111
-	$i = _request('i') + 1;
112
-	$image_source = chemin_image("test.png");
113
-	$GLOBALS['redirect'] = generer_url_action("tester_taille",
114
-		"i=$i&arg=" . $GLOBALS['taille_min'] . "-" . $GLOBALS['taille_test']);
115
-
116
-	ob_start('action_tester_taille_error_handler');
117
-	filtrer('image_recadre', $image_source, $taille, $taille);
118
-	$GLOBALS['redirect'] = generer_url_action("tester_taille", "i=$i&arg=$taille-" . $GLOBALS['taille_max']);
119
-
120
-	// si la valeur intermediaire a reussi, on teste la valeur maxi qui est peut etre sous estimee
121
-	// si $GLOBALS['taille_min']==0 (car on est au premier coup)
122
-	if ($GLOBALS['taille_min'] == 0) {
123
-		$taille = $GLOBALS['taille_max'];
124
-		filtrer('image_recadre', $image_source, $taille, $taille);
125
-		$GLOBALS['redirect'] = generer_url_action("tester_taille", "i=$i&arg=$taille-" . $GLOBALS['taille_max']);
126
-	}
127
-	ob_end_clean();
128
-
129
-
130
-	// on est ici, donc pas de plantage
131
-	echo redirige_formulaire($GLOBALS['redirect']);
61
+    if (!autoriser('configurer')) {
62
+        return;
63
+    }
64
+
65
+    $taille = _request('arg');
66
+    $taille = explode('-', $taille);
67
+
68
+    $GLOBALS['taille_max'] = end($taille);
69
+    $GLOBALS['taille_min'] = 0;
70
+    if (count($taille) > 1) {
71
+        $GLOBALS['taille_min'] = reset($taille);
72
+    }
73
+
74
+    // si l'intervalle est assez petit, on garde la valeur min
75
+    if ($GLOBALS['taille_max'] * $GLOBALS['taille_max'] - $GLOBALS['taille_min'] * $GLOBALS['taille_min'] < 50000) {
76
+        $t = ($GLOBALS['taille_min'] * $GLOBALS['taille_min']);
77
+        if ($GLOBALS['taille_min'] !== $GLOBALS['taille_max']) {
78
+            $t = $t * 0.9; // marge de securite
79
+            echo round($t / 1000000, 3) . ' Mpx';
80
+        } else {
81
+            // c'est un cas "on a reussi la borne max initiale, donc on a pas de limite connue"
82
+            $t = 0;
83
+            echo "&infin;";
84
+        }
85
+        ecrire_meta('max_taille_vignettes', $t, 'non');
86
+        die();
87
+    }
88
+
89
+    $taille = $GLOBALS['taille_test'] = round(($GLOBALS['taille_max'] + $GLOBALS['taille_min']) / 2);
90
+
91
+    include_spip('inc/filtres');
92
+    // des inclusions representatives d'un hit prive et/ou public pour la conso memoire
93
+    include_spip('public/assembler');
94
+    include_spip('public/balises');
95
+    include_spip('public/boucles');
96
+    include_spip('public/cacher');
97
+    include_spip('public/compiler');
98
+    include_spip('public/composer');
99
+    include_spip('public/criteres');
100
+    include_spip('public/interfaces');
101
+    include_spip('public/parametrer');
102
+    include_spip('public/phraser_html');
103
+    include_spip('public/references');
104
+
105
+    include_spip('inc/presentation');
106
+    include_spip('inc/charsets');
107
+    include_spip('inc/documents');
108
+    include_spip('inc/header');
109
+    propre("<doc1>"); // charger propre avec le trairement d'un modele
110
+
111
+    $i = _request('i') + 1;
112
+    $image_source = chemin_image("test.png");
113
+    $GLOBALS['redirect'] = generer_url_action("tester_taille",
114
+        "i=$i&arg=" . $GLOBALS['taille_min'] . "-" . $GLOBALS['taille_test']);
115
+
116
+    ob_start('action_tester_taille_error_handler');
117
+    filtrer('image_recadre', $image_source, $taille, $taille);
118
+    $GLOBALS['redirect'] = generer_url_action("tester_taille", "i=$i&arg=$taille-" . $GLOBALS['taille_max']);
119
+
120
+    // si la valeur intermediaire a reussi, on teste la valeur maxi qui est peut etre sous estimee
121
+    // si $GLOBALS['taille_min']==0 (car on est au premier coup)
122
+    if ($GLOBALS['taille_min'] == 0) {
123
+        $taille = $GLOBALS['taille_max'];
124
+        filtrer('image_recadre', $image_source, $taille, $taille);
125
+        $GLOBALS['redirect'] = generer_url_action("tester_taille", "i=$i&arg=$taille-" . $GLOBALS['taille_max']);
126
+    }
127
+    ob_end_clean();
128
+
129
+
130
+    // on est ici, donc pas de plantage
131
+    echo redirige_formulaire($GLOBALS['redirect']);
132 132
 }
Please login to merge, or discard this patch.
ecrire/action/supprimer_lien.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
 
@@ -35,14 +35,14 @@  discard block
 block discarded – undo
35 35
  * @return void
36 36
  */
37 37
 function action_supprimer_lien_dist($arg = null) {
38
-	if (is_null($arg)) {
39
-		$securiser_action = charger_fonction('securiser_action', 'inc');
40
-		$arg = $securiser_action();
41
-	}
38
+    if (is_null($arg)) {
39
+        $securiser_action = charger_fonction('securiser_action', 'inc');
40
+        $arg = $securiser_action();
41
+    }
42 42
 
43
-	$arg = explode("-", $arg);
44
-	list($objet_source, $ids, $objet_lie, $idl) = $arg;
43
+    $arg = explode("-", $arg);
44
+    list($objet_source, $ids, $objet_lie, $idl) = $arg;
45 45
 
46
-	include_spip('action/editer_liens');
47
-	objet_dissocier(array($objet_source => $ids), array($objet_lie => $idl));
46
+    include_spip('action/editer_liens');
47
+    objet_dissocier(array($objet_source => $ids), array($objet_lie => $idl));
48 48
 }
Please login to merge, or discard this patch.
ecrire/action/session.php 1 patch
Indentation   +12 added lines, -12 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,16 +32,16 @@  discard block
 block discarded – undo
32 32
  *   Envoyer en réponse : json contenant toutes les variables publiques de la session
33 33
  **/
34 34
 function action_session_dist() {
35
-	if ($var = _request('var')
36
-		and preg_match(',^[a-z_0-9-]+$,i', $var)
37
-	) {
38
-		if ($_SERVER['REQUEST_METHOD'] == 'POST') {
39
-			include_spip('inc/session');
40
-			session_set('session_' . $var, $val = _request('val'));
41
-			#spip_log("autosave:$var:$val",'autosave');
42
-		}
43
-	}
35
+    if ($var = _request('var')
36
+        and preg_match(',^[a-z_0-9-]+$,i', $var)
37
+    ) {
38
+        if ($_SERVER['REQUEST_METHOD'] == 'POST') {
39
+            include_spip('inc/session');
40
+            session_set('session_' . $var, $val = _request('val'));
41
+            #spip_log("autosave:$var:$val",'autosave');
42
+        }
43
+    }
44 44
 
45
-	# TODO: mode lecture de session ; n'afficher que ce qu'il faut
46
-	#echo json_encode($GLOBALS['visiteur_session']);
45
+    # TODO: mode lecture de session ; n'afficher que ce qu'il faut
46
+    #echo json_encode($GLOBALS['visiteur_session']);
47 47
 }
Please login to merge, or discard this patch.
ecrire/action/instituer_objet.php 1 patch
Indentation   +21 added lines, -21 removed lines patch added patch discarded remove patch
@@ -17,7 +17,7 @@  discard block
 block discarded – undo
17 17
  */
18 18
 
19 19
 if (!defined("_ECRIRE_INC_VERSION")) {
20
-	return;
20
+    return;
21 21
 }
22 22
 
23 23
 /**
@@ -29,25 +29,25 @@  discard block
 block discarded – undo
29 29
  */
30 30
 function action_instituer_objet_dist($arg = null) {
31 31
 
32
-	if (is_null($arg)) {
33
-		$securiser_action = charger_fonction('securiser_action', 'inc');
34
-		$arg = $securiser_action();
35
-	}
36
-
37
-	list($objet, $id_objet, $statut) = preg_split('/\W/', $arg);
38
-	if (!$statut) {
39
-		$statut = _request('statut_nouv');
40
-	} // cas POST
41
-	if (!$statut) {
42
-		return;
43
-	} // impossible mais sait-on jamais
44
-
45
-	if ($id_objet = intval($id_objet)
46
-		and autoriser('instituer', $objet, $id_objet, '', array('statut' => $statut))
47
-	) {
48
-
49
-		include_spip('action/editer_objet');
50
-		objet_modifier($objet, $id_objet, array('statut' => $statut));
51
-	}
32
+    if (is_null($arg)) {
33
+        $securiser_action = charger_fonction('securiser_action', 'inc');
34
+        $arg = $securiser_action();
35
+    }
36
+
37
+    list($objet, $id_objet, $statut) = preg_split('/\W/', $arg);
38
+    if (!$statut) {
39
+        $statut = _request('statut_nouv');
40
+    } // cas POST
41
+    if (!$statut) {
42
+        return;
43
+    } // impossible mais sait-on jamais
44
+
45
+    if ($id_objet = intval($id_objet)
46
+        and autoriser('instituer', $objet, $id_objet, '', array('statut' => $statut))
47
+    ) {
48
+
49
+        include_spip('action/editer_objet');
50
+        objet_modifier($objet, $id_objet, array('statut' => $statut));
51
+    }
52 52
 
53 53
 }
Please login to merge, or discard this patch.
ecrire/action/instituer_langue_objet.php 1 patch
Indentation   +37 added lines, -37 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
 /**
@@ -31,43 +31,43 @@  discard block
 block discarded – undo
31 31
  * @return string
32 32
  */
33 33
 function action_instituer_langue_objet_dist($objet, $id, $id_rubrique, $changer_lang, $serveur='') {
34
-	if ($changer_lang) {
35
-		$table_objet_sql = table_objet_sql($objet);
36
-		$id_table_objet = id_table_objet($objet);
37
-		$trouver_table = charger_fonction('trouver_table', 'base');
38
-		$desc = $trouver_table($table_objet_sql, $serveur);
34
+    if ($changer_lang) {
35
+        $table_objet_sql = table_objet_sql($objet);
36
+        $id_table_objet = id_table_objet($objet);
37
+        $trouver_table = charger_fonction('trouver_table', 'base');
38
+        $desc = $trouver_table($table_objet_sql, $serveur);
39 39
 		
40
-		$set = array();
41
-		if (isset($desc['field']['langue_choisie'])){
42
-			$set['langue_choisie'] = 'oui';
43
-		}
40
+        $set = array();
41
+        if (isset($desc['field']['langue_choisie'])){
42
+            $set['langue_choisie'] = 'oui';
43
+        }
44 44
 		
45
-		if ($changer_lang != "herit") {
46
-			$set['lang'] = $changer_lang;
47
-			sql_updateq($table_objet_sql, $set, "$id_table_objet=" . intval($id),'',$serveur);
48
-			include_spip('inc/rubriques'); // pour calculer_langues_rubriques et calculer_langues_utilisees
49
-			if ($table_objet_sql == 'spip_rubriques') {
50
-				calculer_langues_rubriques();
51
-			}
52
-			$langues = calculer_langues_utilisees($serveur);
53
-			ecrire_meta('langues_utilisees', $langues);
54
-		} else {
55
-			$langue_parent = sql_getfetsel("lang", "spip_rubriques", "id_rubrique=" . intval($id_rubrique));
56
-			if (!$langue_parent) {
57
-				$langue_parent = $GLOBALS['meta']['langue_site'];
58
-			}
59
-			$changer_lang = $langue_parent;
60
-			$set['lang'] = $changer_lang;
61
-			if (isset($set['langue_choisie'])){
62
-				$set['langue_choisie'] = 'non';
63
-			}
64
-			sql_updateq($table_objet_sql, $set, "$id_table_objet=" . intval($id),'',$serveur);
65
-			if ($table_objet_sql == 'spip_rubriques') {
66
-				include_spip('inc/rubriques');
67
-				calculer_langues_rubriques();
68
-			}
69
-		}
70
-	}
45
+        if ($changer_lang != "herit") {
46
+            $set['lang'] = $changer_lang;
47
+            sql_updateq($table_objet_sql, $set, "$id_table_objet=" . intval($id),'',$serveur);
48
+            include_spip('inc/rubriques'); // pour calculer_langues_rubriques et calculer_langues_utilisees
49
+            if ($table_objet_sql == 'spip_rubriques') {
50
+                calculer_langues_rubriques();
51
+            }
52
+            $langues = calculer_langues_utilisees($serveur);
53
+            ecrire_meta('langues_utilisees', $langues);
54
+        } else {
55
+            $langue_parent = sql_getfetsel("lang", "spip_rubriques", "id_rubrique=" . intval($id_rubrique));
56
+            if (!$langue_parent) {
57
+                $langue_parent = $GLOBALS['meta']['langue_site'];
58
+            }
59
+            $changer_lang = $langue_parent;
60
+            $set['lang'] = $changer_lang;
61
+            if (isset($set['langue_choisie'])){
62
+                $set['langue_choisie'] = 'non';
63
+            }
64
+            sql_updateq($table_objet_sql, $set, "$id_table_objet=" . intval($id),'',$serveur);
65
+            if ($table_objet_sql == 'spip_rubriques') {
66
+                include_spip('inc/rubriques');
67
+                calculer_langues_rubriques();
68
+            }
69
+        }
70
+    }
71 71
 
72
-	return $changer_lang;
72
+    return $changer_lang;
73 73
 }
Please login to merge, or discard this patch.
ecrire/action/forcer_job.php 1 patch
Indentation   +10 added lines, -10 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,15 +26,15 @@  discard block
 block discarded – undo
26 26
  * @return void
27 27
  */
28 28
 function action_forcer_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 ($id_job = intval($id_job)
33
-		and autoriser('forcer', 'job', $id_job)
34
-	) {
35
-		include_spip('inc/queue');
36
-		include_spip('inc/genie');
37
-		queue_schedule(array($id_job));
38
-	}
32
+    if ($id_job = intval($id_job)
33
+        and autoriser('forcer', 'job', $id_job)
34
+    ) {
35
+        include_spip('inc/queue');
36
+        include_spip('inc/genie');
37
+        queue_schedule(array($id_job));
38
+    }
39 39
 
40 40
 }
Please login to merge, or discard this patch.
ecrire/action/annuler_job.php 1 patch
Indentation   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -17,7 +17,7 @@  discard block
 block discarded – undo
17 17
  **/
18 18
 
19 19
 if (!defined('_ECRIRE_INC_VERSION')) {
20
-	return;
20
+    return;
21 21
 }
22 22
 
23 23
 /**
@@ -26,12 +26,12 @@  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 ($id_job = intval($id_job)
33
-		and autoriser('annuler', 'job', $id_job)
34
-	) {
35
-		job_queue_remove($id_job);
36
-	}
32
+    if ($id_job = intval($id_job)
33
+        and autoriser('annuler', 'job', $id_job)
34
+    ) {
35
+        job_queue_remove($id_job);
36
+    }
37 37
 }
Please login to merge, or discard this patch.