*/ if (isset($_GET['apikey']) and isset($_GET['path']) and isset($_GET['user']) and isset($_GET['modification']) and isset($_GET['dateModified']) and isset($_GET['size'])) { $auth = (string) $_GET['apikey']; if ($auth != $apikey) { echo json_encode(array("result" => "permissionDenied")); } else { $path = (string) $_GET['path']; $user = (string) $_GET['user']; $modification = (string) $_GET['modification']; $dateModified = (string) $_GET['dateModified']; $size = intval($_GET['size']); if (!fileExists($path, $user)) { echo json_encode(array("result" => "invalidFile")); } else { /* Delete the old chunks */ $actualModification = getFileModification($path, $user); if ($modification != $actualModification) { $fileSize = getFileSize($path, $user); addUserSpaceUsage($user, -$fileSize); $space_used = getUserSpaceUsed($user); $space_limit = getUserSpaceLimit($user); if ($space_used + $size > $space_limit) { addUserSpaceUsage($user, $fileSize); $space_left = $space_limit - $space_used; echo json_encode(array("result" => "notEnoughSpace", "spaceLeft" => $space_left)); return; } setFileSize($path, $user, 0); $status = getFileStatus($path, $user); setFileModificationDate($path, $user, $dateModified); if ($status != "pending") {
* DESCRIPTION: Updates the file status * PARAMETERS: api/files/setStatus.php <apikey> <path> <user> <status> */ if (isset($_GET['path']) and isset($_GET['user'])) { // --> begin authentication $havePermission = false; if (isset($_GET['apikey'])) { $auth = (string) $_GET['apikey']; $havePermission = $auth == $apikey; } else { $havePermission = $_SESSION["email"] == $_GET['user']; } // --> end authentication if (!$havePermission) { echo json_encode(array("result" => "permissionDenied")); } else { $path = (string) $_GET['path']; $user = (string) $_GET['user']; $modification = getFileModification($path, $user); $who = getFileComputers($path, $user); $size = getFileSize($path, $user); if (count($who) > 0) { requestFileDelete($modification, $who); } // please don't remove space from the usage removeFile($path, $user); echo json_encode(array("result" => "ok")); } } else { echo json_encode(array("result" => "missingParams")); }