diff options
Diffstat (limited to 'controllers/list.php')
| -rw-r--r-- | controllers/list.php | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/controllers/list.php b/controllers/list.php index 2dea9ec..7bbb739 100644 --- a/controllers/list.php +++ b/controllers/list.php @@ -16,3 +16,32 @@ function on_post() { $list_status = $e; } } + +function on_patch() { + global $TOKEN; + global $METHOD; + + try { + $user = Database\Cookie::fromDB($TOKEN); + } + catch(Exception $e) { + return; + } + + $list = null; + try { + $list = Database\ArchiveList::fromDB($METHOD['lid']); + } + catch(Exception $e) { + return; + } + + switch ($METHOD['type']) { + case 'add': $list->addItem($METHOD['wid']); break; + + default: throw new Exception('Unknown type ' . $METHOD['type']); + } + + header('Location: /list/' . $list->LID); + exit(); +} |
