Revision: 43477
Author: aaron
Date: 2008-11-14 07:44:14 +0000 (Fri, 14 Nov 2008)
Log Message:
-----------
(bug 16305) Allow optional replacement of user talk page
Modified Paths:
--------------
trunk/extensions/CheckUser/CheckUser.i18n.php
trunk/extensions/CheckUser/CheckUser_body.php
trunk/phase3/includes/specials/SpecialBlockip.php
Modified: trunk/extensions/CheckUser/CheckUser.i18n.php
===================================================================
--- trunk/extensions/CheckUser/CheckUser.i18n.php 2008-11-14 07:18:56 UTC
(rev 43476)
+++ trunk/extensions/CheckUser/CheckUser.i18n.php 2008-11-14 07:44:14 UTC
(rev 43477)
@@ -50,6 +50,7 @@
'checkuser-massblock-text' => 'Selected accounts will be blocked
indefinitely, with autoblocking enabled and account creation disabled.
IP addresses will be blocked for 1 week for IP users only and with
account creation disabled.',
'checkuser-blocktag' => 'Replace user pages with:',
+ 'checkuser-blocktag-talk' => 'Replace talk pages with:',
'checkuser-massblock-commit' => 'Block selected users',
'checkuser-block-success' => '\'\'\'The {{PLURAL:$2|user|users}} $1
{{PLURAL:$2|is|are}} now blocked.\'\'\'',
'checkuser-block-failure' => '\'\'\'No users blocked.\'\'\'',
Modified: trunk/extensions/CheckUser/CheckUser_body.php
===================================================================
--- trunk/extensions/CheckUser/CheckUser_body.php 2008-11-14 07:18:56 UTC
(rev 43476)
+++ trunk/extensions/CheckUser/CheckUser_body.php 2008-11-14 07:44:14 UTC
(rev 43477)
@@ -66,6 +66,7 @@
$period = $wgRequest->getInt( 'period' );
$users = $wgRequest->getArray( 'users' );
$tag = $wgRequest->getBool('usetag') ? trim(
$wgRequest->getVal( 'tag' ) ) : "";
+ $talkTag = $wgRequest->getBool('usettag') ? trim(
$wgRequest->getVal( 'talktag' ) ) : "";
# An IPv4?
if( preg_match(
'#^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}(/\d{1,2}|)$#', $user ) ) {
@@ -100,7 +101,7 @@
# Perform one of the various submit operations...
if( $wgRequest->wasPosted() ) {
if( $wgRequest->getVal('action') === 'block' ) {
- $this->doMassUserBlock( $users, $blockreason,
$tag );
+ $this->doMassUserBlock( $users, $blockreason,
$tag, $talkTag );
} else if( $checktype=='subuserips' ) {
$this->doUserIPsRequest( $name, $reason,
$period );
} else if( $xff && $checktype=='subipedits' ) {
@@ -108,9 +109,9 @@
} else if( $checktype=='subipedits' ) {
$this->doIPEditsRequest( $ip, false, $reason,
$period );
} else if( $xff && $checktype=='subipusers' ) {
- $this->doIPUsersRequest( $xff, true, $reason,
$period, $tag );
+ $this->doIPUsersRequest( $xff, true, $reason,
$period, $tag, $talkTag );
} else if( $checktype=='subipusers' ) {
- $this->doIPUsersRequest( $ip, false, $reason,
$period, $tag );
+ $this->doIPUsersRequest( $ip, false, $reason,
$period, $tag, $talkTag );
} else if( $checktype=='subuseredits' ) {
$this->doUserEditsRequest( $user, $reason,
$period );
}
@@ -210,7 +211,7 @@
* @param string $reason
* @param string $tag
*/
- protected function doMassUserBlock( $users, $reason = '', $tag = '' ) {
+ protected function doMassUserBlock( $users, $reason = '', $tag = '',
$talkTag = '' ) {
global $wgOut, $wgUser, $wgCheckUserMaxBlocks;
if( empty($users) || $wgUser->isBlocked(false) ) {
$wgOut->addWikiText(
wfMsgExt('checkuser-block-failure',array('parsemag')) );
@@ -222,7 +223,7 @@
$wgOut->addWikiText(
wfMsgExt('checkuser-block-noreason',array('parsemag')) );
return;
}
- $safeUsers = IPBlockForm::doMassUserBlock( $users, $reason,
$tag );
+ $safeUsers = IPBlockForm::doMassUserBlock( $users, $reason,
$tag, $talkTag );
if( !empty($safeUsers) ) {
$n = count($safeUsers);
$ulist = implode(', ',$safeUsers);
@@ -665,11 +666,14 @@
* @param string $ip
* @param bool $xfor
* @param string $reason
+ * @param int $period
+ * @param string $tag
+ * @param string $talkTag
* Lists all users in recent changes who used an IP, newest to oldest
down
* Outputs usernames, latest and earliest found edit date, and count
* List unique IPs used for each user in time order, list corresponding
user agent
*/
- protected function doIPUsersRequest( $ip, $xfor = false, $reason = '',
$period = 0, $tag = '' ) {
+ protected function doIPUsersRequest( $ip, $xfor = false, $reason = '',
$period = 0, $tag='', $talkTag='' ) {
global $wgUser, $wgOut, $wgLang, $wgTitle;
$fname = 'CheckUser::doIPUsersRequest';
@@ -906,11 +910,18 @@
}
$s .= "</ul></div>\n";
if( $wgUser->isAllowed('block') &&
!$wgUser->isBlocked() ) {
- $s.= "<fieldset>\n";
+ $s .= "<fieldset>\n";
$s .= "<legend>" .
wfMsgHtml('checkuser-massblock') . "</legend>\n";
$s .= "<p>" .
wfMsgExt('checkuser-massblock-text',array('parseinline')) . "</p>\n";
- $s .= "<p>" . Xml::checkLabel( wfMsgHtml(
"checkuser-blocktag" ), 'usetag', 'usetag') . ' ';
- $s .= Xml::input( 'tag', 46, $tag, array(
'maxlength' => '150', 'id' => 'blocktag' ) ) . "</p>\n";
+ $s .= '<table><tr>' .
+ '<td>' . Xml::check( 'usetag', false,
array('id' => 'usetag') ) . '</td>' .
+ '<td>' . Xml::label( wfMsgHtml(
"checkuser-blocktag" ), 'usetag' ) . '</td>' .
+ '<td>' . Xml::input( 'tag', 46, $tag,
array('id' => 'blocktag') ) . '</td>' .
+ '</tr><tr>' .
+ '<td>' . Xml::check( 'usettag', false,
array('id' => 'usettag') ) . '</td>' .
+ '<td>' . Xml::label( wfMsgHtml(
"checkuser-blocktag-talk" ), 'usettag' ) . '</td>' .
+ '<td>' . Xml::input( 'talktag', 46,
$talkTag, array('id' => 'talktag') ).'</td>'.
+ '</tr></table>';
$s .= "<p>" . wfMsgHtml( "checkuser-reason" ) .
' ';
$s .= Xml::input( 'blockreason', 46, '', array(
'maxlength' => '150', 'id' => 'blockreason' ) );
$s .= ' ' . Xml::submitButton(
wfMsgHtml('checkuser-massblock-commit'),
Modified: trunk/phase3/includes/specials/SpecialBlockip.php
===================================================================
--- trunk/phase3/includes/specials/SpecialBlockip.php 2008-11-14 07:18:56 UTC
(rev 43476)
+++ trunk/phase3/includes/specials/SpecialBlockip.php 2008-11-14 07:44:14 UTC
(rev 43477)
@@ -575,10 +575,11 @@
* Block a list of selected users
* @param array $users
* @param string $reason
- * @param string $tag
+ * @param string $tag replaces user pages
+ * @param string $talkTag replaces user talk pages
* @returns array, list of html-safe usernames
*/
- public static function doMassUserBlock( $users, $reason = '', $tag = ''
) {
+ public static function doMassUserBlock( $users, $reason = '', $tag =
'', $talkTag = '' ) {
global $wgUser;
$counter = $blockSize = 0;
$safeUsers = array();
@@ -597,9 +598,11 @@
if( is_null($u) || (!$u->getId() && !IP::isIPAddress(
$u->getName() )) ) {
continue;
}
- $usertitle = Title::makeTitle( NS_USER, $u->getName() );
- $userpage = new Article( $usertitle );
- $safeUsers[] = '[[' . $usertitle->getPrefixedText() .
'|' . $usertitle->getText() . ']]';
+ $userTitle = $u->getUserPage();
+ $userTalkTitle = $u->getTalkPage();
+ $userpage = new Article( $userTitle );
+ $usertalk = new Article( $userTalkTitle );
+ $safeUsers[] = '[[' . $userTitle->getPrefixedText() .
'|' . $userTitle->getText() . ']]';
$expirestr = $u->getId() ? 'indefinite' : '1 week';
$expiry = Block::parseExpiryInput( $expirestr );
$anonOnly = IP::isIPAddress( $u->getName() ) ? 1 : 0;
@@ -628,12 +631,15 @@
}
$logParams[] = 'nocreate';
# Add log entry
- $log->addEntry( 'block', $usertitle, $reason,
$logParams );
+ $log->addEntry( 'block', $userTitle, $reason,
$logParams );
}
# Tag userpage! (check length to avoid mistakes)
if( strlen($tag) > 2 ) {
$userpage->doEdit( $tag, $reason, EDIT_MINOR );
}
+ if( strlen($talkTag) > 2 ) {
+ $usertalk->doEdit( $talkTag, $reason,
EDIT_MINOR );
+ }
}
return $safeUsers;
}
_______________________________________________
MediaWiki-CVS mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs