From ca6e367669bb10ca3c44601e16576a3666c51aab Mon Sep 17 00:00:00 2001 From: HDVinnie Date: Wed, 22 Jul 2020 14:27:11 -0400 Subject: [PATCH 01/13] refactor: use identical over equal with same type --- app/Services/Clients/TmdbClient.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/Services/Clients/TmdbClient.php b/app/Services/Clients/TmdbClient.php index 8988090dbd..32f7079a42 100644 --- a/app/Services/Clients/TmdbClient.php +++ b/app/Services/Clients/TmdbClient.php @@ -337,7 +337,7 @@ private function formatImages($images, $path, $image) { $images = array_map(fn ($item) => $path.$item['file_path'], $images); - return array_filter($images, fn ($item) => ! $item != ! ($path.$image)); + return array_filter($images, fn ($item) => ! $item !== ! ($path.$image)); } private function formatCasts($credits, $role) From f91264752dacf38c85e590245266e302da11308b Mon Sep 17 00:00:00 2001 From: HDVinnie Date: Wed, 22 Jul 2020 14:28:12 -0400 Subject: [PATCH 02/13] refactor: callable this array to anonymous function --- app/Console/Commands/VendorCleanup.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/app/Console/Commands/VendorCleanup.php b/app/Console/Commands/VendorCleanup.php index 23be457dec..055159ce14 100644 --- a/app/Console/Commands/VendorCleanup.php +++ b/app/Console/Commands/VendorCleanup.php @@ -99,7 +99,9 @@ public function handle() foreach ($directories as $directory) { foreach ($patterns as $pattern) { - $casePattern = preg_replace_callback('#([a-z])#i', [$this, 'prepareWord'], $pattern); + $casePattern = preg_replace_callback('#([a-z])#i', function ($matches) { + return $this->prepareWord($matches); + }, $pattern); $files = glob($directory.'/'.$casePattern, GLOB_BRACE); From e7ccde01900e8e998d2579084137f2e7c783485b Mon Sep 17 00:00:00 2001 From: HDVinnie Date: Wed, 22 Jul 2020 14:50:41 -0400 Subject: [PATCH 03/13] refactor: rename property to match type --- app/Bots/CasinoBot.php | 24 ++-- app/Bots/NerdBot.php | 24 ++-- app/Bots/SystemBot.php | 28 ++-- app/Console/Commands/AutoCorrectHistory.php | 4 +- app/Console/Commands/AutoFlushPeers.php | 4 +- app/Console/Commands/AutoGraveyard.php | 8 +- app/Console/Commands/AutoNerdStat.php | 8 +- app/Console/Commands/AutoPreWarning.php | 4 +- .../AutoRecycleClaimedTorrentRequests.php | 8 +- .../Commands/AutoRemoveFeaturedTorrent.php | 8 +- app/Console/Commands/AutoWarning.php | 6 +- app/Console/Commands/DemoSeed.php | 4 +- app/Console/Commands/FetchGenres.php | 10 +- app/Console/Commands/FetchReleaseYears.php | 10 +- app/Console/Commands/IrcBroadcast.php | 4 +- app/Console/Commands/IrcMessage.php | 4 +- app/Exceptions/Handler.php | 8 +- app/Helpers/BackupPassword.php | 14 +- app/Helpers/Markdown.php | 6 +- app/Helpers/TorrentHelper.php | 14 +- app/Http/Controllers/API/ChatController.php | 90 ++++++------ .../Controllers/API/TorrentController.php | 48 +++---- app/Http/Controllers/AlbumController.php | 8 +- .../Controllers/Auth/RegisterController.php | 44 +++--- .../Controllers/Auth/TwoStepController.php | 4 +- app/Http/Controllers/BonusController.php | 82 +++++------ app/Http/Controllers/CategoryController.php | 4 +- app/Http/Controllers/CommentController.php | 60 ++++---- app/Http/Controllers/ForumController.php | 10 +- app/Http/Controllers/GraveyardController.php | 20 +-- app/Http/Controllers/ImageController.php | 4 +- app/Http/Controllers/InviteController.php | 4 +- .../Controllers/NotificationController.php | 4 +- app/Http/Controllers/PlaylistController.php | 18 +-- .../Controllers/PlaylistTorrentController.php | 10 +- app/Http/Controllers/PostController.php | 20 +-- .../Controllers/PrivateMessageController.php | 36 ++--- app/Http/Controllers/RequestController.php | 114 +++++++-------- app/Http/Controllers/RssController.php | 56 ++++---- .../Staff/ApplicationController.php | 4 +- .../Controllers/Staff/ChatRoomController.php | 8 +- .../Staff/ChatStatusController.php | 8 +- .../Controllers/Staff/FlushController.php | 12 +- app/Http/Controllers/Staff/GiftController.php | 12 +- app/Http/Controllers/Staff/HomeController.php | 14 +- .../Staff/MediaLanguageController.php | 10 +- .../Staff/ModerationController.php | 34 ++--- app/Http/Controllers/Staff/PollController.php | 30 ++-- .../Controllers/Staff/ReportController.php | 12 +- app/Http/Controllers/Staff/RssController.php | 10 +- .../Controllers/Staff/VersionController.php | 6 +- app/Http/Controllers/StatsController.php | 36 ++--- app/Http/Controllers/SubtitleController.php | 10 +- app/Http/Controllers/TopicController.php | 12 +- app/Http/Controllers/TorrentController.php | 130 +++++++++--------- app/Http/Controllers/UserController.php | 10 +- app/Http/Controllers/WarningController.php | 48 +++---- app/Jobs/ProcessMassPM.php | 12 +- app/Listeners/AchievementUnlocked.php | 12 +- app/Listeners/PasswordProtectBackup.php | 4 +- app/Models/Page.php | 8 +- app/Models/Torrent.php | 4 +- app/Notifications/FailedLogin.php | 8 +- app/Notifications/NewBon.php | 4 +- app/Notifications/NewPost.php | 4 +- app/Notifications/NewRequestBounty.php | 4 +- app/Notifications/NewRequestClaim.php | 4 +- app/Notifications/NewRequestFill.php | 4 +- app/Notifications/NewRequestFillApprove.php | 4 +- app/Notifications/NewRequestFillReject.php | 4 +- app/Notifications/NewRequestUnclaim.php | 4 +- app/Notifications/NewTopic.php | 4 +- app/Repositories/ChatRepository.php | 34 ++--- app/Repositories/TaggedUserRepository.php | 14 +- app/Repositories/WishRepository.php | 8 +- app/Services/Clients/MangaUpdatesClient.php | 4 +- app/Services/Data/Movie.php | 10 +- app/Services/Data/Tv.php | 10 +- 78 files changed, 703 insertions(+), 703 deletions(-) diff --git a/app/Bots/CasinoBot.php b/app/Bots/CasinoBot.php index cb694cefc7..0740d343b1 100644 --- a/app/Bots/CasinoBot.php +++ b/app/Bots/CasinoBot.php @@ -49,10 +49,10 @@ class CasinoBot * * @param ChatRepository $chat */ - public function __construct(ChatRepository $chat) + public function __construct(ChatRepository $chatRepository) { $bot = Bot::where('id', '=', '3')->firstOrFail(); - $this->chat = $chat; + $this->chat = $chatRepository; $this->bot = $bot; $this->expiresAt = Carbon::now()->addMinutes(60); $this->current = Carbon::now(); @@ -107,14 +107,14 @@ public function putDonate($amount = 0, $note = '') $this->target->seedbonus -= $value; $this->target->save(); - $transaction = new BotTransaction(); - $transaction->type = 'bon'; - $transaction->cost = $value; - $transaction->user_id = $this->target->id; - $transaction->bot_id = $this->bot->id; - $transaction->to_bot = 1; - $transaction->comment = $output; - $transaction->save(); + $botTransaction = new BotTransaction(); + $botTransaction->type = 'bon'; + $botTransaction->cost = $value; + $botTransaction->user_id = $this->target->id; + $botTransaction->bot_id = $this->bot->id; + $botTransaction->to_bot = 1; + $botTransaction->comment = $output; + $botTransaction->save(); $donations = BotTransaction::with('user', 'bot')->where('bot_id', '=', $this->bot->id)->where('to_bot', '=', 1)->latest()->limit(10)->get(); cache()->put('casinobot-donations', $donations, $this->expiresAt); @@ -169,9 +169,9 @@ public function getHelp() * * @return bool */ - public function process($type, User $target, $message = '', $targeted = 0) + public function process($type, User $user, $message = '', $targeted = 0) { - $this->target = $target; + $this->target = $user; if ($type == 'message') { $x = 0; $y = 1; diff --git a/app/Bots/NerdBot.php b/app/Bots/NerdBot.php index 0d28c86dba..93707f51f9 100644 --- a/app/Bots/NerdBot.php +++ b/app/Bots/NerdBot.php @@ -53,10 +53,10 @@ class NerdBot * * @param ChatRepository $chat */ - public function __construct(ChatRepository $chat) + public function __construct(ChatRepository $chatRepository) { $bot = Bot::where('id', '=', '2')->firstOrFail(); - $this->chat = $chat; + $this->chat = $chatRepository; $this->bot = $bot; $this->expiresAt = Carbon::now()->addMinutes(60); $this->current = Carbon::now(); @@ -393,14 +393,14 @@ public function putDonate($amount = 0, $note = '') $this->target->seedbonus -= $value; $this->target->save(); - $transaction = new BotTransaction(); - $transaction->type = 'bon'; - $transaction->cost = $value; - $transaction->user_id = $this->target->id; - $transaction->bot_id = $this->bot->id; - $transaction->to_bot = 1; - $transaction->comment = $output; - $transaction->save(); + $botTransaction = new BotTransaction(); + $botTransaction->type = 'bon'; + $botTransaction->cost = $value; + $botTransaction->user_id = $this->target->id; + $botTransaction->bot_id = $this->bot->id; + $botTransaction->to_bot = 1; + $botTransaction->comment = $output; + $botTransaction->save(); $donations = BotTransaction::with('user', 'bot')->where('bot_id', '=', $this->bot->id)->where('to_bot', '=', 1)->latest()->limit(10)->get(); cache()->put('casinobot-donations', $donations, $this->expiresAt); @@ -421,9 +421,9 @@ public function putDonate($amount = 0, $note = '') * * @return bool */ - public function process($type, User $target, $message = '', $targeted = 0) + public function process($type, User $user, $message = '', $targeted = 0) { - $this->target = $target; + $this->target = $user; if ($type == 'message') { $x = 0; $y = 1; diff --git a/app/Bots/SystemBot.php b/app/Bots/SystemBot.php index e3f0b3fb1b..96d057bf56 100644 --- a/app/Bots/SystemBot.php +++ b/app/Bots/SystemBot.php @@ -46,10 +46,10 @@ class SystemBot * * @param ChatRepository $chat */ - public function __construct(ChatRepository $chat) + public function __construct(ChatRepository $chatRepository) { $bot = Bot::where('slug', '=', 'systembot')->firstOrFail(); - $this->chat = $chat; + $this->chat = $chatRepository; $this->bot = $bot; } @@ -115,18 +115,18 @@ public function putGift($receiver = '', $amount = 0, $note = '') $this->target->seedbonus -= $value; $this->target->save(); - $transaction = new BonTransactions(); - $transaction->itemID = 0; - $transaction->name = 'gift'; - $transaction->cost = $value; - $transaction->sender = $this->target->id; - $transaction->receiver = $recipient->id; - $transaction->comment = $output; - $transaction->torrent_id = null; - $transaction->save(); + $bonTransactions = new BonTransactions(); + $bonTransactions->itemID = 0; + $bonTransactions->name = 'gift'; + $bonTransactions->cost = $value; + $bonTransactions->sender = $this->target->id; + $bonTransactions->receiver = $recipient->id; + $bonTransactions->comment = $output; + $bonTransactions->torrent_id = null; + $bonTransactions->save(); if ($this->target->id != $recipient->id && $recipient->acceptsNotification($this->target, $recipient, 'bon', 'show_bon_gift')) { - $recipient->notify(new NewBon('gift', $this->target->username, $transaction)); + $recipient->notify(new NewBon('gift', $this->target->username, $bonTransactions)); } $profile_url = href_profile($this->target); @@ -152,9 +152,9 @@ public function putGift($receiver = '', $amount = 0, $note = '') * * @return bool */ - public function process($type, User $target, $message = '', $targeted = 0) + public function process($type, User $user, $message = '', $targeted = 0) { - $this->target = $target; + $this->target = $user; $x = $type == 'message' ? 0 : 1; $y = $x + 1; diff --git a/app/Console/Commands/AutoCorrectHistory.php b/app/Console/Commands/AutoCorrectHistory.php index faf465b45e..a4f2bd78bd 100644 --- a/app/Console/Commands/AutoCorrectHistory.php +++ b/app/Console/Commands/AutoCorrectHistory.php @@ -52,8 +52,8 @@ public function __construct() */ public function handle() { - $current = new Carbon(); - $history = History::select(['id', 'active', 'updated_at'])->where('active', '=', 1)->where('updated_at', '<', $current->copy()->subHours(2)->toDateTimeString())->get(); + $carbon = new Carbon(); + $history = History::select(['id', 'active', 'updated_at'])->where('active', '=', 1)->where('updated_at', '<', $carbon->copy()->subHours(2)->toDateTimeString())->get(); foreach ($history as $h) { $h->active = false; diff --git a/app/Console/Commands/AutoFlushPeers.php b/app/Console/Commands/AutoFlushPeers.php index d418c097f5..6474b1174b 100644 --- a/app/Console/Commands/AutoFlushPeers.php +++ b/app/Console/Commands/AutoFlushPeers.php @@ -53,8 +53,8 @@ public function __construct() */ public function handle() { - $current = new Carbon(); - $peers = Peer::select(['id', 'info_hash', 'user_id', 'updated_at'])->where('updated_at', '<', $current->copy()->subHours(2)->toDateTimeString())->get(); + $carbon = new Carbon(); + $peers = Peer::select(['id', 'info_hash', 'user_id', 'updated_at'])->where('updated_at', '<', $carbon->copy()->subHours(2)->toDateTimeString())->get(); foreach ($peers as $peer) { $history = History::where('info_hash', '=', $peer->info_hash)->where('user_id', '=', $peer->user_id)->first(); diff --git a/app/Console/Commands/AutoGraveyard.php b/app/Console/Commands/AutoGraveyard.php index 091030512b..f2fc01c9ab 100644 --- a/app/Console/Commands/AutoGraveyard.php +++ b/app/Console/Commands/AutoGraveyard.php @@ -27,13 +27,13 @@ class AutoGraveyard extends Command /** * @var ChatRepository */ - private $chat; + private $chatRepository; - public function __construct(ChatRepository $chat) + public function __construct(ChatRepository $chatRepository) { parent::__construct(); - $this->chat = $chat; + $this->chatRepository = $chatRepository; } /** @@ -81,7 +81,7 @@ public function handle() // Auto Shout $appurl = config('app.url'); - $this->chat->systemMessage( + $this->chatRepository->systemMessage( sprintf('Ladies and Gents, [url=%s/users/%s]%s[/url] has successfully resurrected [url=%s/torrents/%s]%s[/url]. :zombie:', $appurl, $user->username, $user->username, $appurl, $torrent->id, $torrent->name) ); diff --git a/app/Console/Commands/AutoNerdStat.php b/app/Console/Commands/AutoNerdStat.php index 3cb49539a3..d3f59bddaa 100644 --- a/app/Console/Commands/AutoNerdStat.php +++ b/app/Console/Commands/AutoNerdStat.php @@ -27,13 +27,13 @@ class AutoNerdStat extends Command /** * @var ChatRepository */ - private $chat; + private $chatRepository; - public function __construct(ChatRepository $chat) + public function __construct(ChatRepository $chatRepository) { parent::__construct(); - $this->chat = $chat; + $this->chatRepository = $chatRepository; } /** @@ -143,7 +143,7 @@ public function handle() $selected = mt_rand(0, count($statArray) - 1); // Auto Shout Nerd Stat - $this->chat->systemMessage($statArray[$selected], 2); + $this->chatRepository->systemMessage($statArray[$selected], 2); } $this->comment('Automated Nerd Stat Command Complete'); } diff --git a/app/Console/Commands/AutoPreWarning.php b/app/Console/Commands/AutoPreWarning.php index 6c078cc98f..c3f7bf61d5 100644 --- a/app/Console/Commands/AutoPreWarning.php +++ b/app/Console/Commands/AutoPreWarning.php @@ -45,7 +45,7 @@ class AutoPreWarning extends Command public function handle() { if (config('hitrun.enabled') == true) { - $current = new Carbon(); + $carbon = new Carbon(); $prewarn = History::with(['user', 'torrent']) ->where('prewarn', '=', 0) ->where('hitrun', '=', 0) @@ -53,7 +53,7 @@ public function handle() ->where('actual_downloaded', '>', 0) ->where('active', '=', 0) ->where('seedtime', '<=', config('hitrun.seedtime')) - ->where('updated_at', '<', $current->copy()->subDays(config('hitrun.prewarn'))->toDateTimeString()) + ->where('updated_at', '<', $carbon->copy()->subDays(config('hitrun.prewarn'))->toDateTimeString()) ->get(); foreach ($prewarn as $pre) { diff --git a/app/Console/Commands/AutoRecycleClaimedTorrentRequests.php b/app/Console/Commands/AutoRecycleClaimedTorrentRequests.php index 50efa31256..07ca40694b 100644 --- a/app/Console/Commands/AutoRecycleClaimedTorrentRequests.php +++ b/app/Console/Commands/AutoRecycleClaimedTorrentRequests.php @@ -38,13 +38,13 @@ class AutoRecycleClaimedTorrentRequests extends Command /** * @var ChatRepository */ - private $chat; + private $chatRepository; - public function __construct(ChatRepository $chat) + public function __construct(ChatRepository $chatRepository) { parent::__construct(); - $this->chat = $chat; + $this->chatRepository = $chatRepository; } /** @@ -67,7 +67,7 @@ public function handle() ->first(); if ($requestClaim) { $tr_url = href_request($torrentRequest); - $this->chat->systemMessage( + $this->chatRepository->systemMessage( sprintf('[url=%s]%s[/url] claim has been reset due to not being filled within 7 days.', $tr_url, $torrentRequest->name) ); diff --git a/app/Console/Commands/AutoRemoveFeaturedTorrent.php b/app/Console/Commands/AutoRemoveFeaturedTorrent.php index 5a6c827f93..a24b72e875 100644 --- a/app/Console/Commands/AutoRemoveFeaturedTorrent.php +++ b/app/Console/Commands/AutoRemoveFeaturedTorrent.php @@ -24,13 +24,13 @@ class AutoRemoveFeaturedTorrent extends Command /** * @var ChatRepository */ - private $chat; + private $chatRepository; - public function __construct(ChatRepository $chat) + public function __construct(ChatRepository $chatRepository) { parent::__construct(); - $this->chat = $chat; + $this->chatRepository = $chatRepository; } /** @@ -69,7 +69,7 @@ public function handle() // Auto Announce Featured Expired $appurl = config('app.url'); - $this->chat->systemMessage( + $this->chatRepository->systemMessage( sprintf('Ladies and Gents, [url=%s/torrents/%s]%s[/url] is no longer featured. :poop:', $appurl, $torrent->id, $torrent->name) ); } diff --git a/app/Console/Commands/AutoWarning.php b/app/Console/Commands/AutoWarning.php index f001f44642..081a47c9cc 100644 --- a/app/Console/Commands/AutoWarning.php +++ b/app/Console/Commands/AutoWarning.php @@ -45,7 +45,7 @@ class AutoWarning extends Command public function handle() { if (config('hitrun.enabled') == true) { - $current = new Carbon(); + $carbon = new Carbon(); $hitrun = History::with(['user', 'torrent']) ->where('actual_downloaded', '>', 0) ->where('prewarn', '=', 1) @@ -53,7 +53,7 @@ public function handle() ->where('immune', '=', 0) ->where('active', '=', 0) ->where('seedtime', '<', config('hitrun.seedtime')) - ->where('updated_at', '<', $current->copy()->subDays(config('hitrun.grace'))->toDateTimeString()) + ->where('updated_at', '<', $carbon->copy()->subDays(config('hitrun.grace'))->toDateTimeString()) ->get(); foreach ($hitrun as $hr) { @@ -69,7 +69,7 @@ public function handle() $warning->warned_by = '1'; $warning->torrent = $hr->torrent->id; $warning->reason = sprintf('Hit and Run Warning For Torrent %s', $hr->torrent->name); - $warning->expires_on = $current->copy()->addDays(config('hitrun.expire')); + $warning->expires_on = $carbon->copy()->addDays(config('hitrun.expire')); $warning->active = '1'; $warning->save(); diff --git a/app/Console/Commands/DemoSeed.php b/app/Console/Commands/DemoSeed.php index 59d7e5d90e..88a59b2641 100644 --- a/app/Console/Commands/DemoSeed.php +++ b/app/Console/Commands/DemoSeed.php @@ -267,9 +267,9 @@ private function search($id) // we delay between api calls to reduce throttling usleep(500_000); - $client = new \App\Services\MovieScrapper(config('api-keys.tmdb'), config('api-keys.tvdb'), config('api-keys.omdb')); + $movieScrapper = new \App\Services\MovieScrapper(config('api-keys.tmdb'), config('api-keys.tvdb'), config('api-keys.omdb')); - return $client->scrape('movie', null, $id); + return $movieScrapper->scrape('movie', null, $id); } private function ids() diff --git a/app/Console/Commands/FetchGenres.php b/app/Console/Commands/FetchGenres.php index 2a16c6f777..e6f9b95a61 100644 --- a/app/Console/Commands/FetchGenres.php +++ b/app/Console/Commands/FetchGenres.php @@ -44,7 +44,7 @@ class FetchGenres extends Command */ public function handle() { - $client = new MovieScrapper(config('api-keys.tmdb'), config('api-keys.tvdb'), config('api-keys.omdb')); + $movieScrapper = new MovieScrapper(config('api-keys.tmdb'), config('api-keys.tvdb'), config('api-keys.omdb')); $torrents = Torrent::withAnyStatus() ->select(['id', 'category_id', 'imdb', 'tmdb']) @@ -53,16 +53,16 @@ public function handle() foreach ($torrents as $torrent) { if ($torrent->category->tv_meta) { if ($torrent->tmdb && $torrent->tmdb != 0) { - $meta = $client->scrape('tv', null, $torrent->tmdb); + $meta = $movieScrapper->scrape('tv', null, $torrent->tmdb); } else { - $meta = $client->scrape('tv', 'tt'.$torrent->imdb); + $meta = $movieScrapper->scrape('tv', 'tt'.$torrent->imdb); } } if ($torrent->category->movie_meta) { if ($torrent->tmdb && $torrent->tmdb != 0) { - $meta = $client->scrape('movie', null, $torrent->tmdb); + $meta = $movieScrapper->scrape('movie', null, $torrent->tmdb); } else { - $meta = $client->scrape('movie', 'tt'.$torrent->imdb); + $meta = $movieScrapper->scrape('movie', 'tt'.$torrent->imdb); } } diff --git a/app/Console/Commands/FetchReleaseYears.php b/app/Console/Commands/FetchReleaseYears.php index 6f8cea9e02..573f6b0203 100644 --- a/app/Console/Commands/FetchReleaseYears.php +++ b/app/Console/Commands/FetchReleaseYears.php @@ -44,7 +44,7 @@ class FetchReleaseYears extends Command */ public function handle() { - $client = new MovieScrapper(config('api-keys.tmdb'), config('api-keys.tvdb'), config('api-keys.omdb')); + $movieScrapper = new MovieScrapper(config('api-keys.tmdb'), config('api-keys.tvdb'), config('api-keys.omdb')); $appurl = config('app.url'); $torrents = Torrent::withAnyStatus() @@ -69,9 +69,9 @@ public function handle() if ($torrent->category->tv_meta) { if ($torrent->tmdb && $torrent->tmdb != 0) { - $meta = $client->scrape('tv', null, $torrent->tmdb); + $meta = $movieScrapper->scrape('tv', null, $torrent->tmdb); } else { - $meta = $client->scrape('tv', 'tt'.$torrent->imdb); + $meta = $movieScrapper->scrape('tv', 'tt'.$torrent->imdb); } if (isset($meta->releaseYear) && $meta->releaseYear > '1900') { $torrent->release_year = $meta->releaseYear; @@ -87,9 +87,9 @@ public function handle() if ($torrent->category->movie_meta) { if ($torrent->tmdb && $torrent->tmdb != 0) { - $meta = $client->scrape('movie', null, $torrent->tmdb); + $meta = $movieScrapper->scrape('movie', null, $torrent->tmdb); } else { - $meta = $client->scrape('movie', 'tt'.$torrent->imdb); + $meta = $movieScrapper->scrape('movie', 'tt'.$torrent->imdb); } if (isset($meta->releaseYear) && $meta->releaseYear > '1900') { $torrent->release_year = $meta->releaseYear; diff --git a/app/Console/Commands/IrcBroadcast.php b/app/Console/Commands/IrcBroadcast.php index 87c09cd6af..86d4e0b468 100644 --- a/app/Console/Commands/IrcBroadcast.php +++ b/app/Console/Commands/IrcBroadcast.php @@ -52,8 +52,8 @@ public function __construct() public function handle() { $this->info('Broadcasting: '.$this->argument('message')); - $bot = new IRCAnnounceBot(); - $bot->broadcast($this->argument('message')); + $ircAnnounceBot = new IRCAnnounceBot(); + $ircAnnounceBot->broadcast($this->argument('message')); } /** diff --git a/app/Console/Commands/IrcMessage.php b/app/Console/Commands/IrcMessage.php index d0a17cc9ca..265d6563fd 100644 --- a/app/Console/Commands/IrcMessage.php +++ b/app/Console/Commands/IrcMessage.php @@ -52,8 +52,8 @@ public function __construct() public function handle() { $this->info('Messaging '.$this->argument('channel').': '.$this->argument('message')); - $bot = new IRCAnnounceBot(); - $bot->message($this->argument('channel'), $this->argument('message')); + $ircAnnounceBot = new IRCAnnounceBot(); + $ircAnnounceBot->message($this->argument('channel'), $this->argument('message')); } /** diff --git a/app/Exceptions/Handler.php b/app/Exceptions/Handler.php index 284ab47de7..286b7eebc2 100644 --- a/app/Exceptions/Handler.php +++ b/app/Exceptions/Handler.php @@ -53,9 +53,9 @@ class Handler extends ExceptionHandler * * @return void */ - public function report(Throwable $exception) + public function report(Throwable $throwable) { - parent::report($exception); + parent::report($throwable); } /** @@ -68,8 +68,8 @@ public function report(Throwable $exception) * * @return \Illuminate\Http\Response */ - public function render($request, Throwable $exception) + public function render($request, Throwable $throwable) { - return parent::render($request, $exception); + return parent::render($request, $throwable); } } diff --git a/app/Helpers/BackupPassword.php b/app/Helpers/BackupPassword.php index 562c2781fc..cad653f6b0 100644 --- a/app/Helpers/BackupPassword.php +++ b/app/Helpers/BackupPassword.php @@ -41,7 +41,7 @@ class BackupPassword * * @throws \PhpZip\Exception\ZipException */ - public function __construct(BackupEncryption $encryption, string $path) + public function __construct(BackupEncryption $backupEncryption, string $path) { $this->password = config('backup.security.password'); @@ -52,13 +52,13 @@ public function __construct(BackupEncryption $encryption, string $path) // If ZipArchive is enabled if (class_exists('ZipArchive') && in_array('setEncryptionIndex', get_class_methods('ZipArchive'))) { consoleOutput()->info('Applying password and encryption to zip using ZipArchive...'); - $this->makeZipArchive($encryption, $path); + $this->makeZipArchive($backupEncryption, $path); } // Fall back on PHP-driven ZipFile else { consoleOutput()->info('Applying password and encryption to zip using ZipFile...'); - $this->makeZipFile($encryption, $path); + $this->makeZipFile($backupEncryption, $path); } consoleOutput()->info('Successfully applied password and encryption to zip.'); @@ -74,9 +74,9 @@ public function __construct(BackupEncryption $encryption, string $path) * * @return void */ - protected function makeZipArchive(BackupEncryption $encryption, string $path): void + protected function makeZipArchive(BackupEncryption $backupEncryption, string $path): void { - $encryptionConstant = $encryption->getEncryptionConstant( + $encryptionConstant = $backupEncryption->getEncryptionConstant( config('backup.security.encryption'), 'ZipArchive' ); @@ -103,9 +103,9 @@ protected function makeZipArchive(BackupEncryption $encryption, string $path): v * * @return void */ - protected function makeZipFile(BackupEncryption $encryption, string $path): void + protected function makeZipFile(BackupEncryption $backupEncryption, string $path): void { - $encryptionConstant = $encryption->getEncryptionConstant( + $encryptionConstant = $backupEncryption->getEncryptionConstant( config('backup.security.encryption'), 'ZipFile' ); diff --git a/app/Helpers/Markdown.php b/app/Helpers/Markdown.php index 85649d451d..5084f0ed60 100644 --- a/app/Helpers/Markdown.php +++ b/app/Helpers/Markdown.php @@ -1441,11 +1441,11 @@ public static function instance($name = 'default') return self::$instances[$name]; } - $instance = new static(); + $static = new static(); - self::$instances[$name] = $instance; + self::$instances[$name] = $static; - return $instance; + return $static; } private static $instances = []; diff --git a/app/Helpers/TorrentHelper.php b/app/Helpers/TorrentHelper.php index a0c9d5c954..f2a0d57e4e 100644 --- a/app/Helpers/TorrentHelper.php +++ b/app/Helpers/TorrentHelper.php @@ -100,15 +100,15 @@ public static function approveHelper($id) // Announce To IRC if (config('irc-bot.enabled') == true) { $appname = config('app.name'); - $bot = new IRCAnnounceBot(); + $ircAnnounceBot = new IRCAnnounceBot(); if ($anon == 0) { - $bot->message(config('irc-bot.channels'), '['.$appname.'] User '.$username.' has uploaded '.$torrent->name.' grab it now!'); - $bot->message(config('irc-bot.channels'), '[Category: '.$torrent->category->name.'] [Type: '.$torrent->type->name.'] [Size:'.$torrent->getSize().']'); - $bot->message(config('irc-bot.channels'), sprintf('[Link: %s/torrents/', $appurl).$id.']'); + $ircAnnounceBot->message(config('irc-bot.channels'), '['.$appname.'] User '.$username.' has uploaded '.$torrent->name.' grab it now!'); + $ircAnnounceBot->message(config('irc-bot.channels'), '[Category: '.$torrent->category->name.'] [Type: '.$torrent->type->name.'] [Size:'.$torrent->getSize().']'); + $ircAnnounceBot->message(config('irc-bot.channels'), sprintf('[Link: %s/torrents/', $appurl).$id.']'); } else { - $bot->message(config('irc-bot.channels'), '['.$appname.'] An anonymous user has uploaded '.$torrent->name.' grab it now!'); - $bot->message(config('irc-bot.channels'), '[Category: '.$torrent->category->name.'] [Type: '.$torrent->type->name.'] [Size: '.$torrent->getSize().']'); - $bot->message(config('irc-bot.channels'), sprintf('[Link: %s/torrents/', $appurl).$id.']'); + $ircAnnounceBot->message(config('irc-bot.channels'), '['.$appname.'] An anonymous user has uploaded '.$torrent->name.' grab it now!'); + $ircAnnounceBot->message(config('irc-bot.channels'), '[Category: '.$torrent->category->name.'] [Type: '.$torrent->type->name.'] [Size: '.$torrent->getSize().']'); + $ircAnnounceBot->message(config('irc-bot.channels'), sprintf('[Link: %s/torrents/', $appurl).$id.']'); } } } diff --git a/app/Http/Controllers/API/ChatController.php b/app/Http/Controllers/API/ChatController.php index 04a912ed49..b5cac95e6c 100644 --- a/app/Http/Controllers/API/ChatController.php +++ b/app/Http/Controllers/API/ChatController.php @@ -37,83 +37,83 @@ class ChatController extends Controller /** * @var ChatRepository */ - private $chat; + private $chatRepository; /** * @var AuthManager */ - private $auth; + private $authManager; - public function __construct(ChatRepository $chat, \Illuminate\Contracts\Auth\Factory $auth) + public function __construct(ChatRepository $chatRepository, \Illuminate\Contracts\Auth\Factory $factory) { - $this->chat = $chat; - $this->auth = $auth; + $this->chatRepository = $chatRepository; + $this->authManager = $factory; } /* STATUSES */ public function statuses() { - return response($this->chat->statuses()); + return response($this->chatRepository->statuses()); } /* ECHOES */ public function echoes() { - $user = User::with(['echoes'])->findOrFail($this->auth->user()->id); + $user = User::with(['echoes'])->findOrFail($this->authManager->user()->id); if (! $user->echoes || (is_countable($user->echoes->toArray()) ? count($user->echoes->toArray()) : 0) < 1) { - $echoes = new UserEcho(); - $echoes->user_id = $this->auth->user()->id; - $echoes->room_id = 1; - $echoes->save(); + $userEcho = new UserEcho(); + $userEcho->user_id = $this->authManager->user()->id; + $userEcho->room_id = 1; + $userEcho->save(); } - return UserEchoResource::collection($this->chat->echoes($this->auth->user()->id)); + return UserEchoResource::collection($this->chatRepository->echoes($this->authManager->user()->id)); } /* AUDIBLES */ public function audibles() { - $user = User::with(['audibles'])->findOrFail($this->auth->user()->id); + $user = User::with(['audibles'])->findOrFail($this->authManager->user()->id); if (! $user->audibles || (is_countable($user->audibles->toArray()) ? count($user->audibles->toArray()) : 0) < 1) { - $audibles = new UserAudible(); - $audibles->user_id = $this->auth->user()->id; - $audibles->room_id = 1; - $audibles->status = 1; - $audibles->save(); + $userAudible = new UserAudible(); + $userAudible->user_id = $this->authManager->user()->id; + $userAudible->room_id = 1; + $userAudible->status = 1; + $userAudible->save(); } - return UserAudibleResource::collection($this->chat->audibles($this->auth->user()->id)); + return UserAudibleResource::collection($this->chatRepository->audibles($this->authManager->user()->id)); } /* BOTS */ public function bots() { - return BotResource::collection($this->chat->bots()); + return BotResource::collection($this->chatRepository->bots()); } /* ROOMS */ public function rooms() { - return ChatRoomResource::collection($this->chat->rooms()); + return ChatRoomResource::collection($this->chatRepository->rooms()); } public function config() { - return response($this->chat->config()); + return response($this->chatRepository->config()); } /* MESSAGES */ public function messages($room_id) { - return ChatMessageResource::collection($this->chat->messages($room_id)); + return ChatMessageResource::collection($this->chatRepository->messages($room_id)); } /* MESSAGES */ public function privateMessages($target_id) { - return ChatMessageResource::collection($this->chat->privateMessages($this->auth->user()->id, $target_id)); + return ChatMessageResource::collection($this->chatRepository->privateMessages($this->authManager->user()->id, $target_id)); } /* MESSAGES */ @@ -121,18 +121,18 @@ public function botMessages($bot_id) { $bot = Bot::where('id', '=', $bot_id)->firstOrFail(); if ($bot->is_systembot) { - $runbot = new SystemBot($this->chat); + $runbot = new SystemBot($this->chatRepository); } elseif ($bot->is_nerdbot) { - $runbot = new NerdBot($this->chat); + $runbot = new NerdBot($this->chatRepository); } - $runbot->process('message', $this->auth->user(), '', 0); + $runbot->process('message', $this->authManager->user(), '', 0); - return ChatMessageResource::collection($this->chat->botMessages($this->auth->user()->id, $bot->id)); + return ChatMessageResource::collection($this->chatRepository->botMessages($this->authManager->user()->id, $bot->id)); } public function createMessage(Request $request) { - $user = $this->auth->user(); + $user = $this->authManager->user(); $user_id = $user->id; $receiver_id = $request->input('receiver_id'); @@ -188,7 +188,7 @@ public function createMessage(Request $request) $message = '/bot gift'.substr($message, strlen($trip) + 1, strlen($message)); } if ($target == 'system') { - $runbot = new SystemBot($this->chat); + $runbot = new SystemBot($this->chatRepository); } if ($which == null) { foreach ($bots as $bot) { @@ -219,15 +219,15 @@ public function createMessage(Request $request) if ($which != null && $which != 'skip' && ! $runbot) { if ($bot->is_systembot) { - $runbot = new SystemBot($this->chat); + $runbot = new SystemBot($this->chatRepository); } elseif ($bot->is_nerdbot) { - $runbot = new NerdBot($this->chat); + $runbot = new NerdBot($this->chatRepository); } elseif ($bot->is_casinobot) { - $runbot = new CasinoBot($this->chat); + $runbot = new CasinoBot($this->chatRepository); } } if ($runbot !== null) { - return $runbot->process($which, $this->auth->user(), $message, 0); + return $runbot->process($which, $this->authManager->user(), $message, 0); } $echo = false; @@ -336,11 +336,11 @@ public function createMessage(Request $request) $ignore = $bot_id > 0 && $receiver_id == 1 ? true : null; $save = true; $echo = true; - $message = $this->chat->privateMessage($user_id, $room_id, $message, $receiver_id, null, $ignore); + $message = $this->chatRepository->privateMessage($user_id, $room_id, $message, $receiver_id, null, $ignore); } else { $receiver_id = null; $bot_id = null; - $message = $this->chat->message($user_id, $room_id, $message, $receiver_id, $bot_id); + $message = $this->chatRepository->message($user_id, $room_id, $message, $receiver_id, $bot_id); } if (! $save) { @@ -356,7 +356,7 @@ public function createMessage(Request $request) public function deleteMessage($id) { - $this->chat->deleteMessage($id); + $this->chatRepository->deleteMessage($id); return response('success'); } @@ -367,7 +367,7 @@ public function deleteRoomEcho(Request $request, $user_id) $echo->delete(); $user = User::with(['chatStatus', 'chatroom', 'group', 'echoes'])->findOrFail($user_id); - $room = $this->chat->roomFindOrFail($request->input('room_id')); + $room = $this->chatRepository->roomFindOrFail($request->input('room_id')); $user->chatroom()->dissociate(); $user->chatroom()->associate($room); @@ -467,11 +467,11 @@ public function updateUserChatStatus(Request $request, $id) $systemUser = User::where('username', 'System')->firstOrFail(); $user = User::with(['chatStatus', 'chatroom', 'group', 'echoes'])->findOrFail($id); - $status = $this->chat->statusFindOrFail($request->input('status_id')); + $status = $this->chatRepository->statusFindOrFail($request->input('status_id')); $log = '[url=/users/'.$user->username.']'.$user->username.'[/url] has updated their status to [b]'.$status->name.'[/b]'; - $message = $this->chat->message($systemUser->id, $user->chatroom->id, $log, null); + $message = $this->chatRepository->message($systemUser->id, $user->chatroom->id, $log, null); $message->save(); $user->chatStatus()->dissociate(); @@ -484,7 +484,7 @@ public function updateUserChatStatus(Request $request, $id) public function updateUserRoom(Request $request, $id) { $user = User::with(['chatStatus', 'chatroom', 'group', 'echoes'])->findOrFail($id); - $room = $this->chat->roomFindOrFail($request->input('room_id')); + $room = $this->chatRepository->roomFindOrFail($request->input('room_id')); $user->chatroom()->dissociate(); $user->chatroom()->associate($room); @@ -503,10 +503,10 @@ public function updateUserRoom(Request $request, $id) } } if (! $sender_listening) { - $sender_port = new UserEcho(); - $sender_port->user_id = $id; - $sender_port->room_id = $room->id; - $sender_port->save(); + $userEcho = new UserEcho(); + $userEcho->user_id = $id; + $userEcho->room_id = $room->id; + $userEcho->save(); $sender_echoes = UserEcho::with(['room', 'target', 'bot'])->whereRaw('user_id = ?', [$id])->get(); $sender_dirty = 1; } diff --git a/app/Http/Controllers/API/TorrentController.php b/app/Http/Controllers/API/TorrentController.php index d70e80bcb4..cf468e3548 100644 --- a/app/Http/Controllers/API/TorrentController.php +++ b/app/Http/Controllers/API/TorrentController.php @@ -37,16 +37,16 @@ class TorrentController extends BaseController /** * @var ChatRepository */ - private $chat; + private $chatRepository; /** * RequestController Constructor. * * @param ChatRepository $chat */ - public function __construct(ChatRepository $chat) + public function __construct(ChatRepository $chatRepository) { - $this->chat = $chat; + $this->chatRepository = $chatRepository; } /** @@ -83,7 +83,7 @@ public function store(Request $request, Torrent $torrent) return $this->sendError('Validation Error.', 'You Must Provide A Valid Torrent File For Upload!'); } - $client = new \App\Services\MovieScrapper(config('api-keys.tmdb'), config('api-keys.tvdb'), config('api-keys.omdb')); + $movieScrapper = new \App\Services\MovieScrapper(config('api-keys.tmdb'), config('api-keys.tvdb'), config('api-keys.omdb')); // Deplace and decode the torrent temporarily $decodedTorrent = TorrentTools::normalizeTorrent($requestFile); $infohash = Bencode::get_infohash($decodedTorrent); @@ -172,10 +172,10 @@ public function store(Request $request, Torrent $torrent) $torrent->save(); // Set torrent to featured if ($torrent->featured == 1) { - $feature = new FeaturedTorrent(); - $feature->user_id = $user->id; - $feature->torrent_id = $torrent->id; - $feature->save(); + $featuredTorrent = new FeaturedTorrent(); + $featuredTorrent->user_id = $user->id; + $featuredTorrent->torrent_id = $torrent->id; + $featuredTorrent->save(); } // Count and save the torrent number in this category $category->num_torrent = $category->torrents_count; @@ -183,27 +183,27 @@ public function store(Request $request, Torrent $torrent) // Backup the files contained in the torrent $fileList = TorrentTools::getTorrentFiles($decodedTorrent); foreach ($fileList as $file) { - $f = new TorrentFile(); - $f->name = $file['name']; - $f->size = $file['size']; - $f->torrent_id = $torrent->id; - $f->save(); - unset($f); + $torrentFile = new TorrentFile(); + $torrentFile->name = $file['name']; + $torrentFile->size = $file['size']; + $torrentFile->torrent_id = $torrent->id; + $torrentFile->save(); + unset($torrentFile); } $meta = null; // Torrent Tags System if ($torrent->category->tv_meta) { if ($torrent->tmdb && $torrent->tmdb != 0) { - $meta = $client->scrape('tv', null, $torrent->tmdb); + $meta = $movieScrapper->scrape('tv', null, $torrent->tmdb); } else { - $meta = $client->scrape('tv', 'tt'.$torrent->imdb); + $meta = $movieScrapper->scrape('tv', 'tt'.$torrent->imdb); } } if ($torrent->category->movie_meta) { if ($torrent->tmdb && $torrent->tmdb != 0) { - $meta = $client->scrape('movie', null, $torrent->tmdb); + $meta = $movieScrapper->scrape('movie', null, $torrent->tmdb); } else { - $meta = $client->scrape('movie', 'tt'.$torrent->imdb); + $meta = $movieScrapper->scrape('movie', 'tt'.$torrent->imdb); } } if (isset($meta) && $meta->genres) { @@ -227,33 +227,33 @@ public function store(Request $request, Torrent $torrent) // Announce To Shoutbox if ($anon == 0) { - $this->chat->systemMessage( + $this->chatRepository->systemMessage( sprintf('User [url=%s/users/', $appurl).$username.']'.$username.sprintf('[/url] has uploaded [url=%s/torrents/', $appurl).$torrent->id.']'.$torrent->name.'[/url] grab it now! :slight_smile:' ); } else { - $this->chat->systemMessage( + $this->chatRepository->systemMessage( sprintf('An anonymous user has uploaded [url=%s/torrents/', $appurl).$torrent->id.']'.$torrent->name.'[/url] grab it now! :slight_smile:' ); } if ($anon == 1 && $featured == 1) { - $this->chat->systemMessage( + $this->chatRepository->systemMessage( sprintf('Ladies and Gents, [url=%s/torrents/', $appurl).$torrent->id.']'.$torrent->name.'[/url] has been added to the Featured Torrents Slider by an anonymous user! Grab It While You Can! :fire:' ); } elseif ($anon == 0 && $featured == 1) { - $this->chat->systemMessage( + $this->chatRepository->systemMessage( sprintf('Ladies and Gents, [url=%s/torrents/', $appurl).$torrent->id.']'.$torrent->name.sprintf('[/url] has been added to the Featured Torrents Slider by [url=%s/users/', $appurl).$username.']'.$username.'[/url]! Grab It While You Can! :fire:' ); } if ($free == 1 && $featured == 0) { - $this->chat->systemMessage( + $this->chatRepository->systemMessage( sprintf('Ladies and Gents, [url=%s/torrents/', $appurl).$torrent->id.']'.$torrent->name.'[/url] has been granted 100%% FreeLeech! Grab It While You Can! :fire:' ); } if ($doubleup == 1 && $featured == 0) { - $this->chat->systemMessage( + $this->chatRepository->systemMessage( sprintf('Ladies and Gents, [url=%s/torrents/', $appurl).$torrent->id.']'.$torrent->name.'[/url] has been granted Double Upload! Grab It While You Can! :fire:' ); } diff --git a/app/Http/Controllers/AlbumController.php b/app/Http/Controllers/AlbumController.php index 0bcfdf99de..cc97f6bf66 100644 --- a/app/Http/Controllers/AlbumController.php +++ b/app/Http/Controllers/AlbumController.php @@ -25,16 +25,16 @@ class AlbumController extends Controller /** * @var OmdbClient */ - private $client; + private $omdbClient; /** * AlbumController Constructor. * * @param OmdbClient $client */ - public function __construct(OmdbClient $client) + public function __construct(OmdbClient $omdbClient) { - $this->client = $client; + $this->omdbClient = $omdbClient; } /** @@ -69,7 +69,7 @@ public function create() public function store(Request $request) { $imdb = Str::startsWith($request->input('imdb'), 'tt') ? $request->input('imdb') : 'tt'.$request->input('imdb'); - $omdb = $this->client->find(['imdb' => $imdb]); + $omdb = $this->omdbClient->find(['imdb' => $imdb]); if ($omdb === null || ! $omdb) { return redirect()->route('albums.create') diff --git a/app/Http/Controllers/Auth/RegisterController.php b/app/Http/Controllers/Auth/RegisterController.php index fdd0caa66d..d7ce4f922e 100644 --- a/app/Http/Controllers/Auth/RegisterController.php +++ b/app/Http/Controllers/Auth/RegisterController.php @@ -33,16 +33,16 @@ class RegisterController extends Controller /** * @var ChatRepository */ - private $chat; + private $chatRepository; /** * RegisterController Constructor. * * @param ChatRepository $chat */ - public function __construct(ChatRepository $chat) + public function __construct(ChatRepository $chatRepository) { - $this->chat = $chat; + $this->chatRepository = $chatRepository; } /** @@ -127,14 +127,14 @@ public function register(Request $request, $code = null) ->withErrors($v->errors()); } $user->save(); - $privacy = new UserPrivacy(); - $privacy->setDefaultValues(); - $privacy->user_id = $user->id; - $privacy->save(); - $notification = new UserNotification(); - $notification->setDefaultValues(); - $notification->user_id = $user->id; - $notification->save(); + $userPrivacy = new UserPrivacy(); + $userPrivacy->setDefaultValues(); + $userPrivacy->user_id = $user->id; + $userPrivacy->save(); + $userNotification = new UserNotification(); + $userNotification->setDefaultValues(); + $userNotification->user_id = $user->id; + $userNotification->save(); if ($key) { // Update The Invite Record $key->accepted_by = $user->id; @@ -143,10 +143,10 @@ public function register(Request $request, $code = null) } // Handle The Activation System $token = hash_hmac('sha256', $user->username.$user->email.Str::random(16), config('app.key')); - $activation = new UserActivation(); - $activation->user_id = $user->id; - $activation->token = $token; - $activation->save(); + $userActivation = new UserActivation(); + $userActivation->user_id = $user->id; + $userActivation->token = $token; + $userActivation->save(); $this->dispatch(new SendActivationMail($user, $token)); // Select A Random Welcome Message $profile_url = href_profile($user); @@ -160,16 +160,16 @@ public function register(Request $request, $code = null) 'Welcome to '.config('other.title').sprintf(' [url=%s]%s[/url]. We were expecting you ( ͡° ͜ʖ ͡°)', $profile_url, $user->username), ]; $selected = mt_rand(0, count($welcomeArray) - 1); - $this->chat->systemMessage( + $this->chatRepository->systemMessage( $welcomeArray[$selected] ); // Send Welcome PM - $pm = new PrivateMessage(); - $pm->sender_id = 1; - $pm->receiver_id = $user->id; - $pm->subject = config('welcomepm.subject'); - $pm->message = config('welcomepm.message'); - $pm->save(); + $privateMessage = new PrivateMessage(); + $privateMessage->sender_id = 1; + $privateMessage->receiver_id = $user->id; + $privateMessage->subject = config('welcomepm.subject'); + $privateMessage->message = config('welcomepm.message'); + $privateMessage->save(); return redirect()->route('login') ->withSuccess(trans('auth.register-thanks')); diff --git a/app/Http/Controllers/Auth/TwoStepController.php b/app/Http/Controllers/Auth/TwoStepController.php index a102574a4c..421480aced 100644 --- a/app/Http/Controllers/Auth/TwoStepController.php +++ b/app/Http/Controllers/Auth/TwoStepController.php @@ -124,7 +124,7 @@ public function showVerification() return view('auth.twostep-exceeded')->with($data); } - $now = new Carbon(); + $carbon = new Carbon(); $sentTimestamp = $twoStepAuth->requestDate; if (! $twoStepAuth->authCode) { @@ -137,7 +137,7 @@ public function showVerification() } else { $timeBuffer = config('laravel2step.laravel2stepTimeResetBufferSeconds'); $timeAllowedToSendCode = $sentTimestamp->addSeconds($timeBuffer); - if ($now->gt($timeAllowedToSendCode)) { + if ($carbon->gt($timeAllowedToSendCode)) { $this->sendVerificationCodeNotification($twoStepAuth); $twoStepAuth->requestDate = new Carbon(); $twoStepAuth->save(); diff --git a/app/Http/Controllers/BonusController.php b/app/Http/Controllers/BonusController.php index 2cf5128f38..095f777da0 100644 --- a/app/Http/Controllers/BonusController.php +++ b/app/Http/Controllers/BonusController.php @@ -34,7 +34,7 @@ class BonusController extends Controller /** * @var ChatRepository */ - private $chat; + private $chatRepository; /** * The library used for parsing byte units. @@ -51,11 +51,11 @@ class BonusController extends Controller */ public function __construct( \App\Interfaces\ByteUnitsInterface $byteUnits, - ChatRepository $chat + ChatRepository $chatRepository ) { $this->byteUnits = $byteUnits; - $this->chat = $chat; + $this->chatRepository = $chatRepository; } /** @@ -296,18 +296,18 @@ public function doItemExchange($userID, $itemID) } } elseif ($item['personal_freeleech'] == true) { if (! $activefl) { - $personal_freeleech = new PersonalFreeleech(); - $personal_freeleech->user_id = $user_acc->id; - $personal_freeleech->save(); + $personalFreeleech = new PersonalFreeleech(); + $personalFreeleech->user_id = $user_acc->id; + $personalFreeleech->save(); // Send Private Message - $pm = new PrivateMessage(); - $pm->sender_id = 1; - $pm->receiver_id = $user_acc->id; - $pm->subject = 'Personal 24 Hour Freeleech Activated'; - $pm->message = sprintf('Your [b]Personal 24 Hour Freeleech[/b] session has started! It will expire on %s [b]', $current->addDays(1)->toDayDateTimeString()).config('app.timezone').'[/b]! + $privateMessage = new PrivateMessage(); + $privateMessage->sender_id = 1; + $privateMessage->receiver_id = $user_acc->id; + $privateMessage->subject = 'Personal 24 Hour Freeleech Activated'; + $privateMessage->message = sprintf('Your [b]Personal 24 Hour Freeleech[/b] session has started! It will expire on %s [b]', $current->addDays(1)->toDayDateTimeString()).config('app.timezone').'[/b]! [color=red][b]THIS IS AN AUTOMATED SYSTEM MESSAGE, PLEASE DO NOT REPLY![/b][/color]'; - $pm->save(); + $privateMessage->save(); } else { return false; } @@ -367,24 +367,24 @@ public function sendGift(Request $request) $user->seedbonus -= $value; $user->save(); - $transaction = new BonTransactions(); - $transaction->itemID = 0; - $transaction->name = 'gift'; - $transaction->cost = $value; - $transaction->sender = $user->id; - $transaction->receiver = $recipient->id; - $transaction->comment = $request->input('bonus_message'); - $transaction->torrent_id = null; - $transaction->save(); + $bonTransactions = new BonTransactions(); + $bonTransactions->itemID = 0; + $bonTransactions->name = 'gift'; + $bonTransactions->cost = $value; + $bonTransactions->sender = $user->id; + $bonTransactions->receiver = $recipient->id; + $bonTransactions->comment = $request->input('bonus_message'); + $bonTransactions->torrent_id = null; + $bonTransactions->save(); if ($user->id != $recipient->id && $recipient->acceptsNotification($request->user(), $recipient, 'bon', 'show_bon_gift')) { - $recipient->notify(new NewBon('gift', $user->username, $transaction)); + $recipient->notify(new NewBon('gift', $user->username, $bonTransactions)); } $profile_url = href_profile($user); $recipient_url = href_profile($recipient); - $this->chat->systemMessage( + $this->chatRepository->systemMessage( sprintf('[url=%s]%s[/url] has gifted %s BON to [url=%s]%s[/url]', $profile_url, $user->username, $value, $recipient_url, $recipient->username) ); @@ -453,15 +453,15 @@ public function tipUploader(Request $request, $id) $user->seedbonus -= $tip_amount; $user->save(); - $transaction = new BonTransactions(); - $transaction->itemID = 0; - $transaction->name = 'tip'; - $transaction->cost = $tip_amount; - $transaction->sender = $user->id; - $transaction->receiver = $uploader->id; - $transaction->comment = 'tip'; - $transaction->torrent_id = $torrent->id; - $transaction->save(); + $bonTransactions = new BonTransactions(); + $bonTransactions->itemID = 0; + $bonTransactions->name = 'tip'; + $bonTransactions->cost = $tip_amount; + $bonTransactions->sender = $user->id; + $bonTransactions->receiver = $uploader->id; + $bonTransactions->comment = 'tip'; + $bonTransactions->torrent_id = $torrent->id; + $bonTransactions->save(); if ($uploader->acceptsNotification($request->user(), $uploader, 'torrent', 'show_torrent_tip')) { $uploader->notify(new NewUploadTip('torrent', $user->username, $tip_amount, $torrent)); @@ -508,15 +508,15 @@ public function tipPoster(Request $request) $user->seedbonus -= $tip_amount; $user->save(); - $transaction = new BonTransactions(); - $transaction->itemID = 0; - $transaction->name = 'tip'; - $transaction->cost = $tip_amount; - $transaction->sender = $user->id; - $transaction->receiver = $poster->id; - $transaction->comment = 'tip'; - $transaction->post_id = $post->id; - $transaction->save(); + $bonTransactions = new BonTransactions(); + $bonTransactions->itemID = 0; + $bonTransactions->name = 'tip'; + $bonTransactions->cost = $tip_amount; + $bonTransactions->sender = $user->id; + $bonTransactions->receiver = $poster->id; + $bonTransactions->comment = 'tip'; + $bonTransactions->post_id = $post->id; + $bonTransactions->save(); $poster->notify(new NewPostTip('forum', $user->username, $tip_amount, $post)); diff --git a/app/Http/Controllers/CategoryController.php b/app/Http/Controllers/CategoryController.php index 63f60d0b47..b8afd6a02d 100644 --- a/app/Http/Controllers/CategoryController.php +++ b/app/Http/Controllers/CategoryController.php @@ -43,13 +43,13 @@ public function index() public function show(Request $request, $id) { $user = $request->user(); - $client = new \App\Services\MovieScrapper(config('api-keys.tmdb'), config('api-keys.tvdb'), config('api-keys.omdb')); + $movieScrapper = new \App\Services\MovieScrapper(config('api-keys.tmdb'), config('api-keys.tvdb'), config('api-keys.omdb')); $category = Category::select(['id', 'name'])->findOrFail($id); $torrents = Torrent::with(['user', 'category', 'type'])->withCount(['thanks', 'comments'])->where('category_id', '=', $id)->orderBy('sticky', 'desc')->latest()->paginate(25); $personal_freeleech = PersonalFreeleech::where('user_id', '=', $user->id)->first(); return view('category.show', [ - 'client' => $client, + 'client' => $movieScrapper, 'torrents' => $torrents, 'user' => $user, 'category' => $category, diff --git a/app/Http/Controllers/CommentController.php b/app/Http/Controllers/CommentController.php index 43fc4d975c..2efd90b9c0 100644 --- a/app/Http/Controllers/CommentController.php +++ b/app/Http/Controllers/CommentController.php @@ -41,12 +41,12 @@ class CommentController extends Controller /** * @var TaggedUserRepository */ - private $tag; + private $taggedUserRepository; /** * @var ChatRepository */ - private $chat; + private $chatRepository; /** * CommentController Constructor. @@ -54,10 +54,10 @@ class CommentController extends Controller * @param TaggedUserRepository $tag * @param ChatRepository $chat */ - public function __construct(TaggedUserRepository $tag, ChatRepository $chat) + public function __construct(TaggedUserRepository $taggedUserRepository, ChatRepository $chatRepository) { - $this->tag = $tag; - $this->chat = $chat; + $this->taggedUserRepository = $taggedUserRepository; + $this->chatRepository = $chatRepository; } /** @@ -100,22 +100,22 @@ public function article(Request $request, $id) $profile_url = href_profile($user); // Auto Shout if ($comment->anon == 0) { - $this->chat->systemMessage( + $this->chatRepository->systemMessage( sprintf('[url=%s]%s[/url] has left a comment on article [url=%s]%s[/url]', $profile_url, $user->username, $article_url, $article->title) ); } else { - $this->chat->systemMessage( + $this->chatRepository->systemMessage( sprintf('An anonymous user has left a comment on article [url=%s]%s[/url]', $article_url, $article->title) ); } - if ($this->tag->hasTags($request->input('content'))) { - if ($this->tag->contains($request->input('content'), '@here') && $user->group->is_modo) { + if ($this->taggedUserRepository->hasTags($request->input('content'))) { + if ($this->taggedUserRepository->contains($request->input('content'), '@here') && $user->group->is_modo) { $users = collect([]); $article->comments()->get()->each(function ($c) use ($users) { $users->push($c->user); }); - $this->tag->messageCommentUsers( + $this->taggedUserRepository->messageCommentUsers( 'article', $users, $user, @@ -124,7 +124,7 @@ public function article(Request $request, $id) ); } else { $sender = $comment->anon ? 'Anonymous' : $user->username; - $this->tag->messageTaggedCommentUsers( + $this->taggedUserRepository->messageTaggedCommentUsers( 'article', $request->input('content'), $user, @@ -191,22 +191,22 @@ public function playlist(Request $request, $id) $profile_url = href_profile($user); // Auto Shout if ($comment->anon == 0) { - $this->chat->systemMessage( + $this->chatRepository->systemMessage( sprintf('[url=%s]%s[/url] has left a comment on playlist [url=%s]%s[/url]', $profile_url, $user->username, $playlist_url, $playlist->name) ); } else { - $this->chat->systemMessage( + $this->chatRepository->systemMessage( sprintf('An anonymous user has left a comment on playlist [url=%s]%s[/url]', $playlist_url, $playlist->name) ); } - if ($this->tag->hasTags($request->input('content'))) { - if ($this->tag->contains($request->input('content'), '@here') && $user->group->is_modo) { + if ($this->taggedUserRepository->hasTags($request->input('content'))) { + if ($this->taggedUserRepository->contains($request->input('content'), '@here') && $user->group->is_modo) { $users = collect([]); $playlist->comments()->get()->each(function ($c) use ($users) { $users->push($c->user); }); - $this->tag->messageCommentUsers( + $this->taggedUserRepository->messageCommentUsers( 'playlist', $users, $user, @@ -215,7 +215,7 @@ public function playlist(Request $request, $id) ); } else { $sender = $comment->anon ? 'Anonymous' : $user->username; - $this->tag->messageTaggedCommentUsers( + $this->taggedUserRepository->messageTaggedCommentUsers( 'playlist', $request->input('content'), $user, @@ -286,22 +286,22 @@ public function torrent(Request $request, $id) $profile_url = href_profile($user); // Auto Shout if ($comment->anon == 0) { - $this->chat->systemMessage( + $this->chatRepository->systemMessage( sprintf('[url=%s]%s[/url] has left a comment on Torrent [url=%s]%s[/url]', $profile_url, $user->username, $torrent_url, $torrent->name) ); } else { - $this->chat->systemMessage( + $this->chatRepository->systemMessage( sprintf('An anonymous user has left a comment on torrent [url=%s]%s[/url]', $torrent_url, $torrent->name) ); } - if ($this->tag->hasTags($request->input('content'))) { - if ($this->tag->contains($request->input('content'), '@here') && $user->group->is_modo) { + if ($this->taggedUserRepository->hasTags($request->input('content'))) { + if ($this->taggedUserRepository->contains($request->input('content'), '@here') && $user->group->is_modo) { $users = collect([]); $torrent->comments()->get()->each(function ($c) use ($users) { $users->push($c->user); }); - $this->tag->messageCommentUsers( + $this->taggedUserRepository->messageCommentUsers( 'torrent', $users, $user, @@ -310,7 +310,7 @@ public function torrent(Request $request, $id) ); } else { $sender = $comment->anon ? 'Anonymous' : $user->username; - $this->tag->messageTaggedCommentUsers( + $this->taggedUserRepository->messageTaggedCommentUsers( 'torrent', $request->input('content'), $user, @@ -377,11 +377,11 @@ public function request(Request $request, $id) $profile_url = href_profile($user); // Auto Shout if ($comment->anon == 0) { - $this->chat->systemMessage( + $this->chatRepository->systemMessage( sprintf('[url=%s]%s[/url] has left a comment on Request [url=%s]%s[/url]', $profile_url, $user->username, $tr_url, $tr->name) ); } else { - $this->chat->systemMessage( + $this->chatRepository->systemMessage( sprintf('An anonymous user has left a comment on Request [url=%s]%s[/url]', $tr_url, $tr->name) ); } @@ -389,14 +389,14 @@ public function request(Request $request, $id) if ($user->id != $tr->user_id) { $tr->notifyRequester('comment', $comment); } - if ($this->tag->hasTags($request->input('content'))) { - if ($this->tag->contains($request->input('content'), '@here') && $user->group->is_modo) { + if ($this->taggedUserRepository->hasTags($request->input('content'))) { + if ($this->taggedUserRepository->contains($request->input('content'), '@here') && $user->group->is_modo) { $users = collect([]); $tr->comments()->get()->each(function ($c) use ($users) { $users->push($c->user); }); - $this->tag->messageCommentUsers( + $this->taggedUserRepository->messageCommentUsers( 'request', $users, $user, @@ -405,7 +405,7 @@ public function request(Request $request, $id) ); } else { $sender = $comment->anon ? 'Anonymous' : $user->username; - $this->tag->messageTaggedCommentUsers( + $this->taggedUserRepository->messageTaggedCommentUsers( 'request', $request->input('content'), $user, @@ -505,7 +505,7 @@ public function quickthanks(Request $request, $id) // Auto Shout $torrent_url = href_torrent($torrent); $profile_url = href_profile($user); - $this->chat->systemMessage( + $this->chatRepository->systemMessage( sprintf('[url=%s]%s[/url] has left a comment on Torrent [url=%s]%s[/url]', $profile_url, $user->username, $torrent_url, $torrent->name) ); diff --git a/app/Http/Controllers/ForumController.php b/app/Http/Controllers/ForumController.php index b7ea4d4dfb..3a9c8e2476 100644 --- a/app/Http/Controllers/ForumController.php +++ b/app/Http/Controllers/ForumController.php @@ -25,12 +25,12 @@ class ForumController extends Controller /** * @var TaggedUserRepository */ - private $tag; + private $taggedUserRepository; /** * @var ChatRepository */ - private $chat; + private $chatRepository; /** * ForumController Constructor. @@ -38,10 +38,10 @@ class ForumController extends Controller * @param TaggedUserRepository $tag * @param ChatRepository $chat */ - public function __construct(TaggedUserRepository $tag, ChatRepository $chat) + public function __construct(TaggedUserRepository $taggedUserRepository, ChatRepository $chatRepository) { - $this->tag = $tag; - $this->chat = $chat; + $this->taggedUserRepository = $taggedUserRepository; + $this->chatRepository = $chatRepository; } /** diff --git a/app/Http/Controllers/GraveyardController.php b/app/Http/Controllers/GraveyardController.php index 483268eded..33c96f7fd4 100644 --- a/app/Http/Controllers/GraveyardController.php +++ b/app/Http/Controllers/GraveyardController.php @@ -25,16 +25,16 @@ class GraveyardController extends Controller /** * @var TorrentFacetedRepository */ - private $faceted; + private $torrentFacetedRepository; /** * GraveyardController Constructor. * * @param TorrentFacetedRepository $faceted */ - public function __construct(TorrentFacetedRepository $faceted) + public function __construct(TorrentFacetedRepository $torrentFacetedRepository) { - $this->faceted = $faceted; + $this->torrentFacetedRepository = $torrentFacetedRepository; } /** @@ -49,7 +49,7 @@ public function index(Request $request) $current = Carbon::now(); $user = $request->user(); $torrents = Torrent::with('category', 'type')->where('created_at', '<', $current->copy()->subDays(30)->toDateTimeString())->paginate(25); - $repository = $this->faceted; + $repository = $this->torrentFacetedRepository; $deadcount = Torrent::where('seeders', '=', 0)->where('created_at', '<', $current->copy()->subDays(30)->toDateTimeString())->count(); return view('graveyard.index', [ @@ -162,12 +162,12 @@ public function store(Request $request, $id) ->withErrors('Torrent Resurrection Failed! You cannot resurrect your own uploads.'); } - $resurrection = new Graveyard(); - $resurrection->user_id = $user->id; - $resurrection->torrent_id = $torrent->id; - $resurrection->seedtime = $request->input('seedtime'); + $graveyard = new Graveyard(); + $graveyard->user_id = $user->id; + $graveyard->torrent_id = $torrent->id; + $graveyard->seedtime = $request->input('seedtime'); - $v = validator($resurrection->toArray(), [ + $v = validator($graveyard->toArray(), [ 'user_id' => 'required', 'torrent_id' => 'required', 'seedtime' => 'required', @@ -177,7 +177,7 @@ public function store(Request $request, $id) return redirect()->route('graveyard.index') ->withErrors($v->errors()); } - $resurrection->save(); + $graveyard->save(); return redirect()->route('graveyard.index') ->withSuccess('Torrent Resurrection Complete! You will be rewarded automatically once seedtime requirements are met.'); diff --git a/app/Http/Controllers/ImageController.php b/app/Http/Controllers/ImageController.php index bbd696af24..85b3e2dcf5 100644 --- a/app/Http/Controllers/ImageController.php +++ b/app/Http/Controllers/ImageController.php @@ -51,8 +51,8 @@ public function store(Request $request) $file = $request->file('image'); $random_name = uniqid(); $destinationPath = public_path('/files/img/'); - $extension = $file->getClientOriginalExtension(); - $filename = 'album-image_'.$random_name.'.'.$extension; + $clientOriginalExtension = $file->getClientOriginalExtension(); + $filename = 'album-image_'.$random_name.'.'.$clientOriginalExtension; $uploadSuccess = $request->file('image')->move($destinationPath, $filename); $image->image = $filename; diff --git a/app/Http/Controllers/InviteController.php b/app/Http/Controllers/InviteController.php index 8f7cacc351..9e94bb2346 100644 --- a/app/Http/Controllers/InviteController.php +++ b/app/Http/Controllers/InviteController.php @@ -80,7 +80,7 @@ public function create(Request $request) */ public function store(Request $request) { - $current = new Carbon(); + $carbon = new Carbon(); $user = $request->user(); if (config('other.invites_restriced') == true && ! in_array($user->group->name, config('other.invite_groups'))) { @@ -105,7 +105,7 @@ public function store(Request $request) $invite->user_id = $user->id; $invite->email = $request->input('email'); $invite->code = $code; - $invite->expires_on = $current->copy()->addDays(config('other.invite_expire')); + $invite->expires_on = $carbon->copy()->addDays(config('other.invite_expire')); $invite->custom = $request->input('message'); if (config('email-blacklist.enabled')) { diff --git a/app/Http/Controllers/NotificationController.php b/app/Http/Controllers/NotificationController.php index 8b6e647618..8f51b93c47 100644 --- a/app/Http/Controllers/NotificationController.php +++ b/app/Http/Controllers/NotificationController.php @@ -188,8 +188,8 @@ public function update(Request $request, $id) */ public function updateAll(Request $request) { - $current = new Carbon(); - $request->user()->unreadNotifications()->update(['read_at' => $current]); + $carbon = new Carbon(); + $request->user()->unreadNotifications()->update(['read_at' => $carbon]); return redirect()->route('notifications.index') ->withSuccess('All Notifications Marked As Read!'); diff --git a/app/Http/Controllers/PlaylistController.php b/app/Http/Controllers/PlaylistController.php index 495be0a90f..b72066add5 100644 --- a/app/Http/Controllers/PlaylistController.php +++ b/app/Http/Controllers/PlaylistController.php @@ -26,16 +26,16 @@ class PlaylistController extends Controller /** * @var ChatRepository */ - private $chat; + private $chatRepository; /** * PlaylistController Constructor. * * @param ChatRepository $chat */ - public function __construct(ChatRepository $chat) + public function __construct(ChatRepository $chatRepository) { - $this->chat = $chat; + $this->chatRepository = $chatRepository; } /** @@ -104,7 +104,7 @@ public function store(Request $request) // Announce To Shoutbox $appurl = config('app.url'); if ($playlist->is_private != 1) { - $this->chat->systemMessage( + $this->chatRepository->systemMessage( sprintf('User [url=%s/', $appurl).$user->username.'.'.$user->id.']'.$user->username.sprintf('[/url] has created a new playlist [url=%s/playlists/', $appurl).$playlist->id.']'.$playlist->name.'[/url] check it out now! :slight_smile:' ); } @@ -133,17 +133,17 @@ public function show($id) $torrent = Torrent::where('id', '=', $random->torrent_id)->firstOrFail(); } if (isset($random) && isset($torrent)) { - $client = new MovieScrapper(config('api-keys.tmdb'), config('api-keys.tvdb'), config('api-keys.omdb')); + $movieScrapper = new MovieScrapper(config('api-keys.tmdb'), config('api-keys.tvdb'), config('api-keys.omdb')); if ($torrent->category_id == 2) { if ($torrent->tmdb || $torrent->tmdb != 0) { - $meta = $client->scrape('tv', null, $torrent->tmdb); + $meta = $movieScrapper->scrape('tv', null, $torrent->tmdb); } else { - $meta = $client->scrape('tv', 'tt'.$torrent->imdb); + $meta = $movieScrapper->scrape('tv', 'tt'.$torrent->imdb); } } elseif ($torrent->tmdb || $torrent->tmdb != 0) { - $meta = $client->scrape('movie', null, $torrent->tmdb); + $meta = $movieScrapper->scrape('movie', null, $torrent->tmdb); } else { - $meta = $client->scrape('movie', 'tt'.$torrent->imdb); + $meta = $movieScrapper->scrape('movie', 'tt'.$torrent->imdb); } } diff --git a/app/Http/Controllers/PlaylistTorrentController.php b/app/Http/Controllers/PlaylistTorrentController.php index 1d705ac915..5d930ee025 100644 --- a/app/Http/Controllers/PlaylistTorrentController.php +++ b/app/Http/Controllers/PlaylistTorrentController.php @@ -33,11 +33,11 @@ public function store(Request $request) abort_unless($user->id === $playlist->user_id, 403); - $playlist_torrent = new PlaylistTorrent(); - $playlist_torrent->playlist_id = $playlist->id; - $playlist_torrent->torrent_id = $request->input('torrent_id'); + $playlistTorrent = new PlaylistTorrent(); + $playlistTorrent->playlist_id = $playlist->id; + $playlistTorrent->torrent_id = $request->input('torrent_id'); - $v = validator($playlist_torrent->toArray(), [ + $v = validator($playlistTorrent->toArray(), [ 'playlist_id' => 'required|numeric|exists:playlists,id|unique:playlist_torrents,playlist_id,NULL,NULL,torrent_id,'.$request->input('torrent_id'), 'torrent_id' => 'required|numeric|exists:torrents,id|unique:playlist_torrents,torrent_id,NULL,NULL,playlist_id,'.$request->input('playlist_id'), ]); @@ -46,7 +46,7 @@ public function store(Request $request) return redirect()->route('playlists.show', ['id' => $playlist->id]) ->withErrors($v->errors()); } - $playlist_torrent->save(); + $playlistTorrent->save(); return redirect()->route('playlists.show', ['id' => $playlist->id]) ->withSuccess('Torrent Has Successfully Been Attached To Your Playlist.'); diff --git a/app/Http/Controllers/PostController.php b/app/Http/Controllers/PostController.php index 3a065b423f..09c8d6ee1a 100644 --- a/app/Http/Controllers/PostController.php +++ b/app/Http/Controllers/PostController.php @@ -36,12 +36,12 @@ class PostController extends Controller /** * @var TaggedUserRepository */ - private $tag; + private $taggedUserRepository; /** * @var ChatRepository */ - private $chat; + private $chatRepository; /** * ForumController Constructor. @@ -49,10 +49,10 @@ class PostController extends Controller * @param TaggedUserRepository $tag * @param ChatRepository $chat */ - public function __construct(TaggedUserRepository $tag, ChatRepository $chat) + public function __construct(TaggedUserRepository $taggedUserRepository, ChatRepository $chatRepository) { - $this->tag = $tag; - $this->chat = $chat; + $this->taggedUserRepository = $taggedUserRepository; + $this->chatRepository = $chatRepository; } /** @@ -95,15 +95,15 @@ public function reply(Request $request, $id) $appurl = config('app.url'); $href = sprintf('%s/forums/topics/%s?page=%s#post-%s', $appurl, $topic->id, $post->getPageNumber(), $post->id); $message = sprintf('%s has tagged you in a forum post. You can view it [url=%s] HERE [/url]', $user->username, $href); - if ($this->tag->hasTags($request->input('content'))) { - if ($this->tag->contains($request->input('content'), '@here') && $user->group->is_modo) { + if ($this->taggedUserRepository->hasTags($request->input('content'))) { + if ($this->taggedUserRepository->contains($request->input('content'), '@here') && $user->group->is_modo) { $users = collect([]); $topic->posts()->get()->each(function ($p) use ($users) { $users->push($p->user); }); - $this->tag->messagePostUsers( + $this->taggedUserRepository->messagePostUsers( 'forum', $users, $user, @@ -111,7 +111,7 @@ public function reply(Request $request, $id) $post ); } else { - $this->tag->messageTaggedPostUsers( + $this->taggedUserRepository->messageTaggedPostUsers( 'forum', $request->input('content'), $user, @@ -150,7 +150,7 @@ public function reply(Request $request, $id) if (config('other.staff-forum-notify') && ($forum->id == config('other.staff-forum-id') || $forum->parent_id == config('other.staff-forum-id'))) { $topic->notifyStaffers($user, $topic, $post); } else { - $this->chat->systemMessage(sprintf('[url=%s]%s[/url] has left a reply on topic [url=%s]%s[/url]', $profileUrl, $user->username, $postUrl, $topic->name)); + $this->chatRepository->systemMessage(sprintf('[url=%s]%s[/url] has left a reply on topic [url=%s]%s[/url]', $profileUrl, $user->username, $postUrl, $topic->name)); // Notify All Subscribers Of New Reply if ($topic->first_user_poster_id != $user->id) { $topic->notifyStarter($user, $topic, $post); diff --git a/app/Http/Controllers/PrivateMessageController.php b/app/Http/Controllers/PrivateMessageController.php index 1486909b01..a1b9ffd16d 100644 --- a/app/Http/Controllers/PrivateMessageController.php +++ b/app/Http/Controllers/PrivateMessageController.php @@ -148,14 +148,14 @@ public function sendPrivateMessage(Request $request) ->withErrors($v->errors()); } - $pm = new PrivateMessage(); - $pm->sender_id = $user->id; - $pm->receiver_id = $recipient->id; - $pm->subject = $request->input('subject'); - $pm->message = $request->input('message'); - $pm->read = 0; - - $v = validator($pm->toArray(), [ + $privateMessage = new PrivateMessage(); + $privateMessage->sender_id = $user->id; + $privateMessage->receiver_id = $recipient->id; + $privateMessage->subject = $request->input('subject'); + $privateMessage->message = $request->input('message'); + $privateMessage->read = 0; + + $v = validator($privateMessage->toArray(), [ 'sender_id' => 'required', 'receiver_id' => 'required', 'subject' => 'required', @@ -172,7 +172,7 @@ public function sendPrivateMessage(Request $request) return redirect()->route('create', ['username' => $request->user()->username, 'id' => $request->user()->id]) ->withErrors($v->errors()); } - $pm->save(); + $privateMessage->save(); if ($dest == 'profile') { return redirect()->route('users.show', ['username' => $recipient->username]) ->withSuccess('Your PM Was Sent Successfully!'); @@ -196,15 +196,15 @@ public function replyPrivateMessage(Request $request, $id) $message = PrivateMessage::where('id', '=', $id)->firstOrFail(); - $pm = new PrivateMessage(); - $pm->sender_id = $user->id; - $pm->receiver_id = $message->sender_id == $user->id ? $message->receiver_id : $message->sender_id; - $pm->subject = $message->subject; - $pm->message = $request->input('message'); - $pm->related_to = $message->id; - $pm->read = 0; + $privateMessage = new PrivateMessage(); + $privateMessage->sender_id = $user->id; + $privateMessage->receiver_id = $message->sender_id == $user->id ? $message->receiver_id : $message->sender_id; + $privateMessage->subject = $message->subject; + $privateMessage->message = $request->input('message'); + $privateMessage->related_to = $message->id; + $privateMessage->read = 0; - $v = validator($pm->toArray(), [ + $v = validator($privateMessage->toArray(), [ 'sender_id' => 'required', 'receiver_id' => 'required', 'subject' => 'required', @@ -217,7 +217,7 @@ public function replyPrivateMessage(Request $request, $id) return redirect()->route('inbox') ->withErrors($v->errors()); } - $pm->save(); + $privateMessage->save(); return redirect()->route('inbox') ->withSuccess('Your PM Was Sent Successfully!'); diff --git a/app/Http/Controllers/RequestController.php b/app/Http/Controllers/RequestController.php index 62d64fcee3..32b5abb3f8 100644 --- a/app/Http/Controllers/RequestController.php +++ b/app/Http/Controllers/RequestController.php @@ -45,12 +45,12 @@ class RequestController extends Controller /** * @var RequestFacetedRepository */ - private $faceted; + private $requestFacetedRepository; /** * @var ChatRepository */ - private $chat; + private $chatRepository; /** * RequestController Constructor. @@ -58,10 +58,10 @@ class RequestController extends Controller * @param RequestFacetedRepository $faceted * @param ChatRepository $chat */ - public function __construct(RequestFacetedRepository $faceted, ChatRepository $chat) + public function __construct(RequestFacetedRepository $requestFacetedRepository, ChatRepository $chatRepository) { - $this->faceted = $faceted; - $this->chat = $chat; + $this->requestFacetedRepository = $requestFacetedRepository; + $this->chatRepository = $chatRepository; } /** @@ -87,7 +87,7 @@ public function requests(Request $request) ->first(); $torrentRequests = TorrentRequest::with(['user', 'category', 'type'])->paginate(25); - $repository = $this->faceted; + $repository = $this->requestFacetedRepository; return view('requests.requests', [ 'torrentRequests' => $torrentRequests, @@ -241,20 +241,20 @@ public function request(Request $request, $id) $comments = $torrentRequest->comments()->latest('created_at')->paginate(6); $carbon = Carbon::now()->addDay(); - $client = new \App\Services\MovieScrapper(config('api-keys.tmdb'), config('api-keys.tvdb'), config('api-keys.omdb')); + $movieScrapper = new \App\Services\MovieScrapper(config('api-keys.tmdb'), config('api-keys.tvdb'), config('api-keys.omdb')); $meta = null; if ($torrentRequest->category->tv_meta) { if ($torrentRequest->tmdb || $torrentRequest->tmdb != 0) { - $meta = $client->scrape('tv', null, $torrentRequest->tmdb); + $meta = $movieScrapper->scrape('tv', null, $torrentRequest->tmdb); } else { - $meta = $client->scrape('tv', 'tt'.$torrentRequest->imdb); + $meta = $movieScrapper->scrape('tv', 'tt'.$torrentRequest->imdb); } } if ($torrentRequest->category->movie_meta) { if ($torrentRequest->tmdb || $torrentRequest->tmdb != 0) { - $meta = $client->scrape('movie', null, $torrentRequest->tmdb); + $meta = $movieScrapper->scrape('movie', null, $torrentRequest->tmdb); } else { - $meta = $client->scrape('movie', 'tt'.$torrentRequest->imdb); + $meta = $movieScrapper->scrape('movie', 'tt'.$torrentRequest->imdb); } } if ($torrentRequest->category->game_meta) { @@ -308,23 +308,23 @@ public function addrequest(Request $request) $user = $request->user(); $category = Category::findOrFail($request->input('category_id')); - $tr = new TorrentRequest(); - $tr->name = $request->input('name'); - $tr->description = $request->input('description'); - $tr->category_id = $category->id; - $tr->user_id = $user->id; - $tr->imdb = $request->input('imdb'); - $tr->tvdb = $request->input('tvdb'); - $tr->tmdb = $request->input('tmdb'); - $tr->mal = $request->input('mal'); - $tr->igdb = $request->input('igdb'); - $tr->type_id = $request->input('type_id'); - $tr->resolution_id = $request->input('resolution_id'); - $tr->bounty = $request->input('bounty'); - $tr->votes = 1; - $tr->anon = $request->input('anon'); - - $v = validator($tr->toArray(), [ + $torrentRequest = new TorrentRequest(); + $torrentRequest->name = $request->input('name'); + $torrentRequest->description = $request->input('description'); + $torrentRequest->category_id = $category->id; + $torrentRequest->user_id = $user->id; + $torrentRequest->imdb = $request->input('imdb'); + $torrentRequest->tvdb = $request->input('tvdb'); + $torrentRequest->tmdb = $request->input('tmdb'); + $torrentRequest->mal = $request->input('mal'); + $torrentRequest->igdb = $request->input('igdb'); + $torrentRequest->type_id = $request->input('type_id'); + $torrentRequest->resolution_id = $request->input('resolution_id'); + $torrentRequest->bounty = $request->input('bounty'); + $torrentRequest->votes = 1; + $torrentRequest->anon = $request->input('anon'); + + $v = validator($torrentRequest->toArray(), [ 'name' => 'required|max:180', 'imdb' => 'required|numeric', 'tvdb' => 'required|numeric', @@ -343,13 +343,13 @@ public function addrequest(Request $request) return redirect()->route('requests') ->withErrors($v->errors())->withInput(); } - $tr->save(); - $requestsBounty = new TorrentRequestBounty(); - $requestsBounty->user_id = $user->id; - $requestsBounty->seedbonus = $request->input('bounty'); - $requestsBounty->requests_id = $tr->id; - $requestsBounty->anon = $request->input('anon'); - $requestsBounty->save(); + $torrentRequest->save(); + $torrentRequestBounty = new TorrentRequestBounty(); + $torrentRequestBounty->user_id = $user->id; + $torrentRequestBounty->seedbonus = $request->input('bounty'); + $torrentRequestBounty->requests_id = $torrentRequest->id; + $torrentRequestBounty->anon = $request->input('anon'); + $torrentRequestBounty->save(); $BonTransactions = new BonTransactions(); $BonTransactions->itemID = 0; $BonTransactions->name = 'request'; @@ -360,16 +360,16 @@ public function addrequest(Request $request) $BonTransactions->save(); $user->seedbonus -= $request->input('bounty'); $user->save(); - $tr_url = href_request($tr); + $tr_url = href_request($torrentRequest); $profile_url = href_profile($user); // Auto Shout - if ($tr->anon == 0) { - $this->chat->systemMessage( - sprintf('[url=%s]%s[/url] has created a new request [url=%s]%s[/url]', $profile_url, $user->username, $tr_url, $tr->name) + if ($torrentRequest->anon == 0) { + $this->chatRepository->systemMessage( + sprintf('[url=%s]%s[/url] has created a new request [url=%s]%s[/url]', $profile_url, $user->username, $tr_url, $torrentRequest->name) ); } else { - $this->chat->systemMessage( - sprintf('An anonymous user has created a new request [url=%s]%s[/url]', $tr_url, $tr->name) + $this->chatRepository->systemMessage( + sprintf('An anonymous user has created a new request [url=%s]%s[/url]', $tr_url, $torrentRequest->name) ); } @@ -487,12 +487,12 @@ public function addBonus(Request $request, $id) ->withErrors($v->errors()); } $tr->save(); - $requestsBounty = new TorrentRequestBounty(); - $requestsBounty->user_id = $user->id; - $requestsBounty->seedbonus = $request->input('bonus_value'); - $requestsBounty->requests_id = $tr->id; - $requestsBounty->anon = $request->input('anon'); - $requestsBounty->save(); + $torrentRequestBounty = new TorrentRequestBounty(); + $torrentRequestBounty->user_id = $user->id; + $torrentRequestBounty->seedbonus = $request->input('bonus_value'); + $torrentRequestBounty->requests_id = $tr->id; + $torrentRequestBounty->anon = $request->input('anon'); + $torrentRequestBounty->save(); $BonTransactions = new BonTransactions(); $BonTransactions->itemID = 0; $BonTransactions->name = 'request'; @@ -506,12 +506,12 @@ public function addBonus(Request $request, $id) $tr_url = href_request($tr); $profile_url = href_profile($user); // Auto Shout - if ($requestsBounty->anon == 0) { - $this->chat->systemMessage( + if ($torrentRequestBounty->anon == 0) { + $this->chatRepository->systemMessage( sprintf('[url=%s]%s[/url] has added %s BON bounty to request [url=%s]%s[/url]', $profile_url, $user->username, $request->input('bonus_value'), $tr_url, $tr->name) ); } else { - $this->chat->systemMessage( + $this->chatRepository->systemMessage( sprintf('An anonymous user added %s BON bounty to request [url=%s]%s[/url]', $request->input('bonus_value'), $tr_url, $tr->name) ); } @@ -622,11 +622,11 @@ public function approveRequest(Request $request, $id) // Auto Shout if ($tr->filled_anon == 0) { - $this->chat->systemMessage( + $this->chatRepository->systemMessage( sprintf('[url=%s]%s[/url] has filled request, [url=%s]%s[/url]', $profile_url, $fill_user->username, $tr_url, $tr->name) ); } else { - $this->chat->systemMessage( + $this->chatRepository->systemMessage( sprintf('An anonymous user has filled request, [url=%s]%s[/url]', $tr_url, $tr->name) ); } @@ -728,11 +728,11 @@ public function claimRequest(Request $request, $id) $torrentRequest = TorrentRequest::with('user')->findOrFail($id); if ($torrentRequest->claimed == null) { - $requestClaim = new TorrentRequestClaim(); - $requestClaim->request_id = $id; - $requestClaim->username = $user->username; - $requestClaim->anon = $request->input('anon'); - $requestClaim->save(); + $torrentRequestClaim = new TorrentRequestClaim(); + $torrentRequestClaim->request_id = $id; + $torrentRequestClaim->username = $user->username; + $torrentRequestClaim->anon = $request->input('anon'); + $torrentRequestClaim->save(); $torrentRequest->claimed = 1; $torrentRequest->save(); diff --git a/app/Http/Controllers/RssController.php b/app/Http/Controllers/RssController.php index 08d59e7d31..e97bf11f34 100644 --- a/app/Http/Controllers/RssController.php +++ b/app/Http/Controllers/RssController.php @@ -29,16 +29,16 @@ class RssController extends Controller /** * @var TorrentFacetedRepository */ - private $torrent_faceted; + private $torrentFacetedRepository; /** * RssController Constructor. * * @param TorrentFacetedRepository $torrent_faceted */ - public function __construct(TorrentFacetedRepository $torrent_faceted) + public function __construct(TorrentFacetedRepository $torrentFacetedRepository) { - $this->torrent_faceted = $torrent_faceted; + $this->torrentFacetedRepository = $torrentFacetedRepository; } /** @@ -74,7 +74,7 @@ public function index(Request $request, $hash = null) public function create(Request $request) { $user = $request->user(); - $torrent_repository = $this->torrent_faceted; + $torrent_repository = $this->torrentFacetedRepository; return view('rss.create', [ 'torrent_repository' => $torrent_repository, @@ -229,16 +229,16 @@ public function show($id, $rsskey) $description .= '%'.$keyword.'%'; } - $torrent = Torrent::with(['user', 'category', 'type', 'resolution']); + $builder = Torrent::with(['user', 'category', 'type', 'resolution']); if ($rss->object_torrent->search) { - $torrent->where(function ($query) use ($search) { + $builder->where(function ($query) use ($search) { $query->where('name', 'like', $search); }); } if ($rss->object_torrent->description) { - $torrent->where(function ($query) use ($description) { + $builder->where(function ($query) use ($description) { $query->where('description', 'like', $description)->orWhere('mediainfo', 'like', $description); }); } @@ -248,83 +248,83 @@ public function show($id, $rsskey) if (null === $match) { return ['result' => [], 'count' => 0]; } - $torrent->where('user_id', '=', $match->id)->where('anon', '=', 0); + $builder->where('user_id', '=', $match->id)->where('anon', '=', 0); } if ($rss->object_torrent->imdb && $rss->object_torrent->imdb != null) { - $torrent->where('imdb', '=', $imdb); + $builder->where('imdb', '=', $imdb); } if ($rss->object_torrent->tvdb && $rss->object_torrent->tvdb != null) { - $torrent->where('tvdb', '=', $tvdb); + $builder->where('tvdb', '=', $tvdb); } if ($rss->object_torrent->tmdb && $rss->object_torrent->tmdb != null) { - $torrent->where('tmdb', '=', $tmdb); + $builder->where('tmdb', '=', $tmdb); } if ($rss->object_torrent->mal && $rss->object_torrent->mal != null) { - $torrent->where('mal', '=', $mal); + $builder->where('mal', '=', $mal); } if ($rss->object_torrent->categories && is_array($rss->object_torrent->categories)) { - $torrent->whereIn('category_id', $categories); + $builder->whereIn('category_id', $categories); } if ($rss->object_torrent->types && is_array($rss->object_torrent->types)) { - $torrent->whereIn('type_id', $types); + $builder->whereIn('type_id', $types); } if ($rss->object_torrent->resolutions && is_array($rss->object_torrent->resolutions)) { - $torrent->whereIn('resolution_id', $resolutions); + $builder->whereIn('resolution_id', $resolutions); } if ($rss->object_torrent->genres && is_array($rss->object_torrent->genres)) { $genreID = TagTorrent::select(['torrent_id'])->distinct()->whereIn('tag_name', $genres)->get(); - $torrent->whereIn('id', $genreID)->cursor(); + $builder->whereIn('id', $genreID)->cursor(); } if ($rss->object_torrent->freeleech && $rss->object_torrent->freeleech != null) { - $torrent->where('free', '=', $freeleech); + $builder->where('free', '=', $freeleech); } if ($rss->object_torrent->doubleupload && $rss->object_torrent->doubleupload != null) { - $torrent->where('doubleup', '=', $doubleupload); + $builder->where('doubleup', '=', $doubleupload); } if ($rss->object_torrent->featured && $rss->object_torrent->featured != null) { - $torrent->where('featured', '=', $featured); + $builder->where('featured', '=', $featured); } if ($rss->object_torrent->stream && $rss->object_torrent->stream != null) { - $torrent->where('stream', '=', $stream); + $builder->where('stream', '=', $stream); } if ($rss->object_torrent->highspeed && $rss->object_torrent->highspeed != null) { - $torrent->where('highspeed', '=', $highspeed); + $builder->where('highspeed', '=', $highspeed); } if ($rss->object_torrent->sd && $rss->object_torrent->sd != null) { - $torrent->where('sd', '=', $sd); + $builder->where('sd', '=', $sd); } if ($rss->object_torrent->internal && $rss->object_torrent->internal != null) { - $torrent->where('internal', '=', $internal); + $builder->where('internal', '=', $internal); } if ($rss->object_torrent->alive && $rss->object_torrent->alive != null) { - $torrent->where('seeders', '>=', $alive); + $builder->where('seeders', '>=', $alive); } if ($rss->object_torrent->dying && $rss->object_torrent->dying != null) { - $torrent->where('seeders', '=', $dying)->where('times_completed', '>=', 3); + $builder->where('seeders', '=', $dying)->where('times_completed', '>=', 3); } if ($rss->object_torrent->dead && $rss->object_torrent->dead != null) { - $torrent->where('seeders', '=', $dead); + $builder->where('seeders', '=', $dead); } - $torrents = $torrent->latest()->take(50)->get(); + $torrents = $builder->latest()->take(50)->get(); return response()->view('rss.show', ['torrents' => $torrents, 'user' => $user, 'rss' => $rss])->header('Content-Type', 'text/xml'); } @@ -341,7 +341,7 @@ public function edit(Request $request, $id) { $user = $request->user(); $rss = Rss::where('is_private', '=', 1)->findOrFail($id); - $torrent_repository = $this->torrent_faceted; + $torrent_repository = $this->torrentFacetedRepository; return view('rss.edit', [ 'torrent_repository' => $torrent_repository, diff --git a/app/Http/Controllers/Staff/ApplicationController.php b/app/Http/Controllers/Staff/ApplicationController.php index 42cb348c39..125df6ec5a 100644 --- a/app/Http/Controllers/Staff/ApplicationController.php +++ b/app/Http/Controllers/Staff/ApplicationController.php @@ -69,7 +69,7 @@ public function approve(Request $request, $id) $application = Application::withAnyStatus()->findOrFail($id); if ($application->status !== 1) { - $current = new Carbon(); + $carbon = new Carbon(); $user = $request->user(); $code = Uuid::uuid4()->toString(); @@ -77,7 +77,7 @@ public function approve(Request $request, $id) $invite->user_id = $user->id; $invite->email = $application->email; $invite->code = $code; - $invite->expires_on = $current->copy()->addDays(config('other.invite_expire')); + $invite->expires_on = $carbon->copy()->addDays(config('other.invite_expire')); $invite->custom = $request->input('approve'); if (config('email-blacklist.enabled') == true) { diff --git a/app/Http/Controllers/Staff/ChatRoomController.php b/app/Http/Controllers/Staff/ChatRoomController.php index fec978395f..bfbe04005e 100644 --- a/app/Http/Controllers/Staff/ChatRoomController.php +++ b/app/Http/Controllers/Staff/ChatRoomController.php @@ -24,16 +24,16 @@ class ChatRoomController extends Controller /** * @var ChatRepository */ - private $chat; + private $chatRepository; /** * ChatController Constructor. * * @param ChatRepository $chat */ - public function __construct(ChatRepository $chat) + public function __construct(ChatRepository $chatRepository) { - $this->chat = $chat; + $this->chatRepository = $chatRepository; } /** @@ -43,7 +43,7 @@ public function __construct(ChatRepository $chat) */ public function index() { - $chatrooms = $this->chat->rooms(); + $chatrooms = $this->chatRepository->rooms(); return view('Staff.chat.room.index', [ 'chatrooms' => $chatrooms, diff --git a/app/Http/Controllers/Staff/ChatStatusController.php b/app/Http/Controllers/Staff/ChatStatusController.php index 8714efaf43..4c2d04d9d0 100644 --- a/app/Http/Controllers/Staff/ChatStatusController.php +++ b/app/Http/Controllers/Staff/ChatStatusController.php @@ -23,16 +23,16 @@ class ChatStatusController extends Controller /** * @var ChatRepository */ - private $chat; + private $chatRepository; /** * ChatController Constructor. * * @param ChatRepository $chat */ - public function __construct(ChatRepository $chat) + public function __construct(ChatRepository $chatRepository) { - $this->chat = $chat; + $this->chatRepository = $chatRepository; } /** @@ -42,7 +42,7 @@ public function __construct(ChatRepository $chat) */ public function index() { - $chatstatuses = $this->chat->statuses(); + $chatstatuses = $this->chatRepository->statuses(); return view('Staff.chat.status.index', [ 'chatstatuses' => $chatstatuses, diff --git a/app/Http/Controllers/Staff/FlushController.php b/app/Http/Controllers/Staff/FlushController.php index 479ab9d418..d1a57975a7 100644 --- a/app/Http/Controllers/Staff/FlushController.php +++ b/app/Http/Controllers/Staff/FlushController.php @@ -26,16 +26,16 @@ class FlushController extends Controller /** * @var ChatRepository */ - private $chat; + private $chatRepository; /** * ChatController Constructor. * * @param ChatRepository $chat */ - public function __construct(ChatRepository $chat) + public function __construct(ChatRepository $chatRepository) { - $this->chat = $chat; + $this->chatRepository = $chatRepository; } /** @@ -47,8 +47,8 @@ public function __construct(ChatRepository $chat) */ public function peers() { - $current = new Carbon(); - $peers = Peer::select(['id', 'info_hash', 'user_id', 'updated_at'])->where('updated_at', '<', $current->copy()->subHours(2)->toDateTimeString())->get(); + $carbon = new Carbon(); + $peers = Peer::select(['id', 'info_hash', 'user_id', 'updated_at'])->where('updated_at', '<', $carbon->copy()->subHours(2)->toDateTimeString())->get(); foreach ($peers as $peer) { $history = History::where('info_hash', '=', $peer->info_hash)->where('user_id', '=', $peer->user_id)->first(); @@ -77,7 +77,7 @@ public function chat() $message->delete(); } - $this->chat->systemMessage( + $this->chatRepository->systemMessage( 'Chatbox Has Been Flushed! :broom:' ); diff --git a/app/Http/Controllers/Staff/GiftController.php b/app/Http/Controllers/Staff/GiftController.php index bab6b8df8e..821a17e515 100644 --- a/app/Http/Controllers/Staff/GiftController.php +++ b/app/Http/Controllers/Staff/GiftController.php @@ -67,13 +67,13 @@ public function store(Request $request) $recipient->fl_tokens += $fl_tokens; $recipient->save(); // Send Private Message - $pm = new PrivateMessage(); - $pm->sender_id = 1; - $pm->receiver_id = $recipient->id; - $pm->subject = 'You Have Received A System Generated Gift'; - $pm->message = sprintf('We just wanted to let you know that staff member, %s, has credited your account with %s Bonus Points, %s Invites and %s Freeleech Tokens. + $privateMessage = new PrivateMessage(); + $privateMessage->sender_id = 1; + $privateMessage->receiver_id = $recipient->id; + $privateMessage->subject = 'You Have Received A System Generated Gift'; + $privateMessage->message = sprintf('We just wanted to let you know that staff member, %s, has credited your account with %s Bonus Points, %s Invites and %s Freeleech Tokens. [color=red][b]THIS IS AN AUTOMATED SYSTEM MESSAGE, PLEASE DO NOT REPLY![/b][/color]', $staff->username, $seedbonus, $invites, $fl_tokens); - $pm->save(); + $privateMessage->save(); return redirect()->route('staff.gifts.index') ->withSuccess('Gift Sent'); diff --git a/app/Http/Controllers/Staff/HomeController.php b/app/Http/Controllers/Staff/HomeController.php index 39c9a97f80..4ea7d368f7 100644 --- a/app/Http/Controllers/Staff/HomeController.php +++ b/app/Http/Controllers/Staff/HomeController.php @@ -75,15 +75,15 @@ public function index(Request $request) } // System Information - $sys = new SystemInformation(); - $uptime = $sys->uptime(); - $ram = $sys->memory(); - $disk = $sys->disk(); - $avg = $sys->avg(); - $basic = $sys->basic(); + $systemInformation = new SystemInformation(); + $uptime = $systemInformation->uptime(); + $ram = $systemInformation->memory(); + $disk = $systemInformation->disk(); + $avg = $systemInformation->avg(); + $basic = $systemInformation->basic(); // Directory Permissions - $file_permissions = $sys->directoryPermissions(); + $file_permissions = $systemInformation->directoryPermissions(); return view('Staff.dashboard.index', [ 'users' => $users, diff --git a/app/Http/Controllers/Staff/MediaLanguageController.php b/app/Http/Controllers/Staff/MediaLanguageController.php index 4816ba6040..d80bd38123 100644 --- a/app/Http/Controllers/Staff/MediaLanguageController.php +++ b/app/Http/Controllers/Staff/MediaLanguageController.php @@ -50,11 +50,11 @@ public function create() */ public function store(Request $request) { - $media_language = new MediaLanguage(); - $media_language->name = $request->input('name'); - $media_language->code = $request->input('code'); + $mediaLanguage = new MediaLanguage(); + $mediaLanguage->name = $request->input('name'); + $mediaLanguage->code = $request->input('code'); - $v = validator($media_language->toArray(), [ + $v = validator($mediaLanguage->toArray(), [ 'name' => 'required|unique:media_languages', 'code' => 'required|unique:media_languages', ]); @@ -63,7 +63,7 @@ public function store(Request $request) return redirect()->route('staff.media_languages.index') ->withErrors($v->errors()); } - $media_language->save(); + $mediaLanguage->save(); return redirect()->route('staff.media_languages.index') ->withSuccess('Media Language Successfully Added'); diff --git a/app/Http/Controllers/Staff/ModerationController.php b/app/Http/Controllers/Staff/ModerationController.php index 52d1900797..ecdb6d1ecc 100644 --- a/app/Http/Controllers/Staff/ModerationController.php +++ b/app/Http/Controllers/Staff/ModerationController.php @@ -26,16 +26,16 @@ class ModerationController extends Controller /** * @var ChatRepository */ - private $chat; + private $chatRepository; /** * ModerationController Constructor. * * @param ChatRepository $chat */ - public function __construct(ChatRepository $chat) + public function __construct(ChatRepository $chatRepository) { - $this->chat = $chat; + $this->chatRepository = $chatRepository; } /** @@ -78,11 +78,11 @@ public function approve($id) // Announce To Shoutbox if ($anon == 0) { - $this->chat->systemMessage( + $this->chatRepository->systemMessage( sprintf('User [url=%s/users/', $appurl).$username.']'.$username.sprintf('[/url] has uploaded [url=%s/torrents/', $appurl).$torrent->id.']'.$torrent->name.'[/url] grab it now! :slight_smile:' ); } else { - $this->chat->systemMessage( + $this->chatRepository->systemMessage( sprintf('An anonymous user has uploaded [url=%s/torrents/', $appurl).$torrent->id.']'.$torrent->name.'[/url] grab it now! :slight_smile:' ); } @@ -119,16 +119,16 @@ public function postpone(Request $request) $user = $request->user(); $torrent = Torrent::withAnyStatus()->where('id', '=', $request->input('id'))->first(); $torrent->markPostponed(); - $pm = new PrivateMessage(); - $pm->sender_id = $user->id; - $pm->receiver_id = $torrent->user_id; - $pm->subject = sprintf('Your upload, %s ,has been postponed by %s', $torrent->name, $user->username); - $pm->message = sprintf('Greetings, + $privateMessage = new PrivateMessage(); + $privateMessage->sender_id = $user->id; + $privateMessage->receiver_id = $torrent->user_id; + $privateMessage->subject = sprintf('Your upload, %s ,has been postponed by %s', $torrent->name, $user->username); + $privateMessage->message = sprintf('Greetings, Your upload, %s ,has been postponed. Please see below the message from the staff member. %s', $torrent->name, $request->input('message')); - $pm->save(); + $privateMessage->save(); return redirect()->route('staff.moderation.index') ->withSuccess('Torrent Postponed'); @@ -156,16 +156,16 @@ public function reject(Request $request) $user = $request->user(); $torrent = Torrent::withAnyStatus()->where('id', '=', $request->input('id'))->first(); $torrent->markRejected(); - $pm = new PrivateMessage(); - $pm->sender_id = $user->id; - $pm->receiver_id = $torrent->user_id; - $pm->subject = sprintf('Your upload, %s ,has been rejected by %s', $torrent->name, $user->username); - $pm->message = sprintf('Greetings, + $privateMessage = new PrivateMessage(); + $privateMessage->sender_id = $user->id; + $privateMessage->receiver_id = $torrent->user_id; + $privateMessage->subject = sprintf('Your upload, %s ,has been rejected by %s', $torrent->name, $user->username); + $privateMessage->message = sprintf('Greetings, Your upload %s has been rejected. Please see below the message from the staff member. %s', $torrent->name, $request->input('message')); - $pm->save(); + $privateMessage->save(); return redirect()->route('staff.moderation.index') ->withSuccess('Torrent Rejected'); diff --git a/app/Http/Controllers/Staff/PollController.php b/app/Http/Controllers/Staff/PollController.php index 1f70f507de..516e102957 100644 --- a/app/Http/Controllers/Staff/PollController.php +++ b/app/Http/Controllers/Staff/PollController.php @@ -24,16 +24,16 @@ class PollController extends Controller /** * @var ChatRepository */ - private $chat; + private $chatRepository; /** * PollController Constructor. * * @param ChatRepository $chat */ - public function __construct(ChatRepository $chat) + public function __construct(ChatRepository $chatRepository) { - $this->chat = $chat; + $this->chatRepository = $chatRepository; } /** @@ -79,18 +79,18 @@ public function create() * * @return \Illuminate\Http\RedirectResponse */ - public function store(StorePoll $request) + public function store(StorePoll $storePoll) { - $user = $request->user(); + $user = $storePoll->user(); - $poll = $request->user() ? $user->polls()->create($request->all()) : Poll::create($request->all()); + $poll = $storePoll->user() ? $user->polls()->create($storePoll->all()) : Poll::create($storePoll->all()); - $options = collect($request->input('options'))->map(fn ($value) => new Option(['name' => $value])); + $options = collect($storePoll->input('options'))->map(fn ($value) => new Option(['name' => $value])); $poll->options()->saveMany($options); $poll_url = href_poll($poll); - $this->chat->systemMessage( + $this->chatRepository->systemMessage( sprintf('A new poll has been created [url=%s]%s[/url] vote on it now! :slight_smile:', $poll_url, $poll->title) ); @@ -120,18 +120,18 @@ public function edit($id) * * @return \Illuminate\Http\RedirectResponse */ - public function update(StorePoll $request, $id) + public function update(StorePoll $storePoll, $id) { $poll = Poll::findOrFail($id); - $poll->title = $request->input('title'); + $poll->title = $storePoll->input('title'); - $poll->multiple_choice = (bool) $request->input('multiple_choice'); + $poll->multiple_choice = (bool) $storePoll->input('multiple_choice'); // Remove the deleted options in poll $oldOptionIds = collect($poll->options)->map(fn ($option) => $option->id)->all(); - $existingOldOptionIds = collect($request->input('option-id'))->map(fn ($id) => (int) $id)->all(); + $existingOldOptionIds = collect($storePoll->input('option-id'))->map(fn ($id) => (int) $id)->all(); $idsOfOptionToBeRemove = array_diff($oldOptionIds, $existingOldOptionIds); @@ -141,7 +141,7 @@ public function update(StorePoll $request, $id) } // Update existing options - $existingOldOptionContents = collect($request->input('option-content'))->map(fn ($content) => strval($content))->all(); + $existingOldOptionContents = collect($storePoll->input('option-content'))->map(fn ($content) => strval($content))->all(); if (count($existingOldOptionContents) === count($existingOldOptionIds)) { $len = count($existingOldOptionContents); @@ -153,14 +153,14 @@ public function update(StorePoll $request, $id) } // Insert new options - $newOptions = collect($request->input('new-option-content'))->map(fn ($content) => new Option(['name' => $content])); + $newOptions = collect($storePoll->input('new-option-content'))->map(fn ($content) => new Option(['name' => $content])); $poll->options()->saveMany($newOptions); // Last work from store() $poll_url = href_poll($poll); - $this->chat->systemMessage( + $this->chatRepository->systemMessage( sprintf('A poll has been updated [url=%s]%s[/url] vote on it now! :slight_smile:', $poll_url, $poll->title) ); diff --git a/app/Http/Controllers/Staff/ReportController.php b/app/Http/Controllers/Staff/ReportController.php index 738d9fef20..7a80566614 100644 --- a/app/Http/Controllers/Staff/ReportController.php +++ b/app/Http/Controllers/Staff/ReportController.php @@ -78,16 +78,16 @@ public function update(Request $request, $id) $report->save(); // Send Private Message - $pm = new PrivateMessage(); - $pm->sender_id = $user->id; - $pm->receiver_id = $report->reporter_id; - $pm->subject = 'Your Report Has A New Verdict'; - $pm->message = sprintf('[b]REPORT TITLE:[/b] %s + $privateMessage = new PrivateMessage(); + $privateMessage->sender_id = $user->id; + $privateMessage->receiver_id = $report->reporter_id; + $privateMessage->subject = 'Your Report Has A New Verdict'; + $privateMessage->message = sprintf('[b]REPORT TITLE:[/b] %s [b]ORIGINAL MESSAGE:[/b] %s [b]VERDICT:[/b] %s', $report->title, $report->message, $report->verdict); - $pm->save(); + $privateMessage->save(); return redirect()->route('staff.reports.index') ->withSuccess('Report has been successfully resolved'); diff --git a/app/Http/Controllers/Staff/RssController.php b/app/Http/Controllers/Staff/RssController.php index 8fd80424b2..ca1124b206 100644 --- a/app/Http/Controllers/Staff/RssController.php +++ b/app/Http/Controllers/Staff/RssController.php @@ -26,16 +26,16 @@ class RssController extends Controller /** * @var TorrentFacetedRepository */ - private $torrent_faceted; + private $torrentFacetedRepository; /** * RssController Constructor. * * @param TorrentFacetedRepository $torrent_faceted */ - public function __construct(TorrentFacetedRepository $torrent_faceted) + public function __construct(TorrentFacetedRepository $torrentFacetedRepository) { - $this->torrent_faceted = $torrent_faceted; + $this->torrentFacetedRepository = $torrentFacetedRepository; } /** @@ -65,7 +65,7 @@ public function index($hash = null) public function create(Request $request) { $user = $request->user(); - $torrent_repository = $this->torrent_faceted; + $torrent_repository = $this->torrentFacetedRepository; return view('Staff.rss.create', [ 'torrent_repository' => $torrent_repository, @@ -142,7 +142,7 @@ public function edit(Request $request, $id) { $user = $request->user(); $rss = Rss::where('is_private', '=', 0)->findOrFail($id); - $torrent_repository = $this->torrent_faceted; + $torrent_repository = $this->torrentFacetedRepository; return view('Staff.rss.edit', [ 'torrent_repository' => $torrent_repository, diff --git a/app/Http/Controllers/Staff/VersionController.php b/app/Http/Controllers/Staff/VersionController.php index 4df76e5088..35d2bed825 100644 --- a/app/Http/Controllers/Staff/VersionController.php +++ b/app/Http/Controllers/Staff/VersionController.php @@ -21,11 +21,11 @@ class VersionController extends Controller /** * @var VersionController */ - private $version; + private $versionController; public function __construct() { - $this->version = config('unit3d.version'); + $this->versionController = config('unit3d.version'); } /** @@ -40,7 +40,7 @@ public function checkVersion() $lastestVersion = $response[0]->tag_name; return response([ - 'updated' => ! version_compare($this->version, $lastestVersion, '<'), + 'updated' => ! version_compare($this->versionController, $lastestVersion, '<'), 'latestversion' => $lastestVersion, ]); } diff --git a/app/Http/Controllers/StatsController.php b/app/Http/Controllers/StatsController.php index ef983c5197..34e53875de 100644 --- a/app/Http/Controllers/StatsController.php +++ b/app/Http/Controllers/StatsController.php @@ -29,14 +29,14 @@ class StatsController extends Controller /** * @var \Carbon\Carbon|mixed */ - public $expiresAt; + public $carbon; /** * StatsController Constructor. */ public function __construct() { - $this->expiresAt = Carbon::now()->addMinutes(10); + $this->carbon = Carbon::now()->addMinutes(10); } /** @@ -49,10 +49,10 @@ public function __construct() public function index() { // Total Members Count (All Groups) - $all_user = cache()->remember('all_user', $this->expiresAt, fn () => User::withTrashed()->count()); + $all_user = cache()->remember('all_user', $this->carbon, fn () => User::withTrashed()->count()); // Total Active Members Count (Not Validating, Banned, Disabled, Pruned) - $active_user = cache()->remember('active_user', $this->expiresAt, function () { + $active_user = cache()->remember('active_user', $this->carbon, function () { $banned_group = cache()->rememberForever('banned_group', fn () => Group::where('slug', '=', 'banned')->pluck('id')); $validating_group = cache()->rememberForever('validating_group', fn () => Group::where('slug', '=', 'validating')->pluck('id')); $disabled_group = cache()->rememberForever('disabled_group', fn () => Group::where('slug', '=', 'disabled')->pluck('id')); @@ -62,61 +62,61 @@ public function index() }); // Total Disabled Members Count - $disabled_user = cache()->remember('disabled_user', $this->expiresAt, function () { + $disabled_user = cache()->remember('disabled_user', $this->carbon, function () { $disabled_group = cache()->rememberForever('disabled_group', fn () => Group::where('slug', '=', 'disabled')->pluck('id')); return User::where('group_id', '=', $disabled_group[0])->count(); }); // Total Pruned Members Count - $pruned_user = cache()->remember('pruned_user', $this->expiresAt, function () { + $pruned_user = cache()->remember('pruned_user', $this->carbon, function () { $pruned_group = cache()->rememberForever('pruned_group', fn () => Group::where('slug', '=', 'pruned')->pluck('id')); return User::onlyTrashed()->where('group_id', '=', $pruned_group[0])->count(); }); // Total Banned Members Count - $banned_user = cache()->remember('banned_user', $this->expiresAt, function () { + $banned_user = cache()->remember('banned_user', $this->carbon, function () { $banned_group = cache()->rememberForever('banned_group', fn () => Group::where('slug', '=', 'banned')->pluck('id')); return User::where('group_id', '=', $banned_group[0])->count(); }); // Total Torrents Count - $num_torrent = cache()->remember('num_torrent', $this->expiresAt, fn () => Torrent::count()); + $num_torrent = cache()->remember('num_torrent', $this->carbon, fn () => Torrent::count()); // Total Categories With Torrent Count $categories = Category::withCount('torrents')->get()->sortBy('position'); // Total HD Count - $num_hd = cache()->remember('num_hd', $this->expiresAt, fn () => Torrent::where('sd', '=', 0)->count()); + $num_hd = cache()->remember('num_hd', $this->carbon, fn () => Torrent::where('sd', '=', 0)->count()); // Total SD Count - $num_sd = cache()->remember('num_sd', $this->expiresAt, fn () => Torrent::where('sd', '=', 1)->count()); + $num_sd = cache()->remember('num_sd', $this->carbon, fn () => Torrent::where('sd', '=', 1)->count()); // Total Torrent Size - $torrent_size = cache()->remember('torrent_size', $this->expiresAt, fn () => Torrent::sum('size')); + $torrent_size = cache()->remember('torrent_size', $this->carbon, fn () => Torrent::sum('size')); // Total Seeders - $num_seeders = cache()->remember('num_seeders', $this->expiresAt, fn () => Peer::where('seeder', '=', 1)->count()); + $num_seeders = cache()->remember('num_seeders', $this->carbon, fn () => Peer::where('seeder', '=', 1)->count()); // Total Leechers - $num_leechers = cache()->remember('num_leechers', $this->expiresAt, fn () => Peer::where('seeder', '=', 0)->count()); + $num_leechers = cache()->remember('num_leechers', $this->carbon, fn () => Peer::where('seeder', '=', 0)->count()); // Total Peers - $num_peers = cache()->remember('num_peers', $this->expiresAt, fn () => Peer::count()); + $num_peers = cache()->remember('num_peers', $this->carbon, fn () => Peer::count()); //Total Upload Traffic Without Double Upload - $actual_upload = cache()->remember('actual_upload', $this->expiresAt, fn () => History::sum('actual_uploaded')); + $actual_upload = cache()->remember('actual_upload', $this->carbon, fn () => History::sum('actual_uploaded')); //Total Upload Traffic With Double Upload - $credited_upload = cache()->remember('credited_upload', $this->expiresAt, fn () => History::sum('uploaded')); + $credited_upload = cache()->remember('credited_upload', $this->carbon, fn () => History::sum('uploaded')); //Total Download Traffic Without Freeleech - $actual_download = cache()->remember('actual_download', $this->expiresAt, fn () => History::sum('actual_downloaded')); + $actual_download = cache()->remember('actual_download', $this->carbon, fn () => History::sum('actual_downloaded')); //Total Download Traffic With Freeleech - $credited_download = cache()->remember('credited_download', $this->expiresAt, fn () => History::sum('downloaded')); + $credited_download = cache()->remember('credited_download', $this->carbon, fn () => History::sum('downloaded')); //Total Up/Down Traffic without perks $actual_up_down = $actual_upload + $actual_download; diff --git a/app/Http/Controllers/SubtitleController.php b/app/Http/Controllers/SubtitleController.php index e8fa481354..7f35394dbc 100644 --- a/app/Http/Controllers/SubtitleController.php +++ b/app/Http/Controllers/SubtitleController.php @@ -39,16 +39,16 @@ class SubtitleController extends Controller /** * @var ChatRepository */ - private $chat; + private $chatRepository; /** * SubtitleController Constructor. * * @param ChatRepository $chat */ - public function __construct(ChatRepository $chat) + public function __construct(ChatRepository $chatRepository) { - $this->chat = $chat; + $this->chatRepository = $chatRepository; } /** @@ -132,11 +132,11 @@ public function store(Request $request) $torrent_url = href_torrent($subtitle->torrent); $profile_url = href_profile($user); if ($subtitle->anon == false) { - $this->chat->systemMessage( + $this->chatRepository->systemMessage( sprintf('[url=%s]%s[/url] has uploaded a new %s subtitle for [url=%s]%s[/url]', $profile_url, $user->username, $subtitle->language->name, $torrent_url, $subtitle->torrent->name) ); } else { - $this->chat->systemMessage( + $this->chatRepository->systemMessage( sprintf('An anonymous user has uploaded a new %s subtitle for [url=%s]%s[/url]', $subtitle->language->name, $torrent_url, $subtitle->torrent->name) ); } diff --git a/app/Http/Controllers/TopicController.php b/app/Http/Controllers/TopicController.php index 179d5388b8..c561493ea1 100644 --- a/app/Http/Controllers/TopicController.php +++ b/app/Http/Controllers/TopicController.php @@ -39,12 +39,12 @@ class TopicController extends Controller /** * @var TaggedUserRepository */ - private $tag; + private $taggedUserRepository; /** * @var ChatRepository */ - private $chat; + private $chatRepository; /** * ForumController Constructor. @@ -52,10 +52,10 @@ class TopicController extends Controller * @param TaggedUserRepository $tag * @param ChatRepository $chat */ - public function __construct(TaggedUserRepository $tag, ChatRepository $chat) + public function __construct(TaggedUserRepository $taggedUserRepository, ChatRepository $chatRepository) { - $this->tag = $tag; - $this->chat = $chat; + $this->taggedUserRepository = $taggedUserRepository; + $this->chatRepository = $chatRepository; } /** @@ -221,7 +221,7 @@ public function newTopic(Request $request, $id) if (config('other.staff-forum-notify') && ($forum->id == config('other.staff-forum-id') || $forum->parent_id == config('other.staff-forum-id'))) { $forum->notifyStaffers($user, $topic); } else { - $this->chat->systemMessage(sprintf('[url=%s]%s[/url] has created a new topic [url=%s]%s[/url]', $profileUrl, $user->username, $topicUrl, $topic->name)); + $this->chatRepository->systemMessage(sprintf('[url=%s]%s[/url] has created a new topic [url=%s]%s[/url]', $profileUrl, $user->username, $topicUrl, $topic->name)); $forum->notifySubscribers($user, $topic); } //Achievements diff --git a/app/Http/Controllers/TorrentController.php b/app/Http/Controllers/TorrentController.php index 405485af95..cb85cc496b 100644 --- a/app/Http/Controllers/TorrentController.php +++ b/app/Http/Controllers/TorrentController.php @@ -55,12 +55,12 @@ class TorrentController extends Controller /** * @var TorrentFacetedRepository */ - private $faceted; + private $torrentFacetedRepository; /** * @var ChatRepository */ - private $chat; + private $chatRepository; /** * @var int @@ -93,10 +93,10 @@ class TorrentController extends Controller * @param TorrentFacetedRepository $faceted * @param ChatRepository $chat */ - public function __construct(TorrentFacetedRepository $faceted, ChatRepository $chat) + public function __construct(TorrentFacetedRepository $torrentFacetedRepository, ChatRepository $chatRepository) { - $this->faceted = $faceted; - $this->chat = $chat; + $this->torrentFacetedRepository = $torrentFacetedRepository; + $this->chatRepository = $chatRepository; } /** @@ -109,7 +109,7 @@ public function __construct(TorrentFacetedRepository $faceted, ChatRepository $c public function torrents(Request $request) { $user = $request->user(); - $repository = $this->faceted; + $repository = $this->torrentFacetedRepository; $torrents = Torrent::with(['user:id,username', 'category', 'type', 'tags']) ->withCount(['thanks', 'comments']) @@ -177,23 +177,23 @@ public function cardLayout(Request $request) { $user = $request->user(); $torrents = Torrent::with(['user:id,username', 'category', 'type'])->latest()->paginate(33); - $repository = $this->faceted; + $repository = $this->torrentFacetedRepository; - $client = new \App\Services\MovieScrapper(config('api-keys.tmdb'), config('api-keys.tvdb'), config('api-keys.omdb')); + $movieScrapper = new \App\Services\MovieScrapper(config('api-keys.tmdb'), config('api-keys.tvdb'), config('api-keys.omdb')); foreach ($torrents as $torrent) { $meta = null; if ($torrent->category->tv_meta) { if ($torrent->tmdb || $torrent->tmdb != 0) { - $meta = $client->scrape('tv', null, $torrent->tmdb); + $meta = $movieScrapper->scrape('tv', null, $torrent->tmdb); } elseif ($torrent->imdb && $torrent->imdb != 0) { - $meta = $client->scrape('tv', 'tt'.$torrent->imdb); + $meta = $movieScrapper->scrape('tv', 'tt'.$torrent->imdb); } } if ($torrent->category->movie_meta) { if ($torrent->tmdb || $torrent->tmdb != 0) { - $meta = $client->scrape('movie', null, $torrent->tmdb); + $meta = $movieScrapper->scrape('movie', null, $torrent->tmdb); } elseif ($torrent->imdb && $torrent->imdb != 0) { - $meta = $client->scrape('movie', 'tt'.$torrent->imdb); + $meta = $movieScrapper->scrape('movie', 'tt'.$torrent->imdb); } } if ($torrent->category->game_meta) { @@ -246,20 +246,20 @@ public function filtered(Request $request) public function groupingLayout(Request $request) { $user = $request->user(); - $repository = $this->faceted; + $repository = $this->torrentFacetedRepository; $personal_freeleech = PersonalFreeleech::where('user_id', '=', $user->id)->first(); $logger = null; $cache = []; $attributes = []; - $torrent = DB::table('torrents')->selectRaw('distinct(torrents.imdb),max(torrents.created_at) as screated_at,max(torrents.seeders) as sseeders,max(torrents.leechers) as sleechers,max(torrents.times_completed) as stimes_completed,max(torrents.name) as sname,max(torrents.size) as ssize')->leftJoin('torrents as torrentsl', 'torrents.id', '=', 'torrentsl.id')->groupBy('torrents.imdb')->whereRaw('torrents.status = ? AND torrents.imdb != ?', [1, 0]); + $builder = DB::table('torrents')->selectRaw('distinct(torrents.imdb),max(torrents.created_at) as screated_at,max(torrents.seeders) as sseeders,max(torrents.leechers) as sleechers,max(torrents.times_completed) as stimes_completed,max(torrents.name) as sname,max(torrents.size) as ssize')->leftJoin('torrents as torrentsl', 'torrents.id', '=', 'torrentsl.id')->groupBy('torrents.imdb')->whereRaw('torrents.status = ? AND torrents.imdb != ?', [1, 0]); - $prelauncher = $torrent->orderBy('s'.self::SORTING, self::ORDER)->pluck('imdb')->toArray(); + $prelauncher = $builder->orderBy('s'.self::SORTING, self::ORDER)->pluck('imdb')->toArray(); if (! is_array($prelauncher)) { $prelauncher = []; } - $links = new Paginator($prelauncher, count($prelauncher), self::QTY); + $lengthAwarePaginator = new Paginator($prelauncher, count($prelauncher), self::QTY); $hungry = array_chunk($prelauncher, self::QTY); $fed = []; @@ -310,22 +310,22 @@ public function groupingLayout(Request $request) $torrents = count($cache) > 0 ? $cache : null; if (is_array($torrents)) { - $client = new \App\Services\MovieScrapper(config('api-keys.tmdb'), config('api-keys.tvdb'), config('api-keys.omdb')); + $movieScrapper = new \App\Services\MovieScrapper(config('api-keys.tmdb'), config('api-keys.tvdb'), config('api-keys.omdb')); foreach ($torrents as $k1 => $c) { foreach ($c as $k2 => $d) { $meta = null; if ($d['chunk']->category->tv_meta) { if ($d['chunk']->tmdb || $d['chunk']->tmdb != 0) { - $meta = $client->scrape('tv', null, $d['chunk']->tmdb); + $meta = $movieScrapper->scrape('tv', null, $d['chunk']->tmdb); } elseif ($d['chunk']->imdb && $d['chunk']->imdb != 0) { - $meta = $client->scrape('tv', 'tt'.$d['chunk']->imdb); + $meta = $movieScrapper->scrape('tv', 'tt'.$d['chunk']->imdb); } } if ($d['chunk']->category->movie_meta) { if ($d['chunk']->tmdb || $d['chunk']->tmdb != 0) { - $meta = $client->scrape('movie', null, $d['chunk']->tmdb); + $meta = $movieScrapper->scrape('movie', null, $d['chunk']->tmdb); } elseif ($d['chunk']->imdb && $d['chunk']->imdb != 0) { - $meta = $client->scrape('movie', 'tt'.$d['chunk']->imdb); + $meta = $movieScrapper->scrape('movie', 'tt'.$d['chunk']->imdb); } } if ($d['chunk']->category->game_meta) { @@ -345,7 +345,7 @@ public function groupingLayout(Request $request) 'user' => $user, 'sorting' => self::SORTING, 'direction' => self::DIRECTION, - 'links' => $links, + 'links' => $lengthAwarePaginator, 'totals' => $totals, 'personal_freeleech' => $personal_freeleech, 'repository' => $repository, @@ -369,7 +369,7 @@ public function groupingLayout(Request $request) public function faceted(Request $request, Torrent $torrent) { $user = $request->user(); - $repository = $this->faceted; + $repository = $this->torrentFacetedRepository; $personal_freeleech = PersonalFreeleech::where('user_id', '=', $user->id)->first(); $collection = null; $history = null; @@ -928,20 +928,20 @@ public function torrent(Request $request, $id) $user_tips = BonTransactions::where('torrent_id', '=', $id)->where('sender', '=', $request->user()->id)->sum('cost'); $last_seed_activity = History::where('info_hash', '=', $torrent->info_hash)->where('seeder', '=', 1)->latest('updated_at')->first(); - $client = new \App\Services\MovieScrapper(config('api-keys.tmdb'), config('api-keys.tvdb'), config('api-keys.omdb')); + $movieScrapper = new \App\Services\MovieScrapper(config('api-keys.tmdb'), config('api-keys.tvdb'), config('api-keys.omdb')); $meta = null; if ($torrent->category->tv_meta) { if ($torrent->tmdb && $torrent->tmdb != 0) { - $meta = $client->scrape('tv', null, $torrent->tmdb); + $meta = $movieScrapper->scrape('tv', null, $torrent->tmdb); } else { - $meta = $client->scrape('tv', 'tt'.$torrent->imdb); + $meta = $movieScrapper->scrape('tv', 'tt'.$torrent->imdb); } } if ($torrent->category->movie_meta) { if ($torrent->tmdb && $torrent->tmdb != 0) { - $meta = $client->scrape('movie', null, $torrent->tmdb); + $meta = $movieScrapper->scrape('movie', null, $torrent->tmdb); } else { - $meta = $client->scrape('movie', 'tt'.$torrent->imdb); + $meta = $movieScrapper->scrape('movie', 'tt'.$torrent->imdb); } } @@ -967,9 +967,9 @@ public function torrent(Request $request, $id) $subtitle = null; $subtitle_crumbs = null; if ($torrent->mediainfo != null) { - $parser = new MediaInfo(); - $parsed = $parser->parse($torrent->mediainfo); - $view_crumbs = $parser->prepareViewCrumbs($parsed); + $mediaInfo = new MediaInfo(); + $parsed = $mediaInfo->parse($torrent->mediainfo); + $view_crumbs = $mediaInfo->prepareViewCrumbs($parsed); $general = $parsed['general']; $general_crumbs = $view_crumbs['general']; $video = $parsed['video']; @@ -993,7 +993,7 @@ public function torrent(Request $request, $id) 'characters' => $characters, 'total_tips' => $total_tips, 'user_tips' => $user_tips, - 'client' => $client, + 'client' => $movieScrapper, 'featured' => $featured, 'general' => $general, 'general_crumbs' => $general_crumbs, @@ -1048,7 +1048,7 @@ public function edit(Request $request, $id) { $user = $request->user(); $torrent = Torrent::withAnyStatus()->findOrFail($id); - $client = new \App\Services\MovieScrapper(config('api-keys.tmdb'), config('api-keys.tvdb'), config('api-keys.omdb')); + $movieScrapper = new \App\Services\MovieScrapper(config('api-keys.tmdb'), config('api-keys.tvdb'), config('api-keys.omdb')); abort_unless($user->group->is_modo || $user->id == $torrent->user_id, 403); $torrent->name = $request->input('name'); @@ -1094,16 +1094,16 @@ public function edit(Request $request, $id) // Torrent Tags System if ($torrent->category->tv_meta) { if ($torrent->tmdb && $torrent->tmdb != 0) { - $meta = $client->scrape('tv', null, $torrent->tmdb); + $meta = $movieScrapper->scrape('tv', null, $torrent->tmdb); } else { - $meta = $client->scrape('tv', 'tt'.$torrent->imdb); + $meta = $movieScrapper->scrape('tv', 'tt'.$torrent->imdb); } } if ($torrent->category->movie_meta) { if ($torrent->tmdb && $torrent->tmdb != 0) { - $meta = $client->scrape('movie', null, $torrent->tmdb); + $meta = $movieScrapper->scrape('movie', null, $torrent->tmdb); } else { - $meta = $client->scrape('movie', 'tt'.$torrent->imdb); + $meta = $movieScrapper->scrape('movie', 'tt'.$torrent->imdb); } } if (isset($meta) && $meta->genres) { @@ -1288,7 +1288,7 @@ public function upload(Request $request) ->withWarning('Torrent Description Preview Loaded!'); } - $client = new \App\Services\MovieScrapper(config('api-keys.tmdb'), config('api-keys.tvdb'), config('api-keys.omdb')); + $movieScrapper = new \App\Services\MovieScrapper(config('api-keys.tmdb'), config('api-keys.tvdb'), config('api-keys.omdb')); $requestFile = $request->file('torrent'); if ($request->hasFile('torrent') == false) { return redirect()->route('upload_form', ['category_id' => $category->id]) @@ -1375,27 +1375,27 @@ public function upload(Request $request) // Backup the files contained in the torrent $fileList = TorrentTools::getTorrentFiles($decodedTorrent); foreach ($fileList as $file) { - $f = new TorrentFile(); - $f->name = $file['name']; - $f->size = $file['size']; - $f->torrent_id = $torrent->id; - $f->save(); - unset($f); + $torrentFile = new TorrentFile(); + $torrentFile->name = $file['name']; + $torrentFile->size = $file['size']; + $torrentFile->torrent_id = $torrent->id; + $torrentFile->save(); + unset($torrentFile); } $meta = null; // Torrent Tags System if ($torrent->category->tv_meta !== 0) { if ($torrent->tmdb && $torrent->tmdb != 0) { - $meta = $client->scrape('tv', null, $torrent->tmdb); + $meta = $movieScrapper->scrape('tv', null, $torrent->tmdb); } else { - $meta = $client->scrape('tv', 'tt'.$torrent->imdb); + $meta = $movieScrapper->scrape('tv', 'tt'.$torrent->imdb); } } if ($torrent->category->movie_meta !== 0) { if ($torrent->tmdb && $torrent->tmdb != 0) { - $meta = $client->scrape('movie', null, $torrent->tmdb); + $meta = $movieScrapper->scrape('movie', null, $torrent->tmdb); } else { - $meta = $client->scrape('movie', 'tt'.$torrent->imdb); + $meta = $movieScrapper->scrape('movie', 'tt'.$torrent->imdb); } } if (isset($meta) && $meta->genres) { @@ -1416,11 +1416,11 @@ public function upload(Request $request) // Announce To Shoutbox if ($anon == 0) { - $this->chat->systemMessage( + $this->chatRepository->systemMessage( sprintf('User [url=%s/users/', $appurl).$username.']'.$username.sprintf('[/url] has uploaded [url=%s/torrents/', $appurl).$torrent->id.']'.$torrent->name.'[/url] grab it now! :slight_smile:' ); } else { - $this->chat->systemMessage( + $this->chatRepository->systemMessage( sprintf('An anonymous user has uploaded [url=%s/torrents/', $appurl).$torrent->id.']'.$torrent->name.'[/url] grab it now! :slight_smile:' ); } @@ -1534,17 +1534,17 @@ public function bumpTorrent(Request $request, $id) $torrent_url = href_torrent($torrent); $profile_url = href_profile($user); - $this->chat->systemMessage( + $this->chatRepository->systemMessage( sprintf('Attention, [url=%s]%s[/url] has been bumped to the top by [url=%s]%s[/url]! It could use more seeds!', $torrent_url, $torrent->name, $profile_url, $user->username) ); // Announce To IRC if (config('irc-bot.enabled') == true) { $appname = config('app.name'); - $bot = new IRCAnnounceBot(); - $bot->message('#announce', '['.$appname.'] User '.$user->username.' has bumped '.$torrent->name.' , it could use more seeds!'); - $bot->message('#announce', '[Category: '.$torrent->category->name.'] [Type: '.$torrent->type->name.'] [Size:'.$torrent->getSize().']'); - $bot->message('#announce', sprintf('[Link: %s]', $torrent_url)); + $ircAnnounceBot = new IRCAnnounceBot(); + $ircAnnounceBot->message('#announce', '['.$appname.'] User '.$user->username.' has bumped '.$torrent->name.' , it could use more seeds!'); + $ircAnnounceBot->message('#announce', '[Category: '.$torrent->category->name.'] [Type: '.$torrent->type->name.'] [Size:'.$torrent->getSize().']'); + $ircAnnounceBot->message('#announce', sprintf('[Link: %s]', $torrent_url)); } return redirect()->route('torrent', ['id' => $torrent->id]) @@ -1591,13 +1591,13 @@ public function grantFL(Request $request, $id) if ($torrent->free == 0) { $torrent->free = '1'; - $this->chat->systemMessage( + $this->chatRepository->systemMessage( sprintf('Ladies and Gents, [url=%s]%s[/url] has been granted 100%% FreeLeech! Grab It While You Can! :fire:', $torrent_url, $torrent->name) ); } else { $torrent->free = '0'; - $this->chat->systemMessage( + $this->chatRepository->systemMessage( sprintf('Ladies and Gents, [url=%s]%s[/url] has been revoked of its 100%% FreeLeech! :poop:', $torrent_url, $torrent->name) ); } @@ -1636,7 +1636,7 @@ public function grantFeatured(Request $request, $id) $torrent_url = href_torrent($torrent); $profile_url = href_profile($user); - $this->chat->systemMessage( + $this->chatRepository->systemMessage( sprintf('Ladies and Gents, [url=%s]%s[/url] has been added to the Featured Torrents Slider by [url=%s]%s[/url]! Grab It While You Can! :fire:', $torrent_url, $torrent->name, $profile_url, $user->username) ); @@ -1667,12 +1667,12 @@ public function grantDoubleUp(Request $request, $id) if ($torrent->doubleup == 0) { $torrent->doubleup = '1'; - $this->chat->systemMessage( + $this->chatRepository->systemMessage( sprintf('Ladies and Gents, [url=%s]%s[/url] has been granted Double Upload! Grab It While You Can! :fire:', $torrent_url, $torrent->name) ); } else { $torrent->doubleup = '0'; - $this->chat->systemMessage( + $this->chatRepository->systemMessage( sprintf('Ladies and Gents, [url=%s]%s[/url] has been revoked of its Double Upload! :poop:', $torrent_url, $torrent->name) ); } @@ -1706,7 +1706,7 @@ public function reseedTorrent(Request $request, $id) $torrent_url = href_torrent($torrent); $profile_url = href_profile($user); - $this->chat->systemMessage( + $this->chatRepository->systemMessage( sprintf('Ladies and Gents, a reseed request was just placed on [url=%s]%s[/url] can you help out :question:', $torrent_url, $torrent->name) ); @@ -1733,10 +1733,10 @@ public function freeleechToken(Request $request, $id) $active_token = FreeleechToken::where('user_id', '=', $user->id)->where('torrent_id', '=', $torrent->id)->first(); if ($user->fl_tokens >= 1 && ! $active_token) { - $token = new FreeleechToken(); - $token->user_id = $user->id; - $token->torrent_id = $torrent->id; - $token->save(); + $freeleechToken = new FreeleechToken(); + $freeleechToken->user_id = $user->id; + $freeleechToken->torrent_id = $torrent->id; + $freeleechToken->save(); $user->fl_tokens -= '1'; $user->save(); diff --git a/app/Http/Controllers/UserController.php b/app/Http/Controllers/UserController.php index 26e7e2c079..4a7eeaf311 100644 --- a/app/Http/Controllers/UserController.php +++ b/app/Http/Controllers/UserController.php @@ -1978,12 +1978,12 @@ public function downloadHistoryTorrents(Request $request, $username) $zipFileName = sprintf('%s.zip', $user->username); // Create ZipArchive Obj - $zip = new ZipArchive(); + $zipArchive = new ZipArchive(); // Get Users History $historyTorrents = History::where('user_id', '=', $user->id)->pluck('info_hash'); - if ($zip->open($path.'/'.$zipFileName, ZipArchive::CREATE) === true) { + if ($zipArchive->open($path.'/'.$zipFileName, ZipArchive::CREATE) === true) { // Match History Results To Torrents $failCSV = '"Name","URL","ID","info_hash" '; @@ -2017,16 +2017,16 @@ public function downloadHistoryTorrents(Request $request, $username) file_put_contents(getcwd().'/files/tmp/'.$tmpFileName, $fileToDownload); // Add Files To ZipArchive - $zip->addFile(getcwd().'/files/tmp/'.$tmpFileName, $tmpFileName); + $zipArchive->addFile(getcwd().'/files/tmp/'.$tmpFileName, $tmpFileName); } } if ($failCount > 0) { $CSVtmpName = sprintf('%s.zip', $user->username).'-missingTorrentFiles.CSV'; file_put_contents(getcwd().'/files/tmp/'.$CSVtmpName, $failCSV); - $zip->addFile(getcwd().'/files/tmp/'.$CSVtmpName, 'missingTorrentFiles.CSV'); + $zipArchive->addFile(getcwd().'/files/tmp/'.$CSVtmpName, 'missingTorrentFiles.CSV'); } // Close ZipArchive - $zip->close(); + $zipArchive->close(); } $zip_file = $path.'/'.$zipFileName; diff --git a/app/Http/Controllers/WarningController.php b/app/Http/Controllers/WarningController.php index 83f2abacce..2ca5eb7e8b 100644 --- a/app/Http/Controllers/WarningController.php +++ b/app/Http/Controllers/WarningController.php @@ -68,12 +68,12 @@ public function deactivate(Request $request, $id) $warning->save(); // Send Private Message - $pm = new PrivateMessage(); - $pm->sender_id = $staff->id; - $pm->receiver_id = $warning->user_id; - $pm->subject = 'Hit and Run Warning Deactivated'; - $pm->message = $staff->username.' has decided to deactivate your active warning for torrent '.$warning->torrent.' You lucked out! [color=red][b]THIS IS AN AUTOMATED SYSTEM MESSAGE, PLEASE DO NOT REPLY![/b][/color]'; - $pm->save(); + $privateMessage = new PrivateMessage(); + $privateMessage->sender_id = $staff->id; + $privateMessage->receiver_id = $warning->user_id; + $privateMessage->subject = 'Hit and Run Warning Deactivated'; + $privateMessage->message = $staff->username.' has decided to deactivate your active warning for torrent '.$warning->torrent.' You lucked out! [color=red][b]THIS IS AN AUTOMATED SYSTEM MESSAGE, PLEASE DO NOT REPLY![/b][/color]'; + $privateMessage->save(); return redirect()->route('warnings.show', ['username' => $warning->warneduser->username]) ->withSuccess('Warning Was Successfully Deactivated'); @@ -102,12 +102,12 @@ public function deactivateAllWarnings(Request $request, $username) } // Send Private Message - $pm = new PrivateMessage(); - $pm->sender_id = $staff->id; - $pm->receiver_id = $user->id; - $pm->subject = 'All Hit and Run Warning Deactivated'; - $pm->message = $staff->username.' has decided to deactivate all of your active hit and run warnings. You lucked out! [color=red][b]THIS IS AN AUTOMATED SYSTEM MESSAGE, PLEASE DO NOT REPLY![/b][/color]'; - $pm->save(); + $privateMessage = new PrivateMessage(); + $privateMessage->sender_id = $staff->id; + $privateMessage->receiver_id = $user->id; + $privateMessage->subject = 'All Hit and Run Warning Deactivated'; + $privateMessage->message = $staff->username.' has decided to deactivate all of your active hit and run warnings. You lucked out! [color=red][b]THIS IS AN AUTOMATED SYSTEM MESSAGE, PLEASE DO NOT REPLY![/b][/color]'; + $privateMessage->save(); return redirect()->route('warnings.show', ['username' => $user->username]) ->withSuccess('All Warnings Were Successfully Deactivated'); @@ -129,12 +129,12 @@ public function deleteWarning(Request $request, $id) $warning = Warning::findOrFail($id); // Send Private Message - $pm = new PrivateMessage(); - $pm->sender_id = $staff->id; - $pm->receiver_id = $warning->user_id; - $pm->subject = 'Hit and Run Warning Deleted'; - $pm->message = $staff->username.' has decided to delete your warning for torrent '.$warning->torrent.' You lucked out! [color=red][b]THIS IS AN AUTOMATED SYSTEM MESSAGE, PLEASE DO NOT REPLY![/b][/color]'; - $pm->save(); + $privateMessage = new PrivateMessage(); + $privateMessage->sender_id = $staff->id; + $privateMessage->receiver_id = $warning->user_id; + $privateMessage->subject = 'Hit and Run Warning Deleted'; + $privateMessage->message = $staff->username.' has decided to delete your warning for torrent '.$warning->torrent.' You lucked out! [color=red][b]THIS IS AN AUTOMATED SYSTEM MESSAGE, PLEASE DO NOT REPLY![/b][/color]'; + $privateMessage->save(); $warning->deleted_by = $staff->id; $warning->save(); @@ -168,12 +168,12 @@ public function deleteAllWarnings(Request $request, $username) } // Send Private Message - $pm = new PrivateMessage(); - $pm->sender_id = $staff->id; - $pm->receiver_id = $user->id; - $pm->subject = 'All Hit and Run Warnings Deleted'; - $pm->message = $staff->username.' has decided to delete all of your warnings. You lucked out! [color=red][b]THIS IS AN AUTOMATED SYSTEM MESSAGE, PLEASE DO NOT REPLY![/b][/color]'; - $pm->save(); + $privateMessage = new PrivateMessage(); + $privateMessage->sender_id = $staff->id; + $privateMessage->receiver_id = $user->id; + $privateMessage->subject = 'All Hit and Run Warnings Deleted'; + $privateMessage->message = $staff->username.' has decided to delete all of your warnings. You lucked out! [color=red][b]THIS IS AN AUTOMATED SYSTEM MESSAGE, PLEASE DO NOT REPLY![/b][/color]'; + $privateMessage->save(); return redirect()->route('warnings.show', ['username' => $user->username]) ->withSuccess('All Warnings Were Successfully Deleted'); diff --git a/app/Jobs/ProcessMassPM.php b/app/Jobs/ProcessMassPM.php index dcb5ba8664..c5ca0ea809 100644 --- a/app/Jobs/ProcessMassPM.php +++ b/app/Jobs/ProcessMassPM.php @@ -57,11 +57,11 @@ public function __construct($sender_id, $receiver_id, $subject, $message) */ public function handle() { - $pm = new PrivateMessage(); - $pm->sender_id = $this->sender_id; - $pm->receiver_id = $this->receiver_id; - $pm->subject = $this->subject; - $pm->message = $this->message; - $pm->save(); + $privateMessage = new PrivateMessage(); + $privateMessage->sender_id = $this->sender_id; + $privateMessage->receiver_id = $this->receiver_id; + $privateMessage->subject = $this->subject; + $privateMessage->message = $this->message; + $privateMessage->save(); } } diff --git a/app/Listeners/AchievementUnlocked.php b/app/Listeners/AchievementUnlocked.php index 6bef2aa122..25d910f127 100644 --- a/app/Listeners/AchievementUnlocked.php +++ b/app/Listeners/AchievementUnlocked.php @@ -22,9 +22,9 @@ class AchievementUnlocked { private $chat; - public function __construct(ChatRepository $chat) + public function __construct(ChatRepository $chatRepository) { - $this->chat = $chat; + $this->chat = $chatRepository; } /** @@ -34,17 +34,17 @@ public function __construct(ChatRepository $chat) * * @return void */ - public function handle(Unlocked $event) + public function handle(Unlocked $unlocked) { // There's an AchievementProgress instance located on $event->progress - $user = User::where('id', '=', $event->progress->achiever_id)->first(); - Session::flash('achievement', $event->progress->details->name); + $user = User::where('id', '=', $unlocked->progress->achiever_id)->first(); + Session::flash('achievement', $unlocked->progress->details->name); if ($user->private_profile == 0) { $profile_url = href_profile($user); $this->chat->systemMessage( - sprintf('User [url=%s]%s[/url] has unlocked the %s achievement :medal:', $profile_url, $user->username, $event->progress->details->name) + sprintf('User [url=%s]%s[/url] has unlocked the %s achievement :medal:', $profile_url, $user->username, $unlocked->progress->details->name) ); } } diff --git a/app/Listeners/PasswordProtectBackup.php b/app/Listeners/PasswordProtectBackup.php index 7783c66381..76af2cff49 100644 --- a/app/Listeners/PasswordProtectBackup.php +++ b/app/Listeners/PasswordProtectBackup.php @@ -37,8 +37,8 @@ public function __construct() * * @return string */ - public function handle(BackupZipWasCreated $event): string + public function handle(BackupZipWasCreated $backupZipWasCreated): string { - return (new BackupPassword(new \App\Helpers\BackupEncryption(), $event->pathToZip))->path; + return (new BackupPassword(new \App\Helpers\BackupEncryption(), $backupZipWasCreated->pathToZip))->path; } } diff --git a/app/Models/Page.php b/app/Models/Page.php index d08962fbf9..66a8b32bba 100644 --- a/app/Models/Page.php +++ b/app/Models/Page.php @@ -62,11 +62,11 @@ public function setContentAttribute($value) */ public function getContentHtml() { - $converter = new BBCodeConverter($this->content); - $content = $converter->toMarkdown(); + $bbCodeConverter = new BBCodeConverter($this->content); + $content = $bbCodeConverter->toMarkdown(); - $parser = new Markdown(); + $markdown = new Markdown(); - return $parser->text($content); + return $markdown->text($content); } } diff --git a/app/Models/Torrent.php b/app/Models/Torrent.php index 515f10b93c..7d8784e1b0 100644 --- a/app/Models/Torrent.php +++ b/app/Models/Torrent.php @@ -383,9 +383,9 @@ public function setMediaInfoAttribute($value) */ public function getMediaInfo() { - $parser = new MediaInfo(); + $mediaInfo = new MediaInfo(); - return $parser->parse($this->mediaInfo); + return $mediaInfo->parse($this->mediaInfo); } /** diff --git a/app/Notifications/FailedLogin.php b/app/Notifications/FailedLogin.php index 43182b734f..d591079687 100644 --- a/app/Notifications/FailedLogin.php +++ b/app/Notifications/FailedLogin.php @@ -35,7 +35,7 @@ class FailedLogin extends Notification implements ShouldQueue * * @var Carbon\Carbon */ - public $time; + public $carbon; /** * Create a new notification instance. @@ -47,7 +47,7 @@ class FailedLogin extends Notification implements ShouldQueue public function __construct($ip) { $this->ip = $ip; - $this->time = Carbon::now(); + $this->carbon = Carbon::now(); } /** @@ -73,7 +73,7 @@ public function toArray($notifiable) { return [ 'ip' => $this->ip, - 'time' => $this->time, + 'time' => $this->carbon, ]; } @@ -91,6 +91,6 @@ public function toMail($notifiable) ->subject(trans('email.fail-login-subject')) ->greeting(trans('email.fail-login-greeting')) ->line(trans('email.fail-login-line1')) - ->line(trans('email.fail-login-line2', ['ip' => $this->ip, 'host' => gethostbyaddr($this->ip), 'time' => $this->time])); + ->line(trans('email.fail-login-line2', ['ip' => $this->ip, 'host' => gethostbyaddr($this->ip), 'time' => $this->carbon])); } } diff --git a/app/Notifications/NewBon.php b/app/Notifications/NewBon.php index 3b2c04645e..b2be230fa1 100644 --- a/app/Notifications/NewBon.php +++ b/app/Notifications/NewBon.php @@ -35,10 +35,10 @@ class NewBon extends Notification implements ShouldQueue * @param string $sender * @param BonTransactions $transaction */ - public function __construct(string $type, string $sender, BonTransactions $transaction) + public function __construct(string $type, string $sender, BonTransactions $bonTransactions) { $this->type = $type; - $this->transaction = $transaction; + $this->transaction = $bonTransactions; $this->sender = $sender; } diff --git a/app/Notifications/NewPost.php b/app/Notifications/NewPost.php index 4f101f103f..2417fb9e44 100644 --- a/app/Notifications/NewPost.php +++ b/app/Notifications/NewPost.php @@ -36,9 +36,9 @@ class NewPost extends Notification implements ShouldQueue * @param User $poster * @param Post $post */ - public function __construct(string $type, User $poster, Post $post) + public function __construct(string $type, User $user, Post $post) { - $this->poster = $poster; + $this->poster = $user; $this->post = $post; $this->type = $type; } diff --git a/app/Notifications/NewRequestBounty.php b/app/Notifications/NewRequestBounty.php index 74e324c95b..4ab46a2207 100644 --- a/app/Notifications/NewRequestBounty.php +++ b/app/Notifications/NewRequestBounty.php @@ -38,11 +38,11 @@ class NewRequestBounty extends Notification implements ShouldQueue * @param $amount * @param TorrentRequest $tr */ - public function __construct(string $type, string $sender, $amount, TorrentRequest $tr) + public function __construct(string $type, string $sender, $amount, TorrentRequest $torrentRequest) { $this->type = $type; $this->sender = $sender; - $this->tr = $tr; + $this->tr = $torrentRequest; $this->amount = $amount; } diff --git a/app/Notifications/NewRequestClaim.php b/app/Notifications/NewRequestClaim.php index 0f63a698f4..d54c3c7834 100644 --- a/app/Notifications/NewRequestClaim.php +++ b/app/Notifications/NewRequestClaim.php @@ -35,11 +35,11 @@ class NewRequestClaim extends Notification implements ShouldQueue * @param string $sender * @param TorrentRequest $tr */ - public function __construct(string $type, string $sender, TorrentRequest $tr) + public function __construct(string $type, string $sender, TorrentRequest $torrentRequest) { $this->type = $type; $this->sender = $sender; - $this->tr = $tr; + $this->tr = $torrentRequest; } /** diff --git a/app/Notifications/NewRequestFill.php b/app/Notifications/NewRequestFill.php index b04fade804..171fdcdc03 100644 --- a/app/Notifications/NewRequestFill.php +++ b/app/Notifications/NewRequestFill.php @@ -35,11 +35,11 @@ class NewRequestFill extends Notification implements ShouldQueue * @param string $sender * @param TorrentRequest $tr */ - public function __construct(string $type, string $sender, TorrentRequest $tr) + public function __construct(string $type, string $sender, TorrentRequest $torrentRequest) { $this->type = $type; $this->sender = $sender; - $this->tr = $tr; + $this->tr = $torrentRequest; } /** diff --git a/app/Notifications/NewRequestFillApprove.php b/app/Notifications/NewRequestFillApprove.php index 4247137364..5f648eb42c 100644 --- a/app/Notifications/NewRequestFillApprove.php +++ b/app/Notifications/NewRequestFillApprove.php @@ -35,11 +35,11 @@ class NewRequestFillApprove extends Notification implements ShouldQueue * @param string $sender * @param TorrentRequest $tr */ - public function __construct(string $type, string $sender, TorrentRequest $tr) + public function __construct(string $type, string $sender, TorrentRequest $torrentRequest) { $this->type = $type; $this->sender = $sender; - $this->tr = $tr; + $this->tr = $torrentRequest; } /** diff --git a/app/Notifications/NewRequestFillReject.php b/app/Notifications/NewRequestFillReject.php index 1bafe10745..a6d6538dc1 100644 --- a/app/Notifications/NewRequestFillReject.php +++ b/app/Notifications/NewRequestFillReject.php @@ -35,11 +35,11 @@ class NewRequestFillReject extends Notification implements ShouldQueue * @param string $sender * @param TorrentRequest $tr */ - public function __construct(string $type, string $sender, TorrentRequest $tr) + public function __construct(string $type, string $sender, TorrentRequest $torrentRequest) { $this->type = $type; $this->sender = $sender; - $this->tr = $tr; + $this->tr = $torrentRequest; } /** diff --git a/app/Notifications/NewRequestUnclaim.php b/app/Notifications/NewRequestUnclaim.php index 85b31a93de..d0ee929e60 100644 --- a/app/Notifications/NewRequestUnclaim.php +++ b/app/Notifications/NewRequestUnclaim.php @@ -35,11 +35,11 @@ class NewRequestUnclaim extends Notification implements ShouldQueue * @param string $sender * @param TorrentRequest $tr */ - public function __construct(string $type, string $sender, TorrentRequest $tr) + public function __construct(string $type, string $sender, TorrentRequest $torrentRequest) { $this->type = $type; $this->sender = $sender; - $this->tr = $tr; + $this->tr = $torrentRequest; } /** diff --git a/app/Notifications/NewTopic.php b/app/Notifications/NewTopic.php index 3bdca329b9..8e90f774ca 100644 --- a/app/Notifications/NewTopic.php +++ b/app/Notifications/NewTopic.php @@ -36,11 +36,11 @@ class NewTopic extends Notification implements ShouldQueue * @param User $poster * @param Topic $topic */ - public function __construct(string $type, User $poster, Topic $topic) + public function __construct(string $type, User $user, Topic $topic) { $this->type = $type; $this->topic = $topic; - $this->poster = $poster; + $this->poster = $user; } /** diff --git a/app/Repositories/ChatRepository.php b/app/Repositories/ChatRepository.php index 73df9a6480..bb42a954b0 100644 --- a/app/Repositories/ChatRepository.php +++ b/app/Repositories/ChatRepository.php @@ -37,12 +37,12 @@ class ChatRepository /** * @var Chatroom */ - private $room; + private $chatroom; /** * @var ChatStatus */ - private $status; + private $chatStatus; /** * @var User @@ -64,15 +64,15 @@ class ChatRepository */ private $audible; - public function __construct(Message $message, Chatroom $room, ChatStatus $status, User $user, Bot $bot, UserEcho $echo, UserAudible $audible) + public function __construct(Message $message, Chatroom $chatroom, ChatStatus $chatStatus, User $user, Bot $bot, UserEcho $userEcho, UserAudible $userAudible) { $this->message = $message; - $this->room = $room; - $this->echo = $echo; - $this->status = $status; + $this->chatroom = $chatroom; + $this->echo = $userEcho; + $this->chatStatus = $chatStatus; $this->user = $user; $this->bot = $bot; - $this->audible = $audible; + $this->audible = $userAudible; } public function config() @@ -115,12 +115,12 @@ public function audibles($user_id) public function rooms() { - return $this->room->all(); + return $this->chatroom->all(); } public function roomFindOrFail($id) { - return $this->room->findOrFail($id); + return $this->chatroom->findOrFail($id); } public function ping($type, $id) @@ -329,16 +329,16 @@ public function systemChatroom($room = null) if ($room instanceof Chatroom) { $room = $room->id; } elseif (is_int($room)) { - $room = $this->room->findOrFail($room)->id; + $room = $this->chatroom->findOrFail($room)->id; } else { - $room = $this->room->whereName($room)->first()->id; + $room = $this->chatroom->whereName($room)->first()->id; } } elseif (is_int($config)) { - $room = $this->room->findOrFail($config)->id; + $room = $this->chatroom->findOrFail($config)->id; } elseif ($config instanceof Chatroom) { $room = $config->id; } else { - $room = $this->room->whereName($config)->first()->id; + $room = $this->chatroom->whereName($config)->first()->id; } return $room; @@ -346,17 +346,17 @@ public function systemChatroom($room = null) public function statuses() { - return $this->status->all(); + return $this->chatStatus->all(); } public function status($user) { if ($user instanceof User) { - $status = $this->status->where('user_id', '=', $user->id)->first(); + $status = $this->chatStatus->where('user_id', '=', $user->id)->first(); } if (is_int($user)) { - $status = $this->status->where('user_id', '=', $user)->first(); + $status = $this->chatStatus->where('user_id', '=', $user)->first(); } return $status; @@ -364,7 +364,7 @@ public function status($user) public function statusFindOrFail($id) { - return $this->status->findOrFail($id); + return $this->chatStatus->findOrFail($id); } /** diff --git a/app/Repositories/TaggedUserRepository.php b/app/Repositories/TaggedUserRepository.php index 8a11b204f2..8ec2950ddc 100644 --- a/app/Repositories/TaggedUserRepository.php +++ b/app/Repositories/TaggedUserRepository.php @@ -44,7 +44,7 @@ class TaggedUserRepository /** * @var PrivateMessage */ - private $message; + private $privateMessage; /** * TaggedUserRepository constructor. @@ -52,10 +52,10 @@ class TaggedUserRepository * @param User $user * @param PrivateMessage $message */ - public function __construct(User $user, PrivateMessage $message) + public function __construct(User $user, PrivateMessage $privateMessage) { $this->user = $user; - $this->message = $message; + $this->privateMessage = $privateMessage; } /** @@ -91,11 +91,11 @@ public function contains($haystack, $needle) return collect($this->getTags($haystack))->contains($needle); } - public function messageTaggedCommentUsers(string $type, string $content, User $sender, $alias, Comment $comment) + public function messageTaggedCommentUsers(string $type, string $content, User $user, $alias, Comment $comment) { foreach ($this->getTags($content) as $username) { $tagged_user = $this->user->where('username', str_replace('@', '', $username))->first(); - $this->messageCommentUsers($type, $tagged_user, $sender, $alias, $comment); + $this->messageCommentUsers($type, $tagged_user, $user, $alias, $comment); } return true; @@ -126,11 +126,11 @@ public function messageCommentUsers($type, $users, $sender, $alias, Comment $com return true; } - public function messageTaggedPostUsers(string $type, string $content, User $sender, $alias, Post $post) + public function messageTaggedPostUsers(string $type, string $content, User $user, $alias, Post $post) { foreach ($this->getTags($content) as $username) { $tagged_user = $this->user->where('username', str_replace('@', '', $username))->first(); - $this->messagePostUsers($type, $tagged_user, $sender, $alias, $post); + $this->messagePostUsers($type, $tagged_user, $user, $alias, $post); } return true; diff --git a/app/Repositories/WishRepository.php b/app/Repositories/WishRepository.php index 72db0d0640..6c00c3d6a2 100644 --- a/app/Repositories/WishRepository.php +++ b/app/Repositories/WishRepository.php @@ -34,7 +34,7 @@ class WishRepository implements WishInterface /** * @var OmdbClient */ - private $client; + private $omdbClient; /** * @var Torrent @@ -49,11 +49,11 @@ class WishRepository implements WishInterface * @param OmdbClient $client * @param Torrent $torrent */ - public function __construct(Wish $wish, User $user, OmdbClient $client, Torrent $torrent) + public function __construct(Wish $wish, User $user, OmdbClient $omdbClient, Torrent $torrent) { $this->wish = $wish; $this->user = $user; - $this->client = $client; + $this->omdbClient = $omdbClient; $this->torrent = $torrent; } @@ -175,6 +175,6 @@ public function delete($id) */ public function omdbRequest($imdb) { - return $this->client->find(['imdb' => $imdb]); + return $this->omdbClient->find(['imdb' => $imdb]); } } diff --git a/app/Services/Clients/MangaUpdatesClient.php b/app/Services/Clients/MangaUpdatesClient.php index e7ba4ce211..23650a479a 100644 --- a/app/Services/Clients/MangaUpdatesClient.php +++ b/app/Services/Clients/MangaUpdatesClient.php @@ -38,10 +38,10 @@ public function find($key) public function manga($id) { $webpage = $this->request($this->apiUrl.$this->apiSeriesUrl.$id); - $dom = new Crawler($webpage); + $crawler = new Crawler($webpage); $data = []; - $data['description'] = $dom->filter('.sContainer .sContent')->first()->html(); + $data['description'] = $crawler->filter('.sContainer .sContent')->first()->html(); preg_match( '#(?:class\=\"sCat\"\>\Associated Names\<\/b\>\<\/div\>)+\n?(?:\
)(.+)(?:\n?+\<\/div\>)#i', diff --git a/app/Services/Data/Movie.php b/app/Services/Data/Movie.php index bcbf8d8553..9f97e112b7 100644 --- a/app/Services/Data/Movie.php +++ b/app/Services/Data/Movie.php @@ -40,7 +40,7 @@ class Movie /** * @var Carbon */ - public $releaseDate; + public $carbon; /** * @var int @@ -168,12 +168,12 @@ public function __construct($data = []) } } - if ($this->releaseDate instanceof \DateTime) { - $release_date = $this->releaseDate ? (new Carbon())->instance($this->releaseDate) : null; + if ($this->carbon instanceof \DateTime) { + $release_date = $this->carbon ? (new Carbon())->instance($this->carbon) : null; } else { - $release_date = $this->releaseDate ? new Carbon($this->releaseDate) : null; + $release_date = $this->carbon ? new Carbon($this->carbon) : null; } - $this->releaseDate = $release_date; + $this->carbon = $release_date; $this->releaseYear = $release_date ? $release_date->year : null; $this->title = $this->cleanTitle($this->title); diff --git a/app/Services/Data/Tv.php b/app/Services/Data/Tv.php index 0dbaf8d3a6..94775aa1b7 100644 --- a/app/Services/Data/Tv.php +++ b/app/Services/Data/Tv.php @@ -30,7 +30,7 @@ class Tv extends Movie /** * @var Carbon */ - public $endDate; + public $carbon; /** * @var bool @@ -61,11 +61,11 @@ public function __construct($data = []) { parent::__construct($data); - if ($this->endDate instanceof \DateTime) { - $this->endDate = $this->endDate ? (new Carbon())->instance($this->endDate) : null; + if ($this->carbon instanceof \DateTime) { + $this->carbon = $this->carbon ? (new Carbon())->instance($this->carbon) : null; } else { - $this->endDate = $this->endDate ? (new Carbon($this->endDate)) : null; + $this->carbon = $this->carbon ? (new Carbon($this->carbon)) : null; } - $this->ended = $this->endDate ? true : $this->ended; + $this->ended = $this->carbon ? true : $this->ended; } } From a975116218a0cfa8f9bac4916a69b2013389f03a Mon Sep 17 00:00:00 2001 From: HDVinnie Date: Wed, 22 Jul 2020 15:09:37 -0400 Subject: [PATCH 04/13] refactor: preslash simple functions - Add pre-slash to short named functions to improve performance by almost 30% - @see https://stackoverflow.com/questions/55419673/php7-adding-a-slash-to-all-standard-php-functions-php-cs-fixer-rule --- app/Bots/CasinoBot.php | 56 +-- app/Bots/IRCAnnounceBot.php | 42 +- app/Bots/NerdBot.php | 130 +++---- app/Bots/SystemBot.php | 56 +-- app/Console/Commands/AutoBan.php | 4 +- .../Commands/AutoBanDisposableUsers.php | 6 +- app/Console/Commands/AutoBonAllocation.php | 22 +- .../Commands/AutoDisableInactiveUsers.php | 12 +- app/Console/Commands/AutoGraveyard.php | 8 +- app/Console/Commands/AutoGroup.php | 18 +- app/Console/Commands/AutoHighspeedTag.php | 2 +- app/Console/Commands/AutoNerdStat.php | 66 ++-- app/Console/Commands/AutoPreWarning.php | 14 +- app/Console/Commands/AutoRecycleAudits.php | 2 +- .../AutoRecycleClaimedTorrentRequests.php | 4 +- .../Commands/AutoRemoveFeaturedTorrent.php | 4 +- .../Commands/AutoRevokePermissions.php | 12 +- .../Commands/AutoSoftDeleteDisabledUsers.php | 10 +- app/Console/Commands/AutoWarning.php | 12 +- app/Console/Commands/DbDump.php | 26 +- app/Console/Commands/DbLoad.php | 22 +- app/Console/Commands/DemoSeed.php | 16 +- app/Console/Commands/FetchGenres.php | 4 +- app/Console/Commands/FetchReleaseYears.php | 26 +- app/Console/Commands/GitUpdater.php | 50 +-- app/Console/Commands/TestMailSettings.php | 4 +- app/Console/Commands/VendorCleanup.php | 32 +- app/Console/ConsoleTools.php | 26 +- app/Console/Kernel.php | 2 +- app/Helpers/BBCodeConverter.php | 118 +++--- app/Helpers/BackupPassword.php | 14 +- app/Helpers/Bbcode.php | 4 +- app/Helpers/Bencode.php | 48 +-- app/Helpers/EmailBlacklistUpdater.php | 10 +- app/Helpers/HiddenCaptcha.php | 28 +- app/Helpers/LanguageCensor.php | 28 +- app/Helpers/Linkify.php | 4 +- app/Helpers/Markdown.php | 232 +++++------ app/Helpers/MediaInfo.php | 48 +-- app/Helpers/StringHelper.php | 36 +- app/Helpers/SystemInformation.php | 50 +-- app/Helpers/TorrentHelper.php | 24 +- app/Helpers/TorrentTools.php | 42 +- app/Http/Controllers/API/BaseController.php | 4 +- app/Http/Controllers/API/ChatController.php | 142 +++---- .../Controllers/API/TorrentController.php | 42 +- .../Controllers/AchievementsController.php | 4 +- app/Http/Controllers/AlbumController.php | 22 +- app/Http/Controllers/AnnounceController.php | 94 ++--- app/Http/Controllers/ArticleController.php | 4 +- .../Controllers/Auth/ActivationController.php | 12 +- .../Auth/ApplicationController.php | 28 +- .../Auth/ForgotPasswordController.php | 2 +- .../Auth/ForgotUsernameController.php | 18 +- app/Http/Controllers/Auth/LoginController.php | 36 +- .../Controllers/Auth/RegisterController.php | 78 ++-- .../Auth/ResetPasswordController.php | 6 +- .../Controllers/Auth/TwoStepController.php | 46 +-- app/Http/Controllers/BonusController.php | 66 ++-- app/Http/Controllers/BookmarkController.php | 10 +- app/Http/Controllers/CategoryController.php | 6 +- app/Http/Controllers/CommentController.php | 110 +++--- app/Http/Controllers/ContactController.php | 6 +- app/Http/Controllers/FollowController.php | 14 +- .../Controllers/ForumCategoryController.php | 6 +- app/Http/Controllers/ForumController.php | 38 +- app/Http/Controllers/GraveyardController.php | 24 +- app/Http/Controllers/HomeController.php | 32 +- app/Http/Controllers/ImageController.php | 22 +- app/Http/Controllers/InviteController.php | 42 +- app/Http/Controllers/LanguageController.php | 24 +- app/Http/Controllers/LikeController.php | 16 +- .../Controllers/NotificationController.php | 18 +- app/Http/Controllers/PageController.php | 16 +- app/Http/Controllers/PlaylistController.php | 50 +-- .../Controllers/PlaylistTorrentController.php | 16 +- app/Http/Controllers/PollController.php | 18 +- app/Http/Controllers/PostController.php | 40 +- .../Controllers/PrivateMessageController.php | 42 +- app/Http/Controllers/ReportController.php | 18 +- app/Http/Controllers/RequestController.php | 124 +++--- app/Http/Controllers/RssController.php | 52 +-- app/Http/Controllers/SeedboxController.php | 14 +- .../Staff/ApplicationController.php | 24 +- .../Controllers/Staff/ArticleController.php | 28 +- .../Controllers/Staff/AuditController.php | 6 +- .../Staff/AuthenticationController.php | 2 +- .../Controllers/Staff/BackupController.php | 60 +-- app/Http/Controllers/Staff/BanController.php | 20 +- .../Controllers/Staff/CategoryController.php | 28 +- .../Controllers/Staff/ChatBotController.php | 18 +- .../Controllers/Staff/ChatRoomController.php | 18 +- .../Staff/ChatStatusController.php | 16 +- .../Controllers/Staff/CheaterController.php | 2 +- .../Controllers/Staff/CommandController.php | 58 +-- .../Controllers/Staff/FlushController.php | 6 +- .../Controllers/Staff/ForumController.php | 16 +- app/Http/Controllers/Staff/GiftController.php | 12 +- .../Controllers/Staff/GroupController.php | 32 +- app/Http/Controllers/Staff/HomeController.php | 8 +- .../Controllers/Staff/InviteController.php | 2 +- .../Staff/MassActionController.php | 14 +- .../Staff/MediaLanguageController.php | 20 +- .../Staff/ModerationController.php | 32 +- app/Http/Controllers/Staff/NoteController.php | 10 +- app/Http/Controllers/Staff/PageController.php | 20 +- app/Http/Controllers/Staff/PollController.php | 38 +- .../Controllers/Staff/ReportController.php | 16 +- .../Staff/ResolutionController.php | 20 +- app/Http/Controllers/Staff/RssController.php | 26 +- .../Controllers/Staff/SeedboxController.php | 6 +- app/Http/Controllers/Staff/TagController.php | 18 +- app/Http/Controllers/Staff/TypeController.php | 20 +- app/Http/Controllers/Staff/UserController.php | 24 +- .../Controllers/Staff/VersionController.php | 8 +- .../Controllers/Staff/WarningController.php | 2 +- app/Http/Controllers/StatsController.php | 106 ++--- .../Controllers/SubscriptionController.php | 16 +- app/Http/Controllers/SubtitleController.php | 42 +- app/Http/Controllers/ThankController.php | 6 +- app/Http/Controllers/TopicController.php | 52 +-- app/Http/Controllers/TopicLabelController.php | 14 +- app/Http/Controllers/TorrentController.php | 262 ++++++------- app/Http/Controllers/UserController.php | 368 +++++++++--------- app/Http/Controllers/WarningController.php | 24 +- app/Http/Controllers/WishController.php | 14 +- app/Http/Middleware/Authenticate.php | 2 +- app/Http/Middleware/CheckForAdmin.php | 2 +- app/Http/Middleware/CheckForModo.php | 2 +- app/Http/Middleware/CheckForOwner.php | 2 +- app/Http/Middleware/CheckIfBanned.php | 6 +- app/Http/Middleware/Http2ServerPush.php | 26 +- app/Http/Middleware/ProAjaxMiddleware.php | 12 +- .../Middleware/RedirectIfAuthenticated.php | 4 +- app/Http/Middleware/SetLanguage.php | 22 +- app/Http/Middleware/TwoStepAuth.php | 8 +- app/Http/Middleware/UpdateLastAction.php | 2 +- app/Http/Resources/ChatMessageResource.php | 6 +- app/Http/Resources/TorrentResource.php | 2 +- app/Http/Resources/TorrentsResource.php | 2 +- app/Jobs/SendActivationMail.php | 2 +- app/Jobs/SendDeleteUserMail.php | 2 +- app/Jobs/SendDisableUserMail.php | 2 +- app/Listeners/AchievementUnlocked.php | 4 +- app/Listeners/FailedLoginListener.php | 2 +- app/Mail/ActivateUser.php | 2 +- app/Mail/BanUser.php | 2 +- app/Mail/Bug.php | 2 +- app/Mail/Contact.php | 2 +- app/Mail/DeleteUser.php | 2 +- app/Mail/DisableUser.php | 2 +- app/Mail/InviteUser.php | 2 +- app/Mail/UnbanUser.php | 2 +- app/Models/Article.php | 8 +- app/Models/FailedLoginAttempt.php | 2 +- app/Models/Forum.php | 8 +- app/Models/Group.php | 2 +- app/Models/Language.php | 44 +-- app/Models/Poll.php | 6 +- app/Models/Post.php | 10 +- app/Models/Rss.php | 2 +- app/Models/Topic.php | 4 +- app/Models/Torrent.php | 8 +- app/Models/TorrentRequest.php | 2 +- app/Models/TwoStepAuth.php | 2 +- app/Models/User.php | 60 +-- app/Notifications/FailedLogin.php | 8 +- app/Notifications/NewBon.php | 4 +- app/Notifications/NewComment.php | 2 +- app/Notifications/NewCommentTag.php | 8 +- app/Notifications/NewFollow.php | 4 +- app/Notifications/NewPost.php | 8 +- app/Notifications/NewPostTag.php | 4 +- app/Notifications/NewPostTip.php | 4 +- app/Notifications/NewRequestBounty.php | 4 +- app/Notifications/NewRequestClaim.php | 4 +- app/Notifications/NewRequestFill.php | 4 +- app/Notifications/NewRequestFillApprove.php | 4 +- app/Notifications/NewRequestFillReject.php | 4 +- app/Notifications/NewRequestUnclaim.php | 4 +- app/Notifications/NewReseedRequest.php | 6 +- app/Notifications/NewThank.php | 2 +- app/Notifications/NewTopic.php | 6 +- app/Notifications/NewUnfollow.php | 2 +- app/Notifications/NewUpload.php | 6 +- app/Notifications/NewUploadTip.php | 4 +- app/Notifications/TwoStepAuthCode.php | 10 +- app/Notifications/UsernameReminder.php | 10 +- app/Observers/TorrentObserver.php | 10 +- app/Observers/UserObserver.php | 10 +- app/Providers/AppServiceProvider.php | 12 +- app/Providers/BroadcastServiceProvider.php | 2 +- app/Providers/RouteServiceProvider.php | 6 +- app/Repositories/ChatRepository.php | 48 +-- app/Repositories/RequestFacetedRepository.php | 12 +- app/Repositories/TaggedUserRepository.php | 18 +- app/Repositories/TorrentFacetedRepository.php | 16 +- app/Repositories/WishRepository.php | 6 +- app/Services/Clients/Client.php | 12 +- app/Services/Clients/MangaUpdatesClient.php | 12 +- app/Services/Clients/OmdbClient.php | 16 +- app/Services/Clients/TmdbClient.php | 36 +- app/Services/Data/Episode.php | 4 +- app/Services/Data/Genre.php | 2 +- app/Services/Data/Movie.php | 36 +- app/Services/Data/Person.php | 4 +- app/Traits/Auditable.php | 30 +- app/Traits/Encryptable.php | 4 +- app/Traits/TwoStep.php | 16 +- app/Traits/UsersOnlineTrait.php | 2 +- app/Validators/EmailBlacklistValidator.php | 16 +- 211 files changed, 2498 insertions(+), 2498 deletions(-) diff --git a/app/Bots/CasinoBot.php b/app/Bots/CasinoBot.php index 0740d343b1..9c795b8137 100644 --- a/app/Bots/CasinoBot.php +++ b/app/Bots/CasinoBot.php @@ -67,15 +67,15 @@ public function __construct(ChatRepository $chatRepository) */ public function replaceVars($output) { - $output = str_replace('{me}', $this->bot->name, $output); - $output = str_replace('{command}', $this->bot->command, $output); - if (strstr($output, '{bots}')) { + $output = \str_replace('{me}', $this->bot->name, $output); + $output = \str_replace('{command}', $this->bot->command, $output); + if (\strstr($output, '{bots}')) { $bot_help = ''; $bots = Bot::where('active', '=', 1)->where('id', '!=', $this->bot->id)->orderBy('position', 'asc')->get(); foreach ($bots as $bot) { $bot_help .= '( ! | / | @)'.$bot->command.' help triggers help file for '.$bot->name."\n"; } - $output = str_replace('{bots}', $bot_help, $output); + $output = \str_replace('{bots}', $bot_help, $output); } return $output; @@ -93,10 +93,10 @@ public function replaceVars($output) */ public function putDonate($amount = 0, $note = '') { - $output = implode(' ', $note); - $v = validator(['bot_id' => $this->bot->id, 'amount'=> $amount, 'note'=> $output], [ + $output = \implode(' ', $note); + $v = \validator(['bot_id' => $this->bot->id, 'amount'=> $amount, 'note'=> $output], [ 'bot_id' => 'required|exists:bots,id|max:999', - 'amount' => sprintf('required|numeric|min:1|max:%s', $this->target->seedbonus), + 'amount' => \sprintf('required|numeric|min:1|max:%s', $this->target->seedbonus), 'note' => 'required|string', ]); if ($v->passes()) { @@ -117,7 +117,7 @@ public function putDonate($amount = 0, $note = '') $botTransaction->save(); $donations = BotTransaction::with('user', 'bot')->where('bot_id', '=', $this->bot->id)->where('to_bot', '=', 1)->latest()->limit(10)->get(); - cache()->put('casinobot-donations', $donations, $this->expiresAt); + \cache()->put('casinobot-donations', $donations, $this->expiresAt); return 'Your donation to '.$this->bot->name.' for '.$amount.' BON has been sent!'; } @@ -136,10 +136,10 @@ public function putDonate($amount = 0, $note = '') */ public function getDonations($duration = 'default') { - $donations = cache()->get('casinobot-donations'); + $donations = \cache()->get('casinobot-donations'); if (! $donations || $donations == null) { $donations = BotTransaction::with('user', 'bot')->where('bot_id', '=', $this->bot->id)->where('to_bot', '=', 1)->latest()->limit(10)->get(); - cache()->put('casinobot-donations', $donations, $this->expiresAt); + \cache()->put('casinobot-donations', $donations, $this->expiresAt); } $donation_dump = ''; $i = 1; @@ -148,7 +148,7 @@ public function getDonations($duration = 'default') $i++; } - return "The Most Recent Donations To Me Are As Follows:\n\n".trim($donation_dump); + return "The Most Recent Donations To Me Are As Follows:\n\n".\trim($donation_dump); } /** @@ -187,23 +187,23 @@ public function process($type, User $user, $message = '', $targeted = 0) } else { $log = 'All '.$this->bot->name.' commands must be a private message or begin with /'.$this->bot->command.' or !'.$this->bot->command.'. Need help? Type /'.$this->bot->command.' help and you shall be helped.'; } - $command = @explode(' ', $message); + $command = @\explode(' ', $message); $wildcard = null; $params = null; - if (array_key_exists($y, $command)) { + if (\array_key_exists($y, $command)) { $params = $command[$y]; } if ($params != null) { $clone = $command; - array_shift($clone); - array_shift($clone); - array_shift($clone); + \array_shift($clone); + \array_shift($clone); + \array_shift($clone); $wildcard = $clone; } - if (array_key_exists($x, $command)) { + if (\array_key_exists($x, $command)) { if ($command[$x] === 'donations') { $log = $this->getDonations($params); } @@ -235,8 +235,8 @@ public function pm() } if ($type == 'message' || $type == 'private') { $receiver_dirty = 0; - $receiver_echoes = cache()->get('user-echoes'.$target->id); - if (! $receiver_echoes || ! is_array($receiver_echoes) || count($receiver_echoes) < 1) { + $receiver_echoes = \cache()->get('user-echoes'.$target->id); + if (! $receiver_echoes || ! \is_array($receiver_echoes) || \count($receiver_echoes) < 1) { $receiver_echoes = UserEcho::with(['room', 'target', 'bot'])->whereRaw('user_id = ?', [$target->id])->get(); } $receiver_listening = false; @@ -255,12 +255,12 @@ public function pm() } if ($receiver_dirty == 1) { $expiresAt = Carbon::now()->addMinutes(60); - cache()->put('user-echoes'.$target->id, $receiver_echoes, $expiresAt); - event(new Chatter('echo', $target->id, UserEchoResource::collection($receiver_echoes))); + \cache()->put('user-echoes'.$target->id, $receiver_echoes, $expiresAt); + \event(new Chatter('echo', $target->id, UserEchoResource::collection($receiver_echoes))); } $receiver_dirty = 0; - $receiver_audibles = cache()->get('user-audibles'.$target->id); - if (! $receiver_audibles || ! is_array($receiver_audibles) || count($receiver_audibles) < 1) { + $receiver_audibles = \cache()->get('user-audibles'.$target->id); + if (! $receiver_audibles || ! \is_array($receiver_audibles) || \count($receiver_audibles) < 1) { $receiver_audibles = UserAudible::with(['room', 'target', 'bot'])->whereRaw('user_id = ?', [$target->id])->get(); } $receiver_listening = false; @@ -279,8 +279,8 @@ public function pm() } if ($receiver_dirty == 1) { $expiresAt = Carbon::now()->addMinutes(60); - cache()->put('user-audibles'.$target->id, $receiver_audibles, $expiresAt); - event(new Chatter('audible', $target->id, UserAudibleResource::collection($receiver_audibles))); + \cache()->put('user-audibles'.$target->id, $receiver_audibles, $expiresAt); + \event(new Chatter('audible', $target->id, UserAudibleResource::collection($receiver_audibles))); } if ($txt != '') { $room_id = 0; @@ -288,7 +288,7 @@ public function pm() $message = $this->chat->privateMessage(1, $room_id, $txt, $target->id, $this->bot->id); } - return response('success'); + return \response('success'); } if ($type == 'echo') { if ($txt != '') { @@ -296,7 +296,7 @@ public function pm() $message = $this->chat->botMessage($this->bot->id, $room_id, $txt, $target->id); } - return response('success'); + return \response('success'); } if ($type == 'public') { @@ -305,7 +305,7 @@ public function pm() $dumproom = $this->chat->message(1, $target->chatroom->id, $txt, null, $this->bot->id); } - return response('success'); + return \response('success'); } return true; diff --git a/app/Bots/IRCAnnounceBot.php b/app/Bots/IRCAnnounceBot.php index 7e357f0b5d..291d13d454 100644 --- a/app/Bots/IRCAnnounceBot.php +++ b/app/Bots/IRCAnnounceBot.php @@ -45,17 +45,17 @@ class IRCAnnounceBot public function __construct() { - $this->username = config('irc-bot.username'); - $this->channels = config('irc-bot.channels'); - $this->server = config('irc-bot.server'); - $this->port = config('irc-bot.port'); - $this->hostname = config('irc-bot.hostname'); - $this->nickservpass = config('irc-bot.nickservpass'); - $this->joinchannels = config('irc-bot.joinchannels'); - $this->socket = fsockopen($this->server, $this->port); - - $this->send_data(sprintf('NICK %s', $this->username)); - $this->send_data(sprintf('USER %s %s %s %s', $this->username, $this->hostname, $this->server, $this->username)); + $this->username = \config('irc-bot.username'); + $this->channels = \config('irc-bot.channels'); + $this->server = \config('irc-bot.server'); + $this->port = \config('irc-bot.port'); + $this->hostname = \config('irc-bot.hostname'); + $this->nickservpass = \config('irc-bot.nickservpass'); + $this->joinchannels = \config('irc-bot.joinchannels'); + $this->socket = \fsockopen($this->server, $this->port); + + $this->send_data(\sprintf('NICK %s', $this->username)); + $this->send_data(\sprintf('USER %s %s %s %s', $this->username, $this->hostname, $this->server, $this->username)); $this->connect(); } @@ -63,20 +63,20 @@ public function __construct() public function __destruct() { if ($this->socket) { - fclose($this->socket); + \fclose($this->socket); } } private function connect() { - while ($data = fgets($this->socket)) { - flush(); - $ex = explode(' ', $data); + while ($data = \fgets($this->socket)) { + \flush(); + $ex = \explode(' ', $data); if ($ex[0] === 'PING') { $this->send_data('PONG '.$ex[1]); if ($this->nickservpass) { - $this->send_data(sprintf('NICKSERV IDENTIFY %s', $this->nickservpass)); + $this->send_data(\sprintf('NICKSERV IDENTIFY %s', $this->nickservpass)); } return; @@ -86,24 +86,24 @@ private function connect() private function send_data($data) { - fwrite($this->socket, sprintf('%s + \fwrite($this->socket, \sprintf('%s ', $data)); } private function say($channel, $string) { - $this->send_data(sprintf('PRIVMSG %s %s', $channel, $string)); + $this->send_data(\sprintf('PRIVMSG %s %s', $channel, $string)); } private function join($channel) { - $this->send_data(sprintf('JOIN %s', $channel)); + $this->send_data(\sprintf('JOIN %s', $channel)); } public function message($channel, $message) { // Messages an specific IRC Channel - if ($this->joinchannels && preg_match('##(\w*[a-zA-Z_0-9]+\w*)#', $channel)) { + if ($this->joinchannels && \preg_match('##(\w*[a-zA-Z_0-9]+\w*)#', $channel)) { $this->join($channel); } @@ -113,7 +113,7 @@ public function message($channel, $message) public function broadcast($message, $channels = null) { // Broadcast to all IRC Channels in config - $channels = (is_null($channels)) ? $this->channels : $channels; + $channels = (\is_null($channels)) ? $this->channels : $channels; foreach ($channels as $channel) { $this->message($channel, $message); } diff --git a/app/Bots/NerdBot.php b/app/Bots/NerdBot.php index 93707f51f9..c0296d8c62 100644 --- a/app/Bots/NerdBot.php +++ b/app/Bots/NerdBot.php @@ -71,15 +71,15 @@ public function __construct(ChatRepository $chatRepository) */ public function replaceVars($output) { - $output = str_replace('{me}', $this->bot->name, $output); - $output = str_replace('{command}', $this->bot->command, $output); - if (strstr($output, '{bots}')) { + $output = \str_replace('{me}', $this->bot->name, $output); + $output = \str_replace('{command}', $this->bot->command, $output); + if (\strstr($output, '{bots}')) { $bot_help = ''; $bots = Bot::where('active', '=', 1)->where('id', '!=', $this->bot->id)->orderBy('position', 'asc')->get(); foreach ($bots as $bot) { $bot_help .= '( ! | / | @)'.$bot->command.' help triggers help file for '.$bot->name."\n"; } - $output = str_replace('{bots}', $bot_help, $output); + $output = \str_replace('{bots}', $bot_help, $output); } return $output; @@ -96,13 +96,13 @@ public function replaceVars($output) */ public function getBanker($duration = 'default') { - $banker = cache()->get('nerdbot-banker'); + $banker = \cache()->get('nerdbot-banker'); if (! $banker || $banker == null) { $banker = User::latest('seedbonus')->first(); - cache()->put('nerdbot-banker', $banker, $this->expiresAt); + \cache()->put('nerdbot-banker', $banker, $this->expiresAt); } - return sprintf('Currently [url=/users/%s]%s[/url] Is The Top BON Holder On ', $banker->username, $banker->username).config('other.title').'!'; + return \sprintf('Currently [url=/users/%s]%s[/url] Is The Top BON Holder On ', $banker->username, $banker->username).\config('other.title').'!'; } /** @@ -116,13 +116,13 @@ public function getBanker($duration = 'default') */ public function getSnatched($duration = 'default') { - $snatched = cache()->get('nerdbot-snatched'); + $snatched = \cache()->get('nerdbot-snatched'); if (! $snatched || $snatched == null) { $snatched = Torrent::latest('times_completed')->first(); - cache()->put('nerdbot-snatched', $snatched, $this->expiresAt); + \cache()->put('nerdbot-snatched', $snatched, $this->expiresAt); } - return sprintf('Currently [url=/torrents/%s]%s[/url] Is The Most Snatched Torrent On ', $snatched->id, $snatched->name).config('other.title').'!'; + return \sprintf('Currently [url=/torrents/%s]%s[/url] Is The Most Snatched Torrent On ', $snatched->id, $snatched->name).\config('other.title').'!'; } /** @@ -136,13 +136,13 @@ public function getSnatched($duration = 'default') */ public function getLeeched($duration = 'default') { - $leeched = cache()->get('nerdbot-leeched'); + $leeched = \cache()->get('nerdbot-leeched'); if (! $leeched || $leeched == null) { $leeched = Torrent::latest('leechers')->first(); - cache()->put('nerdbot-leeched', $leeched, $this->expiresAt); + \cache()->put('nerdbot-leeched', $leeched, $this->expiresAt); } - return sprintf('Currently [url=/torrents/%s]%s[/url] Is The Most Leeched Torrent On ', $leeched->id, $leeched->name).config('other.title').'!'; + return \sprintf('Currently [url=/torrents/%s]%s[/url] Is The Most Leeched Torrent On ', $leeched->id, $leeched->name).\config('other.title').'!'; } /** @@ -156,13 +156,13 @@ public function getLeeched($duration = 'default') */ public function getSeeded($duration = 'default') { - $seeded = cache()->get('nerdbot-seeded'); + $seeded = \cache()->get('nerdbot-seeded'); if (! $seeded || $seeded == null) { $seeded = Torrent::latest('seeders')->first(); - cache()->put('nerdbot-seeded', $seeded, $this->expiresAt); + \cache()->put('nerdbot-seeded', $seeded, $this->expiresAt); } - return sprintf('Currently [url=/torrents/%s]%s[/url] Is The Most Seeded Torrent On ', $seeded->id, $seeded->name).config('other.title').'!'; + return \sprintf('Currently [url=/torrents/%s]%s[/url] Is The Most Seeded Torrent On ', $seeded->id, $seeded->name).\config('other.title').'!'; } /** @@ -176,13 +176,13 @@ public function getSeeded($duration = 'default') */ public function getFreeleech($duration = 'default') { - $fl = cache()->get('nerdbot-fl'); + $fl = \cache()->get('nerdbot-fl'); if (! $fl || $fl == null) { $fl = Torrent::where('free', '=', 1)->count(); - cache()->put('nerdbot-fl', $fl, $this->expiresAt); + \cache()->put('nerdbot-fl', $fl, $this->expiresAt); } - return sprintf('There Are Currently %s Freeleech Torrents On ', $fl).config('other.title').'!'; + return \sprintf('There Are Currently %s Freeleech Torrents On ', $fl).\config('other.title').'!'; } /** @@ -196,13 +196,13 @@ public function getFreeleech($duration = 'default') */ public function getDoubleUpload($duration = 'default') { - $du = cache()->get('nerdbot-doubleup'); + $du = \cache()->get('nerdbot-doubleup'); if (! $du || $du == null) { $du = Torrent::where('doubleup', '=', 1)->count(); - cache()->put('nerdbot-doubleup', $du, $this->expiresAt); + \cache()->put('nerdbot-doubleup', $du, $this->expiresAt); } - return sprintf('There Are Currently %s Double Upload Torrents On ', $du).config('other.title').'!'; + return \sprintf('There Are Currently %s Double Upload Torrents On ', $du).\config('other.title').'!'; } /** @@ -216,13 +216,13 @@ public function getDoubleUpload($duration = 'default') */ public function getPeers($duration = 'default') { - $peers = cache()->get('nerdbot-peers'); + $peers = \cache()->get('nerdbot-peers'); if (! $peers || $peers == null) { $peers = Peer::count(); - cache()->put('nerdbot-peers', $peers, $this->expiresAt); + \cache()->put('nerdbot-peers', $peers, $this->expiresAt); } - return sprintf('Currently There Are %s Peers On ', $peers).config('other.title').'!'; + return \sprintf('Currently There Are %s Peers On ', $peers).\config('other.title').'!'; } /** @@ -236,13 +236,13 @@ public function getPeers($duration = 'default') */ public function getBans($duration = 'default') { - $bans = cache()->get('nerdbot-bans'); + $bans = \cache()->get('nerdbot-bans'); if (! $bans || $bans == null) { $bans = Ban::whereNull('unban_reason')->whereNull('removed_at')->where('created_at', '>', $this->current->subDay())->count(); - cache()->put('nerdbot-bans', $bans, $this->expiresAt); + \cache()->put('nerdbot-bans', $bans, $this->expiresAt); } - return sprintf('In The Last 24 Hours %s Users Have Been Banned From ', $bans).config('other.title').'!'; + return \sprintf('In The Last 24 Hours %s Users Have Been Banned From ', $bans).\config('other.title').'!'; } /** @@ -256,13 +256,13 @@ public function getBans($duration = 'default') */ public function getWarnings($duration = 'default') { - $warnings = cache()->get('nerdbot-warnings'); + $warnings = \cache()->get('nerdbot-warnings'); if (! $warnings || $warnings == null) { $warnings = Warning::where('created_at', '>', $this->current->subDay())->count(); - cache()->put('nerdbot-warnings', $warnings, $this->expiresAt); + \cache()->put('nerdbot-warnings', $warnings, $this->expiresAt); } - return sprintf('In The Last 24 Hours %s Hit and Run Warnings Have Been Issued On ', $warnings).config('other.title').'!'; + return \sprintf('In The Last 24 Hours %s Hit and Run Warnings Have Been Issued On ', $warnings).\config('other.title').'!'; } /** @@ -276,13 +276,13 @@ public function getWarnings($duration = 'default') */ public function getUploads($duration = 'default') { - $uploads = cache()->get('nerdbot-uploads'); + $uploads = \cache()->get('nerdbot-uploads'); if (! $uploads || $uploads == null) { $uploads = Torrent::where('created_at', '>', $this->current->subDay())->count(); - cache()->put('nerdbot-uploads', $uploads, $this->expiresAt); + \cache()->put('nerdbot-uploads', $uploads, $this->expiresAt); } - return sprintf('In The Last 24 Hours %s Torrents Have Been Uploaded To ', $uploads).config('other.title').'!'; + return \sprintf('In The Last 24 Hours %s Torrents Have Been Uploaded To ', $uploads).\config('other.title').'!'; } /** @@ -296,13 +296,13 @@ public function getUploads($duration = 'default') */ public function getLogins($duration = 'default') { - $logins = cache()->get('nerdbot-logins'); + $logins = \cache()->get('nerdbot-logins'); if (! $logins || $logins == null) { $logins = User::whereNotNull('last_login')->where('last_login', '>', $this->current->subDay())->count(); - cache()->put('nerdbot-logins', $logins, $this->expiresAt); + \cache()->put('nerdbot-logins', $logins, $this->expiresAt); } - return sprintf('In The Last 24 Hours %s Unique Users Have Logged Into ', $logins).config('other.title').'!'; + return \sprintf('In The Last 24 Hours %s Unique Users Have Logged Into ', $logins).\config('other.title').'!'; } /** @@ -316,13 +316,13 @@ public function getLogins($duration = 'default') */ public function getRegistrations($duration = 'default') { - $registrations = cache()->get('nerdbot-users'); + $registrations = \cache()->get('nerdbot-users'); if (! $registrations || $registrations == null) { $registrations = User::where('created_at', '>', $this->current->subDay())->count(); - cache()->put('nerdbot-users', $registrations, $this->expiresAt); + \cache()->put('nerdbot-users', $registrations, $this->expiresAt); } - return sprintf('In The Last 24 Hours %s Users Have Registered To ', $registrations).config('other.title').'!'; + return \sprintf('In The Last 24 Hours %s Users Have Registered To ', $registrations).\config('other.title').'!'; } /** @@ -336,10 +336,10 @@ public function getRegistrations($duration = 'default') */ public function getDonations($duration = 'default') { - $donations = cache()->get('nerdbot-donations'); + $donations = \cache()->get('nerdbot-donations'); if (! $donations || $donations == null) { $donations = BotTransaction::with('user', 'bot')->where('to_bot', '=', 1)->latest()->limit(10)->get(); - cache()->put('nerdbot-donations', $donations, $this->expiresAt); + \cache()->put('nerdbot-donations', $donations, $this->expiresAt); } $donation_dump = ''; $i = 1; @@ -348,7 +348,7 @@ public function getDonations($duration = 'default') $i++; } - return "The Most Recent Donations To All Bots Are As Follows:\n\n".trim($donation_dump); + return "The Most Recent Donations To All Bots Are As Follows:\n\n".\trim($donation_dump); } /** @@ -364,7 +364,7 @@ public function getHelp() */ public function getKing() { - return config('other.title').' Is King!'; + return \config('other.title').' Is King!'; } /** @@ -379,10 +379,10 @@ public function getKing() */ public function putDonate($amount = 0, $note = '') { - $output = implode(' ', $note); - $v = validator(['bot_id' => $this->bot->id, 'amount'=> $amount, 'note'=> $output], [ + $output = \implode(' ', $note); + $v = \validator(['bot_id' => $this->bot->id, 'amount'=> $amount, 'note'=> $output], [ 'bot_id' => 'required|exists:bots,id|max:999', - 'amount' => sprintf('required|numeric|min:1|max:%s', $this->target->seedbonus), + 'amount' => \sprintf('required|numeric|min:1|max:%s', $this->target->seedbonus), 'note' => 'required|string', ]); if ($v->passes()) { @@ -403,7 +403,7 @@ public function putDonate($amount = 0, $note = '') $botTransaction->save(); $donations = BotTransaction::with('user', 'bot')->where('bot_id', '=', $this->bot->id)->where('to_bot', '=', 1)->latest()->limit(10)->get(); - cache()->put('casinobot-donations', $donations, $this->expiresAt); + \cache()->put('casinobot-donations', $donations, $this->expiresAt); return 'Your donation to '.$this->bot->name.' for '.$amount.' BON has been sent!'; } @@ -439,23 +439,23 @@ public function process($type, User $user, $message = '', $targeted = 0) } else { $log = 'All '.$this->bot->name.' commands must be a private message or begin with /'.$this->bot->command.' or !'.$this->bot->command.'. Need help? Type /'.$this->bot->command.' help and you shall be helped.'; } - $command = @explode(' ', $message); + $command = @\explode(' ', $message); $wildcard = null; $params = null; - if (array_key_exists($y, $command)) { + if (\array_key_exists($y, $command)) { $params = $command[$y]; } if ($params != null) { $clone = $command; - array_shift($clone); - array_shift($clone); - array_shift($clone); + \array_shift($clone); + \array_shift($clone); + \array_shift($clone); $wildcard = $clone; } - if (array_key_exists($x, $command)) { + if (\array_key_exists($x, $command)) { if ($command[$x] === 'banker') { $log = $this->getBanker($params); } @@ -529,8 +529,8 @@ public function pm() } if ($type == 'message' || $type == 'private') { $receiver_dirty = 0; - $receiver_echoes = cache()->get('user-echoes'.$target->id); - if (! $receiver_echoes || ! is_array($receiver_echoes) || count($receiver_echoes) < 1) { + $receiver_echoes = \cache()->get('user-echoes'.$target->id); + if (! $receiver_echoes || ! \is_array($receiver_echoes) || \count($receiver_echoes) < 1) { $receiver_echoes = UserEcho::with(['room', 'target', 'bot'])->whereRaw('user_id = ?', [$target->id])->get(); } $receiver_listening = false; @@ -549,12 +549,12 @@ public function pm() } if ($receiver_dirty == 1) { $expiresAt = Carbon::now()->addMinutes(60); - cache()->put('user-echoes'.$target->id, $receiver_echoes, $expiresAt); - event(new Chatter('echo', $target->id, UserEchoResource::collection($receiver_echoes))); + \cache()->put('user-echoes'.$target->id, $receiver_echoes, $expiresAt); + \event(new Chatter('echo', $target->id, UserEchoResource::collection($receiver_echoes))); } $receiver_dirty = 0; - $receiver_audibles = cache()->get('user-audibles'.$target->id); - if (! $receiver_audibles || ! is_array($receiver_audibles) || count($receiver_audibles) < 1) { + $receiver_audibles = \cache()->get('user-audibles'.$target->id); + if (! $receiver_audibles || ! \is_array($receiver_audibles) || \count($receiver_audibles) < 1) { $receiver_audibles = UserAudible::with(['room', 'target', 'bot'])->whereRaw('user_id = ?', [$target->id])->get(); } $receiver_listening = false; @@ -573,8 +573,8 @@ public function pm() } if ($receiver_dirty == 1) { $expiresAt = Carbon::now()->addMinutes(60); - cache()->put('user-audibles'.$target->id, $receiver_audibles, $expiresAt); - event(new Chatter('audible', $target->id, UserAudibleResource::collection($receiver_audibles))); + \cache()->put('user-audibles'.$target->id, $receiver_audibles, $expiresAt); + \event(new Chatter('audible', $target->id, UserAudibleResource::collection($receiver_audibles))); } if ($txt != '') { $room_id = 0; @@ -582,7 +582,7 @@ public function pm() $message = $this->chat->privateMessage(1, $room_id, $txt, $target->id, $this->bot->id); } - return response('success'); + return \response('success'); } if ($type == 'echo') { if ($txt != '') { @@ -590,7 +590,7 @@ public function pm() $message = $this->chat->botMessage($this->bot->id, $room_id, $txt, $target->id); } - return response('success'); + return \response('success'); } if ($type == 'public') { @@ -599,7 +599,7 @@ public function pm() $dumproom = $this->chat->message(1, $target->chatroom->id, $txt, null, $this->bot->id); } - return response('success'); + return \response('success'); } return true; diff --git a/app/Bots/SystemBot.php b/app/Bots/SystemBot.php index 96d057bf56..534b3acef7 100644 --- a/app/Bots/SystemBot.php +++ b/app/Bots/SystemBot.php @@ -62,15 +62,15 @@ public function __construct(ChatRepository $chatRepository) */ public function replaceVars($output) { - $output = str_replace('{me}', $this->bot->name, $output); - $output = str_replace('{command}', $this->bot->command, $output); - if (strstr($output, '{bots}')) { + $output = \str_replace('{me}', $this->bot->name, $output); + $output = \str_replace('{command}', $this->bot->command, $output); + if (\strstr($output, '{bots}')) { $bot_help = ''; $bots = Bot::where('active', '=', 1)->where('id', '!=', $this->bot->id)->orderBy('position', 'asc')->get(); foreach ($bots as $bot) { $bot_help .= '( ! | / | @)'.$bot->command.' help triggers help file for '.$bot->name."\n"; } - $output = str_replace('{bots}', $bot_help, $output); + $output = \str_replace('{bots}', $bot_help, $output); } return $output; @@ -95,10 +95,10 @@ public function getHelp() */ public function putGift($receiver = '', $amount = 0, $note = '') { - $output = implode(' ', $note); - $v = validator(['receiver' => $receiver, 'amount'=> $amount, 'note'=> $output], [ + $output = \implode(' ', $note); + $v = \validator(['receiver' => $receiver, 'amount'=> $amount, 'note'=> $output], [ 'receiver' => 'required|string|exists:users,username', - 'amount' => sprintf('required|numeric|min:1|max:%s', $this->target->seedbonus), + 'amount' => \sprintf('required|numeric|min:1|max:%s', $this->target->seedbonus), 'note' => 'required|string', ]); if ($v->passes()) { @@ -129,11 +129,11 @@ public function putGift($receiver = '', $amount = 0, $note = '') $recipient->notify(new NewBon('gift', $this->target->username, $bonTransactions)); } - $profile_url = href_profile($this->target); - $recipient_url = href_profile($recipient); + $profile_url = \href_profile($this->target); + $recipient_url = \href_profile($recipient); $this->chat->systemMessage( - sprintf('[url=%s]%s[/url] has gifted %s BON to [url=%s]%s[/url]', $profile_url, $this->target->username, $value, $recipient_url, $recipient->username) + \sprintf('[url=%s]%s[/url] has gifted %s BON to [url=%s]%s[/url]', $profile_url, $this->target->username, $value, $recipient_url, $recipient->username) ); return 'Your gift to '.$recipient->username.' for '.$amount.' BON has been sent!'; @@ -165,14 +165,14 @@ public function process($type, User $user, $message = '', $targeted = 0) } else { $log = 'All '.$this->bot->name.' commands must be a private message or begin with /'.$this->bot->command.' or !'.$this->bot->command.'. Need help? Type /'.$this->bot->command.' help and you shall be helped.'; } - $command = @explode(' ', $message); - if (array_key_exists($x, $command)) { - if ($command[$x] === 'gift' && array_key_exists($y, $command) && array_key_exists($z, $command) && array_key_exists($z + 1, $command)) { + $command = @\explode(' ', $message); + if (\array_key_exists($x, $command)) { + if ($command[$x] === 'gift' && \array_key_exists($y, $command) && \array_key_exists($z, $command) && \array_key_exists($z + 1, $command)) { $clone = $command; - array_shift($clone); - array_shift($clone); - array_shift($clone); - array_shift($clone); + \array_shift($clone); + \array_shift($clone); + \array_shift($clone); + \array_shift($clone); $log = $this->putGift($command[$y], $command[$z], $clone); } if ($command[$x] === 'help') { @@ -203,8 +203,8 @@ public function pm() } if ($type == 'message' || $type == 'private') { $receiver_dirty = 0; - $receiver_echoes = cache()->get('user-echoes'.$target->id); - if (! $receiver_echoes || ! is_array($receiver_echoes) || count($receiver_echoes) < 1) { + $receiver_echoes = \cache()->get('user-echoes'.$target->id); + if (! $receiver_echoes || ! \is_array($receiver_echoes) || \count($receiver_echoes) < 1) { $receiver_echoes = UserEcho::with(['room', 'target', 'bot'])->whereRaw('user_id = ?', [$target->id])->get(); } $receiver_listening = false; @@ -223,12 +223,12 @@ public function pm() } if ($receiver_dirty == 1) { $expiresAt = Carbon::now()->addMinutes(60); - cache()->put('user-echoes'.$target->id, $receiver_echoes, $expiresAt); - event(new Chatter('echo', $target->id, UserEchoResource::collection($receiver_echoes))); + \cache()->put('user-echoes'.$target->id, $receiver_echoes, $expiresAt); + \event(new Chatter('echo', $target->id, UserEchoResource::collection($receiver_echoes))); } $receiver_dirty = 0; - $receiver_audibles = cache()->get('user-audibles'.$target->id); - if (! $receiver_audibles || ! is_array($receiver_audibles) || count($receiver_audibles) < 1) { + $receiver_audibles = \cache()->get('user-audibles'.$target->id); + if (! $receiver_audibles || ! \is_array($receiver_audibles) || \count($receiver_audibles) < 1) { $receiver_audibles = UserAudible::with(['room', 'target', 'bot'])->whereRaw('user_id = ?', [$target->id])->get(); } $receiver_listening = false; @@ -247,8 +247,8 @@ public function pm() } if ($receiver_dirty == 1) { $expiresAt = Carbon::now()->addMinutes(60); - cache()->put('user-audibles'.$target->id, $receiver_audibles, $expiresAt); - event(new Chatter('audible', $target->id, UserAudibleResource::collection($receiver_audibles))); + \cache()->put('user-audibles'.$target->id, $receiver_audibles, $expiresAt); + \event(new Chatter('audible', $target->id, UserAudibleResource::collection($receiver_audibles))); } if ($txt != '') { $room_id = 0; @@ -256,7 +256,7 @@ public function pm() $message = $this->chat->privateMessage(1, $room_id, $txt, $target->id, $this->bot->id); } - return response('success'); + return \response('success'); } if ($type == 'echo') { if ($txt != '') { @@ -264,7 +264,7 @@ public function pm() $message = $this->chat->botMessage($this->bot->id, $room_id, $txt, $target->id); } - return response('success'); + return \response('success'); } if ($type == 'public') { @@ -273,7 +273,7 @@ public function pm() $dumproom = $this->chat->message(1, $target->chatroom->id, $txt, null, $this->bot->id); } - return response('success'); + return \response('success'); } return true; diff --git a/app/Console/Commands/AutoBan.php b/app/Console/Commands/AutoBan.php index 05311d3e3d..507998b758 100644 --- a/app/Console/Commands/AutoBan.php +++ b/app/Console/Commands/AutoBan.php @@ -46,9 +46,9 @@ class AutoBan extends Command */ public function handle() { - $banned_group = cache()->rememberForever('banned_group', fn () => Group::where('slug', '=', 'banned')->pluck('id')); + $banned_group = \cache()->rememberForever('banned_group', fn () => Group::where('slug', '=', 'banned')->pluck('id')); - $bans = Warning::with('warneduser')->select(DB::raw('user_id, count(*) as value'))->where('active', '=', 1)->groupBy('user_id')->having('value', '>=', config('hitrun.max_warnings'))->get(); + $bans = Warning::with('warneduser')->select(DB::raw('user_id, count(*) as value'))->where('active', '=', 1)->groupBy('user_id')->having('value', '>=', \config('hitrun.max_warnings'))->get(); foreach ($bans as $ban) { if ($ban->warneduser->group_id != $banned_group[0] && ! $ban->warneduser->group->is_immune) { diff --git a/app/Console/Commands/AutoBanDisposableUsers.php b/app/Console/Commands/AutoBanDisposableUsers.php index bb2fd108d8..55b35460eb 100644 --- a/app/Console/Commands/AutoBanDisposableUsers.php +++ b/app/Console/Commands/AutoBanDisposableUsers.php @@ -46,11 +46,11 @@ class AutoBanDisposableUsers extends Command */ public function handle() { - $banned_group = cache()->rememberForever('banned_group', fn () => Group::where('slug', '=', 'banned')->pluck('id')); + $banned_group = \cache()->rememberForever('banned_group', fn () => Group::where('slug', '=', 'banned')->pluck('id')); User::where('group_id', '!=', $banned_group[0])->chunkById(100, function ($users) use ($banned_group) { foreach ($users as $user) { - $v = validator([ + $v = \validator([ 'email' => $user->email, ], [ 'email' => 'required|string|email|max:70|blacklist', @@ -68,7 +68,7 @@ public function handle() $user->save(); // Log The Ban To Ban Log - $domain = substr(strrchr($user->email, '@'), 1); + $domain = \substr(\strrchr($user->email, '@'), 1); $logban = new Ban(); $logban->owned_by = $user->id; $logban->created_by = 1; diff --git a/app/Console/Commands/AutoBonAllocation.php b/app/Console/Commands/AutoBonAllocation.php index 57150e6fd5..766890d6d4 100644 --- a/app/Console/Commands/AutoBonAllocation.php +++ b/app/Console/Commands/AutoBonAllocation.php @@ -159,7 +159,7 @@ public function handle(ByteUnits $byteUnits) $array = []; foreach ($dying_torrent as $key => $value) { - if (array_key_exists($value->user_id, $array)) { + if (\array_key_exists($value->user_id, $array)) { $array[$value->user_id] += $value->value * 2; } else { $array[$value->user_id] = $value->value * 2; @@ -167,7 +167,7 @@ public function handle(ByteUnits $byteUnits) } foreach ($legendary_torrent as $key => $value) { - if (array_key_exists($value->user_id, $array)) { + if (\array_key_exists($value->user_id, $array)) { $array[$value->user_id] += $value->value * 1.5; } else { $array[$value->user_id] = $value->value * 1.5; @@ -175,7 +175,7 @@ public function handle(ByteUnits $byteUnits) } foreach ($old_torrent as $key => $value) { - if (array_key_exists($value->user_id, $array)) { + if (\array_key_exists($value->user_id, $array)) { $array[$value->user_id] += $value->value * 1; } else { $array[$value->user_id] = $value->value * 1; @@ -183,7 +183,7 @@ public function handle(ByteUnits $byteUnits) } foreach ($huge_torrent as $key => $value) { - if (array_key_exists($value->user_id, $array)) { + if (\array_key_exists($value->user_id, $array)) { $array[$value->user_id] += $value->value * 0.75; } else { $array[$value->user_id] = $value->value * 0.75; @@ -191,7 +191,7 @@ public function handle(ByteUnits $byteUnits) } foreach ($large_torrent as $key => $value) { - if (array_key_exists($value->user_id, $array)) { + if (\array_key_exists($value->user_id, $array)) { $array[$value->user_id] += $value->value * 0.50; } else { $array[$value->user_id] = $value->value * 0.50; @@ -199,7 +199,7 @@ public function handle(ByteUnits $byteUnits) } foreach ($regular_torrent as $key => $value) { - if (array_key_exists($value->user_id, $array)) { + if (\array_key_exists($value->user_id, $array)) { $array[$value->user_id] += $value->value * 0.25; } else { $array[$value->user_id] = $value->value * 0.25; @@ -207,7 +207,7 @@ public function handle(ByteUnits $byteUnits) } foreach ($participaint_seeder as $key => $value) { - if (array_key_exists($value->user_id, $array)) { + if (\array_key_exists($value->user_id, $array)) { $array[$value->user_id] += $value->value * 0.25; } else { $array[$value->user_id] = $value->value * 0.25; @@ -215,7 +215,7 @@ public function handle(ByteUnits $byteUnits) } foreach ($teamplayer_seeder as $key => $value) { - if (array_key_exists($value->user_id, $array)) { + if (\array_key_exists($value->user_id, $array)) { $array[$value->user_id] += $value->value * 0.50; } else { $array[$value->user_id] = $value->value * 0.50; @@ -223,7 +223,7 @@ public function handle(ByteUnits $byteUnits) } foreach ($commited_seeder as $key => $value) { - if (array_key_exists($value->user_id, $array)) { + if (\array_key_exists($value->user_id, $array)) { $array[$value->user_id] += $value->value * 0.75; } else { $array[$value->user_id] = $value->value * 0.75; @@ -231,7 +231,7 @@ public function handle(ByteUnits $byteUnits) } foreach ($mvp_seeder as $key => $value) { - if (array_key_exists($value->user_id, $array)) { + if (\array_key_exists($value->user_id, $array)) { $array[$value->user_id] += $value->value * 1; } else { $array[$value->user_id] = $value->value * 1; @@ -239,7 +239,7 @@ public function handle(ByteUnits $byteUnits) } foreach ($legendary_seeder as $key => $value) { - if (array_key_exists($value->user_id, $array)) { + if (\array_key_exists($value->user_id, $array)) { $array[$value->user_id] += $value->value * 2; } else { $array[$value->user_id] = $value->value * 2; diff --git a/app/Console/Commands/AutoDisableInactiveUsers.php b/app/Console/Commands/AutoDisableInactiveUsers.php index 3391d4b773..3d9c96caf1 100644 --- a/app/Console/Commands/AutoDisableInactiveUsers.php +++ b/app/Console/Commands/AutoDisableInactiveUsers.php @@ -44,15 +44,15 @@ class AutoDisableInactiveUsers extends Command */ public function handle() { - if (config('pruning.user_pruning') == true) { - $disabled_group = cache()->rememberForever('disabled_group', fn () => Group::where('slug', '=', 'disabled')->pluck('id')); + if (\config('pruning.user_pruning') == true) { + $disabled_group = \cache()->rememberForever('disabled_group', fn () => Group::where('slug', '=', 'disabled')->pluck('id')); $current = Carbon::now(); - $matches = User::whereIn('group_id', [config('pruning.group_ids')])->get(); + $matches = User::whereIn('group_id', [\config('pruning.group_ids')])->get(); - $users = $matches->where('created_at', '<', $current->copy()->subDays(config('pruning.account_age'))->toDateTimeString()) - ->where('last_login', '<', $current->copy()->subDays(config('pruning.last_login'))->toDateTimeString()) + $users = $matches->where('created_at', '<', $current->copy()->subDays(\config('pruning.account_age'))->toDateTimeString()) + ->where('last_login', '<', $current->copy()->subDays(\config('pruning.last_login'))->toDateTimeString()) ->get(); foreach ($users as $user) { @@ -68,7 +68,7 @@ public function handle() $user->save(); // Send Email - dispatch(new SendDisableUserMail($user)); + \dispatch(new SendDisableUserMail($user)); } } } diff --git a/app/Console/Commands/AutoGraveyard.php b/app/Console/Commands/AutoGraveyard.php index f2fc01c9ab..b5938256b4 100644 --- a/app/Console/Commands/AutoGraveyard.php +++ b/app/Console/Commands/AutoGraveyard.php @@ -75,14 +75,14 @@ public function handle() $reward->rewarded = 1; $reward->save(); - $user->fl_tokens += config('graveyard.reward'); + $user->fl_tokens += \config('graveyard.reward'); $user->save(); // Auto Shout - $appurl = config('app.url'); + $appurl = \config('app.url'); $this->chatRepository->systemMessage( - sprintf('Ladies and Gents, [url=%s/users/%s]%s[/url] has successfully resurrected [url=%s/torrents/%s]%s[/url]. :zombie:', $appurl, $user->username, $user->username, $appurl, $torrent->id, $torrent->name) + \sprintf('Ladies and Gents, [url=%s/users/%s]%s[/url] has successfully resurrected [url=%s/torrents/%s]%s[/url]. :zombie:', $appurl, $user->username, $user->username, $appurl, $torrent->id, $torrent->name) ); // Send Private Message @@ -90,7 +90,7 @@ public function handle() $pm->sender_id = 1; $pm->receiver_id = $user->id; $pm->subject = 'Successful Graveyard Resurrection'; - $pm->message = sprintf('You have successfully resurrected [url=%s/torrents/', $appurl).$torrent->id.']'.$torrent->name.'[/url] :zombie: ! Thank you for bringing a torrent back from the dead! Enjoy the freeleech tokens! + $pm->message = \sprintf('You have successfully resurrected [url=%s/torrents/', $appurl).$torrent->id.']'.$torrent->name.'[/url] :zombie: ! Thank you for bringing a torrent back from the dead! Enjoy the freeleech tokens! [color=red][b]THIS IS AN AUTOMATED SYSTEM MESSAGE, PLEASE DO NOT REPLY![/b][/color]'; $pm->save(); } diff --git a/app/Console/Commands/AutoGroup.php b/app/Console/Commands/AutoGroup.php index d476335d2e..7b19f374fb 100644 --- a/app/Console/Commands/AutoGroup.php +++ b/app/Console/Commands/AutoGroup.php @@ -56,7 +56,7 @@ public function handle(ByteUnits $byteUnits) // Temp Hard Coding of Group Requirements (Config Files To Come) (Upload in Bytes!) (Seedtime in Seconds!) // Leech ratio dropped below sites minimum - if ($user->getRatio() < config('other.ratio') && $user->group_id != 15) { + if ($user->getRatio() < \config('other.ratio') && $user->group_id != 15) { $user->group_id = 15; $user->can_request = 0; $user->can_invite = 0; @@ -64,7 +64,7 @@ public function handle(ByteUnits $byteUnits) $user->save(); } // User >= 0 and ratio above sites minimum - if ($user->uploaded >= 0 && $user->getRatio() >= config('other.ratio') && $user->group_id != 3) { + if ($user->uploaded >= 0 && $user->getRatio() >= \config('other.ratio') && $user->group_id != 3) { $user->group_id = 3; $user->can_request = 1; $user->can_invite = 1; @@ -73,37 +73,37 @@ public function handle(ByteUnits $byteUnits) } // PowerUser >= 1TiB and account 1 month old - if ($user->uploaded >= $byteUnits->bytesFromUnit('1TiB') && $user->getRatio() >= config('other.ratio') && $user->created_at < $current->copy()->subDays(30)->toDateTimeString() && $user->group_id != 11) { + if ($user->uploaded >= $byteUnits->bytesFromUnit('1TiB') && $user->getRatio() >= \config('other.ratio') && $user->created_at < $current->copy()->subDays(30)->toDateTimeString() && $user->group_id != 11) { $user->group_id = 11; $user->save(); } // SuperUser >= 5TiB and account 2 month old - if ($user->uploaded >= $byteUnits->bytesFromUnit('5TiB') && $user->getRatio() >= config('other.ratio') && $user->created_at < $current->copy()->subDays(60)->toDateTimeString() && $user->group_id != 12) { + if ($user->uploaded >= $byteUnits->bytesFromUnit('5TiB') && $user->getRatio() >= \config('other.ratio') && $user->created_at < $current->copy()->subDays(60)->toDateTimeString() && $user->group_id != 12) { $user->group_id = 12; $user->save(); } // ExtremeUser >= 20TiB and account 3 month old - if ($user->uploaded >= $byteUnits->bytesFromUnit('20TiB') && $user->getRatio() >= config('other.ratio') && $user->created_at < $current->copy()->subDays(90)->toDateTimeString() && $user->group_id != 13) { + if ($user->uploaded >= $byteUnits->bytesFromUnit('20TiB') && $user->getRatio() >= \config('other.ratio') && $user->created_at < $current->copy()->subDays(90)->toDateTimeString() && $user->group_id != 13) { $user->group_id = 13; $user->save(); } // InsaneUser >= 50TiB and account 6 month old - if ($user->uploaded >= $byteUnits->bytesFromUnit('50TiB') && $user->getRatio() >= config('other.ratio') && $user->created_at < $current->copy()->subDays(180)->toDateTimeString() && $user->group_id != 14) { + if ($user->uploaded >= $byteUnits->bytesFromUnit('50TiB') && $user->getRatio() >= \config('other.ratio') && $user->created_at < $current->copy()->subDays(180)->toDateTimeString() && $user->group_id != 14) { $user->group_id = 14; $user->save(); } // Seeder Seedsize >= 5TiB and account 1 month old and seedtime average 30 days or better - if ($user->getTotalSeedSize() >= $byteUnits->bytesFromUnit('5TiB') && $user->getRatio() >= config('other.ratio') && round($user->getTotalSeedTime() / max(1, $hiscount)) > 2_592_000 && $user->created_at < $current->copy()->subDays(30)->toDateTimeString() && $user->group_id != 17) { + if ($user->getTotalSeedSize() >= $byteUnits->bytesFromUnit('5TiB') && $user->getRatio() >= \config('other.ratio') && \round($user->getTotalSeedTime() / \max(1, $hiscount)) > 2_592_000 && $user->created_at < $current->copy()->subDays(30)->toDateTimeString() && $user->group_id != 17) { $user->group_id = 17; $user->save(); } // Veteran >= 100TiB and account 1 year old - if ($user->uploaded >= $byteUnits->bytesFromUnit('100TiB') && $user->getRatio() >= config('other.ratio') && $user->created_at < $current->copy()->subDays(365)->toDateTimeString() && $user->group_id != 16) { + if ($user->uploaded >= $byteUnits->bytesFromUnit('100TiB') && $user->getRatio() >= \config('other.ratio') && $user->created_at < $current->copy()->subDays(365)->toDateTimeString() && $user->group_id != 16) { $user->group_id = 16; $user->save(); } // Archivist Seedsize >= 10TiB and account 3 month old and seedtime average 60 days or better - if ($user->getTotalSeedSize() >= $byteUnits->bytesFromUnit('10TiB') && $user->getRatio() >= config('other.ratio') && round($user->getTotalSeedTime() / max(1, $hiscount)) > 2_592_000 * 2 && $user->created_at < $current->copy()->subDays(90)->toDateTimeString() && $user->group_id != 18) { + if ($user->getTotalSeedSize() >= $byteUnits->bytesFromUnit('10TiB') && $user->getRatio() >= \config('other.ratio') && \round($user->getTotalSeedTime() / \max(1, $hiscount)) > 2_592_000 * 2 && $user->created_at < $current->copy()->subDays(90)->toDateTimeString() && $user->group_id != 18) { $user->group_id = 18; $user->save(); } diff --git a/app/Console/Commands/AutoHighspeedTag.php b/app/Console/Commands/AutoHighspeedTag.php index 9d9971f9d4..536445a38f 100644 --- a/app/Console/Commands/AutoHighspeedTag.php +++ b/app/Console/Commands/AutoHighspeedTag.php @@ -46,7 +46,7 @@ public function handle() $seedbox_users = Seedbox::select(['user_id'])->get()->toArray(); - if (is_array($seedbox_users) && count($seedbox_users) > 0) { + if (\is_array($seedbox_users) && \count($seedbox_users) > 0) { $torid = Peer::select(['torrent_id'])->whereIn('user_id', $seedbox_users)->where('seeder', '=', 1)->get()->toArray(); foreach ($torid as $id) { diff --git a/app/Console/Commands/AutoNerdStat.php b/app/Console/Commands/AutoNerdStat.php index d3f59bddaa..4277ec3d75 100644 --- a/app/Console/Commands/AutoNerdStat.php +++ b/app/Console/Commands/AutoNerdStat.php @@ -59,7 +59,7 @@ public function __construct(ChatRepository $chatRepository) */ public function handle() { - if (config('chat.nerd_bot') == true) { + if (\config('chat.nerd_bot') == true) { // Current Timestamp $current = Carbon::now(); @@ -67,80 +67,80 @@ public function handle() $expiresAt = $current->addMinutes(60); // Site Birthday - $bday = config('other.birthdate'); + $bday = \config('other.birthdate'); // Logins Count Last 24hours $logins = User::whereNotNull('last_login')->where('last_login', '>', $current->subDay())->count(); - cache()->put('nerdbot-logins', $logins, $expiresAt); + \cache()->put('nerdbot-logins', $logins, $expiresAt); // Torrents Uploaded Count Last 24hours $uploads = Torrent::where('created_at', '>', $current->subDay())->count(); - cache()->put('nerdbot-uploads', $uploads, $expiresAt); + \cache()->put('nerdbot-uploads', $uploads, $expiresAt); // New Users Count Last 24hours $users = User::where('created_at', '>', $current->subDay())->count(); - cache()->put('nerdbot-users', $users, $expiresAt); + \cache()->put('nerdbot-users', $users, $expiresAt); // Top Banker $banker = User::latest('seedbonus')->first(); - cache()->put('nerdbot-banker', $banker, $expiresAt); + \cache()->put('nerdbot-banker', $banker, $expiresAt); // Most Snatched Torrent $snatched = Torrent::latest('times_completed')->first(); - cache()->put('nerdbot-snatched', $snatched, $expiresAt); + \cache()->put('nerdbot-snatched', $snatched, $expiresAt); // Most Seeded Torrent $seeded = Torrent::latest('seeders')->first(); - cache()->put('nerdbot-seeded', $seeded, $expiresAt); + \cache()->put('nerdbot-seeded', $seeded, $expiresAt); // Most Leeched Torrent $leeched = Torrent::latest('leechers')->first(); - cache()->put('nerdbot-leeched', $leeched, $expiresAt); + \cache()->put('nerdbot-leeched', $leeched, $expiresAt); // FL Torrents $fl = Torrent::where('free', '=', 1)->count(); - cache()->put('nerdbot-fl', $fl, $expiresAt); + \cache()->put('nerdbot-fl', $fl, $expiresAt); // DU Torrents $du = Torrent::where('doubleup', '=', 1)->count(); - cache()->put('nerdbot-doubleup', $du, $expiresAt); + \cache()->put('nerdbot-doubleup', $du, $expiresAt); // Peers Count $peers = Peer::count(); - cache()->put('nerdbot-peers', $peers, $expiresAt); + \cache()->put('nerdbot-peers', $peers, $expiresAt); // New User Bans Count Last 24hours $bans = Ban::whereNull('unban_reason')->whereNull('removed_at')->where('created_at', '>', $current->subDay())->count(); - cache()->put('nerdbot-bans', $bans, $expiresAt); + \cache()->put('nerdbot-bans', $bans, $expiresAt); // Hit and Run Warning Issued In Last 24hours $warnings = Warning::where('created_at', '>', $current->subDay())->count(); - cache()->put('nerdbot-warnings', $warnings, $expiresAt); + \cache()->put('nerdbot-warnings', $warnings, $expiresAt); // URL Helpers - $banker_url = href_profile($banker); - $seeded_url = href_torrent($seeded); - $leeched_url = href_torrent($leeched); - $snatched_url = href_torrent($snatched); + $banker_url = \href_profile($banker); + $seeded_url = \href_torrent($seeded); + $leeched_url = \href_torrent($leeched); + $snatched_url = \href_torrent($snatched); // Select A Random Nerd Stat $statArray = [ - sprintf('In The Last 24 Hours [color=#93c47d][b]%s[/b][/color] Unique Users Have Logged Into ', $logins).config('other.title').'!', - sprintf('In The Last 24 Hours [color=#93c47d][b]%s[/b][/color] Torrents Have Been Uploaded To ', $uploads).config('other.title').'!', - sprintf('In The Last 24 Hours [color=#93c47d][b]%s[/b][/color] Users Have Registered To ', $users).config('other.title').'!', - sprintf('There Are Currently [color=#93c47d][b]%s[/b][/color] Freeleech Torrents On ', $fl).config('other.title').'!', - sprintf('There Are Currently [color=#93c47d][b]%s[/b][/color] Double Upload Torrents On ', $du).config('other.title').'!', - sprintf('Currently [url=%s]%s[/url] Is The Best Seeded Torrent On ', $seeded_url, $seeded->name).config('other.title').'!', - sprintf('Currently [url=%s]%s[/url] Is The Most Leeched Torrent On ', $leeched_url, $leeched->name).config('other.title').'!', - sprintf('Currently [url=%s]%s[/url] Is The Most Snatched Torrent On ', $snatched_url, $snatched->name).config('other.title').'!', - sprintf('Currently [url=%s]%s[/url] Is The Top BON Holder On ', $banker_url, $banker->username).config('other.title').'!', - sprintf('Currently There Are [color=#93c47d][b]%s[/b][/color] Peers On ', $peers).config('other.title').'!', - sprintf('In The Last 24 Hours [color=#dd7e6b][b]%s[/b][/color] Users Have Been Banned From ', $bans).config('other.title').'!', - sprintf('In The Last 24 Hours [color=#dd7e6b][b]%s[/b][/color] Hit and Run Warnings Have Been Issued On ', $warnings).config('other.title').'!', - config('other.title').sprintf(' Birthday Is [b]%s[/b]!', $bday), - config('other.title').' Is King!', + \sprintf('In The Last 24 Hours [color=#93c47d][b]%s[/b][/color] Unique Users Have Logged Into ', $logins).\config('other.title').'!', + \sprintf('In The Last 24 Hours [color=#93c47d][b]%s[/b][/color] Torrents Have Been Uploaded To ', $uploads).\config('other.title').'!', + \sprintf('In The Last 24 Hours [color=#93c47d][b]%s[/b][/color] Users Have Registered To ', $users).\config('other.title').'!', + \sprintf('There Are Currently [color=#93c47d][b]%s[/b][/color] Freeleech Torrents On ', $fl).\config('other.title').'!', + \sprintf('There Are Currently [color=#93c47d][b]%s[/b][/color] Double Upload Torrents On ', $du).\config('other.title').'!', + \sprintf('Currently [url=%s]%s[/url] Is The Best Seeded Torrent On ', $seeded_url, $seeded->name).\config('other.title').'!', + \sprintf('Currently [url=%s]%s[/url] Is The Most Leeched Torrent On ', $leeched_url, $leeched->name).\config('other.title').'!', + \sprintf('Currently [url=%s]%s[/url] Is The Most Snatched Torrent On ', $snatched_url, $snatched->name).\config('other.title').'!', + \sprintf('Currently [url=%s]%s[/url] Is The Top BON Holder On ', $banker_url, $banker->username).\config('other.title').'!', + \sprintf('Currently There Are [color=#93c47d][b]%s[/b][/color] Peers On ', $peers).\config('other.title').'!', + \sprintf('In The Last 24 Hours [color=#dd7e6b][b]%s[/b][/color] Users Have Been Banned From ', $bans).\config('other.title').'!', + \sprintf('In The Last 24 Hours [color=#dd7e6b][b]%s[/b][/color] Hit and Run Warnings Have Been Issued On ', $warnings).\config('other.title').'!', + \config('other.title').\sprintf(' Birthday Is [b]%s[/b]!', $bday), + \config('other.title').' Is King!', ]; - $selected = mt_rand(0, count($statArray) - 1); + $selected = \mt_rand(0, \count($statArray) - 1); // Auto Shout Nerd Stat $this->chatRepository->systemMessage($statArray[$selected], 2); diff --git a/app/Console/Commands/AutoPreWarning.php b/app/Console/Commands/AutoPreWarning.php index c3f7bf61d5..b597c09dc2 100644 --- a/app/Console/Commands/AutoPreWarning.php +++ b/app/Console/Commands/AutoPreWarning.php @@ -44,7 +44,7 @@ class AutoPreWarning extends Command */ public function handle() { - if (config('hitrun.enabled') == true) { + if (\config('hitrun.enabled') == true) { $carbon = new Carbon(); $prewarn = History::with(['user', 'torrent']) ->where('prewarn', '=', 0) @@ -52,27 +52,27 @@ public function handle() ->where('immune', '=', 0) ->where('actual_downloaded', '>', 0) ->where('active', '=', 0) - ->where('seedtime', '<=', config('hitrun.seedtime')) - ->where('updated_at', '<', $carbon->copy()->subDays(config('hitrun.prewarn'))->toDateTimeString()) + ->where('seedtime', '<=', \config('hitrun.seedtime')) + ->where('updated_at', '<', $carbon->copy()->subDays(\config('hitrun.prewarn'))->toDateTimeString()) ->get(); foreach ($prewarn as $pre) { - if (! $pre->user->group->is_immune && $pre->actual_downloaded > ($pre->torrent->size * (config('hitrun.buffer') / 100))) { + if (! $pre->user->group->is_immune && $pre->actual_downloaded > ($pre->torrent->size * (\config('hitrun.buffer') / 100))) { $exsist = Warning::withTrashed() ->where('torrent', '=', $pre->torrent->id) ->where('user_id', '=', $pre->user->id) ->first(); // Send Pre Warning PM If Actual Warning Doesnt Already Exsist if ($exsist === null) { - $timeleft = config('hitrun.grace') - config('hitrun.prewarn'); + $timeleft = \config('hitrun.grace') - \config('hitrun.prewarn'); // Send Private Message $pm = new PrivateMessage(); $pm->sender_id = 1; $pm->receiver_id = $pre->user->id; $pm->subject = 'Hit and Run Warning Incoming'; - $pm->message = 'You have received a automated [b]PRE-WARNING PM[/b] from the system because [b]you have been disconnected for '.config('hitrun.prewarn').sprintf(' days on Torrent %s - and have not yet met the required seedtime rules set by ', $pre->torrent->name).config('other.title').sprintf('. If you fail to seed it within %s day(s) you will receive a automated WARNING which will last ', $timeleft).config('hitrun.expire').' days![/b] + $pm->message = 'You have received a automated [b]PRE-WARNING PM[/b] from the system because [b]you have been disconnected for '.\config('hitrun.prewarn').\sprintf(' days on Torrent %s + and have not yet met the required seedtime rules set by ', $pre->torrent->name).\config('other.title').\sprintf('. If you fail to seed it within %s day(s) you will receive a automated WARNING which will last ', $timeleft).\config('hitrun.expire').' days![/b] [color=red][b] THIS IS AN AUTOMATED SYSTEM MESSAGE, PLEASE DO NOT REPLY![/b][/color]'; $pm->save(); diff --git a/app/Console/Commands/AutoRecycleAudits.php b/app/Console/Commands/AutoRecycleAudits.php index f4a665206c..64a7dfa119 100644 --- a/app/Console/Commands/AutoRecycleAudits.php +++ b/app/Console/Commands/AutoRecycleAudits.php @@ -41,7 +41,7 @@ class AutoRecycleAudits extends Command public function handle() { $current = Carbon::now(); - $audits = Audit::where('created_at', '<', $current->copy()->subDays(config('audit.recycle'))->toDateTimeString())->get(); + $audits = Audit::where('created_at', '<', $current->copy()->subDays(\config('audit.recycle'))->toDateTimeString())->get(); foreach ($audits as $audit) { $audit->delete(); diff --git a/app/Console/Commands/AutoRecycleClaimedTorrentRequests.php b/app/Console/Commands/AutoRecycleClaimedTorrentRequests.php index 07ca40694b..eab3403872 100644 --- a/app/Console/Commands/AutoRecycleClaimedTorrentRequests.php +++ b/app/Console/Commands/AutoRecycleClaimedTorrentRequests.php @@ -66,9 +66,9 @@ public function handle() ->where('created_at', '<', $current->copy()->subDays(7)->toDateTimeString()) ->first(); if ($requestClaim) { - $tr_url = href_request($torrentRequest); + $tr_url = \href_request($torrentRequest); $this->chatRepository->systemMessage( - sprintf('[url=%s]%s[/url] claim has been reset due to not being filled within 7 days.', $tr_url, $torrentRequest->name) + \sprintf('[url=%s]%s[/url] claim has been reset due to not being filled within 7 days.', $tr_url, $torrentRequest->name) ); $requestClaim->delete(); diff --git a/app/Console/Commands/AutoRemoveFeaturedTorrent.php b/app/Console/Commands/AutoRemoveFeaturedTorrent.php index a24b72e875..8789c2e288 100644 --- a/app/Console/Commands/AutoRemoveFeaturedTorrent.php +++ b/app/Console/Commands/AutoRemoveFeaturedTorrent.php @@ -67,10 +67,10 @@ public function handle() $torrent->save(); // Auto Announce Featured Expired - $appurl = config('app.url'); + $appurl = \config('app.url'); $this->chatRepository->systemMessage( - sprintf('Ladies and Gents, [url=%s/torrents/%s]%s[/url] is no longer featured. :poop:', $appurl, $torrent->id, $torrent->name) + \sprintf('Ladies and Gents, [url=%s/torrents/%s]%s[/url] is no longer featured. :poop:', $appurl, $torrent->id, $torrent->name) ); } diff --git a/app/Console/Commands/AutoRevokePermissions.php b/app/Console/Commands/AutoRevokePermissions.php index 871ebe1de6..c848d897b6 100644 --- a/app/Console/Commands/AutoRevokePermissions.php +++ b/app/Console/Commands/AutoRevokePermissions.php @@ -44,16 +44,16 @@ class AutoRevokePermissions extends Command */ public function handle() { - $banned_group = cache()->rememberForever('banned_group', fn () => Group::where('slug', '=', 'banned')->pluck('id')); - $validating_group = cache()->rememberForever('validating_group', fn () => Group::where('slug', '=', 'validating')->pluck('id')); - $leech_group = cache()->rememberForever('leech_group', fn () => Group::where('slug', '=', 'leech')->pluck('id')); - $disabled_group = cache()->rememberForever('disabled_group', fn () => Group::where('slug', '=', 'disabled')->pluck('id')); - $pruned_group = cache()->rememberForever('pruned_group', fn () => Group::where('slug', '=', 'pruned')->pluck('id')); + $banned_group = \cache()->rememberForever('banned_group', fn () => Group::where('slug', '=', 'banned')->pluck('id')); + $validating_group = \cache()->rememberForever('validating_group', fn () => Group::where('slug', '=', 'validating')->pluck('id')); + $leech_group = \cache()->rememberForever('leech_group', fn () => Group::where('slug', '=', 'leech')->pluck('id')); + $disabled_group = \cache()->rememberForever('disabled_group', fn () => Group::where('slug', '=', 'disabled')->pluck('id')); + $pruned_group = \cache()->rememberForever('pruned_group', fn () => Group::where('slug', '=', 'pruned')->pluck('id')); User::whereNotIn('group_id', [$banned_group[0], $validating_group[0], $leech_group[0], $disabled_group[0], $pruned_group[0]])->update(['can_download' => '1', 'can_request' => '1']); User::whereIn('group_id', [$banned_group[0], $validating_group[0], $leech_group[0], $disabled_group[0], $pruned_group[0]])->update(['can_download' => '0', 'can_request' => '0']); - $warning = Warning::with('warneduser')->select(DB::raw('user_id, count(*) as value'))->where('active', '=', 1)->groupBy('user_id')->having('value', '>=', config('hitrun.revoke'))->get(); + $warning = Warning::with('warneduser')->select(DB::raw('user_id, count(*) as value'))->where('active', '=', 1)->groupBy('user_id')->having('value', '>=', \config('hitrun.revoke'))->get(); foreach ($warning as $deny) { if ($deny->warneduser->can_download == 1 && $deny->warneduser->can_request == 1) { diff --git a/app/Console/Commands/AutoSoftDeleteDisabledUsers.php b/app/Console/Commands/AutoSoftDeleteDisabledUsers.php index ef7a3e7168..19e0e8ef26 100644 --- a/app/Console/Commands/AutoSoftDeleteDisabledUsers.php +++ b/app/Console/Commands/AutoSoftDeleteDisabledUsers.php @@ -56,18 +56,18 @@ class AutoSoftDeleteDisabledUsers extends Command */ public function handle() { - if (config('pruning.user_pruning') == true) { - $disabled_group = cache()->rememberForever('disabled_group', fn () => Group::where('slug', '=', 'disabled')->pluck('id')); - $pruned_group = cache()->rememberForever('pruned_group', fn () => Group::where('slug', '=', 'pruned')->pluck('id')); + if (\config('pruning.user_pruning') == true) { + $disabled_group = \cache()->rememberForever('disabled_group', fn () => Group::where('slug', '=', 'disabled')->pluck('id')); + $pruned_group = \cache()->rememberForever('pruned_group', fn () => Group::where('slug', '=', 'pruned')->pluck('id')); $current = Carbon::now(); $users = User::where('group_id', '=', $disabled_group[0]) - ->where('disabled_at', '<', $current->copy()->subDays(config('pruning.soft_delete'))->toDateTimeString()) + ->where('disabled_at', '<', $current->copy()->subDays(\config('pruning.soft_delete'))->toDateTimeString()) ->get(); foreach ($users as $user) { // Send Email - dispatch(new SendDeleteUserMail($user)); + \dispatch(new SendDeleteUserMail($user)); $user->can_upload = 0; $user->can_download = 0; diff --git a/app/Console/Commands/AutoWarning.php b/app/Console/Commands/AutoWarning.php index 081a47c9cc..bae5aa4f2a 100644 --- a/app/Console/Commands/AutoWarning.php +++ b/app/Console/Commands/AutoWarning.php @@ -44,7 +44,7 @@ class AutoWarning extends Command */ public function handle() { - if (config('hitrun.enabled') == true) { + if (\config('hitrun.enabled') == true) { $carbon = new Carbon(); $hitrun = History::with(['user', 'torrent']) ->where('actual_downloaded', '>', 0) @@ -52,12 +52,12 @@ public function handle() ->where('hitrun', '=', 0) ->where('immune', '=', 0) ->where('active', '=', 0) - ->where('seedtime', '<', config('hitrun.seedtime')) - ->where('updated_at', '<', $carbon->copy()->subDays(config('hitrun.grace'))->toDateTimeString()) + ->where('seedtime', '<', \config('hitrun.seedtime')) + ->where('updated_at', '<', $carbon->copy()->subDays(\config('hitrun.grace'))->toDateTimeString()) ->get(); foreach ($hitrun as $hr) { - if (! $hr->user->group->is_immune && $hr->actual_downloaded > ($hr->torrent->size * (config('hitrun.buffer') / 100))) { + if (! $hr->user->group->is_immune && $hr->actual_downloaded > ($hr->torrent->size * (\config('hitrun.buffer') / 100))) { $exsist = Warning::withTrashed() ->where('torrent', '=', $hr->torrent->id) ->where('user_id', '=', $hr->user->id) @@ -68,8 +68,8 @@ public function handle() $warning->user_id = $hr->user->id; $warning->warned_by = '1'; $warning->torrent = $hr->torrent->id; - $warning->reason = sprintf('Hit and Run Warning For Torrent %s', $hr->torrent->name); - $warning->expires_on = $carbon->copy()->addDays(config('hitrun.expire')); + $warning->reason = \sprintf('Hit and Run Warning For Torrent %s', $hr->torrent->name); + $warning->expires_on = $carbon->copy()->addDays(\config('hitrun.expire')); $warning->active = '1'; $warning->save(); diff --git a/app/Console/Commands/DbDump.php b/app/Console/Commands/DbDump.php index 5d9ca77762..b0092a86ef 100644 --- a/app/Console/Commands/DbDump.php +++ b/app/Console/Commands/DbDump.php @@ -37,11 +37,11 @@ public function __construct() */ public function handle() { - $outfile = config('database.pristine-db-file'); - $host = config('database.connections.mysql.host'); - $db = config('database.connections.mysql.database'); - $user = config('database.connections.mysql.username'); - $password = config('database.connections.mysql.password'); + $outfile = \config('database.pristine-db-file'); + $host = \config('database.connections.mysql.host'); + $db = \config('database.connections.mysql.database'); + $user = \config('database.connections.mysql.username'); + $password = \config('database.connections.mysql.password'); if (! $outfile) { $this->error('The dump file location is not set in the configuration. If you\'ve tried to set it, you may need to call "php artisan cache:clear" and/or specify the environment when calling Artisan, e.g., "php artisan --env=testing db:dump".'); @@ -51,25 +51,25 @@ public function handle() // Necessary to avoid warning about supplying password on CLI. - putenv(sprintf('MYSQL_PWD=%s', $password)); + \putenv(\sprintf('MYSQL_PWD=%s', $password)); - $cmd = sprintf( + $cmd = \sprintf( 'mysqldump --user=%s --databases %s --add-drop-database --add-drop-table --default-character-set=utf8mb4 --skip-extended-insert --host=%s --quick --quote-names --routines --set-charset --single-transaction --triggers --tz-utc %s> %s;', - escapeshellarg($user), - escapeshellarg($db), - escapeshellarg($host), + \escapeshellarg($user), + \escapeshellarg($db), + \escapeshellarg($host), $this->option('verbose') ? '--verbose ' : '', - escapeshellarg($outfile) + \escapeshellarg($outfile) ); $return = null; $output = null; - exec($cmd, $output, $return); + \exec($cmd, $output, $return); if ($return !== 0) { - $this->error(sprintf('Could not dump database to file %s', $outfile)); + $this->error(\sprintf('Could not dump database to file %s', $outfile)); } } } diff --git a/app/Console/Commands/DbLoad.php b/app/Console/Commands/DbLoad.php index 905fe75fe1..2dca03135f 100644 --- a/app/Console/Commands/DbLoad.php +++ b/app/Console/Commands/DbLoad.php @@ -39,30 +39,30 @@ public function __construct() */ public function handle() { - $input = config('database.pristine-db-file'); - $db = config('database.connections.mysql.database'); - $user = config('database.connections.mysql.username'); - $password = config('database.connections.mysql.password'); + $input = \config('database.pristine-db-file'); + $db = \config('database.connections.mysql.database'); + $user = \config('database.connections.mysql.username'); + $password = \config('database.connections.mysql.password'); // Necessary to avoid warning about supplying password on CLI. - putenv(sprintf('MYSQL_PWD=%s', $password)); + \putenv(\sprintf('MYSQL_PWD=%s', $password)); - $cmd = sprintf( + $cmd = \sprintf( 'mysql -u %s %s < %s', - escapeshellarg($user), - escapeshellarg($db), - escapeshellarg($input) + \escapeshellarg($user), + \escapeshellarg($db), + \escapeshellarg($input) ); $return = null; $output = null; - exec($cmd, $output, $return); + \exec($cmd, $output, $return); if ($return !== 0) { - throw new \Exception(sprintf('Could not load database from file %s', $input)); + throw new \Exception(\sprintf('Could not load database from file %s', $input)); } } } diff --git a/app/Console/Commands/DemoSeed.php b/app/Console/Commands/DemoSeed.php index 88a59b2641..0cbb35098e 100644 --- a/app/Console/Commands/DemoSeed.php +++ b/app/Console/Commands/DemoSeed.php @@ -54,7 +54,7 @@ public function handle() $this->warn('*** This process could take a few minutes ***'); $this->warn('Press CTRL + C to abort'); - sleep(5); + \sleep(5); $abort = false; @@ -62,17 +62,17 @@ public function handle() // Users $this->info('Creating User Account'); - $uid = factory()->create()->id; + $uid = \factory()->create()->id; // random boolean - if ([false, true][rand(0, 1)]) { + if ([false, true][\rand(0, 1)]) { $r = $this->search($id); // Torrents $this->info('Creating Movie Torrents for Account ID #'.$uid); try { - factory()->create([ + \factory()->create([ 'user_id' => $uid, 'tmdb' => $id, 'name' => $r->title.' ('.$r->releaseYear.')', @@ -227,8 +227,8 @@ public function handle() 01:34:15.858 : en:Who Gets Away? 01:44:15.249 : en:End Credits ', - 'created_at' => now(), - 'updated_at' => now(), + 'created_at' => \now(), + 'updated_at' => \now(), ]); } catch (Exception $e) { $abort = true; @@ -265,9 +265,9 @@ protected function getArguments() private function search($id) { // we delay between api calls to reduce throttling - usleep(500_000); + \usleep(500_000); - $movieScrapper = new \App\Services\MovieScrapper(config('api-keys.tmdb'), config('api-keys.tvdb'), config('api-keys.omdb')); + $movieScrapper = new \App\Services\MovieScrapper(\config('api-keys.tmdb'), \config('api-keys.tvdb'), \config('api-keys.omdb')); return $movieScrapper->scrape('movie', null, $id); } diff --git a/app/Console/Commands/FetchGenres.php b/app/Console/Commands/FetchGenres.php index e6f9b95a61..87ecf98f59 100644 --- a/app/Console/Commands/FetchGenres.php +++ b/app/Console/Commands/FetchGenres.php @@ -44,7 +44,7 @@ class FetchGenres extends Command */ public function handle() { - $movieScrapper = new MovieScrapper(config('api-keys.tmdb'), config('api-keys.tvdb'), config('api-keys.omdb')); + $movieScrapper = new MovieScrapper(\config('api-keys.tmdb'), \config('api-keys.tvdb'), \config('api-keys.omdb')); $torrents = Torrent::withAnyStatus() ->select(['id', 'category_id', 'imdb', 'tmdb']) @@ -76,7 +76,7 @@ public function handle() } // sleep for 1 second - sleep(1); + \sleep(1); } $this->comment('Torrent Genres Command Complete'); } diff --git a/app/Console/Commands/FetchReleaseYears.php b/app/Console/Commands/FetchReleaseYears.php index 573f6b0203..7e73d129f0 100644 --- a/app/Console/Commands/FetchReleaseYears.php +++ b/app/Console/Commands/FetchReleaseYears.php @@ -44,8 +44,8 @@ class FetchReleaseYears extends Command */ public function handle() { - $movieScrapper = new MovieScrapper(config('api-keys.tmdb'), config('api-keys.tvdb'), config('api-keys.omdb')); - $appurl = config('app.url'); + $movieScrapper = new MovieScrapper(\config('api-keys.tmdb'), \config('api-keys.tvdb'), \config('api-keys.omdb')); + $appurl = \config('app.url'); $torrents = Torrent::withAnyStatus() ->with(['category']) @@ -61,8 +61,8 @@ public function handle() ->whereNull('release_year') ->count(); - $this->alert(sprintf('%s Torrents Already Have A Release Year Value', $withyear)); - $this->alert(sprintf('%s Torrents Are Missing A Release Year Value', $withoutyear)); + $this->alert(\sprintf('%s Torrents Already Have A Release Year Value', $withyear)); + $this->alert(\sprintf('%s Torrents Are Missing A Release Year Value', $withoutyear)); foreach ($torrents as $torrent) { $meta = null; @@ -76,10 +76,10 @@ public function handle() if (isset($meta->releaseYear) && $meta->releaseYear > '1900') { $torrent->release_year = $meta->releaseYear; $torrent->save(); - $this->info(sprintf('(%s) Release Year Fetched For Torrent %s + $this->info(\sprintf('(%s) Release Year Fetched For Torrent %s ', $torrent->category->name, $torrent->name)); } else { - $this->warn(sprintf('(%s) No Release Year Found For Torrent %s + $this->warn(\sprintf('(%s) No Release Year Found For Torrent %s %s/torrents/%s ', $torrent->category->name, $torrent->name, $appurl, $torrent->id)); } @@ -94,10 +94,10 @@ public function handle() if (isset($meta->releaseYear) && $meta->releaseYear > '1900') { $torrent->release_year = $meta->releaseYear; $torrent->save(); - $this->info(sprintf('(%s) Release Year Fetched For Torrent %s + $this->info(\sprintf('(%s) Release Year Fetched For Torrent %s ', $torrent->category->name, $torrent->name)); } else { - $this->warn(sprintf('(%s) No Release Year Found For Torrent %s + $this->warn(\sprintf('(%s) No Release Year Found For Torrent %s %s/torrents/%s ', $torrent->category->name, $torrent->name, $appurl, $torrent->id)); } @@ -108,24 +108,24 @@ public function handle() $meta = Game::find($torrent->igdb); } if (isset($meta->first_release_date) && $meta->first_release_date > '1900') { - $torrent->release_year = date('Y', strtotime($meta->first_release_date)); + $torrent->release_year = \date('Y', \strtotime($meta->first_release_date)); $torrent->save(); - $this->info(sprintf('(%s) Release Year Fetched For Torrent %s + $this->info(\sprintf('(%s) Release Year Fetched For Torrent %s ', $torrent->category->name, $torrent->name)); } else { - $this->warn(sprintf('(%s) No Release Year Found For Torrent %s + $this->warn(\sprintf('(%s) No Release Year Found For Torrent %s %s/torrents/%s ', $torrent->category->name, $torrent->name, $appurl, $torrent->id)); } } if ($torrent->category->no_meta || $torrent->category->music_meta) { - $this->warn(sprintf('(SKIPPED) %s Is In A Category That Does Not Have Meta. + $this->warn(\sprintf('(SKIPPED) %s Is In A Category That Does Not Have Meta. ', $torrent->name)); } // sleep for 1 second - sleep(1); + \sleep(1); } $this->comment('Torrent Release Year Command Complete'); } diff --git a/app/Console/Commands/GitUpdater.php b/app/Console/Commands/GitUpdater.php index 39e81a313a..c13ecc3112 100644 --- a/app/Console/Commands/GitUpdater.php +++ b/app/Console/Commands/GitUpdater.php @@ -101,7 +101,7 @@ public function handle() Press CTRL + C ANYTIME to abort! Aborting can lead to unexpected results! '); - sleep(1); + \sleep(1); $this->update(); @@ -114,7 +114,7 @@ private function update() { $updating = $this->checkForUpdates(); - if ((is_countable($updating) ? count($updating) : 0) > 0) { + if ((\is_countable($updating) ? \count($updating) : 0) > 0) { $this->alertDanger('Found Updates'); $this->cyan('Files that need updated:'); @@ -141,8 +141,8 @@ private function update() $this->restore($paths); - $conflicts = array_intersect($updating, $paths); - if (count($conflicts) > 0) { + $conflicts = \array_intersect($updating, $paths); + if (\count($conflicts) > 0) { $this->red('There are some files that was not updated because because of conflicts.'); $this->red('We will walk you through updating these files now.'); @@ -186,7 +186,7 @@ private function checkForUpdates() $this->process('git fetch origin'); $process = $this->process('git diff ..origin/master --name-only'); - $updating = array_filter(explode("\n", $process->getOutput()), 'strlen'); + $updating = \array_filter(\explode("\n", $process->getOutput()), 'strlen'); $this->done(); @@ -199,7 +199,7 @@ private function manualUpdate($updating) $this->red('Updating will cause you to LOSE any changes you might have made to the file!'); foreach ($updating as $file) { - if ($this->io->confirm(sprintf('Update %s', $file), true)) { + if ($this->io->confirm(\sprintf('Update %s', $file), true)) { $this->updateFile($file); } } @@ -209,7 +209,7 @@ private function manualUpdate($updating) private function updateFile($file) { - $this->process(sprintf('git checkout origin/master -- %s', $file)); + $this->process(\sprintf('git checkout origin/master -- %s', $file)); } private function backup(array $paths) @@ -217,14 +217,14 @@ private function backup(array $paths) $this->header('Backing Up Files'); $this->commands([ - 'rm -rf '.storage_path('gitupdate'), - 'mkdir '.storage_path('gitupdate'), + 'rm -rf '.\storage_path('gitupdate'), + 'mkdir '.\storage_path('gitupdate'), ], true); foreach ($paths as $path) { $this->validatePath($path); $this->createBackupPath($path); - $this->process($this->copy_command.' '.base_path($path).' '.storage_path('gitupdate').'/'.$path); + $this->process($this->copy_command.' '.\base_path($path).' '.\storage_path('gitupdate').'/'.$path); } $this->done(); @@ -235,15 +235,15 @@ private function restore(array $paths) $this->header('Restoring Backups'); foreach ($paths as $path) { - $to = Str::replaceLast('/.', '', base_path(dirname($path))); - $from = storage_path('gitupdate').'/'.$path; + $to = Str::replaceLast('/.', '', \base_path(\dirname($path))); + $from = \storage_path('gitupdate').'/'.$path; - if (is_dir($from)) { - $to .= '/'.basename($from).'/'; + if (\is_dir($from)) { + $to .= '/'.\basename($from).'/'; $from .= '/*'; } - $this->process(sprintf('%s %s %s', $this->copy_command, $from, $to)); + $this->process(\sprintf('%s %s %s', $this->copy_command, $from, $to)); } $this->commands([ @@ -315,8 +315,8 @@ private function permissions() private function validatePath($path) { - if (! is_file(base_path($path)) && ! is_dir(base_path($path))) { - $this->red(sprintf("The path '%s' is invalid", $path)); + if (! \is_file(\base_path($path)) && ! \is_dir(\base_path($path))) { + $this->red(\sprintf("The path '%s' is invalid", $path)); //$this->call('up'); //die(); } @@ -324,12 +324,12 @@ private function validatePath($path) private function createBackupPath($path) { - if (! is_dir(storage_path(sprintf('gitupdate/%s', $path))) && ! is_file(base_path($path))) { - mkdir(storage_path(sprintf('gitupdate/%s', $path)), 0775, true); - } elseif (is_file(base_path($path)) && dirname($path) !== '.') { - $path = dirname($path); - if (! is_dir(storage_path(sprintf('gitupdate/%s', $path)))) { - mkdir(storage_path(sprintf('gitupdate/%s', $path)), 0775, true); + if (! \is_dir(\storage_path(\sprintf('gitupdate/%s', $path))) && ! \is_file(\base_path($path))) { + \mkdir(\storage_path(\sprintf('gitupdate/%s', $path)), 0775, true); + } elseif (\is_file(\base_path($path)) && \dirname($path) !== '.') { + $path = \dirname($path); + if (! \is_dir(\storage_path(\sprintf('gitupdate/%s', $path)))) { + \mkdir(\storage_path(\sprintf('gitupdate/%s', $path)), 0775, true); } } } @@ -352,8 +352,8 @@ protected function getArguments() private function paths() { $p = $this->process('git diff master --name-only'); - $paths = array_filter(explode("\n", $p->getOutput()), 'strlen'); + $paths = \array_filter(\explode("\n", $p->getOutput()), 'strlen'); - return array_merge($paths, self::ADDITIONAL); + return \array_merge($paths, self::ADDITIONAL); } } diff --git a/app/Console/Commands/TestMailSettings.php b/app/Console/Commands/TestMailSettings.php index b89accaada..e76db83fc2 100644 --- a/app/Console/Commands/TestMailSettings.php +++ b/app/Console/Commands/TestMailSettings.php @@ -40,10 +40,10 @@ class TestMailSettings extends Command */ public function handle() { - $owner = config('other.email'); + $owner = \config('other.email'); $this->info('Sending Test Email To '.$owner); - sleep(5); + \sleep(5); try { Mail::to($owner)->send(new TestEmail()); diff --git a/app/Console/Commands/VendorCleanup.php b/app/Console/Commands/VendorCleanup.php index 055159ce14..8367c7f95c 100644 --- a/app/Console/Commands/VendorCleanup.php +++ b/app/Console/Commands/VendorCleanup.php @@ -91,25 +91,25 @@ class VendorCleanup extends Command */ public function handle() { - $patterns = array_diff($this->patterns, $this->excluded); + $patterns = \array_diff($this->patterns, $this->excluded); - $directories = $this->expandDirectoryTree(base_path('vendor')); + $directories = $this->expandDirectoryTree(\base_path('vendor')); $isDry = $this->option('check'); foreach ($directories as $directory) { foreach ($patterns as $pattern) { - $casePattern = preg_replace_callback('#([a-z])#i', function ($matches) { + $casePattern = \preg_replace_callback('#([a-z])#i', function ($matches) { return $this->prepareWord($matches); }, $pattern); - $files = glob($directory.'/'.$casePattern, GLOB_BRACE); + $files = \glob($directory.'/'.$casePattern, GLOB_BRACE); if (! $files) { continue; } - $files = array_diff($files, $this->excluded); + $files = \array_diff($files, $this->excluded); foreach ($this->excluded as $excluded) { $key = $this->arrayFind($excluded, $files); @@ -120,7 +120,7 @@ public function handle() } } foreach ($files as $file) { - if (is_dir($file)) { + if (\is_dir($file)) { $this->out('DELETING DIR: '.$file); if (! $isDry) { $this->delTree($file); @@ -128,7 +128,7 @@ public function handle() } else { $this->out('DELETING FILE: '.$file); if (! $isDry) { - @unlink($file); + @\unlink($file); } } } @@ -147,12 +147,12 @@ public function handle() protected function expandDirectoryTree($dir) { $directories = []; - $files = array_diff(scandir($dir), ['.', '..']); + $files = \array_diff(\scandir($dir), ['.', '..']); foreach ($files as $file) { $directory = $dir.'/'.$file; - if (is_dir($directory)) { + if (\is_dir($directory)) { $directories[] = $directory; - $directories = array_merge($directories, $this->expandDirectoryTree($directory)); + $directories = \array_merge($directories, $this->expandDirectoryTree($directory)); } } @@ -168,7 +168,7 @@ protected function expandDirectoryTree($dir) */ protected function delTree($dir) { - if (! file_exists($dir) || ! is_dir($dir)) { + if (! \file_exists($dir) || ! \is_dir($dir)) { return false; } $iterator = new RecursiveIteratorIterator( @@ -177,12 +177,12 @@ protected function delTree($dir) ); foreach ($iterator as $filename => $fileInfo) { if ($fileInfo->isDir()) { - @rmdir($filename); + @\rmdir($filename); } else { - @unlink($filename); + @\unlink($filename); } } - @rmdir($dir); + @\rmdir($dir); } /** @@ -194,13 +194,13 @@ protected function delTree($dir) */ protected function prepareWord($matches) { - return '['.strtolower($matches[1]).strtoupper($matches[1]).']'; + return '['.\strtolower($matches[1]).\strtoupper($matches[1]).']'; } protected function arrayFind($needle, array $haystack) { foreach ($haystack as $key => $value) { - if (false !== stripos($value, $needle)) { + if (false !== \stripos($value, $needle)) { return $key; } } diff --git a/app/Console/ConsoleTools.php b/app/Console/ConsoleTools.php index db055eab15..0d8e2147c9 100644 --- a/app/Console/ConsoleTools.php +++ b/app/Console/ConsoleTools.php @@ -27,7 +27,7 @@ trait ConsoleTools private function cyan($line) { - $this->io->writeln(sprintf('%s', $line)); + $this->io->writeln(\sprintf('%s', $line)); } private function white($line) @@ -37,22 +37,22 @@ private function white($line) private function magenta($line) { - $this->io->writeln(sprintf('%s', $line)); + $this->io->writeln(\sprintf('%s', $line)); } private function green($line) { - $this->io->writeln(sprintf('%s', $line)); + $this->io->writeln(\sprintf('%s', $line)); } private function red($line) { - $this->io->writeln(sprintf('%s', $line)); + $this->io->writeln(\sprintf('%s', $line)); } private function blue($line) { - $this->io->writeln(sprintf('%s', $line)); + $this->io->writeln(\sprintf('%s', $line)); } private function done() @@ -62,29 +62,29 @@ private function done() private function header($line) { - $this->blue(str_repeat('=', 50)); + $this->blue(\str_repeat('=', 50)); $this->io->write($line); - $this->blue(str_repeat('=', 50)); + $this->blue(\str_repeat('=', 50)); } private function alertSuccess($line) { - $this->io->writeln(sprintf('[ !! %s !! ]', $line)); + $this->io->writeln(\sprintf('[ !! %s !! ]', $line)); } private function alertDanger($line) { - $this->io->writeln(sprintf('[ !! %s !! ]', $line)); + $this->io->writeln(\sprintf('[ !! %s !! ]', $line)); } private function alertInfo($line) { - $this->io->writeln(sprintf('[ !! %s !! ]', $line)); + $this->io->writeln(\sprintf('[ !! %s !! ]', $line)); } private function alertWarning($line) { - $this->io->writeln(sprintf('[ !! %s !! ]', $line)); + $this->io->writeln(\sprintf('[ !! %s !! ]', $line)); } private function commands(array $commands, $silent = false) @@ -114,14 +114,14 @@ private function process($command, $silent = false) try { $process->checkTimeout(); } catch (ProcessTimedOutException $e) { - $this->red(sprintf("'%s' timed out.!", $command)); + $this->red(\sprintf("'%s' timed out.!", $command)); } if (! $silent) { $bar->advance(); } - usleep(200_000); + \usleep(200_000); } if (! $silent) { diff --git a/app/Console/Kernel.php b/app/Console/Kernel.php index 9ab320ec2d..0712b38b2e 100644 --- a/app/Console/Kernel.php +++ b/app/Console/Kernel.php @@ -72,6 +72,6 @@ protected function commands() { $this->load(__DIR__.'/Commands'); - require base_path('routes/console.php'); + require \base_path('routes/console.php'); } } diff --git a/app/Helpers/BBCodeConverter.php b/app/Helpers/BBCodeConverter.php index 5bd9bc2ae4..1c97092291 100644 --- a/app/Helpers/BBCodeConverter.php +++ b/app/Helpers/BBCodeConverter.php @@ -36,9 +36,9 @@ public function __construct($text) */ protected function replaceSize() { - $this->text = preg_replace_callback('#\[size=([\W\D\w\s]*?)\]([\W\D\w\s]*?)\[/size\]#iu', + $this->text = \preg_replace_callback('#\[size=([\W\D\w\s]*?)\]([\W\D\w\s]*?)\[/size\]#iu', - fn ($matches) => ''.trim($matches[1], '').'', + fn ($matches) => ''.\trim($matches[1], '').'', $this->text ); @@ -49,9 +49,9 @@ protected function replaceSize() */ protected function replaceCenter() { - $this->text = preg_replace_callback('#\[center\]([\W\D\w\s]*?)\[/center\]#iu', + $this->text = \preg_replace_callback('#\[center\]([\W\D\w\s]*?)\[/center\]#iu', - fn ($matches) => ''.trim($matches[1], ' ').'', + fn ($matches) => ''.\trim($matches[1], ' ').'', $this->text ); @@ -62,9 +62,9 @@ protected function replaceCenter() */ protected function replaceBold() { - $this->text = preg_replace_callback('#\[b\]([\W\D\w\s]*?)\[/b\]#iu', + $this->text = \preg_replace_callback('#\[b\]([\W\D\w\s]*?)\[/b\]#iu', - fn ($matches) => '**'.trim($matches[1], ' ').'**', + fn ($matches) => '**'.\trim($matches[1], ' ').'**', $this->text ); @@ -75,9 +75,9 @@ protected function replaceBold() */ protected function replaceItalic() { - $this->text = preg_replace_callback('#\[i\]([\W\D\w\s]*?)\[/i\]#iu', + $this->text = \preg_replace_callback('#\[i\]([\W\D\w\s]*?)\[/i\]#iu', - fn ($matches) => '*'.trim($matches[1], ' ').'*', + fn ($matches) => '*'.\trim($matches[1], ' ').'*', $this->text ); @@ -88,9 +88,9 @@ protected function replaceItalic() */ protected function replaceUnderline() { - $this->text = preg_replace_callback('#\[u\]([\W\D\w\s]*?)\[/u\]#iu', + $this->text = \preg_replace_callback('#\[u\]([\W\D\w\s]*?)\[/u\]#iu', - fn ($matches) => '_'.trim($matches[1], ' ').'_', + fn ($matches) => '_'.\trim($matches[1], ' ').'_', $this->text ); @@ -101,9 +101,9 @@ protected function replaceUnderline() */ protected function replaceStrikethrough() { - $this->text = preg_replace_callback('#\[s\]([\W\D\w\s]*?)\[/s\]#iu', + $this->text = \preg_replace_callback('#\[s\]([\W\D\w\s]*?)\[/s\]#iu', - fn ($matches) => '~~'.trim($matches[1], ' ').'~~', + fn ($matches) => '~~'.\trim($matches[1], ' ').'~~', $this->text ); @@ -114,31 +114,31 @@ protected function replaceStrikethrough() */ protected function replaceLists() { - $this->text = preg_replace_callback('#\[list(?P=1)?\](?P[\W\D\w\s]*?)\[/list\]#iu', + $this->text = \preg_replace_callback('#\[list(?P=1)?\](?P[\W\D\w\s]*?)\[/list\]#iu', function ($matches) { $buffer = ''; - $list = preg_replace('#\s*$|^\s*#mu', '', $matches['items']); - if (is_null($list)) { - throw new \RuntimeException(sprintf("Text identified by '%d' has malformed BBCode lists", $this->id)); + $list = \preg_replace('#\s*$|^\s*#mu', '', $matches['items']); + if (\is_null($list)) { + throw new \RuntimeException(\sprintf("Text identified by '%d' has malformed BBCode lists", $this->id)); } - $items = preg_split('#\[\*\]#u', $list); + $items = \preg_split('#\[\*\]#u', $list); - $counter = count($items); + $counter = \count($items); if (isset($matches['type']) && $matches['type'] == '=1') { // ordered list // We start from 1 to discard the first string, in fact, it's empty. for ($i = 1; $i < $counter; $i++) { if (! empty($items[$i])) { - $buffer .= (string) ($i).'. '.trim($items[$i]).PHP_EOL; + $buffer .= (string) ($i).'. '.\trim($items[$i]).PHP_EOL; } } } else { // unordered list // We start from 1 to discard the first string, in fact, it's empty. for ($i = 1; $i < $counter; $i++) { if (! empty($items[$i])) { - $buffer .= '- '.trim($items[$i]).PHP_EOL; + $buffer .= '- '.\trim($items[$i]).PHP_EOL; } } } @@ -162,46 +162,46 @@ protected function replaceTables() { $replaceRow = function ($matches) { $columns = $matches['columns']; - $columns = trim($columns); + $columns = \trim($columns); - $cells = preg_replace_callback('#\[td?\](?P[\W\w\s]*?)\[/td\]#iu', fn ($matches) => $matches['cells'].' | ', $columns); + $cells = \preg_replace_callback('#\[td?\](?P[\W\w\s]*?)\[/td\]#iu', fn ($matches) => $matches['cells'].' | ', $columns); if ($cells !== '') { $cells = '| '.$cells; } - return trim($cells); + return \trim($cells); }; - $this->text = preg_replace_callback('#\[table?\](?P[\W\w\s]*?)\[/table\]#iu', function ($tableMatches) use ($replaceRow) { - preg_match_all('#\[th?\](?P[\W\w\s]*?)\[/th\]#iu', $tableMatches['rows'], $headerMatches, PREG_SET_ORDER); + $this->text = \preg_replace_callback('#\[table?\](?P[\W\w\s]*?)\[/table\]#iu', function ($tableMatches) use ($replaceRow) { + \preg_match_all('#\[th?\](?P[\W\w\s]*?)\[/th\]#iu', $tableMatches['rows'], $headerMatches, PREG_SET_ORDER); $headers = []; - if (count($headerMatches) !== 0) { - $headers = array_map($replaceRow, $headerMatches); + if (\count($headerMatches) !== 0) { + $headers = \array_map($replaceRow, $headerMatches); } - preg_match_all('#\[tr?\](?P[\W\w\s]*?)\[/tr\]#iu', $tableMatches['rows'], $contentMatches, PREG_SET_ORDER); + \preg_match_all('#\[tr?\](?P[\W\w\s]*?)\[/tr\]#iu', $tableMatches['rows'], $contentMatches, PREG_SET_ORDER); $rows = []; - if (count($contentMatches) !== 0) { - $rows = array_map($replaceRow, $contentMatches); + if (\count($contentMatches) !== 0) { + $rows = \array_map($replaceRow, $contentMatches); } $headerSeparator = ''; - if (count($rows) > 0) { - $columnCount = substr_count($rows[0], '|'); + if (\count($rows) > 0) { + $columnCount = \substr_count($rows[0], '|'); - if (count($headers) === 0) { - $headers[] = implode(' ', array_fill(0, $columnCount, '|')); + if (\count($headers) === 0) { + $headers[] = \implode(' ', \array_fill(0, $columnCount, '|')); } - $headerSeparator = implode(' --- ', array_fill(0, $columnCount, '|')); + $headerSeparator = \implode(' --- ', \array_fill(0, $columnCount, '|')); } else { return $tableMatches['rows']; } $headers[] = $headerSeparator; - return implode("\n", array_merge($headers, $rows))."\n"; + return \implode("\n", \array_merge($headers, $rows))."\n"; }, $this->text); } @@ -210,14 +210,14 @@ protected function replaceTables() */ protected function replaceUrls() { - $this->text = preg_replace_callback('#\[url\s*=\s*("(?:[^"]*")|\A[^\']*\Z|(?:[^\'">\]\s]+))\s*(?:[^]\s]*)\]([\W\D\w\s]*?)\[/url\]#iu', + $this->text = \preg_replace_callback('#\[url\s*=\s*("(?:[^"]*")|\A[^\']*\Z|(?:[^\'">\]\s]+))\s*(?:[^]\s]*)\]([\W\D\w\s]*?)\[/url\]#iu', function ($matches) { if (isset($matches[1]) && isset($matches[2])) { return '['.$matches[2].']('.$matches[1].')'; } - throw new \RuntimeException(sprintf("Text identified by '%d' has malformed BBCode urls", $this->id)); + throw new \RuntimeException(\sprintf("Text identified by '%d' has malformed BBCode urls", $this->id)); }, $this->text @@ -229,7 +229,7 @@ function ($matches) { */ protected function replaceImage() { - $this->text = preg_replace_callback('#\[img\]([\W\D\w\s]*?)\[/img\]#iu', + $this->text = \preg_replace_callback('#\[img\]([\W\D\w\s]*?)\[/img\]#iu', fn ($matches) => PHP_EOL.'![]'.'('.$matches[1].')'.PHP_EOL, @@ -242,7 +242,7 @@ protected function replaceImage() */ protected function replaceImages() { - $this->text = preg_replace_callback('#\[img\s*=\s*("(?:[^"]*")|\A[^\']*\Z|(?:[^\'">\]\s]+))\s*(?:[^]\s]*)\[/img\]#iu', + $this->text = \preg_replace_callback('#\[img\s*=\s*("(?:[^"]*")|\A[^\']*\Z|(?:[^\'">\]\s]+))\s*(?:[^]\s]*)\[/img\]#iu', fn ($matches) => PHP_EOL.'!['.$matches[2].']'.'('.$matches[1].')'.PHP_EOL, @@ -256,13 +256,13 @@ protected function replaceImages() protected function replaceQuotes() { // Removes the inner quotes, leaving just one level. - $this->text = preg_replace('#\G(?(\[quote\b[^]]*](?>[^[]++|\[(?!/?quote)|(?1))*\[/quote])|(?[^[]++|\[(?!/?quote))+\K)|\[quote\b[^]]*]\K#', '', $this->text); + $this->text = \preg_replace('#\G(?(\[quote\b[^]]*](?>[^[]++|\[(?!/?quote)|(?1))*\[/quote])|(?[^[]++|\[(?!/?quote))+\K)|\[quote\b[^]]*]\K#', '', $this->text); // Replaces all the remaining quotes with '> ' characters. - $this->text = preg_replace_callback('#\[quote\b[^]]*\]((?>[^[]++|\[(?!/?quote))*)\[/quote\]#i', + $this->text = \preg_replace_callback('#\[quote\b[^]]*\]((?>[^[]++|\[(?!/?quote))*)\[/quote\]#i', function ($matches) { - $quote = preg_replace('#^\s*#mu', '', trim($matches[1])); + $quote = \preg_replace('#^\s*#mu', '', \trim($matches[1])); return '> '.$quote.PHP_EOL.PHP_EOL; }, @@ -276,11 +276,11 @@ function ($matches) { */ protected function replaceSnippets() { - $this->text = preg_replace_callback('#\[code\s*=?(?P\w*)\](?P[\W\D\w\s]*?)\[\/code\]#iu', + $this->text = \preg_replace_callback('#\[code\s*=?(?P\w*)\](?P[\W\D\w\s]*?)\[\/code\]#iu', function ($matches) { if (isset($matches['snippet'])) { - $language = strtolower($matches['language']); + $language = \strtolower($matches['language']); if ($language === 'html4strict' || $language === 'div') { $language = 'html'; @@ -308,10 +308,10 @@ function ($matches) { $language = 'aspx-vb'; } - return PHP_EOL.'```'.$language.PHP_EOL.trim($matches['snippet']).PHP_EOL.'```'.PHP_EOL; + return PHP_EOL.'```'.$language.PHP_EOL.\trim($matches['snippet']).PHP_EOL.'```'.PHP_EOL; } - throw new \RuntimeException(sprintf("Text identified by '%d' has malformed BBCode snippet.", $this->id)); + throw new \RuntimeException(\sprintf("Text identified by '%d' has malformed BBCode snippet.", $this->id)); }, $this->text @@ -323,9 +323,9 @@ function ($matches) { */ protected function replaceSpoilers() { - $this->text = preg_replace_callback('#\[spoiler\]([\W\D\w\s]*?)\[/spoiler\]#iu', + $this->text = \preg_replace_callback('#\[spoiler\]([\W\D\w\s]*?)\[/spoiler\]#iu', - fn ($matches) => '
Spoiler!
'.trim($matches[1], ' ').'
', + fn ($matches) => '
Spoiler!
'.\trim($matches[1], ' ').'
', $this->text ); @@ -336,9 +336,9 @@ protected function replaceSpoilers() */ protected function replaceColor() { - $this->text = preg_replace_callback('#\[color=([\W\D\w\s]*?)\]([\W\D\w\s]*?)\[/color\]#iu', + $this->text = \preg_replace_callback('#\[color=([\W\D\w\s]*?)\]([\W\D\w\s]*?)\[/color\]#iu', - fn ($matches) => ''.trim($matches[2], '').'', + fn ($matches) => ''.\trim($matches[2], '').'', $this->text ); @@ -349,9 +349,9 @@ protected function replaceColor() */ protected function replaceVideo() { - $this->text = preg_replace_callback('#\[video=.*\]([\W\D\w\s]*?)\[/video\]#iu', + $this->text = \preg_replace_callback('#\[video=.*\]([\W\D\w\s]*?)\[/video\]#iu', - fn ($matches) => '', + fn ($matches) => '', $this->text ); @@ -362,9 +362,9 @@ protected function replaceVideo() */ protected function replaceYoutube() { - $this->text = preg_replace_callback('#\[youtube\]([\W\D\w\s]*?)\[/youtube\]#iu', + $this->text = \preg_replace_callback('#\[youtube\]([\W\D\w\s]*?)\[/youtube\]#iu', - fn ($matches) => '', + fn ($matches) => '', $this->text ); @@ -375,9 +375,9 @@ protected function replaceYoutube() */ protected function replaceAlert() { - $this->text = preg_replace_callback('#\[alert\]([\W\D\w\s]*?)\[/alert\]#iu', + $this->text = \preg_replace_callback('#\[alert\]([\W\D\w\s]*?)\[/alert\]#iu', - fn ($matches) => '
'.trim($matches[1], '').'
', + fn ($matches) => '
'.\trim($matches[1], '').'
', $this->text ); @@ -388,9 +388,9 @@ protected function replaceAlert() */ protected function replaceNote() { - $this->text = preg_replace_callback('#\[note\]([\W\D\w\s]*?)\[/note\]#iu', + $this->text = \preg_replace_callback('#\[note\]([\W\D\w\s]*?)\[/note\]#iu', - fn ($matches) => '
'.trim($matches[1], '').'
', + fn ($matches) => '
'.\trim($matches[1], '').'
', $this->text ); diff --git a/app/Helpers/BackupPassword.php b/app/Helpers/BackupPassword.php index cad653f6b0..a004d25c78 100644 --- a/app/Helpers/BackupPassword.php +++ b/app/Helpers/BackupPassword.php @@ -43,25 +43,25 @@ class BackupPassword */ public function __construct(BackupEncryption $backupEncryption, string $path) { - $this->password = config('backup.security.password'); + $this->password = \config('backup.security.password'); if (! $this->password) { return $this->path = $path; } // If ZipArchive is enabled - if (class_exists('ZipArchive') && in_array('setEncryptionIndex', get_class_methods('ZipArchive'))) { - consoleOutput()->info('Applying password and encryption to zip using ZipArchive...'); + if (\class_exists('ZipArchive') && \in_array('setEncryptionIndex', \get_class_methods('ZipArchive'))) { + \consoleOutput()->info('Applying password and encryption to zip using ZipArchive...'); $this->makeZipArchive($backupEncryption, $path); } // Fall back on PHP-driven ZipFile else { - consoleOutput()->info('Applying password and encryption to zip using ZipFile...'); + \consoleOutput()->info('Applying password and encryption to zip using ZipFile...'); $this->makeZipFile($backupEncryption, $path); } - consoleOutput()->info('Successfully applied password and encryption to zip.'); + \consoleOutput()->info('Successfully applied password and encryption to zip.'); } /** @@ -77,7 +77,7 @@ public function __construct(BackupEncryption $backupEncryption, string $path) protected function makeZipArchive(BackupEncryption $backupEncryption, string $path): void { $encryptionConstant = $backupEncryption->getEncryptionConstant( - config('backup.security.encryption'), + \config('backup.security.encryption'), 'ZipArchive' ); @@ -106,7 +106,7 @@ protected function makeZipArchive(BackupEncryption $backupEncryption, string $pa protected function makeZipFile(BackupEncryption $backupEncryption, string $path): void { $encryptionConstant = $backupEncryption->getEncryptionConstant( - config('backup.security.encryption'), + \config('backup.security.encryption'), 'ZipFile' ); diff --git a/app/Helpers/Bbcode.php b/app/Helpers/Bbcode.php index 2e33af34be..b1606a846f 100644 --- a/app/Helpers/Bbcode.php +++ b/app/Helpers/Bbcode.php @@ -344,8 +344,8 @@ public function stripBBCodeTags($source) */ protected function searchAndReplace($pattern, $replace, $source) { - while (preg_match($pattern, $source)) { - $source = preg_replace($pattern, $replace, $source); + while (\preg_match($pattern, $source)) { + $source = \preg_replace($pattern, $replace, $source); } return $source; diff --git a/app/Helpers/Bencode.php b/app/Helpers/Bencode.php index c4304a79d5..1be0c0a198 100644 --- a/app/Helpers/Bencode.php +++ b/app/Helpers/Bencode.php @@ -19,7 +19,7 @@ class Bencode { public static function parse_integer($s, &$pos) { - $len = strlen($s); + $len = \strlen($s); if ($len === 0 || $s[$pos] != 'i') { return; } @@ -27,7 +27,7 @@ public static function parse_integer($s, &$pos) $result = ''; while ($pos < $len && $s[$pos] != 'e') { - if (is_numeric($s[$pos]) || $s[$pos] = '-') { + if (\is_numeric($s[$pos]) || $s[$pos] = '-') { $result .= $s[$pos]; } else { // We have an invalid character in the string. @@ -50,11 +50,11 @@ public static function parse_integer($s, &$pos) public static function parse_string($s, &$pos) { - $len = strlen($s); + $len = \strlen($s); $length_str = ''; while ($pos < $len && $s[$pos] != ':') { - if (is_numeric($s[$pos])) { + if (\is_numeric($s[$pos])) { $length_str .= $s[$pos]; } else { // Non-numeric character, we return null in this case. @@ -91,7 +91,7 @@ public static function parse_string($s, &$pos) public static function bdecode($s, &$pos = 0) { - $len = strlen($s); + $len = \strlen($s); if ($pos >= $len) { return; } @@ -100,7 +100,7 @@ public static function bdecode($s, &$pos = 0) if ($c == 'i') { return self::parse_integer($s, $pos); } - if (is_numeric($c)) { + if (\is_numeric($c)) { return self::parse_string($s, $pos); } if ($c == 'd') { @@ -109,7 +109,7 @@ public static function bdecode($s, &$pos = 0) while ($pos < $len && $s[$pos] != 'e') { $key = self::bdecode($s, $pos); $value = self::bdecode($s, $pos); - if (is_null($key) || is_null($value)) { + if (\is_null($key) || \is_null($value)) { return; } $dict[$key] = $value; @@ -126,7 +126,7 @@ public static function bdecode($s, &$pos = 0) $pos++; while ($pos < $len && $s[$pos] != 'e') { $next = self::bdecode($s, $pos); - if (! is_null($next)) { + if (! \is_null($next)) { $list[] = $next; } else { return; @@ -145,12 +145,12 @@ public static function bdecode($s, &$pos = 0) public static function bencode($d) { - if (is_array($d)) { + if (\is_array($d)) { $ret = 'l'; $is_dict = false; if (! isset($d['isDct'])) { - foreach (array_keys($d) as $key) { - if (! is_int($key)) { + foreach (\array_keys($d) as $key) { + if (! \is_int($key)) { $is_dict = true; break; @@ -163,17 +163,17 @@ public static function bencode($d) if ($is_dict) { $ret = 'd'; // this is required by the specs, and BitTornado actualy chokes on unsorted dictionaries - ksort($d, SORT_STRING); + \ksort($d, SORT_STRING); } foreach ($d as $key => $value) { if ($is_dict) { - $ret .= strlen($key).':'.$key; + $ret .= \strlen($key).':'.$key; } - if (is_int($value) || is_float($value)) { - $ret .= sprintf('i%de', $value); - } elseif (is_string($value)) { - $ret .= strlen($value).':'.$value; + if (\is_int($value) || \is_float($value)) { + $ret .= \sprintf('i%de', $value); + } elseif (\is_string($value)) { + $ret .= \strlen($value).':'.$value; } else { $ret .= self::bencode($value); } @@ -181,24 +181,24 @@ public static function bencode($d) return $ret.'e'; } - if (is_string($d)) { - return strlen($d).':'.$d; + if (\is_string($d)) { + return \strlen($d).':'.$d; } - if (is_int($d) || is_float($d)) { - return sprintf('i%de', $d); + if (\is_int($d) || \is_float($d)) { + return \sprintf('i%de', $d); } } public static function bdecode_file($filename) { - $f = file_get_contents($filename, FILE_BINARY); + $f = \file_get_contents($filename, FILE_BINARY); return self::bdecode($f); } public static function get_infohash($t) { - return sha1(self::bencode($t['info'])); + return \sha1(self::bencode($t['info'])); } public static function get_meta($t) @@ -208,7 +208,7 @@ public static function get_meta($t) $count = 0; // Multifile - if (isset($t['info']['files']) && is_array($t['info']['files'])) { + if (isset($t['info']['files']) && \is_array($t['info']['files'])) { foreach ($t['info']['files'] as $file) { $count++; $size += $file['length']; diff --git a/app/Helpers/EmailBlacklistUpdater.php b/app/Helpers/EmailBlacklistUpdater.php index 3e3944ed95..754ca81a0b 100644 --- a/app/Helpers/EmailBlacklistUpdater.php +++ b/app/Helpers/EmailBlacklistUpdater.php @@ -19,19 +19,19 @@ class EmailBlacklistUpdater { public static function update() { - $url = config('email-blacklist.source'); + $url = \config('email-blacklist.source'); if ($url === null) { return false; } // Define parameters for the cache - $key = config('email-blacklist.cache-key'); + $key = \config('email-blacklist.cache-key'); $duration = Carbon::now()->addMonth(); - $domains = json_decode(file_get_contents($url), true); - $count = count($domains); + $domains = \json_decode(\file_get_contents($url), true); + $count = \count($domains); // Retrieve blacklisted domains - cache()->put($key, $domains, $duration); + \cache()->put($key, $domains, $duration); return $count; } diff --git a/app/Helpers/HiddenCaptcha.php b/app/Helpers/HiddenCaptcha.php index a34b62685e..5256b5cd5f 100644 --- a/app/Helpers/HiddenCaptcha.php +++ b/app/Helpers/HiddenCaptcha.php @@ -28,23 +28,23 @@ class HiddenCaptcha */ public static function render($mustBeEmptyField = '_username') { - $ts = time(); + $ts = \time(); $random = Str::random(16); // Generate the token $token = [ 'timestamp' => $ts, - 'session_id' => session()->getId(), - 'ip' => request()->ip(), - 'user_agent' => request()->header('User-Agent'), + 'session_id' => \session()->getId(), + 'ip' => \request()->ip(), + 'user_agent' => \request()->header('User-Agent'), 'random_field_name' => $random, 'must_be_empty' => $mustBeEmptyField, ]; // Encrypt the token - $token = Crypt::encrypt(serialize($token)); + $token = Crypt::encrypt(\serialize($token)); - return (string) view('partials.captcha', ['mustBeEmptyField' => $mustBeEmptyField, 'ts' => $ts, 'random' => $random, 'token' => $token]); + return (string) \view('partials.captcha', ['mustBeEmptyField' => $mustBeEmptyField, 'ts' => $ts, 'random' => $random, 'token' => $token]); } /** @@ -66,12 +66,12 @@ public static function check(Validator $validator, $minLimit = 0, $maxLimit = 1_ } // Hidden "must be empty" field check - if (! array_key_exists($token['must_be_empty'], $formData) || ! empty($formData[$token['must_be_empty']])) { + if (! \array_key_exists($token['must_be_empty'], $formData) || ! empty($formData[$token['must_be_empty']])) { return false; } // Check time limits - $now = time(); + $now = \time(); if ($now - $token['timestamp'] < $minLimit || $now - $token['timestamp'] > $maxLimit) { return false; } @@ -83,7 +83,7 @@ public static function check(Validator $validator, $minLimit = 0, $maxLimit = 1_ // Check if the random field value is similar to the token value $randomField = $formData[$token['random_field_name']]; - if (! ctype_digit($randomField) || $token['timestamp'] != $randomField) { + if (! \ctype_digit($randomField) || $token['timestamp'] != $randomField) { return false; } @@ -107,10 +107,10 @@ private static function getToken($captcha) return false; } - $token = @unserialize($token); + $token = @\unserialize($token); // Token is null or unserializable - if (! $token || ! is_array($token) || empty($token)) { + if (! $token || ! \is_array($token) || empty($token)) { return false; } @@ -118,9 +118,9 @@ private static function getToken($captcha) if (empty($token['session_id']) || empty($token['ip']) || empty($token['user_agent']) || - $token['session_id'] !== session()->getId() || - $token['ip'] !== request()->ip() || - $token['user_agent'] !== request()->header('User-Agent') + $token['session_id'] !== \session()->getId() || + $token['ip'] !== \request()->ip() || + $token['user_agent'] !== \request()->header('User-Agent') ) { return false; } diff --git a/app/Helpers/LanguageCensor.php b/app/Helpers/LanguageCensor.php index 6734e986e7..503bb465ba 100644 --- a/app/Helpers/LanguageCensor.php +++ b/app/Helpers/LanguageCensor.php @@ -27,22 +27,22 @@ class LanguageCensor protected static function isSpecial($c) { - return strpos(self::SPECIAL_CHARS, $c) !== false; + return \strpos(self::SPECIAL_CHARS, $c) !== false; } protected static function matchWordIndexes($string, $word) { $result = []; - $length = strlen($word); - $string_length = strlen($string); - $pos = stripos($string, $word, 0); + $length = \strlen($word); + $string_length = \strlen($string); + $pos = \stripos($string, $word, 0); while ($pos !== false) { $prev = ($pos === 0) ? ' ' : $string[$pos - 1]; $last = ($pos + $length) < $string_length ? $string[$pos + $length] : ' '; if (self::isSpecial($prev) && self::isSpecial($last)) { $result[] = $pos; } - $pos = stripos($string, $word, $pos + $length); + $pos = \stripos($string, $word, $pos + $length); } return $result; @@ -57,18 +57,18 @@ protected static function matchWordIndexes($string, $word) */ public static function censor($source) { - $redactArray = config('censor.redact', []); + $redactArray = \config('censor.redact', []); foreach ($redactArray as $word) { $result = ''; - $length = strlen($source); - $word_length = strlen($word); - assert($word_length > 0); + $length = \strlen($source); + $word_length = \strlen($word); + \assert($word_length > 0); $indexes = self::matchWordIndexes($source, $word); $ignore = 0; for ($i = 0; $i < $length; $i++) { - if ((is_countable($indexes) ? count($indexes) : 0) > 0 && $indexes[0] == $i) { - $match = substr($source, $indexes[0], $word_length); - $result .= sprintf("%s", $match); + if ((\is_countable($indexes) ? \count($indexes) : 0) > 0 && $indexes[0] == $i) { + $match = \substr($source, $indexes[0], $word_length); + $result .= \sprintf("%s", $match); $ignore = $word_length - 1; } elseif ($ignore > 0) { $ignore--; @@ -79,9 +79,9 @@ public static function censor($source) $source = $result; } - $replaceDict = config('censor.replace', []); + $replaceDict = \config('censor.replace', []); foreach ($replaceDict as $word => $replacement) { - $source = str_ireplace($word, $replacement, $source); + $source = \str_ireplace($word, $replacement, $source); } return $source; diff --git a/app/Helpers/Linkify.php b/app/Helpers/Linkify.php index 9b1724509f..626e0dfb04 100644 --- a/app/Helpers/Linkify.php +++ b/app/Helpers/Linkify.php @@ -22,8 +22,8 @@ class Linkify public function linky($text) { - if (preg_match(self::REG_EX_URL, $text, $url)) { - return preg_replace(self::REG_EX_URL, sprintf("%s ", $url[0], $url[0]), $text); + if (\preg_match(self::REG_EX_URL, $text, $url)) { + return \preg_replace(self::REG_EX_URL, \sprintf("%s ", $url[0], $url[0]), $text); } return $text; diff --git a/app/Helpers/Markdown.php b/app/Helpers/Markdown.php index 5084f0ed60..1b147fc7cc 100644 --- a/app/Helpers/Markdown.php +++ b/app/Helpers/Markdown.php @@ -26,19 +26,19 @@ public function text($text) $this->DefinitionData = []; // standardize line breaks - $text = str_replace(["\r\n", "\r"], "\n", $text); + $text = \str_replace(["\r\n", "\r"], "\n", $text); // remove surrounding line breaks - $text = trim($text, "\n"); + $text = \trim($text, "\n"); // split text into lines - $lines = explode("\n", $text); + $lines = \explode("\n", $text); // iterate through lines to identify blocks $markup = $this->lines($lines); // trim line breaks - $markup = trim($markup, "\n"); + $markup = \trim($markup, "\n"); return $markup; } @@ -145,7 +145,7 @@ protected function lines(array $lines) $CurrentBlock = null; foreach ($lines as $line) { - if (rtrim($line) === '') { + if (\rtrim($line) === '') { if (isset($CurrentBlock)) { $CurrentBlock['interrupted'] = true; } @@ -153,17 +153,17 @@ protected function lines(array $lines) continue; } - if (strpos($line, "\t") !== false) { - $parts = explode("\t", $line); + if (\strpos($line, "\t") !== false) { + $parts = \explode("\t", $line); $line = $parts[0]; unset($parts[0]); foreach ($parts as $part) { - $shortage = 4 - mb_strlen($line, 'utf-8') % 4; + $shortage = 4 - \mb_strlen($line, 'utf-8') % 4; - $line .= str_repeat(' ', $shortage); + $line .= \str_repeat(' ', $shortage); $line .= $part; } } @@ -174,7 +174,7 @@ protected function lines(array $lines) $indent++; } - $text = $indent > 0 ? substr($line, $indent) : $line; + $text = $indent > 0 ? \substr($line, $indent) : $line; // ~ @@ -279,12 +279,12 @@ protected function lines(array $lines) protected function isBlockContinuable($Type) { - return method_exists($this, 'block'.$Type.'Continue'); + return \method_exists($this, 'block'.$Type.'Continue'); } protected function isBlockCompletable($Type) { - return method_exists($this, 'block'.$Type.'Complete'); + return \method_exists($this, 'block'.$Type.'Complete'); } // @@ -297,7 +297,7 @@ protected function blockCode($Line, $Block = null) } if ($Line['indent'] >= 4) { - $text = substr($Line['body'], 4); + $text = \substr($Line['body'], 4); return [ 'element' => [ @@ -323,7 +323,7 @@ protected function blockCodeContinue($Line, $Block) $Block['element']['text']['text'] .= "\n"; - $text = substr($Line['body'], 4); + $text = \substr($Line['body'], 4); $Block['element']['text']['text'] .= $text; @@ -354,7 +354,7 @@ protected function blockComment($Line) 'markup' => $Line['body'], ]; - if (preg_match('#-->$#', $Line['text'])) { + if (\preg_match('#-->$#', $Line['text'])) { $Block['closed'] = true; } @@ -370,7 +370,7 @@ protected function blockCommentContinue($Line, array $Block) $Block['markup'] .= "\n".$Line['body']; - if (preg_match('#-->$#', $Line['text'])) { + if (\preg_match('#-->$#', $Line['text'])) { $Block['closed'] = true; } @@ -382,7 +382,7 @@ protected function blockCommentContinue($Line, array $Block) protected function blockFencedCode($Line) { - if (preg_match('/^['.$Line['text'][0].']{3,}[ ]*([^`]+)?[ ]*$/', $Line['text'], $matches)) { + if (\preg_match('/^['.$Line['text'][0].']{3,}[ ]*([^`]+)?[ ]*$/', $Line['text'], $matches)) { $Element = [ 'name' => 'code', 'text' => '', @@ -419,8 +419,8 @@ protected function blockFencedCodeContinue($Line, $Block) unset($Block['interrupted']); } - if (preg_match('/^'.$Block['char'].'{3,}[ ]*$/', $Line['text'])) { - $Block['element']['text']['text'] = substr($Block['element']['text']['text'], 1); + if (\preg_match('/^'.$Block['char'].'{3,}[ ]*$/', $Line['text'])) { + $Block['element']['text']['text'] = \substr($Block['element']['text']['text'], 1); $Block['complete'] = true; @@ -457,11 +457,11 @@ protected function blockHeader($Line) return; } - $text = trim($Line['text'], '# '); + $text = \trim($Line['text'], '# '); return [ 'element' => [ - 'name' => 'h'.min(6, $level), + 'name' => 'h'.\min(6, $level), 'text' => $text, 'handler' => 'line', ], @@ -476,7 +476,7 @@ protected function blockList($Line) { [$name, $pattern] = $Line['text'][0] <= '-' ? ['ul', '[*+-]'] : ['ol', '[0-9]+[.]']; - if (preg_match('/^('.$pattern.'[ ]+)(.*)/', $Line['text'], $matches)) { + if (\preg_match('/^('.$pattern.'[ ]+)(.*)/', $Line['text'], $matches)) { $Block = [ 'indent' => $Line['indent'], 'pattern' => $pattern, @@ -487,7 +487,7 @@ protected function blockList($Line) ]; if ($name === 'ol') { - $listStart = stristr($matches[0], '.', true); + $listStart = \stristr($matches[0], '.', true); if ($listStart !== '1') { $Block['element']['attributes'] = ['start' => $listStart]; @@ -510,7 +510,7 @@ protected function blockList($Line) protected function blockListContinue($Line, array $Block) { - if ($Block['indent'] === $Line['indent'] && preg_match('/^'.$Block['pattern'].'(?:[ ]+(.*)|$)/', $Line['text'], $matches)) { + if ($Block['indent'] === $Line['indent'] && \preg_match('/^'.$Block['pattern'].'(?:[ ]+(.*)|$)/', $Line['text'], $matches)) { if (isset($Block['interrupted'])) { $Block['li']['text'][] = ''; @@ -541,7 +541,7 @@ protected function blockListContinue($Line, array $Block) } if (! isset($Block['interrupted'])) { - $text = preg_replace('#^[ ]{0,4}#', '', $Line['body']); + $text = \preg_replace('#^[ ]{0,4}#', '', $Line['body']); $Block['li']['text'][] = $text; @@ -551,7 +551,7 @@ protected function blockListContinue($Line, array $Block) if ($Line['indent'] > 0) { $Block['li']['text'][] = ''; - $text = preg_replace('#^[ ]{0,4}#', '', $Line['body']); + $text = \preg_replace('#^[ ]{0,4}#', '', $Line['body']); $Block['li']['text'][] = $text; @@ -565,7 +565,7 @@ protected function blockListComplete(array $Block) { if (isset($Block['loose'])) { foreach ($Block['element']['text'] as &$li) { - if (end($li['text']) !== '') { + if (\end($li['text']) !== '') { $li['text'][] = ''; } } @@ -579,7 +579,7 @@ protected function blockListComplete(array $Block) protected function blockQuote($Line) { - if (preg_match('#^>[ ]?(.*)#', $Line['text'], $matches)) { + if (\preg_match('#^>[ ]?(.*)#', $Line['text'], $matches)) { return [ 'element' => [ 'name' => 'blockquote', @@ -592,7 +592,7 @@ protected function blockQuote($Line) protected function blockQuoteContinue($Line, array $Block) { - if ($Line['text'][0] === '>' && preg_match('#^>[ ]?(.*)#', $Line['text'], $matches)) { + if ($Line['text'][0] === '>' && \preg_match('#^>[ ]?(.*)#', $Line['text'], $matches)) { if (isset($Block['interrupted'])) { $Block['element']['text'][] = ''; @@ -616,7 +616,7 @@ protected function blockQuoteContinue($Line, array $Block) protected function blockRule($Line) { - if (preg_match('/^(['.$Line['text'][0].'])([ ]*\1){2,}[ ]*$/', $Line['text'])) { + if (\preg_match('/^(['.$Line['text'][0].'])([ ]*\1){2,}[ ]*$/', $Line['text'])) { return [ 'element' => [ 'name' => 'hr', @@ -634,7 +634,7 @@ protected function blockSetextHeader($Line, array $Block = null) return; } - if (rtrim($Line['text'], $Line['text'][0]) === '') { + if (\rtrim($Line['text'], $Line['text'][0]) === '') { $Block['element']['name'] = $Line['text'][0] === '=' ? 'h1' : 'h2'; return $Block; @@ -650,10 +650,10 @@ protected function blockMarkup($Line) return; } - if (preg_match('/^<(\w[\w-]*)(?:[ ]*'.$this->regexHtmlAttribute.')*[ ]*(\/)?>/', $Line['text'], $matches)) { - $element = strtolower($matches[1]); + if (\preg_match('/^<(\w[\w-]*)(?:[ ]*'.$this->regexHtmlAttribute.')*[ ]*(\/)?>/', $Line['text'], $matches)) { + $element = \strtolower($matches[1]); - if (in_array($element, $this->textLevelElements)) { + if (\in_array($element, $this->textLevelElements)) { return; } @@ -663,22 +663,22 @@ protected function blockMarkup($Line) 'markup' => $Line['text'], ]; - $length = strlen($matches[0]); + $length = \strlen($matches[0]); - $remainder = substr($Line['text'], $length); + $remainder = \substr($Line['text'], $length); - if (trim($remainder) === '') { - if (isset($matches[2]) || in_array($matches[1], $this->voidElements)) { + if (\trim($remainder) === '') { + if (isset($matches[2]) || \in_array($matches[1], $this->voidElements)) { $Block['closed'] = true; $Block['void'] = true; } } else { - if (isset($matches[2]) || in_array($matches[1], $this->voidElements)) { + if (isset($matches[2]) || \in_array($matches[1], $this->voidElements)) { return; } - if (preg_match('/<\/'.$matches[1].'>[ ]*$/i', $remainder)) { + if (\preg_match('/<\/'.$matches[1].'>[ ]*$/i', $remainder)) { $Block['closed'] = true; } } @@ -693,11 +693,11 @@ protected function blockMarkupContinue($Line, array $Block) return; } - if (preg_match('/^<'.$Block['name'].'(?:[ ]*'.$this->regexHtmlAttribute.')*[ ]*>/i', $Line['text'])) { // open + if (\preg_match('/^<'.$Block['name'].'(?:[ ]*'.$this->regexHtmlAttribute.')*[ ]*>/i', $Line['text'])) { // open $Block['depth']++; } - if (preg_match('/(.*?)<\/'.$Block['name'].'>[ ]*$/i', $Line['text'], $matches)) { // close + if (\preg_match('/(.*?)<\/'.$Block['name'].'>[ ]*$/i', $Line['text'], $matches)) { // close if ($Block['depth'] > 0) { $Block['depth']--; } else { @@ -721,8 +721,8 @@ protected function blockMarkupContinue($Line, array $Block) protected function blockReference($Line) { - if (preg_match('#^\[(.+?)\]:[ ]*?(?:[ ]+["\'(](.+)["\')])?[ ]*$#', $Line['text'], $matches)) { - $id = strtolower($matches[1]); + if (\preg_match('#^\[(.+?)\]:[ ]*?(?:[ ]+["\'(](.+)["\')])?[ ]*$#', $Line['text'], $matches)) { + $id = \strtolower($matches[1]); $Data = [ 'url' => $matches[2], @@ -750,18 +750,18 @@ protected function blockTable($Line, array $Block = null) return; } - if (strpos($Block['element']['text'], '|') !== false && rtrim($Line['text'], ' -:|') === '') { + if (\strpos($Block['element']['text'], '|') !== false && \rtrim($Line['text'], ' -:|') === '') { $alignments = []; $divider = $Line['text']; - $divider = trim($divider); - $divider = trim($divider, '|'); + $divider = \trim($divider); + $divider = \trim($divider, '|'); - $dividerCells = explode('|', $divider); + $dividerCells = \explode('|', $divider); foreach ($dividerCells as $dividerCell) { - $dividerCell = trim($dividerCell); + $dividerCell = \trim($dividerCell); if ($dividerCell === '') { continue; @@ -773,7 +773,7 @@ protected function blockTable($Line, array $Block = null) $alignment = 'left'; } - if (substr($dividerCell, -1) === ':') { + if (\substr($dividerCell, -1) === ':') { $alignment = $alignment === 'left' ? 'center' : 'right'; } @@ -786,13 +786,13 @@ protected function blockTable($Line, array $Block = null) $header = $Block['element']['text']; - $header = trim($header); - $header = trim($header, '|'); + $header = \trim($header); + $header = \trim($header, '|'); - $headerCells = explode('|', $header); + $headerCells = \explode('|', $header); foreach ($headerCells as $index => $headerCell) { - $headerCell = trim($headerCell); + $headerCell = \trim($headerCell); $HeaderElement = [ 'name' => 'th', @@ -849,18 +849,18 @@ protected function blockTableContinue($Line, array $Block) return; } - if ($Line['text'][0] === '|' || strpos($Line['text'], '|')) { + if ($Line['text'][0] === '|' || \strpos($Line['text'], '|')) { $Elements = []; $row = $Line['text']; - $row = trim($row); - $row = trim($row, '|'); + $row = \trim($row); + $row = \trim($row, '|'); - preg_match_all('#(?:(\\\[|])|[^|`]|`[^`]+`|`)+#', $row, $matches); + \preg_match_all('#(?:(\\\[|])|[^|`]|`[^`]+`|`)+#', $row, $matches); foreach ($matches[0] as $index => $cell) { - $cell = trim($cell); + $cell = \trim($cell); $Element = [ 'name' => 'td', @@ -937,17 +937,17 @@ public function line($text, $nonNestables = []) // $excerpt is based on the first occurrence of a marker - while ($excerpt = strpbrk($text, $this->inlineMarkerList)) { + while ($excerpt = \strpbrk($text, $this->inlineMarkerList)) { $marker = $excerpt[0]; - $markerPosition = strpos($text, $marker); + $markerPosition = \strpos($text, $marker); $Excerpt = ['text' => $excerpt, 'context' => $text]; foreach ($this->InlineTypes[$marker] as $inlineType) { // check to see if the current inline type is nestable in the current context - if (! empty($nonNestables) && in_array($inlineType, $nonNestables)) { + if (! empty($nonNestables) && \in_array($inlineType, $nonNestables)) { continue; } @@ -976,7 +976,7 @@ public function line($text, $nonNestables = []) } // the text that comes before the inline - $unmarkedText = substr($text, 0, $Inline['position']); + $unmarkedText = \substr($text, 0, $Inline['position']); // compile the unmarked text $markup .= $this->unmarkedText($unmarkedText); @@ -985,18 +985,18 @@ public function line($text, $nonNestables = []) $markup .= $Inline['markup'] ?? $this->element($Inline['element']); // remove the examined text - $text = substr($text, $Inline['position'] + $Inline['extent']); + $text = \substr($text, $Inline['position'] + $Inline['extent']); continue 2; } // the marker does not belong to an inline - $unmarkedText = substr($text, 0, $markerPosition + 1); + $unmarkedText = \substr($text, 0, $markerPosition + 1); $markup .= $this->unmarkedText($unmarkedText); - $text = substr($text, $markerPosition + 1); + $text = \substr($text, $markerPosition + 1); } return $markup.$this->unmarkedText($text); @@ -1010,12 +1010,12 @@ protected function inlineCode($Excerpt) { $marker = $Excerpt['text'][0]; - if (preg_match('/^('.$marker.'+)[ ]*(.+?)[ ]*(? strlen($matches[0]), + 'extent' => \strlen($matches[0]), 'element' => [ 'name' => 'code', 'text' => $text, @@ -1026,7 +1026,7 @@ protected function inlineCode($Excerpt) protected function inlineEmailTag($Excerpt) { - if (strpos($Excerpt['text'], '>') !== false && preg_match('#^<((mailto:)?\S+?@\S+?)>#i', $Excerpt['text'], $matches)) { + if (\strpos($Excerpt['text'], '>') !== false && \preg_match('#^<((mailto:)?\S+?@\S+?)>#i', $Excerpt['text'], $matches)) { $url = $matches[1]; if (! isset($matches[2])) { @@ -1034,7 +1034,7 @@ protected function inlineEmailTag($Excerpt) } return [ - 'extent' => strlen($matches[0]), + 'extent' => \strlen($matches[0]), 'element' => [ 'name' => 'a', 'text' => $matches[1], @@ -1054,16 +1054,16 @@ protected function inlineEmphasis($Excerpt) $marker = $Excerpt['text'][0]; - if ($Excerpt['text'][1] === $marker && preg_match($this->StrongRegex[$marker], $Excerpt['text'], $matches)) { + if ($Excerpt['text'][1] === $marker && \preg_match($this->StrongRegex[$marker], $Excerpt['text'], $matches)) { $emphasis = 'strong'; - } elseif (preg_match($this->EmRegex[$marker], $Excerpt['text'], $matches)) { + } elseif (\preg_match($this->EmRegex[$marker], $Excerpt['text'], $matches)) { $emphasis = 'em'; } else { return; } return [ - 'extent' => strlen($matches[0]), + 'extent' => \strlen($matches[0]), 'element' => [ 'name' => $emphasis, 'handler' => 'line', @@ -1074,7 +1074,7 @@ protected function inlineEmphasis($Excerpt) protected function inlineEscapeSequence($Excerpt) { - if (isset($Excerpt['text'][1]) && in_array($Excerpt['text'][1], $this->specialCharacters)) { + if (isset($Excerpt['text'][1]) && \in_array($Excerpt['text'][1], $this->specialCharacters)) { return [ 'markup' => $Excerpt['text'][1], 'extent' => 2, @@ -1088,7 +1088,7 @@ protected function inlineImage($Excerpt) return; } - $Excerpt['text'] = substr($Excerpt['text'], 1); + $Excerpt['text'] = \substr($Excerpt['text'], 1); $Link = $this->inlineLink($Excerpt); @@ -1131,32 +1131,32 @@ protected function inlineLink($Excerpt) $remainder = $Excerpt['text']; - if (preg_match('#\[((?:[^][]++|(?R))*+)\]#', $remainder, $matches)) { + if (\preg_match('#\[((?:[^][]++|(?R))*+)\]#', $remainder, $matches)) { $Element['text'] = $matches[1]; - $extent += strlen($matches[0]); + $extent += \strlen($matches[0]); - $remainder = substr($remainder, $extent); + $remainder = \substr($remainder, $extent); } else { return; } - if (preg_match('#^[(]\s*+((?:[^ ()]++|[(][^ )]+[)])++)(?:[ ]+("[^"]*"|\'[^\']*\'))?\s*[)]#', $remainder, $matches)) { + if (\preg_match('#^[(]\s*+((?:[^ ()]++|[(][^ )]+[)])++)(?:[ ]+("[^"]*"|\'[^\']*\'))?\s*[)]#', $remainder, $matches)) { $Element['attributes']['href'] = $matches[1]; if (isset($matches[2])) { - $Element['attributes']['title'] = substr($matches[2], 1, -1); + $Element['attributes']['title'] = \substr($matches[2], 1, -1); } - $extent += strlen($matches[0]); + $extent += \strlen($matches[0]); } else { - if (preg_match('#^\s*\[(.*?)\]#', $remainder, $matches)) { - $definition = strlen($matches[1]) !== 0 ? $matches[1] : $Element['text']; - $definition = strtolower($definition); + if (\preg_match('#^\s*\[(.*?)\]#', $remainder, $matches)) { + $definition = \strlen($matches[1]) !== 0 ? $matches[1] : $Element['text']; + $definition = \strtolower($definition); - $extent += strlen($matches[0]); + $extent += \strlen($matches[0]); } else { - $definition = strtolower($Element['text']); + $definition = \strtolower($Element['text']); } if (! isset($this->DefinitionData['Reference'][$definition])) { @@ -1177,35 +1177,35 @@ protected function inlineLink($Excerpt) protected function inlineMarkup($Excerpt) { - if ($this->markupEscaped || $this->safeMode || strpos($Excerpt['text'], '>') === false) { + if ($this->markupEscaped || $this->safeMode || \strpos($Excerpt['text'], '>') === false) { return; } - if ($Excerpt['text'][1] === '/' && preg_match('#^<\/\w[\w-]*[ ]*>#s', $Excerpt['text'], $matches)) { + if ($Excerpt['text'][1] === '/' && \preg_match('#^<\/\w[\w-]*[ ]*>#s', $Excerpt['text'], $matches)) { return [ 'markup' => $matches[0], - 'extent' => strlen($matches[0]), + 'extent' => \strlen($matches[0]), ]; } - if ($Excerpt['text'][1] === '!' && preg_match('#^#s', $Excerpt['text'], $matches)) { + if ($Excerpt['text'][1] === '!' && \preg_match('#^#s', $Excerpt['text'], $matches)) { return [ 'markup' => $matches[0], - 'extent' => strlen($matches[0]), + 'extent' => \strlen($matches[0]), ]; } - if ($Excerpt['text'][1] !== ' ' && preg_match('/^<\w[\w-]*(?:[ ]*'.$this->regexHtmlAttribute.')*[ ]*\/?>/s', $Excerpt['text'], $matches)) { + if ($Excerpt['text'][1] !== ' ' && \preg_match('/^<\w[\w-]*(?:[ ]*'.$this->regexHtmlAttribute.')*[ ]*\/?>/s', $Excerpt['text'], $matches)) { return [ 'markup' => $matches[0], - 'extent' => strlen($matches[0]), + 'extent' => \strlen($matches[0]), ]; } } protected function inlineSpecialCharacter($Excerpt) { - if ($Excerpt['text'][0] === '&' && ! preg_match('#^&#?\w+;#', $Excerpt['text'])) { + if ($Excerpt['text'][0] === '&' && ! \preg_match('#^&#?\w+;#', $Excerpt['text'])) { return [ 'markup' => '&', 'extent' => 1, @@ -1226,9 +1226,9 @@ protected function inlineStrikethrough($Excerpt) return; } - if ($Excerpt['text'][1] === '~' && preg_match('#^~~(?=\S)(.+?)(?<=\S)~~#', $Excerpt['text'], $matches)) { + if ($Excerpt['text'][1] === '~' && \preg_match('#^~~(?=\S)(.+?)(?<=\S)~~#', $Excerpt['text'], $matches)) { return [ - 'extent' => strlen($matches[0]), + 'extent' => \strlen($matches[0]), 'element' => [ 'name' => 'del', 'text' => $matches[1], @@ -1244,11 +1244,11 @@ protected function inlineUrl($Excerpt) return; } - if (preg_match('#\bhttps?:[\/]{2}[^\s<]+\b\/*#ui', $Excerpt['context'], $matches, PREG_OFFSET_CAPTURE)) { + if (\preg_match('#\bhttps?:[\/]{2}[^\s<]+\b\/*#ui', $Excerpt['context'], $matches, PREG_OFFSET_CAPTURE)) { $url = $matches[0][0]; return [ - 'extent' => strlen($matches[0][0]), + 'extent' => \strlen($matches[0][0]), 'position' => $matches[0][1], 'element' => [ 'name' => 'a', @@ -1263,11 +1263,11 @@ protected function inlineUrl($Excerpt) protected function inlineUrlTag($Excerpt) { - if (strpos($Excerpt['text'], '>') !== false && preg_match('#^<(\w+:\/{2}[^ >]+)>#i', $Excerpt['text'], $matches)) { + if (\strpos($Excerpt['text'], '>') !== false && \preg_match('#^<(\w+:\/{2}[^ >]+)>#i', $Excerpt['text'], $matches)) { $url = $matches[1]; return [ - 'extent' => strlen($matches[0]), + 'extent' => \strlen($matches[0]), 'element' => [ 'name' => 'a', 'text' => $url, @@ -1284,11 +1284,11 @@ protected function inlineUrlTag($Excerpt) protected function unmarkedText($text) { if ($this->breaksEnabled) { - return preg_replace('#[ ]*\n#', "
\n", $text); + return \preg_replace('#[ ]*\n#', "
\n", $text); } - $text = preg_replace('#(?:[ ][ ]+|[ ]*\\\)\n#', "
\n", $text); + $text = \preg_replace('#(?:[ ][ ]+|[ ]*\\\)\n#', "
\n", $text); - return str_replace(" \n", "\n", $text); + return \str_replace(" \n", "\n", $text); } // @@ -1351,15 +1351,15 @@ protected function li($lines) { $markup = $this->lines($lines); - $trimmedMarkup = trim($markup); + $trimmedMarkup = \trim($markup); - if (! in_array('', $lines) && substr($trimmedMarkup, 0, 3) === '

') { + if (! \in_array('', $lines) && \substr($trimmedMarkup, 0, 3) === '

') { $markup = $trimmedMarkup; - $markup = substr($markup, 3); + $markup = \substr($markup, 3); - $position = strpos($markup, '

'); + $position = \strpos($markup, '

'); - $markup = substr_replace($markup, '', $position, 4); + $markup = \substr_replace($markup, '', $position, 4); } return $markup; @@ -1387,9 +1387,9 @@ protected function sanitiseElement(array $Element) } if (! empty($Element['attributes'])) { - foreach (array_keys($Element['attributes']) as $att) { + foreach (\array_keys($Element['attributes']) as $att) { // filter out badly parsed attribute - if (! preg_match($goodAttribute, $att)) { + if (! \preg_match($goodAttribute, $att)) { unset($Element['attributes'][$att]); } // dump onevent attribute @@ -1410,7 +1410,7 @@ protected function filterUnsafeUrlInAttribute(array $Element, $attribute) } } - $Element['attributes'][$attribute] = str_replace(':', '%3A', $Element['attributes'][$attribute]); + $Element['attributes'][$attribute] = \str_replace(':', '%3A', $Element['attributes'][$attribute]); return $Element; } @@ -1421,18 +1421,18 @@ protected function filterUnsafeUrlInAttribute(array $Element, $attribute) protected static function escape($text, $allowQuotes = false) { - return htmlspecialchars($text, $allowQuotes ? ENT_NOQUOTES : ENT_QUOTES, 'UTF-8'); + return \htmlspecialchars($text, $allowQuotes ? ENT_NOQUOTES : ENT_QUOTES, 'UTF-8'); } protected static function striAtStart($string, $needle) { - $len = strlen($needle); + $len = \strlen($needle); - if ($len > strlen($string)) { + if ($len > \strlen($string)) { return false; } - return strtolower(substr($string, 0, $len)) === strtolower($needle); + return \strtolower(\substr($string, 0, $len)) === \strtolower($needle); } public static function instance($name = 'default') diff --git a/app/Helpers/MediaInfo.php b/app/Helpers/MediaInfo.php index 3b5232e81e..17f9a5c663 100644 --- a/app/Helpers/MediaInfo.php +++ b/app/Helpers/MediaInfo.php @@ -37,13 +37,13 @@ class MediaInfo public function parse($string) { - $string = trim($string); - $lines = preg_split("/\r\n|\n|\r/", $string); + $string = \trim($string); + $lines = \preg_split("/\r\n|\n|\r/", $string); $output = []; foreach ($lines as $line) { - $line = trim($line); // removed strtolower, unnecessary with the i-switch in the regexp (caseless) and adds problems with values; added it in the required places instead. - if (preg_match(self::REGEX_SECTION, $line)) { + $line = \trim($line); // removed strtolower, unnecessary with the i-switch in the regexp (caseless) and adds problems with values; added it in the required places instead. + if (\preg_match(self::REGEX_SECTION, $line)) { $section = $line; $output[$section] = []; } @@ -52,7 +52,7 @@ public function parse($string) } } - if (count($output) > 0) { + if (\count($output) > 0) { $output = $this->parseSections($output); } @@ -63,7 +63,7 @@ private function parseSections(array $sections) { $output = []; foreach ($sections as $key => $section) { - $key_section = strtolower(explode(' ', $key)[0]); + $key_section = \strtolower(\explode(' ', $key)[0]); if (! empty($section)) { if ($key_section === 'general') { $output[$key_section] = $this->parseProperty($section, $key_section); @@ -82,13 +82,13 @@ private function parseProperty($sections, $section) foreach ($sections as $info) { $property = null; $value = null; - $info = explode(':', $info, 2); - if (count($info) >= 2) { - $property = trim(strtolower($info[0])); - $value = trim($info[1]); + $info = \explode(':', $info, 2); + if (\count($info) >= 2) { + $property = \trim(\strtolower($info[0])); + $value = \trim($info[1]); } if ($property && $value) { - switch (strtolower($section)) { + switch (\strtolower($section)) { case 'general': switch ($property) { case 'complete name': @@ -165,7 +165,7 @@ private function parseProperty($sections, $section) break; case 'display aspect ratio': case 'displayaspectratio': - $output['aspect_ratio'] = str_replace('/', ':', $value); // mediainfo sometimes uses / instead of : + $output['aspect_ratio'] = \str_replace('/', ':', $value); // mediainfo sometimes uses / instead of : break; case 'bit rate': case 'bitrate': @@ -301,8 +301,8 @@ private function parseProperty($sections, $section) public static function stripPath($string) { - $string = str_replace('\\', '/', $string); - $path_parts = pathinfo($string); + $string = \str_replace('\\', '/', $string); + $path_parts = \pathinfo($string); return $path_parts['basename']; } @@ -310,7 +310,7 @@ public static function stripPath($string) private function parseFileSize($string) { $number = (float) $string; - preg_match('#[KMGTPEZ]#i', $string, $size); + \preg_match('#[KMGTPEZ]#i', $string, $size); if (! empty($size[0])) { $number = $this->computerSize($number, $size[0].'b'); } @@ -320,19 +320,19 @@ private function parseFileSize($string) private function parseBitRate($string) { - $string = str_replace(' ', '', strtolower($string)); + $string = \str_replace(' ', '', \strtolower($string)); - return str_replace('kbps', ' kbps', $string); + return \str_replace('kbps', ' kbps', $string); } private function parseWidthHeight($string) { - return str_replace(['pixels', ' '], null, strtolower($string)); + return \str_replace(['pixels', ' '], null, \strtolower($string)); } private function parseAudioChannels($string) { - return str_ireplace(array_keys(self::REPLACE), self::REPLACE, $string); + return \str_ireplace(\array_keys(self::REPLACE), self::REPLACE, $string); } private function formatOutput($data) @@ -356,7 +356,7 @@ public function prepareViewCrumbs($data) $output['general'] = null; } else { if (isset($data['general']['format'])) { - $output['general'][] = ucfirst($data['general']['format']); + $output['general'][] = \ucfirst($data['general']['format']); } if (isset($data['general']['duration'])) { $output['general'][] = $data['general']['duration']; @@ -370,7 +370,7 @@ public function prepareViewCrumbs($data) foreach ($data['video'] as $video_element) { $temp_video_output = []; if (isset($video_element['format'])) { - $temp_video_output[] = strtoupper($video_element['format']); + $temp_video_output[] = \strtoupper($video_element['format']); } if (isset($video_element['width']) && isset($video_element['height'])) { $temp_video_output[] = $video_element['width'].' x '.$video_element['height']; @@ -420,7 +420,7 @@ public function prepareViewCrumbs($data) $temp_text_output[] = $text_element[$property]; } } - if (isset($text_element['forced']) && strtolower($text_element['forced']) === 'yes') { + if (isset($text_element['forced']) && \strtolower($text_element['forced']) === 'yes') { $temp_text_output[] = 'Forced'; } @@ -442,10 +442,10 @@ private function parseAudioFormat($string) private function computerSize($number, $size) { $bytes = (float) $number; - $size = strtolower($size); + $size = \strtolower($size); if (isset(self::FACTORS[$size])) { - return (float) number_format($bytes * pow(1_024, self::FACTORS[$size]), 2, '.', ''); + return (float) \number_format($bytes * \pow(1_024, self::FACTORS[$size]), 2, '.', ''); } return $bytes; diff --git a/app/Helpers/StringHelper.php b/app/Helpers/StringHelper.php index 38add2e3db..3a41d68e20 100644 --- a/app/Helpers/StringHelper.php +++ b/app/Helpers/StringHelper.php @@ -39,7 +39,7 @@ public static function generateRandomString($length = 20) { $string = ''; for ($i = 0; $i < $length; $i++) { - $string .= self::CHARACTERS[rand(0, strlen(self::CHARACTERS) - 1)]; + $string .= self::CHARACTERS[\rand(0, \strlen(self::CHARACTERS) - 1)]; } return $string; @@ -47,7 +47,7 @@ public static function generateRandomString($length = 20) public static function formatBytes($bytes, $precision = 2) { - $bytes = max($bytes, 0); + $bytes = \max($bytes, 0); $suffix = 'B'; $value = $bytes; if ($bytes >= self::PIB) { @@ -67,7 +67,7 @@ public static function formatBytes($bytes, $precision = 2) $value = $bytes / self::KIB; } - return round($value, $precision).' '.$suffix; + return \round($value, $precision).' '.$suffix; } /** @@ -86,7 +86,7 @@ public static function timeRemaining($seconds) $months = 0; $years = 0; - $seconds = config('hitrun.seedtime') - $seconds; + $seconds = \config('hitrun.seedtime') - $seconds; if ($seconds == 0) { return 'N/A'; @@ -115,13 +115,13 @@ public static function timeRemaining($seconds) $minutes++; $seconds -= 60; } - $years = ($years === 0) ? '' : $years.trans('common.abbrev-years'); - $months = ($months === 0) ? '' : $months.trans('common.abbrev-months'); - $weeks = ($weeks === 0) ? '' : $weeks.trans('common.abbrev-weeks'); - $days = ($days === 0) ? '' : $days.trans('common.abbrev-days'); - $hours = ($hours === 0) ? '' : $hours.trans('common.abbrev-hours'); - $minutes = ($minutes === 0) ? '' : $minutes.trans('common.abbrev-minutes'); - $seconds = ($seconds == 0) ? '' : $seconds.trans('common.abbrev-seconds'); + $years = ($years === 0) ? '' : $years.\trans('common.abbrev-years'); + $months = ($months === 0) ? '' : $months.\trans('common.abbrev-months'); + $weeks = ($weeks === 0) ? '' : $weeks.\trans('common.abbrev-weeks'); + $days = ($days === 0) ? '' : $days.\trans('common.abbrev-days'); + $hours = ($hours === 0) ? '' : $hours.\trans('common.abbrev-hours'); + $minutes = ($minutes === 0) ? '' : $minutes.\trans('common.abbrev-minutes'); + $seconds = ($seconds == 0) ? '' : $seconds.\trans('common.abbrev-seconds'); return $years.$months.$weeks.$days.$hours.$minutes.$seconds; } @@ -169,13 +169,13 @@ public static function timeElapsed($seconds) $minutes++; $seconds -= 60; } - $years = ($years === 0) ? '' : $years.trans('common.abbrev-years'); - $months = ($months === 0) ? '' : $months.trans('common.abbrev-months'); - $weeks = ($weeks === 0) ? '' : $weeks.trans('common.abbrev-weeks'); - $days = ($days === 0) ? '' : $days.trans('common.abbrev-days'); - $hours = ($hours === 0) ? '' : $hours.trans('common.abbrev-hours'); - $minutes = ($minutes === 0) ? '' : $minutes.trans('common.abbrev-minutes'); - $seconds = ($seconds == 0) ? '' : $seconds.trans('common.abbrev-seconds'); + $years = ($years === 0) ? '' : $years.\trans('common.abbrev-years'); + $months = ($months === 0) ? '' : $months.\trans('common.abbrev-months'); + $weeks = ($weeks === 0) ? '' : $weeks.\trans('common.abbrev-weeks'); + $days = ($days === 0) ? '' : $days.\trans('common.abbrev-days'); + $hours = ($hours === 0) ? '' : $hours.\trans('common.abbrev-hours'); + $minutes = ($minutes === 0) ? '' : $minutes.\trans('common.abbrev-minutes'); + $seconds = ($seconds == 0) ? '' : $seconds.\trans('common.abbrev-seconds'); return $years.$months.$weeks.$days.$hours.$minutes.$seconds; } diff --git a/app/Helpers/SystemInformation.php b/app/Helpers/SystemInformation.php index aa709afa14..a234ba52ac 100644 --- a/app/Helpers/SystemInformation.php +++ b/app/Helpers/SystemInformation.php @@ -35,18 +35,18 @@ class SystemInformation public function avg() { - if (is_readable('/proc/loadavg')) { - return (float) file_get_contents('/proc/loadavg'); + if (\is_readable('/proc/loadavg')) { + return (float) \file_get_contents('/proc/loadavg'); } } public function memory() { - if (is_readable('/proc/meminfo')) { - $content = file_get_contents('/proc/meminfo'); - preg_match('#^MemTotal: \s*(\d*)#m', $content, $matches); + if (\is_readable('/proc/meminfo')) { + $content = \file_get_contents('/proc/meminfo'); + \preg_match('#^MemTotal: \s*(\d*)#m', $content, $matches); $total = $matches[1] * 1_024; - preg_match('#^MemFree: \s*(\d*)#m', $content, $matches); + \preg_match('#^MemFree: \s*(\d*)#m', $content, $matches); $free = $matches[1] * 1_024; //preg_match('/^MemAvailable: \s*(\d*)/m', $content, $matches); //$used = $this->formatBytes($matches[1] * 1024); @@ -67,20 +67,20 @@ public function memory() protected function formatBytes($bytes, $precision = 2) { - $bytes = max($bytes, 0); - $pow = floor(($bytes ? log($bytes) : 0) / log(1_024)); - $pow = min($pow, count(self::UNITS) - 1); + $bytes = \max($bytes, 0); + $pow = \floor(($bytes ? \log($bytes) : 0) / \log(1_024)); + $pow = \min($pow, \count(self::UNITS) - 1); // Uncomment one of the following alternatives - $bytes /= pow(1_024, $pow); + $bytes /= \pow(1_024, $pow); // $bytes /= (1 << (10 * $pow)); - return round($bytes, $precision).' '.self::UNITS[$pow]; + return \round($bytes, $precision).' '.self::UNITS[$pow]; } public function disk() { - $total = disk_total_space(base_path()); - $free = disk_free_space(base_path()); + $total = \disk_total_space(\base_path()); + $free = \disk_free_space(\base_path()); return [ 'total' => $this->formatBytes($total), @@ -91,8 +91,8 @@ public function disk() public function uptime() { - if (is_readable('/proc/uptime')) { - return (float) file_get_contents('/proc/uptime'); + if (\is_readable('/proc/uptime')) { + return (float) \file_get_contents('/proc/uptime'); } } @@ -104,16 +104,16 @@ public function systemTime(): Carbon public function basic() { return [ - 'os' => php_uname('s'), - 'php' => phpversion(), + 'os' => \php_uname('s'), + 'php' => \phpversion(), 'database' => $this->getDatabase(), - 'laravel' => app()->version(), + 'laravel' => \app()->version(), ]; } private function getDatabase() { - if (! in_array(config('database.default'), self::KNOWN_DATABASES)) { + if (! \in_array(\config('database.default'), self::KNOWN_DATABASES)) { return 'Unkown'; } $results = DB::select(DB::raw('select version()')); @@ -130,22 +130,22 @@ public function directoryPermissions() { return [ [ - 'directory' => base_path('bootstrap/cache'), + 'directory' => \base_path('bootstrap/cache'), 'permission' => $this->getDirectoryPermission('bootstrap/cache'), 'recommended' => '0775', ], [ - 'directory' => base_path('public'), + 'directory' => \base_path('public'), 'permission' => $this->getDirectoryPermission('public'), 'recommended' => '0775', ], [ - 'directory' => base_path('storage'), + 'directory' => \base_path('storage'), 'permission' => $this->getDirectoryPermission('storage'), 'recommended' => '0775', ], [ - 'directory' => base_path('vendor'), + 'directory' => \base_path('vendor'), 'permission' => $this->getDirectoryPermission('vendor'), 'recommended' => '0775', ], @@ -162,9 +162,9 @@ public function directoryPermissions() public function getDirectoryPermission($path) { try { - return substr(sprintf('%o', fileperms(base_path($path))), -4); + return \substr(\sprintf('%o', \fileperms(\base_path($path))), -4); } catch (\Exception $ex) { - return trans('site.error'); + return \trans('site.error'); } } } diff --git a/app/Helpers/TorrentHelper.php b/app/Helpers/TorrentHelper.php index f2a0d57e4e..5ba01706ab 100644 --- a/app/Helpers/TorrentHelper.php +++ b/app/Helpers/TorrentHelper.php @@ -38,8 +38,8 @@ class TorrentHelper { public static function approveHelper($id) { - $appurl = config('app.url'); - $appname = config('app.name'); + $appurl = \config('app.url'); + $appname = \config('app.name'); Torrent::approve($id); $torrent = Torrent::with('uploader')->withAnyStatus()->where('id', '=', $id)->first(); @@ -51,7 +51,7 @@ public static function approveHelper($id) $wishes = Wish::where('imdb', '=', 'tt'.$torrent->imdb)->whereNull('source')->get(); if ($wishes) { foreach ($wishes as $wish) { - $wish->source = sprintf('%s/torrents/%s', $appurl, $torrent->id); + $wish->source = \sprintf('%s/torrents/%s', $appurl, $torrent->id); $wish->save(); // Send Private Message @@ -59,7 +59,7 @@ public static function approveHelper($id) $pm->sender_id = 1; $pm->receiver_id = $wish->user_id; $pm->subject = 'Wish List Notice!'; - $pm->message = sprintf('The following item, %s, from your wishlist has been uploaded to %s! You can view it [url=%s/torrents/', $wish->title, $appname, $appurl).$torrent->id.'] HERE [/url] + $pm->message = \sprintf('The following item, %s, from your wishlist has been uploaded to %s! You can view it [url=%s/torrents/', $wish->title, $appname, $appurl).$torrent->id.'] HERE [/url] [color=red][b]THIS IS AN AUTOMATED SYSTEM MESSAGE, PLEASE DO NOT REPLY![/b][/color]'; $pm->save(); } @@ -98,17 +98,17 @@ public static function approveHelper($id) } // Announce To IRC - if (config('irc-bot.enabled') == true) { - $appname = config('app.name'); + if (\config('irc-bot.enabled') == true) { + $appname = \config('app.name'); $ircAnnounceBot = new IRCAnnounceBot(); if ($anon == 0) { - $ircAnnounceBot->message(config('irc-bot.channels'), '['.$appname.'] User '.$username.' has uploaded '.$torrent->name.' grab it now!'); - $ircAnnounceBot->message(config('irc-bot.channels'), '[Category: '.$torrent->category->name.'] [Type: '.$torrent->type->name.'] [Size:'.$torrent->getSize().']'); - $ircAnnounceBot->message(config('irc-bot.channels'), sprintf('[Link: %s/torrents/', $appurl).$id.']'); + $ircAnnounceBot->message(\config('irc-bot.channels'), '['.$appname.'] User '.$username.' has uploaded '.$torrent->name.' grab it now!'); + $ircAnnounceBot->message(\config('irc-bot.channels'), '[Category: '.$torrent->category->name.'] [Type: '.$torrent->type->name.'] [Size:'.$torrent->getSize().']'); + $ircAnnounceBot->message(\config('irc-bot.channels'), \sprintf('[Link: %s/torrents/', $appurl).$id.']'); } else { - $ircAnnounceBot->message(config('irc-bot.channels'), '['.$appname.'] An anonymous user has uploaded '.$torrent->name.' grab it now!'); - $ircAnnounceBot->message(config('irc-bot.channels'), '[Category: '.$torrent->category->name.'] [Type: '.$torrent->type->name.'] [Size: '.$torrent->getSize().']'); - $ircAnnounceBot->message(config('irc-bot.channels'), sprintf('[Link: %s/torrents/', $appurl).$id.']'); + $ircAnnounceBot->message(\config('irc-bot.channels'), '['.$appname.'] An anonymous user has uploaded '.$torrent->name.' grab it now!'); + $ircAnnounceBot->message(\config('irc-bot.channels'), '[Category: '.$torrent->category->name.'] [Type: '.$torrent->type->name.'] [Size: '.$torrent->getSize().']'); + $ircAnnounceBot->message(\config('irc-bot.channels'), \sprintf('[Link: %s/torrents/', $appurl).$id.']'); } } } diff --git a/app/Helpers/TorrentTools.php b/app/Helpers/TorrentTools.php index 02765d8600..4abe4f0563 100644 --- a/app/Helpers/TorrentTools.php +++ b/app/Helpers/TorrentTools.php @@ -38,23 +38,23 @@ public static function normalizeTorrent($torrentFile) // The PID will be set if an user downloads the torrent, but for // security purposes it's better to overwrite the user-provided // announce URL. - $announce = config('app.url'); + $announce = \config('app.url'); $announce .= '/announce/PID'; $result['announce'] = $announce; - $result['info']['source'] = config('torrent.source'); + $result['info']['source'] = \config('torrent.source'); $result['info']['private'] = 1; - $created_by = config('torrent.created_by', null); - $created_by_append = config('torrent.created_by_append', false); + $created_by = \config('torrent.created_by', null); + $created_by_append = \config('torrent.created_by_append', false); if ($created_by !== null) { - if ($created_by_append && array_key_exists('created by', $result)) { + if ($created_by_append && \array_key_exists('created by', $result)) { $c = $result['created by']; - $c = trim($c, '. '); + $c = \trim($c, '. '); $c .= '. '.$created_by; $created_by = $c; } $result['created by'] = $created_by; } - $comment = config('torrent.comment', null); + $comment = \config('torrent.comment', null); if ($comment !== null) { $result['comment'] = $comment; } @@ -72,8 +72,8 @@ public static function normalizeTorrent($torrentFile) public static function getFileCount($decodedTorrent) { // Multiple file torrent ? - if (array_key_exists('files', $decodedTorrent['info']) && (is_countable($decodedTorrent['info']['files']) ? count($decodedTorrent['info']['files']) : 0)) { - return is_countable($decodedTorrent['info']['files']) ? count($decodedTorrent['info']['files']) : 0; + if (\array_key_exists('files', $decodedTorrent['info']) && (\is_countable($decodedTorrent['info']['files']) ? \count($decodedTorrent['info']['files']) : 0)) { + return \is_countable($decodedTorrent['info']['files']) ? \count($decodedTorrent['info']['files']) : 0; } return 1; @@ -89,11 +89,11 @@ public static function getFileCount($decodedTorrent) public static function getTorrentSize($decodedTorrent) { $size = 0; - if (array_key_exists('files', $decodedTorrent['info']) && (is_countable($decodedTorrent['info']['files']) ? count($decodedTorrent['info']['files']) : 0)) { + if (\array_key_exists('files', $decodedTorrent['info']) && (\is_countable($decodedTorrent['info']['files']) ? \count($decodedTorrent['info']['files']) : 0)) { foreach ($decodedTorrent['info']['files'] as $k => $file) { $dir = ''; $size += $file['length']; - $count = is_countable($file['path']) ? count($file['path']) : 0; + $count = \is_countable($file['path']) ? \count($file['path']) : 0; } } else { $size = $decodedTorrent['info']['length']; @@ -112,10 +112,10 @@ public static function getTorrentSize($decodedTorrent) */ public static function getTorrentFiles($decodedTorrent) { - if (array_key_exists('files', $decodedTorrent['info']) && (is_countable($decodedTorrent['info']['files']) ? count($decodedTorrent['info']['files']) : 0)) { + if (\array_key_exists('files', $decodedTorrent['info']) && (\is_countable($decodedTorrent['info']['files']) ? \count($decodedTorrent['info']['files']) : 0)) { foreach ($decodedTorrent['info']['files'] as $k => $file) { $dir = ''; - $count = is_countable($file['path']) ? count($file['path']) : 0; + $count = \is_countable($file['path']) ? \count($file['path']) : 0; for ($i = 0; $i < $count; $i++) { if ($i + 1 === $count) { $fname = $dir.$file['path'][$i]; @@ -144,7 +144,7 @@ public static function getTorrentFiles($decodedTorrent) */ public static function getTorrentHash($decodedTorrent) { - return sha1(Bencode::bencode($decodedTorrent['info'])); + return \sha1(Bencode::bencode($decodedTorrent['info'])); } /** @@ -156,8 +156,8 @@ public static function getTorrentHash($decodedTorrent) */ public static function getTorrentFileCount($decodedTorrent) { - if (array_key_exists('files', $decodedTorrent['info'])) { - return is_countable($decodedTorrent['info']['files']) ? count($decodedTorrent['info']['files']) : 0; + if (\array_key_exists('files', $decodedTorrent['info'])) { + return \is_countable($decodedTorrent['info']['files']) ? \count($decodedTorrent['info']['files']) : 0; } return 1; @@ -172,11 +172,11 @@ public static function getTorrentFileCount($decodedTorrent) */ public static function getNfo($inputFile) { - $fileName = uniqid().'.nfo'; - $inputFile->move(getcwd().'/files/tmp/', $fileName); - if (file_exists(getcwd().'/files/tmp/'.$fileName)) { - $fileContent = file_get_contents(getcwd().'/files/tmp/'.$fileName); - unlink(getcwd().'/files/tmp/'.$fileName); + $fileName = \uniqid().'.nfo'; + $inputFile->move(\getcwd().'/files/tmp/', $fileName); + if (\file_exists(\getcwd().'/files/tmp/'.$fileName)) { + $fileContent = \file_get_contents(\getcwd().'/files/tmp/'.$fileName); + \unlink(\getcwd().'/files/tmp/'.$fileName); } else { $fileContent = null; } diff --git a/app/Http/Controllers/API/BaseController.php b/app/Http/Controllers/API/BaseController.php index 7a737710dd..5734cbcc43 100644 --- a/app/Http/Controllers/API/BaseController.php +++ b/app/Http/Controllers/API/BaseController.php @@ -25,7 +25,7 @@ public function sendResponse($result, $message) 'message' => $message, ]; - return response()->json($response, 200); + return \response()->json($response, 200); } public function sendError($error, $errorMessages = [], $code = 404) @@ -39,6 +39,6 @@ public function sendError($error, $errorMessages = [], $code = 404) $response['data'] = $errorMessages; } - return response()->json($response, $code); + return \response()->json($response, $code); } } diff --git a/app/Http/Controllers/API/ChatController.php b/app/Http/Controllers/API/ChatController.php index b5cac95e6c..80856b5c63 100644 --- a/app/Http/Controllers/API/ChatController.php +++ b/app/Http/Controllers/API/ChatController.php @@ -53,7 +53,7 @@ public function __construct(ChatRepository $chatRepository, \Illuminate\Contract /* STATUSES */ public function statuses() { - return response($this->chatRepository->statuses()); + return \response($this->chatRepository->statuses()); } /* ECHOES */ @@ -61,7 +61,7 @@ public function echoes() { $user = User::with(['echoes'])->findOrFail($this->authManager->user()->id); - if (! $user->echoes || (is_countable($user->echoes->toArray()) ? count($user->echoes->toArray()) : 0) < 1) { + if (! $user->echoes || (\is_countable($user->echoes->toArray()) ? \count($user->echoes->toArray()) : 0) < 1) { $userEcho = new UserEcho(); $userEcho->user_id = $this->authManager->user()->id; $userEcho->room_id = 1; @@ -76,7 +76,7 @@ public function audibles() { $user = User::with(['audibles'])->findOrFail($this->authManager->user()->id); - if (! $user->audibles || (is_countable($user->audibles->toArray()) ? count($user->audibles->toArray()) : 0) < 1) { + if (! $user->audibles || (\is_countable($user->audibles->toArray()) ? \count($user->audibles->toArray()) : 0) < 1) { $userAudible = new UserAudible(); $userAudible->user_id = $this->authManager->user()->id; $userAudible->room_id = 1; @@ -101,7 +101,7 @@ public function rooms() public function config() { - return response($this->chatRepository->config()); + return \response($this->chatRepository->config()); } /* MESSAGES */ @@ -143,71 +143,71 @@ public function createMessage(Request $request) $save = $request->get('save'); if ($user->can_chat === 0) { - return response('error', 401); + return \response('error', 401); } // Temp Fix For HTMLPurifier if ($message === '<') { - return response('error', 401); + return \response('error', 401); } $bot_dirty = 0; - $bots = cache()->get('bots'); - if (! $bots || ! is_array($bots) || count($bots) < 1) { + $bots = \cache()->get('bots'); + if (! $bots || ! \is_array($bots) || \count($bots) < 1) { $bots = Bot::where('active', '=', 1)->orderBy('position', 'asc')->get(); $bot_dirty = 1; } if ($bot_dirty == 1) { $expiresAt = Carbon::now()->addMinutes(60); - cache()->put('bots', $bots, $expiresAt); + \cache()->put('bots', $bots, $expiresAt); } $which = null; $target = null; $runbot = null; $trip = 'msg'; - if ($message && substr($message, 0, 1 + (strlen($trip))) === '/'.$trip) { + if ($message && \substr($message, 0, 1 + (\strlen($trip))) === '/'.$trip) { $which = 'skip'; - $command = @explode(' ', $message); - if (array_key_exists(1, $command)) { + $command = @\explode(' ', $message); + if (\array_key_exists(1, $command)) { $receiver = User::where('username', 'like', $command[1])->firstOrFail(); $receiver_id = $receiver->id; $clone = $command; - array_shift($clone); - array_shift($clone); - $message = trim(implode(' ', $clone)); + \array_shift($clone); + \array_shift($clone); + $message = \trim(\implode(' ', $clone)); } $bot_id = 1; } $trip = 'gift'; - if ($message && substr($message, 0, 1 + (strlen($trip))) === '/'.$trip) { + if ($message && \substr($message, 0, 1 + (\strlen($trip))) === '/'.$trip) { $which = 'echo'; $target = 'system'; - $message = '/bot gift'.substr($message, strlen($trip) + 1, strlen($message)); + $message = '/bot gift'.\substr($message, \strlen($trip) + 1, \strlen($message)); } if ($target == 'system') { $runbot = new SystemBot($this->chatRepository); } if ($which == null) { foreach ($bots as $bot) { - if ($message && substr($message, 0, 1 + (strlen($bot->command))) === '/'.$bot->command) { + if ($message && \substr($message, 0, 1 + (\strlen($bot->command))) === '/'.$bot->command) { $which = 'echo'; - } elseif ($message && substr($message, 0, 1 + (strlen($bot->command))) === '!'.$bot->command) { + } elseif ($message && \substr($message, 0, 1 + (\strlen($bot->command))) === '!'.$bot->command) { $which = 'public'; - } elseif ($message && substr($message, 0, 1 + (strlen($bot->command))) === '@'.$bot->command) { - $message = substr($message, 1 + strlen($bot->command), strlen($message)); + } elseif ($message && \substr($message, 0, 1 + (\strlen($bot->command))) === '@'.$bot->command) { + $message = \substr($message, 1 + \strlen($bot->command), \strlen($message)); $which = 'private'; } elseif ($message && $receiver_id == 1 && $bot->id == $bot_id) { - if ($message && substr($message, 0, 1 + (strlen($bot->command))) === '/'.$bot->command) { - $message = substr($message, 1 + strlen($bot->command), strlen($message)); + if ($message && \substr($message, 0, 1 + (\strlen($bot->command))) === '/'.$bot->command) { + $message = \substr($message, 1 + \strlen($bot->command), \strlen($message)); } - if ($message && substr($message, 0, 1 + (strlen($bot->command))) === '!'.$bot->command) { - $message = substr($message, 1 + strlen($bot->command), strlen($message)); + if ($message && \substr($message, 0, 1 + (\strlen($bot->command))) === '!'.$bot->command) { + $message = \substr($message, 1 + \strlen($bot->command), \strlen($message)); } - if ($message && substr($message, 0, 1 + (strlen($bot->command))) === '@'.$bot->command) { - $message = substr($message, 1 + strlen($bot->command), strlen($message)); + if ($message && \substr($message, 0, 1 + (\strlen($bot->command))) === '@'.$bot->command) { + $message = \substr($message, 1 + \strlen($bot->command), \strlen($message)); } $which = 'message'; } @@ -234,12 +234,12 @@ public function createMessage(Request $request) if ($receiver_id && $receiver_id > 0) { $sender_dirty = 0; $receiver_dirty = 0; - $sender_echoes = cache()->get('user-echoes'.$user_id); - $receiver_echoes = cache()->get('user-echoes'.$receiver_id); - if (! $sender_echoes || ! is_array($sender_echoes) || count($sender_echoes) < 1) { + $sender_echoes = \cache()->get('user-echoes'.$user_id); + $receiver_echoes = \cache()->get('user-echoes'.$receiver_id); + if (! $sender_echoes || ! \is_array($sender_echoes) || \count($sender_echoes) < 1) { $sender_echoes = UserEcho::with(['room', 'target', 'bot'])->where('user_id', $user_id)->get(); } - if (! $receiver_echoes || ! is_array($receiver_echoes) || count($receiver_echoes) < 1) { + if (! $receiver_echoes || ! \is_array($receiver_echoes) || \count($receiver_echoes) < 1) { $receiver_echoes = UserEcho::with(['room', 'target', 'bot'])->whereRaw('user_id = ?', [$receiver_id])->get(); } $sender_listening = false; @@ -272,23 +272,23 @@ public function createMessage(Request $request) } if ($sender_dirty == 1) { $expiresAt = Carbon::now()->addMinutes(60); - cache()->put('user-echoes'.$user_id, $sender_echoes, $expiresAt); - event(new Chatter('echo', $user_id, UserEchoResource::collection($sender_echoes))); + \cache()->put('user-echoes'.$user_id, $sender_echoes, $expiresAt); + \event(new Chatter('echo', $user_id, UserEchoResource::collection($sender_echoes))); } if ($receiver_dirty == 1) { $expiresAt = Carbon::now()->addMinutes(60); - cache()->put('user-echoes'.$receiver_id, $receiver_echoes, $expiresAt); - event(new Chatter('echo', $receiver_id, UserEchoResource::collection($receiver_echoes))); + \cache()->put('user-echoes'.$receiver_id, $receiver_echoes, $expiresAt); + \event(new Chatter('echo', $receiver_id, UserEchoResource::collection($receiver_echoes))); } $sender_dirty = 0; $receiver_dirty = 0; - $sender_audibles = cache()->get('user-audibles'.$user_id); - $receiver_audibles = cache()->get('user-audibles'.$receiver_id); - if (! $sender_audibles || ! is_array($sender_audibles) || count($sender_audibles) < 1) { + $sender_audibles = \cache()->get('user-audibles'.$user_id); + $receiver_audibles = \cache()->get('user-audibles'.$receiver_id); + if (! $sender_audibles || ! \is_array($sender_audibles) || \count($sender_audibles) < 1) { $sender_audibles = UserAudible::with(['room', 'target', 'bot'])->where('user_id', $user_id)->get(); } - if (! $receiver_audibles || ! is_array($receiver_audibles) || count($receiver_audibles) < 1) { + if (! $receiver_audibles || ! \is_array($receiver_audibles) || \count($receiver_audibles) < 1) { $receiver_audibles = UserAudible::with(['room', 'target', 'bot'])->whereRaw('user_id = ?', [$receiver_id])->get(); } $sender_listening = false; @@ -323,13 +323,13 @@ public function createMessage(Request $request) } if ($sender_dirty == 1) { $expiresAt = Carbon::now()->addMinutes(60); - cache()->put('user-audibles'.$user_id, $sender_audibles, $expiresAt); - event(new Chatter('audible', $user_id, UserAudibleResource::collection($sender_audibles))); + \cache()->put('user-audibles'.$user_id, $sender_audibles, $expiresAt); + \event(new Chatter('audible', $user_id, UserAudibleResource::collection($sender_audibles))); } if ($receiver_dirty == 1) { $expiresAt = Carbon::now()->addMinutes(60); - cache()->put('user-audibles'.$receiver_id, $receiver_audibles, $expiresAt); - event(new Chatter('audible', $receiver_id, UserAudibleResource::collection($receiver_audibles))); + \cache()->put('user-audibles'.$receiver_id, $receiver_audibles, $expiresAt); + \event(new Chatter('audible', $receiver_id, UserAudibleResource::collection($receiver_audibles))); } $room_id = 0; @@ -351,14 +351,14 @@ public function createMessage(Request $request) return new ChatMessageResource($message); } - return response('success'); + return \response('success'); } public function deleteMessage($id) { $this->chatRepository->deleteMessage($id); - return response('success'); + return \response('success'); } public function deleteRoomEcho(Request $request, $user_id) @@ -377,10 +377,10 @@ public function deleteRoomEcho(Request $request, $user_id) $sender_echoes = UserEcho::with(['room', 'target', 'bot'])->where('user_id', $user_id)->get(); $expiresAt = Carbon::now()->addMinutes(60); - cache()->put('user-echoes'.$user_id, $sender_echoes, $expiresAt); - event(new Chatter('echo', $user_id, UserEchoResource::collection($sender_echoes))); + \cache()->put('user-echoes'.$user_id, $sender_echoes, $expiresAt); + \event(new Chatter('echo', $user_id, UserEchoResource::collection($sender_echoes))); - return response($user); + return \response($user); } public function deleteTargetEcho(Request $request, $user_id) @@ -392,10 +392,10 @@ public function deleteTargetEcho(Request $request, $user_id) $sender_echoes = UserEcho::with(['room', 'target', 'bot'])->where('user_id', $user_id)->get(); $expiresAt = Carbon::now()->addMinutes(60); - cache()->put('user-echoes'.$user_id, $sender_echoes, $expiresAt); - event(new Chatter('echo', $user_id, UserEchoResource::collection($sender_echoes))); + \cache()->put('user-echoes'.$user_id, $sender_echoes, $expiresAt); + \event(new Chatter('echo', $user_id, UserEchoResource::collection($sender_echoes))); - return response($user); + return \response($user); } public function deleteBotEcho(Request $request, $user_id) @@ -407,10 +407,10 @@ public function deleteBotEcho(Request $request, $user_id) $sender_echoes = UserEcho::with(['room', 'target', 'bot'])->where('user_id', $user_id)->get(); $expiresAt = Carbon::now()->addMinutes(60); - cache()->put('user-echoes'.$user_id, $sender_echoes, $expiresAt); - event(new Chatter('echo', $user_id, UserEchoResource::collection($sender_echoes))); + \cache()->put('user-echoes'.$user_id, $sender_echoes, $expiresAt); + \event(new Chatter('echo', $user_id, UserEchoResource::collection($sender_echoes))); - return response($user); + return \response($user); } public function toggleRoomAudible(Request $request, $user_id) @@ -423,10 +423,10 @@ public function toggleRoomAudible(Request $request, $user_id) $sender_audibles = UserAudible::with(['room', 'target', 'bot'])->where('user_id', $user_id)->get(); $expiresAt = Carbon::now()->addMinutes(60); - cache()->put('user-audibles'.$user_id, $sender_audibles, $expiresAt); - event(new Chatter('audible', $user_id, UserAudibleResource::collection($sender_audibles))); + \cache()->put('user-audibles'.$user_id, $sender_audibles, $expiresAt); + \event(new Chatter('audible', $user_id, UserAudibleResource::collection($sender_audibles))); - return response($user); + return \response($user); } public function toggleTargetAudible(Request $request, $user_id) @@ -439,10 +439,10 @@ public function toggleTargetAudible(Request $request, $user_id) $sender_audibles = UserAudible::with(['target', 'room', 'bot'])->where('user_id', $user_id)->get(); $expiresAt = Carbon::now()->addMinutes(60); - cache()->put('user-audibles'.$user_id, $sender_audibles, $expiresAt); - event(new Chatter('audible', $user_id, UserAudibleResource::collection($sender_audibles))); + \cache()->put('user-audibles'.$user_id, $sender_audibles, $expiresAt); + \event(new Chatter('audible', $user_id, UserAudibleResource::collection($sender_audibles))); - return response($user); + return \response($user); } public function toggleBotAudible(Request $request, $user_id) @@ -455,10 +455,10 @@ public function toggleBotAudible(Request $request, $user_id) $sender_audibles = UserAudible::with(['bot', 'room', 'bot'])->where('user_id', $user_id)->get(); $expiresAt = Carbon::now()->addMinutes(60); - cache()->put('user-audibles'.$user_id, $sender_audibles, $expiresAt); - event(new Chatter('audible', $user_id, UserAudibleResource::collection($sender_audibles))); + \cache()->put('user-audibles'.$user_id, $sender_audibles, $expiresAt); + \event(new Chatter('audible', $user_id, UserAudibleResource::collection($sender_audibles))); - return response($user); + return \response($user); } /* USERS */ @@ -478,7 +478,7 @@ public function updateUserChatStatus(Request $request, $id) $user->chatStatus()->associate($status); $user->save(); - return response($user); + return \response($user); } public function updateUserRoom(Request $request, $id) @@ -492,8 +492,8 @@ public function updateUserRoom(Request $request, $id) $user->save(); $sender_dirty = 0; - $sender_echoes = cache()->get('user-echoes'.$id); - if (! $sender_echoes || ! is_array($sender_echoes) || count($sender_echoes) < 1) { + $sender_echoes = \cache()->get('user-echoes'.$id); + if (! $sender_echoes || ! \is_array($sender_echoes) || \count($sender_echoes) < 1) { $sender_echoes = UserEcho::with(['room', 'target', 'bot'])->whereRaw('user_id = ?', [$id])->get(); } $sender_listening = false; @@ -512,24 +512,24 @@ public function updateUserRoom(Request $request, $id) } if ($sender_dirty == 1) { $expiresAt = Carbon::now()->addMinutes(60); - cache()->put('user-echoes'.$id, $sender_echoes, $expiresAt); - event(new Chatter('echo', $id, UserEchoResource::collection($sender_echoes))); + \cache()->put('user-echoes'.$id, $sender_echoes, $expiresAt); + \event(new Chatter('echo', $id, UserEchoResource::collection($sender_echoes))); } - return response($user); + return \response($user); } public function updateUserTarget($id) { $user = User::with(['chatStatus', 'chatroom', 'group', 'echoes'])->findOrFail($id); - return response($user); + return \response($user); } public function updateBotTarget($id) { $user = User::with(['chatStatus', 'chatroom', 'group', 'echoes'])->findOrFail($id); - return response($user); + return \response($user); } } diff --git a/app/Http/Controllers/API/TorrentController.php b/app/Http/Controllers/API/TorrentController.php index cf468e3548..50537ef9d1 100644 --- a/app/Http/Controllers/API/TorrentController.php +++ b/app/Http/Controllers/API/TorrentController.php @@ -83,7 +83,7 @@ public function store(Request $request, Torrent $torrent) return $this->sendError('Validation Error.', 'You Must Provide A Valid Torrent File For Upload!'); } - $movieScrapper = new \App\Services\MovieScrapper(config('api-keys.tmdb'), config('api-keys.tvdb'), config('api-keys.omdb')); + $movieScrapper = new \App\Services\MovieScrapper(\config('api-keys.tmdb'), \config('api-keys.tvdb'), \config('api-keys.omdb')); // Deplace and decode the torrent temporarily $decodedTorrent = TorrentTools::normalizeTorrent($requestFile); $infohash = Bencode::get_infohash($decodedTorrent); @@ -94,14 +94,14 @@ public function store(Request $request, Torrent $torrent) return $this->sendError('Validation Error.', 'You Must Provide A Valid Torrent File For Upload!'); } - $fileName = sprintf('%s.torrent', uniqid()); // Generate a unique name + $fileName = \sprintf('%s.torrent', \uniqid()); // Generate a unique name Storage::disk('torrents')->put($fileName, Bencode::bencode($decodedTorrent)); // Find the right category $category = Category::withCount('torrents')->findOrFail($request->input('category_id')); // Create the torrent (DB) - $torrent = app()->make(Torrent::class); + $torrent = \app()->make(Torrent::class); $torrent->name = $request->input('name'); $torrent->slug = Str::slug($torrent->name); $torrent->description = $request->input('description'); @@ -133,7 +133,7 @@ public function store(Request $request, Torrent $torrent) $torrent->moderated_by = User::where('username', 'System')->first()->id; //System ID // Validation - $v = validator($torrent->toArray(), [ + $v = \validator($torrent->toArray(), [ 'name' => 'required|unique:torrents', 'slug' => 'required', 'description' => 'required', @@ -216,7 +216,7 @@ public function store(Request $request, Torrent $torrent) } // check for trusted user and update torrent if ($user->group->is_trusted) { - $appurl = config('app.url'); + $appurl = \config('app.url'); $user = $torrent->user; $user_id = $user->id; $username = $user->username; @@ -228,40 +228,40 @@ public function store(Request $request, Torrent $torrent) // Announce To Shoutbox if ($anon == 0) { $this->chatRepository->systemMessage( - sprintf('User [url=%s/users/', $appurl).$username.']'.$username.sprintf('[/url] has uploaded [url=%s/torrents/', $appurl).$torrent->id.']'.$torrent->name.'[/url] grab it now! :slight_smile:' + \sprintf('User [url=%s/users/', $appurl).$username.']'.$username.\sprintf('[/url] has uploaded [url=%s/torrents/', $appurl).$torrent->id.']'.$torrent->name.'[/url] grab it now! :slight_smile:' ); } else { $this->chatRepository->systemMessage( - sprintf('An anonymous user has uploaded [url=%s/torrents/', $appurl).$torrent->id.']'.$torrent->name.'[/url] grab it now! :slight_smile:' + \sprintf('An anonymous user has uploaded [url=%s/torrents/', $appurl).$torrent->id.']'.$torrent->name.'[/url] grab it now! :slight_smile:' ); } if ($anon == 1 && $featured == 1) { $this->chatRepository->systemMessage( - sprintf('Ladies and Gents, [url=%s/torrents/', $appurl).$torrent->id.']'.$torrent->name.'[/url] has been added to the Featured Torrents Slider by an anonymous user! Grab It While You Can! :fire:' + \sprintf('Ladies and Gents, [url=%s/torrents/', $appurl).$torrent->id.']'.$torrent->name.'[/url] has been added to the Featured Torrents Slider by an anonymous user! Grab It While You Can! :fire:' ); } elseif ($anon == 0 && $featured == 1) { $this->chatRepository->systemMessage( - sprintf('Ladies and Gents, [url=%s/torrents/', $appurl).$torrent->id.']'.$torrent->name.sprintf('[/url] has been added to the Featured Torrents Slider by [url=%s/users/', $appurl).$username.']'.$username.'[/url]! Grab It While You Can! :fire:' + \sprintf('Ladies and Gents, [url=%s/torrents/', $appurl).$torrent->id.']'.$torrent->name.\sprintf('[/url] has been added to the Featured Torrents Slider by [url=%s/users/', $appurl).$username.']'.$username.'[/url]! Grab It While You Can! :fire:' ); } if ($free == 1 && $featured == 0) { $this->chatRepository->systemMessage( - sprintf('Ladies and Gents, [url=%s/torrents/', $appurl).$torrent->id.']'.$torrent->name.'[/url] has been granted 100%% FreeLeech! Grab It While You Can! :fire:' + \sprintf('Ladies and Gents, [url=%s/torrents/', $appurl).$torrent->id.']'.$torrent->name.'[/url] has been granted 100%% FreeLeech! Grab It While You Can! :fire:' ); } if ($doubleup == 1 && $featured == 0) { $this->chatRepository->systemMessage( - sprintf('Ladies and Gents, [url=%s/torrents/', $appurl).$torrent->id.']'.$torrent->name.'[/url] has been granted Double Upload! Grab It While You Can! :fire:' + \sprintf('Ladies and Gents, [url=%s/torrents/', $appurl).$torrent->id.']'.$torrent->name.'[/url] has been granted Double Upload! Grab It While You Can! :fire:' ); } TorrentHelper::approveHelper($torrent->id); } - return $this->sendResponse(route('torrent.download.rsskey', ['id' => $torrent->id, 'rsskey' => auth('api')->user()->rsskey]), 'Torrent uploaded successfully.'); + return $this->sendResponse(\route('torrent.download.rsskey', ['id' => $torrent->id, 'rsskey' => \auth('api')->user()->rsskey]), 'Torrent uploaded successfully.'); } /** @@ -343,19 +343,19 @@ public function filter(Request $request, Torrent $torrent) $dying = $request->input('dying'); $dead = $request->input('dead'); - $terms = explode(' ', $search); + $terms = \explode(' ', $search); $search = ''; foreach ($terms as $term) { $search .= '%'.$term.'%'; } - $usernames = explode(' ', $uploader); + $usernames = \explode(' ', $uploader); $uploader = null; foreach ($usernames as $username) { $uploader .= $username.'%'; } - $keywords = explode(' ', $description); + $keywords = \explode(' ', $description); $description = ''; foreach ($keywords as $keyword) { $description .= '%'.$keyword.'%'; @@ -398,7 +398,7 @@ public function filter(Request $request, Torrent $torrent) } if ($request->has('imdb') && $request->input('imdb') != null) { - $torrent->where('torrents.imdb', '=', str_replace('tt', '', $imdb)); + $torrent->where('torrents.imdb', '=', \str_replace('tt', '', $imdb)); } if ($request->has('tvdb') && $request->input('tvdb') != null) { @@ -501,16 +501,16 @@ private static function anonymizeMediainfo($mediainfo) if ($mediainfo === null) { return; } - $complete_name_i = strpos($mediainfo, 'Complete name'); + $complete_name_i = \strpos($mediainfo, 'Complete name'); if ($complete_name_i !== false) { - $path_i = strpos($mediainfo, ': ', $complete_name_i); + $path_i = \strpos($mediainfo, ': ', $complete_name_i); if ($path_i !== false) { $path_i += 2; - $end_i = strpos($mediainfo, "\n", $path_i); - $path = substr($mediainfo, $path_i, $end_i - $path_i); + $end_i = \strpos($mediainfo, "\n", $path_i); + $path = \substr($mediainfo, $path_i, $end_i - $path_i); $new_path = MediaInfo::stripPath($path); - return substr_replace($mediainfo, $new_path, $path_i, strlen($path)); + return \substr_replace($mediainfo, $new_path, $path_i, \strlen($path)); } } diff --git a/app/Http/Controllers/AchievementsController.php b/app/Http/Controllers/AchievementsController.php index 1c7fbc65a8..3601baf5ee 100644 --- a/app/Http/Controllers/AchievementsController.php +++ b/app/Http/Controllers/AchievementsController.php @@ -32,7 +32,7 @@ public function index(Request $request) $achievements = $user->unlockedAchievements(); $pending = $user->inProgressAchievements(); - return view('achievement.index', [ + return \view('achievement.index', [ 'route' => 'achievement', 'user' => $user, 'achievements' => $achievements, @@ -53,7 +53,7 @@ public function show($username) $achievements = $user->unlockedAchievements(); - return view('achievement.show', [ + return \view('achievement.show', [ 'route' => 'achievement', 'user' => $user, 'achievements' => $achievements, diff --git a/app/Http/Controllers/AlbumController.php b/app/Http/Controllers/AlbumController.php index cc97f6bf66..f4a43548eb 100644 --- a/app/Http/Controllers/AlbumController.php +++ b/app/Http/Controllers/AlbumController.php @@ -46,7 +46,7 @@ public function index() { $albums = Album::withCount('images')->get(); - return view('album.index')->with('albums', $albums); + return \view('album.index')->with('albums', $albums); } /** @@ -56,7 +56,7 @@ public function index() */ public function create() { - return view('album.create'); + return \view('album.create'); } /** @@ -72,7 +72,7 @@ public function store(Request $request) $omdb = $this->omdbClient->find(['imdb' => $imdb]); if ($omdb === null || ! $omdb) { - return redirect()->route('albums.create') + return \redirect()->route('albums.create') ->withErrors('Bad IMDB Request!'); } @@ -83,12 +83,12 @@ public function store(Request $request) $album->imdb = $request->input('imdb'); $image = $request->file('cover_image'); - $filename = 'album-cover_'.uniqid().'.'.$image->getClientOriginalExtension(); - $path = public_path('/files/img/'.$filename); + $filename = 'album-cover_'.\uniqid().'.'.$image->getClientOriginalExtension(); + $path = \public_path('/files/img/'.$filename); Image::make($image->getRealPath())->fit(400, 225)->encode('png', 100)->save($path); $album->cover_image = $filename; - $v = validator($album->toArray(), [ + $v = \validator($album->toArray(), [ 'user_id' => 'required', 'name' => 'required', 'description' => 'required', @@ -97,13 +97,13 @@ public function store(Request $request) ]); if ($v->fails()) { - return redirect()->route('albums.create') + return \redirect()->route('albums.create') ->withInput() ->withErrors($v->errors()); } $album->save(); - return redirect()->route('albums.show', ['id' => $album->id]) + return \redirect()->route('albums.show', ['id' => $album->id]) ->withSuccess('Your album has successfully published!'); } @@ -119,7 +119,7 @@ public function show($id) $album = Album::with('images')->find($id); $albums = Album::with('images')->get(); - return view('album.show', ['album' => $album, 'albums' => $albums]); + return \view('album.show', ['album' => $album, 'albums' => $albums]); } /** @@ -135,10 +135,10 @@ public function destroy(Request $request, $id) $user = $request->user(); $album = Album::findOrFail($id); - abort_unless($user->group->is_modo || ($user->id === $album->user_id && Carbon::now()->lt($album->created_at->addDay())), 403); + \abort_unless($user->group->is_modo || ($user->id === $album->user_id && Carbon::now()->lt($album->created_at->addDay())), 403); $album->delete(); - return redirect()->route('albums.index') + return \redirect()->route('albums.index') ->withSuccess('Album has successfully been deleted'); } } diff --git a/app/Http/Controllers/AnnounceController.php b/app/Http/Controllers/AnnounceController.php index fb51fcec19..3c1b2233b6 100644 --- a/app/Http/Controllers/AnnounceController.php +++ b/app/Http/Controllers/AnnounceController.php @@ -59,71 +59,71 @@ public function announce(Request $request, $passkey) // Check Announce Request Method $method = $request->method(); if (! $request->isMethod('get')) { - info('Announce Request Method Was Not GET'); + \info('Announce Request Method Was Not GET'); - return response(Bencode::bencode(['failure reason' => 'Invalid Request Type: Client Request Was Not A HTTP GET.']))->withHeaders(['Content-Type' => 'text/plain']); + return \response(Bencode::bencode(['failure reason' => 'Invalid Request Type: Client Request Was Not A HTTP GET.']))->withHeaders(['Content-Type' => 'text/plain']); } // Request Agent Information $agent = $request->server('HTTP_USER_AGENT'); // Blacklist - if (config('client-blacklist.enabled') == true) { + if (\config('client-blacklist.enabled') == true) { // Check If Browser Is Blacklisted - $blockedBrowsers = config('client-blacklist.browsers'); - if (in_array($agent, $blockedBrowsers)) { - abort(405, 'What Are You Trying To Do?'); + $blockedBrowsers = \config('client-blacklist.browsers'); + if (\in_array($agent, $blockedBrowsers)) { + \abort(405, 'What Are You Trying To Do?'); die(); } // Check If Client Is Blacklisted - $blockedClients = config('client-blacklist.clients'); - if (in_array($agent, $blockedClients)) { + $blockedClients = \config('client-blacklist.clients'); + if (\in_array($agent, $blockedClients)) { //info('Blacklist Client Attempted To Connect To Announce'); - return response(Bencode::bencode(['failure reason' => 'The Client You Are Trying To Use Has Been Blacklisted']))->withHeaders(['Content-Type' => 'text/plain']); + return \response(Bencode::bencode(['failure reason' => 'The Client You Are Trying To Use Has Been Blacklisted']))->withHeaders(['Content-Type' => 'text/plain']); } } // If Passkey Is Not Provided Return Error to Client if ($passkey == null) { //info('Client Attempted To Connect To Announce Without A Passkey'); - return response(Bencode::bencode(['failure reason' => 'Please Call Passkey']))->withHeaders(['Content-Type' => 'text/plain']); + return \response(Bencode::bencode(['failure reason' => 'Please Call Passkey']))->withHeaders(['Content-Type' => 'text/plain']); } // If Infohash Is Not Provided Return Error to Client if (! $request->has('info_hash')) { //info('Client Attempted To Connect To Announce Without A Infohash'); - return response(Bencode::bencode(['failure reason' => 'Missing info_hash']))->withHeaders(['Content-Type' => 'text/plain']); + return \response(Bencode::bencode(['failure reason' => 'Missing info_hash']))->withHeaders(['Content-Type' => 'text/plain']); } // If Peerid Is Not Provided Return Error to Client if (! $request->has('peer_id')) { //info('Client Attempted To Connect To Announce Without A Peerid'); - return response(Bencode::bencode(['failure reason' => 'Missing peer_id']))->withHeaders(['Content-Type' => 'text/plain']); + return \response(Bencode::bencode(['failure reason' => 'Missing peer_id']))->withHeaders(['Content-Type' => 'text/plain']); } // If Port Is Not Provided Return Error to Client if (! $request->has('port')) { //info('Client Attempted To Connect To Announce Without A Specified Port'); - return response(Bencode::bencode(['failure reason' => 'Missing port']))->withHeaders(['Content-Type' => 'text/plain']); + return \response(Bencode::bencode(['failure reason' => 'Missing port']))->withHeaders(['Content-Type' => 'text/plain']); } // If "Left" Is Not Provided Return Error to Client if (! $request->has('left')) { //info('Client Attempted To Connect To Announce Without Supplying Any "Left" Information'); - return response(Bencode::bencode(['failure reason' => 'Missing left']))->withHeaders(['Content-Type' => 'text/plain']); + return \response(Bencode::bencode(['failure reason' => 'Missing left']))->withHeaders(['Content-Type' => 'text/plain']); } // If "Upload" Is Not Provided Return Error to Client if (! $request->has('uploaded')) { //info('Client Attempted To Connect To Announce Without Supplying Any "Upload" Information'); - return response(Bencode::bencode(['failure reason' => 'Missing upload']))->withHeaders(['Content-Type' => 'text/plain']); + return \response(Bencode::bencode(['failure reason' => 'Missing upload']))->withHeaders(['Content-Type' => 'text/plain']); } // If "Download" Is Not Provided Return Error to Client if (! $request->has('downloaded')) { //info('Client Attempted To Connect To Announce Without Supplying Any "Download" Information'); - return response(Bencode::bencode(['failure reason' => 'Missing download']))->withHeaders(['Content-Type' => 'text/plain']); + return \response(Bencode::bencode(['failure reason' => 'Missing download']))->withHeaders(['Content-Type' => 'text/plain']); } // Check Passkey Against Cache or Users Table @@ -133,43 +133,43 @@ public function announce(Request $request, $passkey) // If Passkey Doesn't Exist Return Error to Client if ($user === null) { //info('Client Attempted To Connect To Announce With A Invalid Passkey'); - return response(Bencode::bencode(['failure reason' => 'Passkey is invalid']))->withHeaders(['Content-Type' => 'text/plain']); + return \response(Bencode::bencode(['failure reason' => 'Passkey is invalid']))->withHeaders(['Content-Type' => 'text/plain']); } // Caached System Required Groups - $banned_group = cache()->rememberForever('banned_group', fn () => Group::where('slug', '=', 'banned')->pluck('id')); - $validating_group = cache()->rememberForever('validating_group', fn () => Group::where('slug', '=', 'validating')->pluck('id')); - $disabled_group = cache()->rememberForever('disabled_group', fn () => Group::where('slug', '=', 'disabled')->pluck('id')); + $banned_group = \cache()->rememberForever('banned_group', fn () => Group::where('slug', '=', 'banned')->pluck('id')); + $validating_group = \cache()->rememberForever('validating_group', fn () => Group::where('slug', '=', 'validating')->pluck('id')); + $disabled_group = \cache()->rememberForever('disabled_group', fn () => Group::where('slug', '=', 'disabled')->pluck('id')); // If User Is Banned Return Error to Client if ($user->group_id == $banned_group[0]) { //info('A Banned User (' . $user->username . ') Attempted To Announce'); - return response(Bencode::bencode(['failure reason' => 'You are no longer welcome here']))->withHeaders(['Content-Type' => 'text/plain']); + return \response(Bencode::bencode(['failure reason' => 'You are no longer welcome here']))->withHeaders(['Content-Type' => 'text/plain']); } // If User Is Disabled Return Error to Client if ($user->group_id == $disabled_group[0]) { //info('A Disabled User (' . $user->username . ') Attempted To Announce'); - return response(Bencode::bencode(['failure reason' => 'Your account is disabled. Please login.']))->withHeaders(['Content-Type' => 'text/plain']); + return \response(Bencode::bencode(['failure reason' => 'Your account is disabled. Please login.']))->withHeaders(['Content-Type' => 'text/plain']); } // If User Account Is Unactivated Return Error to Client if ($user->active == 0) { //info('A Unactivated User (' . $user->username . ') Attempted To Announce'); - return response(Bencode::bencode(['failure reason' => 'Your account is not activated']))->withHeaders(['Content-Type' => 'text/plain']); + return \response(Bencode::bencode(['failure reason' => 'Your account is not activated']))->withHeaders(['Content-Type' => 'text/plain']); } // If User Is Validating Return Error to Client if ($user->group_id == $validating_group[0]) { //info('A Validating User (' . $user->username . ') Attempted To Announce'); - return response(Bencode::bencode(['failure reason' => 'Your account is still validating']))->withHeaders(['Content-Type' => 'text/plain']); + return \response(Bencode::bencode(['failure reason' => 'Your account is still validating']))->withHeaders(['Content-Type' => 'text/plain']); } // Standard Information Fields $event = $request->input('event'); - $info_hash = bin2hex($request->input('info_hash')); - $peer_id = bin2hex($request->input('peer_id')); - $md5_peer_id = md5($peer_id); + $info_hash = \bin2hex($request->input('info_hash')); + $peer_id = \bin2hex($request->input('peer_id')); + $md5_peer_id = \md5($peer_id); $ip = $request->ip(); $port = (int) $request->input('port'); $left = (int) $request->input('left'); @@ -179,29 +179,29 @@ public function announce(Request $request, $passkey) $real_downloaded = $downloaded; //Extra Information Fields - $tracker_id = $request->has('trackerid') ? bin2hex($request->input('tracker_id')) : null; + $tracker_id = $request->has('trackerid') ? \bin2hex($request->input('tracker_id')) : null; $compact = $request->input('compact') == 1; - $key = $request->has('key') ? bin2hex($request->input('key')) : null; + $key = $request->has('key') ? \bin2hex($request->input('key')) : null; $corrupt = $request->has('corrupt') ? $request->input('corrupt') : null; - $ipv6 = $request->has('ipv6') ? bin2hex($request->input('ipv6')) : null; + $ipv6 = $request->has('ipv6') ? \bin2hex($request->input('ipv6')) : null; $no_peer_id = $request->input('no_peer_id') == 1; // If User Download Rights Are Disabled Return Error to Client if ($user->can_download == 0 && $left != 0) { //info('A User With Revoked Download Privileges Attempted To Announce'); - return response(Bencode::bencode(['failure reason' => 'Your download privileges are Revoked']))->withHeaders(['Content-Type' => 'text/plain']); + return \response(Bencode::bencode(['failure reason' => 'Your download privileges are Revoked']))->withHeaders(['Content-Type' => 'text/plain']); } // If User Client Is Sending Negative Values Return Error to Client if ($uploaded < 0 || $downloaded < 0 || $left < 0) { //info('Client Attempted To Send Data With A Negative Value'); - return response(Bencode::bencode(['failure reason' => 'Data from client is a negative value']))->withHeaders(['Content-Type' => 'text/plain']); + return \response(Bencode::bencode(['failure reason' => 'Data from client is a negative value']))->withHeaders(['Content-Type' => 'text/plain']); } // If User Client Does Not Support Compact Return Error to Client if (! $compact) { //info('Client Attempted To Connect To Announce But Doesn't Support Compact'); - return response(Bencode::bencode(['failure reason' => "Your client doesn't support compact, please update your client"]))->withHeaders(['Content-Type' => 'text/plain']); + return \response(Bencode::bencode(['failure reason' => "Your client doesn't support compact, please update your client"]))->withHeaders(['Content-Type' => 'text/plain']); } // Check Info Hash Against Cache or Torrents Table @@ -211,25 +211,25 @@ public function announce(Request $request, $passkey) // If Torrent Doesnt Exsist Return Error to Client if ($torrent === null) { //info('Client Attempted To Connect To Announce But The Torrent Doesn't Exist Using Hash ' . $info_hash); - return response(Bencode::bencode(['failure reason' => 'Torrent not found']))->withHeaders(['Content-Type' => 'text/plain']); + return \response(Bencode::bencode(['failure reason' => 'Torrent not found']))->withHeaders(['Content-Type' => 'text/plain']); } // If Torrent Is Pending Moderation Return Error to Client if ($torrent->status == self::PENDING) { //info('Client Attempted To Connect To Announce But The Torrent Is Pending Moderation'); - return response(Bencode::bencode(['failure reason' => 'Torrent is still pending moderation']))->withHeaders(['Content-Type' => 'text/plain']); + return \response(Bencode::bencode(['failure reason' => 'Torrent is still pending moderation']))->withHeaders(['Content-Type' => 'text/plain']); } // If Torrent Is Rejected Return Error to Client if ($torrent->status == self::REJECTED) { //info('Client Attempted To Connect To Announce But The Torrent Is Rejected'); - return response(Bencode::bencode(['failure reason' => 'Torrent has been rejected']))->withHeaders(['Content-Type' => 'text/plain']); + return \response(Bencode::bencode(['failure reason' => 'Torrent has been rejected']))->withHeaders(['Content-Type' => 'text/plain']); } // If Torrent Is Postponed Return Error to Client if ($torrent->status == self::POSTPONED) { //info('Client Attempted To Connect To Announce But The Torrent Is Postponed'); - return response(Bencode::bencode(['failure reason' => 'Torrent has been postponed']))->withHeaders(['Content-Type' => 'text/plain']); + return \response(Bencode::bencode(['failure reason' => 'Torrent has been postponed']))->withHeaders(['Content-Type' => 'text/plain']); } // Get Torrents Peers @@ -239,9 +239,9 @@ public function announce(Request $request, $passkey) $connections = Peer::where('torrent_id', '=', $torrent->id)->where('user_id', '=', $user->id)->count(); // If Users Peer Count On A Single Torrent Is Greater Than X Return Error to Client - if ($connections > config('announce.rate_limit')) { + if ($connections > \config('announce.rate_limit')) { //info('Client Attempted To Connect To Announce But Has Hit Rate Limits'); - return response(Bencode::bencode(['failure reason' => 'You have reached the rate limit']))->withHeaders(['Content-Type' => 'text/plain']); + return \response(Bencode::bencode(['failure reason' => 'You have reached the rate limit']))->withHeaders(['Content-Type' => 'text/plain']); } // Get The Current Peer @@ -250,7 +250,7 @@ public function announce(Request $request, $passkey) // Flag is tripped if new session is created but client reports up/down > 0 $ghost = false; if ($peer === null && $event == 'completed') { - return response(Bencode::bencode(['failure reason' => 'Torrent is complete but no record found.']))->withHeaders(['Content-Type' => 'text/plain']); + return \response(Bencode::bencode(['failure reason' => 'Torrent is complete but no record found.']))->withHeaders(['Content-Type' => 'text/plain']); } // Creates a new peer if not existing @@ -287,13 +287,13 @@ public function announce(Request $request, $passkey) $freeleech_token = FreeleechToken::where('user_id', '=', $user->id)->where('torrent_id', '=', $torrent->id)->first(); $group = Group::whereId($user->group_id)->first(); - if (config('other.freeleech') == 1 || $torrent->free == 1 || $personal_freeleech || $group->is_freeleech == 1 || $freeleech_token) { + if (\config('other.freeleech') == 1 || $torrent->free == 1 || $personal_freeleech || $group->is_freeleech == 1 || $freeleech_token) { $mod_downloaded = 0; } else { $mod_downloaded = $downloaded; } - if (config('other.doubleup') == 1 || $torrent->doubleup == 1 || $group->is_double_upload == 1) { + if (\config('other.doubleup') == 1 || $torrent->doubleup == 1 || $group->is_double_upload == 1) { $mod_uploaded = $uploaded * 2; } else { $mod_uploaded = $uploaded; @@ -475,7 +475,7 @@ public function announce(Request $request, $passkey) // Build Response For Bittorrent Client $res = []; - $res['interval'] = rand(self::MIN, self::MAX); + $res['interval'] = \rand(self::MIN, self::MAX); $res['min interval'] = self::MIN; $res['tracker_id'] = $md5_peer_id; // A string that the client should send back on its next announcements. $res['complete'] = $torrent->seeders; @@ -483,7 +483,7 @@ public function announce(Request $request, $passkey) $res['peers'] = $this->givePeers($peers, $compact, $no_peer_id, FILTER_FLAG_IPV4); $res['peers6'] = $this->givePeers($peers, $compact, $no_peer_id, FILTER_FLAG_IPV6); - return response(Bencode::bencode($res))->withHeaders(['Content-Type' => 'text/plain']); + return \response(Bencode::bencode($res))->withHeaders(['Content-Type' => 'text/plain']); // End Build Response For Bittorrent Client } @@ -500,9 +500,9 @@ private function givePeers($peers, $compact, $no_peer_id, $filter_flag = FILTER_ if ($compact) { $pcomp = ''; foreach ($peers as &$p) { - if (isset($p['ip']) && isset($p['port']) && filter_var($p['ip'], FILTER_VALIDATE_IP, $filter_flag)) { - $pcomp .= inet_pton($p['ip']); - $pcomp .= pack('n', (int) $p['port']); + if (isset($p['ip']) && isset($p['port']) && \filter_var($p['ip'], FILTER_VALIDATE_IP, $filter_flag)) { + $pcomp .= \inet_pton($p['ip']); + $pcomp .= \pack('n', (int) $p['port']); } } diff --git a/app/Http/Controllers/ArticleController.php b/app/Http/Controllers/ArticleController.php index 71c36fcd9b..e58b73b953 100644 --- a/app/Http/Controllers/ArticleController.php +++ b/app/Http/Controllers/ArticleController.php @@ -26,7 +26,7 @@ public function index() { $articles = Article::latest()->paginate(6); - return view('article.index', ['articles' => $articles]); + return \view('article.index', ['articles' => $articles]); } /** @@ -40,6 +40,6 @@ public function show($id) { $article = Article::with(['user', 'comments'])->findOrFail($id); - return view('article.show', ['article' => $article]); + return \view('article.show', ['article' => $article]); } } diff --git a/app/Http/Controllers/Auth/ActivationController.php b/app/Http/Controllers/Auth/ActivationController.php index 04afe40e04..9cd922f22c 100644 --- a/app/Http/Controllers/Auth/ActivationController.php +++ b/app/Http/Controllers/Auth/ActivationController.php @@ -21,8 +21,8 @@ class ActivationController extends Controller { public function activate($token) { - $banned_group = cache()->rememberForever('banned_group', fn () => Group::where('slug', '=', 'banned')->pluck('id')); - $member_group = cache()->rememberForever('member_group', fn () => Group::where('slug', '=', 'user')->pluck('id')); + $banned_group = \cache()->rememberForever('banned_group', fn () => Group::where('slug', '=', 'banned')->pluck('id')); + $member_group = \cache()->rememberForever('member_group', fn () => Group::where('slug', '=', 'user')->pluck('id')); $activation = UserActivation::with('user')->where('token', '=', $token)->firstOrFail(); if ($activation->user->id && $activation->user->group->id != $banned_group[0]) { @@ -37,11 +37,11 @@ public function activate($token) $activation->delete(); - return redirect()->route('login') - ->withSuccess(trans('auth.activation-success')); + return \redirect()->route('login') + ->withSuccess(\trans('auth.activation-success')); } - return redirect()->route('login') - ->withErrors(trans('auth.activation-error')); + return \redirect()->route('login') + ->withErrors(\trans('auth.activation-error')); } } diff --git a/app/Http/Controllers/Auth/ApplicationController.php b/app/Http/Controllers/Auth/ApplicationController.php index 5a6912875b..0ca83dfd71 100644 --- a/app/Http/Controllers/Auth/ApplicationController.php +++ b/app/Http/Controllers/Auth/ApplicationController.php @@ -28,7 +28,7 @@ class ApplicationController extends Controller */ public function create() { - return view('auth.application.create'); + return \view('auth.application.create'); } /** @@ -40,14 +40,14 @@ public function create() */ public function store(Request $request) { - $application = resolve(Application::class); + $application = \resolve(Application::class); $application->type = $request->input('type'); $application->email = $request->input('email'); $application->referrer = $request->input('referrer'); - if (config('email-blacklist.enabled') == true) { - if (config('captcha.enabled') == false) { - $v = validator($request->all(), [ + if (\config('email-blacklist.enabled') == true) { + if (\config('captcha.enabled') == false) { + $v = \validator($request->all(), [ 'type' => 'required', 'email' => 'required|string|email|max:70|blacklist|unique:invites|unique:users|unique:applications', 'referrer' => 'required', @@ -57,7 +57,7 @@ public function store(Request $request) 'links' => 'min:2', ]); } else { - $v = validator($request->all(), [ + $v = \validator($request->all(), [ 'type' => 'required', 'email' => 'required|string|email|max:70|blacklist|unique:invites|unique:users|unique:applications', 'referrer' => 'required', @@ -68,8 +68,8 @@ public function store(Request $request) 'captcha' => 'hiddencaptcha', ]); } - } elseif (config('captcha.enabled') == false) { - $v = validator($request->all(), [ + } elseif (\config('captcha.enabled') == false) { + $v = \validator($request->all(), [ 'type' => 'required', 'email' => 'required|string|email|max:70|unique:invites|unique:users|unique:applications', 'referrer' => 'required', @@ -79,7 +79,7 @@ public function store(Request $request) 'links' => 'min:2', ]); } else { - $v = validator($request->all(), [ + $v = \validator($request->all(), [ 'type' => 'required', 'email' => 'required|string|email|max:70|unique:invites|unique:users|unique:applications', 'referrer' => 'required', @@ -92,18 +92,18 @@ public function store(Request $request) } if ($v->fails()) { - return redirect()->route('application.create') + return \redirect()->route('application.create') ->withErrors($v->errors()); } $application->save(); // Map And Save IMG Proofs - $imgs = collect($request->input('images'))->map(fn ($value) => new ApplicationImageProof(['image' => $value])); + $imgs = \collect($request->input('images'))->map(fn ($value) => new ApplicationImageProof(['image' => $value])); $application->imageProofs()->saveMany($imgs); // Map And Save URL Proofs - $urls = collect($request->input('links'))->map(fn ($value) => new ApplicationUrlProof(['url' => $value])); + $urls = \collect($request->input('links'))->map(fn ($value) => new ApplicationUrlProof(['url' => $value])); $application->urlProofs()->saveMany($urls); - return redirect()->route('login') - ->withSuccess(trans('auth.application-submitted')); + return \redirect()->route('login') + ->withSuccess(\trans('auth.application-submitted')); } } diff --git a/app/Http/Controllers/Auth/ForgotPasswordController.php b/app/Http/Controllers/Auth/ForgotPasswordController.php index 78793339c6..f7b972b069 100644 --- a/app/Http/Controllers/Auth/ForgotPasswordController.php +++ b/app/Http/Controllers/Auth/ForgotPasswordController.php @@ -28,7 +28,7 @@ public function __construct() protected function validateEmail(Request $request) { - if (config('captcha.enabled') == false) { + if (\config('captcha.enabled') == false) { $request->validate(['email' => 'required|email']); } else { $request->validate([ diff --git a/app/Http/Controllers/Auth/ForgotUsernameController.php b/app/Http/Controllers/Auth/ForgotUsernameController.php index 90af882843..817c2206a7 100644 --- a/app/Http/Controllers/Auth/ForgotUsernameController.php +++ b/app/Http/Controllers/Auth/ForgotUsernameController.php @@ -27,7 +27,7 @@ class ForgotUsernameController extends Controller */ public function showForgotUsernameForm() { - return view('auth.username'); + return \view('auth.username'); } /** @@ -41,30 +41,30 @@ public function sendUsernameReminder(Request $request) { $email = $request->get('email'); - if (config('captcha.enabled') == false) { - $v = validator($request->all(), [ + if (\config('captcha.enabled') == false) { + $v = \validator($request->all(), [ 'email' => 'required', ]); } else { - $v = validator($request->all(), [ + $v = \validator($request->all(), [ 'email' => 'required', 'captcha' => 'hiddencaptcha', ]); } if ($v->fails()) { - return redirect()->route('username.request') + return \redirect()->route('username.request') ->withErrors($v->errors()); } $user = User::where('email', '=', $email)->first(); if (empty($user)) { - return redirect()->route('username.request') - ->withErrors(trans('email.no-email-found')); + return \redirect()->route('username.request') + ->withErrors(\trans('email.no-email-found')); } //send username reminder notification $user->notify(new UsernameReminder()); - return redirect()->route('login') - ->withSuccess(trans('email.username-sent')); + return \redirect()->route('login') + ->withSuccess(\trans('email.username-sent')); } } diff --git a/app/Http/Controllers/Auth/LoginController.php b/app/Http/Controllers/Auth/LoginController.php index 85b6012b7b..98dee2b550 100644 --- a/app/Http/Controllers/Auth/LoginController.php +++ b/app/Http/Controllers/Auth/LoginController.php @@ -53,7 +53,7 @@ public function username() */ protected function validateLogin(Request $request) { - if (config('captcha.enabled') == true) { + if (\config('captcha.enabled') == true) { $this->validate($request, [ $this->username() => 'required|string', 'password' => 'required|string', @@ -69,25 +69,25 @@ protected function validateLogin(Request $request) protected function authenticated(Request $request, $user) { - $banned_group = cache()->rememberForever('banned_group', fn () => Group::where('slug', '=', 'banned')->pluck('id')); - $validating_group = cache()->rememberForever('validating_group', fn () => Group::where('slug', '=', 'validating')->pluck('id')); - $disabled_group = cache()->rememberForever('disabled_group', fn () => Group::where('slug', '=', 'disabled')->pluck('id')); - $member_group = cache()->rememberForever('member_group', fn () => Group::where('slug', '=', 'user')->pluck('id')); + $banned_group = \cache()->rememberForever('banned_group', fn () => Group::where('slug', '=', 'banned')->pluck('id')); + $validating_group = \cache()->rememberForever('validating_group', fn () => Group::where('slug', '=', 'validating')->pluck('id')); + $disabled_group = \cache()->rememberForever('disabled_group', fn () => Group::where('slug', '=', 'disabled')->pluck('id')); + $member_group = \cache()->rememberForever('member_group', fn () => Group::where('slug', '=', 'user')->pluck('id')); if ($user->active == 0 || $user->group_id == $validating_group[0]) { $this->guard()->logout(); $request->session()->invalidate(); - return redirect()->route('login') - ->withErrors(trans('auth.not-activated')); + return \redirect()->route('login') + ->withErrors(\trans('auth.not-activated')); } if ($user->group_id == $banned_group[0]) { $this->guard()->logout(); $request->session()->invalidate(); - return redirect()->route('login') - ->withErrors(trans('auth.banned')); + return \redirect()->route('login') + ->withErrors(\trans('auth.banned')); } if ($user->group_id == $disabled_group[0]) { @@ -101,11 +101,11 @@ protected function authenticated(Request $request, $user) $user->disabled_at = null; $user->save(); - return redirect()->route('home.index') - ->withSuccess(trans('auth.welcome-restore')); + return \redirect()->route('home.index') + ->withSuccess(\trans('auth.welcome-restore')); } - if (auth()->viaRemember() && $user->group_id == $disabled_group[0]) { + if (\auth()->viaRemember() && $user->group_id == $disabled_group[0]) { $user->group_id = $member_group[0]; $user->can_upload = 1; $user->can_download = 1; @@ -116,16 +116,16 @@ protected function authenticated(Request $request, $user) $user->disabled_at = null; $user->save(); - return redirect()->route('home.index') - ->withSuccess(trans('auth.welcome-restore')); + return \redirect()->route('home.index') + ->withSuccess(\trans('auth.welcome-restore')); } if ($user->read_rules == 0) { - return redirect()->to(config('other.rules_url')) - ->withWarning(trans('auth.require-rules')); + return \redirect()->to(\config('other.rules_url')) + ->withWarning(\trans('auth.require-rules')); } - return redirect()->route('home.index') - ->withSuccess(trans('auth.welcome')); + return \redirect()->route('home.index') + ->withSuccess(\trans('auth.welcome')); } } diff --git a/app/Http/Controllers/Auth/RegisterController.php b/app/Http/Controllers/Auth/RegisterController.php index d7ce4f922e..4acc56f3fb 100644 --- a/app/Http/Controllers/Auth/RegisterController.php +++ b/app/Http/Controllers/Auth/RegisterController.php @@ -55,66 +55,66 @@ public function __construct(ChatRepository $chatRepository) public function registrationForm($code = null) { // Make sure open reg is off, invite code is not present and application signups enabled - if ($code === 'null' && config('other.invite-only') == 1 && config('other.application_signups') == true) { - return redirect()->route('application.create') - ->withInfo(trans('auth.allow-invite-appl')); + if ($code === 'null' && \config('other.invite-only') == 1 && \config('other.application_signups') == true) { + return \redirect()->route('application.create') + ->withInfo(\trans('auth.allow-invite-appl')); } // Make sure open reg is off and invite code is not present - if ($code === 'null' && config('other.invite-only') == 1) { - return redirect()->route('login') - ->withWarning(trans('auth.allow-invite')); + if ($code === 'null' && \config('other.invite-only') == 1) { + return \redirect()->route('login') + ->withWarning(\trans('auth.allow-invite')); } - return view('auth.register', ['code' => $code]); + return \view('auth.register', ['code' => $code]); } public function register(Request $request, $code = null) { // Make sure open reg is off and invite code exist and has not been used already $key = Invite::where('code', '=', $code)->first(); - if (config('other.invite-only') == 1 && (! $key || $key->accepted_by !== null)) { - return redirect()->route('registrationForm', ['code' => $code]) - ->withErrors(trans('auth.invalid-key')); + if (\config('other.invite-only') == 1 && (! $key || $key->accepted_by !== null)) { + return \redirect()->route('registrationForm', ['code' => $code]) + ->withErrors(\trans('auth.invalid-key')); } - $validating_group = cache()->rememberForever('validating_group', fn () => Group::where('slug', '=', 'validating')->pluck('id')); + $validating_group = \cache()->rememberForever('validating_group', fn () => Group::where('slug', '=', 'validating')->pluck('id')); $user = new User(); $user->username = $request->input('username'); $user->email = $request->input('email'); $user->password = Hash::make($request->input('password')); - $user->passkey = md5(uniqid().time().microtime()); - $user->rsskey = md5(uniqid().time().microtime().$user->password); - $user->uploaded = config('other.default_upload'); - $user->downloaded = config('other.default_download'); - $user->style = config('other.default_style', 0); - $user->locale = config('app.locale'); + $user->passkey = \md5(\uniqid().\time().\microtime()); + $user->rsskey = \md5(\uniqid().\time().\microtime().$user->password); + $user->uploaded = \config('other.default_upload'); + $user->downloaded = \config('other.default_download'); + $user->style = \config('other.default_style', 0); + $user->locale = \config('app.locale'); $user->group_id = $validating_group[0]; - if (config('email-blacklist.enabled') == true) { - if (config('captcha.enabled') == false) { - $v = validator($request->all(), [ + if (\config('email-blacklist.enabled') == true) { + if (\config('captcha.enabled') == false) { + $v = \validator($request->all(), [ 'username' => 'required|alpha_dash|string|between:3,25|unique:users', 'password' => 'required|string|between:8,16', 'email' => 'required|string|email|max:70|blacklist|unique:users', ]); } else { - $v = validator($request->all(), [ + $v = \validator($request->all(), [ 'username' => 'required|alpha_dash|string|between:3,25|unique:users', 'password' => 'required|string|between:8,16', 'email' => 'required|string|email|max:70|blacklist|unique:users', 'captcha' => 'hiddencaptcha', ]); } - } elseif (config('captcha.enabled') == false) { - $v = validator($request->all(), [ + } elseif (\config('captcha.enabled') == false) { + $v = \validator($request->all(), [ 'username' => 'required|alpha_dash|string|between:3,25|unique:users', 'password' => 'required|string|between:8,16', 'email' => 'required|string|email|max:70|unique:users', ]); } else { - $v = validator($request->all(), [ + $v = \validator($request->all(), [ 'username' => 'required|alpha_dash|string|between:3,25|unique:users', 'password' => 'required|string|between:6,16', 'email' => 'required|string|email|max:70|unique:users', @@ -123,7 +123,7 @@ public function register(Request $request, $code = null) } if ($v->fails()) { - return redirect()->route('registrationForm', ['code' => $code]) + return \redirect()->route('registrationForm', ['code' => $code]) ->withErrors($v->errors()); } $user->save(); @@ -142,24 +142,24 @@ public function register(Request $request, $code = null) $key->save(); } // Handle The Activation System - $token = hash_hmac('sha256', $user->username.$user->email.Str::random(16), config('app.key')); + $token = \hash_hmac('sha256', $user->username.$user->email.Str::random(16), \config('app.key')); $userActivation = new UserActivation(); $userActivation->user_id = $user->id; $userActivation->token = $token; $userActivation->save(); $this->dispatch(new SendActivationMail($user, $token)); // Select A Random Welcome Message - $profile_url = href_profile($user); + $profile_url = \href_profile($user); $welcomeArray = [ - sprintf('[url=%s]%s[/url], Welcome to ', $profile_url, $user->username).config('other.title').'! Hope you enjoy the community :rocket:', - sprintf("[url=%s]%s[/url], We've been expecting you :space_invader:", $profile_url, $user->username), - sprintf("[url=%s]%s[/url] has arrived. Party's over. :cry:", $profile_url, $user->username), - sprintf("It's a bird! It's a plane! Nevermind, it's just [url=%s]%s[/url].", $profile_url, $user->username), - sprintf('Ready player [url=%s]%s[/url].', $profile_url, $user->username), - sprintf('A wild [url=%s]%s[/url] appeared.', $profile_url, $user->username), - 'Welcome to '.config('other.title').sprintf(' [url=%s]%s[/url]. We were expecting you ( ͡° ͜ʖ ͡°)', $profile_url, $user->username), + \sprintf('[url=%s]%s[/url], Welcome to ', $profile_url, $user->username).\config('other.title').'! Hope you enjoy the community :rocket:', + \sprintf("[url=%s]%s[/url], We've been expecting you :space_invader:", $profile_url, $user->username), + \sprintf("[url=%s]%s[/url] has arrived. Party's over. :cry:", $profile_url, $user->username), + \sprintf("It's a bird! It's a plane! Nevermind, it's just [url=%s]%s[/url].", $profile_url, $user->username), + \sprintf('Ready player [url=%s]%s[/url].', $profile_url, $user->username), + \sprintf('A wild [url=%s]%s[/url] appeared.', $profile_url, $user->username), + 'Welcome to '.\config('other.title').\sprintf(' [url=%s]%s[/url]. We were expecting you ( ͡° ͜ʖ ͡°)', $profile_url, $user->username), ]; - $selected = mt_rand(0, count($welcomeArray) - 1); + $selected = \mt_rand(0, \count($welcomeArray) - 1); $this->chatRepository->systemMessage( $welcomeArray[$selected] ); @@ -167,11 +167,11 @@ public function register(Request $request, $code = null) $privateMessage = new PrivateMessage(); $privateMessage->sender_id = 1; $privateMessage->receiver_id = $user->id; - $privateMessage->subject = config('welcomepm.subject'); - $privateMessage->message = config('welcomepm.message'); + $privateMessage->subject = \config('welcomepm.subject'); + $privateMessage->message = \config('welcomepm.message'); $privateMessage->save(); - return redirect()->route('login') - ->withSuccess(trans('auth.register-thanks')); + return \redirect()->route('login') + ->withSuccess(\trans('auth.register-thanks')); } } diff --git a/app/Http/Controllers/Auth/ResetPasswordController.php b/app/Http/Controllers/Auth/ResetPasswordController.php index 55e97499a8..fa317bb89a 100644 --- a/app/Http/Controllers/Auth/ResetPasswordController.php +++ b/app/Http/Controllers/Auth/ResetPasswordController.php @@ -32,9 +32,9 @@ public function __construct() protected function resetPassword($user, $password) { - $validating_group = cache()->rememberForever('validating_group', fn () => Group::where('slug', '=', 'validating')->pluck('id')); - $member_group = cache()->rememberForever('member_group', fn () => Group::where('slug', '=', 'user')->pluck('id')); - $user->password = bcrypt($password); + $validating_group = \cache()->rememberForever('validating_group', fn () => Group::where('slug', '=', 'validating')->pluck('id')); + $member_group = \cache()->rememberForever('member_group', fn () => Group::where('slug', '=', 'user')->pluck('id')); + $user->password = \bcrypt($password); $user->remember_token = Str::random(60); if ($user->group_id === $validating_group[0]) { diff --git a/app/Http/Controllers/Auth/TwoStepController.php b/app/Http/Controllers/Auth/TwoStepController.php index 421480aced..8afe2526b5 100644 --- a/app/Http/Controllers/Auth/TwoStepController.php +++ b/app/Http/Controllers/Auth/TwoStepController.php @@ -55,14 +55,14 @@ public function __construct() */ private function setUser2StepData() { - $user = auth()->user(); + $user = \auth()->user(); $twoStepAuth = $this->getTwoStepAuthStatus($user->id); $authCount = $twoStepAuth->authCount; $this->_user = $user; $this->_twoStepAuth = $twoStepAuth; $this->_authCount = $authCount; $this->_authStatus = $twoStepAuth->authStatus; - $this->_remainingAttempts = config('auth.TwoStepExceededCount') - $authCount; + $this->_remainingAttempts = \config('auth.TwoStepExceededCount') - $authCount; } /** @@ -78,7 +78,7 @@ private function invalidCodeReturnData($errors = null) $this->_twoStepAuth->save(); $returnData = [ - 'message' => trans('auth.titleFailed'), + 'message' => \trans('auth.titleFailed'), 'authCount' => $this->_authCount, 'remainingAttempts' => $this->_remainingAttempts, ]; @@ -99,8 +99,8 @@ private function invalidCodeReturnData($errors = null) */ public function showVerification() { - if (! config('auth.TwoStepEnabled')) { - abort(404); + if (! \config('auth.TwoStepEnabled')) { + \abort(404); } $twoStepAuth = $this->_twoStepAuth; @@ -115,13 +115,13 @@ public function showVerification() 'remainingAttempts' => $this->_remainingAttempts + 1, ]; - if ($this->_authCount > config('auth.TwoStepExceededCount')) { + if ($this->_authCount > \config('auth.TwoStepExceededCount')) { $exceededTimeDetails = $this->exceededTimeParser($twoStepAuth->updated_at); $data['timeUntilUnlock'] = $exceededTimeDetails['tomorrow']; $data['timeCountdownUnlock'] = $exceededTimeDetails['remaining']; - return view('auth.twostep-exceeded')->with($data); + return \view('auth.twostep-exceeded')->with($data); } $carbon = new Carbon(); @@ -135,7 +135,7 @@ public function showVerification() if (! $sentTimestamp) { $this->sendVerificationCodeNotification($twoStepAuth); } else { - $timeBuffer = config('laravel2step.laravel2stepTimeResetBufferSeconds'); + $timeBuffer = \config('laravel2step.laravel2stepTimeResetBufferSeconds'); $timeAllowedToSendCode = $sentTimestamp->addSeconds($timeBuffer); if ($carbon->gt($timeAllowedToSendCode)) { $this->sendVerificationCodeNotification($twoStepAuth); @@ -144,7 +144,7 @@ public function showVerification() } } - return view('auth.twostep-verification')->with($data); + return \view('auth.twostep-verification')->with($data); } /** @@ -156,12 +156,12 @@ public function showVerification() */ public function verify(Request $request) { - if (! config('auth.TwoStepEnabled')) { - abort(404); + if (! \config('auth.TwoStepEnabled')) { + \abort(404); } if ($request->ajax()) { - $validator = validator($request->all(), [ + $validator = \validator($request->all(), [ 'v_input_1' => 'required|min:1|max:1', 'v_input_2' => 'required|min:1|max:1', 'v_input_3' => 'required|min:1|max:1', @@ -171,7 +171,7 @@ public function verify(Request $request) if ($validator->fails()) { $returnData = $this->invalidCodeReturnData($validator->errors()); - return response()->json($returnData, 418); + return \response()->json($returnData, 418); } $code = $request->v_input_1.$request->v_input_2.$request->v_input_3.$request->v_input_4; @@ -180,19 +180,19 @@ public function verify(Request $request) if ($validCode != $code) { $returnData = $this->invalidCodeReturnData(); - return response()->json($returnData, 418); + return \response()->json($returnData, 418); } $this->resetActivationCountdown($this->_twoStepAuth); $returnData = [ - 'nextUri' => session('nextUri', '/'), - 'message' => trans('auth.titlePassed'), + 'nextUri' => \session('nextUri', '/'), + 'message' => \trans('auth.titlePassed'), ]; - return response()->json($returnData, 200); + return \response()->json($returnData, 200); } - abort(404); + \abort(404); } /** @@ -202,18 +202,18 @@ public function verify(Request $request) */ public function resend() { - if (! config('auth.TwoStepEnabled')) { - abort(404); + if (! \config('auth.TwoStepEnabled')) { + \abort(404); } $twoStepAuth = $this->_twoStepAuth; $this->sendVerificationCodeNotification($twoStepAuth); $returnData = [ - 'title' => trans('auth.verificationEmailSuccess'), - 'message' => trans('auth.verificationEmailSentMsg'), + 'title' => \trans('auth.verificationEmailSuccess'), + 'message' => \trans('auth.verificationEmailSentMsg'), ]; - return response()->json($returnData, 200); + return \response()->json($returnData, 200); } } diff --git a/app/Http/Controllers/BonusController.php b/app/Http/Controllers/BonusController.php index 095f777da0..4af04e1212 100644 --- a/app/Http/Controllers/BonusController.php +++ b/app/Http/Controllers/BonusController.php @@ -76,7 +76,7 @@ public function gifts(Request $request) $gifts_sent = BonTransactions::where('sender', '=', $user->id)->where('name', '=', 'gift')->sum('cost'); $gifts_received = BonTransactions::where('receiver', '=', $user->id)->where('name', '=', 'gift')->sum('cost'); - return view('bonus.gifts', [ + return \view('bonus.gifts', [ 'user' => $user, 'gifttransactions' => $gifttransactions, 'userbon' => $userbon, @@ -103,7 +103,7 @@ public function tips(Request $request) $tips_sent = BonTransactions::where('sender', '=', $user->id)->where('name', '=', 'tip')->sum('cost'); $tips_received = BonTransactions::where('receiver', '=', $user->id)->where('name', '=', 'tip')->sum('cost'); - return view('bonus.tips', [ + return \view('bonus.tips', [ 'user' => $user, 'bontransactions' => $bontransactions, 'userbon' => $userbon, @@ -131,7 +131,7 @@ public function store(Request $request) $personalFreeleech = $BonExchange->getPersonalFreeleechOption(); $invite = $BonExchange->getInviteOption(); - return view('bonus.store', [ + return \view('bonus.store', [ 'userbon' => $userbon, 'activefl' => $activefl, 'bontransactions' => $bontransactions, @@ -154,7 +154,7 @@ public function gift(Request $request) $user = $request->user(); $userbon = $user->getSeedbonus(); - return view('bonus.gift', [ + return \view('bonus.gift', [ 'userbon' => $userbon, ]); } @@ -208,7 +208,7 @@ public function bonus(Request $request, $username = '') $minute = $total / 60; $second = $minute / 60; - return view('bonus.index', [ + return \view('bonus.index', [ 'userbon' => $userbon, 'dying' => $dying, 'legendary' => $legendary, @@ -245,25 +245,25 @@ public function exchange(Request $request, $id) $user = $request->user(); $userbon = $user->seedbonus; - $BonExchange = resolve(BonExchange::class); + $BonExchange = \resolve(BonExchange::class); $itemCost = $BonExchange->getItemCost($id); if ($userbon >= $itemCost) { $flag = $this->doItemExchange($user->id, $id); if ($flag === '') { - return redirect()->route('bonus_store') + return \redirect()->route('bonus_store') ->withErrors('Bonus Exchange Failed!'); } $user->seedbonus -= $itemCost; $user->save(); } else { - return redirect()->route('bonus_store') + return \redirect()->route('bonus_store') ->withErrors('Bonus Exchange Failed!'); } - return redirect()->route('bonus_store') + return \redirect()->route('bonus_store') ->withSuccess('Bonus Exchange Successful'); } @@ -282,7 +282,7 @@ public function doItemExchange($userID, $itemID) $user_acc = User::findOrFail($userID); $activefl = PersonalFreeleech::where('user_id', '=', $user_acc->id)->first(); - $bon_transactions = resolve(BonTransactions::class); + $bon_transactions = \resolve(BonTransactions::class); if ($item['upload'] == true) { $user_acc->uploaded += $item['value']; @@ -305,7 +305,7 @@ public function doItemExchange($userID, $itemID) $privateMessage->sender_id = 1; $privateMessage->receiver_id = $user_acc->id; $privateMessage->subject = 'Personal 24 Hour Freeleech Activated'; - $privateMessage->message = sprintf('Your [b]Personal 24 Hour Freeleech[/b] session has started! It will expire on %s [b]', $current->addDays(1)->toDayDateTimeString()).config('app.timezone').'[/b]! + $privateMessage->message = \sprintf('Your [b]Personal 24 Hour Freeleech[/b] session has started! It will expire on %s [b]', $current->addDays(1)->toDayDateTimeString()).\config('app.timezone').'[/b]! [color=red][b]THIS IS AN AUTOMATED SYSTEM MESSAGE, PLEASE DO NOT REPLY![/b][/color]'; $privateMessage->save(); } else { @@ -341,9 +341,9 @@ public function sendGift(Request $request) { $user = $request->user(); - $v = validator($request->all(), [ + $v = \validator($request->all(), [ 'to_username' => 'required|exists:users,username|max:180', - 'bonus_points' => sprintf('required|numeric|min:1|max:%s', $user->seedbonus), + 'bonus_points' => \sprintf('required|numeric|min:1|max:%s', $user->seedbonus), 'bonus_message' => 'required|string', ]); @@ -356,7 +356,7 @@ public function sendGift(Request $request) $recipient = User::where('username', '=', $request->input('to_username'))->first(); if (! $recipient || $recipient->id == $user->id) { - return redirect()->route('bonus_store') + return \redirect()->route('bonus_store') ->withErrors('Unable to find specified user'); } @@ -381,42 +381,42 @@ public function sendGift(Request $request) $recipient->notify(new NewBon('gift', $user->username, $bonTransactions)); } - $profile_url = href_profile($user); - $recipient_url = href_profile($recipient); + $profile_url = \href_profile($user); + $recipient_url = \href_profile($recipient); $this->chatRepository->systemMessage( - sprintf('[url=%s]%s[/url] has gifted %s BON to [url=%s]%s[/url]', $profile_url, $user->username, $value, $recipient_url, $recipient->username) + \sprintf('[url=%s]%s[/url] has gifted %s BON to [url=%s]%s[/url]', $profile_url, $user->username, $value, $recipient_url, $recipient->username) ); if ($dest == 'profile') { - return redirect()->route('users.show', ['username' => $recipient->username]) + return \redirect()->route('users.show', ['username' => $recipient->username]) ->withSuccess('Gift Sent'); } - return redirect()->route('bonus_gift') + return \redirect()->route('bonus_gift') ->withSuccess('Gift Sent'); } - $v = validator($request->all(), [ + $v = \validator($request->all(), [ 'to_username' => 'required|exists:users,username|max:180', ]); if ($v->passes()) { $recipient = User::where('username', 'LIKE', $request->input('to_username'))->first(); if (! $recipient || $recipient->id == $user->id) { - return redirect()->route('bonus_store') + return \redirect()->route('bonus_store') ->withErrors('Unable to find specified user'); } if ($dest == 'profile') { - return redirect()->route('users.show', ['username' => $recipient->username]) + return \redirect()->route('users.show', ['username' => $recipient->username]) ->withErrors('You Must Enter An Amount And Message!'); } - return redirect()->route('bonus_gift') + return \redirect()->route('bonus_gift') ->withErrors('You Must Enter An Amount And Message!'); } - return redirect()->route('bonus_store') + return \redirect()->route('bonus_store') ->withErrors('Unable to find specified user'); } @@ -436,15 +436,15 @@ public function tipUploader(Request $request, $id) $tip_amount = $request->input('tip'); if ($tip_amount > $user->seedbonus) { - return redirect()->route('torrent', ['id' => $torrent->id]) + return \redirect()->route('torrent', ['id' => $torrent->id]) ->withErrors('Your To Broke To Tip The Uploader!'); } if ($user->id == $torrent->user_id) { - return redirect()->route('torrent', ['id' => $torrent->id]) + return \redirect()->route('torrent', ['id' => $torrent->id]) ->withErrors('You Cannot Tip Yourself!'); } if ($tip_amount <= 0) { - return redirect()->route('torrent', ['id' => $torrent->id]) + return \redirect()->route('torrent', ['id' => $torrent->id]) ->withErrors('You Cannot Tip A Negative Amount!'); } $uploader->seedbonus += $tip_amount; @@ -467,7 +467,7 @@ public function tipUploader(Request $request, $id) $uploader->notify(new NewUploadTip('torrent', $user->username, $tip_amount, $torrent)); } - return redirect()->route('torrent', ['id' => $torrent->id]) + return \redirect()->route('torrent', ['id' => $torrent->id]) ->withSuccess('Your Tip Was Successfully Applied!'); } @@ -486,20 +486,20 @@ public function tipPoster(Request $request) $post = Post::with('topic')->findOrFail($request->input('post')); $poster = User::where('id', '=', $post->user_id)->firstOrFail(); } else { - abort(404); + \abort(404); } $tip_amount = $request->input('tip'); if ($tip_amount > $user->seedbonus) { - return redirect()->route('forum_topic', ['id' => $post->topic->id]) + return \redirect()->route('forum_topic', ['id' => $post->topic->id]) ->withErrors('You Are To Broke To Tip The Poster!'); } if ($user->id == $poster->id) { - return redirect()->route('forum_topic', ['id' => $post->topic->id]) + return \redirect()->route('forum_topic', ['id' => $post->topic->id]) ->withErrors('You Cannot Tip Yourself!'); } if ($tip_amount <= 0) { - return redirect()->route('forum_topic', ['id' => $post->topic->id]) + return \redirect()->route('forum_topic', ['id' => $post->topic->id]) ->withErrors('You Cannot Tip A Negative Amount!'); } $poster->seedbonus += $tip_amount; @@ -520,7 +520,7 @@ public function tipPoster(Request $request) $poster->notify(new NewPostTip('forum', $user->username, $tip_amount, $post)); - return redirect()->route('forum_topic', ['id' => $post->topic->id]) + return \redirect()->route('forum_topic', ['id' => $post->topic->id]) ->withSuccess('Your Tip Was Successfully Applied!'); } diff --git a/app/Http/Controllers/BookmarkController.php b/app/Http/Controllers/BookmarkController.php index 63ae9ada0f..7aeecb3986 100644 --- a/app/Http/Controllers/BookmarkController.php +++ b/app/Http/Controllers/BookmarkController.php @@ -32,12 +32,12 @@ public function index(Request $request, $username) { $user = User::with('bookmarks')->where('username', '=', $username)->firstOrFail(); - abort_unless(($request->user()->group->is_modo || $request->user()->id == $user->id), 403); + \abort_unless(($request->user()->group->is_modo || $request->user()->id == $user->id), 403); $bookmarks = $user->bookmarks()->latest()->paginate(25); $personal_freeleech = PersonalFreeleech::where('user_id', '=', $user->id)->first(); - return view('user.bookmarks', [ + return \view('user.bookmarks', [ 'user' => $user, 'personal_freeleech' => $personal_freeleech, 'bookmarks' => $bookmarks, @@ -58,12 +58,12 @@ public function store(Request $request, $id) $torrent = Torrent::withAnyStatus()->findOrFail($id); if ($request->user()->isBookmarked($torrent->id)) { - return redirect()->route('torrent', ['id' => $torrent->id]) + return \redirect()->route('torrent', ['id' => $torrent->id]) ->withErrors('Torrent has already been bookmarked.'); } $request->user()->bookmarks()->attach($torrent->id); - return redirect()->route('torrent', ['id' => $torrent->id]) + return \redirect()->route('torrent', ['id' => $torrent->id]) ->withSuccess('Torrent Has Been Bookmarked Successfully!'); } @@ -80,7 +80,7 @@ public function destroy(Request $request, $id) $torrent = Torrent::withAnyStatus()->findOrFail($id); $request->user()->bookmarks()->detach($torrent->id); - return redirect()->route('torrent', ['id' => $torrent->id]) + return \redirect()->route('torrent', ['id' => $torrent->id]) ->withSuccess('Torrent Has Been Unbookmarked Successfully!'); } } diff --git a/app/Http/Controllers/CategoryController.php b/app/Http/Controllers/CategoryController.php index b8afd6a02d..de201e6fb9 100644 --- a/app/Http/Controllers/CategoryController.php +++ b/app/Http/Controllers/CategoryController.php @@ -29,7 +29,7 @@ public function index() { $categories = Category::withCount('torrents')->get()->sortBy('position'); - return view('category.index', ['categories' => $categories]); + return \view('category.index', ['categories' => $categories]); } /** @@ -43,12 +43,12 @@ public function index() public function show(Request $request, $id) { $user = $request->user(); - $movieScrapper = new \App\Services\MovieScrapper(config('api-keys.tmdb'), config('api-keys.tvdb'), config('api-keys.omdb')); + $movieScrapper = new \App\Services\MovieScrapper(\config('api-keys.tmdb'), \config('api-keys.tvdb'), \config('api-keys.omdb')); $category = Category::select(['id', 'name'])->findOrFail($id); $torrents = Torrent::with(['user', 'category', 'type'])->withCount(['thanks', 'comments'])->where('category_id', '=', $id)->orderBy('sticky', 'desc')->latest()->paginate(25); $personal_freeleech = PersonalFreeleech::where('user_id', '=', $user->id)->first(); - return view('category.show', [ + return \view('category.show', [ 'client' => $movieScrapper, 'torrents' => $torrents, 'user' => $user, diff --git a/app/Http/Controllers/CommentController.php b/app/Http/Controllers/CommentController.php index 2efd90b9c0..a82bc4c1ef 100644 --- a/app/Http/Controllers/CommentController.php +++ b/app/Http/Controllers/CommentController.php @@ -74,7 +74,7 @@ public function article(Request $request, $id) $user = $request->user(); if ($user->can_comment == 0) { - return redirect()->route('articles.show', ['id' => $article->id]) + return \redirect()->route('articles.show', ['id' => $article->id]) ->withErrors('Your Comment Rights Have Been Revoked!'); } @@ -84,7 +84,7 @@ public function article(Request $request, $id) $comment->user_id = $user->id; $comment->article_id = $article->id; - $v = validator($comment->toArray(), [ + $v = \validator($comment->toArray(), [ 'content' => 'required', 'user_id' => 'required', 'article_id' => 'required', @@ -92,25 +92,25 @@ public function article(Request $request, $id) ]); if ($v->fails()) { - return redirect()->route('articles.show', ['id' => $article->id]) + return \redirect()->route('articles.show', ['id' => $article->id]) ->withErrors($v->errors()); } $comment->save(); - $article_url = href_article($article); - $profile_url = href_profile($user); + $article_url = \href_article($article); + $profile_url = \href_profile($user); // Auto Shout if ($comment->anon == 0) { $this->chatRepository->systemMessage( - sprintf('[url=%s]%s[/url] has left a comment on article [url=%s]%s[/url]', $profile_url, $user->username, $article_url, $article->title) + \sprintf('[url=%s]%s[/url] has left a comment on article [url=%s]%s[/url]', $profile_url, $user->username, $article_url, $article->title) ); } else { $this->chatRepository->systemMessage( - sprintf('An anonymous user has left a comment on article [url=%s]%s[/url]', $article_url, $article->title) + \sprintf('An anonymous user has left a comment on article [url=%s]%s[/url]', $article_url, $article->title) ); } if ($this->taggedUserRepository->hasTags($request->input('content'))) { if ($this->taggedUserRepository->contains($request->input('content'), '@here') && $user->group->is_modo) { - $users = collect([]); + $users = \collect([]); $article->comments()->get()->each(function ($c) use ($users) { $users->push($c->user); @@ -147,7 +147,7 @@ public function article(Request $request, $id) $user->addProgress(new UserMade800Comments(), 1); $user->addProgress(new UserMade900Comments(), 1); - return redirect()->route('articles.show', ['id' => $article->id]) + return \redirect()->route('articles.show', ['id' => $article->id]) ->withSuccess('Your Comment Has Been Added!'); } @@ -162,10 +162,10 @@ public function article(Request $request, $id) public function playlist(Request $request, $id) { $playlist = Playlist::findOrFail($id); - $user = auth()->user(); + $user = \auth()->user(); if ($user->can_comment == 0) { - return redirect()->route('playlists.show', ['id' => $playlist->id]) + return \redirect()->route('playlists.show', ['id' => $playlist->id]) ->withErrors('Your Comment Rights Have Been Revoked!'); } @@ -175,7 +175,7 @@ public function playlist(Request $request, $id) $comment->user_id = $user->id; $comment->playlist_id = $playlist->id; - $v = validator($comment->toArray(), [ + $v = \validator($comment->toArray(), [ 'content' => 'required', 'user_id' => 'required', 'playlist_id' => 'required', @@ -183,25 +183,25 @@ public function playlist(Request $request, $id) ]); if ($v->fails()) { - return redirect()->route('playlists.show', ['id' => $playlist->id]) + return \redirect()->route('playlists.show', ['id' => $playlist->id]) ->withErrors($v->errors()); } $comment->save(); - $playlist_url = href_playlist($playlist); - $profile_url = href_profile($user); + $playlist_url = \href_playlist($playlist); + $profile_url = \href_profile($user); // Auto Shout if ($comment->anon == 0) { $this->chatRepository->systemMessage( - sprintf('[url=%s]%s[/url] has left a comment on playlist [url=%s]%s[/url]', $profile_url, $user->username, $playlist_url, $playlist->name) + \sprintf('[url=%s]%s[/url] has left a comment on playlist [url=%s]%s[/url]', $profile_url, $user->username, $playlist_url, $playlist->name) ); } else { $this->chatRepository->systemMessage( - sprintf('An anonymous user has left a comment on playlist [url=%s]%s[/url]', $playlist_url, $playlist->name) + \sprintf('An anonymous user has left a comment on playlist [url=%s]%s[/url]', $playlist_url, $playlist->name) ); } if ($this->taggedUserRepository->hasTags($request->input('content'))) { if ($this->taggedUserRepository->contains($request->input('content'), '@here') && $user->group->is_modo) { - $users = collect([]); + $users = \collect([]); $playlist->comments()->get()->each(function ($c) use ($users) { $users->push($c->user); @@ -238,7 +238,7 @@ public function playlist(Request $request, $id) $user->addProgress(new UserMade800Comments(), 1); $user->addProgress(new UserMade900Comments(), 1); - return redirect()->route('playlists.show', ['id' => $playlist->id, 'hash' => '#comments']) + return \redirect()->route('playlists.show', ['id' => $playlist->id, 'hash' => '#comments']) ->withSuccess('Your Comment Has Been Added!'); } @@ -256,7 +256,7 @@ public function torrent(Request $request, $id) $user = $request->user(); if ($user->can_comment == 0) { - return redirect()->route('torrent', ['id' => $torrent->id]) + return \redirect()->route('torrent', ['id' => $torrent->id]) ->withErrors('Your Comment Rights Have Been Revoked!'); } @@ -266,7 +266,7 @@ public function torrent(Request $request, $id) $comment->user_id = $user->id; $comment->torrent_id = $torrent->id; - $v = validator($comment->toArray(), [ + $v = \validator($comment->toArray(), [ 'content' => 'required', 'user_id' => 'required', 'torrent_id' => 'required', @@ -274,7 +274,7 @@ public function torrent(Request $request, $id) ]); if ($v->fails()) { - return redirect()->route('torrent', ['id' => $torrent->id]) + return \redirect()->route('torrent', ['id' => $torrent->id]) ->withErrors($v->errors()); } $comment->save(); @@ -282,21 +282,21 @@ public function torrent(Request $request, $id) if ($user->id != $torrent->user_id) { $torrent->notifyUploader('comment', $comment); } - $torrent_url = href_torrent($torrent); - $profile_url = href_profile($user); + $torrent_url = \href_torrent($torrent); + $profile_url = \href_profile($user); // Auto Shout if ($comment->anon == 0) { $this->chatRepository->systemMessage( - sprintf('[url=%s]%s[/url] has left a comment on Torrent [url=%s]%s[/url]', $profile_url, $user->username, $torrent_url, $torrent->name) + \sprintf('[url=%s]%s[/url] has left a comment on Torrent [url=%s]%s[/url]', $profile_url, $user->username, $torrent_url, $torrent->name) ); } else { $this->chatRepository->systemMessage( - sprintf('An anonymous user has left a comment on torrent [url=%s]%s[/url]', $torrent_url, $torrent->name) + \sprintf('An anonymous user has left a comment on torrent [url=%s]%s[/url]', $torrent_url, $torrent->name) ); } if ($this->taggedUserRepository->hasTags($request->input('content'))) { if ($this->taggedUserRepository->contains($request->input('content'), '@here') && $user->group->is_modo) { - $users = collect([]); + $users = \collect([]); $torrent->comments()->get()->each(function ($c) use ($users) { $users->push($c->user); @@ -333,7 +333,7 @@ public function torrent(Request $request, $id) $user->addProgress(new UserMade800Comments(), 1); $user->addProgress(new UserMade900Comments(), 1); - return redirect()->route('torrent', ['id' => $torrent->id, 'hash' => '#comments']) + return \redirect()->route('torrent', ['id' => $torrent->id, 'hash' => '#comments']) ->withSuccess('Your Comment Has Been Added!'); } @@ -351,7 +351,7 @@ public function request(Request $request, $id) $user = $request->user(); if ($user->can_comment == 0) { - return redirect()->route('request', ['id' => $tr->id]) + return \redirect()->route('request', ['id' => $tr->id]) ->withErrors('Your Comment Rights Have Been Revoked!'); } @@ -361,7 +361,7 @@ public function request(Request $request, $id) $comment->user_id = $user->id; $comment->requests_id = $tr->id; - $v = validator($comment->toArray(), [ + $v = \validator($comment->toArray(), [ 'content' => 'required', 'user_id' => 'required', 'requests_id' => 'required', @@ -369,20 +369,20 @@ public function request(Request $request, $id) ]); if ($v->fails()) { - return redirect()->route('request', ['id' => $tr->id]) + return \redirect()->route('request', ['id' => $tr->id]) ->withErrors($v->errors()); } $comment->save(); - $tr_url = href_request($tr); - $profile_url = href_profile($user); + $tr_url = \href_request($tr); + $profile_url = \href_profile($user); // Auto Shout if ($comment->anon == 0) { $this->chatRepository->systemMessage( - sprintf('[url=%s]%s[/url] has left a comment on Request [url=%s]%s[/url]', $profile_url, $user->username, $tr_url, $tr->name) + \sprintf('[url=%s]%s[/url] has left a comment on Request [url=%s]%s[/url]', $profile_url, $user->username, $tr_url, $tr->name) ); } else { $this->chatRepository->systemMessage( - sprintf('An anonymous user has left a comment on Request [url=%s]%s[/url]', $tr_url, $tr->name) + \sprintf('An anonymous user has left a comment on Request [url=%s]%s[/url]', $tr_url, $tr->name) ); } //Notification @@ -391,7 +391,7 @@ public function request(Request $request, $id) } if ($this->taggedUserRepository->hasTags($request->input('content'))) { if ($this->taggedUserRepository->contains($request->input('content'), '@here') && $user->group->is_modo) { - $users = collect([]); + $users = \collect([]); $tr->comments()->get()->each(function ($c) use ($users) { $users->push($c->user); @@ -428,7 +428,7 @@ public function request(Request $request, $id) $user->addProgress(new UserMade800Comments(), 1); $user->addProgress(new UserMade900Comments(), 1); - return redirect()->route('request', ['id' => $tr->id, 'hash' => '#comments']) + return \redirect()->route('request', ['id' => $tr->id, 'hash' => '#comments']) ->withSuccess('Your Comment Has Been Added!'); } @@ -446,7 +446,7 @@ public function quickthanks(Request $request, $id) $user = $request->user(); if ($user->can_comment == 0) { - return redirect()->route('torrent', ['id' => $torrent->id]) + return \redirect()->route('torrent', ['id' => $torrent->id]) ->withErrors('Your Comment Rights Have Been Revoked!'); } @@ -460,28 +460,28 @@ public function quickthanks(Request $request, $id) ]; } else { $uploader = User::where('id', '=', $torrent->user_id)->first(); - $uploader_url = href_profile($uploader); + $uploader_url = \href_profile($uploader); $thankArray = [ - sprintf('Thanks for the upload [url=%s][color=%s][b]%s[/b][/color][/url] :vulcan_tone2:', $uploader_url, $uploader->group->color, $uploader->username), - sprintf('Beautiful upload [url=%s][color=%s][b]%s[/b][/color][/url] :fire:', $uploader_url, $uploader->group->color, $uploader->username), - sprintf('Cheers [url=%s][color=%s][b]%s[/b][/color][/url] for the upload :beers:', $uploader_url, $uploader->group->color, $uploader->username), + \sprintf('Thanks for the upload [url=%s][color=%s][b]%s[/b][/color][/url] :vulcan_tone2:', $uploader_url, $uploader->group->color, $uploader->username), + \sprintf('Beautiful upload [url=%s][color=%s][b]%s[/b][/color][/url] :fire:', $uploader_url, $uploader->group->color, $uploader->username), + \sprintf('Cheers [url=%s][color=%s][b]%s[/b][/color][/url] for the upload :beers:', $uploader_url, $uploader->group->color, $uploader->username), ]; } - $selected = mt_rand(0, (is_countable($thankArray) ? count($thankArray) : 0) - 1); + $selected = \mt_rand(0, (\is_countable($thankArray) ? \count($thankArray) : 0) - 1); $comment->content = $thankArray[$selected]; $comment->user_id = $user->id; $comment->torrent_id = $torrent->id; - $v = validator($comment->toArray(), [ + $v = \validator($comment->toArray(), [ 'content' => 'required', 'user_id' => 'required', 'torrent_id' => 'required', ]); if ($v->fails()) { - return redirect()->route('torrent', ['id' => $torrent->id]) + return \redirect()->route('torrent', ['id' => $torrent->id]) ->withErrors($v->errors()); } $comment->save(); @@ -503,13 +503,13 @@ public function quickthanks(Request $request, $id) User::find($torrent->user_id)->notify(new NewComment('torrent', $comment)); } // Auto Shout - $torrent_url = href_torrent($torrent); - $profile_url = href_profile($user); + $torrent_url = \href_torrent($torrent); + $profile_url = \href_profile($user); $this->chatRepository->systemMessage( - sprintf('[url=%s]%s[/url] has left a comment on Torrent [url=%s]%s[/url]', $profile_url, $user->username, $torrent_url, $torrent->name) + \sprintf('[url=%s]%s[/url] has left a comment on Torrent [url=%s]%s[/url]', $profile_url, $user->username, $torrent_url, $torrent->name) ); - return redirect()->route('torrent', ['id' => $torrent->id]) + return \redirect()->route('torrent', ['id' => $torrent->id]) ->withSuccess('Your Comment Has Been Added!'); } @@ -526,22 +526,22 @@ public function editComment(Request $request, $comment_id) $user = $request->user(); $comment = Comment::findOrFail($comment_id); - abort_unless($user->group->is_modo || $user->id == $comment->user_id, 403); + \abort_unless($user->group->is_modo || $user->id == $comment->user_id, 403); $content = $request->input('comment-edit'); $comment->content = $content; - $v = validator($comment->toArray(), [ + $v = \validator($comment->toArray(), [ 'content' => 'required', ]); if ($v->fails()) { - return redirect()->back() + return \redirect()->back() ->withErrors($v->errors()); } $comment->save(); - return redirect()->back()->withSuccess('Comment Has Been Edited.'); + return \redirect()->back()->withSuccess('Comment Has Been Edited.'); } /** @@ -557,9 +557,9 @@ public function deleteComment(Request $request, $comment_id) $user = $request->user(); $comment = Comment::findOrFail($comment_id); - abort_unless($user->group->is_modo || $user->id == $comment->user_id, 403); + \abort_unless($user->group->is_modo || $user->id == $comment->user_id, 403); $comment->delete(); - return redirect()->back()->withSuccess('Comment Has Been Deleted.'); + return \redirect()->back()->withSuccess('Comment Has Been Deleted.'); } } diff --git a/app/Http/Controllers/ContactController.php b/app/Http/Controllers/ContactController.php index af123ffb1a..3cbddab40e 100644 --- a/app/Http/Controllers/ContactController.php +++ b/app/Http/Controllers/ContactController.php @@ -27,7 +27,7 @@ class ContactController extends Controller */ public function index() { - return view('contact.index'); + return \view('contact.index'); } /** @@ -40,12 +40,12 @@ public function index() public function store(Request $request) { // Fetch owner account - $user = User::where('username', config('unit3d.owner-username'))->first(); + $user = User::where('username', \config('unit3d.owner-username'))->first(); $input = $request->all(); Mail::to($user->email, $user->username)->send(new Contact($input)); - return redirect()->route('home.index') + return \redirect()->route('home.index') ->withSuccess('Your Message Was Successfully Sent'); } } diff --git a/app/Http/Controllers/FollowController.php b/app/Http/Controllers/FollowController.php index 8d09945dc0..ff5e446fb7 100644 --- a/app/Http/Controllers/FollowController.php +++ b/app/Http/Controllers/FollowController.php @@ -34,7 +34,7 @@ public function store(Request $request, $username) $user = User::where('username', '=', $username)->firstOrFail(); if ($request->user()->id == $user->id) { - return redirect()->route('users.show', ['username' => $user->username]) + return \redirect()->route('users.show', ['username' => $user->username]) ->withErrors('Nice try, but sadly you can not follow yourself.'); } @@ -47,11 +47,11 @@ public function store(Request $request, $username) $user->notify(new NewFollow('user', $request->user(), $user, $follow)); } - return redirect()->route('users.show', ['username' => $user->username]) - ->withSuccess(sprintf('You are now following %s', $user->username)); + return \redirect()->route('users.show', ['username' => $user->username]) + ->withSuccess(\sprintf('You are now following %s', $user->username)); } - return redirect()->route('users.show', ['username' => $user->username]) + return \redirect()->route('users.show', ['username' => $user->username]) ->withErrors('You are already following this user'); } @@ -74,11 +74,11 @@ public function destroy(Request $request, $username) $user->notify(new NewUnfollow('user', $request->user(), $user, $follow)); } - return redirect()->route('users.show', ['username' => $user->username]) - ->withSuccess(sprintf('You are no longer following %s', $user->username)); + return \redirect()->route('users.show', ['username' => $user->username]) + ->withSuccess(\sprintf('You are no longer following %s', $user->username)); } - return redirect()->route('users.show', ['username' => $user->username]) + return \redirect()->route('users.show', ['username' => $user->username]) ->withErrors('You are not following this user to begin with'); } } diff --git a/app/Http/Controllers/ForumCategoryController.php b/app/Http/Controllers/ForumCategoryController.php index 152e95e39c..99db6fe4f4 100644 --- a/app/Http/Controllers/ForumCategoryController.php +++ b/app/Http/Controllers/ForumCategoryController.php @@ -40,20 +40,20 @@ public function show($id) // Check if this is a category or forum if ($forum->parent_id != 0) { - return redirect()->route('forums.show', ['id' => $forum->id]); + return \redirect()->route('forums.show', ['id' => $forum->id]); } // Check if the user has permission to view the forum $category = Forum::findOrFail($forum->id); if ($category->getPermission()->show_forum != true) { - return redirect()->route('forums.index') + return \redirect()->route('forums.index') ->withErrors('You Do Not Have Access To This Category!'); } // Fetch topics->posts in descending order $topics = $forum->sub_topics()->latest('pinned')->latest('last_reply_at')->latest()->paginate(25); - return view('forum.category', [ + return \view('forum.category', [ 'forum' => $forum, 'topics' => $topics, 'category' => $category, diff --git a/app/Http/Controllers/ForumController.php b/app/Http/Controllers/ForumController.php index 3a9c8e2476..d5f1738964 100644 --- a/app/Http/Controllers/ForumController.php +++ b/app/Http/Controllers/ForumController.php @@ -58,17 +58,17 @@ public function search(Request $request) $user = $request->user(); $pests = $user->group->permissions->where('show_forum', '=', 0)->pluck('forum_id')->toArray(); - if (! is_array($pests)) { + if (! \is_array($pests)) { $pests = []; } $topic_neos = $user->subscriptions->where('topic_id', '>', 0)->pluck('topic_id')->toArray(); - if (! is_array($topic_neos)) { + if (! \is_array($topic_neos)) { $topic_neos = []; } $forum_neos = $user->subscriptions->where('forum_id', '>', 0)->pluck('forum_id')->toArray(); - if (! is_array($forum_neos)) { + if (! \is_array($forum_neos)) { $forum_neos = []; } @@ -129,7 +129,7 @@ public function search(Request $request) $category = (int) $request->input('category'); if ($category > 0 && $category < 99_999_999_999) { $children = Forum::where('parent_id', '=', $category)->get()->toArray(); - if (is_array($children)) { + if (\is_array($children)) { $result->where(function ($query) use ($category, $children) { $query->where('topics.forum_id', '=', $category)->orWhereIn('topics.forum_id', $children); }); @@ -139,7 +139,7 @@ public function search(Request $request) if ($request->has('body') && $request->input('body') != '') { if ($request->has('sorting') && $request->input('sorting') != null) { - $sorting = sprintf('posts.%s', $request->input('sorting')); + $sorting = \sprintf('posts.%s', $request->input('sorting')); $direction = $request->input('direction'); } else { $sorting = 'posts.id'; @@ -148,7 +148,7 @@ public function search(Request $request) $results = $result->orderBy($sorting, $direction)->paginate(25); } else { if ($request->has('sorting') && $request->input('sorting') != null) { - $sorting = sprintf('topics.%s', $request->input('sorting')); + $sorting = \sprintf('topics.%s', $request->input('sorting')); $direction = $request->input('direction'); } else { $sorting = 'topics.last_reply_at'; @@ -168,7 +168,7 @@ public function search(Request $request) $params = $request->all(); - return view($logger, [ + return \view($logger, [ 'categories' => $categories, 'results' => $results, 'user' => $user, @@ -193,17 +193,17 @@ public function subscriptions(Request $request) $user = $request->user(); $pests = $user->group->permissions->where('show_forum', '=', 0)->pluck('forum_id')->toArray(); - if (! is_array($pests)) { + if (! \is_array($pests)) { $pests = []; } $topic_neos = $user->subscriptions->where('topic_id', '>', '0')->pluck('topic_id')->toArray(); - if (! is_array($topic_neos)) { + if (! \is_array($topic_neos)) { $topic_neos = []; } $forum_neos = $user->subscriptions->where('forum_id', '>', '0')->pluck('forum_id')->toArray(); - if (! is_array($forum_neos)) { + if (! \is_array($forum_neos)) { $forum_neos = []; } $result = Forum::with('subscription_topics')->selectRaw('forums.id,max(forums.position) as position,max(forums.num_topic) as num_topic,max(forums.num_post) as num_post,max(forums.last_topic_id) as last_topic_id,max(forums.last_topic_name) as last_topic_name,max(forums.last_topic_slug) as last_topic_slug,max(forums.last_post_user_id) as last_post_user_id,max(forums.last_post_user_username) as last_post_user_username,max(forums.name) as name,max(forums.slug) as slug,max(forums.description) as description,max(forums.parent_id) as parent_id,max(forums.created_at),max(forums.updated_at),max(topics.id) as topic_id,max(topics.created_at) as topic_created_at')->leftJoin('topics', 'forums.id', '=', 'topics.forum_id')->whereNotIn('topics.forum_id', $pests)->where(function ($query) use ($topic_neos, $forum_neos) { @@ -222,7 +222,7 @@ public function subscriptions(Request $request) $params = $request->all(); - return view('forum.subscriptions', [ + return \view('forum.subscriptions', [ 'results' => $results, 'user' => $user, 'name' => $request->input('name'), @@ -248,7 +248,7 @@ public function latestTopics(Request $request) $user = $request->user(); $pests = $user->group->permissions->where('show_forum', '=', 0)->pluck('forum_id')->toArray(); - if (! is_array($pests)) { + if (! \is_array($pests)) { $pests = []; } @@ -261,7 +261,7 @@ public function latestTopics(Request $request) // Total Topics Count $num_topics = Topic::count(); - return view('forum.latest_topics', [ + return \view('forum.latest_topics', [ 'results' => $results, 'user' => $user, 'num_posts' => $num_posts, @@ -282,7 +282,7 @@ public function latestPosts(Request $request) $user = $request->user(); $pests = $user->group->permissions->where('show_forum', '=', 0)->pluck('forum_id')->toArray(); - if (! is_array($pests)) { + if (! \is_array($pests)) { $pests = []; } @@ -295,7 +295,7 @@ public function latestPosts(Request $request) // Total Topics Count $num_topics = Topic::count(); - return view('forum.latest_posts', [ + return \view('forum.latest_posts', [ 'results' => $results, 'user' => $user, 'num_posts' => $num_posts, @@ -320,7 +320,7 @@ public function index() // Total Topics Count $num_topics = Topic::count(); - return view('forum.index', [ + return \view('forum.index', [ 'categories' => $categories, 'num_posts' => $num_posts, 'num_forums' => $num_forums, @@ -349,20 +349,20 @@ public function show($id) // Check if this is a category or forum if ($forum->parent_id == 0) { - return redirect()->route('forums.categories.show', ['id' => $forum->id]); + return \redirect()->route('forums.categories.show', ['id' => $forum->id]); } // Check if the user has permission to view the forum $category = Forum::findOrFail($forum->parent_id); if ($category->getPermission()->show_forum != true) { - return redirect()->route('forums.index') + return \redirect()->route('forums.index') ->withErrors('You Do Not Have Access To This Forum!'); } // Fetch topics->posts in descending order $topics = $forum->topics()->latest('pinned')->latest('last_reply_at')->latest()->paginate(25); - return view('forum.display', [ + return \view('forum.display', [ 'forum' => $forum, 'topics' => $topics, 'category' => $category, diff --git a/app/Http/Controllers/GraveyardController.php b/app/Http/Controllers/GraveyardController.php index 33c96f7fd4..0dedc186d1 100644 --- a/app/Http/Controllers/GraveyardController.php +++ b/app/Http/Controllers/GraveyardController.php @@ -52,7 +52,7 @@ public function index(Request $request) $repository = $this->torrentFacetedRepository; $deadcount = Torrent::where('seeders', '=', 0)->where('created_at', '<', $current->copy()->subDays(30)->toDateTimeString())->count(); - return view('graveyard.index', [ + return \view('graveyard.index', [ 'user' => $user, 'torrents' => $torrents, 'repository' => $repository, @@ -76,14 +76,14 @@ public function faceted(Request $request, Torrent $torrent) $user = $request->user(); $search = $request->input('search'); $imdb_id = Str::startsWith($request->get('imdb'), 'tt') ? $request->get('imdb') : 'tt'.$request->get('imdb'); - $imdb = str_replace('tt', '', $imdb_id); + $imdb = \str_replace('tt', '', $imdb_id); $tvdb = $request->input('tvdb'); $tmdb = $request->input('tmdb'); $mal = $request->input('mal'); $categories = $request->input('categories'); $types = $request->input('types'); - $terms = explode(' ', $search); + $terms = \explode(' ', $search); $search = ''; foreach ($terms as $term) { $search .= '%'.$term.'%'; @@ -96,7 +96,7 @@ public function faceted(Request $request, Torrent $torrent) } if ($request->has('imdb') && $request->input('imdb') != null) { - $torrent->where('imdb', '=', str_replace('tt', '', $imdb)); + $torrent->where('imdb', '=', \str_replace('tt', '', $imdb)); } if ($request->has('tvdb') && $request->input('tvdb') != null) { @@ -132,7 +132,7 @@ public function faceted(Request $request, Torrent $torrent) $torrents = $torrent->paginate(25); } - return view('graveyard.results', [ + return \view('graveyard.results', [ 'user' => $user, 'torrents' => $torrents, ])->render(); @@ -153,12 +153,12 @@ public function store(Request $request, $id) $resurrected = Graveyard::where('torrent_id', '=', $torrent->id)->first(); if ($resurrected) { - return redirect()->route('graveyard.index') + return \redirect()->route('graveyard.index') ->withErrors('Torrent Resurrection Failed! This torrent is already pending a resurrection.'); } if ($user->id === $torrent->user_id) { - return redirect()->route('graveyard.index') + return \redirect()->route('graveyard.index') ->withErrors('Torrent Resurrection Failed! You cannot resurrect your own uploads.'); } @@ -167,19 +167,19 @@ public function store(Request $request, $id) $graveyard->torrent_id = $torrent->id; $graveyard->seedtime = $request->input('seedtime'); - $v = validator($graveyard->toArray(), [ + $v = \validator($graveyard->toArray(), [ 'user_id' => 'required', 'torrent_id' => 'required', 'seedtime' => 'required', ]); if ($v->fails()) { - return redirect()->route('graveyard.index') + return \redirect()->route('graveyard.index') ->withErrors($v->errors()); } $graveyard->save(); - return redirect()->route('graveyard.index') + return \redirect()->route('graveyard.index') ->withSuccess('Torrent Resurrection Complete! You will be rewarded automatically once seedtime requirements are met.'); } @@ -196,10 +196,10 @@ public function destroy(Request $request, $id) $user = $request->user(); $resurrection = Graveyard::findOrFail($id); - abort_unless($user->group->is_modo || $user->id === $resurrection->user_id, 403); + \abort_unless($user->group->is_modo || $user->id === $resurrection->user_id, 403); $resurrection->delete(); - return redirect()->route('graveyard.index') + return \redirect()->route('graveyard.index') ->withSuccess('Resurrection Successfully Canceled!'); } } diff --git a/app/Http/Controllers/HomeController.php b/app/Http/Controllers/HomeController.php index 8c53764c21..54311f50a5 100644 --- a/app/Http/Controllers/HomeController.php +++ b/app/Http/Controllers/HomeController.php @@ -50,7 +50,7 @@ public function index(Request $request) $user = $request->user(); // Latest Articles/News Block - $articles = cache()->remember('latest_article', $expiresAt, fn () => Article::latest()->take(1)->get()); + $articles = \cache()->remember('latest_article', $expiresAt, fn () => Article::latest()->take(1)->get()); foreach ($articles as $article) { $article->newNews = ($user->updated_at->subDays(3)->getTimestamp() < $article->created_at->getTimestamp()) ? 1 : 0; } @@ -58,25 +58,25 @@ public function index(Request $request) // Latest Torrents Block $personal_freeleech = PersonalFreeleech::where('user_id', '=', $user->id)->first(); - $newest = cache()->remember('newest_torrents', $expiresAt, fn () => Torrent::with(['user', 'category', 'type']) + $newest = \cache()->remember('newest_torrents', $expiresAt, fn () => Torrent::with(['user', 'category', 'type']) ->withCount(['thanks', 'comments']) ->latest() ->take(5) ->get()); - $seeded = cache()->remember('seeded_torrents', $expiresAt, fn () => Torrent::with(['user', 'category', 'type']) + $seeded = \cache()->remember('seeded_torrents', $expiresAt, fn () => Torrent::with(['user', 'category', 'type']) ->withCount(['thanks', 'comments']) ->latest('seeders') ->take(5) ->get()); - $leeched = cache()->remember('leeched_torrents', $expiresAt, fn () => Torrent::with(['user', 'category', 'type']) + $leeched = \cache()->remember('leeched_torrents', $expiresAt, fn () => Torrent::with(['user', 'category', 'type']) ->withCount(['thanks', 'comments']) ->latest('leechers') ->take(5) ->get()); - $dying = cache()->remember('dying_torrents', $expiresAt, fn () => Torrent::with(['user', 'category', 'type']) + $dying = \cache()->remember('dying_torrents', $expiresAt, fn () => Torrent::with(['user', 'category', 'type']) ->withCount(['thanks', 'comments']) ->where('seeders', '=', 1) ->where('times_completed', '>=', 1) @@ -84,7 +84,7 @@ public function index(Request $request) ->take(5) ->get()); - $dead = cache()->remember('dead_torrents', $expiresAt, fn () => Torrent::with(['user', 'category', 'type']) + $dead = \cache()->remember('dead_torrents', $expiresAt, fn () => Torrent::with(['user', 'category', 'type']) ->withCount(['thanks', 'comments']) ->where('seeders', '=', 0) ->latest('leechers') @@ -92,38 +92,38 @@ public function index(Request $request) ->get()); // Latest Topics Block - $topics = cache()->remember('latest_topics', $expiresAt, fn () => Topic::with('forum')->latest()->take(5)->get()); + $topics = \cache()->remember('latest_topics', $expiresAt, fn () => Topic::with('forum')->latest()->take(5)->get()); // Latest Posts Block - $posts = cache()->remember('latest_posts', $expiresAt, fn () => Post::with('topic', 'user')->latest()->take(5)->get()); + $posts = \cache()->remember('latest_posts', $expiresAt, fn () => Post::with('topic', 'user')->latest()->take(5)->get()); // Online Block - $users = cache()->remember('online_users', $expiresAt, fn () => User::with('group', 'privacy') + $users = \cache()->remember('online_users', $expiresAt, fn () => User::with('group', 'privacy') ->withCount([ 'warnings' => function (Builder $query) { $query->whereNotNull('torrent')->where('active', '1'); }, ]) - ->where('last_action', '>', now()->subMinutes(5)) + ->where('last_action', '>', \now()->subMinutes(5)) ->get()); - $groups = cache()->remember('user-groups', $expiresAt, fn () => Group::select(['name', 'color', 'effect', 'icon'])->oldest('position')->get()); + $groups = \cache()->remember('user-groups', $expiresAt, fn () => Group::select(['name', 'color', 'effect', 'icon'])->oldest('position')->get()); // Featured Torrents Block - $featured = cache()->remember('latest_featured', $expiresAt, fn () => FeaturedTorrent::with('torrent')->get()); + $featured = \cache()->remember('latest_featured', $expiresAt, fn () => FeaturedTorrent::with('torrent')->get()); // Latest Poll Block - $poll = cache()->remember('latest_poll', $expiresAt, fn () => Poll::latest()->first()); + $poll = \cache()->remember('latest_poll', $expiresAt, fn () => Poll::latest()->first()); // Top Uploaders Block - $uploaders = cache()->remember('top_uploaders', $expiresAt, fn () => Torrent::with('user') + $uploaders = \cache()->remember('top_uploaders', $expiresAt, fn () => Torrent::with('user') ->select(DB::raw('user_id, count(*) as value')) ->groupBy('user_id') ->latest('value') ->take(10) ->get()); - $past_uploaders = cache()->remember('month_uploaders', $expiresAt, fn () => Torrent::with('user') + $past_uploaders = \cache()->remember('month_uploaders', $expiresAt, fn () => Torrent::with('user') ->where('created_at', '>', $current->copy()->subDays(30)->toDateTimeString()) ->select(DB::raw('user_id, count(*) as value')) ->groupBy('user_id') @@ -134,7 +134,7 @@ public function index(Request $request) $freeleech_tokens = FreeleechToken::where('user_id', $user->id)->get(); $bookmarks = Bookmark::where('user_id', $user->id)->get(); - return view('home.index', [ + return \view('home.index', [ 'user' => $user, 'personal_freeleech' => $personal_freeleech, 'users' => $users, diff --git a/app/Http/Controllers/ImageController.php b/app/Http/Controllers/ImageController.php index 85b3e2dcf5..1993466b87 100644 --- a/app/Http/Controllers/ImageController.php +++ b/app/Http/Controllers/ImageController.php @@ -30,7 +30,7 @@ public function create($id) { $album = Album::find($id); - return view('album.image', ['album' => $album]); + return \view('album.image', ['album' => $album]); } /** @@ -49,14 +49,14 @@ public function store(Request $request) $image->type = $request->input('type'); $file = $request->file('image'); - $random_name = uniqid(); - $destinationPath = public_path('/files/img/'); + $random_name = \uniqid(); + $destinationPath = \public_path('/files/img/'); $clientOriginalExtension = $file->getClientOriginalExtension(); $filename = 'album-image_'.$random_name.'.'.$clientOriginalExtension; $uploadSuccess = $request->file('image')->move($destinationPath, $filename); $image->image = $filename; - $v = validator($image->toArray(), [ + $v = \validator($image->toArray(), [ 'album_id' => 'required|numeric|exists:albums,id', 'user_id' => 'required', 'description' => 'required', @@ -65,12 +65,12 @@ public function store(Request $request) ]); if ($v->fails()) { - return redirect()->route('images.create', ['id' => $request->input('album_id')]) + return \redirect()->route('images.create', ['id' => $request->input('album_id')]) ->withErrors($v->errors()); } $image->save(); - return redirect()->route('albums.show', ['id' => $request->input('album_id')]) + return \redirect()->route('albums.show', ['id' => $request->input('album_id')]) ->withSuccess('Your image has successfully published!'); } @@ -86,15 +86,15 @@ public function download($id) $image = Image::findOrFail($id); $filename = $image->image; - if (! file_exists(getcwd().'/files/img/'.$filename)) { - return redirect()->route('show_album', ['id' => $image->album_id]) + if (! \file_exists(\getcwd().'/files/img/'.$filename)) { + return \redirect()->route('show_album', ['id' => $image->album_id]) ->withErrors('Image File Not Found! Please Report This To Staff!'); } $image->downloads++; $image->save(); - return response()->download(getcwd().'/files/img/'.$filename); + return \response()->download(\getcwd().'/files/img/'.$filename); } /** @@ -110,10 +110,10 @@ public function destroy(Request $request, $id) $user = $request->user(); $image = Image::findOrFail($id); - abort_unless($user->group->is_modo || $user->id === $image->user_id, 403); + \abort_unless($user->group->is_modo || $user->id === $image->user_id, 403); $image->delete(); - return redirect()->route('albums.show', ['id' => $image->album_id]) + return \redirect()->route('albums.show', ['id' => $image->album_id]) ->withSuccess('Image has successfully been deleted'); } } diff --git a/app/Http/Controllers/InviteController.php b/app/Http/Controllers/InviteController.php index 9e94bb2346..91df5e9673 100644 --- a/app/Http/Controllers/InviteController.php +++ b/app/Http/Controllers/InviteController.php @@ -35,11 +35,11 @@ public function index(Request $request, $username) { $user = $request->user(); $owner = User::where('username', '=', $username)->firstOrFail(); - abort_unless($user->group->is_modo || $user->id === $owner->id, 403); + \abort_unless($user->group->is_modo || $user->id === $owner->id, 403); $invites = Invite::with(['sender', 'receiver'])->where('user_id', '=', $owner->id)->latest()->paginate(25); - return view('user.invites', ['owner' => $owner, 'invites' => $invites, 'route' => 'invite']); + return \view('user.invites', ['owner' => $owner, 'invites' => $invites, 'route' => 'invite']); } /** @@ -53,20 +53,20 @@ public function create(Request $request) { $user = $request->user(); - if (config('other.invite-only') == false) { - return redirect()->route('home.index') + if (\config('other.invite-only') == false) { + return \redirect()->route('home.index') ->withErrors('Invitations Are Disabled Due To Open Registration!'); } if ($user->can_invite == 0) { - return redirect()->route('home.index') + return \redirect()->route('home.index') ->withErrors('Your Invite Rights Have Been Revoked!'); } - if (config('other.invites_restriced') == true && ! in_array($user->group->name, config('other.invite_groups'))) { - return redirect()->route('home.index') + if (\config('other.invites_restriced') == true && ! \in_array($user->group->name, \config('other.invite_groups'))) { + return \redirect()->route('home.index') ->withErrors('Invites are currently disabled for your group.'); } - return view('user.invite', ['user' => $user, 'route' => 'invite']); + return \view('user.invite', ['user' => $user, 'route' => 'invite']); } /** @@ -83,20 +83,20 @@ public function store(Request $request) $carbon = new Carbon(); $user = $request->user(); - if (config('other.invites_restriced') == true && ! in_array($user->group->name, config('other.invite_groups'))) { - return redirect()->route('home.index') + if (\config('other.invites_restriced') == true && ! \in_array($user->group->name, \config('other.invite_groups'))) { + return \redirect()->route('home.index') ->withErrors('Invites are currently disabled for your group.'); } if ($user->invites <= 0) { - return redirect()->route('invites.create') + return \redirect()->route('invites.create') ->withErrors('You do not have enough invites!'); } $exist = Invite::where('email', '=', $request->input('email'))->first(); if ($exist) { - return redirect()->route('invites.create') + return \redirect()->route('invites.create') ->withErrors('The email address your trying to send a invite to has already been sent one.'); } @@ -105,23 +105,23 @@ public function store(Request $request) $invite->user_id = $user->id; $invite->email = $request->input('email'); $invite->code = $code; - $invite->expires_on = $carbon->copy()->addDays(config('other.invite_expire')); + $invite->expires_on = $carbon->copy()->addDays(\config('other.invite_expire')); $invite->custom = $request->input('message'); - if (config('email-blacklist.enabled')) { - $v = validator($invite->toArray(), [ + if (\config('email-blacklist.enabled')) { + $v = \validator($invite->toArray(), [ 'email' => 'required|string|email|max:70|blacklist|unique:users', 'custom' => 'required', ]); } else { - $v = validator($invite->toArray(), [ + $v = \validator($invite->toArray(), [ 'email' => 'required|string|email|max:70|unique:users', 'custom' => 'required', ]); } if ($v->fails()) { - return redirect()->route('invites.create') + return \redirect()->route('invites.create') ->withErrors($v->errors()); } Mail::to($request->input('email'))->send(new InviteUser($invite)); @@ -129,7 +129,7 @@ public function store(Request $request) $user->invites--; $user->save(); - return redirect()->route('invites.create') + return \redirect()->route('invites.create') ->withSuccess('Invite was sent successfully!'); } @@ -146,16 +146,16 @@ public function send(Request $request, $id) $user = $request->user(); $invite = Invite::findOrFail($id); - abort_unless($invite->user_id === $user->id, 403); + \abort_unless($invite->user_id === $user->id, 403); if ($invite->accepted_by !== null) { - return redirect()->route('invites.index', ['username' => $user->username]) + return \redirect()->route('invites.index', ['username' => $user->username]) ->withErrors('The invite you are trying to resend has already been used.'); } Mail::to($invite->email)->send(new InviteUser($invite)); - return redirect()->route('invites.index', ['username' => $user->username]) + return \redirect()->route('invites.index', ['username' => $user->username]) ->withSuccess('Invite was resent successfully!'); } } diff --git a/app/Http/Controllers/LanguageController.php b/app/Http/Controllers/LanguageController.php index 0525442155..1de422e80d 100644 --- a/app/Http/Controllers/LanguageController.php +++ b/app/Http/Controllers/LanguageController.php @@ -28,11 +28,11 @@ private function setLocale($locale, $request) { // Check if is allowed and set default locale if not if (! Language::allowed($locale)) { - $locale = config('app.locale'); + $locale = \config('app.locale'); } - if (auth()->check()) { - auth()->user()->setAttribute('locale', $locale)->save(); + if (\auth()->check()) { + \auth()->user()->setAttribute('locale', $locale)->save(); } else { $request->session()->put('locale', $locale); } @@ -50,9 +50,9 @@ public function home($locale, Request $request) { $this->setLocale($locale, $request); - $url = config('language.url') ? url('/'.$locale) : url('/'); + $url = \config('language.url') ? \url('/'.$locale) : \url('/'); - return redirect($url) + return \redirect($url) ->withSuccess('Language Changed!'); } @@ -69,18 +69,18 @@ public function back($locale, Request $request) $this->setLocale($locale, $request); $session = $request->session(); - if (config('language.url')) { - $previous_url = substr(str_replace(env('APP_URL'), '', $session->previousUrl()), 7); - if (strlen($previous_url) === 3) { - $previous_url = substr($previous_url, 3); + if (\config('language.url')) { + $previous_url = \substr(\str_replace(\env('APP_URL'), '', $session->previousUrl()), 7); + if (\strlen($previous_url) === 3) { + $previous_url = \substr($previous_url, 3); } else { - $previous_url = substr($previous_url, strrpos($previous_url, '/') + 1); + $previous_url = \substr($previous_url, \strrpos($previous_url, '/') + 1); } - $url = rtrim(env('APP_URL'), '/').'/'.$locale.'/'.ltrim($previous_url, '/'); + $url = \rtrim(\env('APP_URL'), '/').'/'.$locale.'/'.\ltrim($previous_url, '/'); $session->setPreviousUrl($url); } - return redirect($session->previousUrl()) + return \redirect($session->previousUrl()) ->withSuccess('Language Changed!'); } } diff --git a/app/Http/Controllers/LikeController.php b/app/Http/Controllers/LikeController.php index 679f3b0f85..10d96b57fa 100644 --- a/app/Http/Controllers/LikeController.php +++ b/app/Http/Controllers/LikeController.php @@ -30,18 +30,18 @@ class LikeController extends Controller public function store(Request $request, $postId) { $post = Post::findOrFail($postId); - $postUrl = sprintf('forums/topics/%s?page=%s#post-%s', $post->topic->id, $post->getPageNumber(), $postId); + $postUrl = \sprintf('forums/topics/%s?page=%s#post-%s', $post->topic->id, $post->getPageNumber(), $postId); $user = $request->user(); $like = $user->likes()->where('post_id', '=', $post->id)->where('like', '=', 1)->first(); $dislike = $user->likes()->where('post_id', '=', $post->id)->where('dislike', '=', 1)->first(); if ($like || $dislike) { - return redirect()->to($postUrl) + return \redirect()->to($postUrl) ->withErrors('You have already liked/disliked this post!'); } if ($user->id == $post->user_id) { - return redirect()->to($postUrl) + return \redirect()->to($postUrl) ->withErrors('You cannot like your own post!'); } $new = new Like(); @@ -50,7 +50,7 @@ public function store(Request $request, $postId) $new->like = 1; $new->save(); - return redirect()->to($postUrl) + return \redirect()->to($postUrl) ->withSuccess('Like Successfully Applied!'); } @@ -65,18 +65,18 @@ public function store(Request $request, $postId) public function destroy(Request $request, $postId) { $post = Post::findOrFail($postId); - $postUrl = sprintf('forums/topics/%s?page=%s#post-%s', $post->topic->id, $post->getPageNumber(), $postId); + $postUrl = \sprintf('forums/topics/%s?page=%s#post-%s', $post->topic->id, $post->getPageNumber(), $postId); $user = $request->user(); $like = $user->likes()->where('post_id', '=', $post->id)->where('like', '=', 1)->first(); $dislike = $user->likes()->where('post_id', '=', $post->id)->where('dislike', '=', 1)->first(); if ($like || $dislike) { - return redirect()->to($postUrl) + return \redirect()->to($postUrl) ->withErrors('You have already liked/disliked this post!'); } if ($user->id == $post->user_id) { - return redirect()->to($postUrl) + return \redirect()->to($postUrl) ->withErrors('You cannot dislike your own post!'); } $new = new Like(); @@ -85,7 +85,7 @@ public function destroy(Request $request, $postId) $new->dislike = 1; $new->save(); - return redirect()->to($postUrl) + return \redirect()->to($postUrl) ->withSuccess('Dislike Successfully Applied!'); } } diff --git a/app/Http/Controllers/NotificationController.php b/app/Http/Controllers/NotificationController.php index 8f51b93c47..5614c45073 100644 --- a/app/Http/Controllers/NotificationController.php +++ b/app/Http/Controllers/NotificationController.php @@ -30,7 +30,7 @@ public function index(Request $request) { $notifications = $request->user()->notifications()->paginate(25); - return view('notification.index', ['notifications' => $notifications]); + return \view('notification.index', ['notifications' => $notifications]); } /** @@ -126,7 +126,7 @@ public function faceted(Request $request) $notifications = $notification->paginate(25); - return view('notification.results', [ + return \view('notification.results', [ 'user' => $user, 'notifications' => $notifications, ])->render(); @@ -145,7 +145,7 @@ public function show(Request $request, $id) $notification = $request->user()->notifications()->findOrFail($id); $notification->markAsRead(); - return redirect()->to($notification->data['url']) + return \redirect()->to($notification->data['url']) ->withSuccess('Notification Marked As Read!'); } @@ -162,18 +162,18 @@ public function update(Request $request, $id) $notification = $request->user()->notifications()->where('id', '=', $id)->first(); if (! $notification) { - return redirect()->route('notifications.index') + return \redirect()->route('notifications.index') ->withErrors('Notification Does Not Exist!'); } if ($notification->read_at != null) { - return redirect()->route('notifications.index') + return \redirect()->route('notifications.index') ->withErrors('Notification Already Marked As Read!'); } $notification->markAsRead(); - return redirect()->route('notifications.index') + return \redirect()->route('notifications.index') ->withSuccess('Notification Marked As Read!'); } @@ -191,7 +191,7 @@ public function updateAll(Request $request) $carbon = new Carbon(); $request->user()->unreadNotifications()->update(['read_at' => $carbon]); - return redirect()->route('notifications.index') + return \redirect()->route('notifications.index') ->withSuccess('All Notifications Marked As Read!'); } @@ -207,7 +207,7 @@ public function destroy(Request $request, $id) { $request->user()->notifications()->findOrFail($id)->delete(); - return redirect()->route('notifications.index') + return \redirect()->route('notifications.index') ->withSuccess('Notification Deleted!'); } @@ -222,7 +222,7 @@ public function destroyAll(Request $request) { $request->user()->notifications()->delete(); - return redirect()->route('notifications.index') + return \redirect()->route('notifications.index') ->withSuccess('All Notifications Deleted!'); } } diff --git a/app/Http/Controllers/PageController.php b/app/Http/Controllers/PageController.php index f7d186b05b..1d10975889 100644 --- a/app/Http/Controllers/PageController.php +++ b/app/Http/Controllers/PageController.php @@ -27,7 +27,7 @@ public function index() { $pages = Page::all(); - return view('page.index', ['pages' => $pages]); + return \view('page.index', ['pages' => $pages]); } /** @@ -41,7 +41,7 @@ public function show($id) { $page = Page::findOrFail($id); - return view('page.page', ['page' => $page]); + return \view('page.page', ['page' => $page]); } /** @@ -53,7 +53,7 @@ public function staff() { $staff = DB::table('users')->leftJoin('groups', 'users.group_id', '=', 'groups.id')->select(['users.id', 'users.title', 'users.username', 'groups.name', 'groups.color', 'groups.icon'])->where('groups.is_admin', 1)->orWhere('groups.is_modo', 1)->get(); - return view('page.staff', ['staff' => $staff]); + return \view('page.staff', ['staff' => $staff]); } /** @@ -65,7 +65,7 @@ public function internal() { $internal = DB::table('users')->leftJoin('groups', 'users.group_id', '=', 'groups.id')->select(['users.id', 'users.title', 'users.username', 'groups.name', 'groups.color', 'groups.icon'])->where('groups.is_internal', 1)->get(); - return view('page.internal', ['internal' => $internal]); + return \view('page.internal', ['internal' => $internal]); } /** @@ -75,10 +75,10 @@ public function internal() */ public function blacklist() { - $clients = config('client-blacklist.clients', []); - $browsers = config('client-blacklist.browsers', []); + $clients = \config('client-blacklist.clients', []); + $browsers = \config('client-blacklist.browsers', []); - return view('page.blacklist', ['clients' => $clients, 'browsers' => $browsers]); + return \view('page.blacklist', ['clients' => $clients, 'browsers' => $browsers]); } /** @@ -88,6 +88,6 @@ public function blacklist() */ public function about() { - return view('page.aboutus'); + return \view('page.aboutus'); } } diff --git a/app/Http/Controllers/PlaylistController.php b/app/Http/Controllers/PlaylistController.php index b72066add5..8d13760331 100644 --- a/app/Http/Controllers/PlaylistController.php +++ b/app/Http/Controllers/PlaylistController.php @@ -47,7 +47,7 @@ public function index() { $playlists = Playlist::with('user')->withCount('torrents')->where('is_private', '=', 0)->orderBy('name', 'ASC')->paginate(24); - return view('playlist.index', ['playlists' => $playlists]); + return \view('playlist.index', ['playlists' => $playlists]); } /** @@ -57,7 +57,7 @@ public function index() */ public function create() { - return view('playlist.create'); + return \view('playlist.create'); } /** @@ -69,7 +69,7 @@ public function create() */ public function store(Request $request) { - $user = auth()->user(); + $user = \auth()->user(); $playlist = new Playlist(); $playlist->user_id = $user->id; @@ -79,8 +79,8 @@ public function store(Request $request) if ($request->hasFile('cover_image') && $request->file('cover_image')->getError() === 0) { $image = $request->file('cover_image'); - $filename = 'playlist-cover_'.uniqid().'.'.$image->getClientOriginalExtension(); - $path = public_path('/files/img/'.$filename); + $filename = 'playlist-cover_'.\uniqid().'.'.$image->getClientOriginalExtension(); + $path = \public_path('/files/img/'.$filename); Image::make($image->getRealPath())->fit(400, 225)->encode('png', 100)->save($path); $playlist->cover_image = $filename; } @@ -88,7 +88,7 @@ public function store(Request $request) $playlist->position = $request->input('position'); $playlist->is_private = $request->input('is_private'); - $v = validator($playlist->toArray(), [ + $v = \validator($playlist->toArray(), [ 'user_id' => 'required', 'name' => 'required', 'description' => 'required', @@ -96,20 +96,20 @@ public function store(Request $request) ]); if ($v->fails()) { - return redirect()->route('playlists.create') + return \redirect()->route('playlists.create') ->withInput() ->withErrors($v->errors()); } $playlist->save(); // Announce To Shoutbox - $appurl = config('app.url'); + $appurl = \config('app.url'); if ($playlist->is_private != 1) { $this->chatRepository->systemMessage( - sprintf('User [url=%s/', $appurl).$user->username.'.'.$user->id.']'.$user->username.sprintf('[/url] has created a new playlist [url=%s/playlists/', $appurl).$playlist->id.']'.$playlist->name.'[/url] check it out now! :slight_smile:' + \sprintf('User [url=%s/', $appurl).$user->username.'.'.$user->id.']'.$user->username.\sprintf('[/url] has created a new playlist [url=%s/playlists/', $appurl).$playlist->id.']'.$playlist->name.'[/url] check it out now! :slight_smile:' ); } - return redirect()->route('playlists.show', ['id' => $playlist->id]) + return \redirect()->route('playlists.show', ['id' => $playlist->id]) ->withSuccess('Your Playlist Was Created Successfully!'); } @@ -133,7 +133,7 @@ public function show($id) $torrent = Torrent::where('id', '=', $random->torrent_id)->firstOrFail(); } if (isset($random) && isset($torrent)) { - $movieScrapper = new MovieScrapper(config('api-keys.tmdb'), config('api-keys.tvdb'), config('api-keys.omdb')); + $movieScrapper = new MovieScrapper(\config('api-keys.tmdb'), \config('api-keys.tvdb'), \config('api-keys.omdb')); if ($torrent->category_id == 2) { if ($torrent->tmdb || $torrent->tmdb != 0) { $meta = $movieScrapper->scrape('tv', null, $torrent->tmdb); @@ -149,7 +149,7 @@ public function show($id) $torrents = PlaylistTorrent::with(['torrent'])->where('playlist_id', '=', $playlist->id)->paginate(26); - return view('playlist.show', ['playlist' => $playlist, 'meta' => $meta, 'torrents' => $torrents]); + return \view('playlist.show', ['playlist' => $playlist, 'meta' => $meta, 'torrents' => $torrents]); } /** @@ -161,12 +161,12 @@ public function show($id) */ public function edit($id) { - $user = auth()->user(); + $user = \auth()->user(); $playlist = Playlist::findOrFail($id); - abort_unless($user->id == $playlist->user_id || $user->group->is_modo, 403); + \abort_unless($user->id == $playlist->user_id || $user->group->is_modo, 403); - return view('playlist.edit', ['playlist' => $playlist]); + return \view('playlist.edit', ['playlist' => $playlist]); } /** @@ -179,10 +179,10 @@ public function edit($id) */ public function update(Request $request, $id) { - $user = auth()->user(); + $user = \auth()->user(); $playlist = Playlist::findOrFail($id); - abort_unless($user->id == $playlist->user_id || $user->group->is_modo, 403); + \abort_unless($user->id == $playlist->user_id || $user->group->is_modo, 403); $playlist->name = $request->input('name'); $playlist->description = $request->input('description'); @@ -190,8 +190,8 @@ public function update(Request $request, $id) if ($request->hasFile('cover_image') && $request->file('cover_image')->getError() === 0) { $image = $request->file('cover_image'); - $filename = 'playlist-cover_'.uniqid().'.'.$image->getClientOriginalExtension(); - $path = public_path('/files/img/'.$filename); + $filename = 'playlist-cover_'.\uniqid().'.'.$image->getClientOriginalExtension(); + $path = \public_path('/files/img/'.$filename); Image::make($image->getRealPath())->fit(400, 225)->encode('png', 100)->save($path); $playlist->cover_image = $filename; } @@ -199,20 +199,20 @@ public function update(Request $request, $id) $playlist->position = $request->input('position'); $playlist->is_private = $request->input('is_private'); - $v = validator($playlist->toArray(), [ + $v = \validator($playlist->toArray(), [ 'name' => 'required', 'description' => 'required', 'is_private' => 'required', ]); if ($v->fails()) { - return redirect()->route('playlists.edit', ['id' => $playlist->id]) + return \redirect()->route('playlists.edit', ['id' => $playlist->id]) ->withInput() ->withErrors($v->errors()); } $playlist->save(); - return redirect()->route('playlists.show', ['id' => $playlist->id]) + return \redirect()->route('playlists.show', ['id' => $playlist->id]) ->withSuccess('Your Playlist Has Successfully Been Updated!'); } @@ -225,14 +225,14 @@ public function update(Request $request, $id) */ public function destroy($id) { - $user = auth()->user(); + $user = \auth()->user(); $playlist = Playlist::findOrFail($id); - abort_unless($user->id == $playlist->user_id || $user->group->is_modo, 403); + \abort_unless($user->id == $playlist->user_id || $user->group->is_modo, 403); $playlist->delete(); - return redirect()->route('playlists.index') + return \redirect()->route('playlists.index') ->withSuccess('Playlist Deleted!'); } } diff --git a/app/Http/Controllers/PlaylistTorrentController.php b/app/Http/Controllers/PlaylistTorrentController.php index 5d930ee025..6285e99213 100644 --- a/app/Http/Controllers/PlaylistTorrentController.php +++ b/app/Http/Controllers/PlaylistTorrentController.php @@ -28,27 +28,27 @@ class PlaylistTorrentController extends Controller */ public function store(Request $request) { - $user = auth()->user(); + $user = \auth()->user(); $playlist = Playlist::findOrFail($request->input('playlist_id')); - abort_unless($user->id === $playlist->user_id, 403); + \abort_unless($user->id === $playlist->user_id, 403); $playlistTorrent = new PlaylistTorrent(); $playlistTorrent->playlist_id = $playlist->id; $playlistTorrent->torrent_id = $request->input('torrent_id'); - $v = validator($playlistTorrent->toArray(), [ + $v = \validator($playlistTorrent->toArray(), [ 'playlist_id' => 'required|numeric|exists:playlists,id|unique:playlist_torrents,playlist_id,NULL,NULL,torrent_id,'.$request->input('torrent_id'), 'torrent_id' => 'required|numeric|exists:torrents,id|unique:playlist_torrents,torrent_id,NULL,NULL,playlist_id,'.$request->input('playlist_id'), ]); if ($v->fails()) { - return redirect()->route('playlists.show', ['id' => $playlist->id]) + return \redirect()->route('playlists.show', ['id' => $playlist->id]) ->withErrors($v->errors()); } $playlistTorrent->save(); - return redirect()->route('playlists.show', ['id' => $playlist->id]) + return \redirect()->route('playlists.show', ['id' => $playlist->id]) ->withSuccess('Torrent Has Successfully Been Attached To Your Playlist.'); } @@ -61,13 +61,13 @@ public function store(Request $request) */ public function destroy($id) { - $user = auth()->user(); + $user = \auth()->user(); $playlist_torrent = PlaylistTorrent::findOrFail($id); - abort_unless($user->group->is_modo || $user->id === $playlist_torrent->playlist->user_id, 403); + \abort_unless($user->group->is_modo || $user->id === $playlist_torrent->playlist->user_id, 403); $playlist_torrent->delete(); - return redirect()->route('playlists.show', ['id' => $playlist_torrent->playlist->id]) + return \redirect()->route('playlists.show', ['id' => $playlist_torrent->playlist->id]) ->withSuccess('Torrent Has Successfully Been Detached From Your Playlist.'); } } diff --git a/app/Http/Controllers/PollController.php b/app/Http/Controllers/PollController.php index 29572db430..661982bcf0 100644 --- a/app/Http/Controllers/PollController.php +++ b/app/Http/Controllers/PollController.php @@ -46,7 +46,7 @@ public function index() { $polls = Poll::latest()->paginate(15); - return view('poll.latest', ['polls' => $polls]); + return \view('poll.latest', ['polls' => $polls]); } /** @@ -64,11 +64,11 @@ public function show(Request $request, $id) $user_has_voted = $poll->voters->where('user_id', '=', $user->id)->isNotEmpty(); if ($user_has_voted) { - return redirect()->route('poll_results', ['id' => $poll->id]) + return \redirect()->route('poll_results', ['id' => $poll->id]) ->withInfo('You have already vote on this poll. Here are the results.'); } - return view('poll.show', ['poll' => $poll]); + return \view('poll.show', ['poll' => $poll]); } /** @@ -86,7 +86,7 @@ public function vote(VoteOnPoll $request) ->where('poll_id', '=', $poll->id) ->exists(); if ($voted) { - return redirect()->route('poll_results', ['id' => $poll->id]) + return \redirect()->route('poll_results', ['id' => $poll->id]) ->withErrors('Bro have already vote on this poll. Your vote has not been counted.'); } @@ -101,14 +101,14 @@ public function vote(VoteOnPoll $request) $vote->user_id = $user->id; $vote->save(); - $poll_url = href_poll($poll); - $profile_url = href_profile($user); + $poll_url = \href_poll($poll); + $profile_url = \href_profile($user); $this->chat->systemMessage( - sprintf('[url=%s]%s[/url] has voted on poll [url=%s]%s[/url]', $profile_url, $user->username, $poll_url, $poll->title) + \sprintf('[url=%s]%s[/url] has voted on poll [url=%s]%s[/url]', $profile_url, $user->username, $poll_url, $poll->title) ); - return redirect()->route('poll_results', ['id' => $poll->id]) + return \redirect()->route('poll_results', ['id' => $poll->id]) ->withSuccess('Your vote has been counted.'); } @@ -127,6 +127,6 @@ public function result($id) 'total_votes' => $poll->totalVotes(), ]; - return view('poll.result', $map); + return \view('poll.result', $map); } } diff --git a/app/Http/Controllers/PostController.php b/app/Http/Controllers/PostController.php index 09c8d6ee1a..f7e7da3b45 100644 --- a/app/Http/Controllers/PostController.php +++ b/app/Http/Controllers/PostController.php @@ -72,7 +72,7 @@ public function reply(Request $request, $id) // The user has the right to create a post here? if (! $category->getPermission()->reply_topic || ($topic->state == 'close' && ! $request->user()->group->is_modo)) { - return redirect()->route('forums.index') + return \redirect()->route('forums.index') ->withErrors('You Cannot Reply To This Topic!'); } @@ -81,23 +81,23 @@ public function reply(Request $request, $id) $post->user_id = $user->id; $post->topic_id = $topic->id; - $v = validator($post->toArray(), [ + $v = \validator($post->toArray(), [ 'content' => 'required|min:1', 'user_id' => 'required', 'topic_id' => 'required', ]); if ($v->fails()) { - return redirect()->route('forum_topic', ['id' => $topic->id]) + return \redirect()->route('forum_topic', ['id' => $topic->id]) ->withErrors($v->errors()); } $post->save(); - $appurl = config('app.url'); - $href = sprintf('%s/forums/topics/%s?page=%s#post-%s', $appurl, $topic->id, $post->getPageNumber(), $post->id); - $message = sprintf('%s has tagged you in a forum post. You can view it [url=%s] HERE [/url]', $user->username, $href); + $appurl = \config('app.url'); + $href = \sprintf('%s/forums/topics/%s?page=%s#post-%s', $appurl, $topic->id, $post->getPageNumber(), $post->id); + $message = \sprintf('%s has tagged you in a forum post. You can view it [url=%s] HERE [/url]', $user->username, $href); if ($this->taggedUserRepository->hasTags($request->input('content'))) { if ($this->taggedUserRepository->contains($request->input('content'), '@here') && $user->group->is_modo) { - $users = collect([]); + $users = \collect([]); $topic->posts()->get()->each(function ($p) use ($users) { $users->push($p->user); @@ -142,15 +142,15 @@ public function reply(Request $request, $id) // Save $forum->save(); // Post To Chatbox - $appurl = config('app.url'); - $postUrl = sprintf('%s/forums/topics/%s?page=%s#post-%s', $appurl, $topic->id, $post->getPageNumber(), $post->id); - $realUrl = sprintf('/forums/topics/%s?page=%s#post-%s', $topic->id, $post->getPageNumber(), $post->id); - $profileUrl = sprintf('%s/users/%s', $appurl, $user->username); + $appurl = \config('app.url'); + $postUrl = \sprintf('%s/forums/topics/%s?page=%s#post-%s', $appurl, $topic->id, $post->getPageNumber(), $post->id); + $realUrl = \sprintf('/forums/topics/%s?page=%s#post-%s', $topic->id, $post->getPageNumber(), $post->id); + $profileUrl = \sprintf('%s/users/%s', $appurl, $user->username); - if (config('other.staff-forum-notify') && ($forum->id == config('other.staff-forum-id') || $forum->parent_id == config('other.staff-forum-id'))) { + if (\config('other.staff-forum-notify') && ($forum->id == \config('other.staff-forum-id') || $forum->parent_id == \config('other.staff-forum-id'))) { $topic->notifyStaffers($user, $topic, $post); } else { - $this->chatRepository->systemMessage(sprintf('[url=%s]%s[/url] has left a reply on topic [url=%s]%s[/url]', $profileUrl, $user->username, $postUrl, $topic->name)); + $this->chatRepository->systemMessage(\sprintf('[url=%s]%s[/url] has left a reply on topic [url=%s]%s[/url]', $profileUrl, $user->username, $postUrl, $topic->name)); // Notify All Subscribers Of New Reply if ($topic->first_user_poster_id != $user->id) { $topic->notifyStarter($user, $topic, $post); @@ -171,7 +171,7 @@ public function reply(Request $request, $id) $user->addProgress(new UserMade800Posts(), 1); $user->addProgress(new UserMade900Posts(), 1); - return redirect()->to($realUrl) + return \redirect()->to($realUrl) ->withSuccess('Post Successfully Posted'); } @@ -190,7 +190,7 @@ public function postEditForm($id, $postId) $category = $forum->getCategory(); $post = Post::findOrFail($postId); - return view('forum.post_edit', [ + return \view('forum.post_edit', [ 'topic' => $topic, 'forum' => $forum, 'post' => $post, @@ -210,13 +210,13 @@ public function postEdit(Request $request, $postId) { $user = $request->user(); $post = Post::findOrFail($postId); - $postUrl = sprintf('forums/topics/%s?page=%s#post-%s', $post->topic->id, $post->getPageNumber(), $postId); + $postUrl = \sprintf('forums/topics/%s?page=%s#post-%s', $post->topic->id, $post->getPageNumber(), $postId); - abort_unless($user->group->is_modo || $user->id === $post->user_id, 403); + \abort_unless($user->group->is_modo || $user->id === $post->user_id, 403); $post->content = $request->input('content'); $post->save(); - return redirect()->to($postUrl) + return \redirect()->to($postUrl) ->withSuccess('Post Successfully Edited!'); } @@ -235,10 +235,10 @@ public function postDelete(Request $request, $postId) $user = $request->user(); $post = Post::with('topic')->findOrFail($postId); - abort_unless($user->group->is_modo || $user->id === $post->user_id, 403); + \abort_unless($user->group->is_modo || $user->id === $post->user_id, 403); $post->delete(); - return redirect()->route('forum_topic', ['id' => $post->topic->id]) + return \redirect()->route('forum_topic', ['id' => $post->topic->id]) ->withSuccess('This Post Is Now Deleted!'); } } diff --git a/app/Http/Controllers/PrivateMessageController.php b/app/Http/Controllers/PrivateMessageController.php index a1b9ffd16d..2d4d9a3539 100644 --- a/app/Http/Controllers/PrivateMessageController.php +++ b/app/Http/Controllers/PrivateMessageController.php @@ -33,7 +33,7 @@ public function searchPMInbox(Request $request) ['subject', 'like', '%'.$request->input('subject').'%'], ])->latest()->paginate(20); - return view('pm.inbox', ['pms' => $pms, 'user' => $user]); + return \view('pm.inbox', ['pms' => $pms, 'user' => $user]); } /** @@ -50,7 +50,7 @@ public function searchPMOutbox(Request $request) ['subject', 'like', '%'.$request->input('subject').'%'], ])->latest()->paginate(20); - return view('pm.outbox', ['pms' => $pms, 'user' => $user]); + return \view('pm.outbox', ['pms' => $pms, 'user' => $user]); } /** @@ -65,7 +65,7 @@ public function getPrivateMessages(Request $request) $user = $request->user(); $pms = PrivateMessage::where('receiver_id', '=', $user->id)->latest()->paginate(25); - return view('pm.inbox', ['pms' => $pms, 'user' => $user]); + return \view('pm.inbox', ['pms' => $pms, 'user' => $user]); } /** @@ -80,7 +80,7 @@ public function getPrivateMessagesSent(Request $request) $user = $request->user(); $pms = PrivateMessage::where('sender_id', '=', $user->id)->latest()->paginate(20); - return view('pm.outbox', ['pms' => $pms, 'user' => $user]); + return \view('pm.outbox', ['pms' => $pms, 'user' => $user]); } /** @@ -102,10 +102,10 @@ public function getPrivateMessageById(Request $request, $id) $pm->save(); } - return view('pm.message', ['pm' => $pm, 'user' => $user]); + return \view('pm.message', ['pm' => $pm, 'user' => $user]); } - return redirect()->route('inbox') + return \redirect()->route('inbox') ->withErrors('What Are You Trying To Do Here!'); } @@ -122,7 +122,7 @@ public function makePrivateMessage(Request $request, $receiver_id = '', $usernam { $user = $request->user(); - return view('pm.send', ['user' => $user, 'receiver_id' => $receiver_id, 'username' => $username]); + return \view('pm.send', ['user' => $user, 'receiver_id' => $receiver_id, 'username' => $username]); } /** @@ -144,7 +144,7 @@ public function sendPrivateMessage(Request $request) if ($request->has('receiver_id')) { $recipient = User::where('username', '=', $request->input('receiver_id'))->firstOrFail(); } else { - return redirect()->route('create', ['username' => $request->user()->username, 'id' => $request->user()->id]) + return \redirect()->route('create', ['username' => $request->user()->username, 'id' => $request->user()->id]) ->withErrors($v->errors()); } @@ -155,7 +155,7 @@ public function sendPrivateMessage(Request $request) $privateMessage->message = $request->input('message'); $privateMessage->read = 0; - $v = validator($privateMessage->toArray(), [ + $v = \validator($privateMessage->toArray(), [ 'sender_id' => 'required', 'receiver_id' => 'required', 'subject' => 'required', @@ -165,20 +165,20 @@ public function sendPrivateMessage(Request $request) if ($v->fails()) { if ($dest == 'profile') { - return redirect()->route('users.show', ['username' => $recipient->username]) + return \redirect()->route('users.show', ['username' => $recipient->username]) ->withErrors($v->errors()); } - return redirect()->route('create', ['username' => $request->user()->username, 'id' => $request->user()->id]) + return \redirect()->route('create', ['username' => $request->user()->username, 'id' => $request->user()->id]) ->withErrors($v->errors()); } $privateMessage->save(); if ($dest == 'profile') { - return redirect()->route('users.show', ['username' => $recipient->username]) + return \redirect()->route('users.show', ['username' => $recipient->username]) ->withSuccess('Your PM Was Sent Successfully!'); } - return redirect()->route('inbox') + return \redirect()->route('inbox') ->withSuccess('Your PM Was Sent Successfully!'); } @@ -204,7 +204,7 @@ public function replyPrivateMessage(Request $request, $id) $privateMessage->related_to = $message->id; $privateMessage->read = 0; - $v = validator($privateMessage->toArray(), [ + $v = \validator($privateMessage->toArray(), [ 'sender_id' => 'required', 'receiver_id' => 'required', 'subject' => 'required', @@ -214,12 +214,12 @@ public function replyPrivateMessage(Request $request, $id) ]); if ($v->fails()) { - return redirect()->route('inbox') + return \redirect()->route('inbox') ->withErrors($v->errors()); } $privateMessage->save(); - return redirect()->route('inbox') + return \redirect()->route('inbox') ->withSuccess('Your PM Was Sent Successfully!'); } @@ -245,14 +245,14 @@ public function deletePrivateMessage(Request $request, $id) $pm->delete(); if ($dest == 'outbox') { - return redirect()->route('outbox')->withSuccess('PM Was Deleted Successfully!'); + return \redirect()->route('outbox')->withSuccess('PM Was Deleted Successfully!'); } - return redirect()->route('inbox') + return \redirect()->route('inbox') ->withSuccess('PM Was Deleted Successfully!'); } - return redirect()->route('inbox') + return \redirect()->route('inbox') ->withErrors('What Are You Trying To Do Here!'); } @@ -268,7 +268,7 @@ public function emptyInbox(Request $request) $user = $request->user(); $pms = PrivateMessage::where('receiver_id', '=', $user->id)->delete(); - return redirect()->route('inbox') + return \redirect()->route('inbox') ->withSuccess('PM Was Deleted Successfully!'); } @@ -288,7 +288,7 @@ public function markAllAsRead(Request $request) $pm->save(); } - return redirect()->route('inbox') + return \redirect()->route('inbox') ->withSuccess('Your Messages Have All Been Marked As Read!'); } } diff --git a/app/Http/Controllers/ReportController.php b/app/Http/Controllers/ReportController.php index 156ed05ebf..54bc0f631a 100644 --- a/app/Http/Controllers/ReportController.php +++ b/app/Http/Controllers/ReportController.php @@ -50,12 +50,12 @@ public function request(Request $request, $id) $reported_by = $request->user(); $reported_user = $torrentRequest->user; - $v = validator($request->all(), [ + $v = \validator($request->all(), [ 'message' => 'required', ]); if ($v->fails()) { - return redirect()->route('request', ['id' => $id]) + return \redirect()->route('request', ['id' => $id]) ->withErrors($v->errors()); } $this->report->create([ @@ -69,7 +69,7 @@ public function request(Request $request, $id) 'solved' => 0, ]); - return redirect()->route('request', ['id' => $id]) + return \redirect()->route('request', ['id' => $id]) ->withSuccess('Your report has been successfully sent'); } @@ -87,12 +87,12 @@ public function torrent(Request $request, $id) $reported_by = $request->user(); $reported_user = $torrent->user; - $v = validator($request->all(), [ + $v = \validator($request->all(), [ 'message' => 'required', ]); if ($v->fails()) { - return redirect()->route('torrent', ['id' => $id]) + return \redirect()->route('torrent', ['id' => $id]) ->withErrors($v->errors()); } $this->report->create([ @@ -106,7 +106,7 @@ public function torrent(Request $request, $id) 'solved' => 0, ]); - return redirect()->route('torrent', ['id' => $id]) + return \redirect()->route('torrent', ['id' => $id]) ->withSuccess('Your report has been successfully sent'); } @@ -123,12 +123,12 @@ public function user(Request $request, $username) $reported_user = User::where('username', '=', $username)->firstOrFail(); $reported_by = $request->user(); - $v = validator($request->all(), [ + $v = \validator($request->all(), [ 'message' => 'required', ]); if ($v->fails()) { - return redirect()->route('users.show', ['username' => $username]) + return \redirect()->route('users.show', ['username' => $username]) ->withErrors($v->errors()); } $this->report->create([ @@ -142,7 +142,7 @@ public function user(Request $request, $username) 'solved' => 0, ]); - return redirect()->route('users.show', ['username' => $username]) + return \redirect()->route('users.show', ['username' => $username]) ->withSuccess('Your report has been successfully sent'); } } diff --git a/app/Http/Controllers/RequestController.php b/app/Http/Controllers/RequestController.php index 32b5abb3f8..d8e134c947 100644 --- a/app/Http/Controllers/RequestController.php +++ b/app/Http/Controllers/RequestController.php @@ -89,7 +89,7 @@ public function requests(Request $request) $torrentRequests = TorrentRequest::with(['user', 'category', 'type'])->paginate(25); $repository = $this->requestFacetedRepository; - return view('requests.requests', [ + return \view('requests.requests', [ 'torrentRequests' => $torrentRequests, 'repository' => $repository, 'user' => $user, @@ -113,7 +113,7 @@ public function faceted(Request $request, TorrentRequest $torrentRequest) $user = $request->user(); $search = $request->input('search'); $imdb_id = Str::startsWith($request->get('imdb'), 'tt') ? $request->get('imdb') : 'tt'.$request->get('imdb'); - $imdb = str_replace('tt', '', $imdb_id); + $imdb = \str_replace('tt', '', $imdb_id); $tvdb = $request->input('tvdb'); $tmdb = $request->input('tmdb'); $mal = $request->input('mal'); @@ -123,7 +123,7 @@ public function faceted(Request $request, TorrentRequest $torrentRequest) $resolutions = $request->input('resolutions'); $myrequests = $request->input('myrequests'); - $terms = explode(' ', $search); + $terms = \explode(' ', $search); $search = ''; foreach ($terms as $term) { $search .= '%'.$term.'%'; @@ -136,7 +136,7 @@ public function faceted(Request $request, TorrentRequest $torrentRequest) } if ($request->has('imdb') && $request->input('imdb') != null) { - $torrentRequest->where('imdb', '=', str_replace('tt', '', $imdb)); + $torrentRequest->where('imdb', '=', \str_replace('tt', '', $imdb)); } if ($request->has('tvdb') && $request->input('tvdb') != null) { @@ -214,7 +214,7 @@ public function faceted(Request $request, TorrentRequest $torrentRequest) $torrentRequests = $torrentRequest->paginate(25); } - return view('requests.results', [ + return \view('requests.results', [ 'user' => $user, 'torrentRequests' => $torrentRequests, ])->render(); @@ -241,7 +241,7 @@ public function request(Request $request, $id) $comments = $torrentRequest->comments()->latest('created_at')->paginate(6); $carbon = Carbon::now()->addDay(); - $movieScrapper = new \App\Services\MovieScrapper(config('api-keys.tmdb'), config('api-keys.tvdb'), config('api-keys.omdb')); + $movieScrapper = new \App\Services\MovieScrapper(\config('api-keys.tmdb'), \config('api-keys.tvdb'), \config('api-keys.omdb')); $meta = null; if ($torrentRequest->category->tv_meta) { if ($torrentRequest->tmdb || $torrentRequest->tmdb != 0) { @@ -261,7 +261,7 @@ public function request(Request $request, $id) $meta = Game::with(['cover' => ['url', 'image_id'], 'artworks' => ['url', 'image_id'], 'genres' => ['name']])->find($torrentRequest->igdb); } - return view('requests.request', [ + return \view('requests.request', [ 'torrentRequest' => $torrentRequest, 'voters' => $voters, 'user' => $user, 'comments' => $comments, @@ -285,13 +285,13 @@ public function addRequestForm(Request $request, $title = '', $imdb = 0, $tmdb = { $user = $request->user(); - return view('requests.add_request', [ + return \view('requests.add_request', [ 'categories' => Category::all()->sortBy('position'), 'types' => Type::all()->sortBy('position'), 'resolutions' => Resolution::all()->sortBy('position'), 'user' => $user, 'title' => $title, - 'imdb' => str_replace('tt', '', $imdb), + 'imdb' => \str_replace('tt', '', $imdb), 'tmdb' => $tmdb, ]); } @@ -324,7 +324,7 @@ public function addrequest(Request $request) $torrentRequest->votes = 1; $torrentRequest->anon = $request->input('anon'); - $v = validator($torrentRequest->toArray(), [ + $v = \validator($torrentRequest->toArray(), [ 'name' => 'required|max:180', 'imdb' => 'required|numeric', 'tvdb' => 'required|numeric', @@ -335,12 +335,12 @@ public function addrequest(Request $request) 'type_id' => 'required|exists:types,id', 'resolution_id' => 'nullable|exists:resolutions,id', 'description' => 'required|string', - 'bounty' => sprintf('required|numeric|min:0|max:%s', $user->seedbonus), + 'bounty' => \sprintf('required|numeric|min:0|max:%s', $user->seedbonus), 'anon' => 'required', ]); if ($v->fails()) { - return redirect()->route('requests') + return \redirect()->route('requests') ->withErrors($v->errors())->withInput(); } $torrentRequest->save(); @@ -356,24 +356,24 @@ public function addrequest(Request $request) $BonTransactions->cost = $request->input('bounty'); $BonTransactions->sender = $user->id; $BonTransactions->receiver = 0; - $BonTransactions->comment = sprintf('new request - %s', $request->input('name')); + $BonTransactions->comment = \sprintf('new request - %s', $request->input('name')); $BonTransactions->save(); $user->seedbonus -= $request->input('bounty'); $user->save(); - $tr_url = href_request($torrentRequest); - $profile_url = href_profile($user); + $tr_url = \href_request($torrentRequest); + $profile_url = \href_profile($user); // Auto Shout if ($torrentRequest->anon == 0) { $this->chatRepository->systemMessage( - sprintf('[url=%s]%s[/url] has created a new request [url=%s]%s[/url]', $profile_url, $user->username, $tr_url, $torrentRequest->name) + \sprintf('[url=%s]%s[/url] has created a new request [url=%s]%s[/url]', $profile_url, $user->username, $tr_url, $torrentRequest->name) ); } else { $this->chatRepository->systemMessage( - sprintf('An anonymous user has created a new request [url=%s]%s[/url]', $tr_url, $torrentRequest->name) + \sprintf('An anonymous user has created a new request [url=%s]%s[/url]', $tr_url, $torrentRequest->name) ); } - return redirect()->route('requests') + return \redirect()->route('requests') ->withSuccess('Request Added.'); } @@ -390,7 +390,7 @@ public function editRequestForm(Request $request, $id) $user = $request->user(); $torrentRequest = TorrentRequest::findOrFail($id); - return view('requests.edit_request', [ + return \view('requests.edit_request', [ 'categories' => Category::all()->sortBy('position'), 'types' => Type::all()->sortBy('position'), 'resolutions' => Resolution::all()->sortBy('position'), @@ -410,7 +410,7 @@ public function editrequest(Request $request, $id) { $user = $request->user(); $torrentRequest = TorrentRequest::findOrFail($id); - abort_unless($user->group->is_modo || $user->id === $torrentRequest->user_id, 403); + \abort_unless($user->group->is_modo || $user->id === $torrentRequest->user_id, 403); // Find the right category $name = $request->input('name'); @@ -437,7 +437,7 @@ public function editrequest(Request $request, $id) $torrentRequest->description = $description; $torrentRequest->anon = $anon; - $v = validator($torrentRequest->toArray(), [ + $v = \validator($torrentRequest->toArray(), [ 'name' => 'required|max:180', 'imdb' => 'required|numeric', 'tvdb' => 'required|numeric', @@ -452,12 +452,12 @@ public function editrequest(Request $request, $id) ]); if ($v->fails()) { - return redirect()->route('requests') + return \redirect()->route('requests') ->withErrors($v->errors()); } $torrentRequest->save(); - return redirect()->route('requests', ['id' => $torrentRequest->id]) + return \redirect()->route('requests', ['id' => $torrentRequest->id]) ->withSuccess('Request Edited Successfully.'); } @@ -478,12 +478,12 @@ public function addBonus(Request $request, $id) $tr->bounty += $request->input('bonus_value'); $tr->created_at = Carbon::now(); - $v = validator($request->all(), [ - 'bonus_value' => sprintf('required|numeric|min:100|max:%s', $user->seedbonus), + $v = \validator($request->all(), [ + 'bonus_value' => \sprintf('required|numeric|min:100|max:%s', $user->seedbonus), ]); if ($v->fails()) { - return redirect()->route('request', ['id' => $tr->id]) + return \redirect()->route('request', ['id' => $tr->id]) ->withErrors($v->errors()); } $tr->save(); @@ -499,20 +499,20 @@ public function addBonus(Request $request, $id) $BonTransactions->cost = $request->input('bonus_value'); $BonTransactions->sender = $user->id; $BonTransactions->receiver = 0; - $BonTransactions->comment = sprintf('adding bonus to %s', $tr->name); + $BonTransactions->comment = \sprintf('adding bonus to %s', $tr->name); $BonTransactions->save(); $user->seedbonus -= $request->input('bonus_value'); $user->save(); - $tr_url = href_request($tr); - $profile_url = href_profile($user); + $tr_url = \href_request($tr); + $profile_url = \href_profile($user); // Auto Shout if ($torrentRequestBounty->anon == 0) { $this->chatRepository->systemMessage( - sprintf('[url=%s]%s[/url] has added %s BON bounty to request [url=%s]%s[/url]', $profile_url, $user->username, $request->input('bonus_value'), $tr_url, $tr->name) + \sprintf('[url=%s]%s[/url] has added %s BON bounty to request [url=%s]%s[/url]', $profile_url, $user->username, $request->input('bonus_value'), $tr_url, $tr->name) ); } else { $this->chatRepository->systemMessage( - sprintf('An anonymous user added %s BON bounty to request [url=%s]%s[/url]', $request->input('bonus_value'), $tr_url, $tr->name) + \sprintf('An anonymous user added %s BON bounty to request [url=%s]%s[/url]', $request->input('bonus_value'), $tr_url, $tr->name) ); } $sender = $request->input('anon') == 1 ? 'Anonymous' : $user->username; @@ -521,7 +521,7 @@ public function addBonus(Request $request, $id) $requester->notify(new NewRequestBounty('torrent', $sender, $request->input('bonus_value'), $tr)); } - return redirect()->route('request', ['id' => $request->input('request_id')]) + return \redirect()->route('request', ['id' => $request->input('request_id')]) ->withSuccess('Your bonus has been successfully added.'); } @@ -543,7 +543,7 @@ public function fillRequest(Request $request, $id) $torrentRequest->filled_when = Carbon::now(); $torrentRequest->filled_anon = $request->input('filled_anon'); - $v = validator($request->all(), [ + $v = \validator($request->all(), [ 'request_id' => 'required|exists:requests,id', 'info_hash' => 'required|exists:torrents,info_hash', 'filled_anon' => 'required', @@ -551,24 +551,24 @@ public function fillRequest(Request $request, $id) $torrent = Torrent::where('info_hash', '=', $torrentRequest->filled_hash)->first(); if ($torrent && ! $torrent->isApproved()) { - return redirect()->route('request', ['id' => $request->input('request_id')]) + return \redirect()->route('request', ['id' => $request->input('request_id')]) ->withErrors('The torrent info_hash you are trying to use is valid in our database but is still pending moderation. Please wait for your torrent to be approved and then try again.'); } if ($v->fails()) { - return redirect()->route('request', ['id' => $request->input('request_id')]) + return \redirect()->route('request', ['id' => $request->input('request_id')]) ->withErrors($v->errors()); } $torrentRequest->save(); // Send Private Message - $appurl = config('app.url'); + $appurl = \config('app.url'); $sender = $request->input('filled_anon') == 1 ? 'Anonymous' : $user->username; $requester = $torrentRequest->user; if ($requester->acceptsNotification($request->user(), $requester, 'request', 'show_request_fill')) { $requester->notify(new NewRequestFill('torrent', $sender, $torrentRequest)); } - return redirect()->route('request', ['id' => $request->input('request_id')]) + return \redirect()->route('request', ['id' => $request->input('request_id')]) ->withSuccess('Your request fill is pending approval by the Requester.'); } @@ -588,7 +588,7 @@ public function approveRequest(Request $request, $id) if ($user->id == $tr->user_id || $request->user()->group->is_modo) { if ($tr->approved_by != null) { - return redirect()->route('request', ['id' => $id]) + return \redirect()->route('request', ['id' => $id]) ->withErrors('Seems this request was already approved'); } $tr->approved_by = $user->id; @@ -605,7 +605,7 @@ public function approveRequest(Request $request, $id) $BonTransactions->cost = $fill_amount; $BonTransactions->sender = 0; $BonTransactions->receiver = $fill_user->id; - $BonTransactions->comment = sprintf('%s has filled %s and has been awarded %s BONUS.', $fill_user->username, $tr->name, $fill_amount); + $BonTransactions->comment = \sprintf('%s has filled %s and has been awarded %s BONUS.', $fill_user->username, $tr->name, $fill_amount); $BonTransactions->save(); $fill_user->seedbonus += $fill_amount; @@ -617,17 +617,17 @@ public function approveRequest(Request $request, $id) $fill_user->addProgress(new UserFilled75Requests(), 1); $fill_user->addProgress(new UserFilled100Requests(), 1); - $tr_url = href_request($tr); - $profile_url = href_profile($fill_user); + $tr_url = \href_request($tr); + $profile_url = \href_profile($fill_user); // Auto Shout if ($tr->filled_anon == 0) { $this->chatRepository->systemMessage( - sprintf('[url=%s]%s[/url] has filled request, [url=%s]%s[/url]', $profile_url, $fill_user->username, $tr_url, $tr->name) + \sprintf('[url=%s]%s[/url] has filled request, [url=%s]%s[/url]', $profile_url, $fill_user->username, $tr_url, $tr->name) ); } else { $this->chatRepository->systemMessage( - sprintf('An anonymous user has filled request, [url=%s]%s[/url]', $tr_url, $tr->name) + \sprintf('An anonymous user has filled request, [url=%s]%s[/url]', $tr_url, $tr->name) ); } @@ -637,15 +637,15 @@ public function approveRequest(Request $request, $id) } if ($tr->filled_anon == 0) { - return redirect()->route('request', ['id' => $id]) - ->withSuccess(sprintf('You have approved %s and the bounty has been awarded to %s', $tr->name, $fill_user->username)); + return \redirect()->route('request', ['id' => $id]) + ->withSuccess(\sprintf('You have approved %s and the bounty has been awarded to %s', $tr->name, $fill_user->username)); } - return redirect()->route('request', ['id' => $id]) - ->withSuccess(sprintf('You have approved %s and the bounty has been awarded to a anonymous user', $tr->name)); + return \redirect()->route('request', ['id' => $id]) + ->withSuccess(\sprintf('You have approved %s and the bounty has been awarded to a anonymous user', $tr->name)); } - return redirect()->route('request', ['id' => $id]) + return \redirect()->route('request', ['id' => $id]) ->withErrors("You don't have access to approve this request"); } @@ -660,12 +660,12 @@ public function approveRequest(Request $request, $id) public function rejectRequest(Request $request, $id) { $user = $request->user(); - $appurl = config('app.url'); + $appurl = \config('app.url'); $torrentRequest = TorrentRequest::findOrFail($id); if ($user->id == $torrentRequest->user_id) { if ($torrentRequest->approved_by != null) { - return redirect()->route('request', ['id' => $id]) + return \redirect()->route('request', ['id' => $id]) ->withErrors('Seems this request was already rejected'); } @@ -679,11 +679,11 @@ public function rejectRequest(Request $request, $id) $torrentRequest->filled_hash = null; $torrentRequest->save(); - return redirect()->route('request', ['id' => $id]) + return \redirect()->route('request', ['id' => $id]) ->withSuccess('This request has been reset.'); } - return redirect()->route('request', ['id' => $id]) + return \redirect()->route('request', ['id' => $id]) ->withSuccess("You don't have access to approve this request"); } @@ -706,11 +706,11 @@ public function deleteRequest(Request $request, $id) $name = $torrentRequest->name; $torrentRequest->delete(); - return redirect()->route('requests') - ->withSuccess(sprintf('You have deleted %s', $name)); + return \redirect()->route('requests') + ->withSuccess(\sprintf('You have deleted %s', $name)); } - return redirect()->route('request', ['id' => $id]) + return \redirect()->route('request', ['id' => $id]) ->withErrors("You don't have access to delete this request."); } @@ -744,11 +744,11 @@ public function claimRequest(Request $request, $id) $requester->notify(new NewRequestClaim('torrent', $sender, $torrentRequest)); } - return redirect()->route('request', ['id' => $id]) + return \redirect()->route('request', ['id' => $id]) ->withSuccess('Request Successfully Claimed'); } - return redirect()->route('request', ['id' => $id]) + return \redirect()->route('request', ['id' => $id]) ->withErrors('Someone else has already claimed this request buddy.'); } @@ -768,7 +768,7 @@ public function unclaimRequest(Request $request, $id) $torrentRequest = TorrentRequest::findOrFail($id); $claimer = TorrentRequestClaim::where('request_id', '=', $id)->first(); - abort_unless($user->group->is_modo || $user->username == $claimer->username, 403); + \abort_unless($user->group->is_modo || $user->username == $claimer->username, 403); if ($torrentRequest->claimed == 1) { $requestClaim = TorrentRequestClaim::where('request_id', '=', $id)->firstOrFail(); @@ -785,11 +785,11 @@ public function unclaimRequest(Request $request, $id) $requester->notify(new NewRequestUnclaim('torrent', $sender, $torrentRequest)); } - return redirect()->route('request', ['id' => $id]) + return \redirect()->route('request', ['id' => $id]) ->withSuccess('Request Successfully Un-Claimed'); } - return redirect()->route('request', ['id' => $id]) + return \redirect()->route('request', ['id' => $id]) ->withErrors('Nothing To Unclaim.'); } @@ -804,7 +804,7 @@ public function unclaimRequest(Request $request, $id) public function resetRequest(Request $request, $id) { $user = $request->user(); - abort_unless($user->group->is_modo, 403); + \abort_unless($user->group->is_modo, 403); $torrentRequest = TorrentRequest::findOrFail($id); $torrentRequest->filled_by = null; @@ -814,7 +814,7 @@ public function resetRequest(Request $request, $id) $torrentRequest->approved_when = null; $torrentRequest->save(); - return redirect()->route('request', ['id' => $id]) + return \redirect()->route('request', ['id' => $id]) ->withSuccess('The request has been reset!'); } } diff --git a/app/Http/Controllers/RssController.php b/app/Http/Controllers/RssController.php index e97bf11f34..584f803f84 100644 --- a/app/Http/Controllers/RssController.php +++ b/app/Http/Controllers/RssController.php @@ -56,7 +56,7 @@ public function index(Request $request, $hash = null) $public_rss = Rss::where('is_private', '=', 0)->orderBy('position', 'ASC')->get(); $private_rss = Rss::where('is_private', '=', 1)->where('user_id', '=', $user->id)->latest()->get(); - return view('rss.index', [ + return \view('rss.index', [ 'hash' => $hash, 'public_rss' => $public_rss, 'private_rss' => $private_rss, @@ -76,7 +76,7 @@ public function create(Request $request) $user = $request->user(); $torrent_repository = $this->torrentFacetedRepository; - return view('rss.create', [ + return \view('rss.create', [ 'torrent_repository' => $torrent_repository, 'categories' => Category::all()->sortBy('position'), 'types' => Type::all()->sortBy('position'), @@ -96,7 +96,7 @@ public function store(Request $request) { $user = $request->user(); - $v = validator($request->all(), [ + $v = \validator($request->all(), [ 'name' => 'required|min:3|max:255', 'search' => 'max:255', 'description' => 'max:255', @@ -141,7 +141,7 @@ public function store(Request $request) $rss->name = $request->input('name'); $rss->user_id = $user->id; $expected = $rss->expected_fields; - $rss->json_torrent = array_merge($expected, $params); + $rss->json_torrent = \array_merge($expected, $params); $rss->is_private = 1; $rss->save(); $success = 'Private RSS Feed Created'; @@ -152,11 +152,11 @@ public function store(Request $request) $error = $v->errors(); } - return redirect()->route('rss.create') + return \redirect()->route('rss.create') ->withErrors($error); } - return redirect()->route('rss.index', ['hash' => 'private']) + return \redirect()->route('rss.index', ['hash' => 'private']) ->withSuccess($success); } @@ -174,17 +174,17 @@ public function show($id, $rsskey) { $user = User::where('rsskey', '=', (string) $rsskey)->firstOrFail(); - $banned_group = cache()->rememberForever('banned_group', fn () => Group::where('slug', '=', 'banned')->pluck('id')); - $disabled_group = cache()->rememberForever('disabled_group', fn () => Group::where('slug', '=', 'disabled')->pluck('id')); + $banned_group = \cache()->rememberForever('banned_group', fn () => Group::where('slug', '=', 'banned')->pluck('id')); + $disabled_group = \cache()->rememberForever('disabled_group', fn () => Group::where('slug', '=', 'disabled')->pluck('id')); if ($user->group->id == $banned_group[0]) { - abort(404); + \abort(404); } if ($user->group->id == $disabled_group[0]) { - abort(404); + \abort(404); } if ($user->active == 0) { - abort(404); + \abort(404); } $rss = Rss::where('id', '=', (int) $id)->whereRaw('(user_id = ? OR is_private != ?)', [$user->id, 1])->firstOrFail(); @@ -211,19 +211,19 @@ public function show($id, $rsskey) $dying = $rss->object_torrent->dying; $dead = $rss->object_torrent->dead; - $terms = explode(' ', $search); + $terms = \explode(' ', $search); $search = ''; foreach ($terms as $term) { $search .= '%'.$term.'%'; } - $usernames = explode(' ', $uploader); + $usernames = \explode(' ', $uploader); $uploader = ''; foreach ($usernames as $username) { $uploader .= '%'.$username.'%'; } - $keywords = explode(' ', $description); + $keywords = \explode(' ', $description); $description = ''; foreach ($keywords as $keyword) { $description .= '%'.$keyword.'%'; @@ -267,19 +267,19 @@ public function show($id, $rsskey) $builder->where('mal', '=', $mal); } - if ($rss->object_torrent->categories && is_array($rss->object_torrent->categories)) { + if ($rss->object_torrent->categories && \is_array($rss->object_torrent->categories)) { $builder->whereIn('category_id', $categories); } - if ($rss->object_torrent->types && is_array($rss->object_torrent->types)) { + if ($rss->object_torrent->types && \is_array($rss->object_torrent->types)) { $builder->whereIn('type_id', $types); } - if ($rss->object_torrent->resolutions && is_array($rss->object_torrent->resolutions)) { + if ($rss->object_torrent->resolutions && \is_array($rss->object_torrent->resolutions)) { $builder->whereIn('resolution_id', $resolutions); } - if ($rss->object_torrent->genres && is_array($rss->object_torrent->genres)) { + if ($rss->object_torrent->genres && \is_array($rss->object_torrent->genres)) { $genreID = TagTorrent::select(['torrent_id'])->distinct()->whereIn('tag_name', $genres)->get(); $builder->whereIn('id', $genreID)->cursor(); } @@ -326,7 +326,7 @@ public function show($id, $rsskey) $torrents = $builder->latest()->take(50)->get(); - return response()->view('rss.show', ['torrents' => $torrents, 'user' => $user, 'rss' => $rss])->header('Content-Type', 'text/xml'); + return \response()->view('rss.show', ['torrents' => $torrents, 'user' => $user, 'rss' => $rss])->header('Content-Type', 'text/xml'); } /** @@ -343,7 +343,7 @@ public function edit(Request $request, $id) $rss = Rss::where('is_private', '=', 1)->findOrFail($id); $torrent_repository = $this->torrentFacetedRepository; - return view('rss.edit', [ + return \view('rss.edit', [ 'torrent_repository' => $torrent_repository, 'categories' => Category::all()->sortBy('position'), 'types' => Type::all()->sortBy('position'), @@ -365,7 +365,7 @@ public function update(Request $request, $id) { $rss = Rss::where('is_private', '=', 1)->findOrFail($id); - $v = validator($request->all(), [ + $v = \validator($request->all(), [ 'search' => 'max:255', 'description' => 'max:255', 'uploader' => 'max:255', @@ -405,8 +405,8 @@ public function update(Request $request, $id) $redirect = null; if ($v->passes()) { $expected = $rss->expected_fields; - $push = array_merge($expected, $params); - $rss->json_torrent = array_merge($rss->json_torrent, $push); + $push = \array_merge($expected, $params); + $rss->json_torrent = \array_merge($rss->json_torrent, $push); $rss->is_private = 1; $rss->save(); $success = 'Private RSS Feed Updated'; @@ -417,11 +417,11 @@ public function update(Request $request, $id) $error = $v->errors(); } - return redirect()->route('rss.edit', ['id' => $id]) + return \redirect()->route('rss.edit', ['id' => $id]) ->withErrors($error); } - return redirect()->route('rss.index', ['hash' => 'private']) + return \redirect()->route('rss.index', ['hash' => 'private']) ->withSuccess($success); } @@ -439,7 +439,7 @@ public function destroy($id) $rss = Rss::where('is_private', '=', 1)->findOrFail($id); $rss->delete(); - return redirect()->route('rss.index', ['hash' => 'private']) + return \redirect()->route('rss.index', ['hash' => 'private']) ->withSuccess('RSS Feed Deleted!'); } } diff --git a/app/Http/Controllers/SeedboxController.php b/app/Http/Controllers/SeedboxController.php index ca698b4f4d..1c37a8d53b 100644 --- a/app/Http/Controllers/SeedboxController.php +++ b/app/Http/Controllers/SeedboxController.php @@ -31,11 +31,11 @@ public function index(Request $request, $username) { $user = User::where('username', '=', $username)->firstOrFail(); - abort_unless(($request->user()->group->is_modo || $request->user()->id == $user->id), 403); + \abort_unless(($request->user()->group->is_modo || $request->user()->id == $user->id), 403); $seedboxes = Seedbox::where('user_id', '=', $user->id)->paginate(25); - return view('seedbox.index', ['user' => $user, 'seedboxes' => $seedboxes]); + return \view('seedbox.index', ['user' => $user, 'seedboxes' => $seedboxes]); } /** @@ -54,18 +54,18 @@ protected function store(Request $request) $seedbox->name = $request->input('name'); $seedbox->ip = $request->input('ip'); - $v = validator($seedbox->toArray(), [ + $v = \validator($seedbox->toArray(), [ 'name' => 'required|alpha_num', 'ip' => 'required|unique:clients,ip', ]); if ($v->fails()) { - return redirect()->route('seedboxes.index', ['username' => $user->username]) + return \redirect()->route('seedboxes.index', ['username' => $user->username]) ->withErrors($v->errors()); } $seedbox->save(); - return redirect()->route('seedboxes.index', ['username' => $user->username]) + return \redirect()->route('seedboxes.index', ['username' => $user->username]) ->withSuccess('Seedbox Has Been Successfully Added!'); } @@ -82,11 +82,11 @@ protected function destroy(Request $request, $id) $user = $request->user(); $seedbox = Seedbox::findOrFail($id); - abort_unless(($user->group->is_modo || $user->id == $seedbox->user_id), 403); + \abort_unless(($user->group->is_modo || $user->id == $seedbox->user_id), 403); $seedbox->delete(); - return redirect()->route('seedboxes.index', ['username' => $user->username]) + return \redirect()->route('seedboxes.index', ['username' => $user->username]) ->withSuccess('Seedbox Has Been Successfully Deleted'); } } diff --git a/app/Http/Controllers/Staff/ApplicationController.php b/app/Http/Controllers/Staff/ApplicationController.php index 125df6ec5a..ec65f136f1 100644 --- a/app/Http/Controllers/Staff/ApplicationController.php +++ b/app/Http/Controllers/Staff/ApplicationController.php @@ -37,7 +37,7 @@ public function index() ->latest() ->paginate(25); - return view('Staff.application.index', ['applications' => $applications]); + return \view('Staff.application.index', ['applications' => $applications]); } /** @@ -51,7 +51,7 @@ public function show($id) { $application = Application::withAnyStatus()->with(['user', 'moderated', 'imageProofs', 'urlProofs'])->findOrFail($id); - return view('Staff.application.show', ['application' => $application]); + return \view('Staff.application.show', ['application' => $application]); } /** @@ -77,34 +77,34 @@ public function approve(Request $request, $id) $invite->user_id = $user->id; $invite->email = $application->email; $invite->code = $code; - $invite->expires_on = $carbon->copy()->addDays(config('other.invite_expire')); + $invite->expires_on = $carbon->copy()->addDays(\config('other.invite_expire')); $invite->custom = $request->input('approve'); - if (config('email-blacklist.enabled') == true) { - $v = validator($request->all(), [ + if (\config('email-blacklist.enabled') == true) { + $v = \validator($request->all(), [ 'email' => 'required|string|email|max:70|blacklist|unique:users|unique:invites', 'approve' => 'required', ]); } else { - $v = validator($request->all(), [ + $v = \validator($request->all(), [ 'email' => 'required|string|email|max:70|unique:users|unique:invites', 'approve' => 'required', ]); } if ($v->fails()) { - return redirect()->route('staff.applications.index') + return \redirect()->route('staff.applications.index') ->withErrors($v->errors()); } Mail::to($application->email)->send(new InviteUser($invite)); $invite->save(); $application->markApproved(); - return redirect()->route('staff.applications.index') + return \redirect()->route('staff.applications.index') ->withSuccess('Application Approved'); } - return redirect()->route('staff.applications.index') + return \redirect()->route('staff.applications.index') ->withErrors('Application Already Approved'); } @@ -122,18 +122,18 @@ public function reject(Request $request, $id) if ($application->status !== 2) { $denied_message = $request->input('deny'); - $v = validator($request->all(), [ + $v = \validator($request->all(), [ 'deny' => 'required', ]); $application->markRejected(); Mail::to($application->email)->send(new DenyApplication($denied_message)); - return redirect()->route('staff.applications.index') + return \redirect()->route('staff.applications.index') ->withSuccess('Application Rejected'); } - return redirect()->route('staff.applications.index') + return \redirect()->route('staff.applications.index') ->withErrors('Application Already Rejected'); } } diff --git a/app/Http/Controllers/Staff/ArticleController.php b/app/Http/Controllers/Staff/ArticleController.php index 8c914f26b4..2c40f01277 100644 --- a/app/Http/Controllers/Staff/ArticleController.php +++ b/app/Http/Controllers/Staff/ArticleController.php @@ -30,7 +30,7 @@ public function index() { $articles = Article::latest()->paginate(25); - return view('Staff.article.index', ['articles' => $articles]); + return \view('Staff.article.index', ['articles' => $articles]); } /** @@ -40,7 +40,7 @@ public function index() */ public function create() { - return view('Staff.article.create'); + return \view('Staff.article.create'); } /** @@ -60,8 +60,8 @@ public function store(Request $request) if ($request->hasFile('image')) { $image = $request->file('image'); - $filename = 'article-'.uniqid().'.'.$image->getClientOriginalExtension(); - $path = public_path('/files/img/'.$filename); + $filename = 'article-'.\uniqid().'.'.$image->getClientOriginalExtension(); + $path = \public_path('/files/img/'.$filename); Image::make($image->getRealPath())->fit(75, 75)->encode('png', 100)->save($path); $article->image = $filename; } else { @@ -69,7 +69,7 @@ public function store(Request $request) $article->image = null; } - $v = validator($article->toArray(), [ + $v = \validator($article->toArray(), [ 'title' => 'required', 'slug' => 'required', 'content' => 'required|min:20', @@ -77,12 +77,12 @@ public function store(Request $request) ]); if ($v->fails()) { - return redirect()->route('staff.articles.index') + return \redirect()->route('staff.articles.index') ->withErrors($v->errors()); } $article->save(); - return redirect()->route('staff.articles.index') + return \redirect()->route('staff.articles.index') ->withSuccess('Your article has successfully published!'); } @@ -97,7 +97,7 @@ public function edit($id) { $article = Article::findOrFail($id); - return view('Staff.article.edit', ['article' => $article]); + return \view('Staff.article.edit', ['article' => $article]); } /** @@ -117,8 +117,8 @@ public function update(Request $request, $id) if ($request->hasFile('image')) { $image = $request->file('image'); - $filename = 'article-'.uniqid().'.'.$image->getClientOriginalExtension(); - $path = public_path('/files/img/'.$filename); + $filename = 'article-'.\uniqid().'.'.$image->getClientOriginalExtension(); + $path = \public_path('/files/img/'.$filename); Image::make($image->getRealPath())->fit(75, 75)->encode('png', 100)->save($path); $article->image = $filename; } else { @@ -126,19 +126,19 @@ public function update(Request $request, $id) $article->image = null; } - $v = validator($article->toArray(), [ + $v = \validator($article->toArray(), [ 'title' => 'required', 'slug' => 'required', 'content' => 'required|min:20', ]); if ($v->fails()) { - return redirect()->route('staff.articles.index') + return \redirect()->route('staff.articles.index') ->withErrors($v->errors()); } $article->save(); - return redirect()->route('staff.articles.index') + return \redirect()->route('staff.articles.index') ->withSuccess('Your article changes have successfully published!'); } @@ -154,7 +154,7 @@ public function destroy($id) $article = Article::findOrFail($id); $article->delete(); - return redirect()->route('staff.articles.index') + return \redirect()->route('staff.articles.index') ->withSuccess('Article has successfully been deleted'); } } diff --git a/app/Http/Controllers/Staff/AuditController.php b/app/Http/Controllers/Staff/AuditController.php index 229fe86c3f..d77edeaec0 100644 --- a/app/Http/Controllers/Staff/AuditController.php +++ b/app/Http/Controllers/Staff/AuditController.php @@ -28,7 +28,7 @@ public function index() { $audits = Audit::with('user')->latest()->paginate(50); - return view('Staff.audit.index', ['audits' => $audits]); + return \view('Staff.audit.index', ['audits' => $audits]); } /** @@ -44,10 +44,10 @@ public function destroy(Request $request, $id) $user = $request->user(); $audit = Audit::findOrFail($id); - abort_unless($user->group->is_modo, 403); + \abort_unless($user->group->is_modo, 403); $audit->delete(); - return redirect()->route('staff.audits.index') + return \redirect()->route('staff.audits.index') ->withSuccess('Audit Record Has Successfully Been Deleted'); } } diff --git a/app/Http/Controllers/Staff/AuthenticationController.php b/app/Http/Controllers/Staff/AuthenticationController.php index 001685b218..f3961bb9d9 100644 --- a/app/Http/Controllers/Staff/AuthenticationController.php +++ b/app/Http/Controllers/Staff/AuthenticationController.php @@ -27,6 +27,6 @@ public function index() { $attempts = FailedLoginAttempt::latest()->paginate(25); - return view('Staff.authentication.index', ['attempts' => $attempts]); + return \view('Staff.authentication.index', ['attempts' => $attempts]); } } diff --git a/app/Http/Controllers/Staff/BackupController.php b/app/Http/Controllers/Staff/BackupController.php index e5fc036855..fc4a00a5a6 100644 --- a/app/Http/Controllers/Staff/BackupController.php +++ b/app/Http/Controllers/Staff/BackupController.php @@ -35,15 +35,15 @@ class BackupController extends Controller public function index(Request $request) { $user = $request->user(); - abort_unless($user->group->is_owner, 403); + \abort_unless($user->group->is_owner, 403); - if ((is_countable(config('backup.backup.destination.disks')) ? count(config('backup.backup.destination.disks')) : 0) === 0) { - dd(trans('backup.no_disks_configured')); + if ((\is_countable(\config('backup.backup.destination.disks')) ? \count(\config('backup.backup.destination.disks')) : 0) === 0) { + \dd(\trans('backup.no_disks_configured')); } $data['backups'] = []; - foreach (config('backup.backup.destination.disks') as $disk_name) { + foreach (\config('backup.backup.destination.disks') as $disk_name) { $disk = Storage::disk($disk_name); $adapter = $disk->getDriver()->getAdapter(); $files = $disk->allFiles(); @@ -51,10 +51,10 @@ public function index(Request $request) // make an array of backup files, with their filesize and creation date foreach ($files as $k => $f) { // only take the zip files into account - if (substr($f, -4) === '.zip' && $disk->exists($f)) { + if (\substr($f, -4) === '.zip' && $disk->exists($f)) { $data['backups'][] = [ 'file_path' => $f, - 'file_name' => str_replace('backups/', '', $f), + 'file_name' => \str_replace('backups/', '', $f), 'file_size' => $disk->size($f), 'last_modified' => $disk->lastModified($f), 'disk' => $disk_name, @@ -65,10 +65,10 @@ public function index(Request $request) } // reverse the backups, so the newest one would be on top - $data['backups'] = array_reverse($data['backups']); + $data['backups'] = \array_reverse($data['backups']); $data['title'] = 'Backups'; - return view('Staff.backup.index', $data); + return \view('Staff.backup.index', $data); } /** @@ -81,17 +81,17 @@ public function index(Request $request) public function create(Request $request) { $user = $request->user(); - abort_unless($user->group->is_owner, 403); + \abort_unless($user->group->is_owner, 403); try { - ini_set('max_execution_time', 900); + \ini_set('max_execution_time', 900); // start the backup process Log::info('BackupManager called from staff dashboard'); Artisan::call('backup:run'); $output = Artisan::output(); - if (strpos($output, 'Backup failed because')) { - preg_match('Backup failed because(.*?)$/ms', $output, $match); + if (\strpos($output, 'Backup failed because')) { + \preg_match('Backup failed because(.*?)$/ms', $output, $match); $message = 'BackupManager process failed because '; $message .= $match[1] ?? ''; Log::error($message.PHP_EOL.$output); @@ -101,7 +101,7 @@ public function create(Request $request) } catch (Exception $e) { Log::error($e); - response($e->getMessage(), 500); + \response($e->getMessage(), 500); } return self::MESSAGE; @@ -117,17 +117,17 @@ public function create(Request $request) public function files(Request $request) { $user = $request->user(); - abort_unless($user->group->is_owner, 403); + \abort_unless($user->group->is_owner, 403); try { - ini_set('max_execution_time', 900); + \ini_set('max_execution_time', 900); // start the backup process Log::info('BackupManager called from staff dashboard'); Artisan::call('backup:run --only-files'); $output = Artisan::output(); - if (strpos($output, 'Backup failed because')) { - preg_match('Backup failed because(.*?)$/ms', $output, $match); + if (\strpos($output, 'Backup failed because')) { + \preg_match('Backup failed because(.*?)$/ms', $output, $match); $message = 'BackupManager process failed because '; $message .= $match[1] ?? ''; Log::error($message.PHP_EOL.$output); @@ -137,7 +137,7 @@ public function files(Request $request) } catch (Exception $e) { Log::error($e); - response($e->getMessage(), 500); + \response($e->getMessage(), 500); } return self::MESSAGE; @@ -153,17 +153,17 @@ public function files(Request $request) public function database(Request $request) { $user = $request->user(); - abort_unless($user->group->is_owner, 403); + \abort_unless($user->group->is_owner, 403); try { - ini_set('max_execution_time', 900); + \ini_set('max_execution_time', 900); // start the backup process Log::info('BackupManager called from staff dashboard'); Artisan::call('backup:run --only-db'); $output = Artisan::output(); - if (strpos($output, 'Backup failed because')) { - preg_match('Backup failed because(.*?)$/ms', $output, $match); + if (\strpos($output, 'Backup failed because')) { + \preg_match('Backup failed because(.*?)$/ms', $output, $match); $message = 'BackupManager process failed because '; $message .= $match[1] ?? ''; Log::error($message.PHP_EOL.$output); @@ -173,7 +173,7 @@ public function database(Request $request) } catch (Exception $e) { Log::error($e); - response($e->getMessage(), 500); + \response($e->getMessage(), 500); } return self::MESSAGE; @@ -189,7 +189,7 @@ public function database(Request $request) public function download(Request $request) { $user = $request->user(); - abort_unless($user->group->is_owner, 403); + \abort_unless($user->group->is_owner, 403); $disk = Storage::disk($request->input('disk')); $file_name = $request->input('file_name'); @@ -199,13 +199,13 @@ public function download(Request $request) $storage_path = $disk->getDriver()->getAdapter()->getPathPrefix(); if ($disk->exists($file_name)) { - return response()->download($storage_path.$file_name); + return \response()->download($storage_path.$file_name); } - return abort(404, trans('backup.backup_doesnt_exist')); + return \abort(404, \trans('backup.backup_doesnt_exist')); } - return abort(404, trans('backup.only_local_downloads_supported')); + return \abort(404, \trans('backup.only_local_downloads_supported')); } /** @@ -218,7 +218,7 @@ public function download(Request $request) public function destroy(Request $request) { $user = $request->user(); - abort_unless($user->group->is_owner, 403); + \abort_unless($user->group->is_owner, 403); $disk = Storage::disk($request->input('disk')); $file_name = $request->input('file_name'); @@ -231,9 +231,9 @@ public function destroy(Request $request) return self::MESSAGE; } - return abort(404, trans('backup.backup_doesnt_exist')); + return \abort(404, \trans('backup.backup_doesnt_exist')); } - return abort(404, trans('backup.backup_doesnt_exist')); + return \abort(404, \trans('backup.backup_doesnt_exist')); } } diff --git a/app/Http/Controllers/Staff/BanController.php b/app/Http/Controllers/Staff/BanController.php index 8bd05387be..e055087106 100644 --- a/app/Http/Controllers/Staff/BanController.php +++ b/app/Http/Controllers/Staff/BanController.php @@ -34,7 +34,7 @@ public function index() { $bans = Ban::latest()->paginate(25); - return view('Staff.ban.index', ['bans' => $bans]); + return \view('Staff.ban.index', ['bans' => $bans]); } /** @@ -51,9 +51,9 @@ public function store(Request $request, $username) { $user = User::where('username', '=', $username)->firstOrFail(); $staff = $request->user(); - $banned_group = cache()->rememberForever('banned_group', fn () => Group::where('slug', '=', 'banned')->pluck('id')); + $banned_group = \cache()->rememberForever('banned_group', fn () => Group::where('slug', '=', 'banned')->pluck('id')); - abort_if($user->group->is_modo || $request->user()->id == $user->id, 403); + \abort_if($user->group->is_modo || $request->user()->id == $user->id, 403); $user->group_id = $banned_group[0]; $user->can_upload = 0; @@ -68,12 +68,12 @@ public function store(Request $request, $username) $ban->created_by = $staff->id; $ban->ban_reason = $request->input('ban_reason'); - $v = validator($ban->toArray(), [ + $v = \validator($ban->toArray(), [ 'ban_reason' => 'required', ]); if ($v->fails()) { - return redirect()->route('users.show', ['username' => $user->username]) + return \redirect()->route('users.show', ['username' => $user->username]) ->withErrors($v->errors()); } $user->save(); @@ -81,7 +81,7 @@ public function store(Request $request, $username) // Send Email Mail::to($user->email)->send(new BanUser($user->email, $ban)); - return redirect()->route('users.show', ['username' => $user->username]) + return \redirect()->route('users.show', ['username' => $user->username]) ->withSuccess('User Is Now Banned!'); } @@ -98,7 +98,7 @@ public function update(Request $request, $username) $user = User::where('username', '=', $username)->firstOrFail(); $staff = $request->user(); - abort_if($user->group->is_modo || $request->user()->id == $user->id, 403); + \abort_if($user->group->is_modo || $request->user()->id == $user->id, 403); $user->group_id = $request->input('group_id'); $user->can_upload = 1; @@ -114,13 +114,13 @@ public function update(Request $request, $username) $ban->unban_reason = $request->input('unban_reason'); $ban->removed_at = Carbon::now(); - $v = validator($request->all(), [ + $v = \validator($request->all(), [ 'group_id' => 'required', 'unban_reason' => 'required', ]); if ($v->fails()) { - return redirect()->route('users.show', ['username' => $user->username]) + return \redirect()->route('users.show', ['username' => $user->username]) ->withErrors($v->errors()); } $user->save(); @@ -128,7 +128,7 @@ public function update(Request $request, $username) // Send Email Mail::to($user->email)->send(new UnbanUser($user->email, $ban)); - return redirect()->route('users.show', ['username' => $user->username]) + return \redirect()->route('users.show', ['username' => $user->username]) ->withSuccess('User Is Now Relieved Of His Ban!'); } } diff --git a/app/Http/Controllers/Staff/CategoryController.php b/app/Http/Controllers/Staff/CategoryController.php index 865e81da6d..62eed05cfe 100644 --- a/app/Http/Controllers/Staff/CategoryController.php +++ b/app/Http/Controllers/Staff/CategoryController.php @@ -30,7 +30,7 @@ public function index() { $categories = Category::all()->sortBy('position'); - return view('Staff.category.index', ['categories' => $categories]); + return \view('Staff.category.index', ['categories' => $categories]); } /** @@ -40,7 +40,7 @@ public function index() */ public function create() { - return view('Staff.category.create'); + return \view('Staff.category.create'); } /** @@ -65,15 +65,15 @@ public function store(Request $request) if ($request->hasFile('image')) { $image = $request->file('image'); - $filename = 'category-'.uniqid().'.'.$image->getClientOriginalExtension(); - $path = public_path('/files/img/'.$filename); + $filename = 'category-'.\uniqid().'.'.$image->getClientOriginalExtension(); + $path = \public_path('/files/img/'.$filename); Image::make($image->getRealPath())->fit(60, 60)->encode('png', 100)->save($path); $category->image = $filename; } else { $category->image = null; } - $v = validator($category->toArray(), [ + $v = \validator($category->toArray(), [ 'name' => 'required', 'slug' => 'required', 'position' => 'required', @@ -86,12 +86,12 @@ public function store(Request $request) ]); if ($v->fails()) { - return redirect()->route('staff.categories.index') + return \redirect()->route('staff.categories.index') ->withErrors($v->errors()); } $category->save(); - return redirect()->route('staff.categories.index') + return \redirect()->route('staff.categories.index') ->withSuccess('Category Successfully Added'); } @@ -106,7 +106,7 @@ public function edit($id) { $category = Category::findOrFail($id); - return view('Staff.category.edit', ['category' => $category]); + return \view('Staff.category.edit', ['category' => $category]); } /** @@ -132,13 +132,13 @@ public function update(Request $request, $id) if ($request->hasFile('image')) { $image = $request->file('image'); - $filename = 'category-'.uniqid().'.'.$image->getClientOriginalExtension(); - $path = public_path('/files/img/'.$filename); + $filename = 'category-'.\uniqid().'.'.$image->getClientOriginalExtension(); + $path = \public_path('/files/img/'.$filename); Image::make($image->getRealPath())->fit(60, 60)->encode('png', 100)->save($path); $category->image = $filename; } - $v = validator($category->toArray(), [ + $v = \validator($category->toArray(), [ 'name' => 'required', 'slug' => 'required', 'position' => 'required', @@ -151,12 +151,12 @@ public function update(Request $request, $id) ]); if ($v->fails()) { - return redirect()->route('staff.categories.index') + return \redirect()->route('staff.categories.index') ->withErrors($v->errors()); } $category->save(); - return redirect()->route('staff.categories.index') + return \redirect()->route('staff.categories.index') ->withSuccess('Category Successfully Modified'); } @@ -172,7 +172,7 @@ public function destroy($id) $category = Category::findOrFail($id); $category->delete(); - return redirect()->route('staff.categories.index') + return \redirect()->route('staff.categories.index') ->withSuccess('Category Successfully Deleted'); } } diff --git a/app/Http/Controllers/Staff/ChatBotController.php b/app/Http/Controllers/Staff/ChatBotController.php index 9c7e098c60..0b746add93 100644 --- a/app/Http/Controllers/Staff/ChatBotController.php +++ b/app/Http/Controllers/Staff/ChatBotController.php @@ -31,7 +31,7 @@ public function index($hash = null) { $bots = Bot::orderBy('position', 'ASC')->get(); - return view('Staff.chat.bot.index', [ + return \view('Staff.chat.bot.index', [ 'bots' => $bots, ]); } @@ -49,7 +49,7 @@ public function edit(Request $request, $id) $user = $request->user(); $bot = Bot::findOrFail($id); - return view('Staff.chat.bot.edit', [ + return \view('Staff.chat.bot.edit', [ 'user' => $user, 'bot' => $bot, ]); @@ -69,7 +69,7 @@ public function update(Request $request, $id) $bot = Bot::findOrFail($id); if ($request->has('command') && $request->input('command') == $bot->command) { - $v = validator($request->all(), [ + $v = \validator($request->all(), [ 'name' => 'required|min:3|max:255', 'command' => 'required|alpha_dash|min:3|max:255', 'position' => 'required', @@ -81,7 +81,7 @@ public function update(Request $request, $id) 'about' => 'sometimes|max:9999', ]); } else { - $v = validator($request->all(), [ + $v = \validator($request->all(), [ 'name' => 'required|min:3|max:255', 'command' => 'required|alpha_dash|min:3|max:255|unique:bots', 'position' => 'required', @@ -118,11 +118,11 @@ public function update(Request $request, $id) $error = $v->errors(); } - return redirect()->route('staff.bots.edit', ['id' => $id]) + return \redirect()->route('staff.bots.edit', ['id' => $id]) ->withErrors($error); } - return redirect()->route('staff.bots.edit', ['id' => $id]) + return \redirect()->route('staff.bots.edit', ['id' => $id]) ->withSuccess($success); } @@ -138,7 +138,7 @@ public function destroy($id) $bot = Bot::where('is_protected', '=', 0)->findOrFail($id); $bot->delete(); - return redirect()->route('staff.bots.index') + return \redirect()->route('staff.bots.index') ->withSuccess('The Humans Vs Machines War Has Begun! Humans: 1 and Bots: 0'); } @@ -155,7 +155,7 @@ public function disable($id) $bot->active = 0; $bot->save(); - return redirect()->route('staff.bots.index') + return \redirect()->route('staff.bots.index') ->withSuccess('The Bot Has Been Disabled'); } @@ -172,7 +172,7 @@ public function enable($id) $bot->active = 1; $bot->save(); - return redirect()->route('staff.bots.index') + return \redirect()->route('staff.bots.index') ->withSuccess('The Bot Has Been Enabled'); } } diff --git a/app/Http/Controllers/Staff/ChatRoomController.php b/app/Http/Controllers/Staff/ChatRoomController.php index bfbe04005e..f3660f7023 100644 --- a/app/Http/Controllers/Staff/ChatRoomController.php +++ b/app/Http/Controllers/Staff/ChatRoomController.php @@ -45,7 +45,7 @@ public function index() { $chatrooms = $this->chatRepository->rooms(); - return view('Staff.chat.room.index', [ + return \view('Staff.chat.room.index', [ 'chatrooms' => $chatrooms, ]); } @@ -62,17 +62,17 @@ public function store(Request $request) $chatroom = new Chatroom(); $chatroom->name = $request->input('name'); - $v = validator($chatroom->toArray(), [ + $v = \validator($chatroom->toArray(), [ 'name' => 'required', ]); if ($v->fails()) { - return redirect()->route('staff.rooms.index') + return \redirect()->route('staff.rooms.index') ->withErrors($v->errors()); } $chatroom->save(); - return redirect()->route('staff.rooms.index') + return \redirect()->route('staff.rooms.index') ->withSuccess('Chatroom Successfully Added'); } @@ -89,17 +89,17 @@ public function update(Request $request, $id) $chatroom = Chatroom::findOrFail($id); $chatroom->name = $request->input('name'); - $v = validator($chatroom->toArray(), [ + $v = \validator($chatroom->toArray(), [ 'name' => 'required', ]); if ($v->fails()) { - return redirect()->route('staff.rooms.index') + return \redirect()->route('staff.rooms.index') ->withErrors($v->errors()); } $chatroom->save(); - return redirect()->route('staff.rooms.index') + return \redirect()->route('staff.rooms.index') ->withSuccess('Chatroom Successfully Modified'); } @@ -114,14 +114,14 @@ public function destroy($id) { $chatroom = Chatroom::findOrFail($id); $users = User::where('chatroom_id', '=', $id)->get(); - $default = Chatroom::where('name', '=', config('chat.system_chatroom'))->pluck('id'); + $default = Chatroom::where('name', '=', \config('chat.system_chatroom'))->pluck('id'); foreach ($users as $user) { $user->chatroom_id = $default[0]; $user->save(); } $chatroom->delete(); - return redirect()->route('staff.rooms.index') + return \redirect()->route('staff.rooms.index') ->withSuccess('Chatroom Successfully Deleted'); } } diff --git a/app/Http/Controllers/Staff/ChatStatusController.php b/app/Http/Controllers/Staff/ChatStatusController.php index 4c2d04d9d0..e722ae9182 100644 --- a/app/Http/Controllers/Staff/ChatStatusController.php +++ b/app/Http/Controllers/Staff/ChatStatusController.php @@ -44,7 +44,7 @@ public function index() { $chatstatuses = $this->chatRepository->statuses(); - return view('Staff.chat.status.index', [ + return \view('Staff.chat.status.index', [ 'chatstatuses' => $chatstatuses, ]); } @@ -63,19 +63,19 @@ public function store(Request $request) $chatstatus->color = $request->input('color'); $chatstatus->icon = $request->input('icon'); - $v = validator($chatstatus->toArray(), [ + $v = \validator($chatstatus->toArray(), [ 'name' => 'required', 'color' => 'required', 'icon' => 'required', ]); if ($v->fails()) { - return redirect()->route('staff.statuses.index') + return \redirect()->route('staff.statuses.index') ->withErrors($v->errors()); } $chatstatus->save(); - return redirect()->route('staff.statuses.index') + return \redirect()->route('staff.statuses.index') ->withSuccess('Chat Status Successfully Added'); } @@ -94,19 +94,19 @@ public function update(Request $request, $id) $chatstatus->color = $request->input('color'); $chatstatus->icon = $request->input('icon'); - $v = validator($chatstatus->toArray(), [ + $v = \validator($chatstatus->toArray(), [ 'name' => 'required', 'color' => 'required', 'icon' => 'required', ]); if ($v->fails()) { - return redirect()->route('staff.statuses.index') + return \redirect()->route('staff.statuses.index') ->withErrors($v->errors()); } $chatstatus->save(); - return redirect()->route('staff.statuses.index') + return \redirect()->route('staff.statuses.index') ->withSuccess('Chat Status Successfully Modified'); } @@ -122,7 +122,7 @@ public function destroy($id) $chatstatus = ChatStatus::findOrFail($id); $chatstatus->delete(); - return redirect()->route('staff.statuses.index') + return \redirect()->route('staff.statuses.index') ->withSuccess('Chat Status Successfully Deleted'); } } diff --git a/app/Http/Controllers/Staff/CheaterController.php b/app/Http/Controllers/Staff/CheaterController.php index e63599b665..b6e99575ba 100644 --- a/app/Http/Controllers/Staff/CheaterController.php +++ b/app/Http/Controllers/Staff/CheaterController.php @@ -43,6 +43,6 @@ function ($join) { ->latest() ->paginate(25); - return view('Staff.cheater.index', ['cheaters' => $cheaters]); + return \view('Staff.cheater.index', ['cheaters' => $cheaters]); } } diff --git a/app/Http/Controllers/Staff/CommandController.php b/app/Http/Controllers/Staff/CommandController.php index 4b24992263..bc5401ce6a 100644 --- a/app/Http/Controllers/Staff/CommandController.php +++ b/app/Http/Controllers/Staff/CommandController.php @@ -28,9 +28,9 @@ class CommandController extends Controller public function index(Request $request) { $user = $request->user(); - abort_unless($user->group->is_owner, 403); + \abort_unless($user->group->is_owner, 403); - return view('Staff.command.index'); + return \view('Staff.command.index'); } /** @@ -43,12 +43,12 @@ public function index(Request $request) public function maintanceEnable(Request $request) { $user = $request->user(); - abort_unless($user->group->is_owner, 403); + \abort_unless($user->group->is_owner, 403); \Artisan::call('down --allow='.$request->ip()); - return redirect()->route('staff.commands.index') - ->withInfo(trim(\Artisan::output())); + return \redirect()->route('staff.commands.index') + ->withInfo(\trim(\Artisan::output())); } /** @@ -61,12 +61,12 @@ public function maintanceEnable(Request $request) public function maintanceDisable(Request $request) { $user = $request->user(); - abort_unless($user->group->is_owner, 403); + \abort_unless($user->group->is_owner, 403); \Artisan::call('up'); - return redirect()->route('staff.commands.index') - ->withInfo(trim(\Artisan::output())); + return \redirect()->route('staff.commands.index') + ->withInfo(\trim(\Artisan::output())); } /** @@ -79,12 +79,12 @@ public function maintanceDisable(Request $request) public function clearCache(Request $request) { $user = $request->user(); - abort_unless($user->group->is_owner, 403); + \abort_unless($user->group->is_owner, 403); \Artisan::call('cache:clear'); - return redirect()->route('staff.commands.index') - ->withInfo(trim(\Artisan::output())); + return \redirect()->route('staff.commands.index') + ->withInfo(\trim(\Artisan::output())); } /** @@ -97,12 +97,12 @@ public function clearCache(Request $request) public function clearView(Request $request) { $user = $request->user(); - abort_unless($user->group->is_owner, 403); + \abort_unless($user->group->is_owner, 403); \Artisan::call('view:clear'); - return redirect()->route('staff.commands.index') - ->withInfo(trim(\Artisan::output())); + return \redirect()->route('staff.commands.index') + ->withInfo(\trim(\Artisan::output())); } /** @@ -115,12 +115,12 @@ public function clearView(Request $request) public function clearRoute(Request $request) { $user = $request->user(); - abort_unless($user->group->is_owner, 403); + \abort_unless($user->group->is_owner, 403); \Artisan::call('route:clear'); - return redirect()->route('staff.commands.index') - ->withInfo(trim(\Artisan::output())); + return \redirect()->route('staff.commands.index') + ->withInfo(\trim(\Artisan::output())); } /** @@ -133,12 +133,12 @@ public function clearRoute(Request $request) public function clearConfig(Request $request) { $user = $request->user(); - abort_unless($user->group->is_owner, 403); + \abort_unless($user->group->is_owner, 403); \Artisan::call('config:clear'); - return redirect()->route('staff.commands.index') - ->withInfo(trim(\Artisan::output())); + return \redirect()->route('staff.commands.index') + ->withInfo(\trim(\Artisan::output())); } /** @@ -151,12 +151,12 @@ public function clearConfig(Request $request) public function clearAllCache(Request $request) { $user = $request->user(); - abort_unless($user->group->is_owner, 403); + \abort_unless($user->group->is_owner, 403); \Artisan::call('clear:all_cache'); - return redirect()->route('staff.commands.index') - ->withInfo(trim(\Artisan::output())); + return \redirect()->route('staff.commands.index') + ->withInfo(\trim(\Artisan::output())); } /** @@ -169,12 +169,12 @@ public function clearAllCache(Request $request) public function setAllCache(Request $request) { $user = $request->user(); - abort_unless($user->group->is_owner, 403); + \abort_unless($user->group->is_owner, 403); \Artisan::call('set:all_cache'); - return redirect()->route('staff.commands.index') - ->withInfo(trim(\Artisan::output())); + return \redirect()->route('staff.commands.index') + ->withInfo(\trim(\Artisan::output())); } /** @@ -187,11 +187,11 @@ public function setAllCache(Request $request) public function testEmail(Request $request) { $user = $request->user(); - abort_unless($user->group->is_owner, 403); + \abort_unless($user->group->is_owner, 403); \Artisan::call('test:email'); - return redirect()->route('staff.commands.index') - ->withInfo(trim(\Artisan::output())); + return \redirect()->route('staff.commands.index') + ->withInfo(\trim(\Artisan::output())); } } diff --git a/app/Http/Controllers/Staff/FlushController.php b/app/Http/Controllers/Staff/FlushController.php index d1a57975a7..2729259b88 100644 --- a/app/Http/Controllers/Staff/FlushController.php +++ b/app/Http/Controllers/Staff/FlushController.php @@ -59,7 +59,7 @@ public function peers() $peer->delete(); } - return redirect()->route('staff.dashboard.index') + return \redirect()->route('staff.dashboard.index') ->withSuccess('Ghost Peers Have Been Flushed'); } @@ -73,7 +73,7 @@ public function peers() public function chat() { foreach (Message::all() as $message) { - broadcast(new MessageDeleted($message)); + \broadcast(new MessageDeleted($message)); $message->delete(); } @@ -81,7 +81,7 @@ public function chat() 'Chatbox Has Been Flushed! :broom:' ); - return redirect()->route('staff.dashboard.index') + return \redirect()->route('staff.dashboard.index') ->withSuccess('Chatbox Has Been Flushed'); } } diff --git a/app/Http/Controllers/Staff/ForumController.php b/app/Http/Controllers/Staff/ForumController.php index 06f1a480ae..50c7fd01ba 100644 --- a/app/Http/Controllers/Staff/ForumController.php +++ b/app/Http/Controllers/Staff/ForumController.php @@ -31,7 +31,7 @@ public function index() { $categories = Forum::where('parent_id', '=', 0)->get()->sortBy('position'); - return view('Staff.forum.index', ['categories' => $categories]); + return \view('Staff.forum.index', ['categories' => $categories]); } /** @@ -44,7 +44,7 @@ public function create() $categories = Forum::where('parent_id', '=', 0)->get(); $groups = Group::all(); - return view('Staff.forum.create', ['categories' => $categories, 'groups' => $groups]); + return \view('Staff.forum.create', ['categories' => $categories, 'groups' => $groups]); } /** @@ -74,7 +74,7 @@ public function store(Request $request) } $perm->forum_id = $forum->id; $perm->group_id = $group->id; - if (array_key_exists($group->id, $request->input('permissions'))) { + if (\array_key_exists($group->id, $request->input('permissions'))) { $perm->show_forum = isset($request->input('permissions')[$group->id]['show_forum']); $perm->read_topic = isset($request->input('permissions')[$group->id]['read_topic']); $perm->reply_topic = isset($request->input('permissions')[$group->id]['reply_topic']); @@ -88,7 +88,7 @@ public function store(Request $request) $perm->save(); } - return redirect()->route('staff.forums.index') + return \redirect()->route('staff.forums.index') ->withSuccess('Forum has been created successfully'); } @@ -105,7 +105,7 @@ public function edit($id) $categories = Forum::where('parent_id', '=', 0)->get(); $groups = Group::all(); - return view('Staff.forum.edit', [ + return \view('Staff.forum.edit', [ 'categories' => $categories, 'groups' => $groups, 'forum' => $forum, @@ -140,7 +140,7 @@ public function update(Request $request, $id) } $perm->forum_id = $forum->id; $perm->group_id = $group->id; - if (array_key_exists($group->id, $request->input('permissions'))) { + if (\array_key_exists($group->id, $request->input('permissions'))) { $perm->show_forum = isset($request->input('permissions')[$group->id]['show_forum']); $perm->read_topic = isset($request->input('permissions')[$group->id]['read_topic']); $perm->reply_topic = isset($request->input('permissions')[$group->id]['reply_topic']); @@ -154,7 +154,7 @@ public function update(Request $request, $id) $perm->save(); } - return redirect()->route('staff.forums.index') + return \redirect()->route('staff.forums.index') ->withSuccess('Forum has been edited successfully'); } @@ -213,7 +213,7 @@ public function destroy($id) $forum->delete(); } - return redirect()->route('staff.forums.index') + return \redirect()->route('staff.forums.index') ->withSuccess('Forum has been deleted successfully'); } } diff --git a/app/Http/Controllers/Staff/GiftController.php b/app/Http/Controllers/Staff/GiftController.php index 821a17e515..6122c75b87 100644 --- a/app/Http/Controllers/Staff/GiftController.php +++ b/app/Http/Controllers/Staff/GiftController.php @@ -27,7 +27,7 @@ class GiftController extends Controller */ public function index() { - return view('Staff.gift.index'); + return \view('Staff.gift.index'); } /** @@ -46,7 +46,7 @@ public function store(Request $request) $invites = $request->input('invites'); $fl_tokens = $request->input('fl_tokens'); - $v = validator($request->all(), [ + $v = \validator($request->all(), [ 'username' => 'required|exists:users,username|max:180', 'seedbonus' => 'required|numeric|min:0', 'invites' => 'required|numeric|min:0', @@ -54,12 +54,12 @@ public function store(Request $request) ]); if ($v->fails()) { - return redirect()->route('staff.gifts.index') + return \redirect()->route('staff.gifts.index') ->withErrors($v->errors()); } $recipient = User::where('username', '=', $username)->first(); if (! $recipient) { - return redirect()->route('staff.gifts.index') + return \redirect()->route('staff.gifts.index') ->withErrors('Unable To Find Specified User'); } $recipient->seedbonus += $seedbonus; @@ -71,11 +71,11 @@ public function store(Request $request) $privateMessage->sender_id = 1; $privateMessage->receiver_id = $recipient->id; $privateMessage->subject = 'You Have Received A System Generated Gift'; - $privateMessage->message = sprintf('We just wanted to let you know that staff member, %s, has credited your account with %s Bonus Points, %s Invites and %s Freeleech Tokens. + $privateMessage->message = \sprintf('We just wanted to let you know that staff member, %s, has credited your account with %s Bonus Points, %s Invites and %s Freeleech Tokens. [color=red][b]THIS IS AN AUTOMATED SYSTEM MESSAGE, PLEASE DO NOT REPLY![/b][/color]', $staff->username, $seedbonus, $invites, $fl_tokens); $privateMessage->save(); - return redirect()->route('staff.gifts.index') + return \redirect()->route('staff.gifts.index') ->withSuccess('Gift Sent'); } } diff --git a/app/Http/Controllers/Staff/GroupController.php b/app/Http/Controllers/Staff/GroupController.php index d5c0250df4..56a7d97c11 100644 --- a/app/Http/Controllers/Staff/GroupController.php +++ b/app/Http/Controllers/Staff/GroupController.php @@ -32,11 +32,11 @@ class GroupController extends Controller public function index(Request $request) { $user = $request->user(); - abort_unless($user->group->is_admin, 403); + \abort_unless($user->group->is_admin, 403); $groups = Group::all()->sortBy('position'); - return view('Staff.group.index', ['groups' => $groups]); + return \view('Staff.group.index', ['groups' => $groups]); } /** @@ -49,9 +49,9 @@ public function index(Request $request) public function create(Request $request) { $user = $request->user(); - abort_unless($user->group->is_admin, 403); + \abort_unless($user->group->is_admin, 403); - return view('Staff.group.create'); + return \view('Staff.group.create'); } /** @@ -64,7 +64,7 @@ public function create(Request $request) public function store(Request $request) { $user = $request->user(); - abort_unless($user->group->is_admin, 403); + \abort_unless($user->group->is_admin, 403); $group = new Group(); $group->name = $request->input('name'); @@ -86,7 +86,7 @@ public function store(Request $request) $group->can_upload = $request->input('can_upload'); $group->autogroup = $request->input('autogroup'); - $v = validator($group->toArray(), [ + $v = \validator($group->toArray(), [ 'name' => 'required|unique:groups', 'slug' => 'required|unique:groups', 'position' => 'required', @@ -95,12 +95,12 @@ public function store(Request $request) ]); if (! $request->user()->group->is_owner && $request->input('is_owner') == 1) { - return redirect()->route('staff.groups.index') + return \redirect()->route('staff.groups.index') ->withErrors('You are not permitted to create a group with owner permissions!'); } if ($v->fails()) { - return redirect()->route('staff.groups.index') + return \redirect()->route('staff.groups.index') ->withErrors($v->errors()); } $group->save(); @@ -115,7 +115,7 @@ public function store(Request $request) $permission->save(); } - return redirect()->route('staff.groups.index') + return \redirect()->route('staff.groups.index') ->withSuccess('Group Was Created Successfully!'); } @@ -130,11 +130,11 @@ public function store(Request $request) public function edit(Request $request, $id) { $user = $request->user(); - abort_unless($user->group->is_admin, 403); + \abort_unless($user->group->is_admin, 403); $group = Group::findOrFail($id); - return view('Staff.group.edit', ['group' => $group]); + return \view('Staff.group.edit', ['group' => $group]); } /** @@ -148,7 +148,7 @@ public function edit(Request $request, $id) public function update(Request $request, $id) { $user = $request->user(); - abort_unless($user->group->is_admin, 403); + \abort_unless($user->group->is_admin, 403); $group = Group::findOrFail($id); @@ -171,7 +171,7 @@ public function update(Request $request, $id) $group->can_upload = $request->input('can_upload'); $group->autogroup = $request->input('autogroup'); - $v = validator($group->toArray(), [ + $v = \validator($group->toArray(), [ 'name' => 'required', 'slug' => 'required', 'position' => 'required', @@ -180,17 +180,17 @@ public function update(Request $request, $id) ]); if (! $request->user()->group->is_owner && $request->input('is_owner') == 1) { - return redirect()->route('staff.groups.index') + return \redirect()->route('staff.groups.index') ->withErrors('You are not permitted to give a group owner permissions!'); } if ($v->fails()) { - return redirect()->route('staff.groups.index') + return \redirect()->route('staff.groups.index') ->withErrors($v->errors()); } $group->save(); - return redirect()->route('staff.groups.index') + return \redirect()->route('staff.groups.index') ->withSuccess('Group Was Updated Successfully!'); } } diff --git a/app/Http/Controllers/Staff/HomeController.php b/app/Http/Controllers/Staff/HomeController.php index 4ea7d368f7..ebf5b9683a 100644 --- a/app/Http/Controllers/Staff/HomeController.php +++ b/app/Http/Controllers/Staff/HomeController.php @@ -34,8 +34,8 @@ class HomeController extends Controller public function index(Request $request) { // User Info - $banned_group = cache()->rememberForever('banned_group', fn () => Group::where('slug', '=', 'banned')->pluck('id')); - $validating_group = cache()->rememberForever('validating_group', fn () => Group::where('slug', '=', 'validating')->pluck('id')); + $banned_group = \cache()->rememberForever('banned_group', fn () => Group::where('slug', '=', 'banned')->pluck('id')); + $validating_group = \cache()->rememberForever('validating_group', fn () => Group::where('slug', '=', 'validating')->pluck('id')); $users = DB::table('users') ->selectRaw('count(*) as total') ->selectRaw("count(case when group_id = $banned_group[0] then 1 end) as banned") @@ -69,7 +69,7 @@ public function index(Request $request) // SSL Info try { - $certificate = $request->secure() ? SslCertificate::createForHostName(config('app.url')) : ''; + $certificate = $request->secure() ? SslCertificate::createForHostName(\config('app.url')) : ''; } catch (\Exception $e) { $certificate = ''; } @@ -85,7 +85,7 @@ public function index(Request $request) // Directory Permissions $file_permissions = $systemInformation->directoryPermissions(); - return view('Staff.dashboard.index', [ + return \view('Staff.dashboard.index', [ 'users' => $users, 'torrents' => $torrents, 'peers' => $peers, diff --git a/app/Http/Controllers/Staff/InviteController.php b/app/Http/Controllers/Staff/InviteController.php index a744c79678..005470612c 100644 --- a/app/Http/Controllers/Staff/InviteController.php +++ b/app/Http/Controllers/Staff/InviteController.php @@ -28,6 +28,6 @@ public function index() $invites = Invite::latest()->paginate(25); $invitecount = Invite::count(); - return view('Staff.invite.index', ['invites' => $invites, 'invitecount' => $invitecount]); + return \view('Staff.invite.index', ['invites' => $invites, 'invitecount' => $invitecount]); } } diff --git a/app/Http/Controllers/Staff/MassActionController.php b/app/Http/Controllers/Staff/MassActionController.php index 7e69e939e6..fa69c2121d 100644 --- a/app/Http/Controllers/Staff/MassActionController.php +++ b/app/Http/Controllers/Staff/MassActionController.php @@ -33,7 +33,7 @@ class MassActionController extends Controller */ public function create() { - return view('Staff.masspm.index'); + return \view('Staff.masspm.index'); } /** @@ -49,20 +49,20 @@ public function store(Request $request) $subject = $request->input('subject'); $message = $request->input('message'); - $v = validator($request->all(), [ + $v = \validator($request->all(), [ 'subject' => 'required|min:5', 'message' => 'required|min:5', ]); if ($v->fails()) { - return redirect()->route('staff.mass-pm.create') + return \redirect()->route('staff.mass-pm.create') ->withErrors($v->errors()); } foreach ($users as $user) { $this->dispatch(new ProcessMassPM(self::SENDER_ID, $user->id, $subject, $message)); } - return redirect()->route('staff.mass-pm.create') + return \redirect()->route('staff.mass-pm.create') ->withSuccess('MassPM Sent'); } @@ -75,8 +75,8 @@ public function store(Request $request) */ public function update() { - $validating_group = cache()->rememberForever('validating_group', fn () => Group::where('slug', '=', 'validating')->pluck('id')); - $member_group = cache()->rememberForever('member_group', fn () => Group::where('slug', '=', 'user')->pluck('id')); + $validating_group = \cache()->rememberForever('validating_group', fn () => Group::where('slug', '=', 'validating')->pluck('id')); + $member_group = \cache()->rememberForever('member_group', fn () => Group::where('slug', '=', 'user')->pluck('id')); $users = User::where('group_id', '=', $validating_group[0])->get(); foreach ($users as $user) { @@ -90,7 +90,7 @@ public function update() $user->save(); } - return redirect()->route('staff.dashboard.index') + return \redirect()->route('staff.dashboard.index') ->withSuccess('Unvalidated Accounts Are Now Validated'); } } diff --git a/app/Http/Controllers/Staff/MediaLanguageController.php b/app/Http/Controllers/Staff/MediaLanguageController.php index d80bd38123..137e26ebd8 100644 --- a/app/Http/Controllers/Staff/MediaLanguageController.php +++ b/app/Http/Controllers/Staff/MediaLanguageController.php @@ -28,7 +28,7 @@ public function index() { $media_languages = MediaLanguage::all()->sortBy('name'); - return view('Staff.media_language.index', ['media_languages' => $media_languages]); + return \view('Staff.media_language.index', ['media_languages' => $media_languages]); } /** @@ -38,7 +38,7 @@ public function index() */ public function create() { - return view('Staff.media_language.create'); + return \view('Staff.media_language.create'); } /** @@ -54,18 +54,18 @@ public function store(Request $request) $mediaLanguage->name = $request->input('name'); $mediaLanguage->code = $request->input('code'); - $v = validator($mediaLanguage->toArray(), [ + $v = \validator($mediaLanguage->toArray(), [ 'name' => 'required|unique:media_languages', 'code' => 'required|unique:media_languages', ]); if ($v->fails()) { - return redirect()->route('staff.media_languages.index') + return \redirect()->route('staff.media_languages.index') ->withErrors($v->errors()); } $mediaLanguage->save(); - return redirect()->route('staff.media_languages.index') + return \redirect()->route('staff.media_languages.index') ->withSuccess('Media Language Successfully Added'); } @@ -80,7 +80,7 @@ public function edit($id) { $media_language = MediaLanguage::findOrFail($id); - return view('Staff.media_language.edit', ['media_language' => $media_language]); + return \view('Staff.media_language.edit', ['media_language' => $media_language]); } /** @@ -97,18 +97,18 @@ public function update(Request $request, $id) $media_language->name = $request->input('name'); $media_language->code = $request->input('code'); - $v = validator($media_language->toArray(), [ + $v = \validator($media_language->toArray(), [ 'name' => 'required', 'code' => 'required', ]); if ($v->fails()) { - return redirect()->route('staff.media_languages.index') + return \redirect()->route('staff.media_languages.index') ->withErrors($v->errors()); } $media_language->save(); - return redirect()->route('staff.media_languages.index') + return \redirect()->route('staff.media_languages.index') ->withSuccess('Media Language Successfully Updated'); } @@ -124,7 +124,7 @@ public function destroy($id) $media_language = MediaLanguage::findOrFail($id); $media_language->delete(); - return redirect()->route('staff.media_languages.index') + return \redirect()->route('staff.media_languages.index') ->withSuccess('Media Language Has Successfully Been Deleted'); } } diff --git a/app/Http/Controllers/Staff/ModerationController.php b/app/Http/Controllers/Staff/ModerationController.php index ecdb6d1ecc..e67f263468 100644 --- a/app/Http/Controllers/Staff/ModerationController.php +++ b/app/Http/Controllers/Staff/ModerationController.php @@ -50,7 +50,7 @@ public function index() $postponed = Torrent::with(['user', 'category', 'type'])->postponed()->get(); $rejected = Torrent::with(['user', 'category', 'type'])->rejected()->get(); - return view('Staff.moderation.index', [ + return \view('Staff.moderation.index', [ 'current' => $current, 'pending' => $pending, 'postponed' => $postponed, @@ -70,7 +70,7 @@ public function approve($id) $torrent = Torrent::withAnyStatus()->where('id', '=', $id)->first(); if ($torrent->status !== 1) { - $appurl = config('app.url'); + $appurl = \config('app.url'); $user = $torrent->user; $user_id = $user->id; $username = $user->username; @@ -79,21 +79,21 @@ public function approve($id) // Announce To Shoutbox if ($anon == 0) { $this->chatRepository->systemMessage( - sprintf('User [url=%s/users/', $appurl).$username.']'.$username.sprintf('[/url] has uploaded [url=%s/torrents/', $appurl).$torrent->id.']'.$torrent->name.'[/url] grab it now! :slight_smile:' + \sprintf('User [url=%s/users/', $appurl).$username.']'.$username.\sprintf('[/url] has uploaded [url=%s/torrents/', $appurl).$torrent->id.']'.$torrent->name.'[/url] grab it now! :slight_smile:' ); } else { $this->chatRepository->systemMessage( - sprintf('An anonymous user has uploaded [url=%s/torrents/', $appurl).$torrent->id.']'.$torrent->name.'[/url] grab it now! :slight_smile:' + \sprintf('An anonymous user has uploaded [url=%s/torrents/', $appurl).$torrent->id.']'.$torrent->name.'[/url] grab it now! :slight_smile:' ); } TorrentHelper::approveHelper($torrent->id); - return redirect()->route('staff.moderation.index') + return \redirect()->route('staff.moderation.index') ->withSuccess('Torrent Approved'); } - return redirect()->route('staff.moderation.index') + return \redirect()->route('staff.moderation.index') ->withErrors('Torrent Already Approved'); } @@ -106,14 +106,14 @@ public function approve($id) */ public function postpone(Request $request) { - $v = validator($request->all(), [ + $v = \validator($request->all(), [ 'id' => 'required|exists:torrents', 'slug' => 'required|exists:torrents', 'message' => 'required', ]); if ($v->fails()) { - return redirect()->route('staff.moderation.index') + return \redirect()->route('staff.moderation.index') ->withErrors($v->errors()); } $user = $request->user(); @@ -122,15 +122,15 @@ public function postpone(Request $request) $privateMessage = new PrivateMessage(); $privateMessage->sender_id = $user->id; $privateMessage->receiver_id = $torrent->user_id; - $privateMessage->subject = sprintf('Your upload, %s ,has been postponed by %s', $torrent->name, $user->username); - $privateMessage->message = sprintf('Greetings, + $privateMessage->subject = \sprintf('Your upload, %s ,has been postponed by %s', $torrent->name, $user->username); + $privateMessage->message = \sprintf('Greetings, Your upload, %s ,has been postponed. Please see below the message from the staff member. %s', $torrent->name, $request->input('message')); $privateMessage->save(); - return redirect()->route('staff.moderation.index') + return \redirect()->route('staff.moderation.index') ->withSuccess('Torrent Postponed'); } @@ -143,14 +143,14 @@ public function postpone(Request $request) */ public function reject(Request $request) { - $v = validator($request->all(), [ + $v = \validator($request->all(), [ 'id' => 'required|exists:torrents', 'slug' => 'required|exists:torrents', 'message' => 'required', ]); if ($v->fails()) { - return redirect()->route('staff.moderation.index') + return \redirect()->route('staff.moderation.index') ->withErrors($v->errors()); } $user = $request->user(); @@ -159,15 +159,15 @@ public function reject(Request $request) $privateMessage = new PrivateMessage(); $privateMessage->sender_id = $user->id; $privateMessage->receiver_id = $torrent->user_id; - $privateMessage->subject = sprintf('Your upload, %s ,has been rejected by %s', $torrent->name, $user->username); - $privateMessage->message = sprintf('Greetings, + $privateMessage->subject = \sprintf('Your upload, %s ,has been rejected by %s', $torrent->name, $user->username); + $privateMessage->message = \sprintf('Greetings, Your upload %s has been rejected. Please see below the message from the staff member. %s', $torrent->name, $request->input('message')); $privateMessage->save(); - return redirect()->route('staff.moderation.index') + return \redirect()->route('staff.moderation.index') ->withSuccess('Torrent Rejected'); } } diff --git a/app/Http/Controllers/Staff/NoteController.php b/app/Http/Controllers/Staff/NoteController.php index 980289f0f1..27d29f3027 100644 --- a/app/Http/Controllers/Staff/NoteController.php +++ b/app/Http/Controllers/Staff/NoteController.php @@ -29,7 +29,7 @@ public function index() { $notes = Note::latest()->paginate(25); - return view('Staff.note.index', ['notes' => $notes]); + return \view('Staff.note.index', ['notes' => $notes]); } /** @@ -50,19 +50,19 @@ public function store(Request $request, $username) $note->staff_id = $staff->id; $note->message = $request->input('message'); - $v = validator($note->toArray(), [ + $v = \validator($note->toArray(), [ 'user_id' => 'required', 'staff_id' => 'required', 'message' => 'required', ]); if ($v->fails()) { - return redirect()->route('users.show', ['username' => $user->username]) + return \redirect()->route('users.show', ['username' => $user->username]) ->withErrors($v->errors()); } $note->save(); - return redirect()->route('users.show', ['username' => $user->username]) + return \redirect()->route('users.show', ['username' => $user->username]) ->withSuccess('Note Has Successfully Posted'); } @@ -79,7 +79,7 @@ public function destroy($id) $user = User::findOrFail($note->user_id); $note->delete(); - return redirect()->route('users.show', ['username' => $user->username]) + return \redirect()->route('users.show', ['username' => $user->username]) ->withSuccess('Note Has Successfully Been Deleted'); } } diff --git a/app/Http/Controllers/Staff/PageController.php b/app/Http/Controllers/Staff/PageController.php index d7dcbc49d2..83d65494e7 100644 --- a/app/Http/Controllers/Staff/PageController.php +++ b/app/Http/Controllers/Staff/PageController.php @@ -29,7 +29,7 @@ public function index() { $pages = Page::all(); - return view('Staff.page.index', ['pages' => $pages]); + return \view('Staff.page.index', ['pages' => $pages]); } /** @@ -39,7 +39,7 @@ public function index() */ public function create() { - return view('Staff.page.create'); + return \view('Staff.page.create'); } /** @@ -56,19 +56,19 @@ public function store(Request $request) $page->slug = Str::slug($page->name); $page->content = $request->input('content'); - $v = validator($page->toArray(), [ + $v = \validator($page->toArray(), [ 'name' => 'required', 'slug' => 'required', 'content' => 'required', ]); if ($v->fails()) { - return redirect()->route('staff.pages.index') + return \redirect()->route('staff.pages.index') ->withErrors($v->errors()); } $page->save(); - return redirect()->route('staff.pages.index') + return \redirect()->route('staff.pages.index') ->withSuccess('Page has been created successfully'); } @@ -83,7 +83,7 @@ public function edit($id) { $page = Page::findOrFail($id); - return view('Staff.page.edit', ['page' => $page]); + return \view('Staff.page.edit', ['page' => $page]); } /** @@ -101,19 +101,19 @@ public function update(Request $request, $id) $page->slug = Str::slug($page->name); $page->content = $request->input('content'); - $v = validator($page->toArray(), [ + $v = \validator($page->toArray(), [ 'name' => 'required', 'slug' => 'required', 'content' => 'required', ]); if ($v->fails()) { - return redirect()->route('staff.pages.index') + return \redirect()->route('staff.pages.index') ->withErrors($v->errors()); } $page->save(); - return redirect()->route('staff.pages.index') + return \redirect()->route('staff.pages.index') ->withSuccess('Page has been edited successfully'); } @@ -128,7 +128,7 @@ public function destroy($id) { Page::findOrFail($id)->delete(); - return redirect()->route('staff.pages.index') + return \redirect()->route('staff.pages.index') ->withSuccess('Page has been deleted successfully'); } } diff --git a/app/Http/Controllers/Staff/PollController.php b/app/Http/Controllers/Staff/PollController.php index 516e102957..b04fb47d09 100644 --- a/app/Http/Controllers/Staff/PollController.php +++ b/app/Http/Controllers/Staff/PollController.php @@ -45,7 +45,7 @@ public function index() { $polls = Poll::latest()->paginate(25); - return view('Staff.poll.index', ['polls' => $polls]); + return \view('Staff.poll.index', ['polls' => $polls]); } /** @@ -59,7 +59,7 @@ public function show($id) { $poll = Poll::where('id', '=', $id)->firstOrFail(); - return view('Staff.poll.show', ['poll' => $poll]); + return \view('Staff.poll.show', ['poll' => $poll]); } /** @@ -69,7 +69,7 @@ public function show($id) */ public function create() { - return view('Staff.poll.create'); + return \view('Staff.poll.create'); } /** @@ -85,16 +85,16 @@ public function store(StorePoll $storePoll) $poll = $storePoll->user() ? $user->polls()->create($storePoll->all()) : Poll::create($storePoll->all()); - $options = collect($storePoll->input('options'))->map(fn ($value) => new Option(['name' => $value])); + $options = \collect($storePoll->input('options'))->map(fn ($value) => new Option(['name' => $value])); $poll->options()->saveMany($options); - $poll_url = href_poll($poll); + $poll_url = \href_poll($poll); $this->chatRepository->systemMessage( - sprintf('A new poll has been created [url=%s]%s[/url] vote on it now! :slight_smile:', $poll_url, $poll->title) + \sprintf('A new poll has been created [url=%s]%s[/url] vote on it now! :slight_smile:', $poll_url, $poll->title) ); - return redirect()->route('staff.polls.index') + return \redirect()->route('staff.polls.index') ->withSuccess('Your poll has been created.'); } @@ -109,7 +109,7 @@ public function edit($id) { $poll = Poll::findOrFail($id); - return view('Staff.poll.edit', ['poll' => $poll]); + return \view('Staff.poll.edit', ['poll' => $poll]); } /** @@ -129,11 +129,11 @@ public function update(StorePoll $storePoll, $id) $poll->multiple_choice = (bool) $storePoll->input('multiple_choice'); // Remove the deleted options in poll - $oldOptionIds = collect($poll->options)->map(fn ($option) => $option->id)->all(); + $oldOptionIds = \collect($poll->options)->map(fn ($option) => $option->id)->all(); - $existingOldOptionIds = collect($storePoll->input('option-id'))->map(fn ($id) => (int) $id)->all(); + $existingOldOptionIds = \collect($storePoll->input('option-id'))->map(fn ($id) => (int) $id)->all(); - $idsOfOptionToBeRemove = array_diff($oldOptionIds, $existingOldOptionIds); + $idsOfOptionToBeRemove = \array_diff($oldOptionIds, $existingOldOptionIds); foreach ($idsOfOptionToBeRemove as $id) { $option = Option::findOrFail($id); @@ -141,10 +141,10 @@ public function update(StorePoll $storePoll, $id) } // Update existing options - $existingOldOptionContents = collect($storePoll->input('option-content'))->map(fn ($content) => strval($content))->all(); + $existingOldOptionContents = \collect($storePoll->input('option-content'))->map(fn ($content) => \strval($content))->all(); - if (count($existingOldOptionContents) === count($existingOldOptionIds)) { - $len = count($existingOldOptionContents); + if (\count($existingOldOptionContents) === \count($existingOldOptionIds)) { + $len = \count($existingOldOptionContents); for ($i = 0; $i < $len; $i++) { $option = Option::findOrFail($existingOldOptionIds[$i]); $option->name = $existingOldOptionContents[$i]; @@ -153,20 +153,20 @@ public function update(StorePoll $storePoll, $id) } // Insert new options - $newOptions = collect($storePoll->input('new-option-content'))->map(fn ($content) => new Option(['name' => $content])); + $newOptions = \collect($storePoll->input('new-option-content'))->map(fn ($content) => new Option(['name' => $content])); $poll->options()->saveMany($newOptions); // Last work from store() - $poll_url = href_poll($poll); + $poll_url = \href_poll($poll); $this->chatRepository->systemMessage( - sprintf('A poll has been updated [url=%s]%s[/url] vote on it now! :slight_smile:', $poll_url, $poll->title) + \sprintf('A poll has been updated [url=%s]%s[/url] vote on it now! :slight_smile:', $poll_url, $poll->title) ); $poll->save(); - return redirect()->route('staff.polls.index') + return \redirect()->route('staff.polls.index') ->withSuccess('Your poll has been edited.'); } @@ -182,7 +182,7 @@ public function destroy($id) $poll = Poll::findOrFail($id); $poll->delete(); - return redirect()->route('staff.polls.index') + return \redirect()->route('staff.polls.index') ->withSuccess('Poll has successfully been deleted'); } } diff --git a/app/Http/Controllers/Staff/ReportController.php b/app/Http/Controllers/Staff/ReportController.php index 7a80566614..e1892f6a3b 100644 --- a/app/Http/Controllers/Staff/ReportController.php +++ b/app/Http/Controllers/Staff/ReportController.php @@ -29,7 +29,7 @@ public function index() { $reports = Report::latest()->paginate(25); - return view('Staff.report.index', ['reports' => $reports]); + return \view('Staff.report.index', ['reports' => $reports]); } /** @@ -43,9 +43,9 @@ public function show($id) { $report = Report::findOrFail($id); - preg_match_all('#\bhttps?://[^,\s()<>]+(?:\([\w\d]+\)|([^,[:punct:]\s]|/))#', $report->message, $match); + \preg_match_all('#\bhttps?://[^,\s()<>]+(?:\([\w\d]+\)|([^,[:punct:]\s]|/))#', $report->message, $match); - return view('Staff.report.show', ['report' => $report, 'urls' => $match[0]]); + return \view('Staff.report.show', ['report' => $report, 'urls' => $match[0]]); } /** @@ -58,9 +58,9 @@ public function show($id) */ public function update(Request $request, $id) { - $user = auth()->user(); + $user = \auth()->user(); - $v = validator($request->all(), [ + $v = \validator($request->all(), [ 'verdict' => 'required|min:3', 'staff_id' => 'required', ]); @@ -68,7 +68,7 @@ public function update(Request $request, $id) $report = Report::findOrFail($id); if ($report->solved == 1) { - return redirect()->route('staff.reports.index') + return \redirect()->route('staff.reports.index') ->withErrors('This Report Has Already Been Solved'); } @@ -82,14 +82,14 @@ public function update(Request $request, $id) $privateMessage->sender_id = $user->id; $privateMessage->receiver_id = $report->reporter_id; $privateMessage->subject = 'Your Report Has A New Verdict'; - $privateMessage->message = sprintf('[b]REPORT TITLE:[/b] %s + $privateMessage->message = \sprintf('[b]REPORT TITLE:[/b] %s [b]ORIGINAL MESSAGE:[/b] %s [b]VERDICT:[/b] %s', $report->title, $report->message, $report->verdict); $privateMessage->save(); - return redirect()->route('staff.reports.index') + return \redirect()->route('staff.reports.index') ->withSuccess('Report has been successfully resolved'); } } diff --git a/app/Http/Controllers/Staff/ResolutionController.php b/app/Http/Controllers/Staff/ResolutionController.php index cf57031e69..d75e975320 100644 --- a/app/Http/Controllers/Staff/ResolutionController.php +++ b/app/Http/Controllers/Staff/ResolutionController.php @@ -29,7 +29,7 @@ public function index() { $resolutions = Resolution::all()->sortBy('position'); - return view('Staff.resolution.index', ['resolutions' => $resolutions]); + return \view('Staff.resolution.index', ['resolutions' => $resolutions]); } /** @@ -39,7 +39,7 @@ public function index() */ public function create() { - return view('Staff.resolution.create'); + return \view('Staff.resolution.create'); } /** @@ -56,19 +56,19 @@ public function store(Request $request) $resolution->slug = Str::slug($resolution->name); $resolution->position = $request->input('position'); - $v = validator($resolution->toArray(), [ + $v = \validator($resolution->toArray(), [ 'name' => 'required', 'slug' => 'required', 'position' => 'required', ]); if ($v->fails()) { - return redirect()->route('staff.resolutions.index') + return \redirect()->route('staff.resolutions.index') ->withErrors($v->errors()); } $resolution->save(); - return redirect()->route('staff.resolutions.index') + return \redirect()->route('staff.resolutions.index') ->withSuccess('Resolution Successfully Added'); } @@ -83,7 +83,7 @@ public function edit($id) { $resolution = Resolution::findOrFail($id); - return view('Staff.resolution.edit', ['resolution' => $resolution]); + return \view('Staff.resolution.edit', ['resolution' => $resolution]); } /** @@ -101,19 +101,19 @@ public function update(Request $request, $id) $resolution->slug = Str::slug($resolution->name); $resolution->position = $request->input('position'); - $v = validator($resolution->toArray(), [ + $v = \validator($resolution->toArray(), [ 'name' => 'required', 'slug' => 'required', 'position' => 'required', ]); if ($v->fails()) { - return redirect()->route('staff.resolutions.index') + return \redirect()->route('staff.resolutions.index') ->withErrors($v->errors()); } $resolution->save(); - return redirect()->route('staff.resolutions.index') + return \redirect()->route('staff.resolutions.index') ->withSuccess('Resolution Successfully Modified'); } @@ -131,7 +131,7 @@ public function destroy($id) $resolution = Resolution::findOrFail($id); $resolution->delete(); - return redirect()->route('staff.resolutions.index') + return \redirect()->route('staff.resolutions.index') ->withSuccess('Resolution Successfully Deleted'); } } diff --git a/app/Http/Controllers/Staff/RssController.php b/app/Http/Controllers/Staff/RssController.php index ca1124b206..49444be05d 100644 --- a/app/Http/Controllers/Staff/RssController.php +++ b/app/Http/Controllers/Staff/RssController.php @@ -49,7 +49,7 @@ public function index($hash = null) { $public_rss = Rss::where('is_private', '=', 0)->orderBy('position', 'ASC')->get(); - return view('Staff.rss.index', [ + return \view('Staff.rss.index', [ 'hash' => $hash, 'public_rss' => $public_rss, ]); @@ -67,7 +67,7 @@ public function create(Request $request) $user = $request->user(); $torrent_repository = $this->torrentFacetedRepository; - return view('Staff.rss.create', [ + return \view('Staff.rss.create', [ 'torrent_repository' => $torrent_repository, 'categories' => Category::all()->sortBy('position'), 'types' => Type::all()->sortBy('position'), @@ -86,7 +86,7 @@ public function store(Request $request) { $user = $request->user(); - $v = validator($request->all(), [ + $v = \validator($request->all(), [ 'name' => 'required|min:3|max:255', 'search' => 'max:255', 'description' => 'max:255', @@ -109,7 +109,7 @@ public function store(Request $request) $rss->name = $request->input('name'); $rss->user_id = $user->id; $expected = $rss->expected_fields; - $rss->json_torrent = array_merge($expected, $params); + $rss->json_torrent = \array_merge($expected, $params); $rss->is_private = 0; $rss->staff_id = $user->id; $rss->position = (int) $request->input('position'); @@ -122,11 +122,11 @@ public function store(Request $request) $error = $v->errors(); } - return redirect()->route('staff.rss.create') + return \redirect()->route('staff.rss.create') ->withErrors($error); } - return redirect()->route('staff.rss.index') + return \redirect()->route('staff.rss.index') ->withSuccess($success); } @@ -144,7 +144,7 @@ public function edit(Request $request, $id) $rss = Rss::where('is_private', '=', 0)->findOrFail($id); $torrent_repository = $this->torrentFacetedRepository; - return view('Staff.rss.edit', [ + return \view('Staff.rss.edit', [ 'torrent_repository' => $torrent_repository, 'categories' => Category::all()->sortBy('position'), 'types' => Type::all()->sortBy('position'), @@ -166,7 +166,7 @@ public function update(Request $request, $id) { $rss = Rss::where('is_private', '=', 0)->findOrFail($id); - $v = validator($request->all(), [ + $v = \validator($request->all(), [ 'name' => 'required|min:3|max:255', 'search' => 'max:255', 'description' => 'max:255', @@ -187,8 +187,8 @@ public function update(Request $request, $id) if ($v->passes()) { $expected = $rss->expected_fields; - $push = array_merge($expected, $params); - $rss->json_torrent = array_merge($rss->json_torrent, $push); + $push = \array_merge($expected, $params); + $rss->json_torrent = \array_merge($rss->json_torrent, $push); $rss->is_private = 0; $rss->name = $request->input('name'); $rss->position = (int) $request->input('position'); @@ -201,11 +201,11 @@ public function update(Request $request, $id) $error = $v->errors(); } - return redirect()->route('staff.rss.edit', ['id' => $id]) + return \redirect()->route('staff.rss.edit', ['id' => $id]) ->withErrors($error); } - return redirect()->route('staff.rss.index') + return \redirect()->route('staff.rss.index') ->withSuccess($success); } @@ -223,7 +223,7 @@ public function destroy($id) $rss = Rss::where('is_private', '=', 0)->findOrFail($id); $rss->delete(); - return redirect()->route('staff.rss.index') + return \redirect()->route('staff.rss.index') ->withSuccess('RSS Feed Deleted!'); } } diff --git a/app/Http/Controllers/Staff/SeedboxController.php b/app/Http/Controllers/Staff/SeedboxController.php index 4dc918cebc..dbacc98144 100644 --- a/app/Http/Controllers/Staff/SeedboxController.php +++ b/app/Http/Controllers/Staff/SeedboxController.php @@ -28,7 +28,7 @@ public function index() { $seedboxes = Seedbox::with('user')->latest()->paginate(50); - return view('Staff.seedbox.index', ['seedboxes' => $seedboxes]); + return \view('Staff.seedbox.index', ['seedboxes' => $seedboxes]); } /** @@ -44,10 +44,10 @@ public function destroy(Request $request, $id) $user = $request->user(); $seedbox = Seedbox::findOrFail($id); - abort_unless($user->group->is_modo, 403); + \abort_unless($user->group->is_modo, 403); $seedbox->delete(); - return redirect()->route('staff.seedboxes.index') + return \redirect()->route('staff.seedboxes.index') ->withSuccess('Seedbox Record Has Successfully Been Deleted'); } } diff --git a/app/Http/Controllers/Staff/TagController.php b/app/Http/Controllers/Staff/TagController.php index 5adec86651..0e8bea9fbd 100644 --- a/app/Http/Controllers/Staff/TagController.php +++ b/app/Http/Controllers/Staff/TagController.php @@ -29,7 +29,7 @@ public function index() { $tags = Tag::all()->sortBy('name'); - return view('Staff.tag.index', ['tags' => $tags]); + return \view('Staff.tag.index', ['tags' => $tags]); } /** @@ -39,7 +39,7 @@ public function index() */ public function create() { - return view('Staff.tag.create'); + return \view('Staff.tag.create'); } /** @@ -55,18 +55,18 @@ public function store(Request $request) $tag->name = $request->input('name'); $tag->slug = Str::slug($tag->name); - $v = validator($tag->toArray(), [ + $v = \validator($tag->toArray(), [ 'name' => 'required|unique:tags', 'slug' => 'required', ]); if ($v->fails()) { - return redirect()->route('staff.tags.index') + return \redirect()->route('staff.tags.index') ->withErrors($v->errors()); } $tag->save(); - return redirect()->route('staff.tags.index') + return \redirect()->route('staff.tags.index') ->withSuccess('Tag Successfully Added'); } @@ -81,7 +81,7 @@ public function edit($id) { $tag = Tag::findOrFail($id); - return view('Staff.tag.edit', ['tag' => $tag]); + return \view('Staff.tag.edit', ['tag' => $tag]); } /** @@ -98,18 +98,18 @@ public function update(Request $request, $id) $tag->name = $request->input('name'); $tag->slug = Str::slug($tag->name); - $v = validator($tag->toArray(), [ + $v = \validator($tag->toArray(), [ 'name' => 'required', 'slug' => 'required', ]); if ($v->fails()) { - return redirect()->route('staff.tags.index') + return \redirect()->route('staff.tags.index') ->withErrors($v->errors()); } $tag->save(); - return redirect()->route('staff.tags.index') + return \redirect()->route('staff.tags.index') ->withSuccess('Tag Successfully Modified'); } } diff --git a/app/Http/Controllers/Staff/TypeController.php b/app/Http/Controllers/Staff/TypeController.php index 027e6f9046..47a6afc499 100644 --- a/app/Http/Controllers/Staff/TypeController.php +++ b/app/Http/Controllers/Staff/TypeController.php @@ -29,7 +29,7 @@ public function index() { $types = Type::all()->sortBy('position'); - return view('Staff.type.index', ['types' => $types]); + return \view('Staff.type.index', ['types' => $types]); } /** @@ -39,7 +39,7 @@ public function index() */ public function create() { - return view('Staff.type.create'); + return \view('Staff.type.create'); } /** @@ -56,19 +56,19 @@ public function store(Request $request) $type->slug = Str::slug($type->name); $type->position = $request->input('position'); - $v = validator($type->toArray(), [ + $v = \validator($type->toArray(), [ 'name' => 'required', 'slug' => 'required', 'position' => 'required', ]); if ($v->fails()) { - return redirect()->route('staff.types.index') + return \redirect()->route('staff.types.index') ->withErrors($v->errors()); } $type->save(); - return redirect()->route('staff.types.index') + return \redirect()->route('staff.types.index') ->withSuccess('Type Successfully Added'); } @@ -83,7 +83,7 @@ public function edit($id) { $type = Type::findOrFail($id); - return view('Staff.type.edit', ['type' => $type]); + return \view('Staff.type.edit', ['type' => $type]); } /** @@ -101,19 +101,19 @@ public function update(Request $request, $id) $type->slug = Str::slug($type->name); $type->position = $request->input('position'); - $v = validator($type->toArray(), [ + $v = \validator($type->toArray(), [ 'name' => 'required', 'slug' => 'required', 'position' => 'required', ]); if ($v->fails()) { - return redirect()->route('staff.types.index') + return \redirect()->route('staff.types.index') ->withErrors($v->errors()); } $type->save(); - return redirect()->route('staff.types.index') + return \redirect()->route('staff.types.index') ->withSuccess('Type Successfully Modified'); } @@ -129,7 +129,7 @@ public function destroy($id) $type = Type::findOrFail($id); $type->delete(); - return redirect()->route('staff.types.index') + return \redirect()->route('staff.types.index') ->withSuccess('Type Successfully Deleted'); } } diff --git a/app/Http/Controllers/Staff/UserController.php b/app/Http/Controllers/Staff/UserController.php index 71cb06f5e4..704e63fef0 100644 --- a/app/Http/Controllers/Staff/UserController.php +++ b/app/Http/Controllers/Staff/UserController.php @@ -54,7 +54,7 @@ public function index() $admins = User::with('group')->where('group_id', '=', 4)->latest()->paginate(25); $coders = User::with('group')->where('group_id', '=', 10)->latest()->paginate(25); - return view('Staff.user.user_search', [ + return \view('Staff.user.user_search', [ 'users' => $users, 'uploaders' => $uploaders, 'mods' => $mods, @@ -77,7 +77,7 @@ public function search(Request $request) ])->paginate(25); $users->setPath('?username='.$request->input('username')); - return view('Staff.user.user_results', ['users' => $users]); + return \view('Staff.user.user_results', ['users' => $users]); } /** @@ -93,7 +93,7 @@ public function settings($username) $groups = Group::all(); $notes = Note::where('user_id', '=', $user->id)->latest()->paginate(25); - return view('Staff.user.user_edit', [ + return \view('Staff.user.user_edit', [ 'user' => $user, 'groups' => $groups, 'notes' => $notes, @@ -136,7 +136,7 @@ public function edit(Request $request, $username) // Hard coded until group change. if ($target >= $sender || ($sender == 0 && ($sendto === 6 || $sendto === 4 || $sendto === 10)) || ($sender == 1 && ($sendto === 4 || $sendto === 10))) { - return redirect()->route('users.show', ['username' => $user->username]) + return \redirect()->route('users.show', ['username' => $user->username]) ->withErrors('You Are Not Authorized To Perform This Action!'); } @@ -149,7 +149,7 @@ public function edit(Request $request, $username) $user->group_id = (int) $request->input('group_id'); $user->save(); - return redirect()->route('users.show', ['username' => $user->username]) + return \redirect()->route('users.show', ['username' => $user->username]) ->withSuccess('Account Was Updated Successfully!'); } @@ -174,7 +174,7 @@ public function permissions(Request $request, $username) $user->can_chat = $request->input('can_chat'); $user->save(); - return redirect()->route('users.show', ['username' => $user->username]) + return \redirect()->route('users.show', ['username' => $user->username]) ->withSuccess('Account Permissions Successfully Edited'); } @@ -189,13 +189,13 @@ public function permissions(Request $request, $username) protected function password(Request $request, $username) { $user = User::where('username', '=', $username)->firstOrFail(); - $staff = auth()->user(); + $staff = \auth()->user(); $new_password = $request->input('new_password'); $user->password = Hash::make($new_password); $user->save(); - return redirect()->route('users.show', ['username' => $user->username]) + return \redirect()->route('users.show', ['username' => $user->username]) ->withSuccess('Account Password Was Updated Successfully!'); } @@ -209,9 +209,9 @@ protected function password(Request $request, $username) protected function destroy($username) { $user = User::where('username', '=', $username)->firstOrFail(); - $staff = auth()->user(); + $staff = \auth()->user(); - abort_if($user->group->is_modo || auth()->user()->id == $user->id, 403); + \abort_if($user->group->is_modo || \auth()->user()->id == $user->id, 403); // Removes UserID from Torrents if any and replaces with System UserID (1) foreach (Torrent::withAnyStatus()->where('user_id', '=', $user->id)->get() as $tor) { @@ -284,11 +284,11 @@ protected function destroy($username) } if ($user->delete()) { - return redirect()->route('staff.dashboard.index') + return \redirect()->route('staff.dashboard.index') ->withSuccess('Account Has Been Removed'); } - return redirect()->route('staff.dashboard.index') + return \redirect()->route('staff.dashboard.index') ->withErrors('Something Went Wrong!'); } } diff --git a/app/Http/Controllers/Staff/VersionController.php b/app/Http/Controllers/Staff/VersionController.php index 35d2bed825..a602026f03 100644 --- a/app/Http/Controllers/Staff/VersionController.php +++ b/app/Http/Controllers/Staff/VersionController.php @@ -25,7 +25,7 @@ class VersionController extends Controller public function __construct() { - $this->versionController = config('unit3d.version'); + $this->versionController = \config('unit3d.version'); } /** @@ -36,11 +36,11 @@ public function __construct() public function checkVersion() { $client = new Client(); - $response = json_decode($client->get('//api.github.com/repos/HDInnovations/UNIT3D/releases')->getBody()); + $response = \json_decode($client->get('//api.github.com/repos/HDInnovations/UNIT3D/releases')->getBody()); $lastestVersion = $response[0]->tag_name; - return response([ - 'updated' => ! version_compare($this->versionController, $lastestVersion, '<'), + return \response([ + 'updated' => ! \version_compare($this->versionController, $lastestVersion, '<'), 'latestversion' => $lastestVersion, ]); } diff --git a/app/Http/Controllers/Staff/WarningController.php b/app/Http/Controllers/Staff/WarningController.php index 0423607405..deb665516c 100644 --- a/app/Http/Controllers/Staff/WarningController.php +++ b/app/Http/Controllers/Staff/WarningController.php @@ -28,6 +28,6 @@ public function index() $warnings = Warning::with(['torrenttitle', 'warneduser'])->latest()->paginate(25); $warningcount = Warning::count(); - return view('Staff.warning.index', ['warnings' => $warnings, 'warningcount' => $warningcount]); + return \view('Staff.warning.index', ['warnings' => $warnings, 'warningcount' => $warningcount]); } } diff --git a/app/Http/Controllers/StatsController.php b/app/Http/Controllers/StatsController.php index 34e53875de..2f7bee7598 100644 --- a/app/Http/Controllers/StatsController.php +++ b/app/Http/Controllers/StatsController.php @@ -49,74 +49,74 @@ public function __construct() public function index() { // Total Members Count (All Groups) - $all_user = cache()->remember('all_user', $this->carbon, fn () => User::withTrashed()->count()); + $all_user = \cache()->remember('all_user', $this->carbon, fn () => User::withTrashed()->count()); // Total Active Members Count (Not Validating, Banned, Disabled, Pruned) - $active_user = cache()->remember('active_user', $this->carbon, function () { - $banned_group = cache()->rememberForever('banned_group', fn () => Group::where('slug', '=', 'banned')->pluck('id')); - $validating_group = cache()->rememberForever('validating_group', fn () => Group::where('slug', '=', 'validating')->pluck('id')); - $disabled_group = cache()->rememberForever('disabled_group', fn () => Group::where('slug', '=', 'disabled')->pluck('id')); - $pruned_group = cache()->rememberForever('pruned_group', fn () => Group::where('slug', '=', 'pruned')->pluck('id')); + $active_user = \cache()->remember('active_user', $this->carbon, function () { + $banned_group = \cache()->rememberForever('banned_group', fn () => Group::where('slug', '=', 'banned')->pluck('id')); + $validating_group = \cache()->rememberForever('validating_group', fn () => Group::where('slug', '=', 'validating')->pluck('id')); + $disabled_group = \cache()->rememberForever('disabled_group', fn () => Group::where('slug', '=', 'disabled')->pluck('id')); + $pruned_group = \cache()->rememberForever('pruned_group', fn () => Group::where('slug', '=', 'pruned')->pluck('id')); return User::whereNotIn('group_id', [$validating_group[0], $banned_group[0], $disabled_group[0], $pruned_group[0]])->count(); }); // Total Disabled Members Count - $disabled_user = cache()->remember('disabled_user', $this->carbon, function () { - $disabled_group = cache()->rememberForever('disabled_group', fn () => Group::where('slug', '=', 'disabled')->pluck('id')); + $disabled_user = \cache()->remember('disabled_user', $this->carbon, function () { + $disabled_group = \cache()->rememberForever('disabled_group', fn () => Group::where('slug', '=', 'disabled')->pluck('id')); return User::where('group_id', '=', $disabled_group[0])->count(); }); // Total Pruned Members Count - $pruned_user = cache()->remember('pruned_user', $this->carbon, function () { - $pruned_group = cache()->rememberForever('pruned_group', fn () => Group::where('slug', '=', 'pruned')->pluck('id')); + $pruned_user = \cache()->remember('pruned_user', $this->carbon, function () { + $pruned_group = \cache()->rememberForever('pruned_group', fn () => Group::where('slug', '=', 'pruned')->pluck('id')); return User::onlyTrashed()->where('group_id', '=', $pruned_group[0])->count(); }); // Total Banned Members Count - $banned_user = cache()->remember('banned_user', $this->carbon, function () { - $banned_group = cache()->rememberForever('banned_group', fn () => Group::where('slug', '=', 'banned')->pluck('id')); + $banned_user = \cache()->remember('banned_user', $this->carbon, function () { + $banned_group = \cache()->rememberForever('banned_group', fn () => Group::where('slug', '=', 'banned')->pluck('id')); return User::where('group_id', '=', $banned_group[0])->count(); }); // Total Torrents Count - $num_torrent = cache()->remember('num_torrent', $this->carbon, fn () => Torrent::count()); + $num_torrent = \cache()->remember('num_torrent', $this->carbon, fn () => Torrent::count()); // Total Categories With Torrent Count $categories = Category::withCount('torrents')->get()->sortBy('position'); // Total HD Count - $num_hd = cache()->remember('num_hd', $this->carbon, fn () => Torrent::where('sd', '=', 0)->count()); + $num_hd = \cache()->remember('num_hd', $this->carbon, fn () => Torrent::where('sd', '=', 0)->count()); // Total SD Count - $num_sd = cache()->remember('num_sd', $this->carbon, fn () => Torrent::where('sd', '=', 1)->count()); + $num_sd = \cache()->remember('num_sd', $this->carbon, fn () => Torrent::where('sd', '=', 1)->count()); // Total Torrent Size - $torrent_size = cache()->remember('torrent_size', $this->carbon, fn () => Torrent::sum('size')); + $torrent_size = \cache()->remember('torrent_size', $this->carbon, fn () => Torrent::sum('size')); // Total Seeders - $num_seeders = cache()->remember('num_seeders', $this->carbon, fn () => Peer::where('seeder', '=', 1)->count()); + $num_seeders = \cache()->remember('num_seeders', $this->carbon, fn () => Peer::where('seeder', '=', 1)->count()); // Total Leechers - $num_leechers = cache()->remember('num_leechers', $this->carbon, fn () => Peer::where('seeder', '=', 0)->count()); + $num_leechers = \cache()->remember('num_leechers', $this->carbon, fn () => Peer::where('seeder', '=', 0)->count()); // Total Peers - $num_peers = cache()->remember('num_peers', $this->carbon, fn () => Peer::count()); + $num_peers = \cache()->remember('num_peers', $this->carbon, fn () => Peer::count()); //Total Upload Traffic Without Double Upload - $actual_upload = cache()->remember('actual_upload', $this->carbon, fn () => History::sum('actual_uploaded')); + $actual_upload = \cache()->remember('actual_upload', $this->carbon, fn () => History::sum('actual_uploaded')); //Total Upload Traffic With Double Upload - $credited_upload = cache()->remember('credited_upload', $this->carbon, fn () => History::sum('uploaded')); + $credited_upload = \cache()->remember('credited_upload', $this->carbon, fn () => History::sum('uploaded')); //Total Download Traffic Without Freeleech - $actual_download = cache()->remember('actual_download', $this->carbon, fn () => History::sum('actual_downloaded')); + $actual_download = \cache()->remember('actual_download', $this->carbon, fn () => History::sum('actual_downloaded')); //Total Download Traffic With Freeleech - $credited_download = cache()->remember('credited_download', $this->carbon, fn () => History::sum('downloaded')); + $credited_download = \cache()->remember('credited_download', $this->carbon, fn () => History::sum('downloaded')); //Total Up/Down Traffic without perks $actual_up_down = $actual_upload + $actual_download; @@ -124,7 +124,7 @@ public function index() //Total Up/Down Traffic with perks $credited_up_down = $credited_upload + $credited_download; - return view('stats.index', [ + return \view('stats.index', [ 'all_user' => $all_user, 'active_user' => $active_user, 'disabled_user' => $disabled_user, @@ -156,15 +156,15 @@ public function index() */ public function uploaded() { - $banned_group = cache()->rememberForever('banned_group', fn () => Group::where('slug', '=', 'banned')->pluck('id')); - $validating_group = cache()->rememberForever('validating_group', fn () => Group::where('slug', '=', 'validating')->pluck('id')); - $disabled_group = cache()->rememberForever('disabled_group', fn () => Group::where('slug', '=', 'disabled')->pluck('id')); - $pruned_group = cache()->rememberForever('pruned_group', fn () => Group::where('slug', '=', 'pruned')->pluck('id')); + $banned_group = \cache()->rememberForever('banned_group', fn () => Group::where('slug', '=', 'banned')->pluck('id')); + $validating_group = \cache()->rememberForever('validating_group', fn () => Group::where('slug', '=', 'validating')->pluck('id')); + $disabled_group = \cache()->rememberForever('disabled_group', fn () => Group::where('slug', '=', 'disabled')->pluck('id')); + $pruned_group = \cache()->rememberForever('pruned_group', fn () => Group::where('slug', '=', 'pruned')->pluck('id')); // Fetch Top Uploaders $uploaded = User::latest('uploaded')->whereNotIn('group_id', [$validating_group[0], $banned_group[0], $disabled_group[0], $pruned_group[0]])->take(100)->get(); - return view('stats.users.uploaded', ['uploaded' => $uploaded]); + return \view('stats.users.uploaded', ['uploaded' => $uploaded]); } /** @@ -176,15 +176,15 @@ public function uploaded() */ public function downloaded() { - $banned_group = cache()->rememberForever('banned_group', fn () => Group::where('slug', '=', 'banned')->pluck('id')); - $validating_group = cache()->rememberForever('validating_group', fn () => Group::where('slug', '=', 'validating')->pluck('id')); - $disabled_group = cache()->rememberForever('disabled_group', fn () => Group::where('slug', '=', 'disabled')->pluck('id')); - $pruned_group = cache()->rememberForever('pruned_group', fn () => Group::where('slug', '=', 'pruned')->pluck('id')); + $banned_group = \cache()->rememberForever('banned_group', fn () => Group::where('slug', '=', 'banned')->pluck('id')); + $validating_group = \cache()->rememberForever('validating_group', fn () => Group::where('slug', '=', 'validating')->pluck('id')); + $disabled_group = \cache()->rememberForever('disabled_group', fn () => Group::where('slug', '=', 'disabled')->pluck('id')); + $pruned_group = \cache()->rememberForever('pruned_group', fn () => Group::where('slug', '=', 'pruned')->pluck('id')); // Fetch Top Downloaders $downloaded = User::latest('downloaded')->whereNotIn('group_id', [$validating_group[0], $banned_group[0], $disabled_group[0], $pruned_group[0]])->take(100)->get(); - return view('stats.users.downloaded', ['downloaded' => $downloaded]); + return \view('stats.users.downloaded', ['downloaded' => $downloaded]); } /** @@ -197,7 +197,7 @@ public function seeders() // Fetch Top Seeders $seeders = Peer::with('user')->select(DB::raw('user_id, count(*) as value'))->where('seeder', '=', 1)->groupBy('user_id')->latest('value')->take(100)->get(); - return view('stats.users.seeders', ['seeders' => $seeders]); + return \view('stats.users.seeders', ['seeders' => $seeders]); } /** @@ -210,7 +210,7 @@ public function leechers() // Fetch Top Leechers $leechers = Peer::with('user')->select(DB::raw('user_id, count(*) as value'))->where('seeder', '=', 0)->groupBy('user_id')->latest('value')->take(100)->get(); - return view('stats.users.leechers', ['leechers' => $leechers]); + return \view('stats.users.leechers', ['leechers' => $leechers]); } /** @@ -223,7 +223,7 @@ public function uploaders() // Fetch Top Uploaders $uploaders = Torrent::with('user')->select(DB::raw('user_id, count(*) as value'))->groupBy('user_id')->latest('value')->take(100)->get(); - return view('stats.users.uploaders', ['uploaders' => $uploaders]); + return \view('stats.users.uploaders', ['uploaders' => $uploaders]); } /** @@ -235,15 +235,15 @@ public function uploaders() */ public function bankers() { - $banned_group = cache()->rememberForever('banned_group', fn () => Group::where('slug', '=', 'banned')->pluck('id')); - $validating_group = cache()->rememberForever('validating_group', fn () => Group::where('slug', '=', 'validating')->pluck('id')); - $disabled_group = cache()->rememberForever('disabled_group', fn () => Group::where('slug', '=', 'disabled')->pluck('id')); - $pruned_group = cache()->rememberForever('pruned_group', fn () => Group::where('slug', '=', 'pruned')->pluck('id')); + $banned_group = \cache()->rememberForever('banned_group', fn () => Group::where('slug', '=', 'banned')->pluck('id')); + $validating_group = \cache()->rememberForever('validating_group', fn () => Group::where('slug', '=', 'validating')->pluck('id')); + $disabled_group = \cache()->rememberForever('disabled_group', fn () => Group::where('slug', '=', 'disabled')->pluck('id')); + $pruned_group = \cache()->rememberForever('pruned_group', fn () => Group::where('slug', '=', 'pruned')->pluck('id')); // Fetch Top Bankers $bankers = User::latest('seedbonus')->whereNotIn('group_id', [$validating_group[0], $banned_group[0], $disabled_group[0], $pruned_group[0]])->take(100)->get(); - return view('stats.users.bankers', ['bankers' => $bankers]); + return \view('stats.users.bankers', ['bankers' => $bankers]); } /** @@ -256,7 +256,7 @@ public function seedtime() // Fetch Top Total Seedtime $seedtime = User::with('history')->select(DB::raw('user_id, count(*) as value'))->groupBy('user_id')->latest('value')->take(100)->sum('seedtime'); - return view('stats.users.seedtime', ['seedtime' => $seedtime]); + return \view('stats.users.seedtime', ['seedtime' => $seedtime]); } /** @@ -269,7 +269,7 @@ public function seedsize() // Fetch Top Total Seedsize Users $seedsize = User::with(['peers', 'torrents'])->select(DB::raw('user_id, count(*) as value'))->groupBy('user_id')->latest('value')->take(100)->sum('size'); - return view('stats.users.seedsize', ['seedsize' => $seedsize]); + return \view('stats.users.seedsize', ['seedsize' => $seedsize]); } /** @@ -282,7 +282,7 @@ public function seeded() // Fetch Top Seeded $seeded = Torrent::latest('seeders')->take(100)->get(); - return view('stats.torrents.seeded', ['seeded' => $seeded]); + return \view('stats.torrents.seeded', ['seeded' => $seeded]); } /** @@ -295,7 +295,7 @@ public function leeched() // Fetch Top Leeched $leeched = Torrent::latest('leechers')->take(100)->get(); - return view('stats.torrents.leeched', ['leeched' => $leeched]); + return \view('stats.torrents.leeched', ['leeched' => $leeched]); } /** @@ -308,7 +308,7 @@ public function completed() // Fetch Top Completed $completed = Torrent::latest('times_completed')->take(100)->get(); - return view('stats.torrents.completed', ['completed' => $completed]); + return \view('stats.torrents.completed', ['completed' => $completed]); } /** @@ -321,7 +321,7 @@ public function dying() // Fetch Top Dying $dying = Torrent::where('seeders', '=', 1)->where('times_completed', '>=', '1')->latest('leechers')->take(100)->get(); - return view('stats.torrents.dying', ['dying' => $dying]); + return \view('stats.torrents.dying', ['dying' => $dying]); } /** @@ -334,7 +334,7 @@ public function dead() // Fetch Top Dead $dead = Torrent::where('seeders', '=', 0)->latest('leechers')->take(100)->get(); - return view('stats.torrents.dead', ['dead' => $dead]); + return \view('stats.torrents.dead', ['dead' => $dead]); } /** @@ -347,7 +347,7 @@ public function bountied() // Fetch Top Bountied $bountied = TorrentRequest::latest('bounty')->take(100)->get(); - return view('stats.requests.bountied', ['bountied' => $bountied]); + return \view('stats.requests.bountied', ['bountied' => $bountied]); } /** @@ -360,7 +360,7 @@ public function groups() // Fetch Groups User Counts $groups = Group::oldest('position')->get(); - return view('stats.groups.groups', ['groups' => $groups]); + return \view('stats.groups.groups', ['groups' => $groups]); } /** @@ -376,7 +376,7 @@ public function group($id) $group = Group::findOrFail($id); $users = User::withTrashed()->where('group_id', '=', $group->id)->latest()->paginate(100); - return view('stats.groups.group', ['users' => $users, 'group' => $group]); + return \view('stats.groups.group', ['users' => $users, 'group' => $group]); } /** @@ -389,6 +389,6 @@ public function languages() // Fetch All Languages $languages = Language::allowed(); - return view('stats.languages.languages', ['languages' => $languages]); + return \view('stats.languages.languages', ['languages' => $languages]); } } diff --git a/app/Http/Controllers/SubscriptionController.php b/app/Http/Controllers/SubscriptionController.php index 5599cb407c..cacb2d5879 100644 --- a/app/Http/Controllers/SubscriptionController.php +++ b/app/Http/Controllers/SubscriptionController.php @@ -46,11 +46,11 @@ public function subscribeTopic(Request $request, string $route, Topic $topic) $subscription->topic_id = $topic->id; $subscription->save(); - return redirect()->route($logger, $params) + return \redirect()->route($logger, $params) ->withSuccess('You are now subscribed to topic, '.$topic->name.'. You will now receive site notifications when a reply is left.'); } - return redirect()->route($logger, $params) + return \redirect()->route($logger, $params) ->withErrors('You are already subscribed to this topic'); } @@ -78,11 +78,11 @@ public function unsubscribeTopic(Request $request, string $route, Topic $topic) $subscription = $request->user()->subscriptions()->where('topic_id', '=', $topic->id)->first(); $subscription->delete(); - return redirect()->route($logger, $params) + return \redirect()->route($logger, $params) ->withSuccess('You are no longer subscribed to topic, '.$topic->name.'. You will no longer receive site notifications when a reply is left.'); } - return redirect()->route($logger, $params) + return \redirect()->route($logger, $params) ->withErrors('You are not subscribed this topic to begin with...'); } @@ -112,11 +112,11 @@ public function subscribeForum(Request $request, string $route, Forum $forum) $subscription->forum_id = $forum->id; $subscription->save(); - return redirect()->route($logger, $params) + return \redirect()->route($logger, $params) ->withSuccess('You are now subscribed to forum, '.$forum->name.'. You will now receive site notifications when a topic is started.'); } - return redirect()->route($logger, $params) + return \redirect()->route($logger, $params) ->withErrors('You are already subscribed to this forum'); } @@ -144,11 +144,11 @@ public function unsubscribeForum(Request $request, string $route, Forum $forum) $subscription = $request->user()->subscriptions()->where('forum_id', '=', $forum->id)->first(); $subscription->delete(); - return redirect()->route($logger, $params) + return \redirect()->route($logger, $params) ->withSuccess('You are no longer subscribed to forum, '.$forum->name.'. You will no longer receive site notifications when a topic is started.'); } - return redirect()->route($logger, $params) + return \redirect()->route($logger, $params) ->withErrors('You are not subscribed this forum to begin with...'); } } diff --git a/app/Http/Controllers/SubtitleController.php b/app/Http/Controllers/SubtitleController.php index 7f35394dbc..2583762282 100644 --- a/app/Http/Controllers/SubtitleController.php +++ b/app/Http/Controllers/SubtitleController.php @@ -62,7 +62,7 @@ public function index() $media_languages = MediaLanguage::all()->sortBy('name'); $categories = Category::all()->sortBy('position'); - return view('subtitle.index', ['subtitles' => $subtitles, 'media_languages' => $media_languages, 'categories' => $categories]); + return \view('subtitle.index', ['subtitles' => $subtitles, 'media_languages' => $media_languages, 'categories' => $categories]); } /** @@ -77,7 +77,7 @@ public function create($torrent_id) $torrent = Torrent::findOrFail($torrent_id); $media_languages = MediaLanguage::all()->sortBy('name'); - return view('subtitle.create', ['torrent' => $torrent, 'media_languages' => $media_languages]); + return \view('subtitle.create', ['torrent' => $torrent, 'media_languages' => $media_languages]); } /** @@ -91,7 +91,7 @@ public function store(Request $request) { $user = $request->user(); $subtitle_file = $request->file('subtitle_file'); - $filename = uniqid().'.'.$subtitle_file->getClientOriginalExtension(); + $filename = \uniqid().'.'.$subtitle_file->getClientOriginalExtension(); $subtitle = new Subtitle(); $subtitle->title = $subtitle_file->getClientOriginalName(); @@ -106,10 +106,10 @@ public function store(Request $request) $subtitle->anon = $request->input('anonymous'); $subtitle->torrent_id = $request->input('torrent_id'); $subtitle->status = 1; - $subtitle->moderated_at = now(); + $subtitle->moderated_at = \now(); $subtitle->moderated_by = 1; - $v = validator($subtitle->toArray(), [ + $v = \validator($subtitle->toArray(), [ 'title' => 'required', 'file_name' => 'required', 'file_size' => 'required', @@ -120,24 +120,24 @@ public function store(Request $request) ]); if ($v->fails()) { - return redirect()->route('subtitles.create', ['torrent_id' => $request->input('torrent_id')]) + return \redirect()->route('subtitles.create', ['torrent_id' => $request->input('torrent_id')]) ->withErrors($v->errors()); } // Save Subtitle - Storage::disk('subtitles')->put($filename, file_get_contents($subtitle_file)); + Storage::disk('subtitles')->put($filename, \file_get_contents($subtitle_file)); $subtitle->save(); // Announce To Shoutbox - $torrent_url = href_torrent($subtitle->torrent); - $profile_url = href_profile($user); + $torrent_url = \href_torrent($subtitle->torrent); + $profile_url = \href_profile($user); if ($subtitle->anon == false) { $this->chatRepository->systemMessage( - sprintf('[url=%s]%s[/url] has uploaded a new %s subtitle for [url=%s]%s[/url]', $profile_url, $user->username, $subtitle->language->name, $torrent_url, $subtitle->torrent->name) + \sprintf('[url=%s]%s[/url] has uploaded a new %s subtitle for [url=%s]%s[/url]', $profile_url, $user->username, $subtitle->language->name, $torrent_url, $subtitle->torrent->name) ); } else { $this->chatRepository->systemMessage( - sprintf('An anonymous user has uploaded a new %s subtitle for [url=%s]%s[/url]', $subtitle->language->name, $torrent_url, $subtitle->torrent->name) + \sprintf('An anonymous user has uploaded a new %s subtitle for [url=%s]%s[/url]', $subtitle->language->name, $torrent_url, $subtitle->torrent->name) ); } @@ -156,7 +156,7 @@ public function store(Request $request) $user->addProgress(new UserUploaded900Subtitles(), 1); $user->addProgress(new UserUploaded1000Subtitles(), 1); - return redirect()->route('torrent', ['id' => $request->input('torrent_id')]) + return \redirect()->route('torrent', ['id' => $request->input('torrent_id')]) ->withSuccess('Subtitle Successfully Added'); } @@ -173,22 +173,22 @@ public function update(Request $request, $id) $subtitle = Subtitle::findOrFail($id); $user = $request->user(); - abort_unless($user->group->is_modo || $user->id == $subtitle->user_id, 403); + \abort_unless($user->group->is_modo || $user->id == $subtitle->user_id, 403); $subtitle->language_id = $request->input('language_id'); $subtitle->note = $request->input('note'); - $v = validator($subtitle->toArray(), [ + $v = \validator($subtitle->toArray(), [ 'language_id' => 'required', ]); if ($v->fails()) { - return redirect()->route('torrent', ['id' => $request->input('torrent_id')]) + return \redirect()->route('torrent', ['id' => $request->input('torrent_id')]) ->withErrors($v->errors()); } $subtitle->save(); - return redirect()->route('torrent', ['id' => $request->input('torrent_id')]) + return \redirect()->route('torrent', ['id' => $request->input('torrent_id')]) ->withSuccess('Subtitle Successfully Updated'); } @@ -205,7 +205,7 @@ public function destroy(Request $request, $id) $subtitle = Subtitle::findOrFail($id); $user = $request->user(); - abort_unless($user->group->is_modo || $user->id == $subtitle->user_id, 403); + \abort_unless($user->group->is_modo || $user->id == $subtitle->user_id, 403); if (Storage::disk('subtitles')->exists($subtitle->file_name)) { Storage::disk('subtitles')->delete($subtitle->file_name); @@ -213,7 +213,7 @@ public function destroy(Request $request, $id) $subtitle->delete(); - return redirect()->route('torrent', ['id' => $request->input('torrent_id')]) + return \redirect()->route('torrent', ['id' => $request->input('torrent_id')]) ->withSuccess('Subtitle Successfully Deleted'); } @@ -232,7 +232,7 @@ public function download(Request $request, $id) // User's download rights are revoked if ($user->can_download == 0 && $subtitle->user_id != $user->id) { - return redirect()->route('torrent', ['id' => $subtitle->torrent->id]) + return \redirect()->route('torrent', ['id' => $subtitle->torrent->id]) ->withErrors('Your Download Rights Have Been Revoked!'); } @@ -266,7 +266,7 @@ public function faceted(Request $request, Subtitle $subtitle) $categories = $request->input('categories'); $language_id = $request->input('language_id'); - $terms = explode(' ', $name); + $terms = \explode(' ', $name); $name = ''; foreach ($terms as $term) { $name .= '%'.$term.'%'; @@ -290,7 +290,7 @@ public function faceted(Request $request, Subtitle $subtitle) $subtitles = $subtitle->latest()->paginate(25); - return view('subtitle.results', [ + return \view('subtitle.results', [ 'user' => $user, 'subtitles' => $subtitles, ])->render(); diff --git a/app/Http/Controllers/ThankController.php b/app/Http/Controllers/ThankController.php index 843e295d59..32416c12e6 100644 --- a/app/Http/Controllers/ThankController.php +++ b/app/Http/Controllers/ThankController.php @@ -33,13 +33,13 @@ public function store(Request $request, $id) $torrent = Torrent::findOrFail($id); if ($user->id === $torrent->user_id) { - return redirect()->route('torrent', ['id' => $torrent->id]) + return \redirect()->route('torrent', ['id' => $torrent->id]) ->withErrors('You Cannot Thank Your Own Torrent!'); } $thank = Thank::where('user_id', '=', $user->id)->where('torrent_id', '=', $torrent->id)->first(); if ($thank) { - return redirect()->route('torrent', ['id' => $torrent->id]) + return \redirect()->route('torrent', ['id' => $torrent->id]) ->withErrors('You Have Already Thanked On This Torrent!'); } @@ -53,7 +53,7 @@ public function store(Request $request, $id) $torrent->notifyUploader('thank', $thank); } - return redirect()->route('torrent', ['id' => $torrent->id]) + return \redirect()->route('torrent', ['id' => $torrent->id]) ->withSuccess('Your Thank Was Successfully Applied!'); } } diff --git a/app/Http/Controllers/TopicController.php b/app/Http/Controllers/TopicController.php index c561493ea1..b5e81e33b2 100644 --- a/app/Http/Controllers/TopicController.php +++ b/app/Http/Controllers/TopicController.php @@ -92,7 +92,7 @@ public function topic($id, $page = '', $post = '') // The user can post a topic here ? if ($category->getPermission()->read_topic != true) { // Redirect him to the forum index - return redirect()->route('forums.index') + return \redirect()->route('forums.index') ->withErrors('You Do Not Have Access To Read This Topic!'); } @@ -100,7 +100,7 @@ public function topic($id, $page = '', $post = '') $topic->views++; $topic->save(); - return view('forum.topic', [ + return \view('forum.topic', [ 'topic' => $topic, 'forum' => $forum, 'category' => $category, @@ -124,11 +124,11 @@ public function addForm(Request $request, $id) // The user has the right to create a topic here? if ($category->getPermission()->start_topic != true) { - return redirect()->route('forums.index') + return \redirect()->route('forums.index') ->withErrors('You Cannot Start A New Topic Here!'); } - return view('forum.new_topic', [ + return \view('forum.new_topic', [ 'forum' => $forum, 'category' => $category, 'title' => $request->input('title'), @@ -151,7 +151,7 @@ public function newTopic(Request $request, $id) // The user has the right to create a topic here? if ($category->getPermission()->start_topic != true) { - return redirect()->route('forums.index') + return \redirect()->route('forums.index') ->withErrors('You Cannot Start A New Topic Here!'); } @@ -168,7 +168,7 @@ public function newTopic(Request $request, $id) $topic->pinned = false; $topic->forum_id = $forum->id; - $v = validator($topic->toArray(), [ + $v = \validator($topic->toArray(), [ 'name' => 'required', 'slug' => 'required', 'state' => 'required', @@ -183,7 +183,7 @@ public function newTopic(Request $request, $id) ]); if ($v->fails()) { - return redirect()->route('forums.index') + return \redirect()->route('forums.index') ->withErrors($v->errors()); } $topic->save(); @@ -191,13 +191,13 @@ public function newTopic(Request $request, $id) $post->content = $request->input('content'); $post->user_id = $user->id; $post->topic_id = $topic->id; - $v = validator($post->toArray(), [ + $v = \validator($post->toArray(), [ 'content' => 'required', 'user_id' => 'required', 'topic_id' => 'required', ]); if ($v->fails()) { - return redirect()->route('forums.index') + return \redirect()->route('forums.index') ->withErrors($v->errors()); } $post->save(); @@ -214,14 +214,14 @@ public function newTopic(Request $request, $id) $forum->save(); // Post To ShoutBox - $appurl = config('app.url'); - $topicUrl = sprintf('%s/forums/topics/%s', $appurl, $topic->id); - $profileUrl = sprintf('%s/users/%s', $appurl, $user->username); + $appurl = \config('app.url'); + $topicUrl = \sprintf('%s/forums/topics/%s', $appurl, $topic->id); + $profileUrl = \sprintf('%s/users/%s', $appurl, $user->username); - if (config('other.staff-forum-notify') && ($forum->id == config('other.staff-forum-id') || $forum->parent_id == config('other.staff-forum-id'))) { + if (\config('other.staff-forum-notify') && ($forum->id == \config('other.staff-forum-id') || $forum->parent_id == \config('other.staff-forum-id'))) { $forum->notifyStaffers($user, $topic); } else { - $this->chatRepository->systemMessage(sprintf('[url=%s]%s[/url] has created a new topic [url=%s]%s[/url]', $profileUrl, $user->username, $topicUrl, $topic->name)); + $this->chatRepository->systemMessage(\sprintf('[url=%s]%s[/url] has created a new topic [url=%s]%s[/url]', $profileUrl, $user->username, $topicUrl, $topic->name)); $forum->notifySubscribers($user, $topic); } //Achievements @@ -238,7 +238,7 @@ public function newTopic(Request $request, $id) $user->addProgress(new UserMade800Posts(), 1); $user->addProgress(new UserMade900Posts(), 1); - return redirect()->route('forum_topic', ['id' => $topic->id]) + return \redirect()->route('forum_topic', ['id' => $topic->id]) ->withSuccess('Topic Created Successfully!'); } @@ -254,7 +254,7 @@ public function editForm($id) $topic = Topic::findOrFail($id); $categories = Forum::where('parent_id', '!=', 0)->get(); - return view('forum.edit_topic', ['topic' => $topic, 'categories' => $categories]); + return \view('forum.edit_topic', ['topic' => $topic, 'categories' => $categories]); } /** @@ -270,14 +270,14 @@ public function editTopic(Request $request, $id) $user = $request->user(); $topic = Topic::findOrFail($id); - abort_unless($user->group->is_modo || $user->id === $topic->first_post_user_id, 403); + \abort_unless($user->group->is_modo || $user->id === $topic->first_post_user_id, 403); $name = $request->input('name'); $forum_id = $request->input('forum_id'); $topic->name = $name; $topic->forum_id = $forum_id; $topic->save(); - return redirect()->route('forum_topic', ['id' => $topic->id]) + return \redirect()->route('forum_topic', ['id' => $topic->id]) ->withSuccess('Topic Successfully Edited'); } @@ -294,11 +294,11 @@ public function closeTopic(Request $request, $id) $user = $request->user(); $topic = Topic::findOrFail($id); - abort_unless($user->group->is_modo || $user->id === $topic->first_post_user_id, 403); + \abort_unless($user->group->is_modo || $user->id === $topic->first_post_user_id, 403); $topic->state = 'close'; $topic->save(); - return redirect()->route('forum_topic', ['id' => $topic->id]) + return \redirect()->route('forum_topic', ['id' => $topic->id]) ->withSuccess('This Topic Is Now Closed!'); } @@ -315,11 +315,11 @@ public function openTopic(Request $request, $id) $user = $request->user(); $topic = Topic::findOrFail($id); - abort_unless($user->group->is_modo || $user->id === $topic->first_post_user_id, 403); + \abort_unless($user->group->is_modo || $user->id === $topic->first_post_user_id, 403); $topic->state = 'open'; $topic->save(); - return redirect()->route('forum_topic', ['id' => $topic->id]) + return \redirect()->route('forum_topic', ['id' => $topic->id]) ->withSuccess('This Topic Is Now Open!'); } @@ -336,12 +336,12 @@ public function deleteTopic(Request $request, $id) $user = $request->user(); $topic = Topic::findOrFail($id); - abort_unless($user->group->is_modo || $user->id === $topic->first_post_user_id, 403); + \abort_unless($user->group->is_modo || $user->id === $topic->first_post_user_id, 403); $posts = $topic->posts(); $posts->delete(); $topic->delete(); - return redirect()->route('forums.show', ['id' => $topic->forum->id]) + return \redirect()->route('forums.show', ['id' => $topic->forum->id]) ->withSuccess('This Topic Is Now Deleted!'); } @@ -358,7 +358,7 @@ public function pinTopic($id) $topic->pinned = 1; $topic->save(); - return redirect()->route('forum_topic', ['id' => $topic->id]) + return \redirect()->route('forum_topic', ['id' => $topic->id]) ->withSuccess('This Topic Is Now Pinned!'); } @@ -375,7 +375,7 @@ public function unpinTopic($id) $topic->pinned = 0; $topic->save(); - return redirect()->route('forum_topic', ['id' => $topic->id]) + return \redirect()->route('forum_topic', ['id' => $topic->id]) ->withSuccess('This Topic Is Now Unpinned!'); } } diff --git a/app/Http/Controllers/TopicLabelController.php b/app/Http/Controllers/TopicLabelController.php index 2815d2e101..deb1c8ebf4 100644 --- a/app/Http/Controllers/TopicLabelController.php +++ b/app/Http/Controllers/TopicLabelController.php @@ -30,7 +30,7 @@ public function approve($id) $topic->approved = $topic->approved == 0 ? '1' : '0'; $topic->save(); - return redirect()->route('forum_topic', ['id' => $topic->id]) + return \redirect()->route('forum_topic', ['id' => $topic->id]) ->withInfo('Label Change Has Been Applied'); } @@ -47,7 +47,7 @@ public function deny($id) $topic->denied = $topic->denied == 0 ? '1' : '0'; $topic->save(); - return redirect()->route('forum_topic', ['id' => $topic->id]) + return \redirect()->route('forum_topic', ['id' => $topic->id]) ->withInfo('Label Change Has Been Applied'); } @@ -64,7 +64,7 @@ public function solve($id) $topic->solved = $topic->solved == 0 ? '1' : '0'; $topic->save(); - return redirect()->route('forum_topic', ['id' => $topic->id]) + return \redirect()->route('forum_topic', ['id' => $topic->id]) ->withInfo('Label Change Has Been Applied'); } @@ -81,7 +81,7 @@ public function invalid($id) $topic->invalid = $topic->invalid == 0 ? '1' : '0'; $topic->save(); - return redirect()->route('forum_topic', ['id' => $topic->id]) + return \redirect()->route('forum_topic', ['id' => $topic->id]) ->withInfo('Label Change Has Been Applied'); } @@ -98,7 +98,7 @@ public function bug($id) $topic->bug = $topic->bug == 0 ? '1' : '0'; $topic->save(); - return redirect()->route('forum_topic', ['id' => $topic->id]) + return \redirect()->route('forum_topic', ['id' => $topic->id]) ->withInfo('Label Change Has Been Applied'); } @@ -115,7 +115,7 @@ public function suggest($id) $topic->suggestion = $topic->suggestion == 0 ? '1' : '0'; $topic->save(); - return redirect()->route('forum_topic', ['id' => $topic->id]) + return \redirect()->route('forum_topic', ['id' => $topic->id]) ->withInfo('Label Change Has Been Applied'); } @@ -132,7 +132,7 @@ public function implement($id) $topic->implemented = $topic->implemented == 0 ? '1' : '0'; $topic->save(); - return redirect()->route('forum_topic', ['id' => $topic->id]) + return \redirect()->route('forum_topic', ['id' => $topic->id]) ->withInfo('Label Change Has Been Applied'); } } diff --git a/app/Http/Controllers/TorrentController.php b/app/Http/Controllers/TorrentController.php index cb85cc496b..7d3b143ee4 100644 --- a/app/Http/Controllers/TorrentController.php +++ b/app/Http/Controllers/TorrentController.php @@ -119,7 +119,7 @@ public function torrents(Request $request) $personal_freeleech = PersonalFreeleech::where('user_id', '=', $user->id)->first(); $bookmarks = Bookmark::where('user_id', $user->id)->get(); - return view('torrent.torrents', [ + return \view('torrent.torrents', [ 'personal_freeleech' => $personal_freeleech, 'repository' => $repository, 'bookmarks' => $bookmarks, @@ -152,10 +152,10 @@ public function similar(Request $request, $category_id, $tmdb) ->get(); if (! $torrents || $torrents->count() < 1) { - abort(404, 'No Similar Torrents Found'); + \abort(404, 'No Similar Torrents Found'); } - return view('torrent.similar', [ + return \view('torrent.similar', [ 'user' => $user, 'personal_freeleech' => $personal_freeleech, 'torrents' => $torrents, @@ -179,7 +179,7 @@ public function cardLayout(Request $request) $torrents = Torrent::with(['user:id,username', 'category', 'type'])->latest()->paginate(33); $repository = $this->torrentFacetedRepository; - $movieScrapper = new \App\Services\MovieScrapper(config('api-keys.tmdb'), config('api-keys.tvdb'), config('api-keys.omdb')); + $movieScrapper = new \App\Services\MovieScrapper(\config('api-keys.tmdb'), \config('api-keys.tvdb'), \config('api-keys.omdb')); foreach ($torrents as $torrent) { $meta = null; if ($torrent->category->tv_meta) { @@ -204,7 +204,7 @@ public function cardLayout(Request $request) } } - return view('torrent.cards', [ + return \view('torrent.cards', [ 'user' => $user, 'torrents' => $torrents, 'repository' => $repository, @@ -256,14 +256,14 @@ public function groupingLayout(Request $request) $prelauncher = $builder->orderBy('s'.self::SORTING, self::ORDER)->pluck('imdb')->toArray(); - if (! is_array($prelauncher)) { + if (! \is_array($prelauncher)) { $prelauncher = []; } - $lengthAwarePaginator = new Paginator($prelauncher, count($prelauncher), self::QTY); + $lengthAwarePaginator = new Paginator($prelauncher, \count($prelauncher), self::QTY); - $hungry = array_chunk($prelauncher, self::QTY); + $hungry = \array_chunk($prelauncher, self::QTY); $fed = []; - if (is_array($hungry) && array_key_exists(self::PAGE, $hungry)) { + if (\is_array($hungry) && \array_key_exists(self::PAGE, $hungry)) { $fed = $hungry[self::PAGE]; } $totals = []; @@ -271,14 +271,14 @@ public function groupingLayout(Request $request) $launcher = Torrent::with(['user:id,username', 'category', 'type'])->withCount(['thanks', 'comments'])->whereIn('imdb', $fed)->orderBy(self::SORTING, self::ORDER); foreach ($launcher->cursor() as $chunk) { if ($chunk->imdb) { - $totals[$chunk->imdb] = ! array_key_exists($chunk->imdb, $totals) ? 1 : $totals[$chunk->imdb] + 1; - if (! array_key_exists('imdb'.$chunk->imdb, $cache)) { + $totals[$chunk->imdb] = ! \array_key_exists($chunk->imdb, $totals) ? 1 : $totals[$chunk->imdb] + 1; + if (! \array_key_exists('imdb'.$chunk->imdb, $cache)) { $cache['imdb'.$chunk->imdb] = []; } - if (! array_key_exists('imdb'.$chunk->imdb, $counts)) { + if (! \array_key_exists('imdb'.$chunk->imdb, $counts)) { $counts['imdb'.$chunk->imdb] = 0; } - if (! array_key_exists('imdb'.$chunk->imdb, $attributes)) { + if (! \array_key_exists('imdb'.$chunk->imdb, $attributes)) { $attributes['imdb'.$chunk->imdb]['seeders'] = 0; $attributes['imdb'.$chunk->imdb]['leechers'] = 0; $attributes['imdb'.$chunk->imdb]['times_completed'] = 0; @@ -289,10 +289,10 @@ public function groupingLayout(Request $request) $attributes['imdb'.$chunk->imdb]['times_completed'] += $chunk->times_completed; $attributes['imdb'.$chunk->imdb]['seeders'] += $chunk->seeders; $attributes['imdb'.$chunk->imdb]['leechers'] += $chunk->leechers; - if (! array_key_exists($chunk->type_id, $attributes['imdb'.$chunk->imdb])) { + if (! \array_key_exists($chunk->type_id, $attributes['imdb'.$chunk->imdb])) { $attributes['imdb'.$chunk->imdb]['types'][$chunk->type_id] = $chunk->type_id; } - if (! array_key_exists($chunk->category_id, $attributes['imdb'.$chunk->imdb])) { + if (! \array_key_exists($chunk->category_id, $attributes['imdb'.$chunk->imdb])) { $attributes['imdb'.$chunk->imdb]['categories'][$chunk->category_id] = $chunk->category_id; } $cache['imdb'.$chunk->imdb]['torrent'.$counts['imdb'.$chunk->imdb]] = [ @@ -307,10 +307,10 @@ public function groupingLayout(Request $request) $counts['imdb'.$chunk->imdb]++; } } - $torrents = count($cache) > 0 ? $cache : null; + $torrents = \count($cache) > 0 ? $cache : null; - if (is_array($torrents)) { - $movieScrapper = new \App\Services\MovieScrapper(config('api-keys.tmdb'), config('api-keys.tvdb'), config('api-keys.omdb')); + if (\is_array($torrents)) { + $movieScrapper = new \App\Services\MovieScrapper(\config('api-keys.tmdb'), \config('api-keys.tvdb'), \config('api-keys.omdb')); foreach ($torrents as $k1 => $c) { foreach ($c as $k2 => $d) { $meta = null; @@ -340,7 +340,7 @@ public function groupingLayout(Request $request) $bookmarks = Bookmark::where('user_id', $user->id)->get(); - return view('torrent.groupings', [ + return \view('torrent.groupings', [ 'torrents' => $torrents, 'user' => $user, 'sorting' => self::SORTING, @@ -435,19 +435,19 @@ public function faceted(Request $request, Torrent $torrent) $order = null; $sorting = null; - $terms = explode(' ', $search); + $terms = \explode(' ', $search); $search = ''; foreach ($terms as $term) { $search .= '%'.$term.'%'; } - $usernames = explode(' ', $uploader); + $usernames = \explode(' ', $uploader); $uploader = null; foreach ($usernames as $username) { $uploader .= $username.'%'; } - $keywords = explode(' ', $description); + $keywords = \explode(' ', $description); $description = ''; foreach ($keywords as $keyword) { $description .= '%'.$keyword.'%'; @@ -495,7 +495,7 @@ public function faceted(Request $request, Torrent $torrent) } if ($request->has('imdb') && $request->input('imdb') != null) { - $torrent->where('torrentsl.imdb', '=', str_replace('tt', '', $imdb)); + $torrent->where('torrentsl.imdb', '=', \str_replace('tt', '', $imdb)); } if ($request->has('tvdb') && $request->input('tvdb') != null) { @@ -576,7 +576,7 @@ public function faceted(Request $request, Torrent $torrent) } } elseif ($nohistory == 1) { $history = History::select(['torrents.id'])->leftJoin('torrents', 'torrents.info_hash', '=', 'history.info_hash')->where('history.user_id', '=', $user->id)->get()->toArray(); - if (! $history || ! is_array($history)) { + if (! $history || ! \is_array($history)) { $history = []; } $torrent = $torrent->with(['user:id,username', 'category', 'type', 'tags'])->withCount(['thanks', 'comments'])->whereNotIn('torrents.id', $history); @@ -632,7 +632,7 @@ public function faceted(Request $request, Torrent $torrent) } if ($request->has('imdb') && $request->input('imdb') != null) { - $torrent->where('torrents.imdb', '=', str_replace('tt', '', $imdb)); + $torrent->where('torrents.imdb', '=', \str_replace('tt', '', $imdb)); } if ($request->has('tvdb') && $request->input('tvdb') != null) { @@ -724,17 +724,17 @@ public function faceted(Request $request, Torrent $torrent) $prelauncher = $torrent->orderBy('s'.$sorting, $order)->pluck('imdb')->toArray(); - if (! is_array($prelauncher)) { + if (! \is_array($prelauncher)) { $prelauncher = []; } - $links = new Paginator($prelauncher, count($prelauncher), $qty); + $links = new Paginator($prelauncher, \count($prelauncher), $qty); - $hungry = array_chunk($prelauncher, $qty); + $hungry = \array_chunk($prelauncher, $qty); $fed = []; if ($page < 1) { $page = 1; } - if (is_array($hungry) && array_key_exists($page - 1, $hungry)) { + if (\is_array($hungry) && \array_key_exists($page - 1, $hungry)) { $fed = $hungry[$page - 1]; } $totals = []; @@ -742,14 +742,14 @@ public function faceted(Request $request, Torrent $torrent) $launcher = Torrent::with(['user:id,username', 'category', 'type', 'tags'])->withCount(['thanks', 'comments'])->whereIn('imdb', $fed)->orderBy($sorting, $order); foreach ($launcher->cursor() as $chunk) { if ($chunk->imdb) { - $totals[$chunk->imdb] = ! array_key_exists($chunk->imdb, $totals) ? 1 : $totals[$chunk->imdb] + 1; - if (! array_key_exists('imdb'.$chunk->imdb, $cache)) { + $totals[$chunk->imdb] = ! \array_key_exists($chunk->imdb, $totals) ? 1 : $totals[$chunk->imdb] + 1; + if (! \array_key_exists('imdb'.$chunk->imdb, $cache)) { $cache['imdb'.$chunk->imdb] = []; } - if (! array_key_exists('imdb'.$chunk->imdb, $counts)) { + if (! \array_key_exists('imdb'.$chunk->imdb, $counts)) { $counts['imdb'.$chunk->imdb] = 0; } - if (! array_key_exists('imdb'.$chunk->imdb, $attributes)) { + if (! \array_key_exists('imdb'.$chunk->imdb, $attributes)) { $attributes['imdb'.$chunk->imdb]['seeders'] = 0; $attributes['imdb'.$chunk->imdb]['leechers'] = 0; $attributes['imdb'.$chunk->imdb]['times_completed'] = 0; @@ -760,10 +760,10 @@ public function faceted(Request $request, Torrent $torrent) $attributes['imdb'.$chunk->imdb]['times_completed'] += $chunk->times_completed; $attributes['imdb'.$chunk->imdb]['seeders'] += $chunk->seeders; $attributes['imdb'.$chunk->imdb]['leechers'] += $chunk->leechers; - if (! array_key_exists($chunk->type_id, $attributes['imdb'.$chunk->imdb])) { + if (! \array_key_exists($chunk->type_id, $attributes['imdb'.$chunk->imdb])) { $attributes['imdb'.$chunk->imdb]['types'][$chunk->type_id] = $chunk->type_id; } - if (! array_key_exists($chunk->category_id, $attributes['imdb'.$chunk->imdb])) { + if (! \array_key_exists($chunk->category_id, $attributes['imdb'.$chunk->imdb])) { $attributes['imdb'.$chunk->imdb]['categories'][$chunk->category_id] = $chunk->category_id; } $cache['imdb'.$chunk->imdb]['torrent'.$counts['imdb'.$chunk->imdb]] = [ @@ -778,30 +778,30 @@ public function faceted(Request $request, Torrent $torrent) $counts['imdb'.$chunk->imdb]++; } } - $torrents = count($cache) > 0 ? $cache : null; + $torrents = \count($cache) > 0 ? $cache : null; } elseif ($history == 1) { $prelauncher = $torrent->orderBy('torrents.sticky', 'desc')->orderBy('torrents.'.$sorting, $order)->pluck('id')->toArray(); - if (! is_array($prelauncher)) { + if (! \is_array($prelauncher)) { $prelauncher = []; } - $links = new Paginator($prelauncher, count($prelauncher), $qty); + $links = new Paginator($prelauncher, \count($prelauncher), $qty); - $hungry = array_chunk($prelauncher, $qty); + $hungry = \array_chunk($prelauncher, $qty); $fed = []; if ($page < 1) { $page = 1; } - if (is_array($hungry) && array_key_exists($page - 1, $hungry)) { + if (\is_array($hungry) && \array_key_exists($page - 1, $hungry)) { $fed = $hungry[$page - 1]; } $torrents = Torrent::with(['user:id,username', 'category', 'type', 'tags'])->withCount(['thanks', 'comments'])->whereIn('id', $fed)->orderBy($sorting, $order)->get(); } else { $torrents = $torrent->orderBy('sticky', 'desc')->orderBy($sorting, $order)->paginate($qty); } - if ($collection == 1 && is_array($torrents)) { - $client = new \App\Services\MovieScrapper(config('api-keys.tmdb'), config('api-keys.tvdb'), config('api-keys.omdb')); + if ($collection == 1 && \is_array($torrents)) { + $client = new \App\Services\MovieScrapper(\config('api-keys.tmdb'), \config('api-keys.tvdb'), \config('api-keys.omdb')); foreach ($torrents as $k1 => $c) { foreach ($c as $k2 => $d) { $meta = null; @@ -832,7 +832,7 @@ public function faceted(Request $request, Torrent $torrent) if ($logger == null) { $logger = 'torrent.results_cards'; } - $client = new \App\Services\MovieScrapper(config('api-keys.tmdb'), config('api-keys.tvdb'), config('api-keys.omdb')); + $client = new \App\Services\MovieScrapper(\config('api-keys.tmdb'), \config('api-keys.tvdb'), \config('api-keys.omdb')); foreach ($torrents as $torrent) { $meta = null; if ($torrent->category->tv_meta) { @@ -863,7 +863,7 @@ public function faceted(Request $request, Torrent $torrent) $bookmarks = Bookmark::where('user_id', $user->id)->get(); - return view($logger, [ + return \view($logger, [ 'torrents' => $torrents, 'user' => $user, 'personal_freeleech' => $personal_freeleech, @@ -889,16 +889,16 @@ private static function anonymizeMediainfo($mediainfo) if ($mediainfo === null) { return; } - $complete_name_i = strpos($mediainfo, 'Complete name'); + $complete_name_i = \strpos($mediainfo, 'Complete name'); if ($complete_name_i !== false) { - $path_i = strpos($mediainfo, ': ', $complete_name_i); + $path_i = \strpos($mediainfo, ': ', $complete_name_i); if ($path_i !== false) { $path_i += 2; - $end_i = strpos($mediainfo, "\n", $path_i); - $path = substr($mediainfo, $path_i, $end_i - $path_i); + $end_i = \strpos($mediainfo, "\n", $path_i); + $path = \substr($mediainfo, $path_i, $end_i - $path_i); $new_path = MediaInfo::stripPath($path); - return substr_replace($mediainfo, $new_path, $path_i, strlen($path)); + return \substr_replace($mediainfo, $new_path, $path_i, \strlen($path)); } } @@ -928,7 +928,7 @@ public function torrent(Request $request, $id) $user_tips = BonTransactions::where('torrent_id', '=', $id)->where('sender', '=', $request->user()->id)->sum('cost'); $last_seed_activity = History::where('info_hash', '=', $torrent->info_hash)->where('seeder', '=', 1)->latest('updated_at')->first(); - $movieScrapper = new \App\Services\MovieScrapper(config('api-keys.tmdb'), config('api-keys.tvdb'), config('api-keys.omdb')); + $movieScrapper = new \App\Services\MovieScrapper(\config('api-keys.tmdb'), \config('api-keys.tvdb'), \config('api-keys.omdb')); $meta = null; if ($torrent->category->tv_meta) { if ($torrent->tmdb && $torrent->tmdb != 0) { @@ -983,7 +983,7 @@ public function torrent(Request $request, $id) $playlists = $user->playlists; - return view('torrent.torrent', [ + return \view('torrent.torrent', [ 'torrent' => $torrent, 'comments' => $comments, 'user' => $user, @@ -1023,9 +1023,9 @@ public function editForm(Request $request, $id) $user = $request->user(); $torrent = Torrent::withAnyStatus()->findOrFail($id); - abort_unless($user->group->is_modo || $user->id == $torrent->user_id, 403); + \abort_unless($user->group->is_modo || $user->id == $torrent->user_id, 403); - return view('torrent.edit_torrent', [ + return \view('torrent.edit_torrent', [ 'categories' => Category::all()->sortBy('position'), 'types' => Type::all()->sortBy('position'), 'resolutions' => Resolution::all()->sortBy('position'), @@ -1048,9 +1048,9 @@ public function edit(Request $request, $id) { $user = $request->user(); $torrent = Torrent::withAnyStatus()->findOrFail($id); - $movieScrapper = new \App\Services\MovieScrapper(config('api-keys.tmdb'), config('api-keys.tvdb'), config('api-keys.omdb')); + $movieScrapper = new \App\Services\MovieScrapper(\config('api-keys.tmdb'), \config('api-keys.tvdb'), \config('api-keys.omdb')); - abort_unless($user->group->is_modo || $user->id == $torrent->user_id, 403); + \abort_unless($user->group->is_modo || $user->id == $torrent->user_id, 403); $torrent->name = $request->input('name'); $torrent->slug = Str::slug($torrent->name); $torrent->description = $request->input('description'); @@ -1068,7 +1068,7 @@ public function edit(Request $request, $id) $torrent->sd = $request->input('sd'); $torrent->internal = $request->input('internal'); - $v = validator($torrent->toArray(), [ + $v = \validator($torrent->toArray(), [ 'name' => 'required', 'slug' => 'required', 'description' => 'required', @@ -1086,7 +1086,7 @@ public function edit(Request $request, $id) ]); if ($v->fails()) { - return redirect()->route('torrent', ['id' => $torrent->id]) + return \redirect()->route('torrent', ['id' => $torrent->id]) ->withErrors($v->errors()); } $torrent->save(); @@ -1120,7 +1120,7 @@ public function edit(Request $request, $id) } } - return redirect()->route('torrent', ['id' => $torrent->id]) + return \redirect()->route('torrent', ['id' => $torrent->id]) ->withSuccess('Successfully Edited!'); } @@ -1135,7 +1135,7 @@ public function edit(Request $request, $id) */ public function deleteTorrent(Request $request) { - $v = validator($request->all(), [ + $v = \validator($request->all(), [ 'id' => 'required|exists:torrents', 'slug' => 'required|exists:torrents', 'message' => 'required|alpha_dash|min:1', @@ -1152,8 +1152,8 @@ public function deleteTorrent(Request $request) $pmuser = new PrivateMessage(); $pmuser->sender_id = 1; $pmuser->receiver_id = $pm->user_id; - $pmuser->subject = sprintf('Torrent Deleted! - %s', $torrent->name); - $pmuser->message = sprintf('[b]Attention:[/b] Torrent %s has been removed from our site. Our system shows that you were either the uploader, a seeder or a leecher on said torrent. We just wanted to let you know you can safely remove it from your client. + $pmuser->subject = \sprintf('Torrent Deleted! - %s', $torrent->name); + $pmuser->message = \sprintf('[b]Attention:[/b] Torrent %s has been removed from our site. Our system shows that you were either the uploader, a seeder or a leecher on said torrent. We just wanted to let you know you can safely remove it from your client. [b]Removal Reason:[/b] %s [color=red][b]THIS IS AN AUTOMATED SYSTEM MESSAGE, PLEASE DO NOT REPLY![/b][/color]', $torrent->name, $request->message); $pmuser->save(); @@ -1185,7 +1185,7 @@ public function deleteTorrent(Request $request) } $torrent->delete(); - return redirect()->route('torrents') + return \redirect()->route('torrents') ->withSuccess('Torrent Has Been Deleted!'); } } else { @@ -1193,11 +1193,11 @@ public function deleteTorrent(Request $request) foreach ($v->errors()->all() as $error) { $errors .= $error."\n"; } - \Log::notice(sprintf('Deletion of torrent failed due to: + \Log::notice(\sprintf('Deletion of torrent failed due to: %s', $errors)); - return redirect()->route('home.index') + return \redirect()->route('home.index') ->withErrors('Unable to delete Torrent'); } } @@ -1214,7 +1214,7 @@ public function peers($id) $torrent = Torrent::withAnyStatus()->findOrFail($id); $peers = Peer::with(['user'])->where('torrent_id', '=', $id)->latest('seeder')->paginate(25); - return view('torrent.peers', ['torrent' => $torrent, 'peers' => $peers]); + return \view('torrent.peers', ['torrent' => $torrent, 'peers' => $peers]); } /** @@ -1229,7 +1229,7 @@ public function history($id) $torrent = Torrent::withAnyStatus()->findOrFail($id); $history = History::with(['user'])->where('info_hash', '=', $torrent->info_hash)->latest()->paginate(25); - return view('torrent.history', ['torrent' => $torrent, 'history' => $history]); + return \view('torrent.history', ['torrent' => $torrent, 'history' => $history]); } /** @@ -1247,14 +1247,14 @@ public function uploadForm(Request $request, $category_id = 0, $title = '', $imd { $user = $request->user(); - return view('torrent.upload', [ + return \view('torrent.upload', [ 'categories' => Category::all()->sortBy('position'), 'types' => Type::all()->sortBy('position'), 'resolutions' => Resolution::all()->sortBy('position'), 'user' => $user, 'category_id' => $category_id, 'title' => $title, - 'imdb' => str_replace('tt', '', $imdb), + 'imdb' => \str_replace('tt', '', $imdb), 'tmdb' => $tmdb, ]); } @@ -1282,20 +1282,20 @@ public function upload(Request $request) $bbcode = new Bbcode(); $previewContent = $bbcode->parse($request->input('description'), true); - return redirect()->route('upload_form', ['category_id' => $category->id]) + return \redirect()->route('upload_form', ['category_id' => $category->id]) ->withInput() ->with(['previewContent' => $previewContent]) ->withWarning('Torrent Description Preview Loaded!'); } - $movieScrapper = new \App\Services\MovieScrapper(config('api-keys.tmdb'), config('api-keys.tvdb'), config('api-keys.omdb')); + $movieScrapper = new \App\Services\MovieScrapper(\config('api-keys.tmdb'), \config('api-keys.tvdb'), \config('api-keys.omdb')); $requestFile = $request->file('torrent'); if ($request->hasFile('torrent') == false) { - return redirect()->route('upload_form', ['category_id' => $category->id]) + return \redirect()->route('upload_form', ['category_id' => $category->id]) ->withErrors('You Must Provide A Torrent File For Upload!')->withInput(); } if ($requestFile->getError() != 0 && $requestFile->getClientOriginalExtension() != 'torrent') { - return redirect()->route('upload_form', ['category_id' => $category->id]) + return \redirect()->route('upload_form', ['category_id' => $category->id]) ->withErrors('An Unknown Error Has Occurred!')->withInput(); } @@ -1303,8 +1303,8 @@ public function upload(Request $request) $decodedTorrent = TorrentTools::normalizeTorrent($requestFile); $infohash = Bencode::get_infohash($decodedTorrent); $meta = Bencode::get_meta($decodedTorrent); - $fileName = uniqid().'.torrent'; // Generate a unique name - file_put_contents(getcwd().'/files/torrents/'.$fileName, Bencode::bencode($decodedTorrent)); + $fileName = \uniqid().'.torrent'; // Generate a unique name + \file_put_contents(\getcwd().'/files/torrents/'.$fileName, Bencode::bencode($decodedTorrent)); // Create the torrent (DB) $torrent = new Torrent(); @@ -1336,7 +1336,7 @@ public function upload(Request $request) $torrent->free = $user->group->is_modo || $user->group->is_internal ? $request->input('free') : 0; // Validation - $v = validator($torrent->toArray(), [ + $v = \validator($torrent->toArray(), [ 'name' => 'required|unique:torrents', 'slug' => 'required', 'description' => 'required', @@ -1360,11 +1360,11 @@ public function upload(Request $request) ]); if ($v->fails()) { - if (file_exists(getcwd().'/files/torrents/'.$fileName)) { - unlink(getcwd().'/files/torrents/'.$fileName); + if (\file_exists(\getcwd().'/files/torrents/'.$fileName)) { + \unlink(\getcwd().'/files/torrents/'.$fileName); } - return redirect()->route('upload_form', ['category_id' => $category->id]) + return \redirect()->route('upload_form', ['category_id' => $category->id]) ->withErrors($v->errors())->withInput(); } // Save The Torrent @@ -1408,7 +1408,7 @@ public function upload(Request $request) } // check for trusted user and update torrent if ($user->group->is_trusted) { - $appurl = config('app.url'); + $appurl = \config('app.url'); $user = $torrent->user; $user_id = $user->id; $username = $user->username; @@ -1417,18 +1417,18 @@ public function upload(Request $request) // Announce To Shoutbox if ($anon == 0) { $this->chatRepository->systemMessage( - sprintf('User [url=%s/users/', $appurl).$username.']'.$username.sprintf('[/url] has uploaded [url=%s/torrents/', $appurl).$torrent->id.']'.$torrent->name.'[/url] grab it now! :slight_smile:' + \sprintf('User [url=%s/users/', $appurl).$username.']'.$username.\sprintf('[/url] has uploaded [url=%s/torrents/', $appurl).$torrent->id.']'.$torrent->name.'[/url] grab it now! :slight_smile:' ); } else { $this->chatRepository->systemMessage( - sprintf('An anonymous user has uploaded [url=%s/torrents/', $appurl).$torrent->id.']'.$torrent->name.'[/url] grab it now! :slight_smile:' + \sprintf('An anonymous user has uploaded [url=%s/torrents/', $appurl).$torrent->id.']'.$torrent->name.'[/url] grab it now! :slight_smile:' ); } TorrentHelper::approveHelper($torrent->id); } - return redirect()->route('download_check', ['id' => $torrent->id]) + return \redirect()->route('download_check', ['id' => $torrent->id]) ->withSuccess('Your torrent file is ready to be downloaded and seeded!'); } @@ -1445,7 +1445,7 @@ public function downloadCheck(Request $request, $id) $torrent = Torrent::withAnyStatus()->findOrFail($id); $user = $request->user(); - return view('torrent.download_check', ['torrent' => $torrent, 'user' => $user]); + return \view('torrent.download_check', ['torrent' => $torrent, 'user' => $user]); } /** @@ -1467,50 +1467,50 @@ public function download(Request $request, $id, $rsskey = null) $torrent = Torrent::withAnyStatus()->findOrFail($id); // User's ratio is too low - if ($user->getRatio() < config('other.ratio')) { - return redirect()->route('torrent', ['id' => $torrent->id]) + if ($user->getRatio() < \config('other.ratio')) { + return \redirect()->route('torrent', ['id' => $torrent->id]) ->withErrors('Your Ratio Is To Low To Download!'); } // User's download rights are revoked if ($user->can_download == 0 && $torrent->user_id != $user->id) { - return redirect()->route('torrent', ['id' => $torrent->id]) + return \redirect()->route('torrent', ['id' => $torrent->id]) ->withErrors('Your Download Rights Have Been Revoked!'); } // Torrent Status Is Rejected if ($torrent->isRejected()) { - return redirect()->route('torrent', ['id' => $torrent->id]) + return \redirect()->route('torrent', ['id' => $torrent->id]) ->withErrors('This Torrent Has Been Rejected By Staff'); } // Define the filename for the download - $tmpFileName = str_replace([' ', '/', '\\'], ['.', '-', '-'], '['.config('torrent.source').']'.$torrent->name.'.torrent'); + $tmpFileName = \str_replace([' ', '/', '\\'], ['.', '-', '-'], '['.\config('torrent.source').']'.$torrent->name.'.torrent'); // The torrent file exist ? - if (! file_exists(getcwd().'/files/torrents/'.$torrent->file_name)) { - return redirect()->route('torrent', ['id' => $torrent->id]) + if (! \file_exists(\getcwd().'/files/torrents/'.$torrent->file_name)) { + return \redirect()->route('torrent', ['id' => $torrent->id]) ->withErrors('Torrent File Not Found! Please Report This Torrent!'); } // Delete the last torrent tmp file - if (file_exists(getcwd().'/files/tmp/'.$tmpFileName)) { - unlink(getcwd().'/files/tmp/'.$tmpFileName); + if (\file_exists(\getcwd().'/files/tmp/'.$tmpFileName)) { + \unlink(\getcwd().'/files/tmp/'.$tmpFileName); } // Get the content of the torrent - $dict = Bencode::bdecode(file_get_contents(getcwd().'/files/torrents/'.$torrent->file_name)); + $dict = Bencode::bdecode(\file_get_contents(\getcwd().'/files/torrents/'.$torrent->file_name)); if ($request->user() || ($rsskey && $user)) { // Set the announce key and add the user passkey - $dict['announce'] = route('announce', ['passkey' => $user->passkey]); + $dict['announce'] = \route('announce', ['passkey' => $user->passkey]); // Remove Other announce url unset($dict['announce-list']); } else { - return redirect()->route('login'); + return \redirect()->route('login'); } $fileToDownload = Bencode::bencode($dict); - file_put_contents(getcwd().'/files/tmp/'.$tmpFileName, $fileToDownload); + \file_put_contents(\getcwd().'/files/tmp/'.$tmpFileName, $fileToDownload); - return response()->download(getcwd().'/files/tmp/'.$tmpFileName)->deleteFileAfterSend(true); + return \response()->download(\getcwd().'/files/tmp/'.$tmpFileName)->deleteFileAfterSend(true); } /** @@ -1525,29 +1525,29 @@ public function bumpTorrent(Request $request, $id) { $user = $request->user(); - abort_unless($user->group->is_modo || $user->group->is_internal, 403); + \abort_unless($user->group->is_modo || $user->group->is_internal, 403); $torrent = Torrent::withAnyStatus()->findOrFail($id); $torrent->created_at = Carbon::now(); $torrent->save(); // Announce To Chat - $torrent_url = href_torrent($torrent); - $profile_url = href_profile($user); + $torrent_url = \href_torrent($torrent); + $profile_url = \href_profile($user); $this->chatRepository->systemMessage( - sprintf('Attention, [url=%s]%s[/url] has been bumped to the top by [url=%s]%s[/url]! It could use more seeds!', $torrent_url, $torrent->name, $profile_url, $user->username) + \sprintf('Attention, [url=%s]%s[/url] has been bumped to the top by [url=%s]%s[/url]! It could use more seeds!', $torrent_url, $torrent->name, $profile_url, $user->username) ); // Announce To IRC - if (config('irc-bot.enabled') == true) { - $appname = config('app.name'); + if (\config('irc-bot.enabled') == true) { + $appname = \config('app.name'); $ircAnnounceBot = new IRCAnnounceBot(); $ircAnnounceBot->message('#announce', '['.$appname.'] User '.$user->username.' has bumped '.$torrent->name.' , it could use more seeds!'); $ircAnnounceBot->message('#announce', '[Category: '.$torrent->category->name.'] [Type: '.$torrent->type->name.'] [Size:'.$torrent->getSize().']'); - $ircAnnounceBot->message('#announce', sprintf('[Link: %s]', $torrent_url)); + $ircAnnounceBot->message('#announce', \sprintf('[Link: %s]', $torrent_url)); } - return redirect()->route('torrent', ['id' => $torrent->id]) + return \redirect()->route('torrent', ['id' => $torrent->id]) ->withSuccess('Torrent Has Been Bumped To The Top Successfully!'); } @@ -1563,12 +1563,12 @@ public function sticky(Request $request, $id) { $user = $request->user(); - abort_unless($user->group->is_modo || $user->group->is_internal, 403); + \abort_unless($user->group->is_modo || $user->group->is_internal, 403); $torrent = Torrent::withAnyStatus()->findOrFail($id); $torrent->sticky = $torrent->sticky == 0 ? '1' : '0'; $torrent->save(); - return redirect()->route('torrent', ['id' => $torrent->id]) + return \redirect()->route('torrent', ['id' => $torrent->id]) ->withSuccess('Torrent Sticky Status Has Been Adjusted!'); } @@ -1584,27 +1584,27 @@ public function grantFL(Request $request, $id) { $user = $request->user(); - abort_unless($user->group->is_modo || $user->group->is_internal, 403); + \abort_unless($user->group->is_modo || $user->group->is_internal, 403); $torrent = Torrent::withAnyStatus()->findOrFail($id); - $torrent_url = href_torrent($torrent); + $torrent_url = \href_torrent($torrent); if ($torrent->free == 0) { $torrent->free = '1'; $this->chatRepository->systemMessage( - sprintf('Ladies and Gents, [url=%s]%s[/url] has been granted 100%% FreeLeech! Grab It While You Can! :fire:', $torrent_url, $torrent->name) + \sprintf('Ladies and Gents, [url=%s]%s[/url] has been granted 100%% FreeLeech! Grab It While You Can! :fire:', $torrent_url, $torrent->name) ); } else { $torrent->free = '0'; $this->chatRepository->systemMessage( - sprintf('Ladies and Gents, [url=%s]%s[/url] has been revoked of its 100%% FreeLeech! :poop:', $torrent_url, $torrent->name) + \sprintf('Ladies and Gents, [url=%s]%s[/url] has been revoked of its 100%% FreeLeech! :poop:', $torrent_url, $torrent->name) ); } $torrent->save(); - return redirect()->route('torrent', ['id' => $torrent->id]) + return \redirect()->route('torrent', ['id' => $torrent->id]) ->withSuccess('Torrent FL Has Been Adjusted!'); } @@ -1620,7 +1620,7 @@ public function grantFeatured(Request $request, $id) { $user = $request->user(); - abort_unless($user->group->is_modo || $user->group->is_internal, 403); + \abort_unless($user->group->is_modo || $user->group->is_internal, 403); $torrent = Torrent::withAnyStatus()->findOrFail($id); if ($torrent->featured == 0) { @@ -1634,17 +1634,17 @@ public function grantFeatured(Request $request, $id) $featured->torrent_id = $torrent->id; $featured->save(); - $torrent_url = href_torrent($torrent); - $profile_url = href_profile($user); + $torrent_url = \href_torrent($torrent); + $profile_url = \href_profile($user); $this->chatRepository->systemMessage( - sprintf('Ladies and Gents, [url=%s]%s[/url] has been added to the Featured Torrents Slider by [url=%s]%s[/url]! Grab It While You Can! :fire:', $torrent_url, $torrent->name, $profile_url, $user->username) + \sprintf('Ladies and Gents, [url=%s]%s[/url] has been added to the Featured Torrents Slider by [url=%s]%s[/url]! Grab It While You Can! :fire:', $torrent_url, $torrent->name, $profile_url, $user->username) ); - return redirect()->route('torrent', ['id' => $torrent->id]) + return \redirect()->route('torrent', ['id' => $torrent->id]) ->withSuccess('Torrent Is Now Featured!'); } - return redirect()->route('torrent', ['id' => $torrent->id]) + return \redirect()->route('torrent', ['id' => $torrent->id]) ->withErrors('Torrent Is Already Featured!'); } @@ -1660,25 +1660,25 @@ public function grantDoubleUp(Request $request, $id) { $user = $request->user(); - abort_unless($user->group->is_modo || $user->group->is_internal, 403); + \abort_unless($user->group->is_modo || $user->group->is_internal, 403); $torrent = Torrent::withAnyStatus()->findOrFail($id); - $torrent_url = href_torrent($torrent); + $torrent_url = \href_torrent($torrent); if ($torrent->doubleup == 0) { $torrent->doubleup = '1'; $this->chatRepository->systemMessage( - sprintf('Ladies and Gents, [url=%s]%s[/url] has been granted Double Upload! Grab It While You Can! :fire:', $torrent_url, $torrent->name) + \sprintf('Ladies and Gents, [url=%s]%s[/url] has been granted Double Upload! Grab It While You Can! :fire:', $torrent_url, $torrent->name) ); } else { $torrent->doubleup = '0'; $this->chatRepository->systemMessage( - sprintf('Ladies and Gents, [url=%s]%s[/url] has been revoked of its Double Upload! :poop:', $torrent_url, $torrent->name) + \sprintf('Ladies and Gents, [url=%s]%s[/url] has been revoked of its Double Upload! :poop:', $torrent_url, $torrent->name) ); } $torrent->save(); - return redirect()->route('torrent', ['id' => $torrent->id]) + return \redirect()->route('torrent', ['id' => $torrent->id]) ->withSuccess('Torrent DoubleUpload Has Been Adjusted!'); } @@ -1692,7 +1692,7 @@ public function grantDoubleUp(Request $request, $id) */ public function reseedTorrent(Request $request, $id) { - $appurl = config('app.url'); + $appurl = \config('app.url'); $user = $request->user(); $torrent = Torrent::findOrFail($id); $reseed = History::where('info_hash', '=', $torrent->info_hash)->where('active', '=', 0)->get(); @@ -1703,18 +1703,18 @@ public function reseedTorrent(Request $request, $id) User::find($r->user_id)->notify(new NewReseedRequest($torrent)); } - $torrent_url = href_torrent($torrent); - $profile_url = href_profile($user); + $torrent_url = \href_torrent($torrent); + $profile_url = \href_profile($user); $this->chatRepository->systemMessage( - sprintf('Ladies and Gents, a reseed request was just placed on [url=%s]%s[/url] can you help out :question:', $torrent_url, $torrent->name) + \sprintf('Ladies and Gents, a reseed request was just placed on [url=%s]%s[/url] can you help out :question:', $torrent_url, $torrent->name) ); - return redirect()->route('torrent', ['id' => $torrent->id]) + return \redirect()->route('torrent', ['id' => $torrent->id]) ->withSuccess('A notification has been sent to all users that downloaded this torrent along with original uploader!'); } - return redirect()->route('torrent', ['id' => $torrent->id]) + return \redirect()->route('torrent', ['id' => $torrent->id]) ->withErrors('This torrent doesnt meet the rules for a reseed request.'); } @@ -1741,11 +1741,11 @@ public function freeleechToken(Request $request, $id) $user->fl_tokens -= '1'; $user->save(); - return redirect()->route('torrent', ['id' => $torrent->id]) + return \redirect()->route('torrent', ['id' => $torrent->id]) ->withSuccess('You Have Successfully Activated A Freeleech Token For This Torrent!'); } - return redirect()->route('torrent', ['id' => $torrent->id]) + return \redirect()->route('torrent', ['id' => $torrent->id]) ->withErrors('You Dont Have Enough Freeleech Tokens Or Already Have One Activated On This Torrent.'); } } diff --git a/app/Http/Controllers/UserController.php b/app/Http/Controllers/UserController.php index 4a7eeaf311..b13fae54ba 100644 --- a/app/Http/Controllers/UserController.php +++ b/app/Http/Controllers/UserController.php @@ -54,7 +54,7 @@ public function show($username) $groups = Group::all(); $followers = Follow::where('target_id', '=', $user->id)->latest()->limit(25)->get(); $history = $user->history; - $warnings = Warning::where('user_id', '=', $user->id)->whereNotNull('torrent')->where('active', '=', 1)->take(config('hitrun.max_warnings'))->get(); + $warnings = Warning::where('user_id', '=', $user->id)->whereNotNull('torrent')->where('active', '=', 1)->take(\config('hitrun.max_warnings'))->get(); $hitrun = Warning::where('user_id', '=', $user->id)->latest()->paginate(10); $bonupload = BonTransactions::where('sender', '=', $user->id)->where([['name', 'like', '%Upload%']])->sum('cost'); @@ -68,7 +68,7 @@ public function show($username) $requested = TorrentRequest::where('user_id', '=', $user->id)->count(); $filled = TorrentRequest::where('filled_by', '=', $user->id)->whereNotNull('approved_by')->count(); - return view('user.profile', [ + return \view('user.profile', [ 'route' => 'profile', 'user' => $user, 'groups' => $groups, @@ -98,7 +98,7 @@ public function followers($username) $user = User::where('username', '=', $username)->firstOrFail(); $results = Follow::with('user')->where('target_id', '=', $user->id)->latest()->paginate(25); - return view('user.followers', [ + return \view('user.followers', [ 'route' => 'follower', 'results' => $results, 'user' => $user, @@ -117,7 +117,7 @@ public function topics($username) $user = User::where('username', '=', $username)->firstOrFail(); $results = Topic::where('topics.first_post_user_id', '=', $user->id)->latest()->paginate(25); - return view('user.topics', [ + return \view('user.topics', [ 'route' => 'forum', 'results' => $results, 'user' => $user, @@ -136,7 +136,7 @@ public function posts($username) $user = User::where('username', '=', $username)->firstOrFail(); $results = Post::selectRaw('posts.id as id,posts.*')->with(['topic', 'user'])->leftJoin('topics', 'posts.topic_id', '=', 'topics.id')->where('posts.user_id', '=', $user->id)->orderBy('posts.created_at', 'desc')->paginate(25); - return view('user.posts', [ + return \view('user.posts', [ 'route' => 'forum', 'results' => $results, 'user' => $user, @@ -155,9 +155,9 @@ public function editProfileForm(Request $request, $username) { $user = User::where('username', '=', $username)->firstOrFail(); - abort_unless($request->user()->id == $user->id, 403); + \abort_unless($request->user()->id == $user->id, 403); - return view('user.edit_profile', ['user' => $user, 'route' => 'edit']); + return \view('user.edit_profile', ['user' => $user, 'route' => 'edit']); } /** @@ -172,32 +172,32 @@ public function editProfile(Request $request, $username) { $user = User::where('username', '=', $username)->firstOrFail(); - abort_unless($request->user()->id == $user->id, 403); + \abort_unless($request->user()->id == $user->id, 403); // Avatar - $max_upload = config('image.max_upload_size'); + $max_upload = \config('image.max_upload_size'); if ($request->hasFile('image') && $request->file('image')->getError() === 0) { $image = $request->file('image'); - if (in_array($image->getClientOriginalExtension(), ['jpg', 'JPG', 'jpeg', 'bmp', 'png', 'PNG', 'tiff', 'gif']) && preg_match('#image/*#', $image->getMimeType())) { + if (\in_array($image->getClientOriginalExtension(), ['jpg', 'JPG', 'jpeg', 'bmp', 'png', 'PNG', 'tiff', 'gif']) && \preg_match('#image/*#', $image->getMimeType())) { if ($max_upload >= $image->getSize()) { $filename = $user->username.'.'.$image->getClientOriginalExtension(); - $path = public_path('/files/img/'.$filename); + $path = \public_path('/files/img/'.$filename); if ($image->getClientOriginalExtension() !== 'gif') { Image::make($image->getRealPath())->fit(150, 150)->encode('png', 100)->save($path); } else { - $v = validator($request->all(), [ + $v = \validator($request->all(), [ 'image' => 'dimensions:ratio=1/1', ]); if ($v->passes()) { - $image->move(public_path('/files/img/'), $filename); + $image->move(\public_path('/files/img/'), $filename); } else { - return redirect()->route('users.show', ['username' => $user->username]) + return \redirect()->route('users.show', ['username' => $user->username]) ->withErrors('Because you are uploading a GIF, your avatar must be square!'); } } $user->image = $user->username.'.'.$image->getClientOriginalExtension(); } else { - return redirect()->route('users.show', ['username' => $user->username]) + return \redirect()->route('users.show', ['username' => $user->username]) ->withErrors('Your avatar is too large, max file size: '.($max_upload / 1_000_000).' MB'); } } @@ -208,7 +208,7 @@ public function editProfile(Request $request, $username) $user->signature = $request->input('signature'); $user->save(); - return redirect()->route('user_edit_profile_form', ['username' => $user->username]) + return \redirect()->route('user_edit_profile_form', ['username' => $user->username]) ->withSuccess('Your Account Was Updated Successfully!'); } @@ -224,9 +224,9 @@ public function settings(Request $request, $username) { $user = User::where('username', '=', $username)->firstOrFail(); - abort_unless($request->user()->id == $user->id, 403); + \abort_unless($request->user()->id == $user->id, 403); - return view('user.settings', ['user' => $user, 'route' => 'settings']); + return \view('user.settings', ['user' => $user, 'route' => 'settings']); } /** @@ -241,7 +241,7 @@ public function changeSettings(Request $request, $username) { $user = User::where('username', '=', $username)->firstOrFail(); - abort_unless($request->user()->id == $user->id, 403); + \abort_unless($request->user()->id == $user->id, 403); // General Settings $user->censor = $request->input('censor'); @@ -250,8 +250,8 @@ public function changeSettings(Request $request, $username) // Style Settings $user->style = (int) $request->input('theme'); $css_url = $request->input('custom_css'); - if (isset($css_url) && ! filter_var($css_url, FILTER_VALIDATE_URL)) { - return redirect()->route('users.show', ['username' => $user->username]) + if (isset($css_url) && ! \filter_var($css_url, FILTER_VALIDATE_URL)) { + return \redirect()->route('users.show', ['username' => $user->username]) ->withErrors('The URL for the external CSS stylesheet is invalid, try it again with a valid URL.'); } $user->custom_css = $css_url; @@ -263,7 +263,7 @@ public function changeSettings(Request $request, $username) $user->ratings = $request->input('ratings'); $user->save(); - return redirect()->route('user_settings', ['username' => $user->username]) + return \redirect()->route('user_settings', ['username' => $user->username]) ->withSuccess('Your Account Was Updated Successfully!'); } @@ -279,9 +279,9 @@ public function security(Request $request, $username) { $user = User::where('username', '=', $username)->firstOrFail(); - abort_unless($request->user()->id == $user->id, 403); + \abort_unless($request->user()->id == $user->id, 403); - return view('user.security', ['user' => $user]); + return \view('user.security', ['user' => $user]); } /** @@ -293,13 +293,13 @@ public function security(Request $request, $username) */ protected function changeTwoStep(Request $request) { - $user = auth()->user(); + $user = \auth()->user(); - abort_unless(config('auth.TwoStepEnabled') == true, 403); + \abort_unless(\config('auth.TwoStepEnabled') == true, 403); $user->twostep = $request->input('twostep'); $user->save(); - return redirect()->route('users.show', ['username' => $user->username]) + return \redirect()->route('users.show', ['username' => $user->username]) ->withSuccess('You Changed Your TwoStep Auth Status!'); } @@ -315,9 +315,9 @@ protected function changePassword(Request $request, $username) { $user = User::where('username', '=', $username)->firstOrFail(); - abort_unless($request->user()->id == $user->id, 403); + \abort_unless($request->user()->id == $user->id, 403); - $v = validator($request->all(), [ + $v = \validator($request->all(), [ 'current_password' => 'required', 'new_password' => 'required|min:6|confirmed', 'new_password_confirmation' => 'required|min:6', @@ -327,14 +327,14 @@ protected function changePassword(Request $request, $username) $user->password = Hash::make($request->input('new_password')); $user->save(); - return redirect()->route('home.index')->withSuccess('Your Password Has Been Reset'); + return \redirect()->route('home.index')->withSuccess('Your Password Has Been Reset'); } - return redirect()->route('user_security', ['username' => $user->username, 'hash' => '#password']) + return \redirect()->route('user_security', ['username' => $user->username, 'hash' => '#password']) ->withErrors('Your Password Was Incorrect!'); } - return redirect()->route('user_security', ['username' => $user->username, 'hash' => '#password']) + return \redirect()->route('user_security', ['username' => $user->username, 'hash' => '#password']) ->withErrors('Your New Password Is To Weak!'); } @@ -350,26 +350,26 @@ protected function changeEmail(Request $request, $username) { $user = User::where('username', '=', $username)->firstOrFail(); - abort_unless($request->user()->id == $user->id, 403); + \abort_unless($request->user()->id == $user->id, 403); - if (config('email-blacklist.enabled') == true) { - $v = validator($request->all(), [ + if (\config('email-blacklist.enabled') == true) { + $v = \validator($request->all(), [ 'email' => 'required|string|email|max:70|blacklist|unique:users', ]); } else { - $v = validator($request->all(), [ + $v = \validator($request->all(), [ 'email' => 'required|string|email|max:70|unique:users', ]); } if ($v->fails()) { - return redirect()->route('user_security', ['username' => $user->username, 'hash' => '#email']) + return \redirect()->route('user_security', ['username' => $user->username, 'hash' => '#email']) ->withErrors($v->errors()); } $user->email = $request->input('email'); $user->save(); - return redirect()->route('user_security', ['username' => $user->username, 'hash' => '#email']) + return \redirect()->route('user_security', ['username' => $user->username, 'hash' => '#email']) ->withSuccess('Your Email Was Updated Successfully!'); } @@ -385,12 +385,12 @@ public function makePrivate(Request $request, $username) { $user = User::where('username', '=', $username)->firstOrFail(); - abort_unless($request->user()->id == $user->id, 403); + \abort_unless($request->user()->id == $user->id, 403); $user->private_profile = 1; $user->save(); - return redirect()->route('users.show', ['username' => $user->username]) + return \redirect()->route('users.show', ['username' => $user->username]) ->withSuccess('You Have Gone Private!'); } @@ -406,12 +406,12 @@ public function makePublic(Request $request, $username) { $user = User::where('username', '=', $username)->firstOrFail(); - abort_unless($request->user()->id == $user->id, 403); + \abort_unless($request->user()->id == $user->id, 403); $user->private_profile = 0; $user->save(); - return redirect()->route('users.show', ['username' => $user->username]) + return \redirect()->route('users.show', ['username' => $user->username]) ->withSuccess('You Have Gone Public!'); } @@ -427,12 +427,12 @@ public function disableNotifications(Request $request, $username) { $user = User::where('username', '=', $username)->firstOrFail(); - abort_unless($request->user()->id == $user->id, 403); + \abort_unless($request->user()->id == $user->id, 403); $user->block_notifications = 1; $user->save(); - return redirect()->route('users.show', ['username' => $user->username]) + return \redirect()->route('users.show', ['username' => $user->username]) ->withSuccess('You Have Disabled Notifications!'); } @@ -448,12 +448,12 @@ public function enableNotifications(Request $request, $username) { $user = User::where('username', '=', $username)->firstOrFail(); - abort_unless($request->user()->id == $user->id, 403); + \abort_unless($request->user()->id == $user->id, 403); $user->block_notifications = 0; $user->save(); - return redirect()->route('users.show', ['username' => $user->username]) + return \redirect()->route('users.show', ['username' => $user->username]) ->withSuccess('You Have Enabled Notifications!'); } @@ -469,12 +469,12 @@ public function makeHidden(Request $request, $username) { $user = User::where('username', '=', $username)->firstOrFail(); - abort_unless($request->user()->id == $user->id, 403); + \abort_unless($request->user()->id == $user->id, 403); $user->hidden = 1; $user->save(); - return redirect()->route('users.show', ['username' => $user->username]) + return \redirect()->route('users.show', ['username' => $user->username]) ->withSuccess('You Have Disappeared Like A Ninja!'); } @@ -490,12 +490,12 @@ public function makeVisible(Request $request, $username) { $user = User::where('username', '=', $username)->firstOrFail(); - abort_unless($request->user()->id == $user->id, 403); + \abort_unless($request->user()->id == $user->id, 403); $user->hidden = 0; $user->save(); - return redirect()->route('users.show', ['username' => $user->username]) + return \redirect()->route('users.show', ['username' => $user->username]) ->withSuccess('You Have Given Up Your Ninja Ways And Become Visible!'); } @@ -511,12 +511,12 @@ public function changePID(Request $request, $username) { $user = User::where('username', '=', $username)->firstOrFail(); - abort_unless($request->user()->id == $user->id, 403); + \abort_unless($request->user()->id == $user->id, 403); - $user->passkey = md5(uniqid().time().microtime()); + $user->passkey = \md5(\uniqid().\time().\microtime()); $user->save(); - return redirect()->route('user_security', ['username' => $user->username, 'hash' => '#pid']) + return \redirect()->route('user_security', ['username' => $user->username, 'hash' => '#pid']) ->withSuccess('Your PID Was Changed Successfully!'); } @@ -532,7 +532,7 @@ protected function changeOther(Request $request, $username) { $user = User::where('username', '=', $username)->firstOrFail(); - abort_unless($request->user()->id == $user->id, 403); + \abort_unless($request->user()->id == $user->id, 403); $privacy = $user->privacy; if (! $privacy) { @@ -544,13 +544,13 @@ protected function changeOther(Request $request, $username) $groups = Group::all(); $tomerge = []; foreach ($groups as $group) { - $tomerge[$group->id] = is_array($approved) && in_array($group->id, $approved) ? 1 : 0; + $tomerge[$group->id] = \is_array($approved) && \in_array($group->id, $approved) ? 1 : 0; } - $privacy->json_other_groups = array_merge($privacy->expected_groups, ['default_groups' => $tomerge]); + $privacy->json_other_groups = \array_merge($privacy->expected_groups, ['default_groups' => $tomerge]); $privacy->show_online = ($request->input('show_online') && $request->input('show_online') == 1 ? 1 : 0); $privacy->save(); - return redirect()->route('user_privacy', ['username' => $user->username, 'hash' => '#other']) + return \redirect()->route('user_privacy', ['username' => $user->username, 'hash' => '#other']) ->withSuccess('Your Other Privacy Settings Have Been Saved!'); } @@ -566,7 +566,7 @@ protected function changeRequest(Request $request, $username) { $user = User::where('username', '=', $username)->firstOrFail(); - abort_unless($request->user()->id == $user->id, 403); + \abort_unless($request->user()->id == $user->id, 403); $privacy = $user->privacy; if (! $privacy) { @@ -578,13 +578,13 @@ protected function changeRequest(Request $request, $username) $groups = Group::all(); $tomerge = []; foreach ($groups as $group) { - $tomerge[$group->id] = is_array($approved) && in_array($group->id, $approved) ? 1 : 0; + $tomerge[$group->id] = \is_array($approved) && \in_array($group->id, $approved) ? 1 : 0; } - $privacy->json_request_groups = array_merge($privacy->expected_groups, ['default_groups' => $tomerge]); + $privacy->json_request_groups = \array_merge($privacy->expected_groups, ['default_groups' => $tomerge]); $privacy->show_requested = ($request->input('show_requested') && $request->input('show_requested') == 1 ? 1 : 0); $privacy->save(); - return redirect()->route('user_privacy', ['username' => $user->username, 'hash' => '#request']) + return \redirect()->route('user_privacy', ['username' => $user->username, 'hash' => '#request']) ->withSuccess('Your Request Privacy Settings Have Been Saved!'); } @@ -600,7 +600,7 @@ protected function changeAchievement(Request $request, $username) { $user = User::where('username', '=', $username)->firstOrFail(); - abort_unless($request->user()->id == $user->id, 403); + \abort_unless($request->user()->id == $user->id, 403); $privacy = $user->privacy; if (! $privacy) { @@ -612,13 +612,13 @@ protected function changeAchievement(Request $request, $username) $groups = Group::all(); $tomerge = []; foreach ($groups as $group) { - $tomerge[$group->id] = is_array($approved) && in_array($group->id, $approved) ? 1 : 0; + $tomerge[$group->id] = \is_array($approved) && \in_array($group->id, $approved) ? 1 : 0; } - $privacy->json_achievement_groups = array_merge($privacy->expected_groups, ['default_groups' => $tomerge]); + $privacy->json_achievement_groups = \array_merge($privacy->expected_groups, ['default_groups' => $tomerge]); $privacy->show_achievement = ($request->input('show_achievement') && $request->input('show_achievement') == 1 ? 1 : 0); $privacy->save(); - return redirect()->route('user_privacy', ['username' => $user->username, 'hash' => '#achievement']) + return \redirect()->route('user_privacy', ['username' => $user->username, 'hash' => '#achievement']) ->withSuccess('Your Achievement Privacy Settings Have Been Saved!'); } @@ -634,7 +634,7 @@ protected function changeForum(Request $request, $username) { $user = User::where('username', '=', $username)->firstOrFail(); - abort_unless($request->user()->id == $user->id, 403); + \abort_unless($request->user()->id == $user->id, 403); $privacy = $user->privacy; if (! $privacy) { @@ -646,14 +646,14 @@ protected function changeForum(Request $request, $username) $groups = Group::all(); $tomerge = []; foreach ($groups as $group) { - $tomerge[$group->id] = is_array($approved) && in_array($group->id, $approved) ? 1 : 0; + $tomerge[$group->id] = \is_array($approved) && \in_array($group->id, $approved) ? 1 : 0; } - $privacy->json_forum_groups = array_merge($privacy->expected_groups, ['default_groups' => $tomerge]); + $privacy->json_forum_groups = \array_merge($privacy->expected_groups, ['default_groups' => $tomerge]); $privacy->show_topic = ($request->input('show_topic') && $request->input('show_topic') == 1 ? 1 : 0); $privacy->show_post = ($request->input('show_post') && $request->input('show_post') == 1 ? 1 : 0); $privacy->save(); - return redirect()->route('user_privacy', ['username' => $user->username, 'hash' => '#forum']) + return \redirect()->route('user_privacy', ['username' => $user->username, 'hash' => '#forum']) ->withSuccess('Your Forum History Privacy Settings Have Been Saved!'); } @@ -669,7 +669,7 @@ protected function changeFollower(Request $request, $username) { $user = User::where('username', '=', $username)->firstOrFail(); - abort_unless($request->user()->id == $user->id, 403); + \abort_unless($request->user()->id == $user->id, 403); $privacy = $user->privacy; if (! $privacy) { @@ -681,13 +681,13 @@ protected function changeFollower(Request $request, $username) $groups = Group::all(); $tomerge = []; foreach ($groups as $group) { - $tomerge[$group->id] = is_array($approved) && in_array($group->id, $approved) ? 1 : 0; + $tomerge[$group->id] = \is_array($approved) && \in_array($group->id, $approved) ? 1 : 0; } - $privacy->json_follower_groups = array_merge($privacy->expected_groups, ['default_groups' => $tomerge]); + $privacy->json_follower_groups = \array_merge($privacy->expected_groups, ['default_groups' => $tomerge]); $privacy->show_follower = ($request->input('show_follower') && $request->input('show_follower') == 1 ? 1 : 0); $privacy->save(); - return redirect()->route('user_privacy', ['username' => $user->username, 'hash' => '#follower']) + return \redirect()->route('user_privacy', ['username' => $user->username, 'hash' => '#follower']) ->withSuccess('Your Follower Privacy Settings Have Been Saved!'); } @@ -703,7 +703,7 @@ protected function changeTorrent(Request $request, $username) { $user = User::where('username', '=', $username)->firstOrFail(); - abort_unless($request->user()->id == $user->id, 403); + \abort_unless($request->user()->id == $user->id, 403); $privacy = $user->privacy; if (! $privacy) { @@ -715,9 +715,9 @@ protected function changeTorrent(Request $request, $username) $groups = Group::all(); $tomerge = []; foreach ($groups as $group) { - $tomerge[$group->id] = is_array($approved) && in_array($group->id, $approved) ? 1 : 0; + $tomerge[$group->id] = \is_array($approved) && \in_array($group->id, $approved) ? 1 : 0; } - $privacy->json_torrent_groups = array_merge($privacy->expected_groups, ['default_groups' => $tomerge]); + $privacy->json_torrent_groups = \array_merge($privacy->expected_groups, ['default_groups' => $tomerge]); $privacy->show_upload = ($request->input('show_upload') && $request->input('show_upload') == 1 ? 1 : 0); $privacy->show_download = ($request->input('show_download') && $request->input('show_download') == 1 ? 1 : 0); $privacy->show_peer = ($request->input('show_peer') && $request->input('show_peer') == 1 ? 1 : 0); @@ -726,7 +726,7 @@ protected function changeTorrent(Request $request, $username) $user->peer_hidden = 0; $user->save(); - return redirect()->route('user_privacy', ['username' => $user->username, 'hash' => '#torrent']) + return \redirect()->route('user_privacy', ['username' => $user->username, 'hash' => '#torrent']) ->withSuccess('Your Torrent History Privacy Settings Have Been Saved!'); } @@ -742,7 +742,7 @@ protected function changeAccountNotification(Request $request, $username) { $user = User::where('username', '=', $username)->firstOrFail(); - abort_unless($request->user()->id == $user->id, 403); + \abort_unless($request->user()->id == $user->id, 403); $notification = $user->notification; if (! $notification) { @@ -755,14 +755,14 @@ protected function changeAccountNotification(Request $request, $username) $groups = Group::all(); $tomerge = []; foreach ($groups as $group) { - $tomerge[$group->id] = is_array($approved) && in_array($group->id, $approved) ? 1 : 0; + $tomerge[$group->id] = \is_array($approved) && \in_array($group->id, $approved) ? 1 : 0; } - $notification->json_account_groups = array_merge($notification->expected_groups, ['default_groups' => $tomerge]); + $notification->json_account_groups = \array_merge($notification->expected_groups, ['default_groups' => $tomerge]); $notification->show_account_follow = ($request->input('show_account_follow') && $request->input('show_account_follow') == 1 ? 1 : 0); $notification->show_account_unfollow = ($request->input('show_account_unfollow') && $request->input('show_account_unfollow') == 1 ? 1 : 0); $notification->save(); - return redirect()->route('user_notification', ['username' => $user->username, 'hash' => '#account']) + return \redirect()->route('user_notification', ['username' => $user->username, 'hash' => '#account']) ->withSuccess('Your Account Notification Settings Have Been Saved!'); } @@ -778,7 +778,7 @@ protected function changeFollowingNotification(Request $request, $username) { $user = User::where('username', '=', $username)->firstOrFail(); - abort_unless($request->user()->id == $user->id, 403); + \abort_unless($request->user()->id == $user->id, 403); $notification = $user->notification; if (! $notification) { @@ -791,13 +791,13 @@ protected function changeFollowingNotification(Request $request, $username) $groups = Group::all(); $tomerge = []; foreach ($groups as $group) { - $tomerge[$group->id] = is_array($approved) && in_array($group->id, $approved) ? 1 : 0; + $tomerge[$group->id] = \is_array($approved) && \in_array($group->id, $approved) ? 1 : 0; } - $notification->json_following_groups = array_merge($notification->expected_groups, ['default_groups' => $tomerge]); + $notification->json_following_groups = \array_merge($notification->expected_groups, ['default_groups' => $tomerge]); $notification->show_following_upload = ($request->input('show_following_upload') && $request->input('show_following_upload') == 1 ? 1 : 0); $notification->save(); - return redirect()->route('user_notification', ['username' => $user->username, 'hash' => '#following']) + return \redirect()->route('user_notification', ['username' => $user->username, 'hash' => '#following']) ->withSuccess('Your Followed User Notification Settings Have Been Saved!'); } @@ -813,7 +813,7 @@ protected function changeBonNotification(Request $request, $username) { $user = User::where('username', '=', $username)->firstOrFail(); - abort_unless($request->user()->id == $user->id, 403); + \abort_unless($request->user()->id == $user->id, 403); $notification = $user->notification; if (! $notification) { @@ -826,13 +826,13 @@ protected function changeBonNotification(Request $request, $username) $groups = Group::all(); $tomerge = []; foreach ($groups as $group) { - $tomerge[$group->id] = is_array($approved) && in_array($group->id, $approved) ? 1 : 0; + $tomerge[$group->id] = \is_array($approved) && \in_array($group->id, $approved) ? 1 : 0; } - $notification->json_bon_groups = array_merge($notification->expected_groups, ['default_groups' => $tomerge]); + $notification->json_bon_groups = \array_merge($notification->expected_groups, ['default_groups' => $tomerge]); $notification->show_bon_gift = ($request->input('show_bon_gift') && $request->input('show_bon_gift') == 1 ? 1 : 0); $notification->save(); - return redirect()->route('user_notification', ['username' => $user->username, 'hash' => '#bon']) + return \redirect()->route('user_notification', ['username' => $user->username, 'hash' => '#bon']) ->withSuccess('Your BON Notification Settings Have Been Saved!'); } @@ -848,7 +848,7 @@ protected function changeSubscriptionNotification(Request $request, $username) { $user = User::where('username', '=', $username)->firstOrFail(); - abort_unless($request->user()->id == $user->id, 403); + \abort_unless($request->user()->id == $user->id, 403); $notification = $user->notification; if (! $notification) { @@ -861,14 +861,14 @@ protected function changeSubscriptionNotification(Request $request, $username) $groups = Group::all(); $tomerge = []; foreach ($groups as $group) { - $tomerge[$group->id] = is_array($approved) && in_array($group->id, $approved) ? 1 : 0; + $tomerge[$group->id] = \is_array($approved) && \in_array($group->id, $approved) ? 1 : 0; } - $notification->json_subscription_groups = array_merge($notification->expected_groups, ['default_groups' => $tomerge]); + $notification->json_subscription_groups = \array_merge($notification->expected_groups, ['default_groups' => $tomerge]); $notification->show_subscription_forum = ($request->input('show_subscription_forum') && $request->input('show_subscription_forum') == 1 ? 1 : 0); $notification->show_subscription_topic = ($request->input('show_subscription_topic') && $request->input('show_subscription_topic') == 1 ? 1 : 0); $notification->save(); - return redirect()->route('user_notification', ['username' => $user->username, 'hash' => '#subscription']) + return \redirect()->route('user_notification', ['username' => $user->username, 'hash' => '#subscription']) ->withSuccess('Your Subscription Notification Settings Have Been Saved!'); } @@ -884,7 +884,7 @@ protected function changeRequestNotification(Request $request, $username) { $user = User::where('username', '=', $username)->firstOrFail(); - abort_unless($request->user()->id == $user->id, 403); + \abort_unless($request->user()->id == $user->id, 403); $notification = $user->notification; if (! $notification) { @@ -897,9 +897,9 @@ protected function changeRequestNotification(Request $request, $username) $groups = Group::all(); $tomerge = []; foreach ($groups as $group) { - $tomerge[$group->id] = is_array($approved) && in_array($group->id, $approved) ? 1 : 0; + $tomerge[$group->id] = \is_array($approved) && \in_array($group->id, $approved) ? 1 : 0; } - $notification->json_request_groups = array_merge($notification->expected_groups, ['default_groups' => $tomerge]); + $notification->json_request_groups = \array_merge($notification->expected_groups, ['default_groups' => $tomerge]); $notification->show_request_comment = ($request->input('show_request_comment') && $request->input('show_request_comment') == 1 ? 1 : 0); $notification->show_request_bounty = ($request->input('show_request_bounty') && $request->input('show_request_bounty') == 1 ? 1 : 0); $notification->show_request_fill = ($request->input('show_request_fill') && $request->input('show_request_fill') == 1 ? 1 : 0); @@ -909,7 +909,7 @@ protected function changeRequestNotification(Request $request, $username) $notification->show_request_unclaim = ($request->input('show_request_unclaim') && $request->input('show_request_unclaim') == 1 ? 1 : 0); $notification->save(); - return redirect()->route('user_notification', ['username' => $user->username, 'hash' => '#request']) + return \redirect()->route('user_notification', ['username' => $user->username, 'hash' => '#request']) ->withSuccess('Your Request Notification Settings Have Been Saved!'); } @@ -925,7 +925,7 @@ protected function changeTorrentNotification(Request $request, $username) { $user = User::where('username', '=', $username)->firstOrFail(); - abort_unless($request->user()->id == $user->id, 403); + \abort_unless($request->user()->id == $user->id, 403); $notification = $user->notification; if (! $notification) { @@ -938,15 +938,15 @@ protected function changeTorrentNotification(Request $request, $username) $groups = Group::all(); $tomerge = []; foreach ($groups as $group) { - $tomerge[$group->id] = is_array($approved) && in_array($group->id, $approved) ? 1 : 0; + $tomerge[$group->id] = \is_array($approved) && \in_array($group->id, $approved) ? 1 : 0; } - $notification->json_torrent_groups = array_merge($notification->expected_groups, ['default_groups' => $tomerge]); + $notification->json_torrent_groups = \array_merge($notification->expected_groups, ['default_groups' => $tomerge]); $notification->show_torrent_comment = ($request->input('show_torrent_comment') && $request->input('show_torrent_comment') == 1 ? 1 : 0); $notification->show_torrent_thank = ($request->input('show_torrent_thank') && $request->input('show_torrent_thank') == 1 ? 1 : 0); $notification->show_torrent_tip = ($request->input('show_torrent_tip') && $request->input('show_torrent_tip') == 1 ? 1 : 0); $notification->save(); - return redirect()->route('user_notification', ['username' => $user->username, 'hash' => '#torrent']) + return \redirect()->route('user_notification', ['username' => $user->username, 'hash' => '#torrent']) ->withSuccess('Your Torrent Notification Settings Have Been Saved!'); } @@ -962,7 +962,7 @@ protected function changeMentionNotification(Request $request, $username) { $user = User::where('username', '=', $username)->firstOrFail(); - abort_unless($request->user()->id == $user->id, 403); + \abort_unless($request->user()->id == $user->id, 403); $notification = $user->notification; if (! $notification) { @@ -975,9 +975,9 @@ protected function changeMentionNotification(Request $request, $username) $groups = Group::all(); $tomerge = []; foreach ($groups as $group) { - $tomerge[$group->id] = is_array($approved) && in_array($group->id, $approved) ? 1 : 0; + $tomerge[$group->id] = \is_array($approved) && \in_array($group->id, $approved) ? 1 : 0; } - $notification->json_mention_groups = array_merge($notification->expected_groups, ['default_groups' => $tomerge]); + $notification->json_mention_groups = \array_merge($notification->expected_groups, ['default_groups' => $tomerge]); $notification->show_mention_torrent_comment = ($request->input('show_mention_torrent_comment') && $request->input('show_mention_torrent_comment') == 1 ? 1 : 0); $notification->show_mention_request_comment = ($request->input('show_mention_request_comment') && $request->input('show_mention_request_comment') == 1 ? 1 : 0); $notification->show_mention_article_comment = ($request->input('show_mention_article_comment') && $request->input('show_mention_article_comment') == 1 ? 1 : 0); @@ -985,7 +985,7 @@ protected function changeMentionNotification(Request $request, $username) $notification->save(); - return redirect()->route('user_notification', ['username' => $user->username, 'hash' => '#mention']) + return \redirect()->route('user_notification', ['username' => $user->username, 'hash' => '#mention']) ->withSuccess('Your @Mention Notification Settings Have Been Saved!'); } @@ -1001,7 +1001,7 @@ protected function changeForumNotification(Request $request, $username) { $user = User::where('username', '=', $username)->firstOrFail(); - abort_unless($request->user()->id == $user->id, 403); + \abort_unless($request->user()->id == $user->id, 403); $notification = $user->notification; if (! $notification) { @@ -1014,13 +1014,13 @@ protected function changeForumNotification(Request $request, $username) $groups = Group::all(); $tomerge = []; foreach ($groups as $group) { - $tomerge[$group->id] = is_array($approved) && in_array($group->id, $approved) ? 1 : 0; + $tomerge[$group->id] = \is_array($approved) && \in_array($group->id, $approved) ? 1 : 0; } - $notification->json_forum_groups = array_merge($notification->expected_groups, ['default_groups' => $tomerge]); + $notification->json_forum_groups = \array_merge($notification->expected_groups, ['default_groups' => $tomerge]); $notification->show_forum_topic = ($request->input('show_forum_topic') && $request->input('show_forum_topic') == 1 ? 1 : 0); $notification->save(); - return redirect()->route('user_notification', ['username' => $user->username, 'hash' => '#forum']) + return \redirect()->route('user_notification', ['username' => $user->username, 'hash' => '#forum']) ->withSuccess('Your Forum Notification Settings Have Been Saved!'); } @@ -1036,7 +1036,7 @@ protected function changeProfile(Request $request, $username) { $user = User::where('username', '=', $username)->firstOrFail(); - abort_unless($request->user()->id == $user->id, 403); + \abort_unless($request->user()->id == $user->id, 403); $privacy = $user->privacy; if (! $privacy) { @@ -1049,9 +1049,9 @@ protected function changeProfile(Request $request, $username) $groups = Group::all(); $tomerge = []; foreach ($groups as $group) { - $tomerge[$group->id] = is_array($approved) && in_array($group->id, $approved) ? 1 : 0; + $tomerge[$group->id] = \is_array($approved) && \in_array($group->id, $approved) ? 1 : 0; } - $privacy->json_profile_groups = array_merge($privacy->expected_groups, ['default_groups' => $tomerge]); + $privacy->json_profile_groups = \array_merge($privacy->expected_groups, ['default_groups' => $tomerge]); $privacy->show_profile_torrent_count = ($request->input('show_profile_torrent_count') && $request->input('show_profile_torrent_count') == 1 ? 1 : 0); $privacy->show_profile_torrent_ratio = ($request->input('show_profile_torrent_ratio') && $request->input('show_profile_torrent_ratio') == 1 ? 1 : 0); $privacy->show_profile_torrent_seed = ($request->input('show_profile_torrent_seed') && $request->input('show_profile_torrent_seed') == 1 ? 1 : 0); @@ -1068,7 +1068,7 @@ protected function changeProfile(Request $request, $username) $privacy->show_profile_warning = ($request->input('show_profile_warning') && $request->input('show_profile_warning') == 1 ? 1 : 0); $privacy->save(); - return redirect()->route('user_privacy', ['username' => $user->username, 'hash' => '#profile']) + return \redirect()->route('user_privacy', ['username' => $user->username, 'hash' => '#profile']) ->withSuccess('Your Profile Privacy Settings Have Been Saved!'); } @@ -1084,12 +1084,12 @@ public function changeRID(Request $request, $username) { $user = User::where('username', '=', $username)->firstOrFail(); - abort_unless($request->user()->id == $user->id, 403); + \abort_unless($request->user()->id == $user->id, 403); - $user->rsskey = md5(uniqid().time().microtime()); + $user->rsskey = \md5(\uniqid().\time().\microtime()); $user->save(); - return redirect()->route('user_security', ['username' => $user->username, 'hash' => '#rid']) + return \redirect()->route('user_security', ['username' => $user->username, 'hash' => '#rid']) ->withSuccess('Your RID Was Changed Successfully!'); } @@ -1105,12 +1105,12 @@ public function changeApiToken(Request $request, $username) { $user = User::where('username', '=', $username)->firstOrFail(); - abort_unless($request->user()->id == $user->id, 403); + \abort_unless($request->user()->id == $user->id, 403); $user->api_token = Str::random(100); $user->save(); - return redirect()->route('user_security', ['username' => $user->username, 'hash' => '#api']) + return \redirect()->route('user_security', ['username' => $user->username, 'hash' => '#api']) ->withSuccess('Your API Token Was Changed Successfully!'); } @@ -1126,11 +1126,11 @@ public function privacy(Request $request, $username) { $user = User::where('username', '=', $username)->firstOrFail(); - abort_unless($request->user()->id == $user->id, 403); + \abort_unless($request->user()->id == $user->id, 403); $groups = Group::where('level', '>', 0)->orderBy('level', 'desc')->get(); - return view('user.privacy', ['user' => $user, 'groups'=> $groups]); + return \view('user.privacy', ['user' => $user, 'groups'=> $groups]); } /** @@ -1145,11 +1145,11 @@ public function notification(Request $request, $username) { $user = User::where('username', '=', $username)->firstOrFail(); - abort_unless($request->user()->id == $user->id, 403); + \abort_unless($request->user()->id == $user->id, 403); $groups = Group::where('level', '>', 0)->orderBy('level', 'desc')->get(); - return view('user.notification', ['user' => $user, 'groups'=> $groups]); + return \view('user.notification', ['user' => $user, 'groups'=> $groups]); } /** @@ -1166,7 +1166,7 @@ public function myFilter(Request $request, $username) { $user = User::where('username', '=', $username)->firstOrFail(); - abort_unless($request->user()->group->is_modo || $request->user()->id == $user->id, 403); + \abort_unless($request->user()->group->is_modo || $request->user()->id == $user->id, 403); if ($request->has('view') && $request->input('view') == 'seeds') { $history = Peer::with(['torrent' => function ($query) { $query->withAnyStatus(); @@ -1236,7 +1236,7 @@ public function myFilter(Request $request, $username) $table = $history->orderBy($sorting, $order)->paginate(50); } - return view('user.filters.seeds', [ + return \view('user.filters.seeds', [ 'user' => $user, 'seeds' => $table, ])->render(); @@ -1288,7 +1288,7 @@ public function myFilter(Request $request, $username) $table = $torrentRequests->where('user_id', '=', $user->id)->orderBy($sorting, $order)->paginate(25); } - return view('user.filters.requests', [ + return \view('user.filters.requests', [ 'user' => $user, 'torrentRequests' => $table, ])->render(); @@ -1329,7 +1329,7 @@ public function myFilter(Request $request, $username) $table = $history->where('graveyard.user_id', '=', $user->id)->orderBy('torrents.'.$sorting, $order)->paginate(50); } - return view('user.filters.resurrections', [ + return \view('user.filters.resurrections', [ 'user' => $user, 'resurrections' => $table, ])->render(); @@ -1369,26 +1369,26 @@ public function myFilter(Request $request, $username) $table = $history->where('peers.user_id', '=', $user->id)->orderBy('torrents.'.$sorting, $order)->paginate(50); } - return view('user.filters.active', [ + return \view('user.filters.active', [ 'user' => $user, 'active' => $table, ])->render(); } elseif ($request->has('view') && $request->input('view') == 'unsatisfieds') { - if (config('hitrun.enabled') == true) { + if (\config('hitrun.enabled') == true) { $history = History::selectRaw('distinct(history.info_hash), max(torrents.id), max(history.completed_at) as completed_at, max(torrents.name) as name, max(history.created_at) as created_at, max(history.id) as id, max(history.user_id) as user_id, max(history.seedtime) as seedtime, max(history.seedtime) as satisfied_at, max(history.seeder) as seeder, max(torrents.size) as size,max(torrents.leechers) as leechers,max(torrents.seeders) as seeders,max(torrents.times_completed) as times_completed')->with(['torrent' => function ($query) { $query->withAnyStatus(); }])->leftJoin('torrents', 'torrents.info_hash', '=', 'history.info_hash')->where('actual_downloaded', '>', 0) - ->whereRaw('history.actual_downloaded > (torrents.size * ('.(config('hitrun.enabled') == true ? (config('hitrun.buffer') / 100) : 0).'))')->groupBy('history.info_hash'); + ->whereRaw('history.actual_downloaded > (torrents.size * ('.(\config('hitrun.enabled') == true ? (\config('hitrun.buffer') / 100) : 0).'))')->groupBy('history.info_hash'); } else { $history = History::selectRaw('distinct(history.info_hash), max(torrents.id), max(history.completed_at) as completed_at, max(torrents.name) as name, max(history.created_at) as created_at, max(history.id) as id, max(history.user_id) as user_id, max(history.seedtime) as seedtime, max(history.seedtime) as satisfied_at, max(history.seeder) as seeder, max(torrents.size) as size,max(torrents.leechers) as leechers,max(torrents.seeders) as seeders,max(torrents.times_completed) as times_completed')->with(['torrent' => function ($query) { $query->withAnyStatus(); }])->leftJoin('torrents', 'torrents.info_hash', '=', 'history.info_hash')->where('actual_downloaded', '>', 0) - ->whereRaw('history.actual_downloaded > (torrents.size * ('.(config('hitrun.enabled') == true ? (config('hitrun.buffer') / 100) : 0).'))')->groupBy('history.info_hash'); + ->whereRaw('history.actual_downloaded > (torrents.size * ('.(\config('hitrun.enabled') == true ? (\config('hitrun.buffer') / 100) : 0).'))')->groupBy('history.info_hash'); } $order = null; $sorting = null; - $history->whereRaw('(history.seedtime < ? and history.immune != 1)', [config('hitrun.seedtime')]); + $history->whereRaw('(history.seedtime < ? and history.immune != 1)', [\config('hitrun.seedtime')]); if ($request->has('name') && $request->input('name') != null) { $history->where('torrents.name', 'like', '%'.$request->input('name').'%'); @@ -1427,7 +1427,7 @@ public function myFilter(Request $request, $username) $table = $history->where('history.user_id', '=', $user->id)->orderBy($sorting, $order)->paginate(50); } - return view('user.filters.unsatisfieds', [ + return \view('user.filters.unsatisfieds', [ 'user' => $user, 'downloads' => $table, ])->render(); @@ -1435,16 +1435,16 @@ public function myFilter(Request $request, $username) $history = History::selectRaw('distinct(history.info_hash), max(history.completed_at) as completed_at, max(torrents.name) as name, max(history.created_at) as created_at, max(history.id) as id, max(history.user_id) as user_id, max(history.seedtime) as seedtime, max(history.seeder) as seeder, max(torrents.size) as size,max(torrents.leechers) as leechers,max(torrents.seeders) as seeders,max(torrents.times_completed) as times_completed')->with(['torrent' => function ($query) { $query->withAnyStatus(); }])->leftJoin('torrents', 'torrents.info_hash', '=', 'history.info_hash')->where('actual_downloaded', '>', 0) - ->whereRaw('history.actual_downloaded > (torrents.size * ('.(config('hitrun.enabled') == true ? (config('hitrun.buffer') / 100) : 0).'))')->groupBy('history.info_hash'); + ->whereRaw('history.actual_downloaded > (torrents.size * ('.(\config('hitrun.enabled') == true ? (\config('hitrun.buffer') / 100) : 0).'))')->groupBy('history.info_hash'); $order = null; $sorting = null; $history->where(function ($query) use ($request) { if ($request->has('satisfied') && $request->input('satisfied') != null) { - $query->orWhereRaw('(history.seedtime >= ? or history.immune = 1)', [config('hitrun.seedtime')]); + $query->orWhereRaw('(history.seedtime >= ? or history.immune = 1)', [\config('hitrun.seedtime')]); } if ($request->has('notsatisfied') && $request->input('notsatisfied') != null) { - $query->orWhereRaw('(history.seedtime < ? and history.immune != 1)', [config('hitrun.seedtime')]); + $query->orWhereRaw('(history.seedtime < ? and history.immune != 1)', [\config('hitrun.seedtime')]); } }); if ($request->has('name') && $request->input('name') != null) { @@ -1493,7 +1493,7 @@ public function myFilter(Request $request, $username) $table = $history->where('history.user_id', '=', $user->id)->orderBy($sorting, $order)->paginate(50); } - return view('user.filters.downloads', [ + return \view('user.filters.downloads', [ 'user' => $user, 'downloads' => $table, ])->render(); @@ -1550,7 +1550,7 @@ public function myFilter(Request $request, $username) $table = $history->orderBy($sorting, $order)->paginate(50); } - return view('user.filters.uploads', [ + return \view('user.filters.uploads', [ 'user' => $user, 'uploads' => $table, ])->render(); @@ -1604,7 +1604,7 @@ public function myFilter(Request $request, $username) $table = $history->where('history.user_id', '=', $user->id)->orderBy($sorting, $order)->paginate(50); - return view('user.filters.history', [ + return \view('user.filters.history', [ 'user' => $user, 'history' => $table, ])->render(); @@ -1632,11 +1632,11 @@ public function downloads(Request $request, $username) $logger = 'user.private.downloads'; - if (config('hitrun.enabled') == true) { + if (\config('hitrun.enabled') == true) { $downloads = History::selectRaw('distinct(history.info_hash), max(torrents.id), max(history.completed_at) as completed_at, max(history.created_at) as created_at, max(history.id) as id, max(history.user_id) as user_id, max(history.seedtime) as seedtime, max(history.seeder) as seeder, max(torrents.size) as size,max(torrents.leechers) as leechers,max(torrents.seeders) as seeders,max(torrents.times_completed) as times_completed')->with(['torrent' => function ($query) { $query->withAnyStatus(); }])->leftJoin('torrents', 'torrents.info_hash', '=', 'history.info_hash')->where('actual_downloaded', '>', 0) - ->whereRaw('history.actual_downloaded > (torrents.size * ('.(config('hitrun.buffer') / 100).'))') + ->whereRaw('history.actual_downloaded > (torrents.size * ('.(\config('hitrun.buffer') / 100).'))') ->where('history.user_id', '=', $user->id)->groupBy('history.info_hash')->orderBy('completed_at', 'desc') ->paginate(50); } else { @@ -1647,7 +1647,7 @@ public function downloads(Request $request, $username) ->paginate(50); } - return view($logger, [ + return \view($logger, [ 'route' => 'downloads', 'user' => $user, 'downloads' => $downloads, @@ -1658,11 +1658,11 @@ public function downloads(Request $request, $username) ]); } $logger = 'user.downloads'; - if (config('hitrun.enabled') == true) { + if (\config('hitrun.enabled') == true) { $downloads = History::with(['torrent' => function ($query) { $query->withAnyStatus(); }])->selectRaw('distinct(history.info_hash), max(torrents.id), max(history.completed_at) as completed_at, max(history.created_at) as created_at, max(history.id) as id, max(history.user_id) as user_id, max(history.seedtime) as seedtime, max(history.seeder) as seeder, max(torrents.size) as size,max(torrents.leechers) as leechers,max(torrents.seeders) as seeders,max(torrents.times_completed) as times_completed')->leftJoin('torrents', 'torrents.info_hash', '=', 'history.info_hash')->where('actual_downloaded', '>', 0) - ->whereRaw('history.actual_downloaded > (torrents.size * ('.(config('hitrun.buffer') / 100).'))') + ->whereRaw('history.actual_downloaded > (torrents.size * ('.(\config('hitrun.buffer') / 100).'))') ->where('history.user_id', '=', $user->id) ->groupBy('history.info_hash')->orderBy('completed_at', 'desc') ->paginate(50); @@ -1675,7 +1675,7 @@ public function downloads(Request $request, $username) ->paginate(50); } - return view($logger, [ + return \view($logger, [ 'route' => 'downloads', 'user' => $user, 'downloads' => $downloads, @@ -1698,7 +1698,7 @@ public function requested(Request $request, $username) $torrentRequests = TorrentRequest::with(['user', 'category', 'type'])->where('user_id', '=', $user->id)->latest()->paginate(25); - return view($logger, [ + return \view($logger, [ 'route' => 'requests', 'user' => $user, 'torrentRequests' => $torrentRequests, @@ -1707,7 +1707,7 @@ public function requested(Request $request, $username) $logger = 'user.requests'; $torrentRequests = TorrentRequest::with(['user', 'category', 'type'])->where('user_id', '=', $user->id)->where('anon', '!=', 1)->latest()->paginate(25); - return view($logger, [ + return \view($logger, [ 'route' => 'requests', 'user' => $user, 'torrentRequests' => $torrentRequests, @@ -1726,31 +1726,31 @@ public function unsatisfieds(Request $request, $username) { $user = User::where('username', '=', $username)->firstOrFail(); - abort_unless($request->user()->group->is_modo || $request->user()->id == $user->id, 403); + \abort_unless($request->user()->group->is_modo || $request->user()->id == $user->id, 403); $his_upl = History::where('user_id', '=', $user->id)->sum('actual_uploaded'); $his_upl_cre = History::where('user_id', '=', $user->id)->sum('uploaded'); $his_downl = History::where('user_id', '=', $user->id)->sum('actual_downloaded'); $his_downl_cre = History::where('user_id', '=', $user->id)->sum('downloaded'); - if (config('hitrun.enabled') == true) { + if (\config('hitrun.enabled') == true) { $downloads = History::selectRaw('distinct(history.info_hash), max(torrents.name) as name, max(torrents.id), max(history.completed_at) as completed_at, max(history.created_at) as created_at, max(history.id) as id, max(history.user_id) as user_id, max(history.seedtime) as seedtime, max(history.seedtime) as satisfied_at, max(history.seeder) as seeder, max(torrents.size) as size,max(torrents.leechers) as leechers,max(torrents.seeders) as seeders,max(torrents.times_completed) as times_completed')->with(['torrent' => function ($query) { $query->withAnyStatus(); }])->leftJoin('torrents', 'torrents.info_hash', '=', 'history.info_hash') - ->whereRaw('history.actual_downloaded > (torrents.size * ('.(config('hitrun.buffer') / 100).'))') + ->whereRaw('history.actual_downloaded > (torrents.size * ('.(\config('hitrun.buffer') / 100).'))') ->where('history.user_id', '=', $user->id)->groupBy('history.info_hash')->orderBy('satisfied_at', 'desc') - ->whereRaw('(history.seedtime < ? and history.immune != 1)', [config('hitrun.seedtime')]) + ->whereRaw('(history.seedtime < ? and history.immune != 1)', [\config('hitrun.seedtime')]) ->paginate(50); } else { $downloads = History::selectRaw('distinct(history.info_hash), max(torrents.name) as name, max(torrents.id), max(history.completed_at) as completed_at, max(history.created_at) as created_at, max(history.id) as id, max(history.user_id) as user_id, max(history.seedtime) as seedtime, max(history.seedtime) as satisfied_at, max(history.seeder) as seeder, max(torrents.size) as size,max(torrents.leechers) as leechers,max(torrents.seeders) as seeders,max(torrents.times_completed) as times_completed')->with(['torrent' => function ($query) { $query->withAnyStatus(); }])->leftJoin('torrents', 'torrents.info_hash', '=', 'history.info_hash') - ->whereRaw('history.actual_downloaded > (torrents.size * ('.(config('hitrun.buffer') / 100).'))') + ->whereRaw('history.actual_downloaded > (torrents.size * ('.(\config('hitrun.buffer') / 100).'))') ->where('history.user_id', '=', $user->id)->groupBy('history.info_hash')->orderBy('satisfied_at', 'desc') - ->whereRaw('(history.seedtime < ? and history.immune != 1)', [config('hitrun.seedtime')]) + ->whereRaw('(history.seedtime < ? and history.immune != 1)', [\config('hitrun.seedtime')]) ->paginate(50); } - return view('user.private.unsatisfieds', [ + return \view('user.private.unsatisfieds', [ 'route' => 'unsatisfieds', 'user' => $user, 'downloads' => $downloads, @@ -1773,7 +1773,7 @@ public function torrents(Request $request, $username) { $user = User::where('username', '=', $username)->firstOrFail(); - abort_unless($request->user()->group->is_modo || $request->user()->id == $user->id, 403); + \abort_unless($request->user()->group->is_modo || $request->user()->id == $user->id, 403); $his_upl = History::where('user_id', '=', $user->id)->sum('actual_uploaded'); $his_upl_cre = History::where('user_id', '=', $user->id)->sum('uploaded'); $his_downl = History::where('user_id', '=', $user->id)->sum('actual_downloaded'); @@ -1783,7 +1783,7 @@ public function torrents(Request $request, $username) }])->selectRaw('distinct(history.id),max(history.info_hash) as info_hash,max(history.agent) as agent,max(history.uploaded) as uploaded,max(history.downloaded) as downloaded,max(history.seeder) as seeder,max(history.active) as active,max(history.actual_uploaded) as actual_uploaded,max(history.actual_downloaded) as actual_downloaded,max(history.seedtime) as seedtime,max(history.created_at) as created_at,max(history.updated_at) as updated_at,max(history.completed_at) as completed_at,max(history.immune) as immune,max(history.hitrun) as hitrun,max(history.prewarn) as prewarn,max(torrents.moderated_at) as moderated_at,max(torrents.slug) as slug,max(torrents.user_id) as user_id,max(torrents.name) as name,max(torrents.category_id) as category_id,max(torrents.size) as size,max(torrents.leechers) as leechers,max(torrents.seeders) as seeders,max(torrents.times_completed) as times_completed,max(torrents.status) as status')->leftJoin('torrents', 'torrents.info_hash', '=', 'history.info_hash')->where('history.user_id', '=', $user->id)->groupBy('history.id') ->orderBy('created_at', 'DESC')->paginate(50); - return view('user.private.torrents', [ + return \view('user.private.torrents', [ 'route' => 'torrents', 'user' => $user, 'history' => $history, @@ -1805,11 +1805,11 @@ public function torrents(Request $request, $username) public function resurrections(Request $request, $username) { $user = User::where('username', '=', $username)->firstOrFail(); - abort_unless($request->user()->group->is_modo || $request->user()->id == $user->id, 403); + \abort_unless($request->user()->group->is_modo || $request->user()->id == $user->id, 403); $resurrections = Graveyard::with(['torrent', 'user'])->where('user_id', '=', $user->id)->paginate(50); - return view('user.private.resurrections', [ + return \view('user.private.resurrections', [ 'route' => 'resurrections', 'user' => $user, 'resurrections' => $resurrections, @@ -1837,7 +1837,7 @@ public function uploads(Request $request, $username) $uploads = Torrent::with(['tips', 'thanks', 'category'])->selectRaw('distinct(torrents.id),max(torrents.moderated_at) as moderated_at,max(torrents.slug) as slug,max(torrents.user_id) as user_id,max(torrents.name) as name,max(torrents.category_id) as category_id,max(torrents.size) as size,max(torrents.leechers) as leechers,max(torrents.seeders) as seeders,max(torrents.times_completed) as times_completed,max(torrents.created_at) as created_at,max(torrents.status) as status,count(distinct thanks.id) as thanked_total,max(bt.tipped_total) as tipped_total') ->withAnyStatus()->where('torrents.user_id', '=', $user->id)->leftJoin(DB::raw('(select distinct(bon_transactions.torrent_id),sum(bon_transactions.cost) as tipped_total from bon_transactions group by bon_transactions.torrent_id) as bt'), 'bt.torrent_id', '=', 'torrents.id')->leftJoin('thanks', 'thanks.torrent_id', 'torrents.id')->groupBy('torrents.id')->orderBy('created_at', 'DESC')->paginate(50); - return view($logger, [ + return \view($logger, [ 'route' => 'uploads', 'user' => $user, 'uploads' => $uploads, @@ -1850,7 +1850,7 @@ public function uploads(Request $request, $username) $logger = 'user.uploads'; $uploads = Torrent::selectRaw('distinct(torrents.id),max(torrents.moderated_at) as moderated_at,max(torrents.slug) as slug,max(torrents.user_id) as user_id,max(torrents.name) as name,max(torrents.category_id) as category_id,max(torrents.size) as size,max(torrents.leechers) as leechers,max(torrents.seeders) as seeders,max(torrents.times_completed) as times_completed,max(torrents.created_at) as created_at,max(torrents.status) as status,count(distinct thanks.id) as thanked_total,sum(bon_transactions.cost) as tipped_total')->where('torrents.user_id', '=', $user->id)->where('torrents.status', '=', 1)->where('torrents.anon', '=', 0)->with(['tips', 'thanks'])->leftJoin('bon_transactions', 'bon_transactions.torrent_id', 'torrents.id')->leftJoin('thanks', 'thanks.torrent_id', 'torrents.id')->groupBy('torrents.id')->orderBy('created_at', 'DESC')->paginate(50); - return view($logger, [ + return \view($logger, [ 'route' => 'uploads', 'user' => $user, 'uploads' => $uploads, @@ -1869,7 +1869,7 @@ public function active(Request $request, $username) { $user = User::where('username', '=', $username)->firstOrFail(); - abort_unless($request->user()->group->is_modo || $request->user()->id == $user->id, 403); + \abort_unless($request->user()->group->is_modo || $request->user()->id == $user->id, 403); $his_upl = History::where('user_id', '=', $user->id)->sum('actual_uploaded'); $his_upl_cre = History::where('user_id', '=', $user->id)->sum('uploaded'); @@ -1883,7 +1883,7 @@ public function active(Request $request, $username) ->distinct('info_hash') ->paginate(50); - return view('user.private.active', ['user' => $user, + return \view('user.private.active', ['user' => $user, 'route' => 'active', 'active' => $active, 'his_upl' => $his_upl, @@ -1905,7 +1905,7 @@ public function seeds(Request $request, $username) { $user = User::where('username', '=', $username)->firstOrFail(); - abort_unless($request->user()->group->is_modo || $request->user()->id == $user->id, 403); + \abort_unless($request->user()->group->is_modo || $request->user()->id == $user->id, 403); $his_upl = History::where('user_id', '=', $user->id)->sum('actual_uploaded'); $his_upl_cre = History::where('user_id', '=', $user->id)->sum('uploaded'); @@ -1918,7 +1918,7 @@ public function seeds(Request $request, $username) ->where('peers.seeder', '=', 1)->orderBy('history_created_at', 'DESC')->groupBy('torrents.info_hash') ->paginate(50); - return view('user.private.seeds', ['user' => $user, + return \view('user.private.seeds', ['user' => $user, 'route' => 'seeds', 'seeds' => $seeds, 'his_upl' => $his_upl, @@ -1938,12 +1938,12 @@ public function seeds(Request $request, $username) */ public function getBans(Request $request, $username) { - abort_unless($request->user()->group->is_modo, 403); + \abort_unless($request->user()->group->is_modo, 403); $user = User::where('username', '=', $username)->firstOrFail(); $bans = Ban::where('owned_by', '=', $user->id)->latest()->get(); - return view('user.banlog', [ + return \view('user.banlog', [ 'user' => $user, 'bans' => $bans, ]); @@ -1960,14 +1960,14 @@ public function getBans(Request $request, $username) public function downloadHistoryTorrents(Request $request, $username) { // Extend The Maximum Execution Time - set_time_limit(300); + \set_time_limit(300); // Authorized User $user = User::where('username', '=', $username)->firstOrFail(); - abort_unless($request->user()->id == $user->id, 403); + \abort_unless($request->user()->id == $user->id, 403); // Define Dir Folder - $path = getcwd().'/files/tmp_zip/'; + $path = \getcwd().'/files/tmp_zip/'; // Check Directory exists if (! File::isDirectory($path)) { @@ -1975,7 +1975,7 @@ public function downloadHistoryTorrents(Request $request, $username) } // Zip File Name - $zipFileName = sprintf('%s.zip', $user->username); + $zipFileName = \sprintf('%s.zip', $user->username); // Create ZipArchive Obj $zipArchive = new ZipArchive(); @@ -1993,37 +1993,37 @@ public function downloadHistoryTorrents(Request $request, $username) $torrent = Torrent::withAnyStatus()->where('info_hash', '=', $historyTorrent)->first(); // Define The Torrent Filename - $tmpFileName = sprintf('%s.torrent', $torrent->slug); + $tmpFileName = \sprintf('%s.torrent', $torrent->slug); // The Torrent File Exist? - if (! file_exists(getcwd().'/files/torrents/'.$torrent->file_name)) { - $failCSV .= '"'.$torrent->name.'","'.route('torrent', ['id' => $torrent->id]).'","'.$torrent->id.'","'.$historyTorrent.'" + if (! \file_exists(\getcwd().'/files/torrents/'.$torrent->file_name)) { + $failCSV .= '"'.$torrent->name.'","'.\route('torrent', ['id' => $torrent->id]).'","'.$torrent->id.'","'.$historyTorrent.'" '; $failCount++; } else { // Delete The Last Torrent Tmp File If Exist - if (file_exists(getcwd().'/files/tmp/'.$tmpFileName)) { - unlink(getcwd().'/files/tmp/'.$tmpFileName); + if (\file_exists(\getcwd().'/files/tmp/'.$tmpFileName)) { + \unlink(\getcwd().'/files/tmp/'.$tmpFileName); } // Get The Content Of The Torrent - $dict = Bencode::bdecode(file_get_contents(getcwd().'/files/torrents/'.$torrent->file_name)); + $dict = Bencode::bdecode(\file_get_contents(\getcwd().'/files/torrents/'.$torrent->file_name)); // Set the announce key and add the user passkey - $dict['announce'] = route('announce', ['passkey' => $user->passkey]); + $dict['announce'] = \route('announce', ['passkey' => $user->passkey]); // Remove Other announce url unset($dict['announce-list']); $fileToDownload = Bencode::bencode($dict); - file_put_contents(getcwd().'/files/tmp/'.$tmpFileName, $fileToDownload); + \file_put_contents(\getcwd().'/files/tmp/'.$tmpFileName, $fileToDownload); // Add Files To ZipArchive - $zipArchive->addFile(getcwd().'/files/tmp/'.$tmpFileName, $tmpFileName); + $zipArchive->addFile(\getcwd().'/files/tmp/'.$tmpFileName, $tmpFileName); } } if ($failCount > 0) { - $CSVtmpName = sprintf('%s.zip', $user->username).'-missingTorrentFiles.CSV'; - file_put_contents(getcwd().'/files/tmp/'.$CSVtmpName, $failCSV); - $zipArchive->addFile(getcwd().'/files/tmp/'.$CSVtmpName, 'missingTorrentFiles.CSV'); + $CSVtmpName = \sprintf('%s.zip', $user->username).'-missingTorrentFiles.CSV'; + \file_put_contents(\getcwd().'/files/tmp/'.$CSVtmpName, $failCSV); + $zipArchive->addFile(\getcwd().'/files/tmp/'.$CSVtmpName, 'missingTorrentFiles.CSV'); } // Close ZipArchive $zipArchive->close(); @@ -2031,11 +2031,11 @@ public function downloadHistoryTorrents(Request $request, $username) $zip_file = $path.'/'.$zipFileName; - if (file_exists($zip_file)) { - return response()->download($zip_file)->deleteFileAfterSend(true); + if (\file_exists($zip_file)) { + return \response()->download($zip_file)->deleteFileAfterSend(true); } - return redirect()->back()->withErrors('Something Went Wrong!'); + return \redirect()->back()->withErrors('Something Went Wrong!'); } /** diff --git a/app/Http/Controllers/WarningController.php b/app/Http/Controllers/WarningController.php index 2ca5eb7e8b..52c4b9a6ab 100644 --- a/app/Http/Controllers/WarningController.php +++ b/app/Http/Controllers/WarningController.php @@ -31,7 +31,7 @@ class WarningController extends Controller */ public function show(Request $request, $username) { - abort_unless($request->user()->group->is_modo, 403); + \abort_unless($request->user()->group->is_modo, 403); $user = User::where('username', '=', $username)->firstOrFail(); @@ -41,7 +41,7 @@ public function show(Request $request, $username) $softDeletedWarnings = Warning::where('user_id', '=', $user->id)->with(['torrenttitle', 'warneduser'])->latest('created_at')->onlyTrashed()->paginate(25); $softDeletedWarningCount = Warning::where('user_id', '=', $user->id)->onlyTrashed()->count(); - return view('user.warninglog', [ + return \view('user.warninglog', [ 'warnings' => $warnings, 'warningcount' => $warningcount, 'softDeletedWarnings' => $softDeletedWarnings, @@ -60,7 +60,7 @@ public function show(Request $request, $username) */ public function deactivate(Request $request, $id) { - abort_unless($request->user()->group->is_modo, 403); + \abort_unless($request->user()->group->is_modo, 403); $staff = $request->user(); $warning = Warning::findOrFail($id); $warning->expires_on = Carbon::now(); @@ -75,7 +75,7 @@ public function deactivate(Request $request, $id) $privateMessage->message = $staff->username.' has decided to deactivate your active warning for torrent '.$warning->torrent.' You lucked out! [color=red][b]THIS IS AN AUTOMATED SYSTEM MESSAGE, PLEASE DO NOT REPLY![/b][/color]'; $privateMessage->save(); - return redirect()->route('warnings.show', ['username' => $warning->warneduser->username]) + return \redirect()->route('warnings.show', ['username' => $warning->warneduser->username]) ->withSuccess('Warning Was Successfully Deactivated'); } @@ -89,7 +89,7 @@ public function deactivate(Request $request, $id) */ public function deactivateAllWarnings(Request $request, $username) { - abort_unless($request->user()->group->is_modo, 403); + \abort_unless($request->user()->group->is_modo, 403); $staff = $request->user(); $user = User::where('username', '=', $username)->firstOrFail(); @@ -109,7 +109,7 @@ public function deactivateAllWarnings(Request $request, $username) $privateMessage->message = $staff->username.' has decided to deactivate all of your active hit and run warnings. You lucked out! [color=red][b]THIS IS AN AUTOMATED SYSTEM MESSAGE, PLEASE DO NOT REPLY![/b][/color]'; $privateMessage->save(); - return redirect()->route('warnings.show', ['username' => $user->username]) + return \redirect()->route('warnings.show', ['username' => $user->username]) ->withSuccess('All Warnings Were Successfully Deactivated'); } @@ -123,7 +123,7 @@ public function deactivateAllWarnings(Request $request, $username) */ public function deleteWarning(Request $request, $id) { - abort_unless($request->user()->group->is_modo, 403); + \abort_unless($request->user()->group->is_modo, 403); $staff = $request->user(); $warning = Warning::findOrFail($id); @@ -140,7 +140,7 @@ public function deleteWarning(Request $request, $id) $warning->save(); $warning->delete(); - return redirect()->route('warnings.show', ['username' => $warning->warneduser->username]) + return \redirect()->route('warnings.show', ['username' => $warning->warneduser->username]) ->withSuccess('Warning Was Successfully Deleted'); } @@ -154,7 +154,7 @@ public function deleteWarning(Request $request, $id) */ public function deleteAllWarnings(Request $request, $username) { - abort_unless($request->user()->group->is_modo, 403); + \abort_unless($request->user()->group->is_modo, 403); $staff = $request->user(); $user = User::where('username', '=', $username)->firstOrFail(); @@ -175,7 +175,7 @@ public function deleteAllWarnings(Request $request, $username) $privateMessage->message = $staff->username.' has decided to delete all of your warnings. You lucked out! [color=red][b]THIS IS AN AUTOMATED SYSTEM MESSAGE, PLEASE DO NOT REPLY![/b][/color]'; $privateMessage->save(); - return redirect()->route('warnings.show', ['username' => $user->username]) + return \redirect()->route('warnings.show', ['username' => $user->username]) ->withSuccess('All Warnings Were Successfully Deleted'); } @@ -189,13 +189,13 @@ public function deleteAllWarnings(Request $request, $username) */ public function restoreWarning(Request $request, $id) { - abort_unless($request->user()->group->is_modo, 403); + \abort_unless($request->user()->group->is_modo, 403); $staff = $request->user(); $warning = Warning::withTrashed()->findOrFail($id); $warning->restore(); - return redirect()->route('warnings.show', ['username' => $warning->warneduser->username]) + return \redirect()->route('warnings.show', ['username' => $warning->warneduser->username]) ->withSuccess('Warning Was Successfully Restored'); } } diff --git a/app/Http/Controllers/WishController.php b/app/Http/Controllers/WishController.php index e6e71dd7ba..f797005f42 100644 --- a/app/Http/Controllers/WishController.php +++ b/app/Http/Controllers/WishController.php @@ -47,11 +47,11 @@ public function index(Request $request, $username) { $user = User::with('wishes')->where('username', '=', $username)->firstOrFail(); - abort_unless(($request->user()->group->is_modo || $request->user()->id == $user->id), 403); + \abort_unless(($request->user()->group->is_modo || $request->user()->id == $user->id), 403); $wishes = $user->wishes()->latest()->paginate(25); - return view('user.wishlist', [ + return \view('user.wishlist', [ 'user' => $user, 'wishes' => $wishes, 'route' => 'wish', @@ -69,7 +69,7 @@ public function store(Request $request) { $user = $request->user(); if ($request->get('imdb') == 0) { - return redirect() + return \redirect() ->route('wishes.index', ['username' => $user->username]) ->withErrors('IMDB Entry Required'); } @@ -77,14 +77,14 @@ public function store(Request $request) $imdb = Str::startsWith($request->get('imdb'), 'tt') ? $request->get('imdb') : 'tt'.$request->get('imdb'); if ($this->wish->exists($user->id, $imdb)) { - return redirect() + return \redirect() ->route('wishes.index', ['username' => $user->username]) ->withErrors('Wish already exists!'); } $omdb = $this->wish->omdbRequest($imdb); if ($omdb === null || $omdb === false) { - return redirect() + return \redirect() ->route('wishes.index', ['username' => $user->username]) ->withErrors('IMDB Bad Request!'); } @@ -99,7 +99,7 @@ public function store(Request $request) 'user_id' => $user->id, ]); - return redirect() + return \redirect() ->route('wishes.index', ['username' => $user->username]) ->withSuccess('Wish Successfully Added!'); } @@ -118,7 +118,7 @@ public function destroy(Request $request, $id) $this->wish->delete($id); - return redirect() + return \redirect() ->route('wishes.index', ['username' => $user->username]) ->withSuccess('Wish Successfully Removed!'); } diff --git a/app/Http/Middleware/Authenticate.php b/app/Http/Middleware/Authenticate.php index 3dacd19273..170159aecf 100644 --- a/app/Http/Middleware/Authenticate.php +++ b/app/Http/Middleware/Authenticate.php @@ -26,6 +26,6 @@ class Authenticate extends Middleware */ protected function redirectTo($request) { - return route('login'); + return \route('login'); } } diff --git a/app/Http/Middleware/CheckForAdmin.php b/app/Http/Middleware/CheckForAdmin.php index 0ad62f1783..55421e1d25 100644 --- a/app/Http/Middleware/CheckForAdmin.php +++ b/app/Http/Middleware/CheckForAdmin.php @@ -27,7 +27,7 @@ class CheckForAdmin */ public function handle($request, Closure $next) { - abort_unless($request->user()->group->is_admin, 403); + \abort_unless($request->user()->group->is_admin, 403); return $next($request); } diff --git a/app/Http/Middleware/CheckForModo.php b/app/Http/Middleware/CheckForModo.php index ef73c8b859..eb6090112b 100644 --- a/app/Http/Middleware/CheckForModo.php +++ b/app/Http/Middleware/CheckForModo.php @@ -27,7 +27,7 @@ class CheckForModo */ public function handle($request, Closure $next) { - abort_unless($request->user()->group->is_modo, 403); + \abort_unless($request->user()->group->is_modo, 403); return $next($request); } diff --git a/app/Http/Middleware/CheckForOwner.php b/app/Http/Middleware/CheckForOwner.php index f06b3a317d..e1c2f1ead2 100644 --- a/app/Http/Middleware/CheckForOwner.php +++ b/app/Http/Middleware/CheckForOwner.php @@ -27,7 +27,7 @@ class CheckForOwner */ public function handle($request, Closure $next) { - abort_unless($request->user()->group->is_owner, 403); + \abort_unless($request->user()->group->is_owner, 403); return $next($request); } diff --git a/app/Http/Middleware/CheckIfBanned.php b/app/Http/Middleware/CheckIfBanned.php index 9fd2b3f125..aea4433aa6 100644 --- a/app/Http/Middleware/CheckIfBanned.php +++ b/app/Http/Middleware/CheckIfBanned.php @@ -32,13 +32,13 @@ class CheckIfBanned public function handle($request, Closure $next, $guard = null) { $user = $request->user(); - $banned_group = cache()->rememberForever('banned_group', fn () => Group::where('slug', '=', 'banned')->pluck('id')); + $banned_group = \cache()->rememberForever('banned_group', fn () => Group::where('slug', '=', 'banned')->pluck('id')); if ($user && $user->group_id == $banned_group[0]) { - auth()->logout(); + \auth()->logout(); $request->session()->flush(); - return redirect()->route('login') + return \redirect()->route('login') ->withErrors('This account is Banned!'); } diff --git a/app/Http/Middleware/Http2ServerPush.php b/app/Http/Middleware/Http2ServerPush.php index cb64831d8b..a019c468b9 100644 --- a/app/Http/Middleware/Http2ServerPush.php +++ b/app/Http/Middleware/Http2ServerPush.php @@ -62,11 +62,11 @@ public function handle(Request $request, Closure $next, $limit = null, $sizeLimi public function getConfig($key, $default = false) { - if (! function_exists('config')) { // for tests.. + if (! \function_exists('config')) { // for tests.. return $default; } - return config('http2serverpush.'.$key, $default); + return \config('http2serverpush.'.$key, $default); } /** @@ -88,20 +88,20 @@ protected function generateAndAttachLinkHeaders(Response $response, $limit = nul if (! $value) { return false; } - $exclude_keywords = collect($excludeKeywords)->map(fn ($keyword) => preg_quote($keyword)); + $exclude_keywords = \collect($excludeKeywords)->map(fn ($keyword) => \preg_quote($keyword)); if ($exclude_keywords->count() <= 0) { return true; } - return ! preg_match('%('.$exclude_keywords->implode('|').')%i', $value); + return ! \preg_match('%('.$exclude_keywords->implode('|').')%i', $value); }) ->take($limit); - $sizeLimit ??= max(1, (int) $this->getConfig('size_limit', 32 * 1_024)); - $headersText = trim($headers->implode(',')); - while (strlen($headersText) > $sizeLimit) { + $sizeLimit ??= \max(1, (int) $this->getConfig('size_limit', 32 * 1_024)); + $headersText = \trim($headers->implode(',')); + while (\strlen($headersText) > $sizeLimit) { $headers->pop(); - $headersText = trim($headers->implode(',')); + $headersText = \trim($headers->implode(',')); } if (! empty($headersText)) { @@ -138,7 +138,7 @@ protected function fetchLinkableNodes($response) { $crawler = $this->getCrawler($response); - return collect($crawler->filter('link:not([rel*="icon"]), script[src], img[src], object[data]')->extract(['src', 'href', 'data'])); + return \collect($crawler->filter('link:not([rel*="icon"]), script[src], img[src], object[data]')->extract(['src', 'href', 'data'])); } /** @@ -150,13 +150,13 @@ protected function fetchLinkableNodes($response) */ private function buildLinkHeaderString($url) { - $type = collect(self::LINK_TYPE_MAP)->first(fn ($type, $extension) => Str::contains(strtoupper($url), $extension)); - if (! preg_match('#^https?://#i', $url)) { + $type = \collect(self::LINK_TYPE_MAP)->first(fn ($type, $extension) => Str::contains(\strtoupper($url), $extension)); + if (! \preg_match('#^https?://#i', $url)) { $basePath = $this->getConfig('base_path', '/'); - $url = $basePath.ltrim($url, $basePath); + $url = $basePath.\ltrim($url, $basePath); } - return is_null($type) ? null : sprintf('<%s>; rel=preload; as=%s', $url, $type); + return \is_null($type) ? null : \sprintf('<%s>; rel=preload; as=%s', $url, $type); } /** diff --git a/app/Http/Middleware/ProAjaxMiddleware.php b/app/Http/Middleware/ProAjaxMiddleware.php index ef4809abd8..4096459ef4 100644 --- a/app/Http/Middleware/ProAjaxMiddleware.php +++ b/app/Http/Middleware/ProAjaxMiddleware.php @@ -55,7 +55,7 @@ public function handle($request, Closure $next) // return redirect('/contact') // then the user should be redirected if ($this->shouldRedirectRequest($request, $response)) { - return response()->json(['redirect' => $response->getTargetUrl()]); + return \response()->json(['redirect' => $response->getTargetUrl()]); } // If we've gotten this far, it looks like its an ajax request @@ -71,7 +71,7 @@ public function handle($request, Closure $next) $request->session()->forget($this->flash_name); // Finally, let's return a json with the flash message - return response()->json([ + return \response()->json([ 'type' => $flash_message['type'], 'message' => $flash_message['message'], //'redirect' => $flash_message['redirect'], // Returns false if no redirect request @@ -79,7 +79,7 @@ public function handle($request, Closure $next) } // So... if the request wants json, return json - return $request->wantsJson() ? response()->json() : $response; + return $request->wantsJson() ? \response()->json() : $response; //return $response; } @@ -118,8 +118,8 @@ public function getFlashMessage($request) { $session = $request->session(); - $flash_message['type'] = $session->get(sprintf('%s.type', $this->flash_name)); - $flash_message['message'] = $session->get(sprintf('%s.message', $this->flash_name)); + $flash_message['type'] = $session->get(\sprintf('%s.type', $this->flash_name)); + $flash_message['message'] = $session->get(\sprintf('%s.message', $this->flash_name)); return $flash_message; } @@ -135,7 +135,7 @@ public function getFlashMessage($request) public function shouldRedirectRequest($request, $response) { // If there is no target URL, we know that it is not a redirect request - if (! method_exists($response, 'getTargetUrl')) { + if (! \method_exists($response, 'getTargetUrl')) { return false; } diff --git a/app/Http/Middleware/RedirectIfAuthenticated.php b/app/Http/Middleware/RedirectIfAuthenticated.php index 067d8c82d4..7ec7ece394 100644 --- a/app/Http/Middleware/RedirectIfAuthenticated.php +++ b/app/Http/Middleware/RedirectIfAuthenticated.php @@ -28,8 +28,8 @@ class RedirectIfAuthenticated */ public function handle($request, Closure $next, $guard = null) { - if (auth()->guard($guard)->check()) { - return redirect()->route('home.index'); + if (\auth()->guard($guard)->check()) { + return \redirect()->route('home.index'); } return $next($request); diff --git a/app/Http/Middleware/SetLanguage.php b/app/Http/Middleware/SetLanguage.php index f751c979a4..1b6cc1a307 100644 --- a/app/Http/Middleware/SetLanguage.php +++ b/app/Http/Middleware/SetLanguage.php @@ -29,27 +29,27 @@ private function setLocale($locale) { // Check if is allowed and set default locale if not if (! Language::allowed($locale)) { - $locale = config('app.locale'); + $locale = \config('app.locale'); } // Set app language App::setLocale($locale); // Set carbon language - if (config('language.carbon')) { + if (\config('language.carbon')) { // Carbon uses only language code - if (config('language.mode.code') == 'long') { - $locale = explode('-', $locale)[0]; + if (\config('language.mode.code') == 'long') { + $locale = \explode('-', $locale)[0]; } Carbon::setLocale($locale); } // Set date language - if (config('language.date')) { + if (\config('language.date')) { // Date uses only language code - if (config('language.mode.code') == 'long') { - $locale = explode('-', $locale)[0]; + if (\config('language.mode.code') == 'long') { + $locale = \explode('-', $locale)[0]; } \Date::setLocale($locale); @@ -58,12 +58,12 @@ private function setLocale($locale) public function setDefaultLocale() { - $this->setLocale(config('app.locale')); + $this->setLocale(\config('app.locale')); } public function setUserLocale() { - $user = auth()->user(); + $user = \auth()->user(); if ($user->locale) { $this->setLocale($user->locale); @@ -75,7 +75,7 @@ public function setUserLocale() public function setSystemLocale($request) { if ($request->session()->has('locale')) { - $this->setLocale(session('locale')); + $this->setLocale(\session('locale')); } else { $this->setDefaultLocale(); } @@ -93,7 +93,7 @@ public function handle($request, Closure $next) { if ($request->has('lang')) { $this->setLocale($request->get('lang')); - } elseif (auth()->check()) { + } elseif (\auth()->check()) { $this->setUserLocale(); } else { $this->setSystemLocale($request); diff --git a/app/Http/Middleware/TwoStepAuth.php b/app/Http/Middleware/TwoStepAuth.php index 7bbb127246..a0a33151cb 100644 --- a/app/Http/Middleware/TwoStepAuth.php +++ b/app/Http/Middleware/TwoStepAuth.php @@ -33,7 +33,7 @@ public function handle(Request $request, Closure $next) { $response = $next($request); $uri = $request->path(); - $nextUri = config('app.url').'/'.$uri; + $nextUri = \config('app.url').'/'.$uri; $user = $request->user(); switch ($uri) { @@ -45,10 +45,10 @@ public function handle(Request $request, Closure $next) break; default: - session(['nextUri' => $nextUri]); + \session(['nextUri' => $nextUri]); - if (config('auth.TwoStepEnabled') && $user->twostep == 1 && ! $this->twoStepVerification()) { - return redirect()->route('verificationNeeded'); + if (\config('auth.TwoStepEnabled') && $user->twostep == 1 && ! $this->twoStepVerification()) { + return \redirect()->route('verificationNeeded'); } break; diff --git a/app/Http/Middleware/UpdateLastAction.php b/app/Http/Middleware/UpdateLastAction.php index 7ba1b136bd..3dd5b8202b 100644 --- a/app/Http/Middleware/UpdateLastAction.php +++ b/app/Http/Middleware/UpdateLastAction.php @@ -31,7 +31,7 @@ public function handle($request, Closure $next) return $next($request); } - $user->last_action = now(); + $user->last_action = \now(); $user->save(); return $next($request); diff --git a/app/Http/Resources/ChatMessageResource.php b/app/Http/Resources/ChatMessageResource.php index 0633ecd66d..0c371038af 100644 --- a/app/Http/Resources/ChatMessageResource.php +++ b/app/Http/Resources/ChatMessageResource.php @@ -30,14 +30,14 @@ class ChatMessageResource extends JsonResource */ public function toArray($request) { - $emojiOne = app()->make(LaravelEmojiOne::class); + $emojiOne = \app()->make(LaravelEmojiOne::class); $logger = null; if ($this->user_id && $this->user_id == 1) { $bbcode = new Bbcode(); $logger = $bbcode->parse('
'.$this->message.'
'); $logger = $emojiOne->toImage($logger); - $logger = str_replace('a href="/#', 'a trigger="bot" class="chatTrigger" href="/#', $logger); + $logger = \str_replace('a href="/#', 'a trigger="bot" class="chatTrigger" href="/#', $logger); } else { $bbcode = new Bbcode(); $logger = $bbcode->parse('
'.$this->message.'
'); @@ -50,7 +50,7 @@ public function toArray($request) 'user' => new UserResource($this->whenLoaded('user')), 'receiver' => new UserResource($this->whenLoaded('receiver')), 'chatroom' => new ChatRoomResource($this->whenLoaded('chatroom')), - 'message' => htmlspecialchars_decode($logger), + 'message' => \htmlspecialchars_decode($logger), 'created_at' => $this->created_at->toIso8601String(), 'updated_at' => $this->updated_at->toIso8601String(), ]; diff --git a/app/Http/Resources/TorrentResource.php b/app/Http/Resources/TorrentResource.php index fb7d77f086..d687b41969 100644 --- a/app/Http/Resources/TorrentResource.php +++ b/app/Http/Resources/TorrentResource.php @@ -49,7 +49,7 @@ public function toArray($request) 'mal_id' => $this->mal, 'igdb_id' => $this->igdb, 'created_at' => $this->created_at->toDayDateTimeString(), - 'download_link' => route('torrent.download.rsskey', ['id' => $this->id, 'rsskey' => auth('api')->user()->rsskey]), + 'download_link' => \route('torrent.download.rsskey', ['id' => $this->id, 'rsskey' => \auth('api')->user()->rsskey]), ], ]; } diff --git a/app/Http/Resources/TorrentsResource.php b/app/Http/Resources/TorrentsResource.php index e12ec34f34..5226853dd7 100644 --- a/app/Http/Resources/TorrentsResource.php +++ b/app/Http/Resources/TorrentsResource.php @@ -35,7 +35,7 @@ public function with($request) { return [ 'links' => [ - 'self' => route('torrents.index'), + 'self' => \route('torrents.index'), ], ]; } diff --git a/app/Jobs/SendActivationMail.php b/app/Jobs/SendActivationMail.php index 4c2d25f4d0..2a04357a79 100644 --- a/app/Jobs/SendActivationMail.php +++ b/app/Jobs/SendActivationMail.php @@ -65,7 +65,7 @@ public function __construct(User $user, $code) public function handle() { if ($this->attempts() > 2) { - $this->delay(min(30 * $this->attempts(), 300)); + $this->delay(\min(30 * $this->attempts(), 300)); } Mail::to($this->user)->send(new ActivateUser($this->user, $this->code)); diff --git a/app/Jobs/SendDeleteUserMail.php b/app/Jobs/SendDeleteUserMail.php index 6b44131826..38dcc82a31 100644 --- a/app/Jobs/SendDeleteUserMail.php +++ b/app/Jobs/SendDeleteUserMail.php @@ -58,7 +58,7 @@ public function __construct(User $user) public function handle() { if ($this->attempts() > 2) { - $this->delay(min(30 * $this->attempts(), 300)); + $this->delay(\min(30 * $this->attempts(), 300)); } Mail::to($this->user)->send(new DeleteUser($this->user)); diff --git a/app/Jobs/SendDisableUserMail.php b/app/Jobs/SendDisableUserMail.php index 43e19401cf..dc550a01fe 100644 --- a/app/Jobs/SendDisableUserMail.php +++ b/app/Jobs/SendDisableUserMail.php @@ -58,7 +58,7 @@ public function __construct(User $user) public function handle() { if ($this->attempts() > 2) { - $this->delay(min(30 * $this->attempts(), 300)); + $this->delay(\min(30 * $this->attempts(), 300)); } Mail::to($this->user)->send(new DisableUser($this->user)); diff --git a/app/Listeners/AchievementUnlocked.php b/app/Listeners/AchievementUnlocked.php index 25d910f127..bf2446c42d 100644 --- a/app/Listeners/AchievementUnlocked.php +++ b/app/Listeners/AchievementUnlocked.php @@ -41,10 +41,10 @@ public function handle(Unlocked $unlocked) Session::flash('achievement', $unlocked->progress->details->name); if ($user->private_profile == 0) { - $profile_url = href_profile($user); + $profile_url = \href_profile($user); $this->chat->systemMessage( - sprintf('User [url=%s]%s[/url] has unlocked the %s achievement :medal:', $profile_url, $user->username, $unlocked->progress->details->name) + \sprintf('User [url=%s]%s[/url] has unlocked the %s achievement :medal:', $profile_url, $user->username, $unlocked->progress->details->name) ); } } diff --git a/app/Listeners/FailedLoginListener.php b/app/Listeners/FailedLoginListener.php index 9e2554f7c9..76c064aa23 100644 --- a/app/Listeners/FailedLoginListener.php +++ b/app/Listeners/FailedLoginListener.php @@ -34,7 +34,7 @@ public function handle($event) Request::getClientIp() ); - if (isset($event->user) && is_a($event->user, 'Illuminate\Database\Eloquent\Model')) { + if (isset($event->user) && \is_a($event->user, 'Illuminate\Database\Eloquent\Model')) { $event->user->notify(new FailedLogin( Request::getClientIp() )); diff --git a/app/Mail/ActivateUser.php b/app/Mail/ActivateUser.php index b03b00a31c..c1dbcf5735 100644 --- a/app/Mail/ActivateUser.php +++ b/app/Mail/ActivateUser.php @@ -47,6 +47,6 @@ public function __construct(User $user, $code) public function build() { return $this->markdown('emails.activate') - ->subject('Activation Required '.config('other.title')); + ->subject('Activation Required '.\config('other.title')); } } diff --git a/app/Mail/BanUser.php b/app/Mail/BanUser.php index 3736effc29..4abbd0a64b 100644 --- a/app/Mail/BanUser.php +++ b/app/Mail/BanUser.php @@ -45,6 +45,6 @@ public function __construct($email, $ban) public function build() { return $this->markdown('emails.ban') - ->subject('You Have Been Banned - '.config('other.title')); + ->subject('You Have Been Banned - '.\config('other.title')); } } diff --git a/app/Mail/Bug.php b/app/Mail/Bug.php index 13ba710fd8..29c4d92138 100644 --- a/app/Mail/Bug.php +++ b/app/Mail/Bug.php @@ -41,7 +41,7 @@ public function __construct(array $input) public function build() { return $this->markdown('emails.bug') - ->from($this->input['email'], config('other.title')) + ->from($this->input['email'], \config('other.title')) ->subject('New Bug Report!'); } } diff --git a/app/Mail/Contact.php b/app/Mail/Contact.php index 53be58e359..06a8d3d161 100644 --- a/app/Mail/Contact.php +++ b/app/Mail/Contact.php @@ -41,7 +41,7 @@ public function __construct(array $input) public function build() { return $this->markdown('emails.contact') - ->from($this->input['email'], config('other.title')) + ->from($this->input['email'], \config('other.title')) ->subject('New contact mail'); } } diff --git a/app/Mail/DeleteUser.php b/app/Mail/DeleteUser.php index 608730419b..d042b46fd6 100644 --- a/app/Mail/DeleteUser.php +++ b/app/Mail/DeleteUser.php @@ -41,6 +41,6 @@ public function __construct($email) public function build() { return $this->markdown('emails.pruned') - ->subject('Your Account Has Been Pruned - '.config('other.title')); + ->subject('Your Account Has Been Pruned - '.\config('other.title')); } } diff --git a/app/Mail/DisableUser.php b/app/Mail/DisableUser.php index 4e1314974d..30e9e951ed 100644 --- a/app/Mail/DisableUser.php +++ b/app/Mail/DisableUser.php @@ -41,6 +41,6 @@ public function __construct($email) public function build() { return $this->markdown('emails.disabled') - ->subject('Your Account Has Been Disabled - '.config('other.title')); + ->subject('Your Account Has Been Disabled - '.\config('other.title')); } } diff --git a/app/Mail/InviteUser.php b/app/Mail/InviteUser.php index c58253b719..88bcaef0de 100644 --- a/app/Mail/InviteUser.php +++ b/app/Mail/InviteUser.php @@ -42,6 +42,6 @@ public function __construct(Invite $invite) public function build() { return $this->markdown('emails.invite') - ->subject('Invite Received '.config('other.title')); + ->subject('Invite Received '.\config('other.title')); } } diff --git a/app/Mail/UnbanUser.php b/app/Mail/UnbanUser.php index a10fab98fd..6af09e2b76 100644 --- a/app/Mail/UnbanUser.php +++ b/app/Mail/UnbanUser.php @@ -45,6 +45,6 @@ public function __construct($email, $ban) public function build() { return $this->markdown('emails.unban') - ->subject('You Have Been Unbanned - '.config('other.title')); + ->subject('You Have Been Unbanned - '.\config('other.title')); } } diff --git a/app/Models/Article.php b/app/Models/Article.php index 5056a7fe0b..2612fa71f7 100644 --- a/app/Models/Article.php +++ b/app/Models/Article.php @@ -88,17 +88,17 @@ public function getBrief($length = 20, $ellipses = true, $strip_html = false) $input = $this->content; //strip tags, if desired if ($strip_html) { - $input = strip_tags($input); + $input = \strip_tags($input); } //no need to trim, already shorter than trim length - if (strlen($input) <= $length) { + if (\strlen($input) <= $length) { return $input; } //find last space within length - $last_space = strrpos(substr($input, 0, $length), ' '); - $trimmed_text = substr($input, 0, $last_space); + $last_space = \strrpos(\substr($input, 0, $length), ' '); + $trimmed_text = \substr($input, 0, $last_space); //add ellipses (...) if ($ellipses) { diff --git a/app/Models/FailedLoginAttempt.php b/app/Models/FailedLoginAttempt.php index 78e39954d9..c5d60c1385 100644 --- a/app/Models/FailedLoginAttempt.php +++ b/app/Models/FailedLoginAttempt.php @@ -52,7 +52,7 @@ class FailedLoginAttempt extends Model public static function record($user, $username, $ip) { return static::create([ - 'user_id' => is_null($user) ? null : $user->id, + 'user_id' => \is_null($user) ? null : $user->id, 'username' => $username, 'ip_address' => $ip, ]); diff --git a/app/Models/Forum.php b/app/Models/Forum.php index 3511a35126..bd889c8d02 100644 --- a/app/Models/Forum.php +++ b/app/Models/Forum.php @@ -90,7 +90,7 @@ public function topics() public function sub_topics() { $children = $this->forums->pluck('id')->toArray(); - if (is_array($children)) { + if (\is_array($children)) { return $this->hasMany(Topic::class)->orWhereIn('topics.forum_id', $children); } @@ -114,9 +114,9 @@ public function forums() */ public function subscription_topics() { - if (auth()->user() !== null) { + if (\auth()->user() !== null) { $id = $this->id; - $subscriptions = auth()->user()->subscriptions->where('topic_id', '>', '0')->pluck('topic_id')->toArray(); + $subscriptions = \auth()->user()->subscriptions->where('topic_id', '>', '0')->pluck('topic_id')->toArray(); return $this->hasMany(Topic::class)->where(function ($query) use ($id, $subscriptions) { $query->whereIn('topics.id', [$id])->orWhereIn('topics.id', $subscriptions); @@ -263,7 +263,7 @@ public function getTopicCount($forumId) */ public function getPermission() { - $group = auth()->check() ? auth()->user()->group : Group::where('slug', 'guest')->first(); + $group = \auth()->check() ? \auth()->user()->group : Group::where('slug', 'guest')->first(); return $group->permissions->where('forum_id', $this->id)->first(); } diff --git a/app/Models/Group.php b/app/Models/Group.php index 1c16ed98b1..2c51ac78da 100644 --- a/app/Models/Group.php +++ b/app/Models/Group.php @@ -129,7 +129,7 @@ public function getPermissionsByForum($forum) */ public function isAllowed($object, $group_id) { - if (is_array($object) && is_array($object['default_groups']) && array_key_exists($group_id, $object['default_groups'])) { + if (\is_array($object) && \is_array($object['default_groups']) && \array_key_exists($group_id, $object['default_groups'])) { return $object['default_groups'][$group_id] == 1; } diff --git a/app/Models/Language.php b/app/Models/Language.php index c10c9ed142..cbd1c46d9d 100644 --- a/app/Models/Language.php +++ b/app/Models/Language.php @@ -29,13 +29,13 @@ class Language public static function flag($code = 'default') { if ($code === 'default') { - $code = app()->getLocale(); + $code = \app()->getLocale(); } $name = self::getName($code); $code = self::country($code); - return view('vendor.language.flag', ['code' => $code, 'name' => $name]); + return \view('vendor.language.flag', ['code' => $code, 'name' => $name]); } /** @@ -48,14 +48,14 @@ public static function flag($code = 'default') public static function country($locale = 'default') { if ($locale === 'default') { - $locale = app()->getLocale(); + $locale = \app()->getLocale(); } - if (config('language.mode.code', 'short') == 'short') { - return strtolower(substr(self::getLongCode($locale), 3)); + if (\config('language.mode.code', 'short') == 'short') { + return \strtolower(\substr(self::getLongCode($locale), 3)); } - return strtolower(substr($locale, 3)); + return \strtolower(\substr($locale, 3)); } /** @@ -65,7 +65,7 @@ public static function country($locale = 'default') **/ public static function flags() { - return view('vendor.language.flags'); + return \view('vendor.language.flags'); } /** @@ -79,14 +79,14 @@ public static function flags() public static function allowed($locale = null) { if ($locale) { - return array_key_exists($locale, self::allowed()); + return \array_key_exists($locale, self::allowed()); } - if (config('language.allowed')) { - return self::names(array_merge(config('language.allowed'), [config('app.locale')])); + if (\config('language.allowed')) { + return self::names(\array_merge(\config('language.allowed'), [\config('app.locale')])); } - return self::names([config('app.locale')]); + return self::names([\config('app.locale')]); } /** @@ -99,10 +99,10 @@ public static function allowed($locale = null) public static function names($codes) { // Get mode - $mode = config('language.mode'); + $mode = \config('language.mode'); // Get languages from config - $languages = config('language.all'); + $languages = \config('language.all'); $array = []; @@ -132,10 +132,10 @@ public static function names($codes) public static function codes($langs) { // Get mode - $mode = config('language.mode'); + $mode = \config('language.mode'); // Get languages from config - $languages = config('language.all'); + $languages = \config('language.all'); $array = []; @@ -164,7 +164,7 @@ public static function codes($langs) **/ public static function back($code) { - return route('back', ['locale' => $code]); + return \route('back', ['locale' => $code]); } /** @@ -176,7 +176,7 @@ public static function back($code) **/ public static function home($code) { - return route('home', ['locale' => $code]); + return \route('home', ['locale' => $code]); } /** @@ -205,13 +205,13 @@ public static function getCode($name = 'default') public static function getLongCode($short = 'default') { if ($short === 'default') { - $short = app()->getLocale(); + $short = \app()->getLocale(); } $long = 'en-GB'; // Get languages from config - $languages = config('language.all'); + $languages = \config('language.all'); foreach ($languages as $language) { if ($language['short'] != $short) { @@ -234,13 +234,13 @@ public static function getLongCode($short = 'default') public static function getShortCode($long = 'default') { if ($long === 'default') { - $long = app()->getLocale(); + $long = \app()->getLocale(); } $short = 'en'; // Get languages from config - $languages = config('language.all'); + $languages = \config('language.all'); foreach ($languages as $language) { if ($language['long'] != $long) { @@ -263,7 +263,7 @@ public static function getShortCode($long = 'default') public static function getName($code = 'default') { if ($code === 'default') { - $code = app()->getLocale(); + $code = \app()->getLocale(); } return self::names([$code])[$code]; diff --git a/app/Models/Poll.php b/app/Models/Poll.php index 197eea7fc4..9cb73e2146 100644 --- a/app/Models/Poll.php +++ b/app/Models/Poll.php @@ -102,7 +102,7 @@ public function voters() */ public function setTitleAttribute($title) { - if (substr($title, -1) !== '?') { + if (\substr($title, -1) !== '?') { return $this->attributes['title'] = $title.'?'; } @@ -118,10 +118,10 @@ public function setTitleAttribute($title) */ public function makeSlugFromTitle($title) { - $slug = strlen($title) > 20 ? substr(Str::slug($title), 0, 20) : Str::slug($title); + $slug = \strlen($title) > 20 ? \substr(Str::slug($title), 0, 20) : Str::slug($title); $count = $this->where('slug', 'LIKE', "%$slug%")->count(); - return $count ? sprintf('%s-%s', $slug, $count) : $slug; + return $count ? \sprintf('%s-%s', $slug, $count) : $slug; } /** diff --git a/app/Models/Post.php b/app/Models/Post.php index 6ae5e482b4..2dd0d6ccb1 100644 --- a/app/Models/Post.php +++ b/app/Models/Post.php @@ -134,17 +134,17 @@ public function getBrief($length = 100, $ellipses = true, $strip_html = false) $input = $this->content; //strip tags, if desired if ($strip_html) { - $input = strip_tags($input); + $input = \strip_tags($input); } //no need to trim, already shorter than trim length - if (strlen($input) <= $length) { + if (\strlen($input) <= $length) { return $input; } //find last space within length - $last_space = strrpos(substr($input, 0, $length), ' '); - $trimmed_text = substr($input, 0, $last_space); + $last_space = \strrpos(\substr($input, 0, $length), ' '); + $trimmed_text = \substr($input, 0, $last_space); //add ellipses (...) if ($ellipses) { @@ -173,6 +173,6 @@ public function getPageNumber() { $result = ($this->getPostNumber() - 1) / 25 + 1; - return floor($result); + return \floor($result); } } diff --git a/app/Models/Rss.php b/app/Models/Rss.php index b8047181a7..aa1442622e 100644 --- a/app/Models/Rss.php +++ b/app/Models/Rss.php @@ -120,7 +120,7 @@ public function getObjectTorrentAttribute() if ($this->json_torrent) { $expected = $this->expected_fields; - return (object) array_merge($expected, $this->json_torrent); + return (object) \array_merge($expected, $this->json_torrent); } return false; diff --git a/app/Models/Topic.php b/app/Models/Topic.php index ffd6d9f789..de713a28bc 100644 --- a/app/Models/Topic.php +++ b/app/Models/Topic.php @@ -178,7 +178,7 @@ public function notifyStaffers($poster, $topic, $post) */ public function viewable() { - if (auth()->user()->group->is_modo) { + if (\auth()->user()->group->is_modo) { return true; } @@ -197,7 +197,7 @@ public function viewable() public function notifyStarter($poster, $topic, $post) { $user = User::find($topic->first_post_user_id); - if ($user->acceptsNotification(auth()->user(), $user, 'forum', 'show_forum_topic')) { + if ($user->acceptsNotification(\auth()->user(), $user, 'forum', 'show_forum_topic')) { $user->notify(new NewPost('topic', $poster, $post)); } diff --git a/app/Models/Torrent.php b/app/Models/Torrent.php index 7d8784e1b0..9660f6625e 100644 --- a/app/Models/Torrent.php +++ b/app/Models/Torrent.php @@ -408,7 +408,7 @@ public function getSize($bytes = null, $precision = 2) */ public function bookmarked() { - return (bool) Bookmark::where('user_id', '=', auth()->user()->id) + return (bool) Bookmark::where('user_id', '=', \auth()->user()->id) ->where('torrent_id', '=', $this->id) ->first(); } @@ -425,7 +425,7 @@ public function notifyUploader($type, $payload) { if ($type == 'thank') { $user = User::with('notification')->findOrFail($this->user_id); - if ($user->acceptsNotification(auth()->user(), $user, 'torrent', 'show_torrent_thank')) { + if ($user->acceptsNotification(\auth()->user(), $user, 'torrent', 'show_torrent_thank')) { $user->notify(new NewThank('torrent', $payload)); return true; @@ -434,7 +434,7 @@ public function notifyUploader($type, $payload) return true; } $user = User::with('notification')->findOrFail($this->user_id); - if ($user->acceptsNotification(auth()->user(), $user, 'torrent', 'show_torrent_comment')) { + if ($user->acceptsNotification(\auth()->user(), $user, 'torrent', 'show_torrent_comment')) { $user->notify(new NewComment('torrent', $payload)); return true; @@ -454,6 +454,6 @@ public function isFreeleech($user = null) { $pfree = $user ? $user->group->is_freeleech || PersonalFreeleech::where('user_id', '=', $user->id)->first() : false; - return $this->free || config('other.freeleech') || $pfree; + return $this->free || \config('other.freeleech') || $pfree; } } diff --git a/app/Models/TorrentRequest.php b/app/Models/TorrentRequest.php index fa86176f31..467963cbd1 100644 --- a/app/Models/TorrentRequest.php +++ b/app/Models/TorrentRequest.php @@ -245,7 +245,7 @@ public function getDescriptionHtml() public function notifyRequester($type, $payload) { $user = User::with('notification')->findOrFail($this->user_id); - if ($user->acceptsNotification(auth()->user(), $user, 'request', 'show_request_comment')) { + if ($user->acceptsNotification(\auth()->user(), $user, 'request', 'show_request_comment')) { $user->notify(new NewComment('request', $payload)); return true; diff --git a/app/Models/TwoStepAuth.php b/app/Models/TwoStepAuth.php index ef24b5b205..9d297f8e93 100644 --- a/app/Models/TwoStepAuth.php +++ b/app/Models/TwoStepAuth.php @@ -117,7 +117,7 @@ class TwoStepAuth extends Model */ public static function rules($merge = []) { - return array_merge( + return \array_merge( [ 'userId' => 'required|integer', 'authCode' => 'required|string|max:4|min:4', diff --git a/app/Models/User.php b/app/Models/User.php index 7cd72f15bd..353370d024 100644 --- a/app/Models/User.php +++ b/app/Models/User.php @@ -64,21 +64,21 @@ class User extends Authenticatable public function group() { return $this->belongsTo(Group::class)->withDefault([ - 'color' => config('user.group.defaults.color'), - 'effect' => config('user.group.defaults.effect'), - 'icon' => config('user.group.defaults.icon'), - 'name' => config('user.group.defaults.name'), - 'slug' => config('user.group.defaults.slug'), - 'position' => config('user.group.defaults.position'), - 'is_admin' => config('user.group.defaults.is_admin'), - 'is_freeleech' => config('user.group.defaults.is_freeleech'), - 'is_immune' => config('user.group.defaults.is_immune'), - 'is_incognito' => config('user.group.defaults.is_incognito'), - 'is_internal' => config('user.group.defaults.is_internal'), - 'is_modo' => config('user.group.defaults.is_modo'), - 'is_trusted' => config('user.group.defaults.is_trusted'), - 'can_upload' => config('user.group.defaults.can_upload'), - 'level' => config('user.group.defaults.level'), + 'color' => \config('user.group.defaults.color'), + 'effect' => \config('user.group.defaults.effect'), + 'icon' => \config('user.group.defaults.icon'), + 'name' => \config('user.group.defaults.name'), + 'slug' => \config('user.group.defaults.slug'), + 'position' => \config('user.group.defaults.position'), + 'is_admin' => \config('user.group.defaults.is_admin'), + 'is_freeleech' => \config('user.group.defaults.is_freeleech'), + 'is_immune' => \config('user.group.defaults.is_immune'), + 'is_incognito' => \config('user.group.defaults.is_incognito'), + 'is_internal' => \config('user.group.defaults.is_internal'), + 'is_modo' => \config('user.group.defaults.is_modo'), + 'is_trusted' => \config('user.group.defaults.is_trusted'), + 'can_upload' => \config('user.group.defaults.can_upload'), + 'level' => \config('user.group.defaults.level'), ]); } @@ -597,8 +597,8 @@ public function acceptsNotification(self $sender, self $target, $group = 'follow if ($target->notification && $type && (! $target->notification->$type)) { return false; } - if ($target->notification && $target->notification->$target_group && is_array($target->notification->$target_group['default_groups'])) { - if (array_key_exists($sender->group->id, $target->notification->$target_group['default_groups'])) { + if ($target->notification && $target->notification->$target_group && \is_array($target->notification->$target_group['default_groups'])) { + if (\array_key_exists($sender->group->id, $target->notification->$target_group['default_groups'])) { return $target->notification->$target_group['default_groups'][$sender->group->id] == 1; } @@ -620,7 +620,7 @@ public function acceptsNotification(self $sender, self $target, $group = 'follow public function isVisible(self $target, $group = 'profile', $type = false) { $target_group = 'json_'.$group.'_groups'; - $sender = auth()->user(); + $sender = \auth()->user(); if ($sender->id == $target->id) { return true; } @@ -633,8 +633,8 @@ public function isVisible(self $target, $group = 'profile', $type = false) if ($target->privacy && $type && (! $target->privacy->$type || $target->privacy->$type == 0)) { return false; } - if ($target->privacy && $target->privacy->$target_group && is_array($target->privacy->$target_group['default_groups'])) { - if (array_key_exists($sender->group->id, $target->privacy->$target_group['default_groups'])) { + if ($target->privacy && $target->privacy->$target_group && \is_array($target->privacy->$target_group['default_groups'])) { + if (\array_key_exists($sender->group->id, $target->privacy->$target_group['default_groups'])) { return $target->privacy->$target_group['default_groups'][$sender->group->id] == 1; } @@ -656,7 +656,7 @@ public function isVisible(self $target, $group = 'profile', $type = false) public function isAllowed(self $target, $group = 'profile', $type = false) { $target_group = 'json_'.$group.'_groups'; - $sender = auth()->user(); + $sender = \auth()->user(); if ($sender->id == $target->id) { return true; } @@ -669,8 +669,8 @@ public function isAllowed(self $target, $group = 'profile', $type = false) if ($target->privacy && $type && (! $target->privacy->$type || $target->privacy->$type == 0)) { return false; } - if ($target->privacy && $target->privacy->$target_group && is_array($target->privacy->$target_group['default_groups'])) { - if (array_key_exists($sender->group->id, $target->privacy->$target_group['default_groups'])) { + if ($target->privacy && $target->privacy->$target_group && \is_array($target->privacy->$target_group['default_groups'])) { + if (\array_key_exists($sender->group->id, $target->privacy->$target_group['default_groups'])) { return $target->privacy->$target_group['default_groups'][$sender->group->id] == 1; } @@ -756,14 +756,14 @@ public function getRatio() return INF; } - return (float) round($this->uploaded / $this->downloaded, 2); + return (float) \round($this->uploaded / $this->downloaded, 2); } // Return the ratio pretty formated as a string. public function getRatioString() { $ratio = $this->getRatio(); - if (is_infinite($ratio)) { + if (\is_infinite($ratio)) { return '∞'; } @@ -777,7 +777,7 @@ public function ratioAfterSize($size) return INF; } - return (float) round($this->uploaded / ($this->downloaded + $size), 2); + return (float) \round($this->uploaded / ($this->downloaded + $size), 2); } // Return the ratio after $size bytes would be downloaded, pretty formatted @@ -785,11 +785,11 @@ public function ratioAfterSize($size) public function ratioAfterSizeString($size, $freeleech = false) { if ($freeleech) { - return $this->getRatioString().' ('.trans('torrent.freeleech').')'; + return $this->getRatioString().' ('.\trans('torrent.freeleech').')'; } $ratio = $this->ratioAfterSize($size); - if (is_infinite($ratio)) { + if (\is_infinite($ratio)) { return '∞'; } @@ -804,7 +804,7 @@ public function untilRatio($ratio) return '∞'; } - $bytes = round(($this->uploaded / $ratio) - $this->downloaded); + $bytes = \round(($this->uploaded / $ratio) - $this->downloaded); return StringHelper::formatBytes($bytes); } @@ -875,7 +875,7 @@ public function getAboutHtml() */ public function getSeedbonus() { - return number_format($this->seedbonus, 2, '.', ' '); + return \number_format($this->seedbonus, 2, '.', ' '); } /** diff --git a/app/Notifications/FailedLogin.php b/app/Notifications/FailedLogin.php index d591079687..44bc2cc83e 100644 --- a/app/Notifications/FailedLogin.php +++ b/app/Notifications/FailedLogin.php @@ -88,9 +88,9 @@ public function toMail($notifiable) { return (new MailMessage()) ->error() - ->subject(trans('email.fail-login-subject')) - ->greeting(trans('email.fail-login-greeting')) - ->line(trans('email.fail-login-line1')) - ->line(trans('email.fail-login-line2', ['ip' => $this->ip, 'host' => gethostbyaddr($this->ip), 'time' => $this->carbon])); + ->subject(\trans('email.fail-login-subject')) + ->greeting(\trans('email.fail-login-greeting')) + ->line(\trans('email.fail-login-line1')) + ->line(\trans('email.fail-login-line2', ['ip' => $this->ip, 'host' => \gethostbyaddr($this->ip), 'time' => $this->carbon])); } } diff --git a/app/Notifications/NewBon.php b/app/Notifications/NewBon.php index b2be230fa1..6dacb87659 100644 --- a/app/Notifications/NewBon.php +++ b/app/Notifications/NewBon.php @@ -63,12 +63,12 @@ public function via($notifiable) */ public function toArray($notifiable) { - $appurl = config('app.url'); + $appurl = \config('app.url'); return [ 'title' => $this->sender.' Has Gifted You '.$this->transaction->cost.' BON', 'body' => $this->sender.' has gifted you '.$this->transaction->cost.' BON with the following note: '.$this->transaction->comment, - 'url' => sprintf('/users/%s', $this->transaction->senderObj->username), + 'url' => \sprintf('/users/%s', $this->transaction->senderObj->username), ]; } } diff --git a/app/Notifications/NewComment.php b/app/Notifications/NewComment.php index acf6cd279a..642449235f 100644 --- a/app/Notifications/NewComment.php +++ b/app/Notifications/NewComment.php @@ -58,7 +58,7 @@ public function via($notifiable) */ public function toArray($notifiable) { - $appurl = config('app.url'); + $appurl = \config('app.url'); if ($this->type == 'torrent') { if ($this->comment->anon == 0) { return [ diff --git a/app/Notifications/NewCommentTag.php b/app/Notifications/NewCommentTag.php index e6e2622cf9..181333686d 100644 --- a/app/Notifications/NewCommentTag.php +++ b/app/Notifications/NewCommentTag.php @@ -63,12 +63,12 @@ public function via($notifiable) */ public function toArray($notifiable) { - $appurl = config('app.url'); + $appurl = \config('app.url'); if ($this->type == 'torrent') { return [ 'title' => $this->tagger.' Has Tagged You In A Torrent Comment', 'body' => $this->tagger.' has tagged you in a Comment for Torrent '.$this->comment->torrent->name, - 'url' => sprintf('/torrents/%s', $this->comment->torrent->id), + 'url' => \sprintf('/torrents/%s', $this->comment->torrent->id), ]; } @@ -76,14 +76,14 @@ public function toArray($notifiable) return [ 'title' => $this->tagger.' Has Tagged You In A Request Comment', 'body' => $this->tagger.' has tagged you in a Comment for Request '.$this->comment->request->name, - 'url' => sprintf('/requests/%s', $this->comment->request->id), + 'url' => \sprintf('/requests/%s', $this->comment->request->id), ]; } return [ 'title' => $this->tagger.' Has Tagged You In An Article Comment', 'body' => $this->tagger.' has tagged you in a Comment for Article '.$this->comment->article->title, - 'url' => sprintf('/articles/%s', $this->comment->article->id), + 'url' => \sprintf('/articles/%s', $this->comment->article->id), ]; } } diff --git a/app/Notifications/NewFollow.php b/app/Notifications/NewFollow.php index 07e230c3ba..06ddabb3ef 100644 --- a/app/Notifications/NewFollow.php +++ b/app/Notifications/NewFollow.php @@ -68,12 +68,12 @@ public function via($notifiable) */ public function toArray($notifiable) { - $appurl = config('app.url'); + $appurl = \config('app.url'); return [ 'title' => $this->sender->username.' Has Followed You!', 'body' => $this->sender->username.' has started to follow you so they will get notifications about your activities.', - 'url' => sprintf('/users/%s', $this->sender->username), + 'url' => \sprintf('/users/%s', $this->sender->username), ]; } } diff --git a/app/Notifications/NewPost.php b/app/Notifications/NewPost.php index 2417fb9e44..ff7b87620b 100644 --- a/app/Notifications/NewPost.php +++ b/app/Notifications/NewPost.php @@ -64,13 +64,13 @@ public function via($notifiable) */ public function toArray($notifiable) { - $appurl = config('app.url'); + $appurl = \config('app.url'); if ($this->type == 'subscription') { return [ 'title' => $this->poster->username.' Has Posted In A Subscribed Topic', 'body' => $this->poster->username.' has left a new post in Subscribed Topic '.$this->post->topic->name, - 'url' => sprintf('/forums/topics/%s?page=%s#post-%s', $this->post->topic->id, $this->post->getPageNumber(), $this->post->id), + 'url' => \sprintf('/forums/topics/%s?page=%s#post-%s', $this->post->topic->id, $this->post->getPageNumber(), $this->post->id), ]; } @@ -78,14 +78,14 @@ public function toArray($notifiable) return [ 'title' => $this->poster->username.' Has Posted In A Staff Forum Topic', 'body' => $this->poster->username.' has left a new post in Staff Topic '.$this->post->topic->name, - 'url' => sprintf('%s?page=%s#post-%s', route('forum_topic', ['id' => $this->post->topic->id]), $this->post->getPageNumber(), $this->post->id), + 'url' => \sprintf('%s?page=%s#post-%s', \route('forum_topic', ['id' => $this->post->topic->id]), $this->post->getPageNumber(), $this->post->id), ]; } return [ 'title' => $this->poster->username.' Has Posted In A Topic You Started', 'body' => $this->poster->username.' has left a new post in Your Topic '.$this->post->topic->name, - 'url' => sprintf('/forums/topics/%s?page=%s#post-%s', $this->post->topic->id, $this->post->getPageNumber(), $this->post->id), + 'url' => \sprintf('/forums/topics/%s?page=%s#post-%s', $this->post->topic->id, $this->post->getPageNumber(), $this->post->id), ]; } } diff --git a/app/Notifications/NewPostTag.php b/app/Notifications/NewPostTag.php index a8dc0d416f..dbfaa071db 100644 --- a/app/Notifications/NewPostTag.php +++ b/app/Notifications/NewPostTag.php @@ -63,12 +63,12 @@ public function via($notifiable) */ public function toArray($notifiable) { - $appurl = config('app.url'); + $appurl = \config('app.url'); return [ 'title' => $this->tagger.' Has Tagged You In A Post', 'body' => $this->tagger.' has tagged you in a Post in Topic '.$this->post->topic->name, - 'url' => sprintf('/forums/topics/%s?page=%s#post-%s', $this->post->topic->id, $this->post->getPageNumber(), $this->post->id), + 'url' => \sprintf('/forums/topics/%s?page=%s#post-%s', $this->post->topic->id, $this->post->getPageNumber(), $this->post->id), ]; } } diff --git a/app/Notifications/NewPostTip.php b/app/Notifications/NewPostTip.php index c401446093..c7bccb9388 100644 --- a/app/Notifications/NewPostTip.php +++ b/app/Notifications/NewPostTip.php @@ -67,12 +67,12 @@ public function via($notifiable) */ public function toArray($notifiable) { - $appurl = config('app.url'); + $appurl = \config('app.url'); return [ 'title' => $this->tipper.' Has Tipped You '.$this->amount.' BON For A Forum Post', 'body' => $this->tipper.' has tipped one of your Forum posts in '.$this->post->topic->name, - 'url' => sprintf('/forums/topics/%s?page=%s#post-%s', $this->post->topic->id, $this->post->getPageNumber(), $this->post->id), + 'url' => \sprintf('/forums/topics/%s?page=%s#post-%s', $this->post->topic->id, $this->post->getPageNumber(), $this->post->id), ]; } } diff --git a/app/Notifications/NewRequestBounty.php b/app/Notifications/NewRequestBounty.php index 4ab46a2207..2bc5787899 100644 --- a/app/Notifications/NewRequestBounty.php +++ b/app/Notifications/NewRequestBounty.php @@ -67,12 +67,12 @@ public function via($notifiable) */ public function toArray($notifiable) { - $appurl = config('app.url'); + $appurl = \config('app.url'); return [ 'title' => $this->sender.' Has Added A Bounty Of '.$this->amount.' To A Requested Torrent', 'body' => $this->sender.' has added a bounty to one of your Requested Torrents '.$this->tr->name, - 'url' => sprintf('/requests/%s', $this->tr->id), + 'url' => \sprintf('/requests/%s', $this->tr->id), ]; } } diff --git a/app/Notifications/NewRequestClaim.php b/app/Notifications/NewRequestClaim.php index d54c3c7834..58bb76eff7 100644 --- a/app/Notifications/NewRequestClaim.php +++ b/app/Notifications/NewRequestClaim.php @@ -63,12 +63,12 @@ public function via($notifiable) */ public function toArray($notifiable) { - $appurl = config('app.url'); + $appurl = \config('app.url'); return [ 'title' => $this->sender.' Has Claimed One Of Your Requested Torrents', 'body' => $this->sender.' has claimed your Requested Torrent '.$this->tr->name, - 'url' => sprintf('/requests/%s', $this->tr->id), + 'url' => \sprintf('/requests/%s', $this->tr->id), ]; } } diff --git a/app/Notifications/NewRequestFill.php b/app/Notifications/NewRequestFill.php index 171fdcdc03..8b4a648408 100644 --- a/app/Notifications/NewRequestFill.php +++ b/app/Notifications/NewRequestFill.php @@ -63,12 +63,12 @@ public function via($notifiable) */ public function toArray($notifiable) { - $appurl = config('app.url'); + $appurl = \config('app.url'); return [ 'title' => $this->sender.' Has Filled One Of Your Torrent Requests', 'body' => $this->sender.' has filled one of your Requested Torrents '.$this->tr->name, - 'url' => sprintf('/requests/%s', $this->tr->id), + 'url' => \sprintf('/requests/%s', $this->tr->id), ]; } } diff --git a/app/Notifications/NewRequestFillApprove.php b/app/Notifications/NewRequestFillApprove.php index 5f648eb42c..f6d149c72d 100644 --- a/app/Notifications/NewRequestFillApprove.php +++ b/app/Notifications/NewRequestFillApprove.php @@ -63,12 +63,12 @@ public function via($notifiable) */ public function toArray($notifiable) { - $appurl = config('app.url'); + $appurl = \config('app.url'); return [ 'title' => $this->sender.' Has Approved Your Fill Of A Requested Torrent', 'body' => $this->sender.' has approved your fill of Requested Torrent '.$this->tr->name, - 'url' => sprintf('/requests/%s', $this->tr->id), + 'url' => \sprintf('/requests/%s', $this->tr->id), ]; } } diff --git a/app/Notifications/NewRequestFillReject.php b/app/Notifications/NewRequestFillReject.php index a6d6538dc1..98cd1e22d6 100644 --- a/app/Notifications/NewRequestFillReject.php +++ b/app/Notifications/NewRequestFillReject.php @@ -63,12 +63,12 @@ public function via($notifiable) */ public function toArray($notifiable) { - $appurl = config('app.url'); + $appurl = \config('app.url'); return [ 'title' => $this->sender.' Has Rejected Your Fill Of A Requested Torrent', 'body' => $this->sender.' has rejected your fill of Requested Torrent '.$this->tr->name, - 'url' => sprintf('/requests/%s', $this->tr->id), + 'url' => \sprintf('/requests/%s', $this->tr->id), ]; } } diff --git a/app/Notifications/NewRequestUnclaim.php b/app/Notifications/NewRequestUnclaim.php index d0ee929e60..cd606cc995 100644 --- a/app/Notifications/NewRequestUnclaim.php +++ b/app/Notifications/NewRequestUnclaim.php @@ -63,12 +63,12 @@ public function via($notifiable) */ public function toArray($notifiable) { - $appurl = config('app.url'); + $appurl = \config('app.url'); return [ 'title' => $this->sender.' Has Unclaimed One Of Your Requested Torrents', 'body' => $this->sender.' has unclaimed your Requested Torrent '.$this->tr->name, - 'url' => sprintf('/requests/%s', $this->tr->id), + 'url' => \sprintf('/requests/%s', $this->tr->id), ]; } } diff --git a/app/Notifications/NewReseedRequest.php b/app/Notifications/NewReseedRequest.php index 93f817e923..68b60c6b55 100644 --- a/app/Notifications/NewReseedRequest.php +++ b/app/Notifications/NewReseedRequest.php @@ -55,12 +55,12 @@ public function via($notifiable) */ public function toArray($notifiable) { - $appurl = config('app.url'); + $appurl = \config('app.url'); return [ 'title' => 'New Reseed Request', - 'body' => sprintf('Some time ago, you downloaded: %s. Now its dead and someone has requested a reseed on it. If you still have this torrent in storage, please consider reseeding it!', $this->torrent->name), - 'url' => sprintf('%s/torrents/%s', $appurl, $this->torrent->id), + 'body' => \sprintf('Some time ago, you downloaded: %s. Now its dead and someone has requested a reseed on it. If you still have this torrent in storage, please consider reseeding it!', $this->torrent->name), + 'url' => \sprintf('%s/torrents/%s', $appurl, $this->torrent->id), ]; } } diff --git a/app/Notifications/NewThank.php b/app/Notifications/NewThank.php index 355feed1a1..d0729932da 100644 --- a/app/Notifications/NewThank.php +++ b/app/Notifications/NewThank.php @@ -58,7 +58,7 @@ public function via($notifiable) */ public function toArray($notifiable) { - $appurl = config('app.url'); + $appurl = \config('app.url'); return [ 'title' => $this->thank->user->username.' Has Thanked You For An Uploaded Torrent', diff --git a/app/Notifications/NewTopic.php b/app/Notifications/NewTopic.php index 8e90f774ca..8ec70fa9a8 100644 --- a/app/Notifications/NewTopic.php +++ b/app/Notifications/NewTopic.php @@ -64,20 +64,20 @@ public function via($notifiable) */ public function toArray($notifiable) { - $appurl = config('app.url'); + $appurl = \config('app.url'); if ($this->type == 'staff') { return [ 'title' => $this->poster->username.' Has Posted In A Staff Forum', 'body' => $this->poster->username.' has started a new staff topic in '.$this->topic->forum->name, - 'url' => route('forum_topic', ['id' => $this->topic->id]), + 'url' => \route('forum_topic', ['id' => $this->topic->id]), ]; } return [ 'title' => $this->poster->username.' Has Posted In A Subscribed Forum', 'body' => $this->poster->username.' has started a new topic in '.$this->topic->forum->name, - 'url' => sprintf('/forums/topics/%s', $this->topic->id), + 'url' => \sprintf('/forums/topics/%s', $this->topic->id), ]; } } diff --git a/app/Notifications/NewUnfollow.php b/app/Notifications/NewUnfollow.php index 4cd4b75f38..4df01cfdc6 100644 --- a/app/Notifications/NewUnfollow.php +++ b/app/Notifications/NewUnfollow.php @@ -63,7 +63,7 @@ public function via($notifiable) */ public function toArray($notifiable) { - $appurl = config('app.url'); + $appurl = \config('app.url'); return [ 'title' => $this->sender->username.' Has Unfollowed You!', diff --git a/app/Notifications/NewUpload.php b/app/Notifications/NewUpload.php index 1024bb168f..15642490f6 100644 --- a/app/Notifications/NewUpload.php +++ b/app/Notifications/NewUpload.php @@ -61,12 +61,12 @@ public function via($notifiable) */ public function toArray($notifiable) { - $appurl = config('app.url'); + $appurl = \config('app.url'); return [ 'title' => $this->torrent->user->username.' Has Uploaded A New Torrent', - 'body' => sprintf('%s, whom you are following has uploaded Torrent %s', $this->torrent->user->username, $this->torrent->name), - 'url' => sprintf('/torrents/%s', $this->torrent->id), + 'body' => \sprintf('%s, whom you are following has uploaded Torrent %s', $this->torrent->user->username, $this->torrent->name), + 'url' => \sprintf('/torrents/%s', $this->torrent->id), ]; } } diff --git a/app/Notifications/NewUploadTip.php b/app/Notifications/NewUploadTip.php index a4fa1a6216..b13af81907 100644 --- a/app/Notifications/NewUploadTip.php +++ b/app/Notifications/NewUploadTip.php @@ -67,12 +67,12 @@ public function via($notifiable) */ public function toArray($notifiable) { - $appurl = config('app.url'); + $appurl = \config('app.url'); return [ 'title' => $this->tipper.' Has Tipped You '.$this->amount.' BON For An Uploaded Torrent', 'body' => $this->tipper.' has tipped one of your Uploaded Torrents '.$this->torrent->name, - 'url' => sprintf('/torrents/%s', $this->torrent->id), + 'url' => \sprintf('/torrents/%s', $this->torrent->id), ]; } } diff --git a/app/Notifications/TwoStepAuthCode.php b/app/Notifications/TwoStepAuthCode.php index b8418d7df5..2bcd23b9f2 100644 --- a/app/Notifications/TwoStepAuthCode.php +++ b/app/Notifications/TwoStepAuthCode.php @@ -60,11 +60,11 @@ public function via($notifiable) public function toMail($notifiable) { return (new MailMessage()) - ->from(config('auth.verificationEmailFrom'), config('auth.verificationEmailFromName')) - ->subject(trans('auth.verificationEmailSubject')) - ->greeting(trans('auth.verificationEmailGreeting', ['username' => $this->user->name])) - ->line(trans('auth.verificationEmailMessage')) + ->from(\config('auth.verificationEmailFrom'), \config('auth.verificationEmailFromName')) + ->subject(\trans('auth.verificationEmailSubject')) + ->greeting(\trans('auth.verificationEmailGreeting', ['username' => $this->user->name])) + ->line(\trans('auth.verificationEmailMessage')) ->line($this->code) - ->action(trans('auth.verificationEmailButton'), route('verificationNeeded')); + ->action(\trans('auth.verificationEmailButton'), \route('verificationNeeded')); } } diff --git a/app/Notifications/UsernameReminder.php b/app/Notifications/UsernameReminder.php index 6c1b067a42..157c560811 100644 --- a/app/Notifications/UsernameReminder.php +++ b/app/Notifications/UsernameReminder.php @@ -54,10 +54,10 @@ public function via($notifiable) public function toMail($notifiable) { return (new MailMessage()) - ->subject(trans('common.your').' '.config('app.name').' '.trans('common.username')) - ->greeting(trans('common.contact-header').', '.$notifiable->username) - ->line(trans('email.username-reminder').' '.$notifiable->username) - ->action('Login as '.$notifiable->username, route('login')) - ->line(trans('email.thanks').' '.config('app.name')); + ->subject(\trans('common.your').' '.\config('app.name').' '.\trans('common.username')) + ->greeting(\trans('common.contact-header').', '.$notifiable->username) + ->line(\trans('email.username-reminder').' '.$notifiable->username) + ->action('Login as '.$notifiable->username, \route('login')) + ->line(\trans('email.thanks').' '.\config('app.name')); } } diff --git a/app/Observers/TorrentObserver.php b/app/Observers/TorrentObserver.php index a5bab81ef7..28e42c066f 100644 --- a/app/Observers/TorrentObserver.php +++ b/app/Observers/TorrentObserver.php @@ -27,7 +27,7 @@ class TorrentObserver */ public function created(Torrent $torrent) { - Cache::put(sprintf('torrent.%s', $torrent->info_hash), $torrent); + Cache::put(\sprintf('torrent.%s', $torrent->info_hash), $torrent); } /** @@ -39,7 +39,7 @@ public function created(Torrent $torrent) */ public function updated(Torrent $torrent) { - Cache::put(sprintf('torrent.%s', $torrent->info_hash), $torrent); + Cache::put(\sprintf('torrent.%s', $torrent->info_hash), $torrent); } /** @@ -51,7 +51,7 @@ public function updated(Torrent $torrent) */ public function retrieved(Torrent $torrent) { - Cache::add(sprintf('torrent.%s', $torrent->info_hash), $torrent); + Cache::add(\sprintf('torrent.%s', $torrent->info_hash), $torrent); } /** @@ -63,7 +63,7 @@ public function retrieved(Torrent $torrent) */ public function deleted(Torrent $torrent) { - Cache::forget(sprintf('torrent.%s', $torrent->info_hash)); + Cache::forget(\sprintf('torrent.%s', $torrent->info_hash)); } /** @@ -75,6 +75,6 @@ public function deleted(Torrent $torrent) */ public function restored(Torrent $torrent) { - Cache::put(sprintf('torrent.%s', $torrent->info_hash), $torrent); + Cache::put(\sprintf('torrent.%s', $torrent->info_hash), $torrent); } } diff --git a/app/Observers/UserObserver.php b/app/Observers/UserObserver.php index 3c7b207ce7..8c84350633 100644 --- a/app/Observers/UserObserver.php +++ b/app/Observers/UserObserver.php @@ -27,7 +27,7 @@ class UserObserver */ public function created(User $user) { - Cache::put(sprintf('user.%s', $user->passkey), $user); + Cache::put(\sprintf('user.%s', $user->passkey), $user); } /** @@ -39,7 +39,7 @@ public function created(User $user) */ public function updated(User $user) { - Cache::put(sprintf('user.%s', $user->passkey), $user); + Cache::put(\sprintf('user.%s', $user->passkey), $user); } /** @@ -51,7 +51,7 @@ public function updated(User $user) */ public function retrieved(User $user) { - Cache::add(sprintf('user.%s', $user->passkey), $user); + Cache::add(\sprintf('user.%s', $user->passkey), $user); } /** @@ -63,7 +63,7 @@ public function retrieved(User $user) */ public function deleted(User $user) { - Cache::forget(sprintf('user.%s', $user->passkey)); + Cache::forget(\sprintf('user.%s', $user->passkey)); } /** @@ -75,6 +75,6 @@ public function deleted(User $user) */ public function restored(User $user) { - Cache::put(sprintf('user.%s', $user->passkey), $user); + Cache::put(\sprintf('user.%s', $user->passkey), $user); } } diff --git a/app/Providers/AppServiceProvider.php b/app/Providers/AppServiceProvider.php index 4f74a973e8..dc03d21880 100644 --- a/app/Providers/AppServiceProvider.php +++ b/app/Providers/AppServiceProvider.php @@ -43,7 +43,7 @@ public function register() { // OMDB $this->app->bind(OmdbClient::class, function ($app) { - $key = config('api-keys.omdb'); + $key = \config('api-keys.omdb'); return new OmdbClient($key); }); @@ -71,20 +71,20 @@ public function boot() Torrent::observe(TorrentObserver::class); // Share $footer_pages across all views - view()->composer('*', function (View $view) { - $footer_pages = cache()->remember('cached-pages', 3_600, fn () => Page::select(['id', 'name', 'slug', 'created_at'])->take(6)->get()); + \view()->composer('*', function (View $view) { + $footer_pages = \cache()->remember('cached-pages', 3_600, fn () => Page::select(['id', 'name', 'slug', 'created_at'])->take(6)->get()); $view->with(['footer_pages' => $footer_pages]); }); // Hidden Captcha - Blade::directive('hiddencaptcha', fn ($mustBeEmptyField = '_username') => sprintf('', $mustBeEmptyField)); + Blade::directive('hiddencaptcha', fn ($mustBeEmptyField = '_username') => \sprintf('', $mustBeEmptyField)); $this->app['validator']->extendImplicit( 'hiddencaptcha', function ($attribute, $value, $parameters, $validator) { - $minLimit = (isset($parameters[0]) && is_numeric($parameters[0])) ? $parameters[0] : 0; - $maxLimit = (isset($parameters[1]) && is_numeric($parameters[1])) ? $parameters[1] : 1_200; + $minLimit = (isset($parameters[0]) && \is_numeric($parameters[0])) ? $parameters[0] : 0; + $maxLimit = (isset($parameters[1]) && \is_numeric($parameters[1])) ? $parameters[1] : 1_200; if (! HiddenCaptcha::check($validator, $minLimit, $maxLimit)) { $validator->setCustomMessages(['hiddencaptcha' => 'Captcha error']); diff --git a/app/Providers/BroadcastServiceProvider.php b/app/Providers/BroadcastServiceProvider.php index 0d14b0a3c2..99cc87e135 100644 --- a/app/Providers/BroadcastServiceProvider.php +++ b/app/Providers/BroadcastServiceProvider.php @@ -27,6 +27,6 @@ public function boot() { Broadcast::routes(); - require base_path('routes/channels.php'); + require \base_path('routes/channels.php'); } } diff --git a/app/Providers/RouteServiceProvider.php b/app/Providers/RouteServiceProvider.php index 176fee3110..abde8d4935 100644 --- a/app/Providers/RouteServiceProvider.php +++ b/app/Providers/RouteServiceProvider.php @@ -58,7 +58,7 @@ protected function mapVueApiRoutes() Route::prefix('api') ->middleware(['web', 'auth']) ->namespace($this->namespace) - ->group(base_path('routes/vue.php')); + ->group(\base_path('routes/vue.php')); } /** @@ -72,7 +72,7 @@ protected function mapWebRoutes() { Route::middleware('web') ->namespace($this->namespace) - ->group(base_path('routes/web.php')); + ->group(\base_path('routes/web.php')); } /** @@ -87,6 +87,6 @@ protected function mapApiRoutes() Route::prefix('api') ->middleware('api') ->namespace($this->namespace) - ->group(base_path('routes/api.php')); + ->group(\base_path('routes/api.php')); } } diff --git a/app/Repositories/ChatRepository.php b/app/Repositories/ChatRepository.php index bb42a954b0..ebd7708b2f 100644 --- a/app/Repositories/ChatRepository.php +++ b/app/Repositories/ChatRepository.php @@ -77,7 +77,7 @@ public function __construct(Message $message, Chatroom $chatroom, ChatStatus $ch public function config() { - return config('chat'); + return \config('chat'); } public function bots() @@ -128,7 +128,7 @@ public function ping($type, $id) if ($type == 'room') { $rooms = Chatroom::where('id', '>', 0)->get(); foreach ($rooms as $room) { - broadcast(new Ping($room->id, $id)); + \broadcast(new Ping($room->id, $id)); } } @@ -153,7 +153,7 @@ public function message($user_id, $room_id, $message, $receiver = null, $bot = n $this->checkMessageLimits($room_id); - broadcast(new MessageSent($message)); + \broadcast(new MessageSent($message)); return $message; } @@ -181,8 +181,8 @@ public function botMessage($bot_id, $room_id, $message, $receiver = null) 'receiver.chatStatus', ])->find($save->id); - event(new Chatter('new.bot', $receiver, new ChatMessageResource($message))); - event(new Chatter('new.ping', $receiver, ['type' => 'bot', 'id' => $bot_id])); + \event(new Chatter('new.bot', $receiver, new ChatMessageResource($message))); + \event(new Chatter('new.ping', $receiver, ['type' => 'bot', 'id' => $bot_id])); $message->delete(); } @@ -210,12 +210,12 @@ public function privateMessage($user_id, $room_id, $message, $receiver = null, $ ])->find($save->id); if ($ignore != null) { - event(new Chatter('new.message', $user_id, new ChatMessageResource($message))); + \event(new Chatter('new.message', $user_id, new ChatMessageResource($message))); } - event(new Chatter('new.message', $receiver, new ChatMessageResource($message))); + \event(new Chatter('new.message', $receiver, new ChatMessageResource($message))); if ($receiver != 1) { - event(new Chatter('new.ping', $receiver, ['type' => 'target', 'id' => $user_id])); + \event(new Chatter('new.ping', $receiver, ['type' => 'target', 'id' => $user_id])); } return $message; @@ -226,7 +226,7 @@ public function deleteMessage($id) $message = $this->message->find($id); if ($message) { - broadcast(new MessageDeleted($message)); + \broadcast(new MessageDeleted($message)); return $message->delete(); } @@ -245,7 +245,7 @@ public function messages($room_id) $query->where('chatroom_id', '=', $room_id); }) ->orderBy('id', 'desc') - ->limit(config('chat.message_limit')) + ->limit(\config('chat.message_limit')) ->get(); } @@ -264,7 +264,7 @@ public function botMessages($sender_id, $bot_id) $query->whereRaw('(user_id = ? and receiver_id = ?)', [$sender_id, $systemUserId])->orWhereRaw('(user_id = ? and receiver_id = ?)', [$systemUserId, $sender_id]); })->where('bot_id', '=', $bot_id) ->orderBy('id', 'desc') - ->limit(config('chat.message_limit')) + ->limit(\config('chat.message_limit')) ->get(); } @@ -281,20 +281,20 @@ public function privateMessages($sender_id, $target_id) $query->whereRaw('(user_id = ? and receiver_id = ?)', [$sender_id, $target_id])->orWhereRaw('(user_id = ? and receiver_id = ?)', [$target_id, $sender_id]); }) ->orderBy('id', 'desc') - ->limit(config('chat.message_limit')) + ->limit(\config('chat.message_limit')) ->get(); } public function checkMessageLimits($room_id) { $messages = $this->messages($room_id)->toArray(); - $limit = config('chat.message_limit'); - $count = is_countable($messages) ? count($messages) : 0; + $limit = \config('chat.message_limit'); + $count = \is_countable($messages) ? \count($messages) : 0; // Lets purge all old messages and keep the database to the limit settings if ($count > $limit) { for ($x = 1; $x <= $count - $limit; $x++) { - $message = array_pop($messages); + $message = \array_pop($messages); echo $message['id']."\n"; $message = $this->message->find($message['id']); @@ -323,17 +323,17 @@ public function systemMessage($message, $bot = null) public function systemChatroom($room = null) { - $config = config('chat.system_chatroom'); + $config = \config('chat.system_chatroom'); if ($room !== null) { if ($room instanceof Chatroom) { $room = $room->id; - } elseif (is_int($room)) { + } elseif (\is_int($room)) { $room = $this->chatroom->findOrFail($room)->id; } else { $room = $this->chatroom->whereName($room)->first()->id; } - } elseif (is_int($config)) { + } elseif (\is_int($config)) { $room = $this->chatroom->findOrFail($config)->id; } elseif ($config instanceof Chatroom) { $room = $config->id; @@ -355,7 +355,7 @@ public function status($user) $status = $this->chatStatus->where('user_id', '=', $user->id)->first(); } - if (is_int($user)) { + if (\is_int($user)) { $status = $this->chatStatus->where('user_id', '=', $user)->first(); } @@ -374,15 +374,15 @@ public function statusFindOrFail($id) */ protected function censorMessage($message) { - foreach (config('censor.redact') as $word) { - if (preg_match(sprintf('/\b%s(?=[.,]|$|\s)/mi', $word), $message)) { - $message = str_replace($word, sprintf("%s", $word), $message); + foreach (\config('censor.redact') as $word) { + if (\preg_match(\sprintf('/\b%s(?=[.,]|$|\s)/mi', $word), $message)) { + $message = \str_replace($word, \sprintf("%s", $word), $message); } } - foreach (config('censor.replace') as $word => $rword) { + foreach (\config('censor.replace') as $word => $rword) { if (Str::contains($message, $word)) { - $message = str_replace($word, $rword, $message); + $message = \str_replace($word, $rword, $message); } } diff --git a/app/Repositories/RequestFacetedRepository.php b/app/Repositories/RequestFacetedRepository.php index c6a52e3844..569662c306 100644 --- a/app/Repositories/RequestFacetedRepository.php +++ b/app/Repositories/RequestFacetedRepository.php @@ -57,10 +57,10 @@ public function resolutions() public function sorting() { return [ - 'created_at' => trans('torrent.date'), - 'name' => trans('torrent.name'), - 'bounty' => trans('request.bounty'), - 'votes' => trans('request.votes'), + 'created_at' => \trans('torrent.date'), + 'name' => \trans('torrent.name'), + 'bounty' => \trans('request.bounty'), + 'votes' => \trans('request.votes'), ]; } @@ -72,8 +72,8 @@ public function sorting() public function direction() { return [ - 'desc' => trans('common.descending'), - 'asc' => trans('common.ascending'), + 'desc' => \trans('common.descending'), + 'asc' => \trans('common.ascending'), ]; } } diff --git a/app/Repositories/TaggedUserRepository.php b/app/Repositories/TaggedUserRepository.php index 8ec2950ddc..5ee839aff6 100644 --- a/app/Repositories/TaggedUserRepository.php +++ b/app/Repositories/TaggedUserRepository.php @@ -65,7 +65,7 @@ public function __construct(User $user, PrivateMessage $privateMessage) */ public function getTags($content) { - preg_match_all($this->regex, $content, $tagged); + \preg_match_all($this->regex, $content, $tagged); return $tagged[0]; } @@ -88,13 +88,13 @@ public function hasTags($content) */ public function contains($haystack, $needle) { - return collect($this->getTags($haystack))->contains($needle); + return \collect($this->getTags($haystack))->contains($needle); } public function messageTaggedCommentUsers(string $type, string $content, User $user, $alias, Comment $comment) { foreach ($this->getTags($content) as $username) { - $tagged_user = $this->user->where('username', str_replace('@', '', $username))->first(); + $tagged_user = $this->user->where('username', \str_replace('@', '', $username))->first(); $this->messageCommentUsers($type, $tagged_user, $user, $alias, $comment); } @@ -104,9 +104,9 @@ public function messageTaggedCommentUsers(string $type, string $content, User $u public function messageCommentUsers($type, $users, $sender, $alias, Comment $comment) { // Array of User objects - if (is_iterable($users)) { + if (\is_iterable($users)) { // we only want unique users from the collection - $users = is_array($users) ? collect($users)->unique() : $users->unique(); + $users = \is_array($users) ? \collect($users)->unique() : $users->unique(); foreach ($users as $user) { if ($this->validate($user) && $user->acceptsNotification($sender, $user, 'mention', 'show_mention_'.$type.'_comment')) { @@ -129,7 +129,7 @@ public function messageCommentUsers($type, $users, $sender, $alias, Comment $com public function messageTaggedPostUsers(string $type, string $content, User $user, $alias, Post $post) { foreach ($this->getTags($content) as $username) { - $tagged_user = $this->user->where('username', str_replace('@', '', $username))->first(); + $tagged_user = $this->user->where('username', \str_replace('@', '', $username))->first(); $this->messagePostUsers($type, $tagged_user, $user, $alias, $post); } @@ -139,9 +139,9 @@ public function messageTaggedPostUsers(string $type, string $content, User $user public function messagePostUsers($type, $users, $sender, $alias, Post $post) { // Array of User objects - if (is_iterable($users)) { + if (\is_iterable($users)) { // we only want unique users from the collection - $users = is_array($users) ? collect($users)->unique() : $users->unique(); + $users = \is_array($users) ? \collect($users)->unique() : $users->unique(); foreach ($users as $user) { if ($this->validate($user) && $user->acceptsNotification($sender, $user, 'mention', 'show_mention_'.$type.'_post')) { @@ -178,6 +178,6 @@ public function setDebug(bool $debug): void protected function validate($user) { - return is_object($user); + return \is_object($user); } } diff --git a/app/Repositories/TorrentFacetedRepository.php b/app/Repositories/TorrentFacetedRepository.php index e92d6ef718..32f44cb2db 100644 --- a/app/Repositories/TorrentFacetedRepository.php +++ b/app/Repositories/TorrentFacetedRepository.php @@ -68,12 +68,12 @@ public function tags() public function sorting() { return [ - 'created_at' => trans('torrent.date'), - 'name' => trans('torrent.name'), - 'seeders' => trans('torrent.seeders'), - 'leechers' => trans('torrent.leechers'), - 'times_completed' => trans('torrent.completed-times'), - 'size' => trans('torrent.size'), + 'created_at' => \trans('torrent.date'), + 'name' => \trans('torrent.name'), + 'seeders' => \trans('torrent.seeders'), + 'leechers' => \trans('torrent.leechers'), + 'times_completed' => \trans('torrent.completed-times'), + 'size' => \trans('torrent.size'), ]; } @@ -85,8 +85,8 @@ public function sorting() public function direction() { return [ - 'desc' => trans('common.descending'), - 'asc' => trans('common.ascending'), + 'desc' => \trans('common.descending'), + 'asc' => \trans('common.ascending'), ]; } } diff --git a/app/Repositories/WishRepository.php b/app/Repositories/WishRepository.php index 6c00c3d6a2..9219e50b78 100644 --- a/app/Repositories/WishRepository.php +++ b/app/Repositories/WishRepository.php @@ -118,7 +118,7 @@ public function exists($uid, $id) */ public function isGranted($id) { - $id = str_replace('tt', '', $id); + $id = \str_replace('tt', '', $id); return (bool) $this->torrent ->where('imdb', '=', $id) @@ -135,14 +135,14 @@ public function isGranted($id) public function getSource($id) { if ($this->isGranted($id)) { - $id = str_replace('tt', '', $id); + $id = \str_replace('tt', '', $id); $source = $this->torrent ->where('imdb', '=', $id) ->where('seeders', '>', 0) ->where('status', '=', 1) ->first(); - return route('torrent', ['id' => $source->id]); + return \route('torrent', ['id' => $source->id]); } return $this->findById($id)->source ?? null; diff --git a/app/Services/Clients/Client.php b/app/Services/Clients/Client.php index 1d705bb1d9..2d71a40173 100644 --- a/app/Services/Clients/Client.php +++ b/app/Services/Clients/Client.php @@ -34,7 +34,7 @@ public function __construct($apiUrl, $apiKey = null) public function request($url, array $options = []) { - $key = md5($url.serialize($options)); + $key = \md5($url.\serialize($options)); if ($cache = $this->cache($key)) { return $cache; } @@ -54,12 +54,12 @@ public function request($url, array $options = []) public function toArray($string) { - return json_decode($string, true); + return \json_decode($string, true); } public function toJson(array $array, $options = 0) { - return json_encode($array, $options); + return \json_encode($array, $options); } public function cache($key, $data = null) @@ -67,11 +67,11 @@ public function cache($key, $data = null) $key = 'movietvdb:'.$key; if ($data) { - cache()->remember($key, 7 * 24 * 60, fn () => serialize($data)); + \cache()->remember($key, 7 * 24 * 60, fn () => \serialize($data)); } - if (cache()->has($key)) { - return unserialize(cache()->get($key)); + if (\cache()->has($key)) { + return \unserialize(\cache()->get($key)); } return $data; diff --git a/app/Services/Clients/MangaUpdatesClient.php b/app/Services/Clients/MangaUpdatesClient.php index 23650a479a..21d65bff3f 100644 --- a/app/Services/Clients/MangaUpdatesClient.php +++ b/app/Services/Clients/MangaUpdatesClient.php @@ -43,21 +43,21 @@ public function manga($id) $data = []; $data['description'] = $crawler->filter('.sContainer .sContent')->first()->html(); - preg_match( + \preg_match( '#(?:class\=\"sCat\"\>\Associated Names\<\/b\>\<\/div\>)+\n?(?:\
)(.+)(?:\n?+\<\/div\>)#i', $webpage, $aka_titles ); - $aka_titles = explode('
', $aka_titles[1]); - $data['aka_titles'] = array_filter($aka_titles, 'html_entity_decode'); + $aka_titles = \explode('
', $aka_titles[1]); + $data['aka_titles'] = \array_filter($aka_titles, 'html_entity_decode'); - preg_match( + \preg_match( '#(?:class\=\"sCat\"\>\Genre\<\/b\>\<\/div\>)+\n?(?:\
)(.+)(?:\n?+\<\/div\>)#i', $webpage, $genre_block ); - preg_match_all('#series\.html\?act\=genresearch\&\;genre\=([\w-+]+)#i', $genre_block[1], $genres); - $data['genres'] = array_filter($genres[1], 'urldecode'); + \preg_match_all('#series\.html\?act\=genresearch\&\;genre\=([\w-+]+)#i', $genre_block[1], $genres); + $data['genres'] = \array_filter($genres[1], 'urldecode'); return $data; } diff --git a/app/Services/Clients/OmdbClient.php b/app/Services/Clients/OmdbClient.php index 50b3c76954..1fa0277f85 100644 --- a/app/Services/Clients/OmdbClient.php +++ b/app/Services/Clients/OmdbClient.php @@ -36,7 +36,7 @@ public function find($keys, $type = null) $result = $this->toArray($this->request($url)); if (isset($result['Response']) && $result['Response'] == 'True') { - return array_map(function ($value) { + return \array_map(function ($value) { if ($value == 'N/A') { return; } @@ -63,7 +63,7 @@ public function person($id) private function formatMovie($movie, $type = 'movie') { - if (is_array($movie) && $movie['Type'] != $type) { + if (\is_array($movie) && $movie['Type'] != $type) { return ($type == 'movie') ? new Movie([]) : new Tv([]); } @@ -80,7 +80,7 @@ private function formatMovie($movie, $type = 'movie') 'wikiUrl' => null, 'rated' => $movie['Rated'], 'imdbRating' => $movie['imdbRating'], - 'imdbVotes' => str_replace(',', '', $movie['imdbVotes']), + 'imdbVotes' => \str_replace(',', '', $movie['imdbVotes']), ]; return ($type == 'movie') ? new Movie($data) : new Tv($data); @@ -90,11 +90,11 @@ private function formatLanguages($languages) { $movie_languages = []; if (! empty($languages)) { - $languages = explode(',', $languages); + $languages = \explode(',', $languages); foreach ($languages as $language) { $movie_languages[] = [ 'code' => null, - 'language' => trim($language), + 'language' => \trim($language), ]; } } @@ -106,9 +106,9 @@ private function formatGenres($genres) { $movie_genres = []; if (! empty($genres)) { - $genres = explode(',', $genres); + $genres = \explode(',', $genres); foreach ($genres as $genre) { - $movie_genres[] = trim($genre); + $movie_genres[] = \trim($genre); } } @@ -117,6 +117,6 @@ private function formatGenres($genres) private function resizePoster($poster) { - return str_replace('SX300', 'SX780', $poster); + return \str_replace('SX300', 'SX780', $poster); } } diff --git a/app/Services/Clients/TmdbClient.php b/app/Services/Clients/TmdbClient.php index 32f7079a42..d48a221b2c 100644 --- a/app/Services/Clients/TmdbClient.php +++ b/app/Services/Clients/TmdbClient.php @@ -48,7 +48,7 @@ public function find($keys, $type = 'movie') $this->validateKeys($keys); if ($type === 'movie' && isset($keys['imdb'])) { - $url = $this->apiUrl.'find/'.$keys['imdb'].'?api_key='.$this->apiKey.'&external_source=imdb_id&language='.config('app.locale'); + $url = $this->apiUrl.'find/'.$keys['imdb'].'?api_key='.$this->apiKey.'&external_source=imdb_id&language='.\config('app.locale'); $results = $this->toArray($this->request($url)); if (isset($results['movie_results'][0]['id'])) { return $this->movie($results['movie_results'][0]['id']); @@ -88,7 +88,7 @@ public function movie($id, $type = 'movie') { $this->validateKeys(['tmdb' => $id]); - $url = $this->apiUrl.$type.'/'.$id.'?append_to_response=recommendations,alternative_titles,credits,videos,images,keywords,external_ids&api_key='.$this->apiKey.'&language='.config('app.locale'); + $url = $this->apiUrl.$type.'/'.$id.'?append_to_response=recommendations,alternative_titles,credits,videos,images,keywords,external_ids&api_key='.$this->apiKey.'&language='.\config('app.locale'); $movie = $this->toArray($this->request($url)); if ($type === 'tv') { @@ -107,7 +107,7 @@ public function person($id) { $this->validateKeys(['tmdb' => $id]); - $url = $this->apiUrl.'person/'.$id.'?append_to_response=movie_credits,tv_credits,external_ids,images&api_key='.$this->apiKey.'&language='.config('app.locale'); + $url = $this->apiUrl.'person/'.$id.'?append_to_response=movie_credits,tv_credits,external_ids,images&api_key='.$this->apiKey.'&language='.\config('app.locale'); return $this->formatPerson($this->toArray($this->request($url))); } @@ -119,7 +119,7 @@ public function person($id) */ private function formatMovie($movie) { - if (is_array($movie)) { + if (\is_array($movie)) { return new Movie([ 'imdb' => ! empty($movie['imdb_id']) ? $movie['imdb_id'] : 'Not Defined', 'tmdb' => $movie['id'], @@ -158,7 +158,7 @@ private function formatMovie($movie) private function formatTv($movie) { - if (is_array($movie)) { + if (\is_array($movie)) { return new Tv([ 'tmdb' => $movie['id'], 'imdb' => ! empty($movie['external_ids']['imdb_id']) ? $movie['external_ids']['imdb_id'] : 'Not Defined', @@ -228,7 +228,7 @@ private function formatPerson($person) private function formatCountries($countries, $type = 'movie') { $movie_countries = []; - if ($type == 'movie' && ! is_null($countries)) { + if ($type == 'movie' && ! \is_null($countries)) { foreach ($countries as $country) { $movie_countries[] = [ 'code' => $country['iso_3166_1'], @@ -237,7 +237,7 @@ private function formatCountries($countries, $type = 'movie') } } - if ($type == 'tv' && ! is_null($countries)) { + if ($type == 'tv' && ! \is_null($countries)) { foreach ($countries as $country) { $movie_countries[] = [ 'code' => $country, @@ -252,7 +252,7 @@ private function formatCountries($countries, $type = 'movie') private function formatLanguages($languages, $type = 'movie') { $movie_languages = []; - if ($type == 'movie' && ! is_null($languages)) { + if ($type == 'movie' && ! \is_null($languages)) { foreach ($languages as $language) { $movie_languages[] = [ 'code' => $language['iso_639_1'], @@ -260,7 +260,7 @@ private function formatLanguages($languages, $type = 'movie') ]; } } - if ($type == 'tv' && ! is_null($languages)) { + if ($type == 'tv' && ! \is_null($languages)) { foreach ($languages as $language) { $movie_languages[] = [ 'code' => $language, @@ -275,7 +275,7 @@ private function formatLanguages($languages, $type = 'movie') private function formatGenres($genres) { $movie_genres = []; - if (! is_null($genres)) { + if (! \is_null($genres)) { foreach ($genres as $genre) { $movie_genres[] = $genre['name']; } @@ -288,11 +288,11 @@ private function formatAlternativeTitles($movie) { $akas = []; - if (! empty($movie['original_title']) && strtolower($movie['original_title']) !== strtolower($movie['title'])) { + if (! empty($movie['original_title']) && \strtolower($movie['original_title']) !== \strtolower($movie['title'])) { $akas[] = $movie['original_title']; } - if (! empty($movie['original_name']) && strtolower($movie['original_name']) !== strtolower($movie['name'])) { + if (! empty($movie['original_name']) && \strtolower($movie['original_name']) !== \strtolower($movie['name'])) { $akas[] = $movie['original_name']; } @@ -307,16 +307,16 @@ private function formatAlternativeTitles($movie) } if ($alternative_titles) { foreach ($alternative_titles as $aka_title) { - similar_text($original_title, $aka_title['title'], $percent); + \similar_text($original_title, $aka_title['title'], $percent); if ($percent < 95) { $akas[] = $aka_title['title']; } } } - if (is_array($akas)) { - $akas = array_filter($akas); - $akas = array_unique($akas); + if (\is_array($akas)) { + $akas = \array_filter($akas); + $akas = \array_unique($akas); } return $akas; @@ -335,9 +335,9 @@ private function formatVideoTrailers($movie) private function formatImages($images, $path, $image) { - $images = array_map(fn ($item) => $path.$item['file_path'], $images); + $images = \array_map(fn ($item) => $path.$item['file_path'], $images); - return array_filter($images, fn ($item) => ! $item !== ! ($path.$image)); + return \array_filter($images, fn ($item) => ! $item !== ! ($path.$image)); } private function formatCasts($credits, $role) diff --git a/app/Services/Data/Episode.php b/app/Services/Data/Episode.php index e1d77d88d2..68f410a1f0 100644 --- a/app/Services/Data/Episode.php +++ b/app/Services/Data/Episode.php @@ -32,8 +32,8 @@ class Episode public function __construct($data = []) { foreach ($data as $key => $value) { - if (property_exists($this, $key)) { - if (is_array($value) && ! count($value)) { + if (\property_exists($this, $key)) { + if (\is_array($value) && ! \count($value)) { $value = null; } $this->$key = ! empty($value) ? $value : null; diff --git a/app/Services/Data/Genre.php b/app/Services/Data/Genre.php index b6f0bf055d..be16ee5586 100644 --- a/app/Services/Data/Genre.php +++ b/app/Services/Data/Genre.php @@ -60,7 +60,7 @@ private function parseGenres($genres) $myGenre = []; $genreCollection = $this->movieGenres + $this->tvGenres; foreach ($genres as $genre) { - if (in_array($genre, $genreCollection)) { + if (\in_array($genre, $genreCollection)) { $myGenre[] = $genre; } elseif ($matchedGenre = $this->matchGenre($genre)) { $myGenre[] = $matchedGenre; diff --git a/app/Services/Data/Movie.php b/app/Services/Data/Movie.php index 9f97e112b7..5c23f79475 100644 --- a/app/Services/Data/Movie.php +++ b/app/Services/Data/Movie.php @@ -160,8 +160,8 @@ class Movie public function __construct($data = []) { foreach ($data as $key => $value) { - if (property_exists($this, $key)) { - if (is_array($value) && ! count($value)) { + if (\property_exists($this, $key)) { + if (\is_array($value) && ! \count($value)) { $value = null; } $this->$key = $value; @@ -183,7 +183,7 @@ public function __construct($data = []) public function merge(self $data, self $data2 = null) { - $movies = func_get_args(); + $movies = \func_get_args(); foreach ($movies as $movie) { foreach ($movie as $movie_key => $movie_value) { @@ -205,18 +205,18 @@ public function merge(self $data, self $data2 = null) $this->aka = $this->removeSimilar($this->aka, $this->title, 90); } - $this->genres = is_array($this->genres) ? array_unique($this->genres) : $this->genres; + $this->genres = \is_array($this->genres) ? \array_unique($this->genres) : $this->genres; return $this; } private function cleanTitle($title) { - if (strlen($title) > 4) { - $might_be_year_one = str_replace(substr($title, 0, -6), '', $title); - $might_be_year = str_replace(['(', ')'], '', $might_be_year_one); - if ($might_be_year > 1_900 && $might_be_year < (date('Y') + 100)) { - $title = trim(str_replace($might_be_year_one, '', $title)); + if (\strlen($title) > 4) { + $might_be_year_one = \str_replace(\substr($title, 0, -6), '', $title); + $might_be_year = \str_replace(['(', ')'], '', $might_be_year_one); + if ($might_be_year > 1_900 && $might_be_year < (\date('Y') + 100)) { + $title = \trim(\str_replace($might_be_year_one, '', $title)); } } @@ -243,22 +243,22 @@ private function removeSimilar($data, $title, $diff) { if ($title) { foreach ($data as $key => $value) { - similar_text($title, $value, $percent); + \similar_text($title, $value, $percent); if ($percent > $diff) { $data[$key] = null; } } } - if (is_array($data)) { - $data = array_filter($data); - $data = array_unique($data); + if (\is_array($data)) { + $data = \array_filter($data); + $data = \array_unique($data); } foreach ($data as $keyOne => $valueOne) { foreach ($data as $keyTwo => $valueTwo) { if ($keyOne != $keyTwo) { - similar_text($valueOne, $valueTwo, $percent); + \similar_text($valueOne, $valueTwo, $percent); if ($percent > $diff) { $data[$keyTwo] = null; } @@ -266,9 +266,9 @@ private function removeSimilar($data, $title, $diff) } } - if (is_array($data)) { - $data = array_filter($data); - $data = array_unique($data); + if (\is_array($data)) { + $data = \array_filter($data); + $data = \array_unique($data); } return $data; @@ -280,7 +280,7 @@ private function genreMerge($genres) $this->genres = []; } - if (is_array($genres)) { + if (\is_array($genres)) { foreach ($genres as $genre) { $this->genres[] = $genre; } diff --git a/app/Services/Data/Person.php b/app/Services/Data/Person.php index 9645398399..a3ea0ed928 100644 --- a/app/Services/Data/Person.php +++ b/app/Services/Data/Person.php @@ -52,8 +52,8 @@ class Person public function __construct($data = []) { foreach ($data as $key => $value) { - if (property_exists($this, $key)) { - if (is_array($value) && ! count($value)) { + if (\property_exists($this, $key)) { + if (\is_array($value) && ! \count($value)) { $value = null; } $this->$key = $value; diff --git a/app/Traits/Auditable.php b/app/Traits/Auditable.php index b9c2c2e843..464a2aeb16 100644 --- a/app/Traits/Auditable.php +++ b/app/Traits/Auditable.php @@ -48,15 +48,15 @@ protected static function strip($model, $data) // Convert the data to an array $data = (array) $data; // Start stripping - $globalDiscards = (! empty(config('audit.global_discards'))) ? config('audit.global_discards') : []; + $globalDiscards = (! empty(\config('audit.global_discards'))) ? \config('audit.global_discards') : []; $modelDiscards = (! empty($instance->discarded)) ? $instance->discarded : []; - foreach (array_keys($data) as $key) { + foreach (\array_keys($data) as $key) { // Check the model-specific discards - if (in_array($key, $modelDiscards)) { + if (\in_array($key, $modelDiscards)) { unset($data[$key]); } // Check global discards - if (! empty($globalDiscards) && in_array($key, $globalDiscards)) { + if (! empty($globalDiscards) && \in_array($key, $globalDiscards)) { unset($data[$key]); } } @@ -78,7 +78,7 @@ protected static function generate($action, $old = [], $new = []) $data = []; switch ($action) { default: - throw new \InvalidArgumentException(sprintf('Unknown action `%s`.', $action)); + throw new \InvalidArgumentException(\sprintf('Unknown action `%s`.', $action)); break; case 'create': // Expect new data to be filled @@ -121,9 +121,9 @@ protected static function generate($action, $old = [], $new = []) break; } - $clean = array_filter($data); + $clean = \array_filter($data); - return json_encode($clean); + return \json_encode($clean); } /** @@ -133,11 +133,11 @@ protected static function generate($action, $old = [], $new = []) */ public static function getUserId() { - if (auth()->guest()) { + if (\auth()->guest()) { return; } - return auth()->user()->id; + return \auth()->user()->id; } /** @@ -153,12 +153,12 @@ protected static function registerCreate($model) // Generate the JSON to store $data = self::generate('create', [], self::strip($model, $model->getAttributes())); - if (! is_null($userId) && ! empty($data)) { + if (! \is_null($userId) && ! empty($data)) { // Store record $now = Carbon::now()->format('Y-m-d H:i:s'); DB::table('audits')->insert([ 'user_id' => $userId, - 'model_name' => class_basename($model), + 'model_name' => \class_basename($model), 'model_entry_id' => $model->{$model->getKeyName()}, 'action' => 'create', 'record' => $data, @@ -181,12 +181,12 @@ protected static function registerUpdate($model) // Generate the JSON to store $data = self::generate('update', self::strip($model, $model->getOriginal()), self::strip($model, $model->getChanges())); - if (! is_null($userId) && ! empty(json_decode($data, true))) { + if (! \is_null($userId) && ! empty(\json_decode($data, true))) { // Store record $now = Carbon::now()->format('Y-m-d H:i:s'); DB::table('audits')->insert([ 'user_id' => $userId, - 'model_name' => class_basename($model), + 'model_name' => \class_basename($model), 'model_entry_id' => $model->{$model->getKeyName()}, 'action' => 'update', 'record' => $data, @@ -209,12 +209,12 @@ protected static function registerDelete($model) // Generate the JSON to store $data = self::generate('delete', self::strip($model, $model->getAttributes())); - if (! is_null($userId) && ! empty($data)) { + if (! \is_null($userId) && ! empty($data)) { // Store record $now = Carbon::now()->format('Y-m-d H:i:s'); DB::table('audits')->insert([ 'user_id' => $userId, - 'model_name' => class_basename($model), + 'model_name' => \class_basename($model), 'model_entry_id' => $model->{$model->getKeyName()}, 'action' => 'delete', 'record' => $data, diff --git a/app/Traits/Encryptable.php b/app/Traits/Encryptable.php index 19ee5fc948..20dad101cb 100644 --- a/app/Traits/Encryptable.php +++ b/app/Traits/Encryptable.php @@ -21,7 +21,7 @@ public function getAttribute($key) { $value = parent::getAttribute($key); - if (in_array($key, $this->encryptable)) { + if (\in_array($key, $this->encryptable)) { return Crypt::decrypt($value); } @@ -30,7 +30,7 @@ public function getAttribute($key) public function setAttribute($key, $value) { - if (in_array($key, $this->encryptable)) { + if (\in_array($key, $this->encryptable)) { $value = Crypt::encrypt($value); } diff --git a/app/Traits/TwoStep.php b/app/Traits/TwoStep.php index b831d25136..37a8b7b3b9 100644 --- a/app/Traits/TwoStep.php +++ b/app/Traits/TwoStep.php @@ -26,7 +26,7 @@ trait TwoStep */ private function twoStepVerification() { - $user = auth()->user(); + $user = \auth()->user(); if ($user) { $twoStepAuthStatus = $this->checkTwoStepAuthStatus($user->id); if ($twoStepAuthStatus->authStatus !== true) { @@ -48,7 +48,7 @@ private function twoStepVerification() */ private function checkTimeSinceVerified($twoStepAuth) { - $expireMinutes = config('auth.TwoStepVerifiedLifetimeMinutes'); + $expireMinutes = \config('auth.TwoStepVerifiedLifetimeMinutes'); $now = Carbon::now(); $expire = Carbon::parse($twoStepAuth->authDate)->addMinutes($expireMinutes); $expired = $now->gt($expire); @@ -98,7 +98,7 @@ private function resetAuthStatus($twoStepAuth) private function generateCode(int $length = 4, string $prefix = '', string $suffix = '') { for ($i = 0; $i < $length; $i++) { - $prefix .= random_int(0, 1) ? chr(random_int(65, 90)) : random_int(0, 9); + $prefix .= \random_int(0, 1) ? \chr(\random_int(65, 90)) : \random_int(0, 9); } return $prefix.$suffix; @@ -148,15 +148,15 @@ protected function getTwoStepAuthStatus(int $userId) */ protected function exceededTimeParser($time) { - $tomorrow = Carbon::parse($time)->addMinutes(config('auth.TwoStepExceededCountdownMinutes'))->format('l, F jS Y h:i:sa'); - $remaining = $time->addMinutes(config('auth.TwoStepExceededCountdownMinutes'))->diffForHumans(null, true); + $tomorrow = Carbon::parse($time)->addMinutes(\config('auth.TwoStepExceededCountdownMinutes'))->format('l, F jS Y h:i:sa'); + $remaining = $time->addMinutes(\config('auth.TwoStepExceededCountdownMinutes'))->diffForHumans(null, true); $data = [ 'tomorrow' => $tomorrow, 'remaining' => $remaining, ]; - return collect($data); + return \collect($data); } /** @@ -169,7 +169,7 @@ protected function exceededTimeParser($time) protected function checkExceededTime($time) { $now = Carbon::now(); - $expire = Carbon::parse($time)->addMinutes(config('auth.TwoStepExceededCountdownMinutes')); + $expire = Carbon::parse($time)->addMinutes(\config('auth.TwoStepExceededCountdownMinutes')); $expired = $now->gt($expire); return (bool) $expired; @@ -223,7 +223,7 @@ protected function resetActivationCountdown($twoStepAuth) */ protected function sendVerificationCodeNotification($twoStepAuth, $deliveryMethod = null) { - $user = auth()->user(); + $user = \auth()->user(); if ($deliveryMethod === null) { $user->notify(new TwoStepAuthCode($user, $twoStepAuth->authCode)); } diff --git a/app/Traits/UsersOnlineTrait.php b/app/Traits/UsersOnlineTrait.php index bc9a9705a3..e003f16663 100644 --- a/app/Traits/UsersOnlineTrait.php +++ b/app/Traits/UsersOnlineTrait.php @@ -26,6 +26,6 @@ public function isOnline() return false; } - return $this->last_action->gt(now()->subMinutes(5)); + return $this->last_action->gt(\now()->subMinutes(5)); } } diff --git a/app/Validators/EmailBlacklistValidator.php b/app/Validators/EmailBlacklistValidator.php index dd2f9d27e5..f0c12c1000 100644 --- a/app/Validators/EmailBlacklistValidator.php +++ b/app/Validators/EmailBlacklistValidator.php @@ -56,10 +56,10 @@ public function validate($attribute, $value, $parameters) $this->refresh(); // Extract domain from supplied email address - $domain = Str::after(strtolower($value), '@'); + $domain = Str::after(\strtolower($value), '@'); // Run validation check - return ! in_array($domain, $this->domains); + return ! \in_array($domain, $this->domains); } /** @@ -74,16 +74,16 @@ public function validate($attribute, $value, $parameters) public function refresh() { $this->shouldUpdate(); - $this->domains = cache()->get(config('email-blacklist.cache-key')); + $this->domains = \cache()->get(\config('email-blacklist.cache-key')); $this->appendCustomDomains(); } protected function shouldUpdate() { - $autoupdate = config('email-blacklist.auto-update'); + $autoupdate = \config('email-blacklist.auto-update'); try { - if ($autoupdate && ! cache()->has(config('email-blacklist.cache-key'))) { + if ($autoupdate && ! \cache()->has(\config('email-blacklist.cache-key'))) { EmailBlacklistUpdater::update(); } } catch (InvalidArgumentException $e) { @@ -92,11 +92,11 @@ protected function shouldUpdate() protected function appendCustomDomains() { - $append_list = config('email-blacklist.append'); + $append_list = \config('email-blacklist.append'); if ($append_list === null) { return; } - $append_domains = explode('|', strtolower($append_list)); - $this->domains = array_merge($this->domains, $append_domains); + $append_domains = \explode('|', \strtolower($append_list)); + $this->domains = \array_merge($this->domains, $append_domains); } } From 680c069ac51dc5dec342d7507efff655dccf9554 Mon Sep 17 00:00:00 2001 From: HDVinnie Date: Wed, 22 Jul 2020 19:10:03 +0000 Subject: [PATCH 05/13] Apply fixes from StyleCI [ci skip] [skip ci] --- app/Http/Controllers/UserController.php | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/app/Http/Controllers/UserController.php b/app/Http/Controllers/UserController.php index b13fae54ba..d0cd7d0b50 100644 --- a/app/Http/Controllers/UserController.php +++ b/app/Http/Controllers/UserController.php @@ -1884,12 +1884,12 @@ public function active(Request $request, $username) ->paginate(50); return \view('user.private.active', ['user' => $user, - 'route' => 'active', - 'active' => $active, - 'his_upl' => $his_upl, - 'his_upl_cre' => $his_upl_cre, - 'his_downl' => $his_downl, - 'his_downl_cre' => $his_downl_cre, + 'route' => 'active', + 'active' => $active, + 'his_upl' => $his_upl, + 'his_upl_cre' => $his_upl_cre, + 'his_downl' => $his_downl, + 'his_downl_cre' => $his_downl_cre, ]); } @@ -1919,12 +1919,12 @@ public function seeds(Request $request, $username) ->paginate(50); return \view('user.private.seeds', ['user' => $user, - 'route' => 'seeds', - 'seeds' => $seeds, - 'his_upl' => $his_upl, - 'his_upl_cre' => $his_upl_cre, - 'his_downl' => $his_downl, - 'his_downl_cre' => $his_downl_cre, + 'route' => 'seeds', + 'seeds' => $seeds, + 'his_upl' => $his_upl, + 'his_upl_cre' => $his_upl_cre, + 'his_downl' => $his_downl, + 'his_downl_cre' => $his_downl_cre, ]); } From 55cdbadc8896e6600050ed01ac3c55c3b2f1b5eb Mon Sep 17 00:00:00 2001 From: HDVinnie Date: Wed, 22 Jul 2020 15:22:46 -0400 Subject: [PATCH 06/13] refactor: recasting removal --- app/Http/Controllers/RssController.php | 4 ++-- app/Models/User.php | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/app/Http/Controllers/RssController.php b/app/Http/Controllers/RssController.php index 584f803f84..9a0b8c1074 100644 --- a/app/Http/Controllers/RssController.php +++ b/app/Http/Controllers/RssController.php @@ -172,7 +172,7 @@ public function store(Request $request) */ public function show($id, $rsskey) { - $user = User::where('rsskey', '=', (string) $rsskey)->firstOrFail(); + $user = User::where('rsskey', '=', $rsskey)->firstOrFail(); $banned_group = \cache()->rememberForever('banned_group', fn () => Group::where('slug', '=', 'banned')->pluck('id')); $disabled_group = \cache()->rememberForever('disabled_group', fn () => Group::where('slug', '=', 'disabled')->pluck('id')); @@ -187,7 +187,7 @@ public function show($id, $rsskey) \abort(404); } - $rss = Rss::where('id', '=', (int) $id)->whereRaw('(user_id = ? OR is_private != ?)', [$user->id, 1])->firstOrFail(); + $rss = Rss::where('id', '=', $id)->whereRaw('(user_id = ? OR is_private != ?)', [$user->id, 1])->firstOrFail(); $search = $rss->object_torrent->search; $description = $rss->object_torrent->description; diff --git a/app/Models/User.php b/app/Models/User.php index 353370d024..f41a084cbb 100644 --- a/app/Models/User.php +++ b/app/Models/User.php @@ -756,7 +756,7 @@ public function getRatio() return INF; } - return (float) \round($this->uploaded / $this->downloaded, 2); + return \round($this->uploaded / $this->downloaded, 2); } // Return the ratio pretty formated as a string. @@ -777,7 +777,7 @@ public function ratioAfterSize($size) return INF; } - return (float) \round($this->uploaded / ($this->downloaded + $size), 2); + return \round($this->uploaded / ($this->downloaded + $size), 2); } // Return the ratio after $size bytes would be downloaded, pretty formatted From 46b40a8e0eb371f91c4494b107900f12561d4018 Mon Sep 17 00:00:00 2001 From: HDVinnie Date: Wed, 22 Jul 2020 16:39:04 -0400 Subject: [PATCH 07/13] refactor: imports --- app/Helpers/HiddenCaptcha.php | 2 +- app/Http/Controllers/AlbumController.php | 2 +- app/Http/Controllers/PlaylistController.php | 2 +- .../Controllers/Staff/ArticleController.php | 2 +- .../Controllers/Staff/CategoryController.php | 2 +- .../Controllers/Staff/CommandController.php | 37 ++++++++++--------- app/Http/Controllers/TorrentController.php | 3 +- app/Http/Controllers/UserController.php | 2 +- app/Http/Middleware/SetLanguage.php | 3 +- app/Listeners/AchievementUnlocked.php | 2 +- app/Traits/Auditable.php | 2 +- 11 files changed, 31 insertions(+), 28 deletions(-) diff --git a/app/Helpers/HiddenCaptcha.php b/app/Helpers/HiddenCaptcha.php index 5256b5cd5f..d745443a89 100644 --- a/app/Helpers/HiddenCaptcha.php +++ b/app/Helpers/HiddenCaptcha.php @@ -13,9 +13,9 @@ namespace App\Helpers; -use Crypt; use Illuminate\Support\Str; use Illuminate\Validation\Validator; +use Illuminate\Support\Facades\Crypt; class HiddenCaptcha { diff --git a/app/Http/Controllers/AlbumController.php b/app/Http/Controllers/AlbumController.php index f4a43548eb..d700a6a709 100644 --- a/app/Http/Controllers/AlbumController.php +++ b/app/Http/Controllers/AlbumController.php @@ -18,7 +18,7 @@ use Carbon\Carbon; use Illuminate\Http\Request; use Illuminate\Support\Str; -use Image; +use Intervention\Image\Facades\Image; class AlbumController extends Controller { diff --git a/app/Http/Controllers/PlaylistController.php b/app/Http/Controllers/PlaylistController.php index 8d13760331..f633c12f7e 100644 --- a/app/Http/Controllers/PlaylistController.php +++ b/app/Http/Controllers/PlaylistController.php @@ -19,7 +19,7 @@ use App\Repositories\ChatRepository; use App\Services\MovieScrapper; use Illuminate\Http\Request; -use Image; +use Intervention\Image\Facades\Image; class PlaylistController extends Controller { diff --git a/app/Http/Controllers/Staff/ArticleController.php b/app/Http/Controllers/Staff/ArticleController.php index 2c40f01277..bfb9df507c 100644 --- a/app/Http/Controllers/Staff/ArticleController.php +++ b/app/Http/Controllers/Staff/ArticleController.php @@ -17,7 +17,7 @@ use App\Models\Article; use Illuminate\Http\Request; use Illuminate\Support\Str; -use Image; +use Intervention\Image\Facades\Image; class ArticleController extends Controller { diff --git a/app/Http/Controllers/Staff/CategoryController.php b/app/Http/Controllers/Staff/CategoryController.php index 62eed05cfe..b9f64b27c0 100644 --- a/app/Http/Controllers/Staff/CategoryController.php +++ b/app/Http/Controllers/Staff/CategoryController.php @@ -17,7 +17,7 @@ use App\Models\Category; use Illuminate\Http\Request; use Illuminate\Support\Str; -use Image; +use Intervention\Image\Facades\Image; class CategoryController extends Controller { diff --git a/app/Http/Controllers/Staff/CommandController.php b/app/Http/Controllers/Staff/CommandController.php index bc5401ce6a..67b7b0462b 100644 --- a/app/Http/Controllers/Staff/CommandController.php +++ b/app/Http/Controllers/Staff/CommandController.php @@ -15,6 +15,7 @@ use App\Http\Controllers\Controller; use Illuminate\Http\Request; +use Illuminate\Support\Facades\Artisan; class CommandController extends Controller { @@ -45,10 +46,10 @@ public function maintanceEnable(Request $request) $user = $request->user(); \abort_unless($user->group->is_owner, 403); - \Artisan::call('down --allow='.$request->ip()); + Artisan::call('down --allow='.$request->ip()); return \redirect()->route('staff.commands.index') - ->withInfo(\trim(\Artisan::output())); + ->withInfo(\trim(Artisan::output())); } /** @@ -63,10 +64,10 @@ public function maintanceDisable(Request $request) $user = $request->user(); \abort_unless($user->group->is_owner, 403); - \Artisan::call('up'); + Artisan::call('up'); return \redirect()->route('staff.commands.index') - ->withInfo(\trim(\Artisan::output())); + ->withInfo(\trim(Artisan::output())); } /** @@ -81,10 +82,10 @@ public function clearCache(Request $request) $user = $request->user(); \abort_unless($user->group->is_owner, 403); - \Artisan::call('cache:clear'); + Artisan::call('cache:clear'); return \redirect()->route('staff.commands.index') - ->withInfo(\trim(\Artisan::output())); + ->withInfo(\trim(Artisan::output())); } /** @@ -99,10 +100,10 @@ public function clearView(Request $request) $user = $request->user(); \abort_unless($user->group->is_owner, 403); - \Artisan::call('view:clear'); + Artisan::call('view:clear'); return \redirect()->route('staff.commands.index') - ->withInfo(\trim(\Artisan::output())); + ->withInfo(\trim(Artisan::output())); } /** @@ -117,10 +118,10 @@ public function clearRoute(Request $request) $user = $request->user(); \abort_unless($user->group->is_owner, 403); - \Artisan::call('route:clear'); + Artisan::call('route:clear'); return \redirect()->route('staff.commands.index') - ->withInfo(\trim(\Artisan::output())); + ->withInfo(\trim(Artisan::output())); } /** @@ -135,10 +136,10 @@ public function clearConfig(Request $request) $user = $request->user(); \abort_unless($user->group->is_owner, 403); - \Artisan::call('config:clear'); + Artisan::call('config:clear'); return \redirect()->route('staff.commands.index') - ->withInfo(\trim(\Artisan::output())); + ->withInfo(\trim(Artisan::output())); } /** @@ -153,10 +154,10 @@ public function clearAllCache(Request $request) $user = $request->user(); \abort_unless($user->group->is_owner, 403); - \Artisan::call('clear:all_cache'); + Artisan::call('clear:all_cache'); return \redirect()->route('staff.commands.index') - ->withInfo(\trim(\Artisan::output())); + ->withInfo(\trim(Artisan::output())); } /** @@ -171,10 +172,10 @@ public function setAllCache(Request $request) $user = $request->user(); \abort_unless($user->group->is_owner, 403); - \Artisan::call('set:all_cache'); + Artisan::call('set:all_cache'); return \redirect()->route('staff.commands.index') - ->withInfo(\trim(\Artisan::output())); + ->withInfo(\trim(Artisan::output())); } /** @@ -189,9 +190,9 @@ public function testEmail(Request $request) $user = $request->user(); \abort_unless($user->group->is_owner, 403); - \Artisan::call('test:email'); + Artisan::call('test:email'); return \redirect()->route('staff.commands.index') - ->withInfo(\trim(\Artisan::output())); + ->withInfo(\trim(Artisan::output())); } } diff --git a/app/Http/Controllers/TorrentController.php b/app/Http/Controllers/TorrentController.php index 7d3b143ee4..6c9f626a99 100644 --- a/app/Http/Controllers/TorrentController.php +++ b/app/Http/Controllers/TorrentController.php @@ -39,6 +39,7 @@ use App\Models\Type; use App\Models\User; use App\Models\Warning; +use Illuminate\Support\Facades\Log; use App\Notifications\NewReseedRequest; use App\Repositories\ChatRepository; use App\Repositories\TorrentFacetedRepository; @@ -1193,7 +1194,7 @@ public function deleteTorrent(Request $request) foreach ($v->errors()->all() as $error) { $errors .= $error."\n"; } - \Log::notice(\sprintf('Deletion of torrent failed due to: + Log::notice(\sprintf('Deletion of torrent failed due to: %s', $errors)); diff --git a/app/Http/Controllers/UserController.php b/app/Http/Controllers/UserController.php index d0cd7d0b50..f98df4b5a4 100644 --- a/app/Http/Controllers/UserController.php +++ b/app/Http/Controllers/UserController.php @@ -35,7 +35,7 @@ use Illuminate\Support\Facades\File; use Illuminate\Support\Facades\Hash; use Illuminate\Support\Str; -use Image; +use Intervention\Image\Facades\Image; use ZipArchive; class UserController extends Controller diff --git a/app/Http/Middleware/SetLanguage.php b/app/Http/Middleware/SetLanguage.php index 1b6cc1a307..697ac35a32 100644 --- a/app/Http/Middleware/SetLanguage.php +++ b/app/Http/Middleware/SetLanguage.php @@ -17,6 +17,7 @@ use Carbon\Carbon; use Closure; use Illuminate\Support\Facades\App; +use Illuminate\Support\Facades\Date; class SetLanguage { @@ -52,7 +53,7 @@ private function setLocale($locale) $locale = \explode('-', $locale)[0]; } - \Date::setLocale($locale); + Date::setLocale($locale); } } diff --git a/app/Listeners/AchievementUnlocked.php b/app/Listeners/AchievementUnlocked.php index bf2446c42d..4a8e99d69d 100644 --- a/app/Listeners/AchievementUnlocked.php +++ b/app/Listeners/AchievementUnlocked.php @@ -16,7 +16,7 @@ use App\Models\User; use App\Repositories\ChatRepository; use Gstt\Achievements\Event\Unlocked; -use Session; +use Illuminate\Support\Facades\Session; class AchievementUnlocked { diff --git a/app/Traits/Auditable.php b/app/Traits/Auditable.php index 464a2aeb16..1581085d09 100644 --- a/app/Traits/Auditable.php +++ b/app/Traits/Auditable.php @@ -14,7 +14,7 @@ namespace App\Traits; use Carbon\Carbon; -use DB; +use Illuminate\Support\Facades\DB; trait Auditable { From 805ce0bfda4f870a9e4cf81afe0558e56b1f14d9 Mon Sep 17 00:00:00 2001 From: HDVinnie Date: Wed, 22 Jul 2020 20:39:18 +0000 Subject: [PATCH 08/13] Apply fixes from StyleCI [ci skip] [skip ci] --- app/Helpers/HiddenCaptcha.php | 2 +- app/Http/Controllers/TorrentController.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/Helpers/HiddenCaptcha.php b/app/Helpers/HiddenCaptcha.php index d745443a89..429b3ff11e 100644 --- a/app/Helpers/HiddenCaptcha.php +++ b/app/Helpers/HiddenCaptcha.php @@ -13,9 +13,9 @@ namespace App\Helpers; +use Illuminate\Support\Facades\Crypt; use Illuminate\Support\Str; use Illuminate\Validation\Validator; -use Illuminate\Support\Facades\Crypt; class HiddenCaptcha { diff --git a/app/Http/Controllers/TorrentController.php b/app/Http/Controllers/TorrentController.php index 6c9f626a99..846e2a8c82 100644 --- a/app/Http/Controllers/TorrentController.php +++ b/app/Http/Controllers/TorrentController.php @@ -39,7 +39,6 @@ use App\Models\Type; use App\Models\User; use App\Models\Warning; -use Illuminate\Support\Facades\Log; use App\Notifications\NewReseedRequest; use App\Repositories\ChatRepository; use App\Repositories\TorrentFacetedRepository; @@ -47,6 +46,7 @@ use Illuminate\Http\Request; use Illuminate\Pagination\LengthAwarePaginator as Paginator; use Illuminate\Support\Facades\DB; +use Illuminate\Support\Facades\Log; use Illuminate\Support\Str; use MarcReichel\IGDBLaravel\Models\Character; use MarcReichel\IGDBLaravel\Models\Game; From aea25ecf2f0d3e32f42de619406347408cfde4fe Mon Sep 17 00:00:00 2001 From: HDVinnie Date: Wed, 22 Jul 2020 16:41:51 -0400 Subject: [PATCH 09/13] refactor: count on null --- app/Helpers/BBCodeConverter.php | 2 +- app/Helpers/EmailBlacklistUpdater.php | 2 +- app/Helpers/SystemInformation.php | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/app/Helpers/BBCodeConverter.php b/app/Helpers/BBCodeConverter.php index 1c97092291..2fd6dc0444 100644 --- a/app/Helpers/BBCodeConverter.php +++ b/app/Helpers/BBCodeConverter.php @@ -125,7 +125,7 @@ function ($matches) { } $items = \preg_split('#\[\*\]#u', $list); - $counter = \count($items); + $counter = is_countable($items) ? \count($items) : 0; if (isset($matches['type']) && $matches['type'] == '=1') { // ordered list // We start from 1 to discard the first string, in fact, it's empty. diff --git a/app/Helpers/EmailBlacklistUpdater.php b/app/Helpers/EmailBlacklistUpdater.php index 754ca81a0b..aa672123e6 100644 --- a/app/Helpers/EmailBlacklistUpdater.php +++ b/app/Helpers/EmailBlacklistUpdater.php @@ -28,7 +28,7 @@ public static function update() $duration = Carbon::now()->addMonth(); $domains = \json_decode(\file_get_contents($url), true); - $count = \count($domains); + $count = is_countable($domains) ? \count($domains) : 0; // Retrieve blacklisted domains \cache()->put($key, $domains, $duration); diff --git a/app/Helpers/SystemInformation.php b/app/Helpers/SystemInformation.php index a234ba52ac..7e69e3acd2 100644 --- a/app/Helpers/SystemInformation.php +++ b/app/Helpers/SystemInformation.php @@ -69,7 +69,7 @@ protected function formatBytes($bytes, $precision = 2) { $bytes = \max($bytes, 0); $pow = \floor(($bytes ? \log($bytes) : 0) / \log(1_024)); - $pow = \min($pow, \count(self::UNITS) - 1); + $pow = \min($pow, (is_countable(self::UNITS) ? \count(self::UNITS) : 0) - 1); // Uncomment one of the following alternatives $bytes /= \pow(1_024, $pow); // $bytes /= (1 << (10 * $pow)); From 07332698679a68d0b26e781775c1486b3b314689 Mon Sep 17 00:00:00 2001 From: HDVinnie Date: Wed, 22 Jul 2020 16:57:13 -0400 Subject: [PATCH 10/13] update: phpdoc blocks --- app/Console/Commands/AutoBan.php | 3 +++ app/Console/Commands/AutoBanDisposableUsers.php | 3 +++ app/Console/Commands/AutoBonAllocation.php | 5 +++++ app/Console/Commands/AutoCorrectHistory.php | 3 +++ app/Console/Commands/AutoDeactivateWarning.php | 3 +++ app/Console/Commands/AutoDisableInactiveUsers.php | 3 +++ app/Console/Commands/AutoFlushPeers.php | 3 +++ app/Console/Commands/AutoGraveyard.php | 3 +++ app/Console/Commands/AutoGroup.php | 3 +++ app/Console/Commands/AutoHighspeedTag.php | 3 +++ app/Console/Commands/AutoNerdStat.php | 3 +++ app/Console/Commands/AutoPreWarning.php | 3 +++ app/Console/Commands/AutoRecycleAudits.php | 3 +++ .../Commands/AutoRecycleClaimedTorrentRequests.php | 4 ++++ app/Console/Commands/AutoRecycleFailedLogins.php | 3 +++ app/Console/Commands/AutoRecycleInvites.php | 3 +++ app/Console/Commands/AutoRemoveFeaturedTorrent.php | 3 +++ .../Commands/AutoRemovePersonalFreeleech.php | 3 +++ app/Console/Commands/AutoRevokePermissions.php | 3 +++ .../Commands/AutoSoftDeleteDisabledUsers.php | 3 +++ app/Console/Commands/AutoWarning.php | 3 +++ app/Console/Commands/ClearCache.php | 3 +++ app/Console/Commands/FetchGenres.php | 3 +++ app/Console/Commands/FetchReleaseYears.php | 3 +++ app/Console/Commands/GitUpdater.php | 3 +++ app/Console/Commands/SetCache.php | 3 +++ app/Console/Commands/SyncPeers.php | 3 +++ app/Console/Commands/TestMailSettings.php | 3 +++ app/Console/Commands/VendorCleanup.php | 3 +++ app/Exceptions/Handler.php | 11 ++++------- app/Helpers/HiddenCaptcha.php | 2 +- app/Http/Controllers/API/ChatController.php | 3 +++ app/Http/Controllers/API/TorrentController.php | 5 ++++- app/Http/Controllers/AchievementsController.php | 3 +++ app/Http/Controllers/AlbumController.php | 6 +++++- app/Http/Controllers/AnnounceController.php | 6 ++++-- app/Http/Controllers/ArticleController.php | 3 +++ app/Http/Controllers/Auth/ActivationController.php | 3 +++ app/Http/Controllers/Auth/ApplicationController.php | 3 +++ .../Controllers/Auth/ForgotUsernameController.php | 3 +++ app/Http/Controllers/Auth/TwoStepController.php | 11 +++++++---- app/Http/Controllers/BonusController.php | 7 +++++-- app/Http/Controllers/BookmarkController.php | 3 +++ app/Http/Controllers/CategoryController.php | 3 +++ app/Http/Controllers/CommentController.php | 10 +++++++--- app/Http/Controllers/ContactController.php | 3 +++ app/Http/Controllers/FollowController.php | 3 +++ app/Http/Controllers/ForumCategoryController.php | 3 +++ app/Http/Controllers/ForumController.php | 7 +++++-- app/Http/Controllers/GraveyardController.php | 6 +++++- app/Http/Controllers/HomeController.php | 3 +++ app/Http/Controllers/ImageController.php | 4 ++++ app/Http/Controllers/InviteController.php | 3 +++ app/Http/Controllers/LanguageController.php | 3 +++ app/Http/Controllers/LikeController.php | 3 +++ app/Http/Controllers/NotificationController.php | 3 +++ app/Http/Controllers/PageController.php | 3 +++ app/Http/Controllers/PlaylistController.php | 6 +++++- app/Http/Controllers/PlaylistTorrentController.php | 4 ++++ app/Http/Controllers/PollController.php | 3 +++ app/Http/Controllers/PostController.php | 7 +++++-- app/Http/Controllers/PrivateMessageController.php | 4 ++++ app/Http/Controllers/ReportController.php | 3 +++ app/Http/Controllers/RequestController.php | 7 +++++-- app/Http/Controllers/RssController.php | 5 ++++- app/Http/Controllers/SeedboxController.php | 4 ++++ .../Controllers/Staff/ApplicationController.php | 3 +++ app/Http/Controllers/Staff/ArticleController.php | 4 ++++ app/Http/Controllers/Staff/AuditController.php | 4 ++++ .../Controllers/Staff/AuthenticationController.php | 3 +++ app/Http/Controllers/Staff/BackupController.php | 3 +++ app/Http/Controllers/Staff/BanController.php | 3 +++ app/Http/Controllers/Staff/CategoryController.php | 4 ++++ app/Http/Controllers/Staff/ChatBotController.php | 8 ++++++-- app/Http/Controllers/Staff/ChatRoomController.php | 6 +++++- app/Http/Controllers/Staff/ChatStatusController.php | 6 +++++- app/Http/Controllers/Staff/CheaterController.php | 3 +++ app/Http/Controllers/Staff/CommandController.php | 3 +++ app/Http/Controllers/Staff/FlushController.php | 5 ++++- app/Http/Controllers/Staff/ForumController.php | 4 ++++ app/Http/Controllers/Staff/GiftController.php | 3 +++ app/Http/Controllers/Staff/GroupController.php | 3 +++ app/Http/Controllers/Staff/HomeController.php | 3 +++ app/Http/Controllers/Staff/InviteController.php | 3 +++ app/Http/Controllers/Staff/MassActionController.php | 3 +++ app/Http/Controllers/Staff/ModerationController.php | 5 ++++- app/Http/Controllers/Staff/NoteController.php | 4 ++++ app/Http/Controllers/Staff/PageController.php | 4 ++++ app/Http/Controllers/Staff/PollController.php | 13 +++++++++---- app/Http/Controllers/Staff/ReportController.php | 3 +++ app/Http/Controllers/Staff/RssController.php | 5 ++++- app/Http/Controllers/Staff/SeedboxController.php | 4 ++++ app/Http/Controllers/Staff/TagController.php | 3 +++ app/Http/Controllers/Staff/TypeController.php | 4 ++++ app/Http/Controllers/Staff/UserController.php | 3 +++ app/Http/Controllers/Staff/VersionController.php | 3 +++ app/Http/Controllers/Staff/WarningController.php | 3 +++ app/Http/Controllers/StatsController.php | 3 +++ app/Http/Controllers/SubscriptionController.php | 3 +++ app/Http/Controllers/ThankController.php | 3 +++ app/Http/Controllers/TopicController.php | 8 ++++++-- app/Http/Controllers/TopicLabelController.php | 3 +++ app/Http/Controllers/TorrentController.php | 9 ++++++--- app/Http/Controllers/UserController.php | 5 ++++- app/Http/Controllers/WarningController.php | 4 ++++ app/Http/Controllers/WishController.php | 3 +++ app/Http/Requests/StorePoll.php | 3 +++ app/Http/Requests/VoteOnPoll.php | 3 +++ app/Traits/TwoStep.php | 9 +++++---- 109 files changed, 392 insertions(+), 51 deletions(-) diff --git a/app/Console/Commands/AutoBan.php b/app/Console/Commands/AutoBan.php index 507998b758..c8d754f620 100644 --- a/app/Console/Commands/AutoBan.php +++ b/app/Console/Commands/AutoBan.php @@ -21,6 +21,9 @@ use Illuminate\Support\Facades\DB; use Illuminate\Support\Facades\Mail; +/** + * @see \Tests\Unit\Console\Commands\AutoBanTest + */ class AutoBan extends Command { /** diff --git a/app/Console/Commands/AutoBanDisposableUsers.php b/app/Console/Commands/AutoBanDisposableUsers.php index 55b35460eb..a652a3c665 100644 --- a/app/Console/Commands/AutoBanDisposableUsers.php +++ b/app/Console/Commands/AutoBanDisposableUsers.php @@ -21,6 +21,9 @@ use Illuminate\Console\Command; use Illuminate\Support\Facades\Mail; +/** + * @see \Tests\Todo\Unit\Console\Commands\AutoBanDisposableUsersTest + */ class AutoBanDisposableUsers extends Command { /** diff --git a/app/Console/Commands/AutoBonAllocation.php b/app/Console/Commands/AutoBonAllocation.php index 766890d6d4..d2f23c062f 100644 --- a/app/Console/Commands/AutoBonAllocation.php +++ b/app/Console/Commands/AutoBonAllocation.php @@ -18,6 +18,9 @@ use Illuminate\Console\Command; use Illuminate\Support\Facades\DB; +/** + * @see \Tests\Unit\Console\Commands\AutoBonAllocationTest + */ class AutoBonAllocation extends Command { /** @@ -37,6 +40,8 @@ class AutoBonAllocation extends Command /** * Execute the console command. * + * @param \App\Helpers\ByteUnits $byteUnits + * * @return mixed */ public function handle(ByteUnits $byteUnits) diff --git a/app/Console/Commands/AutoCorrectHistory.php b/app/Console/Commands/AutoCorrectHistory.php index a4f2bd78bd..035d592a34 100644 --- a/app/Console/Commands/AutoCorrectHistory.php +++ b/app/Console/Commands/AutoCorrectHistory.php @@ -17,6 +17,9 @@ use Carbon\Carbon; use Illuminate\Console\Command; +/** + * @see \Tests\Unit\Console\Commands\AutoCorrectHistoryTest + */ class AutoCorrectHistory extends Command { /** diff --git a/app/Console/Commands/AutoDeactivateWarning.php b/app/Console/Commands/AutoDeactivateWarning.php index e824261802..8a5db52c90 100644 --- a/app/Console/Commands/AutoDeactivateWarning.php +++ b/app/Console/Commands/AutoDeactivateWarning.php @@ -18,6 +18,9 @@ use Carbon\Carbon; use Illuminate\Console\Command; +/** + * @see \Tests\Unit\Console\Commands\AutoDeactivateWarningTest + */ class AutoDeactivateWarning extends Command { /** diff --git a/app/Console/Commands/AutoDisableInactiveUsers.php b/app/Console/Commands/AutoDisableInactiveUsers.php index 3d9c96caf1..aab826d0c9 100644 --- a/app/Console/Commands/AutoDisableInactiveUsers.php +++ b/app/Console/Commands/AutoDisableInactiveUsers.php @@ -19,6 +19,9 @@ use Carbon\Carbon; use Illuminate\Console\Command; +/** + * @see \Tests\Unit\Console\Commands\AutoDisableInactiveUsersTest + */ class AutoDisableInactiveUsers extends Command { /** diff --git a/app/Console/Commands/AutoFlushPeers.php b/app/Console/Commands/AutoFlushPeers.php index 6474b1174b..a2be6dc16e 100644 --- a/app/Console/Commands/AutoFlushPeers.php +++ b/app/Console/Commands/AutoFlushPeers.php @@ -18,6 +18,9 @@ use Carbon\Carbon; use Illuminate\Console\Command; +/** + * @see \Tests\Unit\Console\Commands\AutoFlushPeersTest + */ class AutoFlushPeers extends Command { /** diff --git a/app/Console/Commands/AutoGraveyard.php b/app/Console/Commands/AutoGraveyard.php index b5938256b4..ba474d0694 100644 --- a/app/Console/Commands/AutoGraveyard.php +++ b/app/Console/Commands/AutoGraveyard.php @@ -22,6 +22,9 @@ use App\Repositories\ChatRepository; use Illuminate\Console\Command; +/** + * @see \Tests\Unit\Console\Commands\AutoGraveyardTest + */ class AutoGraveyard extends Command { /** diff --git a/app/Console/Commands/AutoGroup.php b/app/Console/Commands/AutoGroup.php index 7b19f374fb..c0551cf878 100644 --- a/app/Console/Commands/AutoGroup.php +++ b/app/Console/Commands/AutoGroup.php @@ -20,6 +20,9 @@ use Carbon\Carbon; use Illuminate\Console\Command; +/** + * @see \Tests\Unit\Console\Commands\AutoGroupTest + */ class AutoGroup extends Command { /** diff --git a/app/Console/Commands/AutoHighspeedTag.php b/app/Console/Commands/AutoHighspeedTag.php index 536445a38f..90d908f323 100644 --- a/app/Console/Commands/AutoHighspeedTag.php +++ b/app/Console/Commands/AutoHighspeedTag.php @@ -19,6 +19,9 @@ use Illuminate\Console\Command; use Illuminate\Support\Facades\DB; +/** + * @see \Tests\Unit\Console\Commands\AutoHighspeedTagTest + */ class AutoHighspeedTag extends Command { /** diff --git a/app/Console/Commands/AutoNerdStat.php b/app/Console/Commands/AutoNerdStat.php index 4277ec3d75..9dc992d71f 100644 --- a/app/Console/Commands/AutoNerdStat.php +++ b/app/Console/Commands/AutoNerdStat.php @@ -22,6 +22,9 @@ use Carbon\Carbon; use Illuminate\Console\Command; +/** + * @see \Tests\Todo\Unit\Console\Commands\AutoNerdStatTest + */ class AutoNerdStat extends Command { /** diff --git a/app/Console/Commands/AutoPreWarning.php b/app/Console/Commands/AutoPreWarning.php index b597c09dc2..6bdc749ca9 100644 --- a/app/Console/Commands/AutoPreWarning.php +++ b/app/Console/Commands/AutoPreWarning.php @@ -19,6 +19,9 @@ use Carbon\Carbon; use Illuminate\Console\Command; +/** + * @see \Tests\Unit\Console\Commands\AutoPreWarningTest + */ class AutoPreWarning extends Command { /** diff --git a/app/Console/Commands/AutoRecycleAudits.php b/app/Console/Commands/AutoRecycleAudits.php index 64a7dfa119..da3b99cc96 100644 --- a/app/Console/Commands/AutoRecycleAudits.php +++ b/app/Console/Commands/AutoRecycleAudits.php @@ -17,6 +17,9 @@ use Carbon\Carbon; use Illuminate\Console\Command; +/** + * @see \Tests\Unit\Console\Commands\AutoRecycleAuditsTest + */ class AutoRecycleAudits extends Command { /** diff --git a/app/Console/Commands/AutoRecycleClaimedTorrentRequests.php b/app/Console/Commands/AutoRecycleClaimedTorrentRequests.php index eab3403872..85915fcda1 100644 --- a/app/Console/Commands/AutoRecycleClaimedTorrentRequests.php +++ b/app/Console/Commands/AutoRecycleClaimedTorrentRequests.php @@ -19,6 +19,9 @@ use Carbon\Carbon; use Illuminate\Console\Command; +/** + * @see \Tests\Unit\Console\Commands\AutoRecycleClaimedTorrentRequestsTest + */ class AutoRecycleClaimedTorrentRequests extends Command { /** @@ -51,6 +54,7 @@ public function __construct(ChatRepository $chatRepository) * Execute the console command. * * @return mixed + * @throws \Exception */ public function handle() { diff --git a/app/Console/Commands/AutoRecycleFailedLogins.php b/app/Console/Commands/AutoRecycleFailedLogins.php index e0341a55ae..71e893d05b 100644 --- a/app/Console/Commands/AutoRecycleFailedLogins.php +++ b/app/Console/Commands/AutoRecycleFailedLogins.php @@ -17,6 +17,9 @@ use Carbon\Carbon; use Illuminate\Console\Command; +/** + * @see \Tests\Unit\Console\Commands\AutoRecycleFailedLoginsTest + */ class AutoRecycleFailedLogins extends Command { /** diff --git a/app/Console/Commands/AutoRecycleInvites.php b/app/Console/Commands/AutoRecycleInvites.php index 5f54c5bb2f..23a1d08196 100644 --- a/app/Console/Commands/AutoRecycleInvites.php +++ b/app/Console/Commands/AutoRecycleInvites.php @@ -17,6 +17,9 @@ use Carbon\Carbon; use Illuminate\Console\Command; +/** + * @see \Tests\Unit\Console\Commands\AutoRecycleInvitesTest + */ class AutoRecycleInvites extends Command { /** diff --git a/app/Console/Commands/AutoRemoveFeaturedTorrent.php b/app/Console/Commands/AutoRemoveFeaturedTorrent.php index 8789c2e288..8bd586b374 100644 --- a/app/Console/Commands/AutoRemoveFeaturedTorrent.php +++ b/app/Console/Commands/AutoRemoveFeaturedTorrent.php @@ -19,6 +19,9 @@ use Carbon\Carbon; use Illuminate\Console\Command; +/** + * @see \Tests\Unit\Console\Commands\AutoRemoveFeaturedTorrentTest + */ class AutoRemoveFeaturedTorrent extends Command { /** diff --git a/app/Console/Commands/AutoRemovePersonalFreeleech.php b/app/Console/Commands/AutoRemovePersonalFreeleech.php index c1d17c92c9..2af10cb529 100644 --- a/app/Console/Commands/AutoRemovePersonalFreeleech.php +++ b/app/Console/Commands/AutoRemovePersonalFreeleech.php @@ -18,6 +18,9 @@ use Carbon\Carbon; use Illuminate\Console\Command; +/** + * @see \Tests\Unit\Console\Commands\AutoRemovePersonalFreeleechTest + */ class AutoRemovePersonalFreeleech extends Command { /** diff --git a/app/Console/Commands/AutoRevokePermissions.php b/app/Console/Commands/AutoRevokePermissions.php index c848d897b6..c1debbfbc4 100644 --- a/app/Console/Commands/AutoRevokePermissions.php +++ b/app/Console/Commands/AutoRevokePermissions.php @@ -19,6 +19,9 @@ use Illuminate\Console\Command; use Illuminate\Support\Facades\DB; +/** + * @see \Tests\Todo\Unit\Console\Commands\AutoRevokePermissionsTest + */ class AutoRevokePermissions extends Command { /** diff --git a/app/Console/Commands/AutoSoftDeleteDisabledUsers.php b/app/Console/Commands/AutoSoftDeleteDisabledUsers.php index 19e0e8ef26..d142dcf9bd 100644 --- a/app/Console/Commands/AutoSoftDeleteDisabledUsers.php +++ b/app/Console/Commands/AutoSoftDeleteDisabledUsers.php @@ -31,6 +31,9 @@ use Carbon\Carbon; use Illuminate\Console\Command; +/** + * @see \Tests\Unit\Console\Commands\AutoSoftDeleteDisabledUsersTest + */ class AutoSoftDeleteDisabledUsers extends Command { /** diff --git a/app/Console/Commands/AutoWarning.php b/app/Console/Commands/AutoWarning.php index bae5aa4f2a..1113d4d11e 100644 --- a/app/Console/Commands/AutoWarning.php +++ b/app/Console/Commands/AutoWarning.php @@ -19,6 +19,9 @@ use Carbon\Carbon; use Illuminate\Console\Command; +/** + * @see \Tests\Unit\Console\Commands\AutoWarningTest + */ class AutoWarning extends Command { /** diff --git a/app/Console/Commands/ClearCache.php b/app/Console/Commands/ClearCache.php index 188c98c8ab..f74cc4f82e 100644 --- a/app/Console/Commands/ClearCache.php +++ b/app/Console/Commands/ClearCache.php @@ -15,6 +15,9 @@ use Illuminate\Console\Command; +/** + * @see \Tests\Unit\Console\Commands\ClearCacheTest + */ class ClearCache extends Command { /** diff --git a/app/Console/Commands/FetchGenres.php b/app/Console/Commands/FetchGenres.php index 87ecf98f59..5f4e1c5407 100644 --- a/app/Console/Commands/FetchGenres.php +++ b/app/Console/Commands/FetchGenres.php @@ -18,6 +18,9 @@ use App\Services\MovieScrapper; use Illuminate\Console\Command; +/** + * @see \Tests\Todo\Unit\Console\Commands\FetchGenresTest + */ class FetchGenres extends Command { /** diff --git a/app/Console/Commands/FetchReleaseYears.php b/app/Console/Commands/FetchReleaseYears.php index 7e73d129f0..c21e8fbf27 100644 --- a/app/Console/Commands/FetchReleaseYears.php +++ b/app/Console/Commands/FetchReleaseYears.php @@ -18,6 +18,9 @@ use Illuminate\Console\Command; use MarcReichel\IGDBLaravel\Models\Game; +/** + * @see \Tests\Todo\Unit\Console\Commands\FetchReleaseYearsTest + */ class FetchReleaseYears extends Command { /** diff --git a/app/Console/Commands/GitUpdater.php b/app/Console/Commands/GitUpdater.php index c13ecc3112..c696a179dc 100644 --- a/app/Console/Commands/GitUpdater.php +++ b/app/Console/Commands/GitUpdater.php @@ -20,6 +20,9 @@ use Symfony\Component\Console\Output\ConsoleOutput; use Symfony\Component\Console\Style\SymfonyStyle; +/** + * @see \Tests\Todo\Unit\Console\Commands\GitUpdaterTest + */ class GitUpdater extends Command { use ConsoleTools; diff --git a/app/Console/Commands/SetCache.php b/app/Console/Commands/SetCache.php index a91ce81f79..10bf75d3a4 100644 --- a/app/Console/Commands/SetCache.php +++ b/app/Console/Commands/SetCache.php @@ -15,6 +15,9 @@ use Illuminate\Console\Command; +/** + * @see \Tests\Unit\Console\Commands\SetCacheTest + */ class SetCache extends Command { /** diff --git a/app/Console/Commands/SyncPeers.php b/app/Console/Commands/SyncPeers.php index 7294c4642a..996edc2901 100644 --- a/app/Console/Commands/SyncPeers.php +++ b/app/Console/Commands/SyncPeers.php @@ -16,6 +16,9 @@ use App\Models\Torrent; use Illuminate\Console\Command; +/** + * @see \Tests\Unit\Console\Commands\SyncPeersTest + */ class SyncPeers extends Command { /** diff --git a/app/Console/Commands/TestMailSettings.php b/app/Console/Commands/TestMailSettings.php index e76db83fc2..373e39a672 100644 --- a/app/Console/Commands/TestMailSettings.php +++ b/app/Console/Commands/TestMailSettings.php @@ -17,6 +17,9 @@ use Illuminate\Console\Command; use Illuminate\Support\Facades\Mail; +/** + * @see \Tests\Todo\Unit\Console\Commands\TestMailSettingsTest + */ class TestMailSettings extends Command { /** diff --git a/app/Console/Commands/VendorCleanup.php b/app/Console/Commands/VendorCleanup.php index 8367c7f95c..313ec7fb13 100644 --- a/app/Console/Commands/VendorCleanup.php +++ b/app/Console/Commands/VendorCleanup.php @@ -18,6 +18,9 @@ use RecursiveDirectoryIterator; use RecursiveIteratorIterator; +/** + * @see \Tests\Todo\Unit\Console\Commands\VendorCleanupTest + */ class VendorCleanup extends Command { protected $signature = 'vendor:cleanup {--check : Runs in dry mode without deleting files.}'; diff --git a/app/Exceptions/Handler.php b/app/Exceptions/Handler.php index 286b7eebc2..1ab12aca09 100644 --- a/app/Exceptions/Handler.php +++ b/app/Exceptions/Handler.php @@ -47,11 +47,10 @@ class Handler extends ExceptionHandler * * This is a great spot to send exceptions to Sentry, Bugsnag, etc. * - * @param \Throwable $exception - * - * @throws \Throwable + * @param \Throwable $throwable * * @return void + * @throws \Exception */ public function report(Throwable $throwable) { @@ -62,11 +61,9 @@ public function report(Throwable $throwable) * Render an exception into an HTTP response. * * @param \Illuminate\Http\Request $request - * @param \Throwable $exception - * - * @throws \Throwable - * + * @param \Throwable $throwable * @return \Illuminate\Http\Response + * @throws \Throwable */ public function render($request, Throwable $throwable) { diff --git a/app/Helpers/HiddenCaptcha.php b/app/Helpers/HiddenCaptcha.php index 429b3ff11e..d745443a89 100644 --- a/app/Helpers/HiddenCaptcha.php +++ b/app/Helpers/HiddenCaptcha.php @@ -13,9 +13,9 @@ namespace App\Helpers; -use Illuminate\Support\Facades\Crypt; use Illuminate\Support\Str; use Illuminate\Validation\Validator; +use Illuminate\Support\Facades\Crypt; class HiddenCaptcha { diff --git a/app/Http/Controllers/API/ChatController.php b/app/Http/Controllers/API/ChatController.php index 80856b5c63..43f6960d4f 100644 --- a/app/Http/Controllers/API/ChatController.php +++ b/app/Http/Controllers/API/ChatController.php @@ -32,6 +32,9 @@ use Illuminate\Auth\AuthManager; use Illuminate\Http\Request; +/** + * @see \Tests\Feature\Http\Controllers\API\ChatControllerTest + */ class ChatController extends Controller { /** diff --git a/app/Http/Controllers/API/TorrentController.php b/app/Http/Controllers/API/TorrentController.php index 50537ef9d1..4de1b19027 100644 --- a/app/Http/Controllers/API/TorrentController.php +++ b/app/Http/Controllers/API/TorrentController.php @@ -32,6 +32,9 @@ use Illuminate\Support\Facades\Storage; use Illuminate\Support\Str; +/** + * @see \Tests\Todo\Feature\Http\Controllers\TorrentControllerTest + */ class TorrentController extends BaseController { /** @@ -42,7 +45,7 @@ class TorrentController extends BaseController /** * RequestController Constructor. * - * @param ChatRepository $chat + * @param \App\Repositories\ChatRepository $chatRepository */ public function __construct(ChatRepository $chatRepository) { diff --git a/app/Http/Controllers/AchievementsController.php b/app/Http/Controllers/AchievementsController.php index 3601baf5ee..8beccd3f61 100644 --- a/app/Http/Controllers/AchievementsController.php +++ b/app/Http/Controllers/AchievementsController.php @@ -16,6 +16,9 @@ use App\Models\User; use Illuminate\Http\Request; +/** + * @see \Tests\Feature\Http\Controllers\AchievementsControllerTest + */ class AchievementsController extends Controller { /** diff --git a/app/Http/Controllers/AlbumController.php b/app/Http/Controllers/AlbumController.php index d700a6a709..8c4fe8dcc0 100644 --- a/app/Http/Controllers/AlbumController.php +++ b/app/Http/Controllers/AlbumController.php @@ -20,6 +20,9 @@ use Illuminate\Support\Str; use Intervention\Image\Facades\Image; +/** + * @see \Tests\Feature\Http\Controllers\AlbumControllerTest + */ class AlbumController extends Controller { /** @@ -30,7 +33,7 @@ class AlbumController extends Controller /** * AlbumController Constructor. * - * @param OmdbClient $client + * @param \App\Services\Clients\OmdbClient $omdbClient */ public function __construct(OmdbClient $omdbClient) { @@ -129,6 +132,7 @@ public function show($id) * @param \App\Models\Album $id * * @return \Illuminate\Http\RedirectResponse + * @throws \Exception */ public function destroy(Request $request, $id) { diff --git a/app/Http/Controllers/AnnounceController.php b/app/Http/Controllers/AnnounceController.php index 3c1b2233b6..4897bb5fd6 100644 --- a/app/Http/Controllers/AnnounceController.php +++ b/app/Http/Controllers/AnnounceController.php @@ -25,6 +25,9 @@ use Illuminate\Http\Request; use Illuminate\Support\Facades\Cache; +/** + * @see \Tests\Feature\Http\Controllers\AnnounceControllerTest + */ class AnnounceController extends Controller { // Torrent Moderation Codes @@ -43,9 +46,8 @@ class AnnounceController extends Controller * @param \Illuminate\Http\Request $request * @param \App\Models\User $passkey * + * @return \Illuminate\Contracts\Foundation\Application|\Illuminate\Contracts\Routing\ResponseFactory|\Illuminate\Http\Response response for the torrent client * @throws \Exception - * - * @return Bencode response for the torrent client */ public function announce(Request $request, $passkey) { diff --git a/app/Http/Controllers/ArticleController.php b/app/Http/Controllers/ArticleController.php index e58b73b953..2122d2d0a7 100644 --- a/app/Http/Controllers/ArticleController.php +++ b/app/Http/Controllers/ArticleController.php @@ -15,6 +15,9 @@ use App\Models\Article; +/** + * @see \Tests\Feature\Http\Controllers\ArticleControllerTest + */ class ArticleController extends Controller { /** diff --git a/app/Http/Controllers/Auth/ActivationController.php b/app/Http/Controllers/Auth/ActivationController.php index 9cd922f22c..ab2eceb9e1 100644 --- a/app/Http/Controllers/Auth/ActivationController.php +++ b/app/Http/Controllers/Auth/ActivationController.php @@ -17,6 +17,9 @@ use App\Models\Group; use App\Models\UserActivation; +/** + * @see \Tests\Feature\Http\Controllers\Auth\ActivationControllerTest + */ class ActivationController extends Controller { public function activate($token) diff --git a/app/Http/Controllers/Auth/ApplicationController.php b/app/Http/Controllers/Auth/ApplicationController.php index 0ca83dfd71..577da5e05c 100644 --- a/app/Http/Controllers/Auth/ApplicationController.php +++ b/app/Http/Controllers/Auth/ApplicationController.php @@ -19,6 +19,9 @@ use App\Models\ApplicationUrlProof; use Illuminate\Http\Request; +/** + * @see \Tests\Todo\Feature\Http\Controllers\Staff\ApplicationControllerTest + */ class ApplicationController extends Controller { /** diff --git a/app/Http/Controllers/Auth/ForgotUsernameController.php b/app/Http/Controllers/Auth/ForgotUsernameController.php index 817c2206a7..d083813ae7 100644 --- a/app/Http/Controllers/Auth/ForgotUsernameController.php +++ b/app/Http/Controllers/Auth/ForgotUsernameController.php @@ -18,6 +18,9 @@ use App\Notifications\UsernameReminder; use Illuminate\Http\Request; +/** + * @see \Tests\Feature\Http\Controllers\Auth\ForgotUsernameControllerTest + */ class ForgotUsernameController extends Controller { /** diff --git a/app/Http/Controllers/Auth/TwoStepController.php b/app/Http/Controllers/Auth/TwoStepController.php index 8afe2526b5..1c74ec5b06 100644 --- a/app/Http/Controllers/Auth/TwoStepController.php +++ b/app/Http/Controllers/Auth/TwoStepController.php @@ -18,6 +18,9 @@ use Carbon\Carbon; use Illuminate\Http\Request; +/** + * @see \Tests\Feature\Http\Controllers\Auth\TwoStepControllerTest + */ class TwoStepController extends Controller { use TwoStep; @@ -93,9 +96,8 @@ private function invalidCodeReturnData($errors = null) /** * Show the twostep verification form. * + * @return \Illuminate\Contracts\Foundation\Application|\Illuminate\Contracts\View\Factory|\Illuminate\View\View * @throws \Exception - * - * @return \Illuminate\Http\Response */ public function showVerification() { @@ -152,7 +154,8 @@ public function showVerification() * * @param \Illuminate\Http\Request $request * - * @return \Illuminate\Http\Response + * @return \Illuminate\Http\JsonResponse + * @throws \Exception */ public function verify(Request $request) { @@ -198,7 +201,7 @@ public function verify(Request $request) /** * Resend the validation code triggered by user. * - * @return \Illuminate\Http\Response + * @return \Illuminate\Http\JsonResponse */ public function resend() { diff --git a/app/Http/Controllers/BonusController.php b/app/Http/Controllers/BonusController.php index 4af04e1212..2340e83546 100644 --- a/app/Http/Controllers/BonusController.php +++ b/app/Http/Controllers/BonusController.php @@ -29,6 +29,9 @@ use Illuminate\Http\Request; use Illuminate\Support\Facades\DB; +/** + * @see \Tests\Feature\Http\Controllers\BonusControllerTest + */ class BonusController extends Controller { /** @@ -46,8 +49,8 @@ class BonusController extends Controller /** * BonusController Constructor. * - * @param ByteUnits $byteUnits - * @param ChatRepository $chat + * @param \App\Interfaces\ByteUnitsInterface $byteUnits + * @param \App\Repositories\ChatRepository $chatRepository */ public function __construct( \App\Interfaces\ByteUnitsInterface $byteUnits, diff --git a/app/Http/Controllers/BookmarkController.php b/app/Http/Controllers/BookmarkController.php index 7aeecb3986..e5ced43644 100644 --- a/app/Http/Controllers/BookmarkController.php +++ b/app/Http/Controllers/BookmarkController.php @@ -18,6 +18,9 @@ use App\Models\User; use Illuminate\Http\Request; +/** + * @see \Tests\Feature\Http\Controllers\BookmarkControllerTest + */ class BookmarkController extends Controller { /** diff --git a/app/Http/Controllers/CategoryController.php b/app/Http/Controllers/CategoryController.php index de201e6fb9..0fe3c83790 100644 --- a/app/Http/Controllers/CategoryController.php +++ b/app/Http/Controllers/CategoryController.php @@ -18,6 +18,9 @@ use App\Models\Torrent; use Illuminate\Http\Request; +/** + * @see \Tests\Feature\Http\Controllers\CategoryControllerTest + */ class CategoryController extends Controller { /** diff --git a/app/Http/Controllers/CommentController.php b/app/Http/Controllers/CommentController.php index a82bc4c1ef..1329ed4213 100644 --- a/app/Http/Controllers/CommentController.php +++ b/app/Http/Controllers/CommentController.php @@ -36,6 +36,9 @@ use App\Repositories\TaggedUserRepository; use Illuminate\Http\Request; +/** + * @see \Tests\Feature\Http\Controllers\CommentControllerTest + */ class CommentController extends Controller { /** @@ -51,8 +54,8 @@ class CommentController extends Controller /** * CommentController Constructor. * - * @param TaggedUserRepository $tag - * @param ChatRepository $chat + * @param \App\Repositories\TaggedUserRepository $taggedUserRepository + * @param \App\Repositories\ChatRepository $chatRepository */ public function __construct(TaggedUserRepository $taggedUserRepository, ChatRepository $chatRepository) { @@ -548,9 +551,10 @@ public function editComment(Request $request, $comment_id) * Delete A Comment. * * @param \Illuminate\Http\Request $request - * @param $comment_id + * @param $comment_id * * @return \Illuminate\Http\RedirectResponse + * @throws \Exception */ public function deleteComment(Request $request, $comment_id) { diff --git a/app/Http/Controllers/ContactController.php b/app/Http/Controllers/ContactController.php index 3cbddab40e..709cdb92f0 100644 --- a/app/Http/Controllers/ContactController.php +++ b/app/Http/Controllers/ContactController.php @@ -18,6 +18,9 @@ use Illuminate\Http\Request; use Illuminate\Support\Facades\Mail; +/** + * @see \Tests\Feature\Http\Controllers\ContactControllerTest + */ class ContactController extends Controller { /** diff --git a/app/Http/Controllers/FollowController.php b/app/Http/Controllers/FollowController.php index ff5e446fb7..71eaa4d644 100644 --- a/app/Http/Controllers/FollowController.php +++ b/app/Http/Controllers/FollowController.php @@ -19,6 +19,9 @@ use App\Notifications\NewUnfollow; use Illuminate\Http\Request; +/** + * @see \Tests\Feature\Http\Controllers\FollowControllerTest + */ class FollowController extends Controller { /** diff --git a/app/Http/Controllers/ForumCategoryController.php b/app/Http/Controllers/ForumCategoryController.php index 99db6fe4f4..760357169f 100644 --- a/app/Http/Controllers/ForumCategoryController.php +++ b/app/Http/Controllers/ForumCategoryController.php @@ -17,6 +17,9 @@ use App\Models\Post; use App\Models\Topic; +/** + * @see \Tests\Feature\Http\Controllers\ForumCategoryControllerTest + */ class ForumCategoryController extends Controller { /** diff --git a/app/Http/Controllers/ForumController.php b/app/Http/Controllers/ForumController.php index d5f1738964..14c14f12f9 100644 --- a/app/Http/Controllers/ForumController.php +++ b/app/Http/Controllers/ForumController.php @@ -20,6 +20,9 @@ use App\Repositories\TaggedUserRepository; use Illuminate\Http\Request; +/** + * @see \Tests\Todo\Feature\Http\Controllers\Staff\ForumControllerTest + */ class ForumController extends Controller { /** @@ -35,8 +38,8 @@ class ForumController extends Controller /** * ForumController Constructor. * - * @param TaggedUserRepository $tag - * @param ChatRepository $chat + * @param \App\Repositories\TaggedUserRepository $taggedUserRepository + * @param \App\Repositories\ChatRepository $chatRepository */ public function __construct(TaggedUserRepository $taggedUserRepository, ChatRepository $chatRepository) { diff --git a/app/Http/Controllers/GraveyardController.php b/app/Http/Controllers/GraveyardController.php index 0dedc186d1..4e1be04eb7 100644 --- a/app/Http/Controllers/GraveyardController.php +++ b/app/Http/Controllers/GraveyardController.php @@ -20,6 +20,9 @@ use Illuminate\Http\Request; use Illuminate\Support\Str; +/** + * @see \Tests\Todo\Feature\Http\Controllers\GraveyardControllerTest + */ class GraveyardController extends Controller { /** @@ -30,7 +33,7 @@ class GraveyardController extends Controller /** * GraveyardController Constructor. * - * @param TorrentFacetedRepository $faceted + * @param \App\Repositories\TorrentFacetedRepository $torrentFacetedRepository */ public function __construct(TorrentFacetedRepository $torrentFacetedRepository) { @@ -190,6 +193,7 @@ public function store(Request $request, $id) * @param int $id * * @return \Illuminate\Http\RedirectResponse + * @throws \Exception */ public function destroy(Request $request, $id) { diff --git a/app/Http/Controllers/HomeController.php b/app/Http/Controllers/HomeController.php index 54311f50a5..a5655ff2de 100644 --- a/app/Http/Controllers/HomeController.php +++ b/app/Http/Controllers/HomeController.php @@ -29,6 +29,9 @@ use Illuminate\Http\Request; use Illuminate\Support\Facades\DB; +/** + * @see \Tests\Todo\Feature\Http\Controllers\Staff\HomeControllerTest + */ class HomeController extends Controller { /** diff --git a/app/Http/Controllers/ImageController.php b/app/Http/Controllers/ImageController.php index 1993466b87..8d699bf836 100644 --- a/app/Http/Controllers/ImageController.php +++ b/app/Http/Controllers/ImageController.php @@ -17,6 +17,9 @@ use App\Models\Image; use Illuminate\Http\Request; +/** + * @see \Tests\Todo\Feature\Http\Controllers\ImageControllerTest + */ class ImageController extends Controller { /** @@ -104,6 +107,7 @@ public function download($id) * @param \App\Models\Image $id * * @return \Illuminate\Http\RedirectResponse + * @throws \Exception */ public function destroy(Request $request, $id) { diff --git a/app/Http/Controllers/InviteController.php b/app/Http/Controllers/InviteController.php index 91df5e9673..f845e54c57 100644 --- a/app/Http/Controllers/InviteController.php +++ b/app/Http/Controllers/InviteController.php @@ -21,6 +21,9 @@ use Illuminate\Support\Facades\Mail; use Ramsey\Uuid\Uuid; +/** + * @see \Tests\Todo\Feature\Http\Controllers\InviteControllerTest + */ class InviteController extends Controller { /** diff --git a/app/Http/Controllers/LanguageController.php b/app/Http/Controllers/LanguageController.php index 1de422e80d..1b270dbe80 100644 --- a/app/Http/Controllers/LanguageController.php +++ b/app/Http/Controllers/LanguageController.php @@ -16,6 +16,9 @@ use App\Models\Language; use Illuminate\Http\Request; +/** + * @see \Tests\Todo\Feature\Http\Controllers\LanguageControllerTest + */ class LanguageController extends Controller { /** diff --git a/app/Http/Controllers/LikeController.php b/app/Http/Controllers/LikeController.php index 10d96b57fa..1120faccdc 100644 --- a/app/Http/Controllers/LikeController.php +++ b/app/Http/Controllers/LikeController.php @@ -17,6 +17,9 @@ use App\Models\Post; use Illuminate\Http\Request; +/** + * @see \Tests\Todo\Feature\Http\Controllers\LikeControllerTest + */ class LikeController extends Controller { /** diff --git a/app/Http/Controllers/NotificationController.php b/app/Http/Controllers/NotificationController.php index 5614c45073..4721e6729d 100644 --- a/app/Http/Controllers/NotificationController.php +++ b/app/Http/Controllers/NotificationController.php @@ -17,6 +17,9 @@ use Carbon\Carbon; use Illuminate\Http\Request; +/** + * @see \Tests\Todo\Feature\Http\Controllers\NotificationControllerTest + */ class NotificationController extends Controller { /** diff --git a/app/Http/Controllers/PageController.php b/app/Http/Controllers/PageController.php index 1d10975889..2e7a559b53 100644 --- a/app/Http/Controllers/PageController.php +++ b/app/Http/Controllers/PageController.php @@ -16,6 +16,9 @@ use App\Models\Page; use Illuminate\Support\Facades\DB; +/** + * @see \Tests\Todo\Feature\Http\Controllers\PageControllerTest + */ class PageController extends Controller { /** diff --git a/app/Http/Controllers/PlaylistController.php b/app/Http/Controllers/PlaylistController.php index f633c12f7e..58479f3c35 100644 --- a/app/Http/Controllers/PlaylistController.php +++ b/app/Http/Controllers/PlaylistController.php @@ -21,6 +21,9 @@ use Illuminate\Http\Request; use Intervention\Image\Facades\Image; +/** + * @see \Tests\Todo\Feature\Http\Controllers\PlaylistControllerTest + */ class PlaylistController extends Controller { /** @@ -31,7 +34,7 @@ class PlaylistController extends Controller /** * PlaylistController Constructor. * - * @param ChatRepository $chat + * @param \App\Repositories\ChatRepository $chatRepository */ public function __construct(ChatRepository $chatRepository) { @@ -222,6 +225,7 @@ public function update(Request $request, $id) * @param \App\Playlist $id * * @return \Illuminate\Http\RedirectResponse + * @throws \Exception */ public function destroy($id) { diff --git a/app/Http/Controllers/PlaylistTorrentController.php b/app/Http/Controllers/PlaylistTorrentController.php index 6285e99213..2f98c06c98 100644 --- a/app/Http/Controllers/PlaylistTorrentController.php +++ b/app/Http/Controllers/PlaylistTorrentController.php @@ -17,6 +17,9 @@ use App\Models\PlaylistTorrent; use Illuminate\Http\Request; +/** + * @see \Tests\Todo\Feature\Http\Controllers\PlaylistTorrentControllerTest + */ class PlaylistTorrentController extends Controller { /** @@ -58,6 +61,7 @@ public function store(Request $request) * @param int $id * * @return \Illuminate\Http\RedirectResponse + * @throws \Exception */ public function destroy($id) { diff --git a/app/Http/Controllers/PollController.php b/app/Http/Controllers/PollController.php index 661982bcf0..17fec6df55 100644 --- a/app/Http/Controllers/PollController.php +++ b/app/Http/Controllers/PollController.php @@ -20,6 +20,9 @@ use App\Repositories\ChatRepository; use Illuminate\Http\Request; +/** + * @see \Tests\Todo\Feature\Http\Controllers\Staff\PollControllerTest + */ class PollController extends Controller { /** diff --git a/app/Http/Controllers/PostController.php b/app/Http/Controllers/PostController.php index f7e7da3b45..543fd0ee61 100644 --- a/app/Http/Controllers/PostController.php +++ b/app/Http/Controllers/PostController.php @@ -31,6 +31,9 @@ use App\Repositories\TaggedUserRepository; use Illuminate\Http\Request; +/** + * @see \Tests\Todo\Feature\Http\Controllers\PostControllerTest + */ class PostController extends Controller { /** @@ -46,8 +49,8 @@ class PostController extends Controller /** * ForumController Constructor. * - * @param TaggedUserRepository $tag - * @param ChatRepository $chat + * @param \App\Repositories\TaggedUserRepository $taggedUserRepository + * @param \App\Repositories\ChatRepository $chatRepository */ public function __construct(TaggedUserRepository $taggedUserRepository, ChatRepository $chatRepository) { diff --git a/app/Http/Controllers/PrivateMessageController.php b/app/Http/Controllers/PrivateMessageController.php index 2d4d9a3539..2b85ae08c7 100644 --- a/app/Http/Controllers/PrivateMessageController.php +++ b/app/Http/Controllers/PrivateMessageController.php @@ -17,6 +17,9 @@ use App\Models\User; use Illuminate\Http\Request; +/** + * @see \Tests\Todo\Feature\Http\Controllers\PrivateMessageControllerTest + */ class PrivateMessageController extends Controller { /** @@ -230,6 +233,7 @@ public function replyPrivateMessage(Request $request, $id) * @param \App\Models\PrivateMessage $id * * @return \Illuminate\Http\RedirectResponse + * @throws \Exception */ public function deletePrivateMessage(Request $request, $id) { diff --git a/app/Http/Controllers/ReportController.php b/app/Http/Controllers/ReportController.php index 54bc0f631a..7c0a7e2e02 100644 --- a/app/Http/Controllers/ReportController.php +++ b/app/Http/Controllers/ReportController.php @@ -19,6 +19,9 @@ use App\Models\User; use Illuminate\Http\Request; +/** + * @see \Tests\Todo\Feature\Http\Controllers\ReportControllerTest + */ class ReportController extends Controller { /** diff --git a/app/Http/Controllers/RequestController.php b/app/Http/Controllers/RequestController.php index d8e134c947..ffb0af195a 100644 --- a/app/Http/Controllers/RequestController.php +++ b/app/Http/Controllers/RequestController.php @@ -40,6 +40,9 @@ use Illuminate\Support\Str; use MarcReichel\IGDBLaravel\Models\Game; +/** + * @see \Tests\Todo\Feature\Http\Controllers\RequestControllerTest + */ class RequestController extends Controller { /** @@ -55,8 +58,8 @@ class RequestController extends Controller /** * RequestController Constructor. * - * @param RequestFacetedRepository $faceted - * @param ChatRepository $chat + * @param \App\Repositories\RequestFacetedRepository $requestFacetedRepository + * @param \App\Repositories\ChatRepository $chatRepository */ public function __construct(RequestFacetedRepository $requestFacetedRepository, ChatRepository $chatRepository) { diff --git a/app/Http/Controllers/RssController.php b/app/Http/Controllers/RssController.php index 9a0b8c1074..3a7c1347ae 100644 --- a/app/Http/Controllers/RssController.php +++ b/app/Http/Controllers/RssController.php @@ -24,6 +24,9 @@ use App\Repositories\TorrentFacetedRepository; use Illuminate\Http\Request; +/** + * @see \Tests\Todo\Feature\Http\Controllers\RssControllerTest + */ class RssController extends Controller { /** @@ -34,7 +37,7 @@ class RssController extends Controller /** * RssController Constructor. * - * @param TorrentFacetedRepository $torrent_faceted + * @param \App\Repositories\TorrentFacetedRepository $torrentFacetedRepository */ public function __construct(TorrentFacetedRepository $torrentFacetedRepository) { diff --git a/app/Http/Controllers/SeedboxController.php b/app/Http/Controllers/SeedboxController.php index 1c37a8d53b..c879029103 100644 --- a/app/Http/Controllers/SeedboxController.php +++ b/app/Http/Controllers/SeedboxController.php @@ -17,6 +17,9 @@ use App\Models\User; use Illuminate\Http\Request; +/** + * @see \Tests\Todo\Feature\Http\Controllers\SeedboxControllerTest + */ class SeedboxController extends Controller { /** @@ -76,6 +79,7 @@ protected function store(Request $request) * @param \App\Models\Seedbox $id * * @return \Illuminate\Http\RedirectResponse + * @throws \Exception */ protected function destroy(Request $request, $id) { diff --git a/app/Http/Controllers/Staff/ApplicationController.php b/app/Http/Controllers/Staff/ApplicationController.php index ec65f136f1..27207817d2 100644 --- a/app/Http/Controllers/Staff/ApplicationController.php +++ b/app/Http/Controllers/Staff/ApplicationController.php @@ -23,6 +23,9 @@ use Illuminate\Support\Facades\Mail; use Ramsey\Uuid\Uuid; +/** + * @see \Tests\Todo\Feature\Http\Controllers\Staff\ApplicationControllerTest + */ class ApplicationController extends Controller { /** diff --git a/app/Http/Controllers/Staff/ArticleController.php b/app/Http/Controllers/Staff/ArticleController.php index bfb9df507c..965a4dd80d 100644 --- a/app/Http/Controllers/Staff/ArticleController.php +++ b/app/Http/Controllers/Staff/ArticleController.php @@ -19,6 +19,9 @@ use Illuminate\Support\Str; use Intervention\Image\Facades\Image; +/** + * @see \Tests\Feature\Http\Controllers\ArticleControllerTest + */ class ArticleController extends Controller { /** @@ -148,6 +151,7 @@ public function update(Request $request, $id) * @param \App\Models\Article $id * * @return \Illuminate\Http\RedirectResponse + * @throws \Exception */ public function destroy($id) { diff --git a/app/Http/Controllers/Staff/AuditController.php b/app/Http/Controllers/Staff/AuditController.php index d77edeaec0..e2987b7d6f 100644 --- a/app/Http/Controllers/Staff/AuditController.php +++ b/app/Http/Controllers/Staff/AuditController.php @@ -17,6 +17,9 @@ use App\Models\Audit; use Illuminate\Http\Request; +/** + * @see \Tests\Todo\Feature\Http\Controllers\Staff\AuditControllerTest + */ class AuditController extends Controller { /** @@ -38,6 +41,7 @@ public function index() * @param \App\Models\Audit $id * * @return \Illuminate\Http\RedirectResponse + * @throws \Exception */ public function destroy(Request $request, $id) { diff --git a/app/Http/Controllers/Staff/AuthenticationController.php b/app/Http/Controllers/Staff/AuthenticationController.php index f3961bb9d9..58e9ea2aae 100644 --- a/app/Http/Controllers/Staff/AuthenticationController.php +++ b/app/Http/Controllers/Staff/AuthenticationController.php @@ -16,6 +16,9 @@ use App\Http\Controllers\Controller; use App\Models\FailedLoginAttempt; +/** + * @see \Tests\Todo\Feature\Http\Controllers\Staff\AuthenticationControllerTest + */ class AuthenticationController extends Controller { /** diff --git a/app/Http/Controllers/Staff/BackupController.php b/app/Http/Controllers/Staff/BackupController.php index fc4a00a5a6..2c7fd227ab 100644 --- a/app/Http/Controllers/Staff/BackupController.php +++ b/app/Http/Controllers/Staff/BackupController.php @@ -21,6 +21,9 @@ use Illuminate\Support\Facades\Storage; use League\Flysystem\Adapter\Local; +/** + * @see \Tests\Todo\Feature\Http\Controllers\Staff\BackupControllerTest + */ class BackupController extends Controller { private const MESSAGE = 'success'; diff --git a/app/Http/Controllers/Staff/BanController.php b/app/Http/Controllers/Staff/BanController.php index e055087106..4003be52a6 100644 --- a/app/Http/Controllers/Staff/BanController.php +++ b/app/Http/Controllers/Staff/BanController.php @@ -23,6 +23,9 @@ use Illuminate\Http\Request; use Illuminate\Support\Facades\Mail; +/** + * @see \Tests\Todo\Feature\Http\Controllers\Staff\BanControllerTest + */ class BanController extends Controller { /** diff --git a/app/Http/Controllers/Staff/CategoryController.php b/app/Http/Controllers/Staff/CategoryController.php index b9f64b27c0..f40b7c2903 100644 --- a/app/Http/Controllers/Staff/CategoryController.php +++ b/app/Http/Controllers/Staff/CategoryController.php @@ -19,6 +19,9 @@ use Illuminate\Support\Str; use Intervention\Image\Facades\Image; +/** + * @see \Tests\Feature\Http\Controllers\CategoryControllerTest + */ class CategoryController extends Controller { /** @@ -166,6 +169,7 @@ public function update(Request $request, $id) * @param \App\Models\Category $id * * @return \Illuminate\Http\RedirectResponse + * @throws \Exception */ public function destroy($id) { diff --git a/app/Http/Controllers/Staff/ChatBotController.php b/app/Http/Controllers/Staff/ChatBotController.php index 0b746add93..cbb6192d47 100644 --- a/app/Http/Controllers/Staff/ChatBotController.php +++ b/app/Http/Controllers/Staff/ChatBotController.php @@ -18,6 +18,9 @@ use Illuminate\Http\Request; use Illuminate\Support\Str; +/** + * @see \Tests\Feature\Http\Controllers\Staff\ChatBotControllerTest + */ class ChatBotController extends Controller { /** @@ -25,7 +28,7 @@ class ChatBotController extends Controller * * @param string $hash * - * @return \Illuminate\Http\Response + * @return \Illuminate\Contracts\Foundation\Application|\Illuminate\Contracts\View\Factory|\Illuminate\View\View */ public function index($hash = null) { @@ -42,7 +45,7 @@ public function index($hash = null) * @param \Illuminate\Http\Request $request * @param int $id * - * @return \Illuminate\Http\Response + * @return \Illuminate\Contracts\Foundation\Application|\Illuminate\Contracts\View\Factory|\Illuminate\View\View */ public function edit(Request $request, $id) { @@ -132,6 +135,7 @@ public function update(Request $request, $id) * @param int $id * * @return \Illuminate\Http\Response + * @throws \Exception */ public function destroy($id) { diff --git a/app/Http/Controllers/Staff/ChatRoomController.php b/app/Http/Controllers/Staff/ChatRoomController.php index f3660f7023..676b9ee09f 100644 --- a/app/Http/Controllers/Staff/ChatRoomController.php +++ b/app/Http/Controllers/Staff/ChatRoomController.php @@ -19,6 +19,9 @@ use App\Repositories\ChatRepository; use Illuminate\Http\Request; +/** + * @see \Tests\Feature\Http\Controllers\Staff\ChatRoomControllerTest + */ class ChatRoomController extends Controller { /** @@ -29,7 +32,7 @@ class ChatRoomController extends Controller /** * ChatController Constructor. * - * @param ChatRepository $chat + * @param \App\Repositories\ChatRepository $chatRepository */ public function __construct(ChatRepository $chatRepository) { @@ -109,6 +112,7 @@ public function update(Request $request, $id) * @param \App\Models\Chatroom $id * * @return \Illuminate\Http\RedirectResponse + * @throws \Exception */ public function destroy($id) { diff --git a/app/Http/Controllers/Staff/ChatStatusController.php b/app/Http/Controllers/Staff/ChatStatusController.php index e722ae9182..a386fa18cf 100644 --- a/app/Http/Controllers/Staff/ChatStatusController.php +++ b/app/Http/Controllers/Staff/ChatStatusController.php @@ -18,6 +18,9 @@ use App\Repositories\ChatRepository; use Illuminate\Http\Request; +/** + * @see \Tests\Feature\Http\Controllers\Staff\ChatStatusControllerTest + */ class ChatStatusController extends Controller { /** @@ -28,7 +31,7 @@ class ChatStatusController extends Controller /** * ChatController Constructor. * - * @param ChatRepository $chat + * @param \App\Repositories\ChatRepository $chatRepository */ public function __construct(ChatRepository $chatRepository) { @@ -116,6 +119,7 @@ public function update(Request $request, $id) * @param \App\Models\ChatStatus $id * * @return \Illuminate\Http\RedirectResponse + * @throws \Exception */ public function destroy($id) { diff --git a/app/Http/Controllers/Staff/CheaterController.php b/app/Http/Controllers/Staff/CheaterController.php index b6e99575ba..5ac834b8a1 100644 --- a/app/Http/Controllers/Staff/CheaterController.php +++ b/app/Http/Controllers/Staff/CheaterController.php @@ -17,6 +17,9 @@ use App\Models\History; use Illuminate\Support\Facades\DB; +/** + * @see \Tests\Feature\Http\Controllers\Staff\CheaterControllerTest + */ class CheaterController extends Controller { /** diff --git a/app/Http/Controllers/Staff/CommandController.php b/app/Http/Controllers/Staff/CommandController.php index 67b7b0462b..2b260b502e 100644 --- a/app/Http/Controllers/Staff/CommandController.php +++ b/app/Http/Controllers/Staff/CommandController.php @@ -17,6 +17,9 @@ use Illuminate\Http\Request; use Illuminate\Support\Facades\Artisan; +/** + * @see \Tests\Feature\Http\Controllers\Staff\CommandControllerTest + */ class CommandController extends Controller { /** diff --git a/app/Http/Controllers/Staff/FlushController.php b/app/Http/Controllers/Staff/FlushController.php index 2729259b88..cdc3e0a22e 100644 --- a/app/Http/Controllers/Staff/FlushController.php +++ b/app/Http/Controllers/Staff/FlushController.php @@ -21,6 +21,9 @@ use App\Repositories\ChatRepository; use Carbon\Carbon; +/** + * @see \Tests\Todo\Feature\Http\Controllers\Staff\FlushControllerTest + */ class FlushController extends Controller { /** @@ -31,7 +34,7 @@ class FlushController extends Controller /** * ChatController Constructor. * - * @param ChatRepository $chat + * @param \App\Repositories\ChatRepository $chatRepository */ public function __construct(ChatRepository $chatRepository) { diff --git a/app/Http/Controllers/Staff/ForumController.php b/app/Http/Controllers/Staff/ForumController.php index 50c7fd01ba..408ff6b321 100644 --- a/app/Http/Controllers/Staff/ForumController.php +++ b/app/Http/Controllers/Staff/ForumController.php @@ -20,6 +20,9 @@ use Illuminate\Http\Request; use Illuminate\Support\Str; +/** + * @see \Tests\Todo\Feature\Http\Controllers\Staff\ForumControllerTest + */ class ForumController extends Controller { /** @@ -164,6 +167,7 @@ public function update(Request $request, $id) * @param \App\Models\Forum $id * * @return \Illuminate\Http\RedirectResponse + * @throws \Exception */ public function destroy($id) { diff --git a/app/Http/Controllers/Staff/GiftController.php b/app/Http/Controllers/Staff/GiftController.php index 6122c75b87..aa6d27bda0 100644 --- a/app/Http/Controllers/Staff/GiftController.php +++ b/app/Http/Controllers/Staff/GiftController.php @@ -18,6 +18,9 @@ use App\Models\User; use Illuminate\Http\Request; +/** + * @see \Tests\Feature\Http\Controllers\Staff\GiftControllerTest + */ class GiftController extends Controller { /** diff --git a/app/Http/Controllers/Staff/GroupController.php b/app/Http/Controllers/Staff/GroupController.php index 56a7d97c11..5d3db324d9 100644 --- a/app/Http/Controllers/Staff/GroupController.php +++ b/app/Http/Controllers/Staff/GroupController.php @@ -20,6 +20,9 @@ use Illuminate\Http\Request; use Illuminate\Support\Str; +/** + * @see \Tests\Feature\Http\Controllers\Staff\GroupControllerTest + */ class GroupController extends Controller { /** diff --git a/app/Http/Controllers/Staff/HomeController.php b/app/Http/Controllers/Staff/HomeController.php index ebf5b9683a..79ad1fd5f6 100644 --- a/app/Http/Controllers/Staff/HomeController.php +++ b/app/Http/Controllers/Staff/HomeController.php @@ -20,6 +20,9 @@ use Illuminate\Support\Facades\DB; use Spatie\SslCertificate\SslCertificate; +/** + * @see \Tests\Todo\Feature\Http\Controllers\Staff\HomeControllerTest + */ class HomeController extends Controller { /** diff --git a/app/Http/Controllers/Staff/InviteController.php b/app/Http/Controllers/Staff/InviteController.php index 005470612c..099c3fbd06 100644 --- a/app/Http/Controllers/Staff/InviteController.php +++ b/app/Http/Controllers/Staff/InviteController.php @@ -16,6 +16,9 @@ use App\Http\Controllers\Controller; use App\Models\Invite; +/** + * @see \Tests\Todo\Feature\Http\Controllers\InviteControllerTest + */ class InviteController extends Controller { /** diff --git a/app/Http/Controllers/Staff/MassActionController.php b/app/Http/Controllers/Staff/MassActionController.php index fa69c2121d..09145dc55c 100644 --- a/app/Http/Controllers/Staff/MassActionController.php +++ b/app/Http/Controllers/Staff/MassActionController.php @@ -19,6 +19,9 @@ use App\Models\User; use Illuminate\Http\Request; +/** + * @see \Tests\Feature\Http\Controllers\Staff\MassActionControllerTest + */ class MassActionController extends Controller { /** diff --git a/app/Http/Controllers/Staff/ModerationController.php b/app/Http/Controllers/Staff/ModerationController.php index e67f263468..c68d62f1dd 100644 --- a/app/Http/Controllers/Staff/ModerationController.php +++ b/app/Http/Controllers/Staff/ModerationController.php @@ -21,6 +21,9 @@ use Carbon\Carbon; use Illuminate\Http\Request; +/** + * @see \Tests\Todo\Feature\Http\Controllers\Staff\ModerationControllerTest + */ class ModerationController extends Controller { /** @@ -31,7 +34,7 @@ class ModerationController extends Controller /** * ModerationController Constructor. * - * @param ChatRepository $chat + * @param \App\Repositories\ChatRepository $chatRepository */ public function __construct(ChatRepository $chatRepository) { diff --git a/app/Http/Controllers/Staff/NoteController.php b/app/Http/Controllers/Staff/NoteController.php index 27d29f3027..0c54d24b33 100644 --- a/app/Http/Controllers/Staff/NoteController.php +++ b/app/Http/Controllers/Staff/NoteController.php @@ -18,6 +18,9 @@ use App\Models\User; use Illuminate\Http\Request; +/** + * @see \Tests\Feature\Http\Controllers\Staff\NoteControllerTest + */ class NoteController extends Controller { /** @@ -72,6 +75,7 @@ public function store(Request $request, $username) * @param \App\Models\Note $id * * @return \Illuminate\Http\RedirectResponse + * @throws \Exception */ public function destroy($id) { diff --git a/app/Http/Controllers/Staff/PageController.php b/app/Http/Controllers/Staff/PageController.php index 83d65494e7..3d7ae622a8 100644 --- a/app/Http/Controllers/Staff/PageController.php +++ b/app/Http/Controllers/Staff/PageController.php @@ -18,6 +18,9 @@ use Illuminate\Http\Request; use Illuminate\Support\Str; +/** + * @see \Tests\Todo\Feature\Http\Controllers\PageControllerTest + */ class PageController extends Controller { /** @@ -123,6 +126,7 @@ public function update(Request $request, $id) * @param \App\Models\Page $id * * @return \Illuminate\Http\RedirectResponse + * @throws \Exception */ public function destroy($id) { diff --git a/app/Http/Controllers/Staff/PollController.php b/app/Http/Controllers/Staff/PollController.php index b04fb47d09..da67468282 100644 --- a/app/Http/Controllers/Staff/PollController.php +++ b/app/Http/Controllers/Staff/PollController.php @@ -19,6 +19,9 @@ use App\Models\Poll; use App\Repositories\ChatRepository; +/** + * @see \Tests\Todo\Feature\Http\Controllers\Staff\PollControllerTest + */ class PollController extends Controller { /** @@ -29,7 +32,7 @@ class PollController extends Controller /** * PollController Constructor. * - * @param ChatRepository $chat + * @param \App\Repositories\ChatRepository $chatRepository */ public function __construct(ChatRepository $chatRepository) { @@ -75,7 +78,7 @@ public function create() /** * Store A New Poll. * - * @param StorePoll $request + * @param \App\Http\Requests\StorePoll $storePoll * * @return \Illuminate\Http\RedirectResponse */ @@ -115,10 +118,11 @@ public function edit($id) /** * Update A New Poll. * - * @param StorePoll $request - * @param $id + * @param \App\Http\Requests\StorePoll $storePoll + * @param $id * * @return \Illuminate\Http\RedirectResponse + * @throws \Exception */ public function update(StorePoll $storePoll, $id) { @@ -176,6 +180,7 @@ public function update(StorePoll $storePoll, $id) * @param \App\Models\Poll $id * * @return \Illuminate\Http\RedirectResponse + * @throws \Exception */ public function destroy($id) { diff --git a/app/Http/Controllers/Staff/ReportController.php b/app/Http/Controllers/Staff/ReportController.php index e1892f6a3b..a7968da3cc 100644 --- a/app/Http/Controllers/Staff/ReportController.php +++ b/app/Http/Controllers/Staff/ReportController.php @@ -18,6 +18,9 @@ use App\Models\Report; use Illuminate\Http\Request; +/** + * @see \Tests\Todo\Feature\Http\Controllers\ReportControllerTest + */ class ReportController extends Controller { /** diff --git a/app/Http/Controllers/Staff/RssController.php b/app/Http/Controllers/Staff/RssController.php index 49444be05d..7ca6aac9c9 100644 --- a/app/Http/Controllers/Staff/RssController.php +++ b/app/Http/Controllers/Staff/RssController.php @@ -21,6 +21,9 @@ use App\Repositories\TorrentFacetedRepository; use Illuminate\Http\Request; +/** + * @see \Tests\Todo\Feature\Http\Controllers\RssControllerTest + */ class RssController extends Controller { /** @@ -31,7 +34,7 @@ class RssController extends Controller /** * RssController Constructor. * - * @param TorrentFacetedRepository $torrent_faceted + * @param \App\Repositories\TorrentFacetedRepository $torrentFacetedRepository */ public function __construct(TorrentFacetedRepository $torrentFacetedRepository) { diff --git a/app/Http/Controllers/Staff/SeedboxController.php b/app/Http/Controllers/Staff/SeedboxController.php index dbacc98144..5597b24aaf 100644 --- a/app/Http/Controllers/Staff/SeedboxController.php +++ b/app/Http/Controllers/Staff/SeedboxController.php @@ -17,6 +17,9 @@ use App\Models\Seedbox; use Illuminate\Http\Request; +/** + * @see \Tests\Todo\Feature\Http\Controllers\SeedboxControllerTest + */ class SeedboxController extends Controller { /** @@ -38,6 +41,7 @@ public function index() * @param \App\Models\Seedbox $id * * @return \Illuminate\Http\RedirectResponse + * @throws \Exception */ public function destroy(Request $request, $id) { diff --git a/app/Http/Controllers/Staff/TagController.php b/app/Http/Controllers/Staff/TagController.php index 0e8bea9fbd..670a4cca0f 100644 --- a/app/Http/Controllers/Staff/TagController.php +++ b/app/Http/Controllers/Staff/TagController.php @@ -18,6 +18,9 @@ use Illuminate\Http\Request; use Illuminate\Support\Str; +/** + * @see \Tests\Todo\Feature\Http\Controllers\Staff\TagControllerTest + */ class TagController extends Controller { /** diff --git a/app/Http/Controllers/Staff/TypeController.php b/app/Http/Controllers/Staff/TypeController.php index 47a6afc499..8687433daa 100644 --- a/app/Http/Controllers/Staff/TypeController.php +++ b/app/Http/Controllers/Staff/TypeController.php @@ -18,6 +18,9 @@ use Illuminate\Http\Request; use Illuminate\Support\Str; +/** + * @see \Tests\Feature\Http\Controllers\Staff\TypeControllerTest + */ class TypeController extends Controller { /** @@ -123,6 +126,7 @@ public function update(Request $request, $id) * @param \App\Models\Type $id * * @return \Illuminate\Http\RedirectResponse + * @throws \Exception */ public function destroy($id) { diff --git a/app/Http/Controllers/Staff/UserController.php b/app/Http/Controllers/Staff/UserController.php index 704e63fef0..5cbc4124aa 100644 --- a/app/Http/Controllers/Staff/UserController.php +++ b/app/Http/Controllers/Staff/UserController.php @@ -31,6 +31,9 @@ use Illuminate\Http\Request; use Illuminate\Support\Facades\Hash; +/** + * @see \Tests\Todo\Feature\Http\Controllers\UserControllerTest + */ class UserController extends Controller { /** diff --git a/app/Http/Controllers/Staff/VersionController.php b/app/Http/Controllers/Staff/VersionController.php index a602026f03..a14da89c19 100644 --- a/app/Http/Controllers/Staff/VersionController.php +++ b/app/Http/Controllers/Staff/VersionController.php @@ -16,6 +16,9 @@ use App\Http\Controllers\Controller; use GuzzleHttp\Client; +/** + * @see \Tests\Todo\Feature\Http\Controllers\Staff\VersionControllerTest + */ class VersionController extends Controller { /** diff --git a/app/Http/Controllers/Staff/WarningController.php b/app/Http/Controllers/Staff/WarningController.php index deb665516c..d1a6a6bc6b 100644 --- a/app/Http/Controllers/Staff/WarningController.php +++ b/app/Http/Controllers/Staff/WarningController.php @@ -16,6 +16,9 @@ use App\Http\Controllers\Controller; use App\Models\Warning; +/** + * @see \Tests\Todo\Feature\Http\Controllers\WarningControllerTest + */ class WarningController extends Controller { /** diff --git a/app/Http/Controllers/StatsController.php b/app/Http/Controllers/StatsController.php index 2f7bee7598..e921c6f490 100644 --- a/app/Http/Controllers/StatsController.php +++ b/app/Http/Controllers/StatsController.php @@ -24,6 +24,9 @@ use Carbon\Carbon; use Illuminate\Support\Facades\DB; +/** + * @see \Tests\Todo\Feature\Http\Controllers\StatsControllerTest + */ class StatsController extends Controller { /** diff --git a/app/Http/Controllers/SubscriptionController.php b/app/Http/Controllers/SubscriptionController.php index cacb2d5879..5657864b3c 100644 --- a/app/Http/Controllers/SubscriptionController.php +++ b/app/Http/Controllers/SubscriptionController.php @@ -18,6 +18,9 @@ use App\Models\Topic; use Illuminate\Http\Request; +/** + * @see \Tests\Todo\Feature\Http\Controllers\SubscriptionControllerTest + */ class SubscriptionController extends Controller { /** diff --git a/app/Http/Controllers/ThankController.php b/app/Http/Controllers/ThankController.php index 32416c12e6..825c9b7711 100644 --- a/app/Http/Controllers/ThankController.php +++ b/app/Http/Controllers/ThankController.php @@ -17,6 +17,9 @@ use App\Models\Torrent; use Illuminate\Http\Request; +/** + * @see \Tests\Todo\Feature\Http\Controllers\ThankControllerTest + */ class ThankController extends Controller { /** diff --git a/app/Http/Controllers/TopicController.php b/app/Http/Controllers/TopicController.php index b5e81e33b2..88bf220939 100644 --- a/app/Http/Controllers/TopicController.php +++ b/app/Http/Controllers/TopicController.php @@ -34,6 +34,9 @@ use Illuminate\Http\Request; use Illuminate\Support\Str; +/** + * @see \Tests\Todo\Feature\Http\Controllers\TopicControllerTest + */ class TopicController extends Controller { /** @@ -49,8 +52,8 @@ class TopicController extends Controller /** * ForumController Constructor. * - * @param TaggedUserRepository $tag - * @param ChatRepository $chat + * @param \App\Repositories\TaggedUserRepository $taggedUserRepository + * @param \App\Repositories\ChatRepository $chatRepository */ public function __construct(TaggedUserRepository $taggedUserRepository, ChatRepository $chatRepository) { @@ -330,6 +333,7 @@ public function openTopic(Request $request, $id) * @param \App\Models\Topic $id * * @return \Illuminate\Http\RedirectResponse + * @throws \Exception */ public function deleteTopic(Request $request, $id) { diff --git a/app/Http/Controllers/TopicLabelController.php b/app/Http/Controllers/TopicLabelController.php index deb1c8ebf4..b4ed5e406e 100644 --- a/app/Http/Controllers/TopicLabelController.php +++ b/app/Http/Controllers/TopicLabelController.php @@ -15,6 +15,9 @@ use App\Models\Topic; +/** + * @see \Tests\Todo\Feature\Http\Controllers\TopicLabelControllerTest + */ class TopicLabelController extends Controller { /** diff --git a/app/Http/Controllers/TorrentController.php b/app/Http/Controllers/TorrentController.php index 846e2a8c82..e02b485a06 100644 --- a/app/Http/Controllers/TorrentController.php +++ b/app/Http/Controllers/TorrentController.php @@ -39,6 +39,7 @@ use App\Models\Type; use App\Models\User; use App\Models\Warning; +use Illuminate\Support\Facades\Log; use App\Notifications\NewReseedRequest; use App\Repositories\ChatRepository; use App\Repositories\TorrentFacetedRepository; @@ -46,11 +47,13 @@ use Illuminate\Http\Request; use Illuminate\Pagination\LengthAwarePaginator as Paginator; use Illuminate\Support\Facades\DB; -use Illuminate\Support\Facades\Log; use Illuminate\Support\Str; use MarcReichel\IGDBLaravel\Models\Character; use MarcReichel\IGDBLaravel\Models\Game; +/** + * @see \Tests\Todo\Feature\Http\Controllers\TorrentControllerTest + */ class TorrentController extends Controller { /** @@ -91,8 +94,8 @@ class TorrentController extends Controller /** * RequestController Constructor. * - * @param TorrentFacetedRepository $faceted - * @param ChatRepository $chat + * @param \App\Repositories\TorrentFacetedRepository $torrentFacetedRepository + * @param \App\Repositories\ChatRepository $chatRepository */ public function __construct(TorrentFacetedRepository $torrentFacetedRepository, ChatRepository $chatRepository) { diff --git a/app/Http/Controllers/UserController.php b/app/Http/Controllers/UserController.php index f98df4b5a4..90184c54b8 100644 --- a/app/Http/Controllers/UserController.php +++ b/app/Http/Controllers/UserController.php @@ -38,6 +38,9 @@ use Intervention\Image\Facades\Image; use ZipArchive; +/** + * @see \Tests\Todo\Feature\Http\Controllers\UserControllerTest + */ class UserController extends Controller { /** @@ -1955,7 +1958,7 @@ public function getBans(Request $request, $username) * @param \Illuminate\Http\Request $request * @param \App\Models\User $username * - * @return \ZipArchive + * @return \Illuminate\Http\RedirectResponse|\Symfony\Component\HttpFoundation\BinaryFileResponse */ public function downloadHistoryTorrents(Request $request, $username) { diff --git a/app/Http/Controllers/WarningController.php b/app/Http/Controllers/WarningController.php index 52c4b9a6ab..21a7dee1bc 100644 --- a/app/Http/Controllers/WarningController.php +++ b/app/Http/Controllers/WarningController.php @@ -19,6 +19,9 @@ use Carbon\Carbon; use Illuminate\Http\Request; +/** + * @see \Tests\Todo\Feature\Http\Controllers\WarningControllerTest + */ class WarningController extends Controller { /** @@ -120,6 +123,7 @@ public function deactivateAllWarnings(Request $request, $username) * @param \App\Models\Warning $id * * @return \Illuminate\Http\RedirectResponse + * @throws \Exception */ public function deleteWarning(Request $request, $id) { diff --git a/app/Http/Controllers/WishController.php b/app/Http/Controllers/WishController.php index f797005f42..864d4203ed 100644 --- a/app/Http/Controllers/WishController.php +++ b/app/Http/Controllers/WishController.php @@ -18,6 +18,9 @@ use Illuminate\Http\Request; use Illuminate\Support\Str; +/** + * @see \Tests\Todo\Feature\Http\Controllers\WishControllerTest + */ class WishController extends Controller { /** diff --git a/app/Http/Requests/StorePoll.php b/app/Http/Requests/StorePoll.php index d5c09e19cb..abbb4745d0 100644 --- a/app/Http/Requests/StorePoll.php +++ b/app/Http/Requests/StorePoll.php @@ -15,6 +15,9 @@ use Illuminate\Foundation\Http\FormRequest; +/** + * @see \Tests\Todo\Unit\Http\Requests\StorePollTest + */ class StorePoll extends FormRequest { /** diff --git a/app/Http/Requests/VoteOnPoll.php b/app/Http/Requests/VoteOnPoll.php index fe966d3576..a87a44b846 100644 --- a/app/Http/Requests/VoteOnPoll.php +++ b/app/Http/Requests/VoteOnPoll.php @@ -15,6 +15,9 @@ use Illuminate\Foundation\Http\FormRequest; +/** + * @see \Tests\Todo\Unit\Http\Requests\VoteOnPollTest + */ class VoteOnPoll extends FormRequest { /** diff --git a/app/Traits/TwoStep.php b/app/Traits/TwoStep.php index 37a8b7b3b9..4cea03e46c 100644 --- a/app/Traits/TwoStep.php +++ b/app/Traits/TwoStep.php @@ -23,6 +23,7 @@ trait TwoStep * Check if the user is authorized. * * @return bool + * @throws \Exception */ private function twoStepVerification() { @@ -45,6 +46,7 @@ private function twoStepVerification() * @param collection $twoStepAuth * * @return bool + * @throws \Exception */ private function checkTimeSinceVerified($twoStepAuth) { @@ -109,9 +111,8 @@ private function generateCode(int $length = 4, string $prefix = '', string $suff * * @param int $userId * + * @return \App\Models\TwoStepAuth|\Illuminate\Database\Eloquent\Model * @throws \Exception - * - * @return collection */ private function checkTwoStepAuthStatus(int $userId) { @@ -132,7 +133,7 @@ private function checkTwoStepAuthStatus(int $userId) * * @param int $userId * - * @return collection || void + * @return \Illuminate\Database\Eloquent\Builder|\Illuminate\Database\Eloquent\Model | void */ protected function getTwoStepAuthStatus(int $userId) { @@ -144,7 +145,7 @@ protected function getTwoStepAuthStatus(int $userId) * * @param string $time * - * @return collection + * @return \Illuminate\Support\Collection */ protected function exceededTimeParser($time) { From 5aac6a8f04baf47ba67aea46373b6db8b855fe12 Mon Sep 17 00:00:00 2001 From: HDVinnie Date: Wed, 22 Jul 2020 20:57:33 +0000 Subject: [PATCH 11/13] Apply fixes from StyleCI [ci skip] [skip ci] --- .../Commands/AutoRecycleClaimedTorrentRequests.php | 3 ++- app/Exceptions/Handler.php | 7 +++++-- app/Helpers/HiddenCaptcha.php | 2 +- app/Http/Controllers/AlbumController.php | 3 ++- app/Http/Controllers/AnnounceController.php | 3 ++- app/Http/Controllers/Auth/TwoStepController.php | 6 ++++-- app/Http/Controllers/CommentController.php | 3 ++- app/Http/Controllers/GraveyardController.php | 3 ++- app/Http/Controllers/ImageController.php | 3 ++- app/Http/Controllers/PlaylistController.php | 3 ++- app/Http/Controllers/PlaylistTorrentController.php | 3 ++- app/Http/Controllers/PrivateMessageController.php | 3 ++- app/Http/Controllers/SeedboxController.php | 3 ++- app/Http/Controllers/Staff/ArticleController.php | 3 ++- app/Http/Controllers/Staff/AuditController.php | 3 ++- app/Http/Controllers/Staff/CategoryController.php | 3 ++- app/Http/Controllers/Staff/ChatBotController.php | 3 ++- app/Http/Controllers/Staff/ChatRoomController.php | 3 ++- app/Http/Controllers/Staff/ChatStatusController.php | 3 ++- app/Http/Controllers/Staff/ForumController.php | 3 ++- app/Http/Controllers/Staff/NoteController.php | 3 ++- app/Http/Controllers/Staff/PageController.php | 3 ++- app/Http/Controllers/Staff/PollController.php | 6 ++++-- app/Http/Controllers/Staff/SeedboxController.php | 3 ++- app/Http/Controllers/Staff/TypeController.php | 3 ++- app/Http/Controllers/TopicController.php | 3 ++- app/Http/Controllers/TorrentController.php | 2 +- app/Http/Controllers/WarningController.php | 3 ++- app/Traits/TwoStep.php | 9 ++++++--- 29 files changed, 67 insertions(+), 34 deletions(-) diff --git a/app/Console/Commands/AutoRecycleClaimedTorrentRequests.php b/app/Console/Commands/AutoRecycleClaimedTorrentRequests.php index 85915fcda1..551423ea01 100644 --- a/app/Console/Commands/AutoRecycleClaimedTorrentRequests.php +++ b/app/Console/Commands/AutoRecycleClaimedTorrentRequests.php @@ -53,8 +53,9 @@ public function __construct(ChatRepository $chatRepository) /** * Execute the console command. * - * @return mixed * @throws \Exception + * + * @return mixed */ public function handle() { diff --git a/app/Exceptions/Handler.php b/app/Exceptions/Handler.php index 1ab12aca09..d5f9435a0a 100644 --- a/app/Exceptions/Handler.php +++ b/app/Exceptions/Handler.php @@ -49,8 +49,9 @@ class Handler extends ExceptionHandler * * @param \Throwable $throwable * - * @return void * @throws \Exception + * + * @return void */ public function report(Throwable $throwable) { @@ -62,8 +63,10 @@ public function report(Throwable $throwable) * * @param \Illuminate\Http\Request $request * @param \Throwable $throwable - * @return \Illuminate\Http\Response + * * @throws \Throwable + * + * @return \Illuminate\Http\Response */ public function render($request, Throwable $throwable) { diff --git a/app/Helpers/HiddenCaptcha.php b/app/Helpers/HiddenCaptcha.php index d745443a89..429b3ff11e 100644 --- a/app/Helpers/HiddenCaptcha.php +++ b/app/Helpers/HiddenCaptcha.php @@ -13,9 +13,9 @@ namespace App\Helpers; +use Illuminate\Support\Facades\Crypt; use Illuminate\Support\Str; use Illuminate\Validation\Validator; -use Illuminate\Support\Facades\Crypt; class HiddenCaptcha { diff --git a/app/Http/Controllers/AlbumController.php b/app/Http/Controllers/AlbumController.php index 8c4fe8dcc0..8767013dcb 100644 --- a/app/Http/Controllers/AlbumController.php +++ b/app/Http/Controllers/AlbumController.php @@ -131,8 +131,9 @@ public function show($id) * @param \Illuminate\Http\Request $request * @param \App\Models\Album $id * - * @return \Illuminate\Http\RedirectResponse * @throws \Exception + * + * @return \Illuminate\Http\RedirectResponse */ public function destroy(Request $request, $id) { diff --git a/app/Http/Controllers/AnnounceController.php b/app/Http/Controllers/AnnounceController.php index 4897bb5fd6..095f95a623 100644 --- a/app/Http/Controllers/AnnounceController.php +++ b/app/Http/Controllers/AnnounceController.php @@ -46,8 +46,9 @@ class AnnounceController extends Controller * @param \Illuminate\Http\Request $request * @param \App\Models\User $passkey * - * @return \Illuminate\Contracts\Foundation\Application|\Illuminate\Contracts\Routing\ResponseFactory|\Illuminate\Http\Response response for the torrent client * @throws \Exception + * + * @return \Illuminate\Contracts\Foundation\Application|\Illuminate\Contracts\Routing\ResponseFactory|\Illuminate\Http\Response response for the torrent client */ public function announce(Request $request, $passkey) { diff --git a/app/Http/Controllers/Auth/TwoStepController.php b/app/Http/Controllers/Auth/TwoStepController.php index 1c74ec5b06..2def71d3df 100644 --- a/app/Http/Controllers/Auth/TwoStepController.php +++ b/app/Http/Controllers/Auth/TwoStepController.php @@ -96,8 +96,9 @@ private function invalidCodeReturnData($errors = null) /** * Show the twostep verification form. * - * @return \Illuminate\Contracts\Foundation\Application|\Illuminate\Contracts\View\Factory|\Illuminate\View\View * @throws \Exception + * + * @return \Illuminate\Contracts\Foundation\Application|\Illuminate\Contracts\View\Factory|\Illuminate\View\View */ public function showVerification() { @@ -154,8 +155,9 @@ public function showVerification() * * @param \Illuminate\Http\Request $request * - * @return \Illuminate\Http\JsonResponse * @throws \Exception + * + * @return \Illuminate\Http\JsonResponse */ public function verify(Request $request) { diff --git a/app/Http/Controllers/CommentController.php b/app/Http/Controllers/CommentController.php index 1329ed4213..9785094439 100644 --- a/app/Http/Controllers/CommentController.php +++ b/app/Http/Controllers/CommentController.php @@ -553,8 +553,9 @@ public function editComment(Request $request, $comment_id) * @param \Illuminate\Http\Request $request * @param $comment_id * - * @return \Illuminate\Http\RedirectResponse * @throws \Exception + * + * @return \Illuminate\Http\RedirectResponse */ public function deleteComment(Request $request, $comment_id) { diff --git a/app/Http/Controllers/GraveyardController.php b/app/Http/Controllers/GraveyardController.php index 4e1be04eb7..fc0a1dc947 100644 --- a/app/Http/Controllers/GraveyardController.php +++ b/app/Http/Controllers/GraveyardController.php @@ -192,8 +192,9 @@ public function store(Request $request, $id) * @param \Illuminate\Http\Request $request * @param int $id * - * @return \Illuminate\Http\RedirectResponse * @throws \Exception + * + * @return \Illuminate\Http\RedirectResponse */ public function destroy(Request $request, $id) { diff --git a/app/Http/Controllers/ImageController.php b/app/Http/Controllers/ImageController.php index 8d699bf836..89ab4b08de 100644 --- a/app/Http/Controllers/ImageController.php +++ b/app/Http/Controllers/ImageController.php @@ -106,8 +106,9 @@ public function download($id) * @param \Illuminate\Http\Request $request * @param \App\Models\Image $id * - * @return \Illuminate\Http\RedirectResponse * @throws \Exception + * + * @return \Illuminate\Http\RedirectResponse */ public function destroy(Request $request, $id) { diff --git a/app/Http/Controllers/PlaylistController.php b/app/Http/Controllers/PlaylistController.php index 58479f3c35..59fa225ad2 100644 --- a/app/Http/Controllers/PlaylistController.php +++ b/app/Http/Controllers/PlaylistController.php @@ -224,8 +224,9 @@ public function update(Request $request, $id) * * @param \App\Playlist $id * - * @return \Illuminate\Http\RedirectResponse * @throws \Exception + * + * @return \Illuminate\Http\RedirectResponse */ public function destroy($id) { diff --git a/app/Http/Controllers/PlaylistTorrentController.php b/app/Http/Controllers/PlaylistTorrentController.php index 2f98c06c98..6623639a59 100644 --- a/app/Http/Controllers/PlaylistTorrentController.php +++ b/app/Http/Controllers/PlaylistTorrentController.php @@ -60,8 +60,9 @@ public function store(Request $request) * * @param int $id * - * @return \Illuminate\Http\RedirectResponse * @throws \Exception + * + * @return \Illuminate\Http\RedirectResponse */ public function destroy($id) { diff --git a/app/Http/Controllers/PrivateMessageController.php b/app/Http/Controllers/PrivateMessageController.php index 2b85ae08c7..30b6d4c4af 100644 --- a/app/Http/Controllers/PrivateMessageController.php +++ b/app/Http/Controllers/PrivateMessageController.php @@ -232,8 +232,9 @@ public function replyPrivateMessage(Request $request, $id) * @param \Illuminate\Http\Request $request * @param \App\Models\PrivateMessage $id * - * @return \Illuminate\Http\RedirectResponse * @throws \Exception + * + * @return \Illuminate\Http\RedirectResponse */ public function deletePrivateMessage(Request $request, $id) { diff --git a/app/Http/Controllers/SeedboxController.php b/app/Http/Controllers/SeedboxController.php index c879029103..01ba7e2573 100644 --- a/app/Http/Controllers/SeedboxController.php +++ b/app/Http/Controllers/SeedboxController.php @@ -78,8 +78,9 @@ protected function store(Request $request) * @param \Illuminate\Http\Request $request * @param \App\Models\Seedbox $id * - * @return \Illuminate\Http\RedirectResponse * @throws \Exception + * + * @return \Illuminate\Http\RedirectResponse */ protected function destroy(Request $request, $id) { diff --git a/app/Http/Controllers/Staff/ArticleController.php b/app/Http/Controllers/Staff/ArticleController.php index 965a4dd80d..3ade48497f 100644 --- a/app/Http/Controllers/Staff/ArticleController.php +++ b/app/Http/Controllers/Staff/ArticleController.php @@ -150,8 +150,9 @@ public function update(Request $request, $id) * * @param \App\Models\Article $id * - * @return \Illuminate\Http\RedirectResponse * @throws \Exception + * + * @return \Illuminate\Http\RedirectResponse */ public function destroy($id) { diff --git a/app/Http/Controllers/Staff/AuditController.php b/app/Http/Controllers/Staff/AuditController.php index e2987b7d6f..b5de397fdf 100644 --- a/app/Http/Controllers/Staff/AuditController.php +++ b/app/Http/Controllers/Staff/AuditController.php @@ -40,8 +40,9 @@ public function index() * @param \Illuminate\Http\Request $request * @param \App\Models\Audit $id * - * @return \Illuminate\Http\RedirectResponse * @throws \Exception + * + * @return \Illuminate\Http\RedirectResponse */ public function destroy(Request $request, $id) { diff --git a/app/Http/Controllers/Staff/CategoryController.php b/app/Http/Controllers/Staff/CategoryController.php index f40b7c2903..332cfc3a2c 100644 --- a/app/Http/Controllers/Staff/CategoryController.php +++ b/app/Http/Controllers/Staff/CategoryController.php @@ -168,8 +168,9 @@ public function update(Request $request, $id) * * @param \App\Models\Category $id * - * @return \Illuminate\Http\RedirectResponse * @throws \Exception + * + * @return \Illuminate\Http\RedirectResponse */ public function destroy($id) { diff --git a/app/Http/Controllers/Staff/ChatBotController.php b/app/Http/Controllers/Staff/ChatBotController.php index cbb6192d47..919a85cdcb 100644 --- a/app/Http/Controllers/Staff/ChatBotController.php +++ b/app/Http/Controllers/Staff/ChatBotController.php @@ -134,8 +134,9 @@ public function update(Request $request, $id) * * @param int $id * - * @return \Illuminate\Http\Response * @throws \Exception + * + * @return \Illuminate\Http\Response */ public function destroy($id) { diff --git a/app/Http/Controllers/Staff/ChatRoomController.php b/app/Http/Controllers/Staff/ChatRoomController.php index 676b9ee09f..690eb78f3e 100644 --- a/app/Http/Controllers/Staff/ChatRoomController.php +++ b/app/Http/Controllers/Staff/ChatRoomController.php @@ -111,8 +111,9 @@ public function update(Request $request, $id) * * @param \App\Models\Chatroom $id * - * @return \Illuminate\Http\RedirectResponse * @throws \Exception + * + * @return \Illuminate\Http\RedirectResponse */ public function destroy($id) { diff --git a/app/Http/Controllers/Staff/ChatStatusController.php b/app/Http/Controllers/Staff/ChatStatusController.php index a386fa18cf..f08cf81066 100644 --- a/app/Http/Controllers/Staff/ChatStatusController.php +++ b/app/Http/Controllers/Staff/ChatStatusController.php @@ -118,8 +118,9 @@ public function update(Request $request, $id) * * @param \App\Models\ChatStatus $id * - * @return \Illuminate\Http\RedirectResponse * @throws \Exception + * + * @return \Illuminate\Http\RedirectResponse */ public function destroy($id) { diff --git a/app/Http/Controllers/Staff/ForumController.php b/app/Http/Controllers/Staff/ForumController.php index 408ff6b321..a7879273db 100644 --- a/app/Http/Controllers/Staff/ForumController.php +++ b/app/Http/Controllers/Staff/ForumController.php @@ -166,8 +166,9 @@ public function update(Request $request, $id) * * @param \App\Models\Forum $id * - * @return \Illuminate\Http\RedirectResponse * @throws \Exception + * + * @return \Illuminate\Http\RedirectResponse */ public function destroy($id) { diff --git a/app/Http/Controllers/Staff/NoteController.php b/app/Http/Controllers/Staff/NoteController.php index 0c54d24b33..ebd7de3982 100644 --- a/app/Http/Controllers/Staff/NoteController.php +++ b/app/Http/Controllers/Staff/NoteController.php @@ -74,8 +74,9 @@ public function store(Request $request, $username) * * @param \App\Models\Note $id * - * @return \Illuminate\Http\RedirectResponse * @throws \Exception + * + * @return \Illuminate\Http\RedirectResponse */ public function destroy($id) { diff --git a/app/Http/Controllers/Staff/PageController.php b/app/Http/Controllers/Staff/PageController.php index 3d7ae622a8..a07d352d58 100644 --- a/app/Http/Controllers/Staff/PageController.php +++ b/app/Http/Controllers/Staff/PageController.php @@ -125,8 +125,9 @@ public function update(Request $request, $id) * * @param \App\Models\Page $id * - * @return \Illuminate\Http\RedirectResponse * @throws \Exception + * + * @return \Illuminate\Http\RedirectResponse */ public function destroy($id) { diff --git a/app/Http/Controllers/Staff/PollController.php b/app/Http/Controllers/Staff/PollController.php index da67468282..b059b57e81 100644 --- a/app/Http/Controllers/Staff/PollController.php +++ b/app/Http/Controllers/Staff/PollController.php @@ -121,8 +121,9 @@ public function edit($id) * @param \App\Http\Requests\StorePoll $storePoll * @param $id * - * @return \Illuminate\Http\RedirectResponse * @throws \Exception + * + * @return \Illuminate\Http\RedirectResponse */ public function update(StorePoll $storePoll, $id) { @@ -179,8 +180,9 @@ public function update(StorePoll $storePoll, $id) * * @param \App\Models\Poll $id * - * @return \Illuminate\Http\RedirectResponse * @throws \Exception + * + * @return \Illuminate\Http\RedirectResponse */ public function destroy($id) { diff --git a/app/Http/Controllers/Staff/SeedboxController.php b/app/Http/Controllers/Staff/SeedboxController.php index 5597b24aaf..a00fbc5da9 100644 --- a/app/Http/Controllers/Staff/SeedboxController.php +++ b/app/Http/Controllers/Staff/SeedboxController.php @@ -40,8 +40,9 @@ public function index() * @param \Illuminate\Http\Request $request * @param \App\Models\Seedbox $id * - * @return \Illuminate\Http\RedirectResponse * @throws \Exception + * + * @return \Illuminate\Http\RedirectResponse */ public function destroy(Request $request, $id) { diff --git a/app/Http/Controllers/Staff/TypeController.php b/app/Http/Controllers/Staff/TypeController.php index 8687433daa..5d58b442b6 100644 --- a/app/Http/Controllers/Staff/TypeController.php +++ b/app/Http/Controllers/Staff/TypeController.php @@ -125,8 +125,9 @@ public function update(Request $request, $id) * * @param \App\Models\Type $id * - * @return \Illuminate\Http\RedirectResponse * @throws \Exception + * + * @return \Illuminate\Http\RedirectResponse */ public function destroy($id) { diff --git a/app/Http/Controllers/TopicController.php b/app/Http/Controllers/TopicController.php index 88bf220939..5defc10ddf 100644 --- a/app/Http/Controllers/TopicController.php +++ b/app/Http/Controllers/TopicController.php @@ -332,8 +332,9 @@ public function openTopic(Request $request, $id) * @param \Illuminate\Http\Request $request * @param \App\Models\Topic $id * - * @return \Illuminate\Http\RedirectResponse * @throws \Exception + * + * @return \Illuminate\Http\RedirectResponse */ public function deleteTopic(Request $request, $id) { diff --git a/app/Http/Controllers/TorrentController.php b/app/Http/Controllers/TorrentController.php index e02b485a06..bc555aa529 100644 --- a/app/Http/Controllers/TorrentController.php +++ b/app/Http/Controllers/TorrentController.php @@ -39,7 +39,6 @@ use App\Models\Type; use App\Models\User; use App\Models\Warning; -use Illuminate\Support\Facades\Log; use App\Notifications\NewReseedRequest; use App\Repositories\ChatRepository; use App\Repositories\TorrentFacetedRepository; @@ -47,6 +46,7 @@ use Illuminate\Http\Request; use Illuminate\Pagination\LengthAwarePaginator as Paginator; use Illuminate\Support\Facades\DB; +use Illuminate\Support\Facades\Log; use Illuminate\Support\Str; use MarcReichel\IGDBLaravel\Models\Character; use MarcReichel\IGDBLaravel\Models\Game; diff --git a/app/Http/Controllers/WarningController.php b/app/Http/Controllers/WarningController.php index 21a7dee1bc..13500b1741 100644 --- a/app/Http/Controllers/WarningController.php +++ b/app/Http/Controllers/WarningController.php @@ -122,8 +122,9 @@ public function deactivateAllWarnings(Request $request, $username) * @param \Illuminate\Http\Request $request * @param \App\Models\Warning $id * - * @return \Illuminate\Http\RedirectResponse * @throws \Exception + * + * @return \Illuminate\Http\RedirectResponse */ public function deleteWarning(Request $request, $id) { diff --git a/app/Traits/TwoStep.php b/app/Traits/TwoStep.php index 4cea03e46c..4c74c941d0 100644 --- a/app/Traits/TwoStep.php +++ b/app/Traits/TwoStep.php @@ -22,8 +22,9 @@ trait TwoStep /** * Check if the user is authorized. * - * @return bool * @throws \Exception + * + * @return bool */ private function twoStepVerification() { @@ -45,8 +46,9 @@ private function twoStepVerification() * * @param collection $twoStepAuth * - * @return bool * @throws \Exception + * + * @return bool */ private function checkTimeSinceVerified($twoStepAuth) { @@ -111,8 +113,9 @@ private function generateCode(int $length = 4, string $prefix = '', string $suff * * @param int $userId * - * @return \App\Models\TwoStepAuth|\Illuminate\Database\Eloquent\Model * @throws \Exception + * + * @return \App\Models\TwoStepAuth|\Illuminate\Database\Eloquent\Model */ private function checkTwoStepAuthStatus(int $userId) { From 29628335f07b15fc0983ca6b9eeb51347c851919 Mon Sep 17 00:00:00 2001 From: HDVinnie Date: Wed, 22 Jul 2020 23:08:40 -0400 Subject: [PATCH 12/13] update: phpdoc blocks --- app/Bots/CasinoBot.php | 11 ++++++----- app/Bots/NerdBot.php | 11 ++++++----- app/Bots/SystemBot.php | 10 +++++----- app/Helpers/BackupPassword.php | 15 +++++++-------- app/Http/Controllers/Auth/RegisterController.php | 2 +- .../Controllers/Staff/MediaLanguageController.php | 1 + app/Http/Controllers/SubtitleController.php | 3 ++- app/Listeners/AchievementUnlocked.php | 2 +- app/Listeners/PasswordProtectBackup.php | 5 ++--- app/Models/Group.php | 2 +- app/Notifications/NewBon.php | 6 +++--- app/Notifications/NewPost.php | 6 +++--- app/Notifications/NewRequestBounty.php | 8 ++++---- app/Notifications/NewRequestClaim.php | 6 +++--- app/Notifications/NewRequestFill.php | 6 +++--- app/Notifications/NewRequestFillApprove.php | 6 +++--- app/Notifications/NewRequestFillReject.php | 6 +++--- app/Notifications/NewRequestUnclaim.php | 6 +++--- app/Notifications/NewTopic.php | 6 +++--- app/Repositories/TaggedUserRepository.php | 4 ++-- app/Repositories/WishRepository.php | 8 ++++---- app/Services/MovieScrapper.php | 6 ++---- 22 files changed, 68 insertions(+), 68 deletions(-) diff --git a/app/Bots/CasinoBot.php b/app/Bots/CasinoBot.php index 9c795b8137..d51e5dd48a 100644 --- a/app/Bots/CasinoBot.php +++ b/app/Bots/CasinoBot.php @@ -47,7 +47,7 @@ class CasinoBot /** * NerdBot Constructor. * - * @param ChatRepository $chat + * @param \App\Repositories\ChatRepository $chatRepository */ public function __construct(ChatRepository $chatRepository) { @@ -162,12 +162,13 @@ public function getHelp() /** * Process Message. * - * @param $type - * @param User $target - * @param string $message - * @param int $targeted + * @param $type + * @param \App\Models\User $user + * @param string $message + * @param int $targeted * * @return bool + * @throws \Exception */ public function process($type, User $user, $message = '', $targeted = 0) { diff --git a/app/Bots/NerdBot.php b/app/Bots/NerdBot.php index c0296d8c62..4c422e0138 100644 --- a/app/Bots/NerdBot.php +++ b/app/Bots/NerdBot.php @@ -51,7 +51,7 @@ class NerdBot /** * NerdBot Constructor. * - * @param ChatRepository $chat + * @param \App\Repositories\ChatRepository $chatRepository */ public function __construct(ChatRepository $chatRepository) { @@ -414,12 +414,13 @@ public function putDonate($amount = 0, $note = '') /** * Process Message. * - * @param $type - * @param User $target - * @param string $message - * @param int $targeted + * @param $type + * @param \App\Models\User $user + * @param string $message + * @param int $targeted * * @return bool + * @throws \Exception */ public function process($type, User $user, $message = '', $targeted = 0) { diff --git a/app/Bots/SystemBot.php b/app/Bots/SystemBot.php index 534b3acef7..9ff5021527 100644 --- a/app/Bots/SystemBot.php +++ b/app/Bots/SystemBot.php @@ -44,7 +44,7 @@ class SystemBot /** * SystemBot Constructor. * - * @param ChatRepository $chat + * @param \App\Repositories\ChatRepository $chatRepository */ public function __construct(ChatRepository $chatRepository) { @@ -145,10 +145,10 @@ public function putGift($receiver = '', $amount = 0, $note = '') /** * Process Message. * - * @param $type - * @param User $target - * @param string $message - * @param int $targeted + * @param $type + * @param \App\Models\User $user + * @param string $message + * @param int $targeted * * @return bool */ diff --git a/app/Helpers/BackupPassword.php b/app/Helpers/BackupPassword.php index a004d25c78..17e67593ab 100644 --- a/app/Helpers/BackupPassword.php +++ b/app/Helpers/BackupPassword.php @@ -36,8 +36,8 @@ class BackupPassword /** * Read the .zip, apply password and encryption, then rewrite the file. * - * @param \App\Helpers\BackupEncryption $encryption - * @param string $path the path to the .zip-file + * @param \App\Helpers\BackupEncryption $backupEncryption + * @param string $path the path to the .zip-file * * @throws \PhpZip\Exception\ZipException */ @@ -67,12 +67,11 @@ public function __construct(BackupEncryption $backupEncryption, string $path) /** * Use native PHP ZipArchive. * - * @param \App\Helpers\BackupEncryption $encryption + * @param \App\Helpers\BackupEncryption $backupEncryption * @param string $path * - * @throws \Exception - * * @return void + * @throws \Exception */ protected function makeZipArchive(BackupEncryption $backupEncryption, string $path): void { @@ -97,11 +96,11 @@ protected function makeZipArchive(BackupEncryption $backupEncryption, string $pa /** * Use PhpZip\ZipFile-package to create the zip. * - * @param \App\Helpers\BackupEncryption $encryption - * - * @throws \PhpZip\Exception\ZipException + * @param \App\Helpers\BackupEncryption $backupEncryption + * @param string $path * * @return void + * @throws \PhpZip\Exception\ZipException */ protected function makeZipFile(BackupEncryption $backupEncryption, string $path): void { diff --git a/app/Http/Controllers/Auth/RegisterController.php b/app/Http/Controllers/Auth/RegisterController.php index 4acc56f3fb..5ad1cfb849 100644 --- a/app/Http/Controllers/Auth/RegisterController.php +++ b/app/Http/Controllers/Auth/RegisterController.php @@ -38,7 +38,7 @@ class RegisterController extends Controller /** * RegisterController Constructor. * - * @param ChatRepository $chat + * @param \App\Repositories\ChatRepository $chatRepository */ public function __construct(ChatRepository $chatRepository) { diff --git a/app/Http/Controllers/Staff/MediaLanguageController.php b/app/Http/Controllers/Staff/MediaLanguageController.php index 137e26ebd8..629be82185 100644 --- a/app/Http/Controllers/Staff/MediaLanguageController.php +++ b/app/Http/Controllers/Staff/MediaLanguageController.php @@ -118,6 +118,7 @@ public function update(Request $request, $id) * @param \App\Models\MediaLanguage $id * * @return \Illuminate\Http\RedirectResponse + * @throws \Exception */ public function destroy($id) { diff --git a/app/Http/Controllers/SubtitleController.php b/app/Http/Controllers/SubtitleController.php index 2583762282..953c089f91 100644 --- a/app/Http/Controllers/SubtitleController.php +++ b/app/Http/Controllers/SubtitleController.php @@ -44,7 +44,7 @@ class SubtitleController extends Controller /** * SubtitleController Constructor. * - * @param ChatRepository $chat + * @param \App\Repositories\ChatRepository $chatRepository */ public function __construct(ChatRepository $chatRepository) { @@ -199,6 +199,7 @@ public function update(Request $request, $id) * @param \App\Models\Subtitle $id * * @return \Illuminate\Http\RedirectResponse + * @throws \Exception */ public function destroy(Request $request, $id) { diff --git a/app/Listeners/AchievementUnlocked.php b/app/Listeners/AchievementUnlocked.php index 4a8e99d69d..c2d53952bb 100644 --- a/app/Listeners/AchievementUnlocked.php +++ b/app/Listeners/AchievementUnlocked.php @@ -30,7 +30,7 @@ public function __construct(ChatRepository $chatRepository) /** * Handle the event. * - * @param $event + * @param \Gstt\Achievements\Event\Unlocked $unlocked * * @return void */ diff --git a/app/Listeners/PasswordProtectBackup.php b/app/Listeners/PasswordProtectBackup.php index 76af2cff49..4e90725a8c 100644 --- a/app/Listeners/PasswordProtectBackup.php +++ b/app/Listeners/PasswordProtectBackup.php @@ -31,11 +31,10 @@ public function __construct() /** * Handle the event. * - * @param \Spatie\Backup\Events\BackupZipWasCreated $event - * - * @throws \PhpZip\Exception\ZipException + * @param \Spatie\Backup\Events\BackupZipWasCreated $backupZipWasCreated * * @return string + * @throws \PhpZip\Exception\ZipException */ public function handle(BackupZipWasCreated $backupZipWasCreated): string { diff --git a/app/Models/Group.php b/app/Models/Group.php index 2c51ac78da..14af4b9186 100644 --- a/app/Models/Group.php +++ b/app/Models/Group.php @@ -110,7 +110,7 @@ public function permissions() * * @param $forum * - * @return + * @return \Illuminate\Database\Eloquent\Builder|\Illuminate\Database\Eloquent\Model|object|null */ public function getPermissionsByForum($forum) { diff --git a/app/Notifications/NewBon.php b/app/Notifications/NewBon.php index 6dacb87659..d28afc89c6 100644 --- a/app/Notifications/NewBon.php +++ b/app/Notifications/NewBon.php @@ -31,9 +31,9 @@ class NewBon extends Notification implements ShouldQueue /** * Create a new notification instance. * - * @param string $type - * @param string $sender - * @param BonTransactions $transaction + * @param string $type + * @param string $sender + * @param \App\Models\BonTransactions $bonTransactions */ public function __construct(string $type, string $sender, BonTransactions $bonTransactions) { diff --git a/app/Notifications/NewPost.php b/app/Notifications/NewPost.php index ff7b87620b..fbc0a9f78c 100644 --- a/app/Notifications/NewPost.php +++ b/app/Notifications/NewPost.php @@ -32,9 +32,9 @@ class NewPost extends Notification implements ShouldQueue /** * Create a new notification instance. * - * @param string $type - * @param User $poster - * @param Post $post + * @param string $type + * @param \App\Models\User $user + * @param Post $post */ public function __construct(string $type, User $user, Post $post) { diff --git a/app/Notifications/NewRequestBounty.php b/app/Notifications/NewRequestBounty.php index 2bc5787899..a6f0b47fcb 100644 --- a/app/Notifications/NewRequestBounty.php +++ b/app/Notifications/NewRequestBounty.php @@ -33,10 +33,10 @@ class NewRequestBounty extends Notification implements ShouldQueue /** * Create a new notification instance. * - * @param string $type - * @param string $sender - * @param $amount - * @param TorrentRequest $tr + * @param string $type + * @param string $sender + * @param $amount + * @param \App\Models\TorrentRequest $torrentRequest */ public function __construct(string $type, string $sender, $amount, TorrentRequest $torrentRequest) { diff --git a/app/Notifications/NewRequestClaim.php b/app/Notifications/NewRequestClaim.php index 58bb76eff7..c5adabae38 100644 --- a/app/Notifications/NewRequestClaim.php +++ b/app/Notifications/NewRequestClaim.php @@ -31,9 +31,9 @@ class NewRequestClaim extends Notification implements ShouldQueue /** * Create a new notification instance. * - * @param string $type - * @param string $sender - * @param TorrentRequest $tr + * @param string $type + * @param string $sender + * @param \App\Models\TorrentRequest $torrentRequest */ public function __construct(string $type, string $sender, TorrentRequest $torrentRequest) { diff --git a/app/Notifications/NewRequestFill.php b/app/Notifications/NewRequestFill.php index 8b4a648408..0288fab7f9 100644 --- a/app/Notifications/NewRequestFill.php +++ b/app/Notifications/NewRequestFill.php @@ -31,9 +31,9 @@ class NewRequestFill extends Notification implements ShouldQueue /** * Create a new notification instance. * - * @param string $type - * @param string $sender - * @param TorrentRequest $tr + * @param string $type + * @param string $sender + * @param \App\Models\TorrentRequest $torrentRequest */ public function __construct(string $type, string $sender, TorrentRequest $torrentRequest) { diff --git a/app/Notifications/NewRequestFillApprove.php b/app/Notifications/NewRequestFillApprove.php index f6d149c72d..aeee0d8bfc 100644 --- a/app/Notifications/NewRequestFillApprove.php +++ b/app/Notifications/NewRequestFillApprove.php @@ -31,9 +31,9 @@ class NewRequestFillApprove extends Notification implements ShouldQueue /** * Create a new notification instance. * - * @param string $type - * @param string $sender - * @param TorrentRequest $tr + * @param string $type + * @param string $sender + * @param \App\Models\TorrentRequest $torrentRequest */ public function __construct(string $type, string $sender, TorrentRequest $torrentRequest) { diff --git a/app/Notifications/NewRequestFillReject.php b/app/Notifications/NewRequestFillReject.php index 98cd1e22d6..eb70a565f7 100644 --- a/app/Notifications/NewRequestFillReject.php +++ b/app/Notifications/NewRequestFillReject.php @@ -31,9 +31,9 @@ class NewRequestFillReject extends Notification implements ShouldQueue /** * Create a new notification instance. * - * @param string $type - * @param string $sender - * @param TorrentRequest $tr + * @param string $type + * @param string $sender + * @param \App\Models\TorrentRequest $torrentRequest */ public function __construct(string $type, string $sender, TorrentRequest $torrentRequest) { diff --git a/app/Notifications/NewRequestUnclaim.php b/app/Notifications/NewRequestUnclaim.php index cd606cc995..6ce5d8e300 100644 --- a/app/Notifications/NewRequestUnclaim.php +++ b/app/Notifications/NewRequestUnclaim.php @@ -31,9 +31,9 @@ class NewRequestUnclaim extends Notification implements ShouldQueue /** * Create a new notification instance. * - * @param string $type - * @param string $sender - * @param TorrentRequest $tr + * @param string $type + * @param string $sender + * @param \App\Models\TorrentRequest $torrentRequest */ public function __construct(string $type, string $sender, TorrentRequest $torrentRequest) { diff --git a/app/Notifications/NewTopic.php b/app/Notifications/NewTopic.php index 8ec70fa9a8..02bbbd324a 100644 --- a/app/Notifications/NewTopic.php +++ b/app/Notifications/NewTopic.php @@ -32,9 +32,9 @@ class NewTopic extends Notification implements ShouldQueue /** * Create a new notification instance. * - * @param string $type - * @param User $poster - * @param Topic $topic + * @param string $type + * @param \App\Models\User $user + * @param Topic $topic */ public function __construct(string $type, User $user, Topic $topic) { diff --git a/app/Repositories/TaggedUserRepository.php b/app/Repositories/TaggedUserRepository.php index 5ee839aff6..2338a659fb 100644 --- a/app/Repositories/TaggedUserRepository.php +++ b/app/Repositories/TaggedUserRepository.php @@ -49,8 +49,8 @@ class TaggedUserRepository /** * TaggedUserRepository constructor. * - * @param User $user - * @param PrivateMessage $message + * @param User $user + * @param \App\Models\PrivateMessage $privateMessage */ public function __construct(User $user, PrivateMessage $privateMessage) { diff --git a/app/Repositories/WishRepository.php b/app/Repositories/WishRepository.php index 9219e50b78..3f13c393e7 100644 --- a/app/Repositories/WishRepository.php +++ b/app/Repositories/WishRepository.php @@ -44,10 +44,10 @@ class WishRepository implements WishInterface /** * WishRepository constructor. * - * @param Wish $wish - * @param User $user - * @param OmdbClient $client - * @param Torrent $torrent + * @param Wish $wish + * @param User $user + * @param \App\Services\Clients\OmdbClient $omdbClient + * @param Torrent $torrent */ public function __construct(Wish $wish, User $user, OmdbClient $omdbClient, Torrent $torrent) { diff --git a/app/Services/MovieScrapper.php b/app/Services/MovieScrapper.php index c40f28897a..794efe7341 100644 --- a/app/Services/MovieScrapper.php +++ b/app/Services/MovieScrapper.php @@ -31,15 +31,13 @@ public function __construct($tmdb_key = null, $tvdb_key = null, $omdb_key = null } /** - * @param $type + * @param $type * @param null $imdb * @param null $tmdb * @param null $tvdb * - * @throws \ErrorException - * @throws \HttpInvalidParamException - * * @return Movie|Tv + * @throws \ErrorException */ public function scrape($type, $imdb = null, $tmdb = null, $tvdb = null) { From 10befaaea060683f89193ce646702d12970ee759 Mon Sep 17 00:00:00 2001 From: HDVinnie Date: Thu, 23 Jul 2020 03:08:54 +0000 Subject: [PATCH 13/13] Apply fixes from StyleCI [ci skip] [skip ci] --- app/Bots/CasinoBot.php | 3 ++- app/Bots/NerdBot.php | 3 ++- app/Helpers/BackupPassword.php | 8 +++++--- app/Http/Controllers/Staff/MediaLanguageController.php | 3 ++- app/Http/Controllers/SubtitleController.php | 3 ++- app/Listeners/PasswordProtectBackup.php | 3 ++- app/Services/MovieScrapper.php | 3 ++- 7 files changed, 17 insertions(+), 9 deletions(-) diff --git a/app/Bots/CasinoBot.php b/app/Bots/CasinoBot.php index d51e5dd48a..585a3bdbf6 100644 --- a/app/Bots/CasinoBot.php +++ b/app/Bots/CasinoBot.php @@ -167,8 +167,9 @@ public function getHelp() * @param string $message * @param int $targeted * - * @return bool * @throws \Exception + * + * @return bool */ public function process($type, User $user, $message = '', $targeted = 0) { diff --git a/app/Bots/NerdBot.php b/app/Bots/NerdBot.php index 4c422e0138..d94c67be9e 100644 --- a/app/Bots/NerdBot.php +++ b/app/Bots/NerdBot.php @@ -419,8 +419,9 @@ public function putDonate($amount = 0, $note = '') * @param string $message * @param int $targeted * - * @return bool * @throws \Exception + * + * @return bool */ public function process($type, User $user, $message = '', $targeted = 0) { diff --git a/app/Helpers/BackupPassword.php b/app/Helpers/BackupPassword.php index 17e67593ab..64aa58c906 100644 --- a/app/Helpers/BackupPassword.php +++ b/app/Helpers/BackupPassword.php @@ -37,7 +37,7 @@ class BackupPassword * Read the .zip, apply password and encryption, then rewrite the file. * * @param \App\Helpers\BackupEncryption $backupEncryption - * @param string $path the path to the .zip-file + * @param string $path the path to the .zip-file * * @throws \PhpZip\Exception\ZipException */ @@ -70,8 +70,9 @@ public function __construct(BackupEncryption $backupEncryption, string $path) * @param \App\Helpers\BackupEncryption $backupEncryption * @param string $path * - * @return void * @throws \Exception + * + * @return void */ protected function makeZipArchive(BackupEncryption $backupEncryption, string $path): void { @@ -99,8 +100,9 @@ protected function makeZipArchive(BackupEncryption $backupEncryption, string $pa * @param \App\Helpers\BackupEncryption $backupEncryption * @param string $path * - * @return void * @throws \PhpZip\Exception\ZipException + * + * @return void */ protected function makeZipFile(BackupEncryption $backupEncryption, string $path): void { diff --git a/app/Http/Controllers/Staff/MediaLanguageController.php b/app/Http/Controllers/Staff/MediaLanguageController.php index 629be82185..43f00b611c 100644 --- a/app/Http/Controllers/Staff/MediaLanguageController.php +++ b/app/Http/Controllers/Staff/MediaLanguageController.php @@ -117,8 +117,9 @@ public function update(Request $request, $id) * * @param \App\Models\MediaLanguage $id * - * @return \Illuminate\Http\RedirectResponse * @throws \Exception + * + * @return \Illuminate\Http\RedirectResponse */ public function destroy($id) { diff --git a/app/Http/Controllers/SubtitleController.php b/app/Http/Controllers/SubtitleController.php index 953c089f91..3f78b259f9 100644 --- a/app/Http/Controllers/SubtitleController.php +++ b/app/Http/Controllers/SubtitleController.php @@ -198,8 +198,9 @@ public function update(Request $request, $id) * @param \Illuminate\Http\Request $request * @param \App\Models\Subtitle $id * - * @return \Illuminate\Http\RedirectResponse * @throws \Exception + * + * @return \Illuminate\Http\RedirectResponse */ public function destroy(Request $request, $id) { diff --git a/app/Listeners/PasswordProtectBackup.php b/app/Listeners/PasswordProtectBackup.php index 4e90725a8c..d8bfb1fb28 100644 --- a/app/Listeners/PasswordProtectBackup.php +++ b/app/Listeners/PasswordProtectBackup.php @@ -33,8 +33,9 @@ public function __construct() * * @param \Spatie\Backup\Events\BackupZipWasCreated $backupZipWasCreated * - * @return string * @throws \PhpZip\Exception\ZipException + * + * @return string */ public function handle(BackupZipWasCreated $backupZipWasCreated): string { diff --git a/app/Services/MovieScrapper.php b/app/Services/MovieScrapper.php index 794efe7341..55b1b3d5e7 100644 --- a/app/Services/MovieScrapper.php +++ b/app/Services/MovieScrapper.php @@ -36,8 +36,9 @@ public function __construct($tmdb_key = null, $tvdb_key = null, $omdb_key = null * @param null $tmdb * @param null $tvdb * - * @return Movie|Tv * @throws \ErrorException + * + * @return Movie|Tv */ public function scrape($type, $imdb = null, $tmdb = null, $tvdb = null) {