$routes = array("settings" => function ($action) { return restRequestSettings($action); }, "gallery" => function ($action) { return restRequestGallery(); }, "portfolio" => function ($action) { return restRequestPortfolio($action, $_GET["id"]); }, "account" => function ($action) { return restRequestAccount($action, $_GET["email"]); }, "invite" => function ($action) { return restRequestInvite($action, $_GET["email"]); }); $type = $_GET["type"]; $action = $_GET["action"] ?: "get"; $_GET["email"] = strtolower($_GET["email"]); $standardAction = in_array($action, array("create", "get", "update", "delete", "list")); if ($type === "security") { $resource = restRequestSecurity($action, $_POST["email"], $_POST["password"], $_POST["confirm"], $_POST["invite"]); } elseif (!$loggedIn) { $resource = restError(401); } elseif ($type === "command") { $resource = runCommand($action); } elseif (isset($routes[$type]) && $standardAction) { $resource = $routes[$type]($action); } else { $resource = restError(400); } logEvent("get-resource", $type, $action, $_GET["id"], !getProperty($resource, "error")); return $resource; } httpJsonResponse(resource($loggedIn));
// ----------------------------------- // 1) Download install zip from: // http://valums-file-uploader.github.io/file-uploader/ // 2) Unzip file // 3) Copy the following files: // client/fileuploader.css // client/fileuploader.js // client/loading.gif // server/php.php // into the Paradise project folder: // paradise/src/gallery/console/file-uploader/ ////////////////////////////////////// require "php/security.php"; require "file-uploader/php.php"; $uploadFolder = "../~data~/uploads/"; function upload($uploadFolder) { $allowedExtensions = array("jpg", "jpeg", "png"); $sizeLimit = 2 * 1024 * 1024; //2 MB $uploader = new qqFileUploader($allowedExtensions, $sizeLimit); return $uploader->handleUpload($uploadFolder); } function readOnlyResponse() { return array("success" => true, "type" => "simulated"); } $result = $_SESSION["read-only-user"] ? readOnlyResponse() : upload($uploadFolder); logEvent("file-upload", $result["success"], $uploadFolder, $result); httpJsonResponse($result);