diff --git a/core/util.inc.php b/core/util.inc.php
index 652db51c..fbd45897 100644
--- a/core/util.inc.php
+++ b/core/util.inc.php
@@ -100,7 +100,7 @@ function to_shorthand_int($int) {
function autodate($date) {
$ts = strtotime($date);
// Step 2: ...
- return $date;
+ return date("Y-m-d", $ts);
}
diff --git a/ext/comment/theme.php b/ext/comment/theme.php
index 1289aa22..e2b68ba9 100644
--- a/ext/comment/theme.php
+++ b/ext/comment/theme.php
@@ -39,18 +39,14 @@ class CommentListTheme extends Themelet {
/*
* Show comments for an image
*/
- public function display_comments(Page $page, $comments, $postbox, $image_id) {
+ public function display_comments(Page $page, $comments, $postbox, Image $image) {
if($postbox) {
- $page->add_block(new Block("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 {
- if(count($comments) > 0) {
- $page->add_block(new Block("Comments",
- $this->comments_to_html($comments), "main", 30));
- }
+ $html = $this->comments_to_html($comments);
}
+ $page->add_block(new Block("Comments", $html, "main", 30));
}
/*
diff --git a/themes/danbooru/comment.theme.php b/themes/danbooru/comment.theme.php
index 2052ff78..5eb8ea55 100644
--- a/themes/danbooru/comment.theme.php
+++ b/themes/danbooru/comment.theme.php
@@ -39,7 +39,7 @@ class CustomCommentListTheme extends CommentListTheme {
}
- protected function comment_to_html($comment, $trim=false) {
+ protected function comment_to_html(Comment $comment, $trim=false) {
global $user;
$tfe = new TextFormattingEvent($comment->comment);
@@ -51,7 +51,7 @@ class CustomCommentListTheme extends CommentListTheme {
$h_comment = ($trim ? substr($tfe->stripped, 0, 50)."..." : $tfe->formatted);
$i_comment_id = int_escape($comment->comment_id);
$i_image_id = int_escape($comment->image_id);
- $h_posted = html_escape($comment->posted);
+ $h_posted = autodate($comment->posted);
$h_userlink = "$h_name";
$h_dellink = $user->is_admin() ?
diff --git a/themes/danbooru/view.theme.php b/themes/danbooru/view.theme.php
index 57412298..d4e78102 100644
--- a/themes/danbooru/view.theme.php
+++ b/themes/danbooru/view.theme.php
@@ -14,7 +14,7 @@ class CustomViewImageTheme extends ViewImageTheme {
$h_owner = html_escape($image->get_owner()->name);
$h_ownerlink = "$h_owner";
$h_ip = html_escape($image->owner_ip);
- $h_date = date("Y-m-d", strtotime($image->posted));
+ $h_date = autodate($image->posted);
$h_filesize = to_shorthand_int($image->filesize);
global $user;
diff --git a/themes/futaba/comment.theme.php b/themes/futaba/comment.theme.php
index 4d0e0e46..1b6aeda0 100644
--- a/themes/futaba/comment.theme.php
+++ b/themes/futaba/comment.theme.php
@@ -7,7 +7,7 @@ class CustomCommentListTheme extends CommentListTheme {
* $page_number = the current page number
* $total_pages = the total number of comment pages
*/
- public function display_page_start($page, $page_number, $total_pages) {
+ public function display_page_start(Page $page, $page_number, $total_pages) {
$prev = $page_number - 1;
$next = $page_number + 1;
@@ -23,7 +23,7 @@ class CustomCommentListTheme extends CommentListTheme {
$this->display_paginator($page, "comment/list", null, $page_number, $total_pages, 90);
}
- public function display_recent_comments($page, $comments) {
+ public function display_recent_comments(Page $page, $comments) {
// sidebar fails in this theme
}
@@ -35,7 +35,7 @@ class CustomCommentListTheme extends CommentListTheme {
* Add a block with thumbnail and comments, as part of the comment
* list page
*/
- public function add_comment_list($page, $image, $comments, $position, $with_postbox) {
+ public function add_comment_list(Page $page, Image $image, $comments, $position, $with_postbox) {
$h_filename = html_escape($image->filename);
$h_filesize = to_shorthand_int($image->filesize);
$w = $image->width;
@@ -61,7 +61,7 @@ class CustomCommentListTheme extends CommentListTheme {
return $html;
}
- protected function comment_to_html($comment, $trim=false, $inner_id=0) {
+ protected function comment_to_html(Comment $comment, $trim=false, $inner_id=0) {
global $user;
$tfe = new TextFormattingEvent($comment->comment);
diff --git a/themes/warm/comment.theme.php b/themes/warm/comment.theme.php
index ac41df22..d54ac46d 100644
--- a/themes/warm/comment.theme.php
+++ b/themes/warm/comment.theme.php
@@ -17,7 +17,7 @@ class CustomCommentListTheme extends CommentListTheme {
$page->add_block(new Block("{$image->id}: ".($image->get_tag_list()), $html, "main", $position));
}
- protected function comment_to_html($comment, $trim=false) {
+ protected function comment_to_html(Comment $comment, $trim=false) {
global $user;
$tfe = new TextFormattingEvent($comment->comment);