Oops, forgot to change this in r71426
[lhc/web/wiklou.git] / includes / EditPage.php
index be4fe77..a362dd7 100644 (file)
  * usually the same, but they are now allowed to be different.
  */
 class EditPage {
-       const AS_SUCCESS_UPDATE                    = 200;
-       const AS_SUCCESS_NEW_ARTICLE       = 201;
-       const AS_HOOK_ERROR                                = 210;
-       const AS_FILTERING                                 = 211;
-       const AS_HOOK_ERROR_EXPECTED       = 212;
-       const AS_BLOCKED_PAGE_FOR_USER     = 215;
-       const AS_CONTENT_TOO_BIG                   = 216;
-       const AS_USER_CANNOT_EDIT                  = 217;
-       const AS_READ_ONLY_PAGE_ANON       = 218;
-       const AS_READ_ONLY_PAGE_LOGGED     = 219;
-       const AS_READ_ONLY_PAGE                    = 220;
-       const AS_RATE_LIMITED                      = 221;
-       const AS_ARTICLE_WAS_DELETED       = 222;
-       const AS_NO_CREATE_PERMISSION      = 223;
-       const AS_BLANK_ARTICLE                     = 224;
-       const AS_CONFLICT_DETECTED                 = 225;
-       const AS_SUMMARY_NEEDED                    = 226;
-       const AS_TEXTBOX_EMPTY                     = 228;
+       const AS_SUCCESS_UPDATE            = 200;
+       const AS_SUCCESS_NEW_ARTICLE       = 201;
+       const AS_HOOK_ERROR                = 210;
+       const AS_FILTERING                 = 211;
+       const AS_HOOK_ERROR_EXPECTED       = 212;
+       const AS_BLOCKED_PAGE_FOR_USER     = 215;
+       const AS_CONTENT_TOO_BIG           = 216;
+       const AS_USER_CANNOT_EDIT          = 217;
+       const AS_READ_ONLY_PAGE_ANON       = 218;
+       const AS_READ_ONLY_PAGE_LOGGED     = 219;
+       const AS_READ_ONLY_PAGE            = 220;
+       const AS_RATE_LIMITED              = 221;
+       const AS_ARTICLE_WAS_DELETED       = 222;
+       const AS_NO_CREATE_PERMISSION      = 223;
+       const AS_BLANK_ARTICLE             = 224;
+       const AS_CONFLICT_DETECTED         = 225;
+       const AS_SUMMARY_NEEDED            = 226;
+       const AS_TEXTBOX_EMPTY             = 228;
        const AS_MAX_ARTICLE_SIZE_EXCEEDED = 229;
-       const AS_OK                                                = 230;
-       const AS_END                                       = 231;
-       const AS_SPAM_ERROR                                = 232;
-       const AS_IMAGE_REDIRECT_ANON       = 233;
-       const AS_IMAGE_REDIRECT_LOGGED     = 234;
+       const AS_OK                        = 230;
+       const AS_END                       = 231;
+       const AS_SPAM_ERROR                = 232;
+       const AS_IMAGE_REDIRECT_ANON       = 233;
+       const AS_IMAGE_REDIRECT_LOGGED     = 234;
 
        var $mArticle;
        var $mTitle;
@@ -143,7 +143,6 @@ class EditPage {
                        if ( $this->mTitle->getNamespace() == NS_MEDIAWIKI ) {
                                # If this is a system message, get the default text.
                                list( $message, $lang ) = $wgMessageCache->figureMessage( $wgContLang->lcfirst( $this->mTitle->getText() ) );
-                               $wgMessageCache->loadAllMessages( $lang );
                                $text = wfMsgGetKey( $message, false, $lang, false );
                                if( wfEmptyMsg( $message, $text ) )
                                        $text = $this->getPreloadedText( $preload );
@@ -287,7 +286,7 @@ class EditPage {
         *
         * The edit form is self-submitting, so that when things like
         * preview and edit conflicts occur, we get the same form back
-        * with the extra stuff added.  Only when the final submission
+        * with the extra stuff added.  Only when the final submission
         * is made and all is well do we actually save and redirect to
         * the newly-edited page.
         */
@@ -360,9 +359,9 @@ class EditPage {
 
                $this->isConflict = false;
                // css / js subpages of user pages get a special treatment
-               $this->isCssJsSubpage      = $this->mTitle->isCssJsSubpage();
-               $this->isCssSubpage                = $this->mTitle->isCssSubpage();
-               $this->isJsSubpage                 = $this->mTitle->isJsSubpage();
+               $this->isCssJsSubpage      = $this->mTitle->isCssJsSubpage();
+               $this->isCssSubpage        = $this->mTitle->isCssSubpage();
+               $this->isJsSubpage         = $this->mTitle->isJsSubpage();
                $this->isValidCssJsSubpage = $this->mTitle->isValidCssJsSubpage();
 
                # Show applicable editing introductions
@@ -374,9 +373,9 @@ class EditPage {
                }
 
                # Optional notices on a per-namespace and per-page basis
-               $editnotice_ns   = 'editnotice-'.$this->mTitle->getNamespace();
+               $editnotice_ns   = 'editnotice-'.$this->mTitle->getNamespace();
                if ( !wfEmptyMsg( $editnotice_ns, wfMsgForContent( $editnotice_ns ) ) ) {
-                       $wgOut->addWikiText( wfMsgForContent( $editnotice_ns )  );
+                       $wgOut->addWikiText( wfMsgForContent( $editnotice_ns )  );
                }
                if ( MWNamespace::hasSubpages( $this->mTitle->getNamespace() ) ) {
                        $parts = explode( '/', $this->mTitle->getDBkey() );
@@ -389,7 +388,7 @@ class EditPage {
                        }
                }
 
-               # Attempt submission here.      This will check for edit conflicts,
+               # Attempt submission here.  This will check for edit conflicts,
                # and redundantly check for locked database, blocked IPs, etc.
                # that edit() already checked just in case someone tries to sneak
                # in the back door with a hand-edited submission URL.
@@ -591,7 +590,7 @@ class EditPage {
                                $this->starttime = null;
                        }
 
-                       $this->recreate  = $request->getCheck( 'wpRecreate' );
+                       $this->recreate  = $request->getCheck( 'wpRecreate' );
 
                        $this->minoredit = $request->getCheck( 'wpMinoredit' );
                        $this->watchthis = $request->getCheck( 'wpWatchthis' );
@@ -609,17 +608,17 @@ class EditPage {
                } else {
                        # Not a posted form? Start with nothing.
                        wfDebug( __METHOD__ . ": Not a posted form.\n" );
-                       $this->textbox1  = '';
-                       $this->summary   = '';
-                       $this->edittime  = '';
+                       $this->textbox1  = '';
+                       $this->summary   = '';
+                       $this->edittime  = '';
                        $this->starttime = wfTimestampNow();
-                       $this->edit              = false;
-                       $this->preview   = false;
-                       $this->save              = false;
-                       $this->diff              = false;
+                       $this->edit      = false;
+                       $this->preview   = false;
+                       $this->save      = false;
+                       $this->diff      = false;
                        $this->minoredit = false;
                        $this->watchthis = $request->getBool( 'watchthis', false ); // Watch may be overriden by request parameters
-                       $this->recreate  = false;
+                       $this->recreate  = false;
 
                        if ( $this->section == 'new' && $request->getVal( 'preloadtitle' ) ) {
                                $this->summary = $request->getVal( 'preloadtitle' );
@@ -765,10 +764,10 @@ class EditPage {
         * @return one of the constants describing the result
         */
        function internalAttemptSave( &$result, $bot = false ) {
-               global $wgFilterCallback, $wgUser, $wgOut, $wgParser;
+               global $wgFilterCallback, $wgUser, $wgParser;
                global $wgMaxArticleSize;
 
-               wfProfileIn( __METHOD__  );
+               wfProfileIn( __METHOD__  );
                wfProfileIn( __METHOD__ . '-checks' );
 
                if ( !wfRunHooks( 'EditPage::attemptSave', array( $this ) ) ) {
@@ -905,20 +904,11 @@ class EditPage {
 
                        $isComment = ( $this->section == 'new' );
 
-                       $flags = EDIT_NEW | EDIT_DEFER_UPDATES | EDIT_AUTOSUMMARY |
-                               ( $this->minoredit ? EDIT_MINOR : 0 ) |
-                               ( $bot ? EDIT_FORCE_BOT : 0 );
-                       $status = $this->mArticle->doEdit( $this->textbox1, $this->summary, $flags,
-                               false, null, $this->watchthis, $isComment, '', true );
+                       $this->mArticle->insertNewArticle( $this->textbox1, $this->summary,
+                               $this->minoredit, $this->watchthis, false, $isComment, $bot );
 
-                       if ( $status->isOK() ) {
-                               wfProfileOut( __METHOD__ );
-                               return self::AS_SUCCESS_NEW_ARTICLE;
-                       } else {
-                               $result = $status->getErrorsArray();
-                       }
                        wfProfileOut( __METHOD__ );
-                       return self::AS_END;
+                       return self::AS_SUCCESS_NEW_ARTICLE;
                }
 
                # Article exists. Check for edit conflict.
@@ -1026,7 +1016,7 @@ class EditPage {
                                return self::AS_TEXTBOX_EMPTY;
                        }
                        if ( $this->summary != '' ) {
-                               $sectionanchor = $wgParser->guessSectionNameFromWikiText( $this->summary );
+                               $sectionanchor = $wgParser->guessLegacySectionNameFromWikiText( $this->summary );
                                # This is a new section, so create a link to the new section
                                # in the revision summary.
                                $cleanSummary = $wgParser->stripSectionName( $this->summary );
@@ -1040,7 +1030,7 @@ class EditPage {
                        # we can't deal with anchors, includes, html etc in the header for now,
                        # headline would need to be parsed to improve this
                        if ( $hasmatch and strlen( $matches[2] ) > 0 ) {
-                               $sectionanchor = $wgParser->guessSectionNameFromWikiText( $matches[2] );
+                               $sectionanchor = $wgParser->guessLegacySectionNameFromWikiText( $matches[2] );
                        }
                }
                wfProfileOut( __METHOD__ . '-sectionanchor' );
@@ -1060,19 +1050,14 @@ class EditPage {
                        return self::AS_MAX_ARTICLE_SIZE_EXCEEDED;
                }
 
-               // Update the article here
-               $flags = EDIT_UPDATE | EDIT_DEFER_UPDATES | EDIT_AUTOSUMMARY |
-                       ( $this->minoredit ? EDIT_MINOR : 0 ) |
-                       ( $bot ? EDIT_FORCE_BOT : 0 );
-               $status = $this->mArticle->doEdit( $text, $this->summary, $flags,
-                       false, null, $this->watchthis, false, $sectionanchor, true );
-
-               if ( $status->isOK() ) {
+               # update the article here
+               if ( $this->mArticle->updateArticle( $text, $this->summary, $this->minoredit,
+                       $this->watchthis, $bot, $sectionanchor ) )
+               {
                        wfProfileOut( __METHOD__ );
                        return self::AS_SUCCESS_UPDATE;
                } else {
                        $this->isConflict = true;
-                       $result = $status->getErrorsArray();
                }
                wfProfileOut( __METHOD__ );
                return self::AS_END;
@@ -1185,8 +1170,8 @@ class EditPage {
        /**
         * Send the edit form and related headers to $wgOut
         * @param $formCallback Optional callable that takes an OutputPage
-        *                                              parameter; will be called during form output
-        *                                              near the top, for captchas and the like.
+        *                      parameter; will be called during form output
+        *                      near the top, for captchas and the like.
         */
        function showEditForm( $formCallback=null ) {
                global $wgOut, $wgUser, $wgTitle;
@@ -1462,7 +1447,7 @@ HTML
                }
                if ( !$this->mTitle->exists() && $this->mTitle->getRestrictions( 'create' ) ) {
                        LogEventsList::showLogExtract( $wgOut, 'protect', $this->mTitle->getPrefixedText(), '',
-                               array(  'lim' => 1,
+                               array(  'lim' => 1,
                                        'showIfEmpty' => false,
                                        'msgKey' => array( 'titleprotectedwarning' ),
                                        'wrap' => "<div class=\"mw-titleprotectedwarning\">\n$1</div>" ) );
@@ -1526,8 +1511,8 @@ HTML
 
        /**
         * @param $isSubjectPreview Boolean: true if this is the section subject/title
-        *                                                      up top, or false if this is the comment summary
-        *                                                      down below the textarea
+        *                          up top, or false if this is the comment summary
+        *                          down below the textarea
         * @param $summary String: The text of the summary to display
         * @return String
         */
@@ -1550,8 +1535,8 @@ HTML
 
        /**
         * @param $isSubjectPreview Boolean: true if this is the section subject/title
-        *                                                      up top, or false if this is the comment summary
-        *                                                      down below the textarea
+        *                          up top, or false if this is the comment summary
+        *                          down below the textarea
         * @param $summary String: the text of the summary to display
         * @return String
         */
@@ -1815,20 +1800,20 @@ INPUTS
                $data = $dbr->selectRow(
                        array( 'logging', 'user' ),
                        array( 'log_type',
-                                  'log_action',
-                                  'log_timestamp',
-                                  'log_user',
-                                  'log_namespace',
-                                  'log_title',
-                                  'log_comment',
-                                  'log_params',
-                                  'log_deleted',
-                                  'user_name' ),
+                              'log_action',
+                              'log_timestamp',
+                              'log_user',
+                              'log_namespace',
+                              'log_title',
+                              'log_comment',
+                              'log_params',
+                              'log_deleted',
+                              'user_name' ),
                        array( 'log_namespace' => $this->mTitle->getNamespace(),
-                                  'log_title' => $this->mTitle->getDBkey(),
-                                  'log_type' => 'delete',
-                                  'log_action' => 'delete',
-                                  'user_id=log_user' ),
+                              'log_title' => $this->mTitle->getDBkey(),
+                              'log_type' => 'delete',
+                              'log_action' => 'delete',
+                              'user_id=log_user' ),
                        __METHOD__,
                        array( 'LIMIT' => 1, 'ORDER BY' => 'log_timestamp DESC' )
                );
@@ -1847,7 +1832,7 @@ INPUTS
         * @return string
         */
        function getPreviewText() {
-               global $wgOut, $wgUser, $wgTitle, $wgParser, $wgLang, $wgContLang, $wgMessageCache;
+               global $wgOut, $wgUser, $wgParser, $wgMessageCache;
 
                wfProfileIn( __METHOD__ );
 
@@ -2021,7 +2006,7 @@ INPUTS
         *
         * @param $match Text which triggered one or more filters
         */
-       function spamPage( $match = false ) {
+       static function spamPage( $match = false ) {
                global $wgOut, $wgTitle;
 
                $wgOut->setPageTitle( wfMsg( 'spamprotectiontitle' ) );
@@ -2030,8 +2015,9 @@ INPUTS
 
                $wgOut->addHTML( '<div id="spamprotected">' );
                $wgOut->addWikiMsg( 'spamprotectiontext' );
-               if ( $match )
+               if ( $match ) {
                        $wgOut->addWikiMsg( 'spamprotectionmatch', wfEscapeWikiText( $match ) );
+               }
                $wgOut->addHTML( '</div>' );
 
                $wgOut->returnToMain( false, $wgTitle );
@@ -2138,103 +2124,103 @@ INPUTS
                 */
                $toolarray = array(
                        array(
-                               'image'  => $wgLang->getImageFile( 'button-bold' ),
-                               'id'     => 'mw-editbutton-bold',
-                               'open'   => '\'\'\'',
-                               'close'  => '\'\'\'',
+                               'image'  => $wgLang->getImageFile( 'button-bold' ),
+                               'id'     => 'mw-editbutton-bold',
+                               'open'   => '\'\'\'',
+                               'close'  => '\'\'\'',
                                'sample' => wfMsg( 'bold_sample' ),
-                               'tip'    => wfMsg( 'bold_tip' ),
-                               'key'    => 'B'
+                               'tip'    => wfMsg( 'bold_tip' ),
+                               'key'    => 'B'
                        ),
                        array(
-                               'image'  => $wgLang->getImageFile( 'button-italic' ),
-                               'id'     => 'mw-editbutton-italic',
-                               'open'   => '\'\'',
-                               'close'  => '\'\'',
+                               'image'  => $wgLang->getImageFile( 'button-italic' ),
+                               'id'     => 'mw-editbutton-italic',
+                               'open'   => '\'\'',
+                               'close'  => '\'\'',
                                'sample' => wfMsg( 'italic_sample' ),
-                               'tip'    => wfMsg( 'italic_tip' ),
-                               'key'    => 'I'
+                               'tip'    => wfMsg( 'italic_tip' ),
+                               'key'    => 'I'
                        ),
                        array(
-                               'image'  => $wgLang->getImageFile( 'button-link' ),
-                               'id'     => 'mw-editbutton-link',
-                               'open'   => '[[',
-                               'close'  => ']]',
+                               'image'  => $wgLang->getImageFile( 'button-link' ),
+                               'id'     => 'mw-editbutton-link',
+                               'open'   => '[[',
+                               'close'  => ']]',
                                'sample' => wfMsg( 'link_sample' ),
-                               'tip'    => wfMsg( 'link_tip' ),
-                               'key'    => 'L'
+                               'tip'    => wfMsg( 'link_tip' ),
+                               'key'    => 'L'
                        ),
                        array(
-                               'image'  => $wgLang->getImageFile( 'button-extlink' ),
-                               'id'     => 'mw-editbutton-extlink',
-                               'open'   => '[',
-                               'close'  => ']',
+                               'image'  => $wgLang->getImageFile( 'button-extlink' ),
+                               'id'     => 'mw-editbutton-extlink',
+                               'open'   => '[',
+                               'close'  => ']',
                                'sample' => wfMsg( 'extlink_sample' ),
-                               'tip'    => wfMsg( 'extlink_tip' ),
-                               'key'    => 'X'
+                               'tip'    => wfMsg( 'extlink_tip' ),
+                               'key'    => 'X'
                        ),
                        array(
-                               'image'  => $wgLang->getImageFile( 'button-headline' ),
-                               'id'     => 'mw-editbutton-headline',
-                               'open'   => "\n== ",
-                               'close'  => " ==\n",
+                               'image'  => $wgLang->getImageFile( 'button-headline' ),
+                               'id'     => 'mw-editbutton-headline',
+                               'open'   => "\n== ",
+                               'close'  => " ==\n",
                                'sample' => wfMsg( 'headline_sample' ),
-                               'tip'    => wfMsg( 'headline_tip' ),
-                               'key'    => 'H'
+                               'tip'    => wfMsg( 'headline_tip' ),
+                               'key'    => 'H'
                        ),
                        array(
-                               'image'  => $wgLang->getImageFile( 'button-image' ),
-                               'id'     => 'mw-editbutton-image',
-                               'open'   => '[[' . $wgContLang->getNsText( NS_FILE ) . ':',
-                               'close'  => ']]',
+                               'image'  => $wgLang->getImageFile( 'button-image' ),
+                               'id'     => 'mw-editbutton-image',
+                               'open'   => '[[' . $wgContLang->getNsText( NS_FILE ) . ':',
+                               'close'  => ']]',
                                'sample' => wfMsg( 'image_sample' ),
-                               'tip'    => wfMsg( 'image_tip' ),
-                               'key'    => 'D'
+                               'tip'    => wfMsg( 'image_tip' ),
+                               'key'    => 'D'
                        ),
                        array(
-                               'image'  => $wgLang->getImageFile( 'button-media' ),
-                               'id'     => 'mw-editbutton-media',
-                               'open'   => '[[' . $wgContLang->getNsText( NS_MEDIA ) . ':',
-                               'close'  => ']]',
+                               'image'  => $wgLang->getImageFile( 'button-media' ),
+                               'id'     => 'mw-editbutton-media',
+                               'open'   => '[[' . $wgContLang->getNsText( NS_MEDIA ) . ':',
+                               'close'  => ']]',
                                'sample' => wfMsg( 'media_sample' ),
-                               'tip'    => wfMsg( 'media_tip' ),
-                               'key'    => 'M'
+                               'tip'    => wfMsg( 'media_tip' ),
+                               'key'    => 'M'
                        ),
                        array(
-                               'image'  => $wgLang->getImageFile( 'button-math' ),
-                               'id'     => 'mw-editbutton-math',
-                               'open'   => "<math>",
-                               'close'  => "</math>",
+                               'image'  => $wgLang->getImageFile( 'button-math' ),
+                               'id'     => 'mw-editbutton-math',
+                               'open'   => "<math>",
+                               'close'  => "</math>",
                                'sample' => wfMsg( 'math_sample' ),
-                               'tip'    => wfMsg( 'math_tip' ),
-                               'key'    => 'C'
+                               'tip'    => wfMsg( 'math_tip' ),
+                               'key'    => 'C'
                        ),
                        array(
-                               'image'  => $wgLang->getImageFile( 'button-nowiki' ),
-                               'id'     => 'mw-editbutton-nowiki',
-                               'open'   => "<nowiki>",
-                               'close'  => "</nowiki>",
+                               'image'  => $wgLang->getImageFile( 'button-nowiki' ),
+                               'id'     => 'mw-editbutton-nowiki',
+                               'open'   => "<nowiki>",
+                               'close'  => "</nowiki>",
                                'sample' => wfMsg( 'nowiki_sample' ),
-                               'tip'    => wfMsg( 'nowiki_tip' ),
-                               'key'    => 'N'
+                               'tip'    => wfMsg( 'nowiki_tip' ),
+                               'key'    => 'N'
                        ),
                        array(
-                               'image'  => $wgLang->getImageFile( 'button-sig' ),
-                               'id'     => 'mw-editbutton-signature',
-                               'open'   => '--~~~~',
-                               'close'  => '',
+                               'image'  => $wgLang->getImageFile( 'button-sig' ),
+                               'id'     => 'mw-editbutton-signature',
+                               'open'   => '--~~~~',
+                               'close'  => '',
                                'sample' => '',
-                               'tip'    => wfMsg( 'sig_tip' ),
-                               'key'    => 'Y'
+                               'tip'    => wfMsg( 'sig_tip' ),
+                               'key'    => 'Y'
                        ),
                        array(
-                               'image'  => $wgLang->getImageFile( 'button-hr' ),
-                               'id'     => 'mw-editbutton-hr',
-                               'open'   => "\n----\n",
-                               'close'  => '',
+                               'image'  => $wgLang->getImageFile( 'button-hr' ),
+                               'id'     => 'mw-editbutton-hr',
+                               'open'   => "\n----\n",
+                               'close'  => '',
                                'sample' => '',
-                               'tip'    => wfMsg( 'hr_tip' ),
-                               'key'    => 'R'
+                               'tip'    => wfMsg( 'hr_tip' ),
+                               'key'    => 'R'
                        )
                );
                $toolbar = "<div id='toolbar'>\n";
@@ -2274,7 +2260,7 @@ INPUTS
         * @param $tabindex Current tabindex
         * @param $skin Skin object
         * @param $checked Array of checkbox => bool, where bool indicates the checked
-        *                                 status of the checkbox
+        *                 status of the checkbox
         *
         * @return array
         */
@@ -2287,26 +2273,26 @@ INPUTS
                $minorLabel = wfMsgExt( 'minoredit', array( 'parseinline' ) );
                if ( $wgUser->isAllowed( 'minoredit' ) ) {
                        $attribs = array(
-                               'tabindex'      => ++$tabindex,
+                               'tabindex'  => ++$tabindex,
                                'accesskey' => wfMsg( 'accesskey-minoredit' ),
-                               'id'            => 'wpMinoredit',
+                               'id'        => 'wpMinoredit',
                        );
                        $checkboxes['minor'] =
                                Xml::check( 'wpMinoredit', $checked['minor'], $attribs ) .
-                               "&#160;<label for='wpMinoredit'" . $skin->tooltip( 'minoredit', 'withaccess' ) . ">{$minorLabel}</label>";
+                               "&#160;<label for='wpMinoredit' id='mw-editpage-minoredit'" . $skin->tooltip( 'minoredit', 'withaccess' ) . ">{$minorLabel}</label>";
                }
 
                $watchLabel = wfMsgExt( 'watchthis', array( 'parseinline' ) );
                $checkboxes['watch'] = '';
                if ( $wgUser->isLoggedIn() ) {
                        $attribs = array(
-                               'tabindex'      => ++$tabindex,
+                               'tabindex'  => ++$tabindex,
                                'accesskey' => wfMsg( 'accesskey-watch' ),
-                               'id'            => 'wpWatchthis',
+                               'id'        => 'wpWatchthis',
                        );
                        $checkboxes['watch'] =
                                Xml::check( 'wpWatchthis', $checked['watch'], $attribs ) .
-                               "&#160;<label for='wpWatchthis'" . $skin->tooltip( 'watch', 'withaccess' ) . ">{$watchLabel}</label>";
+                               "&#160;<label for='wpWatchthis' id='mw-editpage-watch'" . $skin->tooltip( 'watch', 'withaccess' ) . ">{$watchLabel}</label>";
                }
                wfRunHooks( 'EditPageBeforeEditChecks', array( &$this, &$checkboxes, &$tabindex ) );
                return $checkboxes;
@@ -2324,37 +2310,37 @@ INPUTS
                $buttons = array();
 
                $temp = array(
-                       'id'            => 'wpSave',
-                       'name'          => 'wpSave',
-                       'type'          => 'submit',
-                       'tabindex'      => ++$tabindex,
-                       'value'         => wfMsg( 'savearticle' ),
+                       'id'        => 'wpSave',
+                       'name'      => 'wpSave',
+                       'type'      => 'submit',
+                       'tabindex'  => ++$tabindex,
+                       'value'     => wfMsg( 'savearticle' ),
                        'accesskey' => wfMsg( 'accesskey-save' ),
-                       'title'         => wfMsg( 'tooltip-save' ).' ['.wfMsg( 'accesskey-save' ).']',
+                       'title'     => wfMsg( 'tooltip-save' ).' ['.wfMsg( 'accesskey-save' ).']',
                );
                $buttons['save'] = Xml::element('input', $temp, '');
 
                ++$tabindex; // use the same for preview and live preview
                $temp = array(
-                       'id'            => 'wpPreview',
-                       'name'          => 'wpPreview',
-                       'type'          => 'submit',
-                       'tabindex'      => $tabindex,
-                       'value'         => wfMsg( 'showpreview' ),
+                       'id'        => 'wpPreview',
+                       'name'      => 'wpPreview',
+                       'type'      => 'submit',
+                       'tabindex'  => $tabindex,
+                       'value'     => wfMsg( 'showpreview' ),
                        'accesskey' => wfMsg( 'accesskey-preview' ),
-                       'title'         => wfMsg( 'tooltip-preview' ) . ' [' . wfMsg( 'accesskey-preview' ) . ']',
+                       'title'     => wfMsg( 'tooltip-preview' ) . ' [' . wfMsg( 'accesskey-preview' ) . ']',
                );
                $buttons['preview'] = Xml::element( 'input', $temp, '' );
                $buttons['live'] = '';
 
                $temp = array(
-                       'id'            => 'wpDiff',
-                       'name'          => 'wpDiff',
-                       'type'          => 'submit',
-                       'tabindex'      => ++$tabindex,
-                       'value'         => wfMsg( 'showdiff' ),
+                       'id'        => 'wpDiff',
+                       'name'      => 'wpDiff',
+                       'type'      => 'submit',
+                       'tabindex'  => ++$tabindex,
+                       'value'     => wfMsg( 'showdiff' ),
                        'accesskey' => wfMsg( 'accesskey-diff' ),
-                       'title'         => wfMsg( 'tooltip-diff' ) . ' [' . wfMsg( 'accesskey-diff' ) . ']',
+                       'title'     => wfMsg( 'tooltip-diff' ) . ' [' . wfMsg( 'accesskey-diff' ) . ']',
                );
                $buttons['diff'] = Xml::element( 'input', $temp, '' );
 
@@ -2370,9 +2356,9 @@ INPUTS
         * failure, etc).
         *
         * @todo This doesn't include category or interlanguage links.
-        *               Would need to enhance it a bit, <s>maybe wrap them in XML
-        *               or something...</s> that might also require more skin
-        *               initialization, so check whether that's a problem.
+        *       Would need to enhance it a bit, <s>maybe wrap them in XML
+        *       or something...</s> that might also require more skin
+        *       initialization, so check whether that's a problem.
         */
        function livePreview() {
                global $wgOut;
@@ -2427,7 +2413,7 @@ INPUTS
                $newtext = $this->mArticle->preSaveTransform( $newtext );
                $oldtitle = wfMsgExt( 'currentrev', array( 'parseinline' ) );
                $newtitle = wfMsgExt( 'yourtext', array( 'parseinline' ) );
-               if ( $oldtext !== false  || $newtext != '' ) {
+               if ( $oldtext !== false  || $newtext != '' ) {
                        $de = new DifferenceEngine( $this->mTitle );
                        $de->setText( $oldtext, $newtext );
                        $difftext = $de->getDiff( $oldtitle, $newtitle );
@@ -2587,7 +2573,7 @@ INPUTS
                switch ( $value ) {
                        case self::AS_HOOK_ERROR_EXPECTED:
                        case self::AS_CONTENT_TOO_BIG:
-                       case self::AS_ARTICLE_WAS_DELETED:
+                       case self::AS_ARTICLE_WAS_DELETED:
                        case self::AS_CONFLICT_DETECTED:
                        case self::AS_SUMMARY_NEEDED:
                        case self::AS_TEXTBOX_EMPTY:
@@ -2602,7 +2588,7 @@ INPUTS
                                return false;
 
                        case self::AS_SPAM_ERROR:
-                               $this->spamPage( $resultDetails['spam'] );
+                               self::spamPage( $resultDetails['spam'] );
                                return false;
 
                        case self::AS_BLOCKED_PAGE_FOR_USER:
@@ -2617,22 +2603,22 @@ INPUTS
                                $this->userNotLoggedInPage();
                                return false;
 
-                       case self::AS_READ_ONLY_PAGE_LOGGED:
-                       case self::AS_READ_ONLY_PAGE:
-                               $wgOut->readOnlyPage();
-                               return false;
+                       case self::AS_READ_ONLY_PAGE_LOGGED:
+                       case self::AS_READ_ONLY_PAGE:
+                               $wgOut->readOnlyPage();
+                               return false;
 
-                       case self::AS_RATE_LIMITED:
-                               $wgOut->rateLimited();
-                               return false;
+                       case self::AS_RATE_LIMITED:
+                               $wgOut->rateLimited();
+                               return false;
 
-                       case self::AS_NO_CREATE_PERMISSION:
-                               $this->noCreatePermission();
-                               return;
+                       case self::AS_NO_CREATE_PERMISSION:
+                               $this->noCreatePermission();
+                               return;
 
                        case self::AS_BLANK_ARTICLE:
-                               $wgOut->redirect( $wgTitle->getFullURL() );
-                               return false;
+                               $wgOut->redirect( $wgTitle->getFullURL() );
+                               return false;
 
                        case self::AS_IMAGE_REDIRECT_LOGGED:
                                $wgOut->permissionRequired( 'upload' );