Deprecate $wgSysopUserBans and $wgSysopRangeBans, both of which are pre-1.2, and...
authorHappy-melon <happy-melon@users.mediawiki.org>
Sat, 12 Mar 2011 12:13:22 +0000 (12:13 +0000)
committerHappy-melon <happy-melon@users.mediawiki.org>
Sat, 12 Mar 2011 12:13:22 +0000 (12:13 +0000)
includes/DefaultSettings.php
includes/Linker.php
includes/specials/SpecialBlockip.php
includes/specials/SpecialContributions.php
includes/specials/SpecialDeletedContributions.php
includes/specials/SpecialIpblocklist.php

index 889fa99..70f3a3b 100644 (file)
@@ -3175,10 +3175,16 @@ $wgSecureLogin        = false;
  * @{
  */
 
-/** Allow sysops to ban logged-in users */
+/**
+ * Allow sysops to ban logged-in users
+ * @deprecated @since 1.18
+ */
 $wgSysopUserBans        = true;
 
-/** Allow sysops to ban IP ranges */
+/**
+ * Allow sysops to ban IP ranges
+ * @deprecated @since 1.18; set $wgBlockCIDRLimit to array( 'IPv4' => 32, 'IPv6 => 128 ) instead.
+ */
 $wgSysopRangeBans       = true;
 
 /**
index 5a499cd..a2438e7 100644 (file)
@@ -880,9 +880,9 @@ class Linker {
         * @return String: HTML fragment
         */
        public function userToolLinks( $userId, $userText, $redContribsWhenNoEdits = false, $flags = 0, $edits = null ) {
-               global $wgUser, $wgDisableAnonTalk, $wgSysopUserBans, $wgLang;
+               global $wgUser, $wgDisableAnonTalk, $wgLang;
                $talkable = !( $wgDisableAnonTalk && 0 == $userId );
-               $blockable = ( $wgSysopUserBans || 0 == $userId ) && !$flags & self::TOOL_LINKS_NOBLOCK;
+               $blockable = !$flags & self::TOOL_LINKS_NOBLOCK;
 
                $items = array();
                if ( $talkable ) {
index 9b11a5c..6f4736e 100644 (file)
@@ -106,16 +106,12 @@ class IPBlockForm extends SpecialPage {
        }
 
        public function showForm( $err ) {
-               global $wgOut, $wgUser, $wgSysopUserBans;
+               global $wgOut, $wgUser;
 
                $wgOut->setPageTitle( wfMsg( 'blockip-title' ) );
                $wgOut->addWikiMsg( 'blockiptext' );
 
-               if( $wgSysopUserBans ) {
-                       $mIpaddress = Xml::label( wfMsg( 'ipadressorusername' ), 'mw-bi-target' );
-               } else {
-                       $mIpaddress = Xml::label( wfMsg( 'ipaddress' ), 'mw-bi-target' );
-               }
+               $mIpaddress = Xml::label( wfMsg( 'ipadressorusername' ), 'mw-bi-target' );
                $mIpbexpiry = Xml::label( wfMsg( 'ipbexpiry' ), 'wpBlockExpiry' );
                $mIpbother = Xml::label( wfMsg( 'ipbother' ), 'mw-bi-other' );
                $mIpbreasonother = Xml::label( wfMsg( 'ipbreason' ), 'wpBlockReasonList' );
@@ -426,7 +422,7 @@ class IPBlockForm extends SpecialPage {
         * @return array(message key, arguments) on failure, empty array on success
         */
        function doBlock( &$userId = null, &$expiry = null ) {
-               global $wgUser, $wgSysopUserBans, $wgSysopRangeBans, $wgBlockAllowsUTEdit, $wgBlockCIDRLimit;
+               global $wgUser, $wgBlockAllowsUTEdit, $wgBlockCIDRLimit;
 
                $userId = 0;
                # Expand valid IPv6 addresses, usernames are left as is
@@ -441,7 +437,7 @@ class IPBlockForm extends SpecialPage {
                        $matches = array();
                        if( preg_match( "/^($rxIP4)\\/(\\d{1,2})$/", $this->BlockAddress, $matches ) ) {
                                # IPv4
-                               if( $wgSysopRangeBans ) {
+                               if( $wgBlockCIDRLimit['IPv4'] != 32 ){
                                        if( !IP::isIPv4( $this->BlockAddress ) || $matches[2] > 32 ) {
                                                return array( 'ip_range_invalid' );
                                        } elseif ( $matches[2] < $wgBlockCIDRLimit['IPv4'] ) {
@@ -454,7 +450,7 @@ class IPBlockForm extends SpecialPage {
                                }
                        } elseif( preg_match( "/^($rxIP6)\\/(\\d{1,3})$/", $this->BlockAddress, $matches ) ) {
                                # IPv6
-                               if( $wgSysopRangeBans ) {
+                               if( $wgBlockCIDRLimit['IPv6'] != 128 ) {
                                        if( !IP::isIPv6( $this->BlockAddress ) || $matches[2] > 128 ) {
                                                return array( 'ip_range_invalid' );
                                        } elseif( $matches[2] < $wgBlockCIDRLimit['IPv6'] ) {
@@ -467,17 +463,13 @@ class IPBlockForm extends SpecialPage {
                                }
                        } else {
                                # Username block
-                               if( $wgSysopUserBans ) {
-                                       $user = User::newFromName( $this->BlockAddress );
-                                       if( $user instanceof User && $user->getId() ) {
-                                               # Use canonical name
-                                               $userId = $user->getId();
-                                               $this->BlockAddress = $user->getName();
-                                       } else {
-                                               return array( 'nosuchusershort', htmlspecialchars( $user ? $user->getName() : $this->BlockAddress ) );
-                                       }
+                               $user = User::newFromName( $this->BlockAddress );
+                               if( $user instanceof User && $user->getId() ) {
+                                       # Use canonical name
+                                       $userId = $user->getId();
+                                       $this->BlockAddress = $user->getName();
                                } else {
-                                       return array( 'badipaddress' );
+                                       return array( 'nosuchusershort', htmlspecialchars( $user ? $user->getName() : $this->BlockAddress ) );
                                }
                        }
                }
index 6e2f36e..d4fb945 100644 (file)
@@ -240,7 +240,6 @@ class SpecialContributions extends SpecialPage {
         * @param $subject User: The viewing user ($wgUser is still checked in some cases, like userrights page!!)
         */
        public static function getUserLinks( Title $userpage, Title $talkpage, User $target, User $subject ) {
-               global $wgSysopUserBans;
 
                $sk = $subject->getSkin();
                $id = $target->getId();
@@ -248,7 +247,7 @@ class SpecialContributions extends SpecialPage {
 
                $tools[] = $sk->link( $talkpage, wfMsgHtml( 'sp-contributions-talk' ) );
 
-               if( ( $id !== null && $wgSysopUserBans ) || ( $id === null && IP::isIPAddress( $username ) ) ) {
+               if( ( $id !== null ) || ( $id === null && IP::isIPAddress( $username ) ) ) {
                        if( $subject->isAllowed( 'block' ) ) { # Block / Change block / Unblock links
                                if ( $target->isBlocked() ) {
                                        $tools[] = $sk->linkKnown( # Change block link
index bc2a90b..6041e3c 100644 (file)
@@ -354,7 +354,7 @@ class DeletedContributionsPage extends SpecialPage {
         * @todo Fixme: almost the same as contributionsSub in SpecialContributions.php. Could be combined.
         */
        function getSubTitle( $nt, $id ) {
-               global $wgSysopUserBans, $wgLang, $wgUser, $wgOut;
+               global $wgLang, $wgUser, $wgOut;
 
                $sk = $wgUser->getSkin();
 
@@ -368,7 +368,7 @@ class DeletedContributionsPage extends SpecialPage {
                if( $talk ) {
                        # Talk page link
                        $tools[] = $sk->link( $talk, wfMsgHtml( 'sp-contributions-talk' ) );
-                       if( ( $id !== null && $wgSysopUserBans ) || ( $id === null && IP::isIPAddress( $nt->getText() ) ) ) {
+                       if( ( $id !== null ) || ( $id === null && IP::isIPAddress( $nt->getText() ) ) ) {
                                if( $wgUser->isAllowed( 'block' ) ) { # Block / Change block / Unblock links
                                        if ( $userObj->isBlocked() ) {
                                                $tools[] = $sk->linkKnown( # Change block link
index d7c6f32..764cddc 100644 (file)
@@ -121,7 +121,7 @@ class IPUnblockForm extends SpecialPage {
         * @return $out string: HTML form
         */
        function showForm( $err = null ) {
-               global $wgOut, $wgUser, $wgSysopUserBans;
+               global $wgOut, $wgUser;
 
                $wgOut->addWikiMsg( 'unblockiptext' );
 
@@ -139,12 +139,12 @@ class IPUnblockForm extends SpecialPage {
                                $encName = htmlspecialchars( $block->getRedactedName() );
                                $encId = $this->id;
                                $addressPart = $encName . Html::hidden( 'id', $encId );
-                               $ipa = wfMsgHtml( $wgSysopUserBans ? 'ipadressorusername' : 'ipaddress' );
+                               $ipa = wfMsgHtml( 'ipadressorusername' );
                        }
                }
                if ( !$addressPart ) {
                        $addressPart = Xml::input( 'wpUnblockAddress', 40, $this->ip, array( 'type' => 'text', 'tabindex' => '1' ) );
-                       $ipa = Xml::label( wfMsg( $wgSysopUserBans ? 'ipadressorusername' : 'ipaddress' ), 'wpUnblockAddress' );
+                       $ipa = Xml::label( wfMsg( 'ipadressorusername' ), 'wpUnblockAddress' );
                }
 
                $wgOut->addHTML(