diff --git a/CHANGELOG.md b/CHANGELOG.md index 75f357772..160300e58 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) ([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) ([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/dl_list.php b/dl_list.php index eb4124e9d..1cd3dfad4 100644 --- a/dl_list.php +++ b/dl_list.php @@ -11,8 +11,8 @@ define('BB_SCRIPT', 'dl_list'); require __DIR__ . '/common.php'; -$forum_id = isset($_REQUEST[POST_FORUM_URL]) ? (int)$_REQUEST[POST_FORUM_URL] : 0; -$topic_id = isset($_REQUEST[POST_TOPIC_URL]) ? (int)$_REQUEST[POST_TOPIC_URL] : 0; +$forum_id = $_REQUEST[POST_FORUM_URL] ?? 0; +$topic_id = $_REQUEST[POST_TOPIC_URL] ?? 0; $mode = isset($_REQUEST['mode']) ? (string)$_REQUEST['mode'] : ''; $confirmed = isset($_POST['confirm']); diff --git a/modcp.php b/modcp.php index a151eb0cc..f72b19b3b 100644 --- a/modcp.php +++ b/modcp.php @@ -73,9 +73,9 @@ function validate_mode_condition($request_index, $mod_action = '') $user->session_start(['req_login' => true]); // Obtain initial vars -$forum_id = $_REQUEST['f'] ?? 0; -$topic_id = $_REQUEST['t'] ?? 0; -$post_id = $_REQUEST['p'] ?? 0; +$forum_id = $_REQUEST[POST_FORUM_URL] ?? 0; +$topic_id = $_REQUEST[POST_TOPIC_URL] ?? 0; +$post_id = $_REQUEST[POST_POST_URL] ?? 0; $start = isset($_REQUEST['start']) ? abs((int)$_REQUEST['start']) : 0; $confirmed = isset($_POST['confirm']); @@ -599,8 +599,10 @@ switch ($mode) { bb_die($lang['NO_SUCH_POST']); } + $no_lookup = false; if (!$ip_this_post = \TorrentPier\Helpers\IPHelper::long2ip_extended($post_row['poster_ip'])) { $ip_this_post = $lang['NOT_AVAILABLE']; + $no_lookup = true; } $ip_this_post = ($rdns_ip_num == $ip_this_post) ? gethostbyaddr($ip_this_post) : $ip_this_post; @@ -610,8 +612,9 @@ switch ($mode) { $template->assign_vars([ 'TPL_MODCP_IP' => true, 'IP' => $ip_this_post, - 'U_LOOKUP_IP' => "modcp.php?mode=ip&" . POST_POST_URL . "=$post_id&" . POST_TOPIC_URL . "=$topic_id&rdns=$ip_this_post&sid=" . $userdata['session_id'], + 'U_LOOKUP_IP' => !$no_lookup ? "modcp.php?mode=ip&" . POST_POST_URL . "=$post_id&" . POST_TOPIC_URL . "=$topic_id&rdns=$ip_this_post&sid=" . $userdata['session_id'] : '', ]); + unset($no_lookup); // // Get other IP's this user has posted under @@ -631,8 +634,10 @@ switch ($mode) { continue; } + $no_lookup = false; if (!$ip = \TorrentPier\Helpers\IPHelper::long2ip_extended($row['poster_ip'])) { $ip = $lang['NOT_AVAILABLE']; + $no_lookup = true; } $ip = ($rdns_ip_num == $ip || $rdns_ip_num == 'all') ? gethostbyaddr($ip) : $ip; @@ -640,8 +645,9 @@ switch ($mode) { 'ROW_CLASS' => !($i % 2) ? 'row4' : 'row5', 'IP' => $ip, 'POSTS' => $row['postings'], - 'U_LOOKUP_IP' => "modcp.php?mode=ip&" . POST_POST_URL . "=$post_id&" . POST_TOPIC_URL . "=$topic_id&rdns=" . $ip . "&sid=" . $userdata['session_id'], + 'U_LOOKUP_IP' => !$no_lookup ? "modcp.php?mode=ip&" . POST_POST_URL . "=$post_id&" . POST_TOPIC_URL . "=$topic_id&rdns=" . $ip . "&sid=" . $userdata['session_id'] : '', ]); + unset($no_lookup); $i++; } while ($row = DB()->sql_fetchrow($result)); @@ -651,7 +657,7 @@ switch ($mode) { // Get other users who've posted under this IP // $sql = "SELECT - u.user_id, + u.user_id, u.user_rank, IF(u.user_id = $anon, p.post_username, u.username) AS username, COUNT(*) as postings FROM " . BB_USERS . " u, " . BB_POSTS . " p @@ -667,15 +673,11 @@ switch ($mode) { if ($row = DB()->sql_fetchrow($result)) { $i = 0; do { - $id = $row['user_id']; - $username = (!$row['username']) ? $lang['GUEST'] : $row['username']; - $template->assign_block_vars('userrow', [ 'ROW_CLASS' => !($i % 2) ? 'row4' : 'row5', - 'USERNAME' => $username, + 'USERNAME' => profile_url($row), 'POSTS' => $row['postings'], - 'U_PROFILE' => ($id == GUEST_UID) ? "modcp.php?mode=ip&p=$post_id&t=$topic_id" : PROFILE_URL . $id, - 'U_SEARCHPOSTS' => "search.php?search_author=1&uid=$id", + 'U_SEARCHPOSTS' => "search.php?search_author=1&uid={$row['user_id']}", ]); $i++; diff --git a/posting.php b/posting.php index 53690a0fd..69dacb46e 100644 --- a/posting.php +++ b/posting.php @@ -202,17 +202,17 @@ if (!$is_auth[$is_auth_type]) { switch ($mode) { case 'newtopic': - $redirect = "mode=newtopic&f=$forum_id"; + $redirect = "mode=newtopic&" . POST_FORUM_URL . "=$forum_id"; break; case 'new_rel': - $redirect = "mode=new_rel&f=$forum_id"; + $redirect = "mode=new_rel&" . POST_FORUM_URL . "=$forum_id"; break; case 'reply': - $redirect = "mode=reply&t=$topic_id"; + $redirect = "mode=reply&" . POST_TOPIC_URL . "=$topic_id"; break; case 'quote': case 'editpost': - $redirect = "mode=quote&p=$post_id"; + $redirect = "mode=quote&" . POST_POST_URL . "=$post_id"; break; default: $redirect = ''; diff --git a/styles/templates/admin/admin_log.tpl b/styles/templates/admin/admin_log.tpl index 2bb57477e..c22dd4bdd 100644 --- a/styles/templates/admin/admin_log.tpl +++ b/styles/templates/admin/admin_log.tpl @@ -19,7 +19,7 @@