Exemple #1
0
//  +------------------------------------------------------------------------+
require_once 'include/initialize.inc.php';
//require_once('include/library.inc.php');
//require_once('include/config.inc.php');
header('Content-type: application/json');
$action = get('action');
if ($action == 'play') {
    play();
} elseif ($action == 'pause') {
    pause();
} elseif ($action == 'stop') {
    stop();
} elseif ($action == 'prev') {
    prev_();
} elseif ($action == 'next') {
    next_();
} elseif ($action == 'playSelect') {
    playSelect();
} elseif ($action == 'addSelect') {
    addSelect();
} elseif ($action == 'insertSelect') {
    insertSelect();
} elseif ($action == 'seekImageMap') {
    seekImageMap();
} elseif ($action == 'playIndex') {
    playIndex();
} elseif ($action == 'deleteIndex') {
    deleteIndex();
} elseif ($action == 'deleteIndexAjax') {
    deleteIndexAjax();
} elseif ($action == 'deletePlayed') {
require_once "data-func.php";
init_database();
$postdata = file_get_contents("php://input");
$request = json_decode($postdata);
if (!empty($request->score_id)) {
    $suite_version_id = get("score", (int) $request->score_id, "suite_version_id");
    $build_id = get("score", (int) $request->score_id, "build_id");
    $run_id = get("build", $build_id, "run_id");
    $stamp = get("run", $run_id, "stamp");
    $machine = get("run", $run_id, "machine");
    $mode_id = get("build", $build_id, "mode_id");
    if ($request->type == "prev") {
        $prev = prev_($stamp, $machine, $mode_id, $suite_version_id, (int) $request->amount);
        $last = array_pop($prev);
    } else {
        $next = next_($stamp, $machine, $mode_id, $suite_version_id, (int) $request->amount);
        $last = array_pop($next);
    }
    $build_id = get("score", $last["id"], "build_id");
} else {
    $suite_test_id = get("breakdown", (int) $request->breakdown_id, "suite_test_id");
    $score_id = get("breakdown", (int) $request->breakdown_id, "score_id");
    $build_id = get("score", (int) $score_id, "build_id");
    $run_id = get("build", $build_id, "run_id");
    $stamp = get("run", $run_id, "stamp");
    $machine = get("run", $run_id, "machine");
    $mode_id = get("build", $build_id, "mode_id");
    if ($request->type == "prev") {
        $prev = prev_suite_test($stamp, $machine, $mode_id, $suite_test_id, (int) $request->amount);
        $last = array_pop($prev);
    } else {