2007-07-21 12:11:41 +00:00
|
|
|
<?php
|
|
|
|
|
2008-12-08 20:34:43 +00:00
|
|
|
class CustomViewImageTheme extends ViewImageTheme {
|
2010-07-19 12:53:12 +00:00
|
|
|
public function display_page($image, $editor_parts) {
|
|
|
|
global $page;
|
2008-12-27 06:31:45 +00:00
|
|
|
$page->set_title("Image {$image->id}: ".html_escape($image->get_tag_list()));
|
|
|
|
$page->set_heading(html_escape($image->get_tag_list()));
|
|
|
|
$page->add_block(new Block("Navigation", $this->build_navigation($image), "left", 0));
|
2011-12-28 03:13:14 +00:00
|
|
|
$page->add_block(new Block("Statistics", $this->build_stats($image), "left", 15));
|
2008-12-27 06:31:45 +00:00
|
|
|
$page->add_block(new Block(null, $this->build_image_editor($image, $editor_parts), "main", 10));
|
|
|
|
$page->add_block(new Block(null, $this->build_pin($image), "main", 11));
|
2007-07-21 12:11:41 +00:00
|
|
|
}
|
|
|
|
|
2008-12-27 06:31:45 +00:00
|
|
|
private function build_stats($image) {
|
|
|
|
$h_owner = html_escape($image->get_owner()->name);
|
|
|
|
$h_ownerlink = "<a href='".make_link("user/$h_owner")."'>$h_owner</a>";
|
2007-07-21 12:11:41 +00:00
|
|
|
$h_ip = html_escape($image->owner_ip);
|
2009-07-28 00:09:00 +00:00
|
|
|
$h_date = autodate($image->posted);
|
2008-12-27 06:36:51 +00:00
|
|
|
$h_filesize = to_shorthand_int($image->filesize);
|
2007-07-21 12:11:41 +00:00
|
|
|
|
2008-12-27 06:31:45 +00:00
|
|
|
global $user;
|
2007-07-21 12:11:41 +00:00
|
|
|
if($user->is_admin()) {
|
2008-12-27 06:31:45 +00:00
|
|
|
$h_ownerlink .= " ($h_ip)";
|
2007-07-21 12:11:41 +00:00
|
|
|
}
|
2008-12-27 06:31:45 +00:00
|
|
|
|
|
|
|
$html = "
|
|
|
|
Id: {$image->id}
|
|
|
|
<br>Posted: $h_date by $h_ownerlink
|
|
|
|
<br>Size: {$image->width}x{$image->height}
|
2008-12-27 06:36:51 +00:00
|
|
|
<br>Filesize: $h_filesize
|
2008-12-27 06:31:45 +00:00
|
|
|
";
|
|
|
|
|
2007-07-21 12:11:41 +00:00
|
|
|
if(!is_null($image->source)) {
|
2008-12-27 06:31:45 +00:00
|
|
|
$h_source = html_escape($image->source);
|
2009-01-25 00:49:26 +00:00
|
|
|
if(substr($image->source, 0, 7) != "http://") {
|
2008-12-27 06:31:45 +00:00
|
|
|
$h_source = "http://" . $h_source;
|
2007-07-21 12:11:41 +00:00
|
|
|
}
|
2008-12-27 06:31:45 +00:00
|
|
|
$html .= "<br>Source: <a href='$h_source'>link</a>";
|
2007-07-21 12:11:41 +00:00
|
|
|
}
|
2007-08-01 16:58:50 +00:00
|
|
|
|
2012-01-25 16:40:19 +00:00
|
|
|
if(!is_null($image->rating) && file_exists("ext/rating")) {
|
|
|
|
if($image->rating == null || $image->rating == "u"){
|
|
|
|
$image->rating = "u";
|
|
|
|
}
|
|
|
|
$h_rating = Ratings::rating_to_human($image->rating);
|
|
|
|
$html .= "<br>Rating: $h_rating";
|
2012-01-24 03:14:27 +00:00
|
|
|
}
|
|
|
|
|
2007-07-21 12:11:41 +00:00
|
|
|
return $html;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
?>
|