本文整理汇总了PHP中Queue::checkUserFriends方法的典型用法代码示例。如果您正苦于以下问题:PHP Queue::checkUserFriends方法的具体用法?PHP Queue::checkUserFriends怎么用?PHP Queue::checkUserFriends使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Queue
的用法示例。
在下文中一共展示了Queue::checkUserFriends方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: autoLogin
public static function autoLogin($rememberme = true)
{
if (isset($_SESSION["userId"])) {
$userId = $_SESSION["userId"];
$user = GameUsers::getGameUserById($userId);
if (!empty($user)) {
UtilFunctions::storeSessionUser($user, $rememberme);
return $user;
}
}
if (isset($_COOKIE["auth"]) && false) {
$cookie = $_COOKIE["auth"];
$arr = explode('&', $cookie);
$userName = substr($arr[0], 4);
$hash = substr($arr[1], 5);
$user = GameUsers::getGameUserByUserName($userName);
if (!empty($user)) {
if ($hash == md5($user->getPassword())) {
$user->setLastLoginDate(time());
$user->setLoginCount($user->getLoginCount() + 1);
$user->updateToDatabase(DBUtils::getConnection());
Queue::checkUserFriends($user->userId);
UtilFunctions::storeSessionUser($user, $rememberme);
return $user;
} else {
UtilFunctions::forgetMe();
}
}
}
return false;
}
示例2: index
public function index()
{
if (defined("SERVER_PROD")) {
if (!SERVER_PROD) {
$this->user = GameUsers::getGameUserById(2);
LanguageUtils::setLocale($this->user->language);
if (!empty($this->user) && $this->user->active == 0) {
$this->redirect("banned");
exit(1);
}
return;
}
}
$facebook = new Facebook(array('appId' => FB_APP_ID, 'secret' => FB_APP_SECRET, 'cookie' => true));
$login_req = true;
$this->user = UtilFunctions::autoLogin();
if (!empty($this->user)) {
$facebook->setAccessToken($this->user->getOauthToken());
try {
$fbUser = $facebook->api("/me");
if (!empty($fbUser) && !empty($fbUser['id'])) {
$login_req = false;
}
} catch (Exception $exc) {
$this->log->logError($exc->getTraceAsString());
}
} else {
$login_req = true;
if (isset($_GET['error']) || isset($_GET['error_reason']) || isset($_GET['error_description'])) {
if ($_GET['error_description']) {
$this->addError($_GET['error_description']);
}
if (isset($_GET['error_reason'])) {
$this->addError(isset($_GET['error_reason']));
}
echo "<p> Error : " . $_GET['error_reason'] . "</p>";
echo "<p> Please Refresh Page ! </p>";
exit(1);
} else {
$facebook = new Facebook(array('appId' => FB_APP_ID, 'secret' => FB_APP_SECRET, 'cookie' => true));
try {
$fbUser = $facebook->api("/me");
} catch (Exception $exc) {
$this->log->logError($exc->getTraceAsString());
}
if (!empty($fbUser) && !empty($fbUser['id'])) {
$this->user = GameUsers::getGameUserByFBId($fbUser['id']);
if (!empty($this->user)) {
$this->user->setOauthToken($facebook->getAccessToken());
$this->user->setLastLoginDate(time());
$this->user->setLoginCount($this->user->getLoginCount() + 1);
$this->user->updateToDatabase(DBUtils::getConnection());
Queue::checkUserFriends($this->user->userId);
UtilFunctions::storeSessionUser($this->user);
$login_req = false;
} else {
$result = GameUsers::createGameUser($fbUser, $facebook->getAccessToken());
if ($result->success) {
$this->user = $result->result;
if (!empty($result)) {
$userId = $this->user->getUserId();
if (!empty($userId)) {
Queue::checkUserFriends($this->user->userId);
UtilFunctions::storeSessionUser($this->user);
$login_req = false;
$this->newUser = "1";
}
} else {
$this->addError(LANG_FACEBOOK_USER_CREATE_ERROR_UNKNOWN_ERROR);
}
} else {
if (!empty($result->result)) {
foreach ($result->result as $value) {
$this->addError($value);
}
} else {
$this->addError(LANG_FACEBOOK_USER_CREATE_ERROR_UNKNOWN_ERROR);
}
}
unset($result);
}
}
if (!$login_req && !empty($this->user)) {
GameUserLoginLog::insertLog($this->user->userId);
}
}
}
if (!$login_req) {
if (!empty($this->user) && $this->user->active == 0) {
$this->redirect("banned");
exit(1);
}
}
if ($login_req) {
UtilFunctions::forgetMe();
$params = array('scope' => FB_SCOPE, 'redirect_uri' => FB_CALLBACK_URL);
$login_url = $facebook->getLoginUrl($params);
if (isset($_SERVER['QUERY_STRING'])) {
if (strpos($login_url, "?")) {
$login_url . "&" . $_SERVER['QUERY_STRING'];
//.........这里部分代码省略.........
示例3: Facebook
$user->setLoginCount($user->getLoginCount() + 1);
$user->updateToDatabase(DBUtils::getConnection());
Queue::checkUserFriends($user->userId);
UtilFunctions::storeSessionUser($user);
$error = false;
} else {
//new user
$facebook = new Facebook(array('appId' => FB_APP_ID, 'secret' => FB_APP_SECRET, 'cookie' => true));
$facebook->setAccessToken($fbToken);
$fbUser = $facebook->api("/me");
$res = GameUsers::createGameUser($fbUser, $fbToken);
if ($res->success) {
$user = $res->result;
$userId = $user->getUserId();
if (!empty($userId)) {
Queue::checkUserFriends($userId);
UtilFunctions::storeSessionUser($user);
$newUser = "1";
$error = false;
}
} else {
$result->result = LanguageUtils::getText("LANG_FACEBOOK_USER_CREATE_ERROR_UNKNOWN_ERROR");
}
}
} else {
$result->result = "fbUserId or fbToken empty";
}
if (!$error && !empty($user)) {
$result->success = true;
$result->result = new stdClass();
$result->result->user = $user;