@@ -269,7 +269,7 @@ discard block |
||
| 269 | 269 | { |
| 270 | 270 | $res = self::query()->withTrashed()->where('email', '<>', '[email protected]'); |
| 271 | 271 | |
| 272 | - if (! empty($role)) { |
|
| 272 | + if (!empty($role)) { |
|
| 273 | 273 | $res->where('roles_id', $role); |
| 274 | 274 | } |
| 275 | 275 | |
@@ -318,7 +318,7 @@ discard block |
||
| 318 | 318 | 'rate_limit' => $rateLimit ? $rateLimit['rate_limit'] : 60, |
| 319 | 319 | ]; |
| 320 | 320 | |
| 321 | - if (! empty($email)) { |
|
| 321 | + if (!empty($email)) { |
|
| 322 | 322 | $email = trim($email); |
| 323 | 323 | $sql += ['email' => $email]; |
| 324 | 324 | } |
@@ -427,12 +427,12 @@ discard block |
||
| 427 | 427 | return self::fromQuery( |
| 428 | 428 | sprintf( |
| 429 | 429 | $query, |
| 430 | - ! empty($userName) ? 'AND users.username '.'LIKE '.escapeString('%'.$userName.'%') : '', |
|
| 431 | - ! empty($email) ? 'AND users.email '.'LIKE '.escapeString('%'.$email.'%') : '', |
|
| 432 | - ! empty($host) ? 'AND users.host '.'LIKE '.escapeString('%'.$host.'%') : '', |
|
| 433 | - (! empty($role) ? ('AND users.roles_id = '.$role) : ''), |
|
| 434 | - ! empty($createdFrom) ? 'AND users.created_at >= '.escapeString($createdFrom.' 00:00:00') : '', |
|
| 435 | - ! empty($createdTo) ? 'AND users.created_at <= '.escapeString($createdTo.' 23:59:59') : '', |
|
| 430 | + !empty($userName) ? 'AND users.username '.'LIKE '.escapeString('%'.$userName.'%') : '', |
|
| 431 | + !empty($email) ? 'AND users.email '.'LIKE '.escapeString('%'.$email.'%') : '', |
|
| 432 | + !empty($host) ? 'AND users.host '.'LIKE '.escapeString('%'.$host.'%') : '', |
|
| 433 | + (!empty($role) ? ('AND users.roles_id = '.$role) : ''), |
|
| 434 | + !empty($createdFrom) ? 'AND users.created_at >= '.escapeString($createdFrom.' 00:00:00') : '', |
|
| 435 | + !empty($createdTo) ? 'AND users.created_at <= '.escapeString($createdTo.' 23:59:59') : '', |
|
| 436 | 436 | $order[0], |
| 437 | 437 | $order[1], |
| 438 | 438 | ($start === false ? '' : ('LIMIT '.$offset.' OFFSET '.$start)) |
@@ -544,7 +544,7 @@ discard block |
||
| 544 | 544 | |
| 545 | 545 | public static function isValidUrl($url): bool |
| 546 | 546 | { |
| 547 | - return (! preg_match('/^(http|https|ftp):\/\/([A-Z0-9][A-Z0-9_-]*(?:\.[A-Z0-9][A-Z0-9_-]*)+):?(\d+)?\/?/i', $url)) ? false : true; |
|
| 547 | + return (!preg_match('/^(http|https|ftp):\/\/([A-Z0-9][A-Z0-9_-]*(?:\.[A-Z0-9][A-Z0-9_-]*)+):?(\d+)?\/?/i', $url)) ? false : true; |
|
| 548 | 548 | } |
| 549 | 549 | |
| 550 | 550 | /** |
@@ -580,7 +580,7 @@ discard block |
||
| 580 | 580 | |
| 581 | 581 | // Make sure this is the last check, as if a further validation check failed, the invite would still have been used up. |
| 582 | 582 | $invitedBy = 0; |
| 583 | - if (! $forceInviteMode && (int) Settings::settingValue('registerstatus') === Settings::REGISTER_STATUS_INVITE) { |
|
| 583 | + if (!$forceInviteMode && (int) Settings::settingValue('registerstatus') === Settings::REGISTER_STATUS_INVITE) { |
|
| 584 | 584 | if ($inviteCode === '') { |
| 585 | 585 | return self::ERR_SIGNUP_BADINVITECODE; |
| 586 | 586 | } |
@@ -600,7 +600,7 @@ discard block |
||
| 600 | 600 | public static function checkAndUseInvite(string $inviteCode): int |
| 601 | 601 | { |
| 602 | 602 | $invite = Invitation::findValidByToken($inviteCode); |
| 603 | - if (! $invite) { |
|
| 603 | + if (!$invite) { |
|
| 604 | 604 | return -1; |
| 605 | 605 | } |
| 606 | 606 | |
@@ -616,7 +616,7 @@ discard block |
||
| 616 | 616 | public static function add(string $userName, string $password, string $email, int $role, ?string $notes = '', string $host = '', int $invites = Invitation::DEFAULT_INVITES, int $invitedBy = 0) |
| 617 | 617 | { |
| 618 | 618 | $password = self::hashPassword($password); |
| 619 | - if (! $password) { |
|
| 619 | + if (!$password) { |
|
| 620 | 620 | return false; |
| 621 | 621 | } |
| 622 | 622 | |
@@ -658,9 +658,9 @@ discard block |
||
| 658 | 658 | |
| 659 | 659 | $cats = ['view console', 'view movies', 'view audio', 'view tv', 'view pc', 'view adult', 'view books', 'view other']; |
| 660 | 660 | |
| 661 | - if (! empty($allowed)) { |
|
| 661 | + if (!empty($allowed)) { |
|
| 662 | 662 | foreach ($cats as $cat) { |
| 663 | - if (! \in_array($cat, $allowed, false)) { |
|
| 663 | + if (!\in_array($cat, $allowed, false)) { |
|
| 664 | 664 | $ret[] = match ($cat) { |
| 665 | 665 | 'view console' => 1000, |
| 666 | 666 | 'view movies' => 2000, |
@@ -257,13 +257,13 @@ |
||
| 257 | 257 | UserRoleHistory::recordRoleChange( |
| 258 | 258 | userId: $user->id, |
| 259 | 259 | oldRoleId: $oldRole ? $oldRole->id : null, |
| 260 | - newRoleId: $pendingRole ? $pendingRole->id : $user->roles_id, |
|
| 261 | - oldExpiryDate: null, |
|
| 262 | - newExpiryDate: null, |
|
| 263 | - effectiveDate: $now, |
|
| 264 | - isStacked: true, |
|
| 265 | - changeReason: 'manual_activation', |
|
| 266 | - changedBy: null |
|
| 260 | + newRoleId : $pendingRole ? $pendingRole->id : $user->roles_id, |
|
| 261 | + oldExpiryDate : null, |
|
| 262 | + newExpiryDate : null, |
|
| 263 | + effectiveDate : $now, |
|
| 264 | + isStacked : true, |
|
| 265 | + changeReason : 'manual_activation', |
|
| 266 | + changedBy : null |
|
| 267 | 267 | ); |
| 268 | 268 | |
| 269 | 269 | $this->info(sprintf( |
@@ -32,28 +32,28 @@ discard block |
||
| 32 | 32 | } |
| 33 | 33 | |
| 34 | 34 | if ($request->has('username') && !empty($request->input('username'))) { |
| 35 | - $query->whereHas('user', function ($q) use ($request) { |
|
| 36 | - $q->where('username', 'like', '%' . $request->input('username') . '%'); |
|
| 35 | + $query->whereHas('user', function($q) use ($request) { |
|
| 36 | + $q->where('username', 'like', '%'.$request->input('username').'%'); |
|
| 37 | 37 | }); |
| 38 | 38 | } |
| 39 | 39 | |
| 40 | 40 | if ($request->has('role_id') && !empty($request->input('role_id'))) { |
| 41 | - $query->where(function ($q) use ($request) { |
|
| 41 | + $query->where(function($q) use ($request) { |
|
| 42 | 42 | $q->where('old_role_id', $request->input('role_id')) |
| 43 | 43 | ->orWhere('new_role_id', $request->input('role_id')); |
| 44 | 44 | }); |
| 45 | 45 | } |
| 46 | 46 | |
| 47 | 47 | if ($request->has('change_reason') && !empty($request->input('change_reason'))) { |
| 48 | - $query->where('change_reason', 'like', '%' . $request->input('change_reason') . '%'); |
|
| 48 | + $query->where('change_reason', 'like', '%'.$request->input('change_reason').'%'); |
|
| 49 | 49 | } |
| 50 | 50 | |
| 51 | 51 | if ($request->has('date_from') && !empty($request->input('date_from'))) { |
| 52 | - $query->where('created_at', '>=', $request->input('date_from') . ' 00:00:00'); |
|
| 52 | + $query->where('created_at', '>=', $request->input('date_from').' 00:00:00'); |
|
| 53 | 53 | } |
| 54 | 54 | |
| 55 | 55 | if ($request->has('date_to') && !empty($request->input('date_to'))) { |
| 56 | - $query->where('created_at', '<=', $request->input('date_to') . ' 23:59:59'); |
|
| 56 | + $query->where('created_at', '<=', $request->input('date_to').' 23:59:59'); |
|
| 57 | 57 | } |
| 58 | 58 | |
| 59 | 59 | // Pagination |
@@ -88,7 +88,7 @@ discard block |
||
| 88 | 88 | $this->setAdminPrefs(); |
| 89 | 89 | |
| 90 | 90 | $user = User::findOrFail($userId); |
| 91 | - $meta_title = $title = 'Role History for ' . $user->username; |
|
| 91 | + $meta_title = $title = 'Role History for '.$user->username; |
|
| 92 | 92 | |
| 93 | 93 | $history = UserRoleHistory::with(['oldRole', 'newRole', 'changedByUser']) |
| 94 | 94 | ->where('user_id', $userId) |
@@ -62,7 +62,7 @@ discard block |
||
| 62 | 62 | // Add country data to each user based on their host IP |
| 63 | 63 | foreach ($results as $user) { |
| 64 | 64 | $position = null; |
| 65 | - if (! empty($user->host) && filter_var($user->host, FILTER_VALIDATE_IP)) { |
|
| 65 | + if (!empty($user->host) && filter_var($user->host, FILTER_VALIDATE_IP)) { |
|
| 66 | 66 | $position = Location::get($user->host); |
| 67 | 67 | } |
| 68 | 68 | $user->country_name = $position ? $position->countryName : null; |
@@ -185,7 +185,7 @@ discard block |
||
| 185 | 185 | $adminManuallySetExpiry = false; |
| 186 | 186 | if ($request->has('rolechangedate')) { |
| 187 | 187 | $roleChangeDate = $request->input('rolechangedate'); |
| 188 | - if (! empty($roleChangeDate)) { |
|
| 188 | + if (!empty($roleChangeDate)) { |
|
| 189 | 189 | User::updateUserRoleChangeDate($editedUser->id, $roleChangeDate); |
| 190 | 190 | $adminManuallySetExpiry = true; // Flag that admin set custom expiry |
| 191 | 191 | } else { |
@@ -54,16 +54,16 @@ discard block |
||
| 54 | 54 | $enabled = $config['enabled'] ?? true; |
| 55 | 55 | $workAvailable = $config['work_available'] ?? true; |
| 56 | 56 | |
| 57 | - if (! $pane || ! $command) { |
|
| 57 | + if (!$pane || !$command) { |
|
| 58 | 58 | return false; |
| 59 | 59 | } |
| 60 | 60 | |
| 61 | 61 | // Check if task is enabled and has work |
| 62 | - if (! $enabled) { |
|
| 62 | + if (!$enabled) { |
|
| 63 | 63 | return $this->disablePane($pane, $taskName, 'disabled in settings'); |
| 64 | 64 | } |
| 65 | 65 | |
| 66 | - if (! $workAvailable) { |
|
| 66 | + if (!$workAvailable) { |
|
| 67 | 67 | return $this->disablePane($pane, $taskName, 'no work available'); |
| 68 | 68 | } |
| 69 | 69 | |
@@ -129,13 +129,13 @@ discard block |
||
| 129 | 129 | { |
| 130 | 130 | $logsEnabled = (int) Settings::settingValue('write_logs') === 1; |
| 131 | 131 | |
| 132 | - if (! $logsEnabled) { |
|
| 132 | + if (!$logsEnabled) { |
|
| 133 | 133 | return '/dev/null'; |
| 134 | 134 | } |
| 135 | 135 | |
| 136 | 136 | $logDir = config('tmux.paths.logs', storage_path('logs/tmux')); |
| 137 | 137 | |
| 138 | - if (! is_dir($logDir)) { |
|
| 138 | + if (!is_dir($logDir)) { |
|
| 139 | 139 | mkdir($logDir, 0755, true); |
| 140 | 140 | } |
| 141 | 141 | |
@@ -202,7 +202,7 @@ discard block |
||
| 202 | 202 | $killswitch = $config['killswitch']['pp'] ?? false; |
| 203 | 203 | $pane = '0.1'; |
| 204 | 204 | |
| 205 | - if (! $enabled) { |
|
| 205 | + if (!$enabled) { |
|
| 206 | 206 | return $this->disablePane($pane, 'Update Binaries', 'disabled in settings'); |
| 207 | 207 | } |
| 208 | 208 | |
@@ -215,7 +215,7 @@ discard block |
||
| 215 | 215 | default => null, |
| 216 | 216 | }; |
| 217 | 217 | |
| 218 | - if (! $artisanCommand) { |
|
| 218 | + if (!$artisanCommand) { |
|
| 219 | 219 | return false; |
| 220 | 220 | } |
| 221 | 221 | |
@@ -237,7 +237,7 @@ discard block |
||
| 237 | 237 | $ppKillswitch = $config['killswitch']['pp'] ?? false; |
| 238 | 238 | $pane = '0.2'; |
| 239 | 239 | |
| 240 | - if (! $enabled) { |
|
| 240 | + if (!$enabled) { |
|
| 241 | 241 | return $this->disablePane($pane, 'Backfill', 'disabled in settings'); |
| 242 | 242 | } |
| 243 | 243 | |
@@ -251,7 +251,7 @@ discard block |
||
| 251 | 251 | default => null, |
| 252 | 252 | }; |
| 253 | 253 | |
| 254 | - if (! $artisanCommand) { |
|
| 254 | + if (!$artisanCommand) { |
|
| 255 | 255 | return false; |
| 256 | 256 | } |
| 257 | 257 | |
@@ -279,7 +279,7 @@ discard block |
||
| 279 | 279 | $enabled = (int) ($config['settings']['releases_run'] ?? 0); |
| 280 | 280 | $pane = $config['pane'] ?? '0.3'; |
| 281 | 281 | |
| 282 | - if (! $enabled) { |
|
| 282 | + if (!$enabled) { |
|
| 283 | 283 | return $this->disablePane($pane, 'Update Releases', 'disabled in settings'); |
| 284 | 284 | } |
| 285 | 285 | |
@@ -442,7 +442,7 @@ discard block |
||
| 442 | 442 | |
| 443 | 443 | // Trim whitespace and filter out empty values and '0' |
| 444 | 444 | $types = array_map('trim', $types); |
| 445 | - $types = array_filter($types, fn ($type) => ! empty($type) && $type !== '0'); |
|
| 445 | + $types = array_filter($types, fn ($type) => !empty($type) && $type !== '0'); |
|
| 446 | 446 | |
| 447 | 447 | // Re-index array to ensure sequential keys |
| 448 | 448 | $types = array_values($types); |
@@ -489,7 +489,7 @@ discard block |
||
| 489 | 489 | */ |
| 490 | 490 | protected function loadCrapState(string $file): array |
| 491 | 491 | { |
| 492 | - if (! file_exists($file)) { |
|
| 492 | + if (!file_exists($file)) { |
|
| 493 | 493 | return ['first_run' => true]; |
| 494 | 494 | } |
| 495 | 495 | |
@@ -505,7 +505,7 @@ discard block |
||
| 505 | 505 | protected function saveCrapState(string $file, array $state): void |
| 506 | 506 | { |
| 507 | 507 | $dir = dirname($file); |
| 508 | - if (! is_dir($dir)) { |
|
| 508 | + if (!is_dir($dir)) { |
|
| 509 | 509 | mkdir($dir, 0755, true); |
| 510 | 510 | } |
| 511 | 511 | |
@@ -664,7 +664,7 @@ discard block |
||
| 664 | 664 | return $this->disablePane($pane, 'Post-process Movies', 'disabled in settings'); |
| 665 | 665 | } |
| 666 | 666 | |
| 667 | - if (! $hasMoviesWork) { |
|
| 667 | + if (!$hasMoviesWork) { |
|
| 668 | 668 | return $this->disablePane($pane, 'Post-process Movies', 'no work available'); |
| 669 | 669 | } |
| 670 | 670 | |
@@ -702,7 +702,7 @@ discard block |
||
| 702 | 702 | || (int) ($runVar['counts']['now']['processconsole'] ?? 0) > 0 |
| 703 | 703 | || (int) ($runVar['counts']['now']['processgames'] ?? 0) > 0; |
| 704 | 704 | |
| 705 | - if (! $hasWork) { |
|
| 705 | + if (!$hasWork) { |
|
| 706 | 706 | return $this->disablePane($pane, 'Post-process Amazon', 'no music/books/games to process'); |
| 707 | 707 | } |
| 708 | 708 | |
@@ -766,7 +766,7 @@ discard block |
||
| 766 | 766 | |
| 767 | 767 | $hasWork = (int) ($runVar['counts']['now']['processxxx'] ?? 0) > 0; |
| 768 | 768 | |
| 769 | - if (! $hasWork) { |
|
| 769 | + if (!$hasWork) { |
|
| 770 | 770 | return $this->disablePane($pane, 'Post-process XXX', 'no XXX releases to process'); |
| 771 | 771 | } |
| 772 | 772 | |
@@ -40,7 +40,7 @@ discard block |
||
| 40 | 40 | protected function buildFullLayout(): bool |
| 41 | 41 | { |
| 42 | 42 | // Window 0: Monitor + Binaries + Backfill + Releases |
| 43 | - if (! $this->sessionManager->createSession('Monitor')) { |
|
| 43 | + if (!$this->sessionManager->createSession('Monitor')) { |
|
| 44 | 44 | return false; |
| 45 | 45 | } |
| 46 | 46 | |
@@ -93,7 +93,7 @@ discard block |
||
| 93 | 93 | protected function buildBasicLayout(): bool |
| 94 | 94 | { |
| 95 | 95 | // Window 0: Monitor + Releases |
| 96 | - if (! $this->sessionManager->createSession('Monitor')) { |
|
| 96 | + if (!$this->sessionManager->createSession('Monitor')) { |
|
| 97 | 97 | return false; |
| 98 | 98 | } |
| 99 | 99 | |
@@ -138,7 +138,7 @@ discard block |
||
| 138 | 138 | protected function buildStrippedLayout(): bool |
| 139 | 139 | { |
| 140 | 140 | // Window 0: Monitor + Sequential |
| 141 | - if (! $this->sessionManager->createSession('Monitor')) { |
|
| 141 | + if (!$this->sessionManager->createSession('Monitor')) { |
|
| 142 | 142 | return false; |
| 143 | 143 | } |
| 144 | 144 | |
@@ -242,7 +242,7 @@ discard block |
||
| 242 | 242 | $this->paneManager->createWindow($windowIndex, 'redis'); |
| 243 | 243 | |
| 244 | 244 | // Check if custom args provided for simple redis-cli output |
| 245 | - if (! empty($redisArgs) && $redisArgs !== 'NULL') { |
|
| 245 | + if (!empty($redisArgs) && $redisArgs !== 'NULL') { |
|
| 246 | 246 | $this->paneManager->respawnPane("{$windowIndex}.0", "watch -n{$refreshInterval} -c 'redis-cli -h {$redisHost} -p {$redisPort} {$redisArgs}'"); |
| 247 | 247 | } else { |
| 248 | 248 | // Use modern visual monitoring script |
@@ -47,7 +47,7 @@ |
||
| 47 | 47 | if (preg_match('/^(\d+)\.jpg$/', $filename, $matches)) { |
| 48 | 48 | $anidbid = $matches[1]; |
| 49 | 49 | $newFilename = "{$anidbid}-cover.jpg"; |
| 50 | - $newPath = $animeCoverPath . $newFilename; |
|
| 50 | + $newPath = $animeCoverPath.$newFilename; |
|
| 51 | 51 | |
| 52 | 52 | // Skip if new format already exists |
| 53 | 53 | if (file_exists($newPath)) { |
@@ -15,7 +15,7 @@ discard block |
||
| 15 | 15 | use Symfony\Component\Process\Process; |
| 16 | 16 | use Zip as ZipStream; |
| 17 | 17 | |
| 18 | -if (! function_exists('getRawHtml')) { |
|
| 18 | +if (!function_exists('getRawHtml')) { |
|
| 19 | 19 | /** |
| 20 | 20 | * @param bool $cookie |
| 21 | 21 | * @return bool|mixed|string |
@@ -106,7 +106,7 @@ discard block |
||
| 106 | 106 | } |
| 107 | 107 | } |
| 108 | 108 | |
| 109 | -if (! function_exists('makeFieldLinks')) { |
|
| 109 | +if (!function_exists('makeFieldLinks')) { |
|
| 110 | 110 | /** |
| 111 | 111 | * @return string |
| 112 | 112 | * |
@@ -136,7 +136,7 @@ discard block |
||
| 136 | 136 | } |
| 137 | 137 | } |
| 138 | 138 | |
| 139 | -if (! function_exists('getUserBrowseOrder')) { |
|
| 139 | +if (!function_exists('getUserBrowseOrder')) { |
|
| 140 | 140 | /** |
| 141 | 141 | * @param string $orderBy |
| 142 | 142 | */ |
@@ -162,7 +162,7 @@ discard block |
||
| 162 | 162 | } |
| 163 | 163 | } |
| 164 | 164 | |
| 165 | -if (! function_exists('getUserBrowseOrdering')) { |
|
| 165 | +if (!function_exists('getUserBrowseOrdering')) { |
|
| 166 | 166 | function getUserBrowseOrdering(): array |
| 167 | 167 | { |
| 168 | 168 | return [ |
@@ -192,7 +192,7 @@ discard block |
||
| 192 | 192 | } |
| 193 | 193 | } |
| 194 | 194 | |
| 195 | -if (! function_exists('getSimilarName')) { |
|
| 195 | +if (!function_exists('getSimilarName')) { |
|
| 196 | 196 | /** |
| 197 | 197 | * @param string $name |
| 198 | 198 | */ |
@@ -202,7 +202,7 @@ discard block |
||
| 202 | 202 | } |
| 203 | 203 | } |
| 204 | 204 | |
| 205 | -if (! function_exists('human_filesize')) { |
|
| 205 | +if (!function_exists('human_filesize')) { |
|
| 206 | 206 | /** |
| 207 | 207 | * @param int $decimals |
| 208 | 208 | */ |
@@ -215,7 +215,7 @@ discard block |
||
| 215 | 215 | } |
| 216 | 216 | } |
| 217 | 217 | |
| 218 | -if (! function_exists('bcdechex')) { |
|
| 218 | +if (!function_exists('bcdechex')) { |
|
| 219 | 219 | /** |
| 220 | 220 | * @return string |
| 221 | 221 | */ |
@@ -232,7 +232,7 @@ discard block |
||
| 232 | 232 | } |
| 233 | 233 | } |
| 234 | 234 | |
| 235 | -if (! function_exists('runCmd')) { |
|
| 235 | +if (!function_exists('runCmd')) { |
|
| 236 | 236 | /** |
| 237 | 237 | * Run CLI command. |
| 238 | 238 | * |
@@ -260,7 +260,7 @@ discard block |
||
| 260 | 260 | } |
| 261 | 261 | } |
| 262 | 262 | |
| 263 | -if (! function_exists('escapeString')) { |
|
| 263 | +if (!function_exists('escapeString')) { |
|
| 264 | 264 | |
| 265 | 265 | function escapeString($string): string |
| 266 | 266 | { |
@@ -268,7 +268,7 @@ discard block |
||
| 268 | 268 | } |
| 269 | 269 | } |
| 270 | 270 | |
| 271 | -if (! function_exists('realDuration')) { |
|
| 271 | +if (!function_exists('realDuration')) { |
|
| 272 | 272 | |
| 273 | 273 | function realDuration($milliseconds): string |
| 274 | 274 | { |
@@ -278,7 +278,7 @@ discard block |
||
| 278 | 278 | } |
| 279 | 279 | } |
| 280 | 280 | |
| 281 | -if (! function_exists('is_it_json')) { |
|
| 281 | +if (!function_exists('is_it_json')) { |
|
| 282 | 282 | /** |
| 283 | 283 | * @throws JsonException |
| 284 | 284 | */ |
@@ -293,7 +293,7 @@ discard block |
||
| 293 | 293 | } |
| 294 | 294 | } |
| 295 | 295 | |
| 296 | -if (! function_exists('getStreamingZip')) { |
|
| 296 | +if (!function_exists('getStreamingZip')) { |
|
| 297 | 297 | /** |
| 298 | 298 | * @throws Exception |
| 299 | 299 | */ |
@@ -320,7 +320,7 @@ discard block |
||
| 320 | 320 | } |
| 321 | 321 | } |
| 322 | 322 | |
| 323 | -if (! function_exists('release_flag')) { |
|
| 323 | +if (!function_exists('release_flag')) { |
|
| 324 | 324 | // Function inspired by c0r3@newznabforums adds country flags on the browse page. |
| 325 | 325 | /** |
| 326 | 326 | * @param string $text Text to match against. |
@@ -457,7 +457,7 @@ discard block |
||
| 457 | 457 | } |
| 458 | 458 | } |
| 459 | 459 | |
| 460 | -if (! function_exists('getReleaseCover')) { |
|
| 460 | +if (!function_exists('getReleaseCover')) { |
|
| 461 | 461 | /** |
| 462 | 462 | * Get the cover image URL for a release based on its type and ID |
| 463 | 463 | * |
@@ -470,7 +470,7 @@ discard block |
||
| 470 | 470 | $coverId = null; |
| 471 | 471 | |
| 472 | 472 | // Helper function to get value from object or array |
| 473 | - $getValue = function ($data, $key) { |
|
| 473 | + $getValue = function($data, $key) { |
|
| 474 | 474 | if (is_array($data)) { |
| 475 | 475 | return $data[$key] ?? null; |
| 476 | 476 | } elseif (is_object($data)) { |
@@ -489,25 +489,25 @@ discard block |
||
| 489 | 489 | $xxxinfo_id = $getValue($release, 'xxxinfo_id'); |
| 490 | 490 | $anidbid = $getValue($release, 'anidbid'); |
| 491 | 491 | |
| 492 | - if (! empty($imdbid) && $imdbid > 0) { |
|
| 492 | + if (!empty($imdbid) && $imdbid > 0) { |
|
| 493 | 493 | $coverType = 'movies'; |
| 494 | 494 | $coverId = str_pad($imdbid, 7, '0', STR_PAD_LEFT); |
| 495 | - } elseif (! empty($musicinfo_id)) { |
|
| 495 | + } elseif (!empty($musicinfo_id)) { |
|
| 496 | 496 | $coverType = 'music'; |
| 497 | 497 | $coverId = $musicinfo_id; |
| 498 | - } elseif (! empty($consoleinfo_id)) { |
|
| 498 | + } elseif (!empty($consoleinfo_id)) { |
|
| 499 | 499 | $coverType = 'console'; |
| 500 | 500 | $coverId = $consoleinfo_id; |
| 501 | - } elseif (! empty($bookinfo_id)) { |
|
| 501 | + } elseif (!empty($bookinfo_id)) { |
|
| 502 | 502 | $coverType = 'book'; |
| 503 | 503 | $coverId = $bookinfo_id; |
| 504 | - } elseif (! empty($gamesinfo_id)) { |
|
| 504 | + } elseif (!empty($gamesinfo_id)) { |
|
| 505 | 505 | $coverType = 'games'; |
| 506 | 506 | $coverId = $gamesinfo_id; |
| 507 | - } elseif (! empty($xxxinfo_id)) { |
|
| 507 | + } elseif (!empty($xxxinfo_id)) { |
|
| 508 | 508 | $coverType = 'xxx'; |
| 509 | 509 | $coverId = $xxxinfo_id; |
| 510 | - } elseif (! empty($anidbid) && $anidbid > 0) { |
|
| 510 | + } elseif (!empty($anidbid) && $anidbid > 0) { |
|
| 511 | 511 | $coverType = 'anime'; |
| 512 | 512 | $coverId = $anidbid; |
| 513 | 513 | } |
@@ -523,10 +523,10 @@ discard block |
||
| 523 | 523 | } |
| 524 | 524 | } |
| 525 | 525 | |
| 526 | -if (! function_exists('sanitize')) { |
|
| 526 | +if (!function_exists('sanitize')) { |
|
| 527 | 527 | function sanitize(array|string $phrases, array $doNotSanitize = []): string |
| 528 | 528 | { |
| 529 | - if (! is_array($phrases)) { |
|
| 529 | + if (!is_array($phrases)) { |
|
| 530 | 530 | $wordArray = explode(' ', str_replace('.', ' ', $phrases)); |
| 531 | 531 | } else { |
| 532 | 532 | $wordArray = $phrases; |
@@ -537,9 +537,9 @@ discard block |
||
| 537 | 537 | foreach ($wordArray as $words) { |
| 538 | 538 | $words = preg_split('/\s+/', $words); |
| 539 | 539 | foreach ($words as $st) { |
| 540 | - if (Str::startsWith($st, ['!', '+', '-', '?', '*']) && Str::length($st) > 1 && ! preg_match('/([!+?\-*]){2,}/', $st)) { |
|
| 540 | + if (Str::startsWith($st, ['!', '+', '-', '?', '*']) && Str::length($st) > 1 && !preg_match('/([!+?\-*]){2,}/', $st)) { |
|
| 541 | 541 | $str = $st; |
| 542 | - } elseif (Str::endsWith($st, ['+', '-', '?', '*']) && Str::length($st) > 1 && ! preg_match('/([!+?\-*]){2,}/', $st)) { |
|
| 542 | + } elseif (Str::endsWith($st, ['+', '-', '?', '*']) && Str::length($st) > 1 && !preg_match('/([!+?\-*]){2,}/', $st)) { |
|
| 543 | 543 | $str = $st; |
| 544 | 544 | } else { |
| 545 | 545 | $str = Sanitizer::escape($st, $doNotSanitize); |
@@ -554,7 +554,7 @@ discard block |
||
| 554 | 554 | } |
| 555 | 555 | } |
| 556 | 556 | |
| 557 | -if (! function_exists('formatBytes')) { |
|
| 557 | +if (!function_exists('formatBytes')) { |
|
| 558 | 558 | /** |
| 559 | 559 | * Format bytes into human-readable file size. |
| 560 | 560 | * |
@@ -573,7 +573,7 @@ discard block |
||
| 573 | 573 | } |
| 574 | 574 | } |
| 575 | 575 | |
| 576 | -if (! function_exists('csp_nonce')) { |
|
| 576 | +if (!function_exists('csp_nonce')) { |
|
| 577 | 577 | /** |
| 578 | 578 | * Generate a CSP nonce for inline scripts |
| 579 | 579 | * This should be stored in the request and reused across the request lifecycle |
@@ -590,7 +590,7 @@ discard block |
||
| 590 | 590 | } |
| 591 | 591 | } |
| 592 | 592 | |
| 593 | -if (! function_exists('userDate')) { |
|
| 593 | +if (!function_exists('userDate')) { |
|
| 594 | 594 | /** |
| 595 | 595 | * Format a date/time string according to the authenticated user's timezone |
| 596 | 596 | * |
@@ -622,7 +622,7 @@ discard block |
||
| 622 | 622 | } |
| 623 | 623 | } |
| 624 | 624 | |
| 625 | -if (! function_exists('userDateDiffForHumans')) { |
|
| 625 | +if (!function_exists('userDateDiffForHumans')) { |
|
| 626 | 626 | /** |
| 627 | 627 | * Format a date/time string as a human-readable diff according to the authenticated user's timezone |
| 628 | 628 | * |
@@ -653,7 +653,7 @@ discard block |
||
| 653 | 653 | } |
| 654 | 654 | } |
| 655 | 655 | |
| 656 | -if (! function_exists('getAvailableTimezones')) { |
|
| 656 | +if (!function_exists('getAvailableTimezones')) { |
|
| 657 | 657 | /** |
| 658 | 658 | * Get a list of available timezones grouped by region |
| 659 | 659 | * |
@@ -120,7 +120,7 @@ discard block |
||
| 120 | 120 | foreach ($chunks as $chunk) { |
| 121 | 121 | foreach ($chunk as $release) { |
| 122 | 122 | $searchname = $release->searchname ?? ''; |
| 123 | - $progressBar->setMessage("Processing: " . substr($searchname, 0, 50) . "..."); |
|
| 123 | + $progressBar->setMessage("Processing: ".substr($searchname, 0, 50)."..."); |
|
| 124 | 124 | |
| 125 | 125 | try { |
| 126 | 126 | // Extract clean title from searchname |
@@ -146,7 +146,7 @@ discard block |
||
| 146 | 146 | |
| 147 | 147 | // Check if we should skip (if not forcing and data exists) |
| 148 | 148 | // Don't skip if we're retrying failed releases (anidbid <= 0) |
| 149 | - if (! $force && ! $missingOnly && ! $retryFailed) { |
|
| 149 | + if (!$force && !$missingOnly && !$retryFailed) { |
|
| 150 | 150 | // Check if release already has complete AniList data |
| 151 | 151 | if ($release->anidbid > 0) { |
| 152 | 152 | $anidbInfo = DB::table('anidb_info') |
@@ -169,7 +169,7 @@ discard block |
||
| 169 | 169 | $this->enforceRateLimit(); |
| 170 | 170 | $searchResults = $populateAniList->searchAnime($cleanTitle, 1); |
| 171 | 171 | |
| 172 | - if (! $searchResults || empty($searchResults)) { |
|
| 172 | + if (!$searchResults || empty($searchResults)) { |
|
| 173 | 173 | // Try with spaces replaced for broader matching |
| 174 | 174 | $altTitle = preg_replace('/\s+/', ' ', $cleanTitle); |
| 175 | 175 | if ($altTitle !== $cleanTitle) { |
@@ -178,7 +178,7 @@ discard block |
||
| 178 | 178 | } |
| 179 | 179 | } |
| 180 | 180 | |
| 181 | - if (! $searchResults || empty($searchResults)) { |
|
| 181 | + if (!$searchResults || empty($searchResults)) { |
|
| 182 | 182 | $notFound++; |
| 183 | 183 | $failedSearchnames[] = [ |
| 184 | 184 | 'searchname' => $searchname, |
@@ -199,7 +199,7 @@ discard block |
||
| 199 | 199 | $anilistData = $searchResults[0]; |
| 200 | 200 | $anilistId = $anilistData['id'] ?? null; |
| 201 | 201 | |
| 202 | - if (! $anilistId) { |
|
| 202 | + if (!$anilistId) { |
|
| 203 | 203 | $notFound++; |
| 204 | 204 | $failedSearchnames[] = [ |
| 205 | 205 | 'searchname' => $searchname, |
@@ -227,7 +227,7 @@ discard block |
||
| 227 | 227 | ->where('anilist_id', $anilistId) |
| 228 | 228 | ->value('anidbid'); |
| 229 | 229 | |
| 230 | - if (! $anidbid) { |
|
| 230 | + if (!$anidbid) { |
|
| 231 | 231 | // Fallback: use anilist_id as anidbid |
| 232 | 232 | $anidbid = (int) $anilistId; |
| 233 | 233 | } |
@@ -271,7 +271,7 @@ discard block |
||
| 271 | 271 | $this->line(" - {$item['searchname']} -> {$cleanedTitle} ({$item['reason']})"); |
| 272 | 272 | } |
| 273 | 273 | if (count($failedSearchnames) > 10) { |
| 274 | - $this->line(" ... and " . (count($failedSearchnames) - 10) . " more."); |
|
| 274 | + $this->line(" ... and ".(count($failedSearchnames) - 10)." more."); |
|
| 275 | 275 | } |
| 276 | 276 | } |
| 277 | 277 | |
@@ -281,7 +281,7 @@ discard block |
||
| 281 | 281 | $failed++; |
| 282 | 282 | if ($this->getOutput()->isVerbose()) { |
| 283 | 283 | $this->newLine(); |
| 284 | - $this->error("Error processing release ID {$release->id}: " . $e->getMessage()); |
|
| 284 | + $this->error("Error processing release ID {$release->id}: ".$e->getMessage()); |
|
| 285 | 285 | } |
| 286 | 286 | } |
| 287 | 287 | |
@@ -319,8 +319,8 @@ discard block |
||
| 319 | 319 | foreach ($examples as $item) { |
| 320 | 320 | $cleanedTitle = $item['cleaned_title'] ?? '(extraction failed)'; |
| 321 | 321 | $rows[] = [ |
| 322 | - substr($item['searchname'], 0, 60) . (strlen($item['searchname']) > 60 ? '...' : ''), |
|
| 323 | - substr($cleanedTitle, 0, 40) . (strlen($cleanedTitle) > 40 ? '...' : ''), |
|
| 322 | + substr($item['searchname'], 0, 60).(strlen($item['searchname']) > 60 ? '...' : ''), |
|
| 323 | + substr($cleanedTitle, 0, 40).(strlen($cleanedTitle) > 40 ? '...' : ''), |
|
| 324 | 324 | $item['reason'], |
| 325 | 325 | ]; |
| 326 | 326 | } |
@@ -331,7 +331,7 @@ discard block |
||
| 331 | 331 | ); |
| 332 | 332 | |
| 333 | 333 | if (count($failedSearchnames) > 20) { |
| 334 | - $this->line("... and " . (count($failedSearchnames) - 20) . " more. Use --verbose to see all."); |
|
| 334 | + $this->line("... and ".(count($failedSearchnames) - 20)." more. Use --verbose to see all."); |
|
| 335 | 335 | } |
| 336 | 336 | } |
| 337 | 337 | |
@@ -467,7 +467,7 @@ discard block |
||
| 467 | 467 | $now = time(); |
| 468 | 468 | |
| 469 | 469 | // Clean old timestamps (older than 1 minute) |
| 470 | - $this->requestTimestamps = array_filter($this->requestTimestamps, function ($timestamp) use ($now) { |
|
| 470 | + $this->requestTimestamps = array_filter($this->requestTimestamps, function($timestamp) use ($now) { |
|
| 471 | 471 | return ($now - $timestamp) < 60; |
| 472 | 472 | }); |
| 473 | 473 | |
@@ -476,20 +476,20 @@ discard block |
||
| 476 | 476 | // If we're at or over the limit, wait |
| 477 | 477 | if ($requestCount >= self::RATE_LIMIT_PER_MINUTE) { |
| 478 | 478 | // Calculate wait time based on oldest request |
| 479 | - if (! empty($this->requestTimestamps)) { |
|
| 479 | + if (!empty($this->requestTimestamps)) { |
|
| 480 | 480 | $oldestRequest = min($this->requestTimestamps); |
| 481 | 481 | $waitTime = 60 - ($now - $oldestRequest) + 1; // +1 for safety margin |
| 482 | 482 | |
| 483 | 483 | if ($waitTime > 0 && $waitTime <= 60) { |
| 484 | 484 | if ($this->getOutput()->isVerbose()) { |
| 485 | 485 | $this->newLine(); |
| 486 | - $this->warn("Rate limit reached ({$requestCount}/" . self::RATE_LIMIT_PER_MINUTE . "). Waiting {$waitTime} seconds..."); |
|
| 486 | + $this->warn("Rate limit reached ({$requestCount}/".self::RATE_LIMIT_PER_MINUTE."). Waiting {$waitTime} seconds..."); |
|
| 487 | 487 | } |
| 488 | 488 | sleep($waitTime); |
| 489 | 489 | |
| 490 | 490 | // Clean timestamps again after waiting |
| 491 | 491 | $now = time(); |
| 492 | - $this->requestTimestamps = array_filter($this->requestTimestamps, function ($timestamp) use ($now) { |
|
| 492 | + $this->requestTimestamps = array_filter($this->requestTimestamps, function($timestamp) use ($now) { |
|
| 493 | 493 | return ($now - $timestamp) < 60; |
| 494 | 494 | }); |
| 495 | 495 | } |
@@ -501,7 +501,7 @@ discard block |
||
| 501 | 501 | $minDelay = 60.0 / self::RATE_LIMIT_PER_MINUTE; |
| 502 | 502 | |
| 503 | 503 | // If we have recent requests, ensure we wait at least the minimum delay |
| 504 | - if (! empty($this->requestTimestamps)) { |
|
| 504 | + if (!empty($this->requestTimestamps)) { |
|
| 505 | 505 | $lastRequest = max($this->requestTimestamps); |
| 506 | 506 | $timeSinceLastRequest = $now - $lastRequest; |
| 507 | 507 | |