Permalink security fix

This commit is contained in:
Marcin Kurczewski 2013-10-13 13:38:24 +02:00
parent e33ec7abe7
commit 7c62293b76

View file

@ -8,9 +8,9 @@ class PostController
$callback();
}
private static function locatePost($key)
private static function locatePost($key, $disallowNumeric = false)
{
if (is_numeric($key))
if (is_numeric($key) and !$disallowNumeric)
{
$post = R::findOne('post', 'id = ?', [$key]);
if (!$post)
@ -720,7 +720,7 @@ class PostController
public function retrieveAction($name)
{
$this->context->layoutName = 'layout-file';
$post = self::locatePost($name);
$post = self::locatePost($name, true);
R::preload($post, ['tag']);
PrivilegesHelper::confirmWithException($this->context->user, Privilege::RetrievePost);