33 lines
1,010 B
PHP
33 lines
1,010 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 = Pagination::fromInput($msz->changelog->countChanges(), 30);
|
|
if(!$pagination->validOffset)
|
|
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,
|
|
]);
|