/** * Returns the name of the browser with the given user agent. * * @param string $userAgent * @return string */ public static function getBrowser($userAgent = '') { require_once CMS_DIR . 'lib/util/Browser.php'; $browser = new \Browser($userAgent); if (!$browser->isRobot()) { return $browser->getBrowser(); } return 'unknown'; }
private function isCrawler() { $options = $this->getSettings(); $crawler = false; if ($options['detectBots'] == 1) { switch ($options['detectingMode']) { case 'inexact': if ($_SERVER["HTTP_USER_AGENT"] == '' || $_SERVER['HTTP_ACCEPT'] == '' || $_SERVER['HTTP_ACCEPT_ENCODING'] == '' || $_SERVER['HTTP_ACCEPT_LANGUAGE'] == '' || $_SERVER['HTTP_CONNECTION'] == '') { $crawler == true; } break; case 'exact': if (!class_exists('Browser')) { include_once 'browser.php'; } $browser = new Browser(); $crawler = $browser->isRobot(); break; case 'more': if (ini_get("browscap")) { $browser = get_browser(null, true); $crawler = $browser['crawler']; } break; } } return $crawler; }
/** * Detect mobile device * * @return mixed Mobile device name or false */ public static function mobile_device_detect() { $ui = T3Parameter::_getParam('ui'); if ($ui == 'desktop') { return false; } // Detect mobile if (!class_exists('Browser')) { t3import('core.libs.browser'); } $browser = new Browser(); // Bypass if ($browser->isRobot()) { return false; } // Consider ipad as normal browser if ($browser->getBrowser() == Browser::BROWSER_IPAD) { return false; } // Mobile if ($browser->isMobile()) { if (in_array($browser->getBrowser(), array(Browser::BROWSER_IPHONE, Browser::BROWSER_IPOD))) { $device = 'iphone'; } elseif ($browser->getPlatform() == Browser::PLATFORM_ANDROID) { $device = 'android'; } else { //$device = strtolower($browser->getBrowser()); $device = 'handheld'; } $layout = T3Parameter::_getParam($device . "_layout", ''); if ($layout == -1) { return false; } //disable return $device; //return 'handheld'; } // Not mobile if ($ui == 'mobile') { return 'iphone'; } //default for mobile layout on desktop return false; }
/* don't use htmlentities for $ttl */ $ttl = $ExternalCounters->get_query_param('ttl'); if (!$ttl) { $ttl = 'No title'; } $ttl = $ExternalCounters->prepare_str(str_replace(" ", "+", $ttl)); $encoding = $ExternalCounters->get_query_param('encoding'); $ttl = $ExternalCounters->fix_ttl_encoding($encoding, $ttl, $rfrr); $is_robot = ''; $ua = ''; $ua_str = ''; $ua_version = ''; $os = ''; if (!isset($browser) || empty($browser)) { $browser = new Browser(); $is_robot = $browser->isRobot() ? $browser->getBrowser() : ''; $ua = $browser->getBrowser() ? $browser->getBrowser() : ''; $ua_str = $browser->getUserAgent() ? $browser->getUserAgent() : 'unknown'; $ua_version = $browser->getVersion() ? $browser->getVersion() : ''; $os = $browser->getPlatform() ? $browser->getPlatform() : ''; } $table_name = $pt_externalcounters_table_name; $DBH->exec("CREATE TABLE IF NOT EXISTS `" . $table_name . "` ( `id` mediumint(9) NOT NULL AUTO_INCREMENT, `adddate` int(11) DEFAULT NULL, `random` varchar(50) DEFAULT NULL, `user_login` mediumtext NOT NULL, `referer` mediumtext NOT NULL, `self` mediumtext NOT NULL, `page_title` mediumtext NOT NULL, `browser` mediumtext NOT NULL, `number` mediumtext NOT NULL, `os` mediumtext NOT NULL, `os_number` mediumtext NOT NULL, `host` mediumtext NOT NULL, `ip` mediumtext NOT NULL, PRIMARY KEY (`id`), FULLTEXT KEY `page_title` (`page_title`)) ENGINE=MyISAM DEFAULT CHARSET=utf8;"); if (!$is_robot) { try { /** * if table exists */ if ($ExternalCounters->db_table_exists($DBH, $table_name)) { $SQL = "INSERT INTO `" . $table_name . "` "; $SQL .= "(`adddate`, `random`, `user_login`, `referer`, `self`, `page_title`, `browser`, `number`, `os`, `os_number`, `host`, `ip`) ";
public function loadView() { $sql = 'SELECT V.idview, V.name as shopname, V.namespace, C.idcurrency, C.currencysymbol, C.decimalseparator, C.decimalcount, C.thousandseparator, C.positivepreffix, C.positivesuffix, C.negativepreffix, C.negativesuffix, S.countryid, V.taxes, V.showtax, V.offline, cartredirect, terms, photoid, favicon, forcelogin, apikey, watermark, confirmregistration, enableregistration, invoicenumerationkind, V.pageschemeid, V.contactid, PS.templatefolder FROM view V LEFT JOIN viewcategory VC ON VC.viewid = V.idview LEFT JOIN store S ON V.storeid = S.idstore LEFT JOIN pagescheme PS ON PS.idpagescheme = V.pageschemeid LEFT JOIN currency C ON C.idcurrency = IF(:currencyid > 0, :currencyid, V.currencyid) WHERE V.idview = :viewid'; $stmt = Db::getInstance()->prepare($sql); $stmt->bindValue('viewid', $this->determineViewId()); $stmt->bindValue('currencyid', Session::getActiveCurrencyId()); $stmt->execute(); $rs = $stmt->fetch(); if ($rs) { $this->layer = array('terms' => $rs['terms'], 'idview' => $rs['idview'], 'namespace' => $rs['namespace'], 'cartredirect' => $rs['cartredirect'], 'offline' => $rs['offline'], 'taxes' => $rs['taxes'], 'showtax' => $rs['showtax'], 'shopname' => $rs['shopname'], 'photoid' => $rs['photoid'], 'favicon' => $rs['favicon'], 'watermark' => $rs['watermark'], 'idcurrency' => $rs['idcurrency'], 'currencysymbol' => $rs['currencysymbol'], 'decimalseparator' => $rs['decimalseparator'], 'decimalcount' => $rs['decimalcount'], 'thousandseparator' => $rs['thousandseparator'], 'positivepreffix' => $rs['positivepreffix'], 'positivesuffix' => $rs['positivesuffix'], 'negativepreffix' => $rs['negativepreffix'], 'negativesuffix' => $rs['negativesuffix'], 'countryid' => $rs['countryid'], 'forcelogin' => $rs['forcelogin'], 'confirmregistration' => $rs['confirmregistration'], 'enableregistration' => $rs['enableregistration'], 'apikey' => $rs['apikey'], 'invoicenumerationkind' => $rs['invoicenumerationkind'], 'pageschemeid' => $rs['pageschemeid'], 'theme' => $rs['templatefolder'], 'pageschemeid' => $rs['pageschemeid'], 'contactid' => $rs['contactid']); Session::setActiveShopName($this->layer['shopname']); if (is_null($this->layer['photoid'])) { $this->layer['photoid'] = 'logo.png'; } if (is_null($this->layer['favicon'])) { $this->layer['favicon'] = 'favicon.ico'; } Session::setActiveShopCurrencyId($this->layer['idcurrency']); Session::setActiveForceLogin($this->layer['forcelogin']); if (Session::getActiveBrowserData() == NULL) { $browser = new Browser(); $Data = array('browser' => $browser->getBrowser(), 'platform' => $browser->getPlatform(), 'ismobile' => $browser->isMobile(), 'isbot' => $browser->isRobot()); Session::setActiveBrowserData($Data); } } }
function mobile_device_detect() { $ui = T3Parameter::_getParam('ui'); if ($ui == 'desktop') { return false; } //detect mobile t3import('core.libs.Browser'); $browser = new Browser(); //bypass if ($browser->isRobot()) { return false; } //consider ipad as normal browser if ($browser->getBrowser() == Browser::BROWSER_IPAD) { return false; } //mobile if ($browser->isMobile()) { if (in_array($browser->getBrowser(), array(Browser::BROWSER_IPHONE, Browser::BROWSER_IPOD))) { $device = 'iphone'; } else { $device = strtolower($browser->getBrowser()); } //$device = 'handheld'; $layout = T3Parameter::get($device . "_layout", ''); if ($layout == -1) { return false; } //disable return $device; //return 'handheld'; } //Not mobile if ($ui == 'mobile') { return 'iphone'; } //default for mobile layout on desktop return false; }
/** * Set the Browser to be a robot * * @param bool $value * @return void */ public static function setRobot($value = true) { self::$isRobot = (bool) $value; }
return Response::error('500'); } }); Route::filter('auth', function () { if (Auth::guest()) { return Redirect::to('/'); } }); Route::filter('Sentry_auth', function () { if (Sentry::guest()) { return Redirect::to('/'); } }); Route::filter('ip', function () { // Create the Eloquent object Visit $visit = new Track(); $browser = new Browser(); $visit->location = Locate::get('city') . ', ' . Locate::get('state') . ', ' . Locate::get('country'); $visit->ip_address = Request::ip(); $visit->request = URI::current(); if (Auth::check()) { $visit->user_id = Auth::user()->id; } // Browser stats $visit->browser = $browser->getBrowser(); $visit->browser_version = $browser->getVersion(); $visit->platform = $browser->getPlatform(); $visit->mobile = $browser->isMobile(); $visit->robot = $browser->isRobot(); $visit->save(); });
if (NV_USER_AGENT == 'NUKEVIET CMS ' . $global_config['version'] . '. Developed by VINADES. Url: http://nukeviet.vn. Code: ' . md5($global_config['sitekey'])) { define('NV_IS_MY_USER_AGENT', true); } // Xac dinh borwser cua client $browser = new Browser(NV_USER_AGENT); $client_info['browser'] = array(); $client_info['browser']['key'] = $browser->getBrowserKey(); $client_info['browser']['name'] = $browser->getBrowser(); if (preg_match('/^([0-9]+)\\.(.*)$/', $browser->getVersion(), $matches)) { $client_info['browser']['version'] = (int) $matches[1]; } else { $client_info['browser']['version'] = 0; } $client_info['is_mobile'] = $browser->isMobile(); $client_info['is_tablet'] = $browser->isTablet(); $client_info['is_bot'] = $browser->isRobot(); $client_info['client_os'] = array('key' => $browser->getPlatformKey(), 'name' => $browser->getPlatform()); $is_mobile_tablet = $client_info['is_mobile'] . '-' . $client_info['is_tablet']; if ($is_mobile_tablet != $nv_Request->get_string('is_mobile_tablet', 'session')) { $nv_Request->set_Session('is_mobile_tablet', $is_mobile_tablet); $nv_Request->unset_request('nv' . NV_LANG_DATA . 'themever', 'cookie'); } // Ket noi voi class chong flood if ($global_config['is_flood_blocker'] and !$nv_Request->isset_request('admin', 'session') and (!$nv_Request->isset_request('second', 'get') or $nv_Request->isset_request('second', 'get') and $client_info['is_myreferer'] != 1)) { require NV_ROOTDIR . '/includes/core/flood_blocker.php'; } // Captcha if ($nv_Request->isset_request('scaptcha', 'get')) { require NV_ROOTDIR . '/includes/core/captcha.php'; } // Class ma hoa du lieu