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') %}

Bulk Eraser

Flush collections. Warning: may be so slow as to cause a gateway timeout, but the process will complete.

@@ -104,7 +104,7 @@
- +

Full restart (all keys will be flushed!)

diff --git a/templates/admin/client-whitelist.twig b/templates/admin/client-whitelist.twig index 362ea83e1..03c4e450f 100644 --- a/templates/admin/client-whitelist.twig +++ b/templates/admin/client-whitelist.twig @@ -5,7 +5,7 @@
- + @@ -33,7 +33,7 @@ {% for c in list %} - +
Add client
- + @@ -34,7 +34,7 @@ diff --git a/templates/admin/forum-category.twig b/templates/admin/forum-category.twig index dec6d2033..e72270da8 100644 --- a/templates/admin/forum-category.twig +++ b/templates/admin/forum-category.twig @@ -19,7 +19,7 @@ - + @@ -45,7 +45,7 @@ - + diff --git a/templates/admin/forum-management.twig b/templates/admin/forum-management.twig index fe1495a2a..3a8da5672 100644 --- a/templates/admin/forum-management.twig +++ b/templates/admin/forum-management.twig @@ -27,7 +27,7 @@ - + - +
diff --git a/templates/admin/db-key.twig b/templates/admin/db-key.twig index 00b3baffd..186496154 100644 --- a/templates/admin/db-key.twig +++ b/templates/admin/db-key.twig @@ -7,7 +7,7 @@
- +
diff --git a/templates/admin/dnu.twig b/templates/admin/dnu.twig index 9fa2476b4..ad4bc6f5e 100644 --- a/templates/admin/dnu.twig +++ b/templates/admin/dnu.twig @@ -10,7 +10,7 @@
- +


- + @@ -50,7 +50,7 @@ to {{ fl_added|number_format }} enabled users Members with more tokens will have their total reduced to this limit.

- + diff --git a/templates/admin/invite-source-config.twig b/templates/admin/invite-source-config.twig index 4f42cafca..099be1390 100644 --- a/templates/admin/invite-source-config.twig +++ b/templates/admin/invite-source-config.twig @@ -36,7 +36,7 @@ New name:

- + diff --git a/templates/admin/invite-source.twig b/templates/admin/invite-source.twig index ba21648b2..efdee2948 100644 --- a/templates/admin/invite-source.twig +++ b/templates/admin/invite-source.twig @@ -30,7 +30,7 @@

No inviters have been configured

{% endfor %}
- + Go to user page to edit sources (user id or @name): diff --git a/templates/admin/login-watch.twig b/templates/admin/login-watch.twig index f71f52fae..1baf739d0 100644 --- a/templates/admin/login-watch.twig +++ b/templates/admin/login-watch.twig @@ -29,7 +29,7 @@ {% for b in list %} {% if loop.first %}
- + @@ -41,7 +41,7 @@ - {% if can_ban %} + {% if viewer.permitted('admin_manage_ipbans') %} {% endif %} @@ -79,7 +79,7 @@ - {% if can_ban %} + {% if viewer.permitted('admin_manage_ipbans') %} @@ -88,7 +88,7 @@ {% if loop.last %} - {% if can_ban %} + {% if viewer.permitted('admin_manage_ipbans') %} @@ -60,7 +60,7 @@ - + diff --git a/templates/admin/site-option.twig b/templates/admin/site-option.twig index d3efdc2bf..105b1a2e3 100644 --- a/templates/admin/site-option.twig +++ b/templates/admin/site-option.twig @@ -7,12 +7,12 @@ -{% if is_admin %} +{% if viewer.permitted('admin_manage_permissions') %} {% endif %} -{% if is_admin %} +{% if viewer.permitted('admin_manage_permissions') %} @@ -35,14 +35,14 @@ {% for opt in list %} - {% if is_admin %} + {% if viewer.permitted('admin_manage_permissions') %} @@ -37,7 +37,7 @@ - + diff --git a/templates/admin/user-create.twig b/templates/admin/user-create.twig index b992e4a70..f993b7bb3 100644 --- a/templates/admin/user-create.twig +++ b/templates/admin/user-create.twig @@ -6,7 +6,7 @@
- +
{{ header.last_attempt|raw }} {{ header.banned_until|raw }} ClearBanDo nothing

Ban Reason
diff --git a/templates/admin/mass-pm.twig b/templates/admin/mass-pm.twig index cfec65735..4156f2af1 100644 --- a/templates/admin/mass-pm.twig +++ b/templates/admin/mass-pm.twig @@ -6,7 +6,7 @@
- +

Class

- + {% if id %} {% endif %} @@ -32,7 +32,7 @@
{{ article.title }} - posted {{ article.created|time_diff }} - Edit - Delete + Delete
{{ article.body|bb_format }}
diff --git a/templates/admin/scheduler/edit.twig b/templates/admin/scheduler/edit.twig index 98785bf6d..ad8bbff79 100644 --- a/templates/admin/scheduler/edit.twig +++ b/templates/admin/scheduler/edit.twig @@ -24,7 +24,7 @@ - +
Name Value CommentManage
@@ -26,7 +26,7 @@ - +
- + diff --git a/templates/admin/staff-group.twig b/templates/admin/staff-group.twig index 99b50cc07..94e1e8c9a 100644 --- a/templates/admin/staff-group.twig +++ b/templates/admin/staff-group.twig @@ -17,7 +17,7 @@ - +
diff --git a/templates/admin/user-navigation.twig b/templates/admin/user-navigation.twig index 033c9e0ca..22ee5fe97 100644 --- a/templates/admin/user-navigation.twig +++ b/templates/admin/user-navigation.twig @@ -19,7 +19,7 @@ - + @@ -54,7 +54,7 @@ - + diff --git a/templates/artist/collage-add.twig b/templates/artist/collage-add.twig index 8420d392e..00e1e90d3 100644 --- a/templates/artist/collage-add.twig +++ b/templates/artist/collage-add.twig @@ -3,15 +3,15 @@
{% for collage in collage_list %} - {% if loop.first %} +{% if loop.first %}
or search for collage name or URL:
- {% endif %} +{% endif %} {% else %}
Search for a collage name or URL:
{% endfor %} diff --git a/templates/bonus/title.twig b/templates/bonus/title.twig index 945143b0e..142d8aff2 100644 --- a/templates/bonus/title.twig +++ b/templates/bonus/title.twig @@ -10,7 +10,7 @@
Username:
- +
 

@@ -21,6 +21,4 @@
- {{ footer() }} - diff --git a/templates/collage/recover.twig b/templates/collage/recover.twig index e6e5ae650..bbee83cf8 100644 --- a/templates/collage/recover.twig +++ b/templates/collage/recover.twig @@ -7,7 +7,7 @@
- +
Collage ID: diff --git a/templates/contest/admin-form.twig b/templates/contest/admin-form.twig index a496b72ac..0a43ed4e8 100644 --- a/templates/contest/admin-form.twig +++ b/templates/contest/admin-form.twig @@ -131,7 +131,7 @@
- + {% if create %} diff --git a/templates/contest/admin.twig b/templates/contest/admin.twig index e8a36ded3..a4557a318 100644 --- a/templates/contest/admin.twig +++ b/templates/contest/admin.twig @@ -1,5 +1,4 @@ {{ header('contest admin') }} -

Contest admin

@@ -19,20 +18,21 @@ {% endif %} {% if not create %} - {% include 'contest/list.twig' with { - 'viewer': viewer, - 'current': contest, - 'list': list, - 'type': type, - } only - %} +{% include 'contest/list.twig' + with { + 'current' : contest, + 'list' : list, + 'type' : type, + 'viewer' : viewer, + } only +%} {% endif %} {% if contest is request_fill %}

Request pairs

- {% for pair in contest.requestPairs %} - {% if loop.first %} +{% for pair in contest.requestPairs %} +{% if loop.first %}

The following members have filled out more than one request for the same member.

@@ -40,33 +40,35 @@ - {% endif %} +{% endif %} - {% if loop.last %} +{% if loop.last %}
Request creator Filled
{{ pair.FillerID|user_url }} {{ pair.UserID|user_url }} {{ pair.nr|number_format }}
- {% endif %} - {% else %} +{% endif %} +{% else %}

No members have filled out more than one request for the same member.

- {% endfor %} +{% endfor %}
{% endif %} {% if create or contest %} - {% include 'contest/admin-form.twig' with { - 'action': create ? 'contest.php?action=create' : 'contest.php?action=admin&id=' ~ contest.id, - 'auth': viewer.auth, - 'contest': contest, - 'create': create, - 'type': type, - 'intro': intro, - 'user_count': user_count, +{% include 'contest/admin-form.twig' + with { + 'action' : create + ? 'contest.php?action=create' + : 'contest.php?action=admin&id=' ~ contest.id, + 'contest' : contest, + 'create' : create, + 'type' : type, + 'intro' : intro, + 'user_count' : user_count, + 'viewer' : viewer, } only - %} +%} {% endif %} -
{{ footer() }} diff --git a/templates/debug/analysis-list.twig b/templates/debug/analysis-list.twig index a755f6df3..acbd86c16 100644 --- a/templates/debug/analysis-list.twig +++ b/templates/debug/analysis-list.twig @@ -15,7 +15,7 @@ {{ removed }} case{{ removed|plural }} removed.
{% endif %} - + diff --git a/templates/index/page-header.twig b/templates/index/page-header.twig index eb7d829f3..97cd185c6 100644 --- a/templates/index/page-header.twig +++ b/templates/index/page-header.twig @@ -4,9 +4,8 @@ {% macro active_class(t) %} {%- if t %} active{% endif -%} {% endmacro -%} -{% set auth = user.auth -%} - + @@ -20,17 +19,17 @@
  • - Up: - {{ user.uploadedSize|octet_size }} + Up: + {{ viewer.uploadedSize|octet_size }}
  • - Down: - {{ user.downloadedSize|octet_size }} + Down: + {{ viewer.downloadedSize|octet_size }}
  • - Ratio: {{ ratio(user.uploadedSize, user.downloadedSize) }} + Ratio: {{ ratio(viewer.uploadedSize, viewer.downloadedSize) }}
  • {% set required_ratio = viewer.requiredRatio %} {% if required_ratio > 0 %} @@ -68,11 +67,11 @@ {{ required_ratio|number_format(2) }} {% endif %} -{% if user.tokenCount %} +{% if viewer.tokenCount %}
  • Tokens: - {{ user.tokenCount|number_format }} + {{ viewer.tokenCount|number_format }}
  • {% endif %} @@ -117,7 +116,7 @@ @@ -125,7 +124,7 @@
    diff --git a/templates/invite/pool.twig b/templates/invite/pool.twig index 7d34807c3..8ca249930 100644 --- a/templates/invite/pool.twig +++ b/templates/invite/pool.twig @@ -28,7 +28,7 @@
{% for invite in list %} - {% if loop.first %} +{% if loop.first %} {{ paginator.linkbox|raw }}
@@ -37,11 +37,11 @@ - {% if can_edit %} +{% if viewer.permitted('users_edit_invites') %} - {% endif %} +{% endif %} - {% endif %} +{% endif %} @@ -49,21 +49,21 @@ - {% if can_edit %} +{% if viewer.permitted('users_edit_invites') %} - {% endif %} +{% endif %} - {% if loop.last %} +{% if loop.last %}
IP address Invite link ExpiresControls
{{ invite.user_id|user_full }}{{ ipaddr(invite.ipaddr) }} {{ invite.key }} {{ invite.expires|time_diff }}
- +
- {{ paginator.linkbox|raw }} - {% endif %} +{{ paginator.linkbox|raw }} +{% endif %} {% endfor %} {{ footer() }} diff --git a/templates/recovery/pair.twig b/templates/recovery/pair.twig index 3e726921d..75d3ed8e3 100644 --- a/templates/recovery/pair.twig +++ b/templates/recovery/pair.twig @@ -69,7 +69,7 @@ - +
{% endif %} @@ -93,7 +93,7 @@ - + diff --git a/templates/request/edit-bounty.twig b/templates/request/edit-bounty.twig index f72017771..25bf7e1a5 100644 --- a/templates/request/edit-bounty.twig +++ b/templates/request/edit-bounty.twig @@ -24,7 +24,7 @@
- +
diff --git a/templates/seedbox/config.twig b/templates/seedbox/config.twig index ebc47d9fe..57f91b5be 100644 --- a/templates/seedbox/config.twig +++ b/templates/seedbox/config.twig @@ -24,16 +24,13 @@
-{% if host is empty %} - No seed locations are reporting. Are your clients seeding and connected? -{% else %} +{% for h in seedbox.hostList %} +{% if loop.first %}

Seeding locations

-{% for h in host %} -{% if loop.first %} - + @@ -42,7 +39,7 @@ -{% endif %} +{% endif %} -{% if loop.last %} +{% if loop.last %}
Useragent Total seeding
@@ -59,16 +56,17 @@ {{ h.total|number_format }}
-{% endif %} -{% endfor %} -{% endif %} +{% endif %} +{% else %} + No seed locations are reporting. Are your clients seeding and connected? +{% endfor %}
-{% for f in free %} +{% for f in seedbox.freeList %} {% if loop.first %}

Unused names

@@ -79,7 +77,7 @@
- +