Skip to content
Extraits de code Groupes Projets
Valider fefe3d2a rédigé par cedric@yterium.com's avatar cedric@yterium.com
Parcourir les fichiers

On reintegre facebookexternalhit dans la liste des bots, car on ne veut pas le...

On reintegre facebookexternalhit dans la liste des bots, car on ne veut pas le compter en statistiques, mais on ajoute une constante _IS_BOT_FRIEND qui matche facebookexternalhit
Les botfriend ne sont pas rejetes d'un coup de 503 en cas de surcharge serveur, pour eviter les partages sociaux rates
parent 398d96df
Aucune branche associée trouvée
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
......@@ -5,7 +5,7 @@
* ------------------
*/
define('_ECRAN_SECURITE', '1.3.0'); // 2017-03-06
define('_ECRAN_SECURITE', '1.3.1'); // 2017-05-31
/*
* Documentation : http://www.spip.net/fr_article4200.html
......@@ -23,24 +23,35 @@ if (isset($_GET['test_ecran_securite']))
* var_isbot=1 peut etre utilise pour monitorer la disponibilite pour les bots (sujets a 503 de delestage si
* le load depasse ECRAN_SECURITE_LOAD)
*/
if (!defined('_IS_BOT') and isset($_GET['var_isbot']))
define('_IS_BOT',$_GET['var_isbot']?true:false);
if (!defined('_IS_BOT') and isset($_GET['var_isbot'])){
define('_IS_BOT', $_GET['var_isbot'] ? true : false);
}
/*
* Détecteur de robot d'indexation
*/
if (!defined('_IS_BOT'))
if (!defined('_IS_BOT')){
define('_IS_BOT',
isset($_SERVER['HTTP_USER_AGENT'])
and preg_match(
// mots generiques
',bot|slurp|crawler|spider|webvac|yandex|'
// MSIE 6.0 est un botnet 99,9% du temps, on traite donc ce USER_AGENT comme un bot
. 'MSIE 6\.0|'
// UA plus cibles
. '80legs|accoona|AltaVista|ASPSeek|Baidu|Charlotte|EC2LinkFinder|eStyle|flipboard|hootsuite|FunWebProducts|Google|Genieo|INA dlweb|InfegyAtlas|Java VM|LiteFinder|Lycos|MegaIndex|MetaURI|Moreover|Rambler|Scrapy|Scooter|ScrubbyBloglines|Yahoo|Yeti'
. ',i', (string) $_SERVER['HTTP_USER_AGENT'])
// mots generiques
',bot|slurp|crawler|spider|webvac|yandex|'
// MSIE 6.0 est un botnet 99,9% du temps, on traite donc ce USER_AGENT comme un bot
. 'MSIE 6\.0|'
// UA plus cibles
. '80legs|accoona|AltaVista|ASPSeek|Baidu|Charlotte|EC2LinkFinder|eStyle|facebookexternalhit|flipboard|hootsuite|FunWebProducts|Google|Genieo|INA dlweb|InfegyAtlas|Java VM|LiteFinder|Lycos|MegaIndex|MetaURI|Moreover|Rambler|Scrapy|Scooter|ScrubbyBloglines|Yahoo|Yeti'
. ',i', (string)$_SERVER['HTTP_USER_AGENT'])
);
}
if (!defined('_IS_BOT_FRIEND')){
define('_IS_BOT_FRIEND',
isset($_SERVER['HTTP_USER_AGENT'])
and preg_match(','
// UA plus cibles
. 'facebookexternalhit'
. ',i', (string)$_SERVER['HTTP_USER_AGENT'])
);
}
/*
* Interdit de passer une variable id_article (ou id_xxx) qui ne
......@@ -346,6 +357,7 @@ if (
defined('_ECRAN_SECURITE_LOAD')
and _ECRAN_SECURITE_LOAD > 0
and _IS_BOT
and !_IS_BOT_FRIEND
and $_SERVER['REQUEST_METHOD'] === 'GET'
and (
(function_exists('sys_getloadavg')
......
0% Chargement en cours ou .
You are about to add 0 people to the discussion. Proceed with caution.
Terminez d'abord l'édition de ce message.
Veuillez vous inscrire ou vous pour commenter