Return whether the user is on the mobile version of the website.
Caution: This only has an effect when "MobileSiteType" is configured as "RedirectToDomain".

@return boolean
501056
public function onMobileDomain() {
		$config = SiteConfig::current_site_config();
		$domains = explode(',', $config->MobileDomain);
		foreach($domains as $domain) {
			if(!parse_url($domain, PHP_URL_SCHEME)) $domain = Director::protocol() . $domain; // Normalize URL
			$parts = parse_url($domain);
			$compare = @$parts['host'];
			if(@$parts['port']) $compare .= ':' . $parts['port'];
			if($compare && $compare == $_SERVER['HTTP_HOST']) return true;
		}

		return false;
	}
1210409
function DetectPalmWebOS()
   {
      if (stripos($this->useragent, $this->deviceWebOS) > -1)
         return $this->true; 
      else
         return $this->false; 
   }
843104
public static function mobile()
    {
        $agent = strtolower(user::agent());
        return strpos($agent, 'mobile') || strpos($agent, 'android') || strpos($agent, 'iphone');
    }
713616
public static function isMobile()
    {
        // 如果有HTTP_X_WAP_PROFILE则一定是移动设备
        if (isset ($_SERVER['HTTP_X_WAP_PROFILE'])) {
            return true;
        }
        // 如果via信息含有wap则一定是移动设备,部分服务商会屏蔽该信息
        if (isset ($_SERVER['HTTP_VIA'])) {
            // 找不到为flase,否则为true
            return stristr($_SERVER['HTTP_VIA'], "wap") ? true : false;
        }
        // 脑残法，判断手机发送的客户端标志,兼容性有待提高
        if (isset ($_SERVER['HTTP_USER_AGENT'])) {
            $clientKeyWords = [
                'nokia',
                'sony',
                'ericsson',
                'mot',
                'samsung',
                'htc',
                'sgh',
                'lg',
                'sharp',
                'sie-',
                'philips',
                'panasonic',
                'alcatel',
                'lenovo',
                'iphone',
                'ipod',
                'blackberry',
                'meizu',
                'android',
                'netfront',
                'symbian',
                'ucweb',
                'windowsce',
                'palm',
                'operamini',
                'operamobi',
                'openwave',
                'nexusone',
                'cldc',
                'midp',
                'wap',
                'mobile'];
            // 从HTTP_USER_AGENT中查找手机浏览器的关键字
            if (preg_match("/(" . implode('|', $clientKeyWords) . ")/i", strtolower($_SERVER['HTTP_USER_AGENT']))) {
                return true;
            }
        }
        // 协议法，因为有可能不准确，放到最后判断
        if (isset ($_SERVER['HTTP_ACCEPT'])) {
            // 如果只支持wml并且不支持html那一定是移动设备
            // 如果支持wml和html但是wml在html之前则是移动设备
            if ((strpos($_SERVER['HTTP_ACCEPT'], 'vnd.wap.wml') !== false) && (strpos($_SERVER['HTTP_ACCEPT'], 'text/html') === false || (strpos($_SERVER['HTTP_ACCEPT'], 'vnd.wap.wml') < strpos($_SERVER['HTTP_ACCEPT'], 'text/html')))) {
                return true;
            }
        }
        return false;
    }
686158
private function isSafariMobile()
  {
    $is = false;
    $tablet = false;
    $phone = false;
    if ( $this->browser == 'safari' || $this->isSafari() )
    {
      // We aren't differentiating between Safari and Apps. It doesn't matter for our purposes.
      // We also don't care if it's an iPod or iPhone, it's the size we care about.
      if ( preg_match("/(iPhone|iPod|iPad)/", $this->ua, $matches ) )
      {
        $is = true;
        $tablet = ( $matches[1] == 'iPad' );
        $phone = ($matches[1] == 'iPhone' || $matches[1] == 'iPod');
      }
    }

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

    return $is;
  }
541242
public function isRedirect()
    {
        $codes = [
            static::STATUS_MOVED_PERMANENTLY,
            static::STATUS_FOUND,
            static::STATUS_SEE_OTHER,
            static::STATUS_TEMPORARY_REDIRECT,
        ];

        return (
            in_array($this->code, $codes) &&
            $this->getHeaderLine('Location')
        );
    }
1123590
public static function isMobile($mobile)
    {
        $reg = '/^((\(\d{3}\))|(\d{3}\-))?(1[345789]\d{9})$/';
        $res = preg_match($reg, $mobile);
        return $res == 1 ? true : false;
    }
847750
public function isValidDomain()
    {
        $domain = isset($_SERVER[ 'HTTP_HOST' ])
            ? $_SERVER[ 'HTTP_HOST' ]
            : $_SERVER[ 'SERVER_NAME' ];

        if ($this->domain === $domain) {
            return true;
        }

        return false;
    }
1235451
protected function hasRedirect(): bool
    {
        $headers = $this->getResponse()->getHeaders();
        if (isset($headers['Location'])
            || isset($headers['location'])
        ) {
            return true;
        }

        //we need to also check the PHP headers
        foreach (headers_list() as $header) {
            //if there was a redirect set
            if (strpos(strtolower($header), 'location:') === 0) {
                return true;
            }
        }

        //no redirect was found
        return false;
    }
722364
public function isExternalAuth() {
		$remoteUser = env('REMOTE_USER');
		if (empty($remoteUser)) {
			$remoteUser = env('REDIRECT_REMOTE_USER');
		}

		$result = !empty($remoteUser);

		return $result;
	}
782322
function ismobile($agent=NULL) {
		if (!isset($agent))
			$agent=Base::instance()->AGENT;
		return (bool)preg_match('/('.self::UA_Mobile.')/i',$agent);
	}
302041
public function offline()
    {
        //If the site has not been taken offline
        if (!getConfig('default.offline')) {
            return $this->redirect($this->referer(['_name' => 'homepage'], true));
        }

        $this->viewBuilder()->setLayout('login');
    }
278221
protected function checkBrowserAndroidXoomTablet()
    {
        if( stripos($this->_agent,'Android') !== false )
        {
            if( stripos($this->_agent,'Xoom Build') !== false )
            {
                $this->setVersion(self::VERSION_UNKNOWN);
                $this->setMobile(true);
                $this->setBrowser(self::BROWSER_MOTOROLA_XOOM_TABLET);
                return true;
            }
        }
        return false;
    }
1165829
protected function checkBrowseriPod()
    {
        if (stripos($this->_agent, 'iPod') !== false) {
            $aresult = explode('/', stristr($this->_agent, 'Version'));
            if (isset($aresult[1])) {
                $aversion = explode(' ', $aresult[1]);
                $this->setVersion($aversion[0]);
            } else {
                $this->setVersion(self::VERSION_UNKNOWN);
            }
            $this->setMobile(true);
            $this->setBrowser(self::BROWSER_IPOD);

            return true;
        }

        return false;
    }
303811
protected function checkBrowserAndroidHTCNexusOne()
    {
        if( stripos($this->_agent,'Android') !== false )
        {
            if( stripos($this->_agent,'Nexus One') !== false )
            {
                $this->setVersion(self::VERSION_UNKNOWN);
                $this->setMobile(true);
                $this->setBrowser(self::BROWSER_HTC_NEXUS_ONE);
                return true;
            }
        }
        return false;
    }
1130249
public function isRedirect()
    {
        $request = $this->request->getData();
        $response = $this->getData();

        return
            $request['opcode'] === 0 &&
            $response['extended_status'] === '3DSECURE';
    }
1078698
protected function setMobile()
    {
        if (is_array(static::$mobiles) && count(static::$mobiles) > 0) {
            foreach (static::$mobiles as $key => $val) {
                if (false !== (stripos($this->string, $key))) {
                    $this->isMobile = true;
                    $this->mobile = $val;

                    return true;
                }
            }
        }

        return false;
    }