Completed
Pull Request — master (#39)
by
unknown
07:42
created
ecrire/iterateur/condition.php 1 patch
Indentation   +14 added lines, -14 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('iterateur/data');
@@ -35,12 +35,12 @@  discard block
 block discarded – undo
35 35
  *     Description de la boucle complétée des champs
36 36
  */
37 37
 function iterateur_CONDITION_dist($b) {
38
-	$b->iterateur = 'CONDITION'; # designe la classe d'iterateur
39
-	$b->show = array(
40
-		'field' => array()
41
-	);
38
+    $b->iterateur = 'CONDITION'; # designe la classe d'iterateur
39
+    $b->show = array(
40
+        'field' => array()
41
+    );
42 42
 
43
-	return $b;
43
+    return $b;
44 44
 }
45 45
 
46 46
 /**
@@ -49,12 +49,12 @@  discard block
 block discarded – undo
49 49
  * La boucle condition n'a toujours qu'un seul élément.
50 50
  */
51 51
 class IterateurCONDITION extends IterateurData {
52
-	/**
53
-	 * Obtenir les données de la boucle CONDITION
54
-	 *
55
-	 * @param array $command
56
-	 **/
57
-	protected function select($command) {
58
-		$this->tableau = array(0 => 1);
59
-	}
52
+    /**
53
+     * Obtenir les données de la boucle CONDITION
54
+     *
55
+     * @param array $command
56
+     **/
57
+    protected function select($command) {
58
+        $this->tableau = array(0 => 1);
59
+    }
60 60
 }
Please login to merge, or discard this patch.
ecrire/iterateur/php.php 1 patch
Indentation   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -19,7 +19,7 @@  discard block
 block discarded – undo
19 19
 
20 20
 
21 21
 if (!defined('_ECRIRE_INC_VERSION')) {
22
-	return;
22
+    return;
23 23
 }
24 24
 
25 25
 
@@ -37,22 +37,22 @@  discard block
 block discarded – undo
37 37
  *     Description de la boucle complétée des champs
38 38
  */
39 39
 function iterateur_php_dist($b, $iteratorName) {
40
-	$b->iterateur = $iteratorName; # designe la classe d'iterateur
41
-	$b->show = array(
42
-		'field' => array(
43
-			'cle' => 'STRING',
44
-			'valeur' => 'STRING',
45
-		)
46
-	);
47
-	foreach (get_class_methods($iteratorName) as $method) {
48
-		$b->show['field'][strtolower($method)] = 'METHOD';
49
-	}
50
-
51
-	/*
40
+    $b->iterateur = $iteratorName; # designe la classe d'iterateur
41
+    $b->show = array(
42
+        'field' => array(
43
+            'cle' => 'STRING',
44
+            'valeur' => 'STRING',
45
+        )
46
+    );
47
+    foreach (get_class_methods($iteratorName) as $method) {
48
+        $b->show['field'][strtolower($method)] = 'METHOD';
49
+    }
50
+
51
+    /*
52 52
 	foreach (get_class_vars($iteratorName) as $property) {
53 53
 		$b->show['field'][ strtolower($property) ] = 'PROPERTY';
54 54
 	}
55 55
 	*/
56 56
 
57
-	return $b;
57
+    return $b;
58 58
 }
Please login to merge, or discard this patch.
ecrire/iterateur/pour.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
 include_spip('iterateur/data');
@@ -35,13 +35,13 @@  discard block
 block discarded – undo
35 35
  *     Description de la boucle complétée des champs
36 36
  */
37 37
 function iterateur_POUR_dist($b) {
38
-	$b->iterateur = 'DATA'; # designe la classe d'iterateur
39
-	$b->show = array(
40
-		'field' => array(
41
-			'cle' => 'STRING',
42
-			'valeur' => 'STRING',
43
-		)
44
-	);
38
+    $b->iterateur = 'DATA'; # designe la classe d'iterateur
39
+    $b->show = array(
40
+        'field' => array(
41
+            'cle' => 'STRING',
42
+            'valeur' => 'STRING',
43
+        )
44
+    );
45 45
 
46
-	return $b;
46
+    return $b;
47 47
 }
Please login to merge, or discard this patch.
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 2 patches
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.
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -42,16 +42,16 @@
 block discarded – undo
42 42
 		$res = _T('ecrire:taille_cache_image',
43 43
 			array(
44 44
 				'dir' => joli_repertoire(_DIR_VAR),
45
-				'taille' => "<b>" . (taille_en_octets($taille) > 0 ? taille_en_octets($taille) : "0 octet") . "</b>"
45
+				'taille' => "<b>".(taille_en_octets($taille) > 0 ? taille_en_octets($taille) : "0 octet")."</b>"
46 46
 			)
47 47
 		);
48 48
 	} else {
49 49
 		include_spip('inc/invalideur');
50 50
 		$taille =
51 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/');
52
+			+ calculer_taille_dossier(_DIR_CACHE.'skel/')
53
+			+ calculer_taille_dossier(_DIR_CACHE.'wheels/')
54
+			+ calculer_taille_dossier(_DIR_CACHE.'contextes/');
55 55
 		$taille += intval(taille_du_cache());
56 56
 		if ($taille <= 150000) {
57 57
 			$res = _T('taille_cache_vide');
Please login to merge, or discard this patch.
ecrire/action/tester_taille.php 2 patches
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.
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -76,7 +76,7 @@  discard block
 block discarded – undo
76 76
 		$t = ($GLOBALS['taille_min'] * $GLOBALS['taille_min']);
77 77
 		if ($GLOBALS['taille_min'] !== $GLOBALS['taille_max']) {
78 78
 			$t = $t * 0.9; // marge de securite
79
-			echo round($t / 1000000, 3) . ' Mpx';
79
+			echo round($t / 1000000, 3).' Mpx';
80 80
 		} else {
81 81
 			// c'est un cas "on a reussi la borne max initiale, donc on a pas de limite connue"
82 82
 			$t = 0;
@@ -111,18 +111,18 @@  discard block
 block discarded – undo
111 111
 	$i = _request('i') + 1;
112 112
 	$image_source = chemin_image("test.png");
113 113
 	$GLOBALS['redirect'] = generer_url_action("tester_taille",
114
-		"i=$i&arg=" . $GLOBALS['taille_min'] . "-" . $GLOBALS['taille_test']);
114
+		"i=$i&arg=".$GLOBALS['taille_min']."-".$GLOBALS['taille_test']);
115 115
 
116 116
 	ob_start('action_tester_taille_error_handler');
117 117
 	filtrer('image_recadre', $image_source, $taille, $taille);
118
-	$GLOBALS['redirect'] = generer_url_action("tester_taille", "i=$i&arg=$taille-" . $GLOBALS['taille_max']);
118
+	$GLOBALS['redirect'] = generer_url_action("tester_taille", "i=$i&arg=$taille-".$GLOBALS['taille_max']);
119 119
 
120 120
 	// si la valeur intermediaire a reussi, on teste la valeur maxi qui est peut etre sous estimee
121 121
 	// si $GLOBALS['taille_min']==0 (car on est au premier coup)
122 122
 	if ($GLOBALS['taille_min'] == 0) {
123 123
 		$taille = $GLOBALS['taille_max'];
124 124
 		filtrer('image_recadre', $image_source, $taille, $taille);
125
-		$GLOBALS['redirect'] = generer_url_action("tester_taille", "i=$i&arg=$taille-" . $GLOBALS['taille_max']);
125
+		$GLOBALS['redirect'] = generer_url_action("tester_taille", "i=$i&arg=$taille-".$GLOBALS['taille_max']);
126 126
 	}
127 127
 	ob_end_clean();
128 128
 
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 2 patches
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.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -37,7 +37,7 @@
 block discarded – undo
37 37
 	) {
38 38
 		if ($_SERVER['REQUEST_METHOD'] == 'POST') {
39 39
 			include_spip('inc/session');
40
-			session_set('session_' . $var, $val = _request('val'));
40
+			session_set('session_'.$var, $val = _request('val'));
41 41
 			#spip_log("autosave:$var:$val",'autosave');
42 42
 		}
43 43
 	}
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.