X-Git-Url: http://git.cyclocoop.org/?a=blobdiff_plain;f=includes%2FEditPage.php;h=7115eabdd0478a17938272e0845d12b9e2b46153;hb=688200c607640e77029d171803a7a72832519aa2;hp=33956f60dc303406b711d291138e7601d5de60c5;hpb=c5f80c16251b02a1fcadeebb238e3a917b899acc;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/EditPage.php b/includes/EditPage.php index 33956f60dc..7115eabdd0 100644 --- a/includes/EditPage.php +++ b/includes/EditPage.php @@ -469,9 +469,9 @@ class EditPage { # Ignore some permissions errors when a user is just previewing/viewing diffs $remove = array(); foreach ( $permErrors as $error ) { - if ( ( $this->preview || $this->diff ) && - ( $error[0] == 'blockedtext' || $error[0] == 'autoblockedtext' ) ) - { + if ( ( $this->preview || $this->diff ) + && ( $error[0] == 'blockedtext' || $error[0] == 'autoblockedtext' ) + ) { $remove[] = $error; } } @@ -579,10 +579,10 @@ class EditPage { } elseif ( ( $wgRequest->getVal( 'preload' ) !== null || $this->mTitle->exists() ) && $wgUser->getOption( 'previewonfirst' ) ) { // Standard preference behavior return true; - } elseif ( !$this->mTitle->exists() && - isset( $wgPreviewOnOpenNamespaces[$this->mTitle->getNamespace()] ) && - $wgPreviewOnOpenNamespaces[$this->mTitle->getNamespace()] ) - { + } elseif ( !$this->mTitle->exists() + && isset( $wgPreviewOnOpenNamespaces[$this->mTitle->getNamespace()] ) + && $wgPreviewOnOpenNamespaces[$this->mTitle->getNamespace()] + ) { // Categories are special return true; } else { @@ -741,9 +741,9 @@ class EditPage { $this->watchthis = $request->getCheck( 'wpWatchthis' ); # Don't force edit summaries when a user is editing their own user or talk page - if ( ( $this->mTitle->mNamespace == NS_USER || $this->mTitle->mNamespace == NS_USER_TALK ) && - $this->mTitle->getText() == $wgUser->getName() ) - { + if ( ( $this->mTitle->mNamespace == NS_USER || $this->mTitle->mNamespace == NS_USER_TALK ) + && $this->mTitle->getText() == $wgUser->getName() + ) { $this->allowBlankSummary = true; } else { $this->allowBlankSummary = $request->getBool( 'wpIgnoreBlankSummary' ) || !$wgUser->getOption( 'forceeditsummary' ); @@ -1810,9 +1810,9 @@ class EditPage { // Show the edit conflict page for certain recognized errors from doEdit(), // but don't show it for errors from extension hooks $errors = $doEditStatus->getErrorsArray(); - if ( in_array( $errors[0][0], array( 'edit-gone-missing', 'edit-conflict', - 'edit-already-exists' ) ) ) - { + if ( in_array( $errors[0][0], + array( 'edit-gone-missing', 'edit-conflict', 'edit-already-exists' ) ) + ) { $this->isConflict = true; // Destroys data doEdit() put in $status->value but who cares $doEditStatus->value = self::AS_END; @@ -1931,12 +1931,10 @@ class EditPage { function getBaseRevision() { if ( !$this->mBaseRevision ) { $db = wfGetDB( DB_MASTER ); - $baseRevision = Revision::loadFromTimestamp( + $this->mBaseRevision = Revision::loadFromTimestamp( $db, $this->mTitle, $this->edittime ); - return $this->mBaseRevision = $baseRevision; - } else { - return $this->mBaseRevision; } + return $this->mBaseRevision; } /** @@ -2494,7 +2492,9 @@ class EditPage { } } - if ( $this->mTitle->getNamespace() != NS_MEDIAWIKI && $this->mTitle->isProtected( 'edit' ) ) { + if ( $this->mTitle->isProtected( 'edit' ) && + MWNamespace::getRestrictionLevels( $this->mTitle->getNamespace() ) !== array( '' ) + ) { # Is the title semi-protected? if ( $this->mTitle->isSemiProtected() ) { $noticeMsg = 'semiprotectedpagewarning'; @@ -2696,7 +2696,9 @@ HTML $attribs = array( 'style' => 'display:none;' ); } else { $classes = array(); // Textarea CSS - if ( $this->mTitle->getNamespace() != NS_MEDIAWIKI && $this->mTitle->isProtected( 'edit' ) ) { + if ( $this->mTitle->isProtected( 'edit' ) && + MWNamespace::getRestrictionLevels( $this->mTitle->getNamespace() ) !== array( '' ) + ) { # Is the title semi-protected? if ( $this->mTitle->isSemiProtected() ) { $classes[] = 'mw-textarea-sprotected'; @@ -3238,36 +3240,30 @@ HTML } } - $rt = $content->getRedirectChain(); - if ( $rt ) { - $previewHTML = $this->mArticle->viewRedirect( $rt, false ); - } else { - - # If we're adding a comment, we need to show the - # summary as the headline - if ( $this->section === "new" && $this->summary !== "" ) { - $content = $content->addSectionHeader( $this->summary ); - } + # If we're adding a comment, we need to show the + # summary as the headline + if ( $this->section === "new" && $this->summary !== "" ) { + $content = $content->addSectionHeader( $this->summary ); + } - $hook_args = array( $this, &$content ); - ContentHandler::runLegacyHooks( 'EditPageGetPreviewText', $hook_args ); - wfRunHooks( 'EditPageGetPreviewContent', $hook_args ); + $hook_args = array( $this, &$content ); + ContentHandler::runLegacyHooks( 'EditPageGetPreviewText', $hook_args ); + wfRunHooks( 'EditPageGetPreviewContent', $hook_args ); - $parserOptions->enableLimitReport(); + $parserOptions->enableLimitReport(); - # For CSS/JS pages, we should have called the ShowRawCssJs hook here. - # But it's now deprecated, so never mind + # For CSS/JS pages, we should have called the ShowRawCssJs hook here. + # But it's now deprecated, so never mind - $content = $content->preSaveTransform( $this->mTitle, $wgUser, $parserOptions ); - $parserOutput = $content->getParserOutput( $this->getArticle()->getTitle(), null, $parserOptions ); + $content = $content->preSaveTransform( $this->mTitle, $wgUser, $parserOptions ); + $parserOutput = $content->getParserOutput( $this->getArticle()->getTitle(), null, $parserOptions ); - $previewHTML = $parserOutput->getText(); - $this->mParserOutput = $parserOutput; - $wgOut->addParserOutputNoText( $parserOutput ); + $previewHTML = $parserOutput->getText(); + $this->mParserOutput = $parserOutput; + $wgOut->addParserOutputNoText( $parserOutput ); - if ( count( $parserOutput->getWarnings() ) ) { - $note .= "\n\n" . implode( "\n\n", $parserOutput->getWarnings() ); - } + if ( count( $parserOutput->getWarnings() ) ) { + $note .= "\n\n" . implode( "\n\n", $parserOutput->getWarnings() ); } } catch ( MWContentSerializationException $ex ) { $m = wfMessage( 'content-failed-to-parse', $this->contentModel, $this->contentFormat, $ex->getMessage() );