5 foreach (glob("$Page$Args/2*") as $url) {
6 $link = preg_replace('/\.html$/', '', $url);
7 $name = pathinfo($link, PATHINFO_BASENAME);
8 @list ($date, $suffix) = explode('.', $name, 2);
9 if (!isset($cal[$date])) {
12 if (!is_dir($url) and filesize($url)) {
13 $cal[$date][$suffix] = $link;
17 $year = 3600 * 24 * 365; # seconds per year
18 $scale = 8; # em width per year
19 $mindate = strtotime($date) + ($year / $scale * 3); # first point plus about 3em for centered text
21 print '<ul class="timeline">'."\n";
22 foreach (array_reverse($cal) as $title => $versions) {
24 $subtime = ($mindate - strtotime($title)) / $year * $scale - $time;
25 printf('<li style="left:%.1fem">', $subtime);
26 if ($url = @$versions['']) {
27 printf('<a href="/%s">%s</a>', $url, $title);
32 if ($versions and $User->admin("edit $Page$Args")) {
33 printf(' (%s)', implode(', ', array_map(
34 function ($format, $url) {
35 return sprintf('<a href="/%s">%s</a>', $url, $format);
37 array_keys($versions), $versions