summaryrefslogtreecommitdiff
path: root/handler/admin/UploadEditNote.php
blob: e7cdbb2d5984963d161c7313e98e5e303afb2d50 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
<?php

namespace handler\admin;

use csrf;
use Response;

class UploadEditNote extends AdminRequestHandler {

    public function post(): Response {
        list($id) = $this->input('i:id');

        $upload = \uploads::get($id);
        if (!$upload)
            return new \RedirectResponse('/uploads/?error='.urlencode('upload not found'));

        csrf::check('editupl'.$id);

        $note = $_POST['note'] ?? '';
        $upload->setNote($note);

        return new \RedirectResponse('/uploads/');
    }

}