2006-12-03 00:05:45 +00:00
|
|
|
<?php
|
2010-06-21 12:59:04 +00:00
|
|
|
/**
|
2010-08-14 19:19:41 +00:00
|
|
|
* Implements Special:Contributions
|
2010-06-21 12:59:04 +00:00
|
|
|
*
|
|
|
|
|
* This program is free software; you can redistribute it and/or modify
|
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
|
* the Free Software Foundation; either version 2 of the License, or
|
|
|
|
|
* (at your option) any later version.
|
|
|
|
|
*
|
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
|
*
|
|
|
|
|
* You should have received a copy of the GNU General Public License along
|
|
|
|
|
* with this program; if not, write to the Free Software Foundation, Inc.,
|
2010-06-21 13:16:32 +00:00
|
|
|
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
2010-06-21 12:59:04 +00:00
|
|
|
* http://www.gnu.org/copyleft/gpl.html
|
2010-08-14 19:19:41 +00:00
|
|
|
*
|
|
|
|
|
* @file
|
|
|
|
|
* @ingroup SpecialPage
|
2010-06-21 12:59:04 +00:00
|
|
|
*/
|
|
|
|
|
|
2019-05-13 14:18:07 +00:00
|
|
|
use MediaWiki\Block\DatabaseBlock;
|
2018-08-05 17:58:51 +00:00
|
|
|
use MediaWiki\MediaWikiServices;
|
2017-06-23 19:13:02 +00:00
|
|
|
use MediaWiki\Widget\DateInputWidget;
|
|
|
|
|
|
2006-12-03 00:05:45 +00:00
|
|
|
/**
|
2007-04-27 18:21:50 +00:00
|
|
|
* Special:Contributions, show user contributions in a paged list
|
2010-08-14 19:19:41 +00:00
|
|
|
*
|
WARNING: HUGE COMMIT
Doxygen documentation update:
* Changed alls @addtogroup to @ingroup. @addtogroup adds the comment to the group description, but doesn't add the file, class, function, ... to the group like @ingroup does. See for example http://svn.wikimedia.org/doc/group__SpecialPage.html where it's impossible to see related files, classes, ... that should belong to that group.
* Added @file to file description, it seems that it should be explicitely decalred for file descriptions, otherwise doxygen will think that the comment document the first class, variabled, function, ... that is in that file.
* Removed some empty comments
* Removed some ?>
Added following groups:
* ExternalStorage
* JobQueue
* MaintenanceLanguage
One more thing: there are still a lot of warnings when generating the doc.
2008-05-20 17:13:28 +00:00
|
|
|
* @ingroup SpecialPage
|
2006-12-03 00:05:45 +00:00
|
|
|
*/
|
2014-01-08 20:05:00 +00:00
|
|
|
class SpecialContributions extends IncludableSpecialPage {
|
2011-01-13 18:04:30 +00:00
|
|
|
protected $opts;
|
2011-01-12 21:21:32 +00:00
|
|
|
|
2008-10-17 01:35:54 +00:00
|
|
|
public function __construct() {
|
|
|
|
|
parent::__construct( 'Contributions' );
|
|
|
|
|
}
|
|
|
|
|
|
2008-10-19 06:40:00 +00:00
|
|
|
public function execute( $par ) {
|
2008-10-17 01:35:54 +00:00
|
|
|
$this->setHeaders();
|
|
|
|
|
$this->outputHeader();
|
2011-09-20 20:00:05 +00:00
|
|
|
$out = $this->getOutput();
|
2018-02-19 11:53:47 +00:00
|
|
|
// Modules required for viewing the list of contributions (also when included on other pages)
|
2016-07-07 05:22:14 +00:00
|
|
|
$out->addModuleStyles( [
|
2019-01-09 00:30:18 +00:00
|
|
|
'mediawiki.interface.helpers.styles',
|
2016-07-07 05:22:14 +00:00
|
|
|
'mediawiki.special',
|
|
|
|
|
'mediawiki.special.changeslist',
|
|
|
|
|
] );
|
2019-02-17 19:02:22 +00:00
|
|
|
$out->addModules( 'mediawiki.special.recentchanges' );
|
2015-03-04 23:58:14 +00:00
|
|
|
$this->addHelpLink( 'Help:User contributions' );
|
2008-10-17 01:35:54 +00:00
|
|
|
|
2016-02-17 09:09:32 +00:00
|
|
|
$this->opts = [];
|
2011-09-20 20:00:05 +00:00
|
|
|
$request = $this->getRequest();
|
2008-10-17 01:35:54 +00:00
|
|
|
|
2018-06-20 05:26:57 +00:00
|
|
|
$target = $par ?? $request->getVal( 'target' );
|
2008-10-17 01:35:54 +00:00
|
|
|
|
2015-12-23 21:17:06 +00:00
|
|
|
if ( $request->getVal( 'contribs' ) == 'newbie' || $par === 'newbies' ) {
|
2012-05-02 02:49:46 +00:00
|
|
|
$target = 'newbies';
|
|
|
|
|
$this->opts['contribs'] = 'newbie';
|
2011-10-20 01:15:28 +00:00
|
|
|
} else {
|
|
|
|
|
$this->opts['contribs'] = 'user';
|
2008-10-17 01:35:54 +00:00
|
|
|
}
|
|
|
|
|
|
2011-09-20 20:00:05 +00:00
|
|
|
$this->opts['deletedOnly'] = $request->getBool( 'deletedOnly' );
|
2010-04-28 21:43:23 +00:00
|
|
|
|
2011-12-16 10:58:20 +00:00
|
|
|
if ( !strlen( $target ) ) {
|
2014-01-08 20:05:00 +00:00
|
|
|
if ( !$this->including() ) {
|
|
|
|
|
$out->addHTML( $this->getForm() );
|
|
|
|
|
}
|
2014-03-22 22:51:18 +00:00
|
|
|
|
2008-10-17 01:35:54 +00:00
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
2011-09-20 20:00:05 +00:00
|
|
|
$user = $this->getUser();
|
|
|
|
|
|
2011-12-16 10:58:20 +00:00
|
|
|
$this->opts['limit'] = $request->getInt( 'limit', $user->getOption( 'rclimit' ) );
|
2008-10-19 06:40:00 +00:00
|
|
|
$this->opts['target'] = $target;
|
2011-09-20 20:00:05 +00:00
|
|
|
$this->opts['topOnly'] = $request->getBool( 'topOnly' );
|
2014-02-26 20:57:58 +00:00
|
|
|
$this->opts['newOnly'] = $request->getBool( 'newOnly' );
|
2015-10-07 11:04:09 +00:00
|
|
|
$this->opts['hideMinor'] = $request->getBool( 'hideMinor' );
|
2008-10-17 01:35:54 +00:00
|
|
|
|
2018-02-12 15:11:40 +00:00
|
|
|
$id = 0;
|
|
|
|
|
if ( $this->opts['contribs'] === 'newbie' ) {
|
|
|
|
|
$userObj = User::newFromName( $target ); // hysterical raisins
|
|
|
|
|
$out->addSubtitle( $this->msg( 'sp-contributions-newbies-sub' ) );
|
|
|
|
|
$out->setHTMLTitle( $this->msg(
|
|
|
|
|
'pagetitle',
|
|
|
|
|
$this->msg( 'sp-contributions-newbies-title' )->plain()
|
|
|
|
|
)->inContentLanguage() );
|
|
|
|
|
} elseif ( ExternalUserNames::isExternal( $target ) ) {
|
|
|
|
|
$userObj = User::newFromName( $target, false );
|
|
|
|
|
if ( !$userObj ) {
|
|
|
|
|
$out->addHTML( $this->getForm() );
|
|
|
|
|
return;
|
|
|
|
|
}
|
2013-04-14 17:27:14 +00:00
|
|
|
|
2018-02-12 15:11:40 +00:00
|
|
|
$out->addSubtitle( $this->contributionsSub( $userObj ) );
|
|
|
|
|
$out->setHTMLTitle( $this->msg(
|
|
|
|
|
'pagetitle',
|
|
|
|
|
$this->msg( 'contributions-title', $target )->plain()
|
|
|
|
|
)->inContentLanguage() );
|
|
|
|
|
} else {
|
|
|
|
|
$nt = Title::makeTitleSafe( NS_USER, $target );
|
|
|
|
|
if ( !$nt ) {
|
|
|
|
|
$out->addHTML( $this->getForm() );
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
$userObj = User::newFromName( $nt->getText(), false );
|
|
|
|
|
if ( !$userObj ) {
|
|
|
|
|
$out->addHTML( $this->getForm() );
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
$id = $userObj->getId();
|
2008-10-17 01:35:54 +00:00
|
|
|
|
|
|
|
|
$target = $nt->getText();
|
2011-11-20 11:29:56 +00:00
|
|
|
$out->addSubtitle( $this->contributionsSub( $userObj ) );
|
2013-03-28 11:43:08 +00:00
|
|
|
$out->setHTMLTitle( $this->msg(
|
|
|
|
|
'pagetitle',
|
|
|
|
|
$this->msg( 'contributions-title', $target )->plain()
|
2013-11-12 08:36:00 +00:00
|
|
|
)->inContentLanguage() );
|
2017-04-21 16:17:59 +00:00
|
|
|
|
|
|
|
|
# For IP ranges, we want the contributionsSub, but not the skin-dependent
|
|
|
|
|
# links under 'Tools', which may include irrelevant links like 'Logs'.
|
|
|
|
|
if ( !IP::isValidRange( $target ) ) {
|
|
|
|
|
$this->getSkin()->setRelevantUser( $userObj );
|
|
|
|
|
}
|
2008-10-17 01:35:54 +00:00
|
|
|
}
|
|
|
|
|
|
2015-11-01 19:56:20 +00:00
|
|
|
$ns = $request->getVal( 'namespace', null );
|
|
|
|
|
if ( $ns !== null && $ns !== '' ) {
|
2008-10-19 06:40:00 +00:00
|
|
|
$this->opts['namespace'] = intval( $ns );
|
2008-10-17 01:35:54 +00:00
|
|
|
} else {
|
2008-10-19 06:40:00 +00:00
|
|
|
$this->opts['namespace'] = '';
|
2008-10-17 01:35:54 +00:00
|
|
|
}
|
2009-01-28 19:08:18 +00:00
|
|
|
|
2011-12-15 01:02:25 +00:00
|
|
|
$this->opts['associated'] = $request->getBool( 'associated' );
|
2013-03-28 11:43:08 +00:00
|
|
|
$this->opts['nsInvert'] = (bool)$request->getVal( 'nsInvert' );
|
|
|
|
|
$this->opts['tagfilter'] = (string)$request->getVal( 'tagfilter' );
|
2010-06-20 11:37:07 +00:00
|
|
|
|
2008-10-17 01:35:54 +00:00
|
|
|
// Allows reverts to have the bot flag in recent changes. It is just here to
|
2010-06-20 11:37:07 +00:00
|
|
|
// be passed in the form at the top of the page
|
2011-12-16 10:58:20 +00:00
|
|
|
if ( $user->isAllowed( 'markbotedits' ) && $request->getBool( 'bot' ) ) {
|
2008-10-19 06:40:00 +00:00
|
|
|
$this->opts['bot'] = '1';
|
2008-10-17 01:35:54 +00:00
|
|
|
}
|
|
|
|
|
|
2011-09-20 20:00:05 +00:00
|
|
|
$skip = $request->getText( 'offset' ) || $request->getText( 'dir' ) == 'prev';
|
2008-10-17 01:35:54 +00:00
|
|
|
# Offset overrides year/month selection
|
2017-08-03 21:44:49 +00:00
|
|
|
if ( !$skip ) {
|
2016-12-12 14:26:15 +00:00
|
|
|
$this->opts['year'] = $request->getVal( 'year' );
|
|
|
|
|
$this->opts['month'] = $request->getVal( 'month' );
|
|
|
|
|
|
|
|
|
|
$this->opts['start'] = $request->getVal( 'start' );
|
|
|
|
|
$this->opts['end'] = $request->getVal( 'end' );
|
2008-10-17 01:35:54 +00:00
|
|
|
}
|
2017-08-03 21:44:49 +00:00
|
|
|
$this->opts = ContribsPager::processDateFilter( $this->opts );
|
2010-06-20 11:37:07 +00:00
|
|
|
|
2019-02-17 11:38:12 +00:00
|
|
|
if ( $this->opts['namespace'] < NS_MAIN ) {
|
|
|
|
|
$this->getOutput()->wrapWikiMsg(
|
2019-02-19 08:59:20 +00:00
|
|
|
"<div class=\"mw-negative-namespace-not-supported error\">\n\$1\n</div>",
|
|
|
|
|
[ 'negative-namespace-not-supported' ]
|
|
|
|
|
);
|
2019-02-17 11:38:12 +00:00
|
|
|
$out->addHTML( $this->getForm() );
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
2011-09-20 20:00:05 +00:00
|
|
|
$feedType = $request->getVal( 'feed' );
|
2014-01-18 21:46:59 +00:00
|
|
|
|
2016-02-17 09:09:32 +00:00
|
|
|
$feedParams = [
|
2014-01-18 21:46:59 +00:00
|
|
|
'action' => 'feedcontributions',
|
|
|
|
|
'user' => $target,
|
2016-02-17 09:09:32 +00:00
|
|
|
];
|
2014-01-18 21:46:59 +00:00
|
|
|
if ( $this->opts['topOnly'] ) {
|
|
|
|
|
$feedParams['toponly'] = true;
|
|
|
|
|
}
|
2014-02-26 20:57:58 +00:00
|
|
|
if ( $this->opts['newOnly'] ) {
|
|
|
|
|
$feedParams['newonly'] = true;
|
|
|
|
|
}
|
2015-10-07 11:04:09 +00:00
|
|
|
if ( $this->opts['hideMinor'] ) {
|
|
|
|
|
$feedParams['hideminor'] = true;
|
|
|
|
|
}
|
2014-01-18 21:46:59 +00:00
|
|
|
if ( $this->opts['deletedOnly'] ) {
|
|
|
|
|
$feedParams['deletedonly'] = true;
|
|
|
|
|
}
|
|
|
|
|
if ( $this->opts['tagfilter'] !== '' ) {
|
|
|
|
|
$feedParams['tagfilter'] = $this->opts['tagfilter'];
|
|
|
|
|
}
|
|
|
|
|
if ( $this->opts['namespace'] !== '' ) {
|
|
|
|
|
$feedParams['namespace'] = $this->opts['namespace'];
|
|
|
|
|
}
|
|
|
|
|
// Don't use year and month for the feed URL, but pass them on if
|
|
|
|
|
// we redirect to API (if $feedType is specified)
|
|
|
|
|
if ( $feedType && $this->opts['year'] !== null ) {
|
|
|
|
|
$feedParams['year'] = $this->opts['year'];
|
|
|
|
|
}
|
|
|
|
|
if ( $feedType && $this->opts['month'] !== null ) {
|
|
|
|
|
$feedParams['month'] = $this->opts['month'];
|
|
|
|
|
}
|
|
|
|
|
|
2011-12-16 10:58:20 +00:00
|
|
|
if ( $feedType ) {
|
2014-08-13 17:39:07 +00:00
|
|
|
// Maintain some level of backwards compatibility
|
2011-06-26 19:33:05 +00:00
|
|
|
// If people request feeds using the old parameters, redirect to API
|
2014-01-18 21:46:59 +00:00
|
|
|
$feedParams['feedformat'] = $feedType;
|
|
|
|
|
$url = wfAppendQuery( wfScript( 'api' ), $feedParams );
|
2011-06-25 16:41:29 +00:00
|
|
|
|
2011-09-20 20:00:05 +00:00
|
|
|
$out->redirect( $url, '301' );
|
2013-04-14 17:27:14 +00:00
|
|
|
|
2011-06-25 16:41:29 +00:00
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
2008-10-19 06:40:00 +00:00
|
|
|
// Add RSS/atom links
|
2014-01-18 21:46:59 +00:00
|
|
|
$this->addFeedLinks( $feedParams );
|
2008-10-19 06:40:00 +00:00
|
|
|
|
2016-02-17 09:09:32 +00:00
|
|
|
if ( Hooks::run( 'SpecialContributionsBeforeMainOutput', [ $id, $userObj, $this ] ) ) {
|
2014-01-08 20:05:00 +00:00
|
|
|
if ( !$this->including() ) {
|
|
|
|
|
$out->addHTML( $this->getForm() );
|
|
|
|
|
}
|
2016-02-17 09:09:32 +00:00
|
|
|
$pager = new ContribsPager( $this->getContext(), [
|
2010-06-20 14:48:36 +00:00
|
|
|
'target' => $target,
|
2011-10-20 01:15:28 +00:00
|
|
|
'contribs' => $this->opts['contribs'],
|
2010-06-20 14:48:36 +00:00
|
|
|
'namespace' => $this->opts['namespace'],
|
2013-06-17 20:23:35 +00:00
|
|
|
'tagfilter' => $this->opts['tagfilter'],
|
2016-12-12 14:26:15 +00:00
|
|
|
'start' => $this->opts['start'],
|
|
|
|
|
'end' => $this->opts['end'],
|
2010-06-20 14:48:36 +00:00
|
|
|
'deletedOnly' => $this->opts['deletedOnly'],
|
|
|
|
|
'topOnly' => $this->opts['topOnly'],
|
2014-02-26 20:57:58 +00:00
|
|
|
'newOnly' => $this->opts['newOnly'],
|
2015-10-07 11:04:09 +00:00
|
|
|
'hideMinor' => $this->opts['hideMinor'],
|
2011-11-19 21:03:43 +00:00
|
|
|
'nsInvert' => $this->opts['nsInvert'],
|
2011-12-15 01:02:25 +00:00
|
|
|
'associated' => $this->opts['associated'],
|
2016-02-17 09:09:32 +00:00
|
|
|
] );
|
2013-03-28 11:43:08 +00:00
|
|
|
|
2017-04-21 16:17:59 +00:00
|
|
|
if ( IP::isValidRange( $target ) && !$pager->isQueryableRange( $target ) ) {
|
|
|
|
|
// Valid range, but outside CIDR limit.
|
|
|
|
|
$limits = $this->getConfig()->get( 'RangeContributionsCIDRLimit' );
|
|
|
|
|
$limit = $limits[ IP::isIPv4( $target ) ? 'IPv4' : 'IPv6' ];
|
|
|
|
|
$out->addWikiMsg( 'sp-contributions-outofrange', $limit );
|
|
|
|
|
} elseif ( !$pager->getNumRows() ) {
|
2011-09-20 20:00:05 +00:00
|
|
|
$out->addWikiMsg( 'nocontribs', $target );
|
2010-01-08 21:00:39 +00:00
|
|
|
} else {
|
2016-09-05 20:21:26 +00:00
|
|
|
# Show a message about replica DB lag, if applicable
|
2019-03-04 02:32:47 +00:00
|
|
|
$lag = $pager->getDatabase()->getSessionLagStatus()['lag'];
|
2013-03-28 11:43:08 +00:00
|
|
|
if ( $lag > 0 ) {
|
2011-09-20 20:00:05 +00:00
|
|
|
$out->showLagWarning( $lag );
|
2013-03-28 11:43:08 +00:00
|
|
|
}
|
2010-01-08 21:00:39 +00:00
|
|
|
|
2014-06-02 01:12:34 +00:00
|
|
|
$output = $pager->getBody();
|
|
|
|
|
if ( !$this->including() ) {
|
2019-03-27 18:31:39 +00:00
|
|
|
$output = $pager->getNavigationBar() .
|
2014-07-19 21:12:10 +00:00
|
|
|
$output .
|
2019-03-27 18:31:39 +00:00
|
|
|
$pager->getNavigationBar();
|
2014-06-02 01:12:34 +00:00
|
|
|
}
|
|
|
|
|
$out->addHTML( $output );
|
2010-01-08 21:00:39 +00:00
|
|
|
}
|
2017-04-21 16:17:59 +00:00
|
|
|
|
2011-09-20 20:00:05 +00:00
|
|
|
$out->preventClickjacking( $pager->getPreventClickjacking() );
|
2008-10-17 01:35:54 +00:00
|
|
|
|
2010-01-08 21:00:39 +00:00
|
|
|
# Show the appropriate "footer" message - WHOIS tools, etc.
|
2012-03-30 18:15:58 +00:00
|
|
|
if ( $this->opts['contribs'] == 'newbie' ) {
|
|
|
|
|
$message = 'sp-contributions-footer-newbies';
|
2017-04-21 16:17:59 +00:00
|
|
|
} elseif ( IP::isValidRange( $target ) ) {
|
|
|
|
|
$message = 'sp-contributions-footer-anon-range';
|
2013-03-28 11:43:08 +00:00
|
|
|
} elseif ( IP::isIPAddress( $target ) ) {
|
2012-03-30 18:15:58 +00:00
|
|
|
$message = 'sp-contributions-footer-anon';
|
2013-03-28 11:43:08 +00:00
|
|
|
} elseif ( $userObj->isAnon() ) {
|
2012-03-30 18:15:58 +00:00
|
|
|
// No message for non-existing users
|
|
|
|
|
$message = '';
|
|
|
|
|
} else {
|
2010-01-08 21:00:39 +00:00
|
|
|
$message = 'sp-contributions-footer';
|
2012-03-30 18:15:58 +00:00
|
|
|
}
|
2008-10-17 01:35:54 +00:00
|
|
|
|
2019-03-29 20:12:24 +00:00
|
|
|
if ( $message && !$this->including() && !$this->msg( $message, $target )->isDisabled() ) {
|
|
|
|
|
$out->wrapWikiMsg(
|
|
|
|
|
"<div class='mw-contributions-footer'>\n$1\n</div>",
|
|
|
|
|
[ $message, $target ] );
|
2008-10-17 01:35:54 +00:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
2010-06-20 11:37:07 +00:00
|
|
|
|
2008-10-17 01:35:54 +00:00
|
|
|
/**
|
2009-11-14 20:16:38 +00:00
|
|
|
* Generates the subheading with links
|
2014-04-19 08:16:52 +00:00
|
|
|
* @param User $userObj User object for the target
|
|
|
|
|
* @return string Appropriately-escaped HTML to be output literally
|
2013-10-04 05:54:44 +00:00
|
|
|
* @todo FIXME: Almost the same as getSubTitle in SpecialDeletedContributions.php.
|
|
|
|
|
* Could be combined.
|
2009-11-14 20:16:38 +00:00
|
|
|
*/
|
2011-11-20 11:29:56 +00:00
|
|
|
protected function contributionsSub( $userObj ) {
|
|
|
|
|
if ( $userObj->isAnon() ) {
|
2019-08-08 13:01:15 +00:00
|
|
|
// Show a warning message that the user being searched for doesn't exist.
|
2017-04-21 16:17:59 +00:00
|
|
|
// User::isIP returns true for IP address and usemod IPs like '123.123.123.xxx',
|
|
|
|
|
// but returns false for IP ranges. We don't want to suggest either of these are
|
|
|
|
|
// valid usernames which we would with the 'contributions-userdoesnotexist' message.
|
|
|
|
|
if ( !User::isIP( $userObj->getName() ) && !$userObj->isIPRange() ) {
|
2014-04-10 21:24:35 +00:00
|
|
|
$this->getOutput()->wrapWikiMsg(
|
|
|
|
|
"<div class=\"mw-userpage-userdoesnotexist error\">\n\$1\n</div>",
|
2016-02-17 09:09:32 +00:00
|
|
|
[
|
2014-04-10 21:24:35 +00:00
|
|
|
'contributions-userdoesnotexist',
|
|
|
|
|
wfEscapeWikiText( $userObj->getName() ),
|
2016-02-17 09:09:32 +00:00
|
|
|
]
|
2014-04-10 21:24:35 +00:00
|
|
|
);
|
2014-07-24 08:25:01 +00:00
|
|
|
if ( !$this->including() ) {
|
|
|
|
|
$this->getOutput()->setStatusCode( 404 );
|
|
|
|
|
}
|
2014-04-10 21:24:35 +00:00
|
|
|
}
|
2011-11-20 11:29:56 +00:00
|
|
|
$user = htmlspecialchars( $userObj->getName() );
|
2008-10-17 01:35:54 +00:00
|
|
|
} else {
|
2016-08-04 21:48:55 +00:00
|
|
|
$user = $this->getLinkRenderer()->makeLink( $userObj->getUserPage(), $userObj->getName() );
|
2008-10-17 01:35:54 +00:00
|
|
|
}
|
2011-11-20 11:29:56 +00:00
|
|
|
$nt = $userObj->getUserPage();
|
|
|
|
|
$talk = $userObj->getTalkPage();
|
2012-03-09 23:33:42 +00:00
|
|
|
$links = '';
|
2011-12-16 10:58:20 +00:00
|
|
|
if ( $talk ) {
|
2016-08-04 22:19:59 +00:00
|
|
|
$tools = self::getUserLinks( $this, $userObj );
|
2019-03-27 20:16:59 +00:00
|
|
|
$links = Html::openElement( 'span', [ 'class' => 'mw-changeslist-links' ] );
|
|
|
|
|
foreach ( $tools as $tool ) {
|
|
|
|
|
$links .= Html::rawElement( 'span', [], $tool ) . ' ';
|
|
|
|
|
}
|
|
|
|
|
$links = trim( $links ) . Html::closeElement( 'span' );
|
2009-09-13 02:07:21 +00:00
|
|
|
|
|
|
|
|
// Show a note if the user is blocked and display the last block log entry.
|
2012-06-05 22:58:54 +00:00
|
|
|
// Do not expose the autoblocks, since that may lead to a leak of accounts' IPs,
|
|
|
|
|
// and also this will display a totally irrelevant log entry as a current block.
|
2014-05-30 12:34:42 +00:00
|
|
|
if ( !$this->including() ) {
|
2019-05-13 14:18:07 +00:00
|
|
|
// For IP ranges you must give DatabaseBlock::newFromTarget the CIDR string
|
|
|
|
|
// and not a user object.
|
2017-04-21 16:17:59 +00:00
|
|
|
if ( $userObj->isIPRange() ) {
|
2019-05-13 14:18:07 +00:00
|
|
|
$block = DatabaseBlock::newFromTarget( $userObj->getName(), $userObj->getName() );
|
2017-04-21 16:17:59 +00:00
|
|
|
} else {
|
2019-05-13 14:18:07 +00:00
|
|
|
$block = DatabaseBlock::newFromTarget( $userObj, $userObj );
|
2017-04-21 16:17:59 +00:00
|
|
|
}
|
|
|
|
|
|
2019-05-13 14:18:07 +00:00
|
|
|
if ( !is_null( $block ) && $block->getType() != DatabaseBlock::TYPE_AUTO ) {
|
|
|
|
|
if ( $block->getType() == DatabaseBlock::TYPE_RANGE ) {
|
2018-08-05 17:58:51 +00:00
|
|
|
$nt = MediaWikiServices::getInstance()->getNamespaceInfo()->
|
|
|
|
|
getCanonicalName( NS_USER ) . ':' . $block->getTarget();
|
2014-05-30 12:34:42 +00:00
|
|
|
}
|
2014-06-07 22:43:15 +00:00
|
|
|
|
2014-05-30 12:34:42 +00:00
|
|
|
$out = $this->getOutput(); // showLogExtract() wants first parameter by reference
|
|
|
|
|
LogEventsList::showLogExtract(
|
|
|
|
|
$out,
|
|
|
|
|
'block',
|
|
|
|
|
$nt,
|
|
|
|
|
'',
|
2016-02-17 09:09:32 +00:00
|
|
|
[
|
2014-05-30 12:34:42 +00:00
|
|
|
'lim' => 1,
|
|
|
|
|
'showIfEmpty' => false,
|
2016-02-17 09:09:32 +00:00
|
|
|
'msgKey' => [
|
2014-05-30 12:34:42 +00:00
|
|
|
$userObj->isAnon() ?
|
|
|
|
|
'sp-contributions-blocked-notice-anon' :
|
|
|
|
|
'sp-contributions-blocked-notice',
|
|
|
|
|
$userObj->getName() # Support GENDER in 'sp-contributions-blocked-notice'
|
2016-02-17 09:09:32 +00:00
|
|
|
],
|
2014-05-30 12:34:42 +00:00
|
|
|
'offset' => '' # don't use WebRequest parameter offset
|
2016-02-17 09:09:32 +00:00
|
|
|
]
|
2014-05-30 12:34:42 +00:00
|
|
|
);
|
|
|
|
|
}
|
2009-09-17 17:55:41 +00:00
|
|
|
}
|
2008-10-17 01:35:54 +00:00
|
|
|
}
|
2009-10-07 21:53:13 +00:00
|
|
|
|
2019-03-27 18:31:39 +00:00
|
|
|
return Html::rawElement( 'div', [ 'class' => 'mw-contributions-user-tools' ],
|
2019-03-27 20:16:59 +00:00
|
|
|
$this->msg( 'contributions-subtitle' )->rawParams( $user )->params( $userObj->getName() )
|
|
|
|
|
. ' ' . $links
|
2019-03-27 18:31:39 +00:00
|
|
|
);
|
2008-10-17 01:35:54 +00:00
|
|
|
}
|
|
|
|
|
|
2011-02-10 15:29:54 +00:00
|
|
|
/**
|
|
|
|
|
* Links to different places.
|
2016-08-04 22:19:59 +00:00
|
|
|
*
|
|
|
|
|
* @note This function is also called in DeletedContributionsPage
|
|
|
|
|
* @param SpecialPage $sp SpecialPage instance, for context
|
2014-04-19 08:16:52 +00:00
|
|
|
* @param User $target Target user object
|
2011-12-24 23:11:25 +00:00
|
|
|
* @return array
|
2011-02-10 15:29:54 +00:00
|
|
|
*/
|
2016-08-04 22:19:59 +00:00
|
|
|
public static function getUserLinks( SpecialPage $sp, User $target ) {
|
2011-02-10 15:29:54 +00:00
|
|
|
$id = $target->getId();
|
|
|
|
|
$username = $target->getName();
|
2016-08-04 22:19:59 +00:00
|
|
|
$userpage = $target->getUserPage();
|
|
|
|
|
$talkpage = $target->getTalkPage();
|
2019-04-12 09:20:33 +00:00
|
|
|
$isIP = IP::isValid( $username );
|
|
|
|
|
$isRange = IP::isValidRange( $username );
|
2011-02-10 15:29:54 +00:00
|
|
|
|
2016-08-04 22:19:59 +00:00
|
|
|
$linkRenderer = $sp->getLinkRenderer();
|
2017-04-21 16:17:59 +00:00
|
|
|
|
|
|
|
|
# No talk pages for IP ranges.
|
2019-04-12 09:20:33 +00:00
|
|
|
if ( !$isRange ) {
|
2017-04-21 16:17:59 +00:00
|
|
|
$tools['user-talk'] = $linkRenderer->makeLink(
|
|
|
|
|
$talkpage,
|
|
|
|
|
$sp->msg( 'sp-contributions-talk' )->text()
|
|
|
|
|
);
|
|
|
|
|
}
|
2011-02-10 15:29:54 +00:00
|
|
|
|
2019-04-12 09:20:33 +00:00
|
|
|
if ( $sp->getUser()->isAllowed( 'block' ) ) { # Block / Change block / Unblock links
|
2019-05-13 14:18:07 +00:00
|
|
|
if ( $target->getBlock() && $target->getBlock()->getType() != DatabaseBlock::TYPE_AUTO ) {
|
2019-04-12 09:20:33 +00:00
|
|
|
$tools['block'] = $linkRenderer->makeKnownLink( # Change block link
|
|
|
|
|
SpecialPage::getTitleFor( 'Block', $username ),
|
|
|
|
|
$sp->msg( 'change-blocklink' )->text()
|
|
|
|
|
);
|
|
|
|
|
$tools['unblock'] = $linkRenderer->makeKnownLink( # Unblock link
|
|
|
|
|
SpecialPage::getTitleFor( 'Unblock', $username ),
|
|
|
|
|
$sp->msg( 'unblocklink' )->text()
|
|
|
|
|
);
|
|
|
|
|
} else { # User is not blocked
|
|
|
|
|
$tools['block'] = $linkRenderer->makeKnownLink( # Block link
|
|
|
|
|
SpecialPage::getTitleFor( 'Block', $username ),
|
|
|
|
|
$sp->msg( 'blocklink' )->text()
|
|
|
|
|
);
|
2011-02-10 15:29:54 +00:00
|
|
|
}
|
2019-04-12 09:20:33 +00:00
|
|
|
}
|
2013-04-14 17:27:14 +00:00
|
|
|
|
2019-04-12 09:20:33 +00:00
|
|
|
# Block log link
|
|
|
|
|
$tools['log-block'] = $linkRenderer->makeKnownLink(
|
|
|
|
|
SpecialPage::getTitleFor( 'Log', 'block' ),
|
|
|
|
|
$sp->msg( 'sp-contributions-blocklog' )->text(),
|
|
|
|
|
[],
|
|
|
|
|
[ 'page' => $userpage->getPrefixedText() ]
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
# Suppression log link (T61120)
|
|
|
|
|
if ( $sp->getUser()->isAllowed( 'suppressionlog' ) ) {
|
|
|
|
|
$tools['log-suppression'] = $linkRenderer->makeKnownLink(
|
|
|
|
|
SpecialPage::getTitleFor( 'Log', 'suppress' ),
|
|
|
|
|
$sp->msg( 'sp-contributions-suppresslog', $username )->text(),
|
2016-02-17 09:09:32 +00:00
|
|
|
[],
|
2019-04-12 09:20:33 +00:00
|
|
|
[ 'offender' => $username ]
|
2011-02-10 15:29:54 +00:00
|
|
|
);
|
|
|
|
|
}
|
2017-04-21 16:17:59 +00:00
|
|
|
|
|
|
|
|
# Don't show some links for IP ranges
|
2019-04-12 09:20:33 +00:00
|
|
|
if ( !$isRange ) {
|
|
|
|
|
# Uploads: hide if IPs cannot upload (T220674)
|
|
|
|
|
if ( !$isIP || $target->isAllowed( 'upload' ) ) {
|
|
|
|
|
$tools['uploads'] = $linkRenderer->makeKnownLink(
|
|
|
|
|
SpecialPage::getTitleFor( 'Listfiles', $username ),
|
|
|
|
|
$sp->msg( 'sp-contributions-uploads' )->text()
|
|
|
|
|
);
|
|
|
|
|
}
|
2017-04-21 16:17:59 +00:00
|
|
|
|
|
|
|
|
# Other logs link
|
2019-04-12 09:20:33 +00:00
|
|
|
# Todo: T146628
|
2017-04-21 16:17:59 +00:00
|
|
|
$tools['logs'] = $linkRenderer->makeKnownLink(
|
|
|
|
|
SpecialPage::getTitleFor( 'Log', $username ),
|
|
|
|
|
$sp->msg( 'sp-contributions-logs' )->text()
|
2011-02-10 15:29:54 +00:00
|
|
|
);
|
2017-04-21 16:17:59 +00:00
|
|
|
|
|
|
|
|
# Add link to deleted user contributions for priviledged users
|
2019-04-12 09:20:33 +00:00
|
|
|
# Todo: T183457
|
2017-04-21 16:17:59 +00:00
|
|
|
if ( $sp->getUser()->isAllowed( 'deletedhistory' ) ) {
|
|
|
|
|
$tools['deletedcontribs'] = $linkRenderer->makeKnownLink(
|
|
|
|
|
SpecialPage::getTitleFor( 'DeletedContributions', $username ),
|
|
|
|
|
$sp->msg( 'sp-contributions-deleted', $username )->text()
|
|
|
|
|
);
|
|
|
|
|
}
|
2011-02-10 15:29:54 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
# Add a link to change user rights for privileged users
|
|
|
|
|
$userrightsPage = new UserrightsPage();
|
2016-08-04 22:19:59 +00:00
|
|
|
$userrightsPage->setContext( $sp->getContext() );
|
2012-04-02 16:32:23 +00:00
|
|
|
if ( $userrightsPage->userCanChangeRights( $target ) ) {
|
2016-08-04 22:19:59 +00:00
|
|
|
$tools['userrights'] = $linkRenderer->makeKnownLink(
|
2011-02-10 15:29:54 +00:00
|
|
|
SpecialPage::getTitleFor( 'Userrights', $username ),
|
2017-04-15 15:21:10 +00:00
|
|
|
$sp->msg( 'sp-contributions-userrights', $username )->text()
|
2011-02-10 15:29:54 +00:00
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
2016-08-04 22:19:59 +00:00
|
|
|
Hooks::run( 'ContributionsToolLinks', [ $id, $userpage, &$tools, $sp ] );
|
2013-04-14 17:27:14 +00:00
|
|
|
|
2011-02-10 15:29:54 +00:00
|
|
|
return $tools;
|
|
|
|
|
}
|
|
|
|
|
|
2008-10-17 01:35:54 +00:00
|
|
|
/**
|
|
|
|
|
* Generates the namespace selector form with hidden attributes.
|
2014-04-19 08:16:52 +00:00
|
|
|
* @return string HTML fragment
|
2008-10-17 01:35:54 +00:00
|
|
|
*/
|
2008-10-19 06:40:00 +00:00
|
|
|
protected function getForm() {
|
2013-12-24 08:07:04 +00:00
|
|
|
$this->opts['title'] = $this->getPageTitle()->getPrefixedText();
|
2011-12-16 10:58:20 +00:00
|
|
|
if ( !isset( $this->opts['target'] ) ) {
|
2008-10-19 06:40:00 +00:00
|
|
|
$this->opts['target'] = '';
|
2008-10-17 01:35:54 +00:00
|
|
|
} else {
|
2013-02-03 19:28:43 +00:00
|
|
|
$this->opts['target'] = str_replace( '_', ' ', $this->opts['target'] );
|
2008-10-17 01:35:54 +00:00
|
|
|
}
|
2010-06-20 11:37:07 +00:00
|
|
|
|
2011-12-16 10:58:20 +00:00
|
|
|
if ( !isset( $this->opts['namespace'] ) ) {
|
2008-10-19 06:40:00 +00:00
|
|
|
$this->opts['namespace'] = '';
|
2008-10-17 01:35:54 +00:00
|
|
|
}
|
2010-06-20 11:37:07 +00:00
|
|
|
|
2011-12-16 10:58:20 +00:00
|
|
|
if ( !isset( $this->opts['nsInvert'] ) ) {
|
2011-11-19 21:03:43 +00:00
|
|
|
$this->opts['nsInvert'] = '';
|
|
|
|
|
}
|
|
|
|
|
|
2011-12-16 10:58:20 +00:00
|
|
|
if ( !isset( $this->opts['associated'] ) ) {
|
2011-12-15 01:02:25 +00:00
|
|
|
$this->opts['associated'] = false;
|
|
|
|
|
}
|
|
|
|
|
|
2011-12-16 10:58:20 +00:00
|
|
|
if ( !isset( $this->opts['contribs'] ) ) {
|
2008-10-19 06:40:00 +00:00
|
|
|
$this->opts['contribs'] = 'user';
|
2008-10-17 01:35:54 +00:00
|
|
|
}
|
2010-06-20 11:37:07 +00:00
|
|
|
|
2016-12-12 14:26:15 +00:00
|
|
|
if ( !isset( $this->opts['start'] ) ) {
|
|
|
|
|
$this->opts['start'] = '';
|
2008-10-17 01:35:54 +00:00
|
|
|
}
|
2010-06-20 11:37:07 +00:00
|
|
|
|
2016-12-12 14:26:15 +00:00
|
|
|
if ( !isset( $this->opts['end'] ) ) {
|
|
|
|
|
$this->opts['end'] = '';
|
2008-10-17 01:35:54 +00:00
|
|
|
}
|
2010-06-20 11:37:07 +00:00
|
|
|
|
2011-12-16 10:58:20 +00:00
|
|
|
if ( $this->opts['contribs'] == 'newbie' ) {
|
2008-10-19 06:40:00 +00:00
|
|
|
$this->opts['target'] = '';
|
2008-10-17 01:35:54 +00:00
|
|
|
}
|
2009-02-01 10:05:25 +00:00
|
|
|
|
2011-12-16 10:58:20 +00:00
|
|
|
if ( !isset( $this->opts['tagfilter'] ) ) {
|
2011-10-26 02:56:04 +00:00
|
|
|
$this->opts['tagfilter'] = '';
|
2009-02-01 10:05:25 +00:00
|
|
|
}
|
2010-06-20 11:37:07 +00:00
|
|
|
|
2011-12-16 10:58:20 +00:00
|
|
|
if ( !isset( $this->opts['topOnly'] ) ) {
|
2010-06-20 11:37:07 +00:00
|
|
|
$this->opts['topOnly'] = false;
|
|
|
|
|
}
|
|
|
|
|
|
2014-02-26 20:57:58 +00:00
|
|
|
if ( !isset( $this->opts['newOnly'] ) ) {
|
|
|
|
|
$this->opts['newOnly'] = false;
|
|
|
|
|
}
|
|
|
|
|
|
2015-10-07 11:04:09 +00:00
|
|
|
if ( !isset( $this->opts['hideMinor'] ) ) {
|
|
|
|
|
$this->opts['hideMinor'] = false;
|
|
|
|
|
}
|
|
|
|
|
|
2018-02-19 11:53:47 +00:00
|
|
|
// Modules required only for the form
|
|
|
|
|
$this->getOutput()->addModules( [
|
|
|
|
|
'mediawiki.userSuggest',
|
|
|
|
|
'mediawiki.special.contributions',
|
|
|
|
|
] );
|
|
|
|
|
$this->getOutput()->addModuleStyles( 'mediawiki.widgets.DateInputWidget.styles' );
|
|
|
|
|
$this->getOutput()->enableOOUI();
|
|
|
|
|
|
2013-03-28 11:43:08 +00:00
|
|
|
$form = Html::openElement(
|
|
|
|
|
'form',
|
2016-02-17 09:09:32 +00:00
|
|
|
[
|
2013-03-28 11:43:08 +00:00
|
|
|
'method' => 'get',
|
2014-08-03 21:25:52 +00:00
|
|
|
'action' => wfScript(),
|
2013-03-28 11:43:08 +00:00
|
|
|
'class' => 'mw-contributions-form'
|
2016-02-17 09:09:32 +00:00
|
|
|
]
|
2013-03-28 11:43:08 +00:00
|
|
|
);
|
2010-04-26 16:35:02 +00:00
|
|
|
|
|
|
|
|
# Add hidden params for tracking except for parameters in $skipParameters
|
2016-02-17 09:09:32 +00:00
|
|
|
$skipParameters = [
|
2013-03-28 11:43:08 +00:00
|
|
|
'namespace',
|
|
|
|
|
'nsInvert',
|
|
|
|
|
'deletedOnly',
|
|
|
|
|
'target',
|
|
|
|
|
'contribs',
|
|
|
|
|
'year',
|
|
|
|
|
'month',
|
2016-12-12 14:26:15 +00:00
|
|
|
'start',
|
|
|
|
|
'end',
|
2013-03-28 11:43:08 +00:00
|
|
|
'topOnly',
|
2014-02-26 20:57:58 +00:00
|
|
|
'newOnly',
|
2015-10-07 11:04:09 +00:00
|
|
|
'hideMinor',
|
2015-12-06 01:08:44 +00:00
|
|
|
'associated',
|
|
|
|
|
'tagfilter'
|
2016-02-17 09:09:32 +00:00
|
|
|
];
|
2013-03-28 11:43:08 +00:00
|
|
|
|
2008-10-19 06:40:00 +00:00
|
|
|
foreach ( $this->opts as $name => $value ) {
|
2011-12-16 10:58:20 +00:00
|
|
|
if ( in_array( $name, $skipParameters ) ) {
|
2008-10-17 01:35:54 +00:00
|
|
|
continue;
|
|
|
|
|
}
|
2011-12-15 01:02:25 +00:00
|
|
|
$form .= "\t" . Html::hidden( $name, $value ) . "\n";
|
2008-10-17 01:35:54 +00:00
|
|
|
}
|
2009-01-30 23:24:29 +00:00
|
|
|
|
2016-10-19 19:06:14 +00:00
|
|
|
$tagFilter = ChangeTags::buildTagFilterSelector(
|
|
|
|
|
$this->opts['tagfilter'], false, $this->getContext() );
|
2011-06-17 16:05:05 +00:00
|
|
|
|
2011-12-16 10:58:20 +00:00
|
|
|
if ( $tagFilter ) {
|
2013-03-28 11:43:08 +00:00
|
|
|
$filterSelection = Html::rawElement(
|
2016-08-27 17:26:40 +00:00
|
|
|
'div',
|
2016-02-17 09:09:32 +00:00
|
|
|
[],
|
2016-12-27 21:14:16 +00:00
|
|
|
implode( "\u{00A0}", $tagFilter )
|
2013-03-28 11:43:08 +00:00
|
|
|
);
|
2011-12-15 01:02:25 +00:00
|
|
|
} else {
|
2016-08-27 17:26:40 +00:00
|
|
|
$filterSelection = Html::rawElement( 'div', [], '' );
|
2011-12-15 01:02:25 +00:00
|
|
|
}
|
|
|
|
|
|
2013-03-28 11:43:08 +00:00
|
|
|
$labelNewbies = Xml::radioLabel(
|
|
|
|
|
$this->msg( 'sp-contributions-newbies' )->text(),
|
|
|
|
|
'contribs',
|
|
|
|
|
'newbie',
|
|
|
|
|
'newbie',
|
|
|
|
|
$this->opts['contribs'] == 'newbie',
|
2016-02-17 09:09:32 +00:00
|
|
|
[ 'class' => 'mw-input' ]
|
2013-03-28 11:43:08 +00:00
|
|
|
);
|
|
|
|
|
$labelUsername = Xml::radioLabel(
|
|
|
|
|
$this->msg( 'sp-contributions-username' )->text(),
|
|
|
|
|
'contribs',
|
|
|
|
|
'user',
|
|
|
|
|
'user',
|
|
|
|
|
$this->opts['contribs'] == 'user',
|
2016-02-17 09:09:32 +00:00
|
|
|
[ 'class' => 'mw-input' ]
|
2013-03-28 11:43:08 +00:00
|
|
|
);
|
|
|
|
|
$input = Html::input(
|
|
|
|
|
'target',
|
|
|
|
|
$this->opts['target'],
|
|
|
|
|
'text',
|
2016-02-17 09:09:32 +00:00
|
|
|
[
|
2018-11-10 06:28:12 +00:00
|
|
|
'id' => 'mw-target-user-or-ip',
|
2014-10-10 14:07:32 +00:00
|
|
|
'size' => '40',
|
2016-02-17 09:09:32 +00:00
|
|
|
'class' => [
|
2014-10-10 14:07:32 +00:00
|
|
|
'mw-input',
|
|
|
|
|
'mw-ui-input-inline',
|
|
|
|
|
'mw-autocomplete-user', // used by mediawiki.userSuggest
|
2016-02-17 09:09:32 +00:00
|
|
|
],
|
|
|
|
|
] + (
|
2015-11-12 05:15:40 +00:00
|
|
|
// Only autofocus if target hasn't been specified or in non-newbies mode
|
|
|
|
|
( $this->opts['contribs'] === 'newbie' || $this->opts['target'] )
|
2016-02-17 09:09:32 +00:00
|
|
|
? [] : [ 'autofocus' => true ]
|
2015-11-12 05:15:40 +00:00
|
|
|
)
|
2013-03-28 11:43:08 +00:00
|
|
|
);
|
2015-11-12 05:15:40 +00:00
|
|
|
|
2013-03-28 11:43:08 +00:00
|
|
|
$targetSelection = Html::rawElement(
|
2016-08-27 17:26:40 +00:00
|
|
|
'div',
|
|
|
|
|
[],
|
|
|
|
|
$labelNewbies . '<br>' . $labelUsername . ' ' . $input . ' '
|
2013-02-09 21:44:24 +00:00
|
|
|
);
|
2011-12-15 01:02:25 +00:00
|
|
|
|
2019-02-17 19:02:22 +00:00
|
|
|
$hidden = $this->opts['namespace'] === '' ? ' mw-input-hidden' : '';
|
2013-03-28 11:43:08 +00:00
|
|
|
$namespaceSelection = Xml::tags(
|
2016-08-27 17:26:40 +00:00
|
|
|
'div',
|
2016-02-17 09:09:32 +00:00
|
|
|
[],
|
2013-03-28 11:43:08 +00:00
|
|
|
Xml::label(
|
|
|
|
|
$this->msg( 'namespace' )->text(),
|
2019-06-29 15:26:03 +00:00
|
|
|
'namespace'
|
2016-12-27 21:14:16 +00:00
|
|
|
) . "\u{00A0}" .
|
2013-03-28 11:43:08 +00:00
|
|
|
Html::namespaceSelector(
|
2018-09-10 20:14:20 +00:00
|
|
|
[ 'selected' => $this->opts['namespace'], 'all' => '', 'in-user-lang' => true ],
|
2016-02-17 09:09:32 +00:00
|
|
|
[
|
2013-03-28 11:43:08 +00:00
|
|
|
'name' => 'namespace',
|
|
|
|
|
'id' => 'namespace',
|
2012-03-06 00:53:48 +00:00
|
|
|
'class' => 'namespaceselector',
|
2016-02-17 09:09:32 +00:00
|
|
|
]
|
2016-12-27 21:14:16 +00:00
|
|
|
) . "\u{00A0}" .
|
2013-04-14 17:27:14 +00:00
|
|
|
Html::rawElement(
|
|
|
|
|
'span',
|
2019-02-17 19:02:22 +00:00
|
|
|
[ 'class' => 'mw-input-with-label' . $hidden ],
|
2013-04-14 17:27:14 +00:00
|
|
|
Xml::checkLabel(
|
|
|
|
|
$this->msg( 'invert' )->text(),
|
|
|
|
|
'nsInvert',
|
2019-02-17 19:02:22 +00:00
|
|
|
'nsinvert',
|
2013-04-14 17:27:14 +00:00
|
|
|
$this->opts['nsInvert'],
|
2016-02-17 09:09:32 +00:00
|
|
|
[
|
2013-04-14 17:27:14 +00:00
|
|
|
'title' => $this->msg( 'tooltip-invert' )->text(),
|
|
|
|
|
'class' => 'mw-input'
|
2016-02-17 09:09:32 +00:00
|
|
|
]
|
2016-12-27 21:14:16 +00:00
|
|
|
) . "\u{00A0}"
|
2013-04-14 17:27:14 +00:00
|
|
|
) .
|
2019-02-17 19:02:22 +00:00
|
|
|
Html::rawElement( 'span', [ 'class' => 'mw-input-with-label' . $hidden ],
|
2013-04-14 17:27:14 +00:00
|
|
|
Xml::checkLabel(
|
|
|
|
|
$this->msg( 'namespace_association' )->text(),
|
|
|
|
|
'associated',
|
2019-02-17 19:02:22 +00:00
|
|
|
'nsassociated',
|
2013-04-14 17:27:14 +00:00
|
|
|
$this->opts['associated'],
|
2016-02-17 09:09:32 +00:00
|
|
|
[
|
2013-04-14 17:27:14 +00:00
|
|
|
'title' => $this->msg( 'tooltip-namespace_association' )->text(),
|
|
|
|
|
'class' => 'mw-input'
|
2016-02-17 09:09:32 +00:00
|
|
|
]
|
2016-12-27 21:14:16 +00:00
|
|
|
) . "\u{00A0}"
|
2013-04-14 17:27:14 +00:00
|
|
|
)
|
2013-03-28 11:43:08 +00:00
|
|
|
);
|
2011-12-15 01:02:25 +00:00
|
|
|
|
2016-02-17 09:09:32 +00:00
|
|
|
$filters = [];
|
2016-01-27 04:29:16 +00:00
|
|
|
|
2012-10-13 14:05:00 +00:00
|
|
|
if ( $this->getUser()->isAllowed( 'deletedhistory' ) ) {
|
2016-01-27 04:29:16 +00:00
|
|
|
$filters[] = Html::rawElement(
|
2013-03-28 11:43:08 +00:00
|
|
|
'span',
|
2016-02-17 09:09:32 +00:00
|
|
|
[ 'class' => 'mw-input-with-label' ],
|
2011-12-15 01:02:25 +00:00
|
|
|
Xml::checkLabel(
|
2011-12-26 16:20:30 +00:00
|
|
|
$this->msg( 'history-show-deleted' )->text(),
|
2011-12-15 01:02:25 +00:00
|
|
|
'deletedOnly',
|
|
|
|
|
'mw-show-deleted-only',
|
|
|
|
|
$this->opts['deletedOnly'],
|
2016-02-17 09:09:32 +00:00
|
|
|
[ 'class' => 'mw-input' ]
|
2011-12-15 01:02:25 +00:00
|
|
|
)
|
2012-10-13 14:05:00 +00:00
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
2016-01-27 04:29:16 +00:00
|
|
|
$filters[] = Html::rawElement(
|
2013-03-28 11:43:08 +00:00
|
|
|
'span',
|
2016-02-17 09:09:32 +00:00
|
|
|
[ 'class' => 'mw-input-with-label' ],
|
2013-03-28 11:43:08 +00:00
|
|
|
Xml::checkLabel(
|
|
|
|
|
$this->msg( 'sp-contributions-toponly' )->text(),
|
|
|
|
|
'topOnly',
|
|
|
|
|
'mw-show-top-only',
|
|
|
|
|
$this->opts['topOnly'],
|
2016-02-17 09:09:32 +00:00
|
|
|
[ 'class' => 'mw-input' ]
|
2011-12-15 01:02:25 +00:00
|
|
|
)
|
2012-10-10 19:35:42 +00:00
|
|
|
);
|
2016-01-27 04:29:16 +00:00
|
|
|
$filters[] = Html::rawElement(
|
2014-02-26 20:57:58 +00:00
|
|
|
'span',
|
2016-02-17 09:09:32 +00:00
|
|
|
[ 'class' => 'mw-input-with-label' ],
|
2014-02-26 20:57:58 +00:00
|
|
|
Xml::checkLabel(
|
|
|
|
|
$this->msg( 'sp-contributions-newonly' )->text(),
|
|
|
|
|
'newOnly',
|
|
|
|
|
'mw-show-new-only',
|
|
|
|
|
$this->opts['newOnly'],
|
2015-10-07 11:04:09 +00:00
|
|
|
[ 'class' => 'mw-input' ]
|
|
|
|
|
)
|
|
|
|
|
);
|
|
|
|
|
$filters[] = Html::rawElement(
|
|
|
|
|
'span',
|
|
|
|
|
[ 'class' => 'mw-input-with-label' ],
|
|
|
|
|
Xml::checkLabel(
|
|
|
|
|
$this->msg( 'sp-contributions-hideminor' )->text(),
|
|
|
|
|
'hideMinor',
|
|
|
|
|
'mw-hide-minor-edits',
|
|
|
|
|
$this->opts['hideMinor'],
|
2016-02-17 09:09:32 +00:00
|
|
|
[ 'class' => 'mw-input' ]
|
2014-02-26 20:57:58 +00:00
|
|
|
)
|
|
|
|
|
);
|
2016-01-27 04:29:16 +00:00
|
|
|
|
|
|
|
|
Hooks::run(
|
|
|
|
|
'SpecialContributions::getForm::filters',
|
2016-02-17 09:09:32 +00:00
|
|
|
[ $this, &$filters ]
|
2016-01-27 04:29:16 +00:00
|
|
|
);
|
|
|
|
|
|
2013-03-28 11:43:08 +00:00
|
|
|
$extraOptions = Html::rawElement(
|
2016-08-27 17:26:40 +00:00
|
|
|
'div',
|
|
|
|
|
[],
|
2016-01-27 04:29:16 +00:00
|
|
|
implode( '', $filters )
|
2013-03-28 11:43:08 +00:00
|
|
|
);
|
2011-12-15 01:02:25 +00:00
|
|
|
|
2016-12-12 14:26:15 +00:00
|
|
|
$dateRangeSelection = Html::rawElement(
|
|
|
|
|
'div',
|
|
|
|
|
[],
|
2018-08-22 13:41:49 +00:00
|
|
|
Xml::label( $this->msg( 'date-range-from' )->text(), 'mw-date-start' ) . ' ' .
|
2017-06-23 19:13:02 +00:00
|
|
|
new DateInputWidget( [
|
2016-12-12 14:26:15 +00:00
|
|
|
'infusable' => true,
|
|
|
|
|
'id' => 'mw-date-start',
|
|
|
|
|
'name' => 'start',
|
|
|
|
|
'value' => $this->opts['start'],
|
|
|
|
|
'longDisplayFormat' => true,
|
|
|
|
|
] ) . '<br>' .
|
2018-08-22 13:41:49 +00:00
|
|
|
Xml::label( $this->msg( 'date-range-to' )->text(), 'mw-date-end' ) . ' ' .
|
2017-06-23 19:13:02 +00:00
|
|
|
new DateInputWidget( [
|
2016-12-12 14:26:15 +00:00
|
|
|
'infusable' => true,
|
|
|
|
|
'id' => 'mw-date-end',
|
|
|
|
|
'name' => 'end',
|
|
|
|
|
'value' => $this->opts['end'],
|
|
|
|
|
'longDisplayFormat' => true,
|
|
|
|
|
] )
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
$submit = Xml::tags( 'div', [],
|
|
|
|
|
Html::submitButton(
|
|
|
|
|
$this->msg( 'sp-contributions-submit' )->text(),
|
|
|
|
|
[ 'class' => 'mw-submit' ], [ 'mw-ui-progressive' ]
|
|
|
|
|
)
|
2013-02-09 21:44:24 +00:00
|
|
|
);
|
2011-12-15 01:02:25 +00:00
|
|
|
|
2016-08-27 17:26:40 +00:00
|
|
|
$form .= Xml::fieldset(
|
|
|
|
|
$this->msg( 'sp-contributions-search' )->text(),
|
|
|
|
|
$targetSelection .
|
|
|
|
|
$namespaceSelection .
|
|
|
|
|
$filterSelection .
|
|
|
|
|
$extraOptions .
|
2016-12-12 14:26:15 +00:00
|
|
|
$dateRangeSelection .
|
|
|
|
|
$submit,
|
2016-08-27 17:26:40 +00:00
|
|
|
[ 'class' => 'mw-contributions-table' ]
|
2013-03-28 11:43:08 +00:00
|
|
|
);
|
2011-12-15 01:02:25 +00:00
|
|
|
|
2011-12-26 16:20:30 +00:00
|
|
|
$explain = $this->msg( 'sp-contributions-explain' );
|
2012-11-28 23:12:01 +00:00
|
|
|
if ( !$explain->isBlank() ) {
|
2018-10-26 17:04:36 +00:00
|
|
|
$form .= Html::rawElement(
|
|
|
|
|
'p', [ 'id' => 'mw-sp-contributions-explain' ], $explain->parse()
|
|
|
|
|
);
|
2010-09-08 11:21:08 +00:00
|
|
|
}
|
2013-03-28 11:43:08 +00:00
|
|
|
|
2016-08-27 17:26:40 +00:00
|
|
|
$form .= Xml::closeElement( 'form' );
|
2013-03-28 11:43:08 +00:00
|
|
|
|
2011-12-15 01:02:25 +00:00
|
|
|
return $form;
|
2008-10-17 01:35:54 +00:00
|
|
|
}
|
2013-03-07 20:15:54 +00:00
|
|
|
|
2015-12-03 20:08:31 +00:00
|
|
|
/**
|
|
|
|
|
* Return an array of subpages beginning with $search that this special page will accept.
|
|
|
|
|
*
|
|
|
|
|
* @param string $search Prefix to search for
|
|
|
|
|
* @param int $limit Maximum number of results to return (usually 10)
|
|
|
|
|
* @param int $offset Number of results to skip (usually 0)
|
|
|
|
|
* @return string[] Matching subpages
|
|
|
|
|
*/
|
|
|
|
|
public function prefixSearchSubpages( $search, $limit, $offset ) {
|
|
|
|
|
$user = User::newFromName( $search );
|
|
|
|
|
if ( !$user ) {
|
|
|
|
|
// No prefix suggestion for invalid user
|
2016-02-17 09:09:32 +00:00
|
|
|
return [];
|
2015-12-03 20:08:31 +00:00
|
|
|
}
|
|
|
|
|
// Autocomplete subpage as user list - public to allow caching
|
|
|
|
|
return UserNamePrefixSearch::search( 'public', $search, $limit, $offset );
|
|
|
|
|
}
|
|
|
|
|
|
2013-03-07 20:15:54 +00:00
|
|
|
protected function getGroupName() {
|
|
|
|
|
return 'users';
|
|
|
|
|
}
|
2008-10-17 01:35:54 +00:00
|
|
|
}
|