now displays system messages in their edit box even if they are not set in the databa...
authorMagnus Manske <magnusmanske@users.mediawiki.org>
Wed, 28 Dec 2005 14:47:30 +0000 (14:47 +0000)
committerMagnus Manske <magnusmanske@users.mediawiki.org>
Wed, 28 Dec 2005 14:47:30 +0000 (14:47 +0000)
includes/Article.php
includes/EditPage.php
includes/GlobalFunctions.php
includes/OutputPage.php

index 79d2919..e91153d 100644 (file)
@@ -106,7 +106,12 @@ class Article {
                        wfProfileOut( $fname );
                        $wgOut->setRobotpolicy( 'noindex,nofollow' );
                        
-                       $ret = wfMsg( $wgUser->isLoggedIn() ? 'noarticletext' : 'noarticletextanon' );
+                       if ( $this->mTitle->getNamespace() == NS_MEDIAWIKI ) {
+                               $ret = wfMsgWeirdKey ( $this->mTitle->getText() ) ;
+                       } else {
+                               $ret = wfMsg( $wgUser->isLoggedIn() ? 'noarticletext' : 'noarticletextanon' );
+                       }
+                       
                        return "<div class='noarticletext'>$ret</div>";
                } else {
                        $this->loadContent( $noredir );
@@ -376,7 +381,7 @@ class Article {
                        $redirect = ($redirect == 'no') ? 'no' : 'yes';
                        $t .= ',redirect='.$redirect;
                }
-               $this->mContent = wfMsg( 'missingarticle', $t );
+               $this->mContent = wfMsg( 'missingarticle', $t ) ;
 
                if( $oldid ) {
                        $revision = Revision::newFromId( $oldid );
@@ -2431,7 +2436,11 @@ class Article {
                # first, see if the page exists at all.
                $exists = $page->getArticleId() != 0;
                if( !$exists ) {
-                       $wgOut->addHTML( wfMsg( $wgUser->isLoggedIn() ? 'noarticletext' : 'noarticletextanon' ) );
+                       if ( $this->mTitle->getNamespace() == NS_MEDIAWIKI ) {
+                               $wgOut->addHTML(wfMsgWeirdKey ( $this->mTitle->getText() ) );
+                       } else {
+                               $wgOut->addHTML(wfMsg( $wgUser->isLoggedIn() ? 'noarticletext' : 'noarticletextanon' ) );
+                       }
                } else {
                        $dbr =& $this->getDB( DB_SLAVE );
                        $wl_clause = array(
index 54f1366..7554022 100644 (file)
@@ -653,6 +653,8 @@ class EditPage {
                $this->edittime = $this->mArticle->getTimestamp();
                $this->textbox1 = $this->mArticle->getContent( true );
                $this->summary = '';
+               if ( !$this->mArticle->exists() && $this->mArticle->mTitle->getNamespace() == NS_MEDIAWIKI )
+                       $this->textbox1 = wfMsgWeirdKey ( $this->mArticle->mTitle->getText() ) ;
                wfProxyCheck();
        }
 
index 7bfa34a..fc1c0cb 100644 (file)
@@ -380,6 +380,25 @@ function wfMsgReal( $key, $args, $useDB, $forContent=false, $transform = true )
        return $message;
 }
 
+/**
+ * This function provides the message source for messages to be edited which are *not* stored in the database
+*/
+
+function wfMsgWeirdKey ( $key ) {
+       $subsource = str_replace ( ' ' , '_' , $key ) ;
+       $source = wfMsg ( $subsource ) ;
+       if ( $source == "&lt;{$subsource}&gt;" ) {
+               # Try again with first char lower case
+               $subsource = strtolower ( substr ( $subsource , 0 , 1 ) ) . substr ( $subsource , 1 ) ;
+               $source = wfMsg ( $subsource ) ;
+       }
+       if ( $source == "&lt;{$subsource}&gt;" ) {
+               # Didn't work either, return blank text
+               $source = "" ;
+       }
+       return $source ;
+}
+
 /**
  * Fetch a message string value, but don't replace any keys yet.
  * @param string $key
index f75c90e..1e03a5c 100644 (file)
@@ -748,7 +748,12 @@ class OutputPage {
 
                if( is_string( $source ) ) {
                        if( strcmp( $source, '' ) == 0 ) {
-                               $source = wfMsg( $wgUser->isLoggedIn() ? 'noarticletext' : 'noarticletextanon' );
+                               global $wgTitle ;
+                               if ( $wgTitle->getNamespace() == NS_MEDIAWIKI ) {
+                                       $source = wfMsgWeirdKey ( $wgTitle->getText() ) ;
+                               } else {
+                                       $source = wfMsg( $wgUser->isLoggedIn() ? 'noarticletext' : 'noarticletextanon' );
+                               }
                        }
                        $rows = $wgUser->getOption( 'rows' );
                        $cols = $wgUser->getOption( 'cols' );