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

"; } - // FIXME: privatise this - public function build_postbox($image_id) { - $i_image_id = int_escape($image_id); - return " -
- - -
-
- "; - } - - public function add_comment_list($page, $image, $comments, $position, $with_postbox) { $count = count($comments); diff --git a/themes/danbooru/index.theme.php b/themes/danbooru/index.theme.php index 32c13e3a..05ca6e7e 100644 --- a/themes/danbooru/index.theme.php +++ b/themes/danbooru/index.theme.php @@ -1,12 +1,6 @@ page_number = $page_number; - $this->total_pages = $total_pages; - $this->search_terms = $search_terms; - } - +class CustomIndexTheme extends IndexTheme { public function display_page($page, $images) { global $config; @@ -40,7 +34,7 @@ class IndexTheme extends Themelet { } - private function build_navigation($page_number, $total_pages, $search_terms) { + protected function build_navigation($page_number, $total_pages, $search_terms) { $h_search_string = count($search_terms) == 0 ? "" : html_escape(implode(" ", $search_terms)); $h_search_link = make_link(); $h_search = " @@ -53,30 +47,5 @@ class IndexTheme extends Themelet { return $h_search; } - - private function build_table($images, $query) { - global $config; - - $width = $config->get_int('index_width'); - $height = $config->get_int('index_height'); - - $table = "\n"; - for($i=0; $i<$height; $i++) { - $table .= "\n"; - for($j=0; $j<$width; $j++) { - $image = isset($images[$i*$width+$j]) ? $images[$i*$width+$j] : null; - if(!is_null($image)) { - $table .= "\t\n"; - } - else { - $table .= "\t\n"; - } - } - $table .= "\n"; - } - $table .= "
" . build_thumb_html($image, $query) . " 
\n"; - - return $table; - } } ?> diff --git a/themes/danbooru/style.css b/themes/danbooru/style.css index 71df6eb5..b44497fb 100644 --- a/themes/danbooru/style.css +++ b/themes/danbooru/style.css @@ -156,6 +156,9 @@ A:hover {text-decoration: underline;} padding: 8px 4px 8px 4px; } +#large_upload_form { + width: 600px; +} .setupblock { border: 1px solid #AAA; padding: 8px; diff --git a/themes/danbooru/tag_list.theme.php b/themes/danbooru/tag_list.theme.php index 18696934..8a1a0c3a 100644 --- a/themes/danbooru/tag_list.theme.php +++ b/themes/danbooru/tag_list.theme.php @@ -1,21 +1,9 @@ heading = $text; - } - - public function set_tag_list($list) { - $this->list = $list; - } - - public function set_navigation($nav) { - $this->navigation = $nav; - } - public function display_page($page) { $page->disable_left(); $page->set_title("Tag List"); @@ -23,145 +11,5 @@ class TagListTheme extends Themelet { $page->add_block(new Block("Navigation", str_replace("
", ", ", $this->navigation), "main", 0)); $page->add_block(new Block(" ", $this->list)); } - - // ======================================================================= - - /* - * $tag_infos = array( - * array('tag' => $tag, 'count' => $number_of_uses), - * ... - * ) - */ - public function display_related_block($page, $tag_infos) { - 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); - $count = $row['count']; - 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"; - } - - $page->add_block(new Block("Related", $html, "left")); - } - - - /* - * $tag_infos = array( - * array('tag' => $tag, 'count' => $number_of_uses), - * ... - * ) - */ - public function display_popular_block($page, $tag_infos) { - 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); - $count = $row['count']; - 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"; - if($config->get_bool("tag_list_numbers")) { - $html .= " $count"; - } - } - - $html .= "

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 .= " - - File $n - - "; - if($tl_enabled) { - $upload_list .= " - URL $n - - "; - } - $upload_list .= " - - "; - } - $max_size = $config->get_int('upload_size'); - $max_kb = to_shorthand_int($max_size); - $html = " -

- - $upload_list - - - -
Tags
Source
-
-
(Max file size is $max_kb)
- "; - - $page->set_title("Upload"); - $page->set_heading("Upload"); - $page->add_block(new NavBlock()); - $page->add_block(new Block("Upload", $html, "main", 20)); - } - - public function display_upload_status($page, $ok) { - if($ok) { - $page->set_mode("redirect"); - $page->set_redirect(make_link()); - } - else { - $page->set_title("Upload Status"); - $page->set_heading("Upload Status"); - $page->add_block(new NavBlock()); - } - } - - public function display_upload_error($page, $title, $message) { - $page->add_block(new Block($title, $message)); - } - - private function build_upload_block() { - global $config; - - $upload_list = ""; - for($i=0; $i<$config->get_int('upload_count'); $i++) { - if($i == 0) $style = ""; // "style='display:visible'"; - else $style = "style='display:none'"; - $upload_list .= "\n"; - } - $max_size = $config->get_int('upload_size'); - $max_kb = to_shorthand_int($max_size); - // - return " -
- $upload_list - - -
-
(Max file size is $max_kb)
- "; + parent::display_page($page); } } ?> diff --git a/themes/danbooru/user.theme.php b/themes/danbooru/user.theme.php index 9a6767fd..d6049761 100644 --- a/themes/danbooru/user.theme.php +++ b/themes/danbooru/user.theme.php @@ -1,6 +1,6 @@ set_title("Login"); $page->set_heading("Login"); @@ -49,31 +49,6 @@ class UserPageTheme extends Themelet { $page->add_block(new Block("Signup", $html)); } - public function display_signups_disabled($page) { - $page->set_title("Signups Disabled"); - $page->set_heading("Signups Disabled"); - $page->add_block(new NavBlock()); - $page->add_block(new Block("Signups Disabled", - "The board admin has disabled the ability to create new accounts~")); - } - - public function display_login_block($page) { - global $config; - $html = " -
- - - - -
Name
Password
-
- "; - if($config->get_bool("login_signup_enabled")) { - $html .= "Create Account"; - } - $page->add_block(new Block("Login", $html, "left", 90)); - } - public function display_ip_list($page, $uploads, $comments) { $html = ""; $html .= "
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 = " -
- - Admin: -
Enabled: -

-

- "; - 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; } }