2004-02-18 02:15:00 +00:00
|
|
|
<?php
|
2004-09-02 23:28:24 +00:00
|
|
|
/**
|
|
|
|
|
*
|
2004-09-03 23:00:01 +00:00
|
|
|
* @package MediaWiki
|
|
|
|
|
* @subpackage SpecialPage
|
2004-09-02 23:28:24 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
*
|
|
|
|
|
*/
|
2005-01-31 20:45:10 +00:00
|
|
|
require_once( 'SpecialRecentchanges.php' );
|
|
|
|
|
require_once( 'WatchedItem.php' );
|
2003-04-14 23:10:40 +00:00
|
|
|
|
2004-09-02 23:28:24 +00:00
|
|
|
/**
|
|
|
|
|
* constructor
|
|
|
|
|
*/
|
2005-05-29 04:29:29 +00:00
|
|
|
function wfSpecialWatchlist( $par ) {
|
2005-03-19 16:09:17 +00:00
|
|
|
global $wgUser, $wgOut, $wgLang, $wgTitle, $wgMemc, $wgRequest, $wgContLang;;
|
2004-07-10 03:09:26 +00:00
|
|
|
global $wgUseWatchlistCache, $wgWLCacheTimeout, $wgDBname;
|
2005-05-29 04:29:29 +00:00
|
|
|
global $wgRCShowWatchingUsers, $wgEnotifWatchlist, $wgShowUpdatedMarker;
|
2005-01-31 20:45:10 +00:00
|
|
|
$fname = 'wfSpecialWatchlist';
|
2003-04-14 23:10:40 +00:00
|
|
|
|
2005-01-31 20:45:10 +00:00
|
|
|
$wgOut->setPagetitle( wfMsg( 'watchlist' ) );
|
|
|
|
|
$sub = wfMsg( 'watchlistsub', $wgUser->getName() );
|
2003-04-14 23:10:40 +00:00
|
|
|
$wgOut->setSubtitle( $sub );
|
2005-01-31 20:45:10 +00:00
|
|
|
$wgOut->setRobotpolicy( 'noindex,nofollow' );
|
2003-04-14 23:10:40 +00:00
|
|
|
|
2005-01-31 20:45:10 +00:00
|
|
|
$specialTitle = Title::makeTitle( NS_SPECIAL, 'Watchlist' );
|
2004-08-09 10:03:39 +00:00
|
|
|
|
2005-02-21 12:46:37 +00:00
|
|
|
if( $wgUser->isAnon() ) {
|
2005-02-06 14:03:49 +00:00
|
|
|
$wgOut->addWikiText( wfMsg( 'nowatchlist' ) );
|
2003-04-14 23:10:40 +00:00
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
2004-08-13 11:57:20 +00:00
|
|
|
# Get query variables
|
|
|
|
|
$days = $wgRequest->getVal( 'days' );
|
|
|
|
|
$action = $wgRequest->getVal( 'action' );
|
|
|
|
|
$remove = $wgRequest->getVal( 'remove' );
|
2005-04-28 07:51:48 +00:00
|
|
|
$hideOwn = $wgRequest->getBool( 'hideOwn' );
|
2004-12-18 11:18:56 +00:00
|
|
|
$id = $wgRequest->getArray( 'id' );
|
2004-08-13 11:57:20 +00:00
|
|
|
|
2005-02-21 12:46:37 +00:00
|
|
|
$uid = $wgUser->getID();
|
2005-05-29 04:29:29 +00:00
|
|
|
if( $wgRequest->getVal( 'reset' ) && $wgRequest->wasPosted() ) {
|
2005-01-19 22:59:43 +00:00
|
|
|
$wgUser->clearAllNotifications( $uid );
|
2004-12-18 07:16:11 +00:00
|
|
|
}
|
2004-12-18 03:47:11 +00:00
|
|
|
|
2005-03-19 16:09:17 +00:00
|
|
|
|
2005-01-31 20:45:10 +00:00
|
|
|
if(($action == 'submit') && isset($remove) && is_array($id)) {
|
2005-02-06 14:03:49 +00:00
|
|
|
$wgOut->addWikiText( wfMsg( 'removingchecked' ) );
|
|
|
|
|
$wgOut->addHTML( '<p>' );
|
2003-08-07 11:54:16 +00:00
|
|
|
foreach($id as $one) {
|
|
|
|
|
$t = Title::newFromURL( $one );
|
2005-01-31 20:45:10 +00:00
|
|
|
if($t->getDBkey() != '') {
|
2003-11-09 11:45:12 +00:00
|
|
|
$wl = WatchedItem::fromUserTitle( $wgUser, $t );
|
|
|
|
|
if( $wl->removeWatch() === false ) {
|
2005-01-31 20:45:10 +00:00
|
|
|
$wgOut->addHTML( "<br />\n" . wfMsg( 'couldntremove', htmlspecialchars($one) ) );
|
2003-08-07 11:54:16 +00:00
|
|
|
} else {
|
2005-01-31 20:45:10 +00:00
|
|
|
$wgOut->addHTML( ' (' . htmlspecialchars($one) . ')' );
|
2003-08-07 11:54:16 +00:00
|
|
|
}
|
|
|
|
|
} else {
|
2005-01-31 20:45:10 +00:00
|
|
|
$wgOut->addHTML( "<br />\n" . wfMsg( 'iteminvalidname', htmlspecialchars($one) ) );
|
2003-08-07 11:54:16 +00:00
|
|
|
}
|
|
|
|
|
}
|
2005-02-06 14:03:49 +00:00
|
|
|
$wgOut->addHTML( "done.</p>\n" );
|
2003-08-07 11:54:16 +00:00
|
|
|
}
|
|
|
|
|
|
2004-01-25 02:33:34 +00:00
|
|
|
if ( $wgUseWatchlistCache ) {
|
|
|
|
|
$memckey = "$wgDBname:watchlist:id:" . $wgUser->getId();
|
|
|
|
|
$cache_s = @$wgMemc->get( $memckey );
|
|
|
|
|
if( $cache_s ){
|
2005-02-06 14:03:49 +00:00
|
|
|
$wgOut->addWikiText( wfMsg('wlsaved') );
|
2004-01-25 02:33:34 +00:00
|
|
|
$wgOut->addHTML( $cache_s );
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
}
|
2004-08-09 10:03:39 +00:00
|
|
|
|
2004-07-18 08:48:43 +00:00
|
|
|
$dbr =& wfGetDB( DB_SLAVE );
|
2004-12-19 08:00:50 +00:00
|
|
|
extract( $dbr->tableNames( 'page', 'revision', 'watchlist', 'recentchanges' ) );
|
2004-07-18 08:48:43 +00:00
|
|
|
|
|
|
|
|
$sql = "SELECT COUNT(*) AS n FROM $watchlist WHERE wl_user=$uid";
|
2004-12-18 03:47:11 +00:00
|
|
|
$res = $dbr->query( $sql, $fname );
|
2004-07-18 08:48:43 +00:00
|
|
|
$s = $dbr->fetchObject( $res );
|
2004-12-18 03:47:11 +00:00
|
|
|
|
|
|
|
|
# Patch *** A1 *** (see A2 below)
|
|
|
|
|
# adjust for page X, talk:page X, which are both stored separately, but treated together
|
|
|
|
|
# $nitems = $s->n / 2;
|
2003-08-07 11:54:16 +00:00
|
|
|
$nitems = $s->n;
|
2004-12-18 03:47:11 +00:00
|
|
|
|
2003-08-07 11:54:16 +00:00
|
|
|
if($nitems == 0) {
|
2005-05-14 17:55:04 +00:00
|
|
|
$wgOut->addWikiText( wfMsg( 'nowatchlist' ) );
|
|
|
|
|
return;
|
2003-08-07 11:54:16 +00:00
|
|
|
}
|
2005-05-14 17:55:04 +00:00
|
|
|
|
2004-08-13 11:57:20 +00:00
|
|
|
if ( is_null( $days ) ) {
|
2003-12-03 15:18:38 +00:00
|
|
|
$big = 1000;
|
2003-08-08 05:13:09 +00:00
|
|
|
if($nitems > $big) {
|
|
|
|
|
# Set default cutoff shorter
|
2003-12-03 15:18:38 +00:00
|
|
|
$days = (12.0 / 24.0); # 12 hours...
|
2003-08-08 05:13:09 +00:00
|
|
|
} else {
|
2003-12-05 04:46:43 +00:00
|
|
|
$days = 3; # longer cutoff for shortlisters
|
2003-08-08 05:13:09 +00:00
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
$days = floatval($days);
|
|
|
|
|
}
|
2004-08-09 10:03:39 +00:00
|
|
|
|
2003-08-08 05:13:09 +00:00
|
|
|
if ( $days <= 0 ) {
|
|
|
|
|
$docutoff = '';
|
|
|
|
|
$cutoff = false;
|
2005-03-26 21:26:32 +00:00
|
|
|
$npages = wfMsg( 'watchlistall1' );
|
2003-08-08 05:13:09 +00:00
|
|
|
} else {
|
2004-12-19 08:00:50 +00:00
|
|
|
$docutoff = "AND rev_timestamp > '" .
|
2004-08-10 13:22:15 +00:00
|
|
|
( $cutoff = $dbr->timestamp( time() - intval( $days * 86400 ) ) )
|
2003-08-08 05:13:09 +00:00
|
|
|
. "'";
|
2004-12-19 08:00:50 +00:00
|
|
|
$sql = "SELECT COUNT(*) AS n FROM $page, $revision WHERE rev_timestamp>'$cutoff' AND page_id=rev_page";
|
2004-12-18 03:47:11 +00:00
|
|
|
$res = $dbr->query( $sql, $fname );
|
2004-07-18 08:48:43 +00:00
|
|
|
$s = $dbr->fetchObject( $res );
|
2003-08-08 05:13:09 +00:00
|
|
|
$npages = $s->n;
|
2004-08-09 10:03:39 +00:00
|
|
|
|
2003-08-08 05:13:09 +00:00
|
|
|
}
|
2005-05-14 17:55:04 +00:00
|
|
|
|
2005-05-29 04:29:29 +00:00
|
|
|
if($wgRequest->getBool('edit') || $par == 'edit' ) {
|
2005-02-06 14:03:49 +00:00
|
|
|
$wgOut->addWikiText( wfMsg( 'watchlistcontains', $wgLang->formatNum( $nitems ) ) .
|
2005-04-28 07:51:48 +00:00
|
|
|
"\n\n" . wfMsg( 'watcheditlist' ) );
|
2004-08-09 10:03:39 +00:00
|
|
|
|
2005-01-31 20:45:10 +00:00
|
|
|
$wgOut->addHTML( '<form action=\'' .
|
|
|
|
|
$specialTitle->escapeLocalUrl( 'action=submit' ) .
|
2003-08-07 11:54:16 +00:00
|
|
|
"' method='post'>\n" .
|
|
|
|
|
"<ul>\n" );
|
2004-12-18 03:47:11 +00:00
|
|
|
|
|
|
|
|
# Patch A2
|
|
|
|
|
# The following was proposed by KTurner 07.11.2004 to T.Gries
|
|
|
|
|
# $sql = "SELECT distinct (wl_namespace & ~1),wl_title FROM $watchlist WHERE wl_user=$uid";
|
2004-07-18 08:48:43 +00:00
|
|
|
$sql = "SELECT wl_namespace,wl_title FROM $watchlist WHERE wl_user=$uid";
|
2004-12-18 03:47:11 +00:00
|
|
|
|
|
|
|
|
$res = $dbr->query( $sql, $fname );
|
2003-08-07 11:54:16 +00:00
|
|
|
$sk = $wgUser->getSkin();
|
2004-07-18 08:48:43 +00:00
|
|
|
while( $s = $dbr->fetchObject( $res ) ) {
|
2003-08-07 11:54:16 +00:00
|
|
|
$t = Title::makeTitle( $s->wl_namespace, $s->wl_title );
|
2004-06-12 01:37:42 +00:00
|
|
|
if( is_null( $t ) ) {
|
2004-06-12 01:47:13 +00:00
|
|
|
$wgOut->addHTML( '<!-- bad title "' . htmlspecialchars( $s->wl_title ) . '" in namespace ' . IntVal( $s->wl_namespace ) . " -->\n" );
|
2004-06-12 01:37:42 +00:00
|
|
|
} else {
|
|
|
|
|
$t = $t->getPrefixedText();
|
2005-01-31 20:45:10 +00:00
|
|
|
$wgOut->addHTML( '<li><input type="checkbox" name="id[]" value="' . htmlspecialchars($t) . '" />' .
|
2004-08-09 10:03:39 +00:00
|
|
|
$sk->makeLink( $t, $t ) .
|
2004-06-12 01:37:42 +00:00
|
|
|
"</li>\n" );
|
|
|
|
|
}
|
2003-08-07 11:54:16 +00:00
|
|
|
}
|
|
|
|
|
$wgOut->addHTML( "</ul>\n" .
|
2004-10-14 04:40:58 +00:00
|
|
|
"<input type='submit' name='remove' value=\"" .
|
|
|
|
|
htmlspecialchars( wfMsg( "removechecked" ) ) . "\" />\n" .
|
2003-08-07 11:54:16 +00:00
|
|
|
"</form>\n" );
|
2004-08-09 10:03:39 +00:00
|
|
|
|
2003-04-14 23:10:40 +00:00
|
|
|
return;
|
|
|
|
|
}
|
2004-08-09 10:03:39 +00:00
|
|
|
|
2003-08-07 11:54:16 +00:00
|
|
|
# If the watchlist is relatively short, it's simplest to zip
|
|
|
|
|
# down its entirety and then sort the results.
|
2004-08-09 10:03:39 +00:00
|
|
|
|
2003-08-07 11:54:16 +00:00
|
|
|
# If it's relatively long, it may be worth our while to zip
|
2003-08-08 05:13:09 +00:00
|
|
|
# through the time-sorted page list checking for watched items.
|
2004-08-09 10:03:39 +00:00
|
|
|
|
2003-08-07 11:54:16 +00:00
|
|
|
# Up estimate of watched items by 15% to compensate for talk pages...
|
2003-08-08 05:13:09 +00:00
|
|
|
if( $cutoff && ( $nitems*1.15 > $npages ) ) {
|
2005-01-31 20:45:10 +00:00
|
|
|
$x = 'rev_timestamp';
|
|
|
|
|
$y = wfMsg( 'watchmethod-recent' );
|
2004-12-18 03:47:11 +00:00
|
|
|
# TG patch: here we do not consider pages and their talk pages equivalent - why should we ?
|
|
|
|
|
# The change results in talk-pages not automatically included in watchlists, when their parent page is included
|
|
|
|
|
# $z = "wl_namespace=cur_namespace & ~1";
|
2005-01-31 20:45:10 +00:00
|
|
|
$z = 'wl_namespace=page_namespace';
|
2003-08-07 11:54:16 +00:00
|
|
|
} else {
|
2005-01-31 20:45:10 +00:00
|
|
|
$x = 'page_timestamp';
|
|
|
|
|
$y = wfMsg( 'watchmethod-list' );
|
2004-12-18 03:47:11 +00:00
|
|
|
# TG patch: here we do not consider pages and their talk pages equivalent - why should we ?
|
|
|
|
|
# The change results in talk-pages not automatically included in watchlists, when their parent page is included
|
|
|
|
|
# $z = "(wl_namespace=cur_namespace OR wl_namespace+1=cur_namespace)";
|
2005-01-31 20:45:10 +00:00
|
|
|
$z = 'wl_namespace=page_namespace';
|
2003-08-07 11:54:16 +00:00
|
|
|
}
|
|
|
|
|
|
2005-04-28 07:51:48 +00:00
|
|
|
$andHideOwn = $hideOwn ? "AND (rev_user <> $uid)" : '';
|
2005-05-14 17:55:04 +00:00
|
|
|
|
|
|
|
|
# Show watchlist header
|
2005-05-29 04:29:29 +00:00
|
|
|
$header = '';
|
|
|
|
|
if( $wgUser->getOption( 'enotifwatchlistpages' ) && $wgEnotifWatchlist) {
|
|
|
|
|
$header .= wfMsg( 'wlheader-enotif' ) . "\n";
|
|
|
|
|
}
|
|
|
|
|
if ( $wgShowUpdatedMarker ) {
|
|
|
|
|
$header .= wfMsg( 'wlheader-showupdated' ) . "\n";
|
|
|
|
|
}
|
2005-05-14 17:55:04 +00:00
|
|
|
|
2005-05-29 04:29:29 +00:00
|
|
|
$header .= wfMsg( 'watchdetails', $wgLang->formatNum( $nitems ),
|
|
|
|
|
$wgLang->formatNum( $npages ), $y,
|
|
|
|
|
$specialTitle->getFullUrl( 'edit=yes' ) );
|
|
|
|
|
$wgOut->addWikiText( $header );
|
|
|
|
|
|
|
|
|
|
if ( $wgShowUpdatedMarker ) {
|
2005-05-14 17:55:04 +00:00
|
|
|
$wgOut->addHTML( '<form action="' .
|
2005-05-29 04:29:29 +00:00
|
|
|
$specialTitle->escapeLocalUrl() .
|
2005-05-14 17:55:04 +00:00
|
|
|
'" method="post"><input type="submit" name="dummy" value="' .
|
|
|
|
|
htmlspecialchars( wfMsg( 'enotif_reset' ) ) .
|
|
|
|
|
'" /><input type="hidden" name="reset" value="all" /></form>' .
|
2005-05-29 04:29:29 +00:00
|
|
|
"\n\n" );
|
2005-05-14 17:55:04 +00:00
|
|
|
}
|
2004-08-09 10:03:39 +00:00
|
|
|
|
2004-07-18 08:48:43 +00:00
|
|
|
$use_index = $dbr->useIndexClause( $x );
|
2003-08-07 11:54:16 +00:00
|
|
|
$sql = "SELECT
|
2004-12-19 08:00:50 +00:00
|
|
|
page_namespace,page_title,rev_comment, page_id,
|
|
|
|
|
rev_user,rev_user_text,rev_timestamp,rev_minor_edit,page_is_new,wl_notificationtimestamp
|
|
|
|
|
FROM $watchlist,$page,$revision $use_index
|
2003-08-07 11:54:16 +00:00
|
|
|
WHERE wl_user=$uid
|
2005-03-19 16:09:17 +00:00
|
|
|
$andHideOwn
|
2003-08-07 11:54:16 +00:00
|
|
|
AND $z
|
2004-12-19 08:00:50 +00:00
|
|
|
AND wl_title=page_title
|
|
|
|
|
AND page_latest=rev_id
|
2003-08-08 05:13:09 +00:00
|
|
|
$docutoff
|
2004-12-19 08:00:50 +00:00
|
|
|
ORDER BY rev_timestamp DESC";
|
2003-04-14 23:10:40 +00:00
|
|
|
|
2003-08-07 11:54:16 +00:00
|
|
|
|
2004-07-18 08:48:43 +00:00
|
|
|
$res = $dbr->query( $sql, $fname );
|
2004-08-13 11:57:20 +00:00
|
|
|
$numRows = $dbr->numRows( $res );
|
2003-08-07 11:54:16 +00:00
|
|
|
if($days >= 1)
|
2005-01-31 20:45:10 +00:00
|
|
|
$note = wfMsg( 'rcnote', $wgLang->formatNum( $numRows ), $wgLang->formatNum( $days ) );
|
2003-08-08 05:13:09 +00:00
|
|
|
elseif($days > 0)
|
2005-01-31 20:45:10 +00:00
|
|
|
$note = wfMsg( 'wlnote', $wgLang->formatNum( $numRows ), $wgLang->formatNum( round($days*24) ) );
|
2003-08-08 05:13:09 +00:00
|
|
|
else
|
2005-01-31 20:45:10 +00:00
|
|
|
$note = '';
|
2004-04-03 11:31:05 +00:00
|
|
|
$wgOut->addHTML( "\n<hr />\n{$note}\n<br />" );
|
2004-08-13 11:57:20 +00:00
|
|
|
$note = wlCutoffLinks( $days );
|
2003-04-14 23:10:40 +00:00
|
|
|
$wgOut->addHTML( "{$note}\n" );
|
2005-03-19 16:09:17 +00:00
|
|
|
|
|
|
|
|
$sk = $wgUser->getSkin();
|
|
|
|
|
$s = $sk->makeKnownLink(
|
|
|
|
|
$wgContLang->specialPage( 'Watchlist' ),
|
|
|
|
|
(0 == $hideOwn) ? wfMsg( 'wlhide' ) : wfMsg( 'wlshow' ),
|
|
|
|
|
'hideOwn=' . $wgLang->formatNum( 1-$hideOwn ) );
|
|
|
|
|
|
|
|
|
|
$note = wfMsg( "wlhideshowown", $s );
|
|
|
|
|
$wgOut->addHTML( "\n<br />{$note}\n<br />" );
|
|
|
|
|
|
2004-08-13 11:57:20 +00:00
|
|
|
if ( $numRows == 0 ) {
|
2005-01-31 20:45:10 +00:00
|
|
|
$wgOut->addHTML( '<p><i>' . wfMsg( 'watchnochange' ) . '</i></p>' );
|
2003-08-07 11:54:16 +00:00
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
2003-04-14 23:10:40 +00:00
|
|
|
$sk = $wgUser->getSkin();
|
2004-11-25 13:47:17 +00:00
|
|
|
$list =& new ChangesList( $sk );
|
|
|
|
|
$s = $list->beginRecentChangesList();
|
2004-04-09 23:58:52 +00:00
|
|
|
$counter = 1;
|
2004-07-18 08:48:43 +00:00
|
|
|
while ( $obj = $dbr->fetchObject( $res ) ) {
|
2004-01-17 09:49:43 +00:00
|
|
|
# Make fake RC entry
|
|
|
|
|
$rc = RecentChange::newFromCurRow( $obj );
|
2004-04-09 23:58:52 +00:00
|
|
|
$rc->counter = $counter++;
|
2004-12-18 03:47:11 +00:00
|
|
|
|
2005-05-29 04:29:29 +00:00
|
|
|
if ( $wgShowUpdatedMarker ) {
|
2005-05-14 17:55:04 +00:00
|
|
|
$updated = $obj->wl_notificationtimestamp;
|
2004-12-18 03:47:11 +00:00
|
|
|
} else {
|
2005-05-29 04:29:29 +00:00
|
|
|
// Same visual appearance as MW 1.4
|
|
|
|
|
$updated = true;
|
2004-12-18 03:47:11 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if ($wgRCShowWatchingUsers && $wgUser->getOption( 'shownumberswatching' )) {
|
|
|
|
|
$sql3 = "SELECT COUNT(*) AS n FROM $watchlist WHERE wl_title='" .wfStrencode($obj->cur_title). "' AND wl_namespace='{$obj->cur_namespace}'" ;
|
|
|
|
|
$res3 = $dbr->query( $sql3, DB_READ, $fname );
|
|
|
|
|
$x = $dbr->fetchObject( $res3 );
|
|
|
|
|
$rc->numberofWatchingusers = $x->n;
|
|
|
|
|
} else {
|
|
|
|
|
$rc->numberofWatchingusers = 0;
|
|
|
|
|
}
|
|
|
|
|
|
2005-05-14 17:55:04 +00:00
|
|
|
$s .= $list->recentChangesLine( $rc, $updated );
|
2003-04-14 23:10:40 +00:00
|
|
|
}
|
2004-11-25 13:47:17 +00:00
|
|
|
$s .= $list->endRecentChangesList();
|
2003-04-14 23:10:40 +00:00
|
|
|
|
2004-07-18 08:48:43 +00:00
|
|
|
$dbr->freeResult( $res );
|
2003-04-14 23:10:40 +00:00
|
|
|
$wgOut->addHTML( $s );
|
2004-01-25 02:33:34 +00:00
|
|
|
|
|
|
|
|
if ( $wgUseWatchlistCache ) {
|
|
|
|
|
$wgMemc->set( $memckey, $s, $wgWLCacheTimeout);
|
|
|
|
|
}
|
2004-08-09 10:03:39 +00:00
|
|
|
|
2003-04-14 23:10:40 +00:00
|
|
|
}
|
|
|
|
|
|
2003-08-07 11:54:16 +00:00
|
|
|
|
|
|
|
|
function wlHoursLink( $h, $page ) {
|
2004-09-24 16:45:31 +00:00
|
|
|
global $wgUser, $wgLang, $wgContLang;
|
2003-08-07 11:54:16 +00:00
|
|
|
$sk = $wgUser->getSkin();
|
|
|
|
|
$s = $sk->makeKnownLink(
|
2004-09-24 16:45:31 +00:00
|
|
|
$wgContLang->specialPage( $page ),
|
2004-03-06 03:03:14 +00:00
|
|
|
$wgLang->formatNum( $h ),
|
2005-01-31 20:45:10 +00:00
|
|
|
'days=' . ($h / 24.0) );
|
2003-08-07 11:54:16 +00:00
|
|
|
return $s;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function wlDaysLink( $d, $page ) {
|
2004-09-24 16:45:31 +00:00
|
|
|
global $wgUser, $wgLang, $wgContLang;
|
2003-08-07 11:54:16 +00:00
|
|
|
$sk = $wgUser->getSkin();
|
|
|
|
|
$s = $sk->makeKnownLink(
|
2004-09-24 16:45:31 +00:00
|
|
|
$wgContLang->specialPage( $page ),
|
2005-03-26 21:26:32 +00:00
|
|
|
($d ? $wgLang->formatNum( $d ) : wfMsg( 'watchlistall2' ) ), "days=$d" );
|
2003-08-07 11:54:16 +00:00
|
|
|
return $s;
|
|
|
|
|
}
|
|
|
|
|
|
2005-01-31 20:45:10 +00:00
|
|
|
function wlCutoffLinks( $days, $page = 'Watchlist' )
|
2003-08-07 11:54:16 +00:00
|
|
|
{
|
|
|
|
|
$hours = array( 1, 2, 6, 12 );
|
|
|
|
|
$days = array( 1, 3, 7 );
|
2005-01-31 20:45:10 +00:00
|
|
|
$cl = '';
|
2003-08-07 11:54:16 +00:00
|
|
|
$i = 0;
|
|
|
|
|
foreach( $hours as $h ) {
|
|
|
|
|
$hours[$i++] = wlHoursLink( $h, $page );
|
|
|
|
|
}
|
|
|
|
|
$i = 0;
|
|
|
|
|
foreach( $days as $d ) {
|
|
|
|
|
$days[$i++] = wlDaysLink( $d, $page );
|
|
|
|
|
}
|
2005-01-31 20:45:10 +00:00
|
|
|
return wfMsg ('wlshowlast',
|
|
|
|
|
implode(' | ', $hours),
|
|
|
|
|
implode(' | ', $days),
|
2003-11-19 00:56:59 +00:00
|
|
|
wlDaysLink( 0, $page ) );
|
2003-08-07 11:54:16 +00:00
|
|
|
}
|
|
|
|
|
|
2003-04-14 23:10:40 +00:00
|
|
|
?>
|