コード例 #1
0
 public function check($browser = null)
 {
     $browserAttributes = get_browser();
     if (!isset($browserAttributes['browser'])) {
         return false;
     }
     if (!$browser) {
         foreach ($this->_browsers as $browser) {
             if ($browserAttributes['browser'] !== $browser->browserName()) {
                 continue;
             }
             if (isset($browserAttributes['version'])) {
                 if (!$browser->checkVersion($browserAttributes['version'])) {
                     return false;
                 }
             }
             if (isset($browserAttributes['css'])) {
                 if (!$browser->checkCssVersion($browserAttributes['css'])) {
                     return false;
                 }
             }
             if (isset($browserAttributes['javascript']) and $browser->javascriptEnabled() != NULL) {
                 if ($browser->javascriptEnabled() != $browserAttributes['javascript']) {
                     return false;
                 }
             }
             if (isset($browserAttributes['cookies']) and $browser->cookieEnabled() != NULL) {
                 if (!$browser->cookieEnabled() != $browserAttributes['cookies']) {
                     return false;
                 }
             }
         }
     } elseif ($browser instanceof Browser) {
     }
 }
コード例 #2
0
ファイル: Browscap.php プロジェクト: siite/choose-sa-cloud
 /**
  * Get features from request
  *
  * @param  array $request $_SERVER variable
  * @param  array $config  ignored; included only to satisfy parent class
  * @return array
  */
 public static function getFromRequest($request, array $config)
 {
     $browscap = get_browser($request['http_user_agent'], true);
     $features = array();
     if (is_array($browscap)) {
         foreach ($browscap as $key => $value) {
             // For a few keys, we need to munge a bit for the device object
             switch ($key) {
                 case 'browser':
                     $features['mobile_browser'] = $value;
                     break;
                 case 'version':
                     $features['mobile_browser_version'] = $value;
                     break;
                 case 'platform':
                     $features['device_os'] = $value;
                     break;
                 default:
                     $features[$key] = $value;
                     break;
             }
         }
     }
     return $features;
 }
コード例 #3
0
ファイル: SoftwareInfo.php プロジェクト: aversilov/prexr
 /**
  * 
  * @return string device type
  */
 public static function getDeviceInfo()
 {
     $browser = get_browser(null, true);
     if (!$browser['ismobiledevice'] && !$browser['istablet']) {
         return self::$device_types['desktop'];
     }
     $iPod = stripos($_SERVER['HTTP_USER_AGENT'], "iPod");
     $iPhone = stripos($_SERVER['HTTP_USER_AGENT'], "iPhone");
     $iPad = stripos($_SERVER['HTTP_USER_AGENT'], "iPad");
     $Android = stripos($_SERVER['HTTP_USER_AGENT'], "Android");
     $webOS = stripos($_SERVER['HTTP_USER_AGENT'], "webOS");
     if ($iPhone) {
         return self::$device_types['iPhone'];
     } else {
         if ($iPod) {
             return self::$device_types['iPod'];
         } else {
             if ($iPad) {
                 return self::$device_types['iPad'];
             } else {
                 if ($Android) {
                     if ($browser['istablet']) {
                         return self::$device_types['Android_tablet'];
                     }
                     return self::$device_types['Android_smart'];
                 } else {
                     if ($webOS) {
                         return self::$device_types['webos'];
                     }
                 }
             }
         }
     }
     return self::$device_types['unknown'];
 }
コード例 #4
0
ファイル: browsercaps.php プロジェクト: noccy80/lepton-ng
 static function getAllCaps()
 {
     if (self::$__caps == null) {
         self::$__caps = get_browser(null, true);
     }
     return self::$__caps;
 }
コード例 #5
0
ファイル: CRequest.php プロジェクト: nunodotferreira/Phred
 /**
  * Returns the value of a property of the user's agent, according to the BrowsCap project.
  *
  * The names of the properties and their meanings are defined by the
  * [Browser Capabilities Project](http://browscap.org/).
  *
  * @param  string $propertyName The name of the BrowsCap property.
  *
  * @return CUStringObject The value of the BrowsCap property.
  */
 public static function userAgentProperty($propertyName)
 {
     assert('is_cstring($propertyName)', vs(isset($this), get_defined_vars()));
     if (!isset(self::$ms_browsCap)) {
         self::$ms_browsCap = get_browser(null, true);
     }
     return (string) self::$ms_browsCap[$propertyName];
 }
コード例 #6
0
ファイル: Helper.php プロジェクト: Caroga/sdk
 public static function getBrowserData()
 {
     if (function_exists('get_browser')) {
         return get_browser();
     } else {
         return array('browser_name_regex' => '^mozilla/5\\.0 (windows; .; windows nt 5\\.1; .*rv:.*) gecko/.* firefox/0\\.9.*$', 'browser_name_pattern' => 'Mozilla/5.0 (Windows; ?; Windows NT 5.1; *rv:*) Gecko/* Firefox/0.9*', 'parent' => 'Firefox 0.9', 'platform' => 'WinXP', 'browser' => 'Firefox', 'version' => 0.9, 'majorver' => 0, 'minorver' => 9, 'cssversion' => 2, 'frames' => 1, 'iframes' => 1, 'tables' => 1, 'cookies' => 1);
     }
 }
コード例 #7
0
ファイル: _init.php プロジェクト: esironal/exidoengine
/**
 * Get information about the user browser.
 * @return array
 */
function vendorBasicBrowscapGetBrowser()
{
    if (ini_get('browscap')) {
        return get_browser();
    }
    $bc = new Browscap(APPPATH . 'data/cache');
    return $bc->getBrowser();
}
コード例 #8
0
ファイル: h.php プロジェクト: ChristopheBrun/hLib
 /**
  * Encapsule l'appel à la fonction php get_browser() pour éviter les erreurs en mode console
  * @return array
  */
 public static function getBrowser()
 {
     if (!array_key_exists('HTTP_USER_AGENT', $_SERVER)) {
         // Cette variable n'est pas initialisée en mode console
         return array();
     }
     return get_browser(null, true);
 }
コード例 #9
0
function check_browser()
{
    $displayHTML = '<b>Nice modern browser you got there!</b>';
    $displayHTML = $_SERVER['HTTP_USER_AGENT'] . "<br>";
    $browser = get_browser();
    $displayHTML .= $browser;
    return $displayHTML;
}
 private function _getClientInfo($bGenerateInfo = true)
 {
     if (!$bGenerateInfo) {
         return '';
     }
     $_aBrowser = @ini_get('browscap') ? get_browser($_SERVER['HTTP_USER_AGENT'], true) : array();
     unset($_aBrowser['browser_name_regex']);
     return empty($_aBrowser) ? __('No browser information found.', 'admin-page-framework') : $_aBrowser;
 }
コード例 #11
0
function randomBytes($length = 16, $secure = true, $raw = true, $startEntropy = "", &$rounds = 0, &$drop = 0)
{
    static $lastRandom = "";
    $output = "";
    $length = abs((int) $length);
    $secureValue = "";
    $rounds = 0;
    $drop = 0;
    while (!isset($output[$length - 1])) {
        //some entropy, but works ^^
        $weakEntropy = array(is_array($startEntropy) ? implode($startEntropy) : $startEntropy, serialize(stat(__FILE__)), __DIR__, PHP_OS, microtime(), (string) lcg_value(), (string) PHP_MAXPATHLEN, PHP_SAPI, (string) PHP_INT_MAX . "." . PHP_INT_SIZE, serialize($_SERVER), serialize(get_defined_constants()), get_current_user(), serialize(ini_get_all()), (string) memory_get_usage() . "." . memory_get_peak_usage(), php_uname(), phpversion(), extension_loaded("gmp") ? gmp_strval(gmp_random(4)) : microtime(), zend_version(), (string) getmypid(), (string) getmyuid(), (string) mt_rand(), (string) getmyinode(), (string) getmygid(), (string) rand(), function_exists("zend_thread_id") ? (string) zend_thread_id() : microtime(), var_export(@get_browser(), true), function_exists("getrusage") ? @implode(getrusage()) : microtime(), function_exists("sys_getloadavg") ? @implode(sys_getloadavg()) : microtime(), serialize(get_loaded_extensions()), sys_get_temp_dir(), (string) disk_free_space("."), (string) disk_total_space("."), uniqid(microtime(), true), file_exists("/proc/cpuinfo") ? file_get_contents("/proc/cpuinfo") : microtime());
        shuffle($weakEntropy);
        $value = hash("sha512", implode($weakEntropy), true);
        $lastRandom .= $value;
        foreach ($weakEntropy as $k => $c) {
            //mixing entropy values with XOR and hash randomness extractor
            $value ^= hash("sha256", $c . microtime() . $k, true) . hash("sha256", mt_rand() . microtime() . $k . $c, true);
            $value ^= hash("sha512", (string) lcg_value() . $c . microtime() . $k, true);
        }
        unset($weakEntropy);
        if ($secure === true) {
            $strongEntropyValues = array(is_array($startEntropy) ? hash("sha512", $startEntropy[($rounds + $drop) % count($startEntropy)], true) : hash("sha512", $startEntropy, true), file_exists("/dev/urandom") ? fread(fopen("/dev/urandom", "rb"), 64) : str_repeat("", 64), (function_exists("openssl_random_pseudo_bytes") and version_compare(PHP_VERSION, "5.3.4", ">=")) ? openssl_random_pseudo_bytes(64) : str_repeat("", 64), function_exists("mcrypt_create_iv") ? mcrypt_create_iv(64, MCRYPT_DEV_URANDOM) : str_repeat("", 64), $value);
            $strongEntropy = array_pop($strongEntropyValues);
            foreach ($strongEntropyValues as $value) {
                $strongEntropy = $strongEntropy ^ $value;
            }
            $value = "";
            //Von Neumann randomness extractor, increases entropy
            $bitcnt = 0;
            for ($j = 0; $j < 64; ++$j) {
                $a = ord($strongEntropy[$j]);
                for ($i = 0; $i < 8; $i += 2) {
                    $b = ($a & 1 << $i) > 0 ? 1 : 0;
                    if ($b != (($a & 1 << $i + 1) > 0 ? 1 : 0)) {
                        $secureValue |= $b << $bitcnt;
                        if ($bitcnt == 7) {
                            $value .= chr($secureValue);
                            $secureValue = 0;
                            $bitcnt = 0;
                        } else {
                            ++$bitcnt;
                        }
                        ++$drop;
                    } else {
                        $drop += 2;
                    }
                }
            }
        }
        $output .= substr($value, 0, min($length - strlen($output), $length));
        unset($value);
        ++$rounds;
    }
    $lastRandom = hash("sha512", $lastRandom, true);
    return $raw === false ? bin2hex($output) : $output;
}
コード例 #12
0
ファイル: StatsOperator.php プロジェクト: aversilov/prexr
 public static function userLogin()
 {
     $browser = get_browser(null, true);
     if (isset(Yii::$app->request->cookies['guest_id'])) {
         Yii::$app->response->cookies->remove('guest_id');
     }
     $user = Yii::$app->user->identity;
     $data = ['user_id' => $user->id, 'old_ip' => $user->ip, 'new_ip' => $_SERVER['REMOTE_ADDR'], 'is_dynamic_ip' => $user->is_dynamic_ip, 'browser_name' => $browser['browser'], 'browser_version' => $browser['version'], 'os' => $browser['platform'], 'device' => SoftwareInfo::getDeviceInfo()];
     CurlHelper::sendStatsData('UserLogin', $data);
 }
コード例 #13
0
 /**
  * Returns all browser infos of the session.
  *
  * @return array
  */
 public function getBrowserInfo()
 {
     if (!$this->exists("browser_info")) {
         $browserInfo = array();
         if (ini_get("browscap")) {
             $browserInfo = get_browser($this->get("useragent"), true);
         }
         $this->set("browser_info", $browserInfo);
     }
     return $this->get("browser_info");
 }
コード例 #14
0
 function update_visitor_info($resume_id)
 {
     $browser = get_browser(null, true);
     $this->data['VisitorInfo']['resume_id'] = $resume_id;
     $this->data['VisitorInfo']['browser'] = $browser['browser'];
     $this->data['VisitorInfo']['version'] = $browser['version'];
     $this->data['VisitorInfo']['platform'] = $browser['platform'];
     $this->data['VisitorInfo']['ip_address'] = $_SERVER['SERVER_ADDR'];
     $this->data['VisitorInfo']['domain_name'] = $_SERVER['HTTP_HOST'];
     $this->save($this->data);
 }
コード例 #15
0
 /**
  * Collect user agent data and save in Attributes array.
  */
 protected function SetAttributes($Sender, &$Args)
 {
     if (!isset($Args['FormPostValues']['Attributes'])) {
         $Args['FormPostValues']['Attributes'] = array();
     }
     // Add user agent data to Attributes
     $Data = @get_browser(GetValue('HTTP_USER_AGENT', $_SERVER));
     // requires browsecap.ini or throws error
     $Args['FormPostValues']['Attributes']['Platform'] = GetValue('platform', $Data);
     $Args['FormPostValues']['Attributes']['Browser'] = trim(GetValue('browser', $Data) . ' ' . GetValue('version', $Data));
     $Args['FormPostValues']['Attributes'] = serialize($Args['FormPostValues']['Attributes']);
 }
コード例 #16
0
 function update_browser_stats($resume_analytic_id)
 {
     $this->VisitorBrowser = ClassRegistry::init('VisitorBrowser');
     $visitorBrowser = $this->VisitorBrowser->findByResumeAnalyticId($resume_analytic_id);
     if (empty($visitorBrowser) || time() - strtotime($visitorBrowser['VisitorBrowser']['stamp']) > 300) {
         $browser = get_browser(null, true);
         $this->data['VisitorBrowser']['resume_analytic_id'] = $resume_analytic_id;
         $this->data['VisitorBrowser']['browser'] = $browser['browser'];
         $this->data['VisitorBrowser']['version'] = $browser['version'];
         $this->data['VisitorBrowser']['platform'] = $browser['platform'];
         $this->VisitorBrowser->save($this->data);
     }
 }
コード例 #17
0
ファイル: logs.php プロジェクト: Zandemmer/HackThisSite-Old
 private function findBrowser()
 {
     if (empty($_SERVER['HTTP_USER_AGENT'])) {
         return 'Unknown';
     }
     $data = get_browser($_SERVER['HTTP_USER_AGENT'], true);
     if (empty($data['parent'])) {
         return 'Unknown';
     }
     if (empty($data['platform'])) {
         return 'Unknown';
     }
     return $data['parent'] . ' on ' . $data['platform'];
 }
コード例 #18
0
ファイル: CrashFactory.php プロジェクト: ixudra/csi
 protected function getBrowser($userAgent)
 {
     $version = '';
     try {
         $version = get_browser($userAgent)['version'];
     } catch (Exception $e) {
     }
     foreach (Config::get('csi.browsers') as $regex => $value) {
         if (preg_match($regex, $userAgent)) {
             return array('name' => $value, 'version' => $version);
         }
     }
     return array('name' => '', 'version' => '');
 }
コード例 #19
0
ファイル: Browsers.php プロジェクト: kakserpom/WakePHP
 /**
  * @param $names
  * @param callable $cb
  */
 public function get($agent, $cb)
 {
     $this->browsers->findOne(function ($item) use($cb, $agent) {
         if ($item) {
             call_user_func($cb, $item);
             return;
         }
         $browser = \get_browser($agent, true);
         $browser['name'] = $browser['browser'];
         unset($browser['browser_name_regex'], $browser['browser']);
         $this->browsers->insert(['_id' => $agent] + $browser);
         call_user_func($cb, $browser);
     }, ['where' => ['_id' => $agent]]);
 }
 /**
  * @dataProvider providerUserAgent
  * @depends      testCheckProperties
  *
  * @param string $userAgent
  *
  * @throws \Exception
  * @throws \phpbrowscap\Exception
  */
 public function testCompare($userAgent)
 {
     $libResult = get_browser($userAgent);
     $bcResult = self::$object->getBrowser($userAgent);
     $doNotCheck = array('browser_name_regex', 'browser_name_pattern', 'Parent', 'RenderingEngine_Description');
     foreach (array_keys($this->properties) as $bcProp) {
         if (in_array($bcProp, $doNotCheck)) {
             continue;
         }
         $libProp = strtolower($bcProp);
         $libValue = (string) $libResult->{$libProp};
         $bcValue = (string) $bcResult->{$bcProp};
         self::assertSame($libValue, $bcValue, 'Expected actual "' . $bcProp . '" to be "' . (string) $libValue . '" (was "' . (string) $bcValue . '"; used pattern: ' . (string) $bcResult->browser_name_pattern . ')');
     }
 }
コード例 #21
0
 /**
  * @dataProvider providerUserAgent
  * @depends testCheckProperties
  * @group compare
  *
  * @param string $userAgent
  */
 public function testCompare($userAgent)
 {
     $libResult = get_browser($userAgent);
     $bcResult = self::$object->getBrowser($userAgent);
     foreach (array_keys($this->properties) as $bcProp) {
         if (in_array($bcProp, array('browser_name_regex', 'browser_name_pattern', 'Parent'))) {
             continue;
         }
         $bcProp = strtolower($bcProp);
         self::assertObjectHasAttribute($bcProp, $libResult, 'Actual library result does not have "' . $bcProp . '" property');
         self::assertObjectHasAttribute($bcProp, $bcResult, 'Actual browscap result does not have "' . $bcProp . '" property');
         $libValue = (string) $libResult->{$bcProp};
         $bcValue = (string) $bcResult->{$bcProp};
         self::assertSame($libValue, $bcValue, 'Expected actual "' . $bcProp . '" to be "' . $libValue . '" (was "' . $bcValue . '"; used pattern: ' . $bcResult->browser_name_pattern . ')');
     }
 }
コード例 #22
0
ファイル: data.php プロジェクト: phiggins42/taskspeed
function getBaseData($data)
{
    $ret = array();
    $totals = array();
    $averages = array();
    $libs = array();
    $platforms = array();
    foreach ($data as $item) {
        // find out which browser this test was run in.
        $ua = get_browser($item->ua, true);
        $b = $ua["browser"] . " " . $ua["version"];
        // man i wished php give you easier shorthands :)
        // $platforms[$p] = $platforms[$p] ? $platforms[$p]++ : 0;
        $p = $ua["platform"];
        if (empty($platforms[$p])) {
            $platforms[$p] = 0;
        }
        $platforms[$p]++;
        $scores = $item->scores;
        // build up the array
        if (!is_array($ret[$b])) {
            $ret[$b] = array();
            if (!is_array($ret[$b]["tests"])) {
                $ret[$b]["tests"] = array();
            }
        }
        // do a cumulative count for each library across all browsers
        foreach ($scores as $library => $score) {
            if (!in_array($library, $libs)) {
                $libs[] = $library;
            }
            if (empty($totals[$library])) {
                $totals[$library] = 0;
                $averages[$library] = 0;
            }
            $totals[$library] += $score;
        }
        // stash the full results for each browser test
        $ret[$b]['tests'][] = $scores;
    }
    // reduce the totals to averages
    foreach ($totals as $lib => $total) {
        $averages[$lib] = $totals[$lib] / count($data);
    }
    // give back the "sorted" data
    return array("browsers" => $ret, "totals" => $totals, "averages" => $averages, "libraries" => $libs, "platforms" => array_unique($platforms));
}
コード例 #23
0
 public function actionSendXHRErrorReporting()
 {
     $error = $this->_data["error"];
     $ioArgs = $this->_data["ioargs"];
     global $c_xhr_error_reporting;
     if (isset($c_xhr_error_reporting) && !empty($c_xhr_error_reporting)) {
         $currentUser = $this->_environment->getCurrentUserItem();
         $browserInfo = get_browser(null, true);
         // setup mail
         $receivers = implode(", ", $c_xhr_error_reporting);
         $subject = "CommSy XHR Error";
         $message = "\n\t\t\t\t\tFehler\n\t\t\t\t\t========================\n\t\t\t\t\tServername: " . $_SERVER['SERVER_NAME'] . "\n\t\t\t\t\t" . $error["message"] . "\n\t\t\t\t\tBeschreibung: " . $error["description"] . "\n\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\tBenutzer\n\t\t\t\t\t========================\n\t\t\t\t\tUserID: " . $currentUser->getUserID() . "\n\t\t\t\t\tItemID: " . $currentUser->getItemID() . "\n\t\t\t\t\tAgent: " . $_SERVER["HTTP_USER_AGENT"] . "\n\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\tAufruf\n\t\t\t\t\t========================\n\t\t\t\t\tURL: " . $ioArgs["args"]["url"] . "\n\t\t\t\t\tPostData: " . $ioArgs["args"]["postData"] . "\n\t\t\t\t";
         mail($receivers, $subject, $message);
     }
     $this->setSuccessfullDataReturn(array());
     echo $this->_return;
 }
コード例 #24
0
 /**
  * show main window
  *
  * @return void
  */
 public function indexAction()
 {
     // include DetectMobile lib
     require_once Zend_Registry::get('config')->includePaths->library . '/rsslounge/DetectMobile.php';
     // prepare icon cache
     Zend_Controller_Action_HelperBroker::getStaticHelper('icon')->generateIconImage();
     // stop if ie is current browser
     $browser = @get_browser();
     if (isset($browser->browser) && get_browser()->browser == 'IE' && get_browser()->majorver == 6) {
         $this->_redirect('index/ie');
     }
     // update
     $this->checkDatabase();
     // load feedlist
     $this->feedlistData();
     // set unread if setting firstUnread is set and unread available
     if (Zend_Registry::get('session')->firstUnread == 1 && $this->view->unread > 0) {
         Zend_Registry::get('session')->unread = 1;
     }
     // convert session into array (for loading items)
     $settings = Zend_Controller_Action_HelperBroker::getStaticHelper('itemcounter')->getSessionAsArray();
     // get list template vars
     $listHelper = Zend_Controller_Action_HelperBroker::getStaticHelper('list');
     try {
         $listHelper->readItems($settings);
         $listHelper->setTemplateVars($this->view);
     } catch (Exception $e) {
         $this->view->messages = $e->getMessage();
     }
     // set new timeout for rss refresh in session settings
     Zend_Controller_Action_HelperBroker::getStaticHelper('updater')->timeout();
     // logout/login available?
     $users = new application_models_users();
     if ($users->getUsername() !== false && Zend_Registry::get('session')->authenticated === true) {
         $this->view->logout = true;
     } elseif (Zend_Registry::get('session')->authenticated === 'readonly') {
         $this->view->login = true;
     }
     // add new feed? Then show the dialog (for add feed bookmark)
     $this->view->newfeed = $this->getRequest()->getParam('url', '');
     // ipad detection
     $this->view->isIpad = (bool) strpos($_SERVER['HTTP_USER_AGENT'], 'iPad');
 }
コード例 #25
0
ファイル: admin.php プロジェクト: azanium/PopBloop-Web
function ui_admin_user_agent($option = NULL)
{
    // option: ...
    $u_agent = $_SERVER['HTTP_USER_AGENT'];
    $browser = get_browser(null, true);
    $ret = "";
    switch ($option) {
        case "is_mozilla":
            $ret = preg_match('/Firefox/i', $u_agent) ? 1 : 0;
            break;
        case "is_ie":
            $ret = preg_match('/MSIE/i', $u_agent) ? 1 : 0;
            break;
        case "ismobiledevice":
            $ret = $browser['ismobiledevice'];
            break;
    }
    return $ret;
}
コード例 #26
0
ファイル: BrowserInfo.php プロジェクト: clagiordano/weblibs
 /**
  * Retrive information from native method get_browser with php_browscap.ini
  * or detect them with this class functions from $SERVER['HTTP_USER_AGENT']
  * and return an object BrowserInfo, with al properties setted.
  *
  * @param  boolean $useBrowscap
  * @return \weblibs\php\BrowserInfo
  */
 public function getBrowserInfo($useBrowscap = false)
 {
     if ($useBrowscap && ini_get('browscap')) {
         // In this case use get_browser with php_browscap.ini method:
         $Info = get_browser(null, true);
         $this->Platform = $Info['platform'];
         $this->Browser = $Info['browser'];
         $this->Version = $Info['version'];
     } else {
         // In this case start detection with regexp:
         $this->Platform = $this->detectPlatform();
         $this->Browser = $this->detectBrowser();
         $this->Version = $this->detectVersion();
     }
     // Common methods for both cases
     $this->Architecture = $this->detectArchitecture();
     $this->RemoteAddress = filter_input(INPUT_SERVER, 'REMOTE_ADDR', FILTER_VALIDATE_IP);
     return $this;
 }
コード例 #27
0
ファイル: HttpRequest.php プロジェクト: guitarpoet/clips-tool
 /**
  * Get the request browser's meta data using PHP's browscap support
  */
 public function browserMeta()
 {
     if (isset($this->browser)) {
         return $this->browser;
     }
     $bcap_filename = cache_filename(BCAP_FILENAME);
     if (file_exists($bcap_filename)) {
         // We already have the browscap cache
         $b = new \phpbrowscap\Browscap(dirname($bcap_filename));
         $b->localFile = $bcap_filename;
         $b->doAutoUpdate = false;
         $this->browser = $b->getBrowser();
         return $this->browser;
     } else {
         // We need to download that, log error and try the default get_browser
         $this->logger->warn('Can\'t find the browse cap file(you can get it by using command clips get bcap), using php default get_browser instead.');
     }
     $this->browser = get_browser();
     return $this->browser;
 }
コード例 #28
0
/**
 * Add new fields (1 shown + 1-5 hidden ones) to Special:Contact.
 *
 * @param $contactForm Object: instance of EmailContactForm class
 * @param $form Sringt: HTML
 * @return Boolean: true
 */
function addContactFormFields($contactForm, $form)
{
    global $wgServer, $wgDBname;
    $form .= '<tr>
				<td class="mw-label">' . Xml::label(wfMsg('contactpage-wikiurl'), 'wpWikiURL') . '</td>
				<td class="mw-input" id="mw-contactpage-address">' . Xml::input('wpWikiURL', 60, $wgServer, array('type' => 'text', 'maxlength' => 200)) . '</td>
			</tr>
			<tr>' . Html::Hidden('wpDBname', $wgDBname, array('maxlength' => 100)) . "</tr>\n\t\t\t";
    if (class_exists('MyInfo')) {
        $myinfo = new MyInfo();
        $myinfo->browser = get_browser(null, true);
        $myinfo->info = browser_detection('full');
        $myinfo->info[] = browser_detection('moz_version');
        $form .= '<tr>' . Html::Hidden('wpBrowser', $myinfo->getBrowser(), array('maxlength' => 255)) . '</tr>
			<tr>' . Html::Hidden('wpOperatingSystem', $myinfo->getOs(), array('maxlength' => 255)) . '</tr>
			<tr>' . Html::Hidden('wpSkinName', $myinfo->getSkin(), array('maxlength' => 35)) . '</tr>
			<tr>' . Html::Hidden('wpUserAgent', $myinfo->getUAgent(), array('maxlength' => 500)) . '</tr>';
    }
    return true;
}
コード例 #29
0
ファイル: Agent.php プロジェクト: rampmaster/Profesionals
 public function __construct()
 {
     $this->userAgent = $_SERVER['HTTP_USER_AGENT'];
     $this->browser = get_browser($this->userAgent, true);
     $this->device = "computer";
     $apple_values = array('iPad', 'iPod', 'iPhone');
     $phone_values = array('iPhone', 'Android', 'android', 'blackberry', 'opera mini', 'motorola', 'mobilephone', 'nokia', 'iPod');
     $this->type = "computer";
     foreach ($phone_values as $alias) {
         if (preg_match("/" . $alias . "/", $this->userAgent)) {
             $this->device = "mobile";
         }
     }
     foreach ($apple_values as $alias) {
         if (preg_match("/" . $alias . "/", $this->userAgent)) {
             $this->device = "apple";
         }
     }
     return $this->device;
 }
コード例 #30
-1
ファイル: Core.php プロジェクト: wthielen/zf1e
 /**
  * Gets the browser information and caches it in a static variable
  */
 public static function getBrowser()
 {
     if (is_null(self::$browserinfo)) {
         if (!isset($_SESSION['browserinfo'])) {
             $info = @get_browser();
             $_SESSION['browserinfo'] = $info;
         }
         self::$browserinfo = $_SESSION['browserinfo'];
     }
     return self::$browserinfo;
 }