blob: ec9f750f5c150fdff3fa178cab3095fecdf0d9ca (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
|
<?php
namespace handler;
class PostId extends \RequestHandler {
public function get(): \Response {
list($post_id) = $this->input('i:id');
$post = posts_getPost($post_id);
if (!$post || (!$post->visible && !\admin::isAdmin()))
throw new \NotFoundException();
if ($post->shortName != '')
return new \RedirectResponse($post->getUrl());
throw new \NotFoundException();
}
}
|