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; }
20 if ( ! isset( $limit ) ) {
21 $limit = $wgUser->getOption( "rclimit" );
22 if ( ! $limit ) { $limit = 100; }
27 $docutoff = "cur_timestamp > '" .
28 date( "YmdHis", time() - ( $days * 86400 ) )
34 $dolimit = "LIMIT $limit";
37 $uid = $wgUser->getID();
39 $wgOut->addHTML( wfMsg( "nowatchlist" ) );
43 # $sql = "SELECT DISTINCT
44 # cur_id,cur_namespace,cur_title,cur_comment,
45 # cur_user,cur_user_text,cur_timestamp,cur_minor_edit,cur_is_new
47 # WHERE wl_user={$uid} AND wl_namespace=cur_namespace & (~1) AND wl_title=cur_title
48 # ORDER BY cur_timestamp DESC {$dolimit}";
49 $sql = "SELECT DISTINCT
50 cur_id,cur_namespace,cur_title,cur_comment,
51 cur_user,cur_user_text,cur_timestamp,cur_minor_edit,cur_is_new
53 WHERE wl_user={$uid} AND wl_title=cur_title
54 AND (cur_namespace=wl_namespace OR cur_namespace=wl_namespace+1)
55 ORDER BY inverse_timestamp {$dolimit}";
56 $res = wfQuery( $sql, $fname );
57 if ( wfNumRows( $res ) == 0 ) {
58 $wgOut->addHTML( wfMsg( "nowatchlist" ) );
62 $note = str_replace( "$1", $limit, wfMsg( "rcnote" ) );
63 $note = str_replace( "$2", $days, $note );
64 $wgOut->addHTML( "\n<hr>\n{$note}\n<br>" );
65 $note = rcDayLimitlinks( $days, $limit, "Watchlist", "", true );
66 $wgOut->addHTML( "{$note}\n" );
68 $sk = $wgUser->getSkin();
69 $s = $sk->beginRecentChangesList();
71 while ( $obj = wfFetchObject( $res ) ) {
72 $ts = $obj->cur_timestamp
;
74 $ut = $obj->cur_user_text
;
75 $ns = $obj->cur_namespace
;
76 $ttl = $obj->cur_title
;
77 $com = $obj->cur_comment
;
78 $me = ( $obj->cur_minor_edit
> 0 );
79 $new = ( $obj->cur_is_new
> 0 );
82 $s .= $sk->recentChangesLine( $ts, $u, $ut, $ns, $ttl, $com, $me, $new, $watched );
84 $s .= $sk->endRecentChangesList();
87 $wgOut->addHTML( $s );