Return whether the user is requesting the mobile site - either by query string
or by saved cookie. Falls back to browser detection for first time visitors

@return boolean
494935
public function requestedMobileSite() {
		$config = SiteConfig::current_site_config();
		if ($config->MobileSiteType == 'Disabled') return false;
		
		$request = $this->owner->getRequest();
		$fullSite = $request->getVar('fullSite');
		if (is_numeric($fullSite)) {
			return ($fullSite == 0);
		}

		$fullSiteCookie = Cookie::get('fullSite');
		if (is_numeric($fullSiteCookie)) {
			return ($fullSiteCookie == 0);
		}
		
		return MobileBrowserDetector::is_mobile();
	}
1201190
public static function isMobile()
    {
        if ($_GET['mobile'] === 'yes') {
            setcookie('ismobile', 'yes', 3600);
            return true;
        } elseif ($_GET['mobile'] === 'no') {
            setcookie('ismobile', 'no', 3600);
            return false;
        }

        $cookie = $_COOKIE('ismobile');
        if ($cookie === 'yes') {
            return true;
        } elseif ($cookie === 'no') {
            return false;
        } else {
            $cookie = null;
            static $mobileBrowserList = ['iphone', 'android', 'phone', 'mobile', 'wap', 'netfront', 'java', 'opera mobi', 'opera mini',
                'ucweb', 'windows ce', 'symbian', 'series', 'webos', 'sony', 'blackberry', 'dopod', 'nokia', 'samsung',
                'palmsource', 'xda', 'pieplus', 'meizu', 'midp', 'cldc', 'motorola', 'foma', 'docomo', 'up.browser',
                'up.link', 'blazer', 'helio', 'hosin', 'huawei', 'novarra', 'coolpad', 'webos', 'techfaith', 'palmsource',
                'alcatel', 'amoi', 'ktouch', 'nexian', 'ericsson', 'philips', 'sagem', 'wellcom', 'bunjalloo', 'maui', 'smartphone',
                'iemobile', 'spice', 'bird', 'zte-', 'longcos', 'pantech', 'gionee', 'portalmmm', 'jig browser', 'hiptop',
                'benq', 'haier', '^lct', '320x320', '240x320', '176x220'];
            foreach ($mobileBrowserList as $val) {
                $result = strpos(strtolower($_SERVER['HTTP_USER_AGENT']), $val);
                if (false !== $result) {
                    setcookie('ismobile', 'yes', 3600);
                    return true;
                }
            }
            setcookie('ismobile', 'no', 3600);
            return false;
        }
    }
360591
function DetectGoogleTV()
   {
      if (stripos($this->useragent, $this->deviceGoogleTV) > -1)
         return $this->true; 
      else
         return $this->false; 
   }
378574
protected function checkBrowserNokia()
    {
        if (preg_match("/Nokia([^\/]+)\/([^ SP]+)/i", $this->_agent, $matches)) {
            $this->setVersion($matches[2]);
            if (stripos($this->_agent, 'Series60') !== false || strpos($this->_agent, 'S60') !== false) {
                $this->setBrowser(self::BROWSER_NOKIA_S60);
            } else {
                $this->setBrowser(self::BROWSER_NOKIA);
            }
            $this->setMobile(true);
            return true;
        }
        return false;
    }
810342
public static function checkBrowserSamsung()
    {
        if (stripos(self::$userAgentString, 'SamsungBrowser') !== false) {
            $aresult = explode('/', stristr(self::$userAgentString, 'SamsungBrowser'));
            if (isset($aresult[1])) {
                $aversion = explode(' ', $aresult[1]);
                self::$browser->setVersion($aversion[0]);
            }
            self::$browser->setName(Browser::SAMSUNG_BROWSER);

            return true;
        }

        return false;
    }
1256868
public static function isPageSecure()
    {
        if (isset($_SERVER['HTTPS']) && strtolower($_SERVER['HTTPS']) === 'on') {

            //  Page is being served through HTTPS
            return true;

        } elseif (isset($_SERVER['SERVER_NAME']) && isset($_SERVER['REQUEST_URI']) && SECURE_BASE_URL != BASE_URL) {

            //  Not being served through HTTPS, but does the URL of the page begin
            //  with SECURE_BASE_URL (when BASE_URL is different)

            $sUrl = 'http://' . $_SERVER['SERVER_NAME'] . $_SERVER['REQUEST_URI'];
            return (bool) preg_match('#^' . SECURE_BASE_URL . '.*#', $sUrl);
        }

        //  Unknown, assume not
        return false;
    }
663939
private function checkCookieAuth()
    {
        if (strlen(trim($this->getUsername())) == 0) {
            $this->objConnector->cleanupSession();
            $this->objConnector->refreshSession();
            return false;
        }
        return true;
    }
233122
public function isResumable(): bool
    {
        $name = $this->getName();

        if ($this->request) {
            return $this->request->cookie($name) !== null;
        }

        return isset($_COOKIE[$name]);
    }
563421
public function isMobile()
    {
        deprecationWarning(
            'RequestHandlerComponent::isMobile() is deprecated. Use ServerRequest::is(\'mobile\') instead.'
        );

        $request = $this->getController()->getRequest();

        return $request->is('mobile') || $this->accepts('wap');
    }
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;
    }
1154521
public function restoreLoginFromCookie()
    {
        if (! $this->cookieIsSet()) {
            return false;
        }

        $fields = $this->config('fields');
        $cookieKey = $this->config('cookieKey');
        $loginData = [];

        foreach ($fields as $field) {
            if ($this->Cookie->check("$cookieKey.$field")) {
                $loginData[$field] = $this->Cookie->read("$cookieKey.$field");
            }
        }

        // $controller->request->data might need to be copied over to $this->request->data, depending on how Auth is looking for it
        $controller = $this->_registry->getController();
        $tempRequest = $controller->request->data;
        $controller->request->data = $loginData;
        $user = $controller->Auth->identify();
        $controller->request->data = $tempRequest;

        if ($user) {
            $controller->Auth->setUser($user);
            return true;
        }

        return false;
    }
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;
    }
97593
def request_is_from_mobile?
      @request_is_from_mobile ||= 
        request.format.to_sym == self.class.mobile_format || 
        IsItMobile.mobile?( request.env['HTTP_USER_AGENT'].to_s, request.env['HTTP_ACCEPT'].to_s )
    end
611272
public function hasActiveSession()
    {
        $cookie = $this->app['cookie'];

        return $cookie->has($this->config->get('concrete.session.name')) || $cookie->has('ccmAuthUserHash');
    }
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;
    }
962313
public function isCookieAlive()
	{
		//	...
		$bRet = false;

		if ( $this->isKeepAlive() )
		{
			//
			//	return false if user set to keep alive
			//
			$bRet	= true;
		}
		else
		{
			//	...
			$nLoginTime = $this->m_cUCProMain->getXTInstance()->getTValue( UCProConst::CKT_LOGIN_TM );
			if ( is_numeric( $nLoginTime ) )
			{
				//
				//	escaped time in seconds after user logged in
				//      the default timeout is 1 day.
				//
				$fTerm	= floatval( time() - floatval( $nLoginTime ) );
				$bRet	= ( $fTerm <= $this->m_cUCProMain->getConfig_nCookieTimeout() );
			}
			else
			{
				//
				//      login time is invalid
				//      So, we marked this cookie as timeout
				//
				$bRet	= false;
			}
		}

		return $bRet;
	}
1210531
private function isFirefoxMobile()
  {
    $is = false;
    $tablet = false;
    $phone = false;
    $android = false;
    $touch = true;
    if ( $this->browser == 'firefox' || $this->isFirefox() )
    {
      if ( preg_match( "/(Mobile|Tablet|TV)/", $this->ua, $matches ) )
      {
        $is = true;
        $tablet = ($matches[1] == 'Tablet' || $matches[1] == 'TV') ? true : false;
        $phone =  ($matches[1] == 'Mobile') ? true : false;
      }
      elseif ( stripos( $this->ua, 'Android' ) !== false )
      {
        // No way to determine phone/tablet
        $is = true;
        $android = true;
      }
      elseif ( stripos( $this->ua, 'Maemo' ) !== false )
      {
        $is = true;
        // It's horizontal, which is probably more like a tablet, but it's only 800x480.
        $phone = true;
        $android = false;
        // Yes, the Maemo units have a touch screen, but it's resistive, and doesn't really function like we think
        // of touch in a current web environment.
        $touch = false;
      }
      elseif ( stripos( $this->ua, 'Fennec' ) !== false )
      {
        // No way to determine phone/tablet OR OS
        $is = true;
      }
    }

    if ( $is )
    {
      $this->android = $android;
      // No Firefox for iOS
      $this->ios = false;
      $this->tablet = $tablet;
      $this->phone = $phone;
      $this->mobile = true;
      $this->touch = $touch;
    }

    return $is;
  }