diff --git a/core/basethemelet.class.php b/core/basethemelet.class.php index 1f63525c..19b17e6c 100644 --- a/core/basethemelet.class.php +++ b/core/basethemelet.class.php @@ -83,6 +83,7 @@ class BaseThemelet { * @param string $query * @param int $page_number * @param int $total_pages + * @param bool $show_random */ public function display_paginator(Page $page, $base, $query, $page_number, $total_pages, $show_random = FALSE) { if($total_pages == 0) $total_pages = 1; @@ -127,6 +128,7 @@ class BaseThemelet { * @param int $total_pages * @param string $base_url * @param string $query + * @param bool $show_random * @return string */ private function build_paginator($current_page, $total_pages, $base_url, $query, $show_random) { diff --git a/core/imageboard.pack.php b/core/imageboard.pack.php index 3bee9ef3..9c4bf2ac 100644 --- a/core/imageboard.pack.php +++ b/core/imageboard.pack.php @@ -561,6 +561,7 @@ class Image { * Set the tags for this image. * * @param string[] $tags + * @throws Exception */ public function set_tags($tags) { assert('is_array($tags) && count($tags) > 0', var_export($tags, true)); @@ -918,6 +919,8 @@ class Image { /** * this function exists because mysql is a turd, see the docs for * build_accurate_search_querylet() for a full explanation + * + * @param array $terms */ private static function build_ugly_search_querylet($terms) { global $database; diff --git a/core/sys_config.inc.php b/core/sys_config.inc.php index dae1e161..46e43028 100644 --- a/core/sys_config.inc.php +++ b/core/sys_config.inc.php @@ -18,6 +18,8 @@ * define("SPEED_HAX", true); * */ + +/** @private */ function _d($name, $value) {if(!defined($name)) define($name, $value);} _d("DATABASE_DSN", null); // string PDO database connection details _d("DATABASE_KA", true); // string Keep database connection alive diff --git a/core/user.class.php b/core/user.class.php index fdaf03d0..53145633 100644 --- a/core/user.class.php +++ b/core/user.class.php @@ -204,6 +204,7 @@ class User { /** * @param string $name + * @throws Exception */ public function set_name(/*string*/ $name) { global $database; diff --git a/core/userclass.class.php b/core/userclass.class.php index 7f02f570..5780b3fe 100644 --- a/core/userclass.class.php +++ b/core/userclass.class.php @@ -51,8 +51,6 @@ class UserClass { * @throws SCoreException */ public function can(/*string*/ $ability) { - global $config; - if(array_key_exists($ability, $this->abilities)) { $val = $this->abilities[$ability]; return $val; diff --git a/core/util.inc.php b/core/util.inc.php index f30b6ff8..e1624c25 100644 --- a/core/util.inc.php +++ b/core/util.inc.php @@ -629,7 +629,6 @@ function is_https_enabled() { * from the "Amazon S3 PHP class" which is Copyright (c) 2008, Donovan Schönknecht * and released under the 'Simplified BSD License'. * - * @internal Used to get mime types * @param string &$file File path * @param string $ext * @param bool $list @@ -1180,6 +1179,8 @@ function ip_in_range($IP, $CIDR) { * * from a patch by Christian Walde; only intended for use in the * "extension manager" extension, but it seems to fit better here + * + * @param string $f */ function deltree($f) { //Because Windows (I know, bad excuse) @@ -1223,6 +1224,9 @@ function deltree($f) { * Copy an entire file hierarchy * * from a comment on http://uk.php.net/copy + * + * @param string $source + * @param string $target */ function full_copy($source, $target) { if(is_dir($source)) { diff --git a/ext/admin/main.php b/ext/admin/main.php index 9fe0efe8..446a984c 100644 --- a/ext/admin/main.php +++ b/ext/admin/main.php @@ -119,7 +119,7 @@ class AdminPage extends Extension { } private function delete_by_query() { - global $page, $user; + global $page; $query = $_POST['query']; $reason = @$_POST['reason']; assert(strlen($query) > 1); diff --git a/ext/admin/theme.php b/ext/admin/theme.php index 42ec6126..64ee1a92 100644 --- a/ext/admin/theme.php +++ b/ext/admin/theme.php @@ -20,7 +20,7 @@ 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, null, null, "admin$c_protected"); + $html = make_form(make_link("admin/$action"), "POST", false, "admin$c_protected"); if($protected) { $html .= ""; $html .= ""; diff --git a/ext/amazon_s3/main.php b/ext/amazon_s3/main.php index 7b39e5a2..dc097465 100644 --- a/ext/amazon_s3/main.php +++ b/ext/amazon_s3/main.php @@ -67,8 +67,8 @@ class UploadS3 extends Extension { if(!empty($bucket)) { log_debug("amazon_s3", "Deleting Image #".$event->image->id." from S3"); $s3 = new S3($access, $secret); - $s3->deleteObject($bucket, "images/"+$event->image->hash); - $s3->deleteObject($bucket, "thumbs/"+$event->image->hash); + $s3->deleteObject($bucket, "images/" . $event->image->hash); + $s3->deleteObject($bucket, "thumbs/" . $event->image->hash); } } } diff --git a/ext/artists/main.php b/ext/artists/main.php index 7bb6238b..c5e70b30 100644 --- a/ext/artists/main.php +++ b/ext/artists/main.php @@ -673,7 +673,7 @@ class Artists extends Extension { $this->save_existing_member($membersIDsAsArray[$i], $membersAsArray[$i], $userID); else // if we already updated all, save new ones - $this->save_new_member($artistID, $membersAsArray[$i], "", $userID); + $this->save_new_member($artistID, $membersAsArray[$i], $userID); $i++; } @@ -839,7 +839,7 @@ class Artists extends Extension { $membersArray = explode(" ", $members); foreach ($membersArray as $member) if (!$this->member_exists($artistID, $member)) - $this->save_new_member($artistID, $member, "", $userID); + $this->save_new_member($artistID, $member, $userID); } if (strlen($urls)) @@ -1132,7 +1132,6 @@ class Artists extends Extension { return; $aliasArray = explode(" ", $aliases); - global $database; foreach ($aliasArray as $alias) if (!$this->alias_exists($artistID, $alias)) $this->save_new_alias($artistID, $alias, $userID); diff --git a/ext/blocks/theme.php b/ext/blocks/theme.php index 00cfd170..8a490977 100644 --- a/ext/blocks/theme.php +++ b/ext/blocks/theme.php @@ -1,7 +1,7 @@ "; foreach($blocks as $block) { diff --git a/ext/blotter/main.php b/ext/blotter/main.php index a0bd21b5..645154ec 100644 --- a/ext/blotter/main.php +++ b/ext/blotter/main.php @@ -44,7 +44,6 @@ class Blotter extends Extension { } public function onSetupBuilding(SetupBuildingEvent $event) { - global $config; $sb = new SetupBlock("Blotter"); $sb->add_int_option("blotter_recent", "
Number of recent entries to display: "); $sb->add_text_option("blotter_color", "
Color of important updates: (ABCDEF format) "); diff --git a/ext/bulk_add_csv/theme.php b/ext/bulk_add_csv/theme.php index 01c2e21f..72b8d674 100644 --- a/ext/bulk_add_csv/theme.php +++ b/ext/bulk_add_csv/theme.php @@ -21,7 +21,7 @@ class BulkAddCSVTheme extends Themelet { * csv file */ public function display_admin_block() { - global $page, $user; + global $page; $html = " Add images from a csv. Images will be tagged and have their source and rating set (if \"Image Ratings\" is enabled) diff --git a/ext/comment/main.php b/ext/comment/main.php index a8fd4f8d..9432468f 100644 --- a/ext/comment/main.php +++ b/ext/comment/main.php @@ -286,8 +286,6 @@ class CommentList extends Extension { } public function onSearchTermParse(SearchTermParseEvent $event) { - global $database; - $matches = array(); if(preg_match("/^comments([:]?<|[:]?>|[:]?<=|[:]?>=|[:|=])(\d+)$/i", $event->term, $matches)) { @@ -447,7 +445,7 @@ class CommentList extends Extension { // add / remove / edit comments {{{ private function is_comment_limit_hit() { - global $user, $config, $database; + global $config, $database; // sqlite fails at intervals if($database->get_driver_name() === "sqlite") return false; @@ -562,7 +560,7 @@ class CommentList extends Extension { * @throws CommentPostingException */ private function add_comment_wrapper(/*int*/ $image_id, User $user, /*string*/ $comment) { - global $database, $config, $page; + global $database, $page; if(!$user->can("bypass_comment_checks")) { // will raise an exception if anything is wrong diff --git a/ext/cron_uploader/main.php b/ext/cron_uploader/main.php index a8517ce2..39069963 100644 --- a/ext/cron_uploader/main.php +++ b/ext/cron_uploader/main.php @@ -61,7 +61,7 @@ class CronUploader extends Extension { } private function display_documentation() { - global $config, $page; + global $page; $this->set_dir(); // Determines path to cron_uploader_dir @@ -151,7 +151,6 @@ class CronUploader extends Extension { } public function onSetupBuilding(SetupBuildingEvent $event) { - global $config; $this->set_dir(); $cron_url = make_http(make_link("/cron_upload/" . $this->upload_key)); @@ -344,7 +343,7 @@ class CronUploader extends Extension { foreach ( glob ( "$base/$subdir/*" ) as $fullpath ) { $fullpath = str_replace ( "//", "/", $fullpath ); - $shortpath = str_replace ( $base, "", $fullpath ); + //$shortpath = str_replace ( $base, "", $fullpath ); if (is_link ( $fullpath )) { // ignore diff --git a/ext/custom_html_headers/main.php b/ext/custom_html_headers/main.php index f3ed3b6b..df04b436 100644 --- a/ext/custom_html_headers/main.php +++ b/ext/custom_html_headers/main.php @@ -15,10 +15,8 @@ * You can also add your website name as prefix or suffix to the title of each page on your website. */ class custom_html_headers extends Extension { -# Adds setup block for custom content + # Adds setup block for custom content public function onSetupBuilding(SetupBuildingEvent $event) { - global $config; - $sb = new SetupBlock("Custom HTML Headers"); // custom headers diff --git a/ext/danbooru_api/main.php b/ext/danbooru_api/main.php index 557dda2e..50f3799f 100644 --- a/ext/danbooru_api/main.php +++ b/ext/danbooru_api/main.php @@ -411,7 +411,6 @@ class DanbooruApi extends Extension { private function authenticate_user() { global $config; - global $database; global $user; if(isset($_REQUEST['login']) && isset($_REQUEST['password'])) diff --git a/ext/downtime/theme.php b/ext/downtime/theme.php index aae0cca5..c61123b6 100644 --- a/ext/downtime/theme.php +++ b/ext/downtime/theme.php @@ -3,6 +3,8 @@ class DowntimeTheme extends Themelet { /** * Show the admin that downtime mode is enabled + * + * @param Page $page */ public function display_notification(Page $page) { $page->add_block(new Block("Downtime", @@ -11,6 +13,8 @@ class DowntimeTheme extends Themelet { /** * Display $message and exit + * + * @param string $message */ public function display_message(/*string*/ $message) { global $config, $user; diff --git a/ext/ext_manager/theme.php b/ext/ext_manager/theme.php index fa340d41..b138ac49 100644 --- a/ext/ext_manager/theme.php +++ b/ext/ext_manager/theme.php @@ -2,7 +2,6 @@ class ExtManagerTheme extends Themelet { public function display_table(Page $page, /*array*/ $extensions, /*bool*/ $editable) { - global $user; $h_en = $editable ? "Enabled" : ""; $html = " ".make_form(make_link("ext_manager/set"))." diff --git a/ext/favorites/main.php b/ext/favorites/main.php index 80b722d9..0cfca51b 100644 --- a/ext/favorites/main.php +++ b/ext/favorites/main.php @@ -133,7 +133,6 @@ class Favorites extends Extension { $event->add_querylet(new Querylet("images.id IN (SELECT id FROM images WHERE favorites $cmp $favorites)")); } else if(preg_match("/^favorited_by[=|:](.*)$/i", $event->term, $matches)) { - global $database; $user = User::by_name($matches[1]); if(!is_null($user)) { $user_id = $user->id; diff --git a/ext/favorites/theme.php b/ext/favorites/theme.php index d530e497..ae502ab2 100644 --- a/ext/favorites/theme.php +++ b/ext/favorites/theme.php @@ -2,8 +2,6 @@ class FavoritesTheme extends Themelet { public function get_voter_html(Image $image, $is_favorited) { - global $page, $user; - $i_image_id = int_escape($image->id); $name = $is_favorited ? "unset" : "set"; $label = $is_favorited ? "Un-Favorite" : "Favorite"; diff --git a/ext/forum/main.php b/ext/forum/main.php index 1fea2064..8a263364 100644 --- a/ext/forum/main.php +++ b/ext/forum/main.php @@ -71,7 +71,7 @@ class Forum extends Extension { } public function onUserPageBuilding(UserPageBuildingEvent $event) { - global $page, $user, $database; + global $database; $threads_count = $database->get_one("SELECT COUNT(*) FROM forum_threads WHERE user_id=?", array($event->display_user->id)); $posts_count = $database->get_one("SELECT COUNT(*) FROM forum_posts WHERE user_id=?", array($event->display_user->id)); @@ -250,7 +250,6 @@ class Forum extends Extension { } private function sanity_check_viewed_thread($threadID) { - global $database; $errors = null; if (!$this->threadExists($threadID)) { @@ -298,7 +297,7 @@ class Forum extends Extension { private function show_posts($event, $showAdminOptions = false) { - global $config, $database, $user; + global $config, $database; $threadID = $event->get_arg(1); $pageNumber = $event->get_arg(2); $postsPerPage = $config->get_int('forumPostsPerPage', 15); diff --git a/ext/handle_svg/main.php b/ext/handle_svg/main.php index b6f562be..96640595 100644 --- a/ext/handle_svg/main.php +++ b/ext/handle_svg/main.php @@ -23,7 +23,6 @@ class SVGFileHandler extends Extension { } public function onThumbnailGeneration(ThumbnailGenerationEvent $event) { - global $config; if($this->supported_ext($event->type)) { $hash = $event->hash; @@ -39,7 +38,7 @@ class SVGFileHandler extends Extension { } public function onPageRequest(PageRequestEvent $event) { - global $config, $database, $page; + global $page; if($event->page_matches("get_svg")) { $id = int_escape($event->get_arg(0)); $image = Image::by_id($id); @@ -66,8 +65,6 @@ class SVGFileHandler extends Extension { * @return Image */ private function create_image_from_data($filename, $metadata) { - global $config; - $image = new Image(); $msp = new MiniSVGParser($filename); diff --git a/ext/holiday/main.php b/ext/holiday/main.php index be23350c..7912d8e1 100644 --- a/ext/holiday/main.php +++ b/ext/holiday/main.php @@ -13,7 +13,6 @@ class Holiday extends Extension { } public function onSetupBuilding(SetupBuildingEvent $event) { - global $config; $sb = new SetupBlock("Holiday Theme"); $sb->add_bool_option("holiday_aprilfools", "Enable April Fools"); $event->panel->add_block($sb); diff --git a/ext/home/main.php b/ext/home/main.php index d170b135..fb1269db 100644 --- a/ext/home/main.php +++ b/ext/home/main.php @@ -46,7 +46,6 @@ class Home extends Extension { private function get_body() { // returns just the contents of the body - global $database; global $config; $base_href = get_base_href(); $sitename = $config->get_string('title'); diff --git a/ext/image/main.php b/ext/image/main.php index bdd1978c..784ef564 100644 --- a/ext/image/main.php +++ b/ext/image/main.php @@ -217,7 +217,7 @@ class ImageIO extends Extension { } public function onImageAdminBlockBuilding(ImageAdminBlockBuildingEvent $event) { - global $user, $config; + global $user; if($user->can("delete_image")) { $event->add_part($this->theme->get_deleter_html($event->image->id)); @@ -310,7 +310,7 @@ class ImageIO extends Extension { * @throws ImageAdditionException */ private function add_image(Image $image) { - global $page, $user, $database, $config; + global $user, $database, $config; /* * Validate things diff --git a/ext/image/theme.php b/ext/image/theme.php index 072888bf..96f23501 100644 --- a/ext/image/theme.php +++ b/ext/image/theme.php @@ -8,8 +8,6 @@ class ImageIOTheme extends Themelet { * @return string */ public function get_deleter_html(/*int*/ $image_id) { - global $config; - $html = " ".make_form(make_link("image/delete"))." diff --git a/ext/image_hash_ban/main.php b/ext/image_hash_ban/main.php index 5037c844..742e8a85 100644 --- a/ext/image_hash_ban/main.php +++ b/ext/image_hash_ban/main.php @@ -53,7 +53,7 @@ class ImageBan extends Extension { } public function onPageRequest(PageRequestEvent $event) { - global $config, $database, $page, $user; + global $database, $page, $user; if($event->page_matches("image_hash_ban")) { if($user->can("ban_image")) { diff --git a/ext/index/main.php b/ext/index/main.php index aba16e82..75a7fab0 100644 --- a/ext/index/main.php +++ b/ext/index/main.php @@ -235,7 +235,7 @@ class Index extends Extension { } public function onPageRequest(PageRequestEvent $event) { - global $config, $database, $page, $user; + global $database, $page; if($event->page_matches("post/list")) { if(isset($_GET['search'])) { $search = url_escape(Tag::implode(Tag::resolve_aliases(Tag::explode($_GET['search'], false)))); diff --git a/ext/index/script.js b/ext/index/script.js index 7fd63d6a..e1499c74 100644 --- a/ext/index/script.js +++ b/ext/index/script.js @@ -3,7 +3,7 @@ $(function() { var blocked_tags = ($.cookie("ui-blocked-tags") || "").split(" "); var needs_refresh = false; - for(i=0; ipage_matches("ip_ban")) { - global $config, $database, $page, $user; + global $page, $user; if($user->can("ban_ip")) { if($event->get_arg(0) == "add" && $user->check_auth_token()) { if(isset($_POST['ip']) && isset($_POST['reason']) && isset($_POST['end'])) { diff --git a/ext/log_logstash/main.php b/ext/log_logstash/main.php index fbbff556..43517add 100644 --- a/ext/log_logstash/main.php +++ b/ext/log_logstash/main.php @@ -53,4 +53,3 @@ class LogLogstash extends Extension { } } } -?> diff --git a/ext/notes/main.php b/ext/notes/main.php index f2ea535f..6a66996e 100644 --- a/ext/notes/main.php +++ b/ext/notes/main.php @@ -220,7 +220,6 @@ class Notes extends Extension { $event->add_querylet(new Querylet("images.id IN (SELECT id FROM images WHERE notes $cmp $notes)")); } else if(preg_match("/^notes_by[=|:](.*)$/i", $event->term, $matches)) { - global $database; $user = User::by_name($matches[1]); if(!is_null($user)) { $user_id = $user->id; @@ -323,7 +322,7 @@ class Notes extends Extension { $noteY1 = int_escape($_POST["note_y1"]); $noteHeight = int_escape($_POST["note_height"]); $noteWidth = int_escape($_POST["note_width"]); - $noteText = mysql_real_escape_string(html_escape($_POST["note_text"])); + $noteText = sql_escape(html_escape($_POST["note_text"])); // validate parameters if (is_null($imageID) || !is_numeric($imageID) || diff --git a/ext/numeric_score/main.php b/ext/numeric_score/main.php index c98fde08..5954afd5 100644 --- a/ext/numeric_score/main.php +++ b/ext/numeric_score/main.php @@ -29,14 +29,14 @@ class NumericScore extends Extension { } public function onDisplayingImage(DisplayingImageEvent $event) { - global $user, $page; + global $user; if(!$user->is_anonymous()) { $this->theme->get_voter($event->image); } } public function onUserPageBuilding(UserPageBuildingEvent $event) { - global $page, $user; + global $user; if($user->can("edit_other_vote")) { $this->theme->get_nuller($event->display_user); } diff --git a/ext/oekaki/main.php b/ext/oekaki/main.php index 0894dd2c..bf4c804d 100644 --- a/ext/oekaki/main.php +++ b/ext/oekaki/main.php @@ -54,7 +54,7 @@ class Oekaki extends Extension { header('Content-type: text/plain'); $file = $_FILES['picture']['name']; - $ext = (strpos($file, '.') === FALSE) ? '' : substr($file, strrpos($file, '.')); + //$ext = (strpos($file, '.') === FALSE) ? '' : substr($file, strrpos($file, '.')); $uploadname = $_SERVER['REMOTE_ADDR'] . "." . time(); $uploadfile = data_path('oekaki_unclaimed/'.$uploadname); diff --git a/ext/ouroboros_api/main.php b/ext/ouroboros_api/main.php index 3ad5dbaa..674b3da8 100644 --- a/ext/ouroboros_api/main.php +++ b/ext/ouroboros_api/main.php @@ -399,7 +399,7 @@ class OuroborosAPI extends Extension public function onPageRequest(PageRequestEvent $event) { - global $database, $page, $config, $user; + global $page, $user; if (preg_match("%\.(xml|json)$%", implode('/', $event->args), $matches) === 1) { $this->event = $event; @@ -489,7 +489,7 @@ class OuroborosAPI extends Extension */ protected function postCreate(OuroborosPost $post, $md5 = '') { - global $page, $config, $user; + global $config; $handler = $config->get_string("upload_collision_handler"); if (!empty($md5) && !($handler == 'merge')) { $img = Image::by_hash($md5); diff --git a/ext/pools/theme.php b/ext/pools/theme.php index 2decb2df..b0e07866 100644 --- a/ext/pools/theme.php +++ b/ext/pools/theme.php @@ -61,7 +61,6 @@ class PoolsTheme extends Themelet { * @param int $totalPages */ public function list_pools(Page $page, /*array*/ $pools, /*int*/ $pageNumber, /*int*/ $totalPages) { - global $user; $html = ' @@ -168,7 +167,7 @@ class PoolsTheme extends Themelet { * @param int $totalPages */ public function view_pool(/*array*/ $pools, /*array*/ $images, /*int*/ $pageNumber, /*int*/ $totalPages) { - global $user, $page; + global $page; $this->display_top($pools, "Pool: ".html_escape($pools[0]['title'])); @@ -294,8 +293,6 @@ class PoolsTheme extends Themelet { * @param array $images */ public function edit_order(Page $page, /*array*/ $pools, /*array*/ $images) { - global $user; - $this->display_top($pools, "Sorting Pool"); $pool_images = "\n"; @@ -329,8 +326,6 @@ class PoolsTheme extends Themelet { * @param array $images */ public function edit_pool(Page $page, /*array*/ $pools, /*array*/ $images) { - global $user; - /* EDIT POOL DESCRIPTION */ $desc_html = " ".make_form(make_link("pool/edit_description"))." diff --git a/ext/random_image/main.php b/ext/random_image/main.php index f2ed58a7..f8b18e80 100644 --- a/ext/random_image/main.php +++ b/ext/random_image/main.php @@ -25,7 +25,6 @@ class RandomImage extends Extension { global $page; if($event->page_matches("random_image")) { - $action = ''; if($event->count_args() == 1) { $action = $event->get_arg(0); $search_terms = array(); diff --git a/ext/report_image/main.php b/ext/report_image/main.php index 25f04b4a..ee6a84ae 100644 --- a/ext/report_image/main.php +++ b/ext/report_image/main.php @@ -108,14 +108,14 @@ class ReportImage extends Extension { } public function onUserPageBuilding(UserPageBuildingEvent $event) { - global $page, $user; + global $user; if($user->can("view_image_report")) { $this->theme->get_nuller($event->display_user); } } public function onDisplayingImage(DisplayingImageEvent $event) { - global $user, $page; + global $user; if($user->can('create_image_report')) { $reps = $this->get_reporters($event->image); $this->theme->display_image_banner($event->image, $reps); diff --git a/ext/resize/main.php b/ext/resize/main.php index 6e1c1cb1..acfa14b0 100644 --- a/ext/resize/main.php +++ b/ext/resize/main.php @@ -164,7 +164,7 @@ class ResizeImage extends Extension { * @throws ImageResizeException */ private function resize_image(Image $image_obj, /*int*/ $width, /*int*/ $height) { - global $config, $user, $page, $database; + global $database; if ( ($height <= 0) && ($width <= 0) ) { throw new ImageResizeException("Invalid options for height and width. ($width x $height)"); diff --git a/ext/resize/theme.php b/ext/resize/theme.php index 3d09e1f0..cad3b85c 100644 --- a/ext/resize/theme.php +++ b/ext/resize/theme.php @@ -5,7 +5,7 @@ class ResizeImageTheme extends Themelet { * Display a link to resize an image */ public function get_resize_html(Image $image) { - global $user, $config; + global $config; $default_width = $config->get_int('resize_default_width'); $default_height = $config->get_int('resize_default_height'); diff --git a/ext/rotate/main.php b/ext/rotate/main.php index ae5b6a48..94793dd4 100644 --- a/ext/rotate/main.php +++ b/ext/rotate/main.php @@ -114,7 +114,7 @@ class RotateImage extends Extension { * @throws ImageRotateException */ private function rotate_image(/*int*/ $image_id, /*int*/ $deg) { - global $config, $user, $page, $database; + global $database; if ( ($deg <= -360) || ($deg >= 360) ) { throw new ImageRotateException("Invalid options for rotation angle. ($deg)"); diff --git a/ext/setup/main.php b/ext/setup/main.php index cf2f9fdc..e069b6dd 100644 --- a/ext/setup/main.php +++ b/ext/setup/main.php @@ -279,7 +279,7 @@ class Setup extends Extension { out_span.innerHTML = '(testing...)'; $(document).ready(function() { - http_request = getHTTPObject(); + var http_request = getHTTPObject(); http_request.open('GET', '$test_url', false); http_request.send(null); diff --git a/ext/setup/theme.php b/ext/setup/theme.php index 99fa314a..6a563890 100644 --- a/ext/setup/theme.php +++ b/ext/setup/theme.php @@ -13,8 +13,6 @@ class SetupTheme extends Themelet { * The page should wrap all the options in a form which links to setup_save */ public function display_page(Page $page, SetupPanel $panel) { - global $user; - usort($panel->blocks, "blockcmp"); /* @@ -40,8 +38,6 @@ class SetupTheme extends Themelet { } public function display_advanced(Page $page, $options) { - global $user; - $h_rows = ""; ksort($options); foreach($options as $name => $value) { diff --git a/ext/source_history/main.php b/ext/source_history/main.php index 3c446b18..12d7af55 100644 --- a/ext/source_history/main.php +++ b/ext/source_history/main.php @@ -24,7 +24,7 @@ class Source_History extends Extension { } public function onPageRequest(PageRequestEvent $event) { - global $config, $page, $user; + global $page, $user; if($event->page_matches("source_history/revert")) { // this is a request to revert to a previous version of the source diff --git a/ext/statsd/main.php b/ext/statsd/main.php index 1cec97af..2cb3500a 100644 --- a/ext/statsd/main.php +++ b/ext/statsd/main.php @@ -19,7 +19,7 @@ class StatsDInterface extends Extension { public static $stats = array(); private function _stats($type) { - global $config, $_shm_event_count, $database, $_shm_load_start; + global $_shm_event_count, $database, $_shm_load_start; $time = microtime(true) - $_shm_load_start; StatsDInterface::$stats["shimmie.$type.hits"] = "1|c"; StatsDInterface::$stats["shimmie.$type.time"] = "$time|ms"; diff --git a/ext/tag_categories/main.php b/ext/tag_categories/main.php index 1ab52af1..e1dca36e 100644 --- a/ext/tag_categories/main.php +++ b/ext/tag_categories/main.php @@ -47,7 +47,7 @@ class TagCategories extends Extension { } public function onPageRequest(PageRequestEvent $event) { - global $page, $database, $user; + global $page, $user; if($event->page_matches("tags/categories")) { if($user->is_admin()) { diff --git a/ext/tag_categories/theme.php b/ext/tag_categories/theme.php index e40b3dfa..52c192cd 100644 --- a/ext/tag_categories/theme.php +++ b/ext/tag_categories/theme.php @@ -100,4 +100,3 @@ class TagCategoriesTheme extends Themelet { $page->add_block(new Block("Editing", $html, "main", 10)); } } -?> \ No newline at end of file diff --git a/ext/tag_list/theme.php b/ext/tag_list/theme.php index 7e210f24..db9bf4af 100644 --- a/ext/tag_list/theme.php +++ b/ext/tag_list/theme.php @@ -115,7 +115,7 @@ class TagListTheme extends Themelet { foreach($tag_infos as $row) { $split = $this->return_tag($row, $tag_category_dict); - $category = $split[0]; + //$category = $split[0]; $tag_html = $split[1]; $main_html .= $tag_html . '
'; } @@ -151,7 +151,7 @@ class TagListTheme extends Themelet { foreach($tag_infos as $row) { $split = self::return_tag($row, $tag_category_dict); - $category = $split[0]; + //$category = $split[0]; $tag_html = $split[1]; $main_html .= $tag_html . '
'; } @@ -183,7 +183,7 @@ class TagListTheme extends Themelet { foreach($tag_infos as $row) { $split = self::return_tag($row, $tag_category_dict); - $category = $split[0]; + //$category = $split[0]; $tag_html = $split[1]; $main_html .= $tag_html . '
'; } diff --git a/ext/tagger/main.php b/ext/tagger/main.php index 553a8fc6..04725f60 100644 --- a/ext/tagger/main.php +++ b/ext/tagger/main.php @@ -8,7 +8,7 @@ class Tagger extends Extension { public function onDisplayingImage(DisplayingImageEvent $event) { - global $page, $config, $user; + global $page, $user; if($user->can("edit_image_tag") && ($event->image->is_locked() || $user->can("edit_image_lock"))) { $this->theme->build_tagger($page,$event); @@ -58,7 +58,7 @@ class TaggerXML extends Extension { } private function match_tag_list ($s) { - global $database, $config, $event; + global $database, $config; $max_rows = $config->get_int("ext_tagger_tag_max",30); $limit_rows = $config->get_int("ext_tagger_limit",30); @@ -67,7 +67,7 @@ class TaggerXML extends Extension { // Match $p = strlen($s) == 1? " ":"\_"; - $sq = "%".$p.mysql_real_escape_string($s)."%"; + $sq = "%".$p.sql_escape($s)."%"; $match = "concat(?,tag) LIKE ?"; array_push($values,$p,$sq); // Exclude diff --git a/ext/tagger/theme.php b/ext/tagger/theme.php index 27ac184a..5b446382 100644 --- a/ext/tagger/theme.php +++ b/ext/tagger/theme.php @@ -7,7 +7,6 @@ class taggerTheme extends Themelet { public function build_tagger (Page $page, $event) { - global $config; // Initialization code $base_href = get_base_href(); // TODO: AJAX test and fallback. diff --git a/ext/tips/theme.php b/ext/tips/theme.php index 2aa3ef51..d724ca7c 100644 --- a/ext/tips/theme.php +++ b/ext/tips/theme.php @@ -1,7 +1,7 @@ "; foreach($images as $image){ diff --git a/ext/update/main.php b/ext/update/main.php index aed17253..e1a5c11f 100644 --- a/ext/update/main.php +++ b/ext/update/main.php @@ -28,7 +28,7 @@ class Update extends Extension { } public function onPageRequest(PageRequestEvent $event) { - global $config, $user, $page; + global $user, $page; if($user->is_admin() && isset($_GET['sha'])){ if($event->page_matches("update/download")){ $ok = $this->download_shimmie(); @@ -77,7 +77,7 @@ class Update extends Extension { * @return bool */ private function update_shimmie() { - global $config, $page; + global $config; $commitSHA = $_GET['sha']; diff --git a/ext/upload/main.php b/ext/upload/main.php index 9e8fb062..3a0a7ce5 100644 --- a/ext/upload/main.php +++ b/ext/upload/main.php @@ -292,7 +292,7 @@ class Upload extends Extension { * @return bool TRUE on upload successful. */ private function try_upload($file, $tags, $source, $replace='') { - global $page, $config, $user; + global $page; if(empty($source)) $source = null; diff --git a/ext/upload/theme.php b/ext/upload/theme.php index 8195723a..76c6e438 100644 --- a/ext/upload/theme.php +++ b/ext/upload/theme.php @@ -268,7 +268,7 @@ class UploadTheme extends Themelet { $max_kb = to_shorthand_int($max_size); $image = Image::by_id($image_id); - $thumbnail = $this->build_thumb_html($image, null); + $thumbnail = $this->build_thumb_html($image); $html = "

Replacing Image ID ".$image_id."
Please note: You will have to refresh the image page, or empty your browser cache.

" diff --git a/ext/user/main.php b/ext/user/main.php index 30862d48..53981d60 100644 --- a/ext/user/main.php +++ b/ext/user/main.php @@ -433,11 +433,9 @@ class UserPage extends Extension { */ private function check_user_creation(UserCreationEvent $event) { - global $database; - $name = $event->username; - $pass = $event->password; - $email = $event->email; + //$pass = $event->password; + //$email = $event->email; if(strlen($name) < 1) { throw new UserCreationException("Username must be at least 1 character"); diff --git a/ext/user/theme.php b/ext/user/theme.php index 911500de..ef3b7809 100644 --- a/ext/user/theme.php +++ b/ext/user/theme.php @@ -161,7 +161,7 @@ class UserPageTheme extends Themelet { } protected function build_options(User $duser) { - global $config, $database, $user; + global $config, $user; $html = ""; if($duser->id != $config->get_int('anon_id')){ //justa fool-admin protection so they dont mess around with anon users. diff --git a/ext/view/theme.php b/ext/view/theme.php index 7df95215..68e6affe 100644 --- a/ext/view/theme.php +++ b/ext/view/theme.php @@ -29,8 +29,6 @@ class ViewImageTheme extends Themelet { protected function build_pin(Image $image) { - global $database; - if(isset($_GET['search'])) { $search_terms = explode(' ', $_GET['search']); $query = "search=".url_escape($_GET['search']); diff --git a/ext/wiki/main.php b/ext/wiki/main.php index 7f19bd0e..836f70aa 100644 --- a/ext/wiki/main.php +++ b/ext/wiki/main.php @@ -106,7 +106,7 @@ class Wiki extends Extension { } public function onPageRequest(PageRequestEvent $event) { - global $config, $page, $user; + global $page, $user; if($event->page_matches("wiki")) { if(is_null($event->get_arg(0)) || strlen(trim($event->get_arg(0))) === 0) { $title = "Index"; diff --git a/themes/danbooru/themelet.class.php b/themes/danbooru/themelet.class.php index ff6b5cd4..c8026b5d 100644 --- a/themes/danbooru/themelet.class.php +++ b/themes/danbooru/themelet.class.php @@ -6,6 +6,7 @@ class Themelet extends BaseThemelet { * @param string $query * @param int $page_number * @param int $total_pages + * @param bool $show_random */ public function display_paginator(Page $page, $base, $query, $page_number, $total_pages, $show_random = FALSE) { if($total_pages == 0) $total_pages = 1; diff --git a/themes/danbooru2/admin.theme.php b/themes/danbooru2/admin.theme.php index 2007705d..b46694de 100644 --- a/themes/danbooru2/admin.theme.php +++ b/themes/danbooru2/admin.theme.php @@ -4,7 +4,7 @@ class CustomAdminPageTheme extends AdminPageTheme { public function display_page() { global $page; $page->disable_left(); - parent::display_page($page); + parent::display_page(); } } diff --git a/themes/danbooru2/themelet.class.php b/themes/danbooru2/themelet.class.php index ff6b5cd4..c8026b5d 100644 --- a/themes/danbooru2/themelet.class.php +++ b/themes/danbooru2/themelet.class.php @@ -6,6 +6,7 @@ class Themelet extends BaseThemelet { * @param string $query * @param int $page_number * @param int $total_pages + * @param bool $show_random */ public function display_paginator(Page $page, $base, $query, $page_number, $total_pages, $show_random = FALSE) { if($total_pages == 0) $total_pages = 1; diff --git a/themes/default/layout.class.php b/themes/default/layout.class.php index 979cf9d3..e4bf2de2 100644 --- a/themes/default/layout.class.php +++ b/themes/default/layout.class.php @@ -5,12 +5,14 @@ class Layout { /** * turns the Page into HTML + * + * @param Page $page */ public function display_page(Page $page) { global $config; - $theme_name = $config->get_string('theme', 'default'); - $data_href = get_base_href(); + //$theme_name = $config->get_string('theme', 'default'); + //$data_href = get_base_href(); $contact_link = $config->get_string('contact_link'); $header_html = ""; diff --git a/themes/futaba/themelet.class.php b/themes/futaba/themelet.class.php index 6681ef43..b4add7d3 100644 --- a/themes/futaba/themelet.class.php +++ b/themes/futaba/themelet.class.php @@ -9,7 +9,7 @@ class Themelet extends BaseThemelet { * @param string $query * @param int $page_number * @param int $total_pages - * @param int $position + * @param bool $show_random */ public function display_paginator(Page $page, $base, $query, $page_number, $total_pages, $show_random = FALSE) { if($total_pages == 0) $total_pages = 1; diff --git a/themes/lite/themelet.class.php b/themes/lite/themelet.class.php index 6182b0bb..862cc563 100644 --- a/themes/lite/themelet.class.php +++ b/themes/lite/themelet.class.php @@ -27,6 +27,7 @@ class Themelet extends BaseThemelet { * @param string $query * @param int $page_number * @param int $total_pages + * @param bool $show_random */ public function display_paginator(Page $page, $base, $query, $page_number, $total_pages, $show_random = FALSE) { if($total_pages == 0) $total_pages = 1; @@ -69,6 +70,7 @@ class Themelet extends BaseThemelet { * @param int $total_pages * @param string $base_url * @param string $query + * @param bool $show_random * @return string */ public function litetheme_build_paginator($current_page, $total_pages, $base_url, $query, $show_random) { diff --git a/themes/warm/layout.class.php b/themes/warm/layout.class.php index d06313a7..79a980f7 100644 --- a/themes/warm/layout.class.php +++ b/themes/warm/layout.class.php @@ -5,6 +5,8 @@ class Layout { /** * turns the Page into HTML + * + * @param Page $page */ public function display_page(Page $page) { global $config;