Difference between revisions of "RC-Summary.php"

From Organic Design wiki
m
(Trying to return raw but processed content if SWF in QS)
Line 1: Line 1:
 
<?
 
<?
# Appends article with a compact list of last 5 non-minor changes
+
if ($event == 'data') {
global $wgLang, $wgContLang;
+
# Appends article with a compact list of last 5 non-minor changes
$db =& wfGetDB( DB_MASTER );
+
global $wgLang, $wgContLang;
$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" );
+
$db =& wfGetDB( DB_MASTER );
$changes = array();
+
$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" );
while ($row = mysql_fetch_assoc($result)) {
+
$changes = array();
$time = $wgLang->time( $row['rc_timestamp'], true );
+
while ($row = mysql_fetch_assoc($result)) {
$ns = $wgContLang->getNsText( $row['rc_namespace'] );
+
$time = $wgLang->time( $row['rc_timestamp'], true );
$title = $ns ? "$ns:".$row['rc_title'] : $row['rc_title'];
+
$ns = $wgContLang->getNsText( $row['rc_namespace'] );
$changes[] = 'id'.$row['rc_id']."=$time,".$row['rc_user_text'].",$title,".$row['rc_comment'];
+
$title = $ns ? "$ns:".$row['rc_title'] : $row['rc_title'];
 +
$changes[] = 'id'.$row['rc_id']."=$time,".$row['rc_user_text'].",$title,".$row['rc_comment'];
 +
}
 +
if ($_REQUEST['SWF']) {
 +
xwSetProperty( $properties, 'view', $tTitle );
 +
$GLOBALS[$title] = join( '&', $changes );
 +
}
 +
else $article = join( '<br>', $changes );
 
}
 
}
if ($_REQUEST['SWF']) {
+
elseif ($event == 'view' ) {
$article = join( '&', $changes );
+
$article = $GLOBALS[$title];
xwSetProperty( $properties, 'view' );
 
$GLOBALS['xwRaw'] = 1;
 
 
}
 
}
else $article = join( '<br>', $changes );
 
 
?>
 
?>

Revision as of 20:44, 23 February 2006

<? if ($event == 'data') { # Appends article with a compact list of last 5 non-minor changes global $wgLang, $wgContLang; $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" ); $changes = array(); while ($row = mysql_fetch_assoc($result)) { $time = $wgLang->time( $row['rc_timestamp'], true ); $ns = $wgContLang->getNsText( $row['rc_namespace'] ); $title = $ns ? "$ns:".$row['rc_title'] : $row['rc_title']; $changes[] = 'id'.$row['rc_id']."=$time,".$row['rc_user_text'].",$title,".$row['rc_comment']; } if ($_REQUEST['SWF']) { xwSetProperty( $properties, 'view', $tTitle ); $GLOBALS[$title] = join( '&', $changes ); } else $article = join( '
', $changes ); } elseif ($event == 'view' ) { $article = $GLOBALS[$title]; } ?>