File indexing completed on 2024-05-12 17:24:33

0001 <?php
0002 /**
0003  *  ocs-apiserver
0004  *
0005  *  Copyright 2016 by pling GmbH.
0006  *
0007  *    This file is part of ocs-apiserver.
0008  *
0009  *    This program is free software: you can redistribute it and/or modify
0010  *    it under the terms of the GNU Affero General Public License as
0011  *    published by the Free Software Foundation, either version 3 of the
0012  *    License, or (at your option) any later version.
0013  *
0014  *    This program is distributed in the hope that it will be useful,
0015  *    but WITHOUT ANY WARRANTY; without even the implied warranty of
0016  *    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
0017  *    GNU Affero General Public License for more details.
0018  *
0019  *    You should have received a copy of the GNU Affero General Public License
0020  *    along with this program.  If not, see <http://www.gnu.org/licenses/>.
0021  **/
0022 
0023 /** crawler detection
0024  * @param $USER_AGENT
0025  * @return bool
0026  */
0027 function crawlerDetect($USER_AGENT)
0028 {
0029     $crawlers = array(
0030         array('Google', 'Google'),
0031         array('MSN', 'MSN'),
0032         array('msnbot-media', 'MSN'),
0033         array('bingbot', 'MSN'),
0034         array('MegaIndex.ru' , 'MegaIndex.ru'),
0035         array('Baiduspider', 'Baiduspider'),
0036         array('YandexBot', 'YandexBot'),
0037         array('AhrefsBot', 'AhrefsBot'),
0038         array('ltx71', 'ltx71'),
0039         array('msnbot', 'MSN'),
0040         array('Rambler', 'Rambler'),
0041         array('Yahoo', 'Yahoo'),
0042         array('AbachoBOT', 'AbachoBOT'),
0043         array('accoona', 'Accoona'),
0044         array('AcoiRobot', 'AcoiRobot'),
0045         array('ASPSeek', 'ASPSeek'),
0046         array('CrocCrawler', 'CrocCrawler'),
0047         array('Dumbot', 'Dumbot'),
0048         array('FAST-WebCrawler', 'FAST-WebCrawler'),
0049         array('GeonaBot', 'GeonaBot'),
0050         array('Gigabot', 'Gigabot'),
0051         array('Lycos', 'Lycos spider'),
0052         array('MSRBOT', 'MSRBOT'),
0053         array('Scooter', 'Altavista robot'),
0054         array('AltaVista', 'Altavista robot'),
0055         array('IDBot', 'ID-Search Bot'),
0056         array('eStyle', 'eStyle Bot'),
0057         array('Scrubby', 'Scrubby robot'),
0058         array('MJ12bot','http://mj12bot.com/')
0059     );
0060 
0061     foreach ($crawlers as $c)
0062     {
0063         if (stristr($USER_AGENT, $c[0]))
0064         {
0065             return($c[1]);
0066         }
0067     }
0068 
0069     return false;
0070 }