Ejemplo n.º 1
0
if ($action === 'transfer_ownership') {
    $target = $_GET['username'];
}
if (!$user) {
    json_p(["success" => false, "This endpoint requires authentication."]);
}
if (!$dbManager->validateScope($scope)) {
    json_p("Invalid room name.");
}
switch ($action) {
    case "whitelist":
    case "blacklist":
        if (!$_GET['content']) {
            $_GET['content'] = "";
        }
        json_p($dbManager->manageList($action, $user, $scope, $_GET['content']));
        break;
    case "set_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->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)) {