mirror of
https://github.com/HDInnovations/UNIT3D-Community-Edition.git
synced 2026-04-23 19:50:40 -05:00
PHP Style Change (Laravel Pint CI)
This commit is contained in:
@@ -120,7 +120,7 @@ class CasinoBot
|
||||
{
|
||||
$donations = cache()->get('casinobot-donations');
|
||||
|
||||
if (! $donations) {
|
||||
if (!$donations) {
|
||||
$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);
|
||||
}
|
||||
@@ -211,7 +211,7 @@ class CasinoBot
|
||||
$receiverDirty = false;
|
||||
$receiverEchoes = cache()->get('user-echoes'.$target->id);
|
||||
|
||||
if (! $receiverEchoes || ! \is_array($receiverEchoes)) {
|
||||
if (!$receiverEchoes || !\is_array($receiverEchoes)) {
|
||||
$receiverEchoes = UserEcho::with(['room', 'target', 'bot'])->where('user_id', '=', $target->id)->get();
|
||||
}
|
||||
|
||||
@@ -225,7 +225,7 @@ class CasinoBot
|
||||
}
|
||||
}
|
||||
|
||||
if (! $receiverListening) {
|
||||
if (!$receiverListening) {
|
||||
$receiverPort = new UserEcho();
|
||||
$receiverPort->user_id = $target->id;
|
||||
$receiverPort->bot_id = $this->bot->id;
|
||||
@@ -243,7 +243,7 @@ class CasinoBot
|
||||
$receiverDirty = false;
|
||||
$receiverAudibles = cache()->get('user-audibles'.$target->id);
|
||||
|
||||
if (! $receiverAudibles || ! \is_array($receiverAudibles)) {
|
||||
if (!$receiverAudibles || !\is_array($receiverAudibles)) {
|
||||
$receiverAudibles = UserAudible::with(['room', 'target', 'bot'])->where('user_id', '=', $target->id)->get();
|
||||
}
|
||||
|
||||
@@ -257,7 +257,7 @@ class CasinoBot
|
||||
}
|
||||
}
|
||||
|
||||
if (! $receiverListening) {
|
||||
if (!$receiverListening) {
|
||||
$receiverPort = new UserAudible();
|
||||
$receiverPort->user_id = $target->id;
|
||||
$receiverPort->bot_id = $this->bot->id;
|
||||
|
||||
@@ -126,12 +126,12 @@ class IRCAnnounceBot
|
||||
// Channel name must begin with either `#` or `&`
|
||||
&& \in_array($channel[0], ['#', '&'], true)
|
||||
// Channel names can contain any 8bit code except for SPACE, BELL, NUL, CR, LF and comma
|
||||
&& ! str_contains($channel, ' ')
|
||||
&& ! str_contains($channel, "\7")
|
||||
&& ! str_contains($channel, "\0")
|
||||
&& ! str_contains($channel, "\r")
|
||||
&& ! str_contains($channel, "\n")
|
||||
&& ! str_contains($channel, ',');
|
||||
&& !str_contains($channel, ' ')
|
||||
&& !str_contains($channel, "\7")
|
||||
&& !str_contains($channel, "\0")
|
||||
&& !str_contains($channel, "\r")
|
||||
&& !str_contains($channel, "\n")
|
||||
&& !str_contains($channel, ',');
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -163,7 +163,7 @@ class IRCAnnounceBot
|
||||
*/
|
||||
private function join(string $channel, string $key = ''): void
|
||||
{
|
||||
if (! $this->isValidChannelName($channel)) {
|
||||
if (!$this->isValidChannelName($channel)) {
|
||||
Log::error('Tried to join a channel with invalid name.', ['name' => $channel]);
|
||||
|
||||
return;
|
||||
@@ -177,7 +177,7 @@ class IRCAnnounceBot
|
||||
*/
|
||||
private function part(string $channel): void
|
||||
{
|
||||
if (! $this->isValidChannelName($channel)) {
|
||||
if (!$this->isValidChannelName($channel)) {
|
||||
Log::error('Tried to part a channel with invalid name.', ['name' => $channel]);
|
||||
|
||||
return;
|
||||
|
||||
@@ -354,7 +354,7 @@ class NerdBot
|
||||
$receiverDirty = false;
|
||||
$receiverEchoes = cache()->get('user-echoes'.$target->id);
|
||||
|
||||
if (! $receiverEchoes || ! \is_array($receiverEchoes)) {
|
||||
if (!$receiverEchoes || !\is_array($receiverEchoes)) {
|
||||
$receiverEchoes = UserEcho::with(['room', 'target', 'bot'])->where('user_id', '=', $target->id)->get();
|
||||
}
|
||||
|
||||
@@ -368,7 +368,7 @@ class NerdBot
|
||||
}
|
||||
}
|
||||
|
||||
if (! $receiverListening) {
|
||||
if (!$receiverListening) {
|
||||
$receiverPort = new UserEcho();
|
||||
$receiverPort->user_id = $target->id;
|
||||
$receiverPort->bot_id = $this->bot->id;
|
||||
@@ -386,7 +386,7 @@ class NerdBot
|
||||
$receiverDirty = false;
|
||||
$receiverAudibles = cache()->get('user-audibles'.$target->id);
|
||||
|
||||
if (! $receiverAudibles || ! \is_array($receiverAudibles)) {
|
||||
if (!$receiverAudibles || !\is_array($receiverAudibles)) {
|
||||
$receiverAudibles = UserAudible::with(['room', 'target', 'bot'])->where('user_id', '=', $target->id)->get();
|
||||
}
|
||||
|
||||
@@ -400,7 +400,7 @@ class NerdBot
|
||||
}
|
||||
}
|
||||
|
||||
if (! $receiverListening) {
|
||||
if (!$receiverListening) {
|
||||
$receiverPort = new UserAudible();
|
||||
$receiverPort->user_id = $target->id;
|
||||
$receiverPort->bot_id = $this->bot->id;
|
||||
|
||||
@@ -85,7 +85,7 @@ class SystemBot
|
||||
if ($v->passes()) {
|
||||
$recipient = User::where('username', 'LIKE', $receiver)->first();
|
||||
|
||||
if (! $recipient || $recipient->id === $this->target->id) {
|
||||
if (!$recipient || $recipient->id === $this->target->id) {
|
||||
return 'Your BON gift could not be sent.';
|
||||
}
|
||||
|
||||
@@ -184,7 +184,7 @@ class SystemBot
|
||||
$receiverDirty = false;
|
||||
$receiverEchoes = cache()->get('user-echoes'.$target->id);
|
||||
|
||||
if (! $receiverEchoes || ! \is_array($receiverEchoes)) {
|
||||
if (!$receiverEchoes || !\is_array($receiverEchoes)) {
|
||||
$receiverEchoes = UserEcho::with(['room', 'target', 'bot'])->where('user_id', '=', $target->id)->get();
|
||||
}
|
||||
|
||||
@@ -198,7 +198,7 @@ class SystemBot
|
||||
}
|
||||
}
|
||||
|
||||
if (! $receiverListening) {
|
||||
if (!$receiverListening) {
|
||||
$receiverPort = new UserEcho();
|
||||
$receiverPort->user_id = $target->id;
|
||||
$receiverPort->bot_id = $this->bot->id;
|
||||
@@ -216,7 +216,7 @@ class SystemBot
|
||||
$receiverDirty = false;
|
||||
$receiverAudibles = cache()->get('user-audibles'.$target->id);
|
||||
|
||||
if (! $receiverAudibles || ! \is_array($receiverAudibles)) {
|
||||
if (!$receiverAudibles || !\is_array($receiverAudibles)) {
|
||||
$receiverAudibles = UserAudible::with(['room', 'target', 'bot'])->where('user_id', '=', $target->id)->get();
|
||||
}
|
||||
|
||||
@@ -230,7 +230,7 @@ class SystemBot
|
||||
}
|
||||
}
|
||||
|
||||
if (! $receiverListening) {
|
||||
if (!$receiverListening) {
|
||||
$receiverPort = new UserAudible();
|
||||
$receiverPort->user_id = $target->id;
|
||||
$receiverPort->bot_id = $this->bot->id;
|
||||
|
||||
@@ -44,7 +44,7 @@ class AutoCheckPeerConnectivity extends Command
|
||||
*/
|
||||
public function handle(): void
|
||||
{
|
||||
if (! config('announce.connectable_check')) {
|
||||
if (!config('announce.connectable_check')) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -64,7 +64,7 @@ class AutoFlushPeers extends Command
|
||||
|
||||
Torrent::where('id', '=', $peer->torrent_id)->update([
|
||||
'seeders' => DB::raw('seeders - '.((int) $peer->seeder)),
|
||||
'leechers' => DB::raw('leechers - '.((int) ! $peer->seeder)),
|
||||
'leechers' => DB::raw('leechers - '.((int) !$peer->seeder)),
|
||||
]);
|
||||
|
||||
$peer->active = false;
|
||||
|
||||
@@ -65,7 +65,7 @@ class AutoPreWarning extends Command
|
||||
continue;
|
||||
}
|
||||
|
||||
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)
|
||||
|
||||
@@ -57,7 +57,7 @@ class AutoRefundDownload extends Command
|
||||
->where('history.seedtime', '<=', $FULL_REFUND_SEEDTIME + $MIN_SEEDTIME + $COMMAND_RUN_PERIOD)
|
||||
->where('history.created_at', '>=', $now->copy()->subSeconds($MIN_SEEDTIME))
|
||||
->whereColumn('torrents.user_id', '!=', 'history.user_id')
|
||||
->when(! config('other.refundable'), fn ($query) => $query->where(
|
||||
->when(!config('other.refundable'), fn ($query) => $query->where(
|
||||
fn ($query) => $query
|
||||
->where('groups.is_refundable', '=', 1)
|
||||
->orWhere('torrents.refundable', '=', 1)
|
||||
|
||||
@@ -52,7 +52,7 @@ class AutoStatsClients extends Command
|
||||
->mapWithKeys(fn ($item, $key) => [$item['agent'] => $item['count']])
|
||||
->toArray();
|
||||
|
||||
if (! empty($clients)) {
|
||||
if (!empty($clients)) {
|
||||
cache()->put('stats:clients', $clients, Carbon::now()->addMinutes(1440));
|
||||
}
|
||||
|
||||
|
||||
@@ -62,7 +62,7 @@ class AutoWarning extends Command
|
||||
->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)
|
||||
|
||||
@@ -31,7 +31,7 @@ class DbDump extends Command
|
||||
$user = config('database.connections.mysql.username');
|
||||
$password = config('database.connections.mysql.password');
|
||||
|
||||
if (! $outfile) {
|
||||
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".');
|
||||
|
||||
return;
|
||||
|
||||
@@ -84,7 +84,7 @@ class GitUpdater extends Command
|
||||
<fg=red>BY PROCEEDING YOU AGREE TO THE ABOVE DISCLAIMER! USE AT YOUR OWN RISK!</>
|
||||
</>');
|
||||
|
||||
if (! $this->io->confirm('Would you like to proceed', true)) {
|
||||
if (!$this->io->confirm('Would you like to proceed', true)) {
|
||||
$this->line('<fg=red>Aborted ...</>');
|
||||
|
||||
exit();
|
||||
@@ -337,24 +337,24 @@ class GitUpdater extends Command
|
||||
|
||||
private function validatePath($path): void
|
||||
{
|
||||
if (! is_file(base_path($path)) && ! is_dir(base_path($path))) {
|
||||
if (!is_file(base_path($path)) && !is_dir(base_path($path))) {
|
||||
$this->red(sprintf("The path '%s' is invalid", $path));
|
||||
}
|
||||
}
|
||||
|
||||
private function createBackupPath($path): void
|
||||
{
|
||||
if (! is_dir(storage_path(sprintf('gitupdate/%s', $path))) && ! is_file(base_path($path))) {
|
||||
if (! mkdir($concurrentDirectory = storage_path(sprintf('gitupdate/%s', $path)), 0775, true) && ! is_dir($concurrentDirectory)) {
|
||||
if (!is_dir(storage_path(sprintf('gitupdate/%s', $path))) && !is_file(base_path($path))) {
|
||||
if (!mkdir($concurrentDirectory = storage_path(sprintf('gitupdate/%s', $path)), 0775, true) && !is_dir($concurrentDirectory)) {
|
||||
throw new RuntimeException(sprintf('Directory "%s" was not created', $concurrentDirectory));
|
||||
}
|
||||
} elseif (is_file(base_path($path)) && \dirname((string) $path) !== '.') {
|
||||
$path = \dirname((string) $path);
|
||||
|
||||
if (! is_dir(storage_path(sprintf('gitupdate/%s', $path))) && ! mkdir($concurrentDirectory = storage_path(sprintf(
|
||||
if (!is_dir(storage_path(sprintf('gitupdate/%s', $path))) && !mkdir($concurrentDirectory = storage_path(sprintf(
|
||||
'gitupdate/%s',
|
||||
$path
|
||||
)), 0775, true) && ! is_dir($concurrentDirectory)) {
|
||||
)), 0775, true) && !is_dir($concurrentDirectory)) {
|
||||
throw new RuntimeException(sprintf('Directory "%s" was not created', $concurrentDirectory));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -40,7 +40,7 @@ class SyncTorrentSeasonEpisode extends Command
|
||||
{
|
||||
foreach (Torrent::withoutGlobalScope(ApprovedScope::class)->with(['category'])->whereNull('season_number')->orWhereNull('episode_number')->get() as $torrent) {
|
||||
// Skip if not TV
|
||||
if (! $torrent->category->tv_meta) {
|
||||
if (!$torrent->category->tv_meta) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
@@ -102,7 +102,7 @@ class VendorCleanup extends Command
|
||||
|
||||
$files = glob($directory.'/'.$casePattern, GLOB_BRACE);
|
||||
|
||||
if (! $files) {
|
||||
if (!$files) {
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -121,13 +121,13 @@ class VendorCleanup extends Command
|
||||
if (is_dir($file)) {
|
||||
$this->out('DELETING DIR: '.$file);
|
||||
|
||||
if (! $isDry) {
|
||||
if (!$isDry) {
|
||||
$this->delTree($file);
|
||||
}
|
||||
} else {
|
||||
$this->out('DELETING FILE: '.$file);
|
||||
|
||||
if (! $isDry) {
|
||||
if (!$isDry) {
|
||||
@unlink($file);
|
||||
}
|
||||
}
|
||||
@@ -162,7 +162,7 @@ class VendorCleanup extends Command
|
||||
*/
|
||||
protected function delTree(string $dir)
|
||||
{
|
||||
if (! file_exists($dir) || ! is_dir($dir)) {
|
||||
if (!file_exists($dir) || !is_dir($dir)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -92,7 +92,7 @@ trait ConsoleTools
|
||||
foreach ($commands as $command) {
|
||||
$process = $this->process($command, $silent);
|
||||
|
||||
if (! $silent) {
|
||||
if (!$silent) {
|
||||
echo "\n\n";
|
||||
$this->warn($process->getOutput());
|
||||
}
|
||||
@@ -101,7 +101,7 @@ trait ConsoleTools
|
||||
|
||||
private function process($command, $silent = false): Process
|
||||
{
|
||||
if (! $silent) {
|
||||
if (!$silent) {
|
||||
$this->cyan($command);
|
||||
$bar = $this->progressStart();
|
||||
}
|
||||
@@ -117,20 +117,20 @@ trait ConsoleTools
|
||||
$this->red(sprintf("'%s' timed out.!", $command));
|
||||
}
|
||||
|
||||
if (! $silent) {
|
||||
if (!$silent) {
|
||||
$bar->advance();
|
||||
}
|
||||
|
||||
usleep(200_000);
|
||||
}
|
||||
|
||||
if (! $silent) {
|
||||
if (!$silent) {
|
||||
$this->progressStop($bar);
|
||||
}
|
||||
|
||||
$process->stop();
|
||||
|
||||
if (! $process->isSuccessful()) {
|
||||
if (!$process->isSuccessful()) {
|
||||
$this->red($process->getErrorOutput());
|
||||
//die();
|
||||
}
|
||||
|
||||
@@ -36,7 +36,7 @@ class BackupPassword
|
||||
$this->password = config('backup.security.password');
|
||||
|
||||
// If no password is set, just return the backup-path
|
||||
if (! $this->password) {
|
||||
if (!$this->password) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -341,7 +341,7 @@ class Bbcode
|
||||
}
|
||||
|
||||
// Is the potential tag opening or closing?
|
||||
if ($source[$index + 1] === '/' && ! empty($openedElements)) {
|
||||
if ($source[$index + 1] === '/' && !empty($openedElements)) {
|
||||
$name = array_pop($openedElements);
|
||||
$el = $this->parsers[$name];
|
||||
$tag = substr((string) $source, $index, \strlen((string) $el['closeBbcode']));
|
||||
@@ -382,7 +382,7 @@ class Bbcode
|
||||
$index++;
|
||||
}
|
||||
|
||||
while (! empty($openedElements)) {
|
||||
while (!empty($openedElements)) {
|
||||
$source .= $this->parsers[array_pop($openedElements)]['closeHtml'];
|
||||
}
|
||||
|
||||
|
||||
@@ -75,7 +75,7 @@ class Bencode
|
||||
|
||||
$pos++;
|
||||
|
||||
if (! safe_int($lengthStr)) {
|
||||
if (!safe_int($lengthStr)) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -170,9 +170,9 @@ class Bencode
|
||||
$ret = 'l';
|
||||
$isDict = false;
|
||||
|
||||
if (! isset($d['isDct'])) {
|
||||
if (!isset($d['isDct'])) {
|
||||
foreach (array_keys($d) as $key) {
|
||||
if (! \is_int($key)) {
|
||||
if (!\is_int($key)) {
|
||||
$isDict = true;
|
||||
|
||||
break;
|
||||
|
||||
@@ -19,7 +19,7 @@ class CacheUser
|
||||
{
|
||||
public static function user($id)
|
||||
{
|
||||
if (! $id || $id <= 0 || ! is_numeric($id)) {
|
||||
if (!$id || $id <= 0 || !is_numeric($id)) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
+12
-12
@@ -10,14 +10,14 @@
|
||||
* @author HDVinnie <hdinnovations@protonmail.com>
|
||||
* @license https://www.gnu.org/licenses/agpl-3.0.en.html/ GNU Affero General Public License v3.0
|
||||
*/
|
||||
if (! \function_exists('appurl')) {
|
||||
if (!\function_exists('appurl')) {
|
||||
function appurl()
|
||||
{
|
||||
return config('app.url');
|
||||
}
|
||||
}
|
||||
|
||||
if (! \function_exists('href_profile')) {
|
||||
if (!\function_exists('href_profile')) {
|
||||
function href_profile($user)
|
||||
{
|
||||
$appurl = appurl();
|
||||
@@ -26,7 +26,7 @@ if (! \function_exists('href_profile')) {
|
||||
}
|
||||
}
|
||||
|
||||
if (! \function_exists('href_article')) {
|
||||
if (!\function_exists('href_article')) {
|
||||
function href_article($article)
|
||||
{
|
||||
$appurl = appurl();
|
||||
@@ -35,7 +35,7 @@ if (! \function_exists('href_article')) {
|
||||
}
|
||||
}
|
||||
|
||||
if (! \function_exists('href_torrent')) {
|
||||
if (!\function_exists('href_torrent')) {
|
||||
function href_torrent($torrent)
|
||||
{
|
||||
$appurl = appurl();
|
||||
@@ -44,7 +44,7 @@ if (! \function_exists('href_torrent')) {
|
||||
}
|
||||
}
|
||||
|
||||
if (! \function_exists('href_request')) {
|
||||
if (!\function_exists('href_request')) {
|
||||
function href_request($torrentRequest)
|
||||
{
|
||||
$appurl = appurl();
|
||||
@@ -53,7 +53,7 @@ if (! \function_exists('href_request')) {
|
||||
}
|
||||
}
|
||||
|
||||
if (! \function_exists('href_poll')) {
|
||||
if (!\function_exists('href_poll')) {
|
||||
function href_poll($poll)
|
||||
{
|
||||
$appurl = appurl();
|
||||
@@ -62,7 +62,7 @@ if (! \function_exists('href_poll')) {
|
||||
}
|
||||
}
|
||||
|
||||
if (! \function_exists('href_playlist')) {
|
||||
if (!\function_exists('href_playlist')) {
|
||||
function href_playlist($playlist)
|
||||
{
|
||||
$appurl = appurl();
|
||||
@@ -71,7 +71,7 @@ if (! \function_exists('href_playlist')) {
|
||||
}
|
||||
}
|
||||
|
||||
if (! \function_exists('href_collection')) {
|
||||
if (!\function_exists('href_collection')) {
|
||||
function href_collection($collection)
|
||||
{
|
||||
$appurl = appurl();
|
||||
@@ -80,7 +80,7 @@ if (! \function_exists('href_collection')) {
|
||||
}
|
||||
}
|
||||
|
||||
if (! \function_exists('tmdb_image')) {
|
||||
if (!\function_exists('tmdb_image')) {
|
||||
function tmdb_image($type, $original)
|
||||
{
|
||||
$new = match ($type) {
|
||||
@@ -102,14 +102,14 @@ if (! \function_exists('tmdb_image')) {
|
||||
}
|
||||
}
|
||||
|
||||
if (! \function_exists('modal_style')) {
|
||||
if (!\function_exists('modal_style')) {
|
||||
function modal_style()
|
||||
{
|
||||
return (auth()->user()->style == 0) ? '' : ' modal-dark';
|
||||
}
|
||||
}
|
||||
|
||||
if (! \function_exists('rating_color')) {
|
||||
if (!\function_exists('rating_color')) {
|
||||
function rating_color($number)
|
||||
{
|
||||
$rating = round((float) $number);
|
||||
@@ -128,7 +128,7 @@ if (! \function_exists('rating_color')) {
|
||||
}
|
||||
}
|
||||
|
||||
if (! \function_exists('language_flag')) {
|
||||
if (!\function_exists('language_flag')) {
|
||||
function language_flag($language)
|
||||
{
|
||||
$flag = match ($language) {
|
||||
|
||||
@@ -52,12 +52,12 @@ class HiddenCaptcha
|
||||
$formData = $validator->getData();
|
||||
|
||||
// Check post values
|
||||
if (! isset($formData['_captcha']) || ! ($token = self::getToken($formData['_captcha']))) {
|
||||
if (!isset($formData['_captcha']) || !($token = self::getToken($formData['_captcha']))) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// 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;
|
||||
}
|
||||
|
||||
@@ -94,7 +94,7 @@ class HiddenCaptcha
|
||||
$token = @unserialize($token);
|
||||
|
||||
// Token is null or unserializable
|
||||
if (! $token || ! \is_array($token)) {
|
||||
if (!$token || !\is_array($token)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
* @author HDVinnie <hdinnovations@protonmail.com>
|
||||
* @license https://www.gnu.org/licenses/agpl-3.0.en.html/ GNU Affero General Public License v3.0
|
||||
*/
|
||||
if (! \function_exists('language')) {
|
||||
if (!\function_exists('language')) {
|
||||
/**
|
||||
* Get the language instance.
|
||||
*/
|
||||
|
||||
+26
-26
@@ -231,7 +231,7 @@ class Markdown
|
||||
if (isset($Block)) {
|
||||
$Block['type'] = $blockType;
|
||||
|
||||
if (! isset($Block['identified'])) {
|
||||
if (!isset($Block['identified'])) {
|
||||
if (isset($CurrentBlock)) {
|
||||
$Elements[] = $this->extractElement($CurrentBlock);
|
||||
}
|
||||
@@ -288,7 +288,7 @@ class Markdown
|
||||
|
||||
protected function extractElement(array $Component)
|
||||
{
|
||||
if (! isset($Component['element'])) {
|
||||
if (!isset($Component['element'])) {
|
||||
if (isset($Component['markup'])) {
|
||||
$Component['element'] = ['rawHtml' => $Component['markup']];
|
||||
} elseif (isset($Component['hidden'])) {
|
||||
@@ -314,7 +314,7 @@ class Markdown
|
||||
|
||||
protected function blockCode($Line, $Block = null)
|
||||
{
|
||||
if (isset($Block) && $Block['type'] === 'Paragraph' && ! isset($Block['interrupted'])) {
|
||||
if (isset($Block) && $Block['type'] === 'Paragraph' && !isset($Block['interrupted'])) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -551,7 +551,7 @@ class Markdown
|
||||
|
||||
if ($listStart !== '1') {
|
||||
if (
|
||||
isset($CurrentBlock) && $CurrentBlock['type'] === 'Paragraph' && ! isset($CurrentBlock['interrupted'])
|
||||
isset($CurrentBlock) && $CurrentBlock['type'] === 'Paragraph' && !isset($CurrentBlock['interrupted'])
|
||||
) {
|
||||
return;
|
||||
}
|
||||
@@ -639,7 +639,7 @@ class Markdown
|
||||
return $Block;
|
||||
}
|
||||
|
||||
if (! isset($Block['interrupted'])) {
|
||||
if (!isset($Block['interrupted'])) {
|
||||
$text = preg_replace('/^[ ]{0,'.$requiredIndent.'}+/', '', (string) $Line['body']);
|
||||
|
||||
$Block['li']['handler']['argument'][] = $text;
|
||||
@@ -692,7 +692,7 @@ class Markdown
|
||||
return $Block;
|
||||
}
|
||||
|
||||
if (! isset($Block['interrupted'])) {
|
||||
if (!isset($Block['interrupted'])) {
|
||||
$Block['element']['handler']['argument'][] = $Line['text'];
|
||||
|
||||
return $Block;
|
||||
@@ -720,7 +720,7 @@ class Markdown
|
||||
|
||||
protected function blockSetextHeader($Line, array $Block = null)
|
||||
{
|
||||
if (! isset($Block) || $Block['type'] !== 'Paragraph' || isset($Block['interrupted'])) {
|
||||
if (!isset($Block) || $Block['type'] !== 'Paragraph' || isset($Block['interrupted'])) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -795,12 +795,12 @@ class Markdown
|
||||
|
||||
protected function blockTable($Line, array $Block = null)
|
||||
{
|
||||
if (! isset($Block) || $Block['type'] !== 'Paragraph' || isset($Block['interrupted'])) {
|
||||
if (!isset($Block) || $Block['type'] !== 'Paragraph' || isset($Block['interrupted'])) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (
|
||||
(! str_contains((string) $Block['element']['handler']['argument'], '|') && ! str_contains((string) $Line['text'], '|') && ! str_contains(
|
||||
(!str_contains((string) $Block['element']['handler']['argument'], '|') && !str_contains((string) $Line['text'], '|') && !str_contains(
|
||||
(string) $Line['text'],
|
||||
':'
|
||||
)) || str_contains((string) $Block['element']['handler']['argument'], "\n")
|
||||
@@ -1048,7 +1048,7 @@ class Markdown
|
||||
|
||||
$Inline = $this->{sprintf('inline%s', $inlineType)}($Excerpt);
|
||||
|
||||
if (! isset($Inline)) {
|
||||
if (!isset($Inline)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -1060,7 +1060,7 @@ class Markdown
|
||||
|
||||
// sets a default inline position
|
||||
|
||||
if (! isset($Inline['position'])) {
|
||||
if (!isset($Inline['position'])) {
|
||||
$Inline['position'] = $markerPosition;
|
||||
}
|
||||
|
||||
@@ -1100,7 +1100,7 @@ class Markdown
|
||||
$Elements[] = $InlineText['element'];
|
||||
|
||||
foreach ($Elements as &$Element) {
|
||||
if (! isset($Element['autobreak'])) {
|
||||
if (!isset($Element['autobreak'])) {
|
||||
$Element['autobreak'] = false;
|
||||
}
|
||||
}
|
||||
@@ -1160,7 +1160,7 @@ class Markdown
|
||||
) {
|
||||
$url = $matches[1];
|
||||
|
||||
if (! isset($matches[2])) {
|
||||
if (!isset($matches[2])) {
|
||||
$url = sprintf('mailto:%s', $url);
|
||||
}
|
||||
|
||||
@@ -1179,7 +1179,7 @@ class Markdown
|
||||
|
||||
protected function inlineEmphasis($Excerpt)
|
||||
{
|
||||
if (! isset($Excerpt['text'][1])) {
|
||||
if (!isset($Excerpt['text'][1])) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1218,7 +1218,7 @@ class Markdown
|
||||
|
||||
protected function inlineImage($Excerpt)
|
||||
{
|
||||
if (! isset($Excerpt['text'][1]) || $Excerpt['text'][1] !== '[') {
|
||||
if (!isset($Excerpt['text'][1]) || $Excerpt['text'][1] !== '[') {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1297,7 +1297,7 @@ class Markdown
|
||||
$definition = strtolower($Element['handler']['argument']);
|
||||
}
|
||||
|
||||
if (! isset($this->DefinitionData['Reference'][$definition])) {
|
||||
if (!isset($this->DefinitionData['Reference'][$definition])) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1315,7 +1315,7 @@ class Markdown
|
||||
|
||||
protected function inlineMarkup($Excerpt)
|
||||
{
|
||||
if ($this->markupEscaped || $this->safeMode || ! str_contains((string) $Excerpt['text'], '>')) {
|
||||
if ($this->markupEscaped || $this->safeMode || !str_contains((string) $Excerpt['text'], '>')) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1354,7 +1354,7 @@ class Markdown
|
||||
|
||||
protected function inlineStrikethrough($Excerpt)
|
||||
{
|
||||
if (! isset($Excerpt['text'][1])) {
|
||||
if (!isset($Excerpt['text'][1])) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1375,7 +1375,7 @@ class Markdown
|
||||
|
||||
protected function inlineUrl($Excerpt)
|
||||
{
|
||||
if ($this->urlsLinked !== true || ! isset($Excerpt['text'][2]) || $Excerpt['text'][2] !== '/') {
|
||||
if ($this->urlsLinked !== true || !isset($Excerpt['text'][2]) || $Excerpt['text'][2] !== '/') {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1431,7 +1431,7 @@ class Markdown
|
||||
protected function handle(array $Element)
|
||||
{
|
||||
if (isset($Element['handler'])) {
|
||||
if (! isset($Element['nonNestables'])) {
|
||||
if (!isset($Element['nonNestables'])) {
|
||||
$Element['nonNestables'] = [];
|
||||
}
|
||||
|
||||
@@ -1548,7 +1548,7 @@ class Markdown
|
||||
$text = $Element['rawHtml'];
|
||||
|
||||
$allowRawHtmlInSafeMode = isset($Element['allowRawHtmlInSafeMode']) && $Element['allowRawHtmlInSafeMode'];
|
||||
$permitRawHtml = ! $this->safeMode || $allowRawHtmlInSafeMode;
|
||||
$permitRawHtml = !$this->safeMode || $allowRawHtmlInSafeMode;
|
||||
}
|
||||
|
||||
$hasContent = isset($text) || isset($Element['element']) || isset($Element['elements']);
|
||||
@@ -1560,7 +1560,7 @@ class Markdown
|
||||
$markup .= $this->elements($Element['elements']);
|
||||
} elseif (isset($Element['element'])) {
|
||||
$markup .= $this->element($Element['element']);
|
||||
} elseif (! $permitRawHtml) {
|
||||
} elseif (!$permitRawHtml) {
|
||||
$markup .= self::escape($text, true);
|
||||
} else {
|
||||
$markup .= $text;
|
||||
@@ -1604,7 +1604,7 @@ class Markdown
|
||||
{
|
||||
$Elements = $this->linesElements($lines);
|
||||
|
||||
if (isset($Elements[0], $Elements[0]['name']) && ! \in_array('', $lines) && $Elements[0]['name'] === 'p'
|
||||
if (isset($Elements[0], $Elements[0]['name']) && !\in_array('', $lines) && $Elements[0]['name'] === 'p'
|
||||
) {
|
||||
unset($Elements[0]['name']);
|
||||
}
|
||||
@@ -1660,7 +1660,7 @@ class Markdown
|
||||
'img' => 'src',
|
||||
];
|
||||
|
||||
if (! isset($Element['name'])) {
|
||||
if (!isset($Element['name'])) {
|
||||
unset($Element['attributes']);
|
||||
|
||||
return $Element;
|
||||
@@ -1670,10 +1670,10 @@ class Markdown
|
||||
$Element = $this->filterUnsafeUrlInAttribute($Element, $safeUrlNameToAtt[$Element['name']]);
|
||||
}
|
||||
|
||||
if (! empty($Element['attributes'])) {
|
||||
if (!empty($Element['attributes'])) {
|
||||
foreach (array_keys($Element['attributes']) as $att) {
|
||||
// filter out badly parsed attribute
|
||||
if (! preg_match($goodAttribute, (string) $att)) {
|
||||
if (!preg_match($goodAttribute, (string) $att)) {
|
||||
unset($Element['attributes'][$att]);
|
||||
}
|
||||
// dump onevent attribute
|
||||
|
||||
@@ -123,7 +123,7 @@ class MarkdownExtra extends Markdown
|
||||
|
||||
protected function blockDefinitionList($Line, $Block)
|
||||
{
|
||||
if (! isset($Block) || $Block['type'] !== 'Paragraph') {
|
||||
if (!isset($Block) || $Block['type'] !== 'Paragraph') {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -271,7 +271,7 @@ class MarkdownExtra extends Markdown
|
||||
|
||||
protected function blockMarkupComplete($Block)
|
||||
{
|
||||
if (! isset($Block['void'])) {
|
||||
if (!isset($Block['void'])) {
|
||||
$Block['element']['rawHtml'] = $this->processTag($Block['element']['rawHtml']);
|
||||
}
|
||||
|
||||
@@ -308,13 +308,13 @@ class MarkdownExtra extends Markdown
|
||||
if (preg_match('#^\[\^(.+?)\]#', (string) $Excerpt['text'], $matches)) {
|
||||
$name = $matches[1];
|
||||
|
||||
if (! isset($this->DefinitionData['Footnote'][$name])) {
|
||||
if (!isset($this->DefinitionData['Footnote'][$name])) {
|
||||
return;
|
||||
}
|
||||
|
||||
$this->DefinitionData['Footnote'][$name]['count']++;
|
||||
|
||||
if (! isset($this->DefinitionData['Footnote'][$name]['number'])) {
|
||||
if (!isset($this->DefinitionData['Footnote'][$name]['number'])) {
|
||||
$this->DefinitionData['Footnote'][$name]['number'] = ++$this->footnoteCount; // » &
|
||||
}
|
||||
|
||||
@@ -453,7 +453,7 @@ class MarkdownExtra extends Markdown
|
||||
uasort($this->DefinitionData['Footnote'], 'self::sortFootnotes');
|
||||
|
||||
foreach ($this->DefinitionData['Footnote'] as $definitionId => $DefinitionData) {
|
||||
if (! isset($DefinitionData['number'])) {
|
||||
if (!isset($DefinitionData['number'])) {
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -571,7 +571,7 @@ class MarkdownExtra extends Markdown
|
||||
foreach ($DOMDocument->documentElement->childNodes as $Node) {
|
||||
$nodeMarkup = $DOMDocument->saveHTML($Node);
|
||||
|
||||
if ($Node instanceof DOMElement && ! \in_array($Node->nodeName, $this->textLevelElements)) {
|
||||
if ($Node instanceof DOMElement && !\in_array($Node->nodeName, $this->textLevelElements)) {
|
||||
$elementText .= $this->processTag($nodeMarkup);
|
||||
} else {
|
||||
$elementText .= $nodeMarkup;
|
||||
|
||||
@@ -70,7 +70,7 @@ class MediaInfo
|
||||
foreach ($sections as $key => $section) {
|
||||
$keySection = strtolower(explode(' ', $key)[0]);
|
||||
|
||||
if (! empty($section)) {
|
||||
if (!empty($section)) {
|
||||
if ($keySection === 'general') {
|
||||
$output[$keySection] = $this->parseProperty($section, $keySection);
|
||||
} else {
|
||||
@@ -327,7 +327,7 @@ class MediaInfo
|
||||
$number = (float) str_replace(' ', '', (string) $string);
|
||||
preg_match('/[KMGTPEZ]/i', (string) $string, $size);
|
||||
|
||||
if (! empty($size[0])) {
|
||||
if (!empty($size[0])) {
|
||||
$number = $this->computerSize($number, $size[0].'b');
|
||||
}
|
||||
|
||||
|
||||
@@ -118,7 +118,7 @@ class SystemInformation
|
||||
|
||||
private function getDatabase(): string
|
||||
{
|
||||
if (! \in_array(config('database.default'), self::KNOWN_DATABASES, true)) {
|
||||
if (!\in_array(config('database.default'), self::KNOWN_DATABASES, true)) {
|
||||
return 'Unkown';
|
||||
}
|
||||
|
||||
|
||||
@@ -143,7 +143,7 @@ class TorrentTools
|
||||
$count = is_countable($file['path']) ? \count($file['path']) : 0;
|
||||
|
||||
for ($i = 0; $i < $count; $i++) {
|
||||
if (! \in_array($file['path'][$i], $filenames)) {
|
||||
if (!\in_array($file['path'][$i], $filenames)) {
|
||||
$filenames[] = $file['path'][$i];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -35,7 +35,7 @@ class BaseController extends Controller
|
||||
'message' => $error,
|
||||
];
|
||||
|
||||
if (! empty($errorMessages)) {
|
||||
if (!empty($errorMessages)) {
|
||||
$response['data'] = $errorMessages;
|
||||
}
|
||||
|
||||
|
||||
@@ -55,7 +55,7 @@ class ChatController extends Controller
|
||||
{
|
||||
$user = $request->user()->load(['echoes']);
|
||||
|
||||
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 = $request->user()->id;
|
||||
$userEcho->room_id = 1;
|
||||
@@ -70,7 +70,7 @@ class ChatController extends Controller
|
||||
{
|
||||
$user = $request->user()->load(['audibles']);
|
||||
|
||||
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 = $request->user()->id;
|
||||
$userAudible->room_id = 1;
|
||||
@@ -152,7 +152,7 @@ class ChatController extends Controller
|
||||
$botDirty = 0;
|
||||
$bots = cache()->get('bots');
|
||||
|
||||
if (! $bots || ! \is_array($bots) || \count($bots) < 1) {
|
||||
if (!$bots || !\is_array($bots) || \count($bots) < 1) {
|
||||
$bots = Bot::where('active', '=', 1)->oldest('position')->get();
|
||||
$botDirty = 1;
|
||||
}
|
||||
@@ -225,7 +225,7 @@ class ChatController extends Controller
|
||||
}
|
||||
}
|
||||
|
||||
if ($which != null && $which != 'skip' && ! $runbot) {
|
||||
if ($which != null && $which != 'skip' && !$runbot) {
|
||||
if ($bot->is_systembot) {
|
||||
$runbot = new SystemBot($this->chatRepository);
|
||||
} elseif ($bot->is_nerdbot) {
|
||||
@@ -247,11 +247,11 @@ class ChatController extends Controller
|
||||
$senderEchoes = cache()->get('user-echoes'.$userId);
|
||||
$receiverEchoes = cache()->get('user-echoes'.$receiverId);
|
||||
|
||||
if (! $senderEchoes || ! \is_array($senderEchoes) || \count($senderEchoes) < 1) {
|
||||
if (!$senderEchoes || !\is_array($senderEchoes) || \count($senderEchoes) < 1) {
|
||||
$senderEchoes = UserEcho::with(['room', 'target', 'bot'])->where('user_id', $userId)->get();
|
||||
}
|
||||
|
||||
if (! $receiverEchoes || ! \is_array($receiverEchoes) || \count($receiverEchoes) < 1) {
|
||||
if (!$receiverEchoes || !\is_array($receiverEchoes) || \count($receiverEchoes) < 1) {
|
||||
$receiverEchoes = UserEcho::with(['room', 'target', 'bot'])->whereRaw('user_id = ?', [$receiverId])->get();
|
||||
}
|
||||
|
||||
@@ -263,7 +263,7 @@ class ChatController extends Controller
|
||||
}
|
||||
}
|
||||
|
||||
if (! $senderListening) {
|
||||
if (!$senderListening) {
|
||||
$senderPort = new UserEcho();
|
||||
$senderPort->user_id = $userId;
|
||||
$senderPort->target_id = $receiverId;
|
||||
@@ -280,7 +280,7 @@ class ChatController extends Controller
|
||||
}
|
||||
}
|
||||
|
||||
if (! $receiverListening) {
|
||||
if (!$receiverListening) {
|
||||
$receiverPort = new UserEcho();
|
||||
$receiverPort->user_id = $receiverId;
|
||||
$receiverPort->target_id = $userId;
|
||||
@@ -306,11 +306,11 @@ class ChatController extends Controller
|
||||
$senderAudibles = cache()->get('user-audibles'.$userId);
|
||||
$receiverAudibles = cache()->get('user-audibles'.$receiverId);
|
||||
|
||||
if (! $senderAudibles || ! \is_array($senderAudibles) || \count($senderAudibles) < 1) {
|
||||
if (!$senderAudibles || !\is_array($senderAudibles) || \count($senderAudibles) < 1) {
|
||||
$senderAudibles = UserAudible::with(['room', 'target', 'bot'])->where('user_id', $userId)->get();
|
||||
}
|
||||
|
||||
if (! $receiverAudibles || ! \is_array($receiverAudibles) || \count($receiverAudibles) < 1) {
|
||||
if (!$receiverAudibles || !\is_array($receiverAudibles) || \count($receiverAudibles) < 1) {
|
||||
$receiverAudibles = UserAudible::with(['room', 'target', 'bot'])->whereRaw('user_id = ?', [$receiverId])->get();
|
||||
}
|
||||
|
||||
@@ -322,7 +322,7 @@ class ChatController extends Controller
|
||||
}
|
||||
}
|
||||
|
||||
if (! $senderListening) {
|
||||
if (!$senderListening) {
|
||||
$senderPort = new UserAudible();
|
||||
$senderPort->user_id = $userId;
|
||||
$senderPort->target_id = $receiverId;
|
||||
@@ -340,7 +340,7 @@ class ChatController extends Controller
|
||||
}
|
||||
}
|
||||
|
||||
if (! $receiverListening) {
|
||||
if (!$receiverListening) {
|
||||
$receiverPort = new UserAudible();
|
||||
$receiverPort->user_id = $receiverId;
|
||||
$receiverPort->target_id = $userId;
|
||||
@@ -373,7 +373,7 @@ class ChatController extends Controller
|
||||
$message = $this->chatRepository->message($userId, $roomId, $message, $receiverId, $botId);
|
||||
}
|
||||
|
||||
if (! $save) {
|
||||
if (!$save) {
|
||||
$message->delete();
|
||||
}
|
||||
|
||||
@@ -392,7 +392,7 @@ class ChatController extends Controller
|
||||
|
||||
$changedByStaff = $request->user()->id !== $message->user_id;
|
||||
|
||||
abort_if($changedByStaff && ! $request->user()->group->is_owner && $request->user()->group->level <= $message->user->group->level, 403);
|
||||
abort_if($changedByStaff && !$request->user()->group->is_owner && $request->user()->group->level <= $message->user->group->level, 403);
|
||||
|
||||
$this->chatRepository->deleteMessage($id);
|
||||
|
||||
@@ -455,7 +455,7 @@ class ChatController extends Controller
|
||||
{
|
||||
$user = $request->user();
|
||||
$echo = UserAudible::where('user_id', '=', $user->id)->where('room_id', '=', $request->input('room_id'))->sole();
|
||||
$echo->status = ! $echo->status;
|
||||
$echo->status = !$echo->status;
|
||||
$echo->save();
|
||||
|
||||
$user->load(['chatStatus', 'chatroom', 'group', 'audibles', 'audibles']);
|
||||
@@ -472,7 +472,7 @@ class ChatController extends Controller
|
||||
{
|
||||
$user = $request->user();
|
||||
$echo = UserAudible::where('user_id', '=', $user->id)->where('target_id', '=', $request->input('target_id'))->sole();
|
||||
$echo->status = ! $echo->status;
|
||||
$echo->status = !$echo->status;
|
||||
$echo->save();
|
||||
|
||||
$user->load(['chatStatus', 'chatroom', 'group', 'audibles', 'audibles']);
|
||||
@@ -489,7 +489,7 @@ class ChatController extends Controller
|
||||
{
|
||||
$user = $request->user();
|
||||
$echo = UserAudible::where('user_id', '=', $user->id)->where('bot_id', '=', $request->input('bot_id'))->sole();
|
||||
$echo->status = ! $echo->status;
|
||||
$echo->status = !$echo->status;
|
||||
$echo->save();
|
||||
|
||||
$user->load(['chatStatus', 'chatroom', 'group', 'audibles', 'audibles'])->findOrFail($user->id);
|
||||
@@ -537,7 +537,7 @@ class ChatController extends Controller
|
||||
$senderDirty = 0;
|
||||
$senderEchoes = cache()->get('user-echoes'.$user->id);
|
||||
|
||||
if (! $senderEchoes || ! \is_array($senderEchoes) || \count($senderEchoes) < 1) {
|
||||
if (!$senderEchoes || !\is_array($senderEchoes) || \count($senderEchoes) < 1) {
|
||||
$senderEchoes = UserEcho::with(['room', 'target', 'bot'])->where('user_id', '=', $user->id)->get();
|
||||
}
|
||||
|
||||
@@ -549,7 +549,7 @@ class ChatController extends Controller
|
||||
}
|
||||
}
|
||||
|
||||
if (! $senderListening) {
|
||||
if (!$senderListening) {
|
||||
$userEcho = new UserEcho();
|
||||
$userEcho->user_id = $user->id;
|
||||
$userEcho->room_id = $room->id;
|
||||
|
||||
@@ -101,7 +101,7 @@ class TorrentController extends BaseController
|
||||
|
||||
$requestFile = $request->file('torrent');
|
||||
|
||||
if (! $request->hasFile('torrent')) {
|
||||
if (!$request->hasFile('torrent')) {
|
||||
return $this->sendError('Validation Error.', 'You Must Provide A Torrent File For Upload!');
|
||||
}
|
||||
|
||||
@@ -120,7 +120,7 @@ class TorrentController extends BaseController
|
||||
}
|
||||
|
||||
foreach (TorrentTools::getFilenameArray($decodedTorrent) as $name) {
|
||||
if (! TorrentTools::isValidFilename($name)) {
|
||||
if (!TorrentTools::isValidFilename($name)) {
|
||||
return $this->sendError('Validation Error.', 'Invalid Filenames In Torrent Files!');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -149,7 +149,7 @@ final class AnnounceController extends Controller
|
||||
}
|
||||
|
||||
// Miss Header User-Agent is not allowed.
|
||||
if (! $request->header('User-Agent')) {
|
||||
if (!$request->header('User-Agent')) {
|
||||
throw new TrackerException(120);
|
||||
}
|
||||
|
||||
@@ -244,7 +244,7 @@ final class AnnounceController extends Controller
|
||||
foreach (['uploaded', 'downloaded', 'left'] as $item) {
|
||||
$itemData = $queries[$item];
|
||||
|
||||
if (! is_numeric($itemData) || $itemData < 0) {
|
||||
if (!is_numeric($itemData) || $itemData < 0) {
|
||||
throw new TrackerException(134, [':attribute' => $item]);
|
||||
}
|
||||
}
|
||||
@@ -260,14 +260,14 @@ final class AnnounceController extends Controller
|
||||
}
|
||||
|
||||
foreach (['numwant', 'corrupt'] as $item) {
|
||||
if (! is_numeric($queries[$item]) || $queries[$item] < 0) {
|
||||
if (!is_numeric($queries[$item]) || $queries[$item] < 0) {
|
||||
throw new TrackerException(134, [':attribute' => $item]);
|
||||
}
|
||||
}
|
||||
|
||||
$queries['event'] = strtolower($queries['event']);
|
||||
|
||||
if (! \in_array($queries['event'], ['started', 'completed', 'stopped', 'paused', ''])) {
|
||||
if (!\in_array($queries['event'], ['started', 'completed', 'stopped', 'paused', ''])) {
|
||||
throw new TrackerException(136, [':event' => $queries['event']]);
|
||||
}
|
||||
|
||||
@@ -281,7 +281,7 @@ final class AnnounceController extends Controller
|
||||
}
|
||||
|
||||
if (
|
||||
! is_numeric($queries['port'])
|
||||
!is_numeric($queries['port'])
|
||||
|| $queries['port'] < 0
|
||||
|| $queries['port'] > 0xFFFF
|
||||
|| \in_array($queries['port'], self::BLACK_PORTS, true)
|
||||
@@ -471,7 +471,7 @@ final class AnnounceController extends Controller
|
||||
// least 5 minutes since they last announced.
|
||||
if ($event === 'stopped' && $lastAnnouncedAt < $now - 5 * 60) {
|
||||
Redis::connection('announce')->command('DEL', [$lastAnnouncedKey]);
|
||||
} elseif ($lastAnnouncedAt !== false && ! \in_array($event, ['completed', 'stopped'])) {
|
||||
} elseif ($lastAnnouncedAt !== false && !\in_array($event, ['completed', 'stopped'])) {
|
||||
throw new TrackerException(162, [':elapsed' => $now - $lastAnnouncedAt]);
|
||||
}
|
||||
}
|
||||
@@ -519,10 +519,10 @@ final class AnnounceController extends Controller
|
||||
$isDeadPeer = $queries['event'] === 'stopped';
|
||||
$isSeeder = $queries['left'] == 0;
|
||||
|
||||
$newLeech = $isNewPeer && ! $isDeadPeer && ! $isSeeder;
|
||||
$stoppedLeech = ! $isNewPeer && $isDeadPeer && ! $isSeeder;
|
||||
$leechBecomesSeed = ! $isNewPeer && ! $isDeadPeer && $isSeeder && $peer->left > 0;
|
||||
$seedBecomesLeech = ! $isNewPeer && ! $isDeadPeer && ! $isSeeder && $peer->left === 0;
|
||||
$newLeech = $isNewPeer && !$isDeadPeer && !$isSeeder;
|
||||
$stoppedLeech = !$isNewPeer && $isDeadPeer && !$isSeeder;
|
||||
$leechBecomesSeed = !$isNewPeer && !$isDeadPeer && $isSeeder && $peer->left > 0;
|
||||
$seedBecomesLeech = !$isNewPeer && !$isDeadPeer && !$isSeeder && $peer->left === 0;
|
||||
|
||||
if ($max !== null && $max >= 0 && ($newLeech || $seedBecomesLeech) && $count >= $max) {
|
||||
throw new TrackerException(164, [':max' => $max]);
|
||||
@@ -571,7 +571,7 @@ final class AnnounceController extends Controller
|
||||
if ($queries['left'] == 0) {
|
||||
foreach ($torrent->peers as $peer) {
|
||||
// Don't include other seeders, inactive peers, nor other peers belonging to the same user
|
||||
if ($peer->seeder || ! $peer->active || $peer->user_id === $user->id) {
|
||||
if ($peer->seeder || !$peer->active || $peer->user_id === $user->id) {
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -593,7 +593,7 @@ final class AnnounceController extends Controller
|
||||
} else {
|
||||
foreach ($torrent->peers as $peer) {
|
||||
// Don't include inactive peers, nor other peers belonging to the same user
|
||||
if (! $peer->active || $peer->user_id === $user->id) {
|
||||
if (!$peer->active || $peer->user_id === $user->id) {
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -766,16 +766,16 @@ final class AnnounceController extends Controller
|
||||
|
||||
// Torrent updates
|
||||
|
||||
$isNewPeer = $isNewPeer || ! $peer->active;
|
||||
$isNewPeer = $isNewPeer || !$peer->active;
|
||||
$isDeadPeer = $event === 'stopped';
|
||||
$isSeeder = $queries['left'] == 0;
|
||||
|
||||
$newSeed = $isNewPeer && ! $isDeadPeer && $isSeeder;
|
||||
$newLeech = $isNewPeer && ! $isDeadPeer && ! $isSeeder;
|
||||
$stoppedSeed = ! $isNewPeer && $isDeadPeer && $isSeeder;
|
||||
$stoppedLeech = ! $isNewPeer && $isDeadPeer && ! $isSeeder;
|
||||
$leechBecomesSeed = ! $isNewPeer && ! $isDeadPeer && $isSeeder && $peer->left > 0;
|
||||
$seedBecomesLeech = ! $isNewPeer && ! $isDeadPeer && ! $isSeeder && $peer->left === 0;
|
||||
$newSeed = $isNewPeer && !$isDeadPeer && $isSeeder;
|
||||
$newLeech = $isNewPeer && !$isDeadPeer && !$isSeeder;
|
||||
$stoppedSeed = !$isNewPeer && $isDeadPeer && $isSeeder;
|
||||
$stoppedLeech = !$isNewPeer && $isDeadPeer && !$isSeeder;
|
||||
$leechBecomesSeed = !$isNewPeer && !$isDeadPeer && $isSeeder && $peer->left > 0;
|
||||
$seedBecomesLeech = !$isNewPeer && !$isDeadPeer && !$isSeeder && $peer->left === 0;
|
||||
|
||||
$seederCountDelta = ($newSeed || $leechBecomesSeed) <=> ($stoppedSeed || $seedBecomesLeech);
|
||||
$leecherCountDelta = ($newLeech || $seedBecomesLeech) <=> ($stoppedLeech || $leechBecomesSeed);
|
||||
|
||||
@@ -63,7 +63,7 @@ class ApprovedRequestFillController extends Controller
|
||||
$filler->increment('seedbonus', $torrentRequest->bounty);
|
||||
|
||||
// Achievements
|
||||
if (! $torrentRequest->filled_anon) {
|
||||
if (!$torrentRequest->filled_anon) {
|
||||
$filler->addProgress(new UserFilled25Requests(), 1);
|
||||
$filler->addProgress(new UserFilled50Requests(), 1);
|
||||
$filler->addProgress(new UserFilled75Requests(), 1);
|
||||
|
||||
@@ -44,7 +44,7 @@ class ApplicationController extends Controller
|
||||
$application->referrer = $request->input('referrer');
|
||||
|
||||
if (config('email-blacklist.enabled')) {
|
||||
if (! config('captcha.enabled')) {
|
||||
if (!config('captcha.enabled')) {
|
||||
$v = validator($request->all(), [
|
||||
'type' => 'required',
|
||||
'email' => [
|
||||
@@ -84,7 +84,7 @@ class ApplicationController extends Controller
|
||||
'captcha' => 'hiddencaptcha',
|
||||
]);
|
||||
}
|
||||
} elseif (! config('captcha.enabled')) {
|
||||
} elseif (!config('captcha.enabled')) {
|
||||
$v = validator($request->all(), [
|
||||
'type' => 'required',
|
||||
'email' => 'required|string|email|max:70|unique:invites|unique:users|unique:applications',
|
||||
|
||||
@@ -28,7 +28,7 @@ class ForgotPasswordController extends Controller
|
||||
|
||||
protected function validateEmail(Request $request): void
|
||||
{
|
||||
if (! config('captcha.enabled')) {
|
||||
if (!config('captcha.enabled')) {
|
||||
$request->validate(['email' => 'required|email']);
|
||||
} else {
|
||||
$request->validate([
|
||||
|
||||
@@ -38,7 +38,7 @@ class ForgotUsernameController extends Controller
|
||||
{
|
||||
$email = $request->get('email');
|
||||
|
||||
if (! config('captcha.enabled')) {
|
||||
if (!config('captcha.enabled')) {
|
||||
$v = validator($request->all(), [
|
||||
'email' => 'required',
|
||||
]);
|
||||
|
||||
@@ -64,7 +64,7 @@ class RegisterController extends Controller
|
||||
// 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)) {
|
||||
if (config('other.invite-only') == 1 && (!$key || $key->accepted_by !== null)) {
|
||||
return to_route('registrationForm', ['code' => $code])
|
||||
->withErrors(trans('auth.invalid-key'));
|
||||
}
|
||||
@@ -84,7 +84,7 @@ class RegisterController extends Controller
|
||||
$user->group_id = $validatingGroup[0];
|
||||
|
||||
if (config('email-blacklist.enabled')) {
|
||||
if (! config('captcha.enabled')) {
|
||||
if (!config('captcha.enabled')) {
|
||||
$v = validator($request->all(), [
|
||||
'username' => 'required|alpha_dash|string|between:3,25|unique:users',
|
||||
'password' => [
|
||||
@@ -118,7 +118,7 @@ class RegisterController extends Controller
|
||||
'captcha' => 'hiddencaptcha',
|
||||
]);
|
||||
}
|
||||
} elseif (! config('captcha.enabled')) {
|
||||
} elseif (!config('captcha.enabled')) {
|
||||
$v = validator($request->all(), [
|
||||
'username' => 'required|alpha_dash|string|between:3,25|unique:users',
|
||||
'password' => [
|
||||
|
||||
@@ -34,7 +34,7 @@ class ForumCategoryController extends Controller
|
||||
}
|
||||
|
||||
// Check if the user has permission to view the forum
|
||||
if (! $forum->getPermission()->show_forum) {
|
||||
if (!$forum->getPermission()->show_forum) {
|
||||
return to_route('forums.index')
|
||||
->withErrors('You Do Not Have Access To This Category!');
|
||||
}
|
||||
|
||||
@@ -59,7 +59,7 @@ class ForumController extends Controller
|
||||
}
|
||||
|
||||
// Check if the user has permission to view the forum
|
||||
if (! $forum->getPermission()->show_forum) {
|
||||
if (!$forum->getPermission()->show_forum) {
|
||||
return to_route('forums.index')
|
||||
->withErrors('You Do Not Have Access To This Forum!');
|
||||
}
|
||||
|
||||
@@ -70,7 +70,7 @@ class HomeController extends Controller
|
||||
->where('last_action', '>', now()->subMinutes(5))
|
||||
->orderByRaw('(select position from `groups` where `groups`.id = users.group_id), group_id, username')
|
||||
->get()
|
||||
->sortBy(fn ($user) => $user->hidden || ! $user->isVisible($user, 'other', 'show_online'))
|
||||
->sortBy(fn ($user) => $user->hidden || !$user->isVisible($user, 'other', 'show_online'))
|
||||
),
|
||||
'groups' => cache()->remember(
|
||||
'user-groups',
|
||||
|
||||
@@ -83,7 +83,7 @@ class PlaylistController extends Controller
|
||||
] + $request->validated());
|
||||
|
||||
// Announce To Shoutbox
|
||||
if (! $playlist->is_private) {
|
||||
if (!$playlist->is_private) {
|
||||
$this->chatRepository->systemMessage(
|
||||
sprintf('User [url=%s/', config('app.url')).$request->user()->username.'.'.$request->user()->id.']'.$request->user()->username.sprintf('[/url] has created a new playlist [url=%s/playlists/', config('app.url')).$playlist->id.']'.$playlist->name.'[/url] check it out now! :slight_smile:'
|
||||
);
|
||||
|
||||
@@ -41,7 +41,7 @@ class PlaylistZipController extends Controller
|
||||
$path = getcwd().'/files/tmp_zip/';
|
||||
|
||||
// Check Directory exists
|
||||
if (! File::isDirectory($path)) {
|
||||
if (!File::isDirectory($path)) {
|
||||
File::makeDirectory($path, 0755, true, true);
|
||||
}
|
||||
|
||||
|
||||
@@ -70,7 +70,7 @@ class PostController extends Controller
|
||||
['reply_topic', '=', 1],
|
||||
['group_id', '=', $user->group_id]
|
||||
])
|
||||
->when(! $user->group->is_modo, fn ($query) => $query->where('state', '=', 'open'))
|
||||
->when(!$user->group->is_modo, fn ($query) => $query->where('state', '=', 'open'))
|
||||
->findOrFail($request->topic_id);
|
||||
|
||||
$forum = $topic->forum;
|
||||
@@ -157,7 +157,7 @@ class PostController extends Controller
|
||||
['reply_topic', '=', 1],
|
||||
['group_id', '=', $user->group_id],
|
||||
])
|
||||
->when(! $user->group->is_modo, fn ($query) => $query->where('state', '=', 'open'))
|
||||
->when(!$user->group->is_modo, fn ($query) => $query->where('state', '=', 'open'))
|
||||
->sole();
|
||||
|
||||
abort_unless($user->group->is_modo || $user->id === $post->user_id, 403);
|
||||
@@ -195,7 +195,7 @@ class PostController extends Controller
|
||||
['reply_topic', '=', 1],
|
||||
['group_id', '=', $user->group_id],
|
||||
])
|
||||
->when(! $user->group->is_modo, fn ($query) => $query->where('state', '=', 'open'))
|
||||
->when(!$user->group->is_modo, fn ($query) => $query->where('state', '=', 'open'))
|
||||
->exists(),
|
||||
403
|
||||
);
|
||||
|
||||
@@ -133,7 +133,7 @@ class RssController extends Controller
|
||||
$bannedGroup = cache()->rememberForever('banned_group', fn () => Group::where('slug', '=', 'banned')->pluck('id'));
|
||||
$disabledGroup = cache()->rememberForever('disabled_group', fn () => Group::where('slug', '=', 'disabled')->pluck('id'));
|
||||
|
||||
abort_if($user->group_id == $bannedGroup[0] || $user->group_id == $disabledGroup[0] || ! $user->active, 404);
|
||||
abort_if($user->group_id == $bannedGroup[0] || $user->group_id == $disabledGroup[0] || !$user->active, 404);
|
||||
|
||||
$rss = Rss::query()
|
||||
->where(
|
||||
|
||||
@@ -118,7 +118,7 @@ class SimilarTorrentController extends Controller
|
||||
/** @var Carbon $lastUpdated */
|
||||
$lastUpdated = cache()->get($cacheKey);
|
||||
|
||||
abort_if($lastUpdated !== null && $lastUpdated->addDay()->isFuture() && ! $request->user()->group->is_modo, 403);
|
||||
abort_if($lastUpdated !== null && $lastUpdated->addDay()->isFuture() && !$request->user()->group->is_modo, 403);
|
||||
|
||||
cache()->put($cacheKey, now(), now()->addDay());
|
||||
|
||||
@@ -131,7 +131,7 @@ class SimilarTorrentController extends Controller
|
||||
/** @var Carbon $lastUpdated */
|
||||
$lastUpdated = cache()->get($cacheKey);
|
||||
|
||||
abort_if($lastUpdated !== null && $lastUpdated->addDay()->isFuture() && ! $request->user()->group->is_modo, 403);
|
||||
abort_if($lastUpdated !== null && $lastUpdated->addDay()->isFuture() && !$request->user()->group->is_modo, 403);
|
||||
|
||||
cache()->put($cacheKey, now(), now()->addDay());
|
||||
|
||||
|
||||
@@ -58,7 +58,7 @@ class UserController extends Controller
|
||||
|
||||
return view('Staff.user.edit', [
|
||||
'user' => $user,
|
||||
'groups' => Group::when(! $group->is_owner, fn ($query) => $query->where('level', '<=', $group->level))->get(),
|
||||
'groups' => Group::when(!$group->is_owner, fn ($query) => $query->where('level', '<=', $group->level))->get(),
|
||||
'internals' => Internal::all(),
|
||||
]);
|
||||
}
|
||||
@@ -72,7 +72,7 @@ class UserController extends Controller
|
||||
$staff = $request->user();
|
||||
$group = Group::findOrFail($request->group_id);
|
||||
|
||||
abort_if(! ($staff->group->is_owner || $staff->group->is_admin) && ($staff->group->level <= $user->group->level || $staff->group->level <= $group->level), 403);
|
||||
abort_if(!($staff->group->is_owner || $staff->group->is_admin) && ($staff->group->level <= $user->group->level || $staff->group->level <= $group->level), 403);
|
||||
|
||||
$user->update($request->validated());
|
||||
|
||||
|
||||
@@ -29,7 +29,7 @@ class VersionController extends Controller
|
||||
$latestVersion = Http::get('//api.github.com/repos/HDInnovations/UNIT3D/releases')[0]['tag_name'];
|
||||
|
||||
return response([
|
||||
'updated' => ! version_compare(config('unit3d.version'), $latestVersion, '<'),
|
||||
'updated' => !version_compare(config('unit3d.version'), $latestVersion, '<'),
|
||||
'latestversion' => $latestVersion,
|
||||
]);
|
||||
}
|
||||
|
||||
@@ -92,7 +92,7 @@ class SubtitleController extends Controller
|
||||
Storage::disk('subtitles')->put($filename, file_get_contents($subtitleFile));
|
||||
|
||||
// Announce To Shoutbox
|
||||
if (! $subtitle->anon) {
|
||||
if (!$subtitle->anon) {
|
||||
$this->chatRepository->systemMessage(
|
||||
sprintf(
|
||||
'[url=%s]%s[/url] has uploaded a new %s subtitle for [url=%s]%s[/url]',
|
||||
|
||||
@@ -191,7 +191,7 @@ class TopicController extends Controller
|
||||
['read_topic', '=', 1],
|
||||
['group_id', '=', $user->group_id]
|
||||
])
|
||||
->when(! $user->group->is_modo, fn ($query) => $query->where('state', '=', 'open'))
|
||||
->when(!$user->group->is_modo, fn ($query) => $query->where('state', '=', 'open'))
|
||||
->findOrFail($id);
|
||||
|
||||
abort_unless($user->group->is_modo || $user->id === $topic->first_post_user_id, 403);
|
||||
@@ -228,7 +228,7 @@ class TopicController extends Controller
|
||||
]);
|
||||
|
||||
$topic = Topic::query()
|
||||
->when(! $user->group->is_modo, fn ($query) => $query->where('state', '=', 'open'))
|
||||
->when(!$user->group->is_modo, fn ($query) => $query->where('state', '=', 'open'))
|
||||
->findOrFail($id);
|
||||
|
||||
abort_unless($user->group->is_modo || $user->id === $topic->first_post_user_id, 403);
|
||||
|
||||
@@ -26,7 +26,7 @@ class TopicLabelController extends Controller
|
||||
public function approve(int $id): \Illuminate\Http\RedirectResponse
|
||||
{
|
||||
$topic = Topic::findOrFail($id);
|
||||
$topic->approved = ! $topic->approved;
|
||||
$topic->approved = !$topic->approved;
|
||||
$topic->save();
|
||||
|
||||
return to_route('topics.show', ['id' => $topic->id])
|
||||
@@ -39,7 +39,7 @@ class TopicLabelController extends Controller
|
||||
public function deny(int $id): \Illuminate\Http\RedirectResponse
|
||||
{
|
||||
$topic = Topic::findOrFail($id);
|
||||
$topic->denied = ! $topic->denied;
|
||||
$topic->denied = !$topic->denied;
|
||||
$topic->save();
|
||||
|
||||
return to_route('topics.show', ['id' => $topic->id])
|
||||
@@ -52,7 +52,7 @@ class TopicLabelController extends Controller
|
||||
public function solve(int $id): \Illuminate\Http\RedirectResponse
|
||||
{
|
||||
$topic = Topic::findOrFail($id);
|
||||
$topic->solved = ! $topic->solved;
|
||||
$topic->solved = !$topic->solved;
|
||||
$topic->save();
|
||||
|
||||
return to_route('topics.show', ['id' => $topic->id])
|
||||
@@ -65,7 +65,7 @@ class TopicLabelController extends Controller
|
||||
public function invalid(int $id): \Illuminate\Http\RedirectResponse
|
||||
{
|
||||
$topic = Topic::findOrFail($id);
|
||||
$topic->invalid = ! $topic->invalid;
|
||||
$topic->invalid = !$topic->invalid;
|
||||
$topic->save();
|
||||
|
||||
return to_route('topics.show', ['id' => $topic->id])
|
||||
@@ -78,7 +78,7 @@ class TopicLabelController extends Controller
|
||||
public function bug(int $id): \Illuminate\Http\RedirectResponse
|
||||
{
|
||||
$topic = Topic::findOrFail($id);
|
||||
$topic->bug = ! $topic->bug;
|
||||
$topic->bug = !$topic->bug;
|
||||
$topic->save();
|
||||
|
||||
return to_route('topics.show', ['id' => $topic->id])
|
||||
@@ -91,7 +91,7 @@ class TopicLabelController extends Controller
|
||||
public function suggest(int $id): \Illuminate\Http\RedirectResponse
|
||||
{
|
||||
$topic = Topic::findOrFail($id);
|
||||
$topic->suggestion = ! $topic->suggestion;
|
||||
$topic->suggestion = !$topic->suggestion;
|
||||
$topic->save();
|
||||
|
||||
return to_route('topics.show', ['id' => $topic->id])
|
||||
@@ -104,7 +104,7 @@ class TopicLabelController extends Controller
|
||||
public function implement(int $id): \Illuminate\Http\RedirectResponse
|
||||
{
|
||||
$topic = Topic::findOrFail($id);
|
||||
$topic->implemented = ! $topic->implemented;
|
||||
$topic->implemented = !$topic->implemented;
|
||||
$topic->save();
|
||||
|
||||
return to_route('topics.show', ['id' => $topic->id])
|
||||
|
||||
@@ -77,7 +77,7 @@ class TorrentBuffController extends Controller
|
||||
|
||||
abort_unless($user->group->is_modo || $user->group->is_internal, 403);
|
||||
$torrent = Torrent::withoutGlobalScope(ApprovedScope::class)->findOrFail($id);
|
||||
$torrent->sticky = ! $torrent->sticky;
|
||||
$torrent->sticky = !$torrent->sticky;
|
||||
$torrent->save();
|
||||
|
||||
return to_route('torrents.show', ['id' => $torrent->id])
|
||||
@@ -211,7 +211,7 @@ class TorrentBuffController extends Controller
|
||||
$torrent = Torrent::withoutGlobalScope(ApprovedScope::class)->findOrFail($id);
|
||||
$torrentUrl = href_torrent($torrent);
|
||||
|
||||
if (! $torrent->doubleup) {
|
||||
if (!$torrent->doubleup) {
|
||||
$torrent->doubleup = true;
|
||||
$du_until = $request->input('du_until');
|
||||
|
||||
@@ -252,7 +252,7 @@ class TorrentBuffController extends Controller
|
||||
|
||||
$activeToken = cache()->get('freeleech_token:'.$user->id.':'.$torrent->id);
|
||||
|
||||
if ($user->fl_tokens >= 1 && ! $activeToken) {
|
||||
if ($user->fl_tokens >= 1 && !$activeToken) {
|
||||
$freeleechToken = new FreeleechToken();
|
||||
$freeleechToken->user_id = $user->id;
|
||||
$freeleechToken->torrent_id = $torrent->id;
|
||||
@@ -284,7 +284,7 @@ class TorrentBuffController extends Controller
|
||||
$torrent = Torrent::withoutGlobalScope(ApprovedScope::class)->findOrFail($id);
|
||||
$torrent_url = href_torrent($torrent);
|
||||
|
||||
if (! $torrent->refundable) {
|
||||
if (!$torrent->refundable) {
|
||||
$torrent->refundable = true;
|
||||
|
||||
$this->chatRepository->systemMessage(
|
||||
|
||||
@@ -435,7 +435,7 @@ class TorrentController extends Controller
|
||||
}
|
||||
|
||||
// check for trusted user and update torrent
|
||||
if ($user->group->is_trusted && ! $request->boolean('mod_queue_opt_in')) {
|
||||
if ($user->group->is_trusted && !$request->boolean('mod_queue_opt_in')) {
|
||||
$appurl = config('app.url');
|
||||
$user = $torrent->user;
|
||||
$username = $user->username;
|
||||
|
||||
@@ -40,20 +40,20 @@ class TorrentDownloadController extends Controller
|
||||
{
|
||||
$user = $request->user();
|
||||
|
||||
if (! $user && $rsskey) {
|
||||
if (!$user && $rsskey) {
|
||||
$user = User::where('rsskey', '=', $rsskey)->sole();
|
||||
}
|
||||
$torrent = Torrent::withoutGlobalScope(ApprovedScope::class)->findOrFail($id);
|
||||
$hasHistory = $user->history()->where([['torrent_id', '=', $torrent->id], ['seeder', '=', 1]])->exists();
|
||||
|
||||
// User's ratio is too low
|
||||
if ($user->ratio < config('other.ratio') && ! ($torrent->user_id === $user->id || $hasHistory)) {
|
||||
if ($user->ratio < config('other.ratio') && !($torrent->user_id === $user->id || $hasHistory)) {
|
||||
return to_route('torrents.show', ['id' => $torrent->id])
|
||||
->withErrors('Your Ratio Is Too Low To Download!');
|
||||
}
|
||||
|
||||
// User's download rights are revoked
|
||||
if ($user->can_download == 0 && ! ($torrent->user_id === $user->id || $hasHistory)) {
|
||||
if ($user->can_download == 0 && !($torrent->user_id === $user->id || $hasHistory)) {
|
||||
return to_route('torrents.show', ['id' => $torrent->id])
|
||||
->withErrors('Your Download Rights Have Been Revoked!');
|
||||
}
|
||||
@@ -65,12 +65,12 @@ class TorrentDownloadController extends Controller
|
||||
}
|
||||
|
||||
// The torrent file exist ?
|
||||
if (! file_exists(getcwd().'/files/torrents/'.$torrent->file_name)) {
|
||||
if (!file_exists(getcwd().'/files/torrents/'.$torrent->file_name)) {
|
||||
return to_route('torrents.show', ['id' => $torrent->id])
|
||||
->withErrors('Torrent File Not Found! Please Report This Torrent!');
|
||||
}
|
||||
|
||||
if (! $request->user() && !($rsskey && $user)) {
|
||||
if (!$request->user() && !($rsskey && $user)) {
|
||||
return to_route('login');
|
||||
}
|
||||
|
||||
|
||||
@@ -30,7 +30,7 @@ class ApikeyController extends Controller
|
||||
|
||||
$changedByStaff = $request->user()->isNot($user);
|
||||
|
||||
abort_if($changedByStaff && ! $request->user()->group->is_owner && $request->user()->group->level <= $user->group->level, 403);
|
||||
abort_if($changedByStaff && !$request->user()->group->is_owner && $request->user()->group->level <= $user->group->level, 403);
|
||||
|
||||
$user->update([
|
||||
'api_token' => Str::random(100),
|
||||
|
||||
@@ -31,7 +31,7 @@ class EmailController extends Controller
|
||||
|
||||
$changedByStaff = $request->user()->isNot($user);
|
||||
|
||||
abort_if($changedByStaff && ! $request->user()->group->is_owner && $request->user()->group->level <= $user->group->level, 403);
|
||||
abort_if($changedByStaff && !$request->user()->group->is_owner && $request->user()->group->level <= $user->group->level, 403);
|
||||
|
||||
$request->validate([
|
||||
'email' => [
|
||||
|
||||
@@ -49,7 +49,7 @@ class InviteController extends Controller
|
||||
{
|
||||
abort_unless($request->user()->is($user), 403);
|
||||
|
||||
if (! config('other.invite-only')) {
|
||||
if (!config('other.invite-only')) {
|
||||
return to_route('home.index')
|
||||
->withErrors(trans('user.invites-disabled'));
|
||||
}
|
||||
@@ -59,7 +59,7 @@ class InviteController extends Controller
|
||||
->withErrors(trans('user.invites-banned'));
|
||||
}
|
||||
|
||||
if (config('other.invites_restriced') && ! \in_array($user->group->name, config('other.invite_groups'), true)) {
|
||||
if (config('other.invites_restriced') && !\in_array($user->group->name, config('other.invite_groups'), true)) {
|
||||
return to_route('home.index')
|
||||
->withErrors(trans('user.invites-disabled-group'));
|
||||
}
|
||||
@@ -76,7 +76,7 @@ class InviteController extends Controller
|
||||
{
|
||||
abort_unless($request->user()->is($user) && $user->can_invite, 403);
|
||||
|
||||
if (config('other.invites_restriced') && ! \in_array($user->group->name, config('other.invite_groups'), true)) {
|
||||
if (config('other.invites_restriced') && !\in_array($user->group->name, config('other.invite_groups'), true)) {
|
||||
return to_route('home.index')
|
||||
->withErrors(trans('user.invites-disabled-group'));
|
||||
}
|
||||
|
||||
@@ -30,7 +30,7 @@ class PasskeyController extends Controller
|
||||
|
||||
$changedByStaff = $request->user()->isNot($user);
|
||||
|
||||
abort_if($changedByStaff && ! $request->user()->group->is_owner && $request->user()->group->level <= $user->group->level, 403);
|
||||
abort_if($changedByStaff && !$request->user()->group->is_owner && $request->user()->group->level <= $user->group->level, 403);
|
||||
|
||||
$user->update([
|
||||
'passkey' => md5(random_bytes(60).$user->password)
|
||||
|
||||
@@ -32,10 +32,10 @@ class PasswordController extends Controller
|
||||
|
||||
$changedByStaff = $request->user()->isNot($user);
|
||||
|
||||
abort_if($changedByStaff && ! $request->user()->group->is_owner && $request->user()->group->level <= $user->group->level, 403);
|
||||
abort_if($changedByStaff && !$request->user()->group->is_owner && $request->user()->group->level <= $user->group->level, 403);
|
||||
|
||||
$request->validate([
|
||||
'current_password' => Rule::when(! $changedByStaff, [
|
||||
'current_password' => Rule::when(!$changedByStaff, [
|
||||
'required',
|
||||
'current_password',
|
||||
]),
|
||||
|
||||
@@ -29,7 +29,7 @@ class RsskeyController extends Controller
|
||||
|
||||
$changedByStaff = $request->user()->isNot($user);
|
||||
|
||||
abort_if($changedByStaff && ! $request->user()->group->is_owner && $request->user()->group->level <= $user->group->level, 403);
|
||||
abort_if($changedByStaff && !$request->user()->group->is_owner && $request->user()->group->level <= $user->group->level, 403);
|
||||
|
||||
$user->update([
|
||||
'rsskey' => md5(random_bytes(60).$user->password),
|
||||
|
||||
@@ -38,7 +38,7 @@ class TorrentZipController extends Controller
|
||||
$zipPath = getcwd().'/files/tmp_zip/';
|
||||
|
||||
// Check Directory exists
|
||||
if (! File::isDirectory($zipPath)) {
|
||||
if (!File::isDirectory($zipPath)) {
|
||||
File::makeDirectory($zipPath, 0755, true, true);
|
||||
}
|
||||
|
||||
|
||||
@@ -128,12 +128,12 @@ class UserController extends Controller
|
||||
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'])) {
|
||||
if (!\in_array($image->getClientOriginalExtension(), ['jpg', 'JPG', 'jpeg', 'bmp', 'png', 'PNG', 'tiff', 'gif'])) {
|
||||
return to_route('users.show', ['user' => $user])
|
||||
->withErrors('Only .jpg, .bmp, .png, .tiff, and .gif are allowed.');
|
||||
}
|
||||
|
||||
if (! preg_match('#image/*#', (string) $image->getMimeType())) {
|
||||
if (!preg_match('#image/*#', (string) $image->getMimeType())) {
|
||||
return to_route('users.show', ['user' => $user])
|
||||
->withErrors('Incorrect mime type.');
|
||||
}
|
||||
|
||||
@@ -119,7 +119,7 @@ class BackupPanel extends Component
|
||||
|
||||
$backup = $backupDestination->backups()->first(fn (Backup $backup) => $backup->path() === $filePath);
|
||||
|
||||
if (! $backup) {
|
||||
if (!$backup) {
|
||||
return response('Backup not found', ResponseAlias::HTTP_UNPROCESSABLE_ENTITY);
|
||||
}
|
||||
|
||||
|
||||
@@ -82,7 +82,7 @@ class Comment extends Component
|
||||
|
||||
final public function updatedIsEditing($isEditing): void
|
||||
{
|
||||
if (! $isEditing) {
|
||||
if (!$isEditing) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -119,7 +119,7 @@ class Comment extends Component
|
||||
return;
|
||||
}
|
||||
|
||||
if (! $this->comment->isParent()) {
|
||||
if (!$this->comment->isParent()) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -149,7 +149,7 @@ class Comment extends Component
|
||||
User::find($ticket->user_id)->notify(new NewComment($modelName, $reply));
|
||||
}
|
||||
|
||||
if (! \in_array($this->comment->user_id, [$ticket->staff_id, $ticket->user_id, $this->user->id])) {
|
||||
if (!\in_array($this->comment->user_id, [$ticket->staff_id, $ticket->user_id, $this->user->id])) {
|
||||
User::find($this->comment->user_id)->notify(new NewComment($modelName, $reply));
|
||||
}
|
||||
|
||||
|
||||
@@ -162,7 +162,7 @@ class SimilarTorrent extends Component
|
||||
$names[] = $torrent->name;
|
||||
|
||||
foreach (History::where('torrent_id', '=', $torrent->id)->get() as $pm) {
|
||||
if (! \in_array($pm->user_id, $users)) {
|
||||
if (!\in_array($pm->user_id, $users)) {
|
||||
$users[] = $pm->user_id;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -62,7 +62,7 @@ class SubtitleSearch extends Component
|
||||
fn ($query) => $query
|
||||
->whereIn('user_id', User::select('id')->where('username', '=', $this->username))
|
||||
->when(
|
||||
! auth()->user()->group->is_modo,
|
||||
!auth()->user()->group->is_modo,
|
||||
fn ($query) => $query->where(fn ($query) => $query->where('anon', '=', false)->orWhere('user_id', '=', auth()->id()))
|
||||
)
|
||||
)
|
||||
|
||||
@@ -66,7 +66,7 @@ class TicketSearch extends Component
|
||||
{
|
||||
return Ticket::query()
|
||||
->with(['user.group', 'staff.group', 'category', 'priority'])
|
||||
->when(! $this->user->group->is_modo, fn ($query) => $query->where('user_id', '=', $this->user->id))
|
||||
->when(!$this->user->group->is_modo, fn ($query) => $query->where('user_id', '=', $this->user->id))
|
||||
->when(
|
||||
$this->tab === 'open',
|
||||
fn ($query) => $query->whereNull('closed_at'),
|
||||
|
||||
@@ -99,7 +99,7 @@ class TorrentRequestSearch extends Component
|
||||
|
||||
final public function toggleShowFilters(): void
|
||||
{
|
||||
$this->showFilters = ! $this->showFilters;
|
||||
$this->showFilters = !$this->showFilters;
|
||||
}
|
||||
|
||||
final public function getTorrentRequestStatProperty(): ?object
|
||||
|
||||
@@ -252,7 +252,7 @@ class TorrentSearch extends Component
|
||||
$user = auth()->user();
|
||||
|
||||
// Whitelist which columns are allowed to be ordered by
|
||||
if (! \in_array($this->sortField, [
|
||||
if (!\in_array($this->sortField, [
|
||||
'name',
|
||||
'size',
|
||||
'seeders',
|
||||
@@ -332,7 +332,7 @@ class TorrentSearch extends Component
|
||||
$user = auth()->user();
|
||||
|
||||
// Whitelist which columns are allowed to be ordered by
|
||||
if (! \in_array($this->sortField, [
|
||||
if (!\in_array($this->sortField, [
|
||||
'bumped_at',
|
||||
'times_completed',
|
||||
])) {
|
||||
@@ -570,7 +570,7 @@ class TorrentSearch extends Component
|
||||
final public function getGroupedPostersProperty()
|
||||
{
|
||||
// Whitelist which columns are allowed to be ordered by
|
||||
if (! \in_array($this->sortField, [
|
||||
if (!\in_array($this->sortField, [
|
||||
'bumped_at',
|
||||
'times_completed',
|
||||
])) {
|
||||
|
||||
@@ -56,7 +56,7 @@ class UserSearch extends Component
|
||||
final public function toggleProperties($property): void
|
||||
{
|
||||
if ($property === 'show') {
|
||||
$this->show = ! $this->show;
|
||||
$this->show = !$this->show;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -158,7 +158,7 @@ class UserTorrents extends Component
|
||||
->when($this->uploaded === 'exclude', fn ($query) => $query->where('torrents.user_id', '<>', $this->user->id))
|
||||
->when($this->downloaded === 'include', fn ($query) => $query->where('history.actual_downloaded', '>', 0))
|
||||
->when($this->downloaded === 'exclude', fn ($query) => $query->where('history.actual_downloaded', '=', 0))
|
||||
->when(! empty($this->status), fn ($query) => $query->whereIntegerInRaw('status', $this->status))
|
||||
->when(!empty($this->status), fn ($query) => $query->whereIntegerInRaw('status', $this->status))
|
||||
->orderBy($this->sortField, $this->sortDirection)
|
||||
->paginate($this->perPage);
|
||||
}
|
||||
|
||||
@@ -76,7 +76,7 @@ class UserUploads extends Component
|
||||
fn ($query) => $query
|
||||
->where('name', 'like', '%'.str_replace(' ', '%', $this->name).'%')
|
||||
)
|
||||
->when(! empty($this->status), fn ($query) => $query->whereIntegerInRaw('status', $this->status))
|
||||
->when(!empty($this->status), fn ($query) => $query->whereIntegerInRaw('status', $this->status))
|
||||
->when($this->personalRelease === 'include', fn ($query) => $query->where('personal_release', '=', 1))
|
||||
->when($this->personalRelease === 'exclude', fn ($query) => $query->where('personal_release', '=', 0))
|
||||
->orderBy($this->sortField, $this->sortDirection)
|
||||
|
||||
@@ -57,7 +57,7 @@ class WarningLogSearch extends Component
|
||||
final public function toggleProperties($property): void
|
||||
{
|
||||
if ($property === 'show') {
|
||||
$this->show = ! $this->show;
|
||||
$this->show = !$this->show;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -27,7 +27,7 @@ class SetLanguage
|
||||
private function setLocale(string $locale): void
|
||||
{
|
||||
// Check if is allowed and set default locale if not
|
||||
if (! Language::allowed($locale)) {
|
||||
if (!Language::allowed($locale)) {
|
||||
$locale = config('app.locale');
|
||||
}
|
||||
|
||||
|
||||
@@ -45,7 +45,7 @@ class StorePollVoteRequest extends FormRequest
|
||||
'options' => [
|
||||
'required',
|
||||
'array',
|
||||
Rule::when(! $poll->multiple_choice, 'max:1'),
|
||||
Rule::when(!$poll->multiple_choice, 'max:1'),
|
||||
'min:1',
|
||||
],
|
||||
'options.*' => [
|
||||
|
||||
@@ -39,7 +39,7 @@ class StoreSubtitleRequest extends FormRequest
|
||||
'required',
|
||||
'file',
|
||||
function (string $attribute, mixed $value, Closure $fail): void {
|
||||
if (! \in_array('.'.$value->getClientOriginalExtension(), ['.srt','.ass', '.sup', '.zip'])) {
|
||||
if (!\in_array('.'.$value->getClientOriginalExtension(), ['.srt','.ass', '.sup', '.zip'])) {
|
||||
$fail('The Subtitle uploaded does not have a ".srt, .ass, .sup or .zip" file extension (it has "'.$value->getClientOriginalExtension().'"). Did you upload the correct file?');
|
||||
}
|
||||
},
|
||||
|
||||
@@ -67,7 +67,7 @@ class StoreTorrentRequest extends FormRequest
|
||||
}
|
||||
|
||||
foreach (TorrentTools::getFilenameArray($decodedTorrent) as $name) {
|
||||
if (! TorrentTools::isValidFilename($name)) {
|
||||
if (!TorrentTools::isValidFilename($name)) {
|
||||
$fail('Invalid Filenames In Torrent Files!');
|
||||
}
|
||||
}
|
||||
@@ -124,7 +124,7 @@ class StoreTorrentRequest extends FormRequest
|
||||
],
|
||||
'resolution_id' => [
|
||||
Rule::when($category->movie_meta || $category->tv_meta, 'required'),
|
||||
Rule::when(! $category->movie_meta && ! $category->tv_meta, 'nullable'),
|
||||
Rule::when(!$category->movie_meta && !$category->tv_meta, 'nullable'),
|
||||
'exists:resolutions,id',
|
||||
],
|
||||
'region_id' => [
|
||||
@@ -140,7 +140,7 @@ class StoreTorrentRequest extends FormRequest
|
||||
'required',
|
||||
'numeric',
|
||||
]),
|
||||
Rule::when(! ($category->movie_meta || $category->tv_meta), [
|
||||
Rule::when(!($category->movie_meta || $category->tv_meta), [
|
||||
Rule::in([0]),
|
||||
]),
|
||||
],
|
||||
@@ -150,7 +150,7 @@ class StoreTorrentRequest extends FormRequest
|
||||
'numeric',
|
||||
'integer',
|
||||
]),
|
||||
Rule::when(! $category->tv_meta, [
|
||||
Rule::when(!$category->tv_meta, [
|
||||
Rule::in([0]),
|
||||
]),
|
||||
],
|
||||
@@ -160,7 +160,7 @@ class StoreTorrentRequest extends FormRequest
|
||||
'numeric',
|
||||
'integer',
|
||||
]),
|
||||
Rule::when(! ($category->movie_meta || $category->tv_meta), [
|
||||
Rule::when(!($category->movie_meta || $category->tv_meta), [
|
||||
Rule::in([0]),
|
||||
]),
|
||||
],
|
||||
@@ -170,7 +170,7 @@ class StoreTorrentRequest extends FormRequest
|
||||
'numeric',
|
||||
'integer',
|
||||
]),
|
||||
Rule::when(! ($category->movie_meta || $category->tv_meta), [
|
||||
Rule::when(!($category->movie_meta || $category->tv_meta), [
|
||||
Rule::in([0]),
|
||||
]),
|
||||
],
|
||||
@@ -180,7 +180,7 @@ class StoreTorrentRequest extends FormRequest
|
||||
'numeric',
|
||||
'integer',
|
||||
]),
|
||||
Rule::when(! $category->game_meta, [
|
||||
Rule::when(!$category->game_meta, [
|
||||
Rule::in([0]),
|
||||
]),
|
||||
],
|
||||
@@ -190,7 +190,7 @@ class StoreTorrentRequest extends FormRequest
|
||||
'numeric',
|
||||
'integer',
|
||||
]),
|
||||
Rule::prohibitedIf(! $category->tv_meta),
|
||||
Rule::prohibitedIf(!$category->tv_meta),
|
||||
],
|
||||
'episode_number' => [
|
||||
Rule::when($category->tv_meta, [
|
||||
@@ -198,7 +198,7 @@ class StoreTorrentRequest extends FormRequest
|
||||
'numeric',
|
||||
'integer',
|
||||
]),
|
||||
Rule::prohibitedIf(! $category->tv_meta),
|
||||
Rule::prohibitedIf(!$category->tv_meta),
|
||||
],
|
||||
'anon' => [
|
||||
'required',
|
||||
@@ -219,19 +219,19 @@ class StoreTorrentRequest extends FormRequest
|
||||
'internal' => [
|
||||
'sometimes',
|
||||
'boolean',
|
||||
Rule::when(! $request->user()->group->is_modo && ! $request->user()->group->is_internal, 'prohibited'),
|
||||
Rule::when(!$request->user()->group->is_modo && !$request->user()->group->is_internal, 'prohibited'),
|
||||
],
|
||||
'free' => [
|
||||
'sometimes',
|
||||
'integer',
|
||||
'numeric',
|
||||
'between:0,100',
|
||||
Rule::when(! $request->user()->group->is_modo && ! $request->user()->group->is_internal, 'prohibited'),
|
||||
Rule::when(!$request->user()->group->is_modo && !$request->user()->group->is_internal, 'prohibited'),
|
||||
],
|
||||
'refundable' => [
|
||||
'sometimes',
|
||||
'boolean',
|
||||
Rule::when(! $request->user()->group->is_modo && ! $request->user()->group->is_internal, 'prohibited'),
|
||||
Rule::when(!$request->user()->group->is_modo && !$request->user()->group->is_internal, 'prohibited'),
|
||||
],
|
||||
];
|
||||
}
|
||||
|
||||
@@ -47,7 +47,7 @@ class StoreTorrentRequestRequest extends FormRequest
|
||||
'required',
|
||||
'numeric',
|
||||
]),
|
||||
Rule::when(! ($category->movie_meta || $category->tv_meta), [
|
||||
Rule::when(!($category->movie_meta || $category->tv_meta), [
|
||||
Rule::in([0]),
|
||||
]),
|
||||
],
|
||||
@@ -57,7 +57,7 @@ class StoreTorrentRequestRequest extends FormRequest
|
||||
'numeric',
|
||||
'integer',
|
||||
]),
|
||||
Rule::when(! $category->tv_meta, [
|
||||
Rule::when(!$category->tv_meta, [
|
||||
Rule::in([0]),
|
||||
]),
|
||||
],
|
||||
@@ -67,7 +67,7 @@ class StoreTorrentRequestRequest extends FormRequest
|
||||
'numeric',
|
||||
'integer',
|
||||
]),
|
||||
Rule::when(! ($category->movie_meta || $category->tv_meta), [
|
||||
Rule::when(!($category->movie_meta || $category->tv_meta), [
|
||||
Rule::in([0]),
|
||||
]),
|
||||
],
|
||||
@@ -77,7 +77,7 @@ class StoreTorrentRequestRequest extends FormRequest
|
||||
'numeric',
|
||||
'integer',
|
||||
]),
|
||||
Rule::when(! ($category->movie_meta || $category->tv_meta), [
|
||||
Rule::when(!($category->movie_meta || $category->tv_meta), [
|
||||
Rule::in([0]),
|
||||
]),
|
||||
],
|
||||
@@ -87,7 +87,7 @@ class StoreTorrentRequestRequest extends FormRequest
|
||||
'numeric',
|
||||
'integer',
|
||||
]),
|
||||
Rule::when(! $category->game_meta, [
|
||||
Rule::when(!$category->game_meta, [
|
||||
Rule::in([0]),
|
||||
]),
|
||||
],
|
||||
|
||||
@@ -69,7 +69,7 @@ class UpdateTorrentRequest extends FormRequest
|
||||
],
|
||||
'resolution_id' => [
|
||||
Rule::when($category->movie_meta || $category->tv_meta, 'required'),
|
||||
Rule::when(! $category->movie_meta && ! $category->tv_meta, 'nullable'),
|
||||
Rule::when(!$category->movie_meta && !$category->tv_meta, 'nullable'),
|
||||
'exists:resolutions,id',
|
||||
],
|
||||
'region_id' => [
|
||||
@@ -102,18 +102,18 @@ class UpdateTorrentRequest extends FormRequest
|
||||
],
|
||||
'season_number' => [
|
||||
Rule::when($category->tv_meta, 'required'),
|
||||
Rule::when(! $category->tv_meta, 'nullable'),
|
||||
Rule::when(!$category->tv_meta, 'nullable'),
|
||||
'numeric',
|
||||
],
|
||||
'episode_number' => [
|
||||
Rule::when($category->tv_meta, 'required'),
|
||||
Rule::when(! $category->tv_meta, 'nullable'),
|
||||
Rule::when(!$category->tv_meta, 'nullable'),
|
||||
'numeric',
|
||||
],
|
||||
'anon' => [
|
||||
'required',
|
||||
'boolean',
|
||||
Rule::when(Torrent::withoutGlobalScope(ApprovedScope::class)->find($request->route('id'))->user_id !== $request->user()->id && ! $request->user()->group->is_modo, 'exclude'),
|
||||
Rule::when(Torrent::withoutGlobalScope(ApprovedScope::class)->find($request->route('id'))->user_id !== $request->user()->id && !$request->user()->group->is_modo, 'exclude'),
|
||||
],
|
||||
'stream' => [
|
||||
'required',
|
||||
@@ -130,17 +130,17 @@ class UpdateTorrentRequest extends FormRequest
|
||||
'internal' => [
|
||||
'sometimes',
|
||||
'boolean',
|
||||
Rule::when(! $request->user()->group->is_modo && ! $request->user()->group->is_internal, 'prohibited'),
|
||||
Rule::when(!$request->user()->group->is_modo && !$request->user()->group->is_internal, 'prohibited'),
|
||||
],
|
||||
'free' => [
|
||||
'sometimes',
|
||||
'between:0,100',
|
||||
Rule::when(! $request->user()->group->is_modo && ! $request->user()->group->is_internal, 'prohibited'),
|
||||
Rule::when(!$request->user()->group->is_modo && !$request->user()->group->is_internal, 'prohibited'),
|
||||
],
|
||||
'refundable' => [
|
||||
'sometimes',
|
||||
'boolean',
|
||||
Rule::when(! $request->user()->group->is_modo && ! $request->user()->group->is_internal, 'prohibited'),
|
||||
Rule::when(!$request->user()->group->is_modo && !$request->user()->group->is_internal, 'prohibited'),
|
||||
],
|
||||
];
|
||||
}
|
||||
|
||||
@@ -43,7 +43,7 @@ class ProcessBackup implements ShouldQueue
|
||||
$backupJob->dontBackupDatabases();
|
||||
}
|
||||
|
||||
if (! empty($this->option)) {
|
||||
if (!empty($this->option)) {
|
||||
$prefix = str_replace('_', '-', (string) $this->option).'-';
|
||||
|
||||
$backupJob->setFilename($prefix.date('Y-m-d-H-i-s').'.zip');
|
||||
|
||||
@@ -100,7 +100,7 @@ class Comment extends Model
|
||||
if (empty($ticket->reminded_at) || strtotime((string) $ticket->reminded_at) < strtotime('+ 3 days')) {
|
||||
$last_comment = $ticket->comments()->latest('id')->first();
|
||||
|
||||
if (property_exists($last_comment, 'id') && $last_comment->id !== null && ! $last_comment->user->group->is_modo && strtotime((string) $last_comment->created_at) < strtotime('- 3 days')) {
|
||||
if (property_exists($last_comment, 'id') && $last_comment->id !== null && !$last_comment->user->group->is_modo && strtotime((string) $last_comment->created_at) < strtotime('- 3 days')) {
|
||||
event(new TicketWentStale($last_comment->commentable));
|
||||
}
|
||||
}
|
||||
|
||||
+6
-6
@@ -779,12 +779,12 @@ class User extends Authenticatable
|
||||
return false;
|
||||
}
|
||||
|
||||
if ($target->notification && $type && (! $target->notification->$type)) {
|
||||
if ($target->notification && $type && (!$target->notification->$type)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (\is_array($target->notification?->$targetGroup)) {
|
||||
return ! \in_array($sender->group->id, $target->notification->$targetGroup, true);
|
||||
return !\in_array($sender->group->id, $target->notification->$targetGroup, true);
|
||||
}
|
||||
|
||||
return true;
|
||||
@@ -810,12 +810,12 @@ class User extends Authenticatable
|
||||
return false;
|
||||
}
|
||||
|
||||
if ($target->privacy && $type && (! $target->privacy->$type || $target->privacy->$type == 0)) {
|
||||
if ($target->privacy && $type && (!$target->privacy->$type || $target->privacy->$type == 0)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (\is_array($target->privacy?->$targetGroup)) {
|
||||
return ! \in_array($sender->group->id, $target->privacy->$targetGroup);
|
||||
return !\in_array($sender->group->id, $target->privacy->$targetGroup);
|
||||
}
|
||||
|
||||
return true;
|
||||
@@ -841,12 +841,12 @@ class User extends Authenticatable
|
||||
return false;
|
||||
}
|
||||
|
||||
if ($target->privacy && $type && (! $target->privacy->$type || $target->privacy->$type == 0)) {
|
||||
if ($target->privacy && $type && (!$target->privacy->$type || $target->privacy->$type == 0)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (\is_array($target->privacy?->$targetGroup)) {
|
||||
return ! \in_array($sender->group->id, $target->privacy->$targetGroup);
|
||||
return !\in_array($sender->group->id, $target->privacy->$targetGroup);
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
@@ -70,7 +70,7 @@ class AppServiceProvider extends ServiceProvider
|
||||
$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)) {
|
||||
if (!HiddenCaptcha::check($validator, $minLimit, $maxLimit)) {
|
||||
$validator->setCustomMessages(['hiddencaptcha' => 'Captcha error']);
|
||||
|
||||
return false;
|
||||
|
||||
@@ -34,7 +34,7 @@ class CacheUserProvider extends EloquentUserProvider
|
||||
{
|
||||
$model = CacheUser::user($identifier);
|
||||
|
||||
if (! $model) {
|
||||
if (!$model) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -26,7 +26,7 @@ class EmailBlacklist implements Rule
|
||||
$domain = Str::after(strtolower((string) $value), '@');
|
||||
|
||||
// Run validation check
|
||||
return ! \in_array($domain, $this->domains, true);
|
||||
return !\in_array($domain, $this->domains, true);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -47,7 +47,7 @@ class EmailBlacklist implements Rule
|
||||
$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) {
|
||||
|
||||
@@ -181,7 +181,7 @@ class Movie
|
||||
|
||||
public function get_trailer(): ?string
|
||||
{
|
||||
if (! empty($this->data['videos']['results'])) {
|
||||
if (!empty($this->data['videos']['results'])) {
|
||||
return 'https://www.youtube-nocookie.com/embed/'.$this->data['videos']['results'][0]['key'];
|
||||
}
|
||||
|
||||
|
||||
@@ -201,7 +201,7 @@ class TV
|
||||
|
||||
public function get_trailer(): ?string
|
||||
{
|
||||
if (! empty($this->data['videos']['results'])) {
|
||||
if (!empty($this->data['videos']['results'])) {
|
||||
return 'https://www.youtube.com/embed/'.$this->data['videos']['results'][0]['key'];
|
||||
}
|
||||
|
||||
|
||||
@@ -40,7 +40,7 @@ class TMDB
|
||||
|
||||
public function ifExists($type, $array)
|
||||
{
|
||||
if (isset($array[$type]) && ! empty($array[$type])) {
|
||||
if (isset($array[$type]) && !empty($array[$type])) {
|
||||
return $array[$type];
|
||||
}
|
||||
|
||||
|
||||
@@ -36,7 +36,7 @@ class Unit3dAnnounce
|
||||
'upload_factor' => 100,
|
||||
]);
|
||||
|
||||
if (! $isSuccess) {
|
||||
if (!$isSuccess) {
|
||||
Log::notice('TRACKER - Failed to add torrent.', ['id' => $torrent->id]);
|
||||
}
|
||||
|
||||
@@ -50,7 +50,7 @@ class Unit3dAnnounce
|
||||
'info_hash' => bin2hex($torrent->info_hash),
|
||||
]);
|
||||
|
||||
if (! $isSuccess) {
|
||||
if (!$isSuccess) {
|
||||
Log::notice('TRACKER - Failed to remove torrent', ['id' => $torrent->id]);
|
||||
}
|
||||
|
||||
@@ -86,7 +86,7 @@ class Unit3dAnnounce
|
||||
'upload_factor' => $user->group->is_double_upload ? 200 : 100,
|
||||
]);
|
||||
|
||||
if (! $isSuccess) {
|
||||
if (!$isSuccess) {
|
||||
Log::notice('TRACKER - Failed to add user', ['id' => $user->id]);
|
||||
}
|
||||
|
||||
@@ -100,7 +100,7 @@ class Unit3dAnnounce
|
||||
'passkey' => $user->passkey,
|
||||
]);
|
||||
|
||||
if (! $isSuccess) {
|
||||
if (!$isSuccess) {
|
||||
Log::notice('TRACKER - Failed to remove user', ['id' => $user->id]);
|
||||
}
|
||||
|
||||
@@ -113,7 +113,7 @@ class Unit3dAnnounce
|
||||
'name' => $blacklistedAgent,
|
||||
]);
|
||||
|
||||
if (! $isSuccess) {
|
||||
if (!$isSuccess) {
|
||||
Log::notice('TRACKER - Failed to add blacklisted agent.', ['name' => $blacklistedAgent]);
|
||||
}
|
||||
|
||||
@@ -126,7 +126,7 @@ class Unit3dAnnounce
|
||||
'name' => $blacklistedClient->name,
|
||||
]);
|
||||
|
||||
if (! $isSuccess) {
|
||||
if (!$isSuccess) {
|
||||
Log::notice('TRACKER - Failed to remove blacklisted agent.', ['name' => $blacklistedClient->name]);
|
||||
}
|
||||
|
||||
@@ -140,7 +140,7 @@ class Unit3dAnnounce
|
||||
'torrent_id' => $torrent_id
|
||||
]);
|
||||
|
||||
if (! $isSuccess) {
|
||||
if (!$isSuccess) {
|
||||
Log::notice('TRACKER - Failed to add freeleech token.', ['user_id' => $user_id, 'torrent_id' => $torrent_id]);
|
||||
}
|
||||
|
||||
@@ -153,7 +153,7 @@ class Unit3dAnnounce
|
||||
'user_id' => $user_id,
|
||||
]);
|
||||
|
||||
if (! $isSuccess) {
|
||||
if (!$isSuccess) {
|
||||
Log::notice('TRACKER - Failed to add personal freeleech.', ['user_id' => $user_id]);
|
||||
}
|
||||
|
||||
@@ -166,7 +166,7 @@ class Unit3dAnnounce
|
||||
'user_id' => $user_id,
|
||||
]);
|
||||
|
||||
if (! $isSuccess) {
|
||||
if (!$isSuccess) {
|
||||
Log::notice('TRACKER - Failed to remove personal freeleech.', ['user_id' => $user_id]);
|
||||
}
|
||||
|
||||
@@ -185,12 +185,12 @@ class Unit3dAnnounce
|
||||
$attemptsLeft = 3;
|
||||
$route = 'http://'.config('announce.external_tracker.host').':'.config('announce.external_tracker.port').'/announce/'.config('announce.external_tracker.key').'/'.$path;
|
||||
|
||||
while (! $isSuccess && $attemptsLeft > 0) {
|
||||
while (!$isSuccess && $attemptsLeft > 0) {
|
||||
$response = Http::put($route, $data);
|
||||
|
||||
$isSuccess = $response->ok();
|
||||
|
||||
if (! $isSuccess) {
|
||||
if (!$isSuccess) {
|
||||
$attemptsLeft -= 1;
|
||||
|
||||
if ($attemptsLeft > 0) {
|
||||
@@ -217,12 +217,12 @@ class Unit3dAnnounce
|
||||
$attemptsLeft = 3;
|
||||
$route = 'http://'.config('announce.external_tracker.host').':'.config('announce.external_tracker.port').'/announce/'.config('announce.external_tracker.key').'/'.$path;
|
||||
|
||||
while (! $isSuccess && $attemptsLeft > 0) {
|
||||
while (!$isSuccess && $attemptsLeft > 0) {
|
||||
$response = Http::delete($route, $data);
|
||||
|
||||
$isSuccess = $response->ok();
|
||||
|
||||
if (! $isSuccess) {
|
||||
if (!$isSuccess) {
|
||||
$attemptsLeft -= 1;
|
||||
|
||||
if ($attemptsLeft > 0) {
|
||||
|
||||
@@ -120,7 +120,7 @@ trait Auditable
|
||||
}
|
||||
|
||||
// Check global discards
|
||||
if (! empty($globalDiscards) && \in_array($key, $globalDiscards, true)) {
|
||||
if (!empty($globalDiscards) && \in_array($key, $globalDiscards, true)) {
|
||||
unset($data[$key]);
|
||||
}
|
||||
}
|
||||
@@ -154,7 +154,7 @@ trait Auditable
|
||||
// Generate the JSON to store
|
||||
$data = self::generate('create', [], self::strip($model, $model->getAttributes()));
|
||||
|
||||
if (null !== $userId && ! empty($data)) {
|
||||
if (null !== $userId && !empty($data)) {
|
||||
// Store record
|
||||
$now = Carbon::now()->format('Y-m-d H:i:s');
|
||||
DB::table('audits')->insert([
|
||||
@@ -182,7 +182,7 @@ trait Auditable
|
||||
// Generate the JSON to store
|
||||
$data = self::generate('update', self::strip($model, $model->getOriginal()), self::strip($model, $model->getChanges()));
|
||||
|
||||
if (null !== $userId && ! empty(json_decode($data, true, 512, JSON_THROW_ON_ERROR))) {
|
||||
if (null !== $userId && !empty(json_decode($data, true, 512, JSON_THROW_ON_ERROR))) {
|
||||
// Store record
|
||||
$now = Carbon::now()->format('Y-m-d H:i:s');
|
||||
DB::table('audits')->insert([
|
||||
@@ -210,7 +210,7 @@ trait Auditable
|
||||
// Generate the JSON to store
|
||||
$data = self::generate('delete', self::strip($model, $model->getAttributes()));
|
||||
|
||||
if (null !== $userId && ! empty($data)) {
|
||||
if (null !== $userId && !empty($data)) {
|
||||
// Store record
|
||||
$now = Carbon::now()->format('Y-m-d H:i:s');
|
||||
DB::table('audits')->insert([
|
||||
|
||||
@@ -76,7 +76,7 @@ trait TorrentFilter
|
||||
$authenticatedUser === null,
|
||||
fn ($query) => $query->where('anon', '=', false),
|
||||
fn ($query) => $query->when(
|
||||
! $authenticatedUser->group->is_modo,
|
||||
!$authenticatedUser->group->is_modo,
|
||||
fn ($query) => $query->where(fn ($query) => $query->where('anon', '=', false)->orWhere('user_id', '=', $authenticatedUser->id))
|
||||
)
|
||||
);
|
||||
|
||||
@@ -20,7 +20,7 @@ trait UsersOnlineTrait
|
||||
*/
|
||||
public function isOnline(): bool
|
||||
{
|
||||
if (! $this->last_action) {
|
||||
if (!$this->last_action) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -14,7 +14,7 @@ return new class () extends Migration {
|
||||
$sm = Schema::getConnection()->getDoctrineSchemaManager();
|
||||
$doctrineTable = $sm->listTableDetails('articles');
|
||||
|
||||
if (! $doctrineTable->hasIndex('created_at')) {
|
||||
if (!$doctrineTable->hasIndex('created_at')) {
|
||||
$table->index('created_at');
|
||||
}
|
||||
});
|
||||
@@ -23,19 +23,19 @@ return new class () extends Migration {
|
||||
$sm = Schema::getConnection()->getDoctrineSchemaManager();
|
||||
$doctrineTable = $sm->listTableDetails('bon_transactions;');
|
||||
|
||||
if (! $doctrineTable->hasIndex('itemID')) {
|
||||
if (!$doctrineTable->hasIndex('itemID')) {
|
||||
$table->index('itemID');
|
||||
}
|
||||
|
||||
if (! $doctrineTable->hasIndex('sender')) {
|
||||
if (!$doctrineTable->hasIndex('sender')) {
|
||||
$table->index('sender');
|
||||
}
|
||||
|
||||
if (! $doctrineTable->hasIndex('receiver')) {
|
||||
if (!$doctrineTable->hasIndex('receiver')) {
|
||||
$table->index('receiver');
|
||||
}
|
||||
|
||||
if (! $doctrineTable->hasIndex('torrent_id')) {
|
||||
if (!$doctrineTable->hasIndex('torrent_id')) {
|
||||
$table->index('torrent_id');
|
||||
}
|
||||
});
|
||||
@@ -44,11 +44,11 @@ return new class () extends Migration {
|
||||
$sm = Schema::getConnection()->getDoctrineSchemaManager();
|
||||
$doctrineTable = $sm->listTableDetails('bookmarks');
|
||||
|
||||
if (! $doctrineTable->hasIndex('user_id')) {
|
||||
if (!$doctrineTable->hasIndex('user_id')) {
|
||||
$table->index('user_id');
|
||||
}
|
||||
|
||||
if (! $doctrineTable->hasIndex('torrent_id')) {
|
||||
if (!$doctrineTable->hasIndex('torrent_id')) {
|
||||
$table->index('torrent_id');
|
||||
}
|
||||
});
|
||||
@@ -57,7 +57,7 @@ return new class () extends Migration {
|
||||
$sm = Schema::getConnection()->getDoctrineSchemaManager();
|
||||
$doctrineTable = $sm->listTableDetails('posts');
|
||||
|
||||
if (! $doctrineTable->hasIndex('created_at')) {
|
||||
if (!$doctrineTable->hasIndex('created_at')) {
|
||||
$table->index('created_at');
|
||||
}
|
||||
});
|
||||
@@ -66,7 +66,7 @@ return new class () extends Migration {
|
||||
$sm = Schema::getConnection()->getDoctrineSchemaManager();
|
||||
$doctrineTable = $sm->listTableDetails('topics');
|
||||
|
||||
if (! $doctrineTable->hasIndex('created_at')) {
|
||||
if (!$doctrineTable->hasIndex('created_at')) {
|
||||
$table->index('created_at');
|
||||
}
|
||||
});
|
||||
@@ -75,27 +75,27 @@ return new class () extends Migration {
|
||||
$sm = Schema::getConnection()->getDoctrineSchemaManager();
|
||||
$doctrineTable = $sm->listTableDetails('torrents');
|
||||
|
||||
if (! $doctrineTable->hasIndex('status')) {
|
||||
if (!$doctrineTable->hasIndex('status')) {
|
||||
$table->index('status');
|
||||
}
|
||||
|
||||
if (! $doctrineTable->hasIndex('seeders')) {
|
||||
if (!$doctrineTable->hasIndex('seeders')) {
|
||||
$table->index('seeders');
|
||||
}
|
||||
|
||||
if (! $doctrineTable->hasIndex('leechers')) {
|
||||
if (!$doctrineTable->hasIndex('leechers')) {
|
||||
$table->index('leechers');
|
||||
}
|
||||
|
||||
if (! $doctrineTable->hasIndex('sticky')) {
|
||||
if (!$doctrineTable->hasIndex('sticky')) {
|
||||
$table->index('sticky');
|
||||
}
|
||||
|
||||
if (! $doctrineTable->hasIndex('created_at')) {
|
||||
if (!$doctrineTable->hasIndex('created_at')) {
|
||||
$table->index('created_at');
|
||||
}
|
||||
|
||||
if (! $doctrineTable->hasIndex('bumped_at')) {
|
||||
if (!$doctrineTable->hasIndex('bumped_at')) {
|
||||
$table->index('bumped_at');
|
||||
}
|
||||
});
|
||||
@@ -104,7 +104,7 @@ return new class () extends Migration {
|
||||
$sm = Schema::getConnection()->getDoctrineSchemaManager();
|
||||
$doctrineTable = $sm->listTableDetails('users');
|
||||
|
||||
if (! $doctrineTable->hasIndex('deleted_at')) {
|
||||
if (!$doctrineTable->hasIndex('deleted_at')) {
|
||||
$table->index('deleted_at');
|
||||
}
|
||||
});
|
||||
|
||||
@@ -44,7 +44,7 @@ return new class () extends Migration {
|
||||
|
||||
if (\is_object($old) && \is_object($old->default_groups)) {
|
||||
foreach ($old->default_groups as $groupId => $acceptsNotifications) {
|
||||
if (! $acceptsNotifications && \in_array($groupId, $allowedGroups)) {
|
||||
if (!$acceptsNotifications && \in_array($groupId, $allowedGroups)) {
|
||||
$new[] = (int) $groupId;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -44,7 +44,7 @@ return new class () extends Migration {
|
||||
|
||||
if (\is_object($old) && \is_object($old->default_groups)) {
|
||||
foreach ($old->default_groups as $groupId => $isAllowed) {
|
||||
if (! $isAllowed && \in_array($groupId, $allowedGroups)) {
|
||||
if (!$isAllowed && \in_array($groupId, $allowedGroups)) {
|
||||
$new[] = (int) $groupId;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user