aboutsummaryrefslogtreecommitdiff
path: root/views/list/update/index.php
diff options
context:
space:
mode:
authorSyndamia <kamen@syndamia.com>2025-02-02 10:54:23 +0200
committerSyndamia <kamen@syndamia.com>2025-02-02 10:54:23 +0200
commit4bebfa04cf759d77c511541bdf30747c76a3b2e1 (patch)
tree10eb1a2820fbbf3f49fdafb0a7821abc25e306e6 /views/list/update/index.php
parentb0fb3d9df06ab9aa77f95b3b60d60f414a9f5ebe (diff)
downloadnowayforward_human-4bebfa04cf759d77c511541bdf30747c76a3b2e1.tar
nowayforward_human-4bebfa04cf759d77c511541bdf30747c76a3b2e1.tar.gz
nowayforward_human-4bebfa04cf759d77c511541bdf30747c76a3b2e1.zip
feat(views/list): Fully implement list updating
Diffstat (limited to 'views/list/update/index.php')
-rw-r--r--views/list/update/index.php46
1 files changed, 46 insertions, 0 deletions
diff --git a/views/list/update/index.php b/views/list/update/index.php
new file mode 100644
index 0000000..9374aef
--- /dev/null
+++ b/views/list/update/index.php
@@ -0,0 +1,46 @@
+<?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>Update list</h1>
+
+<form action="#" method="POST" class="font-115 flex-col-centered max-width-20 center-margin">
+ <input type="hidden" name="method" value="PUT">
+ <?php if (isset($list_status)): ?>
+ <?php if ($list_status !== ""): ?>
+ <p class="item error"><span>
+ <strong>Error:</strong> <?= $list_status ?>
+ </span></p>
+ <?php else: ?>
+ <script type="text/javascript">
+ window.location.href = '/list/<?= $_GET["lid"] ?>';
+ </script>
+ <?php endif; ?>
+ <?php endif; ?>
+
+ <input type="hidden" name="lid" value="<?= $_GET['lid'] ?>">
+ <input type="text" name="name" placeholder="List title" minlength="1" value="<?= $list->Name ?>">
+ <textarea name="description" placeholder="Description"><?= $list->Description ?></textarea>
+ <input type="submit" value="Update">
+</form>
+
+<?php elseif ($list === null): ?>
+ <h2>No list with identifier <?= $_GET['lid'] ?> exists!</h2>
+
+<?php else: ?>
+ <h2>You're not the owner of "<?= $list->Name ?>", you have no permission to edit it!</h2>
+
+<?php endif; ?>