misuzu/public-legacy/manage/news/posts.php

31 lines
656 B
PHP

<?php
namespace Misuzu;
use Misuzu\Users\User;
if(!User::hasCurrent() || !perms_check_user(MSZ_PERMS_NEWS, User::getCurrent()->getId(), MSZ_PERM_NEWS_MANAGE_POSTS)) {
echo render_error(403);
return;
}
$news = $msz->getNews();
$pagination = new Pagination($news->countAllPosts(
includeScheduled: true,
includeDeleted: true
), 15);
if(!$pagination->hasValidOffset()) {
echo render_error(404);
return;
}
$posts = $news->getAllPosts(
includeScheduled: true,
includeDeleted: true,
pagination: $pagination
);
Template::render('manage.news.posts', [
'news_posts' => $posts,
'posts_pagination' => $pagination,
]);