widget/reply: redirect to created comment
[minimedit.git] / issue / index.php
index e8a36d21e2efb3f3470f2ff17441b553a46e7f59..62182ac28356c72c40bc029118f9c798a6497bc7 100644 (file)
@@ -5,7 +5,7 @@ require_once 'database.inc.php';
 
 if ($id and ctype_digit($id)) {
        $Page->title = "Issue #$id";
-       $Page->path = "/$id";  # minimal reference
+       $Page->link = $Page->handler . ($Page->path = "/$id");  # minimal reference
        $Issue = $Db->query(
                'SELECT * FROM issues WHERE page = ? AND id = ?', [$Page->handler, $id]
        )->fetch();
@@ -15,7 +15,7 @@ if ($id and ctype_digit($id)) {
 
        $Page->title .= ': '.htmlspecialchars($Issue->subject);
        $Page->teaser = $Issue->body;
-       if (!$User) return;
+       if ($Page->api) return;
        $Page->body = $replies;  # find image
 
        print "<h2>{$Page->title}</h2>\n";
@@ -41,7 +41,6 @@ if ($id and ctype_digit($id)) {
        print "</div>\n";
        return;
 }
-elseif (!$User) return;
 
 if ($_POST) {
                require_once 'upload.inc.php';
@@ -56,6 +55,7 @@ if ($_POST) {
                }
                $_POST = [];
 }
+if ($Page->api) return;
 
 $subsql = "SELECT count(*) FROM comments WHERE page=i.page||'/'||i.id";
 $cols = "*, ($subsql AND message IS NOT NULL) AS replycount";