public static function isLogin() { if (isset($_REQUEST['login'])) { return $_REQUEST['login']; } if (!isset($_COOKIE['wrm_aid']) || !isset($_COOKIE['wrm_atype'])) { return false; } else { $cookieId = UidEncryptUtil::decryptUid($_COOKIE['wrm_aid']); $cookieType = $_COOKIE['wrm_atype']; $session = Yaf_Session::getInstance(); $oauthId = $session->offsetGet('wrm_oauth_id'); $oauthType = $session->offsetGet('wrm_oauth_type'); $oauthExpire = intval($session->offsetGet('wrm_oauth_expire')); $oauthToken = $session->offsetGet("wrm_oauth_token"); self::getClient($cookieType); if ($cookieId != $oauthId || $cookieType != $oauthType) { if (!empty($oauthId)) { self::delSession(); } return false; UserApi::getAccessToken($cookieId, $cookieType); $oauthToken = $session->offsetGet("wrm_oauth_token"); } if (empty($oauthToken)) { self::delSession(); self::delCookie(); return false; } if ($oauthExpire > time()) { self::$client = null; self::getClient($cookieType); return true; } else { if (!empty($oauthId) && !empty($oauthType)) { $client = self::getClient($oauthType); $client->getAccessToken(); if ($client->expireTime > time()) { return true; } } self::delSession(); self::delCookie(); return false; } } }