Index: branches/REL1_18/phase3/includes/Block.php |
— | — | @@ -1057,19 +1057,6 @@ |
1058 | 1058 | return array( null, null ); |
1059 | 1059 | } |
1060 | 1060 | |
1061 | | - if ( IP::isValid( $target ) ) { |
1062 | | - # We can still create a User if it's an IP address, but we need to turn |
1063 | | - # off validation checking (which would exclude IP addresses) |
1064 | | - return array( |
1065 | | - User::newFromName( IP::sanitizeIP( $target ), false ), |
1066 | | - Block::TYPE_IP |
1067 | | - ); |
1068 | | - |
1069 | | - } elseif ( IP::isValidBlock( $target ) ) { |
1070 | | - # Can't create a User from an IP range |
1071 | | - return array( IP::sanitizeRange( $target ), Block::TYPE_RANGE ); |
1072 | | - } |
1073 | | - |
1074 | 1061 | # Consider the possibility that this is not a username at all |
1075 | 1062 | # but actually an old subpage (bug #29797) |
1076 | 1063 | if( strpos( $target, '/' ) !== false ){ |
— | — | @@ -1085,6 +1072,18 @@ |
1086 | 1073 | # since hash characters are not valid in usernames or titles generally. |
1087 | 1074 | return array( $userObj, Block::TYPE_USER ); |
1088 | 1075 | |
| 1076 | + } elseif ( IP::isValid( $target ) ) { |
| 1077 | + # We can still create a User if it's an IP address, but we need to turn |
| 1078 | + # off validation checking (which would exclude IP addresses) |
| 1079 | + return array( |
| 1080 | + User::newFromName( IP::sanitizeIP( $target ), false ), |
| 1081 | + Block::TYPE_IP |
| 1082 | + ); |
| 1083 | + |
| 1084 | + } elseif ( IP::isValidBlock( $target ) ) { |
| 1085 | + # Can't create a User from an IP range |
| 1086 | + return array( IP::sanitizeRange( $target ), Block::TYPE_RANGE ); |
| 1087 | + |
1089 | 1088 | } elseif ( preg_match( '/^#\d+$/', $target ) ) { |
1090 | 1089 | # Autoblock reference in the form "#12345" |
1091 | 1090 | return array( substr( $target, 1 ), Block::TYPE_AUTO ); |