Index: trunk/phase3/includes/User.php |
— | — | @@ -431,7 +431,7 @@ |
432 | 432 | * @return bool |
433 | 433 | */ |
434 | 434 | static function isIP( $name ) { |
435 | | - return preg_match('/^\d{1,3}\.\d{1,3}\.\d{1,3}\.(?:xxx|\d{1,3})$/',$name) || User::isIPv6($name); |
| 435 | + return IP::isIPAddress($name); |
436 | 436 | /*return preg_match("/^ |
437 | 437 | (?:[01]?\d{1,2}|2(:?[0-4]\d|5[0-5]))\. |
438 | 438 | (?:[01]?\d{1,2}|2(:?[0-4]\d|5[0-5]))\. |
— | — | @@ -441,27 +441,6 @@ |
442 | 442 | } |
443 | 443 | |
444 | 444 | /** |
445 | | - * Check if $name is an IPv6 IP. |
446 | | - */ |
447 | | - static function isIPv6($name) { |
448 | | - /* |
449 | | - * if it has any non-valid characters, it can't be a valid IPv6 |
450 | | - * address. |
451 | | - */ |
452 | | - if (preg_match("/[^:a-fA-F0-9]/", $name)) |
453 | | - return false; |
454 | | - |
455 | | - $parts = explode(":", $name); |
456 | | - if (count($parts) < 3) |
457 | | - return false; |
458 | | - foreach ($parts as $part) { |
459 | | - if (!preg_match("/^[0-9a-fA-F]{0,4}$/", $part)) |
460 | | - return false; |
461 | | - } |
462 | | - return true; |
463 | | - } |
464 | | - |
465 | | - /** |
466 | 445 | * Is the input a valid username? |
467 | 446 | * |
468 | 447 | * Checks if the input is a valid username, we don't want an empty string, |