/*! * 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'] : ''; $distance = isset($_POST['distance']) ? $_POST['distance'] : 30; $itemId = isset($_POST['itemId']) ? $_POST['itemId'] : 0; $distance = helper::clearInt($distance); $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."); } $account = new account($dbo, $accountId); $account_info = $account->get(); $geo = new geo($dbo); $geo->setRequestFrom($accountId); $result = $geo->getPeopleNearby($itemId, $account_info['lat'], $account_info['lng'], $distance); echo json_encode($result); exit; }