From: pk910 Date: Thu, 28 Jul 2011 08:15:41 +0000 (+0200) Subject: some fixes X-Git-Url: http://git.pk910.de/?p=PHP-P10.git;a=commitdiff_plain;h=55c45ccc4c5422ddd9ca3bb8840b5e75aa4184bc some fixes --- diff --git a/Uplink/IPAddr.class.php b/Uplink/IPAddr.class.php index e486fb0..661a8e2 100644 --- a/Uplink/IPAddr.class.php +++ b/Uplink/IPAddr.class.php @@ -34,7 +34,7 @@ class IPAddr { public function __construct($initial_value) { for($i = 0; $i < 8; $i++) { - $ip6[$i] = 0; + $this->ip6[$i] = 0; } if($initial_value == null) { //nothing @@ -67,6 +67,7 @@ class IPAddr { $i += 3; } } + $this->addr_is_ipv6 = true; } } @@ -83,6 +84,7 @@ class IPAddr { $this->ip6[$j++] = hexdec($block); } } + $this->addr_is_ipv6 = true; } public function parseIPv4($ipv4) { @@ -91,6 +93,7 @@ class IPAddr { $this->ip6[6] |= intval($ipv4blocks[1]); $this->ip6[7] = intval($ipv4blocks[2]) << 8; $this->ip6[7] |= intval($ipv4blocks[3]); + $this->addr_is_ipv6 = false; } public function isIPv6() { diff --git a/Uplink/Numerics.class.php b/Uplink/Numerics.class.php index 01944dc..87cb642 100644 --- a/Uplink/Numerics.class.php +++ b/Uplink/Numerics.class.php @@ -50,9 +50,6 @@ class Numerics { private static $base64charsLength = 64; public static function intToNum($int, $length) { - //fix a small "bug": normaly 0 = AAAAA but we need 1 = AAAAA - $int = $int - 1; - $numeric = ""; for($pos = $length-1; $pos >= 0; $pos--) { //current position represents floor($int / ($base64charsLength ^ $pos)) @@ -77,10 +74,6 @@ class Numerics { $int = ($posValue * $base); $base = $base * self::$base64charsLength; } - - //fix a small "bug": normaly 0 = AAAAA but we need 1 = AAAAA - $int = $int + 1; - return $int; } diff --git a/Uplink/Uplink.class.php b/Uplink/Uplink.class.php index 9f3eb52..232d976 100644 --- a/Uplink/Uplink.class.php +++ b/Uplink/Uplink.class.php @@ -75,7 +75,7 @@ class Uplink { private $settings = array(); private $server; private $eventHandler = null; - private $last_local_numeric = 1; + private $last_local_numeric = 0; const FLAG_P10SESSION = 0x0001; //connection is in P10 mode (server is connected) const FLAG_SECURITY_QUIT = 0x0002; //local connection abort because of security issues @@ -713,7 +713,7 @@ class Uplink { $ident = $user->getIdent(); $host = $user->getHost(); $modes = $user->getModes()->getModeString(); - $ip = Numerics::numericFromIP($user->getIP()); + $ip = $user->getIP()->getNumeric(); $numeric = $user->getNumeric(); $realname = $user->getRealname(); $this->send("N", $nick, $connect_time, $ident, $host, $modes, $ip, $numeric, $realname);