Test Failed
Push — master ( 24a1f5...1bb6c6 )
by Ron
01:55
created
app/Http/Middleware/CheckPasswordExpire.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -21,7 +21,7 @@
 block discarded – undo
21 21
         $user = $request->user();
22 22
         $passExp = new Carbon(($user->password_expires));
23 23
         
24
-        if(!empty($passExp) && Carbon::now() > $passExp && !empty(config('users.passExpires')))
24
+        if (!empty($passExp) && Carbon::now()>$passExp && !empty(config('users.passExpires')))
25 25
         {
26 26
             Log::notice('User ID-'.Auth::user()->user_id.' is being forced to change their password.');
27 27
             $request->session()->flash('change_password', 'change_password');
Please login to merge, or discard this patch.
app/Http/Middleware/CheckRole.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -15,7 +15,7 @@  discard block
 block discarded – undo
15 15
      */
16 16
     public function handle($request, Closure $next)
17 17
     {
18
-        if($request->user() === null)
18
+        if ($request->user() === null)
19 19
         {
20 20
             Log::alert($request->route().' denied for Guest');
21 21
             return response('Insufficient Permissions', 401);
@@ -23,7 +23,7 @@  discard block
 block discarded – undo
23 23
         $actions = $request->route()->getAction();
24 24
         $roles = isset($actions['roles']) ? $actions['roles'] : null;
25 25
         
26
-        if($request->user()->hasAnyRole($roles)  || !$roles)
26
+        if ($request->user()->hasAnyRole($roles) || !$roles)
27 27
         {
28 28
             return $next($request);
29 29
         }
Please login to merge, or discard this patch.
app/Http/Controllers/FileLinksController.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -40,7 +40,7 @@  discard block
 block discarded – undo
40 40
         {
41 41
             $hash = strtolower(str_random(15));
42 42
             $dup = FileLinks::where('link_hash', $hash)->get()->count();
43
-        }while($dup != 0);
43
+        } while ($dup != 0);
44 44
         
45 45
         //  Create the new file link
46 46
         $link = FileLinks::create([
@@ -53,10 +53,10 @@  discard block
 block discarded – undo
53 53
         $linkID = $link->link_id;
54 54
         
55 55
         //  If there are any files, process them
56
-        if(!empty($request->file))
56
+        if (!empty($request->file))
57 57
         {
58 58
             $filePath = config('filesystems.paths.links').DIRECTORY_SEPARATOR.$linkID;
59
-            foreach($request->file as $file)
59
+            foreach ($request->file as $file)
60 60
             {
61 61
                 //  Clean the file and store it
62 62
                 $fileName = Files::cleanFilename($filePath, $file->getClientOriginalName());
@@ -105,7 +105,7 @@  discard block
 block discarded – undo
105 105
     {
106 106
         $linkData = FileLinks::find($id);
107 107
         
108
-        if(empty($linkData))
108
+        if (empty($linkData))
109 109
         {
110 110
             return view('links.badLink');
111 111
         }
@@ -118,7 +118,7 @@  discard block
 block discarded – undo
118 118
     //  Get the files for the link
119 119
     public function getFiles($type, $linkID)
120 120
     {
121
-        switch($type)
121
+        switch ($type)
122 122
         {
123 123
             case 'down':
124 124
                 $files = FileLInkFiles::where('link_id', $linkID)
@@ -153,7 +153,7 @@  discard block
 block discarded – undo
153 153
     public function submitAddFile($id, Request $request)
154 154
     {
155 155
         $filePath = config('filesystems.paths.links').DIRECTORY_SEPARATOR.$id;
156
-        foreach($request->file as $file)
156
+        foreach ($request->file as $file)
157 157
         {
158 158
             //  Clean the file and store it
159 159
             $fileName = Files::cleanFilename($filePath, $file->getClientOriginalName());
@@ -226,9 +226,9 @@  discard block
 block discarded – undo
226 226
     {
227 227
         //  Remove the file from database
228 228
         $data = FileLinkFiles::where('link_id', $id)->get();
229
-        if(!$data->isEmpty())
229
+        if (!$data->isEmpty())
230 230
         {
231
-            foreach($data as $file)
231
+            foreach ($data as $file)
232 232
             {
233 233
                 $fileID = $file->file_id;
234 234
                 $file->delete();
Please login to merge, or discard this patch.
app/Http/Controllers/TechTipsController.php 1 patch
Spacing   +22 added lines, -22 removed lines patch added patch discarded remove patch
@@ -35,9 +35,9 @@  discard block
 block discarded – undo
35 35
             ->get();
36 36
         
37 37
         $sysArr = [];
38
-        foreach($systems as $sys)
38
+        foreach ($systems as $sys)
39 39
         {
40
-            foreach($sys->SystemTypes as $s)
40
+            foreach ($sys->SystemTypes as $s)
41 41
             {
42 42
                 $sysArr[$sys->name][$s->sys_id] = $s->name;
43 43
             }
@@ -52,7 +52,7 @@  discard block
 block discarded – undo
52 52
     public function search(Request $request)
53 53
     {
54 54
         //  Run different request based on if system field is filled out or not
55
-        if(!empty($request->system))
55
+        if (!empty($request->system))
56 56
         {
57 57
             $tipData = TechTips::where('subject', 'like', '%'.$request->tipSearch.'%')
58 58
                 ->whereHas('TechTipSystems', function($q) use($request)
@@ -81,9 +81,9 @@  discard block
 block discarded – undo
81 81
             ->get();
82 82
         
83 83
         $sysArr = [];
84
-        foreach($systems as $sys)
84
+        foreach ($systems as $sys)
85 85
         {
86
-            foreach($sys->SystemTypes as $s)
86
+            foreach ($sys->SystemTypes as $s)
87 87
             {
88 88
                 $sysArr[$sys->name][$s->sys_id] = $s->name;
89 89
             }
@@ -112,10 +112,10 @@  discard block
 block discarded – undo
112 112
         $tipID = $tip->tip_id;
113 113
 
114 114
         //  Enter all system tags associated with the tip
115
-        if(is_array($request->sysTags))
115
+        if (is_array($request->sysTags))
116 116
         {
117 117
             
118
-            foreach($request->sysTags as $tag)
118
+            foreach ($request->sysTags as $tag)
119 119
             {
120 120
                 TechTipSystems::create([
121 121
                     'tip_id' => $tipID,
@@ -132,10 +132,10 @@  discard block
 block discarded – undo
132 132
         }
133 133
         
134 134
         //  If there are any files, process them
135
-        if(!empty($request->file))
135
+        if (!empty($request->file))
136 136
         {
137 137
             $filePath = config('filesystems.paths.tips').DIRECTORY_SEPARATOR.$tipID;
138
-            foreach($request->file as $file)
138
+            foreach ($request->file as $file)
139 139
             {
140 140
                 //  Clean the file and store it
141 141
                 $fileName = Files::cleanFilename($filePath, $file->getClientOriginalName());
@@ -163,7 +163,7 @@  discard block
 block discarded – undo
163 163
         {
164 164
             Mail::to($userList)->send(new newTechtip($tipData));
165 165
         }
166
-        catch(Exception $e)
166
+        catch (Exception $e)
167 167
         {
168 168
             report($e);
169 169
         }
@@ -177,7 +177,7 @@  discard block
 block discarded – undo
177 177
     public function details($id, $name)
178 178
     {
179 179
         $tipData = TechTips::where('tip_id', $id)->with('user')->first();
180
-        if(empty($tipData))
180
+        if (empty($tipData))
181 181
         {
182 182
             Log::warning('User ID-'.Auth::user()->user_id.' tried to access invlaid Tech Tip ID-'.$id.' Name-'.$name);
183 183
             return view('err.tipNotFound');
@@ -226,7 +226,7 @@  discard block
 block discarded – undo
226 226
     public function edit($id)
227 227
     {
228 228
         $tipData = TechTips::find($id);
229
-        if(empty($tipData))
229
+        if (empty($tipData))
230 230
         {
231 231
             return 'tip not found';
232 232
         }
@@ -249,9 +249,9 @@  discard block
 block discarded – undo
249 249
             ->get();
250 250
         
251 251
         $sysArr = [];
252
-        foreach($systems as $sys)
252
+        foreach ($systems as $sys)
253 253
         {
254
-            foreach($sys->SystemTypes as $s)
254
+            foreach ($sys->SystemTypes as $s)
255 255
             {
256 256
                 $sysArr[$sys->name][$s->sys_id] = $s->name;
257 257
             }
@@ -284,9 +284,9 @@  discard block
 block discarded – undo
284 284
         
285 285
         //  Enter all system tags associated with the tip after destroying the existing systems
286 286
         TechTipSystems::where('tip_id', $id)->delete();
287
-        if(is_array($request->sysTags))
287
+        if (is_array($request->sysTags))
288 288
         {
289
-            foreach($request->sysTags as $tag)
289
+            foreach ($request->sysTags as $tag)
290 290
             {
291 291
                 TechTipSystems::create([
292 292
                     'tip_id' => $id,
@@ -304,13 +304,13 @@  discard block
 block discarded – undo
304 304
         
305 305
         //  Determine if any files were removed
306 306
         $tipFiles = TechTipFiles::where('tip_id', $id)->get();
307
-        if(!$tipFiles->isEmpty())
307
+        if (!$tipFiles->isEmpty())
308 308
         {
309
-            if(!empty($request->existingFile))
309
+            if (!empty($request->existingFile))
310 310
             {
311
-                foreach($tipFiles as $file)
311
+                foreach ($tipFiles as $file)
312 312
                 {
313
-                    if(!in_array($file->file_id, $request->existingFile))
313
+                    if (!in_array($file->file_id, $request->existingFile))
314 314
                     {
315 315
                         TechTipFiles::where('file_id', $file->file_id)->delete();
316 316
                         Files::deleteFile($file->file_id);
@@ -324,10 +324,10 @@  discard block
 block discarded – undo
324 324
         }
325 325
         
326 326
         //  Process any new files
327
-        if(!empty($request->file))
327
+        if (!empty($request->file))
328 328
         {
329 329
             $filePath = config('filesystems.paths.tips').DIRECTORY_SEPARATOR.$id;
330
-            foreach($request->file as $file)
330
+            foreach ($request->file as $file)
331 331
             {
332 332
                 //  Clean the file and store it
333 333
                 $fileName = Files::cleanFilename($filePath, $file->getClientOriginalName());
Please login to merge, or discard this patch.
app/Http/Controllers/SystemController.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -34,7 +34,7 @@  discard block
 block discarded – undo
34 34
     {
35 35
         //  Make sure that the category is valid
36 36
         $valid = SystemCategories::where('name', $cat)->get();
37
-        if($valid->isEmpty())
37
+        if ($valid->isEmpty())
38 38
         {
39 39
             Log::warning('User '.Auth::user()->user_id.' tried to visit invalid category '.$cat);
40 40
             return view('err.badCategory');
@@ -58,7 +58,7 @@  discard block
 block discarded – undo
58 58
         //  Make sure that the system is valid
59 59
         $sys = urldecode($sys);
60 60
         $valid = SystemTypes::where('name', $sys)->first();
61
-        if(empty($valid))
61
+        if (empty($valid))
62 62
         {
63 63
             Log::warning('User '.Auth::user()->user_id.' tried to visit invalid system - '.$sys.' for category '.$cat);
64 64
             return view('err.badSystem');
Please login to merge, or discard this patch.
app/Http/Controllers/UserController.php 2 patches
Indentation   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -146,7 +146,7 @@  discard block
 block discarded – undo
146 146
         
147 147
         $nextChange = config('users.passExpires') != null ? Carbon::now()->addDays(config('users.passExpires')) : null;
148 148
         
149
-         //  Update the password
149
+            //  Update the password
150 150
         User::find($userData->user_id)->update(
151 151
         [
152 152
             'password'         => bcrypt($request->newPass),
@@ -187,7 +187,7 @@  discard block
 block discarded – undo
187 187
         
188 188
         $nextChange = isset($request->force_change) && $request->force_change == 'on' ? Carbon::now()->subDay() : null;
189 189
         
190
-         //  Update the user data
190
+            //  Update the user data
191 191
         User::find($id)->update(
192 192
         [
193 193
             'password'         => bcrypt($request->password),
@@ -260,7 +260,7 @@  discard block
 block discarded – undo
260 260
     //  Deactivae an active user
261 261
     public function destroy($id)
262 262
     {
263
-         //  Update the user data
263
+            //  Update the user data
264 264
         User::find($id)->update(
265 265
         [
266 266
             'active'   => 0
Please login to merge, or discard this patch.
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -39,9 +39,9 @@  discard block
 block discarded – undo
39 39
         $roles = Role::all();
40 40
         
41 41
         $roleArr = [];
42
-        foreach($roles as $role)
42
+        foreach ($roles as $role)
43 43
         {
44
-            if($role->role_id == 1 && Auth::user()->role_id != 1)
44
+            if ($role->role_id == 1 && Auth::user()->role_id != 1)
45 45
             {
46 46
                 continue;
47 47
             }
@@ -95,7 +95,7 @@  discard block
 block discarded – undo
95 95
         {
96 96
             Mail::to($request->email)->send(new InitializeUser($hash, $request->username, $request->first_name.' '.$request->last_name));
97 97
         }
98
-        catch(Exception $e)
98
+        catch (Exception $e)
99 99
         {
100 100
             report($e);
101 101
         }
@@ -113,7 +113,7 @@  discard block
 block discarded – undo
113 113
         //  Validate the hash token
114 114
         $user = UserInitialize::where('token', $hash)->get();
115 115
         
116
-        if($user->isEmpty())
116
+        if ($user->isEmpty())
117 117
         {
118 118
             return abort(404);
119 119
         }
@@ -126,7 +126,7 @@  discard block
 block discarded – undo
126 126
     {
127 127
         //  Verify that the link matches the assigned email address
128 128
         $valid = UserInitialize::where('token', $hash)->first();
129
-        if(empty($valid))
129
+        if (empty($valid))
130 130
         {
131 131
             Log::notice('Someone tried to access an invalid User Initialization link - '.$hash);
132 132
             return abort(404);
@@ -206,9 +206,9 @@  discard block
 block discarded – undo
206 206
         $userRole = DB::select('SELECT `role_id` FROM `user_role` WHERE `user_id` = ?', [$id])[0]->role_id;
207 207
         
208 208
         $roleArr = [];
209
-        foreach($roles as $role)
209
+        foreach ($roles as $role)
210 210
         {
211
-            if($role->role_id == 1 && Auth::user()->role_id != 1)
211
+            if ($role->role_id == 1 && Auth::user()->role_id != 1)
212 212
             {
213 213
                 continue;
214 214
             }
Please login to merge, or discard this patch.
app/Http/Controllers/InstallerController.php 2 patches
Spacing   +22 added lines, -22 removed lines patch added patch discarded remove patch
@@ -31,12 +31,12 @@  discard block
 block discarded – undo
31 31
         $cats = SystemCategories::all();
32 32
         $sysArr = [];
33 33
         //  Populate that list with the matching systems
34
-        foreach($cats as $cat)
34
+        foreach ($cats as $cat)
35 35
         {
36 36
             $systems = SystemTypes::where('cat_id', $cat->cat_id)->get();
37
-            if(!$systems->isEmpty())
37
+            if (!$systems->isEmpty())
38 38
             {
39
-                foreach($systems as $sys)
39
+                foreach ($systems as $sys)
40 40
                 {
41 41
                     $sysArr[$cat->name][] = $sys->name;
42 42
                 }
@@ -71,7 +71,7 @@  discard block
 block discarded – undo
71 71
         
72 72
         Log::info('Tech Bench Settings Updated', ['user_id' => Auth::user()->user_id]);
73 73
         
74
-        return redirect()->back()->with('success', 'Tech Bench Successfully Updated');//
74
+        return redirect()->back()->with('success', 'Tech Bench Successfully Updated'); //
75 75
     }
76 76
     
77 77
     //  Upload and submit a new site logo
@@ -115,7 +115,7 @@  discard block
 block discarded – undo
115 115
             'mail.username'   => $request->username,
116 116
         ]);
117 117
         
118
-        if(!empty($request->password))
118
+        if (!empty($request->password))
119 119
         {
120 120
             config(['mail.password' => $request->password]);
121 121
         }
@@ -127,7 +127,7 @@  discard block
 block discarded – undo
127 127
             Mail::to(Auth::user()->email)->send(new TestEmail());
128 128
             return 'success';
129 129
         }
130
-        catch(Exception $e)
130
+        catch (Exception $e)
131 131
         {
132 132
             Log::notice('Test Email Failed.  Message: '.$e);
133 133
             $msg = '['.$e->getCode().'] "'.$e->getMessage().'" on line '.$e->getTrace()[0]['line'].' of file '.$e->getTrace()[0]['file'];
@@ -150,13 +150,13 @@  discard block
 block discarded – undo
150 150
         Settings::where('key', 'mail.port')->update(['value' => $request->port]);
151 151
         Settings::where('key', 'mail.encryption')->update(['value' => $request->encryption]);
152 152
         Settings::where('key', 'mail.username')->update(['value' => $request->username]);
153
-        if(!empty($request->password))
153
+        if (!empty($request->password))
154 154
         {
155 155
             Settings::where('key', 'mail.password')->update(['value' => $request->password]);
156 156
         }
157 157
          
158 158
         Log::info('Email Settings have been changed by User ID-'.Auth::user()->user_id);
159
-        return redirect()->back()->with('success', 'Tech Bench Successfully Updated');//
159
+        return redirect()->back()->with('success', 'Tech Bench Successfully Updated'); //
160 160
     }
161 161
     
162 162
     //  User settings form
@@ -178,14 +178,14 @@  discard block
 block discarded – undo
178 178
         
179 179
         //  Determine if the password expires field is updated
180 180
         $oldExpire = config('users.passExpires');
181
-        if($request->passExpire != $oldExpire)
181
+        if ($request->passExpire != $oldExpire)
182 182
         {
183 183
             //  Update the setting in the database
184 184
             Settings::where('key', 'users.passExpires')->update([
185 185
                 'value' => $request->passExpire
186 186
             ]);
187 187
             //  If the setting is changing from never to xx days, update all users
188
-            if($request->passExpire == 0)
188
+            if ($request->passExpire == 0)
189 189
             {
190 190
                 User::whereNotNull('password_expires')->update([
191 191
                     'password_expires' => null
@@ -250,13 +250,13 @@  discard block
 block discarded – undo
250 250
         $sysID = $sysData->sys_id;
251 251
         $i = 0;
252 252
         
253
-        foreach($request->custField as $field)
253
+        foreach ($request->custField as $field)
254 254
         {
255
-            if(!empty($field))
255
+            if (!empty($field))
256 256
             {
257 257
                 $id = SystemCustDataTypes::where('name', $field)->first();
258 258
 
259
-                if(is_null($id))
259
+                if (is_null($id))
260 260
                 {
261 261
                     $newField = SystemCustDataTypes::create([
262 262
                         'name' => $field
@@ -280,7 +280,7 @@  discard block
 block discarded – undo
280 280
         
281 281
         Log::info('New System Created', ['cat_id' => $request->catName, 'sys_name' => $request->name, 'user_id' => Auth::user()->user_id]);
282 282
         
283
-        return redirect()->back()->with('success', 'System Successfully Added');//
283
+        return redirect()->back()->with('success', 'System Successfully Added'); //
284 284
     }
285 285
     
286 286
     //  Form to edit an existing system
@@ -307,7 +307,7 @@  discard block
 block discarded – undo
307 307
         $sysName = SystemTypes::find($sysID)->name;
308 308
         
309 309
         //  Change the name of the system if it has been modified
310
-        if($sysName !== $request->name)
310
+        if ($sysName !== $request->name)
311 311
         {
312 312
             SystemTypes::find($sysID)->update([
313 313
                 'name' => $request->name
@@ -320,19 +320,19 @@  discard block
 block discarded – undo
320 320
             ->get();
321 321
         
322 322
         $i = 0;
323
-        foreach($request->custField as $field)
323
+        foreach ($request->custField as $field)
324 324
         {
325 325
             $found = false;
326
-            if(!empty($field))
326
+            if (!empty($field))
327 327
             {
328 328
                 //  Check if the field already exists
329
-                foreach($dataType as $type)
329
+                foreach ($dataType as $type)
330 330
                 {
331
-                    if($type->name === $field)
331
+                    if ($type->name === $field)
332 332
                     {
333 333
                         $found = true;
334 334
                         //  See if the order has changed
335
-                        if($type->order != $i)
335
+                        if ($type->order != $i)
336 336
                         {
337 337
                             SystemCustDataFields::find($type->field_id)->update(
338 338
                             [
@@ -342,11 +342,11 @@  discard block
 block discarded – undo
342 342
                     }
343 343
                 }
344 344
                 //  If the field does not exist, create it
345
-                if(!$found)
345
+                if (!$found)
346 346
                 {
347 347
                     $id = SystemCustDataTypes::where('name', $field)->first();
348 348
 
349
-                    if(is_null($id))
349
+                    if (is_null($id))
350 350
                     {
351 351
                         $newField = SystemCustDataTypes::create([
352 352
                             'name' => $field
Please login to merge, or discard this patch.
Braces   +5 added lines, -10 removed lines patch added patch discarded remove patch
@@ -40,8 +40,7 @@  discard block
 block discarded – undo
40 40
                 {
41 41
                     $sysArr[$cat->name][] = $sys->name;
42 42
                 }
43
-            }
44
-            else
43
+            } else
45 44
             {
46 45
                 $sysArr[$cat->name] = null;
47 46
             }
@@ -126,8 +125,7 @@  discard block
 block discarded – undo
126 125
             Log::info('Test Email Successfully Sent to '.Auth::user()->email);
127 126
             Mail::to(Auth::user()->email)->send(new TestEmail());
128 127
             return 'success';
129
-        }
130
-        catch(Exception $e)
128
+        } catch(Exception $e)
131 129
         {
132 130
             Log::notice('Test Email Failed.  Message: '.$e);
133 131
             $msg = '['.$e->getCode().'] "'.$e->getMessage().'" on line '.$e->getTrace()[0]['line'].' of file '.$e->getTrace()[0]['file'];
@@ -190,8 +188,7 @@  discard block
 block discarded – undo
190 188
                 User::whereNotNull('password_expires')->update([
191 189
                     'password_expires' => null
192 190
                 ]);
193
-            }
194
-            else
191
+            } else
195 192
             {
196 193
                 $newExpire = Carbon::now()->addDays($request->passExpire);
197 194
                 User::whereNull('password_expires')->update([
@@ -262,8 +259,7 @@  discard block
 block discarded – undo
262 259
                         'name' => $field
263 260
                     ]);
264 261
                     $id = $newField->data_type_id;
265
-                }
266
-                else
262
+                } else
267 263
                 {
268 264
                     $id = $id->data_type_id;
269 265
                 }
@@ -352,8 +348,7 @@  discard block
 block discarded – undo
352 348
                             'name' => $field
353 349
                         ]);
354 350
                         $id = $newField->data_type_id;
355
-                    }
356
-                    else
351
+                    } else
357 352
                     {
358 353
                         $id = $id->data_type_id;
359 354
                     }
Please login to merge, or discard this patch.