From db5aa563009b9959b04fd88695c35d9013537d5b Mon Sep 17 00:00:00 2001 From: Shish Date: Sat, 29 Mar 2014 11:44:34 +0000 Subject: [PATCH 1/3] 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) { From c8aa3327a1a23d7317b32dd58d852ca37c2963d5 Mon Sep 17 00:00:00 2001 From: Shish Date: Sun, 30 Mar 2014 13:26:48 +0100 Subject: [PATCH 2/3] A bunch of small changes from scrutinizer-ci; some tidying, some actual bug fixes --- core/database.class.php | 2 + core/extension.class.php | 6 +- core/imageboard.pack.php | 6 +- core/user.class.php | 3 + core/util.inc.php | 11 ++- ext/admin/theme.php | 4 +- ext/artists/main.php | 2 +- ext/artists/theme.php | 37 ++++++---- ext/bulk_add/main.php | 3 +- ext/bulk_add_csv/main.php | 3 +- ext/bulk_remove/main.php | 9 ++- ext/chatbox/main.php | 2 +- ext/cron_uploader/main.php | 42 +++-------- ext/ext_manager/main.php | 2 + ext/favorites/main.php | 4 +- ext/handle_archive/main.php | 4 +- ext/handle_flash/main.php | 74 +++---------------- ext/handle_ico/main.php | 4 +- ext/handle_ico/test.php | 4 +- ext/handle_pixel/main.php | 17 +---- ext/handle_pixel/script.js | 14 ++-- ext/handle_video/theme.php | 3 + ext/image/main.php | 19 ++--- ext/index/theme.php | 2 + ext/link_image/theme.php | 2 +- ext/livefeed/main.php | 1 + ext/log_net/main.php | 1 + ext/not_a_tag/main.php | 6 +- ext/notes/main.php | 6 +- ext/notes/theme.php | 142 +++++++++++++++--------------------- ext/oekaki/main.php | 1 + 31 files changed, 170 insertions(+), 266 deletions(-) diff --git a/core/database.class.php b/core/database.class.php index 2ee4db23..14bac1af 100644 --- a/core/database.class.php +++ b/core/database.class.php @@ -271,11 +271,13 @@ class Database { /** * Meta info about the database engine + * @var DBEngine */ private $engine = null; /** * The currently active cache engine + * @var CacheEngine */ public $cache = null; diff --git a/core/extension.class.php b/core/extension.class.php index b288e91f..bce72590 100644 --- a/core/extension.class.php +++ b/core/extension.class.php @@ -140,9 +140,9 @@ abstract class FormatterExtension extends Extension { */ abstract class DataHandlerExtension extends Extension { public function onDataUpload(DataUploadEvent $event) { - global $user; - - if(($supported_ext = $this->supported_ext($event->type)) && ($check_contents = $this->check_contents($event->tmpname))) { + $supported_ext = $this->supported_ext($event->type); + $check_contents = $this->check_contents($event->tmpname); + if($supported_ext && $check_contents) { if(!move_upload_to_archive($event)) return; send_event(new ThumbnailGenerationEvent($event->hash, $event->type)); diff --git a/core/imageboard.pack.php b/core/imageboard.pack.php index f6a4500a..8e21de8b 100644 --- a/core/imageboard.pack.php +++ b/core/imageboard.pack.php @@ -122,7 +122,7 @@ class Image { if(SPEED_HAX) { if(!$user->can("big_search") and count($tags) > 3) { - die("Anonymous users may only search for up to 3 tags at a time"); // FIXME: throw an exception? + throw new SCoreException("Anonymous users may only search for up to 3 tags at a time"); } } @@ -644,7 +644,7 @@ class Image { * images table. Yes, MySQL does suck this much. */ private static function build_accurate_search_querylet($terms) { - global $config, $database; + global $database; $tag_querylets = array(); $img_querylets = array(); @@ -804,7 +804,7 @@ class Image { * build_accurate_search_querylet() for a full explanation */ private static function build_ugly_search_querylet($terms) { - global $config, $database; + global $database; $tag_querylets = array(); $img_querylets = array(); diff --git a/core/user.class.php b/core/user.class.php index 50034926..110774c5 100644 --- a/core/user.class.php +++ b/core/user.class.php @@ -15,6 +15,9 @@ class User { var $name; var $email; var $join_date; + var $passhash; + + /* @var UserClass */ var $class; /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * diff --git a/core/util.inc.php b/core/util.inc.php index 6de64efb..6bda7f04 100644 --- a/core/util.inc.php +++ b/core/util.inc.php @@ -385,7 +385,13 @@ function make_http(/*string*/ $link) { /** * Make a form tag with relevant auth token and stuff * - * @retval string + * @param target string + * @param method string + * @param multipart boolean + * @param form_id string + * @param onsubmit string + * + * @return string */ function make_form($target, $method="POST", $multipart=False, $form_id="", $onsubmit="") { global $user; @@ -1276,6 +1282,7 @@ function _sanitise_environment() { } function _get_themelet_files($_theme) { + $base_themelets = array(); if(file_exists('themes/'.$_theme.'/custompage.class.php')) $base_themelets[] = 'themes/'.$_theme.'/custompage.class.php'; $base_themelets[] = 'themes/'.$_theme.'/layout.class.php'; $base_themelets[] = 'themes/'.$_theme.'/themelet.class.php'; @@ -1406,7 +1413,7 @@ function _decaret($str) { } function _get_user() { - global $config, $database; + global $config; $user = null; if(get_prefixed_cookie("user") && get_prefixed_cookie("session")) { $tmp_user = User::by_session(get_prefixed_cookie("user"), get_prefixed_cookie("session")); diff --git a/ext/admin/theme.php b/ext/admin/theme.php index 64c18d2f..3eefdb11 100644 --- a/ext/admin/theme.php +++ b/ext/admin/theme.php @@ -14,9 +14,9 @@ class AdminPageTheme extends Themelet { protected function button(/*string*/ $name, /*string*/ $action, /*boolean*/ $protected=false) { $c_protected = $protected ? " protected" : ""; - $html = make_form(make_link("admin/$action"), "POST", false, false, false, "admin$c_protected"); + $html = make_form(make_link("admin/$action"), "POST", false, null, null, "admin$c_protected"); if($protected) { - $html .= ""; + $html .= ""; $html .= ""; } else { diff --git a/ext/artists/main.php b/ext/artists/main.php index 38c614f9..7aea77ad 100644 --- a/ext/artists/main.php +++ b/ext/artists/main.php @@ -143,7 +143,7 @@ class Artists extends Extension { } public function handle_commands($event) { - global $config, $page, $user; + global $page, $user; if($event->page_matches("artist")) { diff --git a/ext/artists/theme.php b/ext/artists/theme.php index acfe05e7..3fddc369 100644 --- a/ext/artists/theme.php +++ b/ext/artists/theme.php @@ -14,19 +14,11 @@ class ArtistsTheme extends Themelet { "; } - public function display_artists(){ - global $page; - - $page->set_title("Artists"); - $page->set_heading("Artists"); - $page->add_block(new Block("Artists", $html, "main", 10)); - - //$this->display_paginator($page, "artist/list", null, $pageNumber, $totalPages); - } - public function sidebar_options(/*string*/ $mode, $artistID=NULL, $is_admin=FALSE){ - global $page; - + global $page, $user; + + $html = ""; + if($mode == "neutral"){ $html = " ".$user->get_auth_html()." @@ -72,11 +64,14 @@ class ArtistsTheme extends Themelet { "; } - $page->add_block(new Block("Manage Artists", $html, "left", 10)); + + if($html) $page->add_block(new Block("Manage Artists", $html, "left", 10)); } public function show_artist_editor($artist, $aliases, $members, $urls) { + global $user; + $artistName = $artist['name']; $artistNotes = $artist['notes']; $artistID = $artist['id']; @@ -140,7 +135,7 @@ class ArtistsTheme extends Themelet { public function new_artist_composer() { - global $page; + global $page, $user; $html = "
    ".$user->get_auth_html()." @@ -234,6 +229,8 @@ class ArtistsTheme extends Themelet { public function show_new_alias_composer($artistID) { + global $user; + $html = ' '.$user->get_auth_html().' @@ -250,6 +247,8 @@ class ArtistsTheme extends Themelet { } public function show_new_member_composer($artistID) { + global $user; + $html = ' '.$user->get_auth_html().' @@ -267,6 +266,8 @@ class ArtistsTheme extends Themelet { public function show_new_url_composer($artistID) { + global $user; + $html = ' '.$user->get_auth_html().' @@ -284,6 +285,8 @@ class ArtistsTheme extends Themelet { public function show_alias_editor($alias) { + global $user; + $html = ' @@ -301,6 +304,8 @@ class ArtistsTheme extends Themelet { public function show_url_editor($url) { + global $user; + $html = ' @@ -318,6 +323,8 @@ class ArtistsTheme extends Themelet { public function show_member_editor($member) { + global $user; + $html = ' @@ -335,7 +342,7 @@ class ArtistsTheme extends Themelet { public function show_artist($artist, $aliases, $members, $urls, $images, $userIsLogged, $userIsAdmin) { - global $user, $event, $page; + global $page; $artist_link = "".str_replace("_", " ", $artist['name']).""; diff --git a/ext/bulk_add/main.php b/ext/bulk_add/main.php index 2cab0f46..408db0fc 100644 --- a/ext/bulk_add/main.php +++ b/ext/bulk_add/main.php @@ -53,6 +53,7 @@ class BulkAdd extends Extension { if(!array_key_exists('extension', $pathinfo)) { throw new UploadException("File has no extension"); } + $metadata = array(); $metadata['filename'] = $pathinfo['basename']; $metadata['extension'] = $pathinfo['extension']; $metadata['tags'] = $tags; @@ -65,8 +66,6 @@ class BulkAdd extends Extension { } private function add_dir(/*string*/ $base, $subdir="") { - global $page; - if(!is_dir($base)) { $this->theme->add_status("Error", "$base is not a directory"); return; diff --git a/ext/bulk_add_csv/main.php b/ext/bulk_add_csv/main.php index fd177846..cd9ead8b 100644 --- a/ext/bulk_add_csv/main.php +++ b/ext/bulk_add_csv/main.php @@ -62,6 +62,7 @@ class BulkAddCSV extends Extension { if(!array_key_exists('extension', $pathinfo)) { throw new UploadException("File has no extension"); } + $metadata = array(); $metadata['filename'] = $pathinfo['basename']; $metadata['extension'] = $pathinfo['extension']; $metadata['tags'] = $tags; @@ -82,8 +83,6 @@ class BulkAddCSV extends Extension { } private function add_csv(/*string*/ $csvfile) { - global $page; - if(!file_exists($csvfile)) { $this->theme->add_status("Error", "$csvfile not found"); return; diff --git a/ext/bulk_remove/main.php b/ext/bulk_remove/main.php index 73bcbb8e..2e609386 100644 --- a/ext/bulk_remove/main.php +++ b/ext/bulk_remove/main.php @@ -12,7 +12,7 @@ class BulkRemove extends Extension { public function onPageRequest(PageRequestEvent $event) { - global $page, $user; + global $user; if($event->page_matches("bulk_remove") && $user->is_admin() && $user->check_auth_token()) { if ($event->get_arg(0) == "confirm") $this->do_bulk_remove(); else $this->show_confirm(); @@ -20,7 +20,7 @@ class BulkRemove extends Extension { } public function onAdminBuilding(AdminBuildingEvent $event) { - global $page, $user; + global $page; $html = "Be extremely careful when using this!
    Once an image is removed there is no way to recover it so it is recommended that you first take when removing a large amount of images.
    @@ -83,10 +83,10 @@ class BulkRemove extends Extension { // if no images were found with the given info - if (count($images_for_removal) == 0 && $html == "") + if (count($images_for_removal) == 0) $error = "No images selected for removal"; - var_dump($tags_arr); + //var_dump($tags_arr); return array( "error" => $error, "images_for_removal" => $images_for_removal); @@ -119,6 +119,7 @@ class BulkRemove extends Extension { private function do_bulk_remove() { + global $page; // display error if user didn't go through admin board if (!isset($_POST["bulk_remove_images"])) { $page->add_block(new Block("Bulk Remove Error", diff --git a/ext/chatbox/main.php b/ext/chatbox/main.php index 9c48ce40..fc48cac1 100644 --- a/ext/chatbox/main.php +++ b/ext/chatbox/main.php @@ -13,7 +13,7 @@ class Chatbox extends Extension { global $page, $user; // Adds header to enable chatbox - $root = make_http(); + $root = get_base_href(); $yPath = "$root/ext/chatbox/"; $page->add_html_header(" diff --git a/ext/cron_uploader/main.php b/ext/cron_uploader/main.php index 49180ca8..56d23f40 100644 --- a/ext/cron_uploader/main.php +++ b/ext/cron_uploader/main.php @@ -206,7 +206,7 @@ class CronUploader extends Extension { /** * Returns amount of files & total size of dir. - * @param unknown $path + * @param $path string * @return multitype:number */ function scan_dir($path){ @@ -227,7 +227,7 @@ class CronUploader extends Extension { /** * Uploads the image & handles everything - * @param number $upload_count to upload a non-config amount of imgs + * @param $upload_count int to upload a non-config amount of imgs * @return boolean returns true if the upload was successful */ public function process_upload($upload_count = 0) { @@ -254,11 +254,11 @@ class CronUploader extends Extension { try { $this->add_image($img[0], $img[1], $img[2]); - $newPath = $this->move_uploaded($img[0], $img[1], false); + $this->move_uploaded($img[0], $img[1], false); } catch (Exception $e) { - $newPath = $this->move_uploaded($img[0], $img[1], true); + $this->move_uploaded($img[0], $img[1], true); } // Remove img from queue array @@ -295,37 +295,17 @@ class CronUploader extends Extension { $this->add_upload_info($info . "Image \"$filename\" moved from queue to \"$newPath\"."); } - /** - * moves a directory up or gets the directory of a file - * - * @param string $path Path to modify - * @param int $depth Amount of directories to go up - * @return unknown Path to correct Directory - */ - private function move_directory_up($path, $depth=1) - { - $path = str_replace("//", "/", $path); - $array = explode("/", $path); - - for ($i = 0; $i < $depth; $i++) { - $to_remove = count($array) -1; // Gets number of element to remove - unset($array[$to_remove]); - } - - return implode("/", $array); - } - /** * Generate the necessary DataUploadEvent for a given image and tags. */ private function add_image($tmpname, $filename, $tags) { - global $user, $image; assert ( file_exists ( $tmpname ) ); $pathinfo = pathinfo ( $filename ); if (! array_key_exists ( 'extension', $pathinfo )) { throw new UploadException ( "File has no extension" ); } + $metadata = array(); $metadata ['filename'] = $pathinfo ['basename']; $metadata ['extension'] = $pathinfo ['extension']; $metadata ['tags'] = ""; // = $tags; doesn't work when not logged in here @@ -343,12 +323,9 @@ class CronUploader extends Extension { // Set tags $img = Image::by_id($event->image_id); $img->set_tags($tags); - } private function generate_image_queue($base = "", $subdir = "") { - global $config; - if ($base == "") $base = $this->root_dir . "/queue"; @@ -391,8 +368,9 @@ class CronUploader extends Extension { /** * Adds a message to the info being published at the end - * @param string $text - * @param int $addon Enter a value to modify an existing value (enter value number) + * @param $text string + * @param $addon int Enter a value to modify an existing value (enter value number) + * @return int */ private function add_upload_info($text, $addon = 0) { $info = $this->upload_info; @@ -409,7 +387,7 @@ class CronUploader extends Extension { // else if addon function is used, select the line & modify it $lines = substr($info, "\n"); // Seperate the string to array in lines - $lines[$addon] = "$line[$addon] $text"; // Add the content to the line + $lines[$addon] = "$lines[$addon] $text"; // Add the content to the line $this->upload_info = implode("\n", $lines); // Put string back together & update return $addon; // Return line number @@ -419,7 +397,7 @@ class CronUploader extends Extension { * This is run at the end to display & save the log. */ private function handle_log() { - global $page, $config; + global $page; // Display message $page->set_mode("data"); diff --git a/ext/ext_manager/main.php b/ext/ext_manager/main.php index d79cfbed..3d92a092 100644 --- a/ext/ext_manager/main.php +++ b/ext/ext_manager/main.php @@ -21,6 +21,7 @@ function __extman_extcmp(ExtensionInfo $a, ExtensionInfo $b) { class ExtensionInfo { var $ext_name, $name, $link, $author, $email; var $description, $documentation, $version, $visibility; + var $enabled; function __construct($main) { $matches = array(); @@ -167,6 +168,7 @@ class ExtManager extends Extension { private function set_things($settings) { $core = explode(",", CORE_EXTS); + $extras = array(); foreach(glob("ext/*/main.php") as $main) { $matches = array(); diff --git a/ext/favorites/main.php b/ext/favorites/main.php index 3c3494f2..10242e53 100644 --- a/ext/favorites/main.php +++ b/ext/favorites/main.php @@ -35,7 +35,7 @@ class Favorites extends Extension { } public function onImageAdminBlockBuilding(ImageAdminBlockBuildingEvent $event) { - global $database, $page, $user; + global $database, $user; if(!$user->is_anonymous()) { $user_id = $user->id; $image_id = $event->image->id; @@ -88,7 +88,7 @@ class Favorites extends Extension { in_array('favorite_action', $_POST) && (($_POST['favorite_action'] == "set") || ($_POST['favorite_action'] == "unset")) ) { - send_event(new FavoriteSetEvent($event->image_id, $user, ($_POST['favorite_action'] == "set"))); + send_event(new FavoriteSetEvent($event->image->id, $user, ($_POST['favorite_action'] == "set"))); } } diff --git a/ext/handle_archive/main.php b/ext/handle_archive/main.php index a01589f8..a6787ac6 100644 --- a/ext/handle_archive/main.php +++ b/ext/handle_archive/main.php @@ -50,11 +50,11 @@ class ArchiveFileHandler extends Extension { assert(file_exists($tmpname)); try { - global $user; $pathinfo = pathinfo($filename); if(!array_key_exists('extension', $pathinfo)) { throw new UploadException("File has no extension"); } + $metadata = array(); $metadata['filename'] = $pathinfo['basename']; $metadata['extension'] = $pathinfo['extension']; $metadata['tags'] = $tags; @@ -69,8 +69,6 @@ class ArchiveFileHandler extends Extension { // copied from bulk add extension private function add_dir($base, $subdir="") { - global $page; - $list = ""; $dir = opendir("$base/$subdir"); diff --git a/ext/handle_flash/main.php b/ext/handle_flash/main.php index e59b8892..d7e42f9b 100644 --- a/ext/handle_flash/main.php +++ b/ext/handle_flash/main.php @@ -17,8 +17,6 @@ class FlashFileHandler extends DataHandlerExtension { } protected function create_image_from_data(/*string*/ $filename, /*array*/ $metadata) { - global $config; - $image = new Image(); $image->filesize = $metadata['size']; @@ -28,15 +26,8 @@ class FlashFileHandler extends DataHandlerExtension { $image->tag_array = Tag::explode($metadata['tags']); $image->source = $metadata['source']; - // redundant, since getimagesize() works on SWF o_O -// $rect = $this->swf_get_bounds($filename); -// if(is_null($rect)) { -// return $null; -// } -// $image->width = $rect[1]; -// $image->height = $rect[3]; - - if(!($info = getimagesize($filename))) return null; + $info = getimagesize($filename); + if(!$info) return null; $image->width = $info[0]; $image->height = $info[1]; @@ -45,61 +36,14 @@ class FlashFileHandler extends DataHandlerExtension { } protected function check_contents(/*string*/ $file) { - if(!file_exists($file)) return false; + if (!file_exists($file)) return false; - $fp = fopen($file, "r"); - $head = fread($fp, 3); - fclose($fp); - if(!in_array($head, array("CWS", "FWS"))) return false; + $fp = fopen($file, "r"); + $head = fread($fp, 3); + fclose($fp); + if (!in_array($head, array("CWS", "FWS"))) return false; - return true; - } - - private function str_to_binarray(/*string*/ $string) { - $binary = array(); - $length = strlen($string); - for($j=0; $j<$length; $j++) { - $c = ord($string[$j]); - for($i=7; $i>=0; $i--) { - $binary[] = ($c >> $i) & 0x01; - } - } - return $binary; - } - - private function binarray_to_int($binarray, $start=0, $length=32) { - $int = 0; - for($i=$start; $i<$start + $length; $i++) { - $int = $int << 1; - $int = $int + ($binarray[$i] == "1" ? 1 : 0); - } - return $int; - } - - private function swf_get_bounds(/*string*/ $filename) { - $fp = fopen($filename, "r"); - $head = fread($fp, 3); - $version = fread($fp, 1); - $length = fread($fp, 4); - - if($head == "FWS") { - $data = fread($fp, 16); - } - else if($head == "CWS") { - $data = fread($fp, 128*1024); - $data = gzuncompress($data); - $data = substr($data, 0, 16); - } - - $bounds = array(); - $rect_bin = $this->str_to_binarray($data); - $nbits = $this->binarray_to_int($rect_bin, 0, 5); - $bounds[] = $this->binarray_to_int($rect_bin, 5 + 0 * $nbits, $nbits) / 20; - $bounds[] = $this->binarray_to_int($rect_bin, 5 + 1 * $nbits, $nbits) / 20; - $bounds[] = $this->binarray_to_int($rect_bin, 5 + 2 * $nbits, $nbits) / 20; - $bounds[] = $this->binarray_to_int($rect_bin, 5 + 3 * $nbits, $nbits) / 20; - - return $bounds; - } + return true; + } } ?> diff --git a/ext/handle_ico/main.php b/ext/handle_ico/main.php index 269cbbb0..07fa97ec 100644 --- a/ext/handle_ico/main.php +++ b/ext/handle_ico/main.php @@ -36,7 +36,7 @@ class IcoFileHandler extends Extension { } public function onPageRequest(PageRequestEvent $event) { - global $config, $database, $page; + global $page; if($event->page_matches("get_ico")) { $id = int_escape($event->get_arg(0)); $image = Image::by_id($id); @@ -56,8 +56,6 @@ class IcoFileHandler extends Extension { } private function create_image_from_data($filename, $metadata) { - global $config; - $image = new Image(); $fp = fopen($filename, "r"); diff --git a/ext/handle_ico/test.php b/ext/handle_ico/test.php index 956ad322..dd362055 100644 --- a/ext/handle_ico/test.php +++ b/ext/handle_ico/test.php @@ -6,8 +6,8 @@ class IcoHandlerTest extends ShimmieWebTestCase { $this->assert_response(302); $this->log_out(); - $raw = $this->get_page("post/view/$image_id"); // test for no crash - $raw = $this->get_page("get_ico/$image_id"); // test for no crash + $this->get_page("post/view/$image_id"); // test for no crash + $this->get_page("get_ico/$image_id"); // test for no crash $this->log_in_as_admin(); $this->delete_image($image_id); diff --git a/ext/handle_pixel/main.php b/ext/handle_pixel/main.php index 0e7d54a4..da8e5e31 100644 --- a/ext/handle_pixel/main.php +++ b/ext/handle_pixel/main.php @@ -14,8 +14,6 @@ class PixelFileHandler extends DataHandlerExtension { } protected function create_image_from_data(/*string*/ $filename, /*array*/ $metadata) { - global $config; - $image = new Image(); $info = getimagesize($filename); @@ -52,9 +50,10 @@ class PixelFileHandler extends DataHandlerExtension { } protected function create_thumb_force(/*string*/ $hash) { + global $config; + $inname = warehouse_path("images", $hash); $outname = warehouse_path("thumbs", $hash); - global $config; $ok = false; @@ -165,7 +164,7 @@ class PixelFileHandler extends DataHandlerExtension { if($width > $height*5) $width = $height*5; if($height > $width*5) $height = $width*5; - $image = imagecreatefromstring($this->read_file($tmpname)); + $image = imagecreatefromstring(file_get_contents($tmpname)); $tsize = get_thumbnail_size($width, $height); $thumb = imagecreatetruecolor($tsize[0], $tsize[1]); @@ -176,16 +175,6 @@ class PixelFileHandler extends DataHandlerExtension { return $thumb; } } - - private function read_file(/*string*/ $fname) { - $fp = fopen($fname, "r"); - if(!$fp) return false; - - $data = fread($fp, filesize($fname)); - fclose($fp); - - return $data; - } // }}} } ?> diff --git a/ext/handle_pixel/script.js b/ext/handle_pixel/script.js index aa83fa16..8c3a50dd 100644 --- a/ext/handle_pixel/script.js +++ b/ext/handle_pixel/script.js @@ -15,26 +15,26 @@ $(function() { } }); -function zoom(zoom) { +function zoom(zoom_type) { var img = $('.shm-main-image'); - if(zoom == "full") { + if(zoom_type == "full") { img.css('max-width', img.data('width') + 'px'); img.css('max-height', img.data('height') + 'px'); } - if(zoom == "width") { + if(zoom_type == "width") { img.css('max-width', '95%'); img.css('max-height', img.data('height') + 'px'); } - if(zoom == "height") { + if(zoom_type == "height") { img.css('max-width', img.data('width') + 'px'); img.css('max-height', (window.innerHeight * 0.95) + 'px'); } - if(zoom == "both") { + if(zoom_type == "both") { img.css('max-width', '95%'); img.css('max-height', (window.innerHeight * 0.95) + 'px'); } - $(".shm-zoomer").val(zoom); + $(".shm-zoomer").val(zoom_type); - $.cookie("ui-image-zoom", zoom, {path: '/', expires: 365}); + $.cookie("ui-image-zoom", zoom_type, {path: '/', expires: 365}); } diff --git a/ext/handle_video/theme.php b/ext/handle_video/theme.php index c58dd6e5..b4e87dde 100644 --- a/ext/handle_video/theme.php +++ b/ext/handle_video/theme.php @@ -31,6 +31,9 @@ else { "; } + else { + $html = "Video type '$ext' not recognised"; + } $page->add_block(new Block("Video", $html, "main", 10)); } } diff --git a/ext/image/main.php b/ext/image/main.php index 59369dd9..51de36b0 100644 --- a/ext/image/main.php +++ b/ext/image/main.php @@ -20,7 +20,7 @@ class ImageAdditionEvent extends Event { * this new image. * * @sa TagSetEvent - * @param $image The new image to add. + * @param $image Image The new image to add. */ public function __construct(Image $image) { $this->image = $image; @@ -46,7 +46,7 @@ class ImageDeletionEvent extends Event { * Used by things like tags and comments handlers to * clean out related rows in their tables. * - * @param $image The image being deleted + * @param $image Image The image being deleted */ public function __construct(Image $image) { $this->image = $image; @@ -93,8 +93,9 @@ class ThumbnailGenerationEvent extends Event { /** * Request a thumbnail be made for an image object * - * @param $hash The unique hash of the image - * @param $type The type of the image + * @param $hash string The unique hash of the image + * @param $type string The type of the image + * @param $force boolean Regenerate the thumbnail even if one already exists */ public function __construct($hash, $type, $force=false) { $this->hash = $hash; @@ -223,9 +224,6 @@ class ImageIO extends Extension { } public function onUserPageBuilding(UserPageBuildingEvent $event) { - global $user; - global $config; - $u_id = url_escape($event->display_user->id); $i_image_count = Image::count_images(array("user_id={$event->display_user->id}")); $i_days_old = ((time() - strtotime($event->display_user->join_date)) / 86400) + 1; @@ -279,7 +277,7 @@ class ImageIO extends Extension { // add image {{{ - private function add_image($image) { + private function add_image(Image $image) { global $page, $user, $database, $config; /* @@ -401,11 +399,8 @@ class ImageIO extends Extension { // replace image {{{ private function replace_image($id, $image) { - global $page; - global $user; global $database; - global $config; - + /* Check to make sure the image exists. */ $existing = Image::by_id($id); diff --git a/ext/index/theme.php b/ext/index/theme.php index 0b7f5ee5..99a0e839 100644 --- a/ext/index/theme.php +++ b/ext/index/theme.php @@ -1,6 +1,8 @@ page_number = $page_number; $this->total_pages = $total_pages; diff --git a/ext/link_image/theme.php b/ext/link_image/theme.php index 1e5d2196..24de94dc 100644 --- a/ext/link_image/theme.php +++ b/ext/link_image/theme.php @@ -62,7 +62,7 @@ class LinkImageTheme extends Themelet { $text = "[url=".$url."]".$content."[/url]"; break; default: - $text = $link." - ".$content; + $text = $url." - ".$content; } return $text; } diff --git a/ext/livefeed/main.php b/ext/livefeed/main.php index 3ce78f83..804b57e6 100644 --- a/ext/livefeed/main.php +++ b/ext/livefeed/main.php @@ -63,6 +63,7 @@ class LiveFeed extends Extension { fwrite($fp, "$data\n"); fclose($fp); } catch (Exception $e) { + /* logging errors shouldn't break everything */ } } } diff --git a/ext/log_net/main.php b/ext/log_net/main.php index 56ee4c9e..918a1b8e 100644 --- a/ext/log_net/main.php +++ b/ext/log_net/main.php @@ -42,6 +42,7 @@ class LogNet extends Extension { fwrite($fp, "$data\n"); fclose($fp); } catch (Exception $e) { + /* logging errors shouldn't break everything */ } } } diff --git a/ext/not_a_tag/main.php b/ext/not_a_tag/main.php index 0aa72f19..5dcb41fc 100644 --- a/ext/not_a_tag/main.php +++ b/ext/not_a_tag/main.php @@ -29,7 +29,7 @@ class NotATag extends Extension { } private function scan(/*array*/ $tags_mixed) { - global $config, $database; + global $database; $tags = array(); foreach($tags_mixed as $tag) $tags[] = strtolower($tag); @@ -53,12 +53,12 @@ class NotATag extends Extension { } public function onPageRequest(PageRequestEvent $event) { - global $config, $database, $page, $user; + global $database, $page, $user; if($event->page_matches("untag")) { if($user->can("ban_image")) { if($event->get_arg(0) == "add") { - $tag = isset($_POST["tag"]) ? $_POST["tag"] : $image->tag; + $tag = $_POST["tag"]; $redirect = isset($_POST['redirect']) ? $_POST['redirect'] : "DNP"; $database->Execute( diff --git a/ext/notes/main.php b/ext/notes/main.php index 5aa2e72b..cfbb6259 100644 --- a/ext/notes/main.php +++ b/ext/notes/main.php @@ -363,6 +363,8 @@ class Notes extends Extension { */ private function delete_note() { + global $user; + $imageID = int_escape($_POST["image_id"]); $noteID = int_escape($_POST["note_id"]); @@ -388,7 +390,7 @@ class Notes extends Extension { * HERE WE DELETE ALL NOTES FROM IMAGE */ private function nuke_notes() { - global $database; + global $database, $user; $image_id = int_escape($_POST["image_id"]); $database->execute("DELETE FROM notes WHERE image_id = ?", array($image_id)); log_info("notes", "Notes deleted from {$image_id} by {$user->name}"); @@ -400,7 +402,7 @@ class Notes extends Extension { * HERE WE DELETE ALL REQUESTS FOR IMAGE */ private function nuke_requests() { - global $database; + global $database, $user; $image_id = int_escape($_POST["image_id"]); $database->execute("DELETE FROM note_request WHERE image_id = ?", array($image_id)); diff --git a/ext/notes/theme.php b/ext/notes/theme.php index 90ed4948..38bfcbb3 100644 --- a/ext/notes/theme.php +++ b/ext/notes/theme.php @@ -42,7 +42,7 @@ class NotesTheme extends Themelet { $page->add_block(new Block("Search Note", $html, "main", 10)); } - // check action POST on form + // check action POST on form public function display_note_system(Page $page, $image_id, $recovered_notes, $adminOptions) { $to_json = array(); @@ -169,94 +169,66 @@ class NotesTheme extends Themelet { $page->set_heading("Note Requests"); $page->add_block(new Block("Note Requests", $pool_images, "main", 20)); } - + + private function get_history($histories) { + global $user; + + $html = "
    R?SubjectFromDateAction
    Public
    Description
    ".html_escape($pool['title'])."
    Action
    ". + "". + "". + "". + "". + "". + ""; + + if(!$user->is_anonymous()){ + $html .= ""; + } + + $html .= "". + ""; + + foreach($histories as $history) { + $image_link = "".$history['image_id'].""; + $history_link = "".$history['note_id'].".".$history['review_id'].""; + $user_link = "".$history['user_name'].""; + $revert_link = "Revert"; + + $html .= "". + "". + "". + "". + "". + ""; + + if(!$user->is_anonymous()){ + $html .= ""; + } + + } + + $html .= "
    ImageNoteBodyUpdaterDateAction
    ".$image_link."".$history_link."".$history['note']."".$user_link."".autodate($history['date'])."".$revert_link."
    "; + + return $html; + } + public function display_histories($histories, $pageNumber, $totalPages) { - global $user, $page; - - $html = "". - "". - "". - "". - "". - "". - ""; - - - if(!$user->is_anonymous()){ - $html .= ""; - } - - $html .= "". - ""; - - foreach($histories as $history) { - $image_link = "".$history['image_id'].""; - $history_link = "".$history['note_id'].".".$history['review_id'].""; - $user_link = "".$history['user_name'].""; - $revert_link = "Revert"; - - $html .= "". - "". - "". - "". - "". - ""; - - if(!$user->is_anonymous()){ - $html .= ""; - } - - } - - $html .= "
    ImageNoteBodyUpdaterDateAction
    ".$image_link."".$history_link."".$history['note']."".$user_link."".autodate($history['date'])."".$revert_link."
    "; - - $page->set_title("Note Updates"); - $page->set_heading("Note Updates"); - $page->add_block(new Block("Note Updates", $html, "main", 10)); - - $this->display_paginator($page, "note/updated", null, $pageNumber, $totalPages); + global $page; + + $html = $this->get_history($histories); + + $page->set_title("Note Updates"); + $page->set_heading("Note Updates"); + $page->add_block(new Block("Note Updates", $html, "main", 10)); + + $this->display_paginator($page, "note/updated", null, $pageNumber, $totalPages); } public function display_history($histories, $pageNumber, $totalPages) { - global $user, $page; - - $html = "". - "". - "". - "". - "". - "". - ""; - - - if(!$user->is_anonymous()){ - $html .= ""; - } - - $html .= "". - ""; - - foreach($histories as $history) { - $image_link = "".$history['image_id'].""; - $history_link = "".$history['note_id'].".".$history['review_id'].""; - $user_link = "".$history['user_name'].""; - $revert_link = "Revert"; - - $html .= "". - "". - "". - "". - "". - ""; - - if(!$user->is_anonymous()){ - $html .= ""; - } - - } - - $html .= "
    ImageNoteBodyUpdaterDateAction
    ".$image_link."".$history_link."".$history['note']."".$user_link."".autodate($history['date'])."".$revert_link."
    "; - + global $page; + + $html = $this->get_history($histories); + $page->set_title("Note History"); $page->set_heading("Note History"); $page->add_block(new Block("Note History", $html, "main", 10)); diff --git a/ext/oekaki/main.php b/ext/oekaki/main.php index 42d06e10..942e5f30 100644 --- a/ext/oekaki/main.php +++ b/ext/oekaki/main.php @@ -28,6 +28,7 @@ class Oekaki extends Extension { throw new UploadException("File has no extension"); } log_info("oekaki", "Processing file [{$pathinfo['filename']}]"); + $metadata = array(); $metadata['filename'] = 'oekaki.png'; $metadata['extension'] = $pathinfo['extension']; $metadata['tags'] = 'oekaki tagme'; From f72bfbb050f6c5f6774f20764da1ac770d3d1c85 Mon Sep 17 00:00:00 2001 From: Shish Date: Sun, 6 Apr 2014 20:47:01 +0100 Subject: [PATCH 3/3] fix indentation --- core/database.class.php | 4 +- core/extension.class.php | 4 +- core/user.class.php | 4 +- core/util.inc.php | 2 +- ext/artists/theme.php | 679 ++++++++++++++++++------------------ ext/bulk_add/main.php | 4 +- ext/bulk_add_csv/main.php | 4 +- ext/cron_uploader/main.php | 6 +- ext/ext_manager/main.php | 6 +- ext/handle_archive/main.php | 2 +- ext/handle_flash/main.php | 18 +- ext/handle_pixel/main.php | 8 +- ext/handle_video/theme.php | 6 +- ext/image/main.php | 4 +- ext/index/theme.php | 2 +- ext/log_net/main.php | 2 +- ext/notes/theme.php | 172 ++++----- ext/oekaki/main.php | 2 +- 18 files changed, 464 insertions(+), 465 deletions(-) diff --git a/core/database.class.php b/core/database.class.php index 14bac1af..eb00e1ab 100644 --- a/core/database.class.php +++ b/core/database.class.php @@ -271,13 +271,13 @@ class Database { /** * Meta info about the database engine - * @var DBEngine + * @var DBEngine */ private $engine = null; /** * The currently active cache engine - * @var CacheEngine + * @var CacheEngine */ public $cache = null; diff --git a/core/extension.class.php b/core/extension.class.php index bce72590..9d881c80 100644 --- a/core/extension.class.php +++ b/core/extension.class.php @@ -140,8 +140,8 @@ abstract class FormatterExtension extends Extension { */ abstract class DataHandlerExtension extends Extension { public function onDataUpload(DataUploadEvent $event) { - $supported_ext = $this->supported_ext($event->type); - $check_contents = $this->check_contents($event->tmpname); + $supported_ext = $this->supported_ext($event->type); + $check_contents = $this->check_contents($event->tmpname); if($supported_ext && $check_contents) { if(!move_upload_to_archive($event)) return; send_event(new ThumbnailGenerationEvent($event->hash, $event->type)); diff --git a/core/user.class.php b/core/user.class.php index 110774c5..3adceadc 100644 --- a/core/user.class.php +++ b/core/user.class.php @@ -15,9 +15,9 @@ class User { var $name; var $email; var $join_date; - var $passhash; + var $passhash; - /* @var UserClass */ + /* @var UserClass */ var $class; /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * diff --git a/core/util.inc.php b/core/util.inc.php index 6bda7f04..587f66a0 100644 --- a/core/util.inc.php +++ b/core/util.inc.php @@ -1282,7 +1282,7 @@ function _sanitise_environment() { } function _get_themelet_files($_theme) { - $base_themelets = array(); + $base_themelets = array(); if(file_exists('themes/'.$_theme.'/custompage.class.php')) $base_themelets[] = 'themes/'.$_theme.'/custompage.class.php'; $base_themelets[] = 'themes/'.$_theme.'/layout.class.php'; $base_themelets[] = 'themes/'.$_theme.'/themelet.class.php'; diff --git a/ext/artists/theme.php b/ext/artists/theme.php index 3fddc369..c6d957a3 100644 --- a/ext/artists/theme.php +++ b/ext/artists/theme.php @@ -17,7 +17,7 @@ class ArtistsTheme extends Themelet { public function sidebar_options(/*string*/ $mode, $artistID=NULL, $is_admin=FALSE){ global $page, $user; - $html = ""; + $html = ""; if($mode == "neutral"){ $html = " @@ -65,51 +65,51 @@ class ArtistsTheme extends Themelet { "; } - if($html) $page->add_block(new Block("Manage Artists", $html, "left", 10)); + if($html) $page->add_block(new Block("Manage Artists", $html, "left", 10)); } - public function show_artist_editor($artist, $aliases, $members, $urls) - { - global $user; + public function show_artist_editor($artist, $aliases, $members, $urls) + { + global $user; - $artistName = $artist['name']; - $artistNotes = $artist['notes']; - $artistID = $artist['id']; + $artistName = $artist['name']; + $artistNotes = $artist['notes']; + $artistID = $artist['id']; - // aliases - $aliasesString = ""; - $aliasesIDsString = ""; - foreach ($aliases as $alias) - { - $aliasesString .= $alias["alias_name"]." "; - $aliasesIDsString .= $alias["alias_id"]." "; - } - $aliasesString = rtrim($aliasesString); - $aliasesIDsString = rtrim($aliasesIDsString); + // aliases + $aliasesString = ""; + $aliasesIDsString = ""; + foreach ($aliases as $alias) + { + $aliasesString .= $alias["alias_name"]." "; + $aliasesIDsString .= $alias["alias_id"]." "; + } + $aliasesString = rtrim($aliasesString); + $aliasesIDsString = rtrim($aliasesIDsString); - // members - $membersString = ""; - $membersIDsString = ""; - foreach ($members as $member) - { - $membersString .= $member["name"]." "; - $membersIDsString .= $member["id"]." "; - } - $membersString = rtrim($membersString); - $membersIDsString = rtrim($membersIDsString); + // members + $membersString = ""; + $membersIDsString = ""; + foreach ($members as $member) + { + $membersString .= $member["name"]." "; + $membersIDsString .= $member["id"]." "; + } + $membersString = rtrim($membersString); + $membersIDsString = rtrim($membersIDsString); - // urls - $urlsString = ""; - $urlsIDsString = ""; - foreach ($urls as $url) - { - $urlsString .= $url["url"]."\n"; - $urlsIDsString .= $url["id"]." "; - } - $urlsString = substr($urlsString, 0, strlen($urlsString) -1); - $urlsIDsString = rtrim($urlsIDsString); + // urls + $urlsString = ""; + $urlsIDsString = ""; + foreach ($urls as $url) + { + $urlsString .= $url["url"]."\n"; + $urlsIDsString .= $url["id"]." "; + } + $urlsString = substr($urlsString, 0, strlen($urlsString) -1); + $urlsIDsString = rtrim($urlsIDsString); - $html = + $html = '
    '.$user->get_auth_html().' @@ -126,113 +126,113 @@ class ArtistsTheme extends Themelet {
    - + '; - global $page; - $page->add_block(new Block("Edit artist", $html, "main", 10)); - } + global $page; + $page->add_block(new Block("Edit artist", $html, "main", 10)); + } public function new_artist_composer() - { - global $page, $user; + { + global $page, $user; - $html = "
    + $html = " ".$user->get_auth_html()." - - - - - +
    Name:
    Aliases:
    Members:
    URLs:
    + + + + - -
    Name:
    Aliases:
    Members:
    URLs:
    Notes:
    - "; + + + "; - $page->set_title("Artists"); - $page->set_heading("Artists"); - $page->add_block(new Block("Artists", $html, "main", 10)); + $page->set_title("Artists"); + $page->set_heading("Artists"); + $page->add_block(new Block("Artists", $html, "main", 10)); } public function list_artists($artists, $pageNumber, $totalPages) - { - global $user, $page; + { + global $user, $page; - $html = "". - "". - "". - "". - "". - ""; + $html = "
    NameTypeLast updaterPosts
    ". + "". + "". + "". + "". + ""; - if(!$user->is_anonymous()) $html .= ""; // space for edit link - - $html .= ""; + if(!$user->is_anonymous()) $html .= ""; // space for edit link + + $html .= ""; - $deletionLinkActionArray = - array('artist' => 'artist/nuke/' - , 'alias' => 'artist/alias/delete/' - , 'member' => 'artist/member/delete/' - ); + $deletionLinkActionArray = + array('artist' => 'artist/nuke/' + , 'alias' => 'artist/alias/delete/' + , 'member' => 'artist/member/delete/' + ); - $editionLinkActionArray = - array('artist' => 'artist/edit/' - , 'alias' => 'artist/alias/edit/' - , 'member' => 'artist/member/edit/' - ); + $editionLinkActionArray = + array('artist' => 'artist/edit/' + , 'alias' => 'artist/alias/edit/' + , 'member' => 'artist/member/edit/' + ); - $typeTextArray = - array('artist' => 'Artist' - , 'alias' => 'Alias' - , 'member' => 'Member' - ); + $typeTextArray = + array('artist' => 'Artist' + , 'alias' => 'Alias' + , 'member' => 'Member' + ); - foreach ($artists as $artist) { - if ($artist['type'] != 'artist') - $artist['name'] = str_replace("_", " ", $artist['name']); + foreach ($artists as $artist) { + if ($artist['type'] != 'artist') + $artist['name'] = str_replace("_", " ", $artist['name']); - $elementLink = "".str_replace("_", " ", $artist['name']).""; - //$artist_link = "".str_replace("_", " ", $artist['artist_name']).""; - $user_link = "".$artist['user_name'].""; - $edit_link = "Edit"; - $del_link = "Delete"; + $elementLink = "".str_replace("_", " ", $artist['name']).""; + //$artist_link = "".str_replace("_", " ", $artist['artist_name']).""; + $user_link = "".$artist['user_name'].""; + $edit_link = "Edit"; + $del_link = "Delete"; - $html .= "". - "". + "". - "". - "". - ""; + $html .= "". + "". + "". + ""; - if(!$user->is_anonymous()) $html .= ""; - if($user->is_admin()) $html .= ""; + if(!$user->is_anonymous()) $html .= ""; + if($user->is_admin()) $html .= ""; - $html .= ""; - } + $html .= ""; + } - $html .= "
    NameTypeLast updaterPostsAction
    Action
    ".$elementLink; + $html .= "
    ".$elementLink; - //if ($artist['type'] == 'member') - // $html .= " (member of ".$artist_link.")"; + //if ($artist['type'] == 'member') + // $html .= " (member of ".$artist_link.")"; - //if ($artist['type'] == 'alias') - // $html .= " (alias for ".$artist_link.")"; + //if ($artist['type'] == 'alias') + // $html .= " (alias for ".$artist_link.")"; - $html .= "".$typeTextArray[$artist['type']]."".$user_link."".$artist['posts']."".$typeTextArray[$artist['type']]."".$user_link."".$artist['posts']."".$edit_link."".$del_link."".$edit_link."".$del_link."
    "; + $html .= ""; - $page->set_title("Artists"); - $page->set_heading("Artists"); - $page->add_block(new Block("Artists", $html, "main", 10)); + $page->set_title("Artists"); + $page->set_heading("Artists"); + $page->add_block(new Block("Artists", $html, "main", 10)); - $this->display_paginator($page, "artist/list", null, $pageNumber, $totalPages); + $this->display_paginator($page, "artist/list", null, $pageNumber, $totalPages); } - public function show_new_alias_composer($artistID) - { - global $user; + public function show_new_alias_composer($artistID) + { + global $user; - $html = - ' + $html = + ' '.$user->get_auth_html().'
    Alias: @@ -240,266 +240,265 @@ class ArtistsTheme extends Themelet {
    - '; + '; - global $page; - $page->add_block(new Block("Artist Aliases", $html, "main", 20)); - } - public function show_new_member_composer($artistID) - { - global $user; + global $page; + $page->add_block(new Block("Artist Aliases", $html, "main", 20)); + } + public function show_new_member_composer($artistID) + { + global $user; - $html = - '
    + $html = + ' '.$user->get_auth_html().'
    Members:
    -
    - '; + + '; - global $page; - $page->add_block(new Block("Artist members", $html, "main", 30)); - } + global $page; + $page->add_block(new Block("Artist members", $html, "main", 30)); + } - public function show_new_url_composer($artistID) - { - global $user; + public function show_new_url_composer($artistID) + { + global $user; - $html = - '
    + $html = + ' '.$user->get_auth_html().'
    URL:
    -
    - '; + + '; - global $page; - $page->add_block(new Block("Artist URLs", $html, "main", 40)); - } + global $page; + $page->add_block(new Block("Artist URLs", $html, "main", 40)); + } - public function show_alias_editor($alias) - { - global $user; + public function show_alias_editor($alias) + { + global $user; - $html = - ' -
    + $html = + ' + '.$user->get_auth_html().' - - - - -
    - '; + + + + + + '; - global $page; - $page->add_block(new Block("Edit Alias", $html, "main", 10)); - } + global $page; + $page->add_block(new Block("Edit Alias", $html, "main", 10)); + } - public function show_url_editor($url) - { - global $user; + public function show_url_editor($url) + { + global $user; - $html = - ' -
    + $html = + ' + '.$user->get_auth_html().' - - - - -
    - '; + + + + + + '; - global $page; - $page->add_block(new Block("Edit URL", $html, "main", 10)); - } + global $page; + $page->add_block(new Block("Edit URL", $html, "main", 10)); + } - public function show_member_editor($member) - { - global $user; + public function show_member_editor($member) + { + global $user; - $html = - ' -
    + $html = + ' + '.$user->get_auth_html().' - - - - -
    - '; + + + + + + '; - global $page; - $page->add_block(new Block("Edit Member", $html, "main", 10)); - } + global $page; + $page->add_block(new Block("Edit Member", $html, "main", 10)); + } public function show_artist($artist, $aliases, $members, $urls, $images, $userIsLogged, $userIsAdmin) - { - global $page; + { + global $page; - $artist_link = "".str_replace("_", " ", $artist['name']).""; + $artist_link = "".str_replace("_", " ", $artist['name']).""; - $html = " - - - - "; - - if ($userIsLogged) - $html .= ""; - - if ($userIsAdmin) - $html .= ""; - - $html .= " - - - - - "; - if ($userIsLogged) $html .= ""; - if ($userIsAdmin) $html .= ""; - $html .= ""; - - if (count($aliases) > 0) - { - $aliasViewLink = str_replace("_", " ", $aliases[0]['alias_name']); // no link anymore - $aliasEditLink = "Edit"; - $aliasDeleteLink = "Delete"; - - $html .= " - - "; - - if ($userIsLogged) - $html .= ""; - - if ($userIsAdmin) - $html .= ""; - - $html .= ""; - - if (count($aliases) > 1) - { - for ($i = 1; $i < count($aliases); $i++) - { - $aliasViewLink = str_replace("_", " ", $aliases[$i]['alias_name']); // no link anymore - $aliasEditLink = "Edit"; - $aliasDeleteLink = "Delete"; - - $html .= " - - "; - if ($userIsLogged) - $html .= ""; - if ($userIsAdmin) - $html .= ""; - - $html .= ""; - } - } - } - - if (count($members) > 0) - { - $memberViewLink = str_replace("_", " ", $members[0]['name']); // no link anymore - $memberEditLink = "Edit"; - $memberDeleteLink = "Delete"; - - $html .= " - - "; - if ($userIsLogged) - $html .= ""; - if ($userIsAdmin) - $html .= ""; - - $html .= ""; - - if (count($members) > 1) - { - for ($i = 1; $i < count($members); $i++) - { - $memberViewLink = str_replace("_", " ", $members[$i]['name']); // no link anymore - $memberEditLink = "Edit"; - $memberDeleteLink = "Delete"; - - $html .= " - - "; - if ($userIsLogged) - $html .= ""; - if ($userIsAdmin) - $html .= ""; - - $html .= ""; - } - } - } - - if (count($urls) > 0) - { - $urlViewLink = "".str_replace("_", " ", $urls[0]['url']).""; - $urlEditLink = "Edit"; - $urlDeleteLink = "Delete"; - - $html .= " - - "; - - if ($userIsLogged) - $html .= ""; - - if ($userIsAdmin) - $html .= ""; - - $html .= ""; - - if (count($urls) > 1) - { - for ($i = 1; $i < count($urls); $i++) - { - $urlViewLink = "".str_replace("_", " ", $urls[$i]['url']).""; - $urlEditLink = "Edit"; - $urlDeleteLink = "Delete"; - - $html .= " - - "; - if ($userIsLogged) - $html .= ""; - - if ($userIsAdmin) - $html .= ""; - - $html .= ""; - } - } - } - - $html .= - " - - "; - if ($userIsLogged) $html .= ""; - if ($userIsAdmin) $html .= ""; - //TODO how will notes be edited? On edit artist? (should there be an editartist?) or on a editnotes? - //same question for deletion - $html .= " -
    Name:".$artist_link."
    Aliases:".$aliasViewLink."".$aliasEditLink."".$aliasDeleteLink."
     ".$aliasViewLink."".$aliasEditLink."".$aliasDeleteLink."
    Members:".$memberViewLink."".$memberEditLink."".$memberDeleteLink."
     ".$memberViewLink."".$memberEditLink."".$memberDeleteLink."
    URLs:".$urlViewLink."".$urlEditLink."".$urlDeleteLink."
     ".$urlViewLink."".$urlEditLink."".$urlDeleteLink."
    Notes:".$artist["notes"]."
    "; - - $page->set_title("Artist"); - $page->set_heading("Artist"); - $page->add_block(new Block("Artist", $html, "main", 10)); - + $html = " + + + + "; + if ($userIsLogged) + $html .= ""; + + if ($userIsAdmin) + $html .= ""; + + $html .= " + + + + + "; + if ($userIsLogged) $html .= ""; + if ($userIsAdmin) $html .= ""; + $html .= ""; + + if (count($aliases) > 0) + { + $aliasViewLink = str_replace("_", " ", $aliases[0]['alias_name']); // no link anymore + $aliasEditLink = "Edit"; + $aliasDeleteLink = "Delete"; + + $html .= " + + "; + + if ($userIsLogged) + $html .= ""; + + if ($userIsAdmin) + $html .= ""; + + $html .= ""; + + if (count($aliases) > 1) + { + for ($i = 1; $i < count($aliases); $i++) + { + $aliasViewLink = str_replace("_", " ", $aliases[$i]['alias_name']); // no link anymore + $aliasEditLink = "Edit"; + $aliasDeleteLink = "Delete"; + + $html .= " + + "; + if ($userIsLogged) + $html .= ""; + if ($userIsAdmin) + $html .= ""; + + $html .= ""; + } + } + } + + if (count($members) > 0) + { + $memberViewLink = str_replace("_", " ", $members[0]['name']); // no link anymore + $memberEditLink = "Edit"; + $memberDeleteLink = "Delete"; + + $html .= " + + "; + if ($userIsLogged) + $html .= ""; + if ($userIsAdmin) + $html .= ""; + + $html .= ""; + + if (count($members) > 1) + { + for ($i = 1; $i < count($members); $i++) + { + $memberViewLink = str_replace("_", " ", $members[$i]['name']); // no link anymore + $memberEditLink = "Edit"; + $memberDeleteLink = "Delete"; + + $html .= " + + "; + if ($userIsLogged) + $html .= ""; + if ($userIsAdmin) + $html .= ""; + + $html .= ""; + } + } + } + + if (count($urls) > 0) + { + $urlViewLink = "".str_replace("_", " ", $urls[0]['url']).""; + $urlEditLink = "Edit"; + $urlDeleteLink = "Delete"; + + $html .= " + + "; + + if ($userIsLogged) + $html .= ""; + + if ($userIsAdmin) + $html .= ""; + + $html .= ""; + + if (count($urls) > 1) + { + for ($i = 1; $i < count($urls); $i++) + { + $urlViewLink = "".str_replace("_", " ", $urls[$i]['url']).""; + $urlEditLink = "Edit"; + $urlDeleteLink = "Delete"; + + $html .= " + + "; + if ($userIsLogged) + $html .= ""; + + if ($userIsAdmin) + $html .= ""; + + $html .= ""; + } + } + } + + $html .= + " + + "; + if ($userIsLogged) $html .= ""; + if ($userIsAdmin) $html .= ""; + //TODO how will notes be edited? On edit artist? (should there be an editartist?) or on a editnotes? + //same question for deletion + $html .= " +
    Name:".$artist_link."
    Aliases:".$aliasViewLink."".$aliasEditLink."".$aliasDeleteLink."
     ".$aliasViewLink."".$aliasEditLink."".$aliasDeleteLink."
    Members:".$memberViewLink."".$memberEditLink."".$memberDeleteLink."
     ".$memberViewLink."".$memberEditLink."".$memberDeleteLink."
    URLs:".$urlViewLink."".$urlEditLink."".$urlDeleteLink."
     ".$urlViewLink."".$urlEditLink."".$urlDeleteLink."
    Notes:".$artist["notes"]."
    "; + + $page->set_title("Artist"); + $page->set_heading("Artist"); + $page->add_block(new Block("Artist", $html, "main", 10)); + //we show the images for the artist $artist_images = ""; foreach($images as $image) { diff --git a/ext/bulk_add/main.php b/ext/bulk_add/main.php index 408db0fc..cf58e4a3 100644 --- a/ext/bulk_add/main.php +++ b/ext/bulk_add/main.php @@ -30,7 +30,7 @@ class BulkAdd extends Extension { public function onCommand(CommandEvent $event) { if($event->cmd == "help") { print " bulk-add [directory]\n"; - print " Import this directory\n\n"; + print " Import this directory\n\n"; } if($event->cmd == "bulk-add") { if(count($event->args) == 1) { @@ -53,7 +53,7 @@ class BulkAdd extends Extension { if(!array_key_exists('extension', $pathinfo)) { throw new UploadException("File has no extension"); } - $metadata = array(); + $metadata = array(); $metadata['filename'] = $pathinfo['basename']; $metadata['extension'] = $pathinfo['extension']; $metadata['tags'] = $tags; diff --git a/ext/bulk_add_csv/main.php b/ext/bulk_add_csv/main.php index cd9ead8b..4ff15773 100644 --- a/ext/bulk_add_csv/main.php +++ b/ext/bulk_add_csv/main.php @@ -33,7 +33,7 @@ class BulkAddCSV extends Extension { public function onCommand(CommandEvent $event) { if($event->cmd == "help") { print " bulk-add-csv [/path/to.csv]\n"; - print " Import this .csv file (refer to documentation)\n\n"; + print " Import this .csv file (refer to documentation)\n\n"; } if($event->cmd == "bulk-add-csv") { global $user; @@ -62,7 +62,7 @@ class BulkAddCSV extends Extension { if(!array_key_exists('extension', $pathinfo)) { throw new UploadException("File has no extension"); } - $metadata = array(); + $metadata = array(); $metadata['filename'] = $pathinfo['basename']; $metadata['extension'] = $pathinfo['extension']; $metadata['tags'] = $tags; diff --git a/ext/cron_uploader/main.php b/ext/cron_uploader/main.php index 56d23f40..24c62c55 100644 --- a/ext/cron_uploader/main.php +++ b/ext/cron_uploader/main.php @@ -305,7 +305,7 @@ class CronUploader extends Extension { if (! array_key_exists ( 'extension', $pathinfo )) { throw new UploadException ( "File has no extension" ); } - $metadata = array(); + $metadata = array(); $metadata ['filename'] = $pathinfo ['basename']; $metadata ['extension'] = $pathinfo ['extension']; $metadata ['tags'] = ""; // = $tags; doesn't work when not logged in here @@ -370,7 +370,7 @@ class CronUploader extends Extension { * Adds a message to the info being published at the end * @param $text string * @param $addon int Enter a value to modify an existing value (enter value number) - * @return int + * @return int */ private function add_upload_info($text, $addon = 0) { $info = $this->upload_info; @@ -415,4 +415,4 @@ class CronUploader extends Extension { file_put_contents ($log_path, $content); } } -?> \ No newline at end of file +?> diff --git a/ext/ext_manager/main.php b/ext/ext_manager/main.php index 3d92a092..fdd59c4e 100644 --- a/ext/ext_manager/main.php +++ b/ext/ext_manager/main.php @@ -21,7 +21,7 @@ function __extman_extcmp(ExtensionInfo $a, ExtensionInfo $b) { class ExtensionInfo { var $ext_name, $name, $link, $author, $email; var $description, $documentation, $version, $visibility; - var $enabled; + var $enabled; function __construct($main) { $matches = array(); @@ -132,7 +132,7 @@ class ExtManager extends Extension { public function onCommand(CommandEvent $event) { if($event->cmd == "help") { print " disable-all-ext\n"; - print " disable all extensions\n\n"; + print " disable all extensions\n\n"; } if($event->cmd == "disable-all-ext") { $this->write_config(array()); @@ -168,7 +168,7 @@ class ExtManager extends Extension { private function set_things($settings) { $core = explode(",", CORE_EXTS); - $extras = array(); + $extras = array(); foreach(glob("ext/*/main.php") as $main) { $matches = array(); diff --git a/ext/handle_archive/main.php b/ext/handle_archive/main.php index a6787ac6..f4dfe3dc 100644 --- a/ext/handle_archive/main.php +++ b/ext/handle_archive/main.php @@ -54,7 +54,7 @@ class ArchiveFileHandler extends Extension { if(!array_key_exists('extension', $pathinfo)) { throw new UploadException("File has no extension"); } - $metadata = array(); + $metadata = array(); $metadata['filename'] = $pathinfo['basename']; $metadata['extension'] = $pathinfo['extension']; $metadata['tags'] = $tags; diff --git a/ext/handle_flash/main.php b/ext/handle_flash/main.php index d7e42f9b..88becce7 100644 --- a/ext/handle_flash/main.php +++ b/ext/handle_flash/main.php @@ -20,13 +20,13 @@ class FlashFileHandler extends DataHandlerExtension { $image = new Image(); $image->filesize = $metadata['size']; - $image->hash = $metadata['hash']; + $image->hash = $metadata['hash']; $image->filename = $metadata['filename']; $image->ext = $metadata['extension']; $image->tag_array = Tag::explode($metadata['tags']); $image->source = $metadata['source']; - $info = getimagesize($filename); + $info = getimagesize($filename); if(!$info) return null; $image->width = $info[0]; @@ -36,14 +36,14 @@ class FlashFileHandler extends DataHandlerExtension { } protected function check_contents(/*string*/ $file) { - if (!file_exists($file)) return false; + if (!file_exists($file)) return false; - $fp = fopen($file, "r"); - $head = fread($fp, 3); - fclose($fp); - if (!in_array($head, array("CWS", "FWS"))) return false; + $fp = fopen($file, "r"); + $head = fread($fp, 3); + fclose($fp); + if (!in_array($head, array("CWS", "FWS"))) return false; - return true; - } + return true; + } } ?> diff --git a/ext/handle_pixel/main.php b/ext/handle_pixel/main.php index da8e5e31..0ee4ca69 100644 --- a/ext/handle_pixel/main.php +++ b/ext/handle_pixel/main.php @@ -23,11 +23,11 @@ class PixelFileHandler extends DataHandlerExtension { $image->height = $info[1]; $image->filesize = $metadata['size']; - $image->hash = $metadata['hash']; + $image->hash = $metadata['hash']; $image->filename = (($pos = strpos($metadata['filename'],'?')) !== false) ? substr($metadata['filename'],0,$pos) : $metadata['filename']; - $image->ext = (($pos = strpos($metadata['extension'],'?')) !== false) ? substr($metadata['extension'],0,$pos) : $metadata['extension']; + $image->ext = (($pos = strpos($metadata['extension'],'?')) !== false) ? substr($metadata['extension'],0,$pos) : $metadata['extension']; $image->tag_array = Tag::explode($metadata['tags']); - $image->source = $metadata['source']; + $image->source = $metadata['source']; return $image; } @@ -50,7 +50,7 @@ class PixelFileHandler extends DataHandlerExtension { } protected function create_thumb_force(/*string*/ $hash) { - global $config; + global $config; $inname = warehouse_path("images", $hash); $outname = warehouse_path("thumbs", $hash); diff --git a/ext/handle_video/theme.php b/ext/handle_video/theme.php index b4e87dde..3e584ce3 100644 --- a/ext/handle_video/theme.php +++ b/ext/handle_video/theme.php @@ -31,9 +31,9 @@ else { "; } - else { - $html = "Video type '$ext' not recognised"; - } + else { + $html = "Video type '$ext' not recognised"; + } $page->add_block(new Block("Video", $html, "main", 10)); } } diff --git a/ext/image/main.php b/ext/image/main.php index 51de36b0..32d1bf97 100644 --- a/ext/image/main.php +++ b/ext/image/main.php @@ -94,8 +94,8 @@ class ThumbnailGenerationEvent extends Event { * Request a thumbnail be made for an image object * * @param $hash string The unique hash of the image - * @param $type string The type of the image - * @param $force boolean Regenerate the thumbnail even if one already exists + * @param $type string The type of the image + * @param $force boolean Regenerate the thumbnail even if one already exists */ public function __construct($hash, $type, $force=false) { $this->hash = $hash; diff --git a/ext/index/theme.php b/ext/index/theme.php index 99a0e839..7c04910b 100644 --- a/ext/index/theme.php +++ b/ext/index/theme.php @@ -1,7 +1,7 @@ page_number = $page_number; diff --git a/ext/log_net/main.php b/ext/log_net/main.php index 918a1b8e..f82d01d3 100644 --- a/ext/log_net/main.php +++ b/ext/log_net/main.php @@ -42,7 +42,7 @@ class LogNet extends Extension { fwrite($fp, "$data\n"); fclose($fp); } catch (Exception $e) { - /* logging errors shouldn't break everything */ + /* logging errors shouldn't break everything */ } } } diff --git a/ext/notes/theme.php b/ext/notes/theme.php index 38bfcbb3..99359b92 100644 --- a/ext/notes/theme.php +++ b/ext/notes/theme.php @@ -1,6 +1,6 @@ Add a note -->
    @@ -39,32 +39,32 @@ class NotesTheme extends Themelet { $page->set_title(html_escape("Search Note")); $page->set_heading(html_escape("Search Note")); - $page->add_block(new Block("Search Note", $html, "main", 10)); + $page->add_block(new Block("Search Note", $html, "main", 10)); } // check action POST on form public function display_note_system(Page $page, $image_id, $recovered_notes, $adminOptions) { $to_json = array(); - foreach($recovered_notes as $note) - { - $parsedNote = $note["note"]; - $parsedNote = str_replace("\n", "\\n", $parsedNote); - $parsedNote = str_replace("\r", "\\r", $parsedNote); + foreach($recovered_notes as $note) + { + $parsedNote = $note["note"]; + $parsedNote = str_replace("\n", "\\n", $parsedNote); + $parsedNote = str_replace("\r", "\\r", $parsedNote); - $to_json[] = array( + $to_json[] = array( 'x1' => $note["x1"], - 'y1' => $note["y1"], - 'height' => $note["height"], - 'width' => $note["width"], - 'note' => $parsedNote, - 'note_id' => $note["id"], + 'y1' => $note["y1"], + 'height' => $note["height"], + 'width' => $note["width"], + 'note' => $parsedNote, + 'note_id' => $note["id"], ); - } + } $html = " + $html .= "
    ".make_form(make_link("note/add_note"))." @@ -88,41 +88,41 @@ class NotesTheme extends Themelet {
    -
    +
    ".make_form(make_link("note/edit_note"))." - - - - - - - - - - - - - - -
    - -
    - "; + + + + + + + + + + + + + + +
    + +
    + "; - if($adminOptions) - $html .= " + if($adminOptions) + $html .= " ".make_form(make_link("note/delete_note"))." - - - - - - -
    - + + + + + + +
    + "; - $html .= "
    "; + $html .= "
    "; $page->add_block(new Block(null, $html, "main", 1)); } @@ -170,64 +170,64 @@ class NotesTheme extends Themelet { $page->add_block(new Block("Note Requests", $pool_images, "main", 20)); } - private function get_history($histories) { - global $user; + private function get_history($histories) { + global $user; - $html = "". - "". - "". - "". - "". - "". - ""; + $html = "
    ImageNoteBodyUpdaterDate
    ". + "". + "". + "". + "". + "". + ""; - if(!$user->is_anonymous()){ - $html .= ""; - } + if(!$user->is_anonymous()){ + $html .= ""; + } - $html .= "". - ""; + $html .= "". + ""; - foreach($histories as $history) { - $image_link = "".$history['image_id'].""; - $history_link = "".$history['note_id'].".".$history['review_id'].""; - $user_link = "".$history['user_name'].""; - $revert_link = "Revert"; + foreach($histories as $history) { + $image_link = "".$history['image_id'].""; + $history_link = "".$history['note_id'].".".$history['review_id'].""; + $user_link = "".$history['user_name'].""; + $revert_link = "Revert"; - $html .= "". - "". - "". - "". - "". - ""; + $html .= "". + "". + "". + "". + "". + ""; - if(!$user->is_anonymous()){ - $html .= ""; - } + if(!$user->is_anonymous()){ + $html .= ""; + } - } + } - $html .= "
    ImageNoteBodyUpdaterDateActionAction
    ".$image_link."".$history_link."".$history['note']."".$user_link."".autodate($history['date'])."
    ".$image_link."".$history_link."".$history['note']."".$user_link."".autodate($history['date'])."".$revert_link."".$revert_link."
    "; + $html .= ""; - return $html; - } + return $html; + } public function display_histories($histories, $pageNumber, $totalPages) { - global $page; + global $page; - $html = $this->get_history($histories); + $html = $this->get_history($histories); - $page->set_title("Note Updates"); - $page->set_heading("Note Updates"); - $page->add_block(new Block("Note Updates", $html, "main", 10)); + $page->set_title("Note Updates"); + $page->set_heading("Note Updates"); + $page->add_block(new Block("Note Updates", $html, "main", 10)); - $this->display_paginator($page, "note/updated", null, $pageNumber, $totalPages); + $this->display_paginator($page, "note/updated", null, $pageNumber, $totalPages); } public function display_history($histories, $pageNumber, $totalPages) { - global $page; + global $page; - $html = $this->get_history($histories); + $html = $this->get_history($histories); $page->set_title("Note History"); $page->set_heading("Note History"); @@ -235,5 +235,5 @@ class NotesTheme extends Themelet { $this->display_paginator($page, "note/updated", null, $pageNumber, $totalPages); } -} +} ?> diff --git a/ext/oekaki/main.php b/ext/oekaki/main.php index 942e5f30..6c114537 100644 --- a/ext/oekaki/main.php +++ b/ext/oekaki/main.php @@ -28,7 +28,7 @@ class Oekaki extends Extension { throw new UploadException("File has no extension"); } log_info("oekaki", "Processing file [{$pathinfo['filename']}]"); - $metadata = array(); + $metadata = array(); $metadata['filename'] = 'oekaki.png'; $metadata['extension'] = $pathinfo['extension']; $metadata['tags'] = 'oekaki tagme';