X-Git-Url: http://git.shiar.nl/minimedit.git/blobdiff_plain/9c21cd6f446eccf22be5bd4e4075255e9a614c2d..HEAD:/widget/doclist.php diff --git a/widget/doclist.php b/widget/doclist.php index 589c8d6..e0751b0 100644 --- a/widget/doclist.php +++ b/widget/doclist.php @@ -1,8 +1,11 @@ place[0])) { + $Page->link .= '/'.$Page->place[0]; +} $cal = []; -foreach (glob("$Page$Args/2*") as $url) { +foreach (glob("{$Page->link}/2*") as $url) { $link = preg_replace('/\.html$/', '', $url); $name = pathinfo($link, PATHINFO_BASENAME); @list ($date, $suffix) = explode('.', $name, 2); @@ -10,10 +13,13 @@ foreach (glob("$Page$Args/2*") as $url) { if (!isset($cal[$group][$date])) { $cal[$group][$date] = []; } - if (!is_dir($url) and filesize($url)) { + if (is_dir($url) ? file_exists("$url/index.html") : filesize($url)) { $cal[$group][$date][$suffix] = $link; } } +if (!$cal) { + return; +} $year = 3600 * 24 * 365; # seconds per year $scale = 7; # em width per year @@ -42,7 +48,7 @@ foreach (array_reverse($cal, TRUE) as $group => $rows) { else { print ''; print $title; - if ($versions and $User->admin("edit $Page$Args")) { + if ($versions and $User->admin("edit {$Page->link}")) { printf(' (%s)', implode(', ', array_map( function ($format, $url) { return sprintf('%s', $url, $format);