@@ -68,17 +68,17 @@ |
||
| 68 | 68 | public function destroy(array|string $id): RedirectResponse |
| 69 | 69 | { |
| 70 | 70 | $ids = null; |
| 71 | - if (! empty($id) && ! \is_array($id)) { |
|
| 71 | + if (!empty($id) && !\is_array($id)) { |
|
| 72 | 72 | $ids = explode(',', $id); |
| 73 | 73 | } elseif (\is_array($id)) { |
| 74 | 74 | $ids = $id; |
| 75 | 75 | } |
| 76 | 76 | |
| 77 | - if (! empty($ids) && UsersRelease::delCartByGuid($ids, $this->userdata->id)) { |
|
| 77 | + if (!empty($ids) && UsersRelease::delCartByGuid($ids, $this->userdata->id)) { |
|
| 78 | 78 | return redirect()->to('/cart/index'); |
| 79 | 79 | } |
| 80 | 80 | |
| 81 | - if (! $id) { |
|
| 81 | + if (!$id) { |
|
| 82 | 82 | return redirect()->to('/cart/index'); |
| 83 | 83 | } |
| 84 | 84 | |
@@ -95,7 +95,7 @@ discard block |
||
| 95 | 95 | $user = $request->user(); |
| 96 | 96 | |
| 97 | 97 | // Only allow canceling if 2FA is not yet enabled |
| 98 | - if ($user->passwordSecurity()->exists() && ! $user->passwordSecurity->google2fa_enable) { |
|
| 98 | + if ($user->passwordSecurity()->exists() && !$user->passwordSecurity->google2fa_enable) { |
|
| 99 | 99 | $user->passwordSecurity()->delete(); |
| 100 | 100 | |
| 101 | 101 | return redirect()->to('profileedit#security')->with('success_2fa', '2FA setup has been cancelled.'); |
@@ -106,7 +106,7 @@ discard block |
||
| 106 | 106 | |
| 107 | 107 | public function disable2fa(Disable2faPasswordSecurityRequest $request): \Illuminate\Routing\Redirector|RedirectResponse|\Illuminate\Contracts\Foundation\Application |
| 108 | 108 | { |
| 109 | - if (! (Hash::check($request->get('current-password'), $request->user()->password))) { |
|
| 109 | + if (!(Hash::check($request->get('current-password'), $request->user()->password))) { |
|
| 110 | 110 | // Password doesn't match |
| 111 | 111 | if ($request->has('redirect_to_profile') || $request->has('from_profile')) { |
| 112 | 112 | return redirect()->to('profileedit#security')->with('error_2fa', 'Your password does not match with your account password. Please try again.'); |
@@ -139,7 +139,7 @@ discard block |
||
| 139 | 139 | ]); |
| 140 | 140 | |
| 141 | 141 | // Get the user ID from session |
| 142 | - if (! $request->session()->has('2fa:user:id')) { |
|
| 142 | + if (!$request->session()->has('2fa:user:id')) { |
|
| 143 | 143 | return redirect()->route('login') |
| 144 | 144 | ->with('message', 'The two-factor authentication session has expired. Please login again.') |
| 145 | 145 | ->with('message_type', 'danger'); |
@@ -148,7 +148,7 @@ discard block |
||
| 148 | 148 | $userId = $request->session()->get('2fa:user:id'); |
| 149 | 149 | $user = \App\Models\User::find($userId); |
| 150 | 150 | |
| 151 | - if (! $user || ! $user->passwordSecurity) { |
|
| 151 | + if (!$user || !$user->passwordSecurity) { |
|
| 152 | 152 | $request->session()->forget('2fa:user:id'); |
| 153 | 153 | |
| 154 | 154 | return redirect()->route('login') |
@@ -162,7 +162,7 @@ discard block |
||
| 162 | 162 | $request->input('one_time_password') |
| 163 | 163 | ); |
| 164 | 164 | |
| 165 | - if (! $valid) { |
|
| 165 | + if (!$valid) { |
|
| 166 | 166 | return redirect()->route('2fa.verify') |
| 167 | 167 | ->with('message', 'Invalid authentication code. Please try again.') |
| 168 | 168 | ->with('message_type', 'danger'); |
@@ -239,7 +239,7 @@ discard block |
||
| 239 | 239 | public function getVerify2fa(Request $request) |
| 240 | 240 | { |
| 241 | 241 | // Check if user ID is stored in the session |
| 242 | - if (! $request->session()->has('2fa:user:id')) { |
|
| 242 | + if (!$request->session()->has('2fa:user:id')) { |
|
| 243 | 243 | return redirect()->route('login') |
| 244 | 244 | ->withErrors(['msg' => 'The two-factor authentication session has expired. Please login again.']); |
| 245 | 245 | } |
@@ -249,7 +249,7 @@ discard block |
||
| 249 | 249 | |
| 250 | 250 | // Get the user |
| 251 | 251 | $user = \App\Models\User::find($userId); |
| 252 | - if (! $user) { |
|
| 252 | + if (!$user) { |
|
| 253 | 253 | $request->session()->forget('2fa:user:id'); |
| 254 | 254 | |
| 255 | 255 | return redirect()->route('login') |
@@ -279,7 +279,7 @@ discard block |
||
| 279 | 279 | 'current-password' => 'required', |
| 280 | 280 | ]); |
| 281 | 281 | |
| 282 | - if (! (Hash::check($request->get('current-password'), $request->user()->password))) { |
|
| 282 | + if (!(Hash::check($request->get('current-password'), $request->user()->password))) { |
|
| 283 | 283 | return redirect()->to('profileedit#security')->with('error_2fa', 'Your password does not match with your account password. Please try again.'); |
| 284 | 284 | } |
| 285 | 285 | |
@@ -30,7 +30,7 @@ discard block |
||
| 30 | 30 | $privateProfiles = config('nntmux_settings.private_profiles'); |
| 31 | 31 | $publicView = false; |
| 32 | 32 | |
| 33 | - if ($privileged || ! $privateProfiles) { |
|
| 33 | + if ($privileged || !$privateProfiles) { |
|
| 34 | 34 | $altID = ($request->has('id') && (int) $request->input('id') >= 0) ? (int) $request->input('id') : false; |
| 35 | 35 | $altUsername = ($request->has('name') && $request->input('name') !== '') ? $request->input('name') : false; |
| 36 | 36 | |
@@ -57,7 +57,7 @@ discard block |
||
| 57 | 57 | } |
| 58 | 58 | |
| 59 | 59 | // Check if the user selected a theme. |
| 60 | - if (! isset($this->userdata->style) || $this->userdata->style === 'None') { |
|
| 60 | + if (!isset($this->userdata->style) || $this->userdata->style === 'None') { |
|
| 61 | 61 | $this->userdata->style = 'Using the admin selected theme.'; |
| 62 | 62 | } |
| 63 | 63 | |
@@ -91,7 +91,7 @@ discard block |
||
| 91 | 91 | $action = $request->input('action') ?? 'view'; |
| 92 | 92 | |
| 93 | 93 | $userid = $this->userdata->id; |
| 94 | - if (! $this->userdata) { |
|
| 94 | + if (!$this->userdata) { |
|
| 95 | 95 | $this->show404('No such user!'); |
| 96 | 96 | } |
| 97 | 97 | |
@@ -101,7 +101,7 @@ discard block |
||
| 101 | 101 | |
| 102 | 102 | // Generate 2FA QR code URL if 2FA is set up but not enabled |
| 103 | 103 | $google2fa_url = ''; |
| 104 | - if ($this->userdata->passwordSecurity()->exists() && ! $this->userdata->passwordSecurity->google2fa_enable) { |
|
| 104 | + if ($this->userdata->passwordSecurity()->exists() && !$this->userdata->passwordSecurity->google2fa_enable) { |
|
| 105 | 105 | $google2fa_url = \Google2FA::getQRCodeInline( |
| 106 | 106 | config('app.name'), |
| 107 | 107 | $this->userdata->email, |
@@ -152,7 +152,7 @@ discard block |
||
| 152 | 152 | |
| 153 | 153 | // Handle Console permission |
| 154 | 154 | if ($request->has('viewconsole')) { |
| 155 | - if (! $this->userdata->hasDirectPermission('view console')) { |
|
| 155 | + if (!$this->userdata->hasDirectPermission('view console')) { |
|
| 156 | 156 | $this->userdata->givePermissionTo('view console'); |
| 157 | 157 | } |
| 158 | 158 | } else { |
@@ -163,7 +163,7 @@ discard block |
||
| 163 | 163 | |
| 164 | 164 | // Handle Movies permission |
| 165 | 165 | if ($request->has('viewmovies')) { |
| 166 | - if (! $this->userdata->hasDirectPermission('view movies')) { |
|
| 166 | + if (!$this->userdata->hasDirectPermission('view movies')) { |
|
| 167 | 167 | $this->userdata->givePermissionTo('view movies'); |
| 168 | 168 | } |
| 169 | 169 | } else { |
@@ -174,7 +174,7 @@ discard block |
||
| 174 | 174 | |
| 175 | 175 | // Handle Audio permission |
| 176 | 176 | if ($request->has('viewaudio')) { |
| 177 | - if (! $this->userdata->hasDirectPermission('view audio')) { |
|
| 177 | + if (!$this->userdata->hasDirectPermission('view audio')) { |
|
| 178 | 178 | $this->userdata->givePermissionTo('view audio'); |
| 179 | 179 | } |
| 180 | 180 | } else { |
@@ -185,7 +185,7 @@ discard block |
||
| 185 | 185 | |
| 186 | 186 | // Handle PC/Games permission |
| 187 | 187 | if ($request->has('viewpc')) { |
| 188 | - if (! $this->userdata->hasDirectPermission('view pc')) { |
|
| 188 | + if (!$this->userdata->hasDirectPermission('view pc')) { |
|
| 189 | 189 | $this->userdata->givePermissionTo('view pc'); |
| 190 | 190 | } |
| 191 | 191 | } else { |
@@ -196,7 +196,7 @@ discard block |
||
| 196 | 196 | |
| 197 | 197 | // Handle TV permission |
| 198 | 198 | if ($request->has('viewtv')) { |
| 199 | - if (! $this->userdata->hasDirectPermission('view tv')) { |
|
| 199 | + if (!$this->userdata->hasDirectPermission('view tv')) { |
|
| 200 | 200 | $this->userdata->givePermissionTo('view tv'); |
| 201 | 201 | } |
| 202 | 202 | } else { |
@@ -207,7 +207,7 @@ discard block |
||
| 207 | 207 | |
| 208 | 208 | // Handle Adult permission |
| 209 | 209 | if ($request->has('viewadult')) { |
| 210 | - if (! $this->userdata->hasDirectPermission('view adult')) { |
|
| 210 | + if (!$this->userdata->hasDirectPermission('view adult')) { |
|
| 211 | 211 | $this->userdata->givePermissionTo('view adult'); |
| 212 | 212 | } |
| 213 | 213 | } else { |
@@ -218,7 +218,7 @@ discard block |
||
| 218 | 218 | |
| 219 | 219 | // Handle Books permission |
| 220 | 220 | if ($request->has('viewbooks')) { |
| 221 | - if (! $this->userdata->hasDirectPermission('view books')) { |
|
| 221 | + if (!$this->userdata->hasDirectPermission('view books')) { |
|
| 222 | 222 | $this->userdata->givePermissionTo('view books'); |
| 223 | 223 | } |
| 224 | 224 | } else { |
@@ -229,7 +229,7 @@ discard block |
||
| 229 | 229 | |
| 230 | 230 | // Handle Other permission |
| 231 | 231 | if ($request->has('viewother')) { |
| 232 | - if (! $this->userdata->hasDirectPermission('view other')) { |
|
| 232 | + if (!$this->userdata->hasDirectPermission('view other')) { |
|
| 233 | 233 | $this->userdata->givePermissionTo('view other'); |
| 234 | 234 | } |
| 235 | 235 | } else { |
@@ -238,12 +238,12 @@ discard block |
||
| 238 | 238 | } |
| 239 | 239 | } |
| 240 | 240 | |
| 241 | - if ($request->has('password') && ! empty($request->input('password'))) { |
|
| 241 | + if ($request->has('password') && !empty($request->input('password'))) { |
|
| 242 | 242 | User::updatePassword($userid, $request->input('password')); |
| 243 | 243 | } |
| 244 | 244 | |
| 245 | - if (! $this->userdata->hasRole('Admin')) { |
|
| 246 | - if (! empty($request->input('email')) && $this->userdata->email !== $request->input('email')) { |
|
| 245 | + if (!$this->userdata->hasRole('Admin')) { |
|
| 246 | + if (!empty($request->input('email')) && $this->userdata->email !== $request->input('email')) { |
|
| 247 | 247 | $this->userdata->email = $request->input('email'); |
| 248 | 248 | |
| 249 | 249 | $verify_user = $this->userdata; |
@@ -294,7 +294,7 @@ discard block |
||
| 294 | 294 | { |
| 295 | 295 | $userId = $request->input('id'); |
| 296 | 296 | |
| 297 | - if ($userId !== null && (int) $userId === $this->userdata->id && ! $this->userdata->hasRole('Admin')) { |
|
| 297 | + if ($userId !== null && (int) $userId === $this->userdata->id && !$this->userdata->hasRole('Admin')) { |
|
| 298 | 298 | $user = User::find($userId); |
| 299 | 299 | SendAccountDeletedEmail::dispatch($user); |
| 300 | 300 | Auth::logout(); |
@@ -315,7 +315,7 @@ discard block |
||
| 315 | 315 | { |
| 316 | 316 | $user = Auth::user(); |
| 317 | 317 | |
| 318 | - if (! $user) { |
|
| 318 | + if (!$user) { |
|
| 319 | 319 | return response()->json(['success' => false, 'message' => 'User not authenticated'], 401); |
| 320 | 320 | } |
| 321 | 321 | |
@@ -20,7 +20,7 @@ discard block |
||
| 20 | 20 | { |
| 21 | 21 | |
| 22 | 22 | // If guid is passed as URL parameter, merge it into request as 'id' |
| 23 | - if ($guid !== null && ! $request->has('id')) { |
|
| 23 | + if ($guid !== null && !$request->has('id')) { |
|
| 24 | 24 | $request->merge(['id' => $guid]); |
| 25 | 25 | } |
| 26 | 26 | |
@@ -38,7 +38,7 @@ discard block |
||
| 38 | 38 | } |
| 39 | 39 | |
| 40 | 40 | $res = User::getByRssToken($request->input('r')); |
| 41 | - if (! $res) { |
|
| 41 | + if (!$res) { |
|
| 42 | 42 | return Utility::showApiError(100); |
| 43 | 43 | } |
| 44 | 44 | |
@@ -56,7 +56,7 @@ discard block |
||
| 56 | 56 | return Utility::showApiError(501); |
| 57 | 57 | } |
| 58 | 58 | |
| 59 | - if (! $request->input('id')) { |
|
| 59 | + if (!$request->input('id')) { |
|
| 60 | 60 | return Utility::showApiError(200, 'Parameter id is required'); |
| 61 | 61 | } |
| 62 | 62 | |
@@ -90,7 +90,7 @@ discard block |
||
| 90 | 90 | |
| 91 | 91 | $nzbPath = (new NZB)->getNZBPath($request->input('id')); |
| 92 | 92 | |
| 93 | - if (! File::exists($nzbPath)) { |
|
| 93 | + if (!File::exists($nzbPath)) { |
|
| 94 | 94 | return Utility::showApiError(300, 'NZB file not found!'); |
| 95 | 95 | } |
| 96 | 96 | |
@@ -117,9 +117,9 @@ discard block |
||
| 117 | 117 | 'X-DNZB-Details' => url('/details/'.$request->input('id')), |
| 118 | 118 | ]; |
| 119 | 119 | |
| 120 | - if (! empty($relData['imdbid']) && $relData['imdbid'] > 0) { |
|
| 120 | + if (!empty($relData['imdbid']) && $relData['imdbid'] > 0) { |
|
| 121 | 121 | $headers['X-DNZB-MoreInfo'] = 'http://www.imdb.com/title/tt'.$relData['imdbid']; |
| 122 | - } elseif (! empty($relData['tvdb']) && $relData['tvdb'] > 0) { |
|
| 122 | + } elseif (!empty($relData['tvdb']) && $relData['tvdb'] > 0) { |
|
| 123 | 123 | $headers['X-DNZB-MoreInfo'] = 'http://www.thetvdb.com/?tab=series&id='.$relData['tvdb']; |
| 124 | 124 | } |
| 125 | 125 | |
@@ -134,15 +134,15 @@ discard block |
||
| 134 | 134 | $cleanName = str_replace([',', ' ', '/', '\\'], '_', $relData['searchname']); |
| 135 | 135 | |
| 136 | 136 | // Stream the file content |
| 137 | - return response()->streamDownload(function () use ($nzbPath) { |
|
| 137 | + return response()->streamDownload(function() use ($nzbPath) { |
|
| 138 | 138 | $bufferSize = 1000000; // 1 MB chunks |
| 139 | 139 | $gz = gzopen($nzbPath, 'rb'); |
| 140 | 140 | |
| 141 | - if (! $gz) { |
|
| 141 | + if (!$gz) { |
|
| 142 | 142 | throw new RuntimeException('Failed to open gzipped file for streaming.'); |
| 143 | 143 | } |
| 144 | 144 | |
| 145 | - while (! gzeof($gz)) { |
|
| 145 | + while (!gzeof($gz)) { |
|
| 146 | 146 | echo gzread($gz, $bufferSize); |
| 147 | 147 | flush(); // Ensure chunks are sent immediately |
| 148 | 148 | } |
@@ -12,7 +12,7 @@ discard block |
||
| 12 | 12 | */ |
| 13 | 13 | public function contact(ContactContactURequest $request) |
| 14 | 14 | { |
| 15 | - if (config('captcha.enabled') === true && (! empty(config('captcha.secret')) && ! empty(config('captcha.sitekey')))) { |
|
| 15 | + if (config('captcha.enabled') === true && (!empty(config('captcha.secret')) && !empty(config('captcha.sitekey')))) { |
|
| 16 | 16 | $this->validate($request, [ |
| 17 | 17 | 'g-recaptcha-response' => 'required|captcha', |
| 18 | 18 | ]); |
@@ -31,7 +31,7 @@ discard block |
||
| 31 | 31 | } |
| 32 | 32 | } |
| 33 | 33 | |
| 34 | - if (! preg_match("/\n/i", $request->input('useremail'))) { |
|
| 34 | + if (!preg_match("/\n/i", $request->input('useremail'))) { |
|
| 35 | 35 | SendContactUsEmail::dispatch($email, $mailTo, $mailBody)->onQueue('contactemail'); |
| 36 | 36 | } |
| 37 | 37 | $msg = "<h2 style='text-align:center;'>Thank you for getting in touch with ".config('app.name').'.</h2>'; |
@@ -35,7 +35,7 @@ discard block |
||
| 35 | 35 | $this->viewData['meta_description'] = 'Manage your sent invitations and send new invitations to friends'; |
| 36 | 36 | $this->viewData['status'] = $status; |
| 37 | 37 | |
| 38 | - if (! $inviteMode) { |
|
| 38 | + if (!$inviteMode) { |
|
| 39 | 39 | // Invitations disabled: show informational message only, no queries. |
| 40 | 40 | $this->viewData['invite_mode'] = false; |
| 41 | 41 | $this->viewData['stats'] = []; |
@@ -95,7 +95,7 @@ discard block |
||
| 95 | 95 | $this->viewData['meta_keywords'] = 'invitation,invite,send,new,user'; |
| 96 | 96 | $this->viewData['meta_description'] = 'Send a new invitation to invite someone to join the site'; |
| 97 | 97 | |
| 98 | - if (! $inviteMode) { |
|
| 98 | + if (!$inviteMode) { |
|
| 99 | 99 | $this->viewData['invite_mode'] = false; |
| 100 | 100 | $this->viewData['meta_title'] = 'Invitations Disabled'; |
| 101 | 101 | $this->viewData['meta_keywords'] = 'invitations,disabled'; |
@@ -271,7 +271,7 @@ discard block |
||
| 271 | 271 | public function cleanup(): JsonResponse |
| 272 | 272 | { |
| 273 | 273 | // Check if user is admin |
| 274 | - if (! auth()->user()->hasRole('admin')) { |
|
| 274 | + if (!auth()->user()->hasRole('admin')) { |
|
| 275 | 275 | abort(403, 'Unauthorized'); |
| 276 | 276 | } |
| 277 | 277 | |
@@ -17,13 +17,13 @@ |
||
| 17 | 17 | $nzb = new NZB; |
| 18 | 18 | |
| 19 | 19 | $rel = Release::getByGuid($guid); |
| 20 | - if (! $rel) { |
|
| 20 | + if (!$rel) { |
|
| 21 | 21 | return response()->json(['error' => 'Release not found'], 404); |
| 22 | 22 | } |
| 23 | 23 | |
| 24 | 24 | $nzbpath = $nzb->NZBPath($guid); |
| 25 | 25 | |
| 26 | - if (! file_exists($nzbpath)) { |
|
| 26 | + if (!file_exists($nzbpath)) { |
|
| 27 | 27 | return response()->json(['error' => 'NZB file not found'], 404); |
| 28 | 28 | } |
| 29 | 29 | |
@@ -53,7 +53,7 @@ discard block |
||
| 53 | 53 | |
| 54 | 54 | $maxwords = 50; |
| 55 | 55 | foreach ($results as $result) { |
| 56 | - if (! empty($result->review)) { |
|
| 56 | + if (!empty($result->review)) { |
|
| 57 | 57 | $words = explode(' ', $result->review); |
| 58 | 58 | if (\count($words) > $maxwords) { |
| 59 | 59 | $newwords = \array_slice($words, 0, $maxwords); |
@@ -63,8 +63,8 @@ discard block |
||
| 63 | 63 | $consoles[] = $result; |
| 64 | 64 | } |
| 65 | 65 | |
| 66 | - $platform = ($request->has('platform') && ! empty($request->input('platform'))) ? stripslashes($request->input('platform')) : ''; |
|
| 67 | - $title = ($request->has('title') && ! empty($request->input('title'))) ? stripslashes($request->input('title')) : ''; |
|
| 66 | + $platform = ($request->has('platform') && !empty($request->input('platform'))) ? stripslashes($request->input('platform')) : ''; |
|
| 67 | + $title = ($request->has('title') && !empty($request->input('title'))) ? stripslashes($request->input('title')) : ''; |
|
| 68 | 68 | |
| 69 | 69 | $genres = $gen->getGenres(Genres::CONSOLE_TYPE, true); |
| 70 | 70 | $tmpgnr = []; |
@@ -82,9 +82,9 @@ |
||
| 82 | 82 | return $movie; |
| 83 | 83 | } |
| 84 | 84 | $sql = self::query()->select('*'); |
| 85 | - if (! empty($search)) { |
|
| 85 | + if (!empty($search)) { |
|
| 86 | 86 | // Search by both title and IMDB ID |
| 87 | - $sql->where(function ($query) use ($search) { |
|
| 87 | + $sql->where(function($query) use ($search) { |
|
| 88 | 88 | $query->whereLike('title', '%'.$search.'%') |
| 89 | 89 | ->orWhere('imdbid', $search); |
| 90 | 90 | }); |