<?php require_once '../autoload.php'; $user = Auth::user(); $dbManager = new DatabaseManager(); if ($dbManager->isOwner($user, $_GET['scope'])) { $dbManager->deleteRoom($_GET['scope']); json_p(["success" => true]); } else { json_p(["success" => false, "reason" => "You are not the owner of this room."]); }
} json_p($dbManager->setRoomPassword($scope, $_GET['password'])); break; case "remove_password": if (!$dbManager->isOwner($user, $scope)) { json_p(['success' => false, 'reason' => "You must be the room owner to make changes to the room password."]); } json_p($dbManager->removeRoomPassword($scope)); break; case "transfer_ownership": if (!$dbManager->isOwner($user, $scope)) { json_p(['success' => false, 'reason' => "You must be the room owner to transfer room ownership."]); } if ($dbManager->checkUser($target)) { $target_obj = $dbManager->getUserByDisplayName($target); if ($target_obj) { json_p($dbManager->setOwner($target_obj->id(), $scope)); } else { json_p(['success' => false, 'reason' => 'The user you want to transfer to does not exist.']); } } else { json_p(['success' => false, 'reason' => 'Invalid transfer target.']); } break; case "delete": if (!$dbManager->isOwner($user, $scope)) { json_p(['success' => false, 'reason' => "You must be the room owner to delete the room."]); } json_p($dbManager->deleteRoom($scope)); break; }