Completed
Push — master ( d9e311...5cc303 )
by cam
04:26
created
config/ecran_securite.php 2 patches
Indentation   +423 added lines, -423 removed lines patch added patch discarded remove patch
@@ -15,11 +15,11 @@  discard block
 block discarded – undo
15 15
  * Test utilisateur
16 16
  */
17 17
 if (isset($_GET['test_ecran_securite'])) {
18
-	$ecran_securite_raison = 'test ' . _ECRAN_SECURITE;
18
+    $ecran_securite_raison = 'test ' . _ECRAN_SECURITE;
19 19
 }
20 20
 
21 21
 if (file_exists($f = __DIR__ . DIRECTORY_SEPARATOR  . 'ecran_securite_options.php')) {
22
-	include ($f);
22
+    include ($f);
23 23
 }
24 24
 
25 25
 /*
@@ -29,221 +29,221 @@  discard block
 block discarded – undo
29 29
  * le load depasse ECRAN_SECURITE_LOAD)
30 30
  */
31 31
 if (!defined('_IS_BOT') and isset($_GET['var_isbot'])) {
32
-	define('_IS_BOT', $_GET['var_isbot'] ? true : false);
32
+    define('_IS_BOT', $_GET['var_isbot'] ? true : false);
33 33
 }
34 34
 
35 35
 /*
36 36
  * Détecteur de robot d'indexation
37 37
  */
38 38
 if (!defined('_IS_BOT')) {
39
-	define(
40
-		'_IS_BOT',
41
-		isset($_SERVER['HTTP_USER_AGENT'])
42
-			and preg_match(
43
-				','
44
-					. implode('|', array(
45
-						// mots generiques
46
-						'bot',
47
-						'slurp',
48
-						'crawler',
49
-						'crwlr',
50
-						'java',
51
-						'monitoring',
52
-						'spider',
53
-						'webvac',
54
-						'yandex',
55
-						'MSIE 6\.0', // botnet 99,9% du temps
56
-						// UA plus cibles
57
-						'200please',
58
-						'80legs',
59
-						'a6-indexer',
60
-						'aboundex',
61
-						'accoona',
62
-						'acrylicapps',
63
-						'addthis',
64
-						'adressendeutschland',
65
-						'alexa',
66
-						'altavista',
67
-						'analyticsseo',
68
-						'antennapod',
69
-						'arachnys',
70
-						'archive',
71
-						'argclrint',
72
-						'aspseek',
73
-						'baidu',
74
-						'begunadvertising',
75
-						'bing',
76
-						'bloglines',
77
-						'buck',
78
-						'browsershots',
79
-						'bubing',
80
-						'butterfly',
81
-						'changedetection',
82
-						'charlotte',
83
-						'chilkat',
84
-						'china',
85
-						'coccoc',
86
-						'crowsnest',
87
-						'dataminr',
88
-						'daumoa',
89
-						'dlvr\.it',
90
-						'dlweb',
91
-						'drupal',
92
-						'ec2linkfinder',
93
-						'eset\.com',
94
-						'estyle',
95
-						'exalead',
96
-						'ezooms',
97
-						'facebookexternalhit',
98
-						'facebookplatform',
99
-						'fairshare',
100
-						'feedfetcher',
101
-						'feedfetcher-google',
102
-						'feedly',
103
-						'fetch',
104
-						'flipboardproxy',
105
-						'genieo',
106
-						'google',
107
-						'go-http-client',
108
-						'grapeshot',
109
-						'hatena-useragent',
110
-						'head',
111
-						'hosttracker',
112
-						'hubspot',
113
-						'ia_archiver',
114
-						'ichiro',
115
-						'iltrovatore-setaccio',
116
-						'immediatenet',
117
-						'ina',
118
-						'inoreader',
119
-						'infegyatlas',
120
-						'infohelfer',
121
-						'instapaper',
122
-						'jabse',
123
-						'james',
124
-						'jersey',
125
-						'kumkie',
126
-						'linkdex',
127
-						'linkfluence',
128
-						'linkwalker',
129
-						'litefinder',
130
-						'loadimpactpageanalyzer',
131
-						'ltx71',
132
-						'luminate',
133
-						'lycos',
134
-						'lycosa',
135
-						'mediapartners-google',
136
-						'msai',
137
-						'myapp',
138
-						'nativehost',
139
-						'najdi',
140
-						'netcraftsurveyagent',
141
-						'netestate',
142
-						'netseer',
143
-						'netnewswire',
144
-						'newspaper',
145
-						'newsblur',
146
-						'nuhk',
147
-						'nuzzel',
148
-						'okhttp',
149
-						'otmedia',
150
-						'owlin',
151
-						'owncloud',
152
-						'panscient',
153
-						'paper\.li',
154
-						'parsijoo',
155
-						'protopage',
156
-						'plukkie',
157
-						'proximic',
158
-						'pubsub',
159
-						'python',
160
-						'qirina',
161
-						'qoshe',
162
-						'qualidator',
163
-						'qwantify',
164
-						'rambler',
165
-						'readability',
166
-						'ruby',
167
-						'sbsearch',
168
-						'scoop\.it',
169
-						'scooter',
170
-						'scoutjet',
171
-						'scrapy',
172
-						'scrubby',
173
-						'scrubbybloglines',
174
-						'shareaholic',
175
-						'shopwiki',
176
-						'simplepie',
177
-						'sistrix',
178
-						'sitechecker',
179
-						'siteexplorer',
180
-						'snapshot',
181
-						'sogou',
182
-						'special_archiver',
183
-						'speedy',
184
-						'spinn3r',
185
-						'spreadtrum',
186
-						'steeler',
187
-						'subscriber',
188
-						'suma',
189
-						'superdownloads',
190
-						'svenska-webbsido',
191
-						'teoma',
192
-						'the knowledge AI',
193
-						'thumbshots',
194
-						'tineye',
195
-						'traackr',
196
-						'trendiction',
197
-						'trendsmap',
198
-						'tweetedtimes',
199
-						'tweetmeme',
200
-						'universalfeedparser',
201
-						'uaslinkchecker',
202
-						'undrip',
203
-						'unwindfetchor',
204
-						'upday',
205
-						'vedma',
206
-						'vkshare',
207
-						'vm',
208
-						'wch',
209
-						'webalta',
210
-						'webcookies',
211
-						'webparser',
212
-						'webthumbnail',
213
-						'wesee',
214
-						'wise-guys',
215
-						'woko',
216
-						'wordpress',
217
-						'wotbox',
218
-						'y!j-bri',
219
-						'y!j-bro',
220
-						'y!j-brw',
221
-						'y!j-bsc',
222
-						'yahoo',
223
-						'yahoo!',
224
-						'yahooysmcm',
225
-						'ymobactus',
226
-						'yats',
227
-						'yeti',
228
-						'zeerch'
229
-					)) . ',i',
230
-				(string)$_SERVER['HTTP_USER_AGENT']
231
-			)
232
-	);
39
+    define(
40
+        '_IS_BOT',
41
+        isset($_SERVER['HTTP_USER_AGENT'])
42
+            and preg_match(
43
+                ','
44
+                    . implode('|', array(
45
+                        // mots generiques
46
+                        'bot',
47
+                        'slurp',
48
+                        'crawler',
49
+                        'crwlr',
50
+                        'java',
51
+                        'monitoring',
52
+                        'spider',
53
+                        'webvac',
54
+                        'yandex',
55
+                        'MSIE 6\.0', // botnet 99,9% du temps
56
+                        // UA plus cibles
57
+                        '200please',
58
+                        '80legs',
59
+                        'a6-indexer',
60
+                        'aboundex',
61
+                        'accoona',
62
+                        'acrylicapps',
63
+                        'addthis',
64
+                        'adressendeutschland',
65
+                        'alexa',
66
+                        'altavista',
67
+                        'analyticsseo',
68
+                        'antennapod',
69
+                        'arachnys',
70
+                        'archive',
71
+                        'argclrint',
72
+                        'aspseek',
73
+                        'baidu',
74
+                        'begunadvertising',
75
+                        'bing',
76
+                        'bloglines',
77
+                        'buck',
78
+                        'browsershots',
79
+                        'bubing',
80
+                        'butterfly',
81
+                        'changedetection',
82
+                        'charlotte',
83
+                        'chilkat',
84
+                        'china',
85
+                        'coccoc',
86
+                        'crowsnest',
87
+                        'dataminr',
88
+                        'daumoa',
89
+                        'dlvr\.it',
90
+                        'dlweb',
91
+                        'drupal',
92
+                        'ec2linkfinder',
93
+                        'eset\.com',
94
+                        'estyle',
95
+                        'exalead',
96
+                        'ezooms',
97
+                        'facebookexternalhit',
98
+                        'facebookplatform',
99
+                        'fairshare',
100
+                        'feedfetcher',
101
+                        'feedfetcher-google',
102
+                        'feedly',
103
+                        'fetch',
104
+                        'flipboardproxy',
105
+                        'genieo',
106
+                        'google',
107
+                        'go-http-client',
108
+                        'grapeshot',
109
+                        'hatena-useragent',
110
+                        'head',
111
+                        'hosttracker',
112
+                        'hubspot',
113
+                        'ia_archiver',
114
+                        'ichiro',
115
+                        'iltrovatore-setaccio',
116
+                        'immediatenet',
117
+                        'ina',
118
+                        'inoreader',
119
+                        'infegyatlas',
120
+                        'infohelfer',
121
+                        'instapaper',
122
+                        'jabse',
123
+                        'james',
124
+                        'jersey',
125
+                        'kumkie',
126
+                        'linkdex',
127
+                        'linkfluence',
128
+                        'linkwalker',
129
+                        'litefinder',
130
+                        'loadimpactpageanalyzer',
131
+                        'ltx71',
132
+                        'luminate',
133
+                        'lycos',
134
+                        'lycosa',
135
+                        'mediapartners-google',
136
+                        'msai',
137
+                        'myapp',
138
+                        'nativehost',
139
+                        'najdi',
140
+                        'netcraftsurveyagent',
141
+                        'netestate',
142
+                        'netseer',
143
+                        'netnewswire',
144
+                        'newspaper',
145
+                        'newsblur',
146
+                        'nuhk',
147
+                        'nuzzel',
148
+                        'okhttp',
149
+                        'otmedia',
150
+                        'owlin',
151
+                        'owncloud',
152
+                        'panscient',
153
+                        'paper\.li',
154
+                        'parsijoo',
155
+                        'protopage',
156
+                        'plukkie',
157
+                        'proximic',
158
+                        'pubsub',
159
+                        'python',
160
+                        'qirina',
161
+                        'qoshe',
162
+                        'qualidator',
163
+                        'qwantify',
164
+                        'rambler',
165
+                        'readability',
166
+                        'ruby',
167
+                        'sbsearch',
168
+                        'scoop\.it',
169
+                        'scooter',
170
+                        'scoutjet',
171
+                        'scrapy',
172
+                        'scrubby',
173
+                        'scrubbybloglines',
174
+                        'shareaholic',
175
+                        'shopwiki',
176
+                        'simplepie',
177
+                        'sistrix',
178
+                        'sitechecker',
179
+                        'siteexplorer',
180
+                        'snapshot',
181
+                        'sogou',
182
+                        'special_archiver',
183
+                        'speedy',
184
+                        'spinn3r',
185
+                        'spreadtrum',
186
+                        'steeler',
187
+                        'subscriber',
188
+                        'suma',
189
+                        'superdownloads',
190
+                        'svenska-webbsido',
191
+                        'teoma',
192
+                        'the knowledge AI',
193
+                        'thumbshots',
194
+                        'tineye',
195
+                        'traackr',
196
+                        'trendiction',
197
+                        'trendsmap',
198
+                        'tweetedtimes',
199
+                        'tweetmeme',
200
+                        'universalfeedparser',
201
+                        'uaslinkchecker',
202
+                        'undrip',
203
+                        'unwindfetchor',
204
+                        'upday',
205
+                        'vedma',
206
+                        'vkshare',
207
+                        'vm',
208
+                        'wch',
209
+                        'webalta',
210
+                        'webcookies',
211
+                        'webparser',
212
+                        'webthumbnail',
213
+                        'wesee',
214
+                        'wise-guys',
215
+                        'woko',
216
+                        'wordpress',
217
+                        'wotbox',
218
+                        'y!j-bri',
219
+                        'y!j-bro',
220
+                        'y!j-brw',
221
+                        'y!j-bsc',
222
+                        'yahoo',
223
+                        'yahoo!',
224
+                        'yahooysmcm',
225
+                        'ymobactus',
226
+                        'yats',
227
+                        'yeti',
228
+                        'zeerch'
229
+                    )) . ',i',
230
+                (string)$_SERVER['HTTP_USER_AGENT']
231
+            )
232
+    );
233 233
 }
234 234
 if (!defined('_IS_BOT_FRIEND')) {
235
-	define(
236
-		'_IS_BOT_FRIEND',
237
-		isset($_SERVER['HTTP_USER_AGENT'])
238
-			and preg_match(
239
-				',' . implode('|', array(
240
-					'facebookexternalhit',
241
-					'flipboardproxy',
242
-					'wordpress'
243
-				)) . ',i',
244
-				(string)$_SERVER['HTTP_USER_AGENT']
245
-			)
246
-	);
235
+    define(
236
+        '_IS_BOT_FRIEND',
237
+        isset($_SERVER['HTTP_USER_AGENT'])
238
+            and preg_match(
239
+                ',' . implode('|', array(
240
+                    'facebookexternalhit',
241
+                    'flipboardproxy',
242
+                    'wordpress'
243
+                )) . ',i',
244
+                (string)$_SERVER['HTTP_USER_AGENT']
245
+            )
246
+    );
247 247
 }
248 248
 
249 249
 /*
@@ -255,28 +255,28 @@  discard block
 block discarded – undo
255 255
  */
256 256
 $_exceptions = array('id_table', 'id_base', 'id_parent', 'id_article_pdf');
257 257
 foreach ($_GET as $var => $val) {
258
-	if (
259
-		$_GET[$var] and strncmp($var, "id_", 3) == 0
260
-		and !in_array($var, $_exceptions)
261
-	) {
262
-		$_GET[$var] = is_array($_GET[$var]) ? @array_map('intval', $_GET[$var]) : intval($_GET[$var]);
263
-	}
258
+    if (
259
+        $_GET[$var] and strncmp($var, "id_", 3) == 0
260
+        and !in_array($var, $_exceptions)
261
+    ) {
262
+        $_GET[$var] = is_array($_GET[$var]) ? @array_map('intval', $_GET[$var]) : intval($_GET[$var]);
263
+    }
264 264
 }
265 265
 foreach ($_POST as $var => $val) {
266
-	if (
267
-		$_POST[$var] and strncmp($var, "id_", 3) == 0
268
-		and !in_array($var, $_exceptions)
269
-	) {
270
-		$_POST[$var] = is_array($_POST[$var]) ? @array_map('intval', $_POST[$var]) : intval($_POST[$var]);
271
-	}
266
+    if (
267
+        $_POST[$var] and strncmp($var, "id_", 3) == 0
268
+        and !in_array($var, $_exceptions)
269
+    ) {
270
+        $_POST[$var] = is_array($_POST[$var]) ? @array_map('intval', $_POST[$var]) : intval($_POST[$var]);
271
+    }
272 272
 }
273 273
 foreach ($GLOBALS as $var => $val) {
274
-	if (
275
-		$GLOBALS[$var] and strncmp($var, "id_", 3) == 0
276
-		and !in_array($var, $_exceptions)
277
-	) {
278
-		$GLOBALS[$var] = is_array($GLOBALS[$var]) ? @array_map('intval', $GLOBALS[$var]) : intval($GLOBALS[$var]);
279
-	}
274
+    if (
275
+        $GLOBALS[$var] and strncmp($var, "id_", 3) == 0
276
+        and !in_array($var, $_exceptions)
277
+    ) {
278
+        $GLOBALS[$var] = is_array($GLOBALS[$var]) ? @array_map('intval', $GLOBALS[$var]) : intval($GLOBALS[$var]);
279
+    }
280 280
 }
281 281
 
282 282
 /*
@@ -289,116 +289,116 @@  discard block
 block discarded – undo
289 289
  * Contrôle de quelques variables (XSS)
290 290
  */
291 291
 foreach (array('lang', 'var_recherche', 'aide', 'var_lang_r', 'lang_r', 'var_ajax_ancre', 'nom_fichier') as $var) {
292
-	if (isset($_GET[$var])) {
293
-		$_REQUEST[$var] = $GLOBALS[$var] = $_GET[$var] = preg_replace(',[^\w\,/#&;-]+,', ' ', (string)$_GET[$var]);
294
-	}
295
-	if (isset($_POST[$var])) {
296
-		$_REQUEST[$var] = $GLOBALS[$var] = $_POST[$var] = preg_replace(',[^\w\,/#&;-]+,', ' ', (string)$_POST[$var]);
297
-	}
292
+    if (isset($_GET[$var])) {
293
+        $_REQUEST[$var] = $GLOBALS[$var] = $_GET[$var] = preg_replace(',[^\w\,/#&;-]+,', ' ', (string)$_GET[$var]);
294
+    }
295
+    if (isset($_POST[$var])) {
296
+        $_REQUEST[$var] = $GLOBALS[$var] = $_POST[$var] = preg_replace(',[^\w\,/#&;-]+,', ' ', (string)$_POST[$var]);
297
+    }
298 298
 }
299 299
 
300 300
 /*
301 301
  * Filtre l'accès à spip_acces_doc (injection SQL en 1.8.2x)
302 302
  */
303 303
 if (isset($_SERVER['REQUEST_URI'])) {
304
-	if (preg_match(',^(.*/)?spip_acces_doc\.,', (string)$_SERVER['REQUEST_URI'])) {
305
-		$file = addslashes((string)$_GET['file']);
306
-	}
304
+    if (preg_match(',^(.*/)?spip_acces_doc\.,', (string)$_SERVER['REQUEST_URI'])) {
305
+        $file = addslashes((string)$_GET['file']);
306
+    }
307 307
 }
308 308
 
309 309
 /*
310 310
  * Pas d'inscription abusive
311 311
  */
312 312
 if (
313
-	isset($_REQUEST['mode']) and isset($_REQUEST['page'])
314
-	and !in_array($_REQUEST['mode'], array("6forum", "1comite"))
315
-	and $_REQUEST['page'] == "identifiants"
313
+    isset($_REQUEST['mode']) and isset($_REQUEST['page'])
314
+    and !in_array($_REQUEST['mode'], array("6forum", "1comite"))
315
+    and $_REQUEST['page'] == "identifiants"
316 316
 ) {
317
-	$ecran_securite_raison = "identifiants";
317
+    $ecran_securite_raison = "identifiants";
318 318
 }
319 319
 
320 320
 /*
321 321
  * Agenda joue à l'injection php
322 322
  */
323 323
 if (
324
-	isset($_REQUEST['partie_cal'])
325
-	and $_REQUEST['partie_cal'] !== htmlentities((string)$_REQUEST['partie_cal'])
324
+    isset($_REQUEST['partie_cal'])
325
+    and $_REQUEST['partie_cal'] !== htmlentities((string)$_REQUEST['partie_cal'])
326 326
 ) {
327
-	$ecran_securite_raison = "partie_cal";
327
+    $ecran_securite_raison = "partie_cal";
328 328
 }
329 329
 if (
330
-	isset($_REQUEST['echelle'])
331
-	and $_REQUEST['echelle'] !== htmlentities((string)$_REQUEST['echelle'])
330
+    isset($_REQUEST['echelle'])
331
+    and $_REQUEST['echelle'] !== htmlentities((string)$_REQUEST['echelle'])
332 332
 ) {
333
-	$ecran_securite_raison = "echelle";
333
+    $ecran_securite_raison = "echelle";
334 334
 }
335 335
 
336 336
 /*
337 337
  * Espace privé
338 338
  */
339 339
 if (
340
-	isset($_REQUEST['exec'])
341
-	and !preg_match(',^[\w-]+$,', (string)$_REQUEST['exec'])
340
+    isset($_REQUEST['exec'])
341
+    and !preg_match(',^[\w-]+$,', (string)$_REQUEST['exec'])
342 342
 ) {
343
-	$ecran_securite_raison = "exec";
343
+    $ecran_securite_raison = "exec";
344 344
 }
345 345
 if (
346
-	isset($_REQUEST['cherche_auteur'])
347
-	and preg_match(',[<],', (string)$_REQUEST['cherche_auteur'])
346
+    isset($_REQUEST['cherche_auteur'])
347
+    and preg_match(',[<],', (string)$_REQUEST['cherche_auteur'])
348 348
 ) {
349
-	$ecran_securite_raison = "cherche_auteur";
349
+    $ecran_securite_raison = "cherche_auteur";
350 350
 }
351 351
 if (
352
-	isset($_REQUEST['exec'])
353
-	and $_REQUEST['exec'] == 'auteurs'
354
-	and isset($_REQUEST['recherche'])
355
-	and preg_match(',[<],', (string)$_REQUEST['recherche'])
352
+    isset($_REQUEST['exec'])
353
+    and $_REQUEST['exec'] == 'auteurs'
354
+    and isset($_REQUEST['recherche'])
355
+    and preg_match(',[<],', (string)$_REQUEST['recherche'])
356 356
 ) {
357
-	$ecran_securite_raison = "recherche";
357
+    $ecran_securite_raison = "recherche";
358 358
 }
359 359
 if (
360
-	isset($_REQUEST['exec'])
361
-	and $_REQUEST['exec'] == 'info_plugin'
362
-	and isset($_REQUEST['plugin'])
363
-	and preg_match(',[<],', (string)$_REQUEST['plugin'])
360
+    isset($_REQUEST['exec'])
361
+    and $_REQUEST['exec'] == 'info_plugin'
362
+    and isset($_REQUEST['plugin'])
363
+    and preg_match(',[<],', (string)$_REQUEST['plugin'])
364 364
 ) {
365
-	$ecran_securite_raison = "plugin";
365
+    $ecran_securite_raison = "plugin";
366 366
 }
367 367
 if (
368
-	isset($_REQUEST['exec'])
369
-	and $_REQUEST['exec'] == 'puce_statut'
370
-	and isset($_REQUEST['id'])
371
-	and !intval($_REQUEST['id'])
368
+    isset($_REQUEST['exec'])
369
+    and $_REQUEST['exec'] == 'puce_statut'
370
+    and isset($_REQUEST['id'])
371
+    and !intval($_REQUEST['id'])
372 372
 ) {
373
-	$ecran_securite_raison = "puce_statut";
373
+    $ecran_securite_raison = "puce_statut";
374 374
 }
375 375
 if (
376
-	isset($_REQUEST['action'])
377
-	and $_REQUEST['action'] == 'configurer'
376
+    isset($_REQUEST['action'])
377
+    and $_REQUEST['action'] == 'configurer'
378 378
 ) {
379
-	if (
380
-		@file_exists('inc_version.php')
381
-		or @file_exists('ecrire/inc_version.php')
382
-	) {
383
-		function action_configurer() {
384
-			include_spip('inc/autoriser');
385
-			if (!autoriser('configurer', _request('configuration'))) {
386
-				include_spip('inc/minipres');
387
-				echo minipres(_T('info_acces_interdit'));
388
-				exit;
389
-			}
390
-			require _DIR_RESTREINT . 'action/configurer.php';
391
-			action_configurer_dist();
392
-		}
393
-	}
379
+    if (
380
+        @file_exists('inc_version.php')
381
+        or @file_exists('ecrire/inc_version.php')
382
+    ) {
383
+        function action_configurer() {
384
+            include_spip('inc/autoriser');
385
+            if (!autoriser('configurer', _request('configuration'))) {
386
+                include_spip('inc/minipres');
387
+                echo minipres(_T('info_acces_interdit'));
388
+                exit;
389
+            }
390
+            require _DIR_RESTREINT . 'action/configurer.php';
391
+            action_configurer_dist();
392
+        }
393
+    }
394 394
 }
395 395
 if (
396
-	isset($_REQUEST['action'])
397
-	and $_REQUEST['action'] == 'ordonner_liens_documents'
398
-	and isset($_REQUEST['ordre'])
399
-	and is_string($_REQUEST['ordre'])
396
+    isset($_REQUEST['action'])
397
+    and $_REQUEST['action'] == 'ordonner_liens_documents'
398
+    and isset($_REQUEST['ordre'])
399
+    and is_string($_REQUEST['ordre'])
400 400
 ) {
401
-	$ecran_securite_raison = "ordre a la chaine";
401
+    $ecran_securite_raison = "ordre a la chaine";
402 402
 }
403 403
 
404 404
 
@@ -406,29 +406,29 @@  discard block
 block discarded – undo
406 406
  * Bloque les requêtes contenant %00 (manipulation d'include)
407 407
  */
408 408
 if (strpos(
409
-	(function_exists('get_magic_quotes_gpc') and @get_magic_quotes_gpc())
410
-		? stripslashes(serialize($_REQUEST))
411
-		: serialize($_REQUEST),
412
-	chr(0)
409
+    (function_exists('get_magic_quotes_gpc') and @get_magic_quotes_gpc())
410
+        ? stripslashes(serialize($_REQUEST))
411
+        : serialize($_REQUEST),
412
+    chr(0)
413 413
 ) !== false) {
414
-	$ecran_securite_raison = "%00";
414
+    $ecran_securite_raison = "%00";
415 415
 }
416 416
 
417 417
 /*
418 418
  * Bloque les requêtes fond=formulaire_
419 419
  */
420 420
 if (
421
-	isset($_REQUEST['fond'])
422
-	and preg_match(',^formulaire_,i', $_REQUEST['fond'])
421
+    isset($_REQUEST['fond'])
422
+    and preg_match(',^formulaire_,i', $_REQUEST['fond'])
423 423
 ) {
424
-	$ecran_securite_raison = "fond=formulaire_";
424
+    $ecran_securite_raison = "fond=formulaire_";
425 425
 }
426 426
 
427 427
 /*
428 428
  * Bloque les requêtes du type ?GLOBALS[type_urls]=toto (bug vieux php)
429 429
  */
430 430
 if (isset($_REQUEST['GLOBALS'])) {
431
-	$ecran_securite_raison = "GLOBALS[GLOBALS]";
431
+    $ecran_securite_raison = "GLOBALS[GLOBALS]";
432 432
 }
433 433
 
434 434
 /*
@@ -437,14 +437,14 @@  discard block
 block discarded – undo
437 437
  * les paginations entremélées
438 438
  */
439 439
 if (_IS_BOT) {
440
-	if (
441
-		(isset($_REQUEST['echelle']) and isset($_REQUEST['partie_cal']) and isset($_REQUEST['type']))
442
-		or (strpos((string)$_SERVER['REQUEST_URI'], 'debut_') and preg_match(',[?&]debut_.*&debut_,', (string)$_SERVER['REQUEST_URI']))
443
-		or (isset($_REQUEST['calendrier_annee']) and strpos((string)$_SERVER['REQUEST_URI'], 'debut_'))
444
-		or (isset($_REQUEST['calendrier_annee']) and preg_match(',[?&]calendrier_annee=.*&calendrier_annee=,', (string)$_SERVER['REQUEST_URI']))
445
-	) {
446
-		$ecran_securite_raison = "robot agenda/double pagination";
447
-	}
440
+    if (
441
+        (isset($_REQUEST['echelle']) and isset($_REQUEST['partie_cal']) and isset($_REQUEST['type']))
442
+        or (strpos((string)$_SERVER['REQUEST_URI'], 'debut_') and preg_match(',[?&]debut_.*&debut_,', (string)$_SERVER['REQUEST_URI']))
443
+        or (isset($_REQUEST['calendrier_annee']) and strpos((string)$_SERVER['REQUEST_URI'], 'debut_'))
444
+        or (isset($_REQUEST['calendrier_annee']) and preg_match(',[?&]calendrier_annee=.*&calendrier_annee=,', (string)$_SERVER['REQUEST_URI']))
445
+    ) {
446
+        $ecran_securite_raison = "robot agenda/double pagination";
447
+    }
448 448
 }
449 449
 
450 450
 /*
@@ -452,82 +452,82 @@  discard block
 block discarded – undo
452 452
  * Bloque un XSS sur une page inexistante
453 453
  */
454 454
 if (isset($_REQUEST['page'])) {
455
-	if ($_REQUEST['page'] == 'test_cfg') {
456
-		$ecran_securite_raison = "test_cfg";
457
-	}
458
-	if ($_REQUEST['page'] !== htmlspecialchars((string)$_REQUEST['page'])) {
459
-		$ecran_securite_raison = "xsspage";
460
-	}
461
-	if (
462
-		$_REQUEST['page'] == '404'
463
-		and isset($_REQUEST['erreur'])
464
-	) {
465
-		$ecran_securite_raison = "xss404";
466
-	}
455
+    if ($_REQUEST['page'] == 'test_cfg') {
456
+        $ecran_securite_raison = "test_cfg";
457
+    }
458
+    if ($_REQUEST['page'] !== htmlspecialchars((string)$_REQUEST['page'])) {
459
+        $ecran_securite_raison = "xsspage";
460
+    }
461
+    if (
462
+        $_REQUEST['page'] == '404'
463
+        and isset($_REQUEST['erreur'])
464
+    ) {
465
+        $ecran_securite_raison = "xss404";
466
+    }
467 467
 }
468 468
 
469 469
 /*
470 470
  * XSS par array
471 471
  */
472 472
 foreach (array('var_login') as $var) {
473
-	if (isset($_REQUEST[$var]) and is_array($_REQUEST[$var])) {
474
-		$ecran_securite_raison = "xss " . $var;
475
-	}
473
+    if (isset($_REQUEST[$var]) and is_array($_REQUEST[$var])) {
474
+        $ecran_securite_raison = "xss " . $var;
475
+    }
476 476
 }
477 477
 
478 478
 /*
479 479
  * Parade antivirale contre un cheval de troie
480 480
  */
481 481
 if (!function_exists('tmp_lkojfghx')) {
482
-	function tmp_lkojfghx() {}
483
-	function tmp_lkojfghx2($a = 0, $b = 0, $c = 0, $d = 0) {
484
-		// si jamais on est arrivé ici sur une erreur php
485
-		// et qu'un autre gestionnaire d'erreur est défini, l'appeller
486
-		if ($b && $GLOBALS['tmp_xhgfjokl']) {
487
-			call_user_func($GLOBALS['tmp_xhgfjokl'], $a, $b, $c, $d);
488
-		}
489
-	}
482
+    function tmp_lkojfghx() {}
483
+    function tmp_lkojfghx2($a = 0, $b = 0, $c = 0, $d = 0) {
484
+        // si jamais on est arrivé ici sur une erreur php
485
+        // et qu'un autre gestionnaire d'erreur est défini, l'appeller
486
+        if ($b && $GLOBALS['tmp_xhgfjokl']) {
487
+            call_user_func($GLOBALS['tmp_xhgfjokl'], $a, $b, $c, $d);
488
+        }
489
+    }
490 490
 }
491 491
 if (isset($_POST['tmp_lkojfghx3'])) {
492
-	$ecran_securite_raison = "gumblar";
492
+    $ecran_securite_raison = "gumblar";
493 493
 }
494 494
 
495 495
 /*
496 496
  * Outils XML mal sécurisés < 2.0.9
497 497
  */
498 498
 if (isset($_REQUEST['transformer_xml'])) {
499
-	$ecran_securite_raison = "transformer_xml";
499
+    $ecran_securite_raison = "transformer_xml";
500 500
 }
501 501
 
502 502
 /*
503 503
  * Outils XML mal sécurisés again
504 504
  */
505 505
 if (isset($_REQUEST['var_url']) and $_REQUEST['var_url'] and isset($_REQUEST['exec']) and $_REQUEST['exec'] == 'valider_xml') {
506
-	$url = trim($_REQUEST['var_url']);
507
-	if (
508
-		strncmp($url, '/', 1) == 0
509
-		or (($p = strpos($url, '..')) !== false and strpos($url, '..', $p + 3) !== false)
510
-		or (($p = strpos($url, '..')) !== false and strpos($url, 'IMG', $p + 3) !== false)
511
-		or (strpos($url, '://') !== false or strpos($url, ':\\') !== false)
512
-	) {
513
-		$ecran_securite_raison = 'URL interdite pour var_url';
514
-	}
506
+    $url = trim($_REQUEST['var_url']);
507
+    if (
508
+        strncmp($url, '/', 1) == 0
509
+        or (($p = strpos($url, '..')) !== false and strpos($url, '..', $p + 3) !== false)
510
+        or (($p = strpos($url, '..')) !== false and strpos($url, 'IMG', $p + 3) !== false)
511
+        or (strpos($url, '://') !== false or strpos($url, ':\\') !== false)
512
+    ) {
513
+        $ecran_securite_raison = 'URL interdite pour var_url';
514
+    }
515 515
 }
516 516
 
517 517
 /*
518 518
  * Sauvegarde mal securisée < 2.0.9
519 519
  */
520 520
 if (
521
-	isset($_REQUEST['nom_sauvegarde'])
522
-	and strstr((string)$_REQUEST['nom_sauvegarde'], '/')
521
+    isset($_REQUEST['nom_sauvegarde'])
522
+    and strstr((string)$_REQUEST['nom_sauvegarde'], '/')
523 523
 ) {
524
-	$ecran_securite_raison = 'nom_sauvegarde manipulee';
524
+    $ecran_securite_raison = 'nom_sauvegarde manipulee';
525 525
 }
526 526
 if (
527
-	isset($_REQUEST['znom_sauvegarde'])
528
-	and strstr((string)$_REQUEST['znom_sauvegarde'], '/')
527
+    isset($_REQUEST['znom_sauvegarde'])
528
+    and strstr((string)$_REQUEST['znom_sauvegarde'], '/')
529 529
 ) {
530
-	$ecran_securite_raison = 'znom_sauvegarde manipulee';
530
+    $ecran_securite_raison = 'znom_sauvegarde manipulee';
531 531
 }
532 532
 
533 533
 
@@ -536,57 +536,57 @@  discard block
 block discarded – undo
536 536
  * on vérifie 'page' pour ne pas bloquer ... drupal
537 537
  */
538 538
 if (
539
-	isset($_REQUEST['op']) and isset($_REQUEST['page'])
540
-	and $_REQUEST['op'] !== preg_replace('/[^\-\w]/', '', $_REQUEST['op'])
539
+    isset($_REQUEST['op']) and isset($_REQUEST['page'])
540
+    and $_REQUEST['op'] !== preg_replace('/[^\-\w]/', '', $_REQUEST['op'])
541 541
 ) {
542
-	$ecran_securite_raison = 'op';
542
+    $ecran_securite_raison = 'op';
543 543
 }
544 544
 
545 545
 /*
546 546
  * Forms & Table ne se méfiait pas assez des uploads de fichiers
547 547
  */
548 548
 if (count($_FILES)) {
549
-	foreach ($_FILES as $k => $v) {
550
-		if (
551
-			preg_match(',^fichier_\d+$,', $k)
552
-			and preg_match(',\.php,i', $v['name'])
553
-		) {
554
-			unset($_FILES[$k]);
555
-		}
556
-	}
549
+    foreach ($_FILES as $k => $v) {
550
+        if (
551
+            preg_match(',^fichier_\d+$,', $k)
552
+            and preg_match(',\.php,i', $v['name'])
553
+        ) {
554
+            unset($_FILES[$k]);
555
+        }
556
+    }
557 557
 }
558 558
 /*
559 559
  * et Contact trop laxiste avec une variable externe
560 560
  * on bloque pas le post pour eviter de perdre des donnees mais on unset la variable et c'est tout
561 561
  */
562 562
 if (isset($_REQUEST['pj_enregistrees_nom']) and $_REQUEST['pj_enregistrees_nom']) {
563
-	unset($_REQUEST['pj_enregistrees_nom']);
564
-	unset($_GET['pj_enregistrees_nom']);
565
-	unset($_POST['pj_enregistrees_nom']);
563
+    unset($_REQUEST['pj_enregistrees_nom']);
564
+    unset($_GET['pj_enregistrees_nom']);
565
+    unset($_POST['pj_enregistrees_nom']);
566 566
 }
567 567
 
568 568
 /*
569 569
  * reinstall=oui un peu trop permissif
570 570
  */
571 571
 if (
572
-	isset($_REQUEST['reinstall'])
573
-	and $_REQUEST['reinstall'] == 'oui'
572
+    isset($_REQUEST['reinstall'])
573
+    and $_REQUEST['reinstall'] == 'oui'
574 574
 ) {
575
-	$ecran_securite_raison = 'reinstall=oui';
575
+    $ecran_securite_raison = 'reinstall=oui';
576 576
 }
577 577
 
578 578
 /*
579 579
  * Pas d'action pendant l'install
580 580
  */
581 581
 if (isset($_REQUEST['exec']) and $_REQUEST['exec'] === 'install' and isset($_REQUEST['action'])) {
582
-	$ecran_securite_raison = 'install&action impossibles';
582
+    $ecran_securite_raison = 'install&action impossibles';
583 583
 }
584 584
 
585 585
 /*
586 586
  * Échappement xss referer
587 587
  */
588 588
 if (isset($_SERVER['HTTP_REFERER'])) {
589
-	$_SERVER['HTTP_REFERER'] = strtr($_SERVER['HTTP_REFERER'], '<>"\'', '[]##');
589
+    $_SERVER['HTTP_REFERER'] = strtr($_SERVER['HTTP_REFERER'], '<>"\'', '[]##');
590 590
 }
591 591
 
592 592
 
@@ -594,7 +594,7 @@  discard block
 block discarded – undo
594 594
  * Echappement HTTP_X_FORWARDED_HOST
595 595
  */
596 596
 if (isset($_SERVER['HTTP_X_FORWARDED_HOST'])) {
597
-	$_SERVER['HTTP_X_FORWARDED_HOST'] = strtr($_SERVER['HTTP_X_FORWARDED_HOST'], "<>?\"\{\}\$'` \r\n", '____________');
597
+    $_SERVER['HTTP_X_FORWARDED_HOST'] = strtr($_SERVER['HTTP_X_FORWARDED_HOST'], "<>?\"\{\}\$'` \r\n", '____________');
598 598
 }
599 599
 
600 600
 
@@ -602,9 +602,9 @@  discard block
 block discarded – undo
602 602
  * Pas d'erreur dans l'erreur
603 603
  */
604 604
 if (isset($_REQUEST['var_erreur']) and isset($_REQUEST['page']) and $_REQUEST['page'] === 'login') {
605
-	if (strlen($_REQUEST['var_erreur']) !== strcspn($_REQUEST['var_erreur'], '<>')) {
606
-		$ecran_securite_raison = 'var_erreur incorrecte';
607
-	}
605
+    if (strlen($_REQUEST['var_erreur']) !== strcspn($_REQUEST['var_erreur'], '<>')) {
606
+        $ecran_securite_raison = 'var_erreur incorrecte';
607
+    }
608 608
 }
609 609
 
610 610
 
@@ -612,53 +612,53 @@  discard block
 block discarded – undo
612 612
  * Réinjection des clés en html dans l'admin r19561
613 613
  */
614 614
 if (
615
-	(isset($_SERVER['REQUEST_URI']) and strpos($_SERVER['REQUEST_URI'], "ecrire/") !== false)
616
-	or isset($_REQUEST['var_memotri'])
615
+    (isset($_SERVER['REQUEST_URI']) and strpos($_SERVER['REQUEST_URI'], "ecrire/") !== false)
616
+    or isset($_REQUEST['var_memotri'])
617 617
 ) {
618
-	$zzzz = implode("", array_keys($_REQUEST));
619
-	if (strlen($zzzz) != strcspn($zzzz, '<>"\'')) {
620
-		$ecran_securite_raison = 'Cle incorrecte en $_REQUEST';
621
-	}
618
+    $zzzz = implode("", array_keys($_REQUEST));
619
+    if (strlen($zzzz) != strcspn($zzzz, '<>"\'')) {
620
+        $ecran_securite_raison = 'Cle incorrecte en $_REQUEST';
621
+    }
622 622
 }
623 623
 
624 624
 /*
625 625
  * Injection par connect
626 626
  */
627 627
 if (
628
-	isset($_REQUEST['connect'])
629
-	// cas qui permettent de sortir d'un commentaire PHP
630
-	and (
631
-		strpos($_REQUEST['connect'], "?") !== false
632
-		or strpos($_REQUEST['connect'], "<") !== false
633
-		or strpos($_REQUEST['connect'], ">") !== false
634
-		or strpos($_REQUEST['connect'], "\n") !== false
635
-		or strpos($_REQUEST['connect'], "\r") !== false
636
-	)
628
+    isset($_REQUEST['connect'])
629
+    // cas qui permettent de sortir d'un commentaire PHP
630
+    and (
631
+        strpos($_REQUEST['connect'], "?") !== false
632
+        or strpos($_REQUEST['connect'], "<") !== false
633
+        or strpos($_REQUEST['connect'], ">") !== false
634
+        or strpos($_REQUEST['connect'], "\n") !== false
635
+        or strpos($_REQUEST['connect'], "\r") !== false
636
+    )
637 637
 ) {
638
-	$ecran_securite_raison = "malformed connect argument";
638
+    $ecran_securite_raison = "malformed connect argument";
639 639
 }
640 640
 
641 641
 /*
642 642
  * S'il y a une raison de mourir, mourons
643 643
  */
644 644
 if (isset($ecran_securite_raison)) {
645
-	header("HTTP/1.0 403 Forbidden");
646
-	header("Expires: Wed, 11 Jan 1984 05:00:00 GMT");
647
-	header("Cache-Control: no-cache, must-revalidate");
648
-	header("Pragma: no-cache");
649
-	header("Content-Type: text/html");
650
-	header("Connection: close");
651
-	die("<html><title>Error 403: Forbidden</title><body><h1>Error 403</h1><p>You are not authorized to view this page ($ecran_securite_raison)</p></body></html>");
645
+    header("HTTP/1.0 403 Forbidden");
646
+    header("Expires: Wed, 11 Jan 1984 05:00:00 GMT");
647
+    header("Cache-Control: no-cache, must-revalidate");
648
+    header("Pragma: no-cache");
649
+    header("Content-Type: text/html");
650
+    header("Connection: close");
651
+    die("<html><title>Error 403: Forbidden</title><body><h1>Error 403</h1><p>You are not authorized to view this page ($ecran_securite_raison)</p></body></html>");
652 652
 }
653 653
 
654 654
 /*
655 655
  * Un filtre filtrer_entites securise
656 656
  */
657 657
 if (!function_exists('filtre_filtrer_entites_dist')) {
658
-	function filtre_filtrer_entites_dist($t) {
659
-		include_spip('inc/texte');
660
-		return interdire_scripts(filtrer_entites($t));
661
-	}
658
+    function filtre_filtrer_entites_dist($t) {
659
+        include_spip('inc/texte');
660
+        return interdire_scripts(filtrer_entites($t));
661
+    }
662 662
 }
663 663
 
664 664
 
@@ -672,35 +672,35 @@  discard block
 block discarded – undo
672 672
  * Bloque les bots quand le load déborde
673 673
  */
674 674
 if (!defined('_ECRAN_SECURITE_LOAD')) {
675
-	define('_ECRAN_SECURITE_LOAD', 4);
675
+    define('_ECRAN_SECURITE_LOAD', 4);
676 676
 }
677 677
 
678 678
 if (
679
-	defined('_ECRAN_SECURITE_LOAD')
680
-	and _ECRAN_SECURITE_LOAD > 0
681
-	and _IS_BOT
682
-	and !_IS_BOT_FRIEND
683
-	and $_SERVER['REQUEST_METHOD'] === 'GET'
684
-	and (
685
-		(function_exists('sys_getloadavg')
686
-			and $load = sys_getloadavg()
687
-			and is_array($load)
688
-			and $load = array_shift($load))
689
-		or
690
-		(@is_readable('/proc/loadavg')
691
-			and $load = file_get_contents('/proc/loadavg')
692
-			and $load = floatval($load))
693
-	)
694
-	and $load > _ECRAN_SECURITE_LOAD // eviter l'evaluation suivante si de toute facon le load est inferieur a la limite
695
-	and rand(0, $load * $load) > _ECRAN_SECURITE_LOAD * _ECRAN_SECURITE_LOAD
679
+    defined('_ECRAN_SECURITE_LOAD')
680
+    and _ECRAN_SECURITE_LOAD > 0
681
+    and _IS_BOT
682
+    and !_IS_BOT_FRIEND
683
+    and $_SERVER['REQUEST_METHOD'] === 'GET'
684
+    and (
685
+        (function_exists('sys_getloadavg')
686
+            and $load = sys_getloadavg()
687
+            and is_array($load)
688
+            and $load = array_shift($load))
689
+        or
690
+        (@is_readable('/proc/loadavg')
691
+            and $load = file_get_contents('/proc/loadavg')
692
+            and $load = floatval($load))
693
+    )
694
+    and $load > _ECRAN_SECURITE_LOAD // eviter l'evaluation suivante si de toute facon le load est inferieur a la limite
695
+    and rand(0, $load * $load) > _ECRAN_SECURITE_LOAD * _ECRAN_SECURITE_LOAD
696 696
 ) {
697
-	//https://webmasters.stackexchange.com/questions/65674/should-i-return-a-429-or-503-status-code-to-a-bot
698
-	header("HTTP/1.0 429 Too Many Requests");
699
-	header("Retry-After: 300");
700
-	header("Expires: Wed, 11 Jan 1984 05:00:00 GMT");
701
-	header("Cache-Control: no-cache, must-revalidate");
702
-	header("Pragma: no-cache");
703
-	header("Content-Type: text/html");
704
-	header("Connection: close");
705
-	die("<html><title>Status 429: Too Many Requests</title><body><h1>Status 429</h1><p>Too Many Requests (try again soon)</p></body></html>");
697
+    //https://webmasters.stackexchange.com/questions/65674/should-i-return-a-429-or-503-status-code-to-a-bot
698
+    header("HTTP/1.0 429 Too Many Requests");
699
+    header("Retry-After: 300");
700
+    header("Expires: Wed, 11 Jan 1984 05:00:00 GMT");
701
+    header("Cache-Control: no-cache, must-revalidate");
702
+    header("Pragma: no-cache");
703
+    header("Content-Type: text/html");
704
+    header("Connection: close");
705
+    die("<html><title>Status 429: Too Many Requests</title><body><h1>Status 429</h1><p>Too Many Requests (try again soon)</p></body></html>");
706 706
 }
Please login to merge, or discard this patch.
Spacing   +25 added lines, -25 removed lines patch added patch discarded remove patch
@@ -15,10 +15,10 @@  discard block
 block discarded – undo
15 15
  * Test utilisateur
16 16
  */
17 17
 if (isset($_GET['test_ecran_securite'])) {
18
-	$ecran_securite_raison = 'test ' . _ECRAN_SECURITE;
18
+	$ecran_securite_raison = 'test '._ECRAN_SECURITE;
19 19
 }
20 20
 
21
-if (file_exists($f = __DIR__ . DIRECTORY_SEPARATOR  . 'ecran_securite_options.php')) {
21
+if (file_exists($f = __DIR__.DIRECTORY_SEPARATOR.'ecran_securite_options.php')) {
22 22
 	include ($f);
23 23
 }
24 24
 
@@ -226,8 +226,8 @@  discard block
 block discarded – undo
226 226
 						'yats',
227 227
 						'yeti',
228 228
 						'zeerch'
229
-					)) . ',i',
230
-				(string)$_SERVER['HTTP_USER_AGENT']
229
+					)).',i',
230
+				(string) $_SERVER['HTTP_USER_AGENT']
231 231
 			)
232 232
 	);
233 233
 }
@@ -236,12 +236,12 @@  discard block
 block discarded – undo
236 236
 		'_IS_BOT_FRIEND',
237 237
 		isset($_SERVER['HTTP_USER_AGENT'])
238 238
 			and preg_match(
239
-				',' . implode('|', array(
239
+				','.implode('|', array(
240 240
 					'facebookexternalhit',
241 241
 					'flipboardproxy',
242 242
 					'wordpress'
243
-				)) . ',i',
244
-				(string)$_SERVER['HTTP_USER_AGENT']
243
+				)).',i',
244
+				(string) $_SERVER['HTTP_USER_AGENT']
245 245
 			)
246 246
 	);
247 247
 }
@@ -290,10 +290,10 @@  discard block
 block discarded – undo
290 290
  */
291 291
 foreach (array('lang', 'var_recherche', 'aide', 'var_lang_r', 'lang_r', 'var_ajax_ancre', 'nom_fichier') as $var) {
292 292
 	if (isset($_GET[$var])) {
293
-		$_REQUEST[$var] = $GLOBALS[$var] = $_GET[$var] = preg_replace(',[^\w\,/#&;-]+,', ' ', (string)$_GET[$var]);
293
+		$_REQUEST[$var] = $GLOBALS[$var] = $_GET[$var] = preg_replace(',[^\w\,/#&;-]+,', ' ', (string) $_GET[$var]);
294 294
 	}
295 295
 	if (isset($_POST[$var])) {
296
-		$_REQUEST[$var] = $GLOBALS[$var] = $_POST[$var] = preg_replace(',[^\w\,/#&;-]+,', ' ', (string)$_POST[$var]);
296
+		$_REQUEST[$var] = $GLOBALS[$var] = $_POST[$var] = preg_replace(',[^\w\,/#&;-]+,', ' ', (string) $_POST[$var]);
297 297
 	}
298 298
 }
299 299
 
@@ -301,8 +301,8 @@  discard block
 block discarded – undo
301 301
  * Filtre l'accès à spip_acces_doc (injection SQL en 1.8.2x)
302 302
  */
303 303
 if (isset($_SERVER['REQUEST_URI'])) {
304
-	if (preg_match(',^(.*/)?spip_acces_doc\.,', (string)$_SERVER['REQUEST_URI'])) {
305
-		$file = addslashes((string)$_GET['file']);
304
+	if (preg_match(',^(.*/)?spip_acces_doc\.,', (string) $_SERVER['REQUEST_URI'])) {
305
+		$file = addslashes((string) $_GET['file']);
306 306
 	}
307 307
 }
308 308
 
@@ -322,13 +322,13 @@  discard block
 block discarded – undo
322 322
  */
323 323
 if (
324 324
 	isset($_REQUEST['partie_cal'])
325
-	and $_REQUEST['partie_cal'] !== htmlentities((string)$_REQUEST['partie_cal'])
325
+	and $_REQUEST['partie_cal'] !== htmlentities((string) $_REQUEST['partie_cal'])
326 326
 ) {
327 327
 	$ecran_securite_raison = "partie_cal";
328 328
 }
329 329
 if (
330 330
 	isset($_REQUEST['echelle'])
331
-	and $_REQUEST['echelle'] !== htmlentities((string)$_REQUEST['echelle'])
331
+	and $_REQUEST['echelle'] !== htmlentities((string) $_REQUEST['echelle'])
332 332
 ) {
333 333
 	$ecran_securite_raison = "echelle";
334 334
 }
@@ -338,13 +338,13 @@  discard block
 block discarded – undo
338 338
  */
339 339
 if (
340 340
 	isset($_REQUEST['exec'])
341
-	and !preg_match(',^[\w-]+$,', (string)$_REQUEST['exec'])
341
+	and !preg_match(',^[\w-]+$,', (string) $_REQUEST['exec'])
342 342
 ) {
343 343
 	$ecran_securite_raison = "exec";
344 344
 }
345 345
 if (
346 346
 	isset($_REQUEST['cherche_auteur'])
347
-	and preg_match(',[<],', (string)$_REQUEST['cherche_auteur'])
347
+	and preg_match(',[<],', (string) $_REQUEST['cherche_auteur'])
348 348
 ) {
349 349
 	$ecran_securite_raison = "cherche_auteur";
350 350
 }
@@ -352,7 +352,7 @@  discard block
 block discarded – undo
352 352
 	isset($_REQUEST['exec'])
353 353
 	and $_REQUEST['exec'] == 'auteurs'
354 354
 	and isset($_REQUEST['recherche'])
355
-	and preg_match(',[<],', (string)$_REQUEST['recherche'])
355
+	and preg_match(',[<],', (string) $_REQUEST['recherche'])
356 356
 ) {
357 357
 	$ecran_securite_raison = "recherche";
358 358
 }
@@ -360,7 +360,7 @@  discard block
 block discarded – undo
360 360
 	isset($_REQUEST['exec'])
361 361
 	and $_REQUEST['exec'] == 'info_plugin'
362 362
 	and isset($_REQUEST['plugin'])
363
-	and preg_match(',[<],', (string)$_REQUEST['plugin'])
363
+	and preg_match(',[<],', (string) $_REQUEST['plugin'])
364 364
 ) {
365 365
 	$ecran_securite_raison = "plugin";
366 366
 }
@@ -387,7 +387,7 @@  discard block
 block discarded – undo
387 387
 				echo minipres(_T('info_acces_interdit'));
388 388
 				exit;
389 389
 			}
390
-			require _DIR_RESTREINT . 'action/configurer.php';
390
+			require _DIR_RESTREINT.'action/configurer.php';
391 391
 			action_configurer_dist();
392 392
 		}
393 393
 	}
@@ -439,9 +439,9 @@  discard block
 block discarded – undo
439 439
 if (_IS_BOT) {
440 440
 	if (
441 441
 		(isset($_REQUEST['echelle']) and isset($_REQUEST['partie_cal']) and isset($_REQUEST['type']))
442
-		or (strpos((string)$_SERVER['REQUEST_URI'], 'debut_') and preg_match(',[?&]debut_.*&debut_,', (string)$_SERVER['REQUEST_URI']))
443
-		or (isset($_REQUEST['calendrier_annee']) and strpos((string)$_SERVER['REQUEST_URI'], 'debut_'))
444
-		or (isset($_REQUEST['calendrier_annee']) and preg_match(',[?&]calendrier_annee=.*&calendrier_annee=,', (string)$_SERVER['REQUEST_URI']))
442
+		or (strpos((string) $_SERVER['REQUEST_URI'], 'debut_') and preg_match(',[?&]debut_.*&debut_,', (string) $_SERVER['REQUEST_URI']))
443
+		or (isset($_REQUEST['calendrier_annee']) and strpos((string) $_SERVER['REQUEST_URI'], 'debut_'))
444
+		or (isset($_REQUEST['calendrier_annee']) and preg_match(',[?&]calendrier_annee=.*&calendrier_annee=,', (string) $_SERVER['REQUEST_URI']))
445 445
 	) {
446 446
 		$ecran_securite_raison = "robot agenda/double pagination";
447 447
 	}
@@ -455,7 +455,7 @@  discard block
 block discarded – undo
455 455
 	if ($_REQUEST['page'] == 'test_cfg') {
456 456
 		$ecran_securite_raison = "test_cfg";
457 457
 	}
458
-	if ($_REQUEST['page'] !== htmlspecialchars((string)$_REQUEST['page'])) {
458
+	if ($_REQUEST['page'] !== htmlspecialchars((string) $_REQUEST['page'])) {
459 459
 		$ecran_securite_raison = "xsspage";
460 460
 	}
461 461
 	if (
@@ -471,7 +471,7 @@  discard block
 block discarded – undo
471 471
  */
472 472
 foreach (array('var_login') as $var) {
473 473
 	if (isset($_REQUEST[$var]) and is_array($_REQUEST[$var])) {
474
-		$ecran_securite_raison = "xss " . $var;
474
+		$ecran_securite_raison = "xss ".$var;
475 475
 	}
476 476
 }
477 477
 
@@ -519,13 +519,13 @@  discard block
 block discarded – undo
519 519
  */
520 520
 if (
521 521
 	isset($_REQUEST['nom_sauvegarde'])
522
-	and strstr((string)$_REQUEST['nom_sauvegarde'], '/')
522
+	and strstr((string) $_REQUEST['nom_sauvegarde'], '/')
523 523
 ) {
524 524
 	$ecran_securite_raison = 'nom_sauvegarde manipulee';
525 525
 }
526 526
 if (
527 527
 	isset($_REQUEST['znom_sauvegarde'])
528
-	and strstr((string)$_REQUEST['znom_sauvegarde'], '/')
528
+	and strstr((string) $_REQUEST['znom_sauvegarde'], '/')
529 529
 ) {
530 530
 	$ecran_securite_raison = 'znom_sauvegarde manipulee';
531 531
 }
Please login to merge, or discard this patch.