MediaWiki  master
ProtectionForm.php
Go to the documentation of this file.
1 <?php
29 
35  protected $mRestrictions = [];
36 
38  protected $mReason = '';
39 
41  protected $mReasonSelection = '';
42 
44  protected $mCascade = false;
45 
47  protected $mExpiry = [];
48 
53  protected $mExpirySelection = [];
54 
56  protected $mPermErrors = [];
57 
59  protected $mApplicableTypes = [];
60 
62  protected $mExistingExpiry = [];
63 
65  protected $mArticle;
66 
68  protected $mTitle;
69 
71  protected $disabled;
72 
74  protected $disabledAttrib;
75 
77  private $mContext;
78 
80  private $mRequest;
81 
83  private $mUser;
84 
86  private $mLang;
87 
89  private $mOut;
90 
92  private $permManager;
93 
95  private $hookRunner;
96 
97  public function __construct( Article $article ) {
98  // Set instance variables.
99  $this->mArticle = $article;
100  $this->mTitle = $article->getTitle();
101  $this->mApplicableTypes = $this->mTitle->getRestrictionTypes();
102  $this->mContext = $article->getContext();
103  $this->mRequest = $this->mContext->getRequest();
104  $this->mUser = $this->mContext->getUser();
105  $this->mOut = $this->mContext->getOutput();
106  $this->mLang = $this->mContext->getLanguage();
107 
108  $services = MediaWikiServices::getInstance();
109  $this->permManager = $services->getPermissionManager();
110  $this->hookRunner = new HookRunner( $services->getHookContainer() );
111 
112  // Check if the form should be disabled.
113  // If it is, the form will be available in read-only to show levels.
114  $this->mPermErrors = $this->permManager->getPermissionErrors(
115  'protect',
116  $this->mUser,
117  $this->mTitle,
118  $this->mRequest->wasPosted()
119  ? PermissionManager::RIGOR_SECURE
120  : PermissionManager::RIGOR_FULL // T92357
121  );
122  if ( wfReadOnly() ) {
123  $this->mPermErrors[] = [ 'readonlytext', wfReadOnlyReason() ];
124  }
125  $this->disabled = $this->mPermErrors !== [];
126  $this->disabledAttrib = $this->disabled ? [ 'disabled' => 'disabled' ] : [];
127 
128  $this->loadData();
129  }
130 
134  private function loadData() {
135  $levels = $this->permManager->getNamespaceRestrictionLevels(
136  $this->mTitle->getNamespace(), $this->mUser
137  );
138 
139  $this->mCascade = $this->mTitle->areRestrictionsCascading();
140  $this->mReason = $this->mRequest->getText( 'mwProtect-reason' );
141  $this->mReasonSelection = $this->mRequest->getText( 'wpProtectReasonSelection' );
142  $this->mCascade = $this->mRequest->getBool( 'mwProtect-cascade', $this->mCascade );
143 
144  foreach ( $this->mApplicableTypes as $action ) {
145  // @todo FIXME: This form currently requires individual selections,
146  // but the db allows multiples separated by commas.
147 
148  // Pull the actual restriction from the DB
149  $this->mRestrictions[$action] = implode( '', $this->mTitle->getRestrictions( $action ) );
150 
151  if ( !$this->mRestrictions[$action] ) {
152  // No existing expiry
153  $existingExpiry = '';
154  } else {
155  $existingExpiry = $this->mTitle->getRestrictionExpiry( $action );
156  }
157  $this->mExistingExpiry[$action] = $existingExpiry;
158 
159  $requestExpiry = $this->mRequest->getText( "mwProtect-expiry-$action" );
160  $requestExpirySelection = $this->mRequest->getVal( "wpProtectExpirySelection-$action" );
161 
162  if ( $requestExpiry ) {
163  // Custom expiry takes precedence
164  $this->mExpiry[$action] = $requestExpiry;
165  $this->mExpirySelection[$action] = 'othertime';
166  } elseif ( $requestExpirySelection ) {
167  // Expiry selected from list
168  $this->mExpiry[$action] = '';
169  $this->mExpirySelection[$action] = $requestExpirySelection;
170  } elseif ( $existingExpiry ) {
171  // Use existing expiry in its own list item
172  $this->mExpiry[$action] = '';
173  $this->mExpirySelection[$action] = $existingExpiry;
174  } else {
175  // Catches 'infinity' - Existing expiry is infinite, use "infinite" in drop-down
176  // Final default: infinite
177  $this->mExpiry[$action] = '';
178  $this->mExpirySelection[$action] = 'infinite';
179  }
180 
181  $val = $this->mRequest->getVal( "mwProtect-level-$action" );
182  if ( isset( $val ) && in_array( $val, $levels ) ) {
183  $this->mRestrictions[$action] = $val;
184  }
185  }
186  }
187 
195  private function getExpiry( $action ) {
196  if ( $this->mExpirySelection[$action] == 'existing' ) {
197  return $this->mExistingExpiry[$action];
198  } elseif ( $this->mExpirySelection[$action] == 'othertime' ) {
199  $value = $this->mExpiry[$action];
200  } else {
201  $value = $this->mExpirySelection[$action];
202  }
203  if ( wfIsInfinity( $value ) ) {
204  $time = 'infinity';
205  } else {
206  $unix = strtotime( $value );
207 
208  if ( !$unix || $unix === -1 ) {
209  return false;
210  }
211 
212  // @todo FIXME: Non-qualified absolute times are not in users specified timezone
213  // and there isn't notice about it in the ui
214  $time = wfTimestamp( TS_MW, $unix );
215  }
216  return $time;
217  }
218 
222  public function execute() {
223  if (
224  $this->permManager->getNamespaceRestrictionLevels(
225  $this->mTitle->getNamespace()
226  ) === [ '' ]
227  ) {
228  throw new ErrorPageError( 'protect-badnamespace-title', 'protect-badnamespace-text' );
229  }
230 
231  if ( $this->mRequest->wasPosted() ) {
232  if ( $this->save() ) {
233  $q = $this->mArticle->getPage()->isRedirect() ? 'redirect=no' : '';
234  $this->mOut->redirect( $this->mTitle->getFullURL( $q ) );
235  }
236  } else {
237  $this->show();
238  }
239  }
240 
246  private function show( $err = null ) {
247  $out = $this->mOut;
248  $out->setRobotPolicy( 'noindex,nofollow' );
249  $out->addBacklinkSubtitle( $this->mTitle );
250 
251  if ( is_array( $err ) ) {
252  $out->wrapWikiMsg( "<div class='error'>\n$1\n</div>\n", $err );
253  } elseif ( is_string( $err ) ) {
254  $out->addHTML( "<div class='error'>{$err}</div>\n" );
255  }
256 
257  if ( $this->mApplicableTypes === [] ) {
258  // No restriction types available for the current title
259  // this might happen if an extension alters the available types
260  $out->setPageTitle( $this->mContext->msg(
261  'protect-norestrictiontypes-title',
262  $this->mTitle->getPrefixedText()
263  ) );
264  $out->addWikiTextAsInterface(
265  $this->mContext->msg( 'protect-norestrictiontypes-text' )->plain()
266  );
267 
268  // Show the log in case protection was possible once
269  $this->showLogExtract();
270  // return as there isn't anything else we can do
271  return;
272  }
273 
274  list( $cascadeSources, /* $restrictions */ ) = $this->mTitle->getCascadeProtectionSources();
275  if ( $cascadeSources && count( $cascadeSources ) > 0 ) {
276  $titles = '';
277 
278  foreach ( $cascadeSources as $title ) {
279  $titles .= '* [[:' . $title->getPrefixedText() . "]]\n";
280  }
281 
283  $out->wrapWikiMsg(
284  "<div id=\"mw-protect-cascadeon\">\n$1\n" . $titles . "</div>",
285  [ 'protect-cascadeon', count( $cascadeSources ) ]
286  );
287  }
288 
289  # Show an appropriate message if the user isn't allowed or able to change
290  # the protection settings at this time
291  if ( $this->disabled ) {
292  $out->setPageTitle(
293  $this->mContext->msg( 'protect-title-notallowed',
294  $this->mTitle->getPrefixedText() )
295  );
296  $out->addWikiTextAsInterface( $out->formatPermissionsErrorMessage(
297  $this->mPermErrors, 'protect'
298  ) );
299  } else {
300  $out->setPageTitle(
301  $this->mContext->msg( 'protect-title', $this->mTitle->getPrefixedText() )
302  );
303  $out->addWikiMsg( 'protect-text',
304  wfEscapeWikiText( $this->mTitle->getPrefixedText() ) );
305  }
306 
307  $out->addHTML( $this->buildForm() );
308  $this->showLogExtract();
309  }
310 
316  private function save() {
317  # Permission check!
318  if ( $this->disabled ) {
319  $this->show();
320  return false;
321  }
322 
323  $token = $this->mRequest->getVal( 'wpEditToken' );
324  if ( !$this->mUser->matchEditToken( $token, [ 'protect', $this->mTitle->getPrefixedDBkey() ] ) ) {
325  $this->show( [ 'sessionfailure' ] );
326  return false;
327  }
328 
329  # Create reason string. Use list and/or custom string.
330  $reasonstr = $this->mReasonSelection;
331  if ( $reasonstr != 'other' && $this->mReason != '' ) {
332  // Entry from drop down menu + additional comment
333  $reasonstr .= $this->mContext->msg( 'colon-separator' )->text() . $this->mReason;
334  } elseif ( $reasonstr == 'other' ) {
335  $reasonstr = $this->mReason;
336  }
337 
338  $expiry = [];
339  foreach ( $this->mApplicableTypes as $action ) {
340  $expiry[$action] = $this->getExpiry( $action );
341  if ( empty( $this->mRestrictions[$action] ) ) {
342  // unprotected
343  continue;
344  }
345  if ( !$expiry[$action] ) {
346  $this->show( [ 'protect_expiry_invalid' ] );
347  return false;
348  }
349  if ( $expiry[$action] < wfTimestampNow() ) {
350  $this->show( [ 'protect_expiry_old' ] );
351  return false;
352  }
353  }
354 
355  $this->mCascade = $this->mRequest->getBool( 'mwProtect-cascade' );
356 
357  $status = $this->mArticle->getPage()->doUpdateRestrictions(
358  $this->mRestrictions,
359  $expiry,
360  $this->mCascade,
361  $reasonstr,
362  $this->mUser
363  );
364 
365  if ( !$status->isOK() ) {
366  $this->show( $this->mOut->parseInlineAsInterface(
367  $status->getWikiText( false, false, $this->mLang )
368  ) );
369  return false;
370  }
371 
378  $errorMsg = '';
379  if ( !$this->hookRunner->onProtectionForm__save( $this->mArticle, $errorMsg, $reasonstr ) ) {
380  if ( $errorMsg == '' ) {
381  $errorMsg = [ 'hookaborted' ];
382  }
383  }
384  if ( $errorMsg != '' ) {
385  $this->show( $errorMsg );
386  return false;
387  }
388 
390  $this->mRequest->getCheck( 'mwProtectWatch' ),
391  $this->mTitle,
392  $this->mUser
393  );
394 
395  return true;
396  }
397 
403  private function buildForm() {
404  $this->mOut->enableOOUI();
405  $out = '';
406  $fields = [];
407  if ( !$this->disabled ) {
408  $this->mOut->addModules( 'mediawiki.action.protect' );
409  }
410  $scExpiryOptions = $this->mContext->msg( 'protect-expiry-options' )->inContentLanguage()->text();
411  $levels = $this->permManager->getNamespaceRestrictionLevels(
412  $this->mTitle->getNamespace(),
413  $this->disabled ? null : $this->mUser
414  );
415 
416  // Not all languages have V_x <-> N_x relation
417  foreach ( $this->mRestrictions as $action => $selected ) {
418  // Messages:
419  // restriction-edit, restriction-move, restriction-create, restriction-upload
420  $section = 'restriction-' . $action;
421  $id = 'mwProtect-level-' . $action;
422  $options = [];
423  foreach ( $levels as $key ) {
424  $options[$this->getOptionLabel( $key )] = $key;
425  }
426 
427  $fields[$id] = [
428  'type' => 'select',
429  'name' => $id,
430  'default' => $selected,
431  'id' => $id,
432  'size' => count( $levels ),
433  'options' => $options,
434  'disabled' => $this->disabled,
435  'section' => $section,
436  ];
437 
438  $expiryOptions = [];
439 
440  if ( $this->mExistingExpiry[$action] ) {
441  if ( $this->mExistingExpiry[$action] == 'infinity' ) {
442  $existingExpiryMessage = $this->mContext->msg( 'protect-existing-expiry-infinity' );
443  } else {
444  $timestamp = $this->mLang->userTimeAndDate( $this->mExistingExpiry[$action], $this->mUser );
445  $date = $this->mLang->userDate( $this->mExistingExpiry[$action], $this->mUser );
446  $time = $this->mLang->userTime( $this->mExistingExpiry[$action], $this->mUser );
447  $existingExpiryMessage = $this->mContext->msg(
448  'protect-existing-expiry',
449  $timestamp,
450  $date,
451  $time
452  );
453  }
454  $expiryOptions[$existingExpiryMessage->text()] = 'existing';
455  }
456 
457  $expiryOptions[$this->mContext->msg( 'protect-othertime-op' )->text()] = 'othertime';
458  foreach ( explode( ',', $scExpiryOptions ) as $option ) {
459  if ( strpos( $option, ":" ) === false ) {
460  $show = $value = $option;
461  } else {
462  list( $show, $value ) = explode( ":", $option );
463  }
464  $expiryOptions[$show] = htmlspecialchars( $value );
465  }
466 
467  # Add expiry dropdown
468  $fields["wpProtectExpirySelection-$action"] = [
469  'type' => 'select',
470  'name' => "wpProtectExpirySelection-$action",
471  'id' => "mwProtectExpirySelection-$action",
472  'tabindex' => '2',
473  'disabled' => $this->disabled,
474  'label' => $this->mContext->msg( 'protectexpiry' )->text(),
475  'options' => $expiryOptions,
476  'default' => $this->mExpirySelection[$action],
477  'section' => $section,
478  ];
479 
480  # Add custom expiry field
481  if ( !$this->disabled ) {
482  $fields["mwProtect-expiry-$action"] = [
483  'type' => 'text',
484  'label' => $this->mContext->msg( 'protect-othertime' )->text(),
485  'name' => "mwProtect-expiry-$action",
486  'id' => "mwProtect-$action-expires",
487  'size' => 50,
488  'default' => $this->mExpiry[$action],
489  'disabled' => $this->disabled,
490  'section' => $section,
491  ];
492  }
493  }
494 
495  # Give extensions a chance to add items to the form
496  $hookFormRaw = '';
497  $hookFormOptions = [];
498 
499  $this->hookRunner->onProtectionForm__buildForm( $this->mArticle, $hookFormRaw );
500  $this->hookRunner->onProtectionFormAddFormFields( $this->mArticle, $hookFormOptions );
501 
502  # Merge forms added from addFormFields
503  $fields = array_merge( $fields, $hookFormOptions );
504 
505  # Add raw sections added in buildForm
506  if ( $hookFormRaw ) {
507  $fields['rawinfo'] = [
508  'type' => 'info',
509  'default' => $hookFormRaw,
510  'raw' => true,
511  'section' => 'restriction-blank'
512  ];
513  }
514 
515  # JavaScript will add another row with a value-chaining checkbox
516  if ( $this->mTitle->exists() ) {
517  $fields['mwProtect-cascade'] = [
518  'type' => 'check',
519  'label' => $this->mContext->msg( 'protect-cascade' )->text(),
520  'id' => 'mwProtect-cascade',
521  'name' => 'mwProtect-cascade',
522  'default' => $this->mCascade,
523  'disabled' => $this->disabled,
524  ];
525  }
526 
527  # Add manual and custom reason field/selects as well as submit
528  if ( !$this->disabled ) {
529  // HTML maxlength uses "UTF-16 code units", which means that characters outside BMP
530  // (e.g. emojis) count for two each. This limit is overridden in JS to instead count
531  // Unicode codepoints.
532  // Subtract arbitrary 75 to leave some space for the autogenerated null edit's summary
533  // and other texts chosen by dropdown menus on this page.
534  $maxlength = CommentStore::COMMENT_CHARACTER_LIMIT - 75;
535  $fields['wpProtectReasonSelection'] = [
536  'type' => 'select',
537  'cssclass' => 'mwProtect-reason',
538  'label' => $this->mContext->msg( 'protectcomment' )->text(),
539  'tabindex' => 4,
540  'id' => 'wpProtectReasonSelection',
541  'name' => 'wpProtectReasonSelection',
542  'flatlist' => true,
543  'options' => Xml::listDropDownOptions(
544  $this->mContext->msg( 'protect-dropdown' )->inContentLanguage()->text(),
545  [ 'other' => $this->mContext->msg( 'protect-otherreason-op' )->inContentLanguage()->text() ]
546  ),
547  'default' => $this->mReasonSelection,
548  ];
549  $fields['mwProtect-reason'] = [
550  'type' => 'text',
551  'id' => 'mwProtect-reason',
552  'label' => $this->mContext->msg( 'protect-otherreason' )->text(),
553  'name' => 'mwProtect-reason',
554  'size' => 60,
555  'maxlength' => $maxlength,
556  'default' => $this->mReason,
557  ];
558  # Disallow watching if user is not logged in
559  if ( $this->mUser->isRegistered() ) {
560  $fields['mwProtectWatch'] = [
561  'type' => 'check',
562  'id' => 'mwProtectWatch',
563  'label' => $this->mContext->msg( 'watchthis' )->text(),
564  'name' => 'mwProtectWatch',
565  'default' => (
566  $this->mUser->isWatched( $this->mTitle )
567  || $this->mUser->getOption( 'watchdefault' )
568  ),
569  ];
570  }
571  }
572 
573  if ( $this->permManager->userHasRight( $this->mUser, 'editinterface' ) ) {
574  $linkRenderer = MediaWikiServices::getInstance()->getLinkRenderer();
575  $link = $linkRenderer->makeKnownLink(
576  $this->mContext->msg( 'protect-dropdown' )->inContentLanguage()->getTitle(),
577  $this->mContext->msg( 'protect-edit-reasonlist' )->text(),
578  [],
579  [ 'action' => 'edit' ]
580  );
581  $out .= '<p class="mw-protect-editreasons">' . $link . '</p>';
582  }
583 
584  if ( !$this->disabled ) {
585  $fields['wpEditToken'] = [
586  'name' => 'wpEditToken',
587  'type' => 'hidden',
588  'default' => $this->mUser->getEditToken( [ 'protect', $this->mTitle->getPrefixedDBkey() ] ),
589  ];
590  }
591 
592  $htmlForm = HTMLForm::factory( 'ooui', $fields, $this->mContext );
593  $htmlForm
594  ->setMethod( 'post' )
595  ->setId( 'mw-Protect-Form' )
596  ->setTableId( 'mw-protect-table2' )
597  ->setAction( $this->mTitle->getLocalURL( 'action=protect' ) )
598  ->setSubmitID( 'mw-Protect-submit' )
599  ->setSubmitText( $this->mContext->msg( 'confirm' )->text() )
600  ->suppressDefaultSubmit( $this->disabled )
601  ->setWrapperLegend( $this->mContext->msg( 'protect-legend' )->text() )
602  ->loadData();
603 
604  return $htmlForm->getHTML( false ) . $out;
605  }
606 
613  private function getOptionLabel( $permission ) {
614  if ( $permission == '' ) {
615  return $this->mContext->msg( 'protect-default' )->text();
616  } else {
617  // Messages: protect-level-autoconfirmed, protect-level-sysop
618  $msg = $this->mContext->msg( "protect-level-{$permission}" );
619  if ( $msg->exists() ) {
620  return $msg->text();
621  }
622  return $this->mContext->msg( 'protect-fallback', $permission )->text();
623  }
624  }
625 
629  private function showLogExtract() {
630  # Show relevant lines from the protection log:
631  $protectLogPage = new LogPage( 'protect' );
632  $this->mOut->addHTML( Xml::element( 'h2', null, $protectLogPage->getName()->text() ) );
634  LogEventsList::showLogExtract( $this->mOut, 'protect', $this->mTitle );
635  # Let extensions add other relevant log extracts
636  $this->hookRunner->onProtectionForm__showLogExtract( $this->mArticle, $this->mOut );
637  }
638 }
ProtectionForm\$mExpirySelection
array $mExpirySelection
Map of action to value selected in expiry drop-down list.
Definition: ProtectionForm.php:53
ProtectionForm\$mExpiry
array $mExpiry
Map of action to "other" expiry time.
Definition: ProtectionForm.php:47
ProtectionForm\__construct
__construct(Article $article)
Definition: ProtectionForm.php:97
MediaWiki\MediaWikiServices
MediaWikiServices is the service locator for the application scope of MediaWiki.
Definition: MediaWikiServices.php:173
ProtectionForm\$mReason
string $mReason
The custom/additional protection reason.
Definition: ProtectionForm.php:38
ProtectionForm\getExpiry
getExpiry( $action)
Get the expiry time for a given action, by combining the relevant inputs.
Definition: ProtectionForm.php:195
wfTimestamp
wfTimestamp( $outputtype=TS_UNIX, $ts=0)
Get a timestamp string in one of various formats.
Definition: GlobalFunctions.php:1832
ProtectionForm\$mContext
IContextSource $mContext
Definition: ProtectionForm.php:77
ProtectionForm\$mUser
User $mUser
Definition: ProtectionForm.php:83
ProtectionForm\$mArticle
Article $mArticle
Definition: ProtectionForm.php:65
wfReadOnly
wfReadOnly()
Check whether the wiki is in read-only mode.
Definition: GlobalFunctions.php:1135
ProtectionForm\loadData
loadData()
Loads the current state of protection into the object.
Definition: ProtectionForm.php:134
ProtectionForm\$mOut
OutputPage $mOut
Definition: ProtectionForm.php:89
ProtectionForm
Handles the page protection UI and backend.
Definition: ProtectionForm.php:33
ProtectionForm\save
save()
Save submitted protection form.
Definition: ProtectionForm.php:316
ProtectionForm\$mRestrictions
array $mRestrictions
A map of action to restriction level, from request or default.
Definition: ProtectionForm.php:35
ProtectionForm\$disabled
bool $disabled
Definition: ProtectionForm.php:71
Article\getTitle
getTitle()
Get the title object of the article.
Definition: Article.php:213
ProtectionForm\showLogExtract
showLogExtract()
Show protection long extracts for this page.
Definition: ProtectionForm.php:629
ProtectionForm\$mTitle
Title $mTitle
Definition: ProtectionForm.php:68
ProtectionForm\getOptionLabel
getOptionLabel( $permission)
Prepare the label for a protection selector option.
Definition: ProtectionForm.php:613
ProtectionForm\$mCascade
bool $mCascade
True if the restrictions are cascading, from request or existing protection.
Definition: ProtectionForm.php:44
LogPage
Class to simplify the use of log pages.
Definition: LogPage.php:37
Xml\element
static element( $element, $attribs=null, $contents='', $allowShortTag=true)
Format an XML element with given attributes and, optionally, text content.
Definition: Xml.php:41
Article\getContext
getContext()
Gets the context this Article is executed in.
Definition: Article.php:2324
ProtectionForm\$hookRunner
HookRunner $hookRunner
Definition: ProtectionForm.php:95
$title
$title
Definition: testCompression.php:38
ProtectionForm\$mApplicableTypes
array $mApplicableTypes
Types (i.e.
Definition: ProtectionForm.php:59
ProtectionForm\execute
execute()
Main entry point for action=protect and action=unprotect.
Definition: ProtectionForm.php:222
LogEventsList\showLogExtract
static showLogExtract(&$out, $types=[], $page='', $user='', $param=[])
Show log extract.
Definition: LogEventsList.php:602
wfTimestampNow
wfTimestampNow()
Convenience function; returns MediaWiki timestamp for the present time.
Definition: GlobalFunctions.php:1861
OutputPage
This is one of the Core classes and should be read at least once by any new developers.
Definition: OutputPage.php:50
ProtectionForm\$mLang
Language $mLang
Definition: ProtectionForm.php:86
MediaWiki\Permissions\PermissionManager
A service class for checking permissions To obtain an instance, use MediaWikiServices::getInstance()-...
Definition: PermissionManager.php:51
ProtectionForm\show
show( $err=null)
Show the input form with optional error message.
Definition: ProtectionForm.php:246
WatchAction\doWatchOrUnwatch
static doWatchOrUnwatch( $watch, Title $title, Authority $performer, string $expiry=null)
Watch or unwatch a page.
Definition: WatchAction.php:247
wfIsInfinity
wfIsInfinity( $str)
Determine input string is represents as infinity.
Definition: GlobalFunctions.php:2773
ProtectionForm\$mExistingExpiry
array $mExistingExpiry
Map of action to the expiry time of the existing protection.
Definition: ProtectionForm.php:62
wfEscapeWikiText
wfEscapeWikiText( $text)
Escapes the given text so that it may be output using addWikiText() without any linking,...
Definition: GlobalFunctions.php:1505
ProtectionForm\buildForm
buildForm()
Build the input form.
Definition: ProtectionForm.php:403
IContextSource
Interface for objects which can provide a MediaWiki context on request.
Definition: IContextSource.php:57
WebRequest
The WebRequest class encapsulates getting at data passed in the URL or via a POSTed form stripping il...
Definition: WebRequest.php:42
CommentStore\COMMENT_CHARACTER_LIMIT
const COMMENT_CHARACTER_LIMIT
Maximum length of a comment in UTF-8 characters.
Definition: CommentStore.php:48
Title
Represents a title within MediaWiki.
Definition: Title.php:46
wfReadOnlyReason
wfReadOnlyReason()
Check if the site is in read-only mode and return the message if so.
Definition: GlobalFunctions.php:1148
ProtectionForm\$disabledAttrib
array $disabledAttrib
Definition: ProtectionForm.php:74
ProtectionForm\$permManager
PermissionManager $permManager
Definition: ProtectionForm.php:92
MediaWiki\HookContainer\HookRunner
This class provides an implementation of the core hook interfaces, forwarding hook calls to HookConta...
Definition: HookRunner.php:576
Article
Class for viewing MediaWiki article and history.
Definition: Article.php:47
ProtectionForm\$mRequest
WebRequest $mRequest
Definition: ProtectionForm.php:80
ErrorPageError
An error page which can definitely be safely rendered using the OutputPage.
Definition: ErrorPageError.php:30
User
The User object encapsulates all of the user-specific settings (user_id, name, rights,...
Definition: User.php:66
ProtectionForm\$mReasonSelection
string $mReasonSelection
The reason selected from the list, blank for other/additional.
Definition: ProtectionForm.php:41
HTMLForm\factory
static factory( $displayFormat,... $arguments)
Construct a HTMLForm object for given display type.
Definition: HTMLForm.php:322
Language
Internationalisation code See https://www.mediawiki.org/wiki/Special:MyLanguage/Localisation for more...
Definition: Language.php:43
Xml\listDropDownOptions
static listDropDownOptions( $list, $params=[])
Build options for a drop-down box from a textual list.
Definition: Xml.php:545
OutputPage\setRobotPolicy
setRobotPolicy( $policy)
Set the robot policy for the page: http://www.robotstxt.org/meta.html
Definition: OutputPage.php:871
ProtectionForm\$mPermErrors
array $mPermErrors
Permissions errors for the protect action.
Definition: ProtectionForm.php:56