X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2FEditPage.php;h=6ae4371a104b5fc5a0fc24b5aeb9a60b92aa6c47;hb=f5360c82b810a05b35e8de3f983ecf2deea1961a;hp=550a018e5e5202c2c936c5496270f9b165b8a4a7;hpb=b43543acc941633d12b2d26dfea53027bfa079d8;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/EditPage.php b/includes/EditPage.php index 550a018e5e..6ae4371a10 100644 --- a/includes/EditPage.php +++ b/includes/EditPage.php @@ -689,10 +689,6 @@ class EditPage { # checking, etc. if ( $this->formtype == 'initial' || $this->firsttime ) { if ( $this->initialiseForm() === false ) { - $out = $this->context->getOutput(); - if ( $out->getRedirect() === '' ) { // mcrundo hack redirects, don't override it - $this->noSuchSectionPage(); - } return; } @@ -1131,7 +1127,7 @@ class EditPage { * @return string|null */ protected function importContentFormData( &$request ) { - return; // Don't do anything, EditPage already extracted wpTextbox1 + return null; // Don't do anything, EditPage already extracted wpTextbox1 } /** @@ -1145,8 +1141,26 @@ class EditPage { $content = $this->getContentObject( false ); # TODO: track content object?! if ( $content === false ) { + $out = $this->context->getOutput(); + if ( $out->getRedirect() === '' ) { // mcrundo hack redirects, don't override it + $this->noSuchSectionPage(); + } + return false; + } + + if ( !$this->isSupportedContentModel( $content->getModel() ) ) { + $modelMsg = $this->getContext()->msg( 'content-model-' . $content->getModel() ); + $modelName = $modelMsg->exists() ? $modelMsg->text() : $content->getModel(); + + $out = $this->context->getOutput(); + $out->showErrorPage( + 'modeleditnotsupported-title', + 'modeleditnotsupported-text', + $modelName + ); return false; } + $this->textbox1 = $this->toEditText( $content ); $user = $this->context->getUser(); @@ -1785,8 +1799,11 @@ class EditPage { } elseif ( !$status->isOK() ) { # ...or the hook could be expecting us to produce an error // FIXME this sucks, we should just use the Status object throughout + if ( !$status->getErrors() ) { + // Provide a fallback error message if none was set + $status->fatal( 'hookaborted' ); + } $this->hookError = $this->formatStatusErrors( $status ); - $status->fatal( 'hookaborted' ); $status->value = self::AS_HOOK_ERROR_EXPECTED; return false; } @@ -4152,7 +4169,7 @@ ERROR; * - 'legacy-name' (optional): short name for backwards-compatibility * @param array $checked Array of checkbox name (matching the 'legacy-name') => bool, * where bool indicates the checked status of the checkbox - * @return array + * @return array[] */ public function getCheckboxesDefinition( $checked ) { $checkboxes = []; @@ -4447,8 +4464,8 @@ ERROR; protected function addPageProtectionWarningHeaders() { $out = $this->context->getOutput(); if ( $this->mTitle->isProtected( 'edit' ) && - MediaWikiServices::getInstance()->getNamespaceInfo()->getRestrictionLevels( - $this->mTitle->getNamespace() + MediaWikiServices::getInstance()->getPermissionManager()->getNamespaceRestrictionLevels( + $this->getTitle()->getNamespace() ) !== [ '' ] ) { # Is the title semi-protected?