Difference between revisions of "RC-Summary.php"

From Organic Design wiki
m
m
Line 29: Line 29:
 
xwSetProperty($properties, 'view', $tTitle);
 
xwSetProperty($properties, 'view', $tTitle);
 
# Only return content if first ID changed
 
# Only return content if first ID changed
$$title = $swf == $first ? '' : join( '&', $changes ) )
+
$$title = $swf == $first ? '' : join( '&', $changes ) );
 
$$title = preg_replace( "/\\[{2}(.+?)\\|(.+?)\\]{2}/", '<u><a href="$1">$2</a></u>', $$title );
 
$$title = preg_replace( "/\\[{2}(.+?)\\|(.+?)\\]{2}/", '<u><a href="$1">$2</a></u>', $$title );
 
$$title = preg_replace( "/\\[{2}(.+?)\\]{2}/", '<u><a href="$1">$1</a></u>', $$title );
 
$$title = preg_replace( "/\\[{2}(.+?)\\]{2}/", '<u><a href="$1">$1</a></u>', $$title );

Revision as of 20:29, 27 February 2006

<?

  1. Appends article with a compact list of last 5 non-minor changes

global $wgLang, $wgContLang, $$title; if ( $event == 'view' ) { $article = $$title; header( 'Content-type: application/x-www-urlform-encoded' ); } 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 10 "); # Format the items for display $changes = array(); $i = -1; 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']; $id = $row['rc_id']; $changes[++$i] = "item$i=$id,$t,".$row['rc_user_text'].",$a,".$row['rc_comment']; if ($i == 0) $first = $id; } # If SWF format requested, remove all view-transforms and replace with self if ( $swf = $_REQUEST['SWF'] ) { xwRemoveElement( $properties, 'view' ); xwSetProperty($properties, 'view', $tTitle); # Only return content if first ID changed $$title = $swf == $first ?  : join( '&', $changes ) ); $$title = preg_replace( "/\\[{2}(.+?)\\|(.+?)\\]{2}/", '<a href="$1">$2</a>', $$title ); $$title = preg_replace( "/\\[{2}(.+?)\\]{2}/", '<a href="$1">$1</a>', $$title ); } # SWF not requested, render a nice table for embedding else { $article = join( '
', $changes ); } } ?>