X-Git-Url: http://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2FSkin.php;h=bdd40ca2c954e33aa0d52f82c69f1f62a89fec3d;hb=e56ab3154a52842eb8e4b235aa2aa5dfa5599c99;hp=482513c88c6a33e3bf4c7cea3c548984ac1cfe97;hpb=da056c312e5758f2ec22e51c70ecf71c10dc4522;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/Skin.php b/includes/Skin.php index 482513c88c..bdd40ca2c9 100644 --- a/includes/Skin.php +++ b/includes/Skin.php @@ -3,6 +3,7 @@ /** * * @package MediaWiki + * @subpackage Skins */ /** @@ -10,30 +11,10 @@ */ if( defined( "MEDIAWIKI" ) ) { -# See skin.doc +# See skin.txt +require_once( 'Linker.php' ); require_once( 'Image.php' ); -# These are the INTERNAL names, which get mapped directly to class names and -# file names in ./skins/. For display purposes, the Language class has -# internationalized names -# -/* -$wgValidSkinNames = array( - 'standard' => 'Standard', - 'nostalgia' => 'Nostalgia', - 'cologneblue' => 'CologneBlue' -); -if( $wgUsePHPTal ) { - #$wgValidSkinNames[] = 'PHPTal'; - #$wgValidSkinNames['davinci'] = 'DaVinci'; - #$wgValidSkinNames['mono'] = 'Mono'; - #$wgValidSkinNames['monobookminimal'] = 'MonoBookMinimal'; - $wgValidSkinNames['monobook'] = 'MonoBook'; - $wgValidSkinNames['myskin'] = 'MySkin'; - $wgValidSkinNames['chick'] = 'Chick'; -} -*/ - # Get a list of all skins available in /skins/ # Build using the regular expression '^(.*).php$' # Array keys are all lower case, array value keep the case used by filename @@ -43,9 +24,9 @@ $skinDir = dir($IP.'/skins'); # while code from www.php.net while (false !== ($file = $skinDir->read())) { - if(preg_match('/^(.*).php$/',$file, $matches)) { + if(preg_match('/^([^.].*)\.php$/',$file, $matches)) { $aSkin = $matches[1]; - $wgValidSkinNames[strtolower($aSkin)] = $aSkin; + $wgValidSkinNames[strtolower($aSkin)] = $aSkin; } } $skinDir->close(); @@ -53,17 +34,6 @@ unset($matches); require_once( 'RecentChange.php' ); -global $wgLinkHolders; -$wgLinkHolders = array( - 'namespaces' => array(), - 'dbkeys' => array(), - 'queries' => array(), - 'texts' => array(), - 'titles' => array() -); -global $wgInterwikiLinkHolders; -$wgInterwikiLinkHolders = array(); - /** * @todo document * @package MediaWiki @@ -90,42 +60,32 @@ class RCCacheEntry extends RecentChange * This base class is also the "Standard" skin. * @package MediaWiki */ -class Skin { +class Skin extends Linker { /**#@+ * @access private */ var $lastdate, $lastline; - var $linktrail ; # linktrail regexp var $rc_cache ; # Cache for Enhanced Recent Changes var $rcCacheIndex ; # Recent Changes Cache Counter for visibility toggle var $rcMoveIndex; - var $postParseLinkColour = false; /**#@-*/ - function Skin() { - $this->linktrail = wfMsg('linktrail'); - } + /** Constructor, call parent constructor */ + function Skin() { parent::Linker(); } function getSkinNames() { global $wgValidSkinNames; return $wgValidSkinNames; } - function getStylesheet() { - return 'common/wikistandard.css'; - } + /** @return string path to the skin stylesheet */ + function getStylesheet() { return 'common/wikistandard.css'; } + /** @return string skin name */ function getSkinName() { return 'standard'; } - /** - * Get/set accessor for delayed link colouring - */ - function postParseLinkColour( $setting = NULL ) { - return wfSetVar( $this->postParseLinkColour, $setting ); - } - function qbSetting() { global $wgOut, $wgUser; @@ -212,16 +172,42 @@ class Skin { } function getHeadScripts() { - global $wgStylePath, $wgUser, $wgContLang, $wgAllowUserJs; - $r = "\n"; - if( $wgAllowUserJs && $wgUser->getID() != 0 ) { # logged in - $userpage = $wgContLang->getNsText( Namespace::getUser() ) . ":" . $wgUser->getName(); - $userjs = htmlspecialchars($this->makeUrl($userpage.'/'.$this->getSkinName().'.js', 'action=raw&ctype=text/javascript')); - $r .= '\n"; + global $wgStylePath, $wgUser, $wgContLang, $wgAllowUserJs, $wgJsMimeType; + $r = "\n"; + if( $wgAllowUserJs && $wgUser->isLoggedIn() ) { + $userpage = $wgUser->getUserPage(); + $userjs = htmlspecialchars( $this->makeUrl( + $userpage->getPrefixedText().'/'.$this->getSkinName().'.js', + 'action=raw&ctype='.$wgJsMimeType)); + $r .= '\n"; } return $r; } + /** + * To make it harder for someone to slip a user a fake + * user-JavaScript or user-CSS preview, a random token + * is associated with the login session. If it's not + * passed back with the preview request, we won't render + * the code. + * + * @param string $action + * @return bool + * @access private + */ + function userCanPreview( $action ) { + global $wgTitle, $wgRequest, $wgUser; + + if( $action != 'submit' ) + return false; + if( !$wgRequest->wasPosted() ) + return false; + if( !$wgTitle->userCanEditCssJsSubpage() ) + return false; + return $wgUser->matchEditToken( + $wgRequest->getVal( 'wpEditToken' ) ); + } + # get the user/site-specific stylesheet, SkinPHPTal called from RawPage.php (settings are cached that way) function getUserStylesheet() { global $wgOut, $wgStylePath, $wgContLang, $wgUser, $wgRequest, $wgTitle, $wgAllowUserCss; @@ -229,12 +215,14 @@ class Skin { $action = $wgRequest->getText('action'); $s = "@import \"$wgStylePath/$sheet\";\n"; if($wgContLang->isRTL()) $s .= "@import \"$wgStylePath/common/common_rtl.css\";\n"; - if( $wgAllowUserCss && $wgUser->getID() != 0 ) { # logged in - if($wgTitle->isCssSubpage() and $action == 'submit' and $wgTitle->userCanEditCssJsSubpage()) { + if( $wgAllowUserCss && $wgUser->isLoggedIn() ) { # logged in + if($wgTitle->isCssSubpage() && $this->userCanPreview( $action ) ) { $s .= $wgRequest->getText('wpTextbox1'); } else { - $userpage = $wgContLang->getNsText( Namespace::getUser() ) . ":" . $wgUser->getName(); - $s.= '@import "'.$this->makeUrl($userpage.'/'.$this->getSkinName().'.css', 'action=raw&ctype=text/css').'";'."\n"; + $userpage = $wgUser->getUserPage(); + $s.= '@import "'.$this->makeUrl( + $userpage->getPrefixedText().'/'.$this->getSkinName().'.css', + 'action=raw&ctype=text/css').'";'."\n"; } } $s .= $this->doGetUserStyles(); @@ -268,19 +256,41 @@ class Skin { $csspage = $wgContLang->getNsText( NS_MEDIAWIKI ) . ':' . $this->getSkinName() . '.css'; $s = '@import "'.$this->makeUrl($csspage, 'action=raw&ctype=text/css')."\";\n"; - if ( 1 == $wgUser->getOption( 'underline' ) ) { - # Don't override browser settings - } else { - # CHECK MERGE @@@ - # Force no underline - $s .= "a { text-decoration: none; }\n"; - } - if ( 1 == $wgUser->getOption( 'highlightbroken' ) ) { + return $s . $this->reallyDoGetUserStyles(); + } + + function reallyDoGetUserStyles() { + global $wgUser; + $s = ''; + $underline = $wgUser->getOption( "underline" ) ? 'underline' : 'none'; + $s .= "a { text-decoration: $underline; }\n"; + if( $wgUser->getOption( 'highlightbroken' ) ) { $s .= "a.new, #quickbar a.new { color: #CC2200; }\n"; + } else { + $s .= <<getOption( 'justify' ) ) { + if( $wgUser->getOption( 'justify' ) ) { $s .= "#article { text-align: justify; }\n"; } + if( !$wgUser->getOption( 'showtoc' ) ) { + $s .= "#toc { display: none; }\n"; + } return $s; } @@ -294,7 +304,7 @@ class Skin { } else $a = array( 'bgcolor' => '#FFFFFF' ); if($wgOut->isArticle() && $wgUser->getOption('editondblclick') && - (!$wgTitle->isProtected() || $wgUser->isSysop()) ) { + (!$wgTitle->isProtected() || $wgUser->isAllowed('protect')) ) { $t = wfMsg( 'editthispage' ); $oid = $red = ''; if ( !empty($redirect) && $redirect == 'no' ) { @@ -309,65 +319,13 @@ class Skin { } $a['onload'] = $wgOut->getOnloadHandler(); - return $a; - } - - function getExternalLinkAttributes( $link, $text, $class='' ) { - global $wgUser, $wgOut, $wgContLang; - - $same = ($link == $text); - $link = urldecode( $link ); - $link = $wgContLang->checkTitleEncoding( $link ); - $link = str_replace( '_', ' ', $link ); - $link = htmlspecialchars( $link ); - - $r = ($class != '') ? " class='$class'" : " class='external'"; - - if ( !$same && $wgUser->getOption( 'hover' ) ) { - $r .= " title=\"{$link}\""; - } - return $r; - } - - function getInternalLinkAttributes( $link, $text, $broken = false ) { - global $wgUser, $wgOut; - - $link = urldecode( $link ); - $link = str_replace( '_', ' ', $link ); - $link = htmlspecialchars( $link ); - - if ( $broken == 'stub' ) { - $r = ' class="stub"'; - } else if ( $broken == 'yes' ) { - $r = ' class="new"'; - } else { - $r = ''; - } - - if ( 1 == $wgUser->getOption( 'hover' ) ) { - $r .= " title=\"{$link}\""; - } - return $r; - } - - /** - * @param bool $broken - */ - function getInternalLinkAttributesObj( &$nt, $text, $broken = false ) { - global $wgUser, $wgOut; - - if ( $broken == 'stub' ) { - $r = ' class="stub"'; - } else if ( $broken == 'yes' ) { - $r = ' class="new"'; - } else { - $r = ''; - } - - if ( 1 == $wgUser->getOption( 'hover' ) ) { - $r .= ' title="' . $nt->getEscapedText() . '"'; + if( $wgUser->getOption( 'editsectiononrightclick' ) ) { + if( $a['onload'] != '' ) { + $a['onload'] .= ';'; + } + $a['onload'] .= 'setupRightClickEdit()'; } - return $r; + return $a; } /** @@ -383,13 +341,11 @@ class Skin { * two functions to make it easier to subclass. */ function beforeContent() { - global $wgUser, $wgOut; - return $this->doBeforeContent(); } function doBeforeContent() { - global $wgUser, $wgOut, $wgTitle, $wgContLang, $wgSiteNotice; + global $wgOut, $wgTitle, $wgContLang; $fname = 'Skin::doBeforeContent'; wfProfileIn( $fname ); @@ -439,8 +395,9 @@ class Skin { $s .= "\n\n\n"; $s .= "\n
\n"; - if( $wgSiteNotice ) { - $s .= "\n
$wgSiteNotice
\n"; + $notice = wfGetSiteNotice(); + if( $notice ) { + $s .= "\n
$notice
\n"; } $s .= $this->pageTitle(); $s .= $this->pageSubtitle() ; @@ -451,7 +408,7 @@ class Skin { function getCategoryLinks () { - global $wgOut, $wgTitle, $wgUser, $wgParser; + global $wgOut, $wgTitle, $wgParser; global $wgUseCategoryMagic, $wgUseCategoryBrowser, $wgLang; if( !$wgUseCategoryMagic ) return '' ; @@ -461,22 +418,21 @@ class Skin { #if( !$wgOut->isArticle() ) return ''; $t = implode ( ' | ' , $wgOut->mCategoryLinks ) ; - $s = $this->makeKnownLink( 'Special:Categories', + $s = $this->makeKnownLinkObj( Title::makeTitle( NS_SPECIAL, 'Categories' ), wfMsg( 'categories' ), 'article=' . urlencode( $wgTitle->getPrefixedDBkey() ) ) . ': ' . $t; # optional 'dmoz-like' category browser. Will be shown under the list # of categories an article belong to if($wgUseCategoryBrowser) { - $s .= '

'; + $s .= '

'; # get a big array of the parents tree - $parenttree = $wgTitle->getCategorieBrowser(); + $parenttree = $wgTitle->getParentCategoryTree(); # Render the array as a serie of links - function walkThrough ($tree) { - global $wgUser; - $sk = $wgUser->getSkin(); + # Need to give skin cause $this is undefined at this level + function walkThrough ($tree, &$skin) { $return = ''; foreach($tree as $element => $parent) { if(empty($parent)) { @@ -484,17 +440,19 @@ class Skin { $return .= '
'; } else { # grab the others elements - $return .= walkThrough($parent); + $return .= walkThrough($parent, $skin); } # add our current element to the list $eltitle = Title::NewFromText($element); - # FIXME : should be makeLink() [AV] - $return .= $sk->makeKnownLink($element, $eltitle->getText()).' > '; + if(!empty($parent)) $return .= ' > '; + $return .= $skin->makeLinkObj( $eltitle, $eltitle->getText() ) ; } return $return; } - $s .= walkThrough($parenttree); + # Skin object passed by reference cause it can not be + # accessed under the method subfunction walkThrough. + $s .= walkThrough($parenttree, $this); } return $s; @@ -511,20 +469,20 @@ class Skin { return " "; } - # This gets called immediately before the tag. - # + /** + * This gets called immediately before the tag. + * @return string HTML to be put after ??? + */ function afterContent() { - global $wgUser, $wgOut, $wgServer; - global $wgTitle, $wgLang; - $printfooter = "
\n" . $this->printFooter() . "
\n"; return $printfooter . $this->doAfterContent(); } + /** @return string Retrievied from HTML text */ function printSource() { global $wgTitle; $url = htmlspecialchars( $wgTitle->getFullURL() ); - return wfMsg( "retrievedfrom", "$url" ); + return wfMsg( 'retrievedfrom', ''.$url.'' ); } function printFooter() { @@ -532,9 +490,8 @@ class Skin { "

\n\n

" . $this->pageStats() . "

\n"; } - function doAfterContent() { - # overloaded by derived classes - } + /** overloaded by derived classes */ + function doAfterContent() { } function pageTitleLinks() { global $wgOut, $wgTitle, $wgUser, $wgContLang, $wgUseApproval, $wgRequest; @@ -549,11 +506,14 @@ class Skin { } if ( $wgOut->isArticleRelated() ) { - if ( $wgTitle->getNamespace() == Namespace::getImage() ) { + if ( $wgTitle->getNamespace() == NS_IMAGE ) { $name = $wgTitle->getDBkey(); - $link = htmlspecialchars( Image::wfImageUrl( $name ) ); - $style = $this->getInternalLinkAttributes( $link, $name ); - $s .= " | {$name}"; + $image = new Image( $wgTitle ); + if( $image->exists() ) { + $link = htmlspecialchars( $image->getURL() ); + $style = $this->getInternalLinkAttributes( $link, $name ); + $s .= " | {$name}"; + } } # This will show the "Approve" link if $wgUseApproval=true; if ( isset ( $wgUseApproval ) && $wgUseApproval ) @@ -567,7 +527,7 @@ class Skin { } } if ( 'history' == $action || isset( $diff ) || isset( $oldid ) ) { - $s .= ' | ' . $this->makeKnownLink( $wgTitle->getPrefixedText(), + $s .= ' | ' . $this->makeKnownLinkObj( $wgTitle, wfMsg( 'currentrev' ) ); } @@ -575,11 +535,8 @@ class Skin { # do not show "You have new messages" text when we are viewing our # own talk page - if(!(strcmp($wgTitle->getText(),$wgUser->getName()) == 0 && - $wgTitle->getNamespace()==Namespace::getTalk(Namespace::getUser()))) { - $n =$wgUser->getName(); - $tl = $this->makeKnownLink( $wgContLang->getNsText( - Namespace::getTalk( Namespace::getUser() ) ) . ":{$n}", + if( $wgTitle->equals( $wgUser->getTalkPage() ) ) { + $tl = $this->makeKnownLinkObj( $wgUser->getTalkPage(), wfMsg('newmessageslink') ); $s.= ' | '. wfMsg( 'newmessages', $tl ) . ''; # disable caching @@ -597,7 +554,7 @@ class Skin { function getUndeleteLink() { global $wgUser, $wgTitle, $wgContLang, $action; - if( $wgUser->isSysop() && + if( $wgUser->isAllowed('rollback') && (($wgTitle->getArticleId() == 0) || ($action == "history")) && ($n = $wgTitle->isDeleted() ) ) { return wfMsg( 'thisisdeleted', @@ -634,7 +591,6 @@ class Skin { global $wgOut, $wgTitle, $wgUser; $s = '

' . htmlspecialchars( $wgOut->getPageTitle() ) . '

'; - if($wgUser->getOption( 'editsectiononrightclick' ) && $wgTitle->userCanEdit()) { $s=$this->editSectionScript($wgTitle, 0,$s);} return $s; } @@ -688,13 +644,12 @@ class Skin { $lo = $wgContLang->specialPage( 'Userlogout' ); $s = ''; - if ( 0 == $wgUser->getID() ) { - if( $wgShowIPinHeader && isset( $_COOKIE[ini_get('session.name')] ) ) { + if ( $wgUser->isAnon() ) { + if( $wgShowIPinHeader && isset( $_COOKIE[ini_get('session.name')] ) ) { $n = $wgIP; - $tl = $this->makeKnownLink( $wgContLang->getNsText( - Namespace::getTalk( Namespace::getUser() ) ) . ":{$n}", - $wgContLang->getNsText( Namespace::getTalk( 0 ) ) ); + $tl = $this->makeKnownLinkObj( $wgUser->getTalkPage(), + $wgContLang->getNsText( NS_TALK ) ); $s .= $n . ' ('.$tl.')'; } else { @@ -706,20 +661,20 @@ class Skin { $q = ''; } else { $q = "returnto={$rt}"; } - $s .= "\n
" . $this->makeKnownLink( $li, - wfMsg( 'login' ), $q ); + $s .= "\n
" . $this->makeKnownLinkObj( + Title::makeTitle( NS_SPECIAL, 'Userlogin' ), + wfMsg( 'login' ), $q ); } else { $n = $wgUser->getName(); $rt = $wgTitle->getPrefixedURL(); - $tl = $this->makeKnownLink( $wgContLang->getNsText( - Namespace::getTalk( Namespace::getUser() ) ) . ":{$n}", - $wgContLang->getNsText( Namespace::getTalk( 0 ) ) ); + $tl = $this->makeKnownLinkObj( $wgUser->getTalkPage(), + $wgContLang->getNsText( NS_TALK ) ); $tl = " ({$tl})"; - $s .= $this->makeKnownLink( $wgContLang->getNsText( - Namespace::getUser() ) . ":{$n}", $n ) . "{$tl}
" . - $this->makeKnownLink( $lo, wfMsg( 'logout' ), + $s .= $this->makeKnownLinkObj( $wgUser->getUserPage(), + $n ) . "{$tl}
" . + $this->makeKnownLinkObj( Title::makeTitle( NS_SPECIAL, 'Userlogout' ), wfMsg( 'logout' ), "returnto={$rt}" ) . ' | ' . $this->specialLink( 'preferences' ); } @@ -766,6 +721,18 @@ class Skin { # Many people don't like this dropdown box #$s .= $sep . $this->specialPagesList(); + /* show links to different language variants */ + global $wgDisableLangConversion, $wgContLang, $wgTitle; + $variants = $wgContLang->getVariants(); + if( !$wgDisableLangConversion && sizeof( $variants ) > 1 ) { + foreach( $variants as $code ) { + $varname = $wgContLang->getVariantname( $code ); + if( $varname == 'disable' ) + continue; + $s .= ' | ' . $varname . ''; + } + } + return $s; } @@ -776,7 +743,7 @@ class Skin { $s = ''; if ( $wgOut->isArticleRelated() ) { $s .= '' . $this->editThisPage() . ''; - if ( 0 != $wgUser->getID() ) { + if ( $wgUser->isLoggedIn() ) { $s .= $sep . $this->watchThisPage(); } $s .= $sep . $this->talkLink() @@ -784,8 +751,8 @@ class Skin { . $sep . $this->whatLinksHere() . $sep . $this->watchPageLinksLink(); - if ( $wgTitle->getNamespace() == Namespace::getUser() - || $wgTitle->getNamespace() == Namespace::getTalk(Namespace::getUser()) ) + if ( $wgTitle->getNamespace() == NS_USER + || $wgTitle->getNamespace() == NS_USER_TALK ) { $id=User::idFromName($wgTitle->getText()); @@ -794,16 +761,15 @@ class Skin { if($id || $ip) { # both anons and non-anons have contri list $s .= $sep . $this->userContribsLink(); } - if ( 0 != $wgUser->getID() ) { # show only to signed in users - if($id) { # can only email non-anons - $s .= $sep . $this->emailUserLink(); - } + if( $this->showEmailUser( $id ) ) { + $s .= $sep . $this->emailUserLink(); } } - if ( $wgUser->isSysop() && $wgTitle->getArticleId() ) { - $s .= "\n
" . $this->deleteThisPage() . - $sep . $this->protectThisPage() . - $sep . $this->moveThisPage(); + if ( $wgTitle->getArticleId() ) { + $s .= "\n
"; + if($wgUser->isAllowed('delete')) { $s .= $this->deleteThisPage(); } + if($wgUser->isAllowed('protect')) { $s .= $sep . $this->protectThisPage(); } + if($wgUser->isAllowed('move')) { $s .= $sep . $this->moveThisPage(); } } $s .= "
\n" . $this->otherLanguages(); } @@ -811,8 +777,8 @@ class Skin { } function pageStats() { - global $wgOut, $wgLang, $wgArticle, $wgRequest; - global $wgDisableCounters, $wgMaxCredits, $wgShowCreditsIfMax; + global $wgOut, $wgLang, $wgArticle, $wgRequest, $wgUser; + global $wgDisableCounters, $wgMaxCredits, $wgShowCreditsIfMax, $wgTitle, $wgPageShowWatchingUsers; extract( $wgRequest->getValues( 'oldid', 'diff' ) ); if ( ! $wgOut->isArticle() ) { return ''; } @@ -828,12 +794,23 @@ class Skin { } if (isset($wgMaxCredits) && $wgMaxCredits != 0) { - require_once("Credits.php"); + require_once('Credits.php'); $s .= ' ' . getCredits($wgArticle, $wgMaxCredits, $wgShowCreditsIfMax); } else { $s .= $this->lastModified(); } + if ($wgPageShowWatchingUsers && $wgUser->getOption( 'shownumberswatching' )) { + $dbr =& wfGetDB( DB_SLAVE ); + extract( $dbr->tableNames( 'watchlist' ) ); + $sql = "SELECT COUNT(*) AS n FROM $watchlist + WHERE wl_title='" . $dbr->strencode($wgTitle->getDBKey()) . + "' AND wl_namespace=" . $wgTitle->getNamespace() ; + $res = $dbr->query( $sql, 'Skin::pageStats'); + $x = $dbr->fetchObject( $res ); + $s .= ' ' . wfMsg('number_of_watching_users_pageview', $x->n ); + } + return $s . ' ' . $this->getCopyright(); } @@ -864,17 +841,19 @@ class Skin { } function getCopyrightIcon() { - global $wgRightsPage, $wgRightsUrl, $wgRightsText, $wgRightsIcon; + global $wgRightsPage, $wgRightsUrl, $wgRightsText, $wgRightsIcon, $wgCopyrightIcon; $out = ''; - if( $wgRightsIcon ) { + if ( isset( $wgCopyrightIcon ) && $wgCopyrightIcon ) { + $out = $wgCopyrightIcon; + } else if ( $wgRightsIcon ) { $icon = htmlspecialchars( $wgRightsIcon ); - if( $wgRightsUrl ) { + if ( $wgRightsUrl ) { $url = htmlspecialchars( $wgRightsUrl ); $out .= ''; } $text = htmlspecialchars( $wgRightsText ); $out .= "$text"; - if( $wgRightsUrl ) { + if ( $wgRightsUrl ) { $out .= ''; } } @@ -889,15 +868,18 @@ class Skin { } function lastModified() { - global $wgLang, $wgArticle; + global $wgLang, $wgArticle, $wgLoadBalancer; $timestamp = $wgArticle->getTimestamp(); if ( $timestamp ) { - $d = $wgLang->timeanddate( $wgArticle->getTimestamp(), true ); + $d = $wgLang->timeanddate( $timestamp, true ); $s = ' ' . wfMsg( 'lastmodified', $d ); } else { $s = ''; } + if ( $wgLoadBalancer->getLaggedSlaveMode() ) { + $s .= ' ' . wfMsg( 'laggedslavemode' ) . ''; + } return $s; } @@ -918,27 +900,34 @@ class Skin { return $s; } + /** + * show a drop-down box of special pages + * @TODO crash bug913. Need to be rewrote completly. + */ function specialPagesList() { - global $wgUser, $wgOut, $wgContLang, $wgServer, $wgRedirectScript; + global $wgUser, $wgOut, $wgContLang, $wgServer, $wgRedirectScript, $wgAvailableRights; require_once('SpecialPage.php'); $a = array(); $pages = SpecialPage::getPages(); + // special pages without access restriction foreach ( $pages[''] as $name => $page ) { $a[$name] = $page->getDescription(); } - if ( $wgUser->isSysop() ) - { - foreach ( $pages['sysop'] as $name => $page ) { - $a[$name] = $page->getDescription(); - } - } - if ( $wgUser->isDeveloper() ) - { - foreach ( $pages['developer'] as $name => $page ) { - $a[$name] = $page->getDescription() ; + + // Other special pages that are restricted. + // Copied from SpecialSpecialpages.php + foreach($wgAvailableRights as $right) { + if( $wgUser->isAllowed($right) ) { + /** Add all pages for this right */ + if(isset($pages[$right])) { + foreach($pages[$right] as $name => $page) { + $a[$name] = $page->getDescription(); + } + } } } + $go = wfMsg( 'go' ); $sp = wfMsg( 'specialpages' ); $spp = $wgContLang->specialPage( 'Specialpages' ); @@ -948,6 +937,7 @@ class Skin { $s .= "