@@ -15,14 +15,14 @@ |
||
| 15 | 15 | public function analyze(string $compressedData): array |
| 16 | 16 | { |
| 17 | 17 | $ok = $this->archiveInfo->setData($compressedData, true); |
| 18 | - if (! $ok) { |
|
| 18 | + if (!$ok) { |
|
| 19 | 19 | return ['ok' => false, 'error' => $this->archiveInfo->error ?: 'Unknown error', 'summary' => null, 'is_encrypted' => false]; |
| 20 | 20 | } |
| 21 | 21 | if ($this->archiveInfo->error !== '') { |
| 22 | 22 | return ['ok' => false, 'error' => $this->archiveInfo->error, 'summary' => null, 'is_encrypted' => false]; |
| 23 | 23 | } |
| 24 | 24 | $summary = $this->archiveInfo->getSummary(true); |
| 25 | - $isEncrypted = ! empty($this->archiveInfo->isEncrypted) || (isset($summary['is_encrypted']) && (int) $summary['is_encrypted'] !== 0); |
|
| 25 | + $isEncrypted = !empty($this->archiveInfo->isEncrypted) || (isset($summary['is_encrypted']) && (int) $summary['is_encrypted'] !== 0); |
|
| 26 | 26 | |
| 27 | 27 | return ['ok' => true, 'error' => null, 'summary' => $summary, 'is_encrypted' => $isEncrypted]; |
| 28 | 28 | } |
@@ -57,7 +57,7 @@ discard block |
||
| 57 | 57 | if (preg_match('/time=(\d{1,2}:\d{1,2}:)?(\d{1,2})\.(\d{1,2})\s*bitrate=/i', $time, $numbers)) { |
| 58 | 58 | if ($numbers[3] > 0) { |
| 59 | 59 | $numbers[3]--; |
| 60 | - } elseif (! empty($numbers[1])) { |
|
| 60 | + } elseif (!empty($numbers[1])) { |
|
| 61 | 61 | $numbers[2]--; |
| 62 | 62 | $numbers[3] = '99'; |
| 63 | 63 | } |
@@ -116,10 +116,10 @@ discard block |
||
| 116 | 116 | |
| 117 | 117 | public function createSampleImage(string $guid, string $fileLocation, string $tmpPath, bool $enabled, int $width = 800, int $height = 600): bool |
| 118 | 118 | { |
| 119 | - if (! $enabled) { |
|
| 119 | + if (!$enabled) { |
|
| 120 | 120 | return false; |
| 121 | 121 | } |
| 122 | - if (! File::isFile($fileLocation)) { |
|
| 122 | + if (!File::isFile($fileLocation)) { |
|
| 123 | 123 | return false; |
| 124 | 124 | } |
| 125 | 125 | $fileName = ($tmpPath.'zzzz'.random_int(5, 12).random_int(5, 12).'.jpg'); |
@@ -135,7 +135,7 @@ discard block |
||
| 135 | 135 | } |
| 136 | 136 | } |
| 137 | 137 | } |
| 138 | - if (! File::isFile($fileName)) { |
|
| 138 | + if (!File::isFile($fileName)) { |
|
| 139 | 139 | return false; |
| 140 | 140 | } |
| 141 | 141 | $saved = $this->releaseImage->saveImage( |
@@ -155,10 +155,10 @@ discard block |
||
| 155 | 155 | |
| 156 | 156 | public function createVideoSample(string $guid, string $fileLocation, string $tmpPath, bool $enabled, int $durationSeconds): bool |
| 157 | 157 | { |
| 158 | - if (! $enabled) { |
|
| 158 | + if (!$enabled) { |
|
| 159 | 159 | return false; |
| 160 | 160 | } |
| 161 | - if (! File::isFile($fileLocation)) { |
|
| 161 | + if (!File::isFile($fileLocation)) { |
|
| 162 | 162 | return false; |
| 163 | 163 | } |
| 164 | 164 | $fileName = ($tmpPath.'zzzz'.$guid.'.ogv'); |
@@ -194,7 +194,7 @@ discard block |
||
| 194 | 194 | } |
| 195 | 195 | } |
| 196 | 196 | } |
| 197 | - if (! $newMethod && $this->ffprobe->isValid($fileLocation)) { |
|
| 197 | + if (!$newMethod && $this->ffprobe->isValid($fileLocation)) { |
|
| 198 | 198 | try { |
| 199 | 199 | $video = $this->ffmpeg->open($fileLocation); |
| 200 | 200 | $videoSample = $video->clip(TimeCode::fromSeconds(0), TimeCode::fromSeconds($durationSeconds)); |
@@ -208,14 +208,14 @@ discard block |
||
| 208 | 208 | } |
| 209 | 209 | } |
| 210 | 210 | } |
| 211 | - if (! File::isFile($fileName)) { |
|
| 211 | + if (!File::isFile($fileName)) { |
|
| 212 | 212 | return false; |
| 213 | 213 | } |
| 214 | 214 | $newFile = ($this->releaseImage->vidSavePath.$guid.'.ogv'); |
| 215 | - if (! @File::move($fileName, $newFile)) { |
|
| 215 | + if (!@File::move($fileName, $newFile)) { |
|
| 216 | 216 | $copied = @File::copy($fileName, $newFile); |
| 217 | 217 | File::delete($fileName); |
| 218 | - if (! $copied) { |
|
| 218 | + if (!$copied) { |
|
| 219 | 219 | return false; |
| 220 | 220 | } |
| 221 | 221 | } |
@@ -227,7 +227,7 @@ discard block |
||
| 227 | 227 | |
| 228 | 228 | public function addVideoMediaInfo(int $releaseId, string $fileLocation): bool |
| 229 | 229 | { |
| 230 | - if (! File::isFile($fileLocation)) { |
|
| 230 | + if (!File::isFile($fileLocation)) { |
|
| 231 | 231 | return false; |
| 232 | 232 | } |
| 233 | 233 | try { |
@@ -252,8 +252,8 @@ discard block |
||
| 252 | 252 | string $audioSavePath |
| 253 | 253 | ): array { |
| 254 | 254 | // Mirror original behavior: defaults depend on flags, not file presence |
| 255 | - $retVal = ! $processAudioInfo ? true : false; |
|
| 256 | - $audVal = ! $processAudioSample ? true : false; |
|
| 255 | + $retVal = !$processAudioInfo ? true : false; |
|
| 256 | + $audVal = !$processAudioSample ? true : false; |
|
| 257 | 257 | |
| 258 | 258 | // Only proceed with file-dependent operations if file exists |
| 259 | 259 | if (File::isFile($fileLocation)) { |
@@ -265,7 +265,7 @@ discard block |
||
| 265 | 265 | if ($track->get('album') !== null && $track->get('performer') !== null) { |
| 266 | 266 | if ((int) $release->predb_id === 0 && config('nntmux.rename_music_mediainfo')) { |
| 267 | 267 | $ext = strtoupper($fileExtension); |
| 268 | - if (! empty($track->get('recorded_date')) && preg_match('/(?:19|20)\d\d/', $track->get('recorded_date')->getFullname(), $Year)) { |
|
| 268 | + if (!empty($track->get('recorded_date')) && preg_match('/(?:19|20)\d\d/', $track->get('recorded_date')->getFullname(), $Year)) { |
|
| 269 | 269 | $newName = $track->get('performer')->getFullName().' - '.$track->get('album')->getFullName().' ('.$Year[0].') '.$ext; |
| 270 | 270 | } else { |
| 271 | 271 | $newName = $track->get('performer')->getFullName().' - '.$track->get('album')->getFullName().' '.$ext; |
@@ -31,17 +31,17 @@ |
||
| 31 | 31 | $purgeDays = (int) config('nntmux.purge_inactive_users_days'); |
| 32 | 32 | $threshold = now()->subDays($purgeDays); |
| 33 | 33 | |
| 34 | - User::query()->where('roles_id', 1)->where(function ($q) use ($threshold) { |
|
| 35 | - $q->where(function ($qq) use ($threshold) { |
|
| 34 | + User::query()->where('roles_id', 1)->where(function($q) use ($threshold) { |
|
| 35 | + $q->where(function($qq) use ($threshold) { |
|
| 36 | 36 | $qq->whereNotNull('lastlogin')->where('lastlogin', '<', $threshold); |
| 37 | - })->orWhere(function ($qq) use ($threshold) { |
|
| 37 | + })->orWhere(function($qq) use ($threshold) { |
|
| 38 | 38 | // Only treat null lastlogin as inactive if the account is older than threshold |
| 39 | 39 | $qq->whereNull('lastlogin')->where('created_at', '<', $threshold); |
| 40 | 40 | }); |
| 41 | - })->where(function ($q) use ($threshold) { |
|
| 42 | - $q->where(function ($qq) use ($threshold) { |
|
| 41 | + })->where(function($q) use ($threshold) { |
|
| 42 | + $q->where(function($qq) use ($threshold) { |
|
| 43 | 43 | $qq->whereNotNull('apiaccess')->where('apiaccess', '<', $threshold); |
| 44 | - })->orWhere(function ($qq) use ($threshold) { |
|
| 44 | + })->orWhere(function($qq) use ($threshold) { |
|
| 45 | 45 | $qq->whereNull('apiaccess')->where('created_at', '<', $threshold); |
| 46 | 46 | }); |
| 47 | 47 | }); |
@@ -105,7 +105,7 @@ discard block |
||
| 105 | 105 | Category::TV_ROOT, |
| 106 | 106 | Category::TV_OTHER, |
| 107 | 107 | $this->releases->showPasswords(), |
| 108 | - ! empty($limit) ? sprintf(' LIMIT %d OFFSET 0', min($limit, 100)) : '' |
|
| 108 | + !empty($limit) ? sprintf(' LIMIT %d OFFSET 0', min($limit, 100)) : '' |
|
| 109 | 109 | ); |
| 110 | 110 | |
| 111 | 111 | $expiresAt = now()->addMinutes(config('nntmux.cache_expiry_medium')); |
@@ -133,7 +133,7 @@ discard block |
||
| 133 | 133 | Category::MOVIE_ROOT, |
| 134 | 134 | Category::MOVIE_OTHER, |
| 135 | 135 | $this->releases->showPasswords(), |
| 136 | - ! empty($limit) ? sprintf(' LIMIT %d OFFSET 0', min($limit, 100)) : '' |
|
| 136 | + !empty($limit) ? sprintf(' LIMIT %d OFFSET 0', min($limit, 100)) : '' |
|
| 137 | 137 | ); |
| 138 | 138 | |
| 139 | 139 | $expiresAt = now()->addMinutes(config('nntmux.cache_expiry_medium')); |
@@ -34,7 +34,7 @@ discard block |
||
| 34 | 34 | ->when($email !== '', fn ($q) => $q->where('users.email', 'like', "%$email%")) |
| 35 | 35 | ->when($host !== '', fn ($q) => $q->where('users.host', 'like', "%$host%")) |
| 36 | 36 | // Created date filters |
| 37 | - ->when($createdFrom !== '' || $createdTo !== '', function ($q) use ($createdFrom, $createdTo) { |
|
| 37 | + ->when($createdFrom !== '' || $createdTo !== '', function($q) use ($createdFrom, $createdTo) { |
|
| 38 | 38 | try { |
| 39 | 39 | if ($createdFrom !== '' && $createdTo !== '') { |
| 40 | 40 | $from = Carbon::createFromFormat('Y-m-d', $createdFrom)->startOfDay(); |
@@ -52,7 +52,7 @@ discard block |
||
| 52 | 52 | } |
| 53 | 53 | }) |
| 54 | 54 | // Deleted date filters |
| 55 | - ->when($deletedFrom !== '' || $deletedTo !== '', function ($q) use ($deletedFrom, $deletedTo) { |
|
| 55 | + ->when($deletedFrom !== '' || $deletedTo !== '', function($q) use ($deletedFrom, $deletedTo) { |
|
| 56 | 56 | try { |
| 57 | 57 | if ($deletedFrom !== '' && $deletedTo !== '') { |
| 58 | 58 | $from = Carbon::createFromFormat('Y-m-d', $deletedFrom)->startOfDay(); |
@@ -112,7 +112,7 @@ discard block |
||
| 112 | 112 | $action = $request->input('action'); |
| 113 | 113 | $userIds = $request->input('user_ids', []); |
| 114 | 114 | |
| 115 | - if (! in_array($action, ['restore', 'delete'], true) || empty($userIds) || ! is_array($userIds)) { |
|
| 115 | + if (!in_array($action, ['restore', 'delete'], true) || empty($userIds) || !is_array($userIds)) { |
|
| 116 | 116 | return redirect()->route('admin.deleted.users.index')->with('error', 'Invalid bulk action request.'); |
| 117 | 117 | } |
| 118 | 118 | |
@@ -37,7 +37,7 @@ discard block |
||
| 37 | 37 | $guid = ''; |
| 38 | 38 | |
| 39 | 39 | if ($idOpt !== null && $idOpt !== '') { |
| 40 | - if (! ctype_digit((string) $idOpt)) { |
|
| 40 | + if (!ctype_digit((string) $idOpt)) { |
|
| 41 | 41 | $this->error('Release ID must be numeric.'); |
| 42 | 42 | |
| 43 | 43 | return 5; // invalid id format |
@@ -83,7 +83,7 @@ discard block |
||
| 83 | 83 | $processor = new ProcessAdditional; |
| 84 | 84 | $ok = $processor->processSingleGuid($guid); |
| 85 | 85 | |
| 86 | - if (! $ok) { |
|
| 86 | + if (!$ok) { |
|
| 87 | 87 | $this->error('Processing failed or nothing processed for '.($idOpt ? 'ID '.$idOpt : 'GUID '.$guid).'.'); |
| 88 | 88 | |
| 89 | 89 | return 3; |
@@ -69,7 +69,7 @@ discard block |
||
| 69 | 69 | |
| 70 | 70 | // Add any advanced criteria |
| 71 | 71 | $advancedCriteria = $this->argument('criteria'); |
| 72 | - if (! empty($advancedCriteria)) { |
|
| 72 | + if (!empty($advancedCriteria)) { |
|
| 73 | 73 | $criteria = array_merge($criteria, $advancedCriteria); |
| 74 | 74 | } |
| 75 | 75 | |
@@ -90,14 +90,14 @@ discard block |
||
| 90 | 90 | } |
| 91 | 91 | |
| 92 | 92 | // Show confirmation unless force flag is set |
| 93 | - if (! $force) { |
|
| 93 | + if (!$force) { |
|
| 94 | 94 | $this->warn('You are about to delete releases matching the following criteria:'); |
| 95 | 95 | foreach ($criteria as $criterion) { |
| 96 | 96 | $this->line(" - {$criterion}"); |
| 97 | 97 | } |
| 98 | 98 | $this->newLine(); |
| 99 | 99 | |
| 100 | - if (! $this->confirm('Are you sure you want to proceed with the deletion?')) { |
|
| 100 | + if (!$this->confirm('Are you sure you want to proceed with the deletion?')) { |
|
| 101 | 101 | $this->info('Operation cancelled.'); |
| 102 | 102 | |
| 103 | 103 | return 0; |
@@ -109,7 +109,7 @@ discard block |
||
| 109 | 109 | |
| 110 | 110 | // Build the query to find releases to delete |
| 111 | 111 | $query = $this->buildQueryFromCriteria($criteria); |
| 112 | - if (! $query) { |
|
| 112 | + if (!$query) { |
|
| 113 | 113 | $this->error('Could not build query from criteria.'); |
| 114 | 114 | |
| 115 | 115 | return 1; |
@@ -189,7 +189,7 @@ discard block |
||
| 189 | 189 | // Get the query that would be executed |
| 190 | 190 | $query = $this->buildQueryFromCriteria($criteria); |
| 191 | 191 | |
| 192 | - if (! $query) { |
|
| 192 | + if (!$query) { |
|
| 193 | 193 | $this->error('Could not build query from criteria.'); |
| 194 | 194 | |
| 195 | 195 | return 1; |
@@ -348,13 +348,13 @@ discard block |
||
| 348 | 348 | switch ($modifier) { |
| 349 | 349 | case 'equals': |
| 350 | 350 | $group = DB::select('SELECT id FROM usenet_groups WHERE name = ?', [$value]); |
| 351 | - if (! empty($group)) { |
|
| 351 | + if (!empty($group)) { |
|
| 352 | 352 | return " AND groups_id = {$group[0]->id}"; |
| 353 | 353 | } |
| 354 | 354 | break; |
| 355 | 355 | case 'like': |
| 356 | 356 | $groups = DB::select('SELECT id FROM usenet_groups WHERE name LIKE ?', ['%'.str_replace(' ', '%', $value).'%']); |
| 357 | - if (! empty($groups)) { |
|
| 357 | + if (!empty($groups)) { |
|
| 358 | 358 | $ids = array_column($groups, 'id'); |
| 359 | 359 | |
| 360 | 360 | return ' AND groups_id IN ('.implode(',', $ids).')'; |
@@ -98,7 +98,7 @@ |
||
| 98 | 98 | |
| 99 | 99 | $query = clone $baseQuery; |
| 100 | 100 | |
| 101 | - $query->chunkById($chunkSize, function ($releases) use (&$processed, &$failed, &$remaining, $bar, $showOutput) { |
|
| 101 | + $query->chunkById($chunkSize, function($releases) use (&$processed, &$failed, &$remaining, $bar, $showOutput) { |
|
| 102 | 102 | foreach ($releases as $release) { |
| 103 | 103 | if ($remaining <= 0) { |
| 104 | 104 | return false; // stop chunking |
@@ -21,7 +21,7 @@ |
||
| 21 | 21 | public function reply($user, Thread $thread): bool |
| 22 | 22 | { |
| 23 | 23 | // Admins can reply even if locked; otherwise respect lock state |
| 24 | - return $user->hasRole('Admin') || (! $thread->locked); |
|
| 24 | + return $user->hasRole('Admin') || (!$thread->locked); |
|
| 25 | 25 | } |
| 26 | 26 | |
| 27 | 27 | public function delete($user, Thread $thread): bool |