public function add($userId, $reason = "") { $result = array("error" => true, "error_code" => ERROR_UNKNOWN); $currentTime = time(); $ip_addr = helper::ip_addr(); $u_agent = helper::u_agent(); $stmt = $this->db->prepare("INSERT INTO profile_blacklist (blockedByUserId, blockedUserId, reason, createAt, ip_addr, u_agent) value (:blockedByUserId, :blockedUserId, :reason, :createAt, :ip_addr, :u_agent)"); $stmt->bindParam(":blockedByUserId", $this->requestFrom, PDO::PARAM_INT); $stmt->bindParam(":blockedUserId", $userId, PDO::PARAM_INT); $stmt->bindParam(":reason", $reason, PDO::PARAM_STR); $stmt->bindParam(":createAt", $currentTime, PDO::PARAM_INT); $stmt->bindParam(":ip_addr", $ip_addr, PDO::PARAM_STR); $stmt->bindParam(":u_agent", $u_agent, PDO::PARAM_STR); if ($stmt->execute()) { $result = array("error" => false, "error_code" => ERROR_SUCCESS); $my_profile = new profile($this->db, $this->requestFrom); if ($my_profile->is_friend_exists($userId)) { $friends = new friends($this->db, $this->requestFrom); $friends->remove($userId); unset($friends); } else { if ($my_profile->is_follower_exists($userId)) { // Unfollow $my_profile->addFollower($userId); } $profile = new profile($this->db, $userId); if ($profile->is_follower_exists($this->requestFrom)) { $profile->addFollower($this->requestFrom); } unset($profile); } unset($my_profile); } 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; }
</ul> </div> </div> <hr style="margin:5px 0"/> </div> <div class="row"> <!--load members if more than one --> <?php if ($allMs = $m->totalMembers(1) > 1) { ?> <?php if (is_array($m_info)) { foreach ($m_info as $key => $mi) { //get friends properties (request pending, rejected and so on) $fr_rquest = new friends(); ?> <div class="col-md-12"> <!-- Widget: user widget style 1 --> <div class="box box-widget widget-user-2 <?php if ($fr_rquest->friendReqExists($mi['m_id']) && $fr_to === $_SESSION['isv_user_id'] && $friendReq_status === 1) { echo "f_req_exists"; } ?> "> <div class="showme">pending friend request</div> <!-- Add the bg color to the header using any of the bg-* classes --> <div class="widget-user-header bg-white"> <a href="<?php echo ISVIPI_URL . 'profile/' . $mi['m_username']; ?>
exit; } $friend_id = cleanGET($PAGE[3]); /** ignore the friend request **/ $f_remove = new friends(); $f_remove->un_friend($friend_id); } /*** RBLOCK USER **/ if ($operation === 'f_block') { if (!isset($PAGE[3]) || empty($PAGE[3])) { $_SESSION[''] = 'An error occurred. Please try again.'; header('location:' . $from_url . ''); exit; } $user_id = cleanGET($PAGE[3]); /** ignore the friend request **/ $block = new friends(); $block->block_user($user_id); } /*** RBLOCK USER **/ if ($operation === 'f_unblock') { if (!isset($PAGE[3]) || empty($PAGE[3])) { $_SESSION[''] = 'An error occurred. Please try again.'; header('location:' . $from_url . ''); exit; } $user_id = cleanGET($PAGE[3]); /** ignore the friend request **/ $unblock = new friends(); $unblock->unblock_user($user_id); }
* * http://ifsoft.com.ua, http://ifsoft.co.uk * qascript@ifsoft.co.uk * * Copyright 2012-2016 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'] : ''; $profileId = isset($_POST['profileId']) ? $_POST['profileId'] : 0; $itemId = isset($_POST['itemId']) ? $_POST['itemId'] : 0; $profileId = helper::clearInt($profileId); $itemId = helper::clearInt($itemId); $result = array("error" => true, "error_code" => ERROR_UNKNOWN); $auth = new auth($dbo); if (!$auth->authorize($accountId, $accessToken)) { api::printError(ERROR_ACCESS_TOKEN, "Error authorization."); } $friends = new friends($dbo, $profileId); $friends->setRequestFrom($accountId); if ($profileId == $accountId && $itemId == 0) { $account = new account($dbo, $accountId); $account->setLastFriendsView(); unset($account); } $result = $friends->get($itemId); echo json_encode($result); exit; }
<?php /*! * ifsoft.co.uk engine v1.0 * * http://ifsoft.com.ua, http://ifsoft.co.uk * qascript@ifsoft.co.uk * * Copyright 2012-2016 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'] : ''; $friendId = isset($_POST['friendId']) ? $_POST['friendId'] : 0; $friendId = helper::clearInt($friendId); $result = array("error" => true, "error_code" => ERROR_UNKNOWN); $auth = new auth($dbo); if (!$auth->authorize($accountId, $accessToken)) { api::printError(ERROR_ACCESS_TOKEN, "Error authorization."); } $friends = new friends($dbo, $accountId); $friends->setRequestFrom($accountId); $result = $friends->accept($friendId); echo json_encode($result); exit; }
<?php /*! * ifsoft.co.uk engine v1.0 * * http://ifsoft.com.ua, http://ifsoft.co.uk * qascript@ifsoft.co.uk * * Copyright 2012-2016 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'] : ''; $friendId = isset($_POST['friendId']) ? $_POST['friendId'] : 0; $friendId = helper::clearInt($friendId); $result = array("error" => true, "error_code" => ERROR_UNKNOWN); $auth = new auth($dbo); if (!$auth->authorize($accountId, $accessToken)) { api::printError(ERROR_ACCESS_TOKEN, "Error authorization."); } $friends = new friends($dbo, $accountId); $friends->setRequestFrom($accountId); $result = $friends->remove($friendId); echo json_encode($result); exit; }