3 include_once( "$IP/SpecialRecentchanges.php" );
5 function wfSpecialWatchlist()
7 global $wgUser, $wgOut, $wgLang, $wgTitle;
8 global $days, $limit, $target; # From query string
9 $fname = "wfSpecialWatchlist";
11 $wgOut->setPagetitle( wfMsg( "watchlist" ) );
12 $sub = str_replace( "$1", $wgUser->getName(), wfMsg( "watchlistsub" ) );
13 $wgOut->setSubtitle( $sub );
14 $wgOut->setRobotpolicy( "index,follow" );
16 if ( ! isset( $days ) ) {
17 $days = $wgUser->getOption( "rcdays" );
18 if ( ! $days ) { $days = 3; }
21 list( $limit, $offset ) = wfCheckLimits( 100, "rclimit" );
26 $docutoff = "cur_timestamp > '" .
27 wfUnix2Timestamp( time() - ( $days * 86400 ) )
33 $dolimit = "LIMIT $limit";
36 $uid = $wgUser->getID();
38 $wgOut->addHTML( wfMsg( "nowatchlist" ) );
42 $sql = "SELECT DISTINCT
43 cur_id,cur_namespace,cur_title,cur_comment,
44 cur_user,cur_user_text,cur_timestamp,cur_minor_edit,cur_is_new
46 WHERE wl_user={$uid} AND wl_title=cur_title
47 AND (cur_namespace=wl_namespace OR cur_namespace=wl_namespace+1)
48 ORDER BY inverse_timestamp {$dolimit}";
49 $res = wfQuery( $sql, $fname );
50 if ( wfNumRows( $res ) == 0 ) {
51 $wgOut->addHTML( wfMsg( "nowatchlist" ) );
55 $note = wfMsg( "rcnote", $limit, $days );
56 $wgOut->addHTML( "\n<hr>\n{$note}\n<br>" );
57 $note = rcDayLimitlinks( $days, $limit, "Watchlist", "", true );
58 $wgOut->addHTML( "{$note}\n" );
60 $sk = $wgUser->getSkin();
61 $s = $sk->beginRecentChangesList();
63 while ( $obj = wfFetchObject( $res ) ) {
64 $ts = $obj->cur_timestamp
;
66 $ut = $obj->cur_user_text
;
67 $ns = $obj->cur_namespace
;
68 $ttl = $obj->cur_title
;
69 $com = $obj->cur_comment
;
70 $me = ( $obj->cur_minor_edit
> 0 );
71 $new = ( $obj->cur_is_new
> 0 );
74 $s .= $sk->recentChangesLine( $ts, $u, $ut, $ns, $ttl, $com, $me, $new, $watched );
76 $s .= $sk->endRecentChangesList();
79 $wgOut->addHTML( $s );