Difference between revisions of "RC-Summary.php"
(tidy up) |
(Add comments) |
||
Line 4: | Line 4: | ||
if ( $event == 'view' ) $article = $$title; | if ( $event == 'view' ) $article = $$title; | ||
else { | else { | ||
+ | # Get the changes from the db | ||
$db =& wfGetDB( DB_MASTER ); | $db =& wfGetDB( DB_MASTER ); | ||
$result = $db->query(" | $result = $db->query(" | ||
Line 9: | Line 10: | ||
FROM recentchanges WHERE rc_minor=0 ORDER BY rc_timestamp DESC LIMIT 5 | FROM recentchanges WHERE rc_minor=0 ORDER BY rc_timestamp DESC LIMIT 5 | ||
"); | "); | ||
+ | # Format the items for display | ||
$changes = array(); | $changes = array(); | ||
while ($row = mysql_fetch_assoc($result)) { | while ($row = mysql_fetch_assoc($result)) { | ||
Line 16: | Line 18: | ||
$changes[] = 'id'.$row['rc_id']."=$t,".$row['rc_user_text'].",$a,".$row['rc_comment']; | $changes[] = 'id'.$row['rc_id']."=$t,".$row['rc_user_text'].",$a,".$row['rc_comment']; | ||
} | } | ||
+ | # If SWF format requested, remove all view-transforms and replace with self | ||
if ( $_REQUEST['SWF'] ) { | if ( $_REQUEST['SWF'] ) { | ||
− | |||
xwRemoveElement( $properties, 'view' ); | xwRemoveElement( $properties, 'view' ); | ||
xwSetProperty($properties, 'view', $tTitle); | xwSetProperty($properties, 'view', $tTitle); |
Revision as of 00:17, 24 February 2006
<?
- Appends article with a compact list of last 5 non-minor changes
global $wgLang, $wgContLang, $$title;
if ( $event == 'view' ) $article = $$title;
else {
# Get the changes from the db
$db =& wfGetDB( DB_MASTER );
$result = $db->query("
SELECT rc_id, rc_timestamp, rc_user_text, rc_namespace, rc_title, rc_comment
FROM recentchanges WHERE rc_minor=0 ORDER BY rc_timestamp DESC LIMIT 5
");
# Format the items for display
$changes = array();
while ($row = mysql_fetch_assoc($result)) {
$t = $wgLang->time( $row['rc_timestamp'], true );
$n = $wgContLang->getNsText( $row['rc_namespace'] );
$a = $n ? "$n:".$row['rc_title'] : $row['rc_title'];
$changes[] = 'id'.$row['rc_id']."=$t,".$row['rc_user_text'].",$a,".$row['rc_comment'];
}
# If SWF format requested, remove all view-transforms and replace with self
if ( $_REQUEST['SWF'] ) {
xwRemoveElement( $properties, 'view' );
xwSetProperty($properties, 'view', $tTitle);
$$title = join( '&', $changes );
}
else $article = join( '
', $changes );
}
?>