From 6e8677eb96253f7bf74f99f41aaf6d45655b35cf Mon Sep 17 00:00:00 2001 From: Roman Kelesidis Date: Mon, 3 Jul 2023 16:28:51 +0700 Subject: [PATCH] Revert "Minor improvements (#207)" --- CHANGELOG.md | 2 +- admin/admin_log.php | 4 ++-- common.php | 2 +- library/includes/functions.php | 3 ++- 4 files changed, 6 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6cfd4cb7..217e331f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -14,7 +14,7 @@ - Corrected translations [\#183](https://github.com/torrentpier/torrentpier-lts/pull/183) ([belomaxorka](https://github.com/belomaxorka)) - Fixed $bb_cfg['pm_days_keep'] [\#180](https://github.com/torrentpier/torrentpier-lts/pull/180) ([belomaxorka](https://github.com/belomaxorka)) - IP storage bugfix [\#177](https://github.com/torrentpier/torrentpier-lts/pull/177) ([belomaxorka](https://github.com/belomaxorka)) -- Minor improvements [\#172](https://github.com/torrentpier/torrentpier-lts/pull/172), [\#175](https://github.com/torrentpier/torrentpier-lts/pull/175), [\#176](https://github.com/torrentpier/torrentpier-lts/pull/176), [\#178](https://github.com/torrentpier/torrentpier-lts/pull/178), [\#179](https://github.com/torrentpier/torrentpier-lts/pull/179), [\#181](https://github.com/torrentpier/torrentpier-lts/pull/181), [\#187](https://github.com/torrentpier/torrentpier-lts/pull/187), [\#192](https://github.com/torrentpier/torrentpier-lts/pull/192), [\#194](https://github.com/torrentpier/torrentpier-lts/pull/194), [\#195](https://github.com/torrentpier/torrentpier-lts/pull/195), [\#199](https://github.com/torrentpier/torrentpier-lts/pull/199), [\#200](https://github.com/torrentpier/torrentpier-lts/pull/200), [\#201](https://github.com/torrentpier/torrentpier-lts/pull/201), [\#207](https://github.com/torrentpier/torrentpier-lts/pull/207), [\#208](https://github.com/torrentpier/torrentpier-lts/pull/208) ([belomaxorka](https://github.com/belomaxorka)) +- Minor improvements [\#172](https://github.com/torrentpier/torrentpier-lts/pull/172), [\#175](https://github.com/torrentpier/torrentpier-lts/pull/175), [\#176](https://github.com/torrentpier/torrentpier-lts/pull/176), [\#178](https://github.com/torrentpier/torrentpier-lts/pull/178), [\#179](https://github.com/torrentpier/torrentpier-lts/pull/179), [\#181](https://github.com/torrentpier/torrentpier-lts/pull/181), [\#187](https://github.com/torrentpier/torrentpier-lts/pull/187), [\#192](https://github.com/torrentpier/torrentpier-lts/pull/192), [\#194](https://github.com/torrentpier/torrentpier-lts/pull/194), [\#195](https://github.com/torrentpier/torrentpier-lts/pull/195), [\#199](https://github.com/torrentpier/torrentpier-lts/pull/199), [\#200](https://github.com/torrentpier/torrentpier-lts/pull/200), [\#201](https://github.com/torrentpier/torrentpier-lts/pull/201), [\#208](https://github.com/torrentpier/torrentpier-lts/pull/208) ([belomaxorka](https://github.com/belomaxorka)) - Fixed empty user search box [\#171](https://github.com/torrentpier/torrentpier-lts/pull/171) ([belomaxorka](https://github.com/belomaxorka)) - Added some placeholders for input fields [\#173](https://github.com/torrentpier/torrentpier-lts/pull/173) ([belomaxorka](https://github.com/belomaxorka)) diff --git a/admin/admin_log.php b/admin/admin_log.php index 22a45623..5331a38e 100644 --- a/admin/admin_log.php +++ b/admin/admin_log.php @@ -304,7 +304,7 @@ if ($log_rowset) 'USER_ID' => $row['log_user_id'], 'USERNAME' => $row['log_username'], 'USER_HREF_S' => url_arg($url, $user_key, $row['log_user_id']), - 'USER_IP' => verify_ip($row['log_user_ip']) ? decode_ip($row['log_user_ip']) : '127.0.0.1', + 'USER_IP' => decode_ip($row['log_user_ip']), 'FORUM_ID' => $row['log_forum_id'], 'FORUM_HREF' => BB_ROOT . FORUM_URL . $row['log_forum_id'], @@ -410,4 +410,4 @@ $template->assign_vars(array( 'TOPIC_CSV' => $topic_csv, )); -print_page('admin_log.tpl', 'admin'); +print_page('admin_log.tpl', 'admin'); \ No newline at end of file diff --git a/common.php b/common.php index edfa45ab..d43e41b6 100644 --- a/common.php +++ b/common.php @@ -300,7 +300,7 @@ function hexhex ($value) function verify_ip ($ip) { - return (bool)filter_var($ip, FILTER_VALIDATE_IP, FILTER_FLAG_IPV4); + return preg_match('#^(\d{1,3}\.){3}\d{1,3}$#', $ip); } function str_compact ($str) diff --git a/library/includes/functions.php b/library/includes/functions.php index e56713e4..46063e8d 100644 --- a/library/includes/functions.php +++ b/library/includes/functions.php @@ -997,7 +997,8 @@ function bt_show_port ($port) function decode_ip_xx ($ip) { - return inet_ntop(inet_pton($ip) & inet_pton("255.255.255.0")); + $h = explode('.', chunk_split($ip, 2, '.')); + return hexdec($h[0]) .'.'. hexdec($h[1]) .'.'. hexdec($h[2]) .'.xx'; } function checkbox_get_val (&$key, &$val, $default = 1, $on = 1, $off = 0)