Follow up r66566. Rename uploadLink() to getUploadLink() per Bryan's comments
[lhc/web/wiklou.git] / skins / CologneBlue.php
index bc4a4c5..1bbbfc2 100644 (file)
@@ -7,8 +7,9 @@
  * @ingroup Skins
  */
 
-if( !defined( 'MEDIAWIKI' ) )
+if( !defined( 'MEDIAWIKI' ) ) {
        die( -1 );
+}
 
 /**
  * @todo document
@@ -25,7 +26,6 @@ class SkinCologneBlue extends Skin {
        }
 
        function doBeforeContent() {
-               $qb = $this->qbSetting();
                $mainPageObj = Title::newMainPage();
 
                $s = "\n<div id='content'>\n<div id='topbar'>" .
@@ -46,7 +46,9 @@ class SkinCologneBlue extends Skin {
                $s .= '<font size="-1"><span id="langlinks">';
                $s .= str_replace( '<br />', '', $this->otherLanguages() );
                $cat = $this->getCategoryLinks();
-               if( $cat ) $s .= "<br />$cat\n";
+               if( $cat ) {
+                       $s .= "<br />$cat\n";
+               }
                $s .= '<br />' . $this->pageTitleLinks();
                $s .= '</span></font>';
 
@@ -110,41 +112,50 @@ class SkinCologneBlue extends Skin {
 
                if ( 2 == $qb ) { # Right
                        $s .= "#quickbar { position: absolute; right: 4px; }\n" .
-                         "#article { margin-left: 4px; margin-right: 148px; }\n";
-               } else if ( 1 == $qb ) {
+                               "#article { margin-left: 4px; margin-right: 148px; }\n";
+               } elseif ( 1 == $qb ) {
                        $s .= "#quickbar { position: absolute; left: 4px; }\n" .
-                         "#article { margin-left: 148px; margin-right: 4px; }\n";
-               } else if ( 3 == $qb ) { # Floating left
+                               "#article { margin-left: 148px; margin-right: 4px; }\n";
+               } elseif ( 3 == $qb ) { # Floating left
                        $s .= "#quickbar { position:absolute; left:4px } \n" .
-                         "#topbar { margin-left: 148px }\n" .
-                         "#article { margin-left:148px; margin-right: 4px; } \n" .
-                         "body>#quickbar { position:fixed; left:4px; top:4px; overflow:auto ;bottom:4px;} \n"; # Hides from IE
-               } else if ( 4 == $qb ) { # Floating right
+                               "#topbar { margin-left: 148px }\n" .
+                               "#article { margin-left:148px; margin-right: 4px; } \n" .
+                               "body>#quickbar { position:fixed; left:4px; top:4px; overflow:auto ;bottom:4px;} \n"; # Hides from IE
+               } elseif ( 4 == $qb ) { # Floating right
                        $s .= "#quickbar { position: fixed; right: 4px; } \n" .
-                         "#topbar { margin-right: 148px }\n" .
-                         "#article { margin-right: 148px; margin-left: 4px; } \n" .
-                         "body>#quickbar { position: fixed; right: 4px; top: 4px; overflow: auto ;bottom:4px;} \n"; # Hides from IE
+                               "#topbar { margin-right: 148px }\n" .
+                               "#article { margin-right: 148px; margin-left: 4px; } \n" .
+                               "body>#quickbar { position: fixed; right: 4px; top: 4px; overflow: auto ;bottom:4px;} \n"; # Hides from IE
                }
                return $s;
        }
 
        function sysLinks() {
                global $wgUser, $wgLang, $wgContLang;
-               $li = $wgContLang->specialPage( 'Userlogin' );
-               $lo = $wgContLang->specialPage( 'Userlogout' );
+               $li = SpecialPage::getTitleFor( 'Userlogin' );
+               $lo = SpecialPage::getTitleFor( 'Userlogout' );
 
                $rt = $this->mTitle->getPrefixedURL();
                if ( 0 == strcasecmp( urlencode( $lo ), $rt ) ) {
-                       $q = '';
+                       $q = array();
                } else {
-                       $q = "returnto={$rt}";
+                       $q = array( 'returnto' => $rt );
                }
 
                $s = array(
                        $this->mainPageLink(),
-                       $this->makeKnownLink( wfMsgForContent( 'aboutpage' ), wfMsg( 'about' ) ),
-                       $this->makeKnownLink( wfMsgForContent( 'helppage' ), wfMsg( 'help' ) ),
-                       $this->makeKnownLink( wfMsgForContent( 'faqpage' ), wfMsg( 'faq' ) ),
+                       $this->linkKnown(
+                               Title::newFromText( wfMsgForContent( 'aboutpage' ) ),
+                               wfMsg( 'about' )
+                       ),
+                       $this->linkKnown(
+                               Title::newFromText( wfMsgForContent( 'helppage' ) ),
+                               wfMsg( 'help' )
+                       ),
+                       $this->linkKnown(
+                               Title::newFromText( wfMsgForContent( 'faqpage' ) ),
+                               wfMsg( 'faq' )
+                       ),
                        $this->specialLink( 'specialpages' )
                );
 
@@ -156,9 +167,19 @@ class SkinCologneBlue extends Skin {
                        $s[] = $this->extensionTabLinks();
                }
                if ( $wgUser->isLoggedIn() ) {
-                       $s[] = $this->makeKnownLink( $lo, wfMsg( 'logout' ), $q );
+                       $s[] = $this->linkKnown(
+                               $lo,
+                               wfMsg( 'logout' ),
+                               array(),
+                               $q
+                       );
                } else {
-                       $s[] = $this->makeKnownLink( $li, wfMsg( 'login' ), $q );
+                       $s[] = $this->linkKnown(
+                               $li,
+                               wfMsg( 'login' ),
+                               array(),
+                               $q
+                       );
                }
 
                return $wgLang->pipeList( $s );
@@ -199,20 +220,23 @@ class SkinCologneBlue extends Skin {
                        $s .= $this->menuHead( 'qbedit' );
                        $s .= '<strong>' . $this->editThisPage() . '</strong>';
 
-                       $s .= $sep . $this->makeKnownLink( wfMsgForContent( 'edithelppage' ), wfMsg( 'edithelp' ) );
+                       $s .= $sep . $this->linkKnown(
+                               Title::newFromText( wfMsgForContent( 'edithelppage' ) ),
+                               wfMsg( 'edithelp' )
+                       );
 
                        if( $wgUser->isLoggedIn() ) {
                                $s .= $sep . $this->moveThisPage();
                        }
                        if ( $wgUser->isAllowed( 'delete' ) ) {
                                $dtp = $this->deleteThisPage();
-                               if ( '' != $dtp ) {
+                               if ( $dtp != '' ) {
                                        $s .= $sep . $dtp;
                                }
                        }
                        if ( $wgUser->isAllowed( 'protect' ) ) {
                                $ptp = $this->protectThisPage();
-                               if ( '' != $ptp ) {
+                               if ( $ptp != '' ) {
                                        $s .= $sep . $ptp;
                                }
                        }
@@ -220,8 +244,8 @@ class SkinCologneBlue extends Skin {
 
                        $s .= $this->menuHead( 'qbpageoptions' );
                        $s .= $this->talkLink()
-                         . $sep . $this->commentLink()
-                         . $sep . $this->printableLink();
+                                       . $sep . $this->commentLink()
+                                       . $sep . $this->printableLink();
                        if ( $wgUser->isLoggedIn() ) {
                                $s .= $sep . $this->watchThisPage();
                        }
@@ -229,9 +253,9 @@ class SkinCologneBlue extends Skin {
                        $s .= $sep;
 
                        $s .= $this->menuHead( 'qbpageinfo' )
-                         . $this->historyLink()
-                         . $sep . $this->whatLinksHere()
-                         . $sep . $this->watchPageLinksLink();
+                                       . $this->historyLink()
+                                       . $sep . $this->whatLinksHere()
+                                       . $sep . $this->watchPageLinksLink();
 
                        if( $tns == NS_USER || $tns == NS_USER_TALK ) {
                                $id = User::idFromName( $this->mTitle->getText() );
@@ -256,44 +280,42 @@ class SkinCologneBlue extends Skin {
                                array( 'known', 'noclasses' )
                        );
                        if ( $wgUser->getNewtalk() ) {
-                               $tl .= " *";
+                               $tl .= ' *';
                        }
 
                        $s .= $this->link(
-                               $wgUser->getUserPage(),
-                               wfMsg( 'mypage' ),
-                               array(),
-                               array(),
-                               array( 'known', 'noclasses' )
-                         )
-                         . $sep . $tl
-                         . $sep . $this->specialLink( 'watchlist' )
-                         . $sep . $this->link(
-                               SpecialPage::getSafeTitleFor( 'Contributions', $wgUser->getName() ),
-                               wfMsg( 'mycontris' ),
-                               array(),
-                               array(),
-                               array( 'known', 'noclasses' )
-                         )
-                         . $sep . $this->specialLink( 'preferences' )
-                         . $sep . $this->specialLink( 'userlogout' );
+                                       $wgUser->getUserPage(),
+                                       wfMsg( 'mypage' ),
+                                       array(),
+                                       array(),
+                                       array( 'known', 'noclasses' )
+                               ) . $sep . $tl . $sep . $this->specialLink( 'watchlist' )
+                                       . $sep .
+                               $this->link(
+                                       SpecialPage::getSafeTitleFor( 'Contributions', $wgUser->getName() ),
+                                       wfMsg( 'mycontris' ),
+                                       array(),
+                                       array(),
+                                       array( 'known', 'noclasses' )
+                               ) . $sep . $this->specialLink( 'preferences' )
+                               . $sep . $this->specialLink( 'userlogout' );
                } else {
                        $s .= $this->specialLink( 'userlogin' );
                }
 
                $s .= $this->menuHead( 'qbspecialpages' )
-                 . $this->specialLink( 'newpages' )
-                 . $sep . $this->specialLink( 'listfiles' )
-                 . $sep . $this->specialLink( 'statistics' );
-               if ( $wgUser->isLoggedIn() && $wgEnableUploads ) {
-                       $s .= $sep . $this->specialLink( 'upload' );
+                       . $this->specialLink( 'newpages' )
+                       . $sep . $this->specialLink( 'listfiles' )
+                       . $sep . $this->specialLink( 'statistics' );
+               if( UploadBase::isEnabled() && UploadBase::isAllowed( $wgUser ) === true ) {
+                       $s .= $sep . $this->getUploadLink();
                }
 
                global $wgSiteSupportPage;
 
                if( $wgSiteSupportPage ) {
                        $s .= $sep . '<a href="' . htmlspecialchars( $wgSiteSupportPage ) . '" class="internal">'
-                             . wfMsg( 'sitesupport' ) . '</a>';
+                                       . wfMsg( 'sitesupport' ) . '</a>';
                }
 
                $s .= $sep . $this->link(
@@ -308,29 +330,30 @@ class SkinCologneBlue extends Skin {
                return $s;
        }
 
-       function menuHead( $key ){
+       function menuHead( $key ) {
                $s = "\n<h6>" . wfMsg( $key ) . "</h6>";
                return $s;
        }
 
-       function searchForm( $label = '' ){
+       function searchForm( $label = '' ) {
                global $wgRequest, $wgUseTwoButtonsSearchForm;
 
                $search = $wgRequest->getText( 'search' );
                $action = $this->escapeSearchLink();
                $s = "<form id=\"searchform{$this->searchboxes}\" method=\"get\" class=\"inline\" action=\"$action\">";
-               if( '' != $label ) {
+               if( $label != '' ) {
                        $s .= "{$label}: ";
                }
 
                $s .= "<input type='text' id=\"searchInput{$this->searchboxes}\" class=\"mw-searchInput\" name=\"search\" size=\"14\" value=\""
-                 . htmlspecialchars( substr( $search, 0, 256 ) ) . "\" /><br />"
-                 . "<input type='submit' id=\"searchGoButton{$this->searchboxes}\" class=\"searchButton\" name=\"go\" value=\"" . htmlspecialchars( wfMsg( 'searcharticle' ) ) . "\" />";
+                       . htmlspecialchars( substr( $search, 0, 256 ) ) . "\" /><br />"
+                       . "<input type='submit' id=\"searchGoButton{$this->searchboxes}\" class=\"searchButton\" name=\"go\" value=\"" . htmlspecialchars( wfMsg( 'searcharticle' ) ) . "\" />";
 
-               if( $wgUseTwoButtonsSearchForm )
+               if( $wgUseTwoButtonsSearchForm ) {
                        $s .= "<input type='submit' id=\"mw-searchButton{$this->searchboxes}\" class=\"searchButton\" name=\"fulltext\" value=\"" . htmlspecialchars( wfMsg( 'search' ) ) . "\" />\n";
-               else
+               } else {
                        $s .= '<div><a href="' . $action . '" rel="search">' . wfMsg( 'powersearch-legend' ) . "</a></div>\n";
+               }
 
                $s .= '</form>';