Revert "IP detect subsystem replace (#204)"

This commit is contained in:
Roman Kelesidis 2023-07-01 00:28:52 +07:00
parent 1c768b1eef
commit 0adde79a65
4 changed files with 8 additions and 12 deletions

View File

@ -8,7 +8,6 @@
- Release v2.1.5-2023.06 🎉
- Cron subsystem rework [\#206](https://github.com/torrentpier/torrentpier-lts/pull/206) ([belomaxorka](https://github.com/belomaxorka))
- Fixed broken sessions [\#205](https://github.com/torrentpier/torrentpier-lts/pull/205) ([belomaxorka](https://github.com/belomaxorka))
- IP detect subsystem replace [\#204](https://github.com/torrentpier/torrentpier-lts/pull/204) ([belomaxorka](https://github.com/belomaxorka))
- Fixed broken skype widget in user profile [\#203](https://github.com/torrentpier/torrentpier-lts/pull/203) ([belomaxorka](https://github.com/belomaxorka))
- Redirect to viewprofile.php if profile.php hasn't arguments [\#202](https://github.com/torrentpier/torrentpier-lts/pull/202) ([belomaxorka](https://github.com/belomaxorka))
- Show smilies in post for guests [\#196](https://github.com/torrentpier/torrentpier-lts/pull/196) ([belomaxorka](https://github.com/belomaxorka))

View File

@ -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');

View File

@ -265,17 +265,13 @@ function clean_filename ($fname)
function encode_ip ($ip)
{
$long = -1;
if (verify_ip($ip))
{
$long = ip2long($ip);
}
return $long;
$d = explode('.', $ip);
return sprintf('%02x%02x%02x%02x', $d[0], $d[1], $d[2], $d[3]);
}
function decode_ip ($ip)
{
return long2ip($ip);
return long2ip("0x{$ip}");
}
function ip2int ($ip)
@ -303,7 +299,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)

View File

@ -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)