From 9cfd3d6a004ecb5484097ab7a82ea9ad40767a0d Mon Sep 17 00:00:00 2001 From: Roman Kelesidis Date: Sat, 4 May 2024 12:58:51 +0700 Subject: [PATCH] Minor improvements (#1462) * Minor improvements * Update viewforum.php * Update posting.php * Updated * Update admin_forums.php * Update CHANGELOG.md --- CHANGELOG.md | 2 +- admin/admin_forums.php | 16 ++++++++-------- dl_list.php | 2 +- modcp.php | 4 ++-- posting.php | 2 +- tracker.php | 6 +++--- viewforum.php | 2 +- 7 files changed, 17 insertions(+), 17 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index f7a47991a..3955c4369 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -14,7 +14,7 @@ - Fixed quote selection for smiles [\#1457](https://github.com/torrentpier/torrentpier/pull/1457) ([belomaxorka](https://github.com/belomaxorka)) - Demo mode: Allow registering torrents by default [\#1440](https://github.com/torrentpier/torrentpier/pull/1440) ([belomaxorka](https://github.com/belomaxorka)) - Code refactoring [\#1441](https://github.com/torrentpier/torrentpier/pull/1441) ([belomaxorka](https://github.com/belomaxorka)) -- Minor improvements [\#1435](https://github.com/torrentpier/torrentpier/pull/1435), [\#1443](https://github.com/torrentpier/torrentpier/pull/1443), [\#1446](https://github.com/torrentpier/torrentpier/pull/1446), [\#1450](https://github.com/torrentpier/torrentpier/pull/1450), [\#1452](https://github.com/torrentpier/torrentpier/pull/1452), [\#1458](https://github.com/torrentpier/torrentpier/pull/1458), [\#1461](https://github.com/torrentpier/torrentpier/pull/1461) ([belomaxorka](https://github.com/belomaxorka)) +- Minor improvements [\#1435](https://github.com/torrentpier/torrentpier/pull/1435), [\#1443](https://github.com/torrentpier/torrentpier/pull/1443), [\#1446](https://github.com/torrentpier/torrentpier/pull/1446), [\#1450](https://github.com/torrentpier/torrentpier/pull/1450), [\#1452](https://github.com/torrentpier/torrentpier/pull/1452), [\#1458](https://github.com/torrentpier/torrentpier/pull/1458), [\#1461](https://github.com/torrentpier/torrentpier/pull/1461), [\#1462](https://github.com/torrentpier/torrentpier/pull/1462) ([belomaxorka](https://github.com/belomaxorka)) - Updated deps [\#1454](https://github.com/torrentpier/torrentpier/pull/1454), [\#1455](https://github.com/torrentpier/torrentpier/pull/1455), [\#1459](https://github.com/torrentpier/torrentpier/pull/1459), [\#1460](https://github.com/torrentpier/torrentpier/pull/1460) ([belomaxorka](https://github.com/belomaxorka)) - New Crowdin updates [\#1444](https://github.com/torrentpier/torrentpier/pull/1444), [\#1447](https://github.com/torrentpier/torrentpier/pull/1447), [\#1453](https://github.com/torrentpier/torrentpier/pull/1453) ([Exileum](https://github.com/Exileum)) diff --git a/admin/admin_forums.php b/admin/admin_forums.php index 96e5c8602..a657f9a97 100644 --- a/admin/admin_forums.php +++ b/admin/admin_forums.php @@ -115,8 +115,8 @@ if ($mode) { if ($parent = get_forum_data($forum_parent)) { $cat_id = $parent['cat_id']; } - } elseif (isset($_REQUEST['c'])) { - $cat_id = (int)$_REQUEST['c']; + } elseif (isset($_REQUEST[POST_CAT_URL])) { + $cat_id = (int)$_REQUEST[POST_CAT_URL]; } $catlist = get_list('category', $cat_id, true); @@ -347,12 +347,12 @@ if ($mode) { // // Show form to edit a category // - $cat_id = (int)$_GET['c']; + $cat_id = (int)$_GET[POST_CAT_URL]; $cat_info = get_info('category', $cat_id); $hidden_fields = array( 'mode' => 'modcat', - 'c' => $cat_id, + POST_CAT_URL => $cat_id, ); $template->assign_vars(array( @@ -373,7 +373,7 @@ if ($mode) { bb_die('Category name is empty'); } - $cat_id = (int)$_POST['c']; + $cat_id = (int)$_POST[POST_CAT_URL]; $row = get_info('category', $cat_id); $cur_cat_title = $row['cat_title']; @@ -486,7 +486,7 @@ if ($mode) { case 'deletecat': // Show form to delete a category - $cat_id = (int)$_GET['c']; + $cat_id = (int)$_GET[POST_CAT_URL]; $catinfo = get_info('category', $cat_id); $categories_count = $catinfo['number']; @@ -634,7 +634,7 @@ if ($mode) { case 'cat_order': $move = (int)$_GET['move']; - $cat_id = (int)$_GET['c']; + $cat_id = (int)$_GET[POST_CAT_URL]; DB()->query(' UPDATE ' . BB_CATEGORIES . " SET @@ -681,7 +681,7 @@ if (!$mode || $show_main_page) { $where_cat_sql = $req_cat_id = ''; - if ($c =& $_REQUEST['c']) { + if ($c =& $_REQUEST[POST_CAT_URL]) { if ($c !== 'all') { $req_cat_id = (int)$c; $where_cat_sql = "WHERE cat_id = $req_cat_id"; diff --git a/dl_list.php b/dl_list.php index 1cd3dfad4..b156c9fd2 100644 --- a/dl_list.php +++ b/dl_list.php @@ -79,7 +79,7 @@ if ($mode == 'dl_delete' && $topic_id) { if (!$confirmed) { $hidden_fields = [ - 't' => $topic_id, + POST_TOPIC_URL => $topic_id, 'mode' => 'dl_delete', ]; diff --git a/modcp.php b/modcp.php index f72b19b3b..62d77599b 100644 --- a/modcp.php +++ b/modcp.php @@ -199,8 +199,8 @@ switch ($mode) { $hidden_fields = [ 'sid' => $userdata['session_id'], 'mode' => $mode, - 'f' => $forum_id, - 't' => $topic_id + POST_FORUM_URL => $forum_id, + POST_TOPIC_URL => $topic_id ]; foreach ($req_topics as $req_topic_id) { $hidden_fields['topic_id_list'][] = $req_topic_id; diff --git a/posting.php b/posting.php index 69dacb46e..e866d85e1 100644 --- a/posting.php +++ b/posting.php @@ -304,7 +304,7 @@ if (($delete || $mode == 'delete') && !$confirm) { redirect(POST_URL . "$post_id#$post_id"); } $hidden_fields = [ - 'p' => $post_id, + POST_POST_URL => $post_id, 'mode' => 'delete' ]; print_confirmation([ diff --git a/tracker.php b/tracker.php index d7714bc91..e0b4a567e 100644 --- a/tracker.php +++ b/tracker.php @@ -46,7 +46,7 @@ $lastvisit = (!IS_GUEST) ? $userdata['user_lastvisit'] : ''; $search_id = (isset($_GET['search_id']) && is_string($_GET['search_id'])) ? $_GET['search_id'] : ''; $session_id = $userdata['session_id']; -$status = is_countable($_POST['status']) ? $_POST['status'] : false; +$status = (isset($_POST['status']) && is_countable($_POST['status'])) ? (array)$_POST['status'] : []; $cat_forum = $tor_to_show = $search_in_forums_ary = []; $title_match_sql = $title_match_q = $search_in_forums_csv = ''; @@ -605,7 +605,7 @@ if ($allowed_forums) { if ($tor_type) { $SQL['WHERE'][] = "tor.tor_type IN(1,2)"; } - if ($status) { + if (!empty($status)) { $SQL['WHERE'][] = "tor.tor_status IN(" . implode(', ', $status) . ")"; } @@ -910,7 +910,7 @@ $template->assign_vars(array( 'S_RG_SELECT' => build_select($s_rg_key, $s_release_group_select, $s_rg_val), 'TOR_SEARCH_ACTION' => $tracker_url, 'TOR_COLSPAN' => $tor_colspan, - 'TOR_STATUS' => $statuses ?? false, + 'TOR_STATUS' => $statuses ?? '', 'TITLE_MATCH_MAX' => $title_match_max_len, 'POSTER_NAME_MAX' => $poster_name_max_len, 'POSTER_ERROR' => $poster_error, diff --git a/viewforum.php b/viewforum.php index 4c2fec38d..a1b2c3689 100644 --- a/viewforum.php +++ b/viewforum.php @@ -24,7 +24,7 @@ $page_cfg['load_tpl_vars'] = [ ]; // Init request vars -$forum_id = (int)request_var('f', ''); +$forum_id = (int)request_var(POST_FORUM_URL, ''); $start = abs((int)request_var('start', '')); $mark_read = (request_var('mark', '') === 'topics');