diff --git a/core/event.php b/core/event.php index b000e6eb..472fb9ba 100644 --- a/core/event.php +++ b/core/event.php @@ -116,17 +116,16 @@ class PageRequestEvent extends Event } } - public function try_page_num(int $n): int { - if($this->count_args() > $n) { + public function try_page_num(int $n): int + { + if ($this->count_args() > $n) { $i = $this->get_arg($n); if (!is_numeric($i) || $i <= 0) { return int_escape($i); - } - else { + } else { return 1; } - } - else { + } else { return 1; } } diff --git a/ext/alias_editor/main.php b/ext/alias_editor/main.php index ab0f76bd..74fb02eb 100644 --- a/ext/alias_editor/main.php +++ b/ext/alias_editor/main.php @@ -49,7 +49,7 @@ class AliasEditor extends Extension } } } elseif ($event->get_arg(0) == "list") { - if($event->count_args() == 2) { + if ($event->count_args() == 2) { $page_number = $event->get_arg(1); if (!is_numeric($page_number)) { $page_number = 0; @@ -58,8 +58,7 @@ class AliasEditor extends Extension } else { $page_number--; } - } - else { + } else { $page_number = 0; } diff --git a/ext/arrowkey_navigation/main.php b/ext/arrowkey_navigation/main.php index c7a890df..d370e4a7 100644 --- a/ext/arrowkey_navigation/main.php +++ b/ext/arrowkey_navigation/main.php @@ -54,17 +54,16 @@ class ArrowkeyNavigation extends Extension // get the amount of images per page $images_per_page = $config->get_int(IndexConfig::IMAGES); - if($event->count_args() > 1) { - // if there are tags, use pages with tags + if ($event->count_args() > 1) { + // if there are tags, use pages with tags $prefix = url_escape($event->get_arg(0)) . "/"; $page_number = $event->try_page_num(1); $total_pages = ceil($database->get_one( "SELECT count FROM tags WHERE tag=:tag", ["tag"=>$event->get_arg(0)] ) / $images_per_page); - } - else { - // if there are no tags, use default + } else { + // if there are no tags, use default $prefix = ""; $page_number = $event->try_page_num(0); $total_pages = ceil($database->get_one( diff --git a/ext/comment/main.php b/ext/comment/main.php index d929f642..926409a0 100644 --- a/ext/comment/main.php +++ b/ext/comment/main.php @@ -250,7 +250,7 @@ class CommentList extends Extension private function onPageRequest_beta_search(PageRequestEvent $event) { $search = $event->get_arg(1); - $page_num = $event->try_page_num(2); + $page_num = $event->try_page_num(2); $duser = User::by_name($search); $i_comment_count = Comment::count_comments_by_user($duser); $com_per_page = 50; diff --git a/ext/danbooru_api/main.php b/ext/danbooru_api/main.php index a8ccffab..de3530b4 100644 --- a/ext/danbooru_api/main.php +++ b/ext/danbooru_api/main.php @@ -86,8 +86,8 @@ class DanbooruApi extends Extension foreach ($namelist as $name) { $sqlresult = $database->get_all( $database->scoreql_to_sql( - "SELECT id,tag,count FROM tags WHERE SCORE_STRNORM(tag) = SCORE_STRNORM(?)" - ), + "SELECT id,tag,count FROM tags WHERE SCORE_STRNORM(tag) = SCORE_STRNORM(?)" + ), [$name] ); foreach ($sqlresult as $row) { diff --git a/ext/ext_manager/main.php b/ext/ext_manager/main.php index ddb9e63a..7f06c9a6 100644 --- a/ext/ext_manager/main.php +++ b/ext/ext_manager/main.php @@ -60,14 +60,13 @@ class ExtManager extends Extension } if ($event->page_matches("ext_doc")) { - if($event->count_args() == 1) { + if ($event->count_args() == 1) { $ext = $event->get_arg(0); if (file_exists("ext/$ext/info.php")) { $info = ExtensionInfo::get_by_key($ext); $this->theme->display_doc($page, $info); } - } - else { + } else { $this->theme->display_table($page, $this->get_extensions(false), false); } } diff --git a/ext/forum/main.php b/ext/forum/main.php index 5c5e76e8..28a5b1b9 100644 --- a/ext/forum/main.php +++ b/ext/forum/main.php @@ -248,7 +248,7 @@ class Forum extends Extension $threadsPerPage = $config->get_int('forumThreadsPerPage', 15); $totalPages = ceil($database->get_one("SELECT COUNT(*) FROM forum_threads") / $threadsPerPage); - if($event->count_args() >= 2) { + if ($event->count_args() >= 2) { $pageNumber = $event->get_arg(1); if (!is_numeric($pageNumber)) { $pageNumber = 0; @@ -259,8 +259,7 @@ class Forum extends Extension } else { $pageNumber--; } - } - else { + } else { $pageNumber = 0; } @@ -287,7 +286,7 @@ class Forum extends Extension $totalPages = ceil($database->get_one("SELECT COUNT(*) FROM forum_posts WHERE thread_id = ?", [$threadID]) / $postsPerPage); $threadTitle = $this->get_thread_title($threadID); - if($event->count_args() >= 3) { + if ($event->count_args() >= 3) { $pageNumber = $event->get_arg(2); if (!is_numeric($pageNumber)) { $pageNumber = 0; @@ -298,8 +297,7 @@ class Forum extends Extension } else { $pageNumber--; } - } - else { + } else { $pageNumber = 0; } diff --git a/ext/shimmie_api/main.php b/ext/shimmie_api/main.php index 6cddf2ed..cd706a78 100644 --- a/ext/shimmie_api/main.php +++ b/ext/shimmie_api/main.php @@ -39,13 +39,11 @@ class ShimmieApi extends Extension $page->set_type("text/plain"); if ($event->page_matches("api/shimmie/get_tags")) { - if($event->count_args() > 0) { + if ($event->count_args() > 0) { $tag = $event->get_arg(0); - } - elseif (isset($_GET['tag'])) { + } elseif (isset($_GET['tag'])) { $tag = $_GET['tag']; - } - else { + } else { $tag = null; } $res = $this->api_get_tags($tag); diff --git a/ext/transcode/main.php b/ext/transcode/main.php index 69a034d0..0511b876 100644 --- a/ext/transcode/main.php +++ b/ext/transcode/main.php @@ -128,13 +128,11 @@ class TranscodeImage extends Extension global $page, $user; if ($event->page_matches("transcode") && $user->can(Permissions::EDIT_FILES)) { - if($event->count_args() >= 1) { + if ($event->count_args() >= 1) { $image_id = int_escape($event->get_arg(0)); - } - elseif(isset($_POST['image_id'])) { + } elseif (isset($_POST['image_id'])) { $image_id = int_escape($_POST['image_id']); - } - else { + } else { throw new ImageTranscodeException("Can not resize Image: No valid Image ID given."); } $image_obj = Image::by_id($image_id); diff --git a/ext/trash/main.php b/ext/trash/main.php index c2d43b23..68ce366e 100644 --- a/ext/trash/main.php +++ b/ext/trash/main.php @@ -19,13 +19,11 @@ class Trash extends Extension if ($event->page_matches("trash_restore") && $user->can(Permissions::VIEW_TRASH)) { // Try to get the image ID - if($event->count_args() >= 1) { + if ($event->count_args() >= 1) { $image_id = int_escape($event->get_arg(0)); - } - elseif (isset($_POST['image_id'])) { + } elseif (isset($_POST['image_id'])) { $image_id = $_POST['image_id']; - } - else { + } else { throw new SCoreException("Can not restore image: No valid Image ID given."); } diff --git a/ext/upload/main.php b/ext/upload/main.php index 87a31ab9..afb71d2b 100644 --- a/ext/upload/main.php +++ b/ext/upload/main.php @@ -187,13 +187,11 @@ class Upload extends Extension throw new UploadException("Can not replace Image: disk nearly full"); } // Try to get the image ID - if($event->count_args() >= 1) { + if ($event->count_args() >= 1) { $image_id = int_escape($event->get_arg(0)); - } - elseif(isset($_POST['image_id'])) { + } elseif (isset($_POST['image_id'])) { $image_id = $_POST['image_id']; - } - else { + } else { throw new UploadException("Can not replace Image: No valid Image ID given."); }