diff options
| author | Syndamia <kamen@syndamia.com> | 2025-02-02 11:06:04 +0200 |
|---|---|---|
| committer | Syndamia <kamen@syndamia.com> | 2025-02-02 11:06:04 +0200 |
| commit | 0f54da2c648a5913f6ed282f39dc7d6a62ef37da (patch) | |
| tree | 22c0dc0a3e6151c16b5fe0686035d783f96b36e9 /views | |
| parent | 4bebfa04cf759d77c511541bdf30747c76a3b2e1 (diff) | |
| download | nowayforward_human-0f54da2c648a5913f6ed282f39dc7d6a62ef37da.tar nowayforward_human-0f54da2c648a5913f6ed282f39dc7d6a62ef37da.tar.gz nowayforward_human-0f54da2c648a5913f6ed282f39dc7d6a62ef37da.zip | |
feat(views/list): Fully implement list deletion
Diffstat (limited to 'views')
| -rw-r--r-- | views/global/router.php | 1 | ||||
| -rw-r--r-- | views/list/delete/index.php | 40 | ||||
| -rw-r--r-- | views/list/delete/meta.php | 4 |
3 files changed, 45 insertions, 0 deletions
diff --git a/views/global/router.php b/views/global/router.php index ea3799f..18adfca 100644 --- a/views/global/router.php +++ b/views/global/router.php @@ -30,6 +30,7 @@ function route_view() { case '/list/update': return '/list/update'; case '/list/new': return '/list/new'; case '/list/add': return '/list/add'; + case '/list/delete': return '/list/delete'; } switch ($root) { diff --git a/views/list/delete/index.php b/views/list/delete/index.php new file mode 100644 index 0000000..7d5bf5b --- /dev/null +++ b/views/list/delete/index.php @@ -0,0 +1,40 @@ +<?php + require_login(); + + $list = null; + $author = null; + $user = null; + + try { + $list = Database\ArchiveList::fromDB($_GET['lid'] ?? -1); + $author = Database\User::fromDBuid($list->AuthorUID); + $user = Database\Cookie::fromDB($TOKEN); + } + catch(Exception $e) {} +?> + +<?php if ($list !== null && $user->UID === $author->UID): ?> + + <h1>Are you sure you want to delete <?= $user->Username ?>'s "<?= $list->Name ?>"?</h1> + + <form action="#" method="POST" class="font-115 flex-col-centered max-width-20 center-margin"> + <input type="hidden" name="method" value="DELETE"> + <?php if (isset($list_status)): ?> + <?php if ($list_status !== ""): ?> + <p class="item error"><span> + <strong>Error:</strong> <?= $list_status ?> + </span></p> + <?php endif; ?> + <?php endif; ?> + + <input type="hidden" name="lid" value="<?= $_GET['lid'] ?>"> + <input type="submit" value="Delete forever!"> + </form> + +<?php elseif ($list === null): ?> + <h2>No list with identifier <?= $_GET['lid'] ?> exists!</h2> + +<?php else: ?> + <h2>You have no permission to delete <?= $user->Username ?>'s "<?= $list->Name ?>"!</h2> + +<?php endif; ?> diff --git a/views/list/delete/meta.php b/views/list/delete/meta.php new file mode 100644 index 0000000..2e07b80 --- /dev/null +++ b/views/list/delete/meta.php @@ -0,0 +1,4 @@ +<?php + +$title = 'Delete a list of archives'; +$controller = 'list'; |
