checkPermissions(); $this->checkReadOnly(); $output = $this->getOutput(); $user = $this->getUser(); $request = $this->getRequest(); // Check blocks if ( $user->isBlocked() ) { throw new UserBlockedError( $user->getBlock() ); } $this->setHeaders(); $this->outputHeader(); $this->getOutput()->addModules( [ 'mediawiki.special.edittags', 'mediawiki.special' ] ); $this->submitClicked = $request->wasPosted() && $request->getBool( 'wpSubmit' ); // Handle our many different possible input types $ids = $request->getVal( 'ids' ); if ( !is_null( $ids ) ) { // Allow CSV from the form hidden field, or a single ID for show/hide links $this->ids = explode( ',', $ids ); } else { // Array input $this->ids = array_keys( $request->getArray( 'ids', [] ) ); } $this->ids = array_unique( array_filter( $this->ids ) ); // No targets? if ( count( $this->ids ) == 0 ) { throw new ErrorPageError( 'tags-edit-nooldid-title', 'tags-edit-nooldid-text' ); } $this->typeName = $request->getVal( 'type' ); $this->targetObj = Title::newFromText( $request->getText( 'target' ) ); // sanity check of parameter switch ( $this->typeName ) { case 'logentry': case 'logging': $this->typeName = 'logentry'; break; default: $this->typeName = 'revision'; break; } // Allow the list type to adjust the passed target // Yuck! Copied straight out of SpecialRevisiondelete, but it does exactly // what we want $this->targetObj = RevisionDeleter::suggestTarget( $this->typeName === 'revision' ? 'revision' : 'logging', $this->targetObj, $this->ids ); $this->isAllowed = $user->isAllowed( 'changetags' ); $this->reason = $request->getVal( 'wpReason' ); // We need a target page! if ( is_null( $this->targetObj ) ) { $output->addWikiMsg( 'undelete-header' ); return; } // Give a link to the logs/hist for this page $this->showConvenienceLinks(); // Either submit or create our form if ( $this->isAllowed && $this->submitClicked ) { $this->submit(); } else { $this->showForm(); } // Show relevant lines from the tag log $tagLogPage = new LogPage( 'tag' ); $output->addHTML( "
$1
', "tags-edit-{$this->typeName}-explanation" ); // Show form if the user can submit if ( $this->isAllowed ) { $conf = $this->getConfig(); $oldCommentSchema = $conf->get( 'CommentTableSchemaMigrationStage' ) === MIGRATION_OLD; $form = Xml::openElement( 'form', [ 'method' => 'post', 'action' => $this->getPageTitle()->getLocalURL( [ 'action' => 'submit' ] ), 'id' => 'mw-revdel-form-revisions' ] ) . Xml::fieldset( $this->msg( "tags-edit-{$this->typeName}-legend", count( $this->ids ) )->text() ) . $this->buildCheckBoxes() . Xml::openElement( 'table' ) . "' . $this->msg( 'tags-edit-existing-tags' )->escaped() . ' | '; if ( $tags ) { $html .= $this->getLanguage()->commaList( array_map( 'htmlspecialchars', $tags ) ); } else { $html .= $this->msg( 'tags-edit-existing-tags-none' )->parse(); } $html .= ' | ||
' . $tagSelect[0] . ' | ' . $tagSelect[1];
} else {
// Otherwise, use a multi-select field for adding tags, and a list of
// checkboxes for removing them
// phpcs:ignore Generic.CodeAnalysis.ForLoopWithTestFunctionCall
for ( $list->reset(); $list->current(); $list->next() ) {
$currentTags = $list->current()->getTags();
if ( $currentTags ) {
$tags = array_merge( $tags, explode( ',', $currentTags ) );
}
}
$tags = array_unique( $tags );
$html = '
|