本文整理汇总了PHP中messages::setRequestFrom方法的典型用法代码示例。如果您正苦于以下问题:PHP messages::setRequestFrom方法的具体用法?PHP messages::setRequestFrom怎么用?PHP messages::setRequestFrom使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类messages
的用法示例。
在下文中一共展示了messages::setRequestFrom方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: get
public function get()
{
$result = array("error" => true, "error_code" => ERROR_ACCOUNT_ID);
$stmt = $this->db->prepare("SELECT * FROM users WHERE id = (:id) LIMIT 1");
$stmt->bindParam(":id", $this->id, PDO::PARAM_INT);
if ($stmt->execute()) {
if ($stmt->rowCount() > 0) {
$row = $stmt->fetch();
$notifications_count = 0;
$messages_count = 0;
$guests_count = 0;
$friends_count = 0;
// Get new messages count
$msg = new messages($this->db);
$msg->setRequestFrom($this->id);
$messages_count = $msg->getNewMessagesCount();
unset($msg);
// Get new notifications count
$notifications = new notify($this->db);
$notifications->setRequestFrom($this->id);
$notifications_count = $notifications->getNewCount($row['last_notify_view']);
unset($notifications);
// Get new guests count
$guests = new guests($this->db, $this->id);
$guests->setRequestFrom($this->id);
$guests_count = $guests->getNewCount($row['last_guests_view']);
unset($guests);
// Get new friends count
$friends = new friends($this->db, $this->id);
$friends->setRequestFrom($this->id);
$friends_count = $friends->getNewCount($row['last_friends_view']);
unset($friends);
$profile = new profile($this->db, $row['id']);
$online = false;
$current_time = time();
if ($row['last_authorize'] != 0 && $row['last_authorize'] > $current_time - 15 * 60) {
$online = true;
}
$time = new language($this->db);
$result = array("error" => false, "error_code" => ERROR_SUCCESS, "id" => $row['id'], "gcm_regid" => $row['gcm_regid'], "admob" => $row['admob'], "ghost" => $row['ghost'], "vip" => $row['vip'], "gcm" => $row['gcm'], "balance" => $row['balance'], "fb_id" => $row['fb_id'], "rating" => $row['rating'], "state" => $row['state'], "regtime" => $row['regtime'], "ip_addr" => $row['ip_addr'], "username" => $row['login'], "fullname" => stripcslashes($row['fullname']), "location" => stripcslashes($row['country']), "status" => stripcslashes($row['status']), "fb_page" => stripcslashes($row['fb_page']), "instagram_page" => stripcslashes($row['my_page']), "verify" => $row['verify'], "email" => $row['email'], "emailVerify" => $row['emailVerify'], "sex" => $row['sex'], "year" => $row['bYear'], "month" => $row['bMonth'], "day" => $row['bDay'], "lat" => $row['lat'], "lng" => $row['lng'], "language" => $row['language'], "lowPhotoUrl" => $row['lowPhotoUrl'], "normalPhotoUrl" => $row['normalPhotoUrl'], "bigPhotoUrl" => $row['normalPhotoUrl'], "coverUrl" => $row['normalCoverUrl'], "originCoverUrl" => $row['originCoverUrl'], "iStatus" => $row['iStatus'], "iPoliticalViews" => $row['iPoliticalViews'], "iWorldView" => $row['iWorldView'], "iPersonalPriority" => $row['iPersonalPriority'], "iImportantInOthers" => $row['iImportantInOthers'], "iSmokingViews" => $row['iSmokingViews'], "iAlcoholViews" => $row['iAlcoholViews'], "iLooking" => $row['iLooking'], "iInterested" => $row['iInterested'], "allowComments" => $row['allowComments'], "allowMessages" => $row['allowMessages'], "allowLikesGCM" => $row['allowLikesGCM'], "allowGiftsGCM" => $row['allowGiftsGCM'], "allowCommentsGCM" => $row['allowCommentsGCM'], "allowFollowersGCM" => $row['allowFollowersGCM'], "allowMessagesGCM" => $row['allowMessagesGCM'], "allowCommentReplyGCM" => $row['allowCommentReplyGCM'], "lastAuthorize" => $row['last_authorize'], "lastAuthorizeDate" => date("Y-m-d H:i:s", $row['last_authorize']), "lastAuthorizeTimeAgo" => $time->timeAgo($row['last_authorize']), "online" => $online, "friendsCount" => $row['friends_count'], "photosCount" => $row['photos_count'], "likesCount" => $row['likes_count'], "giftsCount" => $row['gifts_count'], "notificationsCount" => $notifications_count, "guestsCount" => $guests_count, "newFriendsCount" => $friends_count, "messagesCount" => $messages_count);
unset($profile);
unset($time);
}
}
return $result;
}
示例2: isset
*/
include_once $_SERVER['DOCUMENT_ROOT'] . "/core/init.inc.php";
include_once $_SERVER['DOCUMENT_ROOT'] . "/config/api.inc.php";
if (!empty($_POST)) {
$clientId = isset($_POST['clientId']) ? $_POST['clientId'] : 0;
$accountId = isset($_POST['accountId']) ? $_POST['accountId'] : '';
$accessToken = isset($_POST['accessToken']) ? $_POST['accessToken'] : '';
$profileId = isset($_POST['profileId']) ? $_POST['profileId'] : '';
$chatId = isset($_POST['chatId']) ? $_POST['chatId'] : 0;
$msgId = isset($_POST['msgId']) ? $_POST['msgId'] : 0;
$clientId = helper::clearInt($clientId);
$accountId = helper::clearInt($accountId);
$profileId = helper::clearInt($profileId);
$chatId = helper::clearInt($chatId);
$msgId = helper::clearInt($msgId);
$result = array("error" => true, "error_code" => ERROR_UNKNOWN);
$auth = new auth($dbo);
if (!$auth->authorize($accountId, $accessToken)) {
api::printError(ERROR_ACCESS_TOKEN, "Error authorization.");
}
$messages = new messages($dbo);
$messages->setRequestFrom($accountId);
if ($chatId == 0) {
$chatId = $messages->getChatId($accountId, $profileId);
}
if ($chatId != 0) {
$result = $messages->getPreviousMessages($chatId, $msgId);
}
echo json_encode($result);
exit;
}
示例3: get
public function get($chatId, $msgId = 0)
{
if ($msgId == 0) {
$msgId = $this->getMaxMessageId();
$msgId++;
}
$messages = array("error" => false, "error_code" => ERROR_SUCCESS, "chatId" => $chatId, "messagesCount" => $this->messagesCountByChat($chatId), "msgId" => $msgId, "newMessagesCount" => 0, "messages" => array());
$stmt = $this->db->prepare("SELECT id FROM messages WHERE chatId = (:chatId) AND id < (:msgId) AND removeAt = 0 ORDER BY id DESC LIMIT 20");
$stmt->bindParam(':chatId', $chatId, PDO::PARAM_INT);
$stmt->bindParam(':msgId', $msgId, PDO::PARAM_INT);
if ($stmt->execute()) {
while ($row = $stmt->fetch()) {
$msgInfo = $this->info($row['id']);
array_push($messages['messages'], $msgInfo);
$messages['msgId'] = $msgInfo['id'];
unset($msgInfo);
}
$chatInfo = $this->chatInfo($chatId);
$profileId = $chatInfo['fromUserId'];
if ($profileId == $this->getRequestFrom()) {
$this->setChatLastView_FromId($chatId);
} else {
$this->setChatLastView_ToId($chatId);
}
}
$messages_count = 0;
$msg = new messages($this->db);
$msg->setRequestFrom($this->getRequestFrom());
$messages_count = $msg->getNewMessagesCount();
unset($msg);
$messages['newMessagesCount'] = $messages_count;
return $messages;
}