Typo
[lhc/web/wiklou.git] / includes / EditPage.php
index 65c07e9..4133c0f 100644 (file)
@@ -110,7 +110,7 @@ class EditPage {
         * @private
         */
        function getContent( $def_text = '' ) {
-               global $wgOut, $wgRequest, $wgParser, $wgMessageCache;
+               global $wgOut, $wgRequest, $wgParser, $wgContLang, $wgMessageCache;
 
                wfProfileIn( __METHOD__ );
                # Get variables from query string :P
@@ -124,9 +124,12 @@ class EditPage {
                // For other non-existent articles, use preload text if any.
                if ( !$this->mTitle->exists() ) {
                        if ( $this->mTitle->getNamespace() == NS_MEDIAWIKI ) {
-                               $wgMessageCache->loadAllMessages();
                                # If this is a system message, get the default text.
-                               $text = wfMsgWeirdKey( $this->mTitle->getText() ) ;
+                               list( $message, $lang ) = $wgMessageCache->figureMessage( $wgContLang->lcfirst( $this->mTitle->getText() ) );
+                               $wgMessageCache->loadAllMessages( $lang );
+                               $text = wfMsgGetKey( $message, false, $lang, false );
+                               if( wfEmptyMsg( $message, $text ) )
+                                       $text = '';
                        } else {
                                # If requested, preload some text.
                                $text = $this->getPreloadedText( $preload );
@@ -326,8 +329,8 @@ class EditPage {
                if ( $this->mTitle->isDeleted() ) {
                        $this->lastDelete = $this->getLastDelete();
                        if ( $this->lastDelete ) {
-                               $deletetime = $this->lastDelete->log_timestamp;
-                               if ( ($deletetime - $this->starttime) > 0 ) {
+                               $deleteTime = wfTimestamp( TS_MW, $this->lastDelete->log_timestamp );
+                               if ( $deleteTime > $this->starttime ) {
                                        $this->deletedSinceEdit = true;
                                }
                        }
@@ -1044,11 +1047,8 @@ class EditPage {
         */
        function initialiseForm() {
                $this->edittime = $this->mArticle->getTimestamp();
-               $this->textbox1 = $this->getContent(false);
-               if ( $this->textbox1 === false) return false;
-
-               if ( !$this->mArticle->exists() && $this->mTitle->getNamespace() == NS_MEDIAWIKI )
-                       $this->textbox1 = wfMsgWeirdKey( $this->mTitle->getText() );
+               $this->textbox1 = $this->getContent( false );
+               if ( $this->textbox1 === false ) return false;
                wfProxyCheck();
                return true;
        }
@@ -1175,10 +1175,12 @@ class EditPage {
                } elseif ( $wgUser->isAnon() && $this->formtype != 'preview' ) {
                        $wgOut->wrapWikiMsg( '<div id="mw-anon-edit-warning">$1</div>', 'anoneditwarning' );
                } else {
-                       if ( $this->isCssJsSubpage && $this->formtype != 'preview' ) {
+                       if ( $this->isCssJsSubpage ) {
                                # Check the skin exists
                                if ( $this->isValidCssJsSubpage ) {
-                                       $wgOut->addWikiMsg( 'usercssjsyoucanpreview' );
+                                       if ( $this->formtype !== 'preview' ) {
+                                               $wgOut->addWikiMsg( 'usercssjsyoucanpreview' );
+                                       }
                                } else {
                                        $wgOut->addWikiMsg( 'userinvalidcssjstitle', $wgTitle->getSkinFromCssJsSubpage() );
                                }
@@ -1199,7 +1201,7 @@ class EditPage {
                                $noticeMsg = 'protectedpagewarning';
                                $classes[] = 'mw-textarea-protected';
                        }
-                       $wgOut->addHTML( "<div id='mw-edit-$noticeMsg'>\n" );
+                       $wgOut->addHTML( "<div class='mw-warning-with-logexcerpt'>\n" );
                        $wgOut->addWikiMsg( $noticeMsg );
                        LogEventsList::showLogExtract( $wgOut, 'protect', $this->mTitle->getPrefixedText(), '', 1 );
                        $wgOut->addHTML( "</div>\n" );
@@ -1645,9 +1647,8 @@ END
                                $previewtext = wfMsg('userjspreview');
                        }
                        $parserOptions->setTidy(true);
-                       $parserOutput = $wgParser->parse( $previewtext , $this->mTitle, $parserOptions );
-                       //$wgOut->addHTML( $parserOutput->mText );
-                       $previewHTML = '';
+                       $parserOutput = $wgParser->parse( $previewtext, $this->mTitle, $parserOptions );
+                       $previewHTML = $parserOutput->mText;
                } elseif ( $rt = Title::newFromRedirect( $this->textbox1 ) ) {
                        $previewHTML = $this->mArticle->viewRedirect( $rt, false );
                } else {
@@ -2340,17 +2341,29 @@ END
                global $wgUser;
                $loglist = new LogEventsList( $wgUser->getSkin(), $out );
                $pager = new LogPager( $loglist, 'delete', false, $this->mTitle->getPrefixedText() );
-               if ( $pager->getNumRows() > 0 ) {
-                       $out->addHtml( '<div id="mw-recreate-deleted-warn">' );
+               $count = $pager->getNumRows();
+               if ( $count > 0 ) {
+                       $pager->mLimit = 10;
+                       $out->addHtml( '<div class="mw-warning-with-logexcerpt">' );
                        $out->addWikiMsg( 'recreate-deleted-warn' );
                        $out->addHTML(
                                $loglist->beginLogEventsList() .
                                $pager->getBody() .
                                $loglist->endLogEventsList()
                        );
+                       if($count > 10){
+                               $out->addHtml( $wgUser->getSkin()->link(
+                                       SpecialPage::getTitleFor( 'Log' ),
+                                       wfMsgHtml( 'deletelog-fulllog' ),
+                                       array(),
+                                       array(
+                                               'type' => 'delete',
+                                               'page' => $this->mTitle->getPrefixedText() ) ) );
+                       }
                        $out->addHtml( '</div>' );
                        return true;
                }
+               
                return false;
        }