Run the identification sequence to match the right browser type according to the
user agent

@return Zend_Http_UserAgent_Result
340094
protected function _matchUserAgent()
    {
        $type = self::DEFAULT_BROWSER_TYPE;

        // If we have no identification sequence, just return the default type
        if (empty($this->_config['identification_sequence'])) {
            return $type;
        }

        // Get sequence against which to match
        $sequence = explode(',', $this->_config['identification_sequence']);

        // If a browser type is already configured, push that to the front of the list
        if (null !== ($browserType = $this->getBrowserType())) {
            array_unshift($sequence, $browserType);
        }

        // Append the default browser type to the list if not alread in the list
        if (!in_array($type, $sequence)) {
            $sequence[] = $type;
        }

        // Test each type until we find a match
        foreach ($sequence as $browserType) {
            $browserType = trim($browserType);
            $className   = $this->_getUserAgentDevice($browserType);

            // Attempt to match this device class
            if ($this->_match($className)) {
                $type = $browserType;
                $this->_browserTypeClass[$type] = $className;
                break;
            }
        }

        return $type;
    }
15217
public function run()
    {
        if ($this->driver === null || (is_array($this->driver) && !isset($this->driver['__class']))) {
            $this->driver['__class'] = GdDriver::class;
        }

        $this->driver = $this->app->ensureObject($this->driver, DriverInterface::class);

        if ($this->app->request->getQueryParam(self::REFRESH_GET_VAR) !== null) {
            // AJAX request for regenerating code
            $code = $this->getVerifyCode(true);
            $this->app->response->format = Response::FORMAT_JSON;
            return [
                'hash1' => $this->generateValidationHash($code),
                'hash2' => $this->generateValidationHash(strtolower($code)),
                // we add a random 'v' parameter so that FireFox can refresh the image
                // when src attribute of image tag is changed
                'url' => Url::to([$this->id, 'v' => uniqid()]),
            ];
        }

        $this->setHttpHeaders();
        $this->app->response->format = Response::FORMAT_RAW;

        return $this->driver->renderImage($this->getVerifyCode());
    }
1016909
public function getUserAgent($user_agent = null, $return_array = false, $full_info = false) {
		if ($full_info) { return get_browser($user_agent, $return_array); }

		return $_SERVER['HTTP_USER_AGENT'];
	}
1258166
public function run()
    {
        // The token or post data is invalid
        if ($this->parseRet['code'] !== 1) {
            return false;
        }

        // Output 'echostr' for first time authentication
        if (isset($this->query['echostr'])) {
            return htmlspecialchars($this->query['echostr'], ENT_QUOTES, 'UTF-8');
        }

        $msg = $this->handleMsg();
        if (!$msg) {
            return 'success';
        }
        return $this->isEncrypted() ? $this->encryptMsg($msg) : $msg;
    }
375931
public function match($userAgentString)
    {
        foreach ($this->getValues() as $userAgentIdentifier) {
            if ($userAgentIdentifier === UserAgentDirective::DEFAULT_USER_AGENT) {
                continue;
            }

            if (substr_count($userAgentString, $userAgentIdentifier)) {
                return $userAgentIdentifier;
            }
        }

        return null;
    }
1008997
public function getUserAgent()
    {
        if (isset($this->_userAgent)) {
            return $this->_userAgent;
        }
        return $this->_userAgent = isset($_SERVER['HTTP_USER_AGENT']) ? $_SERVER['HTTP_USER_AGENT'] : null;
    }
594406
public function getPageTypeIdentifier()
    {
        $request = $this->getRequest();

        return $request->getModuleName() . '_' . $request->getControllerName() . '_' . $request->getActionName();
    }
179322
public function applyRecoveryMatch($userAgent)
    {
        if (Utils::checkIfContains($userAgent, 'Series60')) {
            return 'nokia_generic_series60';
        }

        if (Utils::checkIfContains($userAgent, 'Series80')) {
            return 'nokia_generic_series80';
        }

        if (Utils::checkIfContains($userAgent, 'MeeGo')) {
            return 'nokia_generic_meego';
        }

        return WurflConstants::NO_MATCH;
    }
433980
public function matchesRequest()
    {
        return $this->event->get('token') === $this->config->get('token') && $this->event->get('type') === 'MESSAGE';
    }
345860
public function match(){

            $session = $this->getSession();
            $key = static::USER_SESSION;
            if($session->has($key)){

                if($value = $session->get($key) instanceof AuthenticationLoginObject){
                    return $value;
                }
            }else{
                return false;
            }
        }
1273979
public function run()
    {
        if (! $this->runPreSearch()) {
            return $this->value;
        }

        $converted = null;
        //deal with double encoded payload
        $this->value = preg_replace('/&amp;/', '&', $this->value);
        if (preg_match('/&#x?[\w]+/ms', $this->value)) {
            $converted = preg_replace('/(&#x?[\w]{2,6}\d?);?/ms', '$1;', $this->value);
            $converted = html_entity_decode($converted, ENT_QUOTES, 'UTF-8');
            $this->value .= "\n".str_replace(';;', ';', $converted);
        }
        // normalize obfuscated protocol handlers
        $this->value = preg_replace(
            '/(?:j\s*a\s*v\s*a\s*s\s*c\s*r\s*i\s*p\s*t\s*:)|(d\s*a\s*t\s*a\s*:)/ms',
            'javascript:',
            $this->value
        );

        return $this->value;
    }
211462
public static function matchDetectionRulesAgainstUA(){
		$userAgent=isset(self::$httpHeaders['HTTP_USER_AGENT'])?self::$httpHeaders['HTTP_USER_AGENT']:'';
		if(empty($userAgent))
			return false;

		//foreach(self::getRules() as $_regex){
		foreach(self::getMobileDetectionRules() as $_regex){
			if(empty($_regex)) continue;
			if(self::match($_regex,$userAgent))
				return true;
			}
		return false;
		}
609208
public static function checkBrowserMozilla()
    {
        if (stripos(self::$userAgentString, 'mozilla') !== false &&
            preg_match('/rv:[0-9].[0-9][a-b]?/i', self::$userAgentString) &&
            stripos(self::$userAgentString, 'netscape') === false
        ) {
            $aversion = explode(' ', stristr(self::$userAgentString, 'rv:'));
            preg_match('/rv:[0-9].[0-9][a-b]?/i', self::$userAgentString, $aversion);
            self::$browser->setVersion(str_replace('rv:', '', $aversion[0]));
            self::$browser->setName(Browser::MOZILLA);

            return true;
        } elseif (stripos(self::$userAgentString, 'mozilla') !== false &&
            preg_match('/rv:[0-9]\.[0-9]/i', self::$userAgentString) &&
            stripos(self::$userAgentString, 'netscape') === false
        ) {
            $aversion = explode('', stristr(self::$userAgentString, 'rv:'));
            self::$browser->setVersion(str_replace('rv:', '', $aversion[0]));
            self::$browser->setName(Browser::MOZILLA);

            return true;
        } elseif (stripos(self::$userAgentString, 'mozilla') !== false &&
            preg_match('/mozilla\/([^ ]*)/i', self::$userAgentString, $matches) &&
            stripos(self::$userAgentString, 'netscape') === false
        ) {
            if (isset($matches[1])) {
                self::$browser->setVersion($matches[1]);
            }
            self::$browser->setName(Browser::MOZILLA);

            return true;
        }

        return false;
    }
1192006
public function authenticate()
    {
        if (empty($this->request)) {
            throw new Exception\RuntimeException(
                'Request and Response objects must be set before calling authenticate()'
            );
        }

        if ($this->request->getUri()->getScheme() != 'https') {

            return new Result(
                Result::FAILURE_UNCATEGORIZED,
                array(),
                array('Http authentication must be over https')
            );
        }

        return parent::authenticate();
    }
1061065
protected function checkBrowserNokia()
    {
        if ($this->containString($this->_agent, array('Nokia5800', 'Nokia5530', 'Nokia5230'), true, false)) {
            $this->setBrowser(self::BROWSER_NOKIA);
            $this->setVersion('7.0');
            $this->setMobile(true);
            $this->setRobot(false);

            return true;
        }

        if ($this->checkSimpleBrowserUA(array('NokiaBrowser', 'BrowserNG', 'Series60', 'S60', 'S40OviBrowser'), $this->_agent, self::BROWSER_NOKIA, true)) {
            return true;
        }

        return false;
    }
1090431
public static function checkBrowserNokia()
    {
        if (preg_match("/Nokia([^\/]+)\/([^ SP]+)/i", self::$userAgentString, $matches)) {
            self::$browser->setVersion($matches[2]);
            if (stripos(self::$userAgentString, 'Series60') !== false ||
                strpos(self::$userAgentString, 'S60') !== false
            ) {
                self::$browser->setName(Browser::NOKIA_S60);
            } else {
                self::$browser->setName(Browser::NOKIA);
            }

            return true;
        }

        return false;
    }
734964
public static function checkBrowserSafari()
    {
        if (stripos(self::$userAgentString, 'Safari') !== false) {
            $aresult = explode('/', stristr(self::$userAgentString, 'Version'));
            if (isset($aresult[1])) {
                $aversion = explode(' ', $aresult[1]);
                self::$browser->setVersion($aversion[0]);
            } else {
                self::$browser->setVersion(Browser::VERSION_UNKNOWN);
            }
            self::$browser->setName(Browser::SAFARI);

            return true;
        }

        return false;
    }