diff --git a/bin/lint-staged b/bin/lint-staged
index 260f17875..027296708 100755
--- a/bin/lint-staged
+++ b/bin/lint-staged
@@ -1,6 +1,6 @@
#!/bin/bash
-set -eo pipefail
+set -euo pipefail
STAGED=$(git diff --name-only --cached --diff-filter=d)
JS="$(echo $(grep ".*\.js$" <<< "$STAGED" || true))"
@@ -9,7 +9,6 @@ CSS="$(echo $(grep ".*\.scss$" <<< "$STAGED" || true))"
TWIG="$(echo $(grep ".*\.twig$" <<< "$STAGED" || true))"
if [ -z "$JS" ] && [ -z "$PHP" ] && [ -z "$CSS" ] && [ -z "$TWIG" ]; then
- echo "Nothing to lint."
exit 0
fi
@@ -21,6 +20,13 @@ fi
if [ -n "$TWIG" ]; then
echo "Linting Twig"
+ for t in $TWIG
+ do
+ if ! git grep -qc "${t/templates\//}"; then
+ echo "$t not referenced in codebase"
+ exit 1
+ fi
+ done
docker compose exec -T web bin/twig-parse $TWIG
fi
diff --git a/classes/view.class.php b/classes/view.class.php
index 903782ee8..5489ee454 100644
--- a/classes/view.class.php
+++ b/classes/view.class.php
@@ -142,7 +142,7 @@ class View {
'document' => $module,
'dono_target' => $payMan->monthlyPercent(new Gazelle\Manager\Donation()),
'nav_links' => $navLinks,
- 'user' => $Viewer,
+ 'viewer' => $Viewer,
]);
}
diff --git a/sections/bonus/title.php b/sections/bonus/title.php
index da32e84f3..559a34fb5 100644
--- a/sections/bonus/title.php
+++ b/sections/bonus/title.php
@@ -43,9 +43,9 @@ if (isset($_POST['confirm'])) {
}
echo $Twig->render('bonus/title.twig', [
- 'auth' => $Viewer->auth(),
'bbcode' => $BBCode,
'label' => $Label,
'price' => $Price,
'title' => $Item['Title'],
+ 'viewer' => $Viewer,
]);
diff --git a/sections/collages/recover.php b/sections/collages/recover.php
index 89905b8c7..35a341329 100644
--- a/sections/collages/recover.php
+++ b/sections/collages/recover.php
@@ -31,5 +31,5 @@ if (!empty($_POST['id']) || $_POST['name'] !== '') {
}
echo $Twig->render('collage/recover.twig', [
- 'auth' => $Viewer->auth(),
+ 'viewer' => $Viewer,
]);
diff --git a/sections/recovery/pair.php b/sections/recovery/pair.php
index 6d0ccb5d4..3407a0fa3 100644
--- a/sections/recovery/pair.php
+++ b/sections/recovery/pair.php
@@ -45,10 +45,10 @@ if (isset($_POST['curr']) && isset($_POST['prev'])) {
}
echo $Twig->render('recovery/pair.twig', [
- 'auth' => $Viewer->auth(),
'confirm' => $confirm,
'curr_id' => $currId,
'prev_id' => $prevId,
'prev' => $prev,
'message' => $message,
+ 'viewer' => $Viewer,
]);
diff --git a/sections/requests/edit_bounty.php b/sections/requests/edit_bounty.php
index a52615a89..7f032e8c1 100644
--- a/sections/requests/edit_bounty.php
+++ b/sections/requests/edit_bounty.php
@@ -12,6 +12,6 @@ if (is_null($request)) {
}
echo $Twig->render('request/edit-bounty.twig', [
- 'auth' => $Viewer->auth(),
'request' => $request,
+ 'viewer' => $Viewer,
]);
diff --git a/sections/staffblog/index.php b/sections/staffblog/index.php
index b95328d14..1fbf2bbd1 100644
--- a/sections/staffblog/index.php
+++ b/sections/staffblog/index.php
@@ -57,9 +57,9 @@ View::show_header('Staff Blog', ['js' => 'bbcode']);
if (in_array($_REQUEST['action'] ?? '', ['', 'editblog'])) {
echo $Twig->render('staffblog/edit.twig', [
'action' => empty($_REQUEST['action']) ? 'create' : 'edit',
- 'auth' => $Viewer->auth(),
'blog' => $blog ?? null,
'show_form' => !isset($_REQUEST['action']) || $_REQUEST['action'] !== 'editblog',
+ 'viewer' => $Viewer,
]);
}
diff --git a/sections/tools/data/invite_pool.php b/sections/tools/data/invite_pool.php
index da2d33904..37e64d616 100644
--- a/sections/tools/data/invite_pool.php
+++ b/sections/tools/data/invite_pool.php
@@ -21,14 +21,13 @@ if ($search) {
$pending = $inviteMan->totalPending();
$paginator = new Gazelle\Util\Paginator(INVITES_PER_PAGE, (int)($_GET['page'] ?? 1));
-$paginator->setTotal($inviteMan->totalPending());
+$paginator->setTotal($pending);
echo $Twig->render('invite/pool.twig', [
- 'auth' => $Viewer->auth(),
'paginator' => $paginator,
'list' => $inviteMan->pendingInvites($paginator->limit(), $paginator->offset()),
'pending' => $pending,
'removed' => $removed,
'search' => $search,
- 'can_edit' => $Viewer->permitted('users_edit_invites'),
+ 'viewer' => $Viewer,
]);
diff --git a/sections/tools/development/analysis_list.php b/sections/tools/development/analysis_list.php
index bc0d0186e..985086e77 100644
--- a/sections/tools/development/analysis_list.php
+++ b/sections/tools/development/analysis_list.php
@@ -38,10 +38,15 @@ $heading = new Gazelle\Util\SortableTableHeader('updated', [
]);
echo $Twig->render('debug/analysis-list.twig', [
- 'auth' => $Viewer->auth(),
'heading' => $heading,
- 'list' => $errMan->list($heading->getOrderBy(), $heading->getOrderDir(), $paginator->limit(), $paginator->offset()),
+ 'list' => $errMan->list(
+ $heading->getOrderBy(),
+ $heading->getOrderDir(),
+ $paginator->limit(),
+ $paginator->offset()
+ ),
'paginator' => $paginator,
'removed' => $removed,
'search' => $_REQUEST['search'] ?? '',
+ 'viewer' => $Viewer,
]);
diff --git a/sections/tools/development/clear_cache.php b/sections/tools/development/clear_cache.php
index f32081036..2518a568a 100644
--- a/sections/tools/development/clear_cache.php
+++ b/sections/tools/development/clear_cache.php
@@ -72,10 +72,10 @@ if (isset($_REQUEST['json'])) {
}
echo $Twig->render('admin/cache-management.twig', [
- 'can_flush' => $Viewer->permitted('admin_clear_cache'),
- 'delta' => $delta,
- 'flushed' => $flushed,
- 'key' => $_REQUEST['key'] ?? '',
- 'multi' => $multi,
- 'result' => $result,
+ 'delta' => $delta,
+ 'flushed' => $flushed,
+ 'key' => $_REQUEST['key'] ?? '',
+ 'multi' => $multi,
+ 'result' => $result,
+ 'viewer' => $Viewer,
]);
diff --git a/sections/tools/development/periodic_edit.php b/sections/tools/development/periodic_edit.php
index 7aebbc600..a7e369780 100644
--- a/sections/tools/development/periodic_edit.php
+++ b/sections/tools/development/periodic_edit.php
@@ -7,7 +7,7 @@ if (!$Viewer->permitted('admin_periodic_task_manage')) {
}
echo $Twig->render('admin/scheduler/edit.twig', [
- 'auth' => $Viewer->auth(),
'err' => $err ?? null,
'task_list' => (new Gazelle\TaskScheduler())->getTasks(),
+ 'viewer' => $Viewer,
]);
diff --git a/sections/tools/development/site_options.php b/sections/tools/development/site_options.php
index f09d8025b..c024dc27c 100644
--- a/sections/tools/development/site_options.php
+++ b/sections/tools/development/site_options.php
@@ -11,8 +11,8 @@ $siteOption = new Gazelle\Manager\SiteOption();
if ($Viewer->permitted('admin_manage_permissions') && isset($_POST['submit'])) {
authorize();
- $name = trim($_POST['name']);
- $value = trim($_POST['value']);
+ $name = trim($_POST['name']);
+ $value = trim($_POST['value']);
$comment = trim($_POST['comment']);
if ($_POST['submit'] == 'Delete') {
@@ -37,7 +37,6 @@ if ($Viewer->permitted('admin_manage_permissions') && isset($_POST['submit'])) {
}
echo $Twig->render('admin/site-option.twig', [
- 'auth' => $Viewer->auth(),
- 'is_admin' => $Viewer->permitted('admin_manage_permissions'),
- 'list' => $siteOption->list(),
+ 'list' => $siteOption->list(),
+ 'viewer' => $Viewer,
]);
diff --git a/sections/tools/managers/bonus_points.php b/sections/tools/managers/bonus_points.php
index d3a8606a0..311e3ea83 100644
--- a/sections/tools/managers/bonus_points.php
+++ b/sections/tools/managers/bonus_points.php
@@ -37,7 +37,7 @@ if (isset($_REQUEST['add_points'])) {
}
echo $Twig->render('admin/bonus-points.twig', [
- 'auth' => $Viewer->auth(),
'message' => $message,
'since' => date("Y-m-d", strtotime("-120 day", time())),
+ 'viewer' => $Viewer,
]);
diff --git a/sections/tools/managers/categories_list.php b/sections/tools/managers/categories_list.php
index 36a22f648..ed6472c3a 100644
--- a/sections/tools/managers/categories_list.php
+++ b/sections/tools/managers/categories_list.php
@@ -7,6 +7,6 @@ if (!$Viewer->permitted('admin_manage_forums')) {
}
echo $Twig->render('admin/forum-category.twig', [
- 'auth' => $Viewer->auth(),
- 'list' => (new Gazelle\Manager\ForumCategory())->usageList(),
+ 'list' => (new Gazelle\Manager\ForumCategory())->usageList(),
+ 'viewer' => $Viewer,
]);
diff --git a/sections/tools/managers/create_user.php b/sections/tools/managers/create_user.php
index b0044c838..15e530794 100644
--- a/sections/tools/managers/create_user.php
+++ b/sections/tools/managers/create_user.php
@@ -40,5 +40,5 @@ if (isset($_POST['Username'])) {
}
echo $Twig->render('admin/user-create.twig', [
- 'auth' => $Viewer->auth(),
+ 'viewer' => $Viewer,
]);
diff --git a/sections/tools/managers/db_key.php b/sections/tools/managers/db_key.php
index 88dcba492..a6d38e93c 100644
--- a/sections/tools/managers/db_key.php
+++ b/sections/tools/managers/db_key.php
@@ -12,7 +12,7 @@ if (isset($_POST['dbkey'])) {
}
echo $Twig->render('admin/db-key.twig', [
- 'auth' => $Viewer->auth(),
+ 'viewer' => $Viewer,
'fingerprint' => (apcu_exists('DB_KEY') && apcu_fetch('DB_KEY'))
? '0x' . substr(apcu_fetch('DB_KEY'), 0, 4)
: false,
diff --git a/sections/tools/managers/dnu_list.php b/sections/tools/managers/dnu_list.php
index 35930b931..480b1b9bf 100644
--- a/sections/tools/managers/dnu_list.php
+++ b/sections/tools/managers/dnu_list.php
@@ -7,6 +7,6 @@ if (!$Viewer->permitted('admin_dnu')) {
}
echo $Twig->render('admin/dnu.twig', [
- 'auth' => $Viewer->auth(),
- 'list' => (new Gazelle\Manager\DNU())->dnuList(),
+ 'list' => (new Gazelle\Manager\DNU())->dnuList(),
+ 'viewer' => $Viewer,
]);
diff --git a/sections/tools/managers/forum_list.php b/sections/tools/managers/forum_list.php
index 5b8038fae..eef914200 100644
--- a/sections/tools/managers/forum_list.php
+++ b/sections/tools/managers/forum_list.php
@@ -7,8 +7,8 @@ if (!$Viewer->permitted('admin_manage_forums')) {
}
echo $Twig->render('admin/forum-management.twig', [
- 'auth' => $Viewer->auth(),
'category' => (new Gazelle\Manager\ForumCategory())->forumCategoryList(),
'class_list' => (new Gazelle\Manager\User())->classList(),
'toc' => (new Gazelle\Manager\Forum())->tableOfContents($Viewer),
+ 'viewer' => $Viewer,
]);
diff --git a/sections/tools/managers/invite_source.php b/sections/tools/managers/invite_source.php
index 88f237b71..165800613 100644
--- a/sections/tools/managers/invite_source.php
+++ b/sections/tools/managers/invite_source.php
@@ -13,6 +13,6 @@ if ($user) {
}
echo $Twig->render('admin/invite-source.twig', [
- 'auth' => $Viewer->auth(),
- 'list' => (new Gazelle\Manager\InviteSource())->summaryByInviter(),
+ 'list' => (new Gazelle\Manager\InviteSource())->summaryByInviter(),
+ 'viewer' => $Viewer,
]);
diff --git a/sections/tools/managers/invite_source_config.php b/sections/tools/managers/invite_source_config.php
index 584d566e7..d9be96d4f 100644
--- a/sections/tools/managers/invite_source_config.php
+++ b/sections/tools/managers/invite_source_config.php
@@ -20,6 +20,6 @@ if ($remove) {
}
echo $Twig->render('admin/invite-source-config.twig', [
- 'auth' => $Viewer->auth(),
- 'list' => $manager->usageList(),
+ 'list' => $manager->usageList(),
+ 'viewer' => $Viewer,
]);
diff --git a/sections/tools/managers/login_watch.php b/sections/tools/managers/login_watch.php
index fb5fd2e7b..4fdc18c7e 100644
--- a/sections/tools/managers/login_watch.php
+++ b/sections/tools/managers/login_watch.php
@@ -54,12 +54,11 @@ $list = $watch->activeList($headerInfo->getOrderBy(), $headerInfo->getOrderDir()
$resolve = isset($_REQUEST['resolve']);
echo $Twig->render('admin/login-watch.twig', [
- 'auth' => $Viewer->auth(),
'header' => $header,
'list' => $list,
- 'can_ban' => $Viewer->permitted('admin_manage_ipbans'),
'nr_ban' => $nrBan ?? null,
'nr_clear' => $nrClear ?? null,
'paginator' => $paginator,
'resolve' => $resolve,
+ 'viewer' => $Viewer,
]);
diff --git a/sections/tools/managers/mass_pm.php b/sections/tools/managers/mass_pm.php
index d79937afc..9fb736c5a 100644
--- a/sections/tools/managers/mass_pm.php
+++ b/sections/tools/managers/mass_pm.php
@@ -7,7 +7,7 @@ if (!$Viewer->permitted("admin_global_notification")) {
}
echo $Twig->render('admin/mass-pm.twig', [
- 'auth' => $Viewer->auth(),
- 'body' => new Gazelle\Util\Textarea('body', '', 95, 10),
- 'class' => (new Gazelle\Manager\User())->classList(),
+ 'body' => new Gazelle\Util\Textarea('body', '', 95, 10),
+ 'class' => (new Gazelle\Manager\User())->classList(),
+ 'viewer' => $Viewer,
]);
diff --git a/sections/tools/managers/navigation_list.php b/sections/tools/managers/navigation_list.php
index e1d48569f..cb6daf4d5 100644
--- a/sections/tools/managers/navigation_list.php
+++ b/sections/tools/managers/navigation_list.php
@@ -7,6 +7,6 @@ if (!$Viewer->permitted('admin_manage_navigation')) {
}
echo $Twig->render('admin/user-navigation.twig', [
- 'auth' => $Viewer->auth(),
- 'list' => (new Gazelle\Manager\UserNavigation())->fullList(),
+ 'list' => (new Gazelle\Manager\UserNavigation())->fullList(),
+ 'viewer' => $Viewer,
]);
diff --git a/sections/tools/managers/news.php b/sections/tools/managers/news.php
index 32a5687b5..9bb01543d 100644
--- a/sections/tools/managers/news.php
+++ b/sections/tools/managers/news.php
@@ -65,10 +65,10 @@ switch ($_REQUEST['action']) {
error('Unknown news action');
}
echo $Twig->render('admin/news.twig', [
- 'auth' => $Viewer->auth(),
'body' => new Gazelle\Util\Textarea('body', $body),
'create' => $create,
'id' => $id,
'title' => $title,
'list' => $newsMan->headlines(),
+ 'viewer' => $Viewer,
]);
diff --git a/sections/tools/managers/staff_groups_list.php b/sections/tools/managers/staff_groups_list.php
index 22d19ecc5..b1b552b23 100644
--- a/sections/tools/managers/staff_groups_list.php
+++ b/sections/tools/managers/staff_groups_list.php
@@ -7,6 +7,6 @@ if (!$Viewer->permitted('admin_manage_permissions')) {
}
echo $Twig->render('admin/staff-group.twig', [
- 'auth' => $Viewer->auth(),
- 'list' => (new Gazelle\Manager\StaffGroup())->groupList(),
+ 'list' => (new Gazelle\Manager\StaffGroup())->groupList(),
+ 'viewer' => $Viewer,
]);
diff --git a/sections/tools/managers/tags_official.php b/sections/tools/managers/tags_official.php
index 5c97563bb..a3d8a17b8 100644
--- a/sections/tools/managers/tags_official.php
+++ b/sections/tools/managers/tags_official.php
@@ -30,8 +30,8 @@ if ($_POST['newtag'] ?? null) {
}
echo $Twig->render('tag/official.twig', [
- 'auth' => $Viewer->auth(),
'list' => $tagMan->officialList($_GET['order'] ?? 'name'),
'new' => $new,
'unofficial' => $unofficialName,
+ 'viewer' => $Viewer,
]);
diff --git a/sections/tools/managers/tokens.php b/sections/tools/managers/tokens.php
index df9d3601b..ae7b43b42 100644
--- a/sections/tools/managers/tokens.php
+++ b/sections/tools/managers/tokens.php
@@ -26,9 +26,9 @@ if (isset($_POST['addtokens'])) {
echo $Twig->render('admin/freeleech-tokens.twig', [
'amount' => $amount,
- 'auth' => $Viewer->auth(),
'fl_added' => $flAdded,
'fl_cleared' => $flCleared,
'leech_disabled' => $_POST['allowleechdisabled'] ?? true,
'only_drop' => $_POST['onlydrop'] ?? false,
+ 'viewer' => $Viewer,
]);
diff --git a/sections/tools/managers/whitelist_list.php b/sections/tools/managers/whitelist_list.php
index 9fb30bf8e..c62be83de 100644
--- a/sections/tools/managers/whitelist_list.php
+++ b/sections/tools/managers/whitelist_list.php
@@ -7,6 +7,6 @@ if (!$Viewer->permitted('admin_whitelist')) {
}
echo $Twig->render('admin/client-whitelist.twig', [
- 'auth' => $Viewer->auth(),
- 'list' => (new Gazelle\Manager\ClientWhitelist())->list(),
+ 'list' => (new Gazelle\Manager\ClientWhitelist())->list(),
+ 'viewer' => $Viewer,
]);
diff --git a/sections/torrents/edit_group_handle.php b/sections/torrents/edit_group_handle.php
index 26462e58c..c35867ecf 100644
--- a/sections/torrents/edit_group_handle.php
+++ b/sections/torrents/edit_group_handle.php
@@ -14,24 +14,23 @@ $tgroup = (new Gazelle\Manager\TGroup())->findById((int)$_REQUEST['groupid']);
if (is_null($tgroup)) {
error(404);
}
-$GroupID = $tgroup->id();
$logInfo = [];
if (($_GET['action'] ?? '') == 'revert') {
// we're reverting to a previous revision
- $RevisionID = (int)$_GET['revisionid'];
- if (!$RevisionID) {
+ $revisionId = (int)$_GET['revisionid'];
+ if (!$revisionId) {
error('No revision specified to revert');
}
if (empty($_GET['confirm'])) {
- echo $Twig->render('tgroup/revert-confirm.twig', [
- 'auth' => $Viewer->auth(),
- 'group_id' => $GroupID,
- 'revision_id' => $RevisionID,
+ echo $Twig->render('tgroup/confirm-revert.twig', [
+ 'group_id' => $tgroup->id(),
+ 'revision_id' => $revisionId,
+ 'viewer' => $Viewer,
]);
exit;
}
- $revert = $tgroup->revertRevision($Viewer->id(), $RevisionID);
+ $revert = $tgroup->revertRevision($Viewer->id(), $revisionId);
if (is_null($revert)) {
error(404);
}
@@ -78,7 +77,7 @@ if (($_GET['action'] ?? '') == 'revert') {
if ($_POST['summary']) {
$logInfo[] = "summary: " . trim($_POST['summary']);
}
- $RevisionID = $tgroup->createRevision($Body, $Image, $_POST['summary'], $Viewer);
+ $revisionId = $tgroup->createRevision($Body, $Image, $_POST['summary'], $Viewer);
}
$imageFlush = ($Image != $tgroup->showFallbackImage(false)->image());
diff --git a/sections/torrents/masspm.php b/sections/torrents/masspm.php
index eeaea7d75..5ae4f3058 100644
--- a/sections/torrents/masspm.php
+++ b/sections/torrents/masspm.php
@@ -11,7 +11,7 @@ if (is_null($torrent)) {
}
echo $Twig->render('torrent/masspm.twig', [
- 'auth' => $Viewer->auth(),
'textarea' => new Gazelle\Util\Textarea('message', '[pl]' . $torrent->id() . '[/pl]', 60, 8),
'torrent' => $torrent,
+ 'viewer' => $Viewer,
]);
diff --git a/sections/torrents/merge.php b/sections/torrents/merge.php
index be34c9bf3..257b34ee0 100644
--- a/sections/torrents/merge.php
+++ b/sections/torrents/merge.php
@@ -25,9 +25,9 @@ if ($old->categoryName() !== 'Music') {
// Everything is legit, ask for confirmation
if (empty($_POST['confirm'])) {
echo $Twig->render('torrent/confirm-merge.twig', [
- 'auth' => $Viewer->auth(),
- 'new' => $new,
- 'old' => $old,
+ 'new' => $new,
+ 'old' => $old,
+ 'viewer' => $Viewer,
]);
exit;
}
diff --git a/sections/torrents/new_groupid.php b/sections/torrents/new_groupid.php
index 26de6122e..1373df244 100644
--- a/sections/torrents/new_groupid.php
+++ b/sections/torrents/new_groupid.php
@@ -29,9 +29,9 @@ if ($torrent->groupId() === $new->id()) {
if (empty($_POST['confirm'])) {
echo $Twig->render('torrent/confirm-move.twig', [
- 'auth' => $Viewer->auth(),
'new' => $new,
- 'torrent' => $torrent
+ 'torrent' => $torrent,
+ 'viewer' => $Viewer,
]);
exit;
}
diff --git a/sections/user/seedbox_edit.php b/sections/user/seedbox_edit.php
index bf5d5579d..9b58e7dbd 100644
--- a/sections/user/seedbox_edit.php
+++ b/sections/user/seedbox_edit.php
@@ -63,8 +63,7 @@ if (isset($_POST['mode'])) {
}
echo $Twig->render('seedbox/config.twig', [
- 'auth' => $Viewer->auth(),
- 'free' => $seedbox->freeList(),
- 'host' => $seedbox->hostList(),
- 'user' => $user,
+ 'seedbox' => $seedbox,
+ 'user' => $user,
+ 'viewer' => $Viewer,
]);
diff --git a/sections/user/seedbox_view.php b/sections/user/seedbox_view.php
index b6d146e5d..2a0839ab5 100644
--- a/sections/user/seedbox_view.php
+++ b/sections/user/seedbox_view.php
@@ -65,21 +65,21 @@ if ($source && $target) {
$paginator->limit(),
$paginator->offset()
),
- 'auth' => $Viewer->auth(),
'mode' => $union ? 'union' : 'exclude',
'paginator' => $paginator,
'seedbox' => $seedbox,
'source_id' => $source,
'target_id' => $target,
'user_id' => $userId,
+ 'viewer' => $Viewer,
]);
}
echo $Twig->render('seedbox/view.twig', [
- 'auth' => $Viewer->auth(),
'mode' => $union ? 'union' : 'exclude',
'seedbox' => $seedbox,
'source' => $source,
'target' => $target,
'user_id' => $userId,
+ 'viewer' => $Viewer,
]);
diff --git a/sections/userhistory/token_history.php b/sections/userhistory/token_history.php
index e42632281..f638154d5 100644
--- a/sections/userhistory/token_history.php
+++ b/sections/userhistory/token_history.php
@@ -33,10 +33,8 @@ $paginator = new Gazelle\Util\Paginator(25, (int)($_GET['page'] ?? 1));
$paginator->setTotal($user->stats()->flTokenTotal());
echo $Twig->render('user/history-freeleech.twig', [
- 'admin' => $Viewer->permitted('admin_fl_history'),
- 'auth' => $Viewer->auth(),
- 'list' => $user->tokenList($torMan, $paginator->limit(), $paginator->offset()),
- 'own_profile' => $Viewer->id() == $user->id(),
- 'paginator' => $paginator,
- 'user' => $user,
+ 'list' => $user->tokenList($torMan, $paginator->limit(), $paginator->offset()),
+ 'paginator' => $paginator,
+ 'user' => $user,
+ 'viewer' => $Viewer,
]);
diff --git a/templates/admin/bonus-points.twig b/templates/admin/bonus-points.twig
index d449f5a7a..f46c8b768 100644
--- a/templates/admin/bonus-points.twig
+++ b/templates/admin/bonus-points.twig
@@ -18,7 +18,7 @@
-
+
diff --git a/templates/admin/cache-management.twig b/templates/admin/cache-management.twig
index cd9e0965c..38b7b9216 100644
--- a/templates/admin/cache-management.twig
+++ b/templates/admin/cache-management.twig
@@ -56,13 +56,13 @@
-{% if can_flush %}
+{% if viewer.permitted('admin_clear_cache') %}
{% endif %}
-{% if can_flush %}
+{% if viewer.permitted('admin_clear_cache') %}
Flush collections. Warning: may be so slow as to cause a gateway timeout, but the process will complete.
@@ -104,7 +104,7 @@