$talkpage = $title->getTalkPage();
$item = new FeedItem(
$title->getPrefixedText(),
- htmlspecialchars( $obj->rc_comment ),
+ rcFormatDiff( $obj ),
$title->getFullURL(),
$obj->rc_timestamp,
$obj->rc_user_text,
return $note;
}
+function rcFormatDiff( $row ) {
+ require_once( 'DifferenceEngine.php' );
+ $comment = "<p>" . htmlspecialchars( $row->rc_comment ) . "</p>\n";
+
+ if( $row->rc_namespace >= 0 ) {
+ global $wgContLang;
+
+ #$diff =& new DifferenceEngine( $row->rc_this_oldid, $row->rc_last_oldid, $row->rc_id );
+ #$diff->showDiffPage();
+
+ $dbr =& wfGetDB( DB_SLAVE );
+ if( $row->rc_this_oldid ) {
+ $newrow = $dbr->selectRow( 'old',
+ array( 'old_flags', 'old_text' ),
+ array( 'old_id' => $row->rc_this_oldid ) );
+ $newtext = Article::getRevisionText( $newrow );
+ } else {
+ $newrow = $dbr->selectRow( 'cur',
+ array( 'cur_text' ),
+ array( 'cur_id' => $row->rc_cur_id ) );
+ $newtext = $newrow->cur_text;
+ }
+ if( $row->rc_last_oldid ) {
+ $oldrow = $dbr->selectRow( 'old',
+ array( 'old_flags', 'old_text' ),
+ array( 'old_id' => $row->rc_last_oldid ) );
+ $oldtext = Article::getRevisionText( $oldrow );
+ $diffText = DifferenceEngine::getDiff( $oldtext, $newtext,
+ wfMsg( 'revisionasof', $wgContLang->timeanddate( $row->rc_timestamp ) ),
+ wfMsg( 'currentrev' ) );
+ } else {
+ $diffText = '<p><b>' . wfMsg( 'newpage' ) . '</b></p>' .
+ '<div>' . nl2br( htmlspecialchars( $newtext ) ) . '</div>';
+ }
+
+ return $comment . $diffText;
+ }
+
+ return $comment;
+}
+
?>