blob: 80c8eefa466caf73f0ebf8bc6772f1f776328797 (
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
26
27
28
29
30
31
32
33
34
|
<?php
namespace handler\admin;
use csrf;
use NotFoundException;
use pages;
use posts;
use RedirectResponse;
use Response;
class AutoDelete extends AdminRequestHandler {
public function get(): Response {
list($name) = $this->input('short_name');
$post = posts::getPostByName($name);
if ($post) {
csrf::check('delpost'.$post->id);
posts::delete($post);
return new RedirectResponse('/');
}
$page = pages::getPageByName($name);
if ($page) {
csrf::check('delpage'.$page->shortName);
pages::delete($page);
return new RedirectResponse('/');
}
throw new NotFoundException();
}
}
|