ch1p_io_web/handler/PostId.php
Evgeny Zinoviev f7bfdf58de initial
2022-07-09 19:40:17 +03:00

20 lines
447 B
PHP

<?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();
}
}