* Not showing " : " in recentchanges if the rcComment is empty
[lhc/web/wiklou.git] / includes / Article.php
index 09c5161..6e5e453 100644 (file)
@@ -81,7 +81,7 @@ class Article {
         * @return Return the text of this revision
        */
        function getContent( $noredir ) {
-               global $wgRequest, $wgUser;
+               global $wgRequest, $wgUser, $wgOut;
 
                # Get variables from query string :P
                $action = $wgRequest->getText( 'action', 'view' );
@@ -93,13 +93,13 @@ class Article {
 
                if ( 0 == $this->getID() ) {
                        if ( 'edit' == $action ) {
-                               wfProfileOut( $fname );                         
+                               wfProfileOut( $fname );
                                # Should we put something in the textarea?
                                # if &preload=Pagename is set, we try to get
                                # the revision text and put it in.
                                if($preload) {
                                        $preloadTitle=Title::newFromText($preload);
-                                       if($preloadTitle->userCanRead()) {
+                                       if(isset($preloadTitle) && $preloadTitle->userCanRead()) {
                                                $rev=Revision::newFromTitle($preloadTitle);
                                                if($rev) {
                                                return $rev->getText();
@@ -109,10 +109,10 @@ class Article {
                                # Don't preload anything.
                                # We used to put MediaWiki:Newarticletext here.
                                # This is now shown above the edit box instead.
-                               return ''; 
+                               return '';
                        }
                        wfProfileOut( $fname );
-                       
+                       $wgOut->setRobotpolicy( 'noindex,nofollow' );
                        return wfMsg( 'noarticletext' );
                } else {
                        $this->loadContent( $noredir );
@@ -833,6 +833,13 @@ class Article {
                wfProfileOut( $fname );
        }
 
+       function render() {
+               global $wgOut;
+
+               $wgOut->setArticleBodyOnly(true);
+               $this->view();
+       }
+
        /**
         * Insert a new empty page record for this article.
         * This *must* be followed up by creating a revision