From 31d5e782dedb0a09b5d73e7bac61dccfe25e73f1 Mon Sep 17 00:00:00 2001 From: Karl 'vollmerk' Vollmer Date: Thu, 28 Feb 2008 05:44:49 +0000 Subject: removed ip2int, int2ip custom functions fixed browse issues when adding filters in specific order --- docs/CHANGELOG | 2 ++ lib/class/access.class.php | 10 +++++----- lib/class/api.class.php | 4 ++-- lib/class/browse.class.php | 2 +- lib/class/stream.class.php | 2 +- lib/class/user.class.php | 16 ++++++++-------- lib/class/vauth.class.php | 6 +++--- lib/class/xmlrpcserver.class.php | 2 +- lib/general.lib.php | 25 +------------------------ templates/show_access_list.inc.php | 4 ++-- templates/show_edit_access.inc.php | 4 ++-- templates/show_ip_history.inc.php | 2 +- 12 files changed, 29 insertions(+), 50 deletions(-) diff --git a/docs/CHANGELOG b/docs/CHANGELOG index 47f1331b..a138ab88 100755 --- a/docs/CHANGELOG +++ b/docs/CHANGELOG @@ -4,6 +4,8 @@ -------------------------------------------------------------------------- v.3.4-Beta2 + - Fixed browse issue when adding filters under specific conditions + - Removed ip2int, int2ip and replaced with standard PHP functions - Updated Russian Translation and plural fixes ( Thx littlesavage ) - Fixed Sorting on Admin->Browse Users - Fixed Shoutbox and shoutbox management (pb1dft) diff --git a/lib/class/access.class.php b/lib/class/access.class.php index e2ed73ec..98fd0b39 100644 --- a/lib/class/access.class.php +++ b/lib/class/access.class.php @@ -80,8 +80,8 @@ class Access { $name = Dba::escape($data['name']); $type = self::validate_type($data['type']); - $start = ip2int($data['start']); - $end = ip2int($data['end']); + $start = ip2long($data['start']); + $end = ip2long($data['end']); $level = Dba::escape($data['level']); $user = $data['user'] ? Dba::escape($data['user']) : '-1'; $key = Dba::escape($data['key']); @@ -104,8 +104,8 @@ class Access { /* We need to verify the incomming data a littlebit */ - $start = ip2int($data['start']); - $end = ip2int($data['end']); + $start = ip2long($data['start']); + $end = ip2long($data['end']); $name = Dba::escape($data['name']); $key = Dba::escape($data['key']); $user = $data['user'] ? Dba::escape($data['user']) : '-1'; @@ -170,7 +170,7 @@ class Access { } // Clean incomming variables - $ip = ip2int($ip); + $ip = ip2long($ip); $user = Dba::escape($user); $key = Dba::escape($key); $level = Dba::escape($level); diff --git a/lib/class/api.class.php b/lib/class/api.class.php index 8e15c136..f1ff7a33 100644 --- a/lib/class/api.class.php +++ b/lib/class/api.class.php @@ -65,10 +65,10 @@ class Api { // Clean incomming variables $user_id = Dba::escape($user_id); $timestamp = intval($timestamp); - $ip = ip2int($ip); + $ip = ip2long($ip); // Log this attempt - debug_event('API','Login Attempt, IP:' . int2ip($ip) . ' Time:' . $timestamp . ' User:' . $user_id . ' Auth:' . $passphrase,'1'); + debug_event('API','Login Attempt, IP:' . long2ip($ip) . ' Time:' . $timestamp . ' User:' . $user_id . ' Auth:' . $passphrase,'1'); // Run the query and return the passphrases as we'll have to mangle them // to figure out if they match what we've got diff --git a/lib/class/browse.class.php b/lib/class/browse.class.php index bf72bbe9..cf5644b5 100644 --- a/lib/class/browse.class.php +++ b/lib/class/browse.class.php @@ -433,7 +433,7 @@ class Browse { } // if filters // Now Add the Order - $order_sql = "ORDER BY "; + $order_sql = " ORDER BY "; // If we don't have a sort, then go ahead and return it now if (!is_array($_SESSION['browse']['sort'])) { return $sql; } diff --git a/lib/class/stream.class.php b/lib/class/stream.class.php index 1f802bd7..80d05654 100644 --- a/lib/class/stream.class.php +++ b/lib/class/stream.class.php @@ -188,7 +188,7 @@ class Stream { $expire = time() + Config::get('stream_length'); $sid = Dba::escape($sid); $agent = Dba::escape($_SERVER['HTTP_USER_AGENT']); - $ip = ip2int($_SERVER['REMOTE_ADDR']); + $ip = ip2long($_SERVER['REMOTE_ADDR']); $uid = Dba::escape($uid); $sql = "UPDATE `session_stream` SET `expire`='$expire', `agent`='$agent', `ip`='$ip' " . diff --git a/lib/class/user.class.php b/lib/class/user.class.php index d548f1f3..5c7a2124 100644 --- a/lib/class/user.class.php +++ b/lib/class/user.class.php @@ -553,7 +553,7 @@ class User { $sip = $_SERVER['REMOTE_ADDR']; debug_event('User Ip', 'Login from ip adress: ' . $sip,'3'); } - $ip = ip2int($sip); + $ip = ip2long($sip); $date = time(); $user = $this->id; @@ -658,16 +658,16 @@ class User { /* Get Users Last ip */ $data = $this->get_ip_history(1); - $this->ip_history = int2ip($data['0']['ip']); + $this->ip_history = long2ip($data['0']['ip']); } // format_user - /*! - @function format_favorites - @discussion takes an array of objects and formats them corrrectly - and returns a simply array with just count); diff --git a/lib/class/vauth.class.php b/lib/class/vauth.class.php index a7d2dc91..5f67e442 100644 --- a/lib/class/vauth.class.php +++ b/lib/class/vauth.class.php @@ -264,7 +264,7 @@ class vauth { } // end switch on data type $username = Dba::escape($data['username']); - $ip = $_SERVER['REMOTE_ADDR'] ? Dba::escape(ip2int($_SERVER['REMOTE_ADDR'])) : '0'; + $ip = $_SERVER['REMOTE_ADDR'] ? Dba::escape(ip2long($_SERVER['REMOTE_ADDR'])) : '0'; $type = Dba::escape($data['type']); $value = Dba::escape($data['value']); $agent = Dba::escape(substr($_SERVER['HTTP_USER_AGENT'],0,254)); @@ -365,7 +365,7 @@ class vauth { break; case 'stream': $key = Dba::escape($key); - $ip = ip2int($data['ip']); + $ip = ip2long($data['ip']); $agent = Dba::escape($data['agent']); $sql = "SELECT * FROM `session_stream` WHERE `id`='$key' AND `expire` > '$time' AND `ip`='$ip' AND `agent`='$agent'"; $db_results = Dba::query($sql); @@ -511,7 +511,7 @@ class vauth { if (Config::get('prevent_multiple_logins')) { $client = new User($results['id']); $current_ip = $client->is_logged_in(); - if ($current_ip != ip2int($_SERVER['REMOTE_ADDR'])) { + if ($current_ip != ip2long($_SERVER['REMOTE_ADDR'])) { Error::add('general','User Already Logged in'); return false; } diff --git a/lib/class/xmlrpcserver.class.php b/lib/class/xmlrpcserver.class.php index e5f3eff3..6cb08451 100644 --- a/lib/class/xmlrpcserver.class.php +++ b/lib/class/xmlrpcserver.class.php @@ -146,7 +146,7 @@ class xmlRpcServer { debug_event('XMLSERVER','Login Attempt, IP: ' . $_SERVER['REMOTE_ADDR'] . ' Time: ' . $timestamp . ' Hash:' . $encoded_key,'5'); // Convert the IP Address to an int - $ip = ip2int($_SERVER['REMOTE_ADDR']); + $ip = ip2long($_SERVER['REMOTE_ADDR']); // Run the query and return the key's for ACLs of type RPC that would match this IP $sql = "SELECT * FROM `access_list` WHERE `type`='rpc' AND `start` <= '$ip' AND `end` >= '$ip'"; diff --git a/lib/general.lib.php b/lib/general.lib.php index e43736e5..5c80606b 100644 --- a/lib/general.lib.php +++ b/lib/general.lib.php @@ -1,7 +1,7 @@ ?> name); ?> - start); ?> - end); ?> + start); ?> + end); ?> get_level_name(); ?> get_user_name(); ?> key; ?> diff --git a/templates/show_edit_access.inc.php b/templates/show_edit_access.inc.php index c4825d2f..14848946 100644 --- a/templates/show_edit_access.inc.php +++ b/templates/show_edit_access.inc.php @@ -42,14 +42,14 @@ : - + (0.0.0.0) : - + (0.0.0.0) diff --git a/templates/show_ip_history.inc.php b/templates/show_ip_history.inc.php index 9b266772..801d51cd 100644 --- a/templates/show_ip_history.inc.php +++ b/templates/show_ip_history.inc.php @@ -43,7 +43,7 @@ - + -- cgit