Let old skins take into account $wgUploadNavigationUrl.
authorDerk-Jan Hartman <hartman@users.mediawiki.org>
Mon, 17 May 2010 15:15:09 +0000 (15:15 +0000)
committerDerk-Jan Hartman <hartman@users.mediawiki.org>
Mon, 17 May 2010 15:15:09 +0000 (15:15 +0000)
Also fixes old skins to take into account the actual uploadrights of users.
Fixes bug 23563

RELEASE-NOTES
includes/Skin.php
skins/CologneBlue.php
skins/Nostalgia.php
skins/Standard.php

index 471bc3c..d6a4160 100644 (file)
@@ -166,6 +166,7 @@ in a negative namespace (which is invalid).
 * Special:Userrights didn't recognize user as changing his/her own rights if user did not capitalize first letter of username.
 * (bug 23507) Add styles for printing wikitables
 * (bug 19586) Avoid JS errors in mwsuggest when using old browsers such as Opera 8.
+* (bug 23563) Old skins now support $wgUploadNavigationUrl and take into account upload rights.
 
 === API changes in 1.17 ===
 * (bug 22738) Allow filtering by action type on query=logevent
index fda45fb..c26a922 100644 (file)
@@ -1988,6 +1988,25 @@ CSS;
                );
        }
 
+       function uploadLink() {
+               global $wgUploadNavigationUrl;
+
+               if( $wgUploadNavigationUrl ) {
+                       $title = Title::newFromText( $wgUploadNavigationUrl );
+               }
+               if( !$title ) {
+                       $title = SpecialPage::getTitleFor('Upload');
+               }
+
+               return $this->link(
+                        $title,
+                        wfMsgHtml( 'upload' ),
+                        array(),
+                        array(),
+                        array( 'known', 'noclasses' )
+                );
+       }
+
        /* these are used extensively in SkinTemplate, but also some other places */
        static function makeMainPageUrl( $urlaction = '' ) {
                $title = Title::newMainPage();
index d12333a..3aabf1c 100644 (file)
@@ -307,8 +307,8 @@ class SkinCologneBlue extends Skin {
                        . $this->specialLink( 'newpages' )
                        . $sep . $this->specialLink( 'listfiles' )
                        . $sep . $this->specialLink( 'statistics' );
-               if ( $wgUser->isLoggedIn() && $wgEnableUploads ) {
-                       $s .= $sep . $this->specialLink( 'upload' );
+               if( UploadBase::isEnabled() && UploadBase::isAllowed( $wgUser ) === true ) {
+                       $s .= $sep . $this->uploadLink();
                }
 
                global $wgSiteSupportPage;
index d4f3f06..c57ea98 100644 (file)
@@ -89,9 +89,10 @@ class SkinNostalgia extends Skin {
                        /* show my preferences link */
                        $s .= $sep . $this->specialLink( 'preferences' );
                        /* show upload file link */
-                       if ( $wgEnableUploads ) {
-                               $s .= $sep . $this->specialLink( 'upload' );
+                       if( UploadBase::isEnabled() && UploadBase::isAllowed( $wgUser ) === true ) {
+                               $s .= $sep . $this->uploadLink();
                        }
+
                        /* show log out link */
                        $s .= $sep . $this->specialLink( 'userlogout' );
                }
index e57cfaf..4942729 100644 (file)
@@ -264,9 +264,10 @@ class SkinStandard extends Skin {
                        $s .= "\n<br /><hr class='sep' />";
                }
 
-               if ( $wgUser->isLoggedIn() && ( $wgEnableUploads || $wgRemoteUploads ) ) {
-                       $s .= $this->specialLink( 'upload' ) . $sep;
+               if( UploadBase::isEnabled() && UploadBase::isAllowed( $wgUser ) === true ) {
+                       $s .= $this->uploadLink() . $sep;
                }
+
                $s .= $this->specialLink( 'specialpages' );
 
                global $wgSiteSupportPage;