public function getAll($notifyId = 0) { if ($notifyId == 0) { $notifyId = $this->getMaxId(); $notifyId++; } $notifications = array("error" => false, "error_code" => ERROR_SUCCESS, "notifyId" => $notifyId, "notifications" => array()); $stmt = $this->db->prepare("SELECT * FROM notifications WHERE notifyToId = (:notifyToId) AND id < (:notifyId) ORDER BY id DESC LIMIT 20"); $stmt->bindParam(':notifyToId', $this->requestFrom, PDO::PARAM_INT); $stmt->bindParam(':notifyId', $notifyId, PDO::PARAM_INT); if ($stmt->execute()) { if ($stmt->rowCount() > 0) { while ($row = $stmt->fetch()) { $time = new language($this->db, $this->language); if ($row['notifyFromId'] == 0) { $profileInfo = array("id" => 0, "state" => 0, "username" => "", "fullname" => "", "lowPhotoUrl" => "/img/profile_default_photo.png"); } else { $profile = new profile($this->db, $row['notifyFromId']); $profileInfo = $profile->get(); unset($profile); } $data = array("id" => $row['id'], "type" => $row['notifyType'], "itemId" => $row['itemId'], "fromUserId" => $profileInfo['id'], "fromUserState" => $profileInfo['state'], "fromUserUsername" => $profileInfo['username'], "fromUserFullname" => $profileInfo['fullname'], "fromUserPhotoUrl" => $profileInfo['lowPhotoUrl'], "createAt" => $row['createAt'], "timeAgo" => $time->timeAgo($row['createAt'])); array_push($notifications['notifications'], $data); $notifications['notifyId'] = $row['id']; unset($data); } } } return $notifications; }
public function info($giftId) { $result = array("error" => true, "error_code" => ERROR_UNKNOWN); $stmt = $this->db->prepare("SELECT * FROM gifts WHERE id = (:giftId) LIMIT 1"); $stmt->bindParam(":giftId", $giftId, PDO::PARAM_INT); if ($stmt->execute()) { if ($stmt->rowCount() > 0) { $row = $stmt->fetch(); $time = new language($this->db, $this->language); $profile = new profile($this->db, $row['giftFrom']); $profileInfo = $profile->get(); unset($profile); $result = array("error" => false, "error_code" => ERROR_SUCCESS, "id" => $row['id'], "giftId" => $row['giftId'], "giftTo" => $row['giftTo'], "giftFrom" => $row['giftFrom'], "giftFromUserVip" => $profileInfo['vip'], "giftFromUserVerify" => $profileInfo['verify'], "giftFromUserUsername" => $profileInfo['username'], "giftFromUserFullname" => $profileInfo['fullname'], "giftFromUserPhoto" => $profileInfo['lowPhotoUrl'], "giftAnonymous" => $row['giftAnonymous'], "message" => htmlspecialchars_decode(stripslashes($row['message'])), "imgUrl" => $row['imgUrl'], "createAt" => $row['createAt'], "date" => date("Y-m-d H:i:s", $row['createAt']), "timeAgo" => $time->timeAgo($row['createAt']), "removeAt" => $row['removeAt']); } } return $result; }
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; }
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(); // test to my like $myLike = false; if ($this->requestFrom != 0) { if ($this->is_like_exists($this->requestFrom)) { $myLike = true; } } // test to blocked $blocked = false; if ($this->requestFrom != 0) { $blacklist = new blacklist($this->db); $blacklist->setRequestFrom($this->requestFrom); if ($blacklist->isExists($this->id)) { $blocked = true; } unset($blacklist); } // test to follow $follow = false; if ($this->requestFrom != 0) { if ($this->is_follower_exists($this->requestFrom)) { $follow = true; } } // test to friend $friend = false; if ($this->requestFrom != 0) { if ($this->is_friend_exists($this->requestFrom)) { $friend = true; } } // test to my follower $follower = false; if ($this->requestFrom != 0) { $myProfile = new profile($this->db, $this->requestFrom); if ($myProfile->is_follower_exists($this->getId())) { $follower = true; } unset($myProfile); } // is my profile exists in blacklist $inBlackList = false; if ($this->requestFrom != 0) { $blacklist = new blacklist($this->db); $blacklist->setRequestFrom($this->getId()); if ($blacklist->isExists($this->getRequestFrom())) { $inBlackList = true; } unset($blacklist); } $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'], "ghost" => $row['ghost'], "vip" => $row['vip'], "rating" => $row['rating'], "state" => $row['state'], "sex" => $row['sex'], "year" => $row['bYear'], "month" => $row['bMonth'], "day" => $row['bDay'], "lat" => $row['lat'], "lng" => $row['lng'], "username" => $row['login'], "fullname" => htmlspecialchars_decode(stripslashes($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'], "lowPhotoUrl" => $row['lowPhotoUrl'], "bigPhotoUrl" => $row['bigPhotoUrl'], "normalPhotoUrl" => $row['normalPhotoUrl'], "normalCoverUrl" => $row['normalCoverUrl'], "originCoverUrl" => $row['originCoverUrl'], "coverPosition" => $row['coverPosition'], "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'], "allowPhotosComments" => $row['allowPhotosComments'], "allowMessages" => $row['allowMessages'], "friendsCount" => $row['friends_count'], "photosCount" => $row['photos_count'], "likesCount" => $row['likes_count'], "giftsCount" => $row['gifts_count'], "follower" => $follower, "friend" => $friend, "inBlackList" => $inBlackList, "follow" => $follow, "blocked" => $blocked, "myLike" => $myLike, "createAt" => $row['regtime'], "createDate" => date("Y-m-d", $row['regtime']), "lastAuthorize" => $row['last_authorize'], "lastAuthorizeDate" => date("Y-m-d H:i:s", $row['last_authorize']), "lastAuthorizeTimeAgo" => $time->timeAgo($row['last_authorize']), "online" => $online); } } return $result; }
function draw($msg, $helper = null) { $msg['message'] = helper::processMsgText($msg['message']); $fromUserPhoto = "/img/profile_default_photo.png"; if (strlen($msg['fromUserPhotoUrl']) != 0) { $fromUserPhoto = $msg['fromUserPhotoUrl']; } ?> <div class="post post_item" data-id="<?php echo $msg['id']; ?> "> <a class="profile_cont" href="/admin/profile.php/?id<?php echo $msg['fromUserId']; ?> "> <img src="<?php echo $fromUserPhoto; ?> "> </a> <div class="post_content"> <div class="action_remove" onclick="Message.remove('<?php echo $msg['id']; ?> ', '<?php echo admin::getAccessToken(); ?> '); return false;"></div> <div class="post_title"> <a href="/admin/profile.php/?id=<?php echo $msg['fromUserId']; ?> "> <span class="post_fullname"><?php echo $msg['fromUserFullname']; ?> </span> <s>@</s><b class="post_username"><?php echo $msg['fromUserUsername']; ?> </b> </a> </div> <div class="post_data"> <?php echo $msg['message']; ?> </div> <?php if (strlen($msg['imgUrl'])) { ?> <div class="post_img"> <img src="<?php echo $msg['imgUrl']; ?> "/> </div> <?php } ?> <div class="post_footer"> <?php $time = new language(NULL, "en"); ?> <a class="time" href="javascript:void(0);"><?php echo $time->timeAgo($msg['createAt']); ?> </a> </div> </div> </div> <?php }
public function info($itemId) { $result = array("error" => true, "error_code" => ERROR_UNKNOWN); $stmt = $this->db->prepare("SELECT * FROM friends WHERE id = (:itemId) LIMIT 1"); $stmt->bindParam(":itemId", $itemId, PDO::PARAM_INT); if ($stmt->execute()) { if ($stmt->rowCount() > 0) { $row = $stmt->fetch(); $time = new language($this->db, $this->language); $profile = new profile($this->db, $row['friend']); $profileInfo = $profile->get(); unset($profile); $result = array("error" => false, "error_code" => ERROR_SUCCESS, "id" => $row['id'], "friendUserId" => $row['friend'], "friendUserVip" => $profileInfo['vip'], "friendUserVerify" => $profileInfo['verify'], "friendUserUsername" => $profileInfo['username'], "friendUserFullname" => $profileInfo['fullname'], "friendUserPhoto" => $profileInfo['lowPhotoUrl'], "friendUserOnline" => $profileInfo['online'], "friendLocation" => $profileInfo['location'], "friendTo" => $row['friendTo'], "friend" => $row['friend'], "createAt" => $row['createAt'], "date" => date("Y-m-d H:i:s", $row['createAt']), "timeAgo" => $time->timeAgo($row['createAt']), "removeAt" => $row['removeAt']); } } return $result; }
private function itemInfo($itemId) { $result = array("error" => true, "error_code" => ERROR_UNKNOWN); $stmt = $this->db->prepare("SELECT * FROM profile_blacklist WHERE id = (:itemId) LIMIT 1"); $stmt->bindParam(":itemId", $itemId, PDO::PARAM_INT); if ($stmt->execute()) { if ($stmt->rowCount() > 0) { $row = $stmt->fetch(); $time = new language($this->db, $this->language); $profile = new profile($this->db, $row['blockedUserId']); $blockedUserId = $profile->get(); unset($profile); $lowPhotoUrl = "/img/profile_default_photo.png"; if (strlen($blockedUserId['lowPhotoUrl']) != 0) { $lowPhotoUrl = $blockedUserId['lowPhotoUrl']; } $result = array("error" => false, "error_code" => ERROR_SUCCESS, "id" => $row['id'], "blockedUserId" => $row['blockedUserId'], "blockedUserState" => $blockedUserId['state'], "blockedUserVerify" => $blockedUserId['verify'], "blockedUserUsername" => $blockedUserId['username'], "blockedUserFullname" => $blockedUserId['fullname'], "blockedUserPhotoUrl" => $lowPhotoUrl, "reason" => htmlspecialchars_decode(stripslashes($row['reason'])), "createAt" => $row['createAt'], "removeAt" => $row['removeAt'], "timeAgo" => $time->timeAgo($row['createAt'])); } } return $result; }
public function info($photoId) { $result = array("error" => true, "error_code" => ERROR_UNKNOWN); $stmt = $this->db->prepare("SELECT * FROM photos WHERE id = (:photoId) LIMIT 1"); $stmt->bindParam(":photoId", $photoId, PDO::PARAM_INT); if ($stmt->execute()) { if ($stmt->rowCount() > 0) { $row = $stmt->fetch(); $time = new language($this->db, $this->language); $profile = new profile($this->db, $row['fromUserId']); $profileInfo = $profile->get(); unset($profile); $result = array("error" => false, "error_code" => ERROR_SUCCESS, "id" => $row['id'], "accessMode" => $row['accessMode'], "fromUserId" => $row['fromUserId'], "fromUserVerify" => $profileInfo['verify'], "fromUserUsername" => $profileInfo['username'], "fromUserFullname" => $profileInfo['fullname'], "fromUserPhoto" => $profileInfo['lowPhotoUrl'], "comment" => htmlspecialchars_decode(stripslashes($row['comment'])), "area" => htmlspecialchars_decode(stripslashes($row['area'])), "country" => htmlspecialchars_decode(stripslashes($row['country'])), "city" => htmlspecialchars_decode(stripslashes($row['city'])), "lat" => $row['lat'], "lng" => $row['lng'], "imgUrl" => $row['imgUrl'], "previewImgUrl" => $row['previewImgUrl'], "originImgUrl" => $row['originImgUrl'], "rating" => $row['rating'], "commentsCount" => $row['commentsCount'], "likesCount" => $row['likesCount'], "createAt" => $row['createAt'], "date" => date("Y-m-d H:i:s", $row['createAt']), "timeAgo" => $time->timeAgo($row['createAt']), "removeAt" => $row['removeAt']); } } return $result; }