/**
*
* @package MediaWiki
+ * @subpackage Skins
*/
/**
# See skin.doc
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
var $rc_cache ; # Cache for Enhanced Recent Changes
var $rcCacheIndex ; # Recent Changes Cache Counter for visibility toggle
var $rcMoveIndex;
- var $postParseLinkColour = true;
+ var $postParseLinkColour = false;
/**#@-*/
function Skin() {
- global $wgUseOldExistenceCheck;
- $postParseLinkColour = !$wgUseOldExistenceCheck;
$this->linktrail = wfMsg('linktrail');
}
}
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' ) {
$s .= '<br/><hr/>';
# 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) {
# add our current element to the list
$eltitle = Title::NewFromText($element);
# FIXME : should be makeLink() [AV]
- $return .= $sk->makeKnownLink($element, $eltitle->getText()).' > ';
+ $return .= $sk->makeLink($element, $eltitle->getText()).' > ';
}
return $return;
}
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',
}
}
}
- if ( $wgUser->isSysop() && $wgTitle->getArticleId() ) {
- $s .= "\n<br />" . $this->deleteThisPage() .
- $sep . $this->protectThisPage() .
- $sep . $this->moveThisPage();
+ if ( $wgTitle->getArticleId() ) {
+ $s .= "\n<br />";
+ if($wgUser->isAllowed('delete')) { $s .= $this->deleteThisPage(); }
+ if($wgUser->isAllowed('protect')) { $s .= $sep . $this->protectThisPage(); }
+ if($wgUser->isAllowed('move')) { $s .= $sep . $this->moveThisPage(); }
}
$s .= "<br />\n" . $this->otherLanguages();
}
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;
require_once('SpecialPage.php');
global $wgUser, $wgOut, $wgTitle, $wgRequest;
$diff = $wgRequest->getVal( 'diff' );
- if ( $wgTitle->getArticleId() && ( ! $diff ) && $wgUser->isSysop() ) {
+ if ( $wgTitle->getArticleId() && ( ! $diff ) && $wgUser->isAllowed('delete') ) {
$n = $wgTitle->getPrefixedText();
$t = wfMsg( 'deletethispage' );
global $wgUser, $wgOut, $wgTitle, $wgRequest;
$diff = $wgRequest->getVal( 'diff' );
- if ( $wgTitle->getArticleId() && ( ! $diff ) && $wgUser->isSysop() ) {
+ if ( $wgTitle->getArticleId() && ( ! $diff ) && $wgUser->isAllowed('protect') ) {
$n = $wgTitle->getPrefixedText();
if ( $wgTitle->isProtected() ) {
function makeImage( $url, $alt = '' ) {
global $wgOut;
-
if ( '' == $alt ) {
$alt = $this->fnamePart( $url );
}
$mwWidth =& MagicWord::get( MAG_IMG_WIDTH );
$mwCenter =& MagicWord::get( MAG_IMG_CENTER );
$mwFramed =& MagicWord::get( MAG_IMG_FRAMED );
- $alt = $part[count($part)-1];
+ $alt = '';
$height = $framed = $thumb = false;
$manual_thumb = "" ;
}
} elseif ( ! is_null( $mwFramed->matchVariableStartToEnd($val) ) ) {
$framed=true;
+ } else {
+ $alt = $val;
}
}
if ( 'center' == $align )
if ( '' == $manual_thumb ) $url = $img->createThumb( $width );
}
- if ( empty( $alt ) ) {
- $alt = preg_replace( '/\.(.+?)^/', '', $img->getName() );
- }
$alt = preg_replace( '/<[^>]*>/', '', $alt );
$alt = preg_replace('/&(?!:amp;|#[Xx][0-9A-fa-f]+;|#[0-9]+;|[a-zA-Z0-9]+;)/', '&', $alt);
$alt = str_replace( array('<', '>', '"'), array('<', '>', '"'), $alt );
$u = $nt->escapeLocalURL();
- $uf = $nt->escapeFullURL();
- if ( $url == '' )
- {
+ if ( $url == '' ) {
$s = wfMsg( 'missingimage', $img->getName() );
$s .= "<br>{$alt}<br>{$url}<br>\n";
} else {
$s = '<a href="'.$u.'" class="image" title="'.$alt.'">' .
- '<img src="'.$url.'" alt="'.$alt.'" longdesc="'.$uf.'" /></a>';
+ '<img src="'.$url.'" alt="'.$alt.'" longdesc="'.$u.'" /></a>';
}
if ( '' != $align ) {
$s = "<div class=\"float{$align}\"><span>{$s}</span></div>";
}
$u = $img->getEscapeLocalURL();
- $uf = $img->getEscapeFullURL();
$more = htmlspecialchars( wfMsg( 'thumbnail-more' ) );
$magnifyalign = $wgContLang->isRTL() ? 'left' : 'right';
$s .= '<a href="'.$u.'" class="internal" title="'.$alt.'">'.
'<img src="'.$thumbUrl.'" alt="'.$alt.'" ' .
'width="'.$boxwidth.'" height="'.$boxheight.'" ' .
- 'longdesc="'.$uf.'" /></a>';
+ 'longdesc="'.$u.'" /></a>';
if ( $framed ) {
$zoomicon="";
} else {
}
function makeMediaLink( $name, $url, $alt = '' ) {
- $nt = Title::makeTitleSafe( Namespace::getMedia(), $name );
+ $nt = Title::makeTitleSafe( NS_IMAGE, $name );
return $this->makeMediaLinkObj( $nt, $alt );
}
- function makeMediaLinkObj( $nt, $alt = '' ) {
+ function makeMediaLinkObj( $nt, $alt = '', $nourl=false ) {
if ( ! isset( $nt ) )
{
### HOTFIX. Instead of breaking, return empty string.
$s = $alt;
} else {
- $name = $nt->getDBKey();
- $url = Image::wfImageUrl( $name );
+ $name = $nt->getDBKey();
+ $img = Image::newFromTitle( $nt );
+ $url = $img->getURL();
+ # $nourl can be set by the parser
+ # this is a hack to mask absolute URLs, so the parser doesn't
+ # linkify them (it is currently not context-aware)
+ # 2004-10-25
+ if ($nourl) { $url=str_replace("http://","http-noparse://",$url) ; }
if ( empty( $alt ) ) {
$alt = preg_replace( '/\.(.+?)^/', '', $name );
}
-
$u = htmlspecialchars( $url );
- $s = "<a href=\"{$u}\" class='internal' title=\"{$alt}\">{$alt}</a>";
+ $s = "<a href=\"{$u}\" class='internal' title=\"{$alt}\">{$alt}</a>";
}
return $s;
}
if ( $rc_type == RC_MOVE || $rc_type == RC_MOVE_OVER_REDIRECT ) {
$r .= ' ';
} else {
- # M & N (minor & new)
+ # M, N and !
$M = wfMsg( 'minoreditletter' );
$N = wfMsg( 'newpageletter' );
} else {
$r .= ' ' ;
}
+ if ( $rcObj->unpatrolled ) {
+ $r .= '!';
+ } else {
+ $r .= ' ';
+ }
}
# Timestamp
# Collate list of users
$isnew = false ;
+ $unpatrolled = false;
$userlinks = array () ;
foreach ( $block AS $rcObj ) {
$oldid = $rcObj->mAttribs['rc_last_oldid'];
- if ( $rcObj->mAttribs['rc_new'] ) $isnew = true ;
+ if ( $rcObj->mAttribs['rc_new'] ) {
+ $isnew = true ;
+ }
$u = $rcObj->userlink ;
- if ( !isset ( $userlinks[$u] ) ) $userlinks[$u] = 0 ;
+ if ( !isset ( $userlinks[$u] ) ) {
+ $userlinks[$u] = 0 ;
+ }
+ if ( $rcObj->unpatrolled ) {
+ $unpatrolled = true;
+ }
$userlinks[$u]++ ;
}
$rcm = 'RCM'.$this->rcCacheIndex ;
$toggleLink = "javascript:toggleVisibility('$rci','$rcm','$rcl')" ;
$arrowdir = $wgContLang->isRTL() ? 'l' : 'r';
- $tl = '<span id="'.$rcm.'"><a href="'.$toggleLink.'"><img src="'.$wgStylePath.'/common/images/Arr_'.$arrowdir.'.png" width="12" height="12" /></a></span>' ;
- $tl .= '<span id="'.$rcl.'" style="display:none"><a href="'.$toggleLink.'"><img src="'.$wgStylePath.'/common/images/Arr_d.png" width="12" height="12" /></a></span>' ;
+ $tl = '<span id="'.$rcm.'"><a href="'.$toggleLink.'"><img src="'.$wgStylePath.'/common/images/Arr_'.$arrowdir.'.png" width="12" height="12" alt="+" /></a></span>' ;
+ $tl .= '<span id="'.$rcl.'" style="display:none"><a href="'.$toggleLink.'"><img src="'.$wgStylePath.'/common/images/Arr_d.png" width="12" height="12" alt="-" /></a></span>' ;
$r .= $tl ;
# Main line
if ( $isnew ) $r .= $N ;
else $r .= ' ' ;
$r .= ' ' ; # Minor
+ if ( $unpatrolled ) {
+ $r .= "!";
+ } else {
+ $r .= " ";
+ }
# Timestamp
$r .= ' '.$block[0]->timestamp.' ' ;
$r .= '<img src="'.$wgStylePath.'/common/images/Arr_.png" width="12" height="12" />';
$r .= '<tt> ' ;
- if ( $rc_new ) $r .= $N ;
- else $r .= ' ' ;
- if ( $rc_minor ) $r .= $M ;
- else $r .= ' ' ;
- $r .= '</tt>' ;
+ if ( $rc_new ) {
+ $r .= $N ;
+ } else {
+ $r .= ' ' ;
+ }
+
+ if ( $rc_minor ) {
+ $r .= $M ;
+ } else {
+ $r .= ' ' ;
+ }
+
+ if ( $rcObj->unpatrolled ) {
+ $r .= "!";
+ } else {
+ $r .= " ";
+ }
+
+ $r .= ' </tt>' ;
$o = '' ;
if ( $rc_last_oldid != 0 ) {
extract( $rc->mAttribs );
$curIdEq = 'curid=' . $rc_cur_id;
+ # Should patrol-related stuff be shown?
+ $unpatrolled = $wgUseRCPatrol && $wgUser->getID() != 0 &&
+ ( !$wgOnlySysopsCanPatrol || $wgUser->isAllowed('patrol') ) && $rc_patrolled == 0;
+
# Make date header if necessary
$date = $wgContLang->date( $rc_timestamp, true);
$uidate = $wgLang->date( $rc_timestamp, true);
$s = '';
if ( $date != $this->lastdate ) {
if ( '' != $this->lastdate ) { $s .= "</ul>\n"; }
- $s .= "<h4>{$uidate}</h4>\n<ul class='special'>";
+ $s .= "<h4>{$uidate}</h4>\n<ul class=\"special\">";
$this->lastdate = $date;
$this->rclistOpen = true;
}
- # If this edit has not yet been patrolled, make it stick out
- $s .= ( ! $wgUseRCPatrol || $rc_patrolled ) ? '<li> ' : '<li class="not_patrolled"> ';
+ $s .= '<li>';
if ( $rc_type == RC_MOVE || $rc_type == RC_MOVE_OVER_REDIRECT ) {
# Diff
if ( $rc_type == RC_NEW || $rc_type == RC_LOG ) {
$diffLink = wfMsg( 'diff' );
} else {
- if ( $wgUseRCPatrol && $rc_patrolled == 0 && $wgUser->getID() != 0 &&
- ( $wgUser->isSysop() || !$wgOnlySysopsCanPatrol ) )
+ if ( $unpatrolled )
$rcidparam = "&rcid={$rc_id}";
else
$rcidparam = "";
$s .= $this->makeKnownLinkObj( $rc->getTitle(), wfMsg( 'hist' ), $curIdEq.'&action=history' );
$s .= ') . . ';
- # M and N (minor and new)
+ # M, N and ! (minor, new and unpatrolled)
if ( $rc_minor ) { $s .= ' <span class="minor">'.wfMsg( "minoreditletter" ).'</span>'; }
if ( $rc_type == RC_NEW ) { $s .= '<span class="newpage">'.wfMsg( "newpageletter" ).'</span>'; }
+ if ( !$rc_patrolled ) { $s .= ' <span class="unpatrolled">!</span>'; }
# Article link
# If it's a new article, there is no diff link, but if it hasn't been
# patrolled yet, we need to give users a way to do so
- if ( $wgUseRCPatrol && $rc_type == RC_NEW && $rc_patrolled == 0 &&
- $wgUser->getID() != 0 && ( $wgUser->isSysop() || !$wgOnlySysopsCanPatrol ) )
+ if ( $unpatrolled && $rc_type == RC_NEW )
$articleLink = $this->makeKnownLinkObj( $rc->getTitle(), '', "rcid={$rc_id}" );
else
$articleLink = $this->makeKnownLinkObj( $rc->getTitle(), '' );
}
# Block link
$blockLink='';
- if ( ( 0 == $rc_user ) && $wgUser->isSysop() ) {
+ if ( ( 0 == $rc_user ) && $wgUser->isAllowed('block') ) {
$blockLink = $this->makeKnownLink( $wgContLang->specialPage(
'Blockip' ), wfMsg( 'blocklink' ), 'ip='.$rc_user_text );
function recentChangesLineNew( &$baseRC, $watched = false ) {
global $wgTitle, $wgLang, $wgContLang, $wgUser, $wgRCSeconds;
-
+ global $wgUseRCPatrol, $wgOnlySysopsCanPatrol;
+
# Create a specialised object
$rc = RCCacheEntry::newFromParent( $baseRC ) ;
$ret .= "<h4>{$uidate}</h4>\n";
$this->lastdate = $date;
}
-
+
+ # Should patrol-related stuff be shown?
+ if ( $wgUseRCPatrol && $wgUser->getID() != 0 &&
+ ( !$wgOnlySysopsCanPatrol || $wgUser->isAllowed('patrol') )) {
+ $rc->unpatrolled = !$rc_patrolled;
+ } else {
+ $rc->unpatrolled = false;
+ }
+
# Make article link
if ( $rc_type == RC_MOVE || $rc_type == RC_MOVE_OVER_REDIRECT ) {
$msg = ( $rc_type == RC_MOVE ) ? "1movedto2" : "1movedto2_redir";
$logtype = $matches[1];
$logname = LogPage::logName( $logtype );
$clink = '(' . $this->makeKnownLinkObj( $rc->getTitle(), $logname ) . ')';
+ } elseif ( $rc->unpatrolled && $rc_type == RC_NEW ) {
+ # Unpatrolled new page, give rc_id in query
+ $clink = $this->makeKnownLinkObj( $rc->getTitle(), '', "rcid={$rc_id}" );
} else {
$clink = $this->makeKnownLinkObj( $rc->getTitle(), '' ) ;
}
# Make "last" link
$titleObj = $rc->getTitle();
+ if ( $rc->unpatrolled ) {
+ $rcIdQuery = "&rcid={$rc_id}";
+ } else {
+ $rcIdQuery = '';
+ }
if ( $rc_last_oldid == 0 || $rc_type == RC_LOG || $rc_type == RC_MOVE || $rc_type == RC_MOVE_OVER_REDIRECT ) {
$lastLink = wfMsg( 'last' );
} else {
$lastLink = $this->makeKnownLinkObj( $rc->getTitle(), wfMsg( 'last' ),
- $curIdEq.'&diff='.$rc_this_oldid.'&oldid='.$rc_last_oldid );
+ $curIdEq.'&diff='.$rc_this_oldid.'&oldid='.$rc_last_oldid . $rcIdQuery );
}
# Make user link (or user contributions for unregistered users)
$userTalkLink= $this->makeLink($utns . ':'.$rc_user_text, $talkname );
global $wgDisableAnonTalk;
- if ( ( 0 == $rc_user ) && $wgUser->isSysop() ) {
+ if ( ( 0 == $rc_user ) && $wgUser->isAllowed('block') ) {
$blockLink = $this->makeKnownLink( $wgContLang->specialPage(
'Blockip' ), wfMsg( 'blocklink' ), 'ip='.$rc_user_text );
if( $wgDisableAnonTalk )
if ( $iscur ) {
$url = Image::wfImageUrl( $img );
$rlink = $cur;
- if ( $wgUser->isSysop() ) {
+ if ( $wgUser->isAllowed('delete') ) {
$link = $wgTitle->escapeLocalURL( 'image=' . $wgTitle->getPartialURL() .
'&action=delete' );
$style = $this->getInternalLinkAttributes( $link, $delall );