* (bug 6635) Fix regression searching for range blocks on Ipblocklist
authorBrion Vibber <brion@users.mediawiki.org>
Wed, 12 Jul 2006 01:29:16 +0000 (01:29 +0000)
committerBrion Vibber <brion@users.mediawiki.org>
Wed, 12 Jul 2006 01:29:16 +0000 (01:29 +0000)
* Fix regression searching Ipblocklist with ugly URLs

It would probably be even nicer if the search for a specific IP would bring up matching range blocks

RELEASE-NOTES
includes/SpecialIpblocklist.php

index 8f50cf9..bb798fc 100644 (file)
@@ -55,6 +55,8 @@ it from source control: http://www.mediawiki.org/wiki/Download_from_SVN
 * Pre-strip characters ignored in IDNs from URLs so they can't be used
   to break the blacklists for regular URLs
 * Fix regression in blocking of user accounts
+* (bug 6635) Fix regression searching for range blocks on Ipblocklist
+* Fix regression searching Ipblocklist with ugly URLs
 
 
 == Languages updated ==
index b1cf1f4..16edc6c 100644 (file)
@@ -174,10 +174,17 @@ class IPUnblockForm {
                } elseif ( wfIP2Unsigned( $this->ip ) !== false ) {
                        $conds['ipb_address'] = $this->ip;
                        $conds['ipb_auto'] = 0;
+               } elseif( preg_match( "/^(\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3})\\/(\\d{1,2})$/", $this->ip, $matches ) ) {
+                       $conds['ipb_address'] = Block::normaliseRange( $this->ip );
+                       $conds['ipb_auto'] = 0;
                } else {
                        $user = User::newFromName( $this->ip );
-                       if ( ( $id = $user->getID() ) != 0 ) {
+                       if ( $user && ( $id = $user->getID() ) != 0 ) {
                                $conds['ipb_user'] = $id;
+                       } else {
+                               // Uh...?
+                               $conds['ipb_address'] = $this->ip;
+                               $conds['ipb_auto'] = 0;
                        }
                }
 
@@ -196,11 +203,12 @@ class IPUnblockForm {
        }
 
        function searchForm() {
-               global $wgTitle, $wgRequest;
+               global $wgTitle, $wgScript, $wgRequest;
                return
                        wfElement( 'form', array(
-                               'action' => $wgTitle->getLocalUrl() ),
+                               'action' => $wgScript ),
                                null ) .
+                       wfHidden( 'title', $wgTitle->getPrefixedDbKey() ) .
                        wfElement( 'input', array(
                                'type' => 'hidden',
                                'name' => 'action',