@@ -14,8 +14,9 @@ discard block |
||
| 14 | 14 | /* |
| 15 | 15 | * Test utilisateur |
| 16 | 16 | */ |
| 17 | -if (isset($_GET['test_ecran_securite'])) |
|
| 17 | +if (isset($_GET['test_ecran_securite'])) { |
|
| 18 | 18 | $ecran_securite_raison = 'test '._ECRAN_SECURITE; |
| 19 | +} |
|
| 19 | 20 | |
| 20 | 21 | /* |
| 21 | 22 | * Monitoring |
@@ -60,18 +61,21 @@ discard block |
||
| 60 | 61 | * (sauf pour id_table, qui n'est pas numérique jusqu'à [5743]) |
| 61 | 62 | * (id_base est une variable de la config des widgets de WordPress) |
| 62 | 63 | */ |
| 63 | -foreach ($_GET as $var => $val) |
|
| 64 | +foreach ($_GET as $var => $val) { |
|
| 64 | 65 | if ($_GET[$var] and strncmp($var, "id_", 3) == 0 |
| 65 | 66 | and !in_array($var, array('id_table', 'id_base'))) |
| 66 | 67 | $_GET[$var] = is_array($_GET[$var])?@array_map('intval', $_GET[$var]):intval($_GET[$var]); |
| 67 | -foreach ($_POST as $var => $val) |
|
| 68 | +} |
|
| 69 | +foreach ($_POST as $var => $val) { |
|
| 68 | 70 | if ($_POST[$var] and strncmp($var, "id_", 3) == 0 |
| 69 | 71 | and !in_array($var, array('id_table', 'id_base'))) |
| 70 | 72 | $_POST[$var] = is_array($_POST[$var])?@array_map('intval', $_POST[$var]):intval($_POST[$var]); |
| 71 | -foreach ($GLOBALS as $var => $val) |
|
| 73 | +} |
|
| 74 | +foreach ($GLOBALS as $var => $val) { |
|
| 72 | 75 | if ($GLOBALS[$var] and strncmp($var, "id_", 3) == 0 |
| 73 | 76 | and !in_array($var, array('id_table', 'id_base'))) |
| 74 | 77 | $GLOBALS[$var] = is_array($GLOBALS[$var])?@array_map('intval', $GLOBALS[$var]):intval($GLOBALS[$var]); |
| 78 | +} |
|
| 75 | 79 | |
| 76 | 80 | /* |
| 77 | 81 | * Interdit la variable $cjpeg_command, qui était utilisée sans |
@@ -83,11 +87,13 @@ discard block |
||
| 83 | 87 | * Contrôle de quelques variables (XSS) |
| 84 | 88 | */ |
| 85 | 89 | foreach(array('lang', 'var_recherche', 'aide', 'var_lang_r', 'lang_r', 'var_ajax_ancre', 'nom_fichier') as $var) { |
| 86 | - if (isset($_GET[$var])) |
|
| 87 | - $_REQUEST[$var] = $GLOBALS[$var] = $_GET[$var] = preg_replace(',[^\w\,/#&;-]+,', ' ', (string)$_GET[$var]); |
|
| 88 | - if (isset($_POST[$var])) |
|
| 89 | - $_REQUEST[$var] = $GLOBALS[$var] = $_POST[$var] = preg_replace(',[^\w\,/#&;-]+,', ' ', (string)$_POST[$var]); |
|
| 90 | -} |
|
| 90 | + if (isset($_GET[$var])) { |
|
| 91 | + $_REQUEST[$var] = $GLOBALS[$var] = $_GET[$var] = preg_replace(',[^\w\,/#&;-]+,', ' ', (string)$_GET[$var]); |
|
| 92 | + } |
|
| 93 | + if (isset($_POST[$var])) { |
|
| 94 | + $_REQUEST[$var] = $GLOBALS[$var] = $_POST[$var] = preg_replace(',[^\w\,/#&;-]+,', ' ', (string)$_POST[$var]); |
|
| 95 | + } |
|
| 96 | + } |
|
| 91 | 97 | |
| 92 | 98 | /* |
| 93 | 99 | * Filtre l'accès à spip_acces_doc (injection SQL en 1.8.2x) |
@@ -101,41 +107,49 @@ discard block |
||
| 101 | 107 | */ |
| 102 | 108 | if (isset($_REQUEST['mode']) and isset($_REQUEST['page']) |
| 103 | 109 | and !in_array($_REQUEST['mode'], array("6forum", "1comite")) |
| 104 | -and $_REQUEST['page'] == "identifiants") |
|
| 110 | +and $_REQUEST['page'] == "identifiants") { |
|
| 105 | 111 | $ecran_securite_raison = "identifiants"; |
| 112 | +} |
|
| 106 | 113 | |
| 107 | 114 | /* |
| 108 | 115 | * Agenda joue à l'injection php |
| 109 | 116 | */ |
| 110 | 117 | if (isset($_REQUEST['partie_cal']) |
| 111 | -and $_REQUEST['partie_cal'] !== htmlentities((string)$_REQUEST['partie_cal'])) |
|
| 118 | +and $_REQUEST['partie_cal'] !== htmlentities((string)$_REQUEST['partie_cal'])) { |
|
| 112 | 119 | $ecran_securite_raison = "partie_cal"; |
| 120 | +} |
|
| 113 | 121 | if (isset($_REQUEST['echelle']) |
| 114 | -and $_REQUEST['echelle'] !== htmlentities((string)$_REQUEST['echelle'])) |
|
| 122 | +and $_REQUEST['echelle'] !== htmlentities((string)$_REQUEST['echelle'])) { |
|
| 115 | 123 | $ecran_securite_raison = "echelle"; |
| 124 | +} |
|
| 116 | 125 | |
| 117 | 126 | /* |
| 118 | 127 | * Espace privé |
| 119 | 128 | */ |
| 120 | 129 | if (isset($_REQUEST['exec']) |
| 121 | -and !preg_match(',^[\w-]+$,', (string)$_REQUEST['exec'])) |
|
| 130 | +and !preg_match(',^[\w-]+$,', (string)$_REQUEST['exec'])) { |
|
| 122 | 131 | $ecran_securite_raison = "exec"; |
| 132 | +} |
|
| 123 | 133 | if (isset($_REQUEST['cherche_auteur']) |
| 124 | -and preg_match(',[<],', (string)$_REQUEST['cherche_auteur'])) |
|
| 134 | +and preg_match(',[<],', (string)$_REQUEST['cherche_auteur'])) { |
|
| 125 | 135 | $ecran_securite_raison = "cherche_auteur"; |
| 136 | +} |
|
| 126 | 137 | if (isset($_REQUEST['exec']) |
| 127 | 138 | and $_REQUEST['exec'] == 'auteurs' |
| 128 | -and preg_match(',[<],', (string)$_REQUEST['recherche'])) |
|
| 139 | +and preg_match(',[<],', (string)$_REQUEST['recherche'])) { |
|
| 129 | 140 | $ecran_securite_raison = "recherche"; |
| 141 | +} |
|
| 130 | 142 | if (isset($_REQUEST['exec']) |
| 131 | 143 | and $_REQUEST['exec'] == 'info_plugin' |
| 132 | -and preg_match(',[<],', (string)$_REQUEST['plugin'])) |
|
| 144 | +and preg_match(',[<],', (string)$_REQUEST['plugin'])) { |
|
| 133 | 145 | $ecran_securite_raison = "plugin"; |
| 146 | +} |
|
| 134 | 147 | if (isset($_REQUEST['exec']) |
| 135 | 148 | and $_REQUEST['exec'] == 'puce_statut' |
| 136 | 149 | and isset($_REQUEST['id']) |
| 137 | -and !intval($_REQUEST['id'])) |
|
| 150 | +and !intval($_REQUEST['id'])) { |
|
| 138 | 151 | $ecran_securite_raison = "puce_statut"; |
| 152 | +} |
|
| 139 | 153 | if (isset($_REQUEST['action']) |
| 140 | 154 | and $_REQUEST['action'] == 'configurer') { |
| 141 | 155 | if (@file_exists('inc_version.php') |
@@ -160,21 +174,24 @@ discard block |
||
| 160 | 174 | @get_magic_quotes_gpc() ? |
| 161 | 175 | stripslashes(serialize($_REQUEST)) : serialize($_REQUEST), |
| 162 | 176 | chr(0) |
| 163 | -) !== false) |
|
| 177 | +) !== false) { |
|
| 164 | 178 | $ecran_securite_raison = "%00"; |
| 179 | +} |
|
| 165 | 180 | |
| 166 | 181 | /* |
| 167 | 182 | * Bloque les requêtes fond=formulaire_ |
| 168 | 183 | */ |
| 169 | 184 | if (isset($_REQUEST['fond']) |
| 170 | -and preg_match(',^formulaire_,i', $_REQUEST['fond'])) |
|
| 185 | +and preg_match(',^formulaire_,i', $_REQUEST['fond'])) { |
|
| 171 | 186 | $ecran_securite_raison = "fond=formulaire_"; |
| 187 | +} |
|
| 172 | 188 | |
| 173 | 189 | /* |
| 174 | 190 | * Bloque les requêtes du type ?GLOBALS[type_urls]=toto (bug vieux php) |
| 175 | 191 | */ |
| 176 | -if (isset($_REQUEST['GLOBALS'])) |
|
| 192 | +if (isset($_REQUEST['GLOBALS'])) { |
|
| 177 | 193 | $ecran_securite_raison = "GLOBALS[GLOBALS]"; |
| 194 | +} |
|
| 178 | 195 | |
| 179 | 196 | /* |
| 180 | 197 | * Bloque les requêtes des bots sur: |
@@ -185,29 +202,34 @@ discard block |
||
| 185 | 202 | (isset($_REQUEST['echelle']) and isset($_REQUEST['partie_cal']) and isset($_REQUEST['type'])) |
| 186 | 203 | or (strpos((string)$_SERVER['REQUEST_URI'], 'debut_') and preg_match(',[?&]debut_.*&debut_,', (string)$_SERVER['REQUEST_URI'])) |
| 187 | 204 | ) |
| 188 | -) |
|
| 205 | +) { |
|
| 189 | 206 | $ecran_securite_raison = "robot agenda/double pagination"; |
| 207 | +} |
|
| 190 | 208 | |
| 191 | 209 | /* |
| 192 | 210 | * Bloque une vieille page de tests de CFG (<1.11) |
| 193 | 211 | * Bloque un XSS sur une page inexistante |
| 194 | 212 | */ |
| 195 | 213 | if (isset($_REQUEST['page'])) { |
| 196 | - if ($_REQUEST['page'] == 'test_cfg') |
|
| 197 | - $ecran_securite_raison = "test_cfg"; |
|
| 198 | - if ($_REQUEST['page'] !== htmlspecialchars((string)$_REQUEST['page'])) |
|
| 199 | - $ecran_securite_raison = "xsspage"; |
|
| 214 | + if ($_REQUEST['page'] == 'test_cfg') { |
|
| 215 | + $ecran_securite_raison = "test_cfg"; |
|
| 216 | + } |
|
| 217 | + if ($_REQUEST['page'] !== htmlspecialchars((string)$_REQUEST['page'])) { |
|
| 218 | + $ecran_securite_raison = "xsspage"; |
|
| 219 | + } |
|
| 200 | 220 | if ($_REQUEST['page'] == '404' |
| 201 | - and isset($_REQUEST['erreur'])) |
|
| 202 | - $ecran_securite_raison = "xss404"; |
|
| 203 | -} |
|
| 221 | + and isset($_REQUEST['erreur'])) { |
|
| 222 | + $ecran_securite_raison = "xss404"; |
|
| 223 | + } |
|
| 224 | + } |
|
| 204 | 225 | |
| 205 | 226 | /* |
| 206 | 227 | * XSS par array |
| 207 | 228 | */ |
| 208 | -foreach (array('var_login') as $var) |
|
| 209 | -if (isset($_REQUEST[$var]) and is_array($_REQUEST[$var])) |
|
| 229 | +foreach (array('var_login') as $var) { |
|
| 230 | + if (isset($_REQUEST[$var]) and is_array($_REQUEST[$var])) |
|
| 210 | 231 | $ecran_securite_raison = "xss ".$var; |
| 232 | +} |
|
| 211 | 233 | |
| 212 | 234 | /* |
| 213 | 235 | * Parade antivirale contre un cheval de troie |
@@ -217,18 +239,21 @@ discard block |
||
| 217 | 239 | function tmp_lkojfghx2($a = 0, $b = 0, $c = 0, $d = 0) { |
| 218 | 240 | // si jamais on est arrivé ici sur une erreur php |
| 219 | 241 | // et qu'un autre gestionnaire d'erreur est défini, l'appeller |
| 220 | - if ($b && $GLOBALS['tmp_xhgfjokl']) |
|
| 221 | - call_user_func($GLOBALS['tmp_xhgfjokl'], $a, $b, $c, $d); |
|
| 242 | + if ($b && $GLOBALS['tmp_xhgfjokl']) { |
|
| 243 | + call_user_func($GLOBALS['tmp_xhgfjokl'], $a, $b, $c, $d); |
|
| 244 | + } |
|
| 222 | 245 | } |
| 223 | 246 | } |
| 224 | -if (isset($_POST['tmp_lkojfghx3'])) |
|
| 247 | +if (isset($_POST['tmp_lkojfghx3'])) { |
|
| 225 | 248 | $ecran_securite_raison = "gumblar"; |
| 249 | +} |
|
| 226 | 250 | |
| 227 | 251 | /* |
| 228 | 252 | * Outils XML mal sécurisés < 2.0.9 |
| 229 | 253 | */ |
| 230 | -if (isset($_REQUEST['transformer_xml'])) |
|
| 254 | +if (isset($_REQUEST['transformer_xml'])) { |
|
| 231 | 255 | $ecran_securite_raison = "transformer_xml"; |
| 256 | +} |
|
| 232 | 257 | |
| 233 | 258 | /* |
| 234 | 259 | * Outils XML mal sécurisés again |
@@ -246,11 +271,13 @@ discard block |
||
| 246 | 271 | * Sauvegarde mal securisée < 2.0.9 |
| 247 | 272 | */ |
| 248 | 273 | if (isset($_REQUEST['nom_sauvegarde']) |
| 249 | -and strstr((string)$_REQUEST['nom_sauvegarde'], '/')) |
|
| 274 | +and strstr((string)$_REQUEST['nom_sauvegarde'], '/')) { |
|
| 250 | 275 | $ecran_securite_raison = 'nom_sauvegarde manipulee'; |
| 276 | +} |
|
| 251 | 277 | if (isset($_REQUEST['znom_sauvegarde']) |
| 252 | -and strstr((string)$_REQUEST['znom_sauvegarde'], '/')) |
|
| 278 | +and strstr((string)$_REQUEST['znom_sauvegarde'], '/')) { |
|
| 253 | 279 | $ecran_securite_raison = 'znom_sauvegarde manipulee'; |
| 280 | +} |
|
| 254 | 281 | |
| 255 | 282 | |
| 256 | 283 | /* |
@@ -258,8 +285,9 @@ discard block |
||
| 258 | 285 | * on vérifie 'page' pour ne pas bloquer ... drupal |
| 259 | 286 | */ |
| 260 | 287 | if (isset($_REQUEST['op']) and isset($_REQUEST['page']) |
| 261 | -and $_REQUEST['op'] !== preg_replace('/[^\-\w]/', '', $_REQUEST['op'])) |
|
| 288 | +and $_REQUEST['op'] !== preg_replace('/[^\-\w]/', '', $_REQUEST['op'])) { |
|
| 262 | 289 | $ecran_securite_raison = 'op'; |
| 290 | +} |
|
| 263 | 291 | |
| 264 | 292 | /* |
| 265 | 293 | * Forms & Table ne se méfiait pas assez des uploads de fichiers |
@@ -267,8 +295,9 @@ discard block |
||
| 267 | 295 | if (count($_FILES)){ |
| 268 | 296 | foreach($_FILES as $k => $v){ |
| 269 | 297 | if (preg_match(',^fichier_\d+$,', $k) |
| 270 | - and preg_match(',\.php,i', $v['name'])) |
|
| 271 | - unset($_FILES[$k]); |
|
| 298 | + and preg_match(',\.php,i', $v['name'])) { |
|
| 299 | + unset($_FILES[$k]); |
|
| 300 | + } |
|
| 272 | 301 | } |
| 273 | 302 | } |
| 274 | 303 | /* |
@@ -285,21 +314,24 @@ discard block |
||
| 285 | 314 | * reinstall=oui un peu trop permissif |
| 286 | 315 | */ |
| 287 | 316 | if (isset($_REQUEST['reinstall']) |
| 288 | -and $_REQUEST['reinstall'] == 'oui') |
|
| 317 | +and $_REQUEST['reinstall'] == 'oui') { |
|
| 289 | 318 | $ecran_securite_raison = 'reinstall=oui'; |
| 319 | +} |
|
| 290 | 320 | |
| 291 | 321 | /* |
| 292 | 322 | * Échappement xss referer |
| 293 | 323 | */ |
| 294 | -if (isset($_SERVER['HTTP_REFERER'])) |
|
| 324 | +if (isset($_SERVER['HTTP_REFERER'])) { |
|
| 295 | 325 | $_SERVER['HTTP_REFERER'] = strtr($_SERVER['HTTP_REFERER'], '<>"\'', '[]##'); |
| 326 | +} |
|
| 296 | 327 | |
| 297 | 328 | |
| 298 | 329 | /* |
| 299 | 330 | * Echappement HTTP_X_FORWARDED_HOST |
| 300 | 331 | */ |
| 301 | -if (isset($_SERVER['HTTP_X_FORWARDED_HOST'])) |
|
| 332 | +if (isset($_SERVER['HTTP_X_FORWARDED_HOST'])) { |
|
| 302 | 333 | $_SERVER['HTTP_X_FORWARDED_HOST'] = strtr($_SERVER['HTTP_X_FORWARDED_HOST'], "<>?\"\{\}\$'` \r\n", '____________'); |
| 334 | +} |
|
| 303 | 335 | |
| 304 | 336 | |
| 305 | 337 | /* |
@@ -307,9 +339,10 @@ discard block |
||
| 307 | 339 | */ |
| 308 | 340 | if (strpos($_SERVER['REQUEST_URI'], "ecrire/") !== false){ |
| 309 | 341 | $zzzz = implode("", array_keys($_REQUEST)); |
| 310 | - if (strlen($zzzz) != strcspn($zzzz, '<>"\'')) |
|
| 311 | - $ecran_securite_raison = 'Cle incorrecte en $_REQUEST'; |
|
| 312 | -} |
|
| 342 | + if (strlen($zzzz) != strcspn($zzzz, '<>"\'')) { |
|
| 343 | + $ecran_securite_raison = 'Cle incorrecte en $_REQUEST'; |
|
| 344 | + } |
|
| 345 | + } |
|
| 313 | 346 | |
| 314 | 347 | /* |
| 315 | 348 | * Injection par connect |
@@ -358,8 +391,9 @@ discard block |
||
| 358 | 391 | /* |
| 359 | 392 | * Bloque les bots quand le load déborde |
| 360 | 393 | */ |
| 361 | -if (!defined('_ECRAN_SECURITE_LOAD')) |
|
| 394 | +if (!defined('_ECRAN_SECURITE_LOAD')) { |
|
| 362 | 395 | define('_ECRAN_SECURITE_LOAD', 4); |
| 396 | +} |
|
| 363 | 397 | |
| 364 | 398 | if ( |
| 365 | 399 | defined('_ECRAN_SECURITE_LOAD') |
@@ -15,7 +15,7 @@ discard block |
||
| 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 | * Monitoring |
@@ -24,170 +24,170 @@ discard block |
||
| 24 | 24 | * le load depasse ECRAN_SECURITE_LOAD) |
| 25 | 25 | */ |
| 26 | 26 | if (!defined('_IS_BOT') and isset($_GET['var_isbot'])){ |
| 27 | - define('_IS_BOT', $_GET['var_isbot'] ? true : false); |
|
| 27 | + define('_IS_BOT', $_GET['var_isbot'] ? true : false); |
|
| 28 | 28 | } |
| 29 | 29 | |
| 30 | 30 | /* |
| 31 | 31 | * Détecteur de robot d'indexation |
| 32 | 32 | */ |
| 33 | 33 | if (!defined('_IS_BOT')){ |
| 34 | - define('_IS_BOT', |
|
| 35 | - isset($_SERVER['HTTP_USER_AGENT']) |
|
| 36 | - and preg_match(',' |
|
| 37 | - . implode ('|', array( |
|
| 38 | - // mots generiques |
|
| 39 | - 'bot', |
|
| 40 | - 'slurp', |
|
| 41 | - 'crawler', |
|
| 42 | - 'spider', |
|
| 43 | - 'webvac', |
|
| 44 | - 'yandex', |
|
| 45 | - 'MSIE 6\.0', // botnet 99,9% du temps |
|
| 46 | - // UA plus cibles |
|
| 47 | - '200please', |
|
| 48 | - '80legs', |
|
| 49 | - 'a6-indexer', |
|
| 50 | - 'aboundex', |
|
| 51 | - 'accoona', |
|
| 52 | - 'addthis', |
|
| 53 | - 'adressendeutschland', |
|
| 54 | - 'alexa', |
|
| 55 | - 'altavista', |
|
| 56 | - 'analyticsseo', |
|
| 57 | - 'archive', |
|
| 58 | - 'aspseek', |
|
| 59 | - 'baidu', |
|
| 60 | - 'begunadvertising', |
|
| 61 | - 'bingpreview', |
|
| 62 | - 'bloglines', |
|
| 63 | - 'browsershots', |
|
| 64 | - 'bubing', |
|
| 65 | - 'butterfly', |
|
| 66 | - 'changedetection', |
|
| 67 | - 'charlotte', |
|
| 68 | - 'chilkat', |
|
| 69 | - 'china', |
|
| 70 | - 'coccoc', |
|
| 71 | - 'crowsnest', |
|
| 72 | - 'dataminr', |
|
| 73 | - 'daumoa', |
|
| 74 | - 'dlweb', |
|
| 75 | - 'ec2linkfinder', |
|
| 76 | - 'estyle', |
|
| 77 | - 'ezooms', |
|
| 78 | - 'facebookexternalhit', |
|
| 79 | - 'facebookplatform', |
|
| 80 | - 'fairshare', |
|
| 81 | - 'feedfetcher', |
|
| 82 | - 'feedfetcher-google', |
|
| 83 | - 'feedly', |
|
| 84 | - 'fetch', |
|
| 85 | - 'flipboardproxy', |
|
| 86 | - 'genieo', |
|
| 87 | - 'google', |
|
| 88 | - 'grapeshot', |
|
| 89 | - 'hatena-useragent', |
|
| 90 | - 'head', |
|
| 91 | - 'hosttracker', |
|
| 92 | - 'hubspot', |
|
| 93 | - 'ia_archiver', |
|
| 94 | - 'ichiro', |
|
| 95 | - 'iltrovatore-setaccio', |
|
| 96 | - 'immediatenet', |
|
| 97 | - 'ina', |
|
| 98 | - 'infegyatlas', |
|
| 99 | - 'infohelfer', |
|
| 100 | - 'instapaper', |
|
| 101 | - 'jabse', |
|
| 102 | - 'james', |
|
| 103 | - 'kumkie', |
|
| 104 | - 'linkdex', |
|
| 105 | - 'linkfluence', |
|
| 106 | - 'linkwalker', |
|
| 107 | - 'litefinder', |
|
| 108 | - 'loadimpactpageanalyzer', |
|
| 109 | - 'luminate', |
|
| 110 | - 'lycos', |
|
| 111 | - 'lycosa', |
|
| 112 | - 'mediapartners-google', |
|
| 113 | - 'msai', |
|
| 114 | - 'najdi', |
|
| 115 | - 'netcraftsurveyagent', |
|
| 116 | - 'netestate', |
|
| 117 | - 'netseer', |
|
| 118 | - 'nuhk', |
|
| 119 | - 'panscient', |
|
| 120 | - 'parsijoo', |
|
| 121 | - 'plukkie', |
|
| 122 | - 'proximic', |
|
| 123 | - 'owlin', |
|
| 124 | - 'qirina', |
|
| 125 | - 'qualidator', |
|
| 126 | - 'rambler', |
|
| 127 | - 'readability', |
|
| 128 | - 'sbsearch', |
|
| 129 | - 'scooter', |
|
| 130 | - 'scrapy', |
|
| 131 | - 'scrubby', |
|
| 132 | - 'scrubbybloglines', |
|
| 133 | - 'shareaholic', |
|
| 134 | - 'shopwiki', |
|
| 135 | - 'sistrix', |
|
| 136 | - 'sitechecker', |
|
| 137 | - 'siteexplorer', |
|
| 138 | - 'sogou', |
|
| 139 | - 'special_archiver', |
|
| 140 | - 'speedy', |
|
| 141 | - 'spinn3r', |
|
| 142 | - 'spreadtrum', |
|
| 143 | - 'steeler', |
|
| 144 | - 'subscriber', |
|
| 145 | - 'suma', |
|
| 146 | - 'superdownloads', |
|
| 147 | - 'svenska-webbsido', |
|
| 148 | - 'teoma', |
|
| 149 | - 'thumbshots', |
|
| 150 | - 'tineye', |
|
| 151 | - 'trendiction', |
|
| 152 | - 'tweetedtimes', |
|
| 153 | - 'tweetmeme', |
|
| 154 | - 'uaslinkchecker', |
|
| 155 | - 'undrip', |
|
| 156 | - 'unwindfetchor', |
|
| 157 | - 'vedma', |
|
| 158 | - 'vkshare', |
|
| 159 | - 'vm', |
|
| 160 | - 'wch', |
|
| 161 | - 'webalta', |
|
| 162 | - 'webcookies', |
|
| 163 | - 'webthumbnail', |
|
| 164 | - 'wesee', |
|
| 165 | - 'wise-guys', |
|
| 166 | - 'woko', |
|
| 167 | - 'wotbox', |
|
| 168 | - 'y!j-bri', |
|
| 169 | - 'y!j-bro', |
|
| 170 | - 'y!j-brw', |
|
| 171 | - 'y!j-bsc', |
|
| 172 | - 'yahoo', |
|
| 173 | - 'yahoo!', |
|
| 174 | - 'yahooysmcm', |
|
| 175 | - 'yats', |
|
| 176 | - 'yeti', |
|
| 177 | - 'zeerch' |
|
| 178 | - )) . ',i', |
|
| 179 | - (string)$_SERVER['HTTP_USER_AGENT']) |
|
| 180 | - ); |
|
| 34 | + define('_IS_BOT', |
|
| 35 | + isset($_SERVER['HTTP_USER_AGENT']) |
|
| 36 | + and preg_match(',' |
|
| 37 | + . implode ('|', array( |
|
| 38 | + // mots generiques |
|
| 39 | + 'bot', |
|
| 40 | + 'slurp', |
|
| 41 | + 'crawler', |
|
| 42 | + 'spider', |
|
| 43 | + 'webvac', |
|
| 44 | + 'yandex', |
|
| 45 | + 'MSIE 6\.0', // botnet 99,9% du temps |
|
| 46 | + // UA plus cibles |
|
| 47 | + '200please', |
|
| 48 | + '80legs', |
|
| 49 | + 'a6-indexer', |
|
| 50 | + 'aboundex', |
|
| 51 | + 'accoona', |
|
| 52 | + 'addthis', |
|
| 53 | + 'adressendeutschland', |
|
| 54 | + 'alexa', |
|
| 55 | + 'altavista', |
|
| 56 | + 'analyticsseo', |
|
| 57 | + 'archive', |
|
| 58 | + 'aspseek', |
|
| 59 | + 'baidu', |
|
| 60 | + 'begunadvertising', |
|
| 61 | + 'bingpreview', |
|
| 62 | + 'bloglines', |
|
| 63 | + 'browsershots', |
|
| 64 | + 'bubing', |
|
| 65 | + 'butterfly', |
|
| 66 | + 'changedetection', |
|
| 67 | + 'charlotte', |
|
| 68 | + 'chilkat', |
|
| 69 | + 'china', |
|
| 70 | + 'coccoc', |
|
| 71 | + 'crowsnest', |
|
| 72 | + 'dataminr', |
|
| 73 | + 'daumoa', |
|
| 74 | + 'dlweb', |
|
| 75 | + 'ec2linkfinder', |
|
| 76 | + 'estyle', |
|
| 77 | + 'ezooms', |
|
| 78 | + 'facebookexternalhit', |
|
| 79 | + 'facebookplatform', |
|
| 80 | + 'fairshare', |
|
| 81 | + 'feedfetcher', |
|
| 82 | + 'feedfetcher-google', |
|
| 83 | + 'feedly', |
|
| 84 | + 'fetch', |
|
| 85 | + 'flipboardproxy', |
|
| 86 | + 'genieo', |
|
| 87 | + 'google', |
|
| 88 | + 'grapeshot', |
|
| 89 | + 'hatena-useragent', |
|
| 90 | + 'head', |
|
| 91 | + 'hosttracker', |
|
| 92 | + 'hubspot', |
|
| 93 | + 'ia_archiver', |
|
| 94 | + 'ichiro', |
|
| 95 | + 'iltrovatore-setaccio', |
|
| 96 | + 'immediatenet', |
|
| 97 | + 'ina', |
|
| 98 | + 'infegyatlas', |
|
| 99 | + 'infohelfer', |
|
| 100 | + 'instapaper', |
|
| 101 | + 'jabse', |
|
| 102 | + 'james', |
|
| 103 | + 'kumkie', |
|
| 104 | + 'linkdex', |
|
| 105 | + 'linkfluence', |
|
| 106 | + 'linkwalker', |
|
| 107 | + 'litefinder', |
|
| 108 | + 'loadimpactpageanalyzer', |
|
| 109 | + 'luminate', |
|
| 110 | + 'lycos', |
|
| 111 | + 'lycosa', |
|
| 112 | + 'mediapartners-google', |
|
| 113 | + 'msai', |
|
| 114 | + 'najdi', |
|
| 115 | + 'netcraftsurveyagent', |
|
| 116 | + 'netestate', |
|
| 117 | + 'netseer', |
|
| 118 | + 'nuhk', |
|
| 119 | + 'panscient', |
|
| 120 | + 'parsijoo', |
|
| 121 | + 'plukkie', |
|
| 122 | + 'proximic', |
|
| 123 | + 'owlin', |
|
| 124 | + 'qirina', |
|
| 125 | + 'qualidator', |
|
| 126 | + 'rambler', |
|
| 127 | + 'readability', |
|
| 128 | + 'sbsearch', |
|
| 129 | + 'scooter', |
|
| 130 | + 'scrapy', |
|
| 131 | + 'scrubby', |
|
| 132 | + 'scrubbybloglines', |
|
| 133 | + 'shareaholic', |
|
| 134 | + 'shopwiki', |
|
| 135 | + 'sistrix', |
|
| 136 | + 'sitechecker', |
|
| 137 | + 'siteexplorer', |
|
| 138 | + 'sogou', |
|
| 139 | + 'special_archiver', |
|
| 140 | + 'speedy', |
|
| 141 | + 'spinn3r', |
|
| 142 | + 'spreadtrum', |
|
| 143 | + 'steeler', |
|
| 144 | + 'subscriber', |
|
| 145 | + 'suma', |
|
| 146 | + 'superdownloads', |
|
| 147 | + 'svenska-webbsido', |
|
| 148 | + 'teoma', |
|
| 149 | + 'thumbshots', |
|
| 150 | + 'tineye', |
|
| 151 | + 'trendiction', |
|
| 152 | + 'tweetedtimes', |
|
| 153 | + 'tweetmeme', |
|
| 154 | + 'uaslinkchecker', |
|
| 155 | + 'undrip', |
|
| 156 | + 'unwindfetchor', |
|
| 157 | + 'vedma', |
|
| 158 | + 'vkshare', |
|
| 159 | + 'vm', |
|
| 160 | + 'wch', |
|
| 161 | + 'webalta', |
|
| 162 | + 'webcookies', |
|
| 163 | + 'webthumbnail', |
|
| 164 | + 'wesee', |
|
| 165 | + 'wise-guys', |
|
| 166 | + 'woko', |
|
| 167 | + 'wotbox', |
|
| 168 | + 'y!j-bri', |
|
| 169 | + 'y!j-bro', |
|
| 170 | + 'y!j-brw', |
|
| 171 | + 'y!j-bsc', |
|
| 172 | + 'yahoo', |
|
| 173 | + 'yahoo!', |
|
| 174 | + 'yahooysmcm', |
|
| 175 | + 'yats', |
|
| 176 | + 'yeti', |
|
| 177 | + 'zeerch' |
|
| 178 | + )) . ',i', |
|
| 179 | + (string)$_SERVER['HTTP_USER_AGENT']) |
|
| 180 | + ); |
|
| 181 | 181 | } |
| 182 | 182 | if (!defined('_IS_BOT_FRIEND')){ |
| 183 | - define('_IS_BOT_FRIEND', |
|
| 184 | - isset($_SERVER['HTTP_USER_AGENT']) |
|
| 185 | - and preg_match(',' . implode ('|', array( |
|
| 186 | - 'facebookexternalhit', |
|
| 187 | - 'flipboardproxy' |
|
| 188 | - )) . ',i', |
|
| 189 | - (string)$_SERVER['HTTP_USER_AGENT']) |
|
| 190 | - ); |
|
| 183 | + define('_IS_BOT_FRIEND', |
|
| 184 | + isset($_SERVER['HTTP_USER_AGENT']) |
|
| 185 | + and preg_match(',' . implode ('|', array( |
|
| 186 | + 'facebookexternalhit', |
|
| 187 | + 'flipboardproxy' |
|
| 188 | + )) . ',i', |
|
| 189 | + (string)$_SERVER['HTTP_USER_AGENT']) |
|
| 190 | + ); |
|
| 191 | 191 | } |
| 192 | 192 | |
| 193 | 193 | /* |
@@ -198,17 +198,17 @@ discard block |
||
| 198 | 198 | * (id_base est une variable de la config des widgets de WordPress) |
| 199 | 199 | */ |
| 200 | 200 | foreach ($_GET as $var => $val) |
| 201 | - if ($_GET[$var] and strncmp($var, "id_", 3) == 0 |
|
| 202 | - and !in_array($var, array('id_table', 'id_base'))) |
|
| 203 | - $_GET[$var] = is_array($_GET[$var])?@array_map('intval', $_GET[$var]):intval($_GET[$var]); |
|
| 201 | + if ($_GET[$var] and strncmp($var, "id_", 3) == 0 |
|
| 202 | + and !in_array($var, array('id_table', 'id_base'))) |
|
| 203 | + $_GET[$var] = is_array($_GET[$var])?@array_map('intval', $_GET[$var]):intval($_GET[$var]); |
|
| 204 | 204 | foreach ($_POST as $var => $val) |
| 205 | - if ($_POST[$var] and strncmp($var, "id_", 3) == 0 |
|
| 206 | - and !in_array($var, array('id_table', 'id_base'))) |
|
| 207 | - $_POST[$var] = is_array($_POST[$var])?@array_map('intval', $_POST[$var]):intval($_POST[$var]); |
|
| 205 | + if ($_POST[$var] and strncmp($var, "id_", 3) == 0 |
|
| 206 | + and !in_array($var, array('id_table', 'id_base'))) |
|
| 207 | + $_POST[$var] = is_array($_POST[$var])?@array_map('intval', $_POST[$var]):intval($_POST[$var]); |
|
| 208 | 208 | foreach ($GLOBALS as $var => $val) |
| 209 | - if ($GLOBALS[$var] and strncmp($var, "id_", 3) == 0 |
|
| 210 | - and !in_array($var, array('id_table', 'id_base'))) |
|
| 211 | - $GLOBALS[$var] = is_array($GLOBALS[$var])?@array_map('intval', $GLOBALS[$var]):intval($GLOBALS[$var]); |
|
| 209 | + if ($GLOBALS[$var] and strncmp($var, "id_", 3) == 0 |
|
| 210 | + and !in_array($var, array('id_table', 'id_base'))) |
|
| 211 | + $GLOBALS[$var] = is_array($GLOBALS[$var])?@array_map('intval', $GLOBALS[$var]):intval($GLOBALS[$var]); |
|
| 212 | 212 | |
| 213 | 213 | /* |
| 214 | 214 | * Interdit la variable $cjpeg_command, qui était utilisée sans |
@@ -220,17 +220,17 @@ discard block |
||
| 220 | 220 | * Contrôle de quelques variables (XSS) |
| 221 | 221 | */ |
| 222 | 222 | foreach(array('lang', 'var_recherche', 'aide', 'var_lang_r', 'lang_r', 'var_ajax_ancre', 'nom_fichier') as $var) { |
| 223 | - if (isset($_GET[$var])) |
|
| 224 | - $_REQUEST[$var] = $GLOBALS[$var] = $_GET[$var] = preg_replace(',[^\w\,/#&;-]+,', ' ', (string)$_GET[$var]); |
|
| 225 | - if (isset($_POST[$var])) |
|
| 226 | - $_REQUEST[$var] = $GLOBALS[$var] = $_POST[$var] = preg_replace(',[^\w\,/#&;-]+,', ' ', (string)$_POST[$var]); |
|
| 223 | + if (isset($_GET[$var])) |
|
| 224 | + $_REQUEST[$var] = $GLOBALS[$var] = $_GET[$var] = preg_replace(',[^\w\,/#&;-]+,', ' ', (string)$_GET[$var]); |
|
| 225 | + if (isset($_POST[$var])) |
|
| 226 | + $_REQUEST[$var] = $GLOBALS[$var] = $_POST[$var] = preg_replace(',[^\w\,/#&;-]+,', ' ', (string)$_POST[$var]); |
|
| 227 | 227 | } |
| 228 | 228 | |
| 229 | 229 | /* |
| 230 | 230 | * Filtre l'accès à spip_acces_doc (injection SQL en 1.8.2x) |
| 231 | 231 | */ |
| 232 | 232 | if (preg_match(',^(.*/)?spip_acces_doc\.,', (string)$_SERVER['REQUEST_URI'])) { |
| 233 | - $file = addslashes((string)$_GET['file']); |
|
| 233 | + $file = addslashes((string)$_GET['file']); |
|
| 234 | 234 | } |
| 235 | 235 | |
| 236 | 236 | /* |
@@ -239,79 +239,79 @@ discard block |
||
| 239 | 239 | if (isset($_REQUEST['mode']) and isset($_REQUEST['page']) |
| 240 | 240 | and !in_array($_REQUEST['mode'], array("6forum", "1comite")) |
| 241 | 241 | and $_REQUEST['page'] == "identifiants") |
| 242 | - $ecran_securite_raison = "identifiants"; |
|
| 242 | + $ecran_securite_raison = "identifiants"; |
|
| 243 | 243 | |
| 244 | 244 | /* |
| 245 | 245 | * Agenda joue à l'injection php |
| 246 | 246 | */ |
| 247 | 247 | if (isset($_REQUEST['partie_cal']) |
| 248 | 248 | and $_REQUEST['partie_cal'] !== htmlentities((string)$_REQUEST['partie_cal'])) |
| 249 | - $ecran_securite_raison = "partie_cal"; |
|
| 249 | + $ecran_securite_raison = "partie_cal"; |
|
| 250 | 250 | if (isset($_REQUEST['echelle']) |
| 251 | 251 | and $_REQUEST['echelle'] !== htmlentities((string)$_REQUEST['echelle'])) |
| 252 | - $ecran_securite_raison = "echelle"; |
|
| 252 | + $ecran_securite_raison = "echelle"; |
|
| 253 | 253 | |
| 254 | 254 | /* |
| 255 | 255 | * Espace privé |
| 256 | 256 | */ |
| 257 | 257 | if (isset($_REQUEST['exec']) |
| 258 | 258 | and !preg_match(',^[\w-]+$,', (string)$_REQUEST['exec'])) |
| 259 | - $ecran_securite_raison = "exec"; |
|
| 259 | + $ecran_securite_raison = "exec"; |
|
| 260 | 260 | if (isset($_REQUEST['cherche_auteur']) |
| 261 | 261 | and preg_match(',[<],', (string)$_REQUEST['cherche_auteur'])) |
| 262 | - $ecran_securite_raison = "cherche_auteur"; |
|
| 262 | + $ecran_securite_raison = "cherche_auteur"; |
|
| 263 | 263 | if (isset($_REQUEST['exec']) |
| 264 | 264 | and $_REQUEST['exec'] == 'auteurs' |
| 265 | 265 | and preg_match(',[<],', (string)$_REQUEST['recherche'])) |
| 266 | - $ecran_securite_raison = "recherche"; |
|
| 266 | + $ecran_securite_raison = "recherche"; |
|
| 267 | 267 | if (isset($_REQUEST['exec']) |
| 268 | 268 | and $_REQUEST['exec'] == 'info_plugin' |
| 269 | 269 | and preg_match(',[<],', (string)$_REQUEST['plugin'])) |
| 270 | - $ecran_securite_raison = "plugin"; |
|
| 270 | + $ecran_securite_raison = "plugin"; |
|
| 271 | 271 | if (isset($_REQUEST['exec']) |
| 272 | 272 | and $_REQUEST['exec'] == 'puce_statut' |
| 273 | 273 | and isset($_REQUEST['id']) |
| 274 | 274 | and !intval($_REQUEST['id'])) |
| 275 | - $ecran_securite_raison = "puce_statut"; |
|
| 275 | + $ecran_securite_raison = "puce_statut"; |
|
| 276 | 276 | if (isset($_REQUEST['action']) |
| 277 | 277 | and $_REQUEST['action'] == 'configurer') { |
| 278 | - if (@file_exists('inc_version.php') |
|
| 279 | - or @file_exists('ecrire/inc_version.php')) { |
|
| 280 | - function action_configurer() { |
|
| 281 | - include_spip('inc/autoriser'); |
|
| 282 | - if(!autoriser('configurer', _request('configuration'))) { |
|
| 283 | - include_spip('inc/minipres'); |
|
| 284 | - echo minipres(_T('info_acces_interdit')); |
|
| 285 | - exit; |
|
| 286 | - } |
|
| 287 | - require _DIR_RESTREINT.'action/configurer.php'; |
|
| 288 | - action_configurer_dist(); |
|
| 289 | - } |
|
| 290 | - } |
|
| 278 | + if (@file_exists('inc_version.php') |
|
| 279 | + or @file_exists('ecrire/inc_version.php')) { |
|
| 280 | + function action_configurer() { |
|
| 281 | + include_spip('inc/autoriser'); |
|
| 282 | + if(!autoriser('configurer', _request('configuration'))) { |
|
| 283 | + include_spip('inc/minipres'); |
|
| 284 | + echo minipres(_T('info_acces_interdit')); |
|
| 285 | + exit; |
|
| 286 | + } |
|
| 287 | + require _DIR_RESTREINT.'action/configurer.php'; |
|
| 288 | + action_configurer_dist(); |
|
| 289 | + } |
|
| 290 | + } |
|
| 291 | 291 | } |
| 292 | 292 | |
| 293 | 293 | /* |
| 294 | 294 | * Bloque les requêtes contenant %00 (manipulation d'include) |
| 295 | 295 | */ |
| 296 | 296 | if (strpos( |
| 297 | - @get_magic_quotes_gpc() ? |
|
| 298 | - stripslashes(serialize($_REQUEST)) : serialize($_REQUEST), |
|
| 299 | - chr(0) |
|
| 297 | + @get_magic_quotes_gpc() ? |
|
| 298 | + stripslashes(serialize($_REQUEST)) : serialize($_REQUEST), |
|
| 299 | + chr(0) |
|
| 300 | 300 | ) !== false) |
| 301 | - $ecran_securite_raison = "%00"; |
|
| 301 | + $ecran_securite_raison = "%00"; |
|
| 302 | 302 | |
| 303 | 303 | /* |
| 304 | 304 | * Bloque les requêtes fond=formulaire_ |
| 305 | 305 | */ |
| 306 | 306 | if (isset($_REQUEST['fond']) |
| 307 | 307 | and preg_match(',^formulaire_,i', $_REQUEST['fond'])) |
| 308 | - $ecran_securite_raison = "fond=formulaire_"; |
|
| 308 | + $ecran_securite_raison = "fond=formulaire_"; |
|
| 309 | 309 | |
| 310 | 310 | /* |
| 311 | 311 | * Bloque les requêtes du type ?GLOBALS[type_urls]=toto (bug vieux php) |
| 312 | 312 | */ |
| 313 | 313 | if (isset($_REQUEST['GLOBALS'])) |
| 314 | - $ecran_securite_raison = "GLOBALS[GLOBALS]"; |
|
| 314 | + $ecran_securite_raison = "GLOBALS[GLOBALS]"; |
|
| 315 | 315 | |
| 316 | 316 | /* |
| 317 | 317 | * Bloque les requêtes des bots sur: |
@@ -319,24 +319,24 @@ discard block |
||
| 319 | 319 | * les paginations entremélées |
| 320 | 320 | */ |
| 321 | 321 | if (_IS_BOT and ( |
| 322 | - (isset($_REQUEST['echelle']) and isset($_REQUEST['partie_cal']) and isset($_REQUEST['type'])) |
|
| 323 | - or (strpos((string)$_SERVER['REQUEST_URI'], 'debut_') and preg_match(',[?&]debut_.*&debut_,', (string)$_SERVER['REQUEST_URI'])) |
|
| 322 | + (isset($_REQUEST['echelle']) and isset($_REQUEST['partie_cal']) and isset($_REQUEST['type'])) |
|
| 323 | + or (strpos((string)$_SERVER['REQUEST_URI'], 'debut_') and preg_match(',[?&]debut_.*&debut_,', (string)$_SERVER['REQUEST_URI'])) |
|
| 324 | 324 | ) |
| 325 | 325 | ) |
| 326 | - $ecran_securite_raison = "robot agenda/double pagination"; |
|
| 326 | + $ecran_securite_raison = "robot agenda/double pagination"; |
|
| 327 | 327 | |
| 328 | 328 | /* |
| 329 | 329 | * Bloque une vieille page de tests de CFG (<1.11) |
| 330 | 330 | * Bloque un XSS sur une page inexistante |
| 331 | 331 | */ |
| 332 | 332 | if (isset($_REQUEST['page'])) { |
| 333 | - if ($_REQUEST['page'] == 'test_cfg') |
|
| 334 | - $ecran_securite_raison = "test_cfg"; |
|
| 335 | - if ($_REQUEST['page'] !== htmlspecialchars((string)$_REQUEST['page'])) |
|
| 336 | - $ecran_securite_raison = "xsspage"; |
|
| 337 | - if ($_REQUEST['page'] == '404' |
|
| 338 | - and isset($_REQUEST['erreur'])) |
|
| 339 | - $ecran_securite_raison = "xss404"; |
|
| 333 | + if ($_REQUEST['page'] == 'test_cfg') |
|
| 334 | + $ecran_securite_raison = "test_cfg"; |
|
| 335 | + if ($_REQUEST['page'] !== htmlspecialchars((string)$_REQUEST['page'])) |
|
| 336 | + $ecran_securite_raison = "xsspage"; |
|
| 337 | + if ($_REQUEST['page'] == '404' |
|
| 338 | + and isset($_REQUEST['erreur'])) |
|
| 339 | + $ecran_securite_raison = "xss404"; |
|
| 340 | 340 | } |
| 341 | 341 | |
| 342 | 342 | /* |
@@ -344,40 +344,40 @@ discard block |
||
| 344 | 344 | */ |
| 345 | 345 | foreach (array('var_login') as $var) |
| 346 | 346 | if (isset($_REQUEST[$var]) and is_array($_REQUEST[$var])) |
| 347 | - $ecran_securite_raison = "xss ".$var; |
|
| 347 | + $ecran_securite_raison = "xss ".$var; |
|
| 348 | 348 | |
| 349 | 349 | /* |
| 350 | 350 | * Parade antivirale contre un cheval de troie |
| 351 | 351 | */ |
| 352 | 352 | if (!function_exists('tmp_lkojfghx')) { |
| 353 | - function tmp_lkojfghx() {} |
|
| 354 | - function tmp_lkojfghx2($a = 0, $b = 0, $c = 0, $d = 0) { |
|
| 355 | - // si jamais on est arrivé ici sur une erreur php |
|
| 356 | - // et qu'un autre gestionnaire d'erreur est défini, l'appeller |
|
| 357 | - if ($b && $GLOBALS['tmp_xhgfjokl']) |
|
| 358 | - call_user_func($GLOBALS['tmp_xhgfjokl'], $a, $b, $c, $d); |
|
| 359 | - } |
|
| 353 | + function tmp_lkojfghx() {} |
|
| 354 | + function tmp_lkojfghx2($a = 0, $b = 0, $c = 0, $d = 0) { |
|
| 355 | + // si jamais on est arrivé ici sur une erreur php |
|
| 356 | + // et qu'un autre gestionnaire d'erreur est défini, l'appeller |
|
| 357 | + if ($b && $GLOBALS['tmp_xhgfjokl']) |
|
| 358 | + call_user_func($GLOBALS['tmp_xhgfjokl'], $a, $b, $c, $d); |
|
| 359 | + } |
|
| 360 | 360 | } |
| 361 | 361 | if (isset($_POST['tmp_lkojfghx3'])) |
| 362 | - $ecran_securite_raison = "gumblar"; |
|
| 362 | + $ecran_securite_raison = "gumblar"; |
|
| 363 | 363 | |
| 364 | 364 | /* |
| 365 | 365 | * Outils XML mal sécurisés < 2.0.9 |
| 366 | 366 | */ |
| 367 | 367 | if (isset($_REQUEST['transformer_xml'])) |
| 368 | - $ecran_securite_raison = "transformer_xml"; |
|
| 368 | + $ecran_securite_raison = "transformer_xml"; |
|
| 369 | 369 | |
| 370 | 370 | /* |
| 371 | 371 | * Outils XML mal sécurisés again |
| 372 | 372 | */ |
| 373 | 373 | if (isset($_REQUEST['var_url']) and $_REQUEST['var_url'] and isset($_REQUEST['exec']) and $_REQUEST['exec']=='valider_xml'){ |
| 374 | - $url = trim($_REQUEST['var_url']); |
|
| 375 | - if (strncmp($url,'/',1)==0 |
|
| 376 | - or (($p=strpos($url,'..'))!==false AND strpos($url,'..',$p+3)!==false) |
|
| 377 | - or (($p=strpos($url,'..'))!==false AND strpos($url,'IMG',$p+3)!==false) |
|
| 378 | - or (strpos($url,'://')!==false or strpos($url,':\\')!==false)) { |
|
| 379 | - $ecran_securite_raison = 'URL interdite pour var_url'; |
|
| 380 | - } |
|
| 374 | + $url = trim($_REQUEST['var_url']); |
|
| 375 | + if (strncmp($url,'/',1)==0 |
|
| 376 | + or (($p=strpos($url,'..'))!==false AND strpos($url,'..',$p+3)!==false) |
|
| 377 | + or (($p=strpos($url,'..'))!==false AND strpos($url,'IMG',$p+3)!==false) |
|
| 378 | + or (strpos($url,'://')!==false or strpos($url,':\\')!==false)) { |
|
| 379 | + $ecran_securite_raison = 'URL interdite pour var_url'; |
|
| 380 | + } |
|
| 381 | 381 | } |
| 382 | 382 | |
| 383 | 383 | /* |
@@ -385,10 +385,10 @@ discard block |
||
| 385 | 385 | */ |
| 386 | 386 | if (isset($_REQUEST['nom_sauvegarde']) |
| 387 | 387 | and strstr((string)$_REQUEST['nom_sauvegarde'], '/')) |
| 388 | - $ecran_securite_raison = 'nom_sauvegarde manipulee'; |
|
| 388 | + $ecran_securite_raison = 'nom_sauvegarde manipulee'; |
|
| 389 | 389 | if (isset($_REQUEST['znom_sauvegarde']) |
| 390 | 390 | and strstr((string)$_REQUEST['znom_sauvegarde'], '/')) |
| 391 | - $ecran_securite_raison = 'znom_sauvegarde manipulee'; |
|
| 391 | + $ecran_securite_raison = 'znom_sauvegarde manipulee'; |
|
| 392 | 392 | |
| 393 | 393 | |
| 394 | 394 | /* |
@@ -397,26 +397,26 @@ discard block |
||
| 397 | 397 | */ |
| 398 | 398 | if (isset($_REQUEST['op']) and isset($_REQUEST['page']) |
| 399 | 399 | and $_REQUEST['op'] !== preg_replace('/[^\-\w]/', '', $_REQUEST['op'])) |
| 400 | - $ecran_securite_raison = 'op'; |
|
| 400 | + $ecran_securite_raison = 'op'; |
|
| 401 | 401 | |
| 402 | 402 | /* |
| 403 | 403 | * Forms & Table ne se méfiait pas assez des uploads de fichiers |
| 404 | 404 | */ |
| 405 | 405 | if (count($_FILES)){ |
| 406 | - foreach($_FILES as $k => $v){ |
|
| 407 | - if (preg_match(',^fichier_\d+$,', $k) |
|
| 408 | - and preg_match(',\.php,i', $v['name'])) |
|
| 409 | - unset($_FILES[$k]); |
|
| 410 | - } |
|
| 406 | + foreach($_FILES as $k => $v){ |
|
| 407 | + if (preg_match(',^fichier_\d+$,', $k) |
|
| 408 | + and preg_match(',\.php,i', $v['name'])) |
|
| 409 | + unset($_FILES[$k]); |
|
| 410 | + } |
|
| 411 | 411 | } |
| 412 | 412 | /* |
| 413 | 413 | * et Contact trop laxiste avec une variable externe |
| 414 | 414 | * on bloque pas le post pour eviter de perdre des donnees mais on unset la variable et c'est tout |
| 415 | 415 | */ |
| 416 | 416 | if (isset($_REQUEST['pj_enregistrees_nom']) and $_REQUEST['pj_enregistrees_nom']){ |
| 417 | - unset($_REQUEST['pj_enregistrees_nom']); |
|
| 418 | - unset($_GET['pj_enregistrees_nom']); |
|
| 419 | - unset($_POST['pj_enregistrees_nom']); |
|
| 417 | + unset($_REQUEST['pj_enregistrees_nom']); |
|
| 418 | + unset($_GET['pj_enregistrees_nom']); |
|
| 419 | + unset($_POST['pj_enregistrees_nom']); |
|
| 420 | 420 | } |
| 421 | 421 | |
| 422 | 422 | /* |
@@ -424,66 +424,66 @@ discard block |
||
| 424 | 424 | */ |
| 425 | 425 | if (isset($_REQUEST['reinstall']) |
| 426 | 426 | and $_REQUEST['reinstall'] == 'oui') |
| 427 | - $ecran_securite_raison = 'reinstall=oui'; |
|
| 427 | + $ecran_securite_raison = 'reinstall=oui'; |
|
| 428 | 428 | |
| 429 | 429 | /* |
| 430 | 430 | * Échappement xss referer |
| 431 | 431 | */ |
| 432 | 432 | if (isset($_SERVER['HTTP_REFERER'])) |
| 433 | - $_SERVER['HTTP_REFERER'] = strtr($_SERVER['HTTP_REFERER'], '<>"\'', '[]##'); |
|
| 433 | + $_SERVER['HTTP_REFERER'] = strtr($_SERVER['HTTP_REFERER'], '<>"\'', '[]##'); |
|
| 434 | 434 | |
| 435 | 435 | |
| 436 | 436 | /* |
| 437 | 437 | * Echappement HTTP_X_FORWARDED_HOST |
| 438 | 438 | */ |
| 439 | 439 | if (isset($_SERVER['HTTP_X_FORWARDED_HOST'])) |
| 440 | - $_SERVER['HTTP_X_FORWARDED_HOST'] = strtr($_SERVER['HTTP_X_FORWARDED_HOST'], "<>?\"\{\}\$'` \r\n", '____________'); |
|
| 440 | + $_SERVER['HTTP_X_FORWARDED_HOST'] = strtr($_SERVER['HTTP_X_FORWARDED_HOST'], "<>?\"\{\}\$'` \r\n", '____________'); |
|
| 441 | 441 | |
| 442 | 442 | |
| 443 | 443 | /* |
| 444 | 444 | * Réinjection des clés en html dans l'admin r19561 |
| 445 | 445 | */ |
| 446 | 446 | if (strpos($_SERVER['REQUEST_URI'], "ecrire/") !== false){ |
| 447 | - $zzzz = implode("", array_keys($_REQUEST)); |
|
| 448 | - if (strlen($zzzz) != strcspn($zzzz, '<>"\'')) |
|
| 449 | - $ecran_securite_raison = 'Cle incorrecte en $_REQUEST'; |
|
| 447 | + $zzzz = implode("", array_keys($_REQUEST)); |
|
| 448 | + if (strlen($zzzz) != strcspn($zzzz, '<>"\'')) |
|
| 449 | + $ecran_securite_raison = 'Cle incorrecte en $_REQUEST'; |
|
| 450 | 450 | } |
| 451 | 451 | |
| 452 | 452 | /* |
| 453 | 453 | * Injection par connect |
| 454 | 454 | */ |
| 455 | 455 | if (isset($_REQUEST['connect']) |
| 456 | - and |
|
| 457 | - // cas qui permettent de sortir d'un commentaire PHP |
|
| 458 | - (strpos($_REQUEST['connect'], "?") !== false |
|
| 459 | - or strpos($_REQUEST['connect'], "<") !== false |
|
| 460 | - or strpos($_REQUEST['connect'], ">") !== false |
|
| 461 | - or strpos($_REQUEST['connect'], "\n") !== false |
|
| 462 | - or strpos($_REQUEST['connect'], "\r") !== false) |
|
| 463 | - ) { |
|
| 464 | - $ecran_securite_raison = "malformed connect argument"; |
|
| 456 | + and |
|
| 457 | + // cas qui permettent de sortir d'un commentaire PHP |
|
| 458 | + (strpos($_REQUEST['connect'], "?") !== false |
|
| 459 | + or strpos($_REQUEST['connect'], "<") !== false |
|
| 460 | + or strpos($_REQUEST['connect'], ">") !== false |
|
| 461 | + or strpos($_REQUEST['connect'], "\n") !== false |
|
| 462 | + or strpos($_REQUEST['connect'], "\r") !== false) |
|
| 463 | + ) { |
|
| 464 | + $ecran_securite_raison = "malformed connect argument"; |
|
| 465 | 465 | } |
| 466 | 466 | |
| 467 | 467 | /* |
| 468 | 468 | * S'il y a une raison de mourir, mourons |
| 469 | 469 | */ |
| 470 | 470 | if (isset($ecran_securite_raison)) { |
| 471 | - header("HTTP/1.0 403 Forbidden"); |
|
| 472 | - header("Expires: Wed, 11 Jan 1984 05:00:00 GMT"); |
|
| 473 | - header("Cache-Control: no-cache, must-revalidate"); |
|
| 474 | - header("Pragma: no-cache"); |
|
| 475 | - header("Content-Type: text/html"); |
|
| 476 | - 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>"); |
|
| 471 | + header("HTTP/1.0 403 Forbidden"); |
|
| 472 | + header("Expires: Wed, 11 Jan 1984 05:00:00 GMT"); |
|
| 473 | + header("Cache-Control: no-cache, must-revalidate"); |
|
| 474 | + header("Pragma: no-cache"); |
|
| 475 | + header("Content-Type: text/html"); |
|
| 476 | + 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>"); |
|
| 477 | 477 | } |
| 478 | 478 | |
| 479 | 479 | /* |
| 480 | 480 | * Un filtre filtrer_entites securise |
| 481 | 481 | */ |
| 482 | 482 | if (!function_exists('filtre_filtrer_entites_dist')) { |
| 483 | - function filtre_filtrer_entites_dist($t) { |
|
| 484 | - include_spip('inc/texte'); |
|
| 485 | - return interdire_scripts(filtrer_entites($t)); |
|
| 486 | - } |
|
| 483 | + function filtre_filtrer_entites_dist($t) { |
|
| 484 | + include_spip('inc/texte'); |
|
| 485 | + return interdire_scripts(filtrer_entites($t)); |
|
| 486 | + } |
|
| 487 | 487 | } |
| 488 | 488 | |
| 489 | 489 | |
@@ -497,34 +497,34 @@ discard block |
||
| 497 | 497 | * Bloque les bots quand le load déborde |
| 498 | 498 | */ |
| 499 | 499 | if (!defined('_ECRAN_SECURITE_LOAD')) |
| 500 | - define('_ECRAN_SECURITE_LOAD', 4); |
|
| 500 | + define('_ECRAN_SECURITE_LOAD', 4); |
|
| 501 | 501 | |
| 502 | 502 | if ( |
| 503 | - defined('_ECRAN_SECURITE_LOAD') |
|
| 504 | - and _ECRAN_SECURITE_LOAD > 0 |
|
| 505 | - and _IS_BOT |
|
| 506 | - and !_IS_BOT_FRIEND |
|
| 507 | - and $_SERVER['REQUEST_METHOD'] === 'GET' |
|
| 508 | - and ( |
|
| 509 | - (function_exists('sys_getloadavg') |
|
| 510 | - and $load = sys_getloadavg() |
|
| 511 | - and is_array($load) |
|
| 512 | - and $load = array_shift($load) |
|
| 513 | - ) |
|
| 514 | - or |
|
| 515 | - (@is_readable('/proc/loadavg') |
|
| 516 | - and $load = file_get_contents('/proc/loadavg') |
|
| 517 | - and $load = floatval($load) |
|
| 518 | - ) |
|
| 519 | - ) |
|
| 520 | - and $load > _ECRAN_SECURITE_LOAD // eviter l'evaluation suivante si de toute facon le load est inferieur a la limite |
|
| 521 | - and rand(0, $load * $load) > _ECRAN_SECURITE_LOAD * _ECRAN_SECURITE_LOAD |
|
| 503 | + defined('_ECRAN_SECURITE_LOAD') |
|
| 504 | + and _ECRAN_SECURITE_LOAD > 0 |
|
| 505 | + and _IS_BOT |
|
| 506 | + and !_IS_BOT_FRIEND |
|
| 507 | + and $_SERVER['REQUEST_METHOD'] === 'GET' |
|
| 508 | + and ( |
|
| 509 | + (function_exists('sys_getloadavg') |
|
| 510 | + and $load = sys_getloadavg() |
|
| 511 | + and is_array($load) |
|
| 512 | + and $load = array_shift($load) |
|
| 513 | + ) |
|
| 514 | + or |
|
| 515 | + (@is_readable('/proc/loadavg') |
|
| 516 | + and $load = file_get_contents('/proc/loadavg') |
|
| 517 | + and $load = floatval($load) |
|
| 518 | + ) |
|
| 519 | + ) |
|
| 520 | + and $load > _ECRAN_SECURITE_LOAD // eviter l'evaluation suivante si de toute facon le load est inferieur a la limite |
|
| 521 | + and rand(0, $load * $load) > _ECRAN_SECURITE_LOAD * _ECRAN_SECURITE_LOAD |
|
| 522 | 522 | ) { |
| 523 | - header("HTTP/1.0 503 Service Unavailable"); |
|
| 524 | - header("Retry-After: 300"); |
|
| 525 | - header("Expires: Wed, 11 Jan 1984 05:00:00 GMT"); |
|
| 526 | - header("Cache-Control: no-cache, must-revalidate"); |
|
| 527 | - header("Pragma: no-cache"); |
|
| 528 | - header("Content-Type: text/html"); |
|
| 529 | - die("<html><title>Status 503: Site temporarily unavailable</title><body><h1>Status 503</h1><p>Site temporarily unavailable (load average $load)</p></body></html>"); |
|
| 523 | + header("HTTP/1.0 503 Service Unavailable"); |
|
| 524 | + header("Retry-After: 300"); |
|
| 525 | + header("Expires: Wed, 11 Jan 1984 05:00:00 GMT"); |
|
| 526 | + header("Cache-Control: no-cache, must-revalidate"); |
|
| 527 | + header("Pragma: no-cache"); |
|
| 528 | + header("Content-Type: text/html"); |
|
| 529 | + die("<html><title>Status 503: Site temporarily unavailable</title><body><h1>Status 503</h1><p>Site temporarily unavailable (load average $load)</p></body></html>"); |
|
| 530 | 530 | } |
@@ -1,3 +1,3 @@ |
||
| 1 | 1 | <?php |
| 2 | - # appel SPIP |
|
| 3 | - include('spip.php'); |
|
| 2 | + # appel SPIP |
|
| 3 | + include('spip.php'); |
|
@@ -11,24 +11,24 @@ |
||
| 11 | 11 | \***************************************************************************/ |
| 12 | 12 | |
| 13 | 13 | if (!defined('_ECRIRE_INC_VERSION')) { |
| 14 | - return; |
|
| 14 | + return; |
|
| 15 | 15 | } |
| 16 | 16 | |
| 17 | 17 | function lister_traductions($id_trad, $objet) { |
| 18 | - $table_objet_sql = table_objet_sql($objet); |
|
| 19 | - $primary = id_table_objet($objet); |
|
| 18 | + $table_objet_sql = table_objet_sql($objet); |
|
| 19 | + $primary = id_table_objet($objet); |
|
| 20 | 20 | |
| 21 | - $select = "$primary as id,lang"; |
|
| 22 | - $where = 'id_trad=' . intval($id_trad); |
|
| 23 | - $trouver_table = charger_fonction('trouver_table','base'); |
|
| 24 | - $desc = $trouver_table($table_objet_sql); |
|
| 25 | - if (isset($desc['field']['statut'])) { |
|
| 26 | - $select .= ',statut'; |
|
| 27 | - $where .= ' AND statut!='.sql_quote('poubelle'); |
|
| 28 | - } |
|
| 21 | + $select = "$primary as id,lang"; |
|
| 22 | + $where = 'id_trad=' . intval($id_trad); |
|
| 23 | + $trouver_table = charger_fonction('trouver_table','base'); |
|
| 24 | + $desc = $trouver_table($table_objet_sql); |
|
| 25 | + if (isset($desc['field']['statut'])) { |
|
| 26 | + $select .= ',statut'; |
|
| 27 | + $where .= ' AND statut!='.sql_quote('poubelle'); |
|
| 28 | + } |
|
| 29 | 29 | |
| 30 | - $rows = sql_allfetsel($select, $table_objet_sql, $where); |
|
| 31 | - lang_select(); |
|
| 30 | + $rows = sql_allfetsel($select, $table_objet_sql, $where); |
|
| 31 | + lang_select(); |
|
| 32 | 32 | |
| 33 | - return $rows; |
|
| 33 | + return $rows; |
|
| 34 | 34 | } |
@@ -11,7 +11,7 @@ |
||
| 11 | 11 | \***************************************************************************/ |
| 12 | 12 | |
| 13 | 13 | if (!defined('_ECRIRE_INC_VERSION')) { |
| 14 | - return; |
|
| 14 | + return; |
|
| 15 | 15 | } |
| 16 | 16 | |
| 17 | 17 | include_spip('prive/objets/liste/auteurs_fonctions'); |
@@ -11,7 +11,7 @@ |
||
| 11 | 11 | \***************************************************************************/ |
| 12 | 12 | |
| 13 | 13 | if (!defined('_ECRIRE_INC_VERSION')) { |
| 14 | - return; |
|
| 14 | + return; |
|
| 15 | 15 | } |
| 16 | 16 | |
| 17 | 17 | include_spip('inc/drapeau_edition'); |
@@ -16,7 +16,7 @@ discard block |
||
| 16 | 16 | * @package SPIP\Core\Fonctions |
| 17 | 17 | **/ |
| 18 | 18 | if (!defined('_ECRIRE_INC_VERSION')) { |
| 19 | - return; |
|
| 19 | + return; |
|
| 20 | 20 | } |
| 21 | 21 | |
| 22 | 22 | /** |
@@ -29,29 +29,29 @@ discard block |
||
| 29 | 29 | * @param <type> $left |
| 30 | 30 | */ |
| 31 | 31 | function critere_compteur_articles_filtres_dist($idb, &$boucles, $crit, $left = false) { |
| 32 | - $boucle = &$boucles[$idb]; |
|
| 32 | + $boucle = &$boucles[$idb]; |
|
| 33 | 33 | |
| 34 | - $_statut = calculer_liste($crit->param[0], array(), $boucles, $boucle->id_parent); |
|
| 34 | + $_statut = calculer_liste($crit->param[0], array(), $boucles, $boucle->id_parent); |
|
| 35 | 35 | |
| 36 | - $not = ''; |
|
| 37 | - if ($crit->not) { |
|
| 38 | - $not = ", 'NOT'"; |
|
| 39 | - } |
|
| 40 | - $boucle->from['LAA'] = 'spip_auteurs_liens'; |
|
| 41 | - $boucle->from_type['LAA'] = 'left'; |
|
| 42 | - $boucle->join['LAA'] = array("'auteurs'", "'id_auteur'", "'id_auteur'", "'LAA.objet=\'article\''"); |
|
| 36 | + $not = ''; |
|
| 37 | + if ($crit->not) { |
|
| 38 | + $not = ", 'NOT'"; |
|
| 39 | + } |
|
| 40 | + $boucle->from['LAA'] = 'spip_auteurs_liens'; |
|
| 41 | + $boucle->from_type['LAA'] = 'left'; |
|
| 42 | + $boucle->join['LAA'] = array("'auteurs'", "'id_auteur'", "'id_auteur'", "'LAA.objet=\'article\''"); |
|
| 43 | 43 | |
| 44 | - $boucle->from['articles'] = 'spip_articles'; |
|
| 45 | - $boucle->from_type['articles'] = 'left'; |
|
| 46 | - $boucle->join['articles'] = array( |
|
| 47 | - "'LAA'", |
|
| 48 | - "'id_article'", |
|
| 49 | - "'id_objet'", |
|
| 50 | - "'(articles.statut IS NULL OR '.sql_in('articles.statut',_q($_statut)$not).')'" |
|
| 51 | - ); |
|
| 44 | + $boucle->from['articles'] = 'spip_articles'; |
|
| 45 | + $boucle->from_type['articles'] = 'left'; |
|
| 46 | + $boucle->join['articles'] = array( |
|
| 47 | + "'LAA'", |
|
| 48 | + "'id_article'", |
|
| 49 | + "'id_objet'", |
|
| 50 | + "'(articles.statut IS NULL OR '.sql_in('articles.statut',_q($_statut)$not).')'" |
|
| 51 | + ); |
|
| 52 | 52 | |
| 53 | - $boucle->select[] = 'COUNT(articles.id_article) AS compteur_articles'; |
|
| 54 | - $boucle->group[] = 'auteurs.id_auteur'; |
|
| 53 | + $boucle->select[] = 'COUNT(articles.id_article) AS compteur_articles'; |
|
| 54 | + $boucle->group[] = 'auteurs.id_auteur'; |
|
| 55 | 55 | } |
| 56 | 56 | |
| 57 | 57 | /** |
@@ -69,7 +69,7 @@ discard block |
||
| 69 | 69 | * Pile complétée par le code à générer |
| 70 | 70 | */ |
| 71 | 71 | function balise_COMPTEUR_ARTICLES_dist($p) { |
| 72 | - return rindex_pile($p, 'compteur_articles', 'compteur_articles_filtres'); |
|
| 72 | + return rindex_pile($p, 'compteur_articles', 'compteur_articles_filtres'); |
|
| 73 | 73 | } |
| 74 | 74 | |
| 75 | 75 | |
@@ -85,42 +85,42 @@ discard block |
||
| 85 | 85 | * @return <type> |
| 86 | 86 | */ |
| 87 | 87 | function afficher_initiale($url, $initiale, $compteur, $debut, $pas) { |
| 88 | - static $memo = null; |
|
| 89 | - static $res = array(); |
|
| 90 | - $out = ''; |
|
| 91 | - if (!$memo |
|
| 92 | - or (!$initiale and !$url) |
|
| 93 | - or ($initiale !== $memo['initiale']) |
|
| 94 | - ) { |
|
| 95 | - $newcompt = intval(floor(($compteur - 1) / $pas) * $pas); |
|
| 96 | - // si fin de la pagination et une seule entree, ne pas l'afficher, ca ne sert a rien |
|
| 97 | - if (!$initiale and !$url and !$memo['compteur']) { |
|
| 98 | - $memo = null; |
|
| 99 | - } |
|
| 100 | - if ($memo) { |
|
| 101 | - $on = (($memo['compteur'] <= $debut) |
|
| 102 | - and ( |
|
| 103 | - $newcompt > $debut or ($newcompt == $debut and $newcompt == $memo['compteur']) |
|
| 104 | - )); |
|
| 105 | - $res[] = lien_ou_expose($memo['url'], $memo['initiale'], $on, 'lien_pagination'); |
|
| 106 | - } |
|
| 107 | - if ($initiale) { |
|
| 108 | - $memo = array( |
|
| 109 | - 'entree' => isset($memo['entree']) ? $memo['entree'] + 1 : 0, |
|
| 110 | - 'initiale' => $initiale, |
|
| 111 | - 'url' => parametre_url($url, 'i', $initiale), |
|
| 112 | - 'compteur' => $newcompt |
|
| 113 | - ); |
|
| 114 | - } |
|
| 115 | - } |
|
| 116 | - if (!$initiale and !$url) { |
|
| 117 | - if (count($res) > 1) { |
|
| 118 | - $out = implode(' ', $res); |
|
| 119 | - } |
|
| 120 | - $memo = $res = null; |
|
| 121 | - } |
|
| 88 | + static $memo = null; |
|
| 89 | + static $res = array(); |
|
| 90 | + $out = ''; |
|
| 91 | + if (!$memo |
|
| 92 | + or (!$initiale and !$url) |
|
| 93 | + or ($initiale !== $memo['initiale']) |
|
| 94 | + ) { |
|
| 95 | + $newcompt = intval(floor(($compteur - 1) / $pas) * $pas); |
|
| 96 | + // si fin de la pagination et une seule entree, ne pas l'afficher, ca ne sert a rien |
|
| 97 | + if (!$initiale and !$url and !$memo['compteur']) { |
|
| 98 | + $memo = null; |
|
| 99 | + } |
|
| 100 | + if ($memo) { |
|
| 101 | + $on = (($memo['compteur'] <= $debut) |
|
| 102 | + and ( |
|
| 103 | + $newcompt > $debut or ($newcompt == $debut and $newcompt == $memo['compteur']) |
|
| 104 | + )); |
|
| 105 | + $res[] = lien_ou_expose($memo['url'], $memo['initiale'], $on, 'lien_pagination'); |
|
| 106 | + } |
|
| 107 | + if ($initiale) { |
|
| 108 | + $memo = array( |
|
| 109 | + 'entree' => isset($memo['entree']) ? $memo['entree'] + 1 : 0, |
|
| 110 | + 'initiale' => $initiale, |
|
| 111 | + 'url' => parametre_url($url, 'i', $initiale), |
|
| 112 | + 'compteur' => $newcompt |
|
| 113 | + ); |
|
| 114 | + } |
|
| 115 | + } |
|
| 116 | + if (!$initiale and !$url) { |
|
| 117 | + if (count($res) > 1) { |
|
| 118 | + $out = implode(' ', $res); |
|
| 119 | + } |
|
| 120 | + $memo = $res = null; |
|
| 121 | + } |
|
| 122 | 122 | |
| 123 | - return $out; |
|
| 123 | + return $out; |
|
| 124 | 124 | } |
| 125 | 125 | |
| 126 | 126 | /** |
@@ -139,23 +139,23 @@ discard block |
||
| 139 | 139 | * @return string |
| 140 | 140 | */ |
| 141 | 141 | function auteur_lien_messagerie($id_auteur, $en_ligne, $statut, $imessage, $email = '') { |
| 142 | - static $time = null; |
|
| 143 | - if (!in_array($statut, array('0minirezo', '1comite'))) { |
|
| 144 | - return ''; |
|
| 145 | - } |
|
| 142 | + static $time = null; |
|
| 143 | + if (!in_array($statut, array('0minirezo', '1comite'))) { |
|
| 144 | + return ''; |
|
| 145 | + } |
|
| 146 | 146 | |
| 147 | - if (is_null($time)) { |
|
| 148 | - $time = time(); |
|
| 149 | - } |
|
| 150 | - $parti = (($time - strtotime($en_ligne)) > 15 * 60); |
|
| 147 | + if (is_null($time)) { |
|
| 148 | + $time = time(); |
|
| 149 | + } |
|
| 150 | + $parti = (($time - strtotime($en_ligne)) > 15 * 60); |
|
| 151 | 151 | |
| 152 | - if ($imessage != 'non' and !$parti // historique : est-ce que ca a encore un sens de limiter vu qu'on a la notification par email ? |
|
| 153 | - and $GLOBALS['meta']['messagerie_agenda'] != 'non' |
|
| 154 | - ) { |
|
| 155 | - return parametre_url(parametre_url(generer_url_ecrire('message_edit', 'new=oui'), 'to', $id_auteur), 'redirect', self()); |
|
| 156 | - } elseif (strlen($email) and autoriser('voir', 'auteur', $id_auteur)) { |
|
| 157 | - return 'mailto:' . $email; |
|
| 158 | - } else { |
|
| 159 | - return ''; |
|
| 160 | - } |
|
| 152 | + if ($imessage != 'non' and !$parti // historique : est-ce que ca a encore un sens de limiter vu qu'on a la notification par email ? |
|
| 153 | + and $GLOBALS['meta']['messagerie_agenda'] != 'non' |
|
| 154 | + ) { |
|
| 155 | + return parametre_url(parametre_url(generer_url_ecrire('message_edit', 'new=oui'), 'to', $id_auteur), 'redirect', self()); |
|
| 156 | + } elseif (strlen($email) and autoriser('voir', 'auteur', $id_auteur)) { |
|
| 157 | + return 'mailto:' . $email; |
|
| 158 | + } else { |
|
| 159 | + return ''; |
|
| 160 | + } |
|
| 161 | 161 | } |
@@ -11,40 +11,40 @@ |
||
| 11 | 11 | \***************************************************************************/ |
| 12 | 12 | |
| 13 | 13 | if (!defined('_ECRIRE_INC_VERSION')) { |
| 14 | - return; |
|
| 14 | + return; |
|
| 15 | 15 | } |
| 16 | 16 | |
| 17 | 17 | function defaut_tri_defined($defaut) { |
| 18 | - if (!defined('_TRI_ARTICLES_RUBRIQUE')) { |
|
| 19 | - return $defaut; |
|
| 20 | - } |
|
| 18 | + if (!defined('_TRI_ARTICLES_RUBRIQUE')) { |
|
| 19 | + return $defaut; |
|
| 20 | + } |
|
| 21 | 21 | |
| 22 | - $sens = 1; |
|
| 23 | - $tri = trim(_TRI_ARTICLES_RUBRIQUE); |
|
| 24 | - $tri = explode(' ', $tri); |
|
| 25 | - if (strncasecmp(end($tri), 'DESC', 4) == 0) { |
|
| 26 | - $sens = -1; |
|
| 27 | - array_pop($tri); |
|
| 28 | - } elseif (strncasecmp(end($tri), 'ASC', 3) == 0) { |
|
| 29 | - $sens = 1; |
|
| 30 | - array_pop($tri); |
|
| 31 | - } |
|
| 32 | - $tri = implode(' ', $tri); |
|
| 33 | - $tri = array($tri => $sens); |
|
| 34 | - foreach ($defaut as $n => $s) { |
|
| 35 | - if (!isset($tri[$n])) { |
|
| 36 | - $tri[$n] = $s; |
|
| 37 | - } |
|
| 38 | - } |
|
| 22 | + $sens = 1; |
|
| 23 | + $tri = trim(_TRI_ARTICLES_RUBRIQUE); |
|
| 24 | + $tri = explode(' ', $tri); |
|
| 25 | + if (strncasecmp(end($tri), 'DESC', 4) == 0) { |
|
| 26 | + $sens = -1; |
|
| 27 | + array_pop($tri); |
|
| 28 | + } elseif (strncasecmp(end($tri), 'ASC', 3) == 0) { |
|
| 29 | + $sens = 1; |
|
| 30 | + array_pop($tri); |
|
| 31 | + } |
|
| 32 | + $tri = implode(' ', $tri); |
|
| 33 | + $tri = array($tri => $sens); |
|
| 34 | + foreach ($defaut as $n => $s) { |
|
| 35 | + if (!isset($tri[$n])) { |
|
| 36 | + $tri[$n] = $s; |
|
| 37 | + } |
|
| 38 | + } |
|
| 39 | 39 | |
| 40 | - return $tri; |
|
| 40 | + return $tri; |
|
| 41 | 41 | } |
| 42 | 42 | |
| 43 | 43 | function defaut_tri_par($par, $defaut) { |
| 44 | - if (!defined('_TRI_ARTICLES_RUBRIQUE')) { |
|
| 45 | - return $par; |
|
| 46 | - } |
|
| 47 | - $par = array_keys($defaut); |
|
| 44 | + if (!defined('_TRI_ARTICLES_RUBRIQUE')) { |
|
| 45 | + return $par; |
|
| 46 | + } |
|
| 47 | + $par = array_keys($defaut); |
|
| 48 | 48 | |
| 49 | - return reset($par); |
|
| 49 | + return reset($par); |
|
| 50 | 50 | } |
@@ -1,7 +1,7 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | 3 | if (!defined('_ECRIRE_INC_VERSION')) { |
| 4 | - return; |
|
| 4 | + return; |
|
| 5 | 5 | } |
| 6 | 6 | |
| 7 | 7 | include_spip('formulaires/selecteur/selecteur_fonctions'); |
@@ -6,7 +6,7 @@ discard block |
||
| 6 | 6 | * @package SPIP\Core\Formulaires |
| 7 | 7 | **/ |
| 8 | 8 | if (!defined('_ECRIRE_INC_VERSION')) { |
| 9 | - return; |
|
| 9 | + return; |
|
| 10 | 10 | } |
| 11 | 11 | |
| 12 | 12 | /** |
@@ -23,31 +23,31 @@ discard block |
||
| 23 | 23 | * Code HTML et javascript |
| 24 | 24 | */ |
| 25 | 25 | function choisir_rubriques_admin_restreint( |
| 26 | - $id_auteur, |
|
| 27 | - $label = '', |
|
| 28 | - $sel_css = '#liste_rubriques_restreintes', |
|
| 29 | - $img_remove = '' |
|
| 26 | + $id_auteur, |
|
| 27 | + $label = '', |
|
| 28 | + $sel_css = '#liste_rubriques_restreintes', |
|
| 29 | + $img_remove = '' |
|
| 30 | 30 | ) { |
| 31 | - global $spip_lang; |
|
| 32 | - $res = ''; |
|
| 33 | - // Ajouter une rubrique a un administrateur restreint |
|
| 34 | - if ($chercher_rubrique = charger_fonction('chercher_rubrique', 'inc') |
|
| 35 | - and $a = $chercher_rubrique(0, 'auteur', false) |
|
| 36 | - ) { |
|
| 37 | - if ($img_remove) { |
|
| 38 | - $img_remove = addslashes("<a href=\"#\" onclick=\"jQuery(this).parent().remove();return false;\" class=\"removelink\">$img_remove</a>"); |
|
| 39 | - } |
|
| 31 | + global $spip_lang; |
|
| 32 | + $res = ''; |
|
| 33 | + // Ajouter une rubrique a un administrateur restreint |
|
| 34 | + if ($chercher_rubrique = charger_fonction('chercher_rubrique', 'inc') |
|
| 35 | + and $a = $chercher_rubrique(0, 'auteur', false) |
|
| 36 | + ) { |
|
| 37 | + if ($img_remove) { |
|
| 38 | + $img_remove = addslashes("<a href=\"#\" onclick=\"jQuery(this).parent().remove();return false;\" class=\"removelink\">$img_remove</a>"); |
|
| 39 | + } |
|
| 40 | 40 | |
| 41 | - $res = |
|
| 42 | - "\n<div id='ajax_rubrique'>\n" |
|
| 43 | - . "<label>$label</label>\n" |
|
| 44 | - . "<input name='id_auteur' value='$id_auteur' type='hidden' />\n" |
|
| 45 | - . $a |
|
| 46 | - . "</div>\n" |
|
| 41 | + $res = |
|
| 42 | + "\n<div id='ajax_rubrique'>\n" |
|
| 43 | + . "<label>$label</label>\n" |
|
| 44 | + . "<input name='id_auteur' value='$id_auteur' type='hidden' />\n" |
|
| 45 | + . $a |
|
| 46 | + . "</div>\n" |
|
| 47 | 47 | |
| 48 | - // onchange = pour le menu |
|
| 49 | - // l'evenement doit etre provoque a la main par le selecteur ajax |
|
| 50 | - . "<script type='text/javascript'>/*<![CDATA[*/ |
|
| 48 | + // onchange = pour le menu |
|
| 49 | + // l'evenement doit etre provoque a la main par le selecteur ajax |
|
| 50 | + . "<script type='text/javascript'>/*<![CDATA[*/ |
|
| 51 | 51 | jQuery(function($){ |
| 52 | 52 | $('#id_parent').on('change', function(){ |
| 53 | 53 | var id_parent = parseInt(this.value); |
@@ -66,7 +66,7 @@ discard block |
||
| 66 | 66 | .attr('name','noname'); |
| 67 | 67 | }); |
| 68 | 68 | /*]]>*/</script>"; |
| 69 | - } |
|
| 69 | + } |
|
| 70 | 70 | |
| 71 | - return $res; |
|
| 71 | + return $res; |
|
| 72 | 72 | } |