summaryrefslogtreecommitdiff
path: root/handler/admin/UploadDelete.php
blob: 26b58b720612a5c456307201854dad5580c59bae (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 RedirectResponse;
use Response;

class UploadDelete extends AdminRequestHandler {

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

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

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

        \uploads::delete($id);

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

}