3 function wfSpecialContributions( $par = "" )
5 global $wgUser, $wgOut, $wgLang, $target, $hideminor;
6 $fname = "wfSpecialContributions";
7 $sysop = $wgUser->isSysop();
12 $target = wfCleanQueryVar( $target );
14 if ( "" == $target ) {
15 $wgOut->errorpage( "notargettitle", "notargettext" );
18 list( $limit, $offset ) = wfCheckLimits( 50, "" );
20 $nt = Title
::newFromURL( $target );
21 $nt->setNamespace( Namespace::getUser() );
23 $sk = $wgUser->getSkin();
24 $id = User
::idFromName( $nt->getText() );
26 if ( 0 == $id ) { $ul = $nt->getText(); }
28 $ul = $sk->makeKnownLink( $nt->getPrefixedText(), $nt->getText() );
30 $sub = str_replace( "$1", $ul, wfMsg( "contribsub" ) );
31 $wgOut->setSubtitle( $sub );
33 if ( ! isset( $hideminor ) ) {
34 $hideminor = $wgUser->getOption( "hideminor" );
37 $cmq = "AND cur_minor_edit=0";
38 $omq = "AND old_minor_edit=0";
39 } else { $cmq = $omq = ""; }
41 $top = wfShowingResults( $offset, $limit );
42 $wgOut->addHTML( "<p>{$top}\n" );
44 $sl = wfViewPrevNext( $offset, $limit,
45 $wgLang->specialpage( "Contributions" ), "target=" . wfUrlEncode( $target ) );
46 $wgOut->addHTML( "<br>{$sl}\n" );
49 $sql = "SELECT cur_namespace,cur_title,cur_timestamp,cur_comment FROM cur " .
50 "WHERE cur_user_text='" . wfStrencode( $nt->getText() ) . "' {$cmq} " .
51 "ORDER BY inverse_timestamp LIMIT {$offset}, {$limit}";
52 $res1 = wfQuery( $sql, $fname );
54 $sql = "SELECT old_namespace,old_title,old_timestamp,old_comment FROM old " .
55 "WHERE old_user_text='" . wfStrencode( $nt->getText() ) . "' {$omq} " .
56 "ORDER BY inverse_timestamp LIMIT {$offset}, {$limit}";
57 $res2 = wfQuery( $sql, $fname );
59 $sql = "SELECT cur_namespace,cur_title,cur_timestamp,cur_comment FROM cur " .
60 "WHERE cur_user={$id} {$cmq} ORDER BY inverse_timestamp LIMIT {$offset}, {$limit}";
61 $res1 = wfQuery( $sql, $fname );
63 $sql = "SELECT old_namespace,old_title,old_timestamp,old_comment FROM old " .
64 "WHERE old_user={$id} {$omq} ORDER BY inverse_timestamp LIMIT {$offset}, {$limit}";
65 $res2 = wfQuery( $sql, $fname );
67 $nCur = wfNumRows( $res1 );
68 $nOld = wfNumRows( $res2 );
71 if ( 0 == $nCur && 0 == $nOld ) {
72 $wgOut->addHTML( "\n<p>" . wfMsg( "nocontribs" ) . "</p>\n" );
75 if ( 0 != $nCur ) { $obj1 = wfFetchObject( $res1 ); }
76 if ( 0 != $nOld ) { $obj2 = wfFetchObject( $res2 ); }
78 $wgOut->addHTML( "<ul>\n" );
80 if ( 0 == $nCur && 0 == $nOld ) { break; }
82 if ( ( 0 == $nOld ) ||
84 ( $obj1->cur_timestamp
>= $obj2->old_timestamp
) ) ) {
85 $ns = $obj1->cur_namespace
;
86 $t = $obj1->cur_title
;
87 $ts = $obj1->cur_timestamp
;
88 $comment =$obj1->cur_comment
;
90 $obj1 = wfFetchObject( $res1 );
94 $ns = $obj2->old_namespace
;
95 $t = $obj2->old_title
;
96 $ts = $obj2->old_timestamp
;
97 $comment =$obj2->old_comment
;
99 $obj2 = wfFetchObject( $res2 );
103 ucListEdit( $sk, $ns, $t, $ts, $topmark, $comment );
107 $wgOut->addHTML( "</ul>\n" );
110 function ucListEdit( $sk, $ns, $t, $ts, $topmark, $comment )
112 global $wgLang, $wgOut, $wgUser, $target;
113 $page = Title
::makeName( $ns, $t );
114 $link = $sk->makeKnownLink( $page, "" );
115 $topmarktext = $topmark ?
wfMsg ( "uctop" ) : "";
116 $sysop = $wgUser->isSysop();
117 if($sysop && $topmark ) {
118 $topmarktext .= " [". $sk->makeKnownLink( $page,
119 wfMsg( "rollbacklink" ), "action=rollback&from=" . urlencode( $target ) ) ."]";
123 $comment="<em>(". htmlspecialchars( $comment ) .")</em> ";
126 $d = $wgLang->timeanddate( $ts, true );
128 $wgOut->addHTML( "<li>{$d} {$link} {$comment}{$topmarktext}</li>\n" );
131 function ucCountLink( $lim, $d )
133 global $wgUser, $wgLang, $target;
135 $sk = $wgUser->getSkin();
136 $s = $sk->makeKnownLink( $wgLang->specialPage( "Contributions" ),
137 "{$lim}", "target={$target}&days={$d}&limit={$lim}" );
141 function ucDaysLink( $lim, $d )
143 global $wgUser, $wgLang, $target;
145 $sk = $wgUser->getSkin();
146 $s = $sk->makeKnownLink( $wgLang->specialPage( "Contributions" ),
147 "{$d}", "target={$target}&days={$d}&limit={$lim}" );