diff --git a/ext/alias_editor/main.php b/ext/alias_editor/main.php index 133de0b4..9232b8c0 100644 --- a/ext/alias_editor/main.php +++ b/ext/alias_editor/main.php @@ -106,7 +106,7 @@ class AliasEditor extends Extension if (count($_FILES) > 0) { $tmp = $_FILES['alias_file']['tmp_name']; $contents = file_get_contents($tmp); - $this->add_alias_csv($database, $contents); + $this->add_alias_csv($contents); log_info("alias_editor", "Imported aliases from file", "Imported aliases"); # FIXME: how many? $page->set_mode(PageMode::REDIRECT); $page->set_redirect(make_link("alias/list")); @@ -179,7 +179,7 @@ class AliasEditor extends Extension return $csv; } - private function add_alias_csv(Database $database, string $csv): int + private function add_alias_csv(string $csv): int { $csv = str_replace("\r", "\n", $csv); $i = 0; diff --git a/ext/artists/main.php b/ext/artists/main.php index 5884ae34..7f03941c 100644 --- a/ext/artists/main.php +++ b/ext/artists/main.php @@ -166,7 +166,7 @@ class Artists extends Extension //*************ARTIST SECTION************** case "list": { - $this->get_listing($page, $event); + $this->get_listing($event); $this->theme->sidebar_options("neutral"); break; } @@ -847,7 +847,7 @@ class Artists extends Extension /* * HERE WE GET THE LIST OF ALL ARTIST WITH PAGINATION */ - private function get_listing(Page $page, PageRequestEvent $event) + private function get_listing(PageRequestEvent $event) { global $config, $database; diff --git a/ext/auto_tagger/main.php b/ext/auto_tagger/main.php index bd73a23d..a4abf1d3 100644 --- a/ext/auto_tagger/main.php +++ b/ext/auto_tagger/main.php @@ -112,7 +112,7 @@ class AutoTagger extends Extension if (count($_FILES) > 0) { $tmp = $_FILES['auto_tag_file']['tmp_name']; $contents = file_get_contents($tmp); - $count = $this->add_auto_tag_csv($database, $contents); + $count = $this->add_auto_tag_csv($contents); log_info(AutoTaggerInfo::KEY, "Imported $count auto-tag definitions from file from file", "Imported $count auto-tag definitions"); $page->set_mode(PageMode::REDIRECT); $page->set_redirect(make_link("auto_tag/list")); @@ -191,7 +191,7 @@ class AutoTagger extends Extension return $csv; } - private function add_auto_tag_csv(Database $database, string $csv): int + private function add_auto_tag_csv(string $csv): int { $csv = str_replace("\r", "\n", $csv); $i = 0; @@ -250,37 +250,6 @@ class AutoTagger extends Extension $this->apply_new_auto_tag($tag); } - private function update_auto_tag(string $tag, string $additional_tags): bool - { - global $database; - $result = $database->get_row("SELECT * FROM auto_tag WHERE LOWER(tag)=LOWER(:tag)", ["tag"=>$tag]); - - if ($result===null) { - throw new AutoTaggerException("Auto-tag not set for $tag, can't update"); - } else { - $additional_tags = Tag::explode($additional_tags); - $current_additional_tags = Tag::explode($result["additional_tags"]); - - if (!Tag::compare($additional_tags, $current_additional_tags)) { - $database->execute( - "UPDATE auto_tag SET additional_tags = :additional_tags WHERE LOWER(tag)=LOWER(:tag)", - ["tag"=>$tag, "additional_tags"=>Tag::implode($additional_tags)] - ); - - log_info( - AutoTaggerInfo::KEY, - "Updated auto-tag for {$tag} -> {".implode(" ", $additional_tags)."}", - "Updated Auto-Tag" - ); - - // Now we apply it to existing items - $this->apply_new_auto_tag($tag); - return true; - } - } - return false; - } - private function apply_new_auto_tag(string $tag) { global $database; @@ -296,8 +265,6 @@ class AutoTagger extends Extension } } - - private function remove_auto_tag(String $tag) { global $database; diff --git a/ext/biography/theme.php b/ext/biography/theme.php index 2aa65b34..f555e932 100644 --- a/ext/biography/theme.php +++ b/ext/biography/theme.php @@ -15,16 +15,12 @@ class BiographyTheme extends Themelet public function display_composer(Page $page, string $bio) { - global $user; - $post_url = make_link("biography"); - $auth = $user->get_auth_html(); - $html = SHM_SIMPLE_FORM( - $post_url, + make_link("biography"), TEXTAREA(["style"=>"width: 100%", "rows"=>"6", "name"=>"biography"], $bio), SHM_SUBMIT("Save") ); - $page->add_block(new Block("About Me", (string)$html, "main", 30)); + $page->add_block(new Block("About Me", $html, "main", 30)); } } diff --git a/ext/cron_uploader/main.php b/ext/cron_uploader/main.php index 195dda85..36defedf 100644 --- a/ext/cron_uploader/main.php +++ b/ext/cron_uploader/main.php @@ -353,7 +353,7 @@ class CronUploader extends Extension //set_time_limit(0); $output_subdir = date('Ymd-His', time()); - $image_queue = $this->generate_image_queue($user_config->get_string(CronUploaderConfig::DIR)); + $image_queue = $this->generate_image_queue(); // Randomize Images //shuffle($this->image_queue); @@ -502,18 +502,6 @@ class CronUploader extends Extension private const PARTIAL_DOWNLOAD_EXTENSIONS = ['crdownload','part']; private const SKIPPABLE_FILES = ['.ds_store','thumbs.db']; - private const SKIPPABLE_DIRECTORIES = ['__macosx']; - - private function is_skippable_dir(string $path): bool - { - $info = pathinfo($path); - - if (array_key_exists("basename", $info) && in_array(strtolower($info['basename']), self::SKIPPABLE_DIRECTORIES)) { - return true; - } - - return false; - } private function is_skippable_file(string $path): bool { @@ -530,7 +518,7 @@ class CronUploader extends Extension return false; } - private function generate_image_queue(string $root_dir, ?int $limit = null): \Generator + private function generate_image_queue(): \Generator { $base = $this->get_queue_dir(); diff --git a/ext/cron_uploader/theme.php b/ext/cron_uploader/theme.php index 6ba6f395..64b43c7c 100644 --- a/ext/cron_uploader/theme.php +++ b/ext/cron_uploader/theme.php @@ -125,7 +125,7 @@ class CronUploaderTheme extends Themelet } } - public function get_user_options(string $dir, bool $stop_on_error, int $log_level, bool $all_logs): string + public function get_user_options(): string { $form = SHM_SIMPLE_FORM( "user_admin/cron_uploader", diff --git a/ext/forum/main.php b/ext/forum/main.php index 3e5914ee..443af4ac 100644 --- a/ext/forum/main.php +++ b/ext/forum/main.php @@ -354,23 +354,6 @@ class Forum extends Extension $database->execute("UPDATE forum_threads SET uptodate=now() WHERE id=:id", ['id'=>$threadID]); } - private function retrieve_posts(int $threadID, int $pageNumber): array - { - global $database, $config; - $postsPerPage = $config->get_int('forumPostsPerPage', 15); - - return $database->get_all( - "SELECT p.id, p.date, p.message, u.name as user_name, u.email AS user_email, u.class AS user_class ". - "FROM forum_posts AS p ". - "INNER JOIN users AS u ". - "ON p.user_id = u.id ". - "WHERE thread_id = :thread_id ". - "ORDER BY p.date ASC ". - "LIMIT :limit OFFSET :offset ", - ["thread_id"=>$threadID, "offset"=>($pageNumber - 1) * $postsPerPage, "limit"=>$postsPerPage] - ); - } - private function delete_thread(int $threadID): void { global $database; diff --git a/ext/index/test.php b/ext/index/test.php index 84f1ab9f..6f21fa62 100644 --- a/ext/index/test.php +++ b/ext/index/test.php @@ -82,7 +82,7 @@ class IndexTest extends ShimmiePHPUnitTestCase /** @depends testUpload */ public function testTagSearchNoResults($image_ids) { - $image_ids = $this->testUpload(); + $this->testUpload(); $this->assert_search_results(["maumaumau"], []); } @@ -106,7 +106,7 @@ class IndexTest extends ShimmiePHPUnitTestCase /** @depends testUpload */ public function testMultiTagSearchNoResults($image_ids) { - $image_ids = $this->testUpload(); + $this->testUpload(); # multiple tags, one of which doesn't exist # (test the "one tag doesn't exist = no hits" path) $this->assert_search_results(["computer", "asdfasdfwaffle"], []); @@ -132,7 +132,7 @@ class IndexTest extends ShimmiePHPUnitTestCase /** @depends testUpload */ public function testMetaSearchNoResults($image_ids) { - $image_ids = $this->testUpload(); + $this->testUpload(); $this->assert_search_results(["hash=1234567890"], []); $this->assert_search_results(["ratio=42:12345"], []); } @@ -162,7 +162,7 @@ class IndexTest extends ShimmiePHPUnitTestCase /** @depends testUpload */ public function testWildSearchNoResults($image_ids) { - $image_ids = $this->testUpload(); + $this->testUpload(); $this->assert_search_results(["asdfasdf*"], []); } diff --git a/ext/user/main.php b/ext/user/main.php index 6890104b..72535128 100644 --- a/ext/user/main.php +++ b/ext/user/main.php @@ -560,7 +560,7 @@ class UserPage extends Extension return $new_user; } - private function set_login_cookie(string $name, string $pass): void + private function set_login_cookie(string $name): void { global $config, $page; @@ -639,7 +639,7 @@ class UserPage extends Extension $duser->set_password($pass1); if ($duser->id == $user->id) { - $this->set_login_cookie($duser->name, $pass1); + $this->set_login_cookie($duser->name); } $page->flash("Password changed");