misuzu/public-legacy/manage/changelog/index.php

33 lines
1,008 B
PHP

<?php
namespace Misuzu;
use RuntimeException;
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_CL_CHANGES_MANAGE))
Template::throwError(403);
$pagination = new Pagination($msz->changelog->countChanges(), 30);
if(!$pagination->hasValidOffset())
Template::throwError(404);
$changeInfos = $msz->changelog->getChanges(pagination: $pagination);
$changes = [];
foreach($changeInfos as $changeInfo) {
$userInfo = $changeInfo->userId !== null ? $msz->usersCtx->getUserInfo($changeInfo->userId) : null;
$changes[] = [
'change' => $changeInfo,
'tags' => $msz->changelog->getTags(changeInfo: $changeInfo),
'user' => $userInfo,
'user_colour' => $msz->usersCtx->getUserColour($userInfo),
];
}
Template::render('manage.changelog.changes', [
'changelog_changes' => $changes,
'changelog_pagination' => $pagination,
]);