@@ -39,7 +39,7 @@ discard block |
||
| 39 | 39 | $i = 0; |
| 40 | 40 | do |
| 41 | 41 | { |
| 42 | - if($i) |
|
| 42 | + if ($i) |
|
| 43 | 43 | { |
| 44 | 44 | $backupName = $backupBase.'('.$i.')'; |
| 45 | 45 | } |
@@ -48,7 +48,7 @@ discard block |
||
| 48 | 48 | $backupName = $backupBase; |
| 49 | 49 | } |
| 50 | 50 | $i++; |
| 51 | - } while(Storage::disk('backup')->exists($backupName.'.zip')); |
|
| 51 | + } while (Storage::disk('backup')->exists($backupName.'.zip')); |
|
| 52 | 52 | |
| 53 | 53 | // Write a file that shows the system version |
| 54 | 54 | $version = new \PragmaRX\Version\Package\Version(); |
@@ -42,8 +42,7 @@ |
||
| 42 | 42 | if($i) |
| 43 | 43 | { |
| 44 | 44 | $backupName = $backupBase.'('.$i.')'; |
| 45 | - } |
|
| 46 | - else |
|
| 45 | + } else |
|
| 47 | 46 | { |
| 48 | 47 | $backupName = $backupBase; |
| 49 | 48 | } |
@@ -26,12 +26,12 @@ discard block |
||
| 26 | 26 | $details = FileLinks::where('link_hash', $id)->first(); |
| 27 | 27 | |
| 28 | 28 | // Verify that the link is valid |
| 29 | - if(empty($details)) |
|
| 29 | + if (empty($details)) |
|
| 30 | 30 | { |
| 31 | 31 | return view('links.guest.badLink'); |
| 32 | 32 | } |
| 33 | 33 | // Verify that the link has not expired |
| 34 | - else if($details->expire <= date('Y-m-d')) |
|
| 34 | + else if ($details->expire<=date('Y-m-d')) |
|
| 35 | 35 | { |
| 36 | 36 | return view('links.guest.expiredLink'); |
| 37 | 37 | } |
@@ -56,7 +56,7 @@ discard block |
||
| 56 | 56 | |
| 57 | 57 | $filePath = config('filesystems.paths.links').DIRECTORY_SEPARATOR.$details->link_id; |
| 58 | 58 | |
| 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()); |
@@ -77,7 +77,7 @@ discard block |
||
| 77 | 77 | 'upload' => 1 |
| 78 | 78 | ]); |
| 79 | 79 | |
| 80 | - if(!empty($request->note)) |
|
| 80 | + if (!empty($request->note)) |
|
| 81 | 81 | { |
| 82 | 82 | FileLinkNotes::create([ |
| 83 | 83 | 'link_id' => $details->link_id, |
@@ -40,7 +40,7 @@ |
||
| 40 | 40 | public function markNotification($id) |
| 41 | 41 | { |
| 42 | 42 | $notification = Auth::user()->notifications()->where('id', $id)->first(); |
| 43 | - if($notification) |
|
| 43 | + if ($notification) |
|
| 44 | 44 | { |
| 45 | 45 | $notification->delete(); |
| 46 | 46 | Log::info('Notification ID-'.$id.' deleted for User ID-'.Auth::user()->user_id); |
@@ -44,8 +44,7 @@ |
||
| 44 | 44 | { |
| 45 | 45 | $notification->delete(); |
| 46 | 46 | Log::info('Notification ID-'.$id.' deleted for User ID-'.Auth::user()->user_id); |
| 47 | - } |
|
| 48 | - else |
|
| 47 | + } else |
|
| 49 | 48 | { |
| 50 | 49 | Log::notice('Notification ID-'.$id.' not found for user ID-'.Auth::user()->user_id); |
| 51 | 50 | } |
@@ -35,9 +35,9 @@ discard block |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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('errors.tipNotFound'); |
@@ -226,7 +226,7 @@ discard block |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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()); |
@@ -27,12 +27,12 @@ discard block |
||
| 27 | 27 | $cats = SystemCategories::all(); |
| 28 | 28 | $sysArr = []; |
| 29 | 29 | // Populate that list with the matching systems |
| 30 | - foreach($cats as $cat) |
|
| 30 | + foreach ($cats as $cat) |
|
| 31 | 31 | { |
| 32 | 32 | $systems = SystemTypes::where('cat_id', $cat->cat_id)->get(); |
| 33 | - if(!$systems->isEmpty()) |
|
| 33 | + if (!$systems->isEmpty()) |
|
| 34 | 34 | { |
| 35 | - foreach($systems as $sys) |
|
| 35 | + foreach ($systems as $sys) |
|
| 36 | 36 | { |
| 37 | 37 | $sysArr[$cat->name][] = $sys->name; |
| 38 | 38 | } |
@@ -67,7 +67,7 @@ discard block |
||
| 67 | 67 | |
| 68 | 68 | Log::info('Tech Bench Settings Updated', ['user_id' => Auth::user()->user_id]); |
| 69 | 69 | |
| 70 | - return redirect()->back()->with('success', 'Tech Bench Successfully Updated');// |
|
| 70 | + return redirect()->back()->with('success', 'Tech Bench Successfully Updated'); // |
|
| 71 | 71 | } |
| 72 | 72 | |
| 73 | 73 | // Upload and submit a new site logo |
@@ -111,7 +111,7 @@ discard block |
||
| 111 | 111 | 'mail.username' => $request->username, |
| 112 | 112 | ]); |
| 113 | 113 | |
| 114 | - if(!empty($request->password)) |
|
| 114 | + if (!empty($request->password)) |
|
| 115 | 115 | { |
| 116 | 116 | config(['mail.password' => $request->password]); |
| 117 | 117 | } |
@@ -123,7 +123,7 @@ discard block |
||
| 123 | 123 | Mail::to(Auth::user()->email)->send(new TestEmail()); |
| 124 | 124 | return 'success'; |
| 125 | 125 | } |
| 126 | - catch(Exception $e) |
|
| 126 | + catch (Exception $e) |
|
| 127 | 127 | { |
| 128 | 128 | Log::notice('Test Email Failed. Message: '.$e); |
| 129 | 129 | $msg = '['.$e->getCode().'] "'.$e->getMessage().'" on line '.$e->getTrace()[0]['line'].' of file '.$e->getTrace()[0]['file']; |
@@ -146,13 +146,13 @@ discard block |
||
| 146 | 146 | Settings::where('key', 'mail.port')->update(['value' => $request->port]); |
| 147 | 147 | Settings::where('key', 'mail.encryption')->update(['value' => $request->encryption]); |
| 148 | 148 | Settings::where('key', 'mail.username')->update(['value' => $request->username]); |
| 149 | - if(!empty($request->password)) |
|
| 149 | + if (!empty($request->password)) |
|
| 150 | 150 | { |
| 151 | 151 | Settings::where('key', 'mail.password')->update(['value' => $request->password]); |
| 152 | 152 | } |
| 153 | 153 | |
| 154 | 154 | Log::info('Email Settings have been changed by User ID-'.Auth::user()->user_id); |
| 155 | - return redirect()->back()->with('success', 'Tech Bench Successfully Updated');// |
|
| 155 | + return redirect()->back()->with('success', 'Tech Bench Successfully Updated'); // |
|
| 156 | 156 | } |
| 157 | 157 | |
| 158 | 158 | // User settings form |
@@ -174,14 +174,14 @@ discard block |
||
| 174 | 174 | |
| 175 | 175 | // Determine if the password expires field is updated |
| 176 | 176 | $oldExpire = config('users.passExpires'); |
| 177 | - if($request->passExpire != $oldExpire) |
|
| 177 | + if ($request->passExpire != $oldExpire) |
|
| 178 | 178 | { |
| 179 | 179 | // Update the setting in the database |
| 180 | 180 | Settings::where('key', 'users.passExpires')->update([ |
| 181 | 181 | 'value' => $request->passExpire |
| 182 | 182 | ]); |
| 183 | 183 | // If the setting is changing from never to xx days, update all users |
| 184 | - if($request->passExpire == 0) |
|
| 184 | + if ($request->passExpire == 0) |
|
| 185 | 185 | { |
| 186 | 186 | User::whereNotNull('password_expires')->update([ |
| 187 | 187 | 'password_expires' => null |
@@ -36,8 +36,7 @@ discard block |
||
| 36 | 36 | { |
| 37 | 37 | $sysArr[$cat->name][] = $sys->name; |
| 38 | 38 | } |
| 39 | - } |
|
| 40 | - else |
|
| 39 | + } else |
|
| 41 | 40 | { |
| 42 | 41 | $sysArr[$cat->name] = null; |
| 43 | 42 | } |
@@ -122,8 +121,7 @@ discard block |
||
| 122 | 121 | Log::info('Test Email Successfully Sent to '.Auth::user()->email); |
| 123 | 122 | Mail::to(Auth::user()->email)->send(new TestEmail()); |
| 124 | 123 | return 'success'; |
| 125 | - } |
|
| 126 | - catch(Exception $e) |
|
| 124 | + } catch(Exception $e) |
|
| 127 | 125 | { |
| 128 | 126 | Log::notice('Test Email Failed. Message: '.$e); |
| 129 | 127 | $msg = '['.$e->getCode().'] "'.$e->getMessage().'" on line '.$e->getTrace()[0]['line'].' of file '.$e->getTrace()[0]['file']; |
@@ -186,8 +184,7 @@ discard block |
||
| 186 | 184 | User::whereNotNull('password_expires')->update([ |
| 187 | 185 | 'password_expires' => null |
| 188 | 186 | ]); |
| 189 | - } |
|
| 190 | - else |
|
| 187 | + } else |
|
| 191 | 188 | { |
| 192 | 189 | $newExpire = Carbon::now()->addDays($request->passExpire); |
| 193 | 190 | User::whereNull('password_expires')->update([ |
@@ -34,7 +34,7 @@ discard block |
||
| 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('errors.badCategory'); |
@@ -58,7 +58,7 @@ discard block |
||
| 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('errors.badSystem'); |
@@ -23,7 +23,7 @@ discard block |
||
| 23 | 23 | { |
| 24 | 24 | $fileTypes = CustomerFileTypes::all(); |
| 25 | 25 | $fTypes = []; |
| 26 | - foreach($fileTypes as $type) |
|
| 26 | + foreach ($fileTypes as $type) |
|
| 27 | 27 | { |
| 28 | 28 | $fTypes[$type->file_type_id] = $type->description; |
| 29 | 29 | } |
@@ -93,7 +93,7 @@ discard block |
||
| 93 | 93 | $custFile = CustomerFiles::find($id); |
| 94 | 94 | $fileTypes = CustomerFileTypes::all(); |
| 95 | 95 | $fTypes = []; |
| 96 | - foreach($fileTypes as $type) |
|
| 96 | + foreach ($fileTypes as $type) |
|
| 97 | 97 | { |
| 98 | 98 | $fTypes[$type->file_type_id] = $type->description; |
| 99 | 99 | } |
@@ -147,7 +147,7 @@ discard block |
||
| 147 | 147 | |
| 148 | 148 | $nextChange = config('users.passExpires') != null ? Carbon::now()->addDays(config('users.passExpires')) : null; |
| 149 | 149 | |
| 150 | - // Update the password |
|
| 150 | + // Update the password |
|
| 151 | 151 | User::find($userData->user_id)->update( |
| 152 | 152 | [ |
| 153 | 153 | 'password' => bcrypt($request->newPass), |
@@ -188,7 +188,7 @@ discard block |
||
| 188 | 188 | |
| 189 | 189 | $nextChange = isset($request->force_change) && $request->force_change == 'on' ? Carbon::now()->subDay() : null; |
| 190 | 190 | |
| 191 | - // Update the user data |
|
| 191 | + // Update the user data |
|
| 192 | 192 | User::find($id)->update( |
| 193 | 193 | [ |
| 194 | 194 | 'password' => bcrypt($request->password), |
@@ -273,7 +273,7 @@ discard block |
||
| 273 | 273 | $linkController->destroy($link->link_id); |
| 274 | 274 | } |
| 275 | 275 | |
| 276 | - // Update the user data |
|
| 276 | + // Update the user data |
|
| 277 | 277 | User::find($id)->update( |
| 278 | 278 | [ |
| 279 | 279 | 'active' => 0 |
@@ -41,9 +41,9 @@ discard block |
||
| 41 | 41 | $roles = Role::all(); |
| 42 | 42 | |
| 43 | 43 | $roleArr = []; |
| 44 | - foreach($roles as $role) |
|
| 44 | + foreach ($roles as $role) |
|
| 45 | 45 | { |
| 46 | - if($role->role_id == 1 && Auth::user()->role_id != 1) |
|
| 46 | + if ($role->role_id == 1 && Auth::user()->role_id != 1) |
|
| 47 | 47 | { |
| 48 | 48 | continue; |
| 49 | 49 | } |
@@ -96,7 +96,7 @@ discard block |
||
| 96 | 96 | { |
| 97 | 97 | Mail::to($request->email)->send(new InitializeUser($hash, $request->username, $request->first_name.' '.$request->last_name)); |
| 98 | 98 | } |
| 99 | - catch(Exception $e) |
|
| 99 | + catch (Exception $e) |
|
| 100 | 100 | { |
| 101 | 101 | report($e); |
| 102 | 102 | } |
@@ -114,7 +114,7 @@ discard block |
||
| 114 | 114 | // Validate the hash token |
| 115 | 115 | $user = UserInitialize::where('token', $hash)->get(); |
| 116 | 116 | |
| 117 | - if($user->isEmpty()) |
|
| 117 | + if ($user->isEmpty()) |
|
| 118 | 118 | { |
| 119 | 119 | return abort(404); |
| 120 | 120 | } |
@@ -127,7 +127,7 @@ discard block |
||
| 127 | 127 | { |
| 128 | 128 | // Verify that the link matches the assigned email address |
| 129 | 129 | $valid = UserInitialize::where('token', $hash)->first(); |
| 130 | - if(empty($valid)) |
|
| 130 | + if (empty($valid)) |
|
| 131 | 131 | { |
| 132 | 132 | Log::notice('Someone tried to access an invalid User Initialization link - '.$hash); |
| 133 | 133 | return abort(404); |
@@ -207,9 +207,9 @@ discard block |
||
| 207 | 207 | $userRole = DB::select('SELECT `role_id` FROM `user_role` WHERE `user_id` = ?', [$id])[0]->role_id; |
| 208 | 208 | |
| 209 | 209 | $roleArr = []; |
| 210 | - foreach($roles as $role) |
|
| 210 | + foreach ($roles as $role) |
|
| 211 | 211 | { |
| 212 | - if($role->role_id == 1 && Auth::user()->role_id != 1) |
|
| 212 | + if ($role->role_id == 1 && Auth::user()->role_id != 1) |
|
| 213 | 213 | { |
| 214 | 214 | continue; |
| 215 | 215 | } |
@@ -268,7 +268,7 @@ discard block |
||
| 268 | 268 | $links = FileLinks::where('user_id', $id)->get(); |
| 269 | 269 | |
| 270 | 270 | |
| 271 | - foreach($links as $link) |
|
| 271 | + foreach ($links as $link) |
|
| 272 | 272 | { |
| 273 | 273 | $linkController->destroy($link->link_id); |
| 274 | 274 | } |
@@ -50,7 +50,7 @@ discard block |
||
| 50 | 50 | $custDetails = Customers::find($id); |
| 51 | 51 | |
| 52 | 52 | // Check for empty data set |
| 53 | - if(empty($custDetails)) |
|
| 53 | + if (empty($custDetails)) |
|
| 54 | 54 | { |
| 55 | 55 | return view('errors.customerNotFound'); |
| 56 | 56 | } |
@@ -85,7 +85,7 @@ discard block |
||
| 85 | 85 | Customers::find($id)->update($request->all()); |
| 86 | 86 | |
| 87 | 87 | // Modify to the new ID number if set |
| 88 | - if(isset($request->cust_id)) |
|
| 88 | + if (isset($request->cust_id)) |
|
| 89 | 89 | { |
| 90 | 90 | $id = $request->cust_id; |
| 91 | 91 | } |