3 * This is to display changes made to all articles linked in an article.
4 * @addtogroup SpecialPage
10 require_once( 'SpecialRecentchanges.php' );
14 * @param string $par parent page we will look at
16 function wfSpecialRecentchangeslinked( $par = NULL ) {
17 global $wgUser, $wgOut, $wgLang, $wgContLang, $wgRequest, $wgTitle, $wgScript;
18 $fname = 'wfSpecialRecentchangeslinked';
20 $days = $wgRequest->getInt( 'days' );
21 $target = isset($par) ?
$par : $wgRequest->getText( 'target' );
22 $hideminor = $wgRequest->getBool( 'hideminor' ) ?
1 : 0;
24 $wgOut->setPagetitle( wfMsg( 'recentchangeslinked' ) );
25 $sk = $wgUser->getSkin();
28 Xml
::openElement( 'form', array( 'method' => 'get', 'action' => $wgScript ) ) .
29 Xml
::openElement( 'fieldset' ) .
30 Xml
::element( 'legend', array(), wfMsg( 'recentchangeslinked' ) ) . "\n" .
31 Xml
::inputLabel( wfMsg( 'recentchangeslinked-page' ), 'target', 'recentchangeslinked-target', 40, $target ) .
32 Xml
::hidden( 'title', $wgTitle->getPrefixedText() ). "\n" .
33 Xml
::submitButton( wfMsg( 'allpagessubmit' ) ) . "\n" .
34 Xml
::closeElement( 'fieldset' ) .
35 Xml
::closeElement( 'form' ) . "\n"
41 $nt = Title
::newFromURL( $target );
43 $wgOut->showErrorPage( 'notargettitle', 'notargettext' );
46 $id = $nt->getArticleId();
48 $wgOut->setPageTitle( wfMsg( 'recentchangeslinked-title', $nt->getPrefixedText() ) );
49 $wgOut->setSyndicated();
50 $wgOut->setFeedAppendQuery( "target=" . urlencode( $target ) );
53 $days = (int)$wgUser->getOption( 'rcdays', 7 );
55 list( $limit, /* offset */ ) = wfCheckLimits( 100, 'rclimit' );
57 $dbr = wfGetDB( DB_SLAVE
,'recentchangeslinked' );
58 $cutoff = $dbr->timestamp( time() - ( $days * 86400 ) );
60 $hideminor = ($hideminor ?
1 : 0);
62 $mlink = $sk->makeKnownLink( $wgContLang->specialPage( 'Recentchangeslinked' ),
63 wfMsg( 'show' ), 'target=' . htmlspecialchars( $nt->getPrefixedURL() ) .
64 "&days={$days}&limit={$limit}&hideminor=0" );
66 $mlink = $sk->makeKnownLink( $wgContLang->specialPage( "Recentchangeslinked" ),
67 wfMsg( "hide" ), "target=" . htmlspecialchars( $nt->getPrefixedURL() ) .
68 "&days={$days}&limit={$limit}&hideminor=1" );
71 $cmq = 'AND rc_minor=0';
74 list($recentchanges, $categorylinks, $pagelinks, $watchlist) =
75 $dbr->tableNamesN( 'recentchanges', 'categorylinks', 'pagelinks', "watchlist" );
77 $uid = $wgUser->getID();
80 GROUP BY rc_cur_id,rc_namespace,rc_title,
81 rc_user,rc_comment,rc_user_text,rc_timestamp,rc_minor,rc_log_type,rc_log_action,rc_params,rc_deleted,
82 rc_new, rc_id, rc_this_oldid, rc_last_oldid, rc_bot, rc_patrolled, rc_type, rc_old_len, rc_new_len
83 " . ($uid ?
",wl_user" : "") . "
84 ORDER BY rc_timestamp DESC
87 // If target is a Category, use categorylinks and invert from and to
88 if( $nt->getNamespace() == NS_CATEGORY
) {
89 $catkey = $dbr->addQuotes( $nt->getDBkey() );
90 $sql = "SELECT /* wfSpecialRecentchangeslinked */
112 " . ($uid ?
",wl_user" : "") . "
113 FROM $categorylinks, $recentchanges
114 " . ($uid ?
"LEFT OUTER JOIN $watchlist ON wl_user={$uid} AND wl_title=rc_title AND wl_namespace=rc_namespace " : "") . "
115 WHERE rc_timestamp > '{$cutoff}'
117 AND cl_from=rc_cur_id
123 "SELECT /* wfSpecialRecentchangeslinked */
145 " . ($uid ?
",wl_user" : "") . "
146 FROM $pagelinks, $recentchanges
147 " . ($uid ?
" LEFT OUTER JOIN $watchlist ON wl_user={$uid} AND wl_title=rc_title AND wl_namespace=rc_namespace " : "") . "
148 WHERE rc_timestamp > '{$cutoff}'
150 AND pl_namespace=rc_namespace
151 AND pl_title=rc_title
156 $res = $dbr->query( $sql, $fname );
158 $wgOut->addHTML("< ".$sk->makeLinkObj($nt, "", "redirect=no" )."<br />\n");
159 $note = wfMsgExt( "rcnote", array ( 'parseinline' ), $limit, $days, $wgLang->timeAndDate( wfTimestampNow(), true ) );
160 $wgOut->addHTML( "<hr />\n{$note}\n<br />" );
162 $note = rcDayLimitlinks( $days, $limit, "Recentchangeslinked",
163 "target=" . $nt->getPrefixedURL() . "&hideminor={$hideminor}",
166 $wgOut->addHTML( $note."\n" );
168 $list = ChangesList
::newFromUser( $wgUser );
169 $s = $list->beginRecentChangesList();
170 $count = $dbr->numRows( $res );
176 if ( 0 == $count ) { break; }
177 $obj = $dbr->fetchObject( $res );
179 $rc = RecentChange
::newFromRow( $obj );
180 $rc->counter
= $counter++
;
181 $s .= $list->recentChangesLine( $rc , !empty( $obj->wl_user
) );
186 $wgOut->addWikiMsg('recentchangeslinked-noresult');
188 $s .= $list->endRecentChangesList();
190 $dbr->freeResult( $res );
191 $wgOut->addHTML( $s );
193 global $wgSitename, $wgFeedClasses, $wgContLanguageCode;
194 $feedFormat = $wgRequest->getVal( 'feed' );
195 if( $feedFormat && isset( $wgFeedClasses[$feedFormat] ) ) {
196 $feedTitle = $wgSitename . ' - ' . wfMsgForContent( 'recentchangeslinked-title', $nt->getPrefixedText() ) . ' [' . $wgContLanguageCode . ']';
197 $feed = new $wgFeedClasses[$feedFormat]( $feedTitle,
198 htmlspecialchars( wfMsgForContent('recentchangeslinked') ), $wgTitle->getFullUrl() );
200 require_once( "SpecialRecentchanges.php" );
202 rcDoOutputFeed( $rchanges, $feed );