Exemple #1
0
    }
    sys_die("Simple Groupware Soap/Ajax Functions", $output, true);
}
if (!empty($_SERVER["HTTP_SOAPACTION"])) {
    if (!extension_loaded("soap")) {
        sys_die(t("{t}%s is not compiled / loaded into PHP.{/t}", "Soap"));
    }
    $soap = new SoapServer(null, array('uri' => 'sgs'));
    $soap->setClass($class);
    $soap->handle();
} else {
    if ($_SERVER["HTTP_X_REQUESTED_WITH"] == "XMLHttpRequest") {
        $func = filter_var($_REQUEST["function"], FILTER_SANITIZE_STRING);
        if ($func == "type_pmwikiarea::ajax_render_preview") {
            require "lib/pmwiki/pmwiki.php";
        }
        if ((strpos($func, "_ajax::") or strpos($func, "::ajax_")) and substr_count($func, "::") == 1) {
            list($class, $func) = explode("::", $func);
        }
        ajax::require_method($func, $class);
        if (!empty($_REQUEST["params"])) {
            $params = json_decode($_REQUEST["params"], true);
        } else {
            $params = json_decode(file_get_contents("php://input"), true);
        }
        echo json_encode(call_user_func_array(array($class, $func), $params));
        if (!empty($_SESSION["notification"]) or !empty($_SESSION["warning"])) {
            ajax::session_save();
        }
    }
}