Esempio n. 1
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)) {
    $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;
    $clientId = helper::clearInt($clientId);
    $accountId = helper::clearInt($accountId);
    $profileId = helper::clearInt($profileId);
    $chatId = helper::clearInt($chatId);
    $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);
    $verifyId = $messages->getChatId($accountId, $profileId);
    if ($chatId == $verifyId) {
        $result = $messages->removeChat($chatId);
    }
    echo json_encode($result);
    exit;
}