Protected function UploadBase->validateName changed to public
[lhc/web/wiklou.git] / includes / EditPage.php
index ce8077d..5434dab 100644 (file)
@@ -546,8 +546,8 @@ class EditPage {
                        // Standard preference behaviour
                        return true;
                } elseif ( !$this->mTitle->exists() &&
-                 isset( $wgPreviewOnOpenNamespaces[$this->mTitle->getNamespace()] ) &&
-                 $wgPreviewOnOpenNamespaces[$this->mTitle->getNamespace()] )
+                       isset( $wgPreviewOnOpenNamespaces[$this->mTitle->getNamespace()] ) &&
+                       $wgPreviewOnOpenNamespaces[$this->mTitle->getNamespace()] )
                {
                        // Categories are special
                        return true;
@@ -624,11 +624,8 @@ class EditPage {
                                wfProfileOut( get_class( $this ) . "::importContentFormData" );
                        }
 
-                       # Trim spaces on user supplied text
-                       $summary = trim( $request->getText( 'wpSummary' ) );
-
                        # Truncate for whole multibyte characters
-                       $this->summary = $wgContLang->truncate( $summary, 255 );
+                       $this->summary = $wgContLang->truncate( $request->getText( 'wpSummary' ), 255 );
 
                        # If the summary consists of a heading, e.g. '==Foobar==', extract the title from the
                        # header syntax, e.g. 'Foobar'. This is mainly an issue when we are using wpSummary for
@@ -1162,7 +1159,7 @@ class EditPage {
                                return false;
 
                        case self::AS_PARSE_ERROR:
-                               $wgOut->addWikiText( '<div class="error">' . $status->getWikiText() . '</div>');
+                               $wgOut->addWikiText( '<div class="error">' . $status->getWikiText() . '</div>' );
                                return true;
 
                        case self::AS_SUCCESS_NEW_ARTICLE:
@@ -1508,7 +1505,7 @@ class EditPage {
                                                $this->isConflict = false;
                                                wfDebug( __METHOD__ . ": conflict suppressed; new section\n" );
                                        }
-                               } elseif ( $this->section == '' && Revision::userWasLastToEdit( DB_MASTER,  $this->mTitle->getArticleID(),
+                               } elseif ( $this->section == '' && Revision::userWasLastToEdit( DB_MASTER, $this->mTitle->getArticleID(),
                                                        $wgUser->getId(), $this->edittime ) ) {
                                        # Suppress edit conflict with self, except for section edits where merging is required.
                                        wfDebug( __METHOD__ . ": Suppressing edit conflict, same user.\n" );
@@ -1715,7 +1712,7 @@ class EditPage {
         * @return bool
         * @deprecated since 1.21, use mergeChangesIntoContent() instead
         */
-       function mergeChangesInto( &$editText ){
+       function mergeChangesInto( &$editText ) {
                ContentHandler::deprecated( __METHOD__, "1.21" );
 
                $editContent = $this->toEditContent( $editText );
@@ -1740,7 +1737,7 @@ class EditPage {
         *
         * @return bool
         */
-       private function mergeChangesIntoContent( &$editContent ){
+       private function mergeChangesIntoContent( &$editContent ) {
                wfProfileIn( __METHOD__ );
 
                $db = wfGetDB( DB_MASTER );
@@ -2197,7 +2194,7 @@ class EditPage {
                        } catch ( MWContentSerializationException $ex ) {
                                // this can't really happen, but be nice if it does.
                                $msg = wfMessage( 'content-failed-to-parse', $this->contentModel, $this->contentFormat, $ex->getMessage() );
-                               $wgOut->addWikiText( '<div class="error">' . $msg->text() . '</div>');
+                               $wgOut->addWikiText( '<div class="error">' . $msg->text() . '</div>' );
                        }
                }
 
@@ -2453,6 +2450,8 @@ class EditPage {
         * @return String
         */
        protected function getSummaryPreview( $isSubjectPreview, $summary = "" ) {
+               // avoid spaces in preview, gets always trimmed on save
+               $summary = trim( $summary );
                if ( !$summary || ( !$this->preview && !$this->diff ) ) {
                        return "";
                }
@@ -2616,7 +2615,7 @@ HTML
                                $this->showDiff();
                        } catch ( MWContentSerializationException $ex ) {
                                $msg = wfMessage( 'content-failed-to-parse', $this->contentModel, $this->contentFormat, $ex->getMessage() );
-                               $wgOut->addWikiText( '<div class="error">' . $msg->text() . '</div>');
+                               $wgOut->addWikiText( '<div class="error">' . $msg->text() . '</div>' );
                        }
                }
        }
@@ -2888,21 +2887,24 @@ HTML
                $dbr = wfGetDB( DB_SLAVE );
                $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' ),
-                       array( 'log_namespace' => $this->mTitle->getNamespace(),
-                                  'log_title' => $this->mTitle->getDBkey(),
-                                  'log_type' => 'delete',
-                                  'log_action' => 'delete',
-                                  'user_id=log_user' ),
+                       array(
+                               'log_type',
+                               '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'
+                       ),
                        __METHOD__,
                        array( 'LIMIT' => 1, 'ORDER BY' => 'log_timestamp DESC' )
                );
@@ -2957,13 +2959,13 @@ HTML
 
                        if ( $this->mTriedSave && !$this->mTokenOk ) {
                                if ( $this->mTokenOkExceptSuffix ) {
-                                       $note = wfMessage( 'token_suffix_mismatch' )->plain() ;
+                                       $note = wfMessage( 'token_suffix_mismatch' )->plain();
 
                                } else {
-                                       $note = wfMessage( 'session_fail_preview' )->plain() ;
+                                       $note = wfMessage( 'session_fail_preview' )->plain();
                                }
                        } elseif ( $this->incompleteForm ) {
-                               $note = wfMessage( 'edit_form_incomplete' )->plain() ;
+                               $note = wfMessage( 'edit_form_incomplete' )->plain();
                        } else {
                                $note = wfMessage( 'previewnote' )->plain() .
                                        ' [[#' . self::EDITFORM_ID . '|' . $wgLang->getArrow() . ' ' . wfMessage( 'continue-editing' )->text() . ']]';
@@ -2972,7 +2974,7 @@ HTML
                        $parserOptions = $this->mArticle->makeParserOptions( $this->mArticle->getContext() );
                        $parserOptions->setEditSection( false );
                        $parserOptions->setIsPreview( true );
-                       $parserOptions->setIsSectionPreview( !is_null($this->section) && $this->section !== '' );
+                       $parserOptions->setIsSectionPreview( !is_null( $this->section ) && $this->section !== '' );
 
                        # don't parse non-wikitext pages, show message about preview
                        if ( $this->mTitle->isCssJsSubpage() || $this->mTitle->isCssOrJsPage() ) {
@@ -2995,7 +2997,7 @@ HTML
                                # Used messages to make sure grep find them:
                                # Messages: usercsspreview, userjspreview, sitecsspreview, sitejspreview
                                if( $level && $format ) {
-                                       $note = "<div id='mw-{$level}{$format}preview'>" . wfMessage( "{$level}{$format}preview" )->text()  . "</div>";
+                                       $note = "<div id='mw-{$level}{$format}preview'>" . wfMessage( "{$level}{$format}preview" )->text() . "</div>";
                                }
                        }
 
@@ -3031,7 +3033,7 @@ HTML
                                }
                        }
                } catch ( MWContentSerializationException $ex ) {
-                       $m = wfMessage('content-failed-to-parse', $this->contentModel, $this->contentFormat, $ex->getMessage() );
+                       $m = wfMessage( 'content-failed-to-parse', $this->contentModel, $this->contentFormat, $ex->getMessage() );
                        $note .= "\n\n" . $m->parse();
                        $previewHTML = '';
                }
@@ -3454,7 +3456,7 @@ HTML
                global $wgOut, $wgLang;
                $this->textbox2 = $this->textbox1;
 
-               if( is_array( $match ) ){
+               if( is_array( $match ) ) {
                        $match = $wgLang->listToText( $match );
                }
                $wgOut->prepareErrorPage( wfMessage( 'spamprotectiontitle' ) );