function addMetadataLinks( &$out ) {
global $wgTitle, $wgEnableDublinCoreRdf, $wgEnableCreativeCommonsRdf, $wgRdfMimeType, $action;
- global $wgRightsPage, $wgRightsUrl;
+ global $wgRightsPage, $wgRightsUrl, $wgUseTrackbacks;
if( $out->isArticleRelated() ) {
# note: buggy CC software only reads first "meta" link
wfProfileIn( 'Skin::outputPage' );
$this->initPage( $out );
+
$out->out( $out->headElement() );
$out->out( "\n<body" );
$out->out( "<!-- Wiki debugging output:\n" .
$out->mDebugtext . "-->\n" );
}
+
$out->out( $this->beforeContent() );
$out->out( $out->mBodytext . "\n" );
*/
function userCanPreview( $action ) {
global $wgTitle, $wgRequest, $wgUser;
-
+
if( $action != 'submit' )
return false;
if( !$wgRequest->wasPosted() )
return false;
- if( !$wgTitle->userCanEditCssJsSubpage() )
+ 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;
return $s . $this->reallyDoGetUserStyles();
}
-
+
function reallyDoGetUserStyles() {
global $wgUser;
$s = '';
- $underline = $wgUser->getOption( "underline" ) ? 'underline' : 'none';
- $s .= "a { text-decoration: $underline; }\n";
+ if (($undopt = $wgUser->getOption("underline")) != 2) {
+ $underline = $undopt ? 'underline' : 'none';
+ $s .= "a { text-decoration: $underline; }\n";
+ }
if( $wgUser->getOption( 'highlightbroken' ) ) {
$s .= "a.new, #quickbar a.new { color: #CC2200; }\n";
} else {
END;
}
if( $wgUser->getOption( 'justify' ) ) {
- $s .= "#article { text-align: justify; }\n";
+ $s .= "#article, #bodyContent { text-align: justify; }\n";
}
if( !$wgUser->getOption( 'showtoc' ) ) {
$s .= "#toc { display: none; }\n";
}
+ if( !$wgUser->getOption( 'editsection' ) ) {
+ $s .= ".editsection { display: none; }\n";
+ }
return $s;
}
}
else $a = array( 'bgcolor' => '#FFFFFF' );
if($wgOut->isArticle() && $wgUser->getOption('editondblclick') &&
- (!$wgTitle->isProtected() || $wgUser->isAllowed('protect')) ) {
+ $wgTitle->userCanEdit() ) {
$t = wfMsg( 'editthispage' );
$oid = $red = '';
if ( !empty($redirect) && $redirect == 'no' ) {
$red = "&redirect={$redirect}";
}
if ( !empty($oldid) && ! isset( $diff ) ) {
- $oid = "&oldid=" . IntVal( $oldid );
+ $oid = "&oldid=" . intval( $oldid );
}
$s = $wgTitle->getFullURL( "action=edit{$oid}{$red}" );
$s = 'document.location = "' .$s .'";';
return $s;
}
-
+
function getCategoryLinks () {
global $wgOut, $wgTitle, $wgParser;
global $wgUseCategoryMagic, $wgUseCategoryBrowser, $wgLang;
# get a big array of the parents tree
$parenttree = $wgTitle->getParentCategoryTree();
-
- # Render the array as a serie of links
- # Need to give skin cause $this is undefined at this level
- function walkThrough ($tree, &$skin) {
- $return = '';
- foreach($tree as $element => $parent) {
- if(empty($parent)) {
- # element start a new list
- $return .= '<br />';
- } else {
- # grab the others elements
- $return .= walkThrough($parent, $skin);
- }
- # add our current element to the list
- $eltitle = Title::NewFromText($element);
- if(!empty($parent)) $return .= ' > ';
- $return .= $skin->makeLinkObj( $eltitle, $eltitle->getText() ) ;
- }
- return $return;
- }
-
# Skin object passed by reference cause it can not be
- # accessed under the method subfunction walkThrough.
- $s .= walkThrough($parenttree, $this);
+ # accessed under the method subfunction drawCategoryBrowser
+ $tempout = explode("\n", Skin::drawCategoryBrowser($parenttree, $this) );
+ # Clean out bogus first entry and sort them
+ unset($tempout[0]);
+ asort($tempout);
+ # Output one per line
+ $s .= implode("<br />\n", $tempout);
}
return $s;
}
+ /** Render the array as a serie of links.
+ * @param array $tree Categories tree returned by Title::getParentCategoryTree
+ * @param object &skin Skin passed by reference
+ * @return string separated by >, terminate with "\n"
+ */
+ function drawCategoryBrowser($tree, &$skin) {
+ $return = '';
+ foreach ($tree as $element => $parent) {
+ if (empty($parent)) {
+ # element start a new list
+ $return .= "\n";
+ } else {
+ # grab the others elements
+ $return .= Skin::drawCategoryBrowser($parent, $skin) . ' > ';
+ }
+ # add our current element to the list
+ $eltitle = Title::NewFromText($element);
+ $return .= $skin->makeLinkObj( $eltitle, $eltitle->getText() ) ;
+ }
+ return $return;
+ }
+
function getCategories() {
$catlinks=$this->getCategoryLinks();
if(!empty($catlinks)) {
function doAfterContent() { }
function pageTitleLinks() {
- global $wgOut, $wgTitle, $wgUser, $wgContLang, $wgUseApproval, $wgRequest;
+ global $wgOut, $wgTitle, $wgUser, $wgContLang, $wgRequest;
extract( $wgRequest->getValues( 'oldid', 'diff' ) );
$action = $wgRequest->getText( 'action' );
$s .= " | <a href=\"{$link}\"{$style}>{$name}</a>";
}
}
- # This will show the "Approve" link if $wgUseApproval=true;
- if ( isset ( $wgUseApproval ) && $wgUseApproval )
- {
- $t = $wgTitle->getDBkey();
- $name = 'Approve this article' ;
- $link = "http://test.wikipedia.org/w/magnus/wiki.phtml?title={$t}&action=submit&doit=1" ;
- #htmlspecialchars( wfImageUrl( $name ) );
- $style = $this->getExternalLinkAttributes( $link, $name );
- $s .= " | <a href=\"{$link}\"{$style}>{$name}</a>" ;
- }
}
if ( 'history' == $action || isset( $diff ) || isset( $oldid ) ) {
$s .= ' | ' . $this->makeKnownLinkObj( $wgTitle,
# do not show "You have new messages" text when we are viewing our
# own talk page
- if( $wgTitle->equals( $wgUser->getTalkPage() ) ) {
+ if( !$wgTitle->equals( $wgUser->getTalkPage() ) ) {
$tl = $this->makeKnownLinkObj( $wgUser->getTalkPage(),
wfMsg('newmessageslink') );
$s.= ' | <strong>'. wfMsg( 'newmessages', $tl ) . '</strong>';
function getUndeleteLink() {
global $wgUser, $wgTitle, $wgContLang, $action;
- if( $wgUser->isAllowed('rollback') &&
- (($wgTitle->getArticleId() == 0) || ($action == "history")) &&
- ($n = $wgTitle->isDeleted() ) ) {
- return wfMsg( 'thisisdeleted',
+ if( (($wgTitle->getArticleId() == 0) || ($action == "history")) &&
+ ($n = $wgTitle->isDeleted() ) )
+ {
+ if ( $wgUser->isAllowed( 'delete' ) ) {
+ $msg = 'thisisdeleted';
+ } else {
+ $msg = 'viewdeleted';
+ }
+ return wfMsg( $msg,
$this->makeKnownLink(
$wgContLang->SpecialPage( 'Undelete/' . $wgTitle->getPrefixedDBkey() ),
- wfMsg( 'restorelink', $n ) ) );
+ wfMsg( 'restorelink' . ($n == 1 ? '1' : ''), $n ) ) );
}
return '';
}
}
function nameAndLogin() {
- global $wgUser, $wgTitle, $wgLang, $wgContLang, $wgShowIPinHeader, $wgIP;
+ global $wgUser, $wgTitle, $wgLang, $wgContLang, $wgShowIPinHeader;
$li = $wgContLang->specialPage( 'Userlogin' );
$lo = $wgContLang->specialPage( 'Userlogout' );
$s = '';
if ( $wgUser->isAnon() ) {
if( $wgShowIPinHeader && isset( $_COOKIE[ini_get('session.name')] ) ) {
- $n = $wgIP;
+ $n = wfGetIP();
$tl = $this->makeKnownLinkObj( $wgUser->getTalkPage(),
- $wgContLang->getNsText( NS_TALK ) );
+ $wgLang->getNsText( NS_TALK ) );
$s .= $n . ' ('.$tl.')';
} else {
$n = $wgUser->getName();
$rt = $wgTitle->getPrefixedURL();
$tl = $this->makeKnownLinkObj( $wgUser->getTalkPage(),
- $wgContLang->getNsText( NS_TALK ) );
+ $wgLang->getNsText( NS_TALK ) );
$tl = " ({$tl})";
}
function bottomLinks() {
- global $wgOut, $wgUser, $wgTitle;
+ global $wgOut, $wgUser, $wgTitle, $wgUseTrackbacks;
$sep = " |\n";
$s = '';
. $sep . $this->whatLinksHere()
. $sep . $this->watchPageLinksLink();
+ if ($wgUseTrackbacks)
+ $s .= $sep . $this->trackbackLink();
+
if ( $wgTitle->getNamespace() == NS_USER
|| $wgTitle->getNamespace() == NS_USER_TALK )
}
}
}
-
+
$go = wfMsg( 'go' );
$sp = wfMsg( 'specialpages' );
$spp = $wgContLang->specialPage( 'Specialpages' );
$s .= "<select name=\"wpDropdown\">\n";
$s .= "<option value=\"{$spp}\">{$sp}</option>\n";
-
+
foreach ( $a as $name => $desc ) {
$p = $wgContLang->specialPage( $name );
$s .= "<option value=\"{$p}\">{$desc}</option>\n";
# 0 != $id->getEmailauthenticationtimestamp() && # .. which is authenticated
# 1 != $wgUser->getOption('disablemail'); # and not disabled
}
-
+
function emailUserLink() {
global $wgTitle;
}
}
+ function trackbackLink() {
+ global $wgTitle;
+
+ return "<a href=\"" . $wgTitle->trackbackURL() . "\">"
+ . wfMsg('trackbacklink') . "</a>";
+ }
+
function otherLanguages() {
global $wgOut, $wgContLang, $wgTitle, $wgHideInterlanguageLinks;
$title = Title::makeTitle( NS_SPECIAL, $name );
return $title->getLocalURL( $urlaction );
}
-
+
/*static*/ function makeI18nUrl ( $name, $urlaction='' ) {
$title = Title::newFromText( wfMsgForContent($name) );
$this->checkTitle($title, $name);
return $title->getLocalURL( $urlaction );
}
-
+
/*static*/ function makeUrl ( $name, $urlaction='' ) {
$title = Title::newFromText( $name );
$this->checkTitle($title, $name);
# If url string starts with http, consider as external URL, else
# internal
/*static*/ function makeInternalOrExternalUrl( $name ) {
- if ( strncmp( $name, 'http', 4 ) == 0 ) {
+ global $wgUrlProtocols;
+ if ( preg_match( '/^(?:' . $wgUrlProtocols . ')/', $name ) ) {
return $name;
} else {
return $this->makeUrl( $name );
*
* @return array
* @access private
- */
+ */
function buildSidebar() {
$fname = 'SkinTemplate::buildSidebar';
wfProfileIn( $fname );
-
+
$bar = array();
$lines = explode( "\n", wfMsgForContent( 'sidebar' ) );
foreach ($lines as $line) {
$link = wfMsgForContent( $line[0] );
if ($link == '-')
continue;
+ if (wfEmptyMsg($line[1], $text = wfMsg($line[1])))
+ $text = $line[1];
+ if (wfEmptyMsg($line[0], $link))
+ $link = $line[0];
$bar[$heading][] = array(
- 'text' => wfMsg( $line[1] ),
+ 'text' => $text,
'href' => $this->makeInternalOrExternalUrl( $link ),
- 'id' => 'n-' . $line[1],
+ 'id' => 'n-' . strtr($line[1], ' ', '-'),
);
} else { continue; }
}
}
-
+
wfProfileOut( $fname );
return $bar;
}