MediaWiki  1.23.2
SpecialBlock.php
Go to the documentation of this file.
1 <?php
33  protected $target;
34 
36  protected $type;
37 
39  protected $previousTarget;
40 
42  protected $requestedHideUser;
43 
45  protected $alreadyBlocked;
46 
48  protected $preErrors = array();
49 
50  public function __construct() {
51  parent::__construct( 'Block', 'block' );
52  }
53 
60  protected function checkExecutePermissions( User $user ) {
61  parent::checkExecutePermissions( $user );
62 
63  # bug 15810: blocked admins should have limited access here
64  $status = self::checkUnblockSelf( $this->target, $user );
65  if ( $status !== true ) {
66  throw new ErrorPageError( 'badaccess', $status );
67  }
68  }
69 
75  protected function setParameter( $par ) {
76  # Extract variables from the request. Try not to get into a situation where we
77  # need to extract *every* variable from the form just for processing here, but
78  # there are legitimate uses for some variables
79  $request = $this->getRequest();
80  list( $this->target, $this->type ) = self::getTargetAndType( $par, $request );
81  if ( $this->target instanceof User ) {
82  # Set the 'relevant user' in the skin, so it displays links like Contributions,
83  # User logs, UserRights, etc.
84  $this->getSkin()->setRelevantUser( $this->target );
85  }
86 
87  list( $this->previousTarget, /*...*/ ) = Block::parseTarget( $request->getVal( 'wpPreviousTarget' ) );
88  $this->requestedHideUser = $request->getBool( 'wpHideUser' );
89  }
90 
96  protected function alterForm( HTMLForm $form ) {
97  $form->setWrapperLegendMsg( 'blockip-legend' );
98  $form->setHeaderText( '' );
99  $form->setSubmitCallback( array( __CLASS__, 'processUIForm' ) );
100 
101  $msg = $this->alreadyBlocked ? 'ipb-change-block' : 'ipbsubmit';
102  $form->setSubmitTextMsg( $msg );
103 
104  # Don't need to do anything if the form has been posted
105  if ( !$this->getRequest()->wasPosted() && $this->preErrors ) {
106  $s = HTMLForm::formatErrors( $this->preErrors );
107  if ( $s ) {
108  $form->addHeaderText( Html::rawElement(
109  'div',
110  array( 'class' => 'error' ),
111  $s
112  ) );
113  }
114  }
115  }
116 
121  protected function getFormFields() {
122  global $wgBlockAllowsUTEdit;
123 
124  $user = $this->getUser();
125 
126  $suggestedDurations = self::getSuggestedDurations();
127 
128  $a = array(
129  'Target' => array(
130  'type' => 'text',
131  'label-message' => 'ipadressorusername',
132  'tabindex' => '1',
133  'id' => 'mw-bi-target',
134  'size' => '45',
135  'autofocus' => true,
136  'required' => true,
137  'validation-callback' => array( __CLASS__, 'validateTargetField' ),
138  ),
139  'Expiry' => array(
140  'type' => !count( $suggestedDurations ) ? 'text' : 'selectorother',
141  'label-message' => 'ipbexpiry',
142  'required' => true,
143  'tabindex' => '2',
144  'options' => $suggestedDurations,
145  'other' => $this->msg( 'ipbother' )->text(),
146  'default' => $this->msg( 'ipb-default-expiry' )->inContentLanguage()->text(),
147  ),
148  'Reason' => array(
149  'type' => 'selectandother',
150  'label-message' => 'ipbreason',
151  'options-message' => 'ipbreason-dropdown',
152  ),
153  'CreateAccount' => array(
154  'type' => 'check',
155  'label-message' => 'ipbcreateaccount',
156  'default' => true,
157  ),
158  );
159 
160  if ( self::canBlockEmail( $user ) ) {
161  $a['DisableEmail'] = array(
162  'type' => 'check',
163  'label-message' => 'ipbemailban',
164  );
165  }
166 
167  if ( $wgBlockAllowsUTEdit ) {
168  $a['DisableUTEdit'] = array(
169  'type' => 'check',
170  'label-message' => 'ipb-disableusertalk',
171  'default' => false,
172  );
173  }
174 
175  $a['AutoBlock'] = array(
176  'type' => 'check',
177  'label-message' => 'ipbenableautoblock',
178  'default' => true,
179  );
180 
181  # Allow some users to hide name from block log, blocklist and listusers
182  if ( $user->isAllowed( 'hideuser' ) ) {
183  $a['HideUser'] = array(
184  'type' => 'check',
185  'label-message' => 'ipbhidename',
186  'cssclass' => 'mw-block-hideuser',
187  );
188  }
189 
190  # Watchlist their user page? (Only if user is logged in)
191  if ( $user->isLoggedIn() ) {
192  $a['Watch'] = array(
193  'type' => 'check',
194  'label-message' => 'ipbwatchuser',
195  );
196  }
197 
198  $a['HardBlock'] = array(
199  'type' => 'check',
200  'label-message' => 'ipb-hardblock',
201  'default' => false,
202  );
203 
204  # This is basically a copy of the Target field, but the user can't change it, so we
205  # can see if the warnings we maybe showed to the user before still apply
206  $a['PreviousTarget'] = array(
207  'type' => 'hidden',
208  'default' => false,
209  );
210 
211  # We'll turn this into a checkbox if we need to
212  $a['Confirm'] = array(
213  'type' => 'hidden',
214  'default' => '',
215  'label-message' => 'ipb-confirm',
216  );
217 
218  $this->maybeAlterFormDefaults( $a );
219 
220  // Allow extensions to add more fields
221  wfRunHooks( 'SpecialBlockModifyFormFields', array( $this, &$a ) );
222 
223  return $a;
224  }
225 
233  protected function maybeAlterFormDefaults( &$fields ) {
234  # This will be overwritten by request data
235  $fields['Target']['default'] = (string)$this->target;
236 
237  # This won't be
238  $fields['PreviousTarget']['default'] = (string)$this->target;
239 
240  $block = Block::newFromTarget( $this->target );
241 
242  if ( $block instanceof Block && !$block->mAuto # The block exists and isn't an autoblock
243  && ( $this->type != Block::TYPE_RANGE # The block isn't a rangeblock
244  || $block->getTarget() == $this->target ) # or if it is, the range is what we're about to block
245  ) {
246  $fields['HardBlock']['default'] = $block->isHardblock();
247  $fields['CreateAccount']['default'] = $block->prevents( 'createaccount' );
248  $fields['AutoBlock']['default'] = $block->isAutoblocking();
249 
250  if ( isset( $fields['DisableEmail'] ) ) {
251  $fields['DisableEmail']['default'] = $block->prevents( 'sendemail' );
252  }
253 
254  if ( isset( $fields['HideUser'] ) ) {
255  $fields['HideUser']['default'] = $block->mHideName;
256  }
257 
258  if ( isset( $fields['DisableUTEdit'] ) ) {
259  $fields['DisableUTEdit']['default'] = $block->prevents( 'editownusertalk' );
260  }
261 
262  // If the username was hidden (ipb_deleted == 1), don't show the reason
263  // unless this user also has rights to hideuser: Bug 35839
264  if ( !$block->mHideName || $this->getUser()->isAllowed( 'hideuser' ) ) {
265  $fields['Reason']['default'] = $block->mReason;
266  } else {
267  $fields['Reason']['default'] = '';
268  }
269 
270  if ( $this->getRequest()->wasPosted() ) {
271  # Ok, so we got a POST submission asking us to reblock a user. So show the
272  # confirm checkbox; the user will only see it if they haven't previously
273  $fields['Confirm']['type'] = 'check';
274  } else {
275  # We got a target, but it wasn't a POST request, so the user must have gone
276  # to a link like [[Special:Block/User]]. We don't need to show the checkbox
277  # as long as they go ahead and block *that* user
278  $fields['Confirm']['default'] = 1;
279  }
280 
281  if ( $block->mExpiry == 'infinity' ) {
282  $fields['Expiry']['default'] = 'infinite';
283  } else {
284  $fields['Expiry']['default'] = wfTimestamp( TS_RFC2822, $block->mExpiry );
285  }
286 
287  $this->alreadyBlocked = true;
288  $this->preErrors[] = array( 'ipb-needreblock', wfEscapeWikiText( (string)$block->getTarget() ) );
289  }
290 
291  # We always need confirmation to do HideUser
292  if ( $this->requestedHideUser ) {
293  $fields['Confirm']['type'] = 'check';
294  unset( $fields['Confirm']['default'] );
295  $this->preErrors[] = array( 'ipb-confirmhideuser', 'ipb-confirmaction' );
296  }
297 
298  # Or if the user is trying to block themselves
299  if ( (string)$this->target === $this->getUser()->getName() ) {
300  $fields['Confirm']['type'] = 'check';
301  unset( $fields['Confirm']['default'] );
302  $this->preErrors[] = array( 'ipb-blockingself', 'ipb-confirmaction' );
303  }
304  }
305 
310  protected function preText() {
311  $this->getOutput()->addModules( 'mediawiki.special.block' );
312 
313  $text = $this->msg( 'blockiptext' )->parse();
314 
315  $otherBlockMessages = array();
316  if ( $this->target !== null ) {
317  # Get other blocks, i.e. from GlobalBlocking or TorBlock extension
318  wfRunHooks( 'OtherBlockLogLink', array( &$otherBlockMessages, $this->target ) );
319 
320  if ( count( $otherBlockMessages ) ) {
322  'h2',
323  array(),
324  $this->msg( 'ipb-otherblocks-header', count( $otherBlockMessages ) )->parse()
325  ) . "\n";
326 
327  $list = '';
328 
329  foreach ( $otherBlockMessages as $link ) {
330  $list .= Html::rawElement( 'li', array(), $link ) . "\n";
331  }
332 
333  $s .= Html::rawElement(
334  'ul',
335  array( 'class' => 'mw-blockip-alreadyblocked' ),
336  $list
337  ) . "\n";
338 
339  $text .= $s;
340  }
341  }
342 
343  return $text;
344  }
345 
350  protected function postText() {
351  $links = array();
352 
353  # Link to the user's contributions, if applicable
354  if ( $this->target instanceof User ) {
355  $contribsPage = SpecialPage::getTitleFor( 'Contributions', $this->target->getName() );
356  $links[] = Linker::link(
357  $contribsPage,
358  $this->msg( 'ipb-blocklist-contribs', $this->target->getName() )->escaped()
359  );
360  }
361 
362  # Link to unblock the specified user, or to a blank unblock form
363  if ( $this->target instanceof User ) {
364  $message = $this->msg( 'ipb-unblock-addr', wfEscapeWikiText( $this->target->getName() ) )->parse();
365  $list = SpecialPage::getTitleFor( 'Unblock', $this->target->getName() );
366  } else {
367  $message = $this->msg( 'ipb-unblock' )->parse();
368  $list = SpecialPage::getTitleFor( 'Unblock' );
369  }
370  $links[] = Linker::linkKnown( $list, $message, array() );
371 
372  # Link to the block list
373  $links[] = Linker::linkKnown(
374  SpecialPage::getTitleFor( 'BlockList' ),
375  $this->msg( 'ipb-blocklist' )->escaped()
376  );
377 
378  $user = $this->getUser();
379 
380  # Link to edit the block dropdown reasons, if applicable
381  if ( $user->isAllowed( 'editinterface' ) ) {
382  $links[] = Linker::link(
383  Title::makeTitle( NS_MEDIAWIKI, 'Ipbreason-dropdown' ),
384  $this->msg( 'ipb-edit-dropdown' )->escaped(),
385  array(),
386  array( 'action' => 'edit' )
387  );
388  }
389 
390  $text = Html::rawElement(
391  'p',
392  array( 'class' => 'mw-ipb-conveniencelinks' ),
393  $this->getLanguage()->pipeList( $links )
394  );
395 
396  $userTitle = self::getTargetUserTitle( $this->target );
397  if ( $userTitle ) {
398  # Get relevant extracts from the block and suppression logs, if possible
399  $out = '';
400 
402  $out,
403  'block',
404  $userTitle,
405  '',
406  array(
407  'lim' => 10,
408  'msgKey' => array( 'blocklog-showlog', $userTitle->getText() ),
409  'showIfEmpty' => false
410  )
411  );
412  $text .= $out;
413 
414  # Add suppression block entries if allowed
415  if ( $user->isAllowed( 'suppressionlog' ) ) {
417  $out,
418  'suppress',
419  $userTitle,
420  '',
421  array(
422  'lim' => 10,
423  'conds' => array( 'log_action' => array( 'block', 'reblock', 'unblock' ) ),
424  'msgKey' => array( 'blocklog-showsuppresslog', $userTitle->getText() ),
425  'showIfEmpty' => false
426  )
427  );
428 
429  $text .= $out;
430  }
431  }
432 
433  return $text;
434  }
435 
442  protected static function getTargetUserTitle( $target ) {
443  if ( $target instanceof User ) {
444  return $target->getUserPage();
445  } elseif ( IP::isIPAddress( $target ) ) {
446  return Title::makeTitleSafe( NS_USER, $target );
447  }
448 
449  return null;
450  }
451 
460  public static function getTargetAndType( $par, WebRequest $request = null ) {
461  $i = 0;
462  $target = null;
463 
464  while ( true ) {
465  switch ( $i++ ) {
466  case 0:
467  # The HTMLForm will check wpTarget first and only if it doesn't get
468  # a value use the default, which will be generated from the options
469  # below; so this has to have a higher precedence here than $par, or
470  # we could end up with different values in $this->target and the HTMLForm!
471  if ( $request instanceof WebRequest ) {
472  $target = $request->getText( 'wpTarget', null );
473  }
474  break;
475  case 1:
476  $target = $par;
477  break;
478  case 2:
479  if ( $request instanceof WebRequest ) {
480  $target = $request->getText( 'ip', null );
481  }
482  break;
483  case 3:
484  # B/C @since 1.18
485  if ( $request instanceof WebRequest ) {
486  $target = $request->getText( 'wpBlockAddress', null );
487  }
488  break;
489  case 4:
490  break 2;
491  }
492 
493  list( $target, $type ) = Block::parseTarget( $target );
494 
495  if ( $type !== null ) {
496  return array( $target, $type );
497  }
498  }
499 
500  return array( null, null );
501  }
502 
511  public static function validateTargetField( $value, $alldata, $form ) {
512  $status = self::validateTarget( $value, $form->getUser() );
513  if ( !$status->isOK() ) {
514  $errors = $status->getErrorsArray();
515 
516  return call_user_func_array( array( $form, 'msg' ), $errors[0] );
517  } else {
518  return true;
519  }
520  }
521 
530  public static function validateTarget( $value, User $user ) {
531  global $wgBlockCIDRLimit;
532 
534  list( $target, $type ) = self::getTargetAndType( $value );
535  $status = Status::newGood( $target );
536 
537  if ( $type == Block::TYPE_USER ) {
538  if ( $target->isAnon() ) {
539  $status->fatal(
540  'nosuchusershort',
541  wfEscapeWikiText( $target->getName() )
542  );
543  }
544 
545  $unblockStatus = self::checkUnblockSelf( $target, $user );
546  if ( $unblockStatus !== true ) {
547  $status->fatal( 'badaccess', $unblockStatus );
548  }
549  } elseif ( $type == Block::TYPE_RANGE ) {
550  list( $ip, $range ) = explode( '/', $target, 2 );
551 
552  if (
553  ( IP::isIPv4( $ip ) && $wgBlockCIDRLimit['IPv4'] == 32 ) ||
554  ( IP::isIPv6( $ip ) && $wgBlockCIDRLimit['IPv6'] == 128 )
555  ) {
556  // Range block effectively disabled
557  $status->fatal( 'range_block_disabled' );
558  }
559 
560  if (
561  ( IP::isIPv4( $ip ) && $range > 32 ) ||
562  ( IP::isIPv6( $ip ) && $range > 128 )
563  ) {
564  // Dodgy range
565  $status->fatal( 'ip_range_invalid' );
566  }
567 
568  if ( IP::isIPv4( $ip ) && $range < $wgBlockCIDRLimit['IPv4'] ) {
569  $status->fatal( 'ip_range_toolarge', $wgBlockCIDRLimit['IPv4'] );
570  }
571 
572  if ( IP::isIPv6( $ip ) && $range < $wgBlockCIDRLimit['IPv6'] ) {
573  $status->fatal( 'ip_range_toolarge', $wgBlockCIDRLimit['IPv6'] );
574  }
575  } elseif ( $type == Block::TYPE_IP ) {
576  # All is well
577  } else {
578  $status->fatal( 'badipaddress' );
579  }
580 
581  return $status;
582  }
583 
590  public static function processUIForm( array $data, HTMLForm $form ) {
591  return self::processForm( $data, $form->getContext() );
592  }
593 
600  public static function processForm( array $data, IContextSource $context ) {
601  global $wgBlockAllowsUTEdit, $wgHideUserContribLimit;
602 
603  $performer = $context->getUser();
604 
605  // Handled by field validator callback
606  // self::validateTargetField( $data['Target'] );
607 
608  # This might have been a hidden field or a checkbox, so interesting data
609  # can come from it
610  $data['Confirm'] = !in_array( $data['Confirm'], array( '', '0', null, false ), true );
611 
613  list( $target, $type ) = self::getTargetAndType( $data['Target'] );
614  if ( $type == Block::TYPE_USER ) {
615  $user = $target;
616  $target = $user->getName();
617  $userId = $user->getId();
618 
619  # Give admins a heads-up before they go and block themselves. Much messier
620  # to do this for IPs, but it's pretty unlikely they'd ever get the 'block'
621  # permission anyway, although the code does allow for it.
622  # Note: Important to use $target instead of $data['Target']
623  # since both $data['PreviousTarget'] and $target are normalized
624  # but $data['target'] gets overriden by (non-normalized) request variable
625  # from previous request.
626  if ( $target === $performer->getName() &&
627  ( $data['PreviousTarget'] !== $target || !$data['Confirm'] )
628  ) {
629  return array( 'ipb-blockingself', 'ipb-confirmaction' );
630  }
631  } elseif ( $type == Block::TYPE_RANGE ) {
632  $userId = 0;
633  } elseif ( $type == Block::TYPE_IP ) {
634  $target = $target->getName();
635  $userId = 0;
636  } else {
637  # This should have been caught in the form field validation
638  return array( 'badipaddress' );
639  }
640 
641  if ( ( strlen( $data['Expiry'] ) == 0 ) || ( strlen( $data['Expiry'] ) > 50 )
642  || !self::parseExpiryInput( $data['Expiry'] )
643  ) {
644  return array( 'ipb_expiry_invalid' );
645  }
646 
647  if ( !isset( $data['DisableEmail'] ) ) {
648  $data['DisableEmail'] = false;
649  }
650 
651  # If the user has done the form 'properly', they won't even have been given the
652  # option to suppress-block unless they have the 'hideuser' permission
653  if ( !isset( $data['HideUser'] ) ) {
654  $data['HideUser'] = false;
655  }
656 
657  if ( $data['HideUser'] ) {
658  if ( !$performer->isAllowed( 'hideuser' ) ) {
659  # this codepath is unreachable except by a malicious user spoofing forms,
660  # or by race conditions (user has oversight and sysop, loads block form,
661  # and is de-oversighted before submission); so need to fail completely
662  # rather than just silently disable hiding
663  return array( 'badaccess-group0' );
664  }
665 
666  # Recheck params here...
667  if ( $type != Block::TYPE_USER ) {
668  $data['HideUser'] = false; # IP users should not be hidden
669  } elseif ( !in_array( $data['Expiry'], array( 'infinite', 'infinity', 'indefinite' ) ) ) {
670  # Bad expiry.
671  return array( 'ipb_expiry_temp' );
672  } elseif ( $wgHideUserContribLimit !== false
673  && $user->getEditCount() > $wgHideUserContribLimit
674  ) {
675  # Typically, the user should have a handful of edits.
676  # Disallow hiding users with many edits for performance.
677  return array( array( 'ipb_hide_invalid',
678  Message::numParam( $wgHideUserContribLimit ) ) );
679  } elseif ( !$data['Confirm'] ) {
680  return array( 'ipb-confirmhideuser', 'ipb-confirmaction' );
681  }
682  }
683 
684  # Create block object.
685  $block = new Block();
686  $block->setTarget( $target );
687  $block->setBlocker( $performer );
688  $block->mReason = $data['Reason'][0];
689  $block->mExpiry = self::parseExpiryInput( $data['Expiry'] );
690  $block->prevents( 'createaccount', $data['CreateAccount'] );
691  $block->prevents( 'editownusertalk', ( !$wgBlockAllowsUTEdit || $data['DisableUTEdit'] ) );
692  $block->prevents( 'sendemail', $data['DisableEmail'] );
693  $block->isHardblock( $data['HardBlock'] );
694  $block->isAutoblocking( $data['AutoBlock'] );
695  $block->mHideName = $data['HideUser'];
696 
697  $reason = array( 'hookaborted' );
698  if ( !wfRunHooks( 'BlockIp', array( &$block, &$performer, &$reason ) ) ) {
699  return $reason;
700  }
701 
702  # Try to insert block. Is there a conflicting block?
703  $status = $block->insert();
704  if ( !$status ) {
705  # Indicates whether the user is confirming the block and is aware of
706  # the conflict (did not change the block target in the meantime)
707  $blockNotConfirmed = !$data['Confirm'] || ( array_key_exists( 'PreviousTarget', $data )
708  && $data['PreviousTarget'] !== $target );
709 
710  # Special case for API - bug 32434
711  $reblockNotAllowed = ( array_key_exists( 'Reblock', $data ) && !$data['Reblock'] );
712 
713  # Show form unless the user is already aware of this...
714  if ( $blockNotConfirmed || $reblockNotAllowed ) {
715  return array( array( 'ipb_already_blocked', $block->getTarget() ) );
716  # Otherwise, try to update the block...
717  } else {
718  # This returns direct blocks before autoblocks/rangeblocks, since we should
719  # be sure the user is blocked by now it should work for our purposes
720  $currentBlock = Block::newFromTarget( $target );
721 
722  if ( $block->equals( $currentBlock ) ) {
723  return array( array( 'ipb_already_blocked', $block->getTarget() ) );
724  }
725 
726  # If the name was hidden and the blocking user cannot hide
727  # names, then don't allow any block changes...
728  if ( $currentBlock->mHideName && !$performer->isAllowed( 'hideuser' ) ) {
729  return array( 'cant-see-hidden-user' );
730  }
731 
732  $currentBlock->isHardblock( $block->isHardblock() );
733  $currentBlock->prevents( 'createaccount', $block->prevents( 'createaccount' ) );
734  $currentBlock->mExpiry = $block->mExpiry;
735  $currentBlock->isAutoblocking( $block->isAutoblocking() );
736  $currentBlock->mHideName = $block->mHideName;
737  $currentBlock->prevents( 'sendemail', $block->prevents( 'sendemail' ) );
738  $currentBlock->prevents( 'editownusertalk', $block->prevents( 'editownusertalk' ) );
739  $currentBlock->mReason = $block->mReason;
740 
741  $status = $currentBlock->update();
742 
743  $logaction = 'reblock';
744 
745  # Unset _deleted fields if requested
746  if ( $currentBlock->mHideName && !$data['HideUser'] ) {
747  RevisionDeleteUser::unsuppressUserName( $target, $userId );
748  }
749 
750  # If hiding/unhiding a name, this should go in the private logs
751  if ( (bool)$currentBlock->mHideName ) {
752  $data['HideUser'] = true;
753  }
754  }
755  } else {
756  $logaction = 'block';
757  }
758 
759  wfRunHooks( 'BlockIpComplete', array( $block, $performer ) );
760 
761  # Set *_deleted fields if requested
762  if ( $data['HideUser'] ) {
763  RevisionDeleteUser::suppressUserName( $target, $userId );
764  }
765 
766  # Can't watch a rangeblock
767  if ( $type != Block::TYPE_RANGE && $data['Watch'] ) {
769  }
770 
771  # Block constructor sanitizes certain block options on insert
772  $data['BlockEmail'] = $block->prevents( 'sendemail' );
773  $data['AutoBlock'] = $block->isAutoblocking();
774 
775  # Prepare log parameters
776  $logParams = array();
777  $logParams[] = $data['Expiry'];
778  $logParams[] = self::blockLogFlags( $data, $type );
779 
780  # Make log entry, if the name is hidden, put it in the oversight log
781  $log_type = $data['HideUser'] ? 'suppress' : 'block';
782  $log = new LogPage( $log_type );
783  $log_id = $log->addEntry(
784  $logaction,
785  Title::makeTitle( NS_USER, $target ),
786  $data['Reason'][0],
787  $logParams,
788  $performer
789  );
790  # Relate log ID to block IDs (bug 25763)
791  $blockIds = array_merge( array( $status['id'] ), $status['autoIds'] );
792  $log->addRelations( 'ipb_id', $blockIds, $log_id );
793 
794  # Report to the user
795  return true;
796  }
797 
806  public static function getSuggestedDurations( $lang = null ) {
807  $a = array();
808  $msg = $lang === null
809  ? wfMessage( 'ipboptions' )->inContentLanguage()->text()
810  : wfMessage( 'ipboptions' )->inLanguage( $lang )->text();
811 
812  if ( $msg == '-' ) {
813  return array();
814  }
815 
816  foreach ( explode( ',', $msg ) as $option ) {
817  if ( strpos( $option, ':' ) === false ) {
818  $option = "$option:$option";
819  }
820 
821  list( $show, $value ) = explode( ':', $option );
822  $a[htmlspecialchars( $show )] = htmlspecialchars( $value );
823  }
824 
825  return $a;
826  }
827 
834  public static function parseExpiryInput( $expiry ) {
835  static $infinity;
836  if ( $infinity == null ) {
837  $infinity = wfGetDB( DB_SLAVE )->getInfinity();
838  }
839 
840  if ( $expiry == 'infinite' || $expiry == 'indefinite' ) {
841  $expiry = $infinity;
842  } else {
843  $expiry = strtotime( $expiry );
844 
845  if ( $expiry < 0 || $expiry === false ) {
846  return false;
847  }
848 
849  $expiry = wfTimestamp( TS_MW, $expiry );
850  }
851 
852  return $expiry;
853  }
854 
860  public static function canBlockEmail( $user ) {
861  global $wgEnableUserEmail, $wgSysopEmailBans;
862 
863  return ( $wgEnableUserEmail && $wgSysopEmailBans && $user->isAllowed( 'blockemail' ) );
864  }
865 
874  public static function checkUnblockSelf( $user, User $performer ) {
875  if ( is_int( $user ) ) {
877  } elseif ( is_string( $user ) ) {
879  }
880 
881  if ( $performer->isBlocked() ) {
882  if ( $user instanceof User && $user->getId() == $performer->getId() ) {
883  # User is trying to unblock themselves
884  if ( $performer->isAllowed( 'unblockself' ) ) {
885  return true;
886  # User blocked themselves and is now trying to reverse it
887  } elseif ( $performer->blockedBy() === $performer->getName() ) {
888  return true;
889  } else {
890  return 'ipbnounblockself';
891  }
892  } else {
893  # User is trying to block/unblock someone else
894  return 'ipbblocked';
895  }
896  } else {
897  return true;
898  }
899  }
900 
908  protected static function blockLogFlags( array $data, $type ) {
909  global $wgBlockAllowsUTEdit;
910  $flags = array();
911 
912  # when blocking a user the option 'anononly' is not available/has no effect
913  # -> do not write this into log
914  if ( !$data['HardBlock'] && $type != Block::TYPE_USER ) {
915  // For grepping: message block-log-flags-anononly
916  $flags[] = 'anononly';
917  }
918 
919  if ( $data['CreateAccount'] ) {
920  // For grepping: message block-log-flags-nocreate
921  $flags[] = 'nocreate';
922  }
923 
924  # Same as anononly, this is not displayed when blocking an IP address
925  if ( !$data['AutoBlock'] && $type == Block::TYPE_USER ) {
926  // For grepping: message block-log-flags-noautoblock
927  $flags[] = 'noautoblock';
928  }
929 
930  if ( $data['DisableEmail'] ) {
931  // For grepping: message block-log-flags-noemail
932  $flags[] = 'noemail';
933  }
934 
935  if ( $wgBlockAllowsUTEdit && $data['DisableUTEdit'] ) {
936  // For grepping: message block-log-flags-nousertalk
937  $flags[] = 'nousertalk';
938  }
939 
940  if ( $data['HideUser'] ) {
941  // For grepping: message block-log-flags-hiddenname
942  $flags[] = 'hiddenname';
943  }
944 
945  return implode( ',', $flags );
946  }
947 
953  public function onSubmit( array $data ) {
954  // This isn't used since we need that HTMLForm that's passed in the
955  // second parameter. See alterForm for the real function
956  }
957 
962  public function onSuccess() {
963  $out = $this->getOutput();
964  $out->setPageTitle( $this->msg( 'blockipsuccesssub' ) );
965  $out->addWikiMsg( 'blockipsuccesstext', wfEscapeWikiText( $this->target ) );
966  }
967 
968  protected function getGroupName() {
969  return 'users';
970  }
971 }
972 
973 # BC @since 1.18
974 class IPBlockForm extends SpecialBlock {
975 }
Title\makeTitle
static & makeTitle( $ns, $title, $fragment='', $interwiki='')
Create a new Title from a namespace index and a DB key.
Definition: Title.php:398
User\newFromId
static newFromId( $id)
Static factory method for creation from a given user ID.
Definition: User.php:411
SpecialBlock\onSuccess
onSuccess()
Do something exciting on successful processing of the form, most likely to show a confirmation messag...
Definition: SpecialBlock.php:957
php
skin txt MediaWiki includes four core it has been set as the default in MediaWiki since the replacing Monobook it had been been the default skin since before being replaced by Vector largely rewritten in while keeping its appearance Several legacy skins were removed in the as the burden of supporting them became too heavy to bear Those in etc for skin dependent CSS etc for skin dependent JavaScript These can also be customised on a per user by etc This feature has led to a wide variety of user styles becoming that gallery is a good place to ending in php
Definition: skin.txt:62
User\getId
getId()
Get the user's ID.
Definition: User.php:1852
is
We use the convention $dbr for read and $dbw for write to help you keep track of whether the database object is a the world will explode Or to be a subsequent write query which succeeded on the master may fail when replicated to the slave due to a unique key collision Replication on the slave will stop and it may take hours to repair the database and get it back online Setting read_only in my cnf on the slave will avoid this but given the dire we prefer to have as many checks as possible We provide a but the wrapper functions like please read the documentation for except in special pages derived from QueryPage It s a common pitfall for new developers to submit code containing SQL queries which examine huge numbers of rows Remember that COUNT * is(N), counting rows in atable is like counting beans in a bucket.------------------------------------------------------------------------ Replication------------------------------------------------------------------------The largest installation of MediaWiki, Wikimedia, uses a large set ofslave MySQL servers replicating writes made to a master MySQL server. Itis important to understand the issues associated with this setup if youwant to write code destined for Wikipedia.It 's often the case that the best algorithm to use for a given taskdepends on whether or not replication is in use. Due to our unabashedWikipedia-centrism, we often just use the replication-friendly version, but if you like, you can use wfGetLB() ->getServerCount() > 1 tocheck to see if replication is in use.===Lag===Lag primarily occurs when large write queries are sent to the master.Writes on the master are executed in parallel, but they are executed inserial when they are replicated to the slaves. The master writes thequery to the binlog when the transaction is committed. The slaves pollthe binlog and start executing the query as soon as it appears. They canservice reads while they are performing a write query, but will not readanything more from the binlog and thus will perform no more writes. Thismeans that if the write query runs for a long time, the slaves will lagbehind the master for the time it takes for the write query to complete.Lag can be exacerbated by high read load. MediaWiki 's load balancer willstop sending reads to a slave when it is lagged by more than 30 seconds.If the load ratios are set incorrectly, or if there is too much loadgenerally, this may lead to a slave permanently hovering around 30seconds lag.If all slaves are lagged by more than 30 seconds, MediaWiki will stopwriting to the database. All edits and other write operations will berefused, with an error returned to the user. This gives the slaves achance to catch up. Before we had this mechanism, the slaves wouldregularly lag by several minutes, making review of recent editsdifficult.In addition to this, MediaWiki attempts to ensure that the user seesevents occurring on the wiki in chronological order. A few seconds of lagcan be tolerated, as long as the user sees a consistent picture fromsubsequent requests. This is done by saving the master binlog positionin the session, and then at the start of each request, waiting for theslave to catch up to that position before doing any reads from it. Ifthis wait times out, reads are allowed anyway, but the request isconsidered to be in "lagged slave mode". Lagged slave mode can bechecked by calling wfGetLB() ->getLaggedSlaveMode(). The onlypractical consequence at present is a warning displayed in the pagefooter.===Lag avoidance===To avoid excessive lag, queries which write large numbers of rows shouldbe split up, generally to write one row at a time. Multi-row INSERT ...SELECT queries are the worst offenders should be avoided altogether.Instead do the select first and then the insert.===Working with lag===Despite our best efforts, it 's not practical to guarantee a low-lagenvironment. Lag will usually be less than one second, but mayoccasionally be up to 30 seconds. For scalability, it 's very importantto keep load on the master low, so simply sending all your queries tothe master is not the answer. So when you have a genuine need forup-to-date data, the following approach is advised:1) Do a quick query to the master for a sequence number or timestamp 2) Run the full query on the slave and check if it matches the data you gotfrom the master 3) If it doesn 't, run the full query on the masterTo avoid swamping the master every time the slaves lag, use of thisapproach should be kept to a minimum. In most cases you should just readfrom the slave and let the user deal with the delay.------------------------------------------------------------------------ Lock contention------------------------------------------------------------------------Due to the high write rate on Wikipedia(and some other wikis), MediaWiki developers need to be very careful to structure their writesto avoid long-lasting locks. By default, MediaWiki opens a transactionat the first query, and commits it before the output is sent. Locks willbe held from the time when the query is done until the commit. So youcan reduce lock time by doing as much processing as possible before youdo your write queries.Often this approach is not good enough, and it becomes necessary toenclose small groups of queries in their own transaction. Use thefollowing syntax:$dbw=wfGetDB(DB_MASTER
SpecialBlock\$preErrors
Array $preErrors
Definition: SpecialBlock.php:43
Block\TYPE_IP
const TYPE_IP
Definition: Block.php:48
SpecialBlock\$target
$target
Definition: SpecialBlock.php:33
Block\TYPE_RANGE
const TYPE_RANGE
Definition: Block.php:49
wfGetDB
& wfGetDB( $db, $groups=array(), $wiki=false)
Get a Database object.
Definition: GlobalFunctions.php:3650
text
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:12
SpecialBlock\processForm
static processForm(array $data, IContextSource $context)
Given the form data, actually implement a block.
Definition: SpecialBlock.php:595
SpecialBlock\preText
preText()
Add header elements like block log entries, etc.
Definition: SpecialBlock.php:305
$form
usually copyright or history_copyright This message must be in HTML not wikitext $subpages will be ignored and the rest of subPageSubtitle() will run. 'SkinTemplateBuildNavUrlsNav_urlsAfterPermalink' whether MediaWiki currently thinks this is a CSS JS page Hooks may change this value to override the return value of Title::isCssOrJsPage(). 'TitleIsAlwaysKnown' whether MediaWiki currently thinks this page is known isMovable() always returns false. $title whether MediaWiki currently thinks this page is movable Hooks may change this value to override the return value of Title::isMovable(). 'TitleIsWikitextPage' whether MediaWiki currently thinks this is a wikitext page Hooks may change this value to override the return value of Title::isWikitextPage() 'TitleMove' use UploadVerification and UploadVerifyFile instead $form
Definition: hooks.txt:2573
SpecialBlock\canBlockEmail
static canBlockEmail( $user)
Can we do an email block?
Definition: SpecialBlock.php:855
wfTimestamp
wfTimestamp( $outputtype=TS_UNIX, $ts=0)
Get a timestamp string in one of various formats.
Definition: GlobalFunctions.php:2483
Status\newGood
static newGood( $value=null)
Factory function for good results.
Definition: Status.php:77
IP
A collection of public static functions to play with IP address and IP blocks.
Definition: IP.php:65
Block\newFromTarget
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:970
FormSpecialPage
Special page which uses an HTMLForm to handle processing.
Definition: FormSpecialPage.php:31
User\newFromName
static newFromName( $name, $validate='valid')
Static factory method for creation from username.
Definition: User.php:388
IP\isIPv6
static isIPv6( $ip)
Given a string, determine if it as valid IP in IPv6 only.
Definition: IP.php:85
$s
$s
Definition: mergeMessageFileList.php:156
SpecialPage\getTitleFor
static getTitleFor( $name, $subpage=false, $fragment='')
Get a localised Title object for a specified special page name.
Definition: SpecialPage.php:74
SpecialPage\getSkin
getSkin()
Shortcut to get the skin being used for this instance.
Definition: SpecialPage.php:555
SpecialBlock\checkExecutePermissions
checkExecutePermissions(User $user)
Checks that the user can unblock themselves if they are trying to do so.
Definition: SpecialBlock.php:55
IPBlockForm
Definition: SpecialBlock.php:969
$flags
it s the revision text itself In either if gzip is the revision text is gzipped $flags
Definition: hooks.txt:2113
SpecialPage\getName
getName()
Get the name of this Special Page.
Definition: SpecialPage.php:139
$link
set to $title object and return false for a match for latest after cache objects are set use the ContentHandler facility to handle CSS and JavaScript for highlighting & $link
Definition: hooks.txt:2149
SpecialBlock\setParameter
setParameter( $par)
Handle some magic here.
Definition: SpecialBlock.php:70
Linker\linkKnown
static linkKnown( $target, $html=null, $customAttribs=array(), $query=array(), $options=array( 'known', 'noclasses'))
Identical to link(), except $options defaults to 'known'.
Definition: Linker.php:264
RevisionDeleteUser\unsuppressUserName
static unsuppressUserName( $name, $userId, $dbw=null)
Definition: RevisionDeleteUser.php:133
SpecialBlock\postText
postText()
Add footer elements to the form.
Definition: SpecialBlock.php:345
Linker\link
static link( $target, $html=null, $customAttribs=array(), $query=array(), $options=array())
This function returns an HTML link to the given target.
Definition: Linker.php:192
$out
$out
Definition: UtfNormalGenerate.php:167
Block\parseTarget
static parseTarget( $target)
From an existing Block, get the target and the type of target.
Definition: Block.php:1194
SpecialBlock\maybeAlterFormDefaults
maybeAlterFormDefaults(&$fields)
If the user has already been blocked with similar settings, load that block and change the defaults f...
Definition: SpecialBlock.php:228
SpecialBlock\__construct
__construct()
Definition: SpecialBlock.php:45
SpecialBlock\alterForm
alterForm(HTMLForm $form)
Customizes the HTMLForm a bit.
Definition: SpecialBlock.php:91
SpecialBlock
A special page that allows users with 'block' right to block users from editing pages and other actio...
Definition: SpecialBlock.php:30
SpecialBlock\$requestedHideUser
Bool $requestedHideUser
whether the previous submission of the form asked for HideUser *
Definition: SpecialBlock.php:39
WatchedItem\IGNORE_USER_RIGHTS
const IGNORE_USER_RIGHTS
Constant to specify that user rights 'editmywatchlist' and 'viewmywatchlist' should not be checked.
Definition: WatchedItem.php:35
LogPage
Class to simplify the use of log pages.
Definition: LogPage.php:32
wfMessage
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 externallinks including delete and has completed for all link tables 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
wfRunHooks
wfRunHooks( $event, array $args=array(), $deprecatedVersion=null)
Call hook functions defined in $wgHooks.
Definition: GlobalFunctions.php:4001
SpecialBlock\$alreadyBlocked
Bool $alreadyBlocked
Definition: SpecialBlock.php:41
SpecialBlock\getTargetUserTitle
static getTargetUserTitle( $target)
Get a user page target for things like logs.
Definition: SpecialBlock.php:437
array
the array() calling protocol came about after MediaWiki 1.4rc1.
List of Api Query prop modules.
SpecialPage\getUser
getUser()
Shortcut to get the User executing this instance.
Definition: SpecialPage.php:545
global
when a variable name is used in a it is silently declared as a new masking the global
Definition: design.txt:93
list
deferred txt A few of the database updates required by various functions here can be deferred until after the result page is displayed to the user For updating the view updating the linked to tables after a etc PHP does not yet have any way to tell the server to actually return and disconnect while still running these but it might have such a feature in the future We handle these by creating a deferred update object and putting those objects on a global list
Definition: deferred.txt:11
SpecialBlock\$type
Integer $type
Block::TYPE_ constant *.
Definition: SpecialBlock.php:35
TS_MW
const TS_MW
MediaWiki concatenated string timestamp (YYYYMMDDHHMMSS)
Definition: GlobalFunctions.php:2431
Title\makeTitleSafe
static makeTitleSafe( $ns, $title, $fragment='', $interwiki='')
Create a new Title from a namespace index and a DB key.
Definition: Title.php:422
$value
$value
Definition: styleTest.css.php:45
SpecialPage\msg
msg()
Wrapper around wfMessage that sets the current context.
Definition: SpecialPage.php:609
FormSpecialPage\$par
string $par
The sub-page of the special page.
Definition: FormSpecialPage.php:35
SpecialBlock\$previousTarget
User String $previousTarget
the previous block target *
Definition: SpecialBlock.php:37
SpecialBlock\getSuggestedDurations
static getSuggestedDurations( $lang=null)
Get an array of suggested block durations from MediaWiki:Ipboptions.
Definition: SpecialBlock.php:801
SpecialPage\getRequest
getRequest()
Get the WebRequest being used for this instance.
Definition: SpecialPage.php:525
wfEscapeWikiText
wfEscapeWikiText( $text)
Escapes the given text so that it may be output using addWikiText() without any linking,...
Definition: GlobalFunctions.php:2077
SpecialBlock\getFormFields
getFormFields()
Get the HTMLForm descriptor array for the block form.
Definition: SpecialBlock.php:116
IContextSource\getUser
getUser()
Get the User object.
block
div flags Integer display flags(NO_ACTION_LINK, NO_EXTRA_USER_LINKS) 'LoginAuthenticateAudit' this hook is for auditing only etc block
Definition: hooks.txt:1632
User\blockedBy
blockedBy()
If user is blocked, return the name of the user who placed the block.
Definition: User.php:1766
$user
please add to it if you re going to add events to the MediaWiki code where normally authentication against an external auth plugin would be creating a account $user
Definition: hooks.txt:237
IP\isIPv4
static isIPv4( $ip)
Given a string, determine if it as valid IP in IPv4 only.
Definition: IP.php:96
IContextSource
Interface for objects which can provide a context on request.
Definition: IContextSource.php:29
WebRequest
The WebRequest class encapsulates getting at data passed in the URL or via a POSTed form,...
Definition: WebRequest.php:38
Block\TYPE_USER
const TYPE_USER
Definition: Block.php:47
it
=Architecture==Two class hierarchies are used to provide the functionality associated with the different content models:*Content interface(and AbstractContent base class) define functionality that acts on the concrete content of a page, and *ContentHandler base class provides functionality specific to a content model, but not acting on concrete content. The most important function of ContentHandler is to act as a factory for the appropriate implementation of Content. These Content objects are to be used by MediaWiki everywhere, instead of passing page content around as text. All manipulation and analysis of page content must be done via the appropriate methods of the Content object. For each content model, a subclass of ContentHandler has to be registered with $wgContentHandlers. The ContentHandler object for a given content model can be obtained using ContentHandler::getForModelID($id). Also Title, WikiPage and Revision now have getContentHandler() methods for convenience. ContentHandler objects are singletons that provide functionality specific to the content type, but not directly acting on the content of some page. ContentHandler::makeEmptyContent() and ContentHandler::unserializeContent() can be used to create a Content object of the appropriate type. However, it is recommended to instead use WikiPage::getContent() resp. Revision::getContent() to get a page 's content as a Content object. These two methods should be the ONLY way in which page content is accessed. Another important function of ContentHandler objects is to define custom action handlers for a content model, see ContentHandler::getActionOverrides(). This is similar to what WikiPage::getActionOverrides() was already doing.==Serialization==With the ContentHandler facility, page content no longer has to be text based. Objects implementing the Content interface are used to represent and handle the content internally. For storage and data exchange, each content model supports at least one serialization format via ContentHandler::serializeContent($content). The list of supported formats for a given content model can be accessed using ContentHandler::getSupportedFormats(). Content serialization formats are identified using MIME type like strings. The following formats are built in:*text/x-wiki - wikitext *text/javascript - for js pages *text/css - for css pages *text/plain - for future use, e.g. with plain text messages. *text/html - for future use, e.g. with plain html messages. *application/vnd.php.serialized - for future use with the api and for extensions *application/json - for future use with the api, and for use by extensions *application/xml - for future use with the api, and for use by extensions In PHP, use the corresponding CONTENT_FORMAT_XXX constant. Note that when using the API to access page content, especially action=edit, action=parse and action=query &prop=revisions, the model and format of the content should always be handled explicitly. Without that information, interpretation of the provided content is not reliable. The same applies to XML dumps generated via maintenance/dumpBackup.php or Special:Export. Also note that the API will provide encapsulated, serialized content - so if the API was called with format=json, and contentformat is also json(or rather, application/json), the page content is represented as a string containing an escaped json structure. Extensions that use JSON to serialize some types of page content may provide specialized API modules that allow access to that content in a more natural form.==Compatibility==The ContentHandler facility is introduced in a way that should allow all existing code to keep functioning at least for pages that contain wikitext or other text based content. However, a number of functions and hooks have been deprecated in favor of new versions that are aware of the page 's content model, and will now generate warnings when used. Most importantly, the following functions have been deprecated:*Revisions::getText() and Revisions::getRawText() is deprecated in favor Revisions::getContent() *WikiPage::getText() is deprecated in favor WikiPage::getContent() Also, the old Article::getContent()(which returns text) is superceded by Article::getContentObject(). However, both methods should be avoided since they do not provide clean access to the page 's actual content. For instance, they may return a system message for non-existing pages. Use WikiPage::getContent() instead. Code that relies on a textual representation of the page content should eventually be rewritten. However, ContentHandler::getContentText() provides a stop-gap that can be used to get text for a page. Its behavior is controlled by $wgContentHandlerTextFallback it
Definition: contenthandler.txt:107
SpecialBlock\onSubmit
onSubmit(array $data)
Process the form on POST submission.
Definition: SpecialBlock.php:948
DB_SLAVE
const DB_SLAVE
Definition: Defines.php:55
type
This document describes the state of Postgres support in and is fairly well maintained The main code is very well while extensions are very hit and miss it is probably the most supported database after MySQL Much of the work in making MediaWiki database agnostic came about through the work of creating Postgres as and are nearing end of but without copying over all the usage comments General notes on the but these can almost always be programmed around *Although Postgres has a true BOOLEAN type
Definition: postgres.txt:22
SpecialBlock\validateTargetField
static validateTargetField( $value, $alldata, $form)
HTMLForm field validation-callback for Target field.
Definition: SpecialBlock.php:506
SpecialBlock\validateTarget
static validateTarget( $value, User $user)
Validate a block target.
Definition: SpecialBlock.php:525
as
This document is intended to provide useful advice for parties seeking to redistribute MediaWiki to end users It s targeted particularly at maintainers for Linux since it s been observed that distribution packages of MediaWiki often break We ve consistently had to recommend that users seeking support use official tarballs instead of their distribution s and this often solves whatever problem the user is having It would be nice if this could such as
Definition: distributors.txt:9
Block
Definition: Block.php:22
SpecialBlock\parseExpiryInput
static parseExpiryInput( $expiry)
Convert a submitted expiry time, which may be relative ("2 weeks", etc) or absolute ("24 May 2034",...
Definition: SpecialBlock.php:829
SpecialBlock\getGroupName
getGroupName()
Under which header this special page is listed in Special:SpecialPages See messages 'specialpages-gro...
Definition: SpecialBlock.php:963
SpecialBlock\checkUnblockSelf
static checkUnblockSelf( $user, User $performer)
bug 15810: blocked admins should not be able to block/unblock others, and probably shouldn't be able ...
Definition: SpecialBlock.php:869
NS_USER
const NS_USER
Definition: Defines.php:81
SpecialBlock\processUIForm
static processUIForm(array $data, HTMLForm $form)
Submit callback for an HTMLForm object, will simply pass.
Definition: SpecialBlock.php:585
SpecialBlock\getTargetAndType
static getTargetAndType( $par, WebRequest $request=null)
Determine the target of the block, and the type of target TODO: should be in Block....
Definition: SpecialBlock.php:455
NS_MEDIAWIKI
const NS_MEDIAWIKI
Definition: Defines.php:87
SpecialBlock\blockLogFlags
static blockLogFlags(array $data, $type)
Return a comma-delimited list of "flags" to be passed to the log reader for this block,...
Definition: SpecialBlock.php:903
HTMLForm\formatErrors
static formatErrors( $errors)
Format a stack of error messages into a single HTML string.
Definition: HTMLForm.php:932
Html\rawElement
static rawElement( $element, $attribs=array(), $contents='')
Returns an HTML element in a string.
Definition: Html.php:124
User\isBlocked
isBlocked( $bFromSlave=true)
Check if user is blocked.
Definition: User.php:1721
ErrorPageError
An error page which can definitely be safely rendered using the OutputPage.
Definition: ErrorPageError.php:27
WatchAction\doWatch
static doWatch(Title $title, User $user, $checkRights=WatchedItem::CHECK_USER_RIGHTS)
Watch a page.
Definition: WatchAction.php:130
User
The User object encapsulates all of the user-specific settings (user_id, name, rights,...
Definition: User.php:59
User\getName
getName()
Get the user name, or the IP of an anonymous user.
Definition: User.php:1876
TS_RFC2822
const TS_RFC2822
RFC 2822 format, for E-mail and HTTP headers.
Definition: GlobalFunctions.php:2441
IP\isIPAddress
static isIPAddress( $ip)
Determine if a string is as valid IP address or network (CIDR prefix).
Definition: IP.php:74
RevisionDeleteUser\suppressUserName
static suppressUserName( $name, $userId, $dbw=null)
Definition: RevisionDeleteUser.php:129
LogEventsList\showLogExtract
static showLogExtract(&$out, $types=array(), $page='', $user='', $param=array())
Show log extract.
Definition: LogEventsList.php:507
User\isAllowed
isAllowed( $action='')
Internal mechanics of testing a permission.
Definition: User.php:3030
HTMLForm
Object handling generic submission, CSRF protection, layout and other logic for UI forms.
Definition: HTMLForm.php:100
$type
$type
Definition: testCompression.php:46