* @{
*/
-/** 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;
/**
* @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 ) {
}
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' );
* @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
$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'] ) {
}
} 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'] ) {
}
} 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 ) );
}
}
}
* @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();
$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
* @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();
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
* @return $out string: HTML form
*/
function showForm( $err = null ) {
- global $wgOut, $wgUser, $wgSysopUserBans;
+ global $wgOut, $wgUser;
$wgOut->addWikiMsg( 'unblockiptext' );
$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(