Exemplo n.º 1
0
 * API_DESCRIPTION: Method for check user answer for the quest
 * API_ACCESS: authorized users
 * API_INPUT: questid - integer, Identificator of the quest
 * API_INPUT: answer - string, answer
 * API_INPUT: token - string, token
 */
$curdir = dirname(__FILE__);
include_once $curdir . "/../api.lib/api.base.php";
include_once $curdir . "/../api.lib/api.game.php";
include_once $curdir . "/../api.lib/api.answerlist.php";
include_once $curdir . "/../api.lib/api.quest.php";
include_once $curdir . "/../../config/config.php";
$response = APIHelpers::startpage($config);
APIHelpers::checkAuth();
$message = '';
if (!APIGame::checkGameDates($message)) {
    APIHelpers::showerror(1211, $message);
}
if (!APIHelpers::issetParam('questid')) {
    APIHelpers::showerror(1212, 'Not found parameter "questid"');
}
if (!APIHelpers::issetParam('answer')) {
    APIHelpers::showerror(1213, 'Not found parameter "answer"');
}
$questid = APIHelpers::getParam('questid', 0);
$answer = APIHelpers::getParam('answer', '');
if ($answer == "") {
    APIHelpers::showerror(1214, 'Parameter "answer" must be not empty');
}
if (!is_numeric($questid)) {
    APIHelpers::showerror(1215, 'Parameter "questid" must be numeric');
Exemplo n.º 2
0
Arquivo: get.php Projeto: azizjonm/fhq
header('Content-Type: application/json');
/*
 * API_NAME: Get Quest Info (users method)
 * API_DESCRIPTION: Method will be returned quest info 
 * API_ACCESS: authorized users
 * API_INPUT: taskid - integer, Identificator of the quest (in future will be questid)
 * API_INPUT: token - string, token
 */
$curdir = dirname(__FILE__);
include_once $curdir . "/../api.lib/api.base.php";
include_once $curdir . "/../api.lib/api.game.php";
include_once $curdir . "/../../config/config.php";
$response = APIHelpers::startpage($config);
APIHelpers::checkAuth();
$message = '';
if (!APIGame::checkGameDates($message) && !APISecurity::isAdmin()) {
    APIHelpers::showerror(1064, $message);
}
if (!APIHelpers::issetParam('taskid')) {
    APIHelpers::showerror(1065, 'Not found parameter "taskid"');
}
$questid = APIHelpers::getParam('taskid', 0);
if (!is_numeric($questid)) {
    APIHelpers::showerror(1066, 'parameter "taskid" must be numeric');
}
$response['result'] = 'ok';
$conn = APIHelpers::createConnection($config);
$response['userid'] = APISecurity::userid();
$params = array();
$params[] = APISecurity::userid();
$params[] = intval($questid);