* Extend language::getLanguageName to return localized language names if available
[lhc/web/wiklou.git] / includes / SkinTemplate.php
index 62d211d..f61104f 100644 (file)
@@ -308,10 +308,10 @@ class SkinTemplate extends Skin {
                                $out->setSquidMaxage(0);
                        }
                } else if (count($newtalks)) {
-                       $sep = str_replace("_", " ", wfMsgHtml("newtalkseperator"));
+                       $sep = str_replace("_", " ", wfMsgHtml("newtalkseparator"));
                        $msgs = array();
                        foreach ($newtalks as $newtalk) {
-                               $msgs[] = wfElement("a",
+                               $msgs[] = Xml::element("a",
                                        array('href' => $newtalk["link"]), $newtalk["wiki"]);
                        }
                        $parts = implode($sep, $msgs);
@@ -416,8 +416,13 @@ class SkinTemplate extends Skin {
                                if ( $nt ) {
                                        $language_urls[] = array(
                                                'href' => $nt->getFullURL(),
-                                               'text' => ($wgContLang->getLanguageName( $nt->getInterwiki()) != ''?$wgContLang->getLanguageName( $nt->getInterwiki()) : $l),
-                                               'class' => $class
+                                               'text' => ( $wgContLang->getLanguageName( $nt->getInterwiki() ) != ''
+                                                       ? $wgContLang->getLanguageName( $nt->getInterwiki() )
+                                                       : $l ),
+                                               'class' => $class,
+                                               'title' => ( $wgLang->getLanguageNameLocalized( $nt->getInterwiki() ) != ''
+                                                       ? $wgLang->getLanguageNameLocalized( $nt->getInterwiki() )
+                                                       : $l )
                                        );
                                }
                        }
@@ -438,7 +443,7 @@ class SkinTemplate extends Skin {
                // XXX: attach this from javascript, same with section editing
                if($this->iseditable && $wgUser->getOption("editondblclick") )
                {
-                       $encEditUrl = wfEscapeJsString( $this->mTitle->getLocalUrl( $this->editUrlOptions() ) );
+                       $encEditUrl = Xml::escapeJsString( $this->mTitle->getLocalUrl( $this->editUrlOptions() ) );
                        $tpl->set('body_ondblclick', 'document.location = "' . $encEditUrl . '";');
                } else {
                        $tpl->set('body_ondblclick', false);
@@ -594,10 +599,9 @@ class SkinTemplate extends Skin {
                if( $selected ) {
                        $classes[] = 'selected';
                }
-               if( $checkEdit && !$title->isAlwaysKnown() && $title->getArticleId() == 0 &&
-                       !($title->getNamespace() == NS_IMAGE && wfFindFile( $title )) ) {
+               if( $checkEdit && !$title->isKnown() ) {
                        $classes[] = 'new';
-                       $query = 'action=edit';
+                       $query = 'action=edit&redlink=1';
                }
 
                $text = wfMsg( $message );
@@ -696,7 +700,7 @@ class SkinTemplate extends Skin {
                                                'href' => $this->mTitle->getLocalUrl( 'action=edit&section=new' )
                                        );
                                }
-                       } elseif ( $this->mTitle->exists() || $this->mTitle->isAlwaysKnown() ) {
+                       } elseif ( $this->mTitle->isKnown() ) {
                                $content_actions['viewsource'] = array(
                                        'class' => ($action == 'edit') ? 'selected' : false,
                                        'text' => wfMsg('viewsource'),
@@ -853,7 +857,7 @@ class SkinTemplate extends Skin {
 
                $nav_urls = array();
                $nav_urls['mainpage'] = array( 'href' => self::makeMainPageUrl() );
-               if( $wgEnableUploads ) {
+               if( $wgEnableUploads && $wgUser->isAllowed( 'upload' ) ) {
                        if ($wgUploadNavigationUrl) {
                                $nav_urls['upload'] = array( 'href' => $wgUploadNavigationUrl );
                        } else {
@@ -880,9 +884,10 @@ class SkinTemplate extends Skin {
 
                        // Also add a "permalink" while we're at it
                        if ( $this->mRevisionId ) {
+                               global $wgScript;
                                $nav_urls['permalink'] = array(
                                        'text' => wfMsg( 'permalink' ),
-                                       'href' => $wgTitle->getLocalURL( "oldid=$this->mRevisionId" )
+                                       'href' => "{$wgScript}?oldid={$this->mRevisionId}"
                                );
                        }