@@ -34,7 +34,7 @@ |
||
34 | 34 | $limit = $this->argument('limit'); |
35 | 35 | |
36 | 36 | // Validate the limit argument |
37 | - if ($limit !== 'full' && ! is_numeric($limit)) { |
|
37 | + if ($limit !== 'full' && !is_numeric($limit)) { |
|
38 | 38 | $this->error('Limit must be "full" or a numeric value.'); |
39 | 39 | |
40 | 40 | return 1; |
@@ -114,7 +114,7 @@ |
||
114 | 114 | switch ($errorCode) { |
115 | 115 | case UPLOAD_ERR_INI_SIZE: |
116 | 116 | return "The file '{$fileName}' exceeds the upload_max_filesize directive (". |
117 | - ini_get('upload_max_filesize').').'; |
|
117 | + ini_get('upload_max_filesize').').'; |
|
118 | 118 | case UPLOAD_ERR_FORM_SIZE: |
119 | 119 | return "The file '{$fileName}' exceeds the MAX_FILE_SIZE directive specified in the HTML form."; |
120 | 120 | case UPLOAD_ERR_PARTIAL: |
@@ -26,7 +26,7 @@ discard block |
||
26 | 26 | $deleteNZB = true; |
27 | 27 | |
28 | 28 | // Get the list of NZB files from php /tmp folder if nzb files were uploaded. |
29 | - if (isset($_FILES['uploadedfiles']) && ! empty($_FILES['uploadedfiles']['name'][0])) { |
|
29 | + if (isset($_FILES['uploadedfiles']) && !empty($_FILES['uploadedfiles']['name'][0])) { |
|
30 | 30 | $maxFileSize = min( |
31 | 31 | $this->convertToBytes(ini_get('upload_max_filesize')), |
32 | 32 | $this->convertToBytes(ini_get('post_max_size')) |
@@ -54,7 +54,7 @@ discard block |
||
54 | 54 | |
55 | 55 | // Get the path the user set in the browser if he put one. |
56 | 56 | $path = ($request->has('folder') ? $request->input('folder') : ''); |
57 | - if (! Str::endsWith($path, '/')) { |
|
57 | + if (!Str::endsWith($path, '/')) { |
|
58 | 58 | $path .= '/'; |
59 | 59 | } |
60 | 60 |
@@ -63,7 +63,7 @@ discard block |
||
63 | 63 | $manticore = new ManticoreSearch; |
64 | 64 | $manticore->truncateRTIndex(Arr::wrap('releases_rt')); |
65 | 65 | $total = Release::count(); |
66 | - if (! $total) { |
|
66 | + if (!$total) { |
|
67 | 67 | $this->warn('Releases table is empty. Nothing to do.'); |
68 | 68 | exit(); |
69 | 69 | } |
@@ -83,7 +83,7 @@ discard block |
||
83 | 83 | ->select(['releases.id', 'releases.name', 'releases.searchname', 'releases.fromname', 'releases.categories_id']) |
84 | 84 | ->selectRaw('IFNULL(GROUP_CONCAT(release_files.name SEPARATOR " "),"") filename') |
85 | 85 | ->groupBy('id') |
86 | - ->chunk($max, function ($releases) use ($manticore, $bar) { |
|
86 | + ->chunk($max, function($releases) use ($manticore, $bar) { |
|
87 | 87 | $data = []; |
88 | 88 | foreach ($releases as $r) { |
89 | 89 | $data[] = [ |
@@ -97,7 +97,7 @@ discard block |
||
97 | 97 | ]; |
98 | 98 | $bar->advance(); |
99 | 99 | } |
100 | - if (! empty($data)) { |
|
100 | + if (!empty($data)) { |
|
101 | 101 | $manticore->manticoreSearch->table('releases_rt')->replaceDocuments($data); |
102 | 102 | } |
103 | 103 | }); |
@@ -114,7 +114,7 @@ discard block |
||
114 | 114 | $manticore->truncateRTIndex(['predb_rt']); |
115 | 115 | |
116 | 116 | $total = Predb::count(); |
117 | - if (! $total) { |
|
117 | + if (!$total) { |
|
118 | 118 | $this->warn('PreDB table is empty. Nothing to do.'); |
119 | 119 | exit(); |
120 | 120 | } |
@@ -131,7 +131,7 @@ discard block |
||
131 | 131 | ->select(['id', 'title', 'filename', 'source']) |
132 | 132 | ->groupBy('id') |
133 | 133 | ->orderBy('id') |
134 | - ->chunk($max, function ($pre) use ($manticore, $bar) { |
|
134 | + ->chunk($max, function($pre) use ($manticore, $bar) { |
|
135 | 135 | $data = []; |
136 | 136 | foreach ($pre as $p) { |
137 | 137 | $data[] = [ |
@@ -143,7 +143,7 @@ discard block |
||
143 | 143 | ]; |
144 | 144 | $bar->advance(); |
145 | 145 | } |
146 | - if (! empty($data)) { |
|
146 | + if (!empty($data)) { |
|
147 | 147 | $manticore->manticoreSearch->table('predb_rt')->replaceDocuments($data); |
148 | 148 | } |
149 | 149 | }); |
@@ -157,7 +157,7 @@ discard block |
||
157 | 157 | $data = ['body' => []]; |
158 | 158 | $elastic = new ElasticSearchSiteSearch; |
159 | 159 | $total = Release::count(); |
160 | - if (! $total) { |
|
160 | + if (!$total) { |
|
161 | 161 | $this->warn('Could not get database information for releases table.'); |
162 | 162 | exit(); |
163 | 163 | } |
@@ -175,7 +175,7 @@ discard block |
||
175 | 175 | ->select(['releases.id', 'releases.name', 'releases.searchname', 'releases.fromname', 'releases.categories_id', 'releases.postdate']) |
176 | 176 | ->selectRaw('IFNULL(GROUP_CONCAT(release_files.name SEPARATOR " "),"") filename') |
177 | 177 | ->groupBy('id') |
178 | - ->chunk($max, function ($releases) use ($bar, $data) { |
|
178 | + ->chunk($max, function($releases) use ($bar, $data) { |
|
179 | 179 | foreach ($releases as $r) { |
180 | 180 | $searchName = str_replace(['.', '-'], ' ', $r->searchname); |
181 | 181 | $data['body'][] = [ |
@@ -208,7 +208,7 @@ discard block |
||
208 | 208 | $data = ['body' => []]; |
209 | 209 | $elastic = new ElasticSearchSiteSearch; |
210 | 210 | $total = Predb::count(); |
211 | - if (! $total) { |
|
211 | + if (!$total) { |
|
212 | 212 | $this->warn('Could not get database information for predb table.'); |
213 | 213 | exit(); |
214 | 214 | } |
@@ -225,7 +225,7 @@ discard block |
||
225 | 225 | ->select(['id', 'title', 'filename', 'source']) |
226 | 226 | ->groupBy('id') |
227 | 227 | ->orderBy('id') |
228 | - ->chunk($max, function ($pre) use ($bar, $data) { |
|
228 | + ->chunk($max, function($pre) use ($bar, $data) { |
|
229 | 229 | foreach ($pre as $p) { |
230 | 230 | $data['body'][] = [ |
231 | 231 | 'index' => [ |
@@ -95,7 +95,7 @@ discard block |
||
95 | 95 | |
96 | 96 | // Create each index |
97 | 97 | foreach ($indexes as $indexName => $schema) { |
98 | - if (! $this->createIndex($indexName, $schema, $dropExisting)) { |
|
98 | + if (!$this->createIndex($indexName, $schema, $dropExisting)) { |
|
99 | 99 | $hasErrors = true; |
100 | 100 | } |
101 | 101 | } |
@@ -127,7 +127,7 @@ discard block |
||
127 | 127 | $indices->drop(['index' => $indexName, 'body' => ['silent' => true]]); |
128 | 128 | $this->info("Successfully dropped {$indexName} index."); |
129 | 129 | } catch (ResponseException $e) { |
130 | - if (! str_contains($e->getMessage(), 'unknown index')) { |
|
130 | + if (!str_contains($e->getMessage(), 'unknown index')) { |
|
131 | 131 | $this->warn("Warning when dropping {$indexName} index: ".$e->getMessage()); |
132 | 132 | } |
133 | 133 | } |
@@ -29,7 +29,7 @@ |
||
29 | 29 | ]); |
30 | 30 | |
31 | 31 | // Check if password is correct |
32 | - if (! Hash::check($validated['current_password'], Auth::user()->password)) { |
|
32 | + if (!Hash::check($validated['current_password'], Auth::user()->password)) { |
|
33 | 33 | if ($request->expectsJson() || $request->ajax()) { |
34 | 34 | return response()->json([ |
35 | 35 | 'success' => false, |
@@ -87,7 +87,7 @@ discard block |
||
87 | 87 | |
88 | 88 | public function disable2fa(Disable2faPasswordSecurityRequest $request): \Illuminate\Routing\Redirector|RedirectResponse|\Illuminate\Contracts\Foundation\Application |
89 | 89 | { |
90 | - if (! (Hash::check($request->get('current-password'), $request->user()->password))) { |
|
90 | + if (!(Hash::check($request->get('current-password'), $request->user()->password))) { |
|
91 | 91 | // Password doesn't match |
92 | 92 | if ($request->has('redirect_to_profile') || $request->has('from_profile')) { |
93 | 93 | return redirect()->to('profileedit#security')->with('error_2fa', 'Your password does not match with your account password. Please try again.'); |
@@ -119,7 +119,7 @@ discard block |
||
119 | 119 | ]); |
120 | 120 | |
121 | 121 | // Get the user ID from session |
122 | - if (! $request->session()->has('2fa:user:id')) { |
|
122 | + if (!$request->session()->has('2fa:user:id')) { |
|
123 | 123 | return redirect()->route('login') |
124 | 124 | ->with('message', 'The two-factor authentication session has expired. Please login again.') |
125 | 125 | ->with('message_type', 'danger'); |
@@ -128,7 +128,7 @@ discard block |
||
128 | 128 | $userId = $request->session()->get('2fa:user:id'); |
129 | 129 | $user = \App\Models\User::find($userId); |
130 | 130 | |
131 | - if (! $user || ! $user->passwordSecurity) { |
|
131 | + if (!$user || !$user->passwordSecurity) { |
|
132 | 132 | $request->session()->forget('2fa:user:id'); |
133 | 133 | |
134 | 134 | return redirect()->route('login') |
@@ -142,7 +142,7 @@ discard block |
||
142 | 142 | $request->input('one_time_password') |
143 | 143 | ); |
144 | 144 | |
145 | - if (! $valid) { |
|
145 | + if (!$valid) { |
|
146 | 146 | return redirect()->route('2fa.verify') |
147 | 147 | ->with('message', 'Invalid authentication code. Please try again.') |
148 | 148 | ->with('message_type', 'danger'); |
@@ -175,7 +175,7 @@ discard block |
||
175 | 175 | public function getVerify2fa(Request $request) |
176 | 176 | { |
177 | 177 | // Check if user ID is stored in the session |
178 | - if (! $request->session()->has('2fa:user:id')) { |
|
178 | + if (!$request->session()->has('2fa:user:id')) { |
|
179 | 179 | return redirect()->route('login') |
180 | 180 | ->withErrors(['msg' => 'The two-factor authentication session has expired. Please login again.']); |
181 | 181 | } |
@@ -185,7 +185,7 @@ discard block |
||
185 | 185 | |
186 | 186 | // Get the user |
187 | 187 | $user = \App\Models\User::find($userId); |
188 | - if (! $user) { |
|
188 | + if (!$user) { |
|
189 | 189 | $request->session()->forget('2fa:user:id'); |
190 | 190 | |
191 | 191 | return redirect()->route('login') |
@@ -212,7 +212,7 @@ discard block |
||
212 | 212 | 'current-password' => 'required', |
213 | 213 | ]); |
214 | 214 | |
215 | - if (! (Hash::check($request->get('current-password'), $request->user()->password))) { |
|
215 | + if (!(Hash::check($request->get('current-password'), $request->user()->password))) { |
|
216 | 216 | return redirect()->to('profileedit#security')->with('error_2fa', 'Your password does not match with your account password. Please try again.'); |
217 | 217 | } |
218 | 218 |
@@ -31,7 +31,7 @@ discard block |
||
31 | 31 | $privateProfiles = config('nntmux_settings.private_profiles'); |
32 | 32 | $publicView = false; |
33 | 33 | |
34 | - if ($privileged || ! $privateProfiles) { |
|
34 | + if ($privileged || !$privateProfiles) { |
|
35 | 35 | $altID = ($request->has('id') && (int) $request->input('id') >= 0) ? (int) $request->input('id') : false; |
36 | 36 | $altUsername = ($request->has('name') && $request->input('name') !== '') ? $request->input('name') : false; |
37 | 37 | |
@@ -61,7 +61,7 @@ discard block |
||
61 | 61 | } |
62 | 62 | |
63 | 63 | // Check if the user selected a theme. |
64 | - if (! isset($this->userdata->style) || $this->userdata->style === 'None') { |
|
64 | + if (!isset($this->userdata->style) || $this->userdata->style === 'None') { |
|
65 | 65 | $this->userdata->style = 'Using the admin selected theme.'; |
66 | 66 | } |
67 | 67 | $this->smarty->assign( |
@@ -112,7 +112,7 @@ discard block |
||
112 | 112 | $action = $request->input('action') ?? 'view'; |
113 | 113 | |
114 | 114 | $userid = $this->userdata->id; |
115 | - if (! $this->userdata) { |
|
115 | + if (!$this->userdata) { |
|
116 | 116 | $this->show404('No such user!'); |
117 | 117 | } |
118 | 118 | |
@@ -122,7 +122,7 @@ discard block |
||
122 | 122 | |
123 | 123 | // Generate 2FA QR code URL if 2FA is set up but not enabled |
124 | 124 | $google2fa_url = ''; |
125 | - if ($this->userdata->passwordSecurity()->exists() && ! $this->userdata->passwordSecurity->google2fa_enable) { |
|
125 | + if ($this->userdata->passwordSecurity()->exists() && !$this->userdata->passwordSecurity->google2fa_enable) { |
|
126 | 126 | $google2fa_url = \Google2FA::getQRCodeInline( |
127 | 127 | config('app.name'), |
128 | 128 | $this->userdata->email, |
@@ -163,7 +163,7 @@ discard block |
||
163 | 163 | 'None', |
164 | 164 | ); |
165 | 165 | |
166 | - if ((int) $request->input('viewconsole') === 1 && $this->userdata->can('view console') && ! $this->userdata->hasDirectPermission('view console')) { |
|
166 | + if ((int) $request->input('viewconsole') === 1 && $this->userdata->can('view console') && !$this->userdata->hasDirectPermission('view console')) { |
|
167 | 167 | $this->userdata->givePermissionTo('view console'); |
168 | 168 | } elseif ((int) $request->input('viewconsole') === 0 && $this->userdata->can('view console') && $this->userdata->hasDirectPermission('view console')) { |
169 | 169 | $this->userdata->revokePermissionTo('view console'); |
@@ -171,7 +171,7 @@ discard block |
||
171 | 171 | $this->userdata->revokePermissionTo('view console'); |
172 | 172 | } |
173 | 173 | |
174 | - if ((int) $request->input('viewmovies') === 1 && $this->userdata->can('view movies') && ! $this->userdata->hasDirectPermission('view movies')) { |
|
174 | + if ((int) $request->input('viewmovies') === 1 && $this->userdata->can('view movies') && !$this->userdata->hasDirectPermission('view movies')) { |
|
175 | 175 | $this->userdata->givePermissionTo('view movies'); |
176 | 176 | } elseif ((int) $request->input('viewmovies') === 0 && $this->userdata->can('view movies') && $this->userdata->hasDirectPermission('view movies')) { |
177 | 177 | $this->userdata->revokePermissionTo('view movies'); |
@@ -179,7 +179,7 @@ discard block |
||
179 | 179 | $this->userdata->revokePermissionTo('view movies'); |
180 | 180 | } |
181 | 181 | |
182 | - if ((int) $request->input('viewaudio') === 1 && $this->userdata->can('view audio') && ! $this->userdata->hasDirectPermission('view audio')) { |
|
182 | + if ((int) $request->input('viewaudio') === 1 && $this->userdata->can('view audio') && !$this->userdata->hasDirectPermission('view audio')) { |
|
183 | 183 | $this->userdata->givePermissionTo('view audio'); |
184 | 184 | } elseif ((int) $request->input('viewaudio') === 0 && $this->userdata->can('view audio') && $this->userdata->hasDirectPermission('view audio')) { |
185 | 185 | $this->userdata->revokePermissionTo('view audio'); |
@@ -187,7 +187,7 @@ discard block |
||
187 | 187 | $this->userdata->revokePermissionTo('view audio'); |
188 | 188 | } |
189 | 189 | |
190 | - if ((int) $request->input('viewpc') === 1 && $this->userdata->can('view pc') && ! $this->userdata->hasDirectPermission('view pc')) { |
|
190 | + if ((int) $request->input('viewpc') === 1 && $this->userdata->can('view pc') && !$this->userdata->hasDirectPermission('view pc')) { |
|
191 | 191 | $this->userdata->givePermissionTo('view pc'); |
192 | 192 | } elseif ((int) $request->input('viewpc') === 0 && $this->userdata->can('view pc') && $this->userdata->hasDirectPermission('view pc')) { |
193 | 193 | $this->userdata->revokePermissionTo('view pc'); |
@@ -195,7 +195,7 @@ discard block |
||
195 | 195 | $this->userdata->revokePermissionTo('view pc'); |
196 | 196 | } |
197 | 197 | |
198 | - if ((int) $request->input('viewtv') === 1 && $this->userdata->can('view tv') && ! $this->userdata->hasDirectPermission('view tv')) { |
|
198 | + if ((int) $request->input('viewtv') === 1 && $this->userdata->can('view tv') && !$this->userdata->hasDirectPermission('view tv')) { |
|
199 | 199 | $this->userdata->givePermissionTo('view tv'); |
200 | 200 | } elseif ((int) $request->input('viewtv') === 0 && $this->userdata->can('view tv') && $this->userdata->hasDirectPermission('view tv')) { |
201 | 201 | $this->userdata->revokePermissionTo('view tv'); |
@@ -203,7 +203,7 @@ discard block |
||
203 | 203 | $this->userdata->revokePermissionTo('view tv'); |
204 | 204 | } |
205 | 205 | |
206 | - if ((int) $request->input('viewadult') === 1 && $this->userdata->can('view adult') && ! $this->userdata->hasDirectPermission('view adult')) { |
|
206 | + if ((int) $request->input('viewadult') === 1 && $this->userdata->can('view adult') && !$this->userdata->hasDirectPermission('view adult')) { |
|
207 | 207 | $this->userdata->givePermissionTo('view adult'); |
208 | 208 | } elseif ((int) $request->input('viewadult') === 0 && $this->userdata->can('view adult') && $this->userdata->hasDirectPermission('view adult')) { |
209 | 209 | $this->userdata->revokePermissionTo('view adult'); |
@@ -211,7 +211,7 @@ discard block |
||
211 | 211 | $this->userdata->revokePermissionTo('view adult'); |
212 | 212 | } |
213 | 213 | |
214 | - if ((int) $request->input('viewbooks') === 1 && $this->userdata->can('view books') && ! $this->userdata->hasDirectPermission('view books')) { |
|
214 | + if ((int) $request->input('viewbooks') === 1 && $this->userdata->can('view books') && !$this->userdata->hasDirectPermission('view books')) { |
|
215 | 215 | $this->userdata->givePermissionTo('view books'); |
216 | 216 | } elseif ((int) $request->input('viewbooks') === 0 && $this->userdata->can('view books') && $this->userdata->hasDirectPermission('view books')) { |
217 | 217 | $this->userdata->revokePermissionTo('view books'); |
@@ -219,7 +219,7 @@ discard block |
||
219 | 219 | $this->userdata->revokePermissionTo('view books'); |
220 | 220 | } |
221 | 221 | |
222 | - if ((int) $request->input('viewother') === 1 && $this->userdata->can('view other') && ! $this->userdata->hasDirectPermission('view other')) { |
|
222 | + if ((int) $request->input('viewother') === 1 && $this->userdata->can('view other') && !$this->userdata->hasDirectPermission('view other')) { |
|
223 | 223 | $this->userdata->givePermissionTo('view other'); |
224 | 224 | } elseif ((int) $request->input('viewother') === 0 && $this->userdata->can('view other') && $this->userdata->hasDirectPermission('view other')) { |
225 | 225 | $this->userdata->revokePermissionTo('view other'); |
@@ -227,12 +227,12 @@ discard block |
||
227 | 227 | $this->userdata->revokePermissionTo('view other'); |
228 | 228 | } |
229 | 229 | |
230 | - if ($request->has('password') && ! empty($request->input('password'))) { |
|
230 | + if ($request->has('password') && !empty($request->input('password'))) { |
|
231 | 231 | User::updatePassword($userid, $request->input('password')); |
232 | 232 | } |
233 | 233 | |
234 | - if (! $this->userdata->hasRole('Admin')) { |
|
235 | - if (! empty($request->input('email')) && $this->userdata->email !== $request->input('email')) { |
|
234 | + if (!$this->userdata->hasRole('Admin')) { |
|
235 | + if (!empty($request->input('email')) && $this->userdata->email !== $request->input('email')) { |
|
236 | 236 | $this->userdata->email = $request->input('email'); |
237 | 237 | |
238 | 238 | $verify_user = $this->userdata; |
@@ -284,7 +284,7 @@ discard block |
||
284 | 284 | $this->setPreferences(); |
285 | 285 | $userId = $request->input('id'); |
286 | 286 | |
287 | - if ($userId !== null && (int) $userId === $this->userdata->id && ! $this->userdata->hasRole('Admin')) { |
|
287 | + if ($userId !== null && (int) $userId === $this->userdata->id && !$this->userdata->hasRole('Admin')) { |
|
288 | 288 | $user = User::find($userId); |
289 | 289 | SendAccountDeletedEmail::dispatch($user); |
290 | 290 | Auth::logout(); |
@@ -18,16 +18,16 @@ |
||
18 | 18 | $username = $request->has('username') ? $request->input('username') : ''; |
19 | 19 | $email = $request->has('email') ? $request->input('email') : ''; |
20 | 20 | $host = $request->has('host') ? $request->input('host') : ''; |
21 | - $orderBy = $request->has('ob') && ! empty($request->input('ob')) ? $request->input('ob') : 'deleted_at_desc'; |
|
21 | + $orderBy = $request->has('ob') && !empty($request->input('ob')) ? $request->input('ob') : 'deleted_at_desc'; |
|
22 | 22 | |
23 | 23 | $deletedUsers = User::onlyTrashed() |
24 | - ->when($username !== '', function ($query) use ($username) { |
|
24 | + ->when($username !== '', function($query) use ($username) { |
|
25 | 25 | return $query->where('username', 'like', '%'.$username.'%'); |
26 | 26 | }) |
27 | - ->when($email !== '', function ($query) use ($email) { |
|
27 | + ->when($email !== '', function($query) use ($email) { |
|
28 | 28 | return $query->where('email', 'like', '%'.$email.'%'); |
29 | 29 | }) |
30 | - ->when($host !== '', function ($query) use ($host) { |
|
30 | + ->when($host !== '', function($query) use ($host) { |
|
31 | 31 | return $query->where('host', 'like', '%'.$host.'%'); |
32 | 32 | }); |
33 | 33 |
@@ -30,15 +30,15 @@ |
||
30 | 30 | { |
31 | 31 | $purgeDays = config('nntmux.purge_inactive_users_days'); |
32 | 32 | User::query()->where('roles_id', '=', 1) |
33 | - ->where(function ($query) use ($purgeDays) { |
|
33 | + ->where(function($query) use ($purgeDays) { |
|
34 | 34 | $query->where('lastlogin', '<', now()->subDays($purgeDays)) |
35 | 35 | ->orWhereNull('lastlogin'); |
36 | 36 | }) |
37 | - ->where(function ($query) use ($purgeDays) { |
|
37 | + ->where(function($query) use ($purgeDays) { |
|
38 | 38 | $query->where('apiaccess', '<', now()->subDays($purgeDays)) |
39 | 39 | ->orWhereNull('apiaccess'); |
40 | 40 | }) |
41 | - ->get()->each(function ($user) { |
|
41 | + ->get()->each(function($user) { |
|
42 | 42 | $user->delete(); // Use soft delete instead of mass deletion |
43 | 43 | }); |
44 | 44 | } |