123456789101112131415161718192021222324 |
- <?php
- class ConfirmUploadAction implements IAction {
- public function execute() {
- if(!Authorize::isLoggedIn()) {
- return array("error" => "Access not authorized");
- }
- $projectId = $_POST['project_id'] ?? $_GET['project_id'];
- $filePath = $_POST['filepath'] ?? $_GET['filepath'];
- $userId = $_SESSION['user_id'];
- $database = SqliteDatabase::getSingleton();
- $sql = "DELETE FROM upload_logs WHERE project_id = :project_id AND user_id = :user_id AND filepath = :filepath LIMIT 1;";
- $preparedQuery = $database->prepare($sql);
- $preparedQuery->bindValue(':project_id', $projectId);
- $preparedQuery->bindValue(':user_id', $userId);
- $preparedQuery->bindValue(':filepath', $filePath);
- $result = $preparedQuery->execute();
- $result->finalize();
-
- return array("message" => "upload confirmed", "filepath" => $filePath);
- }
- }
|