27 lines
676 B
PHP
27 lines
676 B
PHP
<?php
|
|
namespace Misuzu;
|
|
|
|
if(!isset($msz) || !($msz instanceof \Misuzu\MisuzuContext))
|
|
die('Script must be called through the Misuzu route dispatcher.');
|
|
|
|
if(!$msz->authInfo->getPerms('global')->check(Perm::G_NEWS_POSTS_MANAGE))
|
|
Template::throwError(403);
|
|
|
|
$pagination = Pagination::fromInput($msz->news->countPosts(
|
|
includeScheduled: true,
|
|
includeDeleted: true
|
|
), 15);
|
|
|
|
if(!$pagination->validOffset)
|
|
Template::throwError(404);
|
|
|
|
$posts = $msz->news->getPosts(
|
|
includeScheduled: true,
|
|
includeDeleted: true,
|
|
pagination: $pagination
|
|
);
|
|
|
|
Template::render('manage.news.posts', [
|
|
'news_posts' => $posts,
|
|
'posts_pagination' => $pagination,
|
|
]);
|