updateses

This commit is contained in:
Shish 2009-07-28 01:09:00 +01:00
parent a16b3db48c
commit d850a562db
6 changed files with 13 additions and 17 deletions

View file

@ -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);
}

View file

@ -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));
}
/*

View file

@ -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 = "<a class='username' href='".make_link("user/$h_name")."'>$h_name</a>";
$h_dellink = $user->is_admin() ?

View file

@ -14,7 +14,7 @@ class CustomViewImageTheme extends ViewImageTheme {
$h_owner = html_escape($image->get_owner()->name);
$h_ownerlink = "<a href='".make_link("user/$h_owner")."'>$h_owner</a>";
$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;

View file

@ -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);

View file

@ -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);