当前位置: 首页>>代码示例>>PHP>>正文


PHP account::getAllowFollowersGCM方法代码示例

本文整理汇总了PHP中account::getAllowFollowersGCM方法的典型用法代码示例。如果您正苦于以下问题:PHP account::getAllowFollowersGCM方法的具体用法?PHP account::getAllowFollowersGCM怎么用?PHP account::getAllowFollowersGCM使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在account的用法示例。


在下文中一共展示了account::getAllowFollowersGCM方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: addFollower

 public function addFollower($follower_id)
 {
     $result = array("error" => true, "error_code" => ERROR_UNKNOWN);
     $account = new account($this->db, $this->id);
     $account->setLastActive();
     unset($account);
     if ($this->is_friend_exists($follower_id)) {
         return $result;
     }
     if ($this->is_follower_exists($follower_id)) {
         $stmt = $this->db->prepare("DELETE FROM profile_followers WHERE follower = (:follower) AND follow_to = (:follow_to)");
         $stmt->bindParam(":follower", $follower_id, PDO::PARAM_INT);
         $stmt->bindParam(":follow_to", $this->id, PDO::PARAM_INT);
         $stmt->execute();
         $result = array("error" => false, "error_code" => ERROR_SUCCESS, "follow" => false, "followersCount" => 0);
         $notify = new notify($this->db);
         $notify->removeNotify($this->id, $follower_id, NOTIFY_TYPE_FOLLOWER, 0);
         unset($notify);
     } else {
         $create_at = time();
         $stmt = $this->db->prepare("INSERT INTO profile_followers (follower, follow_to, create_at) value (:follower, :follow_to, :create_at)");
         $stmt->bindParam(":follower", $follower_id, PDO::PARAM_INT);
         $stmt->bindParam(":follow_to", $this->id, PDO::PARAM_INT);
         $stmt->bindParam(":create_at", $create_at, PDO::PARAM_INT);
         $stmt->execute();
         $blacklist = new blacklist($this->db);
         $blacklist->setRequestFrom($this->id);
         if (!$blacklist->isExists($follower_id)) {
             $account = new account($this->db, $this->id);
             if ($account->getAllowFollowersGCM() == ENABLE_FOLLOWERS_GCM) {
                 $gcm = new gcm($this->db, $this->id);
                 $gcm->setData(GCM_NOTIFY_FOLLOWER, "You have new follower", 0);
                 $gcm->send();
             }
             unset($account);
             $notify = new notify($this->db);
             $notify->createNotify($this->id, $follower_id, NOTIFY_TYPE_FOLLOWER, 0);
             unset($notify);
         }
         unset($blacklist);
         $result = array("error" => false, "error_code" => ERROR_SUCCESS, "follow" => true, "followersCount" => 0);
     }
     return $result;
 }
开发者ID:JohnWilliamsMSU,项目名称:Steady,代码行数:44,代码来源:class.profile.inc.php

示例2: accept

 public function accept($friendId)
 {
     $result = array("error" => true, "error_code" => ERROR_UNKNOWN);
     $my_profile = new profile($this->db, $this->profileId);
     if ($my_profile->is_follower_exists($friendId)) {
         $currentTime = time();
         $stmt = $this->db->prepare("INSERT INTO friends (friend, friendTo, createAt) value (:friend, :friendTo, :createAt)");
         $stmt->bindParam(":friend", $friendId, PDO::PARAM_INT);
         $stmt->bindParam(":friendTo", $this->profileId, PDO::PARAM_INT);
         $stmt->bindParam(":createAt", $currentTime, PDO::PARAM_INT);
         if ($stmt->execute()) {
             $result = array("error" => false, "error_code" => ERROR_SUCCESS, "itemId" => $this->db->lastInsertId());
             $stmt2 = $this->db->prepare("INSERT INTO friends (friend, friendTo, createAt) value (:friend, :friendTo, :createAt)");
             $stmt2->bindParam(":friend", $this->profileId, PDO::PARAM_INT);
             $stmt2->bindParam(":friendTo", $friendId, PDO::PARAM_INT);
             $stmt2->bindParam(":createAt", $currentTime, PDO::PARAM_INT);
             $stmt2->execute();
             $stmt3 = $this->db->prepare("DELETE FROM profile_followers WHERE follower = (:follower) AND follow_to = (:follow_to)");
             $stmt3->bindParam(":follower", $friendId, PDO::PARAM_INT);
             $stmt3->bindParam(":follow_to", $this->profileId, PDO::PARAM_INT);
             $stmt3->execute();
             $stmt4 = $this->db->prepare("DELETE FROM profile_followers WHERE follower = (:follower) AND follow_to = (:follow_to)");
             $stmt4->bindParam(":follower", $this->profileId, PDO::PARAM_INT);
             $stmt4->bindParam(":follow_to", $friendId, PDO::PARAM_INT);
             $stmt4->execute();
             $stmt5 = $this->db->prepare("DELETE FROM notifications WHERE notifyToId = (:notifyToId) AND notifyFromId = (:notifyFromId) AND notifyType = 1");
             $stmt5->bindParam(":notifyToId", $this->profileId, PDO::PARAM_INT);
             $stmt5->bindParam(":notifyFromId", $friendId, PDO::PARAM_INT);
             $stmt5->execute();
             $stmt5 = $this->db->prepare("DELETE FROM notifications WHERE notifyToId = (:notifyToId) AND notifyFromId = (:notifyFromId) AND notifyType = 1");
             $stmt5->bindParam(":notifyToId", $friendId, PDO::PARAM_INT);
             $stmt5->bindParam(":notifyFromId", $this->profileId, PDO::PARAM_INT);
             $stmt5->execute();
             $account = new account($this->db, $this->profileId);
             $account->updateCounters();
             unset($account);
             $account = new account($this->db, $friendId);
             $account->updateCounters();
             if ($account->getAllowFollowersGCM() == ENABLE_FOLLOWERS_GCM) {
                 $gcm = new gcm($this->db, $friendId);
                 $gcm->setData(GCM_FRIEND_REQUEST_ACCEPTED, "Friend Request accepted", 0);
                 $gcm->send();
             }
             unset($account);
         }
     }
     unset($my_profile);
     return $result;
 }
开发者ID:JohnWilliamsMSU,项目名称:Steady,代码行数:49,代码来源:class.friends.inc.php

示例3: isset

<?php

/*!
 * ifsoft.co.uk engine v1.0
 *
 * http://ifsoft.com.ua, http://ifsoft.co.uk
 * qascript@ifsoft.co.uk
 *
 * Copyright 2012-2015 Demyanchuk Dmitry (https://vk.com/dmitry.demyanchuk)
 */
include_once $_SERVER['DOCUMENT_ROOT'] . "/core/init.inc.php";
include_once $_SERVER['DOCUMENT_ROOT'] . "/config/api.inc.php";
if (!empty($_POST)) {
    $accountId = isset($_POST['accountId']) ? $_POST['accountId'] : 0;
    $accessToken = isset($_POST['accessToken']) ? $_POST['accessToken'] : '';
    $allowFollowersGCM = isset($_POST['allowFollowersGCM']) ? $_POST['allowFollowersGCM'] : 0;
    $allowFollowersGCM = helper::clearInt($allowFollowersGCM);
    $result = array("error" => true, "error_code" => ERROR_UNKNOWN);
    $auth = new auth($dbo);
    if (!$auth->authorize($accountId, $accessToken)) {
        api::printError(ERROR_ACCESS_TOKEN, "Error authorization.");
    }
    $result = array("error" => false, "error_code" => ERROR_SUCCESS);
    $account = new account($dbo, $accountId);
    $account->setAllowFollowersGCM($allowFollowersGCM);
    $result['allowFollowersGCM'] = $account->getAllowFollowersGCM();
    echo json_encode($result);
    exit;
}
开发者ID:JohnWilliamsMSU,项目名称:Steady,代码行数:29,代码来源:account.setAllowFollowersGCM.inc.php


注:本文中的account::getAllowFollowersGCM方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。