widget/reply: redirect to created comment
[minimedit.git] / widget / reply.php
index 1f6d0e2ff0352f709ff0223fdd455c1d3962eded..0935567e82ecb51ba2aeb4ff0a6717b50e313abe 100644 (file)
@@ -61,9 +61,8 @@ if ($_POST) {
                        }
                }
 
-               if ($Page->api) {
-                       abort("/{$Page->link}", '200 reply success');
-               }
+               $target = "/{$Page->link}/$newcomment#$newcomment";
+               abort($target, ($Page->api ? 200 : 303) . ' reply success');
                $_POST['reply'] = NULL;
        }
        catch (Exception $e) {
@@ -81,7 +80,7 @@ print '<ul class="replies">';
 
 while ($row = $query->fetch()) {
        $rowuser = new User("profile/{$row->author}");
-       print '<li>';
+       printf('<li id="%d">', $row->id);
        printf('<strong>%s</strong> <small class=date>%s</small>',
                $rowuser->html, showdate(preg_split('/\D/', $row->created))
        );