Matt Housh
8798926ff2
This should get the repo in sync with the last live versions of the timeline cacher and RSS feed generator on the previous crux.nu server.
108 lines
3.1 KiB
PHP
Executable File
108 lines
3.1 KiB
PHP
Executable File
<?php
|
|
|
|
// to obtain a list of wiki profiles:
|
|
// $ ls -1 /var/www/htdocs/wiki.d/Profiles.* | cut -d. -f2- | grep -v ,del
|
|
|
|
$profiles = array(
|
|
"AlanMizrahi",
|
|
"AnttiNykanen",
|
|
"BrettGoulder",
|
|
"DanielMueller",
|
|
"DannyRawlins",
|
|
"FalkHamann",
|
|
"Fredrik",
|
|
"FredrikRinnestam",
|
|
"Frinnst",
|
|
"Jaeger",
|
|
"JamesMills",
|
|
"JasonThomasDolan",
|
|
"JohannesWinkelmann",
|
|
"JonathanAsghar",
|
|
"JoseBeneyto",
|
|
"JoseVBeneyto",
|
|
"JuergenDaubert",
|
|
"JukkaHeino",
|
|
"JustinRebelo",
|
|
"LucasHazel",
|
|
"MattHoush",
|
|
"MaximilianDietrich",
|
|
"NickSteeves",
|
|
"PageIndex",
|
|
"PerLiden",
|
|
"Profiles",
|
|
"RecentChanges",
|
|
"SimoneRota",
|
|
"ThomasPenteker",
|
|
"TillBiedermann",
|
|
"TilmanSauerbeck"
|
|
);
|
|
|
|
//Markup("timeline", "directives", "/\\(:timeline(\\s+.*)?\\s*:\\)/e", "'<:block>'.GetEvents()");
|
|
Markup("timeline", "directives", "/\\(:timeline(\\s+.*)?\\s*:\\)/", "GetEvents");
|
|
|
|
function GetEvents() {
|
|
|
|
global $profiles;
|
|
|
|
$days = 14;
|
|
if (isset($_POST['days'])) $days = intval($_POST['days']);
|
|
|
|
$dbfile = '/home/crux/timeline/timeline.db';
|
|
$db = new SQLite3($dbfile);
|
|
$from = time() - ($days * 24 * 60 * 60);
|
|
$sql = "select distinct event_date, event_description, event_notes, event_type, event_time from events where event_tstamp >= $from order by event_tstamp desc";
|
|
$res = $db->query($sql);
|
|
if (!$res) die("Query error: $sql");
|
|
|
|
$timeline .= '<table cellspacing="0" border="0" cellpadding="0">'."\n";
|
|
$currdate = "noway";
|
|
|
|
while ($evt =& $res->fetchArray()) {
|
|
|
|
// date header
|
|
if ($evt['event_date'] != $currdate) {
|
|
$timeline .= '<tr><td class="timeline-head" colspan="3"><span class="timeline-date">'.$evt['event_date']."</span></td></tr>\n";
|
|
}
|
|
|
|
// description
|
|
$event_description = "";
|
|
if (substr($evt['event_type'], 0, 5) == "task_") {
|
|
// flyspray events
|
|
$real_name = strstr($evt['event_description'], 'by');
|
|
$real_name = substr($real_name, 3, strlen($real_name));
|
|
$trim_name = str_replace(' ', '', $real_name);
|
|
if (in_array($trim_name, $profiles)) {
|
|
$event_description = str_replace($real_name, "[[~".$trim_name."]]", $evt['event_description']);
|
|
}
|
|
else {
|
|
$event_description = $evt['event_description'];
|
|
}
|
|
}
|
|
elseif (substr($evt['event_type'], 0, 5) == "wiki_") {
|
|
// wiki events
|
|
$event_description = $evt['event_description'];
|
|
}
|
|
elseif (substr($evt['event_type'], 0, 11) == "git_commit_") {
|
|
// git events
|
|
$event_description = "Changeset ".substr($evt['event_type'], 11, strlen($evt['event_type'])).".git ".$evt['event_description'];
|
|
}
|
|
|
|
// append notes
|
|
if ($evt['event_notes'] != "") $event_description .= ": ".$evt['event_notes'];
|
|
|
|
// image
|
|
$img = '<img src="/images/'.$evt['event_type'].'.png">';
|
|
|
|
// final string
|
|
$timeline .= '<tr><td align="right" valign="top" width="60">'.$evt['event_time'].'</td><td align="center" valign="top" width="30">'.$img.'</td><td valign="top">'.$event_description.'</td></tr>'."\n";
|
|
$currdate = $evt['event_date'];
|
|
}
|
|
|
|
$timeline .= "</table>\n";
|
|
$timeline .= '<br><form method="post" action="pmwiki.php?n=Main.Timeline">Show the latest <input size="4" type="text" name="days" value="'.$days.'"> days <input type="submit" value="Show"></form>'."\n";
|
|
|
|
return $timeline;
|
|
}
|
|
|
|
?>
|