diff --git a/core/util.inc.php b/core/util.inc.php index 09e3a85c..652db51c 100644 --- a/core/util.inc.php +++ b/core/util.inc.php @@ -90,6 +90,20 @@ function to_shorthand_int($int) { } +/** + * Turn a date into a time, a date, an "X minutes ago...", etc + * + * Currently missing step 2 + * + * @retval string + */ +function autodate($date) { + $ts = strtotime($date); + // Step 2: ... + return $date; +} + + /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *\ * HTML Generation * \* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ diff --git a/ext/comment/main.php b/ext/comment/main.php index f6b7fd26..96abf62b 100644 --- a/ext/comment/main.php +++ b/ext/comment/main.php @@ -126,7 +126,7 @@ class CommentList implements Extension { $page, $this->get_comments($event->image->id), $this->can_comment(), - $event->image->id); + $event->image); } if($event instanceof ImageDeletionEvent) { diff --git a/themes/danbooru/comment.theme.php b/themes/danbooru/comment.theme.php index d97afc97..2052ff78 100644 --- a/themes/danbooru/comment.theme.php +++ b/themes/danbooru/comment.theme.php @@ -26,17 +26,16 @@ class CustomCommentListTheme extends CommentListTheme { //$page->add_block(new Block("Comments", $html, "left")); } - public function display_comments($page, $comments, $postbox, $image_id) { + public function display_comments(Page $page, $comments, $postbox, Image $image) { $count = count($comments); + $cs = $count == 1 ? "Comment" : "Comments"; if($postbox) { - $page->add_block(new Block("$count Comments", - $this->comments_to_html($comments). - $this->build_postbox($image_id), "main", 30)); + $html = $this->comments_to_html($comments) . $this->build_postbox($image->id); } else { - $page->add_block(new Block("$count Comments", - $this->comments_to_html($comments), "main", 30)); + $html = $this->comments_to_html($comments); } + $page->add_block(new Block("$count $cs", $html, "main", 30)); } @@ -63,19 +62,20 @@ class CustomCommentListTheme extends CommentListTheme { return "
$h_userlink $h_dellink
Posted on $h_posted
$h_comment
"; $html .= $this->comments_to_html($comments); $html .= "