login/pass: error messages below page title
[minimedit.git] / widget / doclist.php
index 589c8d6afcb5a05ccc494d74fc39a70ad5bf4127..e0751b0df77b1c593189c860ba4c824cfca64911 100644 (file)
@@ -1,8 +1,11 @@
 <?php
 global $User;
+if (isset($Page->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 '<span>';
                        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('<a href="/%s">%s</a>', $url, $format);