From db5aa563009b9959b04fd88695c35d9013537d5b Mon Sep 17 00:00:00 2001 From: Shish Date: Sat, 29 Mar 2014 11:44:34 +0000 Subject: [PATCH] remove a bunch of dead code --- core/imageboard.pack.php | 3 --- core/util.inc.php | 2 +- ext/artists/theme.php | 2 +- ext/blotter/theme.php | 4 +--- ext/comment/theme.php | 6 +++--- ext/danbooru_api/main.php | 3 --- ext/favorites/main.php | 2 +- ext/handle_ico/main.php | 1 - ext/handle_pixel/main.php | 4 ++-- ext/handle_svg/main.php | 2 -- ext/image_hash_ban/theme.php | 1 - ext/ipban/theme.php | 1 - ext/log_db/theme.php | 1 - ext/not_a_tag/theme.php | 1 - ext/notes/main.php | 1 - ext/notes/theme.php | 2 -- ext/oekaki/theme.php | 1 - ext/pm/theme.php | 1 - ext/pools/theme.php | 13 ++++--------- ext/rating/theme.php | 1 - ext/report_image/theme.php | 1 - ext/resize/main.php | 2 +- ext/resize/theme.php | 1 - ext/rotate/theme.php | 2 -- ext/setup/theme.php | 3 --- ext/sitemap/main.php | 4 ++-- ext/source_history/main.php | 2 +- ext/tagger/main.php | 21 --------------------- ext/tips/theme.php | 1 - ext/wiki/theme.php | 1 - themes/danbooru/themelet.class.php | 1 - themes/danbooru/user.theme.php | 1 - themes/danbooru2/themelet.class.php | 1 - themes/danbooru2/user.theme.php | 1 - 34 files changed, 17 insertions(+), 77 deletions(-) diff --git a/core/imageboard.pack.php b/core/imageboard.pack.php index 26582333..f6a4500a 100644 --- a/core/imageboard.pack.php +++ b/core/imageboard.pack.php @@ -910,8 +910,6 @@ class Image { // more than one positive tag, or more than zero negative tags else { - $s_tag_array = array_map("sql_escape", $tag_search->variables); - $tag_id_array = array(); $tags_ok = true; foreach($tag_search->variables as $tag) { @@ -1113,7 +1111,6 @@ function move_upload_to_archive(DataUploadEvent $event) { if(!@copy($event->tmpname, $target)) { $errors = error_get_last(); // note: requires php 5.2 throw new UploadException("Failed to copy file from uploads ({$event->tmpname}) to archive ($target): {$errors['type']} / {$errors['message']}"); - return false; } return true; } diff --git a/core/util.inc.php b/core/util.inc.php index f77b36b5..6de64efb 100644 --- a/core/util.inc.php +++ b/core/util.inc.php @@ -451,7 +451,7 @@ function captcha_get_html() { } else { session_start(); - $securimg = new Securimage(); + //$securimg = new Securimage(); $base = get_base_href(); $captcha = "
". "
CAPTCHA: "; diff --git a/ext/artists/theme.php b/ext/artists/theme.php index 1e00cf31..acfe05e7 100644 --- a/ext/artists/theme.php +++ b/ext/artists/theme.php @@ -198,7 +198,7 @@ class ArtistsTheme extends Themelet { $artist['name'] = str_replace("_", " ", $artist['name']); $elementLink = "".str_replace("_", " ", $artist['name']).""; - $artist_link = "".str_replace("_", " ", $artist['artist_name']).""; + //$artist_link = "".str_replace("_", " ", $artist['artist_name']).""; $user_link = "".$artist['user_name'].""; $edit_link = "Edit"; $del_link = "Delete"; diff --git a/ext/blotter/theme.php b/ext/blotter/theme.php index 4c35db3b..872f550a 100644 --- a/ext/blotter/theme.php +++ b/ext/blotter/theme.php @@ -133,7 +133,7 @@ class BlotterTheme extends Themelet { // Reset variables: $i_open = ""; $i_close = ""; - $id = $entries[$i]['id']; + //$id = $entries[$i]['id']; $messy_date = $entries[$i]['entry_date']; $clean_date = date("m/d/y", strtotime($messy_date)); $entry_text = $entries[$i]['entry_text']; @@ -144,8 +144,6 @@ class BlotterTheme extends Themelet { $entries_list .= "
  • {$i_open}{$clean_date} - {$entry_text}{$i_close}
  • "; } - $out_text = ""; - $in_text = ""; $pos_break = ""; $pos_align = "text-align: right; position: absolute; right: 0px;"; diff --git a/ext/comment/theme.php b/ext/comment/theme.php index ba4d12b4..7821b68c 100644 --- a/ext/comment/theme.php +++ b/ext/comment/theme.php @@ -244,7 +244,7 @@ class CommentListTheme extends Themelet { $hb = ($comment->owner_class == "hellbanned" ? "hb" : ""); if($trim) { - return " + $html = "
    $h_userlink: $h_comment >>> @@ -263,7 +263,7 @@ class CommentListTheme extends Themelet { $h_del = $user->can("delete_comment") ? ' - Del' : ''; - return " + $html = "
    $h_avatar @@ -273,7 +273,7 @@ class CommentListTheme extends Themelet {
    "; } - return ""; + return $html; } protected function build_postbox(/*int*/ $image_id) { diff --git a/ext/danbooru_api/main.php b/ext/danbooru_api/main.php index 2ba1b82d..987ee8c4 100644 --- a/ext/danbooru_api/main.php +++ b/ext/danbooru_api/main.php @@ -106,9 +106,6 @@ class DanbooruApi extends Extension { if($user->can("create_image")) { - $file = null; - $filename = ""; - $source = ""; if(isset($_FILES['file'])) { // A file was POST'd in $file = $_FILES['file']['tmp_name']; diff --git a/ext/favorites/main.php b/ext/favorites/main.php index fb8ba57a..3c3494f2 100644 --- a/ext/favorites/main.php +++ b/ext/favorites/main.php @@ -51,7 +51,7 @@ class Favorites extends Extension { public function onDisplayingImage(DisplayingImageEvent $event) { $people = $this->list_persons_who_have_favorited($event->image); if(count($people) > 0) { - $html = $this->theme->display_people($people); + $this->theme->display_people($people); } } diff --git a/ext/handle_ico/main.php b/ext/handle_ico/main.php index 518f1a47..269cbbb0 100644 --- a/ext/handle_ico/main.php +++ b/ext/handle_ico/main.php @@ -60,7 +60,6 @@ class IcoFileHandler extends Extension { $image = new Image(); - $info = ""; $fp = fopen($filename, "r"); $header = unpack("snull/stype/scount", fread($fp, 6)); diff --git a/ext/handle_pixel/main.php b/ext/handle_pixel/main.php index 2dadfc34..0e7d54a4 100644 --- a/ext/handle_pixel/main.php +++ b/ext/handle_pixel/main.php @@ -18,8 +18,8 @@ class PixelFileHandler extends DataHandlerExtension { $image = new Image(); - $info = ""; - if(!($info = getimagesize($filename))) return null; + $info = getimagesize($filename); + if(!$info) return null; $image->width = $info[0]; $image->height = $info[1]; diff --git a/ext/handle_svg/main.php b/ext/handle_svg/main.php index a0bc04e7..76b9a18d 100644 --- a/ext/handle_svg/main.php +++ b/ext/handle_svg/main.php @@ -10,7 +10,6 @@ class SVGFileHandler extends Extension { public function onDataUpload(DataUploadEvent $event) { if($this->supported_ext($event->type) && $this->check_contents($event->tmpname)) { $hash = $event->hash; - $ha = substr($hash, 0, 2); if(!move_upload_to_archive($event)) return; send_event(new ThumbnailGenerationEvent($event->hash, $event->type)); $image = $this->create_image_from_data(warehouse_path("images", $hash), $event->metadata); @@ -27,7 +26,6 @@ class SVGFileHandler extends Extension { global $config; if($this->supported_ext($event->type)) { $hash = $event->hash; - $ha = substr($hash, 0, 2); copy("ext/handle_svg/thumb.jpg", warehouse_path("thumbs", $hash)); } diff --git a/ext/image_hash_ban/theme.php b/ext/image_hash_ban/theme.php index 5afd92b1..87c70cb1 100644 --- a/ext/image_hash_ban/theme.php +++ b/ext/image_hash_ban/theme.php @@ -22,7 +22,6 @@ class ImageBanTheme extends Themelet { */ public function display_image_hash_bans(Page $page, $page_number, $page_count, $bans) { $h_bans = ""; - $n = 0; foreach($bans as $ban) { $h_bans .= " diff --git a/ext/ipban/theme.php b/ext/ipban/theme.php index b6f46b16..e9e927b6 100644 --- a/ext/ipban/theme.php +++ b/ext/ipban/theme.php @@ -14,7 +14,6 @@ class IPBanTheme extends Themelet { public function display_bans(Page $page, $bans) { global $database, $user; $h_bans = ""; - $n = 0; $prefix = ($database->get_driver_name() == "sqlite" ? "bans." : ""); $prefix2 = ($database->get_driver_name() == "sqlite" ? "users." : ""); foreach($bans as $ban) { diff --git a/ext/log_db/theme.php b/ext/log_db/theme.php index a10dd838..77705826 100644 --- a/ext/log_db/theme.php +++ b/ext/log_db/theme.php @@ -40,7 +40,6 @@ class LogDatabaseTheme extends Themelet { \n"; - $n = 0; reset($events); // rewind to first element in array. foreach($events as $event) { diff --git a/ext/not_a_tag/theme.php b/ext/not_a_tag/theme.php index 993bd0dc..543af6f5 100644 --- a/ext/not_a_tag/theme.php +++ b/ext/not_a_tag/theme.php @@ -2,7 +2,6 @@ class NotATagTheme extends Themelet { public function display_untags(Page $page, $page_number, $page_count, $bans) { $h_bans = ""; - $n = 0; foreach($bans as $ban) { $h_bans .= " diff --git a/ext/notes/main.php b/ext/notes/main.php index 4d020cfd..5aa2e72b 100644 --- a/ext/notes/main.php +++ b/ext/notes/main.php @@ -588,7 +588,6 @@ class Notes extends Extension { $noteEnable = $history['note_enable']; $noteID = $history['note_id']; $imageID = $history['image_id']; - $userID = $user->id; $noteX1 = $history['x1']; $noteY1 = $history['y1']; $noteHeight = $history['height']; diff --git a/ext/notes/theme.php b/ext/notes/theme.php index c958c1e3..90ed4948 100644 --- a/ext/notes/theme.php +++ b/ext/notes/theme.php @@ -189,7 +189,6 @@ class NotesTheme extends Themelet { $html .= "". ""; - $n = 0; foreach($histories as $history) { $image_link = "".$history['image_id'].""; $history_link = "".$history['note_id'].".".$history['review_id'].""; @@ -237,7 +236,6 @@ class NotesTheme extends Themelet { $html .= "". ""; - $n = 0; foreach($histories as $history) { $image_link = "".$history['image_id'].""; $history_link = "".$history['note_id'].".".$history['review_id'].""; diff --git a/ext/oekaki/theme.php b/ext/oekaki/theme.php index fccad46a..468c0bdb 100644 --- a/ext/oekaki/theme.php +++ b/ext/oekaki/theme.php @@ -9,7 +9,6 @@ class OekakiTheme extends Themelet { global $config, $page; $base_href = get_base_href(); - $http_base = make_http($base_href); $oekW = $config->get_int("oekaki_width", 400); $oekH = $config->get_int("oekaki_height", 400); diff --git a/ext/pm/theme.php b/ext/pm/theme.php index bf30302b..7b0f5be1 100644 --- a/ext/pm/theme.php +++ b/ext/pm/theme.php @@ -8,7 +8,6 @@ class PrivMsgTheme extends Themelet { "; - $n = 0; foreach($pms as $pm) { $h_subject = html_escape($pm->subject); if(strlen(trim($h_subject)) == 0) $h_subject = "(No subject)"; diff --git a/ext/pools/theme.php b/ext/pools/theme.php index b31be49e..fd25d431 100644 --- a/ext/pools/theme.php +++ b/ext/pools/theme.php @@ -12,7 +12,6 @@ class PoolsTheme extends Themelet { } public function get_adder_html(Image $image, /*array*/ $pools) { - $editor = ""; $h = ""; foreach($pools as $pool) { $h .= ""; @@ -43,8 +42,6 @@ class PoolsTheme extends Themelet { '; - $n = 0; - // Build up the list of pools. foreach($pools as $pool) { $pool_link = ''.html_escape($pool['title']).""; @@ -133,7 +130,6 @@ class PoolsTheme extends Themelet { '; - $n = 0; foreach($pools as $pool) { $pool_info .= "". "". @@ -303,15 +299,15 @@ class PoolsTheme extends Themelet { $this->display_top($pools, "Sorting Pool"); $pool_images = "\n"; - $n = 0; + $i = 0; foreach($images as $pair) { $image = $pair[0]; $thumb_html = $this->build_thumb_html($image); $pool_images .= ''."\n".$thumb_html."\n". - '
    '. - ''. + '
    '. + ''. '
    '; - $n++; + $i++; } $pool_images .= "
    ". @@ -382,7 +378,6 @@ class PoolsTheme extends Themelet { '; - $n = 0; foreach($histories as $history) { $pool_link = "".html_escape($history['title']).""; $user_link = "".html_escape($history['user_name']).""; diff --git a/ext/rating/theme.php b/ext/rating/theme.php index bc95ea70..3e9437a6 100644 --- a/ext/rating/theme.php +++ b/ext/rating/theme.php @@ -2,7 +2,6 @@ class RatingsTheme extends Themelet { public function get_rater_html(/*int*/ $image_id, /*string*/ $rating) { - $i_image_id = int_escape($image_id); $s_checked = $rating == 's' ? " checked" : ""; $q_checked = $rating == 'q' ? " checked" : ""; $e_checked = $rating == 'e' ? " checked" : ""; diff --git a/ext/report_image/theme.php b/ext/report_image/theme.php index 4e3afb9c..b62fd02a 100644 --- a/ext/report_image/theme.php +++ b/ext/report_image/theme.php @@ -15,7 +15,6 @@ class ReportImageTheme extends Themelet { global $config; $h_reportedimages = ""; - $n = 0; foreach($reports as $report) { $image = $report['image']; $h_reason = format_text($report['reason']); diff --git a/ext/resize/main.php b/ext/resize/main.php index 1bd7e146..cac918e4 100644 --- a/ext/resize/main.php +++ b/ext/resize/main.php @@ -229,7 +229,7 @@ class ResizeImage extends Extension { $transparency = imagecolortransparent($image); if ($transparency >= 0) { - $transparent_color = imagecolorsforindex($image, $trnprt_indx); + //$transparent_color = imagecolorsforindex($image, $trnprt_indx); $transparency = imagecolorallocate($image_resized, $trnprt_color['red'], $trnprt_color['green'], $trnprt_color['blue']); imagefill($image_resized, 0, 0, $transparency); imagecolortransparent($image_resized, $transparency); diff --git a/ext/resize/theme.php b/ext/resize/theme.php index 2dfa11c2..e19a8e32 100644 --- a/ext/resize/theme.php +++ b/ext/resize/theme.php @@ -7,7 +7,6 @@ class ResizeImageTheme extends Themelet { public function get_resize_html(Image $image) { global $user, $config; - $i_image_id = int_escape($image->id); $default_width = $config->get_int('resize_default_width'); $default_height = $config->get_int('resize_default_height'); diff --git a/ext/rotate/theme.php b/ext/rotate/theme.php index d29bb172..ddef58c7 100644 --- a/ext/rotate/theme.php +++ b/ext/rotate/theme.php @@ -7,8 +7,6 @@ class RotateImageTheme extends Themelet { public function get_rotate_html(/*int*/ $image_id) { global $user, $config; - $i_image_id = int_escape($image_id); - $html = " ".make_form(make_link('rotate/'.$image_id), 'POST')." diff --git a/ext/setup/theme.php b/ext/setup/theme.php index 6d67d1de..3bad7007 100644 --- a/ext/setup/theme.php +++ b/ext/setup/theme.php @@ -23,7 +23,6 @@ class SetupTheme extends Themelet { */ $setupblock_html = ""; foreach($panel->blocks as $block) { - $html = $this->sb_to_html($block); $setupblock_html .= $this->sb_to_html($block); } @@ -44,12 +43,10 @@ class SetupTheme extends Themelet { global $user; $h_rows = ""; - $n = 0; ksort($options); foreach($options as $name => $value) { $h_name = html_escape($name); $h_value = html_escape($value); - $len = strlen($h_value); $h_box = ""; if(strpos($value, "\n") > 0) { diff --git a/ext/sitemap/main.php b/ext/sitemap/main.php index 33e7e566..3044ffe7 100644 --- a/ext/sitemap/main.php +++ b/ext/sitemap/main.php @@ -63,7 +63,7 @@ class XMLSitemap extends Extension { { global $database, $config; // add index - $index[0] = $base_href = $config->get_string("front_page"); + $index[0] = $config->get_string("front_page"); $this->add_sitemap_queue($index, "weekly", "1"); /* --- Add 20 most used tags --- */ @@ -162,4 +162,4 @@ class XMLSitemap extends Extension { $page->set_data($xml); } } -?> \ No newline at end of file +?> diff --git a/ext/source_history/main.php b/ext/source_history/main.php index 3137a265..366ea7cf 100644 --- a/ext/source_history/main.php +++ b/ext/source_history/main.php @@ -351,7 +351,7 @@ class Source_History extends Extension { } // add a history entry - $row = $database->execute(" + $database->execute(" INSERT INTO source_histories(image_id, source, user_id, user_ip, date_set) VALUES (?, ?, ?, ?, now())", array($image->id, $new_source, $user->id, $_SERVER['REMOTE_ADDR'])); diff --git a/ext/tagger/main.php b/ext/tagger/main.php index 6165b810..4df81ee8 100644 --- a/ext/tagger/main.php +++ b/ext/tagger/main.php @@ -80,7 +80,6 @@ class TaggerXML extends Extension { $q_where = "WHERE {$match} {$hidden} AND count > 0"; // FROM based on return count - $q_from = null; $count = $this->count($q_where,$values); if ($count > $max_rows) { $q_from = "FROM (SELECT * FROM `tags` {$q_where} ". @@ -139,25 +138,5 @@ class TaggerXML extends Extension { return $database->Execute( "SELECT COUNT(*) FROM `tags` $query",$values)->fields['COUNT(*)']; } - - private function image_tags ($image_id) { - global $database; - $list = "("; - $i_tags = $database->Execute( - "SELECT tag_id FROM `image_tags` WHERE image_id=?", - array($image_id)); - - $b = false; - foreach($i_tags as $tag) { - if($b) - $list .= ","; - $b = true; - $list .= $tag['tag_id']; - - } - $list .= ")"; - - return $list; - } } ?> diff --git a/ext/tips/theme.php b/ext/tips/theme.php index 3c86b53e..2f4b84ba 100644 --- a/ext/tips/theme.php +++ b/ext/tips/theme.php @@ -65,7 +65,6 @@ class TipsTheme extends Themelet { $html .= ""; - $n = 0; foreach ($tips as $tip) { $tip_enable = ($tip['enable'] == "Y") ? "Yes" : "No"; $set_link = "".$tip_enable.""; diff --git a/ext/wiki/theme.php b/ext/wiki/theme.php index 45b7bee4..54e7338d 100644 --- a/ext/wiki/theme.php +++ b/ext/wiki/theme.php @@ -39,7 +39,6 @@ class WikiTheme extends Themelet { protected function create_edit_html(WikiPage $page) { $h_title = html_escape($page->title); - $u_title = url_escape($page->title); $i_revision = int_escape($page->revision) + 1; global $user; diff --git a/themes/danbooru/themelet.class.php b/themes/danbooru/themelet.class.php index a6c5be6a..b69c5288 100644 --- a/themes/danbooru/themelet.class.php +++ b/themes/danbooru/themelet.class.php @@ -21,7 +21,6 @@ class Themelet extends BaseThemelet { private function build_paginator($current_page, $total_pages, $base_url, $query) { $next = $current_page + 1; $prev = $current_page - 1; - $rand = mt_rand(1, $total_pages); $at_start = ($current_page <= 3 || $total_pages <= 3); $at_end = ($current_page >= $total_pages -2); diff --git a/themes/danbooru/user.theme.php b/themes/danbooru/user.theme.php index ca62caa8..fba58e8d 100644 --- a/themes/danbooru/user.theme.php +++ b/themes/danbooru/user.theme.php @@ -35,7 +35,6 @@ class CustomUserPageTheme extends UserPageTheme { } public function display_user_block(Page $page, User $user, $parts) { - $h_name = html_escape($user->name); $html = ""; $blocked = array("Pools", "Pool Changes", "Alias Editor", "My Profile"); foreach($parts as $part) { diff --git a/themes/danbooru2/themelet.class.php b/themes/danbooru2/themelet.class.php index a6c5be6a..b69c5288 100644 --- a/themes/danbooru2/themelet.class.php +++ b/themes/danbooru2/themelet.class.php @@ -21,7 +21,6 @@ class Themelet extends BaseThemelet { private function build_paginator($current_page, $total_pages, $base_url, $query) { $next = $current_page + 1; $prev = $current_page - 1; - $rand = mt_rand(1, $total_pages); $at_start = ($current_page <= 3 || $total_pages <= 3); $at_end = ($current_page >= $total_pages -2); diff --git a/themes/danbooru2/user.theme.php b/themes/danbooru2/user.theme.php index ca62caa8..fba58e8d 100644 --- a/themes/danbooru2/user.theme.php +++ b/themes/danbooru2/user.theme.php @@ -35,7 +35,6 @@ class CustomUserPageTheme extends UserPageTheme { } public function display_user_block(Page $page, User $user, $parts) { - $h_name = html_escape($user->name); $html = ""; $blocked = array("Pools", "Pool Changes", "Alias Editor", "My Profile"); foreach($parts as $part) {
    R?SubjectFromDateAction
    Public
    Description
    ".html_escape($pool['title'])."
    Action