Example #1
0
<?php

include 'init.php';
ini_set("display_errors", true);
error_reporting(E_ALL);
$_POST = json_decode(file_get_contents('php://input'), true);
//simple ajax handler
$method = $_POST["method"];
$data = $_POST["data"];
$handler = new handler();
$handler->exec($method, $data);
class handler
{
    public function exec($method, $data)
    {
        $result = self::$method($data);
        self::sendResponse($result);
    }
    public function sendResponse($response)
    {
        $res = array();
        $res["result"] = $response;
        echo json_encode($res);
        exit;
    }
    private function getJobStatus($jobHash)
    {
        return self::getRow("job", "hash", $jobHash);
    }
    private function hasOngoingBackups($data)
    {