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

34 lines
1,010 B
PHP
Raw Normal View History

2022-09-13 13:14:49 +00:00
<?php
namespace Misuzu;
use RuntimeException;
2022-09-13 13:14:49 +00:00
2024-12-02 02:28:08 +00:00
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);
2022-09-13 13:14:49 +00:00
2024-12-19 01:22:26 +00:00
$pagination = Pagination::fromInput($msz->changelog->countChanges(), 30);
if(!$pagination->validOffset)
Template::throwError(404);
2022-09-13 13:14:49 +00:00
$changeInfos = $msz->changelog->getChanges(pagination: $pagination);
2023-07-15 02:05:49 +00:00
$changes = [];
foreach($changeInfos as $changeInfo) {
$userInfo = $changeInfo->userId !== null ? $msz->usersCtx->getUserInfo($changeInfo->userId) : null;
2023-07-15 02:05:49 +00:00
$changes[] = [
'change' => $changeInfo,
'tags' => $msz->changelog->getTags(changeInfo: $changeInfo),
2023-07-15 02:05:49 +00:00
'user' => $userInfo,
'user_colour' => $msz->usersCtx->getUserColour($userInfo),
2023-07-15 02:05:49 +00:00
];
}
2022-09-13 13:14:49 +00:00
Template::render('manage.changelog.changes', [
'changelog_changes' => $changes,
'changelog_pagination' => $pagination,
2022-09-13 13:14:49 +00:00
]);