diff --git a/Makefile b/Makefile index 422a294fb..1fbf264f3 100644 --- a/Makefile +++ b/Makefile @@ -64,6 +64,14 @@ ocelot-reload-conf: ocelot-reload-db: pkill -USR1 ocelot +.PHONY: rector +rector: + vendor/bin/rector process --config lib/rector.php + +.PHONY: rector-dry-run +rector-dry-run: + vendor/bin/rector process --dry-run --config lib/rector.php + .PHONY: test test: lint-css lint-php composer test diff --git a/lib/config.php b/lib/config.php index b1ac070e5..4bff20bb0 100644 --- a/lib/config.php +++ b/lib/config.php @@ -617,6 +617,9 @@ defined('VIP') or define('VIP', 6); // The secret Donor forum. defined('DONOR_FORUM') or define('DONOR_FORUM', 70); +// Where Announcements are sent. +defined('ANNOUNCEMENT_FORUM_ID') or define('ANNOUNCEMENT_FORUM_ID', 12); + // Where Edit Requests are sent. defined('EDITING_FORUM_ID') or define('EDITING_FORUM_ID', 34); diff --git a/lib/rector.php b/lib/rector.php new file mode 100644 index 000000000..7b4f2fb21 --- /dev/null +++ b/lib/rector.php @@ -0,0 +1,34 @@ +paths([ + // __DIR__ . '/../app', + __DIR__ . '/../classes', + // __DIR__ . '/../lib', + // __DIR__ . '/../sections', + ]); + + $rectorConfig->sets([ + LevelSetList::UP_TO_PHP_82, + SetList::DEAD_CODE, + ]); + + $rectorConfig->skip([ + JsonThrowOnErrorRector::class, + CountOnNullRector::class, + NullToStrictStringFuncCallArgRector::class, + ]); + + $rectorConfig->disableParallel(); +}; diff --git a/sections/ajax/better/index.php b/sections/ajax/better/index.php index b4bdca2b6..a8025313a 100644 --- a/sections/ajax/better/index.php +++ b/sections/ajax/better/index.php @@ -1,19 +1,7 @@ 'failure']); - break; -} +match ($_GET['method'] ?? '') { + 'transcode' => require_once('transcode.php'), + 'single' => require_once('single.php'), + default => json_error('bad method'), +}; diff --git a/sections/ajax/bookmarks/artists.php b/sections/ajax/bookmarks/artists.php index e1ebe1eff..6533fb74c 100644 --- a/sections/ajax/bookmarks/artists.php +++ b/sections/ajax/bookmarks/artists.php @@ -25,7 +25,7 @@ $ArtistList = $DB->to_array(); $JsonArtists = []; foreach ($ArtistList as $Artist) { - list($ArtistID, $Name) = $Artist; + [$ArtistID, $Name] = $Artist; $JsonArtists[] = [ 'artistId' => (int)$ArtistID, 'artistName' => $Name diff --git a/sections/ajax/forum/index.php b/sections/ajax/forum/index.php index c2811fd31..072475d9c 100644 --- a/sections/ajax/forum/index.php +++ b/sections/ajax/forum/index.php @@ -4,17 +4,9 @@ if ($Viewer->disableForums()) { print json_die('failure'); } -switch ($_GET['type'] ?? 'main') { - case 'main': - require('main.php'); - break; - case 'viewforum': - require('forum.php'); - break; - case 'viewthread': - require('thread.php'); - break; - default: - print json_error('type'); - break; -} +match ($_GET['type'] ?? 'main') { + 'main' => require_once('main.php'), + 'viewforum' => require_once('forum.php'), + 'viewthread' => require_once('thread.php'), + default => json_error('type'), +}; diff --git a/sections/ajax/forum/thread.php b/sections/ajax/forum/thread.php index 65a3d0eaf..0e53b5c14 100644 --- a/sections/ajax/forum/thread.php +++ b/sections/ajax/forum/thread.php @@ -117,7 +117,7 @@ if ($thread->pinnedPostId()) { $userCache = []; $JsonPosts = []; -foreach ($slice as $Key => $Post) { +foreach ($slice as $Post) { [$PostID, $AuthorID, $AddedTime, $Body, $EditedUserID, $EditedTime] = array_values($Post); if (!isset($userCache[$AuthorID])) { $userCache[$AuthorID] = $userMan->findById((int)$AuthorID); diff --git a/sections/ajax/inbox/inbox.php b/sections/ajax/inbox/inbox.php index cfdd02251..ed8f8c49f 100644 --- a/sections/ajax/inbox/inbox.php +++ b/sections/ajax/inbox/inbox.php @@ -4,7 +4,7 @@ $json = new Gazelle\Json\Inbox( $Viewer, $_GET['type'] ?? 'inbox', (int)($_GET['page'] ?? 1), - (bool)(($_GET['sort'] ?? 'unread') === 'unread'), + ($_GET['sort'] ?? 'unread') === 'unread', new Gazelle\Manager\User, ); diff --git a/sections/ajax/inbox/index.php b/sections/ajax/inbox/index.php index 0d1a787c9..fb4f77538 100644 --- a/sections/ajax/inbox/index.php +++ b/sections/ajax/inbox/index.php @@ -1,10 +1,6 @@ 'viewconv.php', + default => 'inbox.php', +}); diff --git a/sections/ajax/index.php b/sections/ajax/index.php index c2aab1a92..9a118736e 100644 --- a/sections/ajax/index.php +++ b/sections/ajax/index.php @@ -57,11 +57,11 @@ if (isset($Aliases[$Action])) { $_GET['action'] = $Action = $Aliases[$action]; } if (!$Action || !isset($Viewer)) { - json_die("failure"); + json_error("failure"); } $UserID = $Viewer->id(); -if (!empty($_SERVER['CONTENT_TYPE']) && substr($_SERVER['CONTENT_TYPE'], 0, 16) === 'application/json') { +if (!empty($_SERVER['CONTENT_TYPE']) && str_starts_with($_SERVER['CONTENT_TYPE'], 'application/json')) { $_POST = json_decode(file_get_contents('php://input'), true); } @@ -75,13 +75,13 @@ if (!$Viewer->permitted('site_unlimit_ajax') && isset($LimitedPages[$Action])) { } else { $Cache->increment_value('ajax_requests_'.$UserID); if ($UserRequests > $rate) { - json_die("failure", "Rate limit exceeded"); + json_error("failure", "Rate limit exceeded"); } } } if (AJAX && !defined('AUTHED_BY_TOKEN') && in_array($Action, $RequireTokenPages)) { - json_die("failure", "This page requires an api token"); + json_error("failure", "This page requires an api token"); } switch ($Action) { @@ -183,14 +183,10 @@ switch ($Action) { require_once('similar_artists.php'); break; case 'userhistory': - switch ($_GET['type'] ?? '') { - case 'posts': - require_once('userhistory/post_history.php'); - break; - default: - json_die('bad type'); - break; - } + match ($_GET['type'] ?? '') { + 'posts' => require_once('userhistory/post_history.php'), + default => json_error('bad type'), + }; break; case 'votefavorite': require_once('takevote.php'); @@ -255,5 +251,5 @@ switch ($Action) { break; default: // If they're screwing around with the query string - json_die("failure"); + json_error("failure"); } diff --git a/sections/ajax/similar_artists.php b/sections/ajax/similar_artists.php index b6605fb06..ecad031b2 100644 --- a/sections/ajax/similar_artists.php +++ b/sections/ajax/similar_artists.php @@ -23,7 +23,7 @@ $DB->prepared_query(" ", $artistId, $limit ); -while (list($ArtistID, $Name, $Score) = $DB->next_record(MYSQLI_NUM, false)) { +while ([$ArtistID, $Name, $Score] = $DB->next_record(MYSQLI_NUM, false)) { $results[] = [ 'id' => (int)$ArtistID, 'name' => $Name, diff --git a/sections/ajax/tcomments.php b/sections/ajax/tcomments.php index 6658fa5b9..a7a087e4c 100644 --- a/sections/ajax/tcomments.php +++ b/sections/ajax/tcomments.php @@ -11,7 +11,7 @@ $userCache = []; $userMan = new Gazelle\Manager\User; $JsonComments = []; -foreach ($thread as $Key => $Post) { +foreach ($thread as $Post) { [$PostID, $AuthorID, $AddedTime, $Body, $EditedUserID, $EditedTime, $EditedUsername] = array_values($Post); if (!isset($userCache[$AuthorID])) { $userCache[$AuthorID] = $userMan->findById((int)$AuthorID); diff --git a/sections/ajax/top10/index.php b/sections/ajax/top10/index.php index bb9c88fc2..19e2dcd8e 100644 --- a/sections/ajax/top10/index.php +++ b/sections/ajax/top10/index.php @@ -4,20 +4,10 @@ if (!$Viewer->permitted('site_top10')) { json_die('failure'); } -switch ($_GET['type'] ?? 'torrents') { - case 'users': - require_once('users.php'); - break; - case 'tags': - require_once('tags.php'); - break; - case 'history': - require_once('history.php'); - break; - case 'torrents': - require_once('torrents.php'); - break; - default: - print json_encode(['status' => 'failure']); - break; -} +match ($_GET['type'] ?? 'torrents') { + 'history' => require_once('history.php'), + 'tags' => require_once('tags.php'), + 'torrents' => require_once('torrents.php'), + 'users' => require_once('users.php'), + default => json_error('bad type'), +}; diff --git a/sections/ajax/userhistory/index.php b/sections/ajax/userhistory/index.php index bcc7bfef7..1653d546d 100644 --- a/sections/ajax/userhistory/index.php +++ b/sections/ajax/userhistory/index.php @@ -1,10 +1,6 @@ require_once('post_history.php'), + default => json_error('bad type'), +}; diff --git a/sections/apply/admin.php b/sections/apply/admin.php index a9c4dfb2b..6e049a669 100644 --- a/sections/apply/admin.php +++ b/sections/apply/admin.php @@ -10,7 +10,7 @@ $editId = 0; $saved = ''; if (isset($_POST['auth'])) { authorize(); - $edit = array_filter($_POST, function ($x) { return preg_match('/^edit-\d+$/', $x);}, ARRAY_FILTER_USE_KEY); + $edit = array_filter($_POST, fn ($x) => preg_match('/^edit-\d+$/', $x), ARRAY_FILTER_USE_KEY); if (is_array($edit) && count($edit) == 1) { $editId = trim(array_keys($edit)[0], 'edit-'); $appRole = new Gazelle\ApplicantRole($editId); diff --git a/sections/apply/view.php b/sections/apply/view.php index 38e08cfb4..8a89d9d40 100644 --- a/sections/apply/view.php +++ b/sections/apply/view.php @@ -1,5 +1,8 @@ permitted('admin_manage_applicants'); /* important for viewing the full story and full applicant list */ +$Resolved = (isset($_GET['status']) && $_GET['status'] === 'resolved'); + if (isset($_POST['id']) && is_number($_POST['id'])) { authorize(); $ID = (int)$_POST['id']; @@ -7,13 +10,12 @@ if (isset($_POST['id']) && is_number($_POST['id'])) { if (!$IS_STAFF && $app->userId() != $Viewer->id()) { error(403); } - $remove = array_filter($_POST, function ($x) { return preg_match('/^note-delete-\d+$/', $x);}, ARRAY_FILTER_USE_KEY); + $remove = array_filter($_POST, fn ($x) => preg_match('/^note-delete-\d+$/', $x), ARRAY_FILTER_USE_KEY); if (is_array($remove) && count($remove) == 1) { $app->removeNote( trim(array_keys($remove)[0], 'note-delete-') ); - } - elseif (isset($_POST['resolve'])) { + } elseif (isset($_POST['resolve'])) { if ($_POST['resolve'] === 'Resolve') { $app->resolve(true); header('Location: /apply.php?action=view'); @@ -22,8 +24,7 @@ if (isset($_POST['id']) && is_number($_POST['id'])) { elseif ($_POST['resolve'] === 'Reopen') { $app->resolve(false); } - } - elseif (isset($_POST['note_reply'])) { + } elseif (isset($_POST['note_reply'])) { $app->saveNote( $Viewer, $_POST['note_reply'], @@ -37,7 +38,7 @@ if (isset($_POST['id']) && is_number($_POST['id'])) { error(403); } } -$Resolved = (isset($_GET['status']) && $_GET['status'] === 'resolved'); + echo $Twig->render('applicant/view.twig', [ 'app' => $app ?? null, 'auth' => $Viewer->auth(), diff --git a/sections/artist/artist.php b/sections/artist/artist.php index 898007c04..f7678913d 100644 --- a/sections/artist/artist.php +++ b/sections/artist/artist.php @@ -2,7 +2,9 @@ $RevisionID = (int)($_GET['revisionid'] ?? 0); $artistMan = new Gazelle\Manager\Artist; -$Artist = $artistMan->findById((int)($_GET['id'] ?? 0), $RevisionID); +$Artist = $RevisionID + ? $artistMan->findByIdAndRevision((int)($_GET['id'] ?? 0), $RevisionID) + : $artistMan->findById((int)($_GET['id'] ?? 0)); if (is_null($Artist)) { error(404); } diff --git a/sections/artist/concerts.php b/sections/artist/concerts.php index c4e0f032f..9f8799ae8 100644 --- a/sections/artist/concerts.php +++ b/sections/artist/concerts.php @@ -111,14 +111,12 @@ $Website function get_date_title($Str) { $Exploded = explode(' ', $Str); - $Date = $Exploded[2] . ' ' . $Exploded[1] . ', ' . $Exploded[3]; - return $Date; + return $Exploded[2] . ' ' . $Exploded[1] . ', ' . $Exploded[3]; } function get_date_post($Str) { $Exploded = explode(' ', $Str); - $Date = $Exploded[2] . ' ' . $Exploded[1] . ', ' . $Exploded[3] . ' (' . rtrim($Exploded[0], ',') . ')'; - return $Date; + return $Exploded[2] . ' ' . $Exploded[1] . ', ' . $Exploded[3] . ' (' . rtrim($Exploded[0], ',') . ')'; } ?> diff --git a/sections/artist/index.php b/sections/artist/index.php index 5526b1a0f..983c25f19 100644 --- a/sections/artist/index.php +++ b/sections/artist/index.php @@ -1,73 +1,32 @@ require_once('add_similar.php'), + 'add_alias' => require_once('add_alias.php'), + 'change_artistid' => require_once('change_artistid.php'), + 'download' => require_once('download.php'), + 'rename' => require_once('rename.php'), + 'edit' => require_once('takeedit.php'), + 'takeeditrequest' => require_once('takeeditrequest.php'), + default => error(0), + }; } elseif (!empty($_GET['action'])) { - switch ($_GET['action']) { - case 'autocomplete': - require_once('autocomplete.php'); - break; - case 'change_artistid': - require_once('change_artistid.php'); - break; - case 'delete': - require_once('delete.php'); - break; - case 'delete_alias': - require_once('delete_alias.php'); - break; - case 'delete_similar': - require_once('delete_similar.php'); - break; - case 'edit': - require_once('edit.php'); - break; - case 'editrequest': - require_once('editrequest.php'); - break; - case 'history': - require_once('history.php'); - break; - case 'notify': - require_once('notify.php'); - break; - case 'notifyremove': - require_once('notifyremove.php'); - break; - case 'revert': - require_once('takeedit.php'); - break; - case 'vote_similar': - require_once('vote_similar.php'); - break; - default: - error(0); - break; - } + match ($_GET['action']) { + 'autocomplete' => require_once('autocomplete.php'), + 'change_artistid' => require_once('change_artistid.php'), + 'delete' => require_once('delete.php'), + 'delete_alias' => require_once('delete_alias.php'), + 'delete_similar' => require_once('delete_similar.php'), + 'edit' => require_once('edit.php'), + 'editrequest' => require_once('editrequest.php'), + 'history' => require_once('history.php'), + 'notify' => require_once('notify.php'), + 'notifyremove' => require_once('notifyremove.php'), + 'revert' => require_once('takeedit.php'), + 'vote_similar' => require_once('vote_similar.php'), + default => error(0), + }; } else { if (!empty($_GET['id'])) { require_once('artist.php'); diff --git a/sections/artist/rename.php b/sections/artist/rename.php index eb4078029..4a1359aaf 100644 --- a/sections/artist/rename.php +++ b/sections/artist/rename.php @@ -42,7 +42,7 @@ if (!($oldAliasId = $artist->getAlias($oldName))) { error('Could not find existing alias ID'); } -list($TargetAliasID, $TargetArtistID) = $DB->row(" +[$TargetAliasID, $TargetArtistID] = $DB->row(" SELECT AliasID, ArtistID FROM artists_alias WHERE name = ? diff --git a/sections/better/index.php b/sections/better/index.php index 57d28bbbb..f35f7852a 100644 --- a/sections/better/index.php +++ b/sections/better/index.php @@ -1,10 +1,6 @@ 'transcode.php', + default => 'better.php', +}); diff --git a/sections/blog/index.php b/sections/blog/index.php index ad277727f..85ec60f7f 100644 --- a/sections/blog/index.php +++ b/sections/blog/index.php @@ -1,21 +1,9 @@ 'dead_thread.php', + 'deleteblog' => 'delete_blog.php', + 'takeeditblog' => 'take_edit_blog.php', + 'takenewblog' => 'take_new_blog.php', + default => 'blog_page.php', +}); diff --git a/sections/bonus/history.php b/sections/bonus/history.php index b99eb1be2..c0f987d38 100644 --- a/sections/bonus/history.php +++ b/sections/bonus/history.php @@ -23,7 +23,7 @@ echo $Twig->render('user/bonus-history.twig', [ 'item' => $bonus->purchaseHistory(), 'summary' => $summary, 'pool_summary' => $poolSummary, - 'pool_total' => array_reduce($poolSummary, function ($sum = 0, array $s = []) { return $sum + $s['total']; }), + 'pool_total' => array_reduce($poolSummary, fn ($sum = 0, array $s = []) => $sum + $s['total']), 'paginator' => $paginator, 'user' => $user, 'viewer' => $Viewer, diff --git a/sections/bonus/index.php b/sections/bonus/index.php index d68b57c24..084a7c3d1 100644 --- a/sections/bonus/index.php +++ b/sections/bonus/index.php @@ -9,43 +9,26 @@ const DEFAULT_PAGE = 'store.php'; switch ($_GET['action'] ?? '') { case 'purchase': /* handle validity and cost as early as possible */ - if (isset($_REQUEST['label']) && preg_match('/^[a-z]{1,15}(-\w{1,15}){0,4}/', $_REQUEST['label'])) { + if (preg_match('/^[a-z]{1,15}(-\w{1,15}){0,4}/', $_REQUEST['label'] ?? '')) { $viewerBonus = new \Gazelle\User\Bonus($Viewer); $Label = $_REQUEST['label']; $Item = $viewerBonus->getItem($Label); - if ($Item) { - $Price = $viewerBonus->getEffectivePrice($Label); - if ($Price > $Viewer->bonusPointsTotal()) { - error('You cannot afford this item.'); - } - switch($Label) { - case 'token-1': case 'token-2': case 'token-3': case 'token-4': - require_once('tokens.php'); - break; - case 'other-1': case 'other-2': case 'other-3': case 'other-4': - require_once('token_other.php'); - break; - case 'invite': - require_once('invite.php'); - break; - case 'title-bb-y': - case 'title-bb-n': - case 'title-off': - require_once('title.php'); - break; - case 'collage-1': - case 'seedbox': - require_once('purchase.php'); - break; - default: - require_once(DEFAULT_PAGE); - break; - } - } - else { + if (!$Item) { require_once(DEFAULT_PAGE); break; } + $Price = $viewerBonus->getEffectivePrice($Label); + if ($Price > $Viewer->bonusPointsTotal()) { + error('You cannot afford this item.'); + } + require_once(match ($Label) { + 'invite' => 'invite.php', + 'collage-1', 'seedbox' => 'purchase.php', + 'title-bb-y', 'title-bb-n', 'title-off' => 'title.php', + 'token-1', 'token-2', 'token-3', 'token-4' => 'tokens.php', + 'other-1', 'other-2', 'other-3', 'other-4' => 'token_other.php', + default => DEFAULT_PAGE, + }); } break; case 'bprates': diff --git a/sections/bonus/invite.php b/sections/bonus/invite.php index 69bf409b0..a37607017 100644 --- a/sections/bonus/invite.php +++ b/sections/bonus/invite.php @@ -1,7 +1,5 @@ purchaseInvite()) { error("You cannot purchase an invite (either you don't have the privilege or you don't have enough bonus points)."); diff --git a/sections/bonus/title.php b/sections/bonus/title.php index c49b8eee1..8de7c856d 100644 --- a/sections/bonus/title.php +++ b/sections/bonus/title.php @@ -1,7 +1,5 @@ require_once('edit_torrents.php'), + default => error(404), + }; break; case 'view': switch ($_REQUEST['type'] ?? 'torrents') { case 'torrents': - require('torrents.php'); + require_once('torrents.php'); break; case 'artists': - require('artists.php'); + require_once('artists.php'); break; case 'collages': $_GET['bookmarks'] = '1'; - require(__DIR__ . '/../collages/browse.php'); + require_once(__DIR__ . '/../collages/browse.php'); break; case 'requests': $_GET['type'] = 'bookmarks'; - require(__DIR__ . '/../requests/requests.php'); + require_once(__DIR__ . '/../requests/requests.php'); break; default: error(404); diff --git a/sections/bookmarks/torrents.php b/sections/bookmarks/torrents.php index 9a51e1117..9eee1ef75 100644 --- a/sections/bookmarks/torrents.php +++ b/sections/bookmarks/torrents.php @@ -33,7 +33,7 @@ $artistLeaderboard = $bookmark->torrentArtistLeaderboard(new Gazelle\Manager\Art $tagLeaderboard = $bookmark->torrentTagLeaderboard(); $CollageCovers = $Viewer->option('CollageCovers') ?? 25; -View::show_header($user->username() . " › Bookmarked torrent groups", $title, ['js' => 'browse,collage']); +View::show_header($user->username() . " › Bookmarked torrent groups", ['js' => 'browse,collage']); ?>
@@ -213,7 +213,7 @@ foreach ($bookmarkList as $bm) {
"$name", $tgroup->tagNameList()) + array_map(fn ($name) => "$name", $tgroup->tagNameList()) ) ?>
diff --git a/sections/captcha/index.php b/sections/captcha/index.php index afebf50a2..af45584df 100644 --- a/sections/captcha/index.php +++ b/sections/captcha/index.php @@ -4,10 +4,11 @@ if (!function_exists('imagettftext')) { } function get_font() { - return __DIR__ . '/../../fonts/' . CAPTCHA_FONT[mt_rand(0, count(CAPTCHA_FONT) - 1)]; + return __DIR__ . '/../../fonts/' . CAPTCHA_FONT[random_int(0, count(CAPTCHA_FONT) - 1)]; } function make_captcha_img() { + $FontDisplay = []; $Length = 6; $ImageHeight = 75; $ImageWidth = 300; @@ -16,18 +17,18 @@ function make_captcha_img() { $CaptchaString = ''; for ($i = 0; $i < $Length; $i++) { - $CaptchaString .= $Chars[mt_rand(0,strlen($Chars) - 1)]; + $CaptchaString .= $Chars[random_int(0,strlen($Chars) - 1)]; } for ($x = 0; $x < $Length; $x++) { - $FontDisplay[$x]['size'] = mt_rand(24, 32); - $FontDisplay[$x]['top'] = mt_rand($FontDisplay[$x]['size'] + 5, $ImageHeight - ($FontDisplay[$x]['size'] / 2)); - $FontDisplay[$x]['angle'] = mt_rand(-30, 30); + $FontDisplay[$x]['size'] = random_int(24, 32); + $FontDisplay[$x]['top'] = random_int($FontDisplay[$x]['size'] + 5, $ImageHeight - ($FontDisplay[$x]['size'] / 2)); + $FontDisplay[$x]['angle'] = random_int(-30, 30); $FontDisplay[$x]['font'] = get_font(); } $Img = imagecreatetruecolor($ImageWidth, $ImageHeight); - $BGImg = imagecreatefrompng(__DIR__.'/../../captcha/' . CAPTCHA_BG[mt_rand(0, count(CAPTCHA_BG) - 1)]); + $BGImg = imagecreatefrompng(__DIR__.'/../../captcha/' . CAPTCHA_BG[random_int(0, count(CAPTCHA_BG) - 1)]); imagecopymerge($Img, $BGImg, 0, 0, 0, 0, 300, 75, 50); $ForeColor = imagecolorallocatealpha($Img, 255, 255, 255, 65); diff --git a/sections/collages/new.php b/sections/collages/new.php index 403ac8e8b..088edb8a7 100644 --- a/sections/collages/new.php +++ b/sections/collages/new.php @@ -7,11 +7,11 @@ if (!$Viewer->permitted('site_collages_create') && !$Viewer->canCreatePersonalCo // the variables below are instantiated via new_handle.php in the event of an error echo $Twig->render('collage/new.twig', [ - 'category' => isset($Category) ? $Category : false, + 'category' => $Category ?? false, 'description' => new Gazelle\Util\Textarea('description', $Description ?? '', 60, 10), - 'error' => isset($Err) ? $Err : false, - 'name' => isset($Name) ? $Name : '', + 'error' => $Err ?? false, + 'name' => $Name ?? '', 'no_name' => !$Viewer->permitted('site_collages_renamepersonal') && (!$Viewer->permitted('site_collages_create') || ($Category ?? -1) === COLLAGE_PERSONAL_ID), - 'tags' => isset($Tags) ? $Tags : '', + 'tags' => $Tags ?? '', 'viewer' => $Viewer, ]); diff --git a/sections/collages/torrent_collage.php b/sections/collages/torrent_collage.php index 591044f79..b0bb5ea63 100644 --- a/sections/collages/torrent_collage.php +++ b/sections/collages/torrent_collage.php @@ -212,7 +212,7 @@ foreach ($entryList as $tgroupId) {
"$name", $tgroup->tagNameList() + fn ($name) => "$name", $tgroup->tagNameList() )) ?>
@@ -263,7 +263,7 @@ foreach ($entryList as $tgroupId) { links($tgroupId) ?>
- "$name", $tgroup->tagNameList())) ?> + "$name", $tgroup->tagNameList())) ?>
diff --git a/sections/comments/comments.php b/sections/comments/comments.php index 8c8c0b1f9..4b622ad83 100644 --- a/sections/comments/comments.php +++ b/sections/comments/comments.php @@ -226,14 +226,14 @@ if ($Action == 'requests') { $Links = implode(' ', // show links to the other types of pages having comments - array_map(fn($a) => "" . ucfirst(rtrim($a, 's')) . ' comments', - array_filter(['artist', 'collages', 'requests', 'torrents'], fn($a) => $a != $Action) + array_map(fn ($a) => "" . ucfirst(rtrim($a, 's')) . ' comments', + array_filter(['artist', 'collages', 'requests', 'torrents'], fn ($a) => $a != $Action) ) ); if ($TypeLinks) { // and any extra links for this page type $Links .= '
' . implode(' ', array_map( - fn($link) => sprintf('%s', $link[0], $link[1]), $TypeLinks + fn ($link) => sprintf('%s', $link[0], $link[1]), $TypeLinks )); } diff --git a/sections/comments/index.php b/sections/comments/index.php index 1e9b59137..259a990bd 100644 --- a/sections/comments/index.php +++ b/sections/comments/index.php @@ -1,28 +1,12 @@ 'get.php', + 'jump' => 'jump.php', + 'take_delete' => 'take_delete.php', + 'take_edit' => 'take_edit.php', + 'take_post' => 'take_post.php', + 'take_warn' => 'take_warn.php', + 'warn' => 'warn.php', + default => 'comments.php', +}); diff --git a/sections/forums/mod_thread.php b/sections/forums/mod_thread.php index 930939541..1c4b67c06 100644 --- a/sections/forums/mod_thread.php +++ b/sections/forums/mod_thread.php @@ -52,7 +52,7 @@ if (!isset($_POST['transition']) && $newTitle === '') { // Variables for database input $page = (int)$_POST['page']; -$locked = (bool)isset($_POST['locked']); +$locked = isset($_POST['locked']); $newPinned = isset($_POST['sticky']) ? 1 : 0; $newRank = (int)($_POST['ranking'] ?? 0); diff --git a/sections/forums/poll_vote.php b/sections/forums/poll_vote.php index b09c71b9c..c8b110ac1 100644 --- a/sections/forums/poll_vote.php +++ b/sections/forums/poll_vote.php @@ -56,7 +56,7 @@ if (!isset($_POST['vote']) || !is_number($_POST['vote'])) { $choice) { + foreach ($vote as $choice) { ?>
  • (%)
  • diff --git a/sections/friends/index.php b/sections/friends/index.php index 0ce997f86..d3b38bfdc 100644 --- a/sections/friends/index.php +++ b/sections/friends/index.php @@ -1,19 +1,9 @@ require_once('add.php'), + 'Save notes' => require_once('comment.php'), + 'Send PM' => header('Location: inbox.php?action=compose&toid=' . (int)$_POST['friendid']), + 'Unfriend' => require_once('remove.php'), + default => require_once('friends.php'), +}; diff --git a/sections/image/index.php b/sections/image/index.php index c1afc286d..3a5524a74 100644 --- a/sections/image/index.php +++ b/sections/image/index.php @@ -59,9 +59,6 @@ if ($imageData !== false) { $usage = $_GET['type']; switch($usage) { case 'avatar': - $maxHeight = 400; // pixels - $maxSizeKb = 256; - break; case 'avatar2': $maxHeight = 400; $maxSizeKb = 256; diff --git a/sections/inbox/index.php b/sections/inbox/index.php index 37117b059..85b68cf1f 100644 --- a/sections/inbox/index.php +++ b/sections/inbox/index.php @@ -1,27 +1,12 @@ 'takecompose.php', + 'takeedit' => 'takeedit.php', + 'compose' => 'compose.php', + 'viewconv' => 'conversation.php', + 'masschange' => 'massdelete_handle.php', + 'get_post' => 'get_post.php', + 'forward' => 'forward.php', + default => 'inbox.php', +}); diff --git a/sections/index/index.php b/sections/index/index.php index b254b5331..ec656689e 100644 --- a/sections/index/index.php +++ b/sections/index/index.php @@ -6,12 +6,9 @@ if (!isset($Viewer)) { if (!isset($_REQUEST['action'])) { require('private.php'); } else { - switch ($_REQUEST['action']) { - case 'poll': - require(__DIR__ . '/../forums/poll_vote.php'); - break; - default: - error(0); - } + match ($_REQUEST['action']) { + 'poll' => require(__DIR__ . '/../forums/poll_vote.php'), + default => error(0), + }; } } diff --git a/sections/logchecker/index.php b/sections/logchecker/index.php index 403af2d59..790bd7360 100644 --- a/sections/logchecker/index.php +++ b/sections/logchecker/index.php @@ -1,18 +1,9 @@ 'take_test.php', + 'take_upload' => 'take_upload.php', + 'update' => 'update.php', + 'upload' => 'upload.php', + default => 'test.php', +}); diff --git a/sections/logchecker/take_upload.php b/sections/logchecker/take_upload.php index 1a8db33ee..8ddaec275 100644 --- a/sections/logchecker/take_upload.php +++ b/sections/logchecker/take_upload.php @@ -2,7 +2,7 @@ use OrpheusNET\Logchecker\Logchecker; -ini_set('upload_max_filesize', 1000000); +ini_set('upload_max_filesize', 1_000_000); $torrent = (new Gazelle\Manager\Torrent)->findById((int)$_POST['torrentid']); if (is_null($torrent)) { @@ -16,7 +16,7 @@ if ($torrent->uploaderId() != $Viewer->id() && !$Viewer->permitted('admin_add_lo } // Some browsers will report an empty file when you submit, prune those out -$_FILES['logfiles']['name'] = array_filter($_FILES['logfiles']['name'], function($Name) { return !empty($Name); }); +$_FILES['logfiles']['name'] = array_filter($_FILES['logfiles']['name'], fn($Name) => !empty($Name)); if (count($_FILES['logfiles']['name']) == 0) { error("No logfiles uploaded.\n"); } diff --git a/sections/login/index.php b/sections/login/index.php index 880451849..e8847988a 100644 --- a/sections/login/index.php +++ b/sections/login/index.php @@ -1,16 +1,8 @@ 'disabled.php', + 'recover' => isset($_REQUEST['key']) ? 'recover_step2.php' : 'recover_step1.php', + 'unconfirmed' => 'unconfirmed.php', + default => 'login.php', +}); diff --git a/sections/recovery/index.php b/sections/recovery/index.php index 8eee1ce6f..509519bd9 100644 --- a/sections/recovery/index.php +++ b/sections/recovery/index.php @@ -1,23 +1,10 @@ 'admin.php', + 'browse' => 'browse.php', + 'pair' => 'pair.php', + 'save' => RECOVERY ? 'save.php' : 'recover.php', + 'search', 'view' => 'view.php', + default => 'recover.php', +}); diff --git a/sections/recovery/save.php b/sections/recovery/save.php index dcab96e4a..f749ff0c0 100644 --- a/sections/recovery/save.php +++ b/sections/recovery/save.php @@ -38,7 +38,7 @@ else { $info['ipaddr'] = $ipaddr; $info['password_ok'] = $recovery->checkPassword($info['username'], $_POST['password']); - list($ok, $filename) = $recovery->saveScreenshot($_FILES); + [$ok, $filename] = $recovery->saveScreenshot($_FILES); if (!$ok) { $msg = $filename; // the reason we were unable to save the screenshot info } @@ -47,7 +47,7 @@ else { $token = ''; for ($i = 0; $i < 16; ++$i) { - $token .= chr(mt_rand(97, 97+25)); + $token .= chr(random_int(97, 97+25)); if (($i+1) % 4 == 0 && $i < 15) { $token .= '-'; } diff --git a/sections/referral/index.php b/sections/referral/index.php index a3f75ded4..a6d0b2dce 100644 --- a/sections/referral/index.php +++ b/sections/referral/index.php @@ -118,7 +118,7 @@ View::show_header('External Tracker Referrals'); if ($Verified !== true) { $Error = $Verified; } else { - [$Success, $Invite] = $ReferralManager->generateInvite($Account, $_POST['username'], $Email, $Twig); + [$Success, $Invite] = $ReferralManager->generateInvite($Account, $_POST['username'], $Email); if (!$Success) { $Error = $Invite; } else if ($Invite === false) { diff --git a/sections/register/index.php b/sections/register/index.php index 9fcc99cb3..ffc8c202e 100644 --- a/sections/register/index.php +++ b/sections/register/index.php @@ -75,7 +75,6 @@ if (isset($_REQUEST['confirm'])) { case 'invitation': echo $Twig->render('register/no-invite.twig'); exit; - break; case 'password': $error = 'No password given'; break; diff --git a/sections/reports/index.php b/sections/reports/index.php index 58e987e57..72f57be01 100644 --- a/sections/reports/index.php +++ b/sections/reports/index.php @@ -1,37 +1,15 @@ 'ajax_add_notes.php', + 'claim' => 'ajax_claim_report.php', + 'compose' => 'compose.php', + 'report' => 'report.php', + 'resolve' => 'ajax_resolve_report.php', + 'stats' => 'stats.php', + 'takecompose' => 'takecompose.php', + 'takereport' => 'takereport.php', + 'takeresolve' => 'takeresolve.php', + 'unclaim' => 'ajax_unclaim_report.php', + default => 'reports.php', +}); diff --git a/sections/reportsv2/report.php b/sections/reportsv2/report.php index 62114fce3..9c22001e1 100644 --- a/sections/reportsv2/report.php +++ b/sections/reportsv2/report.php @@ -77,7 +77,7 @@ $remasterTuple = $torrent->remasterTuple(); seederTotal()) { $LastActive = $torrent->lastActiveDate(); - if (!is_null($LastActive) && time() - strtotime($LastActive) >= 1209600) { + if (!is_null($LastActive) && time() - strtotime($LastActive) >= 1_209_600) { ?>
    Last active: diff --git a/sections/requests/index.php b/sections/requests/index.php index 5390a1550..8e56e407f 100644 --- a/sections/requests/index.php +++ b/sections/requests/index.php @@ -4,42 +4,16 @@ if ($Viewer->disableRequests()) { error('Your request privileges have been removed.'); } -switch ($_REQUEST['action'] ?? null) { - case 'new': - case 'edit': - require_once('new_edit.php'); - break; - case 'edit-bounty': - require_once('edit_bounty.php'); - break; - case 'takebounty': - require_once('take_bounty.php'); - break; - case 'takevote': - require_once('take_vote.php'); - break; - case 'takefill': - require_once('take_fill.php'); - break; - case 'takenew': - case 'takeedit': - require_once('take_new_edit.php'); - break; - case 'delete': - case 'unfill': - require_once('interim.php'); - break; - case 'takeunfill': - require_once('take_unfill.php'); - break; - case 'takedelete': - require_once('take_delete.php'); - break; - case 'view': - case 'viewrequest': - require_once('request.php'); - break; - default: - require_once('requests.php'); - break; -} +require_once(match ($_REQUEST['action'] ?? null) { + 'delete', 'unfill' => 'interim.php', + 'edit-bounty' => 'edit_bounty.php', + 'new', 'edit' => 'new_edit.php', + 'takebounty' => 'take_bounty.php', + 'takedelete' => 'take_delete.php', + 'takefill' => 'take_fill.php', + 'takenew', 'takeedit' => 'take_new_edit.php', + 'takeunfill' => 'take_unfill.php', + 'takevote' => 'take_vote.php', + 'view', 'viewrequest' => 'request.php', + default => 'requests.php', +}); diff --git a/sections/requests/take_new_edit.php b/sections/requests/take_new_edit.php index bdb2a8fad..ce8679a4b 100644 --- a/sections/requests/take_new_edit.php +++ b/sections/requests/take_new_edit.php @@ -364,7 +364,7 @@ foreach ($ArtistForm as $role => $Artists) { //3. Create a row in the requests_artists table for each artist, based on the ID. $artistMan->setGroupID($RequestID); foreach ($ArtistForm as $role => $Artists) { - foreach ($Artists as $Num => $Artist) { + foreach ($Artists as $Artist) { $artistMan->addToRequest($Artist['id'], $Artist['aliasid'], $role); $Cache->increment('stats_album_count'); $Cache->delete_value('artists_requests_'.$Artist['id']); diff --git a/sections/staffpm/assign.php b/sections/staffpm/assign.php index c0a538f7d..d51ca38ae 100644 --- a/sections/staffpm/assign.php +++ b/sections/staffpm/assign.php @@ -19,17 +19,11 @@ if (isset($_GET['convid'])) { error(404); } $classList = (new Gazelle\Manager\User)->classList(); - switch ($_GET['to']) { - case 'forum': - $staffPm->assignClass($classList[FORUM_MOD]['Level'], $Viewer); - break; - case 'staff': - $staffPm->assignClass($classList[MOD]['Level'], $Viewer); - break; - default: - error(404); - break; - } + match ($_GET['to']) { + 'forum' => $staffPm->assignClass($classList[FORUM_MOD]['Level'], $Viewer), + 'staff' => $staffPm->assignClass($classList[MOD]['Level'], $Viewer), + default => error(404), + }; header('Location: staffpm.php'); exit; } diff --git a/sections/staffpm/scoreboard.php b/sections/staffpm/scoreboard.php index 122af14ad..1ac50ff4b 100644 --- a/sections/staffpm/scoreboard.php +++ b/sections/staffpm/scoreboard.php @@ -8,7 +8,7 @@ $userMan = new Gazelle\Manager\User; $spmMan = new Gazelle\Manager\StaffPM; $isStaffView = ($_REQUEST['view'] ?? 'staff') === 'staff'; -$SupportStaff = array_merge(array_keys($userMan->flsList()), array_keys($userMan->staffList())); +$SupportStaff = [...array_keys($userMan->flsList()), ...array_keys($userMan->staffList())]; echo $Twig->render('staffpm/history.twig', [ 'left' => [ diff --git a/sections/staffpm/staff_inbox.php b/sections/staffpm/staff_inbox.php index 731b9a5f5..37bc6f575 100644 --- a/sections/staffpm/staff_inbox.php +++ b/sections/staffpm/staff_inbox.php @@ -159,7 +159,7 @@ if ($Viewer->isFLS()) { ?> // List messages $ClassLevels = $userMan->classLevelList(); $Row = 'a'; - foreach ($list as list($ID, $Subject, $UserID, $Status, $Level, $AssignedToUser, $Date, $Unread, $NumReplies, $ResolverID, $LastUserID)) { + foreach ($list as [$ID, $Subject, $UserID, $Status, $Level, $AssignedToUser, $Date, $Unread, $NumReplies, $ResolverID, $LastUserID]) { $Row = $Row === 'a' ? 'b' : 'a'; // Get assigned diff --git a/sections/tools/data/ocelot_info.php b/sections/tools/data/ocelot_info.php index c8de09185..6d166f979 100644 --- a/sections/tools/data/ocelot_info.php +++ b/sections/tools/data/ocelot_info.php @@ -10,7 +10,7 @@ if (!isset($_GET['userid'])) { $main = []; foreach ($MainStats as $Key => $Value) { if (is_numeric($Value)) { - if (substr($Key, 0, 6) === "bytes ") { + if (str_starts_with($Key, "bytes ")) { $Value = Format::get_size($Value); $Key = substr($Key, 6); } else { diff --git a/sections/tools/data/user_flow.php b/sections/tools/data/user_flow.php index 3327dff7c..b54775b05 100644 --- a/sections/tools/data/user_flow.php +++ b/sections/tools/data/user_flow.php @@ -14,8 +14,8 @@ $userflowDetails = $userMan->userflowDetails($paginator->limit(), $paginator->of echo $Twig->render('admin/userflow.twig', [ 'category' => array_map(fn($x) => "'$x'", array_keys($userflow)), - 'disabled' => array_map(function ($x) use ($userflow) { return $userflow[$x]['Joined']; }, array_keys($userflow)), - 'enabled' => array_map(function ($x) use ($userflow) { return -$userflow[$x]['Disabled']; }, array_keys($userflow)), + 'disabled' => array_map(fn($x) => $userflow[$x]['Joined'], array_keys($userflow)), + 'enabled' => array_map(fn($x) => -$userflow[$x]['Disabled'], array_keys($userflow)), 'paginator' => $paginator, 'show_flow' => $showFlow, 'details' => $userflowDetails, diff --git a/sections/tools/development/analysis_list.php b/sections/tools/development/analysis_list.php index 5d2cf1a41..0c341104a 100644 --- a/sections/tools/development/analysis_list.php +++ b/sections/tools/development/analysis_list.php @@ -6,7 +6,7 @@ if (!$Viewer->permitted('site_analysis')) { $remove = array_map( fn ($key) => (int)(explode('-', $key)[1]), - array_keys(array_filter($_POST, function ($x) { return preg_match('/^clear-\d+$/', $x);}, ARRAY_FILTER_USE_KEY)) + array_keys(array_filter($_POST, fn($x) => preg_match('/^clear-\d+$/', $x), ARRAY_FILTER_USE_KEY)) ); $errMan = new Gazelle\Manager\ErrorLog; diff --git a/sections/tools/development/clear_cache.php b/sections/tools/development/clear_cache.php index a6d4c1c91..4095f121e 100644 --- a/sections/tools/development/clear_cache.php +++ b/sections/tools/development/clear_cache.php @@ -42,7 +42,7 @@ if (!empty($_REQUEST['key'])) { continue; } $definitions = CACHE_NAMESPACE[$namespace]; - $shape = array_map(function ($s) use ($definitions) { return $definitions[$s];}, + $shape = array_map(fn($s) => $definitions[$s], array_intersect(array_keys($_REQUEST), array_keys($definitions)) ); if (isset($_REQUEST["$namespace-free"]) && str_contains($_REQUEST["$namespace-free"], '*')) { diff --git a/sections/tools/managers/forum_transitions_list.php b/sections/tools/managers/forum_transitions_list.php index ccde66a1f..1285a76ec 100644 --- a/sections/tools/managers/forum_transitions_list.php +++ b/sections/tools/managers/forum_transitions_list.php @@ -24,7 +24,7 @@ function forumList(array $list, $selected = 0) { function classList($Selected = 0) { $Return = ''; $Classes = (new Gazelle\Manager\User)->classList(); - foreach ($Classes as $ID => $Class) { + foreach ($Classes as $Class) { if ($Class['Secondary']) { continue; } diff --git a/sections/tools/managers/invite_source_config.php b/sections/tools/managers/invite_source_config.php index 758318451..9f64b28c6 100644 --- a/sections/tools/managers/invite_source_config.php +++ b/sections/tools/managers/invite_source_config.php @@ -9,7 +9,7 @@ if (!empty($_POST['name'])) { authorize(); $manager->create(trim($_POST['name'])); } -$remove = array_keys(array_filter($_POST, function ($x) { return preg_match('/^remove-\d+$/', $x);}, ARRAY_FILTER_USE_KEY)); +$remove = array_keys(array_filter($_POST, fn($x) => preg_match('/^remove-\d+$/', $x), ARRAY_FILTER_USE_KEY)); if ($remove) { authorize(); foreach ($remove as $r) { diff --git a/sections/tools/managers/irc_alter.php b/sections/tools/managers/irc_alter.php index 87afc6c13..89f9c21a4 100644 --- a/sections/tools/managers/irc_alter.php +++ b/sections/tools/managers/irc_alter.php @@ -6,18 +6,15 @@ if (!$Viewer->permitted('admin_manage_forums')) { authorize(); -$_POST['submit'] = $_POST['submit'] ?? $_POST['create'] ?? ''; +$_POST['submit'] ??= $_POST['create'] ?? ''; $manager = new Gazelle\Manager\IRC; if ($_POST['submit'] == 'Delete') { //Delete -dump($_POST); -exit; $ID = intval($_POST['id'] ?? 0); if ($ID === 0) { error(0); } $DB->prepared_query('DELETE FROM irc_channels WHERE ID = ?', $ID); - } else { // Edit & Create have shared validation // we have a 'submit-234' key, so we want to pull out that 234 diff --git a/sections/tools/managers/login_watch.php b/sections/tools/managers/login_watch.php index a70e46979..e243bbf4a 100644 --- a/sections/tools/managers/login_watch.php +++ b/sections/tools/managers/login_watch.php @@ -9,7 +9,7 @@ if ($_POST) { if ($Viewer->permitted('admin_manage_ipbans')) { $ban = []; $clear = []; - $admin = array_filter($_POST, function ($x) { return preg_match('/^admin-\d+$/', $x);}, ARRAY_FILTER_USE_KEY); + $admin = array_filter($_POST, fn($x) => preg_match('/^admin-\d+$/', $x), ARRAY_FILTER_USE_KEY); foreach ($admin as $admin_id => $op) { $id = (int)explode('-', $admin_id)[1]; if ($op == 'ban') { @@ -20,7 +20,7 @@ if ($_POST) { } } elseif ($Viewer->permitted('admin_login_watch')) { $clear = []; - $admin = array_filter($_POST, function ($x) { return preg_match('/^clear-\d+$/', $x);}, ARRAY_FILTER_USE_KEY); + $admin = array_filter($_POST, fn($x) => preg_match('/^clear-\d+$/', $x), ARRAY_FILTER_USE_KEY); foreach ($admin as $admin_id => $op) { $id = (int)explode('-', $admin_id)[1]; $clear[] = $id; diff --git a/sections/tools/managers/news.php b/sections/tools/managers/news.php index de51e873a..891d23a09 100644 --- a/sections/tools/managers/news.php +++ b/sections/tools/managers/news.php @@ -19,7 +19,6 @@ switch ($_REQUEST['action']) { $notification->push($notification->pushableUsers($Viewer->id()), $_POST['title'], $_POST['body'], SITE_URL . '/index.php', Notification::NEWS); header('Location: index.php'); exit; - break; case 'takeeditnews': authorize(); @@ -30,7 +29,6 @@ switch ($_REQUEST['action']) { $newsMan->modify($id, $_POST['title'], $_POST['body']); header('Location: index.php'); exit; - break; case 'editnews': $id = (int)$_REQUEST['id']; @@ -48,7 +46,6 @@ switch ($_REQUEST['action']) { $newsMan->remove($id); header('Location: index.php'); exit; - break; case 'news': $create = true; diff --git a/sections/tools/managers/permissions_alter.php b/sections/tools/managers/permissions_alter.php index 87c82ef44..e6287db66 100644 --- a/sections/tools/managers/permissions_alter.php +++ b/sections/tools/managers/permissions_alter.php @@ -59,7 +59,7 @@ if (isset($_REQUEST['submit'])) { $badge = $secondary ? ($_REQUEST['badge'] ?? '') : ''; $values = []; foreach ($_REQUEST as $key => $perm) { - if (substr($key, 0, 5) == 'perm_') { + if (str_starts_with($key, 'perm_')) { $values[substr($key, 5)] = (int)$perm; } } diff --git a/sections/tools/managers/rate_limit.php b/sections/tools/managers/rate_limit.php index 8ae2972e8..ab09ace8b 100644 --- a/sections/tools/managers/rate_limit.php +++ b/sections/tools/managers/rate_limit.php @@ -8,7 +8,7 @@ $PRL = new Gazelle\Manager\PermissionRateLimit; if ($_POST) { authorize(); if (isset($_POST['task'])) { - $remove = array_filter($_POST, function ($x) { return preg_match('/^remove-\d+$/', $x);}, ARRAY_FILTER_USE_KEY); + $remove = array_filter($_POST, fn($x) => preg_match('/^remove-\d+$/', $x), ARRAY_FILTER_USE_KEY); if (is_array($remove) && count($remove) == 1) { $PRL->remove(trim(array_keys($remove)[0], 'remove-')); } elseif ($_POST['task'] === 'add') { diff --git a/sections/tools/managers/referral_accounts.php b/sections/tools/managers/referral_accounts.php index bc7a6aa9b..1126320d0 100644 --- a/sections/tools/managers/referral_accounts.php +++ b/sections/tools/managers/referral_accounts.php @@ -43,7 +43,7 @@ View::show_header('Referral Accounts'); diff --git a/sections/tools/managers/referral_alter.php b/sections/tools/managers/referral_alter.php index 7e190b3c1..026377b8d 100644 --- a/sections/tools/managers/referral_alter.php +++ b/sections/tools/managers/referral_alter.php @@ -27,7 +27,7 @@ if ($_POST['submit'] == 'Delete') { error($Val->errorMessage()); } - if (substr($_POST['url'], -1) !== '/') { + if (!str_ends_with($_POST['url'], '/')) { $_POST['url'] .= '/'; } diff --git a/sections/tools/misc/album_of_month.php b/sections/tools/misc/album_of_month.php index aecb84652..cf406e6d7 100644 --- a/sections/tools/misc/album_of_month.php +++ b/sections/tools/misc/album_of_month.php @@ -150,7 +150,7 @@ View::show_header('Album of the Month');

    -  NL Torrents over +  NL Torrents over

    -  NL Torrents over +  NL Torrents over