Code Duplication    Length = 23-23 lines in 2 locations

class/utility.php 1 location

@@ 783-805 (lines=23) @@
780
     * @author        Hervé Thouzard (http://www.herve-thouzard.com)
781
     * @copyright (c) Hervé Thouzard
782
     */
783
    public static function isBot()
784
    {
785
        if (isset($_SESSION['news_cache_bot'])) {
786
            return $_SESSION['news_cache_bot'];
787
        } else {
788
            // Add here every bot you know separated by a pipe | (not matter with the upper or lower cases)
789
            // If you want to see the result for yourself, add your navigator's user agent at the end (mozilla for example)
790
            $botlist      = 'AbachoBOT|Arachnoidea|ASPSeek|Atomz|cosmos|crawl25-public.alexa.com|CrawlerBoy Pinpoint.com|Crawler|DeepIndex|EchO!|exabot|Excalibur Internet Spider|FAST-WebCrawler|Fluffy the spider|GAIS Robot/1.0B2|GaisLab data gatherer|Google|Googlebot-Image|googlebot|Gulliver|ia_archiver|Infoseek|Links2Go|Lycos_Spider_(modspider)|Lycos_Spider_(T-Rex)|MantraAgent|Mata Hari|Mercator|MicrosoftPrototypeCrawler|[email protected]|MSNBOT|NEC Research Agent|NetMechanic|Nokia-WAPToolkit|nttdirectory_robot|Openfind|Oracle Ultra Search|PicoSearch|Pompos|Scooter|Slider_Search_v1-de|Slurp|Slurp.so|SlySearch|Spider|Spinne|SurferF3|Surfnomore Spider|suzuran|teomaagent1|TurnitinBot|Ultraseek|VoilaBot|vspider|W3C_Validator|Web Link Validator|WebTrends|WebZIP|whatUseek_winona|WISEbot|Xenu Link Sleuth|ZyBorg';
791
            $botlist      = strtoupper($botlist);
792
            $currentagent = strtoupper(xoops_getenv('HTTP_USER_AGENT'));
793
            $retval       = false;
794
            $botarray     = explode('|', $botlist);
795
            foreach ($botarray as $onebot) {
796
                if (false !== strpos($currentagent, $onebot)) {
797
                    $retval = true;
798
                    break;
799
                }
800
            }
801
        }
802
        $_SESSION['news_cache_bot'] = $retval;
803
804
        return $retval;
805
    }
806
807
    /**
808
     * Create an infotip

include/functions.php 1 location

@@ 661-683 (lines=23) @@
658
 * @author        Hervé Thouzard (http://www.herve-thouzard.com)
659
 * @copyright (c) Hervé Thouzard
660
 */
661
function news_isbot()
662
{
663
    if (isset($_SESSION['news_cache_bot'])) {
664
        return $_SESSION['news_cache_bot'];
665
    } else {
666
        // Add here every bot you know separated by a pipe | (not matter with the upper or lower cases)
667
        // If you want to see the result for yourself, add your navigator's user agent at the end (mozilla for example)
668
        $botlist      = 'AbachoBOT|Arachnoidea|ASPSeek|Atomz|cosmos|crawl25-public.alexa.com|CrawlerBoy Pinpoint.com|Crawler|DeepIndex|EchO!|exabot|Excalibur Internet Spider|FAST-WebCrawler|Fluffy the spider|GAIS Robot/1.0B2|GaisLab data gatherer|Google|Googlebot-Image|googlebot|Gulliver|ia_archiver|Infoseek|Links2Go|Lycos_Spider_(modspider)|Lycos_Spider_(T-Rex)|MantraAgent|Mata Hari|Mercator|MicrosoftPrototypeCrawler|[email protected]|MSNBOT|NEC Research Agent|NetMechanic|Nokia-WAPToolkit|nttdirectory_robot|Openfind|Oracle Ultra Search|PicoSearch|Pompos|Scooter|Slider_Search_v1-de|Slurp|Slurp.so|SlySearch|Spider|Spinne|SurferF3|Surfnomore Spider|suzuran|teomaagent1|TurnitinBot|Ultraseek|VoilaBot|vspider|W3C_Validator|Web Link Validator|WebTrends|WebZIP|whatUseek_winona|WISEbot|Xenu Link Sleuth|ZyBorg';
669
        $botlist      = strtoupper($botlist);
670
        $currentagent = strtoupper(xoops_getenv('HTTP_USER_AGENT'));
671
        $retval       = false;
672
        $botarray     = explode('|', $botlist);
673
        foreach ($botarray as $onebot) {
674
            if (false !== strpos($currentagent, $onebot)) {
675
                $retval = true;
676
                break;
677
            }
678
        }
679
    }
680
    $_SESSION['news_cache_bot'] = $retval;
681
682
    return $retval;
683
}
684
685
/**
686
 * Create an infotip