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