don't just assume we get a valid title object
[lhc/web/wiklou.git] / includes / SkinTemplate.php
index 6c732e8..9aa3b87 100644 (file)
@@ -490,6 +490,7 @@ class SkinTemplate extends Skin {
                }
                if( $checkEdit && $title->getArticleId() == 0 ) {
                        $classes[] = 'new';
+                       $query = 'action=edit';
                }
                return array(
                        'class' => implode( ' ', $classes ),
@@ -540,7 +541,8 @@ class SkinTemplate extends Skin {
                        $content_actions[$nskey] = $this->tabAction(
                                $this->mTitle->getSubjectPage(),
                                $nskey,
-                               !$this->mTitle->isTalkPage() );
+                               !$this->mTitle->isTalkPage(),
+                               '', true);
                        
                        $content_actions['talk'] = $this->tabAction(
                                $this->mTitle->getTalkPage(),
@@ -678,7 +680,7 @@ class SkinTemplate extends Skin {
                        $content_actions['article'] = array(
                                'class' => 'selected',
                                'text' => wfMsg('specialpage'),
-                               'href' => $this->mTitle->getLocalUrl(), // @bug 2457
+                               'href' => $wgRequest->getRequestURL(), // @bug 2457, 2510
                        );
                }
 
@@ -704,53 +706,12 @@ class SkinTemplate extends Skin {
                                $vcount ++;
                        }
                }
-               
-               // 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' ) ) {
-                       $content_actions['print'] = array(
-                               'class' => false,
-                               'text' => wfMsg( 'printableversion' ),
-                               'href' => $wgRequest->appendQuery( 'printable=yes' ) );
-               }
 
                wfProfileOut( $fname );
                return $content_actions;
        }
        
-       /**
-        * Build an array that represents the sidebar(s), the navigation bar among them
-        *
-        * @return array
-        * @access private
-        */ 
-       function buildSidebar() {
-               $fname = 'SkinTemplate::buildSidebar';
-               wfProfileIn( $fname );
-               
-               $bar = array();
-               $lines = explode( "\n", wfMsgForContent( 'sidebar' ) );
-               foreach ($lines as $line) {
-                       if (strpos($line, '*') !== 0)
-                               continue;
-                       if (strpos($line, '**') !== 0) {
-                               $line = trim($line, '* ');
-                               $heading = $line;
-                       } else {
-                               if (strpos($line, '|') !== false) { // sanity check
-                                       $line = explode( '|' , trim($line, '* '), 2 );
-                                       $bar[$heading][] = array(
-                                               'text' => wfMsg( $line[1] ),
-                                               'href' => $this->makeInternalOrExternalUrl( wfMsgForContent( $line[0] ) ),
-                                               'id' => 'n-' . $line[1],
-                                       );
-                               } else { continue; }
-                       }
-               }
-               
-               wfProfileOut( $fname );
-               return $bar;
-       }
+
 
        /**
         * build array of common navigation links
@@ -789,6 +750,15 @@ class SkinTemplate extends Skin {
                }
                $nav_urls['specialpages'] = array('href' => $this->makeSpecialUrl('Specialpages'));
 
+               
+               // 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' ) );
+               }
+               
                if( $this->mTitle->getNamespace() != NS_SPECIAL) {
                        $nav_urls['whatlinkshere'] = array(
                                'href' => $this->makeSpecialUrl("Whatlinkshere/$this->thispage")