* (bug 3563) Hide the permanent and printable link on empty pages
authorÆvar Arnfjörð Bjarmason <avar@users.mediawiki.org>
Wed, 28 Sep 2005 13:52:22 +0000 (13:52 +0000)
committerÆvar Arnfjörð Bjarmason <avar@users.mediawiki.org>
Wed, 28 Sep 2005 13:52:22 +0000 (13:52 +0000)
includes/SkinTemplate.php

index d2b054a..d29d826 100644 (file)
@@ -775,19 +775,25 @@ class SkinTemplate extends Skin {
                // A print stylesheet is attached to all pages, but nobody ever
                // figures that out. :)  Add a link...
                if( $this->iscontent && ($action == '' || $action == 'view' || $action == 'purge' ) ) {
-                       $nav_urls['print'] = array(
-                               'text' => wfMsg( 'printableversion' ),
-                               'href' => $wgRequest->appendQuery( 'printable=yes' ) );
+                       $revid = $wgArticle->getRevIdFetched();
+                       if ( !( $revid == 0 )  )
+                               $nav_urls['print'] = array(
+                                       'text' => wfMsg( 'printableversion' ),
+                                       'href' => $wgRequest->appendQuery( 'printable=yes' )
+                               );
 
                        // Also add a "permalink" while we're at it
-                       if ( $wgRequest->getInt( 'oldid' ) ) {
+                       if ( (int)$oldid ) {
                                $nav_urls['permalink'] = array(
                                        'text' => wfMsg( 'permalink' ),
-                                       'href' => '' );
+                                       'href' => ''
+                               );
                        } else {
-                               $nav_urls['permalink'] = array(
-                                       'text' => wfMsg( 'permalink' ),
-                                       'href' => $wgTitle->getLocalURL( 'oldid=' . $wgArticle->getRevIdFetched() ) );
+                               if ( !( $revid == 0 )  ) 
+                                       $nav_urls['permalink'] = array(
+                                               'text' => wfMsg( 'permalink' ),
+                                               'href' => $wgTitle->getLocalURL( "oldid=$revid" )
+                                       );
                        }
                }