diff --git a/themes/danbooru/comment.theme.php b/themes/danbooru/comment.theme.php index 0fcbd0a3..67e2a89a 100644 --- a/themes/danbooru/comment.theme.php +++ b/themes/danbooru/comment.theme.php @@ -1,6 +1,6 @@ comment_to_html($comment, $trim); - } - return $html; - } - - private function comment_to_html($comment, $trim=false) { + protected function comment_to_html($comment, $trim=false) { global $user; $tfe = new TextFormattingEvent($comment->comment); @@ -71,19 +63,6 @@ class CommentListTheme extends Themelet { return "
$h_userlink $h_dellink
Posted on $h_posted
$h_comment
" . build_thumb_html($image, $query) . " | \n"; - } - else { - $table .= "\t\n"; - } - } - $table .= " |
Full List\n";
- $page->add_block(new Block("Popular Tags", $html, "left", 60));
- }
-
- /*
- * $tag_infos = array(
- * array('tag' => $tag),
- * ...
- * )
- * $search = the current array of tags being searched for
- */
- public function display_refine_block($page, $tag_infos, $search) {
- global $config;
-
- $html = "";
- $n = 0;
- foreach($tag_infos as $row) {
- $tag = $row['tag'];
- $h_tag = html_escape($tag);
- $h_tag_no_underscores = str_replace("_", " ", $h_tag);
- if($n++) $html .= "\n
";
- if(!is_null($config->get_string('info_link'))) {
- $link = str_replace('$tag', $tag, $config->get_string('info_link'));
- $html .= " ?";
- }
- $link = $this->tag_link($row['tag']);
- $html .= " $h_tag_no_underscores";
- $html .= $this->ars($tag, $search);
- }
-
- $page->add_block(new Block("Refine Search", $html, "left", 60));
- }
-
- private function ars($tag, $tags) {
- $html = "";
- $html .= " (";
- $html .= $this->get_add_link($tags, $tag);
- $html .= $this->get_remove_link($tags, $tag);
- $html .= $this->get_subtract_link($tags, $tag);
- $html .= ")";
- return $html;
- }
-
- private function get_remove_link($tags, $tag) {
- if(!in_array($tag, $tags) && !in_array("-$tag", $tags)) {
- return "";
- }
- else {
- $tags = array_remove($tags, $tag);
- $tags = array_remove($tags, "-$tag");
- return "R";
- }
- }
-
- private function get_add_link($tags, $tag) {
- if(in_array($tag, $tags)) {
- return "";
- }
- else {
- $tags = array_remove($tags, "-$tag");
- $tags = array_add($tags, $tag);
- return "A";
- }
- }
-
- private function get_subtract_link($tags, $tag) {
- if(in_array("-$tag", $tags)) {
- return "";
- }
- else {
- $tags = array_remove($tags, $tag);
- $tags = array_add($tags, "-$tag");
- return "S";
- }
- }
-
- private function tag_link($tag) {
- $u_tag = url_escape($tag);
- return make_link("post/list/$u_tag/1");
- }
}
?>
diff --git a/themes/danbooru/upload.theme.php b/themes/danbooru/upload.theme.php
index 2d18dff9..b67ca974 100644
--- a/themes/danbooru/upload.theme.php
+++ b/themes/danbooru/upload.theme.php
@@ -1,6 +1,6 @@
add_block(new Block("Upload", $this->build_upload_block(), "left", 20));
@@ -8,86 +8,7 @@ class UploadTheme extends Themelet {
public function display_page($page) {
$page->disable_left();
-
- global $config;
- $tl_enabled = ($config->get_string("transload_engine", "none") != "none");
-
- $upload_list = "";
- for($i=0; $i<$config->get_int('upload_count'); $i++) {
- $n = $i + 1;
- $width = $tl_enabled ? "35%" : "80%";
- $upload_list .= "
-
Uploaded from: ";
@@ -91,47 +66,11 @@ class UserPageTheme extends Themelet {
}
public function display_user_page($page, $duser, $user) {
- $page->set_title("{$duser->name}'s Page");
- $page->set_heading("{$duser->name}'s Page");
- $page->add_block(new NavBlock());
- $page->add_block(new Block("Stats", $this->build_stats($duser)));
$page->disable_left();
-
- if(!$user->is_anonymous()) {
- if($user->id == $duser->id || $user->is_admin()) {
- $page->add_block(new Block("Options", $this->build_options($duser), "main", 20));
- }
- if($user->is_admin()) {
- $page->add_block(new Block("More Options", $this->build_more_options($duser)));
- }
- }
+ parent::display_user_page($page, $duser, $user);
}
- private function build_stats($duser) {
- global $database;
- global $config;
-
- $i_days_old = int_escape($duser->get_days_old());
- $h_join_date = html_escape($duser->join_date);
- $i_image_count = int_escape($duser->get_image_count());
- $i_comment_count = int_escape($duser->get_comment_count());
-
- $i_days_old2 = ($i_days_old == 0) ? 1 : $i_days_old;
-
- $h_image_rate = sprintf("%3.1f", ($i_image_count / $i_days_old2));
- $h_comment_rate = sprintf("%3.1f", ($i_comment_count / $i_days_old2));
-
- $u_name = url_escape($duser->name);
- $images_link = make_link("post/list/user=$u_name/1");
-
- return "
- Join date: $h_join_date ($i_days_old days old)
- Images uploaded: $i_image_count ($h_image_rate / day) - Comments made: $i_comment_count ($h_comment_rate / day) - "; - } - - private function build_options($duser) { + protected function build_options($duser) { global $database; global $config; @@ -150,25 +89,6 @@ class UserPageTheme extends Themelet { "; return $html; } - - private function build_more_options($duser) { - global $database; - global $config; - - $i_user_id = int_escape($duser->id); - $h_is_admin = $duser->is_admin() ? " checked" : ""; - $h_is_enabled = $duser->is_enabled() ? " checked" : ""; - - $html = " - - "; - return $html; - } // }}} } ?> diff --git a/themes/danbooru/view.theme.php b/themes/danbooru/view.theme.php index ce93d864..36a15144 100644 --- a/themes/danbooru/view.theme.php +++ b/themes/danbooru/view.theme.php @@ -1,6 +1,6 @@ set_title("Image not found"); $page->set_heading("Image not found"); @@ -9,64 +9,12 @@ class ViewTheme extends Themelet { "No image in the database has the ID #$image_id")); } - public function display_page($page, $image) { - $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->id), "left", 0)); - $page->add_block(new Block("Image", $this->build_image_view($image), "main", 0)); - $page->add_block(new Block(null, $this->build_info($image), "main", 10)); - } var $pin = null; - private function build_pin($image_id) { - if(!is_null($this->pin)) { - return $this->pin; - } - - global $database; - - if(isset($_GET['search'])) { - $search_terms = explode(' ', $_GET['search']); - $query = "search=".url_escape($_GET['search']); - } - else { - $search_terms = array(); - $query = null; - } - - $next = $database->get_next_image($image_id, $search_terms); - $prev = $database->get_prev_image($image_id, $search_terms); - - $h_prev = (!is_null($prev) ? "Prev" : "Prev"); - $h_index = "Index"; - $h_next = (!is_null($next) ? "Next" : "Next"); - - $this->pin = "$h_prev | $h_index | $h_next"; - return $this->pin; - } - - private function build_navigation($image_id) { - $h_pin = $this->build_pin($image_id); - $h_search = " - - "; - - return "$h_pin $h_search"; - } - - private function build_image_view($image) { - $ilink = $image->get_image_link(); - return ""; - } - - private function build_info($image) { + protected function build_info($image) { global $user; $owner = $image->get_owner(); $h_owner = html_escape($owner->name); @@ -112,7 +60,7 @@ class ViewTheme extends Themelet { "; } - + return $html; } } |