X-Git-Url: http://git.heureux-cyclage.org/?p=lhc%2Fweb%2Fwiklou.git;a=blobdiff_plain;f=includes%2Fspecials%2FSpecialEditTags.php;h=d11cf64c498e555bdbea4d7ef66b87c4128bd575;hp=476c452ad8a1ed9d59911715adf00284f59f0f7d;hb=5bb72fcaf659dd7a44fb9112e32f99e49fd1a318;hpb=2dd58ade75d15a5895c0c010e17b6f729a0f72fe diff --git a/includes/specials/SpecialEditTags.php b/includes/specials/SpecialEditTags.php index 476c452ad8..d11cf64c49 100644 --- a/includes/specials/SpecialEditTags.php +++ b/includes/specials/SpecialEditTags.php @@ -222,10 +222,12 @@ class SpecialEditTags extends UnlistedSpecialPage { $numRevisions = 0; // Live revisions... $list = $this->getList(); - // @codingStandardsIgnoreStart Generic.CodeAnalysis.ForLoopWithTestFunctionCall.NotAllowed + // phpcs:ignore Generic.CodeAnalysis.ForLoopWithTestFunctionCall for ( $list->reset(); $list->current(); $list->next() ) { - // @codingStandardsIgnoreEnd $item = $list->current(); + if ( !$item->canView() ) { + throw new ErrorPageError( 'permissionserrors', 'tags-update-no-permission' ); + } $numRevisions++; $out->addHTML( $item->getHTML() ); } @@ -240,6 +242,9 @@ class SpecialEditTags extends UnlistedSpecialPage { // 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' ] ) . @@ -252,12 +257,14 @@ class SpecialEditTags extends UnlistedSpecialPage { Xml::label( $this->msg( 'tags-edit-reason' )->text(), 'wpReason' ) . '' . '' . - Xml::input( - 'wpReason', - 60, - $this->reason, - [ 'id' => 'wpReason', 'maxlength' => 100 ] - ) . + Xml::input( 'wpReason', 60, $this->reason, [ + 'id' => 'wpReason', + // HTML maxlength uses "UTF-16 code units", which means that characters outside BMP + // (e.g. emojis) count for two each. This limit is overridden in JS to instead count + // Unicode codepoints (or 255 UTF-8 bytes for old schema). + // "- 155" is to leave room for the auto-generated part of the log entry. + 'maxlength' => $oldCommentSchema ? 100 : CommentStore::COMMENT_CHARACTER_LIMIT - 155, + ] ) . '' . "\n" . '' . @@ -310,9 +317,8 @@ class SpecialEditTags extends UnlistedSpecialPage { // Otherwise, use a multi-select field for adding tags, and a list of // checkboxes for removing them - // @codingStandardsIgnoreStart Generic.CodeAnalysis.ForLoopWithTestFunctionCall.NotAllowed + // phpcs:ignore Generic.CodeAnalysis.ForLoopWithTestFunctionCall for ( $list->reset(); $list->current(); $list->next() ) { - // @codingStandardsIgnoreEnd $currentTags = $list->current()->getTags(); if ( $currentTags ) { $tags = array_merge( $tags, explode( ',', $currentTags ) ); @@ -451,9 +457,8 @@ class SpecialEditTags extends UnlistedSpecialPage { */ protected function failure( $status ) { $this->getOutput()->setPageTitle( $this->msg( 'actionfailed' ) ); - $this->getOutput()->addWikiText( '
' . - $status->getWikiText( 'tags-edit-failure' ) . - '
' + $this->getOutput()->addWikiText( + Html::errorBox( $status->getWikiText( 'tags-edit-failure' ) ) ); $this->showForm(); }