MediaWiki REL1_31
SpecialContributions.php
Go to the documentation of this file.
1<?php
25
32 protected $opts;
33
34 public function __construct() {
35 parent::__construct( 'Contributions' );
36 }
37
38 public function execute( $par ) {
39 $this->setHeaders();
40 $this->outputHeader();
41 $out = $this->getOutput();
42 // Modules required for viewing the list of contributions (also when included on other pages)
43 $out->addModuleStyles( [
44 'mediawiki.special',
45 'mediawiki.special.changeslist',
46 ] );
47 $this->addHelpLink( 'Help:User contributions' );
48
49 $this->opts = [];
50 $request = $this->getRequest();
51
52 if ( $par !== null ) {
53 $target = $par;
54 } else {
55 $target = $request->getVal( 'target' );
56 }
57
58 if ( $request->getVal( 'contribs' ) == 'newbie' || $par === 'newbies' ) {
59 $target = 'newbies';
60 $this->opts['contribs'] = 'newbie';
61 } else {
62 $this->opts['contribs'] = 'user';
63 }
64
65 $this->opts['deletedOnly'] = $request->getBool( 'deletedOnly' );
66
67 if ( !strlen( $target ) ) {
68 if ( !$this->including() ) {
69 $out->addHTML( $this->getForm() );
70 }
71
72 return;
73 }
74
75 $user = $this->getUser();
76
77 $this->opts['limit'] = $request->getInt( 'limit', $user->getOption( 'rclimit' ) );
78 $this->opts['target'] = $target;
79 $this->opts['topOnly'] = $request->getBool( 'topOnly' );
80 $this->opts['newOnly'] = $request->getBool( 'newOnly' );
81 $this->opts['hideMinor'] = $request->getBool( 'hideMinor' );
82
83 $id = 0;
84 if ( $this->opts['contribs'] === 'newbie' ) {
85 $userObj = User::newFromName( $target ); // hysterical raisins
86 $out->addSubtitle( $this->msg( 'sp-contributions-newbies-sub' ) );
87 $out->setHTMLTitle( $this->msg(
88 'pagetitle',
89 $this->msg( 'sp-contributions-newbies-title' )->plain()
90 )->inContentLanguage() );
91 } elseif ( ExternalUserNames::isExternal( $target ) ) {
92 $userObj = User::newFromName( $target, false );
93 if ( !$userObj ) {
94 $out->addHTML( $this->getForm() );
95 return;
96 }
97
98 $out->addSubtitle( $this->contributionsSub( $userObj ) );
99 $out->setHTMLTitle( $this->msg(
100 'pagetitle',
101 $this->msg( 'contributions-title', $target )->plain()
102 )->inContentLanguage() );
103 } else {
104 $nt = Title::makeTitleSafe( NS_USER, $target );
105 if ( !$nt ) {
106 $out->addHTML( $this->getForm() );
107 return;
108 }
109 $userObj = User::newFromName( $nt->getText(), false );
110 if ( !$userObj ) {
111 $out->addHTML( $this->getForm() );
112 return;
113 }
114 $id = $userObj->getId();
115
116 $target = $nt->getText();
117 $out->addSubtitle( $this->contributionsSub( $userObj ) );
118 $out->setHTMLTitle( $this->msg(
119 'pagetitle',
120 $this->msg( 'contributions-title', $target )->plain()
121 )->inContentLanguage() );
122
123 # For IP ranges, we want the contributionsSub, but not the skin-dependent
124 # links under 'Tools', which may include irrelevant links like 'Logs'.
125 if ( !IP::isValidRange( $target ) &&
126 ( User::isIP( $target ) || $userObj->isLoggedIn() )
127 ) {
128 // Don't add non-existent users, because hidden users
129 // that we add here will be removed later to pretend
130 // that they don't exist, and if users that actually don't
131 // exist are added here and then not removed, it exposes
132 // which users exist and are hidden vs. which actually don't
133 // exist. But, do set the relevant user for single IPs.
134 $this->getSkin()->setRelevantUser( $userObj );
135 }
136 }
137
138 $ns = $request->getVal( 'namespace', null );
139 if ( $ns !== null && $ns !== '' ) {
140 $this->opts['namespace'] = intval( $ns );
141 } else {
142 $this->opts['namespace'] = '';
143 }
144
145 $this->opts['associated'] = $request->getBool( 'associated' );
146 $this->opts['nsInvert'] = (bool)$request->getVal( 'nsInvert' );
147 $this->opts['tagfilter'] = (string)$request->getVal( 'tagfilter' );
148
149 // Allows reverts to have the bot flag in recent changes. It is just here to
150 // be passed in the form at the top of the page
151 if ( $user->isAllowed( 'markbotedits' ) && $request->getBool( 'bot' ) ) {
152 $this->opts['bot'] = '1';
153 }
154
155 $skip = $request->getText( 'offset' ) || $request->getText( 'dir' ) == 'prev';
156 # Offset overrides year/month selection
157 if ( !$skip ) {
158 $this->opts['year'] = $request->getVal( 'year' );
159 $this->opts['month'] = $request->getVal( 'month' );
160
161 $this->opts['start'] = $request->getVal( 'start' );
162 $this->opts['end'] = $request->getVal( 'end' );
163 }
164 $this->opts = ContribsPager::processDateFilter( $this->opts );
165
166 $feedType = $request->getVal( 'feed' );
167
168 $feedParams = [
169 'action' => 'feedcontributions',
170 'user' => $target,
171 ];
172 if ( $this->opts['topOnly'] ) {
173 $feedParams['toponly'] = true;
174 }
175 if ( $this->opts['newOnly'] ) {
176 $feedParams['newonly'] = true;
177 }
178 if ( $this->opts['hideMinor'] ) {
179 $feedParams['hideminor'] = true;
180 }
181 if ( $this->opts['deletedOnly'] ) {
182 $feedParams['deletedonly'] = true;
183 }
184 if ( $this->opts['tagfilter'] !== '' ) {
185 $feedParams['tagfilter'] = $this->opts['tagfilter'];
186 }
187 if ( $this->opts['namespace'] !== '' ) {
188 $feedParams['namespace'] = $this->opts['namespace'];
189 }
190 // Don't use year and month for the feed URL, but pass them on if
191 // we redirect to API (if $feedType is specified)
192 if ( $feedType && $this->opts['year'] !== null ) {
193 $feedParams['year'] = $this->opts['year'];
194 }
195 if ( $feedType && $this->opts['month'] !== null ) {
196 $feedParams['month'] = $this->opts['month'];
197 }
198
199 if ( $feedType ) {
200 // Maintain some level of backwards compatibility
201 // If people request feeds using the old parameters, redirect to API
202 $feedParams['feedformat'] = $feedType;
203 $url = wfAppendQuery( wfScript( 'api' ), $feedParams );
204
205 $out->redirect( $url, '301' );
206
207 return;
208 }
209
210 // Add RSS/atom links
211 $this->addFeedLinks( $feedParams );
212
213 if ( Hooks::run( 'SpecialContributionsBeforeMainOutput', [ $id, $userObj, $this ] ) ) {
214 if ( !$this->including() ) {
215 $out->addHTML( $this->getForm() );
216 }
217 $pager = new ContribsPager( $this->getContext(), [
218 'target' => $target,
219 'contribs' => $this->opts['contribs'],
220 'namespace' => $this->opts['namespace'],
221 'tagfilter' => $this->opts['tagfilter'],
222 'start' => $this->opts['start'],
223 'end' => $this->opts['end'],
224 'deletedOnly' => $this->opts['deletedOnly'],
225 'topOnly' => $this->opts['topOnly'],
226 'newOnly' => $this->opts['newOnly'],
227 'hideMinor' => $this->opts['hideMinor'],
228 'nsInvert' => $this->opts['nsInvert'],
229 'associated' => $this->opts['associated'],
230 ] );
231
232 if ( IP::isValidRange( $target ) && !$pager->isQueryableRange( $target ) ) {
233 // Valid range, but outside CIDR limit.
234 $limits = $this->getConfig()->get( 'RangeContributionsCIDRLimit' );
235 $limit = $limits[ IP::isIPv4( $target ) ? 'IPv4' : 'IPv6' ];
236 $out->addWikiMsg( 'sp-contributions-outofrange', $limit );
237 } else {
238 // @todo We just want a wiki ID here, not a "DB domain", but
239 // current status of MediaWiki conflates the two. See T235955.
240 $poolKey = WikiMap::getCurrentWikiDbDomain() . ':SpecialContributions:';
241 if ( $this->getUser()->isAnon() ) {
242 $poolKey .= 'a:' . $this->getUser()->getName();
243 } else {
244 $poolKey .= 'u:' . $this->getUser()->getId();
245 }
246 $work = new PoolCounterWorkViaCallback( 'SpecialContributions', $poolKey, [
247 'doWork' => function () use ( $pager, $out, $target ) {
248 if ( !$pager->getNumRows() ) {
249 $out->addWikiMsg( 'nocontribs', $target );
250 } else {
251 # Show a message about replica DB lag, if applicable
252 $lag = $pager->getDatabase()->getSessionLagStatus()['lag'];
253 if ( $lag > 0 ) {
254 $out->showLagWarning( $lag );
255 }
256
257 $output = $pager->getBody();
258 if ( !$this->including() ) {
259 $output = $pager->getNavigationBar() .
260 $output .
261 $pager->getNavigationBar();
262 }
263 $out->addHTML( $output );
264 }
265 },
266 'error' => function () use ( $out ) {
267 $msg = $this->getUser()->isAnon()
268 ? 'sp-contributions-concurrency-ip'
269 : 'sp-contributions-concurrency-user';
270 $out->wrapWikiMsg( "<div class='errorbox'>\n$1\n</div>", $msg );
271 }
272 ] );
273 $work->execute();
274 }
275
276 $out->preventClickjacking( $pager->getPreventClickjacking() );
277
278 # Show the appropriate "footer" message - WHOIS tools, etc.
279 if ( $this->opts['contribs'] == 'newbie' ) {
280 $message = 'sp-contributions-footer-newbies';
281 } elseif ( IP::isValidRange( $target ) ) {
282 $message = 'sp-contributions-footer-anon-range';
283 } elseif ( IP::isIPAddress( $target ) ) {
284 $message = 'sp-contributions-footer-anon';
285 } elseif ( $userObj->isAnon() ) {
286 // No message for non-existing users
287 $message = '';
288 } elseif ( $userObj->isHidden() && !$this->getUser()->isAllowed( 'hideuser' ) ) {
289 $message = '';
290 } else {
291 // Not hidden, or hidden but the viewer can still see it
292 $message = 'sp-contributions-footer';
293 }
294
295 if ( $message ) {
296 if ( !$this->including() ) {
297 if ( !$this->msg( $message, $target )->isDisabled() ) {
298 $out->wrapWikiMsg(
299 "<div class='mw-contributions-footer'>\n$1\n</div>",
300 [ $message, $target ] );
301 }
302 }
303 }
304 }
305 }
306
314 protected function contributionsSub( $userObj ) {
315 $isAnon = $userObj->isAnon();
316 if ( !$isAnon && $userObj->isHidden() && !$this->getUser->isAllowed( 'hideuser' ) ) {
317 // T120883 if the user is hidden and the viewer cannot see hidden
318 // users, pretend like it does not exist at all.
319 $isAnon = true;
320 }
321
322 if ( $isAnon ) {
323 // Show a warning message that the user being searched for doesn't exists.
324 // User::isIP returns true for IP address and usemod IPs like '123.123.123.xxx',
325 // but returns false for IP ranges. We don't want to suggest either of these are
326 // valid usernames which we would with the 'contributions-userdoesnotexist' message.
327 if ( !User::isIP( $userObj->getName() ) && !$userObj->isIPRange() ) {
328 $this->getOutput()->wrapWikiMsg(
329 "<div class=\"mw-userpage-userdoesnotexist error\">\n\$1\n</div>",
330 [
331 'contributions-userdoesnotexist',
332 wfEscapeWikiText( $userObj->getName() ),
333 ]
334 );
335 if ( !$this->including() ) {
336 $this->getOutput()->setStatusCode( 404 );
337 }
338 }
339 $user = htmlspecialchars( $userObj->getName() );
340 } else {
341 $user = $this->getLinkRenderer()->makeLink( $userObj->getUserPage(), $userObj->getName() );
342 }
343 $nt = $userObj->getUserPage();
344 $talk = $userObj->getTalkPage();
345 $links = '';
346 if ( $talk ) {
347 $tools = self::getUserLinks( $this, $userObj );
348 $links = $this->getLanguage()->pipeList( $tools );
349
350 // Show a note if the user is blocked and display the last block log entry.
351 // Do not expose the autoblocks, since that may lead to a leak of accounts' IPs,
352 // and also this will display a totally irrelevant log entry as a current block.
353 if ( !$this->including() ) {
354 // For IP ranges you must give Block::newFromTarget the CIDR string and not a user object.
355 if ( $userObj->isIPRange() ) {
356 $block = Block::newFromTarget( $userObj->getName(), $userObj->getName() );
357 } else {
358 $block = Block::newFromTarget( $userObj, $userObj );
359 }
360
361 if ( !is_null( $block ) && $block->getType() != Block::TYPE_AUTO ) {
362 if ( $block->getType() == Block::TYPE_RANGE ) {
363 $nt = MWNamespace::getCanonicalName( NS_USER ) . ':' . $block->getTarget();
364 }
365
366 $out = $this->getOutput(); // showLogExtract() wants first parameter by reference
368 $out,
369 'block',
370 $nt,
371 '',
372 [
373 'lim' => 1,
374 'showIfEmpty' => false,
375 'msgKey' => [
376 $userObj->isAnon() ?
377 'sp-contributions-blocked-notice-anon' :
378 'sp-contributions-blocked-notice',
379 $userObj->getName() # Support GENDER in 'sp-contributions-blocked-notice'
380 ],
381 'offset' => '' # don't use WebRequest parameter offset
382 ]
383 );
384 }
385 }
386 }
387
388 return $this->msg( 'contribsub2' )->rawParams( $user, $links )->params( $userObj->getName() );
389 }
390
399 public static function getUserLinks( SpecialPage $sp, User $target ) {
400 $id = $target->getId();
401 $username = $target->getName();
402 $userpage = $target->getUserPage();
403 $talkpage = $target->getTalkPage();
404
405 $linkRenderer = $sp->getLinkRenderer();
406
407 # No talk pages for IP ranges.
408 if ( !IP::isValidRange( $username ) ) {
409 $tools['user-talk'] = $linkRenderer->makeLink(
410 $talkpage,
411 $sp->msg( 'sp-contributions-talk' )->text()
412 );
413 }
414
415 if ( ( $id !== null ) || ( $id === null && IP::isIPAddress( $username ) ) ) {
416 if ( $sp->getUser()->isAllowed( 'block' ) ) { # Block / Change block / Unblock links
417 if ( $target->isBlocked() && $target->getBlock()->getType() != Block::TYPE_AUTO ) {
418 $tools['block'] = $linkRenderer->makeKnownLink( # Change block link
419 SpecialPage::getTitleFor( 'Block', $username ),
420 $sp->msg( 'change-blocklink' )->text()
421 );
422 $tools['unblock'] = $linkRenderer->makeKnownLink( # Unblock link
423 SpecialPage::getTitleFor( 'Unblock', $username ),
424 $sp->msg( 'unblocklink' )->text()
425 );
426 } else { # User is not blocked
427 $tools['block'] = $linkRenderer->makeKnownLink( # Block link
428 SpecialPage::getTitleFor( 'Block', $username ),
429 $sp->msg( 'blocklink' )->text()
430 );
431 }
432 }
433
434 # Block log link
435 $tools['log-block'] = $linkRenderer->makeKnownLink(
436 SpecialPage::getTitleFor( 'Log', 'block' ),
437 $sp->msg( 'sp-contributions-blocklog' )->text(),
438 [],
439 [ 'page' => $userpage->getPrefixedText() ]
440 );
441
442 # Suppression log link (T61120)
443 if ( $sp->getUser()->isAllowed( 'suppressionlog' ) ) {
444 $tools['log-suppression'] = $linkRenderer->makeKnownLink(
445 SpecialPage::getTitleFor( 'Log', 'suppress' ),
446 $sp->msg( 'sp-contributions-suppresslog', $username )->text(),
447 [],
448 [ 'offender' => $username ]
449 );
450 }
451 }
452
453 # Don't show some links for IP ranges
454 if ( !IP::isValidRange( $username ) ) {
455 # Uploads
456 $tools['uploads'] = $linkRenderer->makeKnownLink(
457 SpecialPage::getTitleFor( 'Listfiles', $username ),
458 $sp->msg( 'sp-contributions-uploads' )->text()
459 );
460
461 # Other logs link
462 $tools['logs'] = $linkRenderer->makeKnownLink(
464 $sp->msg( 'sp-contributions-logs' )->text()
465 );
466
467 # Add link to deleted user contributions for priviledged users
468 if ( $sp->getUser()->isAllowed( 'deletedhistory' ) ) {
469 $tools['deletedcontribs'] = $linkRenderer->makeKnownLink(
470 SpecialPage::getTitleFor( 'DeletedContributions', $username ),
471 $sp->msg( 'sp-contributions-deleted', $username )->text()
472 );
473 }
474 }
475
476 # Add a link to change user rights for privileged users
477 $userrightsPage = new UserrightsPage();
478 $userrightsPage->setContext( $sp->getContext() );
479 if ( $userrightsPage->userCanChangeRights( $target ) ) {
480 $tools['userrights'] = $linkRenderer->makeKnownLink(
481 SpecialPage::getTitleFor( 'Userrights', $username ),
482 $sp->msg( 'sp-contributions-userrights', $username )->text()
483 );
484 }
485
486 Hooks::run( 'ContributionsToolLinks', [ $id, $userpage, &$tools, $sp ] );
487
488 return $tools;
489 }
490
495 protected function getForm() {
496 $this->opts['title'] = $this->getPageTitle()->getPrefixedText();
497 if ( !isset( $this->opts['target'] ) ) {
498 $this->opts['target'] = '';
499 } else {
500 $this->opts['target'] = str_replace( '_', ' ', $this->opts['target'] );
501 }
502
503 if ( !isset( $this->opts['namespace'] ) ) {
504 $this->opts['namespace'] = '';
505 }
506
507 if ( !isset( $this->opts['nsInvert'] ) ) {
508 $this->opts['nsInvert'] = '';
509 }
510
511 if ( !isset( $this->opts['associated'] ) ) {
512 $this->opts['associated'] = false;
513 }
514
515 if ( !isset( $this->opts['contribs'] ) ) {
516 $this->opts['contribs'] = 'user';
517 }
518
519 if ( !isset( $this->opts['start'] ) ) {
520 $this->opts['start'] = '';
521 }
522
523 if ( !isset( $this->opts['end'] ) ) {
524 $this->opts['end'] = '';
525 }
526
527 if ( $this->opts['contribs'] == 'newbie' ) {
528 $this->opts['target'] = '';
529 }
530
531 if ( !isset( $this->opts['tagfilter'] ) ) {
532 $this->opts['tagfilter'] = '';
533 }
534
535 if ( !isset( $this->opts['topOnly'] ) ) {
536 $this->opts['topOnly'] = false;
537 }
538
539 if ( !isset( $this->opts['newOnly'] ) ) {
540 $this->opts['newOnly'] = false;
541 }
542
543 if ( !isset( $this->opts['hideMinor'] ) ) {
544 $this->opts['hideMinor'] = false;
545 }
546
547 // Modules required only for the form
548 $this->getOutput()->addModules( [
549 'mediawiki.userSuggest',
550 'mediawiki.special.contributions',
551 ] );
552 $this->getOutput()->addModuleStyles( 'mediawiki.widgets.DateInputWidget.styles' );
553 $this->getOutput()->enableOOUI();
554
555 $form = Html::openElement(
556 'form',
557 [
558 'method' => 'get',
559 'action' => wfScript(),
560 'class' => 'mw-contributions-form'
561 ]
562 );
563
564 # Add hidden params for tracking except for parameters in $skipParameters
565 $skipParameters = [
566 'namespace',
567 'nsInvert',
568 'deletedOnly',
569 'target',
570 'contribs',
571 'year',
572 'month',
573 'start',
574 'end',
575 'topOnly',
576 'newOnly',
577 'hideMinor',
578 'associated',
579 'tagfilter'
580 ];
581
582 foreach ( $this->opts as $name => $value ) {
583 if ( in_array( $name, $skipParameters ) ) {
584 continue;
585 }
586 $form .= "\t" . Html::hidden( $name, $value ) . "\n";
587 }
588
590 $this->opts['tagfilter'], false, $this->getContext() );
591
592 if ( $tagFilter ) {
593 $filterSelection = Html::rawElement(
594 'div',
595 [],
596 implode( '&#160;', $tagFilter )
597 );
598 } else {
599 $filterSelection = Html::rawElement( 'div', [], '' );
600 }
601
602 $labelNewbies = Xml::radioLabel(
603 $this->msg( 'sp-contributions-newbies' )->text(),
604 'contribs',
605 'newbie',
606 'newbie',
607 $this->opts['contribs'] == 'newbie',
608 [ 'class' => 'mw-input' ]
609 );
610 $labelUsername = Xml::radioLabel(
611 $this->msg( 'sp-contributions-username' )->text(),
612 'contribs',
613 'user',
614 'user',
615 $this->opts['contribs'] == 'user',
616 [ 'class' => 'mw-input' ]
617 );
618 $input = Html::input(
619 'target',
620 $this->opts['target'],
621 'text',
622 [
623 'size' => '40',
624 'class' => [
625 'mw-input',
626 'mw-ui-input-inline',
627 'mw-autocomplete-user', // used by mediawiki.userSuggest
628 ],
629 ] + (
630 // Only autofocus if target hasn't been specified or in non-newbies mode
631 ( $this->opts['contribs'] === 'newbie' || $this->opts['target'] )
632 ? [] : [ 'autofocus' => true ]
633 )
634 );
635
636 $targetSelection = Html::rawElement(
637 'div',
638 [],
639 $labelNewbies . '<br>' . $labelUsername . ' ' . $input . ' '
640 );
641
642 $namespaceSelection = Xml::tags(
643 'div',
644 [],
645 Xml::label(
646 $this->msg( 'namespace' )->text(),
647 'namespace',
648 ''
649 ) . '&#160;' .
650 Html::namespaceSelector(
651 [ 'selected' => $this->opts['namespace'], 'all' => '' ],
652 [
653 'name' => 'namespace',
654 'id' => 'namespace',
655 'class' => 'namespaceselector',
656 ]
657 ) . '&#160;' .
658 Html::rawElement(
659 'span',
660 [ 'class' => 'mw-input-with-label' ],
661 Xml::checkLabel(
662 $this->msg( 'invert' )->text(),
663 'nsInvert',
664 'nsInvert',
665 $this->opts['nsInvert'],
666 [
667 'title' => $this->msg( 'tooltip-invert' )->text(),
668 'class' => 'mw-input'
669 ]
670 ) . '&#160;'
671 ) .
672 Html::rawElement( 'span', [ 'class' => 'mw-input-with-label' ],
673 Xml::checkLabel(
674 $this->msg( 'namespace_association' )->text(),
675 'associated',
676 'associated',
677 $this->opts['associated'],
678 [
679 'title' => $this->msg( 'tooltip-namespace_association' )->text(),
680 'class' => 'mw-input'
681 ]
682 ) . '&#160;'
683 )
684 );
685
686 $filters = [];
687
688 if ( $this->getUser()->isAllowed( 'deletedhistory' ) ) {
689 $filters[] = Html::rawElement(
690 'span',
691 [ 'class' => 'mw-input-with-label' ],
692 Xml::checkLabel(
693 $this->msg( 'history-show-deleted' )->text(),
694 'deletedOnly',
695 'mw-show-deleted-only',
696 $this->opts['deletedOnly'],
697 [ 'class' => 'mw-input' ]
698 )
699 );
700 }
701
702 $filters[] = Html::rawElement(
703 'span',
704 [ 'class' => 'mw-input-with-label' ],
705 Xml::checkLabel(
706 $this->msg( 'sp-contributions-toponly' )->text(),
707 'topOnly',
708 'mw-show-top-only',
709 $this->opts['topOnly'],
710 [ 'class' => 'mw-input' ]
711 )
712 );
713 $filters[] = Html::rawElement(
714 'span',
715 [ 'class' => 'mw-input-with-label' ],
716 Xml::checkLabel(
717 $this->msg( 'sp-contributions-newonly' )->text(),
718 'newOnly',
719 'mw-show-new-only',
720 $this->opts['newOnly'],
721 [ 'class' => 'mw-input' ]
722 )
723 );
724 $filters[] = Html::rawElement(
725 'span',
726 [ 'class' => 'mw-input-with-label' ],
727 Xml::checkLabel(
728 $this->msg( 'sp-contributions-hideminor' )->text(),
729 'hideMinor',
730 'mw-hide-minor-edits',
731 $this->opts['hideMinor'],
732 [ 'class' => 'mw-input' ]
733 )
734 );
735
736 Hooks::run(
737 'SpecialContributions::getForm::filters',
738 [ $this, &$filters ]
739 );
740
741 $extraOptions = Html::rawElement(
742 'div',
743 [],
744 implode( '', $filters )
745 );
746
747 $dateRangeSelection = Html::rawElement(
748 'div',
749 [],
750 Xml::label( wfMessage( 'date-range-from' )->text(), 'mw-date-start' ) . ' ' .
751 new DateInputWidget( [
752 'infusable' => true,
753 'id' => 'mw-date-start',
754 'name' => 'start',
755 'value' => $this->opts['start'],
756 'longDisplayFormat' => true,
757 ] ) . '<br>' .
758 Xml::label( wfMessage( 'date-range-to' )->text(), 'mw-date-end' ) . ' ' .
759 new DateInputWidget( [
760 'infusable' => true,
761 'id' => 'mw-date-end',
762 'name' => 'end',
763 'value' => $this->opts['end'],
764 'longDisplayFormat' => true,
765 ] )
766 );
767
768 $submit = Xml::tags( 'div', [],
769 Html::submitButton(
770 $this->msg( 'sp-contributions-submit' )->text(),
771 [ 'class' => 'mw-submit' ], [ 'mw-ui-progressive' ]
772 )
773 );
774
775 $form .= Xml::fieldset(
776 $this->msg( 'sp-contributions-search' )->text(),
777 $targetSelection .
778 $namespaceSelection .
779 $filterSelection .
780 $extraOptions .
781 $dateRangeSelection .
782 $submit,
783 [ 'class' => 'mw-contributions-table' ]
784 );
785
786 $explain = $this->msg( 'sp-contributions-explain' );
787 if ( !$explain->isBlank() ) {
788 $form .= "<p id='mw-sp-contributions-explain'>{$explain->parse()}</p>";
789 }
790
791 $form .= Xml::closeElement( 'form' );
792
793 return $form;
794 }
795
804 public function prefixSearchSubpages( $search, $limit, $offset ) {
805 $user = User::newFromName( $search );
806 if ( !$user ) {
807 // No prefix suggestion for invalid user
808 return [];
809 }
810 // Autocomplete subpage as user list - public to allow caching
811 return UserNamePrefixSearch::search( 'public', $search, $limit, $offset );
812 }
813
814 protected function getGroupName() {
815 return 'users';
816 }
817}
within a display generated by the Derivative if and wherever such third party notices normally appear The contents of the NOTICE file are for informational purposes only and do not modify the License You may add Your own attribution notices within Derivative Works that You alongside or as an addendum to the NOTICE text from the provided that such additional attribution notices cannot be construed as modifying the License You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for or distribution of Your or for any such Derivative Works as a provided Your and distribution of the Work otherwise complies with the conditions stated in this License Submission of Contributions Unless You explicitly state any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this without any additional terms or conditions Notwithstanding the nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions Trademarks This License does not grant permission to use the trade service or product names of the except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file Disclaimer of Warranty Unless required by applicable law or agreed to in Licensor provides the WITHOUT WARRANTIES OR CONDITIONS OF ANY either express or including
wfAppendQuery( $url, $query)
Append a query string to an existing URL, which may or may not already have query string parameters a...
wfScript( $script='index')
Get the path to a specified script file, respecting file extensions; this is a wrapper around $wgScri...
wfEscapeWikiText( $text)
Escapes the given text so that it may be output using addWikiText() without any linking,...
getContext()
const TYPE_RANGE
Definition Block.php:85
const TYPE_AUTO
Definition Block.php:86
static newFromTarget( $specificTarget, $vagueTarget=null, $fromMaster=false)
Given a target and the target's type, get an existing Block object if possible.
Definition Block.php:1173
static buildTagFilterSelector( $selected='', $ooui=false, IContextSource $context=null)
Build a text box to select a change tag.
static processDateFilter(array $opts)
Set up date filter options, given request data.
static isExternal( $username)
Tells whether the username is external or not.
static run( $event, array $args=[], $deprecatedVersion=null)
Call hook functions defined in Hooks::register and $wgHooks.
Definition Hooks.php:203
A collection of public static functions to play with IP address and IP ranges.
Definition IP.php:67
Shortcut to construct an includable special page.
static showLogExtract(&$out, $types=[], $page='', $user='', $param=[])
Show log extract.
Convenience class for dealing with PoolCounters using callbacks.
execute( $skipcache=false)
Get the result of the work (whatever it is), or the result of the error() function.
Special:Contributions, show user contributions in a paged list.
prefixSearchSubpages( $search, $limit, $offset)
Return an array of subpages beginning with $search that this special page will accept.
getForm()
Generates the namespace selector form with hidden attributes.
execute( $par)
Default execute method Checks user permissions.
getGroupName()
Under which header this special page is listed in Special:SpecialPages See messages 'specialpages-gro...
contributionsSub( $userObj)
Generates the subheading with links.
outputHeader( $summaryMessageKey='')
Outputs a summary message on top of special pages Per default the message key is the canonical name o...
setHeaders()
Sets headers - this should be called from the execute() method of all derived classes!
getOutput()
Get the OutputPage being used for this instance.
getUser()
Shortcut to get the User executing this instance.
getSkin()
Shortcut to get the skin being used for this instance.
static getTitleFor( $name, $subpage=false, $fragment='')
Get a localised Title object for a specified special page name If you don't need a full Title object,...
addFeedLinks( $params)
Adds RSS/atom links.
getContext()
Gets the context this SpecialPage is executed in.
msg( $key)
Wrapper around wfMessage that sets the current context.
getConfig()
Shortcut to get main config object.
getRequest()
Get the WebRequest being used for this instance.
addHelpLink( $to, $overrideBaseUrl=false)
Adds help link with an icon via page indicators.
static search( $audience, $search, $limit, $offset=0)
Do a prefix search of user names and return a list of matching user names.
static newFromName( $name, $validate='valid')
Static factory method for creation from username.
Definition User.php:591
static isIP( $name)
Does the string match an anonymous IP address?
Definition User.php:943
Special page to allow managing user group membership.
static getCurrentWikiDbDomain()
Definition WikiMap.php:289
design txt This is a brief overview of the new design More thorough and up to date information is available on the documentation wiki at etc Handles the details of getting and saving to the user table of the and dealing with sessions and cookies OutputPage Encapsulates the entire HTML page that will be sent in response to any server request It is used by calling its functions to add text
Definition design.txt:18
I won t presume to tell you how to I m just describing the methods I chose to use for myself If you do choose to follow these it will probably be easier for you to collaborate with others on the but if you want to contribute without by all means do which work well I also use K &R brace matching style I know that s a religious issue for some
Definition design.txt:79
returning false will NOT prevent logging a wrapping ErrorException instead of letting the login form give the generic error message that the account does not exist For when the account has been renamed or deleted or an array to pass a message key and parameters block
Definition hooks.txt:2198
do that in ParserLimitReportFormat instead use this to modify the parameters of the image all existing parser cache entries will be invalid To avoid you ll need to handle that somehow(e.g. with the RejectParserCacheValue hook) because MediaWiki won 't do it for you. & $defaults also a ContextSource after deleting those rows but within the same transaction you ll probably need to make sure the header is varied on $request
Definition hooks.txt:2806
static configuration should be added through ResourceLoaderGetConfigVars instead can be used to get the real title after the basic globals have been set but before ordinary actions take place $output
Definition hooks.txt:2255
This code would result in ircNotify being run twice when an article is and once for brion Hooks can return three possible true was required This is the default since MediaWiki *some string
Definition hooks.txt:181
either a plain
Definition hooks.txt:2056
either a unescaped string or a HtmlArmor object after in associative array form externallinks including delete and has completed for all link tables whether this was an auto creation default is conds Array Extra conditions for the No matching items in log is displayed if loglist is empty msgKey Array If you want a nice box with a set this to the key of the message First element is the message additional optional elements are parameters for the key that are processed with wfMessage() -> params() ->parseAsBlock() - offset Set to overwrite offset parameter in $wgRequest set to '' to unset offset - wrap String Wrap the message in html(usually something like "&lt;div ...>$1&lt;/div>"). - flags Integer display flags(NO_ACTION_LINK, NO_EXTRA_USER_LINKS) 'LogException':Called before an exception(or PHP error) is logged. This is meant for integration with external error aggregation services
null means default in associative array with keys and values unescaped Should be merged with default with a value of false meaning to suppress the attribute in associative array with keys and values unescaped noclasses just before the function returns a value If you return true
Definition hooks.txt:2006
this hook is for auditing only or null if authentication failed before getting that far or null if we can t even determine that probably a stub it is not rendered in wiki pages or galleries in category pages allow injecting custom HTML after the section Any uses of the hook need to handle escaping see BaseTemplate::getToolbox and BaseTemplate::makeListItem for details on the format of individual items inside of this array or by returning and letting standard HTTP rendering take place modifiable or by returning false and taking over the output $out
Definition hooks.txt:864
this hook is for auditing only or null if authentication failed before getting that far $username
Definition hooks.txt:785
null means default in associative array with keys and values unescaped Should be merged with default with a value of false meaning to suppress the attribute in associative array with keys and values unescaped noclasses just before the function returns a value If you return an< a > element with HTML attributes $attribs and contents $html will be returned If you return $ret will be returned and may include noclasses after processing after in associative array form before processing starts Return false to skip default processing and return $ret $linkRenderer
Definition hooks.txt:2056
if(is_array($mode)) switch( $mode) $input
This document describes the XML format used to represent information about external sites known to a MediaWiki installation This information about external sites is used to allow inter wiki links
in the order they appear.
Definition sitelist.txt:3