Main Page | Namespace List | Class Hierarchy | Class List | File List | Class Members | File Members | Related Pages

SpecialRecentchangeslinked.php

Go to the documentation of this file.
00001 <?php 00002 require_once( "SpecialRecentchanges.php" ); 00003 00004 function wfSpecialRecentchangeslinked( $par = NULL ) 00005 { 00006 global $wgUser, $wgOut, $wgLang, $wgTitle, $wgRequest; 00007 $fname = "wfSpecialRecentchangeslinked"; 00008 00009 $days = $wgRequest->getInt( 'days' ); 00010 $target = $wgRequest->getText( 'target' ); 00011 $hideminor = $wgRequest->getBool( 'hideminor' ) ? 1 : 0; 00012 00013 $wgOut->setPagetitle( wfMsg( "recentchanges" ) ); 00014 $sk = $wgUser->getSkin(); 00015 00016 if( $par ) { 00017 $target = $par; 00018 } 00019 if ( "" == $target ) { 00020 $wgOut->errorpage( "notargettitle", "notargettext" ); 00021 return; 00022 } 00023 $nt = Title::newFromURL( $target ); 00024 if( !$nt ) { 00025 $wgOut->errorpage( "notargettitle", "notargettext" ); 00026 return; 00027 } 00028 $id = $nt->getArticleId(); 00029 00030 $wgOut->setSubtitle( wfMsg( "rclsub", $nt->getPrefixedText() ) ); 00031 00032 if ( ! $days ) { 00033 $days = $wgUser->getOption( "rcdays" ); 00034 if ( ! $days ) { $days = 7; } 00035 } 00036 $days = (int)$days; 00037 list( $limit, $offset ) = wfCheckLimits( 100, "rclimit" ); 00038 $cutoff = wfUnix2Timestamp( time() - ( $days * 86400 ) ); 00039 00040 $hideminor = ($hideminor ? 1 : 0); 00041 if ( $hideminor ) { 00042 $mlink = $sk->makeKnownLink( $wgLang->specialPage( "Recentchangeslinked" ), 00043 WfMsg( "show" ), "target=" . wfEscapeHTML( $nt->getPrefixedURL() ) . 00044 "&days={$days}&limit={$limit}&hideminor=0" ); 00045 } else { 00046 $mlink = $sk->makeKnownLink( $wgLang->specialPage( "Recentchangeslinked" ), 00047 WfMsg( "hide" ), "target=" . wfEscapeHTML( $nt->getPrefixedURL() ) . 00048 "&days={$days}&limit={$limit}&hideminor=1" ); 00049 } 00050 if ( $hideminor ) { 00051 $cmq = "AND cur_minor_edit=0"; 00052 } else { $cmq = ""; } 00053 00054 $sql = "SELECT cur_id,cur_namespace,cur_title,cur_user,cur_comment," . 00055 "cur_user_text,cur_timestamp,cur_minor_edit,cur_is_new FROM links, cur " . 00056 "WHERE cur_timestamp > '{$cutoff}' {$cmq} AND l_to=cur_id AND l_from=$id " . 00057 "GROUP BY cur_id ORDER BY inverse_timestamp LIMIT {$limit}"; 00058 $res = wfQuery( $sql, DB_READ, $fname ); 00059 00060 $wgOut->addHTML("&lt; ".$sk->makeKnownLinkObj($nt, "", "redirect=no" )."<br />\n"); 00061 $note = wfMsg( "rcnote", $limit, $days ); 00062 $wgOut->addHTML( "<hr />\n{$note}\n<br />" ); 00063 00064 $note = rcDayLimitlinks( $days, $limit, "Recentchangeslinked", 00065 "target=" . $nt->getPrefixedURL() . "&hideminor={$hideminor}", 00066 false, $mlink ); 00067 00068 $wgOut->addHTML( "{$note}\n" ); 00069 00070 $s = $sk->beginRecentChangesList(); 00071 $count = wfNumRows( $res ); 00072 00073 $counter = 1; 00074 while ( $limit ) { 00075 if ( 0 == $count ) { break; } 00076 $obj = wfFetchObject( $res ); 00077 --$count; 00078 00079 $rc = RecentChange::newFromCurRow( $obj ); 00080 $rc->counter = $counter++; 00081 $s .= $sk->recentChangesLine( $rc ); 00082 --$limit; 00083 } 00084 $s .= $sk->endRecentChangesList(); 00085 00086 wfFreeResult( $res ); 00087 $wgOut->addHTML( $s ); 00088 } 00089 00090 ?>

Generated on Tue Jun 29 23:40:07 2004 for Mediawiki by doxygen 1.3.7