From 338a1feb54777ff869ab28faca4b330fb8e10677 Mon Sep 17 00:00:00 2001 From: Spine Date: Sun, 18 Feb 2024 00:35:25 +0000 Subject: [PATCH] apply phpcs PSR2.Methods.FunctionClosingBrace PSR12.Classes.ClassInstantiation --- .phpcs.xml | 6 +- app/API/GenerateInvite.php | 4 +- app/API/Request.php | 2 +- app/API/Torrent.php | 4 +- app/Applicant.php | 2 +- app/ApplicantRole.php | 10 +-- app/Artist.php | 8 +- app/Cache.php | 2 +- app/Collage/AbstractCollage.php | 4 +- app/Collage/TGroup.php | 4 +- app/Collector/Artist.php | 2 +- app/Comment/AbstractComment.php | 2 +- app/Contest/AbstractContest.php | 2 +- app/DB/Mysql.php | 4 +- app/Debug.php | 4 +- app/Donate/Bitcoin.php | 2 +- app/Download.php | 2 +- app/Forum.php | 2 +- app/ForumPost.php | 4 +- app/ForumThread.php | 10 +-- app/Json/News.php | 2 +- app/Json/PM.php | 2 +- app/Json/RipLog.php | 2 +- app/Login.php | 12 +-- app/Manager/Artist.php | 4 +- app/Manager/Bonus.php | 2 +- app/Manager/Collage.php | 2 +- app/Manager/Comment.php | 8 +- app/Manager/DNU.php | 6 +- app/Manager/ForumThread.php | 2 +- app/Manager/Invite.php | 2 +- app/Manager/Payment.php | 2 +- app/Manager/Recovery.php | 6 +- app/Manager/Referral.php | 2 +- app/Manager/Subscription.php | 2 +- app/Manager/TGroup.php | 14 ++-- app/Manager/Torrent.php | 6 +- app/Manager/User.php | 4 +- app/Manager/UserToken.php | 2 +- app/Manager/XBT.php | 2 +- app/Notification/Upload.php | 2 +- app/PM.php | 2 +- app/Request.php | 12 +-- app/Search/Collage.php | 38 ++++----- app/Search/Donation.php | 18 ++--- app/Search/Request.php | 4 +- app/Search/Torrent.php | 4 +- app/SiteInfo.php | 2 +- app/Staff.php | 2 +- app/StaffGroup.php | 2 +- app/TGroup.php | 18 ++--- app/Task/ArtistUsage.php | 2 +- app/Task/BetterTranscode.php | 2 +- app/Task/CalculateContestLeaderboard.php | 4 +- app/Task/CommunityStats.php | 4 +- app/Task/CycleAuthKeys.php | 2 +- app/Task/DemoteUsersRatio.php | 2 +- app/Task/DisableDownloadingRatioWatch.php | 2 +- app/Task/DisableLeechingRatioWatch.php | 2 +- app/Task/DisableUnconfirmedUsers.php | 2 +- app/Task/Donations.php | 2 +- app/Task/ExpireFlTokens.php | 4 +- app/Task/ExpireInvites.php | 2 +- app/Task/InactiveUserDeactivate.php | 2 +- app/Task/InactiveUserWarn.php | 2 +- app/Task/LockOldThreads.php | 2 +- app/Task/Peerupdate.php | 2 +- app/Task/PromoteUsers.php | 2 +- app/Task/RatioRequirements.php | 2 +- app/Task/RatioWatch.php | 2 +- app/Task/Reaper.php | 2 +- app/Task/Recovery.php | 2 +- app/Task/RemoveDeadSessions.php | 2 +- app/Task/ResetReseedRequest.php | 2 +- app/Task/SSLCertificate.php | 2 +- app/Task/TorrentHistory.php | 2 +- app/Task/UpdateDailyTop10.php | 2 +- app/Task/UpdateUserBonusPoints.php | 2 +- app/Task/UpdateWeeklyTop10.php | 2 +- app/Task/UploadNotifier.php | 6 +- app/Task/UserLastAccess.php | 2 +- app/Task/UserStatsDaily.php | 2 +- app/Task/UserStatsMonthly.php | 2 +- app/Task/UserStatsYearly.php | 2 +- app/Torrent.php | 12 +-- app/Torrent/Log.php | 2 +- app/Torrent/Report.php | 2 +- app/TorrentAbstract.php | 2 +- app/Upload.php | 4 +- app/User.php | 8 +- app/User/Activity.php | 2 +- app/User/AutoEnable.php | 4 +- app/User/Bonus.php | 2 +- app/User/Bookmark.php | 6 +- app/User/Donor.php | 2 +- app/User/Inbox.php | 2 +- app/User/Notification/Blog.php | 6 +- app/User/Notification/GlobalNotification.php | 4 +- app/User/Notification/News.php | 8 +- app/User/Quote.php | 8 +- app/User/Subscription.php | 4 +- app/User/Vote.php | 4 +- app/UserCreator.php | 8 +- app/UserRank/Configuration.php | 2 +- app/Util/Irc.php | 2 +- app/Util/IrcText.php | 1 - app/Util/LastFM.php | 2 +- app/Util/Twig.php | 4 +- bin/fix-leech-status.php | 4 +- bin/migrate-logs.php | 4 +- bin/migrate-torrent-files.php | 2 +- bin/rebuild-invite-trees.php | 2 +- bin/recheck-file-storage.php | 6 +- bin/regen-filelists.php | 6 +- ci-coverage.php | 6 +- classes/text.class.php | 14 ++-- classes/users.class.php | 2 +- classes/view.class.php | 20 ++--- gazelle.php | 4 +- lib/bootstrap.php | 2 +- .../migrations/20200905163947_user_delete.php | 6 +- .../20220118231832_add_disable_user_attrs.php | 2 +- public/feeds.php | 10 +-- sections/ajax/add_log.php | 4 +- sections/ajax/announcements.php | 6 +- sections/ajax/artist.php | 8 +- sections/ajax/better/single.php | 2 +- sections/ajax/better/transcode.php | 2 +- sections/ajax/bookmarks/artists.php | 2 +- sections/ajax/bookmarks/torrents.php | 6 +- sections/ajax/browse.php | 10 +-- sections/ajax/collage.php | 6 +- sections/ajax/forum/forum.php | 4 +- sections/ajax/forum/main.php | 4 +- sections/ajax/forum/thread.php | 6 +- sections/ajax/inbox/inbox.php | 2 +- sections/ajax/inbox/viewconv.php | 2 +- sections/ajax/info.php | 8 +- sections/ajax/notifications.php | 2 +- sections/ajax/password_validate.php | 2 +- sections/ajax/post_edit.php | 4 +- sections/ajax/raw_bbcode.php | 2 +- sections/ajax/request.php | 4 +- sections/ajax/requests.php | 6 +- sections/ajax/riplog.php | 2 +- sections/ajax/similar_artists.php | 2 +- sections/ajax/stats.php | 6 +- sections/ajax/stats/torrents.php | 2 +- sections/ajax/stats/users.php | 2 +- sections/ajax/subscriptions.php | 2 +- sections/ajax/tcomments.php | 2 +- sections/ajax/top10/tags.php | 2 +- sections/ajax/top10/torrents.php | 2 +- sections/ajax/top10/users.php | 4 +- sections/ajax/torrent.php | 6 +- sections/ajax/torrent_remove_cover_art.php | 4 +- sections/ajax/torrent_tag_add.php | 6 +- sections/ajax/torrent_tag_remove.php | 6 +- sections/ajax/torrentgroup.php | 4 +- sections/ajax/torrentgroupalbumart.php | 2 +- sections/ajax/upload.php | 4 +- sections/ajax/user.php | 2 +- sections/ajax/user_recents.php | 4 +- sections/ajax/userhistory/post_history.php | 4 +- sections/ajax/usersearch.php | 2 +- sections/ajax/wiki.php | 4 +- sections/api/index.php | 4 +- sections/apply/admin.php | 2 +- sections/apply/apply.php | 4 +- sections/apply/edit.php | 4 +- sections/apply/view.php | 2 +- sections/artist/add_alias.php | 6 +- sections/artist/add_similar.php | 4 +- sections/artist/artist.php | 12 +-- sections/artist/change_artistid.php | 12 +-- sections/artist/delete.php | 8 +- sections/artist/delete_alias.php | 6 +- sections/artist/delete_similar.php | 4 +- sections/artist/download.php | 4 +- sections/artist/edit.php | 2 +- sections/artist/edit_handle.php | 2 +- sections/artist/edit_request.php | 2 +- sections/artist/edit_request_handle.php | 4 +- sections/artist/history.php | 2 +- sections/artist/notify.php | 2 +- sections/artist/notify_remove.php | 2 +- sections/artist/rename.php | 8 +- sections/artist/vote_similar.php | 2 +- sections/better/better.php | 20 ++--- sections/better/transcode.php | 4 +- sections/blog/blog_page.php | 4 +- sections/blog/dead_thread.php | 2 +- sections/blog/delete_blog.php | 2 +- sections/blog/edit_blog_handle.php | 4 +- sections/blog/new_blog_handle.php | 6 +- sections/bonus/bprates.php | 2 +- sections/bonus/history.php | 2 +- sections/bonus/index.php | 2 +- sections/bonus/store.php | 2 +- sections/bonus/token_other.php | 2 +- sections/bookmarks/add.php | 2 +- sections/bookmarks/artists.php | 2 +- sections/bookmarks/edit_torrents.php | 4 +- sections/bookmarks/torrents.php | 10 +-- sections/chat/webirc.php | 2 +- sections/collages/add_artist.php | 4 +- sections/collages/add_torrent.php | 4 +- sections/collages/ajax_add.php | 6 +- sections/collages/all_comments.php | 4 +- sections/collages/autocomplete.php | 2 +- sections/collages/browse.php | 8 +- sections/collages/collage.php | 2 +- sections/collages/collage_artists.php | 2 +- sections/collages/collage_torrent.php | 8 +- sections/collages/delete_handle.php | 6 +- sections/collages/download.php | 4 +- sections/collages/edit.php | 4 +- sections/collages/edit_handle.php | 8 +- sections/collages/manage.php | 4 +- sections/collages/manage_artists.php | 2 +- sections/collages/manage_artists_handle.php | 2 +- sections/collages/manage_handle.php | 4 +- sections/collages/new_handle.php | 8 +- sections/collages/recover.php | 4 +- sections/comments/comments.php | 8 +- sections/comments/delete_handle.php | 2 +- sections/comments/edit_handle.php | 4 +- sections/comments/get.php | 2 +- sections/comments/jump.php | 2 +- sections/comments/post_handle.php | 2 +- sections/comments/warn.php | 2 +- sections/comments/warn_handle.php | 2 +- sections/contest/admin.php | 4 +- sections/contest/index.php | 2 +- sections/donate/index.php | 4 +- sections/enable/index.php | 2 +- sections/forums/add_poll_option.php | 2 +- sections/forums/autosub.php | 2 +- sections/forums/catchup.php | 2 +- sections/forums/change_vote.php | 2 +- sections/forums/delete.php | 2 +- sections/forums/delete_poll_option.php | 2 +- sections/forums/do_warn.php | 2 +- sections/forums/edit_handle.php | 4 +- sections/forums/forum.php | 2 +- sections/forums/get_post.php | 2 +- sections/forums/mod_thread.php | 6 +- sections/forums/new_thread_handle.php | 8 +- sections/forums/newthread.php | 2 +- sections/forums/poll_mod.php | 2 +- sections/forums/poll_vote.php | 4 +- sections/forums/reply_handle.php | 6 +- sections/forums/search.php | 2 +- sections/forums/sticky_post.php | 2 +- sections/forums/thread.php | 12 +-- sections/forums/topic_notes_handle.php | 2 +- sections/forums/warn.php | 4 +- sections/forums/warn_handle.php | 2 +- sections/friends/friends.php | 2 +- sections/inbox/compose.php | 2 +- sections/inbox/compose_handle.php | 6 +- sections/inbox/conversation.php | 2 +- sections/inbox/forward.php | 2 +- sections/index/private.php | 28 +++---- sections/index/public.php | 2 +- sections/log/index.php | 2 +- sections/logchecker/update.php | 2 +- sections/logchecker/upload.php | 2 +- sections/logchecker/upload_handle.php | 6 +- sections/login/disabled.php | 4 +- sections/login/login.php | 4 +- sections/login/recover_step1.php | 6 +- sections/login/recover_step2.php | 4 +- sections/random/index.php | 6 +- sections/recovery/admin.php | 2 +- sections/recovery/browse.php | 2 +- sections/recovery/pair.php | 4 +- sections/recovery/view.php | 2 +- sections/referral/index.php | 2 +- sections/register/index.php | 16 ++-- sections/reports/ajax_add_notes.php | 2 +- sections/reports/ajax_claim_report.php | 2 +- sections/reports/ajax_resolve_report.php | 2 +- sections/reports/ajax_unclaim_report.php | 2 +- sections/reports/compose.php | 14 ++-- sections/reports/compose_handle.php | 2 +- sections/reports/report.php | 16 ++-- sections/reports/report_handle.php | 6 +- sections/reports/reports.php | 14 ++-- sections/reports/resolve_handle.php | 2 +- sections/reports/stats.php | 2 +- sections/reportsv2/ajax_change_resolve.php | 2 +- sections/reportsv2/ajax_claim.php | 2 +- sections/reportsv2/ajax_new_report.php | 8 +- sections/reportsv2/ajax_report.php | 2 +- sections/reportsv2/ajax_switch.php | 4 +- sections/reportsv2/ajax_take_pm.php | 6 +- sections/reportsv2/ajax_unclaim.php | 2 +- sections/reportsv2/ajax_update_comment.php | 2 +- sections/reportsv2/ajax_update_resolve.php | 4 +- sections/reportsv2/report.php | 8 +- sections/reportsv2/report_handle.php | 6 +- sections/reportsv2/resolve_handle.php | 10 +-- sections/reportsv2/search.php | 6 +- sections/reportsv2/static.php | 12 +-- sections/reportsv2/views.php | 6 +- sections/requests/bounty_handle.php | 4 +- sections/requests/delete_handle.php | 6 +- sections/requests/edit.php | 8 +- sections/requests/edit_bounty.php | 2 +- sections/requests/edit_handle.php | 12 +-- sections/requests/interim.php | 2 +- sections/requests/new.php | 8 +- sections/requests/new_handle.php | 16 ++-- sections/requests/request.php | 4 +- sections/requests/requests.php | 6 +- sections/requests/take_fill.php | 6 +- sections/requests/unfill_handle.php | 4 +- sections/requests/vote_handle.php | 2 +- sections/rules/index.php | 2 +- sections/staff/index.php | 2 +- sections/staffblog/index.php | 2 +- sections/staffpm/ajax_delete_response.php | 2 +- sections/staffpm/ajax_edit_response.php | 2 +- sections/staffpm/ajax_get_response.php | 2 +- sections/staffpm/assign.php | 6 +- sections/staffpm/common_responses.php | 2 +- sections/staffpm/multiresolve.php | 2 +- sections/staffpm/post_handle.php | 2 +- sections/staffpm/resolve.php | 2 +- sections/staffpm/scoreboard.php | 4 +- sections/staffpm/staff_inbox.php | 6 +- sections/staffpm/unresolve.php | 2 +- sections/staffpm/user_inbox.php | 4 +- sections/staffpm/viewconv.php | 4 +- sections/stats/torrents.php | 2 +- sections/stats/users.php | 2 +- sections/tools/data/bonus_stats.php | 4 +- sections/tools/data/economic_stats.php | 2 +- sections/tools/data/invite_pool.php | 2 +- sections/tools/data/platform_usage.php | 2 +- sections/tools/data/ratio_watch.php | 2 +- sections/tools/data/registration_log.php | 4 +- sections/tools/data/site_info.php | 2 +- sections/tools/data/special_users.php | 2 +- sections/tools/data/torrent_stats.php | 8 +- sections/tools/data/user_flow.php | 2 +- sections/tools/data/user_info.php | 6 +- sections/tools/development/analysis.php | 2 +- sections/tools/development/analysis_list.php | 2 +- sections/tools/development/clear_cache.php | 2 +- .../tools/development/database_specifics.php | 2 +- sections/tools/development/periodic_alter.php | 4 +- .../tools/development/periodic_detail.php | 2 +- sections/tools/development/periodic_edit.php | 2 +- sections/tools/development/periodic_run.php | 2 +- sections/tools/development/periodic_stats.php | 2 +- sections/tools/development/periodic_view.php | 2 +- sections/tools/development/service_stats.php | 2 +- sections/tools/development/site_options.php | 4 +- sections/tools/finances/donation_log.php | 6 +- sections/tools/finances/donor_rewards.php | 2 +- sections/tools/finances/payment_alter.php | 4 +- sections/tools/finances/payment_list.php | 4 +- .../managers/ajax_take_enable_request.php | 2 +- sections/tools/managers/asn_search.php | 2 +- sections/tools/managers/bans.php | 4 +- sections/tools/managers/bonus_points.php | 2 +- sections/tools/managers/categories_alter.php | 4 +- sections/tools/managers/categories_list.php | 2 +- sections/tools/managers/change_log.php | 2 +- sections/tools/managers/create_user.php | 2 +- sections/tools/managers/custom_pm.php | 2 +- sections/tools/managers/dnu_alter.php | 4 +- sections/tools/managers/dnu_list.php | 2 +- sections/tools/managers/dupe_ip.php | 2 +- sections/tools/managers/email_blacklist.php | 2 +- .../tools/managers/email_blacklist_alter.php | 4 +- sections/tools/managers/email_search.php | 2 +- sections/tools/managers/enable_requests.php | 2 +- sections/tools/managers/featured_album.php | 12 +-- sections/tools/managers/forum_alter.php | 4 +- sections/tools/managers/forum_list.php | 6 +- .../managers/forum_transitions_alter.php | 6 +- .../tools/managers/forum_transitions_list.php | 8 +- .../tools/managers/global_notification.php | 2 +- sections/tools/managers/invite_source.php | 4 +- .../tools/managers/invite_source_config.php | 2 +- sections/tools/managers/ip_search.php | 2 +- sections/tools/managers/manipulate_tree.php | 4 +- sections/tools/managers/mass_pm.php | 2 +- sections/tools/managers/navigation_alter.php | 4 +- sections/tools/managers/navigation_list.php | 2 +- sections/tools/managers/news.php | 2 +- sections/tools/managers/ocelot.php | 2 +- sections/tools/managers/ocelot_info.php | 4 +- sections/tools/managers/privilege_matrix.php | 4 +- sections/tools/managers/quick_ban.php | 2 +- sections/tools/managers/rate_limit.php | 8 +- sections/tools/managers/reaper.php | 2 +- sections/tools/managers/referral_accounts.php | 2 +- sections/tools/managers/referral_alter.php | 4 +- sections/tools/managers/referral_users.php | 2 +- sections/tools/managers/ssl_host.php | 2 +- .../tools/managers/staff_groups_alter.php | 4 +- sections/tools/managers/staff_groups_list.php | 2 +- sections/tools/managers/stylesheets_list.php | 2 +- sections/tools/managers/tags.php | 4 +- sections/tools/managers/tags_aliases.php | 2 +- sections/tools/managers/tags_official.php | 2 +- sections/tools/managers/take_mass_pm.php | 2 +- sections/tools/managers/tokens.php | 2 +- sections/tools/managers/tor_node.php | 2 +- .../tools/managers/torrent_report_edit.php | 4 +- .../tools/managers/torrent_report_view.php | 2 +- sections/tools/managers/userclass_alter.php | 8 +- sections/tools/managers/userclass_edit.php | 6 +- sections/tools/managers/userclass_list.php | 2 +- sections/tools/managers/whitelist_alter.php | 4 +- sections/tools/managers/whitelist_list.php | 2 +- sections/tools/sandboxes/db_sandbox.php | 2 +- sections/tools/sandboxes/notification.php | 4 +- sections/tools/sandboxes/referral_sandbox.php | 2 +- sections/tools/tools.php | 2 +- sections/top10/donors.php | 2 +- sections/top10/history.php | 2 +- sections/top10/lastfm.php | 2 +- sections/top10/tags.php | 2 +- sections/top10/torrents.php | 2 +- sections/top10/users.php | 2 +- sections/top10/votes.php | 6 +- sections/torrents/add_alias.php | 4 +- sections/torrents/add_cover_art.php | 4 +- sections/torrents/autocomplete_tags.php | 2 +- sections/torrents/browse.php | 14 ++-- sections/torrents/collector.php | 4 +- sections/torrents/delete.php | 6 +- sections/torrents/delete_alias.php | 6 +- sections/torrents/delete_handle.php | 4 +- sections/torrents/details.php | 18 ++--- sections/torrents/download.php | 2 +- sections/torrents/downloadlist.php | 2 +- sections/torrents/edit.php | 6 +- sections/torrents/edit_category_handle.php | 10 +-- sections/torrents/edit_group.php | 6 +- sections/torrents/edit_group_handle.php | 6 +- sections/torrents/edit_handle.php | 10 +-- sections/torrents/edit_log.php | 6 +- sections/torrents/edit_log_handle.php | 2 +- sections/torrents/edit_request.php | 2 +- sections/torrents/edit_request_handle.php | 4 +- sections/torrents/grouplog.php | 4 +- sections/torrents/history.php | 2 +- sections/torrents/index.php | 4 +- sections/torrents/log_ajax.php | 4 +- sections/torrents/manage_artists.php | 8 +- sections/torrents/masspm.php | 2 +- sections/torrents/masspm_handle.php | 6 +- sections/torrents/merge.php | 8 +- sections/torrents/new_group_handle.php | 14 ++-- sections/torrents/new_groupid.php | 6 +- sections/torrents/nonwikiedit.php | 8 +- sections/torrents/notify.php | 4 +- sections/torrents/peerlist.php | 2 +- sections/torrents/redownload.php | 4 +- sections/torrents/regen.php | 6 +- sections/torrents/remove_log.php | 6 +- sections/torrents/remove_logs.php | 8 +- sections/torrents/rename.php | 4 +- sections/torrents/rescore_log.php | 6 +- sections/torrents/reseed.php | 4 +- sections/torrents/snatchlist.php | 2 +- sections/torrents/user.php | 8 +- sections/torrents/vote_tag.php | 2 +- sections/upload/upload.php | 8 +- sections/upload/upload_handle.php | 28 +++---- sections/user/2fa/complete.php | 4 +- sections/user/2fa/configure.php | 2 +- sections/user/2fa/index.php | 2 +- sections/user/2fa/remove.php | 2 +- sections/user/advancedsearch.php | 6 +- sections/user/delete_invite.php | 2 +- sections/user/edit.php | 12 +-- sections/user/edit_handle.php | 14 ++-- sections/user/index.php | 2 +- sections/user/invite.php | 6 +- sections/user/invite_handle.php | 6 +- sections/user/invitetree.php | 2 +- sections/user/lastfm.php | 2 +- sections/user/manage_linked.php | 2 +- sections/user/moderate_handle.php | 14 ++-- sections/user/notify_edit.php | 4 +- sections/user/notify_handle.php | 6 +- sections/user/permissions.php | 2 +- sections/user/push_handle.php | 4 +- sections/user/search.php | 2 +- sections/user/seedbox_edit.php | 2 +- sections/user/seedbox_view.php | 4 +- sections/user/sessions.php | 2 +- sections/user/user.php | 26 +++---- sections/user/user_stats.php | 2 +- sections/user/vote_history.php | 4 +- sections/userhistory/announce_key_history.php | 2 +- sections/userhistory/email_history.php | 4 +- sections/userhistory/ip_history.php | 4 +- sections/userhistory/ip_tracker_history.php | 4 +- sections/userhistory/password_history.php | 2 +- sections/userhistory/post_history.php | 2 +- sections/userhistory/subscribed_collages.php | 6 +- sections/userhistory/subscriptions.php | 14 ++-- sections/userhistory/thread_subscribe.php | 2 +- sections/userhistory/token_history.php | 4 +- sections/userhistory/topic_history.php | 2 +- sections/view/index.php | 2 +- sections/wiki/add_alias.php | 2 +- sections/wiki/article.php | 4 +- sections/wiki/compare.php | 2 +- sections/wiki/create.php | 2 +- sections/wiki/create_handle.php | 6 +- sections/wiki/delete.php | 4 +- sections/wiki/delete_alias.php | 2 +- sections/wiki/delete_handle.php | 4 +- sections/wiki/edit.php | 4 +- sections/wiki/edit_handle.php | 4 +- sections/wiki/index.php | 2 +- sections/wiki/revisions.php | 2 +- sections/wiki/search.php | 2 +- sections/wiki/wiki_browse.php | 2 +- tests/helper.php | 28 +++---- tests/phpunit/ApplicantTest.php | 14 ++-- tests/phpunit/ArtistTest.php | 75 +++++++++--------- tests/phpunit/BonusTest.php | 8 +- tests/phpunit/CacheTest.php | 2 +- tests/phpunit/CategoryTest.php | 28 +++---- tests/phpunit/ClientWhitelistTest.php | 2 +- tests/phpunit/CollageTest.php | 78 +++++++++---------- tests/phpunit/CommentTest.php | 28 +++---- tests/phpunit/CounterTest.php | 2 +- tests/phpunit/DbTest.php | 8 +- tests/phpunit/DnuTest.php | 4 +- tests/phpunit/DonorTest.php | 8 +- tests/phpunit/DownloadTest.php | 2 +- tests/phpunit/FileStorageTest.php | 12 +-- tests/phpunit/ForumSearchTest.php | 8 +- tests/phpunit/ForumTest.php | 44 +++++------ tests/phpunit/FriendTest.php | 2 +- tests/phpunit/InboxTest.php | 2 +- tests/phpunit/InviteTest.php | 22 +++--- tests/phpunit/LogTest.php | 16 ++-- tests/phpunit/NotificationUploadTest.php | 64 +++++++-------- tests/phpunit/PrivilegeTest.php | 4 +- tests/phpunit/ReaperTest.php | 16 ++-- tests/phpunit/RequestTest.php | 56 ++++++------- tests/phpunit/SchedulerTest.php | 10 +-- tests/phpunit/SearchEmailTest.php | 2 +- tests/phpunit/SearchReportTest.php | 16 ++-- tests/phpunit/StaffBlogTest.php | 2 +- tests/phpunit/StaffGroupTest.php | 2 +- tests/phpunit/StaffPMTest.php | 2 +- tests/phpunit/TGroupTest.php | 54 ++++++------- tests/phpunit/TagTest.php | 16 ++-- tests/phpunit/TextTest.php | 12 +-- tests/phpunit/TorrentTest.php | 6 +- tests/phpunit/TrackerTest.php | 14 ++-- tests/phpunit/UploadTest.php | 2 +- tests/phpunit/UserActivityTest.php | 22 +++--- tests/phpunit/UserCreateTest.php | 12 +-- tests/phpunit/UserHistoryTest.php | 18 ++--- tests/phpunit/UserNavigationTest.php | 2 +- tests/phpunit/UserSeedboxTest.php | 2 +- tests/phpunit/UserTest.php | 32 ++++---- tests/phpunit/UserTokenTest.php | 14 ++-- tests/phpunit/Util/SSLTest.php | 2 +- tests/phpunit/Util/TwigTest.php | 4 +- tests/phpunit/WikiTest.php | 14 ++-- tests/phpunit/manager/BlogTest.php | 8 +- .../phpunit/manager/CollageFreeleechTest.php | 12 +-- tests/phpunit/manager/DuplicateIpTest.php | 2 +- tests/phpunit/manager/EmailBlacklistTest.php | 2 +- tests/phpunit/manager/FeaturedAlbumTest.php | 26 +++---- tests/phpunit/manager/IPv4Test.php | 4 +- tests/phpunit/manager/NewsTest.php | 10 +-- tests/phpunit/manager/ReportManagerTest.php | 38 ++++----- tests/phpunit/manager/RequestManagerTest.php | 2 +- tests/phpunit/manager/TGroupManagerTest.php | 6 +- tests/phpunit/manager/TorManagerTest.php | 2 +- .../phpunit/manager/TorrentFreeleechTest.php | 16 ++-- tests/phpunit/manager/TorrentManagerTest.php | 10 +-- .../manager/TorrentReportManagerTest.php | 18 ++--- tests/phpunit/manager/UserManagerTest.php | 26 +++---- .../phpunit/manager/UserRegistrationTest.php | 8 +- .../manager/UserclassRateLimitTest.php | 2 +- tests/phpunit/render/RenderTGroupTest.php | 4 +- tests/phpunit/render/RenderUserTest.php | 4 +- tests/phpunit/stats/EconomicTest.php | 2 +- tests/phpunit/stats/UsersTest.php | 16 ++-- 596 files changed, 1624 insertions(+), 1628 deletions(-) diff --git a/.phpcs.xml b/.phpcs.xml index 34df120ec..299768918 100644 --- a/.phpcs.xml +++ b/.phpcs.xml @@ -25,12 +25,10 @@ - - + + - - diff --git a/app/API/GenerateInvite.php b/app/API/GenerateInvite.php index b87265ef0..4879a7683 100644 --- a/app/API/GenerateInvite.php +++ b/app/API/GenerateInvite.php @@ -6,7 +6,7 @@ class GenerateInvite extends AbstractAPI { public function run() { - $userMan = new \Gazelle\Manager\User; + $userMan = new \Gazelle\Manager\User(); $interviewer = null; if (isset($_GET['interviewer_id'])) { $interviewer = $userMan->findById((int)$_GET['interviewer_id']); @@ -39,7 +39,7 @@ public function run() { $interviewer->id(), $key, $email, "Passed Interview" ); if (!empty($_GET['email'])) { - (new Mail)->send($email, 'New account confirmation at ' . SITE_NAME, + (new Mail())->send($email, 'New account confirmation at ' . SITE_NAME, self::$twig->render('email/invite-interviewer.twig', [ 'inviter_name' => $interviewer->username(), 'inviter_key' => $key, diff --git a/app/API/Request.php b/app/API/Request.php index bb40f5cad..70fc1aa10 100644 --- a/app/API/Request.php +++ b/app/API/Request.php @@ -4,7 +4,7 @@ class Request extends AbstractAPI { public function run() { - $request = (new \Gazelle\Manager\Request)->findById((int)($_GET['request_id'] ?? 0)); + $request = (new \Gazelle\Manager\Request())->findById((int)($_GET['request_id'] ?? 0)); if (is_null($request)) { json_error('Missing request id'); } diff --git a/app/API/Torrent.php b/app/API/Torrent.php index 8b0305854..76edeb83b 100644 --- a/app/API/Torrent.php +++ b/app/API/Torrent.php @@ -14,7 +14,7 @@ public function run() { } protected function torrent(int $id): array { - $torrent = (new \Gazelle\Manager\Torrent)->findById($id); + $torrent = (new \Gazelle\Manager\Torrent())->findById($id); if (is_null($torrent)) { json_error('Torrent not found'); } @@ -45,7 +45,7 @@ protected function torrent(int $id): array { } protected function tgroup(int $id): array { - $tgroup = (new \Gazelle\Manager\TGroup)->findById($id); + $tgroup = (new \Gazelle\Manager\TGroup())->findById($id); if (is_null($tgroup)) { json_error('Group not found'); } diff --git a/app/Applicant.php b/app/Applicant.php index c9fc5ecc6..17ffab00e 100644 --- a/app/Applicant.php +++ b/app/Applicant.php @@ -8,7 +8,7 @@ class Applicant extends BaseObject { final public const ENTRIES_PER_PAGE = 1000; // TODO: change to 50 and implement pagination public function flush(): static { - (new Manager\Applicant)->flush(); + (new Manager\Applicant())->flush(); if (isset($this->info)) { self::$cache->delete_value("user_applicant_{$this->userId()}"); } diff --git a/app/ApplicantRole.php b/app/ApplicantRole.php index 3ad73ffec..6e475a4d1 100644 --- a/app/ApplicantRole.php +++ b/app/ApplicantRole.php @@ -91,14 +91,14 @@ public function apply(User $user, string $body): Applicant { ", $this->id, $user->id(), $body, (new Manager\Thread())->createThread('staff-role')->id() ); - (new Manager\Applicant)->flush(); - (new Manager\ApplicantRole)->flush(); + (new Manager\Applicant())->flush(); + (new Manager\ApplicantRole())->flush(); return new \Gazelle\Applicant(self::$db->inserted_id()); } public function modify(): bool { $modified = false; - $userMan = new Manager\User; + $userMan = new Manager\User(); $list = preg_split('/\s+/', $this->clearField('viewer_list')); $viewerList = empty($list) ? [] @@ -141,8 +141,8 @@ public function remove(): int { ", $this->id ); $affected = self::$db->affected_rows(); - (new Manager\Applicant)->flush(); - (new Manager\ApplicantRole)->flush(); + (new Manager\Applicant())->flush(); + (new Manager\ApplicantRole())->flush(); $this->flush(); return $affected; } diff --git a/app/Artist.php b/app/Artist.php index eaa844403..d3351bdc8 100644 --- a/app/Artist.php +++ b/app/Artist.php @@ -485,7 +485,7 @@ public function aliasInfo(): array { } // go through the list and tie the alias to its non-redirecting ancestor - $userMan = new Manager\User; + $userMan = new Manager\User(); $alias = []; foreach ($result as $aliasId => $info) { if ($info['redirectId']) { @@ -494,7 +494,7 @@ public function aliasInfo(): array { 'alias_id' => $aliasId, 'name' => $info['aliasName'], 'user' => $userMan->findById($info['userId']), - ]; + ]; } else { $alias[$aliasId] = [ 'alias' => [], @@ -796,7 +796,7 @@ public function rename(int $aliasId, string $name, Manager\Request $reqMan, User UPDATE IGNORE torrents_artists SET AliasID = ? WHERE AliasID = ? ", $newId, $aliasId ); - $tgMan = new Manager\TGroup; + $tgMan = new Manager\TGroup(); foreach ($groups as $groupId) { $tgMan->findById($groupId)?->refresh(); } @@ -984,7 +984,7 @@ public function remove(User $user, Log $logger): int { self::$db->prepared_query("DELETE FROM artists_tags WHERE ArtistID = ?", $id); self::$db->prepared_query("DELETE FROM wiki_artists WHERE PageID = ?", $id); - (new \Gazelle\Manager\Comment)->remove('artist', $id); + (new \Gazelle\Manager\Comment())->remove('artist', $id); $logger->general("Artist $id ($name) was deleted by " . $user->username()); self::$db->commit(); diff --git a/app/Cache.php b/app/Cache.php index f21e8ce74..450d16dae 100644 --- a/app/Cache.php +++ b/app/Cache.php @@ -87,7 +87,7 @@ public function get_value(string $key): mixed { $begin = microtime(true); if (empty($key)) { $value = false; - } else { + } else { $value = $this->get($key); if (!isset($this->hit[$key])) { $this->hit[$key] = 0; diff --git a/app/Collage/AbstractCollage.php b/app/Collage/AbstractCollage.php index dc9a9ab14..3177b8eb2 100644 --- a/app/Collage/AbstractCollage.php +++ b/app/Collage/AbstractCollage.php @@ -145,7 +145,7 @@ public function addEntry(int $entryId, \Gazelle\User $user): int { /** * Remove an entry from a collage */ - public function removeEntry(int $entryId): int { + public function removeEntry(int $entryId): int { self::$db->begin_transaction(); self::$db->prepared_query(" DELETE FROM {$this->entryTable()} @@ -204,7 +204,7 @@ public function updateSequenceEntry(int $entryId, int $sequence): int { return $affected; } - public function remove(): int { + public function remove(): int { self::$db->prepared_query(" UPDATE collages SET Deleted = '1' diff --git a/app/Collage/TGroup.php b/app/Collage/TGroup.php index f862945f9..dec7d1429 100644 --- a/app/Collage/TGroup.php +++ b/app/Collage/TGroup.php @@ -54,7 +54,7 @@ public function load(): int { $this->groupIds = []; $this->contributors = []; $this->created = []; - $tgMan = new \Gazelle\Manager\TGroup; + $tgMan = new \Gazelle\Manager\TGroup(); foreach ($groupIds as $groupId) { $tgroup = $tgMan->findById($groupId); if (is_null($tgroup)) { @@ -135,7 +135,7 @@ public function remove(): int { if (!$this->holder->isPersonal()) { $rows = parent::remove(); } else { - (new \Gazelle\Manager\Comment)->remove('collages', $this->id); + (new \Gazelle\Manager\Comment())->remove('collages', $this->id); self::$db->prepared_query(" DELETE FROM collages_torrents WHERE CollageID = ? ", $this->id diff --git a/app/Collector/Artist.php b/app/Collector/Artist.php index d3a351e8b..1865e5e25 100644 --- a/app/Collector/Artist.php +++ b/app/Collector/Artist.php @@ -39,7 +39,7 @@ public function prepare(array $list): bool { } public function fillZip(\ZipStream\ZipStream $zip): void { - $releaseMan = new \Gazelle\ReleaseType; + $releaseMan = new \Gazelle\ReleaseType(); while (($downloadList = $this->process('GroupID')) != null) { foreach ($downloadList as $download) { $torrent = $this->torMan->findById($download['TorrentID']); diff --git a/app/Comment/AbstractComment.php b/app/Comment/AbstractComment.php index 6fcfe47b6..1c241c97e 100644 --- a/app/Comment/AbstractComment.php +++ b/app/Comment/AbstractComment.php @@ -295,7 +295,7 @@ public function remove(): bool { ); self::$db->commit(); - (new \Gazelle\Manager\Subscription)->flushPage($page, $this->pageId); + (new \Gazelle\Manager\Subscription())->flushPage($page, $this->pageId); self::$cache->delete_multi([ "edit_{$page}_" . $this->id, diff --git a/app/Contest/AbstractContest.php b/app/Contest/AbstractContest.php index 1139135ec..694dc17f7 100644 --- a/app/Contest/AbstractContest.php +++ b/app/Contest/AbstractContest.php @@ -29,7 +29,7 @@ public function leaderboard(int $limit, int $offset): array { ); $leaderboard = self::$db->to_array(false, MYSQLI_ASSOC, false); - $torMan = new \Gazelle\Manager\Torrent; + $torMan = new \Gazelle\Manager\Torrent(); for ($i = 0, $leaderboardCount = count($leaderboard); $i < $leaderboardCount; $i++) { $torrent = $torMan->findById($leaderboard[$i]['last_entry_id']); $leaderboard[$i]['last_entry_link'] diff --git a/app/DB/Mysql.php b/app/DB/Mysql.php index 688b39d04..40ad383af 100644 --- a/app/DB/Mysql.php +++ b/app/DB/Mysql.php @@ -136,7 +136,7 @@ public function enableQueryLog(): void { private function halt(string $Msg): void { if ($this->Errno == 1062) { - throw new MysqlDuplicateKeyException; + throw new MysqlDuplicateKeyException(); } global $Debug; $Debug->saveCase("MySQL: error({$this->Errno}) {$this->Error} query=[$this->PreparedQuery]"); @@ -235,7 +235,7 @@ public function execute(mixed ...$Parameters): \mysqli_result|bool { return $Statement->get_result(); } catch (\mysqli_sql_exception) { if ($this->LinkID && mysqli_error($this->LinkID) == 1062) { - throw new MysqlDuplicateKeyException; + throw new MysqlDuplicateKeyException(); } } }; diff --git a/app/Debug.php b/app/Debug.php index b98793d1b..d6505be5e 100644 --- a/app/Debug.php +++ b/app/Debug.php @@ -97,7 +97,7 @@ public function saveCase(string $message): int { $userId = (int)$Viewer?->id(); } - $id = (new \Gazelle\Manager\ErrorLog)->create( + $id = (new \Gazelle\Manager\ErrorLog())->create( uri: $uri, userId: $userId, duration: $duration, @@ -121,7 +121,7 @@ public function saveCase(string $message): int { 'includes' => $this->get_includes(), 'vars' => $this->get_logged_vars(), 'perf' => $this->get_perf(), - 'ocelot' => (new \Gazelle\Tracker)->requestList(), + 'ocelot' => (new \Gazelle\Tracker())->requestList(), 'searches' => class_exists('Sphinxql') ? \Sphinxql::$Queries : [], 'searches_time' => class_exists('Sphinxql') ? \Sphinxql::$Time : 0.0, 'queries' => $this->get_queries(), diff --git a/app/Donate/Bitcoin.php b/app/Donate/Bitcoin.php index f19c8a0dd..f29a8857f 100644 --- a/app/Donate/Bitcoin.php +++ b/app/Donate/Bitcoin.php @@ -45,7 +45,7 @@ public function __construct( 'zpub' => $slip132->p2wpkh($btcPrefixes), default => throw new DonationException("invalid xyzpub key $xyzpub"), }; - $network = new \BitWasp\Bitcoin\Network\Networks\Bitcoin; + $network = new \BitWasp\Bitcoin\Network\Networks\Bitcoin(); $config = new GlobalPrefixConfig([ new NetworkConfig($network, [$prefix]) ]); diff --git a/app/Download.php b/app/Download.php index f42140d69..6db8810e1 100644 --- a/app/Download.php +++ b/app/Download.php @@ -99,7 +99,7 @@ public function authorize(): DownloadStatus { self::$db->rollback(); return DownloadStatus::no_tokens; } - if (!(new \Gazelle\Tracker)->addToken($this->torrent, $user)) { + if (!(new \Gazelle\Tracker())->addToken($this->torrent, $user)) { self::$db->rollback(); return DownloadStatus::tracker; } diff --git a/app/Forum.php b/app/Forum.php index f00697992..09851d4c9 100644 --- a/app/Forum.php +++ b/app/Forum.php @@ -23,7 +23,7 @@ public function link(): string { public function flush(): static { $this->info = []; - (new Manager\Forum)->flushToc(); + (new Manager\Forum())->flushToc(); self::$cache->delete_multi([ sprintf(self::CACHE_FORUM, $this->id), sprintf(self::CACHE_TOC_FORUM, $this->id), diff --git a/app/ForumPost.php b/app/ForumPost.php index 35de92262..78121327c 100644 --- a/app/ForumPost.php +++ b/app/ForumPost.php @@ -142,7 +142,7 @@ public function pin(User $user, bool $set): int { */ public function remove(): bool { self::$db->begin_transaction(); - $db = new DB; + $db = new DB(); $db->relaxConstraints(true); self::$db->prepared_query(" DELETE fp, unq @@ -190,7 +190,7 @@ public function remove(): bool { self::$db->commit(); $this->thread()->forum()->adjust(); - (new \Gazelle\Manager\Subscription)->flushPage('forums', $threadId); + (new \Gazelle\Manager\Subscription())->flushPage('forums', $threadId); $thread->flush(); $pageOffset = $this->page() - 1; diff --git a/app/ForumThread.php b/app/ForumThread.php index b62130bf3..cb035ad4f 100644 --- a/app/ForumThread.php +++ b/app/ForumThread.php @@ -10,7 +10,7 @@ class ForumThread extends BaseObject { public function flush(): static { self::$cache->delete_value(sprintf(self::CACHE_KEY, $this->id)); self::$cache->delete_value("edit_forums_{$this->id}"); - (new Manager\Forum)->flushToc(); + (new Manager\Forum())->flushToc(); $last = $this->lastPage(); $this->flushCatalog($last, $last); return $this; @@ -195,7 +195,7 @@ public function slice(int $page, int $perPage): array { } public function addPost(User $user, string $body): ForumPost { - $post = (new Manager\ForumPost)->create($this, $user, $body); + $post = (new Manager\ForumPost())->create($this, $user, $body); $this->info(); $this->info['post_total_summary']++; $this->info['last_post_id'] = $post->id(); @@ -281,7 +281,7 @@ public function editThread(Forum $forum, bool $pinned, int $rank, bool $locked, public function remove(): int { // LastPostID is a chicken and egg situation when removing a thread, // so foreign key constraints need to be igored temporarily. - $db = new \Gazelle\DB; + $db = new \Gazelle\DB(); $db->relaxConstraints(true); self::$db->prepared_query(" DELETE ft, fp, unq @@ -295,7 +295,7 @@ public function remove(): int { $db->relaxConstraints(false); $this->forum()->adjust(); - (new Manager\Subscription)->move('forums', $this->id, null); + (new Manager\Subscription())->move('forums', $this->id, null); $previousPost = self::$db->rowAssoc(" SELECT AuthorID AS user_id, @@ -348,7 +348,7 @@ protected function updateThread(User $user, int $postId): int { $affected = self::$db->affected_rows(); if ($affected) { $this->updateRoot($user->id(), $postId); - (new Manager\Forum)->flushToc(); + (new Manager\Forum())->flushToc(); $this->forum()->flush(); $this->flush(); } diff --git a/app/Json/News.php b/app/Json/News.php index f2b2698bb..c090a76fe 100644 --- a/app/Json/News.php +++ b/app/Json/News.php @@ -20,7 +20,7 @@ public function payload(): array { $r['created'], time_diff($r['created'], 2, false), ], - (new \Gazelle\Manager\News)->list($this->limit, $this->offset) + (new \Gazelle\Manager\News())->list($this->limit, $this->offset) ) ]; } diff --git a/app/Json/PM.php b/app/Json/PM.php index d495f2a1e..10efe8572 100644 --- a/app/Json/PM.php +++ b/app/Json/PM.php @@ -2,7 +2,7 @@ namespace Gazelle\Json; -class PM extends \Gazelle\Json { +class PM extends \Gazelle\Json { public function __construct( protected \Gazelle\PM $pm, protected \Gazelle\Manager\User $userMan, diff --git a/app/Json/RipLog.php b/app/Json/RipLog.php index 2f6262566..4b12f7fe9 100644 --- a/app/Json/RipLog.php +++ b/app/Json/RipLog.php @@ -9,7 +9,7 @@ public function __construct( ) {} public function payload(): array { - $filer = new \Gazelle\File\RipLog; + $filer = new \Gazelle\File\RipLog(); if (!$filer->exists([$this->torrentId, $this->logId])) { return [ 'id' => $this->torrentId, diff --git a/app/Login.php b/app/Login.php index f6c9f4071..14ad9602c 100644 --- a/app/Login.php +++ b/app/Login.php @@ -88,7 +88,7 @@ public function login( } self::$cache->increment($key); } elseif ($this->watch->nrBans() > 3) { - (new Manager\IPv4)->createBan( + (new Manager\IPv4())->createBan( $this->userId, $this->ipaddr, $this->ipaddr, 'Automated ban, too many failed login attempts' ); } @@ -105,7 +105,7 @@ public function login( */ protected function attemptLogin(): ?User { // we have all we need to go forward - $userMan = new Manager\User; + $userMan = new Manager\User(); if (!preg_match(USERNAME_REGEXP, $this->username)) { $this->error = self::ERR_CREDENTIALS; return null; @@ -128,11 +128,11 @@ protected function attemptLogin(): ?User { return null; } if ($TFAKey) { - $tfa = new \RobThree\Auth\TwoFactorAuth; + $tfa = new \RobThree\Auth\TwoFactorAuth(); if (!$tfa->verifyCode($TFAKey, $this->twofa, 2)) { // They have 2FA but the device key did not match // Fallback to considering it as a recovery key. - $userToken = (new Manager\UserToken)->findByToken($this->twofa); + $userToken = (new Manager\UserToken())->findByToken($this->twofa); if ($userToken) { $userToken->consume(); } @@ -149,8 +149,8 @@ protected function attemptLogin(): ?User { } // Did they come in over Tor? - if (BLOCK_TOR && !$user->permitted('can_use_tor') && (new Manager\Tor)->isExitNode($this->ipaddr)) { - $userMan->disableUserList(new Tracker, [$user->id()], "Logged in via Tor ({$this->ipaddr})", Manager\User::DISABLE_TOR); + if (BLOCK_TOR && !$user->permitted('can_use_tor') && (new Manager\Tor())->isExitNode($this->ipaddr)) { + $userMan->disableUserList(new Tracker(), [$user->id()], "Logged in via Tor ({$this->ipaddr})", Manager\User::DISABLE_TOR); // return a newly disabled instance return $userMan->findById($user->id()); } diff --git a/app/Manager/Artist.php b/app/Manager/Artist.php index ac839713f..24d8de9ea 100644 --- a/app/Manager/Artist.php +++ b/app/Manager/Artist.php @@ -181,7 +181,7 @@ public function setUserId(int $userId): static { } public function sectionName(int $sectionId): ?string { - return (new \Gazelle\ReleaseType)->findExtendedNameById($sectionId); + return (new \Gazelle\ReleaseType())->findExtendedNameById($sectionId); } public function sectionLabel(int $sectionId): string { @@ -189,6 +189,6 @@ public function sectionLabel(int $sectionId): string { } public function sectionTitle(int $sectionId): string { - return (new \Gazelle\ReleaseType)->sectionTitle($sectionId); + return (new \Gazelle\ReleaseType())->sectionTitle($sectionId); } } diff --git a/app/Manager/Bonus.php b/app/Manager/Bonus.php index a80844557..c23aa5a62 100644 --- a/app/Manager/Bonus.php +++ b/app/Manager/Bonus.php @@ -14,7 +14,7 @@ class Bonus extends \Gazelle\Base { * @return int Discount rate (0: normal price, 100: everything is free :) */ public function discount(): int { - return (int)(new \Gazelle\Manager\SiteOption)->findValueByName('bonus-discount'); + return (int)(new \Gazelle\Manager\SiteOption())->findValueByName('bonus-discount'); } public function itemList(): array { diff --git a/app/Manager/Collage.php b/app/Manager/Collage.php index 812d40e5c..67aa983da 100644 --- a/app/Manager/Collage.php +++ b/app/Manager/Collage.php @@ -46,7 +46,7 @@ public function create( ); $id = self::$db->inserted_id(); $user->stats()->increment('collage_total'); - (new \Gazelle\Stats\Collage)->increment(); + (new \Gazelle\Stats\Collage())->increment(); $logger->general("Collage $id ($name) was created by {$user->username()}"); return new \Gazelle\Collage($id); } diff --git a/app/Manager/Comment.php b/app/Manager/Comment.php index 00c397a31..9432281ef 100644 --- a/app/Manager/Comment.php +++ b/app/Manager/Comment.php @@ -45,8 +45,8 @@ public function create( self::$cache->delete_value("{$page}_comments_recent_{$pageId}"); } (new \Gazelle\User\Notification\Quote($user)) - ->create(new \Gazelle\Manager\User, $body, $postId, $page, $pageId); - (new Subscription)->flushPage($page, $pageId); + ->create(new \Gazelle\Manager\User(), $body, $postId, $page, $pageId); + (new Subscription())->flushPage($page, $pageId); $className = $this->className($page); return new $className($pageId, 0, $postId); /** @phpstan-ignore-line */ @@ -100,7 +100,7 @@ public function merge(string $page, int $pageId, int $targetPageId): int { ); // comment subscriptions - $subscription = new \Gazelle\Manager\Subscription; + $subscription = new \Gazelle\Manager\Subscription(); $subscription->move($page, $pageId, $targetPageId); for ($i = 0; $i <= $last; ++$i) { @@ -137,7 +137,7 @@ public function remove(string $page, int $pageId): int { $affected = self::$db->affected_rows(); // literally, move the comment thread to nowhere i.e. delete - (new \Gazelle\Manager\Subscription)->move($page, $pageId, null); + (new \Gazelle\Manager\Subscription())->move($page, $pageId, null); self::$db->prepared_query(" DELETE FROM users_notify_quoted WHERE Page = ? AND PageID = ? diff --git a/app/Manager/DNU.php b/app/Manager/DNU.php index cd8d0149e..00b22eec1 100644 --- a/app/Manager/DNU.php +++ b/app/Manager/DNU.php @@ -13,9 +13,9 @@ public function create( (Name, Comment, UserID, Sequence) VALUES (?, ?, ?, 9999) ", $name, $comment, $user->id() - ); - return self::$db->inserted_id(); - } + ); + return self::$db->inserted_id(); + } public function modify( int $id, diff --git a/app/Manager/ForumThread.php b/app/Manager/ForumThread.php index 580b45ea7..761d655ed 100644 --- a/app/Manager/ForumThread.php +++ b/app/Manager/ForumThread.php @@ -9,7 +9,7 @@ class ForumThread extends \Gazelle\BaseManager { * Create a forum thread */ public function create(\Gazelle\Forum $forum, \Gazelle\User $user, string $title, string $body): \Gazelle\ForumThread { - $db = new \Gazelle\DB; + $db = new \Gazelle\DB(); $db->relaxConstraints(true); self::$db->prepared_query(" INSERT INTO forums_topics diff --git a/app/Manager/Invite.php b/app/Manager/Invite.php index 92f7d209d..c4400f0bd 100644 --- a/app/Manager/Invite.php +++ b/app/Manager/Invite.php @@ -19,7 +19,7 @@ public function create(\Gazelle\User $user, string $email, string $notes, string ); $invite = new \Gazelle\Invite($inviteKey); if (preg_match('/^s-(\d+)$/', $source, $match)) { - (new \Gazelle\Manager\InviteSource)->createPendingInviteSource((int)$match[1], $inviteKey); + (new \Gazelle\Manager\InviteSource())->createPendingInviteSource((int)$match[1], $inviteKey); } self::$db->commit(); return $invite; diff --git a/app/Manager/Payment.php b/app/Manager/Payment.php index 7fb111442..986058e80 100644 --- a/app/Manager/Payment.php +++ b/app/Manager/Payment.php @@ -64,7 +64,7 @@ public function list(): array { } // update with latest forex rates - $XBT = new XBT; + $XBT = new XBT(); foreach ($list as &$l) { $l['Active'] = (bool)$l['Active']; if ($l['cc'] == 'XBT') { diff --git a/app/Manager/Recovery.php b/app/Manager/Recovery.php index c515e7e21..156030d7d 100644 --- a/app/Manager/Recovery.php +++ b/app/Manager/Recovery.php @@ -274,7 +274,7 @@ public function accept(int $id, int $admin_id, string $admin_username): bool { VALUES (?, ?, ?, ?, now() + interval 1 week) ", $admin_id, $key, $email, "Account recovery id={$id} key={$key}" ); - (new Mail)->send($email, 'Account recovery confirmation at ' . SITE_NAME, + (new Mail())->send($email, 'Account recovery confirmation at ' . SITE_NAME, self::$twig->render('email/recovery.twig', [ 'invite_key' => $key, ]) @@ -417,7 +417,7 @@ public function mapToPrevious(int $siteUserId, int $prevUserId, string $admin_us } public function boostUpload(): void { - $userMan = new User; + $userMan = new User(); $sql = sprintf(" SELECT HIST.Username, HIST.mapped_id, HIST.UserID, HIST.Uploaded, HIST.Downloaded, HIST.Bounty, HIST.nr_torrents, HIST.userclass, round( @@ -545,7 +545,7 @@ public function boostUpload(): void { --OPS Staff END_MSG; } else { - $Body = <<send($email, 'You have been invited to ' . SITE_NAME, + (new Mail())->send($email, 'You have been invited to ' . SITE_NAME, self::$twig->render('email/referral.twig', [ 'email' => $email, 'inviter_key' => $inviteKey, diff --git a/app/Manager/Subscription.php b/app/Manager/Subscription.php index 6b933df55..b53bc753f 100644 --- a/app/Manager/Subscription.php +++ b/app/Manager/Subscription.php @@ -35,7 +35,7 @@ public function flushPage(string $Page, int $PageID): int { ); $list = self::$db->collect('UserID', false); - new User; + new User(); foreach ($list as $userId) { (new \Gazelle\User\Quote(new \Gazelle\User($userId)))->flush(); } diff --git a/app/Manager/TGroup.php b/app/Manager/TGroup.php index 73fda5dd5..523f64062 100644 --- a/app/Manager/TGroup.php +++ b/app/Manager/TGroup.php @@ -73,7 +73,7 @@ public function createFromTorrent( } else { $bookmarkMan->merge($old, $new); $commentMan->merge('torrents', $oldId, $newId); - $voteMan->merge($old, $new, new \Gazelle\Manager\User); + $voteMan->merge($old, $new, new \Gazelle\Manager\User()); $logger->merge($old, $new); $old->remove($user); } @@ -195,8 +195,8 @@ public function merge( ", $new->id(), $old->id() ); - (new \Gazelle\Manager\Bookmark)->merge($old, $new); - (new \Gazelle\Manager\Comment)->merge('torrents', $old->id(), $new->id()); + (new \Gazelle\Manager\Bookmark())->merge($old, $new); + (new \Gazelle\Manager\Comment())->merge('torrents', $old->id(), $new->id()); $voteManager->merge($old, $new, $userManager); // Collages @@ -364,7 +364,7 @@ public function changeCategory( if ($old->categoryId() === $categoryId) { return null; } - switch ((new Category)->findNameById($categoryId)) { + switch ((new Category())->findNameById($categoryId)) { case 'Music': if (empty($artistName) || !$year || !$releaseType) { return null; @@ -410,9 +410,9 @@ public function changeCategory( if (self::$db->scalar('SELECT ID FROM torrents WHERE GroupID = ?', $old->id())) { $old->flush()->refresh(); } else { - (new \Gazelle\Manager\Bookmark)->merge($old, $new); - (new \Gazelle\Manager\Comment)->merge('torrents', $old->id(), $new->id()); - (new \Gazelle\Manager\Vote)->merge($old, $new, new \Gazelle\Manager\User); + (new \Gazelle\Manager\Bookmark())->merge($old, $new); + (new \Gazelle\Manager\Comment())->merge('torrents', $old->id(), $new->id()); + (new \Gazelle\Manager\Vote())->merge($old, $new, new \Gazelle\Manager\User()); $logger->merge($old, $new); $old->remove($user); } diff --git a/app/Manager/Torrent.php b/app/Manager/Torrent.php index 1251ef1a2..a0f06c4b3 100644 --- a/app/Manager/Torrent.php +++ b/app/Manager/Torrent.php @@ -372,7 +372,7 @@ public function setListFreeleech( $affected = self::$db->affected_rows(); $refresh = []; - $log = new \Gazelle\Log; + $log = new \Gazelle\Log(); foreach ($idList as $torrentId) { $torrent = $this->findById($torrentId)->flush(); $tracker->modifyTorrent($torrent, $leechType); @@ -587,7 +587,7 @@ public function latestUploads(int $limit): array { */ public static function renderPL(int $id, array $attr): ?string { - $torrent = (new self)->findById($id); + $torrent = (new self())->findById($id); $meta = ''; $wantMeta = !(in_array('nometa', $attr) || in_array('title', $attr)); @@ -610,7 +610,7 @@ public static function renderPL(int $id, array $attr): ?string { if (is_null($deleted)) { return null; } - $tgroup = (new \Gazelle\Manager\TGroup)->findById((int)$deleted['GroupID']); + $tgroup = (new \Gazelle\Manager\TGroup())->findById((int)$deleted['GroupID']); if (is_null($tgroup)) { return null; } diff --git a/app/Manager/User.php b/app/Manager/User.php index bdc767124..d20b0babc 100644 --- a/app/Manager/User.php +++ b/app/Manager/User.php @@ -516,7 +516,7 @@ protected function deliverPM(int $toId, int $fromId, string $subject, string $bo SELECT Username FROM users_main WHERE ID = ? ", $fromId ); - (new Notification)->push([$toId], + (new Notification())->push([$toId], "Message from $senderName, Subject: $subject", $body, SITE_URL . '/inbox.php', Notification::INBOX ); } @@ -553,7 +553,7 @@ public function sendSnatchPm(\Gazelle\User $viewer, \Gazelle\Torrent $torrent, } } $total = count($snatchers); - (new \Gazelle\Log)->general($viewer->username() . " sent a mass PM to $total snatcher" . plural($total) + (new \Gazelle\Log())->general($viewer->username() . " sent a mass PM to $total snatcher" . plural($total) . " of torrent " . $torrent->id() . " (" . $torrent->group()->text() . ")" ); return $total; diff --git a/app/Manager/UserToken.php b/app/Manager/UserToken.php index 164e15291..3fc168b58 100644 --- a/app/Manager/UserToken.php +++ b/app/Manager/UserToken.php @@ -39,7 +39,7 @@ public function createPasswordResetToken(\Gazelle\User $user): \Gazelle\User\Tok ", $user->id(), UserTokenType::password->value ); $userToken = $this->create(UserTokenType::password, $user); - (new \Gazelle\Util\Mail)->send($user->email(), 'Password reset information for ' . SITE_NAME, + (new \Gazelle\Util\Mail())->send($user->email(), 'Password reset information for ' . SITE_NAME, self::$twig->render('email/password-reset.twig', [ 'ipaddr' => $_SERVER['REMOTE_ADDR'], 'reset_key' => $userToken->value(), diff --git a/app/Manager/XBT.php b/app/Manager/XBT.php index 884b2fe1c..171ef8ba9 100644 --- a/app/Manager/XBT.php +++ b/app/Manager/XBT.php @@ -16,7 +16,7 @@ class XBT extends \Gazelle\Base { * @return float current rate, or null if API endpoint cannot be reached or is in error. */ public function fetchRate(string $CC): ?float { - $curl = new \Gazelle\Util\Curl; + $curl = new \Gazelle\Util\Curl(); if ($curl->fetch(sprintf(self::FX_QUOTE_URL, $CC))) { // {"data":{"base":"BTC","currency":"USD","amount":"8165.93"}} $payload = json_decode($curl->result()); diff --git a/app/Notification/Upload.php b/app/Notification/Upload.php index eeb947adc..545253999 100644 --- a/app/Notification/Upload.php +++ b/app/Notification/Upload.php @@ -260,7 +260,7 @@ public function sendRssNotification(): int { } $this->rss[] = 'torrents_all'; - $feed = new \Gazelle\Feed; + $feed = new \Gazelle\Feed(); $item = $feed->item( title: $torrent->fullName(), description: \Text::strip_bbcode($tgroup->description()), diff --git a/app/PM.php b/app/PM.php index ad181d796..f212a1240 100644 --- a/app/PM.php +++ b/app/PM.php @@ -79,7 +79,7 @@ public function info(): array { } $this->info = $info; - $manager = new Manager\User; + $manager = new Manager\User(); $this->info['forwarded_to'] = $manager->findById($this->info['forwarded_to'] ?? 0); $this->info['sender'] = []; diff --git a/app/Request.php b/app/Request.php index f4c0f3d91..384089eac 100644 --- a/app/Request.php +++ b/app/Request.php @@ -88,7 +88,7 @@ public function artistRole(): ?ArtistRole\Request { if ($this->categoryName() !== 'Music') { return null; } - return new ArtistRole\Request($this->id, new Manager\Artist); + return new ArtistRole\Request($this->id, new Manager\Artist()); } public function hasArtistRole(): bool { @@ -556,7 +556,7 @@ public function vote(User $user, int $amount): bool { $user->flush(); return true; - } + } public function fill(User $user, Torrent $torrent): int { $bounty = $this->bountyTotal(); @@ -591,7 +591,7 @@ public function fill(User $user, Torrent $torrent): int { (new User($userId))->inbox()->createSystem("The request \"$name\" has been filled", $message); } - (new Log)->general( + (new Log())->general( "Request {$this->id} ($name) was filled by user {$user->label()} with the torrent {$torrent->id()} for a " . byte_format($bounty) . ' bounty.' ); @@ -643,7 +643,7 @@ public function unfill(User $admin, string $reason, Manager\Torrent $torMan): in ); } - (new Log)->general("Request {$this->id} ({$this->title()}), with a " . byte_format($bounty) + (new Log())->general("Request {$this->id} ({$this->title()}), with a " . byte_format($bounty) . " bounty, was unfilled by user {$admin->label()} for the reason: $reason" ); @@ -842,7 +842,7 @@ public function updateBookmarkStats(): int { // and live with the <= 1 minute delay if we have more than 100 bookmarkers $this->updateSphinx(); } else { - (new \SphinxqlQuery)->raw_query( + (new \SphinxqlQuery())->raw_query( "UPDATE requests, requests_delta SET bookmarker = (" . implode(',', self::$db->collect('UserID')) . ") WHERE id = {$this->id}" @@ -869,7 +869,7 @@ public function remove(): bool { REPLACE INTO sphinx_requests_delta (ID) VALUES (?) ", $this->id ); - (new \Gazelle\Manager\Comment)->remove('requests', $this->id); + (new \Gazelle\Manager\Comment())->remove('requests', $this->id); self::$db->commit(); foreach ($artisIds as $artistId) { diff --git a/app/Search/Collage.php b/app/Search/Collage.php index 51a3bd1eb..91eec1b70 100644 --- a/app/Search/Collage.php +++ b/app/Search/Collage.php @@ -15,13 +15,13 @@ class Collage extends \Gazelle\Base { protected array $category = []; protected array $taglist = []; - protected array $join = []; - protected array $where = ["c.Deleted = '0'"]; + protected array $joinList = []; + protected array $whereList= ["c.Deleted = '0'"]; protected array $args = []; /* the collapsed version of the above */ - protected string $_join; - protected string $_where; + protected string $join; + protected string $where; protected \Gazelle\Util\SortableTableHeader $header; @@ -30,7 +30,7 @@ public function header(): \Gazelle\Util\SortableTableHeader { } public function isFilteredView(): bool { - return count($this->where) > 1; + return count($this->whereList) > 1; } public function isBookmarkView(): bool { @@ -60,8 +60,8 @@ public function userLink(): string { public function setBookmarkView(\Gazelle\User $user): static { $this->bookmarkView = true; $this->userLink = $user->link(); - $this->join[] = "INNER JOIN bookmarks_collages AS bc ON (c.ID = bc.CollageID)"; - $this->where[] = "bc.UserID = ?"; + $this->joinList[] = "INNER JOIN bookmarks_collages AS bc ON (c.ID = bc.CollageID)"; + $this->whereList[] = "bc.UserID = ?"; $this->args[] = $user->id(); return $this; } @@ -74,7 +74,7 @@ public function setCategory(array $category): static { public function setContributor(\Gazelle\User $user): static { $this->contributor = true; $this->userLink = $user->link(); - $this->where[] = "c.ID IN (SELECT DISTINCT CollageID FROM collages_torrents WHERE UserID = ?)"; + $this->whereList[] = "c.ID IN (SELECT DISTINCT CollageID FROM collages_torrents WHERE UserID = ?)"; $this->args[] = $user->id(); return $this; } @@ -88,7 +88,7 @@ public function setLookup(string $lookup): static { } public function setPersonal(): static { - $this->where[] = 'c.CategoryID = 0'; + $this->whereList[] = 'c.CategoryID = 0'; return $this; } @@ -104,14 +104,14 @@ public function setTaglist(array $taglist): static { public function setUser(\Gazelle\User $user): static { $this->userLink = $user->link(); - $this->where[] = 'c.UserID = ?'; + $this->whereList[] = 'c.UserID = ?'; $this->args[] = $user->id(); return $this; } public function setWordlist(string $wordlist): static { if (preg_match_all('/(\S+)/', $wordlist, $match)) { - array_push($this->where, ...array_fill(0, count($match[0]), "c." . $this->lookup . " LIKE concat('%', ?, '%')")); + array_push($this->whereList, ...array_fill(0, count($match[0]), "c." . $this->lookup . " LIKE concat('%', ?, '%')")); array_push($this->args, ...$match[0]); } return $this; @@ -128,18 +128,18 @@ public function configure(): void { if ($this->category) { sort($this->category); if (implode(' ', $this->category) !== implode(' ', array_keys(COLLAGE))) { - $this->where[] = "c.CategoryID IN (" . placeholders($this->category) . ')'; + $this->whereList[] = "c.CategoryID IN (" . placeholders($this->category) . ')'; array_push($this->args, ...$this->category); } } if ($this->taglist) { - $this->where[] = '(' . implode($this->tagAll ? ' AND ' : ' OR ', + $this->whereList[] = '(' . implode($this->tagAll ? ' AND ' : ' OR ', array_fill(0, count($this->taglist), "c.TagList LIKE concat('%', ?, '%')")) . ')'; array_push($this->args, ...$this->taglist); } - $this->_join = implode(' ', $this->join); - $this->_where = implode(' AND ', $this->where); + $this->join = implode(' ', $this->joinList); + $this->where = implode(' AND ', $this->whereList); $this->configured = true; } @@ -149,8 +149,8 @@ public function total(): int { } return (int)self::$db->scalar(" SELECT count(*) - FROM collages AS c {$this->_join} - WHERE {$this->_where} + FROM collages AS c {$this->join} + WHERE {$this->where} ", ...$this->args ); } @@ -170,8 +170,8 @@ public function page(int $limit, int $offset): array { c.UserID AS user_id, c.Subscribers AS subscriber_total, c.Updated AS updated - FROM collages AS c {$this->_join} - WHERE {$this->_where} + FROM collages AS c {$this->join} + WHERE {$this->where} ORDER BY $orderBy $orderDir LIMIT ? OFFSET ? ", ...[...$this->args, $limit, $offset] diff --git a/app/Search/Donation.php b/app/Search/Donation.php index efea50815..c01002ae9 100644 --- a/app/Search/Donation.php +++ b/app/Search/Donation.php @@ -3,15 +3,15 @@ namespace Gazelle\Search; class Donation extends \Gazelle\Base { - protected array $join = []; + protected array $joinList = []; protected array $cond = []; protected array $args = []; - protected string $_join; - protected string $_where; + protected string $join; + protected string $where; public function setUsername(string $username): static { - $this->join[] = "INNER JOIN users_main AS m ON (m.ID = d.UserID)"; + $this->joinList[] = "INNER JOIN users_main AS m ON (m.ID = d.UserID)"; $this->cond[] = "m.Username LIKE concat('%', ?, '%')"; $this->args[] = trim($username); return $this; @@ -24,9 +24,9 @@ public function setInterval(string $after, string $before): static { } protected function configure(): void { - if (!isset($this->_where)) { - $this->_where = empty($this->cond) ? '' : ('WHERE ' . implode(' AND ', $this->cond)); - $this->_join = implode(' ', $this->join); + if (!isset($this->where)) { + $this->where = empty($this->cond) ? '' : ('WHERE ' . implode(' AND ', $this->cond)); + $this->join = implode(' ', $this->joinList); } } @@ -35,7 +35,7 @@ public function total(): int { return (int)self::$db->scalar(" SELECT count(*) FROM donations AS d - {$this->_join} {$this->_where} + {$this->join} {$this->where} ", ...$this->args ); } @@ -52,7 +52,7 @@ public function page(int $limit, int $offset): array { d.AddedBy, d.Reason FROM donations AS d - {$this->_join} {$this->_where} + {$this->join} {$this->where} ORDER BY d.Time DESC LIMIT ? OFFSET ? ", ...[...$this->args, $limit, $offset] diff --git a/app/Search/Request.php b/app/Search/Request.php index 0dbc2942b..2acb838b0 100644 --- a/app/Search/Request.php +++ b/app/Search/Request.php @@ -19,7 +19,7 @@ class Request extends \Gazelle\Base { public function __construct( protected \Gazelle\Manager\Request $manager, ) { - $this->sphinxq = new \SphinxqlQuery; + $this->sphinxq = new \SphinxqlQuery(); } public function isBookmarkView(): bool { @@ -168,7 +168,7 @@ public function setTag(string $tagList, string $tagMode): static { $this->negate = true; } } - $filter = (new \Gazelle\Manager\Tag)->sphinxFilter(['include' => $include, 'exclude' => $exclude], $this->negate, $tagMode === 'all'); + $filter = (new \Gazelle\Manager\Tag())->sphinxFilter(['include' => $include, 'exclude' => $exclude], $this->negate, $tagMode === 'all'); $this->tagList = $filter['input']; if ($filter['predicate']) { $this->sphinxq->where_match($filter['predicate'], 'taglist', false); diff --git a/app/Search/Torrent.php b/app/Search/Torrent.php index b49c95023..fd4c6a528 100644 --- a/app/Search/Torrent.php +++ b/app/Search/Torrent.php @@ -429,7 +429,7 @@ private function process_attribute(string $Attribute, array|int|string $Value): case 'releasetype': $id = (int)$Value; - if (!is_null((new \Gazelle\ReleaseType)->findNameById($id))) { + if (!is_null((new \Gazelle\ReleaseType())->findNameById($id))) { $this->SphQL->where('ReleaseType', $id); } break; @@ -481,7 +481,7 @@ private function process_field(string $Field, string $Term): void { private function post_process_fields(): void { if (isset($this->Terms['taglist'])) { // Replace bad tags with tag aliases - $this->Terms['taglist'] = (new \Gazelle\Manager\Tag)->replaceAliasList($this->Terms['taglist']); + $this->Terms['taglist'] = (new \Gazelle\Manager\Tag())->replaceAliasList($this->Terms['taglist']); if (isset($this->RawTerms['tags_type']) && (int)$this->RawTerms['tags_type'] === self::TAGS_ANY) { $this->Terms['taglist']['operator'] = self::SPH_BOOL_OR; } diff --git a/app/SiteInfo.php b/app/SiteInfo.php index da65537da..e4ece6d48 100644 --- a/app/SiteInfo.php +++ b/app/SiteInfo.php @@ -37,7 +37,7 @@ public function uptime(): array { $in = fopen('/proc/cpuinfo', 'r'); if ($in !== false) { while (($line = fgets($in)) !== false) { - if (preg_match('/^processor\s+:\s+\d+/', $line)) { + if (preg_match('/^processor\s+:\s+\d+/', $line)) { ++$ncpu; } } diff --git a/app/Staff.php b/app/Staff.php index f2aec0f5e..e4fa6f6a9 100644 --- a/app/Staff.php +++ b/app/Staff.php @@ -40,7 +40,7 @@ public function pmCount(): int { ]; $effectiveClass = $this->user->privilege()->effectiveClassLevel(); $args = [$this->user->id(), $effectiveClass]; - $classes = (new Manager\User)->classList(); + $classes = (new Manager\User())->classList(); if ($effectiveClass >= $classes[MOD]['Level']) { $cond[] = 'Level >= ?'; $args[] = $classes[MOD]['Level']; diff --git a/app/StaffGroup.php b/app/StaffGroup.php index 77125add7..f31b84673 100644 --- a/app/StaffGroup.php +++ b/app/StaffGroup.php @@ -6,7 +6,7 @@ class StaffGroup extends BaseObject { final public const tableName = 'staff_groups'; public function flush(): static { - (new Manager\Privilege)->flush(); + (new Manager\Privilege())->flush(); self::$cache->delete_value(Manager\StaffGroup::LIST_KEY); unset($this->info); return $this; diff --git a/app/TGroup.php b/app/TGroup.php index 5e0890b43..1b3d31c92 100644 --- a/app/TGroup.php +++ b/app/TGroup.php @@ -304,7 +304,7 @@ public function artistRole(): ?ArtistRole\TGroup { return null; } if (!isset($this->artistRole)) { - $this->artistRole = new ArtistRole\TGroup($this->id, new Manager\Artist); + $this->artistRole = new ArtistRole\TGroup($this->id, new Manager\Artist()); } return $this->artistRole; } @@ -399,7 +399,7 @@ public function releaseType(): ?int { public function releaseTypeName(): ?string { static $releaseTypes; if (is_null($releaseTypes)) { - $releaseTypes = (new \Gazelle\ReleaseType)->list(); + $releaseTypes = (new \Gazelle\ReleaseType())->list(); } return $this->info()['ReleaseType'] == 0 ? null : $releaseTypes[$this->releaseType()]; } @@ -1001,9 +1001,9 @@ public function absorb(Torrent $torrent, User $user, Log $logger): int { $old->flush(); $old->refresh(); } else { - (new \Gazelle\Manager\Bookmark)->merge($old, $this); - (new \Gazelle\Manager\Comment)->merge('torrents', $oldId, $this->id); - (new \Gazelle\Manager\Vote)->merge($old, $this, new Manager\User); + (new \Gazelle\Manager\Bookmark())->merge($old, $this); + (new \Gazelle\Manager\Comment())->merge('torrents', $oldId, $this->id); + (new \Gazelle\Manager\Vote())->merge($old, $this, new Manager\User()); $logger->merge($old, $this); $old->remove($user); @@ -1032,8 +1032,8 @@ public function remove(User $user): bool { DELETE FROM torrents_artists WHERE GroupID = ? ", $this->id ); - $logger = new Log; - $artistMan = new Manager\Artist; + $logger = new Log(); + $artistMan = new Manager\Artist(); foreach ($artistList as $artistId) { $artist = $artistMan->findById($artistId); if ($artist) { @@ -1074,7 +1074,7 @@ public function remove(User $user): bool { self::$cache->delete_value("torrent_collages_" . $this->id); } - (new \Gazelle\Manager\Comment)->remove('torrents', $this->id); + (new \Gazelle\Manager\Comment())->remove('torrents', $this->id); // Requests self::$db->prepared_query(" @@ -1109,7 +1109,7 @@ public function remove(User $user): bool { ", $this->id ); - $manager = new \Gazelle\DB; + $manager = new \Gazelle\DB(); [$ok, $message] = $manager->softDelete(SQLDB, 'torrents_group', [['ID', $this->id]]); if (!$ok) { return false; diff --git a/app/Task/ArtistUsage.php b/app/Task/ArtistUsage.php index fae585d14..c2ba33cb6 100644 --- a/app/Task/ArtistUsage.php +++ b/app/Task/ArtistUsage.php @@ -4,6 +4,6 @@ class ArtistUsage extends \Gazelle\Task { public function run(): void { - $this->processed = (new \Gazelle\Stats\Artists)->updateUsage(); + $this->processed = (new \Gazelle\Stats\Artists())->updateUsage(); } } diff --git a/app/Task/BetterTranscode.php b/app/Task/BetterTranscode.php index 00aaac8ee..88c90db7e 100644 --- a/app/Task/BetterTranscode.php +++ b/app/Task/BetterTranscode.php @@ -4,6 +4,6 @@ class BetterTranscode extends \Gazelle\Task { public function run(): void { - $this->processed = (new \Gazelle\Manager\TGroup)->refreshBetterTranscode(); + $this->processed = (new \Gazelle\Manager\TGroup())->refreshBetterTranscode(); } } diff --git a/app/Task/CalculateContestLeaderboard.php b/app/Task/CalculateContestLeaderboard.php index 423f34aae..6f13b7f0c 100644 --- a/app/Task/CalculateContestLeaderboard.php +++ b/app/Task/CalculateContestLeaderboard.php @@ -4,8 +4,8 @@ class CalculateContestLeaderboard extends \Gazelle\Task { public function run(): void { - $contestMan = new \Gazelle\Manager\Contest; + $contestMan = new \Gazelle\Manager\Contest(); $this->processed = $contestMan->calculateAllLeaderboards(); - $this->processed += $contestMan->schedulePayout(new \Gazelle\Manager\User); + $this->processed += $contestMan->schedulePayout(new \Gazelle\Manager\User()); } } diff --git a/app/Task/CommunityStats.php b/app/Task/CommunityStats.php index faa9ba449..df8605248 100644 --- a/app/Task/CommunityStats.php +++ b/app/Task/CommunityStats.php @@ -4,7 +4,7 @@ class CommunityStats extends \Gazelle\Task { public function run(): void { - $this->processed = (new \Gazelle\Stats\Users)->refresh() - + (new \Gazelle\Stats\TGroups)->refresh(); + $this->processed = (new \Gazelle\Stats\Users())->refresh() + + (new \Gazelle\Stats\TGroups())->refresh(); } } diff --git a/app/Task/CycleAuthKeys.php b/app/Task/CycleAuthKeys.php index b2c915082..dbcf15126 100644 --- a/app/Task/CycleAuthKeys.php +++ b/app/Task/CycleAuthKeys.php @@ -4,6 +4,6 @@ class CycleAuthKeys extends \Gazelle\Task { public function run(): void { - $this->processed += (new \Gazelle\Manager\User)->cycleAuthKeys(); + $this->processed += (new \Gazelle\Manager\User())->cycleAuthKeys(); } } diff --git a/app/Task/DemoteUsersRatio.php b/app/Task/DemoteUsersRatio.php index c776712f3..2119b1484 100644 --- a/app/Task/DemoteUsersRatio.php +++ b/app/Task/DemoteUsersRatio.php @@ -4,7 +4,7 @@ class DemoteUsersRatio extends \Gazelle\Task { public function run(): void { - $userMan = new \Gazelle\Manager\User; + $userMan = new \Gazelle\Manager\User(); foreach ($userMan->demotionCriteria() as $criteria) { $this->demote($criteria['To'], $criteria['Ratio'], $criteria['Upload'], $criteria['From'], $userMan); } diff --git a/app/Task/DisableDownloadingRatioWatch.php b/app/Task/DisableDownloadingRatioWatch.php index c22ba5459..8a40dfe4d 100644 --- a/app/Task/DisableDownloadingRatioWatch.php +++ b/app/Task/DisableDownloadingRatioWatch.php @@ -4,6 +4,6 @@ class DisableDownloadingRatioWatch extends \Gazelle\Task { public function run(): void { - $this->processed += (new \Gazelle\Manager\User)->ratioWatchEngage(new \Gazelle\Tracker, $this); + $this->processed += (new \Gazelle\Manager\User())->ratioWatchEngage(new \Gazelle\Tracker(), $this); } } diff --git a/app/Task/DisableLeechingRatioWatch.php b/app/Task/DisableLeechingRatioWatch.php index 3ee04feb1..cc68ef6c2 100644 --- a/app/Task/DisableLeechingRatioWatch.php +++ b/app/Task/DisableLeechingRatioWatch.php @@ -4,6 +4,6 @@ class DisableLeechingRatioWatch extends \Gazelle\Task { public function run(): void { - $this->processed += (new \Gazelle\Manager\User)->ratioWatchBlock(new \Gazelle\Tracker, $this); + $this->processed += (new \Gazelle\Manager\User())->ratioWatchBlock(new \Gazelle\Tracker(), $this); } } diff --git a/app/Task/DisableUnconfirmedUsers.php b/app/Task/DisableUnconfirmedUsers.php index bcd2cf654..25831b9d2 100644 --- a/app/Task/DisableUnconfirmedUsers.php +++ b/app/Task/DisableUnconfirmedUsers.php @@ -4,6 +4,6 @@ class DisableUnconfirmedUsers extends \Gazelle\Task { public function run(): void { - $this->processed = (new \Gazelle\Manager\User)->disableUnconfirmedUsers(); + $this->processed = (new \Gazelle\Manager\User())->disableUnconfirmedUsers(); } } diff --git a/app/Task/Donations.php b/app/Task/Donations.php index 9cb5fd81d..bf2f3cdc3 100644 --- a/app/Task/Donations.php +++ b/app/Task/Donations.php @@ -4,7 +4,7 @@ class Donations extends \Gazelle\Task { public function run(): void { - $donorMan = new \Gazelle\Manager\Donation; + $donorMan = new \Gazelle\Manager\Donation(); $this->processed = $donorMan->expireRanks(); } } diff --git a/app/Task/ExpireFlTokens.php b/app/Task/ExpireFlTokens.php index 071ca8217..edd8a2969 100644 --- a/app/Task/ExpireFlTokens.php +++ b/app/Task/ExpireFlTokens.php @@ -4,7 +4,7 @@ class ExpireFlTokens extends \Gazelle\Task { public function run(): void { - $this->processed = (new \Gazelle\Manager\User) - ->expireFreeleechTokens(new \Gazelle\Manager\Torrent, new \Gazelle\Tracker); + $this->processed = (new \Gazelle\Manager\User()) + ->expireFreeleechTokens(new \Gazelle\Manager\Torrent(), new \Gazelle\Tracker()); } } diff --git a/app/Task/ExpireInvites.php b/app/Task/ExpireInvites.php index 64943a306..8eb0fbadc 100644 --- a/app/Task/ExpireInvites.php +++ b/app/Task/ExpireInvites.php @@ -4,6 +4,6 @@ class ExpireInvites extends \Gazelle\Task { public function run(): void { - $this->processed = (new \Gazelle\Manager\Invite)->expire($this); + $this->processed = (new \Gazelle\Manager\Invite())->expire($this); } } diff --git a/app/Task/InactiveUserDeactivate.php b/app/Task/InactiveUserDeactivate.php index fb6b110e3..3aa32a85b 100644 --- a/app/Task/InactiveUserDeactivate.php +++ b/app/Task/InactiveUserDeactivate.php @@ -4,6 +4,6 @@ class InactiveUserDeactivate extends \Gazelle\Task { public function run(): void { - $this->processed = (new \Gazelle\Manager\User)->inactiveUserDeactivate(new \Gazelle\Tracker); + $this->processed = (new \Gazelle\Manager\User())->inactiveUserDeactivate(new \Gazelle\Tracker()); } } diff --git a/app/Task/InactiveUserWarn.php b/app/Task/InactiveUserWarn.php index a490668a5..acaf66279 100644 --- a/app/Task/InactiveUserWarn.php +++ b/app/Task/InactiveUserWarn.php @@ -4,6 +4,6 @@ class InactiveUserWarn extends \Gazelle\Task { public function run(): void { - $this->processed = (new \Gazelle\Manager\User)->inactiveUserWarn(new \Gazelle\Util\Mail); + $this->processed = (new \Gazelle\Manager\User())->inactiveUserWarn(new \Gazelle\Util\Mail()); } } diff --git a/app/Task/LockOldThreads.php b/app/Task/LockOldThreads.php index 129596c25..4cd447109 100644 --- a/app/Task/LockOldThreads.php +++ b/app/Task/LockOldThreads.php @@ -4,6 +4,6 @@ class LockOldThreads extends \Gazelle\Task { public function run(): void { - $this->processed = (new \Gazelle\Manager\ForumThread)->lockOldThreads(); + $this->processed = (new \Gazelle\Manager\ForumThread())->lockOldThreads(); } } diff --git a/app/Task/Peerupdate.php b/app/Task/Peerupdate.php index 0891cb36c..73eb45906 100644 --- a/app/Task/Peerupdate.php +++ b/app/Task/Peerupdate.php @@ -4,7 +4,7 @@ class Peerupdate extends \Gazelle\Task { public function run(): void { - [$updated, $skipped] = (new \Gazelle\Manager\Torrent)->updatePeerlists(); + [$updated, $skipped] = (new \Gazelle\Manager\Torrent())->updatePeerlists(); $this->processed += $updated; } } diff --git a/app/Task/PromoteUsers.php b/app/Task/PromoteUsers.php index cf4faf929..177c2b1af 100644 --- a/app/Task/PromoteUsers.php +++ b/app/Task/PromoteUsers.php @@ -4,7 +4,7 @@ class PromoteUsers extends \Gazelle\Task { public function run(): void { - $manager = new \Gazelle\Manager\User; + $manager = new \Gazelle\Manager\User(); $this->processed += $manager->demote($this); $this->processed += $manager->promote($this); } diff --git a/app/Task/RatioRequirements.php b/app/Task/RatioRequirements.php index 4b64c6e7c..f097ff861 100644 --- a/app/Task/RatioRequirements.php +++ b/app/Task/RatioRequirements.php @@ -4,6 +4,6 @@ class RatioRequirements extends \Gazelle\Task { public function run(): void { - $this->processed = (new \Gazelle\Manager\User)->updateRatioRequirements(); + $this->processed = (new \Gazelle\Manager\User())->updateRatioRequirements(); } } diff --git a/app/Task/RatioWatch.php b/app/Task/RatioWatch.php index 15c8e1ace..e36d6e28c 100644 --- a/app/Task/RatioWatch.php +++ b/app/Task/RatioWatch.php @@ -4,6 +4,6 @@ class RatioWatch extends \Gazelle\Task { public function run(): void { - $this->processed += (new \Gazelle\Manager\User)->ratioWatchAudit(new \Gazelle\Tracker, $this); + $this->processed += (new \Gazelle\Manager\User())->ratioWatchAudit(new \Gazelle\Tracker(), $this); } } diff --git a/app/Task/Reaper.php b/app/Task/Reaper.php index b51ede5a4..f40223705 100644 --- a/app/Task/Reaper.php +++ b/app/Task/Reaper.php @@ -4,7 +4,7 @@ class Reaper extends \Gazelle\Task { public function run(): void { - $reaper = new \Gazelle\Torrent\Reaper(new \Gazelle\Manager\Torrent, new \Gazelle\Manager\User); + $reaper = new \Gazelle\Torrent\Reaper(new \Gazelle\Manager\Torrent(), new \Gazelle\Manager\User()); $this->processed = 0; if (REAPER_TASK_CLAIM) { $reaper->claim(); diff --git a/app/Task/Recovery.php b/app/Task/Recovery.php index 7e5bade5e..28e5ccfdf 100644 --- a/app/Task/Recovery.php +++ b/app/Task/Recovery.php @@ -5,7 +5,7 @@ class Recovery extends \Gazelle\Task { public function run(): void { if (RECOVERY) { - $recovery = new \Gazelle\Manager\Recovery; + $recovery = new \Gazelle\Manager\Recovery(); if (RECOVERY_AUTOVALIDATE) { $recovery->validatePending(); } diff --git a/app/Task/RemoveDeadSessions.php b/app/Task/RemoveDeadSessions.php index 808d46fd0..c67dc369a 100644 --- a/app/Task/RemoveDeadSessions.php +++ b/app/Task/RemoveDeadSessions.php @@ -4,6 +4,6 @@ class RemoveDeadSessions extends \Gazelle\Task { public function run(): void { - $this->processed += (new \Gazelle\Manager\Session)->purge(); + $this->processed += (new \Gazelle\Manager\Session())->purge(); } } diff --git a/app/Task/ResetReseedRequest.php b/app/Task/ResetReseedRequest.php index a4e16142f..4ffb11aa4 100644 --- a/app/Task/ResetReseedRequest.php +++ b/app/Task/ResetReseedRequest.php @@ -4,6 +4,6 @@ class ResetReseedRequest extends \Gazelle\Task { public function run(): void { - $this->processed += (new \Gazelle\Manager\Torrent)->resetReseededRequest(); + $this->processed += (new \Gazelle\Manager\Torrent())->resetReseededRequest(); } } diff --git a/app/Task/SSLCertificate.php b/app/Task/SSLCertificate.php index 74f6cddf7..c74e291fb 100644 --- a/app/Task/SSLCertificate.php +++ b/app/Task/SSLCertificate.php @@ -4,6 +4,6 @@ class SSLCertificate extends \Gazelle\Task { public function run(): void { - $this->processed += (new \Gazelle\Manager\SSLHost)->schedule(); + $this->processed += (new \Gazelle\Manager\SSLHost())->schedule(); } } diff --git a/app/Task/TorrentHistory.php b/app/Task/TorrentHistory.php index 2c75fc418..c79769d77 100644 --- a/app/Task/TorrentHistory.php +++ b/app/Task/TorrentHistory.php @@ -4,6 +4,6 @@ class TorrentHistory extends \Gazelle\Task { public function run(): void { - (new \Gazelle\Manager\Torrent)->updateSeedingHistory(); + (new \Gazelle\Manager\Torrent())->updateSeedingHistory(); } } diff --git a/app/Task/UpdateDailyTop10.php b/app/Task/UpdateDailyTop10.php index 75c8a4dc1..a8e7a7afd 100644 --- a/app/Task/UpdateDailyTop10.php +++ b/app/Task/UpdateDailyTop10.php @@ -4,6 +4,6 @@ class UpdateDailyTop10 extends \Gazelle\Task { public function run(): void { - $this->processed = (new \Gazelle\Manager\Torrent)->storeTop10('Daily', 'day', 1); + $this->processed = (new \Gazelle\Manager\Torrent())->storeTop10('Daily', 'day', 1); } } diff --git a/app/Task/UpdateUserBonusPoints.php b/app/Task/UpdateUserBonusPoints.php index bcdc47903..deb031add 100644 --- a/app/Task/UpdateUserBonusPoints.php +++ b/app/Task/UpdateUserBonusPoints.php @@ -4,6 +4,6 @@ class UpdateUserBonusPoints extends \Gazelle\Task { public function run(): void { - $this->processed = (new \Gazelle\Manager\Bonus)->givePoints($this); + $this->processed = (new \Gazelle\Manager\Bonus())->givePoints($this); } } diff --git a/app/Task/UpdateWeeklyTop10.php b/app/Task/UpdateWeeklyTop10.php index 0501759e5..83ab42997 100644 --- a/app/Task/UpdateWeeklyTop10.php +++ b/app/Task/UpdateWeeklyTop10.php @@ -4,6 +4,6 @@ class UpdateWeeklyTop10 extends \Gazelle\Task { public function run(): void { - $this->processed = (new \Gazelle\Manager\Torrent)->storeTop10('Weekly', 'week', 7); + $this->processed = (new \Gazelle\Manager\Torrent())->storeTop10('Weekly', 'week', 7); } } diff --git a/app/Task/UploadNotifier.php b/app/Task/UploadNotifier.php index d8555c2e9..1b15b9a5d 100644 --- a/app/Task/UploadNotifier.php +++ b/app/Task/UploadNotifier.php @@ -4,10 +4,10 @@ class UploadNotifier extends \Gazelle\Task { public function run(): void { - $this->processed = (new \Gazelle\Manager\Notification) + $this->processed = (new \Gazelle\Manager\Notification()) ->processBacklog( - new \Gazelle\Manager\NotificationTicket, - new \Gazelle\Manager\Torrent, + new \Gazelle\Manager\NotificationTicket(), + new \Gazelle\Manager\Torrent(), ); } } diff --git a/app/Task/UserLastAccess.php b/app/Task/UserLastAccess.php index f3637fa35..566235c67 100644 --- a/app/Task/UserLastAccess.php +++ b/app/Task/UserLastAccess.php @@ -4,6 +4,6 @@ class UserLastAccess extends \Gazelle\Task { public function run(): void { - $this->processed += (new \Gazelle\Manager\User)->updateLastAccess(); + $this->processed += (new \Gazelle\Manager\User())->updateLastAccess(); } } diff --git a/app/Task/UserStatsDaily.php b/app/Task/UserStatsDaily.php index d4c99aecb..398a2216a 100644 --- a/app/Task/UserStatsDaily.php +++ b/app/Task/UserStatsDaily.php @@ -4,7 +4,7 @@ class UserStatsDaily extends \Gazelle\Task { public function run(): void { - $this->processed += (new \Gazelle\Stats\Users) + $this->processed += (new \Gazelle\Stats\Users()) ->registerActivity('users_stats_daily', DELETE_USER_STATS_DAILY_DAY); } } diff --git a/app/Task/UserStatsMonthly.php b/app/Task/UserStatsMonthly.php index 2356d1420..9a3f92514 100644 --- a/app/Task/UserStatsMonthly.php +++ b/app/Task/UserStatsMonthly.php @@ -4,7 +4,7 @@ class UserStatsMonthly extends \Gazelle\Task { public function run(): void { - $this->processed += (new \Gazelle\Stats\Users) + $this->processed += (new \Gazelle\Stats\Users()) ->registerActivity('users_stats_monthly', DELETE_USER_STATS_MONTHLY_DAY); } } diff --git a/app/Task/UserStatsYearly.php b/app/Task/UserStatsYearly.php index 641c17c4d..0c35fce8e 100644 --- a/app/Task/UserStatsYearly.php +++ b/app/Task/UserStatsYearly.php @@ -4,7 +4,7 @@ class UserStatsYearly extends \Gazelle\Task { public function run(): void { - $this->processed += (new \Gazelle\Stats\Users) + $this->processed += (new \Gazelle\Stats\Users()) ->registerActivity('users_stats_yearly', 0); } } diff --git a/app/Torrent.php b/app/Torrent.php index f7f6b300f..9ad669185 100644 --- a/app/Torrent.php +++ b/app/Torrent.php @@ -98,12 +98,12 @@ public function torrentFilename(bool $asText, int $maxLength): string { * Convert a stored torrent into a binary file that can be loaded in a torrent client */ public function torrentBody(string $announceUrl): string { - $filer = new \Gazelle\File\Torrent; + $filer = new \Gazelle\File\Torrent(); $contents = $filer->get($this->id); if ($contents == false) { return ''; } - $tor = new \OrpheusNET\BencodeTorrent\BencodeTorrent; + $tor = new \OrpheusNET\BencodeTorrent\BencodeTorrent(); try { $tor->decodeString($contents); } catch (\RuntimeException) { @@ -346,13 +346,13 @@ public function remove(?User $user, string $reason, int $trackerReason = -1): ar $infohash = $this->infohash(); $sizeMB = number_format($this->size() / (1024 * 1024), 2) . ' MiB'; $name = $this->name(); - (new \Gazelle\Tracker)->update_tracker('delete_torrent', [ + (new \Gazelle\Tracker())->update_tracker('delete_torrent', [ 'id' => $this->id, 'info_hash' => $this->infohashEncoded(), 'reason' => $trackerReason, ]); - $manager = new \Gazelle\DB; + $manager = new \Gazelle\DB(); $manager->relaxConstraints(true); [$ok, $message] = $manager->softDelete(SQLDB, 'torrents_leech_stats', [['TorrentID', $this->id]], false); if (!$ok) { @@ -433,7 +433,7 @@ public function remove(?User $user, string $reason, int $trackerReason = -1): ar } $userInfo = $user ? " by " . $user->username() : ''; - (new Log)->general( + (new Log())->general( "Torrent {$this->id} ($name) [$edition] ($sizeMB $infohash) was deleted$userInfo for reason: $reason") ->torrent($this, $user, "deleted torrent ($sizeMB $infohash) for reason: $reason"); self::$db->commit(); @@ -465,7 +465,7 @@ public function expireToken(User $user): int { ); $affected = self::$db->affected_rows(); self::$cache->delete_value("users_tokens_{$user->id()}"); - (new \Gazelle\Tracker)->removeToken($this, $user); + (new \Gazelle\Tracker())->removeToken($this, $user); return $affected; } diff --git a/app/Torrent/Log.php b/app/Torrent/Log.php index 7feb9228a..9c5ce45cf 100644 --- a/app/Torrent/Log.php +++ b/app/Torrent/Log.php @@ -37,7 +37,7 @@ public function logDetails(): array { ); $logs = self::$db->to_array('LogID', MYSQLI_ASSOC, false); $details = []; - $htmlFiler = new \Gazelle\File\RipLogHTML; + $htmlFiler = new \Gazelle\File\RipLogHTML(); foreach ($logs as $log) { $details[$log['LogID']] = [ 'adjustment' => !$log['is_adjusted'] diff --git a/app/Torrent/Report.php b/app/Torrent/Report.php index 11040464d..5a390ba38 100644 --- a/app/Torrent/Report.php +++ b/app/Torrent/Report.php @@ -95,7 +95,7 @@ public function reporterId(): int { } public function reportType(): \Gazelle\Torrent\ReportType { - return (new \Gazelle\Manager\Torrent\ReportType)->findByType($this->type()); + return (new \Gazelle\Manager\Torrent\ReportType())->findByType($this->type()); } public function resolverId(): int { diff --git a/app/TorrentAbstract.php b/app/TorrentAbstract.php index 5d7c9287c..1d721804f 100644 --- a/app/TorrentAbstract.php +++ b/app/TorrentAbstract.php @@ -311,7 +311,7 @@ public function hasLogDb(): bool { * This method can be used to verify that group() can be called. */ public function hasTGroup(): bool { - return (new Manager\TGroup)->findById($this->groupId()) instanceof TGroup; + return (new Manager\TGroup())->findById($this->groupId()) instanceof TGroup; } /** diff --git a/app/Upload.php b/app/Upload.php index d71e19603..b41cae97b 100644 --- a/app/Upload.php +++ b/app/Upload.php @@ -72,7 +72,7 @@ public function head(): string { } public function foot(bool $showFooter): string { - $torMan = new \Gazelle\Manager\Torrent; + $torMan = new \Gazelle\Manager\Torrent(); return self::$twig->render('upload/footer.twig', [ 'is_upload' => $this->Torrent === false || isset($this->Torrent['add-format']), 'info' => $this->Torrent, @@ -116,7 +116,7 @@ public function music_form(array $GenreTags, \Gazelle\Manager\TGroup $manager): $LossymasterApproved = $Torrent['LossymasterApproved'] ?? false; $LossywebApproved = $Torrent['LossywebApproved'] ?? false; } - $releaseTypes = (new \Gazelle\ReleaseType)->list(); + $releaseTypes = (new \Gazelle\ReleaseType())->list(); ob_start(); ?> diff --git a/app/User.php b/app/User.php index 7b99a4889..70db8b0ff 100644 --- a/app/User.php +++ b/app/User.php @@ -891,7 +891,7 @@ public function recordPasswordChange(string $ipaddr): int { ", $this->id, $ipaddr, $_SERVER['HTTP_USER_AGENT'] ); Irc::sendMessage($this->username(), "Security alert: Your password was changed via $ipaddr with {$_SERVER['HTTP_USER_AGENT']}. Not you? Contact staff ASAP."); - (new Mail)->send($this->email(), 'Password changed information for ' . SITE_NAME, + (new Mail())->send($this->email(), 'Password changed information for ' . SITE_NAME, self::$twig->render('email/password-change.twig', [ 'ipaddr' => $ipaddr, 'now' => date('Y-m-d H:i:s'), @@ -987,7 +987,7 @@ public function warnPost( \Gazelle\User $staffer, string $staffReason, string $userMessage -): void { + ): void { if (!$weekDuration) { // verbal warning $warned = "Verbally warned"; $this->inbox()->createSystem( @@ -1261,7 +1261,7 @@ public function supportCount(int $newClassId, int $levelClassId): int { } public function updateCatchup(): bool { - return (new WitnessTable\UserReadForum)->witness($this); + return (new WitnessTable\UserReadForum())->witness($this); } public function addClasses(array $classes): int { @@ -1809,7 +1809,7 @@ public function addBounty(int $bounty): int { public function buffer(): array { $class = $this->primaryClass(); - $demotion = array_filter((new Manager\User)->demotionCriteria(), fn($v) => in_array($class, $v['From'])); + $demotion = array_filter((new Manager\User())->demotionCriteria(), fn($v) => in_array($class, $v['From'])); $criteria = end($demotion); $effectiveUpload = $this->uploadedSize() + $this->stats()->requestBountySize(); diff --git a/app/User/Activity.php b/app/User/Activity.php index 1efa3f28d..3cc3dd4e5 100644 --- a/app/User/Activity.php +++ b/app/User/Activity.php @@ -156,7 +156,7 @@ public function setStaff(\Gazelle\Staff $staff): static { $this->setAlert('New staff blog post!'); } if (FEATURE_EMAIL_REENABLE) { - $total = (new \Gazelle\Manager\AutoEnable)->openTotal(); + $total = (new \Gazelle\Manager\AutoEnable())->openTotal(); if ($total > 0) { $this->setAction('' . $total . " Enable request" . plural($total) . ""); } diff --git a/app/User/AutoEnable.php b/app/User/AutoEnable.php index fad8a5a42..aa2adc17d 100644 --- a/app/User/AutoEnable.php +++ b/app/User/AutoEnable.php @@ -158,7 +158,7 @@ public function resolve(\Gazelle\User $viewer, int $status, string $comment): in ", $token, $this->id ); } - (new Mail)->send($this->email(), $subject, self::$twig->render($template, ['token' => $token])); + (new Mail())->send($this->email(), $subject, self::$twig->render($template, ['token' => $token])); $this->user->addStaffNote( "Enable request {$this->id} " . strtolower($this->outcomeLabel()) . ' by [user]' . $viewer->username() . '[/user]' . (!empty($comment) ? "\nReason: $comment" : "") @@ -203,7 +203,7 @@ public function processToken(): bool { WHERE um.ID = ? ", $userId ); - (new \Gazelle\Tracker)->addUser($this->user); + (new \Gazelle\Tracker())->addUser($this->user); self::$cache->delete_value(self::CACHE_TOTAL_OPEN); $success = true; } diff --git a/app/User/Bonus.php b/app/User/Bonus.php index ec12bb1bd..03cd91041 100644 --- a/app/User/Bonus.php +++ b/app/User/Bonus.php @@ -26,7 +26,7 @@ public function pointsSpent(): int { } protected function items(): array { - return (new \Gazelle\Manager\Bonus)->itemList(); + return (new \Gazelle\Manager\Bonus())->itemList(); } public function itemList(): array { diff --git a/app/User/Bookmark.php b/app/User/Bookmark.php index 171b9d188..2e231b164 100644 --- a/app/User/Bookmark.php +++ b/app/User/Bookmark.php @@ -55,12 +55,12 @@ public function create(string $type, int $id): bool { ); self::$cache->delete_multi(["u_book_t_" . $this->user->id(), "bookmarks_{$type}_" . $this->user->id(), "bookmarks_group_ids_" . $this->user->id()]); - $torMan = (new \Gazelle\Manager\Torrent)->setViewer($this->user); - $tgroup = (new \Gazelle\Manager\TGroup)->findById($id); + $torMan = (new \Gazelle\Manager\Torrent())->setViewer($this->user); + $tgroup = (new \Gazelle\Manager\TGroup())->findById($id); $tgroup->stats()->increment('bookmark_total'); // RSS feed stuff - $Feed = new \Gazelle\Feed; + $Feed = new \Gazelle\Feed(); foreach ($tgroup->torrentIdList() as $id) { $torrent = $torMan->findById($id); if (is_null($torrent)) { diff --git a/app/User/Donor.php b/app/User/Donor.php index 5c21af2dc..463ebfac0 100644 --- a/app/User/Donor.php +++ b/app/User/Donor.php @@ -470,7 +470,7 @@ public function donate( $fiatAmount = $amount; break; default: - $xbtAmount = (new \Gazelle\Manager\XBT)->fiat2xbt($amount, $currency); + $xbtAmount = (new \Gazelle\Manager\XBT())->fiat2xbt($amount, $currency); $fiatAmount = $xbtAmount * $xbtRate; break; } diff --git a/app/User/Inbox.php b/app/User/Inbox.php index 0528f8b85..fbf758c25 100644 --- a/app/User/Inbox.php +++ b/app/User/Inbox.php @@ -68,7 +68,7 @@ public function create(?\Gazelle\User $from, string $subject, string $body): ?\G self::$db->set_query_id($qid); $senderName = $from?->username() ?? 'System'; - (new \Gazelle\Manager\Notification)->push( + (new \Gazelle\Manager\Notification())->push( [$this->id()], "Message from $senderName, Subject: $subject", $body, SITE_URL . '/inbox.php', \Gazelle\Manager\Notification::INBOX, ); diff --git a/app/User/Notification/Blog.php b/app/User/Notification/Blog.php index 71800d3b3..9604ae4c2 100644 --- a/app/User/Notification/Blog.php +++ b/app/User/Notification/Blog.php @@ -8,16 +8,16 @@ public function className(): string { } public function clear(): int { - return (int)(new \Gazelle\WitnessTable\UserReadBlog)->witness($this->user); + return (int)(new \Gazelle\WitnessTable\UserReadBlog())->witness($this->user); } public function load(): bool { - $blogMan = new \Gazelle\Manager\Blog; + $blogMan = new \Gazelle\Manager\Blog(); $latest = $blogMan->latest(); if (is_null($latest)) { return false; } - $lastRead = (new \Gazelle\WitnessTable\UserReadBlog)->lastRead($this->user); + $lastRead = (new \Gazelle\WitnessTable\UserReadBlog())->lastRead($this->user); // You must be new around here. $newJoiner = is_null($lastRead) && $latest->createdEpoch() > strtotime($this->user->created()); diff --git a/app/User/Notification/GlobalNotification.php b/app/User/Notification/GlobalNotification.php index 10fbea06c..6d28f4eb3 100644 --- a/app/User/Notification/GlobalNotification.php +++ b/app/User/Notification/GlobalNotification.php @@ -17,13 +17,13 @@ public function clear(): int { self::$cache->cache_value( sprintf(self::CLEARED, $this->user->id()), true, - (new \Gazelle\Notification\GlobalNotification)->remaining() + (new \Gazelle\Notification\GlobalNotification())->remaining() ); return 1; } public function load(): bool { - $alert = (new \Gazelle\Notification\GlobalNotification)->alert(); + $alert = (new \Gazelle\Notification\GlobalNotification())->alert(); if ($alert && self::$cache->get_value(sprintf(self::CLEARED, $this->user->id())) === false) { $this->title = $alert['title']; $this->url = $alert['url']; diff --git a/app/User/Notification/News.php b/app/User/Notification/News.php index 849033840..155cdac09 100644 --- a/app/User/Notification/News.php +++ b/app/User/Notification/News.php @@ -8,19 +8,19 @@ public function className(): string { } public function clear(): int { - if ((new \Gazelle\WitnessTable\UserReadNews)->witness($this->user)) { + if ((new \Gazelle\WitnessTable\UserReadNews())->witness($this->user)) { $this->user->flush(); } - return (new \Gazelle\Manager\News)->latestId(); + return (new \Gazelle\Manager\News())->latestId(); } public function load(): bool { - $newsMan = new \Gazelle\Manager\News; + $newsMan = new \Gazelle\Manager\News(); ["id" => $newsId, "title" => $title] = $newsMan->latest(); if ($newsId === -1) { return false; } - $lastRead = (new \Gazelle\WitnessTable\UserReadNews)->lastRead($this->user); + $lastRead = (new \Gazelle\WitnessTable\UserReadNews())->lastRead($this->user); // You must be new around here. $newJoiner = is_null($lastRead) diff --git a/app/User/Quote.php b/app/User/Quote.php index 08e55f18a..76065a3f7 100644 --- a/app/User/Quote.php +++ b/app/User/Quote.php @@ -173,9 +173,9 @@ public function page(int $limit, int $offset): array { $quoteList = self::$db->to_array(false, MYSQLI_ASSOC, false); $page = []; - $postMan = new \Gazelle\Manager\ForumPost; - $reqMan = new \Gazelle\Manager\Request; - $tgMan = new \Gazelle\Manager\TGroup; + $postMan = new \Gazelle\Manager\ForumPost(); + $reqMan = new \Gazelle\Manager\Request(); + $tgMan = new \Gazelle\Manager\TGroup(); foreach ($quoteList as $q) { $context = []; @@ -246,7 +246,7 @@ public function unreadTotal(): int { $key = sprintf(self::UNREAD_QUOTE_KEY, $this->user->id()); $total = self::$cache->get_value($key); if ($total === false) { - $forMan = new \Gazelle\Manager\Forum; + $forMan = new \Gazelle\Manager\Forum(); [$cond, $args] = $forMan->configureForUser(new \Gazelle\User($this->user->id())); $args[] = $this->user->id(); // for q.UserID $total = (int)self::$db->scalar(" diff --git a/app/User/Subscription.php b/app/User/Subscription.php index 75f3d4b79..d74d03081 100644 --- a/app/User/Subscription.php +++ b/app/User/Subscription.php @@ -133,7 +133,7 @@ public function commentSubscriptions(): array { public function unread(): int { $unread = self::$cache->get_value('subscriptions_user_new_' . $this->user->id()); if ($unread === false) { - $unread = (new \Gazelle\Manager\Forum)->unreadSubscribedForumTotal($this->user) + $this->unreadCommentTotal(); + $unread = (new \Gazelle\Manager\Forum())->unreadSubscribedForumTotal($this->user) + $this->unreadCommentTotal(); self::$cache->cache_value('subscriptions_user_new_' . $this->user->id(), $unread, 0); } return $unread; @@ -238,7 +238,7 @@ public function catchupSubscriptions(): int { } public function latestSubscriptionList(bool $showUnread, int $limit, int $offset): array { - $forMan = new \Gazelle\Manager\Forum; + $forMan = new \Gazelle\Manager\Forum(); [$cond, $args] = $forMan->configureForUser($this->user); if ($showUnread) { $cond[] = "p.ID > if(t.IsLocked = '1' AND t.IsSticky = '0', p.ID, coalesce(lr.PostID, 0))"; diff --git a/app/User/Vote.php b/app/User/Vote.php index 627e6c526..1cc68ad90 100644 --- a/app/User/Vote.php +++ b/app/User/Vote.php @@ -91,11 +91,11 @@ public function setTopYearInterval(int $lower, int $higher): static { $this->topWhere[] = 'tg.Year >= ?'; $this->topArgs[] = $lower; } - } elseif ($higher > 0) { + } elseif ($higher > 0) { $this->topJoin['torrents_group'] = 'INNER JOIN torrents_group tg ON (tg.ID = v.GroupID)'; $this->topWhere[] = 'tg.Year <= ?'; $this->topArgs[] = $higher; - } + } return $this; } diff --git a/app/UserCreator.php b/app/UserCreator.php index 4aa502a52..52a5040d5 100644 --- a/app/UserCreator.php +++ b/app/UserCreator.php @@ -43,7 +43,7 @@ public function create(): User { } else { $this->permissionId = USER; } - $manager = new Manager\User; + $manager = new Manager\User(); if (!isset($this->inviteKey)) { $inviter = null; } else { @@ -76,7 +76,7 @@ public function create(): User { // neither setEmail() nor setInviteKey() produced anything useful throw new UserCreatorException('email'); } - $domainManager = new \Gazelle\Manager\EmailBlacklist; + $domainManager = new \Gazelle\Manager\EmailBlacklist(); foreach ($this->email as $email) { if ($domainManager->exists($email)) { throw new UserCreatorException('email'); @@ -120,7 +120,7 @@ public function create(): User { ); if ($inviter) { - (new Manager\InviteSource)->resolveInviteSource($this->inviteKey, $user); + (new Manager\InviteSource())->resolveInviteSource($this->inviteKey, $user); (new User\InviteTree($inviter, $manager))->add($user); $inviter->stats()->increment('invited_total'); $user->externalProfile()->modifyProfile($inviterReason); @@ -181,7 +181,7 @@ public function create(): User { ); self::$db->commit(); - (new Tracker)->addUser($user); + (new Tracker())->addUser($user); $this->reset(); // So we can create another user return $user; diff --git a/app/UserRank/Configuration.php b/app/UserRank/Configuration.php index 3036bb3c6..427062bba 100644 --- a/app/UserRank/Configuration.php +++ b/app/UserRank/Configuration.php @@ -13,7 +13,7 @@ public function definition(): array { public function instance(string $dimension): \Gazelle\UserRank\AbstractUserRank { $className = "\\Gazelle\\UserRank\\Dimension\\" . $this->config[$dimension][1]; - return new $className; /** @phpstan-ignore-line */ + return new $className(); /** @phpstan-ignore-line */ } public function weight(string $dimension): int { diff --git a/app/Util/Irc.php b/app/Util/Irc.php index 8ae74e24c..e526b9665 100644 --- a/app/Util/Irc.php +++ b/app/Util/Irc.php @@ -14,7 +14,7 @@ public static function sendMessage(string $target, string $message): bool { if (DISABLE_IRC) { return true; } - $curl = new Curl; + $curl = new Curl(); $curl->setUseProxy(false) ->setMethod(CurlMethod::POST) ->setOption(CURLOPT_POSTFIELDS, $message) diff --git a/app/Util/IrcText.php b/app/Util/IrcText.php index 51d3d4be6..b8f842531 100644 --- a/app/Util/IrcText.php +++ b/app/Util/IrcText.php @@ -106,5 +106,4 @@ enum IrcText: string { case Mauve = "\x0385"; case Violet = "\x0386"; case LavenderRose = "\x0387"; - } diff --git a/app/Util/LastFM.php b/app/Util/LastFM.php index e60055e58..dec58c6ba 100644 --- a/app/Util/LastFM.php +++ b/app/Util/LastFM.php @@ -210,7 +210,7 @@ protected function fetch(string $method, array $args): array|false { foreach ($args as $Key => $Value) { $url .= "&$Key=" . urlencode($Value); } - $curl = new Curl; + $curl = new Curl(); if ($curl->fetch($url . "&format=json&api_key=" . LASTFM_API_KEY)) { return json_decode($curl->result(), true); } diff --git a/app/Util/Twig.php b/app/Util/Twig.php index fef807970..30c78fb66 100644 --- a/app/Util/Twig.php +++ b/app/Util/Twig.php @@ -16,7 +16,7 @@ public static function factory(): \Twig\Environment { new \Twig\Loader\FilesystemLoader(__DIR__ . '/../../templates'), [ 'debug' => DEBUG_MODE, 'cache' => __DIR__ . '/../../cache/twig' - ]); + ]); $twig->addFilter(new \Twig\TwigFilter( 'article', @@ -302,7 +302,7 @@ function ($userId, $viewer): string { $twig->addTest(new \Twig\TwigTest('request_fill', fn($contest) => $contest instanceof \Gazelle\Contest\RequestFill)); - $twig->addGlobal('dom', new \Gazelle\Util\Dominator); + $twig->addGlobal('dom', new \Gazelle\Util\Dominator()); return $twig; } diff --git a/bin/fix-leech-status.php b/bin/fix-leech-status.php index 5efe933f3..267488554 100644 --- a/bin/fix-leech-status.php +++ b/bin/fix-leech-status.php @@ -6,8 +6,8 @@ ini_set('max_execution_time', -1); -$tracker = new Gazelle\Tracker; -$userMan = new Gazelle\Manager\User; +$tracker = new Gazelle\Tracker(); +$userMan = new Gazelle\Manager\User(); $db = Gazelle\DB::DB(); $db->prepared_query(' diff --git a/bin/migrate-logs.php b/bin/migrate-logs.php index e23cd85a6..5c1ab320c 100644 --- a/bin/migrate-logs.php +++ b/bin/migrate-logs.php @@ -22,8 +22,8 @@ $errHtml = 0; $db = Gazelle\DB::DB(); -$logFiler = new Gazelle\File\RipLog; -$htmlFiler = new Gazelle\File\RipLogHTML; +$logFiler = new Gazelle\File\RipLog(); +$htmlFiler = new Gazelle\File\RipLogHTML(); while (true) { $db->prepared_query(' diff --git a/bin/migrate-torrent-files.php b/bin/migrate-torrent-files.php index 11ec96562..e0bdcc901 100644 --- a/bin/migrate-torrent-files.php +++ b/bin/migrate-torrent-files.php @@ -11,7 +11,7 @@ $processed = 0; $new = 0; -$filer = new Gazelle\File\Torrent; +$filer = new Gazelle\File\Torrent(); while (true) { $db->prepared_query(' diff --git a/bin/rebuild-invite-trees.php b/bin/rebuild-invite-trees.php index 47abe31ac..472857352 100644 --- a/bin/rebuild-invite-trees.php +++ b/bin/rebuild-invite-trees.php @@ -16,7 +16,7 @@ while ([$invitee, $inviter] = $db->next_record()) { $save = $db->get_query_id(); if (!isset($inv[$inviter])) { - $inv[$inviter] = new Gazelle\User\InviteTree(new Gazelle\User($inviter), new Gazelle\Manager\User); + $inv[$inviter] = new Gazelle\User\InviteTree(new Gazelle\User($inviter), new Gazelle\Manager\User()); } $inv[$inviter]->add($invitee); $db->set_query_id($save); diff --git a/bin/recheck-file-storage.php b/bin/recheck-file-storage.php index 848efa04d..f1f62ebd0 100644 --- a/bin/recheck-file-storage.php +++ b/bin/recheck-file-storage.php @@ -21,7 +21,7 @@ $allConfig = [ '-html' => [ 'CHECK' => 'SELECT Log FROM torrents_logs WHERE TorrentID = ? AND LogID = ?', - 'FILER' => new Gazelle\File\RipLogHTML, + 'FILER' => new Gazelle\File\RipLogHTML(), 'MD5' => 'SELECT Log AS digest FROM torrents_logs WHERE TorrentID = ? AND LogID = ?', 'PIPE' => '/usr/bin/find ' . STORAGE_PATH_RIPLOGHTML . ' -type f', 'MATCH' => '~/(\d+)_(\d+)\.html$~', @@ -29,7 +29,7 @@ ], '-log' => [ 'CHECK' => 'SELECT 1 FROM torrents_logs WHERE TorrentID = ? AND LogID = ?', - 'FILER' => new Gazelle\File\RipLog, + 'FILER' => new Gazelle\File\RipLog(), 'MD5' => null, 'PIPE' => '/usr/bin/find ' . STORAGE_PATH_RIPLOG . ' -type f', 'MATCH' => '~/(\d+)_(\d+)\.log$~', @@ -37,7 +37,7 @@ ], '-torrent' => [ 'CHECK' => 'SELECT 1 FROM torrents WHERE ID = ?', - 'FILER' => new Gazelle\File\Torrent, + 'FILER' => new Gazelle\File\Torrent(), 'MD5' => 'SELECT File AS digest FROM torrents_files WHERE TorrentID = ?', 'PIPE' => '/usr/bin/find ' . STORAGE_PATH_TORRENT . ' -type f', 'MATCH' => '~/(\d+)\.torrent$~', diff --git a/bin/regen-filelists.php b/bin/regen-filelists.php index 8cb815455..71e84d35b 100644 --- a/bin/regen-filelists.php +++ b/bin/regen-filelists.php @@ -3,9 +3,9 @@ require_once(__DIR__ . '/../lib/bootstrap.php'); $Cache->disableLocalCache(); -$torMan = new Gazelle\Manager\Torrent; -$filer = new Gazelle\File\Torrent; -$encoder = new OrpheusNET\BencodeTorrent\BencodeTorrent; +$torMan = new Gazelle\Manager\Torrent(); +$filer = new Gazelle\File\Torrent(); +$encoder = new OrpheusNET\BencodeTorrent\BencodeTorrent(); $db = Gazelle\DB::DB(); $max = $db->scalar("SELECT max(ID) FROM torrents"); $id = $argv[1] ?? 0; diff --git a/ci-coverage.php b/ci-coverage.php index 26d28fb07..99fb414b7 100644 --- a/ci-coverage.php +++ b/ci-coverage.php @@ -17,14 +17,14 @@ class CoverageHelper { private CodeCoverage $coverage; public function __construct() { - $filter = new Filter; + $filter = new Filter(); $filter->includeDirectory(__DIR__ . '/app'); $filter->includeDirectory(__DIR__ . '/classes'); $filter->includeDirectory(__DIR__ . '/lib'); $filter->includeDirectory(__DIR__ . '/public'); $filter->includeDirectory(__DIR__ . '/sections'); $this->coverage = new CodeCoverage( - (new Selector)->forLineCoverage($filter), + (new Selector())->forLineCoverage($filter), $filter ); $this->coverage->cacheStaticAnalysis('/tmp/coverage-cache'); @@ -36,7 +36,7 @@ public function __destruct() { Filesystem::createDirectory($this::TARGET_DIR); $outfile = tempnam($this::TARGET_DIR, 'phpcov'); if ($outfile !== false) { - (new PhpReport)->process($this->coverage, $outfile); + (new PhpReport())->process($this->coverage, $outfile); rename($outfile, $outfile . ".cov"); } } diff --git a/classes/text.class.php b/classes/text.class.php index 7399902ad..88e04a623 100644 --- a/classes/text.class.php +++ b/classes/text.class.php @@ -372,9 +372,9 @@ public static function resolve_url(string $url): ?string { case '/torrents.php': if (isset($args['torrentid'])) { - return (new \Gazelle\Manager\Torrent)->findById((int)$args['torrentid'])?->link(); + return (new \Gazelle\Manager\Torrent())->findById((int)$args['torrentid'])?->link(); } elseif (isset($args['id'])) { - return (new \Gazelle\Manager\TGroup)->findById((int)$args['id'])?->link(); + return (new \Gazelle\Manager\TGroup())->findById((int)$args['id'])?->link(); } return null; @@ -877,7 +877,7 @@ private static function to_html(array $Array, bool $Rules, bool $cache, CacheBuc } elseif ((int)$Block['Val']) { $GroupID = $Block['Val']; } - $tgroup = (new Gazelle\Manager\TGroup)->findById((int)$GroupID); + $tgroup = (new Gazelle\Manager\TGroup())->findById((int)$GroupID); if (is_null($tgroup)) { $Str .= '[torrent]' . str_replace('[inlineurl]', '', $Block['Val']) . '[/torrent]'; } else { @@ -1175,7 +1175,7 @@ function ($match) { $username = $match['username']; static $cache; if (!isset($cache[$username])) { - $userMan = new \Gazelle\Manager\User; + $userMan = new \Gazelle\Manager\User(); $user = $userMan->findByUsername($username); if (is_null($user) && preg_match('/^(.*)[.?]+$/', $username, $match)) { // strip off trailing dots to see if we can match @Spine... @@ -1415,7 +1415,7 @@ protected static function bbcodeForumUrl(int $val): string { } protected static function bbcodeCommentUrl(int $postId): ?string { - $post = (new Gazelle\Manager\Comment)->findById($postId); + $post = (new Gazelle\Manager\Comment())->findById($postId); if (is_null($post)) { return null; } @@ -1425,7 +1425,7 @@ protected static function bbcodeCommentUrl(int $postId): ?string { } protected static function bbcodePostUrl(int $postId): ?string { - $post = (new \Gazelle\Manager\ForumPost)->findById($postId); + $post = (new \Gazelle\Manager\ForumPost())->findById($postId); if (is_null($post)) { return null; } @@ -1442,7 +1442,7 @@ protected static function bbcodeThreadUrl(int|string $thread, int $postId = null return "[thread]{$thread}[/thread]"; } - $thread = (new \Gazelle\Manager\ForumThread)->findById($threadId); + $thread = (new \Gazelle\Manager\ForumThread())->findById($threadId); if (is_null($thread)) { return $postId ? "[thread]{$threadId}:{$postId}[/thread]" : "[thread]{$threadId}[/thread]"; } diff --git a/classes/users.class.php b/classes/users.class.php index a01a98e77..c6c671b4b 100644 --- a/classes/users.class.php +++ b/classes/users.class.php @@ -16,7 +16,7 @@ public static function format_username($UserID, $Badges = false, $IsWarned = tru if ($UserID == 0) { return 'System'; } - $userMan = new Gazelle\Manager\User; + $userMan = new Gazelle\Manager\User(); $user = $userMan->findById($UserID); if (is_null($user)) { return "Unknown [$UserID]"; diff --git a/classes/view.class.php b/classes/view.class.php index f59374df7..55508bd31 100644 --- a/classes/view.class.php +++ b/classes/view.class.php @@ -60,7 +60,7 @@ public static function header(string $pageTitle, array $option = []): string { $activity = new Gazelle\User\Activity($Viewer); $activity->configure() - ->setStaffPM(new Gazelle\Manager\StaffPM); + ->setStaffPM(new Gazelle\Manager\StaffPM()); $notifier = new Gazelle\User\Notification($Viewer); $alertList = $notifier->setDocument($Document, $_REQUEST['action'] ?? '')->alertList(); @@ -73,25 +73,25 @@ public static function header(string $pageTitle, array $option = []): string { array_push($js, 'noty/noty', 'noty/layouts/bottomRight', 'noty/themes/default', 'user_notifications'); } - $payMan = new Gazelle\Manager\Payment; + $payMan = new Gazelle\Manager\Payment(); if ($Viewer->permitted('users_mod')) { $activity->setStaff(new Gazelle\Staff($Viewer)) - ->setReport(new Gazelle\Stats\Report) + ->setReport(new Gazelle\Stats\Report()) ->setPayment($payMan) - ->setApplicant(new Gazelle\Manager\Applicant) - ->setDb(new Gazelle\DB) - ->setScheduler(new Gazelle\TaskScheduler) - ->setSSLHost(new Gazelle\Manager\SSLHost) + ->setApplicant(new Gazelle\Manager\Applicant()) + ->setDb(new Gazelle\DB()) + ->setScheduler(new Gazelle\TaskScheduler()) + ->setSSLHost(new Gazelle\Manager\SSLHost()) ; if (OPEN_EXTERNAL_REFERRALS) { - $activity->setReferral(new Gazelle\Manager\Referral); + $activity->setReferral(new Gazelle\Manager\Referral()); } } $PageID = [$Document, $_REQUEST['action'] ?? false, $_REQUEST['type'] ?? false]; $navLinks = []; - foreach ((new Gazelle\Manager\UserNavigation)->userControlList($Viewer) as $n) { + foreach ((new Gazelle\Manager\UserNavigation())->userControlList($Viewer) as $n) { [$ID, $Key, $Title, $Target, $Tests, $TestUser, $Mandatory] = array_values($n); if (str_contains($Tests, ':')) { $testList = []; @@ -147,7 +147,7 @@ public static function header(string $pageTitle, array $option = []): string { 'alert_list' => $activity->alertList(), 'bonus' => new Gazelle\User\Bonus($Viewer), 'document' => $Document, - 'dono_target' => $payMan->monthlyPercent(new Gazelle\Manager\Donation), + 'dono_target' => $payMan->monthlyPercent(new Gazelle\Manager\Donation()), 'nav_links' => $navLinks, 'user' => $Viewer, ]); diff --git a/gazelle.php b/gazelle.php index 6920f7a28..31af3ce7e 100644 --- a/gazelle.php +++ b/gazelle.php @@ -44,8 +44,8 @@ $SessionID = false; $Viewer = null; -$ipv4Man = new Gazelle\Manager\IPv4; -$userMan = new Gazelle\Manager\User; +$ipv4Man = new Gazelle\Manager\IPv4(); +$userMan = new Gazelle\Manager\User(); Gazelle\Util\Twig::setUserMan($userMan); // Authorization header only makes sense for the ajax endpoint diff --git a/lib/bootstrap.php b/lib/bootstrap.php index 3789c616c..18ea87239 100644 --- a/lib/bootstrap.php +++ b/lib/bootstrap.php @@ -12,7 +12,7 @@ global $Cache, $Debug, $Twig; -$Cache = new Gazelle\Cache; +$Cache = new Gazelle\Cache(); $Twig = Gazelle\Util\Twig::factory(); Gazelle\Base::initialize($Cache, Gazelle\DB::DB(), $Twig); diff --git a/misc/phinx/migrations/20200905163947_user_delete.php b/misc/phinx/migrations/20200905163947_user_delete.php index e120f68b0..1ee1868de 100644 --- a/misc/phinx/migrations/20200905163947_user_delete.php +++ b/misc/phinx/migrations/20200905163947_user_delete.php @@ -13,9 +13,9 @@ public function up(): void { $this->execute('ALTER TABLE users_leech_stats DROP FOREIGN KEY users_leech_stats_ibfk_1'); $this->execute('ALTER TABLE users_leech_stats ADD FOREIGN KEY (UserID) REFERENCES users_main (ID) ON UPDATE CASCADE ON DELETE CASCADE'); $this->execute('ALTER TABLE users_info ADD FOREIGN KEY (UserID) REFERENCES users_main (ID) ON UPDATE CASCADE ON DELETE CASCADE'); - } + } - public function down(): void { + public function down(): void { $this->execute('ALTER TABLE user_bonus DROP FOREIGN KEY user_bonus_ibfk_1'); $this->execute('ALTER TABLE user_bonus ADD FOREIGN KEY (user_id) REFERENCES users_main (ID)'); $this->execute('ALTER TABLE user_flt DROP FOREIGN KEY user_flt_ibfk_1'); @@ -23,5 +23,5 @@ public function down(): void { $this->execute('ALTER TABLE users_leech_stats DROP FOREIGN KEY users_leech_stats_ibfk_1'); $this->execute('ALTER TABLE users_leech_stats ADD FOREIGN KEY (UserID) REFERENCES users_main (ID)'); $this->execute('ALTER TABLE users_info DROP FOREIGN KEY users_info_ibfk_1'); - } + } } diff --git a/misc/phinx/migrations/20220118231832_add_disable_user_attrs.php b/misc/phinx/migrations/20220118231832_add_disable_user_attrs.php index 694aaac50..6e88e4098 100644 --- a/misc/phinx/migrations/20220118231832_add_disable_user_attrs.php +++ b/misc/phinx/migrations/20220118231832_add_disable_user_attrs.php @@ -22,7 +22,7 @@ public function up(): void ['Name' => 'disable-leech', 'Description' => 'This user has leeching privileges disabled'] ]; $this->table('user_attr')->insert($rows)->save(); - } + } public function down(): void { diff --git a/public/feeds.php b/public/feeds.php index 89c6a2f23..c3c6590a6 100644 --- a/public/feeds.php +++ b/public/feeds.php @@ -7,8 +7,8 @@ require_once(__DIR__ . '/../lib/bootstrap.php'); -$feed = new Gazelle\Feed; -$user = (new Gazelle\Manager\User)->findById((int)($_GET['user'] ?? 0)); +$feed = new Gazelle\Feed(); +$user = (new Gazelle\Manager\User())->findById((int)($_GET['user'] ?? 0)); if (!$user?->isEnabled() || empty($_GET['feed']) || md5($user->id() . RSS_HASH . ($_GET['passkey'] ?? 'NOTPASS')) !== ($_GET['auth'] ?? 'NOTAUTH') @@ -34,13 +34,13 @@ echo $feed->byFeedName($user, $_GET['feed']); break; case 'feed_news': - echo $feed->news(new Gazelle\Manager\News); + echo $feed->news(new Gazelle\Manager\News()); break; case 'feed_blog': - echo $feed->blog(new Gazelle\Manager\Blog, new Gazelle\Manager\ForumThread); + echo $feed->blog(new Gazelle\Manager\Blog(), new Gazelle\Manager\ForumThread()); break; case 'feed_changelog': - echo $feed->changelog(new Gazelle\Manager\Changelog); + echo $feed->changelog(new Gazelle\Manager\Changelog()); break; default: echo match (true) { diff --git a/sections/ajax/add_log.php b/sections/ajax/add_log.php index e23324107..0867f84f8 100644 --- a/sections/ajax/add_log.php +++ b/sections/ajax/add_log.php @@ -1,6 +1,6 @@ findById((int)($_GET['id'] ?? 0)); +$torrent = (new Gazelle\Manager\Torrent())->findById((int)($_GET['id'] ?? 0)); if (is_null($torrent)) { json_error('bad parameters'); } @@ -14,7 +14,7 @@ echo (new Gazelle\Json\AddLog( $torrent, $Viewer, - new Gazelle\Manager\TorrentLog(new Gazelle\File\RipLog, new Gazelle\File\RipLogHTML), + new Gazelle\Manager\TorrentLog(new Gazelle\File\RipLog(), new Gazelle\File\RipLogHTML()), new Gazelle\LogfileSummary($_FILES['logfiles']), )) ->setVersion(1) diff --git a/sections/ajax/announcements.php b/sections/ajax/announcements.php index 72807e62b..620a35afd 100644 --- a/sections/ajax/announcements.php +++ b/sections/ajax/announcements.php @@ -1,7 +1,7 @@ latestId() < $newsReader->lastRead($Viewer)) { $newsReader->witness($Viewer); } @@ -22,7 +22,7 @@ ]; } -$headlines = (new Gazelle\Manager\Blog)->headlines(); +$headlines = (new Gazelle\Manager\Blog())->headlines(); $blog = []; foreach ($headlines as $item) { $blog[] = [ diff --git a/sections/ajax/artist.php b/sections/ajax/artist.php index b5ee962f1..d74e89226 100644 --- a/sections/ajax/artist.php +++ b/sections/ajax/artist.php @@ -1,6 +1,6 @@ setReleasesOnly(!empty($_GET['artistreleases'])) ->setVersion(2) diff --git a/sections/ajax/better/single.php b/sections/ajax/better/single.php index c2bacb9d2..9558b6c7b 100644 --- a/sections/ajax/better/single.php +++ b/sections/ajax/better/single.php @@ -2,7 +2,7 @@ echo (new Gazelle\Json\Better\SingleSeeded( $Viewer, - new Gazelle\Better\SingleSeeded($Viewer, 'all', new Gazelle\Manager\Torrent) + new Gazelle\Better\SingleSeeded($Viewer, 'all', new Gazelle\Manager\Torrent()) )) ->setVersion(2) ->response(); diff --git a/sections/ajax/better/transcode.php b/sections/ajax/better/transcode.php index ac412e7c7..e778eb2bf 100644 --- a/sections/ajax/better/transcode.php +++ b/sections/ajax/better/transcode.php @@ -4,7 +4,7 @@ error(0); } -$search = new Gazelle\Search\Transcode($Viewer, (new Gazelle\Manager\Torrent)->setViewer($Viewer)); +$search = new Gazelle\Search\Transcode($Viewer, (new Gazelle\Manager\Torrent())->setViewer($Viewer)); if (isset($_GET['search'])) { $search->setSearch($_GET['search']); } diff --git a/sections/ajax/bookmarks/artists.php b/sections/ajax/bookmarks/artists.php index b6a31ade5..9c3f98d74 100644 --- a/sections/ajax/bookmarks/artists.php +++ b/sections/ajax/bookmarks/artists.php @@ -6,7 +6,7 @@ if (!$Viewer->permitted('users_override_paranoia')) { json_die('failure'); } - $user = (new Gazelle\Manager\User)->findById((int)$_GET['userid']); + $user = (new Gazelle\Manager\User())->findById((int)$_GET['userid']); if (is_null($user)) { json_die('failure'); } diff --git a/sections/ajax/bookmarks/torrents.php b/sections/ajax/bookmarks/torrents.php index 0e7d50d88..1e6cdbece 100644 --- a/sections/ajax/bookmarks/torrents.php +++ b/sections/ajax/bookmarks/torrents.php @@ -8,7 +8,7 @@ if (!$Viewer->permitted('users_override_paranoia')) { json_error('bad parameters'); } - $user = (new Gazelle\Manager\User)->findById((int)($_GET['userid'] ?? 0)); + $user = (new Gazelle\Manager\User())->findById((int)($_GET['userid'] ?? 0)); if (is_null($user)) { json_error('bad parameters'); } @@ -16,8 +16,8 @@ echo (new Gazelle\Json\Bookmark\TGroup( new Gazelle\User\Bookmark($user), - new Gazelle\Manager\TGroup, - new Gazelle\Manager\Torrent) + new Gazelle\Manager\TGroup(), + new Gazelle\Manager\Torrent()) ) ->setVersion(2) ->response(); diff --git a/sections/ajax/browse.php b/sections/ajax/browse.php index 0d8c1d6f4..5afc52490 100644 --- a/sections/ajax/browse.php +++ b/sections/ajax/browse.php @@ -10,8 +10,8 @@ $Page = (int)($_GET['page'] ?? 1); $Search = new Gazelle\Search\Torrent( - new Gazelle\Manager\TGroup, - new Gazelle\Manager\Torrent, + new Gazelle\Manager\TGroup(), + new Gazelle\Manager\Torrent(), $GroupResults, $OrderBy, $OrderWay, @@ -39,9 +39,9 @@ echo (new Gazelle\Json\TGroupList( new Gazelle\User\Bookmark($Viewer), $Viewer->snatch(), - new Gazelle\Manager\Artist, - (new Gazelle\Manager\TGroup)->setViewer($Viewer), - (new Gazelle\Manager\Torrent)->setViewer($Viewer), + new Gazelle\Manager\Artist(), + (new Gazelle\Manager\TGroup())->setViewer($Viewer), + (new Gazelle\Manager\Torrent())->setViewer($Viewer), $Results, $GroupResults, $resultTotal, diff --git a/sections/ajax/collage.php b/sections/ajax/collage.php index eb101faa6..1a316422c 100644 --- a/sections/ajax/collage.php +++ b/sections/ajax/collage.php @@ -1,6 +1,6 @@ findById((int)($_GET['id'] ?? 0)); +$collage = (new Gazelle\Manager\Collage())->findById((int)($_GET['id'] ?? 0)); if (is_null($collage)) { json_die('bad parameters'); } @@ -8,8 +8,8 @@ echo (new Gazelle\Json\Collage( $collage, $Viewer, - new Gazelle\Manager\TGroup, - new Gazelle\Manager\Torrent + new Gazelle\Manager\TGroup(), + new Gazelle\Manager\Torrent() )) ->setVersion(2) ->response(); diff --git a/sections/ajax/forum/forum.php b/sections/ajax/forum/forum.php index c11e37bf8..7f1a24067 100644 --- a/sections/ajax/forum/forum.php +++ b/sections/ajax/forum/forum.php @@ -12,7 +12,7 @@ //---------- Things to sort out before it can start printing/generating content // Check for lame SQL injection attempts -$forum = (new Gazelle\Manager\Forum)->findById((int)$_GET['forumid']); +$forum = (new Gazelle\Manager\Forum())->findById((int)$_GET['forumid']); if (is_null($forum)) { print json_die(['status' => 'failure']); } @@ -56,7 +56,7 @@ $JsonTopics = []; $userCache = []; -$userMan = new Gazelle\Manager\User; +$userMan = new Gazelle\Manager\User(); foreach ($threadList as $thread) { [$threadId, $Title, $AuthorID, $Locked, $Sticky, $PostCount, $LastID, $LastTime, $LastAuthorID] = array_values($thread); diff --git a/sections/ajax/forum/main.php b/sections/ajax/forum/main.php index dc00caeca..397ff6749 100644 --- a/sections/ajax/forum/main.php +++ b/sections/ajax/forum/main.php @@ -1,10 +1,10 @@ id() => $Viewer]; $category = []; -$forumList = (new Gazelle\Manager\Forum)->forumList(); +$forumList = (new Gazelle\Manager\Forum())->forumList(); foreach ($forumList as $forumId) { $forum = new Gazelle\Forum($forumId); if (!$Viewer->readAccess($forum)) { diff --git a/sections/ajax/forum/thread.php b/sections/ajax/forum/thread.php index ba615e50b..91500670d 100644 --- a/sections/ajax/forum/thread.php +++ b/sections/ajax/forum/thread.php @@ -9,7 +9,7 @@ ********************************************************************************/ -$userMan = new Gazelle\Manager\User; +$userMan = new Gazelle\Manager\User(); //---------- Things to sort out before it can start printing/generating content @@ -19,14 +19,14 @@ } if (isset($_GET['postid'])) { - $post = (new Gazelle\Manager\ForumPost)->findById((int)$_GET['postid']); + $post = (new Gazelle\Manager\ForumPost())->findById((int)$_GET['postid']); if (is_null($post)) { json_error('bad post id'); } $thread = $post->thread(); } elseif (isset($_GET['threadid'])) { $post = false; - $thread = (new Gazelle\Manager\ForumThread)->findById((int)$_GET['threadid']); + $thread = (new Gazelle\Manager\ForumThread())->findById((int)$_GET['threadid']); if (is_null($thread)) { json_error('bad thread id'); } diff --git a/sections/ajax/inbox/inbox.php b/sections/ajax/inbox/inbox.php index 0106a2237..3725c776d 100644 --- a/sections/ajax/inbox/inbox.php +++ b/sections/ajax/inbox/inbox.php @@ -5,7 +5,7 @@ $_GET['type'] ?? 'inbox', (int)($_GET['page'] ?? 1), ($_GET['sort'] ?? 'unread') === 'unread', - new Gazelle\Manager\User, + new Gazelle\Manager\User(), ); if (!empty($_GET['search'])) { diff --git a/sections/ajax/inbox/viewconv.php b/sections/ajax/inbox/viewconv.php index 3e245aad0..9cbdca600 100644 --- a/sections/ajax/inbox/viewconv.php +++ b/sections/ajax/inbox/viewconv.php @@ -6,4 +6,4 @@ } $pm->markRead(); -echo (new Gazelle\Json\PM($pm, new Gazelle\Manager\User))->response(); +echo (new Gazelle\Json\PM($pm, new Gazelle\Manager\User()))->response(); diff --git a/sections/ajax/info.php b/sections/ajax/info.php index 97c363a0a..9be007317 100644 --- a/sections/ajax/info.php +++ b/sections/ajax/info.php @@ -12,8 +12,8 @@ $Ratio = number_format(max($Viewer->uploadedSize() / $Viewer->downloadedSize() - 0.005, 0), 2); //Subtract .005 to floor to 2 decimals } -$ClassLevels = (new \Gazelle\Manager\User)->classLevelList(); -$latestBlog = (new \Gazelle\Manager\Blog)->latest(); +$ClassLevels = (new \Gazelle\Manager\User())->classLevelList(); +$latestBlog = (new \Gazelle\Manager\Blog())->latest(); json_print("success", [ 'username' => $Viewer->username(), @@ -23,8 +23,8 @@ 'notifications' => [ 'messages' => $Viewer->inbox()->unreadTotal(), 'notifications' => (new \Gazelle\User\Notification\Torrent($Viewer))->unread(), - 'newAnnouncement' => (new \Gazelle\Manager\News)->latestId() < (new \Gazelle\WitnessTable\UserReadNews)->lastRead($Viewer), - 'newBlog' => $latestBlog && $latestBlog->createdEpoch() < (new \Gazelle\WitnessTable\UserReadBlog)->lastRead($Viewer), + 'newAnnouncement' => (new \Gazelle\Manager\News())->latestId() < (new \Gazelle\WitnessTable\UserReadNews())->lastRead($Viewer), + 'newBlog' => $latestBlog && $latestBlog->createdEpoch() < (new \Gazelle\WitnessTable\UserReadBlog())->lastRead($Viewer), 'newSubscriptions' => (new \Gazelle\User\Subscription($Viewer))->unread() > 0, ], 'userstats' => [ diff --git a/sections/ajax/notifications.php b/sections/ajax/notifications.php index c909dba9f..57104da23 100644 --- a/sections/ajax/notifications.php +++ b/sections/ajax/notifications.php @@ -7,7 +7,7 @@ echo (new Gazelle\Json\Notification\Torrent( new Gazelle\User\Notification\Torrent($Viewer), new Gazelle\Util\Paginator(TORRENTS_PER_PAGE, (int)($_GET['page'] ?? 1)), - new Gazelle\Manager\Torrent, + new Gazelle\Manager\Torrent(), )) ->setVersion(2) ->response(); diff --git a/sections/ajax/password_validate.php b/sections/ajax/password_validate.php index 9a6a2d26a..3dee54bc1 100644 --- a/sections/ajax/password_validate.php +++ b/sections/ajax/password_validate.php @@ -1,3 +1,3 @@ checkPassword($_REQUEST['password'] ?? ''); +echo (new Gazelle\Manager\User())->checkPassword($_REQUEST['password'] ?? ''); diff --git a/sections/ajax/post_edit.php b/sections/ajax/post_edit.php index bf023f7ec..2fe4e33d9 100644 --- a/sections/ajax/post_edit.php +++ b/sections/ajax/post_edit.php @@ -17,7 +17,7 @@ die("bad depth"); } -$commentMan = new Gazelle\Manager\Comment; +$commentMan = new Gazelle\Manager\Comment(); $history = $commentMan->loadEdits($pageType, $postId); [$userId, $editTime] = $history[$depth]; @@ -25,7 +25,7 @@ $body = $history[$depth - 1][2]; } else { $body = match ($pageType) { - 'forums' => (new Gazelle\Manager\ForumPost)->findById($postId)->body(), + 'forums' => (new Gazelle\Manager\ForumPost())->findById($postId)->body(), default => $commentMan->findById($postId)->body(), }; } diff --git a/sections/ajax/raw_bbcode.php b/sections/ajax/raw_bbcode.php index 6a496b9bf..d028790aa 100644 --- a/sections/ajax/raw_bbcode.php +++ b/sections/ajax/raw_bbcode.php @@ -1,6 +1,6 @@ findById((int)($_GET['postid'] ?? 0)); +$post = (new Gazelle\Manager\ForumPost())->findById((int)($_GET['postid'] ?? 0)); if (is_null($post)) { json_die("failure", "empty postid"); } elseif (!$Viewer->readAccess($post->thread()->forum())) { diff --git a/sections/ajax/request.php b/sections/ajax/request.php index 43551ba7d..7a7bd0caa 100644 --- a/sections/ajax/request.php +++ b/sections/ajax/request.php @@ -1,6 +1,6 @@ findById((int)($_GET['id'] ?? 0)); +$request = (new Gazelle\Manager\Request())->findById((int)($_GET['id'] ?? 0)); if (is_null($request)) { json_die("failure"); } @@ -10,7 +10,7 @@ $Viewer, new Gazelle\User\Bookmark($Viewer), new Gazelle\Comment\Request($request->id(), (int)($_GET['page'] ?? 1), (int)($_GET['post'] ?? 0)), - new Gazelle\Manager\User, + new Gazelle\Manager\User(), )) ->setVersion(2) ->response(); diff --git a/sections/ajax/requests.php b/sections/ajax/requests.php index 6d4b97dfe..d07f6a972 100644 --- a/sections/ajax/requests.php +++ b/sections/ajax/requests.php @@ -1,8 +1,8 @@ setCategory($_GET['filter_cat'] ?? []) - ->setReleaseType($_GET['releases'] ?? [], (new \Gazelle\ReleaseType)->list()); + ->setReleaseType($_GET['releases'] ?? [], (new \Gazelle\ReleaseType())->list()); if (!isset($_GET['show_filled'])) { $search->showUnfilled(); diff --git a/sections/ajax/riplog.php b/sections/ajax/riplog.php index 2ccd36ef2..effd00507 100644 --- a/sections/ajax/riplog.php +++ b/sections/ajax/riplog.php @@ -4,7 +4,7 @@ if (!$logId) { json_error('missing logid parameter'); } -$torrent = (new Gazelle\Manager\Torrent)->findById((int)($_GET['id'] ?? 0)); +$torrent = (new Gazelle\Manager\Torrent())->findById((int)($_GET['id'] ?? 0)); if (is_null($torrent)) { json_error('torrent not found'); } diff --git a/sections/ajax/similar_artists.php b/sections/ajax/similar_artists.php index fdc354851..6c62f4d20 100644 --- a/sections/ajax/similar_artists.php +++ b/sections/ajax/similar_artists.php @@ -1,7 +1,7 @@ findById((int)($_GET['id'] ?? 0)); +$artist = (new Gazelle\Manager\Artist())->findById((int)($_GET['id'] ?? 0)); if (is_null($artist) || !$limit) { print json_die('failure'); } diff --git a/sections/ajax/stats.php b/sections/ajax/stats.php index 5cd3b8ea8..04823f4be 100644 --- a/sections/ajax/stats.php +++ b/sections/ajax/stats.php @@ -1,9 +1,9 @@ setVersion(2) ->response(); diff --git a/sections/ajax/stats/torrents.php b/sections/ajax/stats/torrents.php index d017f829f..34cb954ae 100644 --- a/sections/ajax/stats/torrents.php +++ b/sections/ajax/stats/torrents.php @@ -1,5 +1,5 @@ setVersion(2) ->response(); diff --git a/sections/ajax/stats/users.php b/sections/ajax/stats/users.php index 0ac98e120..0b4f8908b 100644 --- a/sections/ajax/stats/users.php +++ b/sections/ajax/stats/users.php @@ -1,5 +1,5 @@ setVersion(2) ->response(); diff --git a/sections/ajax/subscriptions.php b/sections/ajax/subscriptions.php index 908121898..40c941469 100644 --- a/sections/ajax/subscriptions.php +++ b/sections/ajax/subscriptions.php @@ -6,7 +6,7 @@ $showUnread = (bool)($_GET['showunread'] ?? true); -$forMan = new Gazelle\Manager\Forum; +$forMan = new Gazelle\Manager\Forum(); $paginator = new Gazelle\Util\Paginator($Viewer->postsPerPage(), (int)($_GET['page'] ?? 1)); $paginator->setTotal( $showUnread ? $forMan->unreadSubscribedForumTotal($Viewer) : $forMan->subscribedForumTotal($Viewer) diff --git a/sections/ajax/tcomments.php b/sections/ajax/tcomments.php index 8a207dd1b..bde6c41f7 100644 --- a/sections/ajax/tcomments.php +++ b/sections/ajax/tcomments.php @@ -8,7 +8,7 @@ $thread = $commentPage->load()->thread(); $userCache = []; -$userMan = new Gazelle\Manager\User; +$userMan = new Gazelle\Manager\User(); $JsonComments = []; foreach ($thread as $Post) { diff --git a/sections/ajax/top10/tags.php b/sections/ajax/top10/tags.php index d697a7e2e..0bdb9690f 100644 --- a/sections/ajax/top10/tags.php +++ b/sections/ajax/top10/tags.php @@ -13,7 +13,7 @@ echo (new Gazelle\Json\Top10\Tag( details: $details, limit: $limit, - manager: new Gazelle\Manager\Tag, + manager: new Gazelle\Manager\Tag(), )) ->setVersion(2) ->response(); diff --git a/sections/ajax/top10/torrents.php b/sections/ajax/top10/torrents.php index 351af5522..0216eea8e 100644 --- a/sections/ajax/top10/torrents.php +++ b/sections/ajax/top10/torrents.php @@ -6,7 +6,7 @@ $limit = in_array($limit, [10, 100, 250]) && $details !== 'all' ? $limit : 10; $top10 = new Gazelle\Top10\Torrent(FORMAT, $Viewer); -$torMan = new Gazelle\Manager\Torrent; +$torMan = new Gazelle\Manager\Torrent(); $result = []; // Filter out common parameters that are not needed in getTopTorrents to get more cache hits diff --git a/sections/ajax/top10/users.php b/sections/ajax/top10/users.php index f0632eb4c..8eaa66729 100644 --- a/sections/ajax/top10/users.php +++ b/sections/ajax/top10/users.php @@ -13,8 +13,8 @@ echo (new Gazelle\Json\Top10\User( details: $details, limit: $limit, - stats: new Gazelle\Stats\Users, - userMan: new Gazelle\Manager\User, + stats: new Gazelle\Stats\Users(), + userMan: new Gazelle\Manager\User(), )) ->setVersion(2) ->response(); diff --git a/sections/ajax/torrent.php b/sections/ajax/torrent.php index 8fcfc1dd9..926fd573b 100644 --- a/sections/ajax/torrent.php +++ b/sections/ajax/torrent.php @@ -3,14 +3,14 @@ if (isset($_GET['id']) && isset($_GET['hash'])) { json_error('bad parameters'); } elseif (isset($_GET['hash'])) { - $torrent = (new Gazelle\Manager\Torrent)->findByInfohash($_GET['hash'] ?? ''); + $torrent = (new Gazelle\Manager\Torrent())->findByInfohash($_GET['hash'] ?? ''); } else { - $torrent = (new Gazelle\Manager\Torrent)->findById((int)$_GET['id']); + $torrent = (new Gazelle\Manager\Torrent())->findById((int)$_GET['id']); } if (is_null($torrent)) { json_error('bad parameters'); } -echo (new Gazelle\Json\Torrent($torrent, $Viewer, new Gazelle\Manager\Torrent)) +echo (new Gazelle\Json\Torrent($torrent, $Viewer, new Gazelle\Manager\Torrent())) ->setVersion(5) ->response(); diff --git a/sections/ajax/torrent_remove_cover_art.php b/sections/ajax/torrent_remove_cover_art.php index 2c51c8054..ab4f9f148 100644 --- a/sections/ajax/torrent_remove_cover_art.php +++ b/sections/ajax/torrent_remove_cover_art.php @@ -4,13 +4,13 @@ if (!$Viewer->permitted('site_edit_wiki')) { json_die('failure', 'forbidden'); } -$tgroup = (new Gazelle\Manager\TGroup)->findById((int)$_GET['groupid']); +$tgroup = (new Gazelle\Manager\TGroup())->findById((int)$_GET['groupid']); $coverId = (int)$_GET['id']; if (!$coverId || is_null($tgroup)) { json_die('failure', 'bad parameters'); } -if ($tgroup->removeCoverArt($coverId, $Viewer, new Gazelle\Log)) { +if ($tgroup->removeCoverArt($coverId, $Viewer, new Gazelle\Log())) { json_print("success", ['id' => $coverId]); } else { json_die('failure', 'bad coverId'); diff --git a/sections/ajax/torrent_tag_add.php b/sections/ajax/torrent_tag_add.php index 8af767a42..7b8c2f813 100644 --- a/sections/ajax/torrent_tag_add.php +++ b/sections/ajax/torrent_tag_add.php @@ -8,7 +8,7 @@ authorize(); } -$tgMan = new Gazelle\Manager\TGroup; +$tgMan = new Gazelle\Manager\TGroup(); $tgroup = $tgMan->findById((int)($_REQUEST['groupid'] ?? 0)); if (is_null($tgroup)) { json_or_error('invalid groupid', 0); @@ -21,7 +21,7 @@ $added = []; $rejected = []; -$tagMan = new \Gazelle\Manager\Tag; +$tagMan = new \Gazelle\Manager\Tag(); $Tags = array_unique(explode(',', $_REQUEST['tagname'])); foreach ($Tags as $tagName) { @@ -45,7 +45,7 @@ $tagMan->createTorrentTagVote($tagId, $tgroup, $Viewer, 'up'); $added[] = $resolved; - (new Gazelle\Log)->group($tgroup, $Viewer, "Tag \"$resolved\" added to group"); + (new Gazelle\Log())->group($tgroup, $Viewer, "Tag \"$resolved\" added to group"); } } diff --git a/sections/ajax/torrent_tag_remove.php b/sections/ajax/torrent_tag_remove.php index 1ca06cd1f..2fd61cc0d 100644 --- a/sections/ajax/torrent_tag_remove.php +++ b/sections/ajax/torrent_tag_remove.php @@ -4,8 +4,8 @@ if ($Viewer->disableTagging() || !$Viewer->permitted('site_delete_tag')) { error(403); } -$tagMan = new Gazelle\Manager\Tag; -$tgMan = new Gazelle\Manager\TGroup; +$tagMan = new Gazelle\Manager\Tag(); +$tgMan = new Gazelle\Manager\TGroup(); $tag = $tagMan->findById((int)$_GET['tagid']); $tgroup = $tgMan->findById((int)$_GET['groupid']); @@ -19,7 +19,7 @@ $Cache->cache_value('deleted_tags_' . $tgroup->id() . '_' . $Viewer->id(), $tagName, 300); // Log the removal and if it was the last occurrence. - $logger = new Gazelle\Log; + $logger = new Gazelle\Log(); $logger->group($tgroup, $Viewer, "Tag \"$tagName\" removed"); if (!$tagMan->findById($tag->id())) { $logger->general("Unused tag \"$tagName\" removed by user {$Viewer->label()}"); diff --git a/sections/ajax/torrentgroup.php b/sections/ajax/torrentgroup.php index 6c9f92021..36629571c 100644 --- a/sections/ajax/torrentgroup.php +++ b/sections/ajax/torrentgroup.php @@ -6,7 +6,7 @@ json_error('bad parameters'); } -$tgMan = new Gazelle\Manager\TGroup; +$tgMan = new Gazelle\Manager\TGroup(); $tgroup = $infohash ? $tgMan->findByTorrentInfohash($infohash) : $tgMan->findById($groupId); @@ -15,5 +15,5 @@ json_error('bad parameters'); } -echo (new Gazelle\Json\TGroup($tgroup, $Viewer, (new \Gazelle\Manager\Torrent)->setViewer($Viewer))) +echo (new Gazelle\Json\TGroup($tgroup, $Viewer, (new \Gazelle\Manager\Torrent())->setViewer($Viewer))) ->response(); diff --git a/sections/ajax/torrentgroupalbumart.php b/sections/ajax/torrentgroupalbumart.php index a07d29b51..8e2594e2e 100644 --- a/sections/ajax/torrentgroupalbumart.php +++ b/sections/ajax/torrentgroupalbumart.php @@ -1,6 +1,6 @@ findById((int)$_GET['id']); +$tgroup = (new Gazelle\Manager\TGroup())->findById((int)$_GET['id']); if (is_null($tgroup)) { json_die('failure', 'bad id parameter'); } diff --git a/sections/ajax/upload.php b/sections/ajax/upload.php index 166f5fb5f..d3511db72 100644 --- a/sections/ajax/upload.php +++ b/sections/ajax/upload.php @@ -11,8 +11,8 @@ echo $uploadForm->albumReleaseJS(); } else { echo $uploadForm->music_form( - (new Gazelle\Manager\Tag)->genreList(), - new Gazelle\Manager\TGroup, + (new Gazelle\Manager\Tag())->genreList(), + new Gazelle\Manager\TGroup(), ); } break; diff --git a/sections/ajax/user.php b/sections/ajax/user.php index 785d687d5..6dc262f49 100644 --- a/sections/ajax/user.php +++ b/sections/ajax/user.php @@ -1,6 +1,6 @@ findById((int)$_GET['id']); +$user = (new Gazelle\Manager\User())->findById((int)$_GET['id']); if (is_null($user)) { json_die("failure", "bad id parameter"); } diff --git a/sections/ajax/user_recents.php b/sections/ajax/user_recents.php index 578fbfe93..f3d3a675d 100644 --- a/sections/ajax/user_recents.php +++ b/sections/ajax/user_recents.php @@ -1,6 +1,6 @@ findById((int)($_GET['userid'] ?? 0)); +$user = (new Gazelle\Manager\User())->findById((int)($_GET['userid'] ?? 0)); if (is_null($user)) { json_error("bad userid"); } @@ -9,7 +9,7 @@ json_error("bad limit"); } -echo (new Gazelle\Json\UserRecent($user, $Viewer, new Gazelle\Manager\TGroup)) +echo (new Gazelle\Json\UserRecent($user, $Viewer, new Gazelle\Manager\TGroup())) ->setLimit($limit) ->setVersion(2) ->response(); diff --git a/sections/ajax/userhistory/post_history.php b/sections/ajax/userhistory/post_history.php index 88ec31263..a336bd118 100644 --- a/sections/ajax/userhistory/post_history.php +++ b/sections/ajax/userhistory/post_history.php @@ -4,7 +4,7 @@ json_error('You do not have access to the forums!'); } -$user = empty($_GET['userid']) ? $Viewer : (new Gazelle\Manager\User)->findById((int)$_GET['userid']); +$user = empty($_GET['userid']) ? $Viewer : (new Gazelle\Manager\User())->findById((int)$_GET['userid']); if (is_null($user)) { json_error('User does not exist!'); } @@ -17,6 +17,6 @@ echo (new Gazelle\Json\PostHistory( $forumSearch, - new Gazelle\Manager\User, + new Gazelle\Manager\User(), new Gazelle\Util\Paginator($Viewer->postsPerPage(), (int)($_GET['page'] ?? 1)) ))->response(); diff --git a/sections/ajax/usersearch.php b/sections/ajax/usersearch.php index a29935114..028f14ee3 100644 --- a/sections/ajax/usersearch.php +++ b/sections/ajax/usersearch.php @@ -9,7 +9,7 @@ echo (new Gazelle\Json\UserSearch( $search, $Viewer, - new Gazelle\Manager\User, + new Gazelle\Manager\User(), new Gazelle\Util\Paginator(AJAX_USERS_PER_PAGE, (int)($_GET['page'] ?? 1)), )) ->setVersion(2) diff --git a/sections/ajax/wiki.php b/sections/ajax/wiki.php index f142f5a30..73db60efb 100644 --- a/sections/ajax/wiki.php +++ b/sections/ajax/wiki.php @@ -1,6 +1,6 @@ findById((int)$_GET['id']); } elseif (isset($_GET['name'])) { @@ -24,7 +24,7 @@ 'body' => Text::full_format($wiki->body(), false), 'aliases' => $wiki->alias(), 'authorID' => $wiki->authorId(), - 'authorName' => (new Gazelle\Manager\User)->findById($wiki->authorId())?->username(), + 'authorName' => (new Gazelle\Manager\User())->findById($wiki->authorId())?->username(), 'date' => $wiki->date(), 'revision' => $wiki->revision(), ]); diff --git a/sections/api/index.php b/sections/api/index.php index 8e5bcce1a..975da0d2a 100644 --- a/sections/api/index.php +++ b/sections/api/index.php @@ -3,7 +3,7 @@ if (empty($_GET['aid']) || empty($_GET['token'])) { json_error('invalid parameters'); } -if (!(new Gazelle\API)->validateToken((int)($_GET['aid'] ?? 0), $_GET['token'] ?? '')) { +if (!(new Gazelle\API())->validateToken((int)($_GET['aid'] ?? 0), $_GET['token'] ?? '')) { json_error('invalid token'); } $className = "Gazelle\\API\\" . str_replace("_", "", ucwords($_GET['action'], "_")); @@ -12,7 +12,7 @@ } $api = new $className([ - 'ReleaseTypes' => (new \Gazelle\ReleaseType)->list(), + 'ReleaseTypes' => (new \Gazelle\ReleaseType())->list(), 'Debug' => $Debug, ]); diff --git a/sections/apply/admin.php b/sections/apply/admin.php index 6ca120740..ad026c70f 100644 --- a/sections/apply/admin.php +++ b/sections/apply/admin.php @@ -1,6 +1,6 @@ permitted('admin_manage_applicants')) { $list = $appRoleMan->list(); // everything, including archived roles } else { diff --git a/sections/apply/apply.php b/sections/apply/apply.php index 56b571a78..e1f61332c 100644 --- a/sections/apply/apply.php +++ b/sections/apply/apply.php @@ -1,7 +1,7 @@ findById((int)($_GET['id'] ?? 0)); +$role = (new Gazelle\Manager\ApplicantRole())->findById((int)($_GET['id'] ?? 0)); if (is_null($role)) { error(404); } @@ -27,7 +27,7 @@ } } -$userMan = new Gazelle\Manager\User; +$userMan = new Gazelle\Manager\User(); echo $Twig->render('applicant/role.twig', [ 'text' => new Gazelle\Util\Textarea('description', $role->description()), diff --git a/sections/apply/view.php b/sections/apply/view.php index 4ffa6f478..29648417f 100644 --- a/sections/apply/view.php +++ b/sections/apply/view.php @@ -1,6 +1,6 @@ findById((int)$_GET['id']); if (is_null($app)) { diff --git a/sections/artist/add_alias.php b/sections/artist/add_alias.php index c924d48ca..5c0c1ffbf 100644 --- a/sections/artist/add_alias.php +++ b/sections/artist/add_alias.php @@ -11,7 +11,7 @@ error('You must supply an alias for this artist.'); } -$artMan = new Gazelle\Manager\Artist; +$artMan = new Gazelle\Manager\Artist(); $artist = $artMan->findById((int)$_POST['artistid']); if (is_null($artist)) { error(404); @@ -53,7 +53,7 @@ ]); exit; } - $artist->clearAliasFromArtist($CloneAliasID, $Viewer, new Gazelle\Log); + $artist->clearAliasFromArtist($CloneAliasID, $Viewer, new Gazelle\Log()); } } @@ -66,7 +66,7 @@ error('Redirection must target an alias for the current artist.'); } } - $artist->addAlias($aliasName, $redirectId, $Viewer, new Gazelle\Log); + $artist->addAlias($aliasName, $redirectId, $Viewer, new Gazelle\Log()); } header("Location:" . redirectUrl("artist.php?action=edit&artistid={$artistId}")); diff --git a/sections/artist/add_similar.php b/sections/artist/add_similar.php index d0d1f5c80..29ccddfcb 100644 --- a/sections/artist/add_similar.php +++ b/sections/artist/add_similar.php @@ -4,7 +4,7 @@ authorize(); } -$artistMan = new Gazelle\Manager\Artist; +$artistMan = new Gazelle\Manager\Artist(); $artist = $artistMan->findById((int)($_POST['artistid'] ?? 0)); if (is_null($artist)) { if (defined('AJAX')) { @@ -24,7 +24,7 @@ } } } -$artist->similar()->addSimilar($other, $Viewer, new Gazelle\Log); +$artist->similar()->addSimilar($other, $Viewer, new Gazelle\Log()); if (defined('AJAX')) { json_print('success', [ diff --git a/sections/artist/artist.php b/sections/artist/artist.php index 4411a255f..f57d97a5a 100644 --- a/sections/artist/artist.php +++ b/sections/artist/artist.php @@ -1,7 +1,7 @@ findByIdAndRevision((int)($_GET['id'] ?? 0), $RevisionID) : $artistMan->findById((int)($_GET['id'] ?? 0)); @@ -12,17 +12,17 @@ $artistId = $Artist->id(); $bookmark = new Gazelle\User\Bookmark($Viewer); -$collageMan = new Gazelle\Manager\Collage; -$tgMan = (new Gazelle\Manager\TGroup)->setViewer($Viewer); -$torMan = (new Gazelle\Manager\Torrent)->setViewer($Viewer); +$collageMan = new Gazelle\Manager\Collage(); +$tgMan = (new Gazelle\Manager\TGroup())->setViewer($Viewer); +$torMan = (new Gazelle\Manager\Torrent())->setViewer($Viewer); $stats = new Gazelle\Stats\Artist($artistId); -$userMan = new Gazelle\Manager\User; +$userMan = new Gazelle\Manager\User(); $vote = new Gazelle\User\Vote($Viewer); $authKey = $Viewer->auth(); $isSubscribed = (new Gazelle\User\Subscription($Viewer))->isSubscribedComments('artist', $artistId); $name = $Artist->name(); -$requestList = $Viewer->disableRequests() ? [] : (new Gazelle\Manager\Request)->findByArtist($Artist); +$requestList = $Viewer->disableRequests() ? [] : (new Gazelle\Manager\Request())->findByArtist($Artist); View::show_header($name, ['js' => 'browse,requests,bbcode,comments,voting,subscriptions']); ?> diff --git a/sections/artist/change_artistid.php b/sections/artist/change_artistid.php index cb87922a0..ebf91837a 100644 --- a/sections/artist/change_artistid.php +++ b/sections/artist/change_artistid.php @@ -5,7 +5,7 @@ } authorize(); -$artMan = new Gazelle\Manager\Artist; +$artMan = new Gazelle\Manager\Artist(); $artist = $artMan->findById((int)($_POST['artistid'] ?? 0)); if (is_null($artist)) { error('Please select a valid artist to change.'); @@ -26,11 +26,11 @@ $new->merge( $artist, $Viewer, - new \Gazelle\Manager\Collage, - new \Gazelle\Manager\Comment, - new \Gazelle\Manager\Request, - new \Gazelle\Manager\TGroup, - new \Gazelle\Log, + new \Gazelle\Manager\Collage(), + new \Gazelle\Manager\Comment(), + new \Gazelle\Manager\Request(), + new \Gazelle\Manager\TGroup(), + new \Gazelle\Log(), ); header("Location: artist.php?action=edit&artistid={$new->id()}"); exit; diff --git a/sections/artist/delete.php b/sections/artist/delete.php index 290a8bfdf..14cceec56 100644 --- a/sections/artist/delete.php +++ b/sections/artist/delete.php @@ -5,15 +5,15 @@ } authorize(); -$artist = (new Gazelle\Manager\Artist)->findById((int)($_GET['artistid'] ?? 0)); +$artist = (new Gazelle\Manager\Artist())->findById((int)($_GET['artistid'] ?? 0)); if (is_null($artist)) { error(404); } -$tgMan = new Gazelle\Manager\TGroup; +$tgMan = new Gazelle\Manager\TGroup(); $tgroupList = array_map(fn ($id) => $tgMan->findById($id), $artist->tgroupIdUsage()); -$reqMan = new Gazelle\Manager\Request; +$reqMan = new Gazelle\Manager\Request(); $requestList = array_map(fn ($id) => $reqMan->findById($id), $artist->requestIdUsage()); if (count($tgroupList) + count($requestList) > 0) { @@ -26,7 +26,7 @@ } $name = $artist->name(); -$artist->remove($Viewer, new Gazelle\Log); +$artist->remove($Viewer, new Gazelle\Log()); echo $Twig->render('artist/remove-success.twig', [ 'name' => $name, diff --git a/sections/artist/delete_alias.php b/sections/artist/delete_alias.php index 755482c86..025b3551f 100644 --- a/sections/artist/delete_alias.php +++ b/sections/artist/delete_alias.php @@ -5,7 +5,7 @@ } authorize(); -$artMan = new Gazelle\Manager\Artist; +$artMan = new Gazelle\Manager\Artist(); $aliasId = (int)$_GET['aliasid']; $artist = $artMan->findByAliasId($aliasId); if (is_null($artist)) { @@ -16,7 +16,7 @@ error("The alias $aliasId is the only alias for this artist; removing it would cause bad things to happen."); } -$tgroupList = $artMan->tgroupList($aliasId, new Gazelle\Manager\TGroup); +$tgroupList = $artMan->tgroupList($aliasId, new Gazelle\Manager\TGroup()); if ($tgroupList) { echo $Twig->render('artist/tgroup-usage.twig', [ 'artist' => $artist, @@ -25,6 +25,6 @@ exit; } -$artist->removeAlias($aliasId, $Viewer, new Gazelle\Log); +$artist->removeAlias($aliasId, $Viewer, new Gazelle\Log()); header("Location: " . redirectUrl("artist.php?action=edit&artistid={$artist->id()}")); diff --git a/sections/artist/delete_similar.php b/sections/artist/delete_similar.php index 8889ab426..37c1d030a 100644 --- a/sections/artist/delete_similar.php +++ b/sections/artist/delete_similar.php @@ -6,12 +6,12 @@ error(403); } -$artistMan = new Gazelle\Manager\Artist; +$artistMan = new Gazelle\Manager\Artist(); $artist = $artistMan->findById((int)($_GET['artistid'] ?? 0)); $similar = $artistMan->findById((int)($_GET['similarid'] ?? 0)); if (is_null($artist) || is_null($similar)) { error(404); } -$artist->similar()->removeSimilar($similar, $Viewer, new Gazelle\Log); +$artist->similar()->removeSimilar($similar, $Viewer, new Gazelle\Log()); header("Location: " . redirectUrl($artist->location())); diff --git a/sections/artist/download.php b/sections/artist/download.php index 4c814069f..a8f4a29df 100644 --- a/sections/artist/download.php +++ b/sections/artist/download.php @@ -6,12 +6,12 @@ if (!isset($_REQUEST['preference']) || count($_REQUEST['list']) === 0) { error(0); } -$artist = (new Gazelle\Manager\Artist)->findById((int)($_REQUEST['artistid'] ?? 0)); +$artist = (new Gazelle\Manager\Artist())->findById((int)($_REQUEST['artistid'] ?? 0)); if (is_null($artist)) { error(404); } -$collector = new Gazelle\Collector\Artist($Viewer, new Gazelle\Manager\Torrent, $artist, (int)$_REQUEST['preference']); +$collector = new Gazelle\Collector\Artist($Viewer, new Gazelle\Manager\Torrent(), $artist, (int)$_REQUEST['preference']); if (!$collector->prepare($_REQUEST['list'])) { error("Nothing to gather, choose some encodings and bitrates!"); } diff --git a/sections/artist/edit.php b/sections/artist/edit.php index 30d8b576b..b2def3715 100644 --- a/sections/artist/edit.php +++ b/sections/artist/edit.php @@ -4,7 +4,7 @@ error(403); } -$artist = (new Gazelle\Manager\Artist)->findById((int)$_GET['artistid']); +$artist = (new Gazelle\Manager\Artist())->findById((int)$_GET['artistid']); if (is_null($artist)) { $id = html_escape($_GET['artistid']); // might not be a number error("Cannot find an artist with the ID $id: See the site log."); diff --git a/sections/artist/edit_handle.php b/sections/artist/edit_handle.php index 2dc74db6a..7e5e6cd96 100644 --- a/sections/artist/edit_handle.php +++ b/sections/artist/edit_handle.php @@ -6,7 +6,7 @@ authorize(); -$artist = (new Gazelle\Manager\Artist)->findById((int)$_POST['artistid']); +$artist = (new Gazelle\Manager\Artist())->findById((int)$_POST['artistid']); if (is_null($artist)) { error(404); } diff --git a/sections/artist/edit_request.php b/sections/artist/edit_request.php index 857a773f1..98d9cc1be 100644 --- a/sections/artist/edit_request.php +++ b/sections/artist/edit_request.php @@ -1,6 +1,6 @@ findById((int)($_GET['artistid'] ?? 0)); +$artist = (new Gazelle\Manager\Artist())->findById((int)($_GET['artistid'] ?? 0)); if (is_null($artist)) { error(404); } diff --git a/sections/artist/edit_request_handle.php b/sections/artist/edit_request_handle.php index 1196a9e6e..390a2b761 100644 --- a/sections/artist/edit_request_handle.php +++ b/sections/artist/edit_request_handle.php @@ -1,12 +1,12 @@ findById((int)($_POST['artistid'] ?? 0)); +$artist = (new Gazelle\Manager\Artist())->findById((int)($_POST['artistid'] ?? 0)); if (is_null($artist)) { error(404); } authorize(); -$thread = (new Gazelle\Manager\ForumThread)->create( +$thread = (new Gazelle\Manager\ForumThread())->create( forum: new Gazelle\Forum(EDITING_FORUM_ID), user: new Gazelle\User(SYSTEM_USER_ID), title: "Editing request – Artist: " . $artist->name(), diff --git a/sections/artist/history.php b/sections/artist/history.php index c3389cb9a..a800ec9e1 100644 --- a/sections/artist/history.php +++ b/sections/artist/history.php @@ -1,6 +1,6 @@ findById((int)$_GET['artistid']); if (is_null($artist)) { error(404); diff --git a/sections/artist/notify.php b/sections/artist/notify.php index 19dab3b2a..577512c87 100644 --- a/sections/artist/notify.php +++ b/sections/artist/notify.php @@ -5,7 +5,7 @@ } authorize(); -$artist = (new Gazelle\Manager\Artist)->findById((int)$_GET['artistid']); +$artist = (new Gazelle\Manager\Artist())->findById((int)$_GET['artistid']); if (is_null($artist)) { error(404); } diff --git a/sections/artist/notify_remove.php b/sections/artist/notify_remove.php index 4b867840b..227ed6420 100644 --- a/sections/artist/notify_remove.php +++ b/sections/artist/notify_remove.php @@ -5,7 +5,7 @@ } authorize(); -$artist = (new Gazelle\Manager\Artist)->findById((int)$_GET['artistid']); +$artist = (new Gazelle\Manager\Artist())->findById((int)$_GET['artistid']); if (is_null($artist)) { error(404); } diff --git a/sections/artist/rename.php b/sections/artist/rename.php index 9055bf155..6b3505961 100644 --- a/sections/artist/rename.php +++ b/sections/artist/rename.php @@ -6,7 +6,7 @@ authorize(); -$artistMan = new Gazelle\Manager\Artist; +$artistMan = new Gazelle\Manager\Artist(); $artist = $artistMan->findById((int)$_POST['artistid']); if (is_null($artist)) { error(404); @@ -26,9 +26,9 @@ $new = $artist->smartRename( $newName, $artistMan, - new Gazelle\Manager\Comment, - new Gazelle\Manager\Request, - new Gazelle\Manager\TGroup, + new Gazelle\Manager\Comment(), + new Gazelle\Manager\Request(), + new Gazelle\Manager\TGroup(), $Viewer, ); diff --git a/sections/artist/vote_similar.php b/sections/artist/vote_similar.php index b51a1034d..88ff87633 100644 --- a/sections/artist/vote_similar.php +++ b/sections/artist/vote_similar.php @@ -5,7 +5,7 @@ error(0); } -$artistMan = new Gazelle\Manager\Artist; +$artistMan = new Gazelle\Manager\Artist(); $artist = $artistMan->findById((int)($_GET['artistid'] ?? 0)); $similar = $artistMan->findById((int)($_GET['similarid'] ?? 0)); if (is_null($artist) || is_null($similar)) { diff --git a/sections/better/better.php b/sections/better/better.php index cd06b8b6f..0bcc299a7 100644 --- a/sections/better/better.php +++ b/sections/better/better.php @@ -1,6 +1,6 @@ permitted('users_override_paranoia')) { $user = $userMan->findById((int)$_GET['userid']); if (is_null($user)) { @@ -19,20 +19,20 @@ } $better = match ($type) { - 'artistcollage' => new Gazelle\Better\ArtistCollage($user, $filter, new Gazelle\Manager\Artist), - 'artistdesc' => new Gazelle\Better\ArtistDescription($user, $filter, new Gazelle\Manager\Artist), - 'artistdiscogs' => new Gazelle\Better\ArtistDiscogs($user, $filter, new Gazelle\Manager\Artist), - 'artistimg' => new Gazelle\Better\ArtistImage($user, $filter, new Gazelle\Manager\Artist), - 'artwork' => new Gazelle\Better\Artwork($user, $filter, (new Gazelle\Manager\TGroup)->setViewer($Viewer)), - 'checksum' => new Gazelle\Better\Checksum($user, $filter, (new Gazelle\Manager\Torrent)->setViewer($Viewer)), - 'single' => new Gazelle\Better\SingleSeeded($user, $filter, (new Gazelle\Manager\Torrent)->setViewer($Viewer)), + 'artistcollage' => new Gazelle\Better\ArtistCollage($user, $filter, new Gazelle\Manager\Artist()), + 'artistdesc' => new Gazelle\Better\ArtistDescription($user, $filter, new Gazelle\Manager\Artist()), + 'artistdiscogs' => new Gazelle\Better\ArtistDiscogs($user, $filter, new Gazelle\Manager\Artist()), + 'artistimg' => new Gazelle\Better\ArtistImage($user, $filter, new Gazelle\Manager\Artist()), + 'artwork' => new Gazelle\Better\Artwork($user, $filter, (new Gazelle\Manager\TGroup())->setViewer($Viewer)), + 'checksum' => new Gazelle\Better\Checksum($user, $filter, (new Gazelle\Manager\Torrent())->setViewer($Viewer)), + 'single' => new Gazelle\Better\SingleSeeded($user, $filter, (new Gazelle\Manager\Torrent())->setViewer($Viewer)), 'files', 'folders', 'lineage', 'tags' - => (new Gazelle\Better\Bad($user, $filter, new Gazelle\Manager\Torrent))->setBadType($type), + => (new Gazelle\Better\Bad($user, $filter, new Gazelle\Manager\Torrent()))->setBadType($type), default => error(0), }; if (isset($_GET['remove']) && $better instanceof Gazelle\Better\Bad && $Viewer->permitted('admin_reports')) { - $torrent = (new Gazelle\Manager\Torrent)->findById((int)$_GET['remove']); + $torrent = (new Gazelle\Manager\Torrent())->findById((int)$_GET['remove']); if ($torrent) { $torrent->removeFlag($better->torrentFlag()); } diff --git a/sections/better/transcode.php b/sections/better/transcode.php index e565795b9..f22d6f6fa 100644 --- a/sections/better/transcode.php +++ b/sections/better/transcode.php @@ -15,7 +15,7 @@ if (!$Viewer->permitted('users_override_paranoia')) { error(403); } - $user = (new Gazelle\Manager\User)->findById((int)$_GET['userid']); + $user = (new Gazelle\Manager\User())->findById((int)$_GET['userid']); if (is_null($user)) { error(404); } @@ -24,7 +24,7 @@ $filter = $_GET['filter'] ?? 'uploaded'; $search = $_GET['search'] ?? null; $target = $_GET['target'] ?? null; -$better = new Gazelle\Search\Transcode($user, new Gazelle\Manager\Torrent); +$better = new Gazelle\Search\Transcode($user, new Gazelle\Manager\Torrent()); switch ($filter) { case 'seeding': diff --git a/sections/blog/blog_page.php b/sections/blog/blog_page.php index d7d836434..8183550da 100644 --- a/sections/blog/blog_page.php +++ b/sections/blog/blog_page.php @@ -1,6 +1,6 @@ permitted('admin_manage_blog')) { @@ -13,7 +13,7 @@ $headlines = $blogMan->headlines(); if ($headlines) { - (new \Gazelle\WitnessTable\UserReadBlog)->witness($Viewer); + (new \Gazelle\WitnessTable\UserReadBlog())->witness($Viewer); } echo $Twig->render('blog/editor.twig', [ diff --git a/sections/blog/dead_thread.php b/sections/blog/dead_thread.php index b98029ff0..4197186a2 100644 --- a/sections/blog/dead_thread.php +++ b/sections/blog/dead_thread.php @@ -5,7 +5,7 @@ } authorize(); -$blog = (new Gazelle\Manager\Blog)->findById((int)($_GET['id'] ?? 0)); +$blog = (new Gazelle\Manager\Blog())->findById((int)($_GET['id'] ?? 0)); if (is_null($blog)) { error('Please provide the ID of a blog post from which to remove the thread link.'); } diff --git a/sections/blog/delete_blog.php b/sections/blog/delete_blog.php index 125f0e56a..3c43bee0e 100644 --- a/sections/blog/delete_blog.php +++ b/sections/blog/delete_blog.php @@ -5,7 +5,7 @@ } authorize(); -$blogMan = new Gazelle\Manager\Blog; +$blogMan = new Gazelle\Manager\Blog(); $blog = $blogMan->findById((int)($_GET['id'] ?? 0)); if (is_null($blog)) { error('You must provide an ID of a blog to delete'); diff --git a/sections/blog/edit_blog_handle.php b/sections/blog/edit_blog_handle.php index a9564c4c8..efefbcda3 100644 --- a/sections/blog/edit_blog_handle.php +++ b/sections/blog/edit_blog_handle.php @@ -15,12 +15,12 @@ error('The title of the blog article must not be empty'); } -$blog = (new Gazelle\Manager\Blog)->findById((int)($_POST['blogid'] ?? 0)); +$blog = (new Gazelle\Manager\Blog())->findById((int)($_POST['blogid'] ?? 0)); if (is_null($blog)) { error(404); } -$manager = new Gazelle\Manager\ForumThread; +$manager = new Gazelle\Manager\ForumThread(); $thread = match ((int)($_POST['thread'] ?? -1)) { -1 => null, 0 => $manager->create( diff --git a/sections/blog/new_blog_handle.php b/sections/blog/new_blog_handle.php index 7ecd9b497..643dacf0e 100644 --- a/sections/blog/new_blog_handle.php +++ b/sections/blog/new_blog_handle.php @@ -17,16 +17,16 @@ $thread = match ((int)($_POST['thread'] ?? -1)) { -1 => null, - 0 => (new Gazelle\Manager\ForumThread)->create( + 0 => (new Gazelle\Manager\ForumThread())->create( forum: new Gazelle\Forum(ANNOUNCEMENT_FORUM_ID), user: $Viewer, title: $title, body: $body, ), - default => (new Gazelle\Manager\ForumThread)->findById((int)$_POST['thread']), + default => (new Gazelle\Manager\ForumThread())->findById((int)$_POST['thread']), }; -$blog = (new Gazelle\Manager\Blog)->create([ +$blog = (new Gazelle\Manager\Blog())->create([ 'title' => $title, 'body' => $body, 'important' => isset($_POST['important']) ? 1 : 0, diff --git a/sections/bonus/bprates.php b/sections/bonus/bprates.php index 4a3a2df23..4041d8ffc 100644 --- a/sections/bonus/bprates.php +++ b/sections/bonus/bprates.php @@ -17,7 +17,7 @@ 'pointspergb' => ['dbColumn' => 'points_per_gb', 'defaultSort' => 'desc', 'text' => 'BP/GB/year'], ]); -$userMan = new Gazelle\Manager\User; +$userMan = new Gazelle\Manager\User(); if (empty($_GET['userid'])) { $user = $Viewer; $ownProfile = true; diff --git a/sections/bonus/history.php b/sections/bonus/history.php index c0f987d38..fa831b1cd 100644 --- a/sections/bonus/history.php +++ b/sections/bonus/history.php @@ -6,7 +6,7 @@ if (!$Viewer->permitted('admin_bp_history')) { error(403); } - $user = (new Gazelle\Manager\User)->findById((int)($_GET['userid'] ?? 0)); + $user = (new Gazelle\Manager\User())->findById((int)($_GET['userid'] ?? 0)); if (is_null($user)) { error(404); } diff --git a/sections/bonus/index.php b/sections/bonus/index.php index bdbe1f554..c1d6b4580 100644 --- a/sections/bonus/index.php +++ b/sections/bonus/index.php @@ -41,7 +41,7 @@ require_once('history.php'); break; case 'cacheflush': - (new \Gazelle\Manager\Bonus)->flushPriceCache(); + (new \Gazelle\Manager\Bonus())->flushPriceCache(); header("Location: bonus.php"); exit; case 'donate': diff --git a/sections/bonus/store.php b/sections/bonus/store.php index e42aea413..c44cbd14a 100644 --- a/sections/bonus/store.php +++ b/sections/bonus/store.php @@ -42,7 +42,7 @@ } $points = (int)$Viewer->bonusPointsTotal(); -$bonusMan = new Gazelle\Manager\Bonus; +$bonusMan = new Gazelle\Manager\Bonus(); $auth = $Viewer->auth(); $pool = $bonusMan->getOpenPool(); if ($pool) { diff --git a/sections/bonus/token_other.php b/sections/bonus/token_other.php index 8df715243..2df01d9b8 100644 --- a/sections/bonus/token_other.php +++ b/sections/bonus/token_other.php @@ -11,7 +11,7 @@ if (empty($_POST['user'])) { error('You have to enter a username to give tokens to.'); } - $user = (new Gazelle\Manager\User)->findByUsername(urldecode($_POST['user'])); + $user = (new Gazelle\Manager\User())->findByUsername(urldecode($_POST['user'])); if (is_null($user)) { error('Nobody with that name found at ' . SITE_NAME . '. Try a user search and give them tokens from their profile page.'); } elseif ($user->id() == $Viewer->id()) { diff --git a/sections/bookmarks/add.php b/sections/bookmarks/add.php index 3fb478cbc..e7f293a87 100644 --- a/sections/bookmarks/add.php +++ b/sections/bookmarks/add.php @@ -9,6 +9,6 @@ } if ($type === 'request') { - (new Gazelle\Manager\Request)->findById($id)?->updateBookmarkStats(); + (new Gazelle\Manager\Request())->findById($id)?->updateBookmarkStats(); } print(json_encode('OK')); diff --git a/sections/bookmarks/artists.php b/sections/bookmarks/artists.php index 9f8c6da48..6729e8e3c 100644 --- a/sections/bookmarks/artists.php +++ b/sections/bookmarks/artists.php @@ -1,6 +1,6 @@ permitted('users_override_paranoia')) { error(403); } - $user = (new Gazelle\Manager\User)->findById((int)($_GET['userid'] ?? 0)); + $user = (new Gazelle\Manager\User())->findById((int)($_GET['userid'] ?? 0)); if (is_null($user)) { error(404); } } -$tgMan = new Gazelle\Manager\TGroup; +$tgMan = new Gazelle\Manager\TGroup(); $list = []; foreach ((new Gazelle\User\Bookmark($user))->tgroupBookmarkList() as $info) { diff --git a/sections/bookmarks/torrents.php b/sections/bookmarks/torrents.php index dca4bbb8c..5a997bdbf 100644 --- a/sections/bookmarks/torrents.php +++ b/sections/bookmarks/torrents.php @@ -11,7 +11,7 @@ if (!$Viewer->permitted('users_override_paranoia')) { error(403); } - $user = (new Gazelle\Manager\User)->findById((int)($_GET['userid'] ?? 0)); + $user = (new Gazelle\Manager\User())->findById((int)($_GET['userid'] ?? 0)); if (is_null($user)) { error(404); } @@ -20,16 +20,16 @@ $bookmark = new Gazelle\User\Bookmark($user); $snatcher = $Viewer->snatch(); -$tgMan = (new Gazelle\Manager\TGroup)->setViewer($Viewer); -$torMan = (new Gazelle\Manager\Torrent)->setViewer($Viewer); -$collMan = (new Gazelle\Manager\Collage)->setImageProxy(new Gazelle\Util\ImageProxy($Viewer)); +$tgMan = (new Gazelle\Manager\TGroup())->setViewer($Viewer); +$torMan = (new Gazelle\Manager\Torrent())->setViewer($Viewer); +$collMan = (new Gazelle\Manager\Collage())->setImageProxy(new Gazelle\Util\ImageProxy($Viewer)); $paginator = new Gazelle\Util\Paginator(200, (int)($_GET['page'] ?? 1)); $paginator->setTotal($bookmark->torrentTotal()); $bookmarkList = $bookmark->torrentList($paginator->limit(), $paginator->offset()); $NumGroups = count($bookmarkList); -$artistLeaderboard = $bookmark->torrentArtistLeaderboard(new Gazelle\Manager\Artist); +$artistLeaderboard = $bookmark->torrentArtistLeaderboard(new Gazelle\Manager\Artist()); $tagLeaderboard = $bookmark->torrentTagLeaderboard(); $CollageCovers = $Viewer->option('CollageCovers') ?? 25; diff --git a/sections/chat/webirc.php b/sections/chat/webirc.php index a1c3b3257..76624ef94 100644 --- a/sections/chat/webirc.php +++ b/sections/chat/webirc.php @@ -5,7 +5,7 @@ $Viewer->setField('IRCKey', $ircKey)->modify(); } -$userMan = new Gazelle\Manager\User; +$userMan = new Gazelle\Manager\User(); $ircNick = str_replace('.', '', $Viewer->username()); if (!$ircNick || $userMan->findByUsername($ircNick)) { $ircNick = str_replace('.', '_', $Viewer->username()); diff --git a/sections/collages/add_artist.php b/sections/collages/add_artist.php index 88ebaf302..f62005a9c 100644 --- a/sections/collages/add_artist.php +++ b/sections/collages/add_artist.php @@ -6,7 +6,7 @@ error(403); } -$collageMan = new Gazelle\Manager\Collage; +$collageMan = new Gazelle\Manager\Collage(); $collage = null; if (isset($_POST['collage_combo'])) { // From artist page @@ -62,7 +62,7 @@ } /* check that they correspond to artist pages */ -$artistMan = new Gazelle\Manager\Artist; +$artistMan = new Gazelle\Manager\Artist(); $ID = []; foreach ($URL as $u) { preg_match(ARTIST_REGEXP, $u, $match); diff --git a/sections/collages/add_torrent.php b/sections/collages/add_torrent.php index 013f78cfc..c58e64020 100644 --- a/sections/collages/add_torrent.php +++ b/sections/collages/add_torrent.php @@ -9,7 +9,7 @@ error(403); } -$collageMan = new Gazelle\Manager\Collage; +$collageMan = new Gazelle\Manager\Collage(); if (isset($_POST['collage_combo']) && (int)$_POST['collage_combo']) { $collage = $collageMan->findById((int)$_POST['collage_combo']); // From release page } elseif (isset($_POST['collage_ref'])) { @@ -59,7 +59,7 @@ } /* check that they correspond to torrent pages */ -$tgroupMan = new Gazelle\Manager\TGroup; +$tgroupMan = new Gazelle\Manager\TGroup(); $groupIds = []; foreach ($URL as $u) { preg_match(TGROUP_REGEXP, $u, $match); diff --git a/sections/collages/ajax_add.php b/sections/collages/ajax_add.php index 14cf9547b..819ff65f1 100644 --- a/sections/collages/ajax_add.php +++ b/sections/collages/ajax_add.php @@ -14,7 +14,7 @@ entryId: (int)$_REQUEST['entry_id'], name: trim($_REQUEST['name']), user: $Viewer, - manager: new Gazelle\Manager\Collage, - artistManager: new Gazelle\Manager\Artist, - tgroupManager: new Gazelle\Manager\TGroup, + manager: new Gazelle\Manager\Collage(), + artistManager: new Gazelle\Manager\Artist(), + tgroupManager: new Gazelle\Manager\TGroup(), ))->response(); diff --git a/sections/collages/all_comments.php b/sections/collages/all_comments.php index 24eeb024f..43c24a3f8 100644 --- a/sections/collages/all_comments.php +++ b/sections/collages/all_comments.php @@ -1,6 +1,6 @@ findById((int)($_GET['collageid'] ?? 0)); +$collage = (new Gazelle\Manager\Collage())->findById((int)($_GET['collageid'] ?? 0)); if (is_null($collage)) { error(404); } @@ -18,6 +18,6 @@ 'paginator' => $paginator, 'textarea' => (new Gazelle\Util\Textarea('quickpost', '', 90, 8))->setPreviewManual(true), 'url' => $_SERVER['REQUEST_URI'], - 'userMan' => new Gazelle\Manager\User, + 'userMan' => new Gazelle\Manager\User(), 'viewer' => $Viewer, ]); diff --git a/sections/collages/autocomplete.php b/sections/collages/autocomplete.php index 02a049d24..1544e6008 100644 --- a/sections/collages/autocomplete.php +++ b/sections/collages/autocomplete.php @@ -12,5 +12,5 @@ header('Content-Type: application/json; charset=utf-8'); echo json_encode([ 'query' => $fullName, - 'suggestions' => (new Gazelle\Manager\Collage)->autocomplete($fullName, isset($_GET['artist'])), + 'suggestions' => (new Gazelle\Manager\Collage())->autocomplete($fullName, isset($_GET['artist'])), ]); diff --git a/sections/collages/browse.php b/sections/collages/browse.php index aa367bee9..7db7cb179 100644 --- a/sections/collages/browse.php +++ b/sections/collages/browse.php @@ -1,7 +1,7 @@ setLookup($_GET['type'] ?? 'name'); +$userMan = new Gazelle\Manager\User(); +$search = (new Gazelle\Search\Collage())->setLookup($_GET['type'] ?? 'name'); if (!empty($_GET['bookmarks'])) { $search->setBookmarkView($Viewer); @@ -17,7 +17,7 @@ } if (!empty($_GET['tags'])) { - $tagMan = new Gazelle\Manager\Tag; + $tagMan = new Gazelle\Manager\Tag(); $list = explode(',', $_GET['tags']); $taglist = []; foreach ($list as $name) { @@ -57,7 +57,7 @@ 'input' => $_GET, 'page' => $search->page($paginator->limit(), $paginator->offset()), 'paginator' => $paginator, - 'personal' => (new Gazelle\Manager\Collage)->findPersonalByUser($Viewer), + 'personal' => (new Gazelle\Manager\Collage())->findPersonalByUser($Viewer), 'search' => $search, 'viewer' => $Viewer, ]); diff --git a/sections/collages/collage.php b/sections/collages/collage.php index 8cd24bfe5..5a006e721 100644 --- a/sections/collages/collage.php +++ b/sections/collages/collage.php @@ -1,6 +1,6 @@ findById((int)($_GET['id'] ?? 0)); if (is_null($Collage)) { error(404); diff --git a/sections/collages/collage_artists.php b/sections/collages/collage_artists.php index 9be0c8a03..27d1358a3 100644 --- a/sections/collages/collage_artists.php +++ b/sections/collages/collage_artists.php @@ -45,7 +45,7 @@ echo $Twig->render('collage/sidebar.twig', [ 'artists' => 0, // only makes sense for torrent collages 'collage' => $Collage, - 'comments' => (new Gazelle\Manager\Comment)->collageSummary($CollageID), + 'comments' => (new Gazelle\Manager\Comment())->collageSummary($CollageID), 'contributors' => array_slice($Collage->contributors(), 0, 5, true), 'entries' => $Collage->numArtists(), 'object' => 'artist', diff --git a/sections/collages/collage_torrent.php b/sections/collages/collage_torrent.php index 47baf3ff1..e1b372ea1 100644 --- a/sections/collages/collage_torrent.php +++ b/sections/collages/collage_torrent.php @@ -1,9 +1,9 @@ setViewer($Viewer); -$torMan = (new Gazelle\Manager\Torrent)->setViewer($Viewer); +$tgMan = (new Gazelle\Manager\TGroup())->setViewer($Viewer); +$torMan = (new Gazelle\Manager\Torrent())->setViewer($Viewer); $bookmark = new Gazelle\User\Bookmark($Viewer); -$collMan = (new Gazelle\Manager\Collage)->setImageProxy(new \Gazelle\Util\ImageProxy($Viewer)); +$collMan = (new Gazelle\Manager\Collage())->setImageProxy(new \Gazelle\Util\ImageProxy($Viewer)); $urlStem = (new Gazelle\User\Stylesheet($Viewer))->imagePath(); $vote = new Gazelle\User\Vote($Viewer); @@ -28,7 +28,7 @@ echo$Twig->render('collage/sidebar.twig', [ 'artists' => $Collage->numArtists(), 'collage' => $Collage, - 'comments' => (new Gazelle\Manager\Comment)->collageSummary($CollageID), + 'comments' => (new Gazelle\Manager\Comment())->collageSummary($CollageID), 'contributors' => array_slice($Collage->contributors(), 0, 5, true), 'entries' => $Collage->numEntries(), 'object' => 'torrent', diff --git a/sections/collages/delete_handle.php b/sections/collages/delete_handle.php index 9c2816915..5be6d6e98 100644 --- a/sections/collages/delete_handle.php +++ b/sections/collages/delete_handle.php @@ -7,7 +7,7 @@ error('You must enter a reason!'); } -$collage = (new Gazelle\Manager\Collage)->findById((int)$_POST['collageid']); +$collage = (new Gazelle\Manager\Collage())->findById((int)$_POST['collageid']); if (is_null($collage)) { error(404); } @@ -19,8 +19,8 @@ $name = $collage->name(); $collage->remove(); -(new Gazelle\Manager\Subscription)->flushPage('collages', $collageId); -(new Gazelle\Log)->general(sprintf("Collage %d (%s) was deleted by %s: %s", +(new Gazelle\Manager\Subscription())->flushPage('collages', $collageId); +(new Gazelle\Log())->general(sprintf("Collage %d (%s) was deleted by %s: %s", $collageId, $name, $Viewer->username(), $reason )); diff --git a/sections/collages/download.php b/sections/collages/download.php index ce011dbc6..6bbcf8139 100644 --- a/sections/collages/download.php +++ b/sections/collages/download.php @@ -8,12 +8,12 @@ error(0); } -$collage = (new Gazelle\Manager\Collage)->findById((int)($_REQUEST['collageid'] ?? 0)); +$collage = (new Gazelle\Manager\Collage())->findById((int)($_REQUEST['collageid'] ?? 0)); if (is_null($collage)) { error(404); } -$collector = new Gazelle\Collector\Collage($Viewer, new Gazelle\Manager\Torrent, $collage, (int)$_REQUEST['preference']); +$collector = new Gazelle\Collector\Collage($Viewer, new Gazelle\Manager\Torrent(), $collage, (int)$_REQUEST['preference']); if (!$collector->prepare($_REQUEST['list'])) { error("Nothing to gather, choose some encodings and bitrates!"); } diff --git a/sections/collages/edit.php b/sections/collages/edit.php index 73649e0d3..9a81c1358 100644 --- a/sections/collages/edit.php +++ b/sections/collages/edit.php @@ -1,13 +1,13 @@ findById((int)($_GET['collageid'] ?? 0)); +$collage = (new Gazelle\Manager\Collage())->findById((int)($_GET['collageid'] ?? 0)); if (is_null($collage)) { error(404); } if ($collage->isPersonal() && !$collage->isOwner($Viewer) && !$Viewer->permitted('site_collages_delete')) { error(403); } -$torMan = new Gazelle\Manager\Torrent; +$torMan = new Gazelle\Manager\Torrent(); echo $Twig->render('collage/edit.twig', [ 'can_rename' => $Viewer->permitted('site_collages_delete') diff --git a/sections/collages/edit_handle.php b/sections/collages/edit_handle.php index 32bb45ba1..813884f8f 100644 --- a/sections/collages/edit_handle.php +++ b/sections/collages/edit_handle.php @@ -21,7 +21,7 @@ error(403); } -$collageMan = new Gazelle\Manager\Collage; +$collageMan = new Gazelle\Manager\Collage(); if (isset($_POST['name'])) { $name = trim($_POST['name']); $check = $collageMan->findByName($name); @@ -43,7 +43,7 @@ } if (!isset($_POST['regen-tags'])) { - $collage->setField('TagList', (new Gazelle\Manager\Tag)->normalize(str_replace(',', ' ', $_POST['tags']))); + $collage->setField('TagList', (new Gazelle\Manager\Tag())->normalize(str_replace(',', ' ', $_POST['tags']))); } else { $tagList = $collage->rebuildTagList(); if (count($tagList) > 2) { @@ -90,7 +90,7 @@ $collage->modify(); if ($Viewer->permitted('admin_freeleech') && isset($_POST['change_leech'])) { - $torMan = new \Gazelle\Manager\Torrent; + $torMan = new \Gazelle\Manager\Torrent(); if (!isset($_POST['neutral'])) { $threshold = 0; } else { @@ -101,7 +101,7 @@ } $collage->setFreeleech( torMan: $torMan, - tracker: new \Gazelle\Tracker, + tracker: new \Gazelle\Tracker(), user: $Viewer, leechType: $torMan->lookupLeechType($_POST['leech_type'] ?? LeechType::Normal->value), reason: $torMan->lookupLeechReason($_POST['leech_reason'] ?? LeechReason::Normal->value), diff --git a/sections/collages/manage.php b/sections/collages/manage.php index 2288088da..ccd64cc00 100644 --- a/sections/collages/manage.php +++ b/sections/collages/manage.php @@ -1,6 +1,6 @@ findById((int)($_GET['collageid'] ?? $_GET['id'] ?? 0)); +$collage = (new Gazelle\Manager\Collage())->findById((int)($_GET['collageid'] ?? $_GET['id'] ?? 0)); if (is_null($collage) || $collage->isArtist()) { error(404); } @@ -10,6 +10,6 @@ echo $Twig->render('collage/manage-tgroup.twig', [ 'collage' => $collage, - 'manager' => new Gazelle\Manager\TGroup, + 'manager' => new Gazelle\Manager\TGroup(), 'viewer' => $Viewer, ]); diff --git a/sections/collages/manage_artists.php b/sections/collages/manage_artists.php index 282066bd1..3c7e1bed5 100644 --- a/sections/collages/manage_artists.php +++ b/sections/collages/manage_artists.php @@ -3,7 +3,7 @@ if (!$Viewer->permitted('site_collages_create')) { error(403); } -$collage = (new Gazelle\Manager\Collage)->findById((int)$_GET['collageid']); +$collage = (new Gazelle\Manager\Collage())->findById((int)$_GET['collageid']); if (is_null($collage)) { error(404); } diff --git a/sections/collages/manage_artists_handle.php b/sections/collages/manage_artists_handle.php index 65ee65314..1724d471d 100644 --- a/sections/collages/manage_artists_handle.php +++ b/sections/collages/manage_artists_handle.php @@ -9,7 +9,7 @@ if (!$artistId) { error(404); } -$collage = (new Gazelle\Manager\Collage)->findById((int)$_POST['collageid']); +$collage = (new Gazelle\Manager\Collage())->findById((int)$_POST['collageid']); if (is_null($collage)) { error(404); } diff --git a/sections/collages/manage_handle.php b/sections/collages/manage_handle.php index eb4426cb1..2fedef4ec 100644 --- a/sections/collages/manage_handle.php +++ b/sections/collages/manage_handle.php @@ -6,7 +6,7 @@ if (!$groupId) { error(404); } -$collage = (new Gazelle\Manager\Collage)->findById((int)($_POST['collageid'])); +$collage = (new Gazelle\Manager\Collage())->findById((int)($_POST['collageid'])); if (is_null($collage)) { error(404); } @@ -17,7 +17,7 @@ if (($_POST['submit'] ?? '') === 'Remove') { $userId = $collage->entryUserId($groupId); if ($collage->removeEntry($groupId)) { - (new Gazelle\Log)->general(sprintf("Collage %d (%s) group entry $groupId (added by user $userId) removed by %s", + (new Gazelle\Log())->general(sprintf("Collage %d (%s) group entry $groupId (added by user $userId) removed by %s", $collage->id(), $collage->name(), $Viewer->username() )); } diff --git a/sections/collages/new_handle.php b/sections/collages/new_handle.php index b7fbe5838..fa7e8f77e 100644 --- a/sections/collages/new_handle.php +++ b/sections/collages/new_handle.php @@ -10,9 +10,9 @@ error(403); } $categoryId = (int)$_POST['category']; -$collageMan = new Gazelle\Manager\Collage; +$collageMan = new Gazelle\Manager\Collage(); -$Val = new Gazelle\Util\Validator; +$Val = new Gazelle\Util\Validator(); if ($categoryId != COLLAGE_PERSONAL_ID || $Viewer->permitted('site_collages_renamepersonal')) { $Val->setField('name', true, 'string', 'The name must be between 3 and 100 characters', ['range' => [3, 100]]); $name = trim($_POST['name']); @@ -60,8 +60,8 @@ $categoryId, $name, $_POST['description'], - (new Gazelle\Manager\Tag)->normalize(str_replace(',', ' ', $_POST['tags'])), - new Gazelle\Log + (new Gazelle\Manager\Tag())->normalize(str_replace(',', ' ', $_POST['tags'])), + new Gazelle\Log() ); if ($Viewer->option('AutoSubscribe')) { diff --git a/sections/collages/recover.php b/sections/collages/recover.php index e2c8ff3f9..5d29b42ed 100644 --- a/sections/collages/recover.php +++ b/sections/collages/recover.php @@ -8,7 +8,7 @@ if (!empty($_POST['id']) || $_POST['name'] !== '') { authorize(); - $collageMan = new Gazelle\Manager\Collage; + $collageMan = new Gazelle\Manager\Collage(); $collage = null; if (!empty($_POST['id'])) { @@ -21,7 +21,7 @@ error('Collage is completely deleted'); } else { $collageId = $collage->flush()->id(); - (new Gazelle\Log)->general("Collage $collageId was recovered by " . $Viewer->username()); + (new Gazelle\Log())->general("Collage $collageId was recovered by " . $Viewer->username()); header('Location: ' . $collage->location()); exit; } diff --git a/sections/comments/comments.php b/sections/comments/comments.php index fb63bef48..309a516f6 100644 --- a/sections/comments/comments.php +++ b/sections/comments/comments.php @@ -13,7 +13,7 @@ * If missing or invalid, this defaults to the comments one made */ -$userMan = new Gazelle\Manager\User; +$userMan = new Gazelle\Manager\User(); if (!isset($_GET['id'])) { $User = $Viewer; } else { @@ -208,13 +208,13 @@ $requestList = []; $tgroupList = []; if ($Action == 'requests') { - $requestMan = new Gazelle\Manager\Request; + $requestMan = new Gazelle\Manager\Request(); foreach (array_flip(array_flip($db->collect('PageID'))) as $id) { $id = (int)$id; $requestList[$id] = $requestMan->findById($id); } } elseif ($Action == 'torrents') { - $tgMan = new Gazelle\Manager\TGroup; + $tgMan = new Gazelle\Manager\TGroup(); foreach (array_flip(array_flip($db->collect('PageID'))) as $id) { $id = (int)$id; $tgroupList[$id] = $tgMan->findById($id); @@ -250,7 +250,7 @@ linkbox(); - $commentMan = new Gazelle\Manager\Comment; + $commentMan = new Gazelle\Manager\Comment(); $db->set_query_id($Comments); while ([$AuthorID, $Page, $PageID, $Name, $PostID, $Body, $AddedTime, $EditedTime, $EditedUserID] = $db->next_record(escape: false)) { $author = new Gazelle\User($AuthorID); diff --git a/sections/comments/delete_handle.php b/sections/comments/delete_handle.php index 441180643..2ed3b5925 100644 --- a/sections/comments/delete_handle.php +++ b/sections/comments/delete_handle.php @@ -5,7 +5,7 @@ } authorize(); -$comment = (new Gazelle\Manager\Comment)->findById((int)($_REQUEST['postid'] ?? 0)); +$comment = (new Gazelle\Manager\Comment())->findById((int)($_REQUEST['postid'] ?? 0)); if (is_null($comment)) { error(404); } diff --git a/sections/comments/edit_handle.php b/sections/comments/edit_handle.php index 6f9b81732..4a89b6b1c 100644 --- a/sections/comments/edit_handle.php +++ b/sections/comments/edit_handle.php @@ -10,14 +10,14 @@ error(404, true); } -$comment = (new Gazelle\Manager\Comment)->findById((int)($_REQUEST['postid'] ?? 0)); +$comment = (new Gazelle\Manager\Comment())->findById((int)($_REQUEST['postid'] ?? 0)); if (is_null($comment)) { error(404, true); } if ($comment->userId() != $Viewer->id() && !$Viewer->permitted('site_moderate_forums')) { error(403, true); } -$user = (new Gazelle\Manager\User)->findById($comment->userId()); +$user = (new Gazelle\Manager\User())->findById($comment->userId()); if (is_null($user)) { error(0, true); } diff --git a/sections/comments/get.php b/sections/comments/get.php index 9e827d9da..adbebb9a4 100644 --- a/sections/comments/get.php +++ b/sections/comments/get.php @@ -1,6 +1,6 @@ findBodyById((int)($_GET['postid'] ?? 0)); +$body = (new Gazelle\Manager\Comment())->findBodyById((int)($_GET['postid'] ?? 0)); if (is_null($body)) { error(404); } diff --git a/sections/comments/jump.php b/sections/comments/jump.php index 7fd43140f..e32dca5d1 100644 --- a/sections/comments/jump.php +++ b/sections/comments/jump.php @@ -1,6 +1,6 @@ findById((int)($_REQUEST['postid'] ?? 0)); +$comment = (new Gazelle\Manager\Comment())->findById((int)($_REQUEST['postid'] ?? 0)); if (is_null($comment)) { error(404); } diff --git a/sections/comments/post_handle.php b/sections/comments/post_handle.php index ddf2ccad4..cb6ff06a5 100644 --- a/sections/comments/post_handle.php +++ b/sections/comments/post_handle.php @@ -15,7 +15,7 @@ error(404); } -$commentMan = new Gazelle\Manager\Comment; +$commentMan = new Gazelle\Manager\Comment(); $comment = $commentMan->create($Viewer, $page, $pageId, $_POST['quickpost']); $subscription = new \Gazelle\User\Subscription($Viewer); diff --git a/sections/comments/warn.php b/sections/comments/warn.php index bf7413aab..7433611cb 100644 --- a/sections/comments/warn.php +++ b/sections/comments/warn.php @@ -4,7 +4,7 @@ error(403); } -$comment = (new Gazelle\Manager\Comment)->findById((int)($_POST['postid'] ?? 0)); +$comment = (new Gazelle\Manager\Comment())->findById((int)($_POST['postid'] ?? 0)); if (is_null($comment)) { error(404); } diff --git a/sections/comments/warn_handle.php b/sections/comments/warn_handle.php index 8b2d269cd..352883053 100644 --- a/sections/comments/warn_handle.php +++ b/sections/comments/warn_handle.php @@ -2,6 +2,6 @@ require_once(__DIR__ . '/../forums/do_warn.php'); -[$post, $body] = handleWarningRequest(new Gazelle\Manager\Comment); +[$post, $body] = handleWarningRequest(new Gazelle\Manager\Comment()); $post->setField('Body', $body) ->setField('EditedUserID', $Viewer->id())->modify(); diff --git a/sections/contest/admin.php b/sections/contest/admin.php index 326872cc5..137dde31d 100644 --- a/sections/contest/admin.php +++ b/sections/contest/admin.php @@ -4,7 +4,7 @@ error(403); } -$contestMan = new Gazelle\Manager\Contest; +$contestMan = new Gazelle\Manager\Contest(); $create = isset($_GET['action']) && $_GET['action'] === 'create'; $saved = false; @@ -54,6 +54,6 @@ 'list' => $contestMan->contestList(), 'saved' => $saved, 'type' => $contestMan->contestTypes(), - 'user_count' => (new \Gazelle\Stats\Users)->enabledUserTotal(), + 'user_count' => (new \Gazelle\Stats\Users())->enabledUserTotal(), 'viewer' => $Viewer, ]); diff --git a/sections/contest/index.php b/sections/contest/index.php index 29c029173..5709c22a1 100644 --- a/sections/contest/index.php +++ b/sections/contest/index.php @@ -1,6 +1,6 @@ address($Viewer->id()); } else { $moneroAddr = null; } if (BITCOIN_DONATION_XYZPUB) { - $btcDonation = new Gazelle\Donate\Bitcoin; + $btcDonation = new Gazelle\Donate\Bitcoin(); $btcAddr = $btcDonation->address($Viewer->id()); } else { $btcAddr = null; diff --git a/sections/enable/index.php b/sections/enable/index.php index ec4b4de33..1cb1de943 100644 --- a/sections/enable/index.php +++ b/sections/enable/index.php @@ -9,7 +9,7 @@ exit; } -$enabler = (new Gazelle\Manager\AutoEnable)->findByToken($_GET['token']); +$enabler = (new Gazelle\Manager\AutoEnable())->findByToken($_GET['token']); if (is_null($enabler)) { error('invalid enable token'); } diff --git a/sections/forums/add_poll_option.php b/sections/forums/add_poll_option.php index 8370c73c7..16b5c8961 100644 --- a/sections/forums/add_poll_option.php +++ b/sections/forums/add_poll_option.php @@ -5,7 +5,7 @@ } authorize(); -$poll = (new Gazelle\Manager\ForumPoll)->findById((int)($_POST['threadid'] ?? 0)); +$poll = (new Gazelle\Manager\ForumPoll())->findById((int)($_POST['threadid'] ?? 0)); if (is_null($poll)) { error(404); } diff --git a/sections/forums/autosub.php b/sections/forums/autosub.php index 2dc9a01c4..ff99799db 100644 --- a/sections/forums/autosub.php +++ b/sections/forums/autosub.php @@ -5,7 +5,7 @@ } authorize(); -$forum = (new Gazelle\Manager\Forum)->findById((int)($_POST['id'] ?? 0)); +$forum = (new Gazelle\Manager\Forum())->findById((int)($_POST['id'] ?? 0)); if (is_null($forum)) { json_error('not found'); } diff --git a/sections/forums/catchup.php b/sections/forums/catchup.php index 044c39a53..33fda8128 100644 --- a/sections/forums/catchup.php +++ b/sections/forums/catchup.php @@ -8,7 +8,7 @@ exit; } -$forum = (new Gazelle\Manager\Forum)->findById((int)($_GET['forumid'] ?? 0)); +$forum = (new Gazelle\Manager\Forum())->findById((int)($_GET['forumid'] ?? 0)); if (is_null($forum)) { error(404); } diff --git a/sections/forums/change_vote.php b/sections/forums/change_vote.php index 9caed717f..727fa5a48 100644 --- a/sections/forums/change_vote.php +++ b/sections/forums/change_vote.php @@ -2,7 +2,7 @@ authorize(); -$poll = (new Gazelle\Manager\ForumPoll)->findById((int)($_POST['threadid'] ?? 0)); +$poll = (new Gazelle\Manager\ForumPoll())->findById((int)($_POST['threadid'] ?? 0)); if (is_null($poll)) { error(404); } diff --git a/sections/forums/delete.php b/sections/forums/delete.php index b8b459222..4873fa481 100644 --- a/sections/forums/delete.php +++ b/sections/forums/delete.php @@ -5,7 +5,7 @@ } authorize(); -$post = (new Gazelle\Manager\ForumPost)->findById((int)($_GET['postid'] ?? 0)); +$post = (new Gazelle\Manager\ForumPost())->findById((int)($_GET['postid'] ?? 0)); if (is_null($post)) { error(404); } diff --git a/sections/forums/delete_poll_option.php b/sections/forums/delete_poll_option.php index b15804dc0..78cb10346 100644 --- a/sections/forums/delete_poll_option.php +++ b/sections/forums/delete_poll_option.php @@ -6,7 +6,7 @@ error(403); } -$poll = (new Gazelle\Manager\ForumPoll)->findById((int)($_POST['threadid'] ?? 0)); +$poll = (new Gazelle\Manager\ForumPoll())->findById((int)($_POST['threadid'] ?? 0)); if (is_null($poll)) { error(404); } diff --git a/sections/forums/do_warn.php b/sections/forums/do_warn.php index 0daf2c442..477ef9543 100644 --- a/sections/forums/do_warn.php +++ b/sections/forums/do_warn.php @@ -16,7 +16,7 @@ function handleWarningRequest(\Gazelle\Manager\ForumPost|\Gazelle\Manager\Commen error(404); } - $userMan = new \Gazelle\Manager\User; + $userMan = new \Gazelle\Manager\User(); $user = $userMan->findById($post->userId()); if (is_null($user)) { error(404); diff --git a/sections/forums/edit_handle.php b/sections/forums/edit_handle.php index 7ccf3b127..13b60e0a6 100644 --- a/sections/forums/edit_handle.php +++ b/sections/forums/edit_handle.php @@ -5,7 +5,7 @@ } authorize(); -$post = (new Gazelle\Manager\ForumPost)->findById((int)($_POST['post'] ?? 0)); +$post = (new Gazelle\Manager\ForumPost())->findById((int)($_POST['post'] ?? 0)); if (!$post) { error("No forum post #{$_POST['post']} found", true); } @@ -22,7 +22,7 @@ error("You cannot edit someone else's post", true); } if ($_POST['pm'] ?? 0) { - $user = (new Gazelle\Manager\User)->findById($post->userId()); + $user = (new Gazelle\Manager\User())->findById($post->userId()); if (is_null($user)) { error(0); } diff --git a/sections/forums/forum.php b/sections/forums/forum.php index 708a0df11..323b60a21 100644 --- a/sections/forums/forum.php +++ b/sections/forums/forum.php @@ -8,7 +8,7 @@ ********************************************************************************/ -$forum = (new Gazelle\Manager\Forum)->findById((int)$_GET['forumid']); +$forum = (new Gazelle\Manager\Forum())->findById((int)$_GET['forumid']); if (!$forum) { error(404); } diff --git a/sections/forums/get_post.php b/sections/forums/get_post.php index 97e5fc2be..bfedb0979 100644 --- a/sections/forums/get_post.php +++ b/sections/forums/get_post.php @@ -1,6 +1,6 @@ findById((int)($_GET['post'] ?? 0)); +$post = (new Gazelle\Manager\ForumPost())->findById((int)($_GET['post'] ?? 0)); if (is_null($post)) { error(404); } diff --git a/sections/forums/mod_thread.php b/sections/forums/mod_thread.php index c95b2425b..1284e0ee0 100644 --- a/sections/forums/mod_thread.php +++ b/sections/forums/mod_thread.php @@ -17,9 +17,9 @@ } authorize(); -$forumMan = new Gazelle\Manager\Forum; +$forumMan = new Gazelle\Manager\Forum(); -$thread = (new Gazelle\Manager\ForumThread)->findById((int)($_POST['threadid'] ?? 0)); +$thread = (new Gazelle\Manager\ForumThread())->findById((int)($_POST['threadid'] ?? 0)); if (is_null($thread)) { error(404); } @@ -68,7 +68,7 @@ if ($transId < 1) { error(0); } - $transitions = (new Gazelle\Manager\ForumTransition)->threadTransitionList($Viewer, $forum); + $transitions = (new Gazelle\Manager\ForumTransition())->threadTransitionList($Viewer, $forum); if (!isset($transitions[$transId])) { error(0); } diff --git a/sections/forums/new_thread_handle.php b/sections/forums/new_thread_handle.php index 4a33812f2..b395cf103 100644 --- a/sections/forums/new_thread_handle.php +++ b/sections/forums/new_thread_handle.php @@ -20,7 +20,7 @@ if (!isset($_POST['forum'])) { error(0); } -$forum = (new Gazelle\Manager\Forum)->findById((int)$_POST['forum']); +$forum = (new Gazelle\Manager\Forum())->findById((int)$_POST['forum']); if (is_null($forum)) { error(404); } @@ -59,10 +59,10 @@ } } -$thread = (new Gazelle\Manager\ForumThread)->create($forum, $Viewer, $title, $body); +$thread = (new Gazelle\Manager\ForumThread())->create($forum, $Viewer, $title, $body); $threadId = $thread->id(); if ($needPoll) { - (new Gazelle\Manager\ForumPoll)->create($threadId, $question, $answerList); + (new Gazelle\Manager\ForumPoll())->create($threadId, $question, $answerList); if ($forum->id() == STAFF_FORUM_ID) { Irc::sendMessage( IRC_CHAN_STAFF, @@ -74,7 +74,7 @@ if (isset($_POST['subscribe'])) { (new Gazelle\User\Subscription($Viewer))->subscribe($threadId); } -$userMan = new Gazelle\Manager\User; +$userMan = new Gazelle\Manager\User(); foreach ($forum->autoSubscribeUserIdList() as $userId) { $user = $userMan->findById($userId); if ($user) { diff --git a/sections/forums/newthread.php b/sections/forums/newthread.php index a3818137b..2283e34de 100644 --- a/sections/forums/newthread.php +++ b/sections/forums/newthread.php @@ -1,5 +1,5 @@ findById((int)($_GET['forumid'] ?? 0)); +$forum = (new Gazelle\Manager\Forum())->findById((int)($_GET['forumid'] ?? 0)); if (!$forum) { error(404); } diff --git a/sections/forums/poll_mod.php b/sections/forums/poll_mod.php index 992386115..0a12676e2 100644 --- a/sections/forums/poll_mod.php +++ b/sections/forums/poll_mod.php @@ -5,7 +5,7 @@ } authorize(); -$poll = (new Gazelle\Manager\ForumPoll)->findById((int)($_POST['threadid'] ?? 0)); +$poll = (new Gazelle\Manager\ForumPoll())->findById((int)($_POST['threadid'] ?? 0)); if (is_null($poll)) { error(0, true); } diff --git a/sections/forums/poll_vote.php b/sections/forums/poll_vote.php index 90cc0efa1..920a133c4 100644 --- a/sections/forums/poll_vote.php +++ b/sections/forums/poll_vote.php @@ -1,6 +1,6 @@ findById((int)($_POST['threadid'] ?? 0)); +$poll = (new Gazelle\Manager\ForumPoll())->findById((int)($_POST['threadid'] ?? 0)); if (is_null($poll)) { error(404, true); } @@ -40,7 +40,7 @@
    hasRevealVotes()) { - $staffVote = $poll->staffVote(new Gazelle\Manager\User); + $staffVote = $poll->staffVote(new Gazelle\Manager\User()); foreach ($staffVote as $response => $info) { if ($response !== 'missing') { ?> diff --git a/sections/forums/reply_handle.php b/sections/forums/reply_handle.php index 18e3421ec..7982019d7 100644 --- a/sections/forums/reply_handle.php +++ b/sections/forums/reply_handle.php @@ -5,7 +5,7 @@ } authorize(); -$thread = (new Gazelle\Manager\ForumThread)->findById((int)($_POST['threadid'] ?? 0)); +$thread = (new Gazelle\Manager\ForumThread())->findById((int)($_POST['threadid'] ?? 0)); if (is_null($thread)) { error(404); } @@ -31,12 +31,12 @@ $postId = $post->id(); (new Gazelle\User\Notification\Quote($Viewer))->create( - new Gazelle\Manager\User, $body, $postId, 'forums', $threadId + new Gazelle\Manager\User(), $body, $postId, 'forums', $threadId ); $subscription = new Gazelle\User\Subscription($Viewer); if (isset($_POST['subscribe']) && !$subscription->isSubscribed($threadId)) { $subscription->subscribe($threadId); } -(new Gazelle\Manager\Subscription)->flushPage('forums', $threadId); +(new Gazelle\Manager\Subscription())->flushPage('forums', $threadId); header("Location: {$thread->location()}&postid=$postId#post$postId"); diff --git a/sections/forums/search.php b/sections/forums/search.php index 26607d8c8..9389f55dc 100644 --- a/sections/forums/search.php +++ b/sections/forums/search.php @@ -128,7 +128,7 @@ $LastCategoryID = -1; $Columns = 0; $i = 0; - $Forums = (new Gazelle\Manager\Forum)->forumList(); + $Forums = (new Gazelle\Manager\Forum())->forumList(); foreach ($Forums as $forumId) { $forum = new Gazelle\Forum($forumId); if (!$Viewer->readAccess($forum)) { diff --git a/sections/forums/sticky_post.php b/sections/forums/sticky_post.php index 36f6d2b46..c70603339 100644 --- a/sections/forums/sticky_post.php +++ b/sections/forums/sticky_post.php @@ -5,7 +5,7 @@ } authorize(); -$post = (new Gazelle\Manager\ForumPost)->findById((int)($_GET['postid'] ?? 0)); +$post = (new Gazelle\Manager\ForumPost())->findById((int)($_GET['postid'] ?? 0)); if (is_null($post)) { error(404); } diff --git a/sections/forums/thread.php b/sections/forums/thread.php index a2ed8f94f..347cf6d80 100644 --- a/sections/forums/thread.php +++ b/sections/forums/thread.php @@ -13,9 +13,9 @@ //---------- Things to sort out before it can start printing/generating content -$forumMan = new Gazelle\Manager\Forum; +$forumMan = new Gazelle\Manager\Forum(); if (isset($_GET['postid'])) { - $post = (new Gazelle\Manager\ForumPost)->findById((int)$_GET['postid']); + $post = (new Gazelle\Manager\ForumPost())->findById((int)$_GET['postid']); if (is_null($post)) { error(404); } @@ -26,7 +26,7 @@ $thread = $post->thread(); } elseif (isset($_GET['threadid'])) { $post = null; - $thread = (new Gazelle\Manager\ForumThread)->findById((int)$_GET['threadid']); + $thread = (new Gazelle\Manager\ForumThread())->findById((int)$_GET['threadid']); if (is_null($thread)) { error(404); } @@ -82,10 +82,10 @@ $Cache->delete_value('subscriptions_user_new_' . $Viewer->id()); } -$userMan = new Gazelle\Manager\User; +$userMan = new Gazelle\Manager\User(); $avatarFilter = Gazelle\Util\Twig::factory()->createTemplate('{{ user|avatar(viewer)|raw }}'); -$transitions = (new Gazelle\Manager\ForumTransition)->threadTransitionList($Viewer, $forum); +$transitions = (new Gazelle\Manager\ForumTransition())->threadTransitionList($Viewer, $forum); $department = $forum->departmentList($Viewer); $auth = $Viewer->auth(); @@ -338,7 +338,7 @@