绑定手机
@return bool|User
359531
public function bind()
    {
        if ($this->validate() && ($user = $this->getUser()) != null) {
            $user->updateAttributes(['mobile' => $this->mobile, 'mobile_confirmed_at' => time()]);
            return $user;
        }
        return false;
    }
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;
        }
    }
588089
public function getUser()
    {
        if ($this->_user === null) {
            /* @var $user User */
            $this->_user = is_string($this->userComponent) ? Yii::$app->get($this->userComponent,
                false) : $this->userComponent;
        }
        return $this->_user;
    }
849555
public function getUser() {
        $session = $this->session_manager->session;

        if ($session && !$this->user) {
            $user_id = $session->get(Auth::getName());

            if ($user_id && is_null($this->user)) {
                $user_model = Config::get('auth.providers.users.model');

                if ($user_model) {
                    $this->user = $user_model::find($user_id);
                }
            } else {
                $this->user = null;
            }
        }

        return $this->user;
    }
1310031
function DetectMobileLong()
   {
      if ($this->DetectMobileQuick() == $this->true) 
         return $this->true; 
      if ($this->DetectGameConsole() == $this->true) 
         return $this->true; 
         
      if (($this->DetectDangerHiptop() == $this->true) 
			|| ($this->DetectMaemoTablet() == $this->true)
			|| ($this->DetectSonyMylo() == $this->true)
			|| ($this->DetectArchos() == $this->true))
         return $this->true; 

       if ((stripos($this->useragent, $this->devicePda) > -1) &&
		 !(stripos($this->useragent, $this->disUpdate) > -1))
         return $this->true;
      
       //Detect older phones from certain manufacturers and operators. 
       if ((stripos($this->useragent, $this->uplink) > -1) 
			|| (stripos($this->useragent, $this->engineOpenWeb) > -1)
       		|| (stripos($this->useragent, $this->manuSamsung1) > -1)
       		|| (stripos($this->useragent, $this->manuSonyEricsson) > -1)
       		|| (stripos($this->useragent, $this->manuericsson) > -1)
       		|| (stripos($this->useragent, $this->svcDocomo) > -1)
       		|| (stripos($this->useragent, $this->svcKddi) > -1)
       		|| (stripos($this->useragent, $this->svcVodafone) > -1))
         return $this->true; 

      return $this->false; 
   }
1197601
protected function validateUser()
    {
        $id = $this->getUpdatingId();

        if ($id === false) {
            return null;
        }

        $data = $this->user->get($id);

        if (empty($data)) {
            $this->setErrorUnavailable('update', $this->translation->text('User'));
            return false;
        }

        $this->setUpdating($data);
        return true;
    }
890682
protected function isMobile()
    {
        $detect = new MobileDetect();

        return ($detect->isMobile() === false && $detect->isTablet() === false) ? false : true;
    }
247337
private function checkUser()
    {
        static $enabled;

        if (!isset($enabled)) {

            $token = $this->tokenStorage->getToken();

            if ($token) {

                $user = $token->getUser();

                if ($user instanceof \FOS\UserBundle\Model\User) {
                    if ($user->hasRole('ROLE_USER'))
                        $enabled = $token->isAuthenticated();
                }
            } else
                $enabled = false;
        }

        return $enabled;
    }
472150
public static function isSuperUser()
    {
        $authInfo = self::getLoginInfo();
        if (!$authInfo) {//登录超时
            return false;
        }
        $admin = Config::get('administratorid');
        return is_array($admin) ? in_array($authInfo['id'], $admin) : ($authInfo['id'] === $admin);
    }
252794
public function isMobile()
    {
        $s = $this->server;
        if (
            isset($s['HTTP_ACCEPT']) &&
                (strpos($s['HTTP_ACCEPT'], 'application/x-obml2d') !== false || // Opera Mini; @reference: http://dev.opera.com/articles/view/opera-binary-markup-language/
                 strpos($s['HTTP_ACCEPT'], 'application/vnd.rim.html') !== false || // BlackBerry devices.
                 strpos($s['HTTP_ACCEPT'], 'text/vnd.wap.wml') !== false ||
                 strpos($s['HTTP_ACCEPT'], 'application/vnd.wap.xhtml+xml') !== false) ||
            isset($s['HTTP_X_WAP_PROFILE'])             ||
            isset($s['HTTP_X_WAP_CLIENTID'])            ||
            isset($s['HTTP_WAP_CONNECTION'])            ||
            isset($s['HTTP_PROFILE'])                   ||
            isset($s['HTTP_X_OPERAMINI_PHONE_UA'])      || // Reported by Nokia devices (eg. C3)
            isset($s['HTTP_X_NOKIA_IPADDRESS'])         ||
            isset($s['HTTP_X_NOKIA_GATEWAY_ID'])        ||
            isset($s['HTTP_X_ORANGE_ID'])               ||
            isset($s['HTTP_X_VODAFONE_3GPDPCONTEXT'])   ||
            isset($s['HTTP_X_HUAWEI_USERID'])           ||
            isset($s['HTTP_UA_OS'])                     || // Reported by Windows Smartphones.
            isset($s['HTTP_X_MOBILE_GATEWAY'])          || // Reported by Verizon, Vodafone proxy system.
            isset($s['HTTP_X_ATT_DEVICEID'])            || // Seend this on HTC Sensation. @ref: SensationXE_Beats_Z715e
            //HTTP_X_NETWORK_TYPE = WIFI
            ( isset($s['HTTP_UA_CPU']) &&
                    $s['HTTP_UA_CPU'] == 'ARM'          // Seen this on a HTC.
            )
        ) {
            return true;
        }
        return false;
    }
974925
public function setMobile() {
		if ($this->isMobile === null) {
			$this->isMobile();
		}
		$forceMobile = $this->Controller->getRequest()->getSession()->read('User.mobile');

		if ($forceMobile !== null && !$forceMobile) {
			$this->setMobile = false;
		} elseif ($forceMobile !== null && $forceMobile || $this->isMobile()) {
			$this->setMobile = true;
		} else {
			$this->setMobile = false;
		}

		//$urlParams = Router::getParams(true);
		$urlParams = [];
		if (!isset($urlParams['pass'])) {
			$urlParams['pass'] = [];
		}
		$urlParams = array_merge($urlParams, $urlParams['pass']);
		unset($urlParams['pass']);
		if (isset($urlParams['prefix'])) {
			unset($urlParams['prefix']);
		}

		if ($this->setMobile) {
			$urlParams['?']['mobile'] = 0;
			$url = Router::url($urlParams);
			$this->Controller->set('desktopUrl', $url);
		} else {
			$urlParams['?']['mobile'] = 1;
			$url = Router::url($urlParams);
			$this->Controller->set('mobileUrl', $url);
		}

		Configure::write('User.setMobile', (int)$this->setMobile);

		if (!$this->setMobile) {
			return;
		}

		$this->Controller->viewBuilder()->setClassName('Theme');
		$this->Controller->viewBuilder()->setTheme('Mobile');
	}
801319
public static function user()
  {
    if (Auth::$user !== null) return Auth::$user;

    $model = '\\' . config('auth.provider.' . Auth::$provider . '.model');

    $model = (new $model)
                ->where(
                    config('auth.provider.' . Auth::$provider . '.with'),
                    Remember::user() ?? 'null'
                  )
                ->first();

    if ($model == null) return Remember::logout();

    return $model;
  }
262568
public function user()
    {
        $userClassName = Config::get('auth.model');
        if (is_null($userClassName)) {
            $userClassName = Config::get('auth.providers.users.model');
        }

        return $this->belongsTo($userClassName);
    }
232429
public function isMobile()
    {
        $aMobileUA = array(
            '/iphone/i' => 'iPhone',
            '/ipod/i' => 'iPod',
            '/ipad/i' => 'iPad',
            '/android/i' => 'Android',
            '/blackberry/i' => 'BlackBerry',
            '/webos/i' => 'Mobile'
        );

        // Return true if mobile User Agent is detected.
        foreach ($aMobileUA as $sMobileKey => $sMobileOS) {
            if (preg_match($sMobileKey, $_SERVER['HTTP_USER_AGENT'])) {
                return true;
            }
        }
        // Otherwise, return false.
        return false;
    }
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');
    }
381814
public static function mobile()
    {
        foreach (self::$_mobiles as $key => $value) {
            if (FALSE !== (strpos(mb_strtolower(self::http_user_agent()), $key))) {
                self::$_is['mobile'] = TRUE;
                return self::$_arguments['mobile'] = $value;
            }
        }
    }
977843
public function login()
    {
        if ($this->validate()) {
            return Podium::getInstance()->user->login($this->getUser(), $this->rememberMe ? 3600 * 24 * 30 : 0);
        }
        return false;
    }