setFetchMode(DB_FETCHMODE_ASSOC); $sql = "select * from events order by event_tstamp desc limit $limit"; $res =& $db->Query($sql); if (DB::isError($res)) die("Query error"); header ("Content-type: text/xml"); $timeline .= ''."\n"; $timeline .= 'CRUX timelineCRUX: timeline (commits, tasks, wiki edits)http://crux.nu'; while ($evt =& $res->fetchRow()) { $url = $evt['event_url']; $url = str_replace("&","&", $url); # strip diff link $description = preg_replace('/\(\[\[.*\]\]\)/s','', $evt['event_description']); # strip wiki link with url $description = preg_replace('/\[\[(.*)\|(\d+)\]\]/s','$2', $description); # strip users (git) $description = preg_replace('/\[\[~(.*)\|(.*)\]\]/s','$2', $description); # strip wiki link without url $description = preg_replace('/\[\[(\w+)\.(\w+)\]\] /s','$1.$2', $description); # strip wiki user with ~ $description = preg_replace('/\[\[~(\w+)\]\] /s','$1', $description); # Compact description for git commits $description = preg_replace('/\[\[http(.*)\|(.*)\]\] committed by/','$2 by', $description); # Compact description for wiki edits $description = str_replace ("Wiki page ","", $description); $notes = ""; $titlenotes = ""; if ($evt['event_notes'] != "") { $notes = $evt['event_notes']; $titlenotes = ": ".$notes; if (strlen($notes) > 40) { $titlenotes = ": ".substr($notes,0,40)."..."; } } $timeline .= " $description$titlenotes $notes $url \n"; } $timeline .= "\n"; echo $timeline; ?>