Rev 1130 | Rev 1386 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 1130 | Rev 1174 | ||
---|---|---|---|
Line 48... | Line 48... | ||
48 | 48 | ||
49 | if (!empty($ipv6)) { |
49 | if (!empty($ipv6)) { |
50 | if (strpos($ipv6, '/') === false) $ipv6 .= '/128'; |
50 | if (strpos($ipv6, '/') === false) $ipv6 .= '/128'; |
51 | list($bare, $cidr) = explode('/', $ipv6); |
51 | list($bare, $cidr) = explode('/', $ipv6); |
52 | $this->bare = $bare; |
52 | $this->bare = $bare; |
53 | if (is_numeric($cidr)) throw new OIDplusException(_L('Invalid IPv4')); |
53 | if (!is_numeric($cidr)) throw new OIDplusException(_L('Invalid IPv6')); |
54 | $this->cidr = (int)$cidr; |
54 | $this->cidr = (int)$cidr; |
55 | if (!ipv6_valid($bare)) throw new OIDplusException(_L('Invalid IPv6')); |
55 | if (!ipv6_valid($bare)) throw new OIDplusException(_L('Invalid IPv6')); |
56 | if (!is_numeric($cidr)) throw new OIDplusException(_L('Invalid IPv6')); |
- | |
57 | if ($cidr < 0) throw new OIDplusException(_L('Invalid IPv6')); |
56 | if ($cidr < 0) throw new OIDplusException(_L('Invalid IPv6')); |
58 | if ($cidr > 128) throw new OIDplusException(_L('Invalid IPv6')); |
57 | if ($cidr > 128) throw new OIDplusException(_L('Invalid IPv6')); |
59 | $this->bare = ipv6_normalize($this->bare); |
58 | $this->bare = ipv6_normalize($this->bare); |
60 | $this->ipv6 = $this->bare . '/' . $this->cidr; |
59 | $this->ipv6 = $this->bare . '/' . $this->cidr; |
61 | } |
60 | } |