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;
 }
Esempio n. 2
0
 * 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;
    $profileId = helper::clearInt($profileId);
    $result = array("error" => true, "error_code" => ERROR_UNKNOWN);
    $auth = new auth($dbo);
    if (!$auth->authorize($accountId, $accessToken)) {
        api::printError(ERROR_ACCESS_TOKEN, "Error authorization.");
    }
    $profile = new profile($dbo, $profileId);
    $profile->setRequestFrom($accountId);
    $account = new account($dbo, $accountId);
    $accountInfo = $account->get();
    if ($profileId == $accountId) {
        $account->setLastActive();
    } else {
        if ($accountInfo['ghost'] == 0) {
            $guests = new guests($dbo, $profileId);
            $guests->setRequestFrom($accountId);
            $guests->add($accountId);
        }
    }
    $result = $profile->get();
    echo json_encode($result);
    exit;
}
Esempio n. 3
0
<?php

include 'classes/guests.php';
$oGuests = new guests();
echo $oGuests->getAppId() . PHP_EOL;
echo 'Login status: ' . $oGuests->login() . PHP_EOL;
$sType = 'users';
echo 'Password updated status: ' . $oGuests->updatePassword($sType) . PHP_EOL;
echo $oGuests->getAge() . PHP_EOL;
echo $oGuests->getPin() . PHP_EOL;
Esempio n. 4
0
/*!
 * 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'] : '';
    $itemId = isset($_POST['itemId']) ? $_POST['itemId'] : 0;
    $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.");
    }
    if ($itemId == 0) {
        $account = new account($dbo, $accountId);
        $account->setLastGuestsView();
        unset($account);
    }
    $guests = new guests($dbo, $accountId);
    $guests->setRequestFrom($accountId);
    $result = $guests->get($itemId);
    echo json_encode($result);
    exit;
}