@@ -59,9 +59,12 @@ discard block |
||
| 59 | 59 | public function archiveFiles(Request $request) |
| 60 | 60 | { |
| 61 | 61 | // Debug Data |
| 62 | - if (Auth::user()) { |
|
| 62 | + if (Auth::user()) |
|
| 63 | + { |
|
| 63 | 64 | $user = Auth::user()->full_name; |
| 64 | - } else { |
|
| 65 | + } |
|
| 66 | + else |
|
| 67 | + { |
|
| 65 | 68 | $user = \Request::ip(); |
| 66 | 69 | } |
| 67 | 70 | Log::debug('Route ' . Route::currentRouteName() . ' visited by ' . $user.' Request Data:', $request->toArray()); |
@@ -107,9 +110,12 @@ discard block |
||
| 107 | 110 | public function downloadArchive($fileName) |
| 108 | 111 | { |
| 109 | 112 | // Debug Data |
| 110 | - if (Auth::user()) { |
|
| 113 | + if (Auth::user()) |
|
| 114 | + { |
|
| 111 | 115 | $user = Auth::user()->full_name; |
| 112 | - } else { |
|
| 116 | + } |
|
| 117 | + else |
|
| 118 | + { |
|
| 113 | 119 | $user = \Request::ip(); |
| 114 | 120 | } |
| 115 | 121 | Log::debug('Route '.Route::currentRouteName().' visited by '.$user); |
@@ -22,7 +22,8 @@ discard block |
||
| 22 | 22 | $this->line(''); |
| 23 | 23 | // Select which update file to use |
| 24 | 24 | $updateFile = $this->checkForUpdate(); |
| 25 | - if ($updateFile) { |
|
| 25 | + if ($updateFile) |
|
| 26 | + { |
|
| 26 | 27 | // Open up the file and verify it is at least the same version as the current setup |
| 27 | 28 | $valid = $this->openUpdate($updateFile); |
| 28 | 29 | |
@@ -80,7 +81,8 @@ discard block |
||
| 80 | 81 | $this->line(''); |
| 81 | 82 | |
| 82 | 83 | $anticipate = []; |
| 83 | - foreach ($updateList as $key => $up) { |
|
| 84 | + foreach ($updateList as $key => $up) |
|
| 85 | + { |
|
| 84 | 86 | $opt = $key + 1; |
| 85 | 87 | $anticipate[$opt] = $up; |
| 86 | 88 | $this->line('[' . $opt . '] ' . $up); |
@@ -36,8 +36,7 @@ discard block |
||
| 36 | 36 | $userLinks = new UserCollection( |
| 37 | 37 | User::withCount([ |
| 38 | 38 | 'FileLinks', |
| 39 | - 'FileLinks as expired_file_links_count' => function($query) |
|
| 40 | - { |
|
| 39 | + 'FileLinks as expired_file_links_count' => function($query) { |
|
| 41 | 40 | $query->where('expire', '<', Carbon::now()); |
| 42 | 41 | } |
| 43 | 42 | ]) |
@@ -91,7 +90,8 @@ discard block |
||
| 91 | 90 | Log::notice('User '.Auth::user()->full_name.' updated User Password Policy'); |
| 92 | 91 | |
| 93 | 92 | // If the setting is changing from never to xx days, update all users |
| 94 | - if ($request->passExpire == 0) { |
|
| 93 | + if ($request->passExpire == 0) |
|
| 94 | + { |
|
| 95 | 95 | User::whereNotNull('password_expires')->update([ |
| 96 | 96 | 'password_expires' => null |
| 97 | 97 | ]); |
@@ -112,8 +112,7 @@ discard block |
||
| 112 | 112 | { |
| 113 | 113 | $this->authorize('hasAccess', 'Manage User Roles'); |
| 114 | 114 | Log::debug('Route ' . Route::currentRouteName() . ' visited by ' . Auth::user()->full_name); |
| 115 | - $roles = UserRoleType::with(['UserRolePermissions' => function($query) |
|
| 116 | - { |
|
| 115 | + $roles = UserRoleType::with(['UserRolePermissions' => function($query) { |
|
| 117 | 116 | $query->join('user_role_permission_types', 'user_role_permission_types.perm_type_id', '=', 'user_role_permissions.perm_type_id'); |
| 118 | 117 | }])->get(); |
| 119 | 118 | $perms = UserRolePermissionTypes::all(); |
@@ -182,12 +182,18 @@ discard block |
||
| 182 | 182 | |
| 183 | 183 | // Good to go - get role information |
| 184 | 184 | $roleArr = []; |
| 185 | - foreach ($roles as $role) { |
|
| 186 | - if ($role->role_id == 1 && Auth::user()->role_id != 1) { |
|
| 185 | + foreach ($roles as $role) |
|
| 186 | + { |
|
| 187 | + if ($role->role_id == 1 && Auth::user()->role_id != 1) |
|
| 188 | + { |
|
| 187 | 189 | continue; |
| 188 | - } else if ($role->role_id == 2 && Auth::user()->role_id > 1) { |
|
| 190 | + } |
|
| 191 | + else if ($role->role_id == 2 && Auth::user()->role_id > 1) |
|
| 192 | + { |
|
| 189 | 193 | continue; |
| 190 | - } else { |
|
| 194 | + } |
|
| 195 | + else |
|
| 196 | + { |
|
| 191 | 197 | // $roleArr[$role->role_id] = $role->name; |
| 192 | 198 | $roleArr[] = [ |
| 193 | 199 | 'value' => $role->role_id, |
@@ -279,17 +285,20 @@ discard block |
||
| 279 | 285 | $user = User::find($request->user_id); |
| 280 | 286 | |
| 281 | 287 | // Verify this is a valid user ID |
| 282 | - if (!$user) { |
|
| 288 | + if (!$user) |
|
| 289 | + { |
|
| 283 | 290 | $success = false; |
| 284 | 291 | $reason = 'Cannot find user with this ID'; |
| 285 | 292 | } |
| 286 | 293 | // Make sure that the user is not trying to deactivate someone with more permissions |
| 287 | - else if ($user->role_id < Auth::user()->role_id) { |
|
| 294 | + else if ($user->role_id < Auth::user()->role_id) |
|
| 295 | + { |
|
| 288 | 296 | $success = false; |
| 289 | 297 | $reason = 'You cannot change password for a user with higher permissions that you. If this user has locked themselves out, have then use the reset link on the login page.'; |
| 290 | 298 | } |
| 291 | 299 | // Good to go - update user password |
| 292 | - else { |
|
| 300 | + else |
|
| 301 | + { |
|
| 293 | 302 | // Update the user data |
| 294 | 303 | $user->update( |
| 295 | 304 | [ |
@@ -29,7 +29,8 @@ discard block |
||
| 29 | 29 | |
| 30 | 30 | // Determine if the note should go to the customer, or its parent |
| 31 | 31 | $details = Customers::find($request->cust_id); |
| 32 | - if ($details->parent_id && $request->shared == 'true') { |
|
| 32 | + if ($details->parent_id && $request->shared == 'true') |
|
| 33 | + { |
|
| 33 | 34 | $request->cust_id = $details->parent_id; |
| 34 | 35 | } |
| 35 | 36 | |
@@ -55,7 +56,8 @@ discard block |
||
| 55 | 56 | |
| 56 | 57 | // Determine if there is a parent site with shared notes |
| 57 | 58 | $parent = Customers::find($id)->parent_id; |
| 58 | - if ($parent) { |
|
| 59 | + if ($parent) |
|
| 60 | + { |
|
| 59 | 61 | $parentList = CustomerNotes::where('cust_id', $parent)->where('shared', 1)->orderBy('urgent', 'desc')->get(); |
| 60 | 62 | |
| 61 | 63 | $notes = $notes->merge($parentList); |
@@ -76,7 +78,8 @@ discard block |
||
| 76 | 78 | ]); |
| 77 | 79 | |
| 78 | 80 | $details = Customers::find($request->cust_id); |
| 79 | - if ($details->parent_id && $request->shared == 'true') { |
|
| 81 | + if ($details->parent_id && $request->shared == 'true') |
|
| 82 | + { |
|
| 80 | 83 | $request->cust_id = $details->parent_id; |
| 81 | 84 | } |
| 82 | 85 | |
@@ -25,7 +25,8 @@ discard block |
||
| 25 | 25 | // Validate the hash token |
| 26 | 26 | $user = UserInitialize::where('token', $hash)->get(); |
| 27 | 27 | |
| 28 | - if ($user->isEmpty()) { |
|
| 28 | + if ($user->isEmpty()) |
|
| 29 | + { |
|
| 29 | 30 | Log::warning('Visitor at IP Address ' . \Request::ip() . ' tried to access invalid initialize hash - ' . $hash); |
| 30 | 31 | return abort(404); |
| 31 | 32 | } |
@@ -43,7 +44,8 @@ discard block |
||
| 43 | 44 | |
| 44 | 45 | // Verify that the link matches the assigned email address |
| 45 | 46 | $valid = UserInitialize::where('token', $hash)->first(); |
| 46 | - if (empty($valid)) { |
|
| 47 | + if (empty($valid)) |
|
| 48 | + { |
|
| 47 | 49 | Log::warning('Visitor at IP Address ' . \Request::ip() . ' tried to submit an invalid User Initialization link - ' . $hash); |
| 48 | 50 | return abort(404); |
| 49 | 51 | } |
@@ -53,14 +53,17 @@ discard block |
||
| 53 | 53 | Log::debug('Route ' . Route::currentRouteName() . ' visited by ' . Auth::user()->full_name.'. Submitted Data - ', $request->toArray()); |
| 54 | 54 | |
| 55 | 55 | // See if there are any search paramaters entered |
| 56 | - if (!$request->search['searchText'] && !isset($request->search['articleType']) && !isset($request->search['systemType'])) { |
|
| 56 | + if (!$request->search['searchText'] && !isset($request->search['articleType']) && !isset($request->search['systemType'])) |
|
| 57 | + { |
|
| 57 | 58 | // No search paramaters, send all tech tips |
| 58 | 59 | $tips = new TechTipsCollection( |
| 59 | 60 | TechTips::orderBy('created_at', 'DESC') |
| 60 | 61 | ->with('SystemTypes') |
| 61 | 62 | ->paginate($request->pagination['perPage']) |
| 62 | 63 | ); |
| 63 | - } else { |
|
| 64 | + } |
|
| 65 | + else |
|
| 66 | + { |
|
| 64 | 67 | $article = isset($request->search['articleType']) ? true : false; |
| 65 | 68 | $system = isset($request->search['systemType']) ? true : false; |
| 66 | 69 | // Search paramaters, filter results |
@@ -151,7 +154,8 @@ discard block |
||
| 151 | 154 | $save = $receiver->receive(); |
| 152 | 155 | |
| 153 | 156 | // See if the uploade has finished |
| 154 | - if ($save->isFinished()) { |
|
| 157 | + if ($save->isFinished()) |
|
| 158 | + { |
|
| 155 | 159 | $this->saveFile($save->getFile()); |
| 156 | 160 | |
| 157 | 161 | return 'uploaded successfully'; |
@@ -252,8 +256,7 @@ discard block |
||
| 252 | 256 | if(!$tipData->supressEmail) |
| 253 | 257 | { |
| 254 | 258 | $details = TechTips::find($tipID); |
| 255 | - $users = User::whereHas('UserSettings', function($query) |
|
| 256 | - { |
|
| 259 | + $users = User::whereHas('UserSettings', function($query) { |
|
| 257 | 260 | $query->where('em_tech_tip', 1); |
| 258 | 261 | })->get(); |
| 259 | 262 | |
@@ -267,7 +270,8 @@ discard block |
||
| 267 | 270 | // Details controller - will move to the show controller with just the tech tip id |
| 268 | 271 | public function details($id, $subject) |
| 269 | 272 | { |
| 270 | - if (session()->has('newTipFile')) { |
|
| 273 | + if (session()->has('newTipFile')) |
|
| 274 | + { |
|
| 271 | 275 | session()->forget('newTipFile'); |
| 272 | 276 | } |
| 273 | 277 | |
@@ -301,7 +305,8 @@ discard block |
||
| 301 | 305 | { |
| 302 | 306 | Log::debug('Route ' . Route::currentRouteName() . ' visited by ' . Auth::user()->full_name); |
| 303 | 307 | |
| 304 | - switch ($action) { |
|
| 308 | + switch ($action) |
|
| 309 | + { |
|
| 305 | 310 | case 'add': |
| 306 | 311 | TechTipFavs::create([ |
| 307 | 312 | 'user_id' => Auth::user()->user_id, |
@@ -330,7 +335,8 @@ discard block |
||
| 330 | 335 | $this->authorize('hasAccess', 'Edit Tech Tip'); |
| 331 | 336 | $tipData = TechTips::where('tip_id', $id)->with('User')->with('SystemTypes')->with('TechTipTypes')->first(); |
| 332 | 337 | |
| 333 | - if (!$tipData) { |
|
| 338 | + if (!$tipData) |
|
| 339 | + { |
|
| 334 | 340 | return view('tips.tipNotFound'); |
| 335 | 341 | } |
| 336 | 342 | |
@@ -363,7 +369,8 @@ discard block |
||
| 363 | 369 | $receiver = new FileReceiver('file', $request, HandlerFactory::classFromRequest($request)); |
| 364 | 370 | |
| 365 | 371 | // Verify if there is a file to be processed or not |
| 366 | - if ($receiver->isUploaded() === false || $request->_completed) { |
|
| 372 | + if ($receiver->isUploaded() === false || $request->_completed) |
|
| 373 | + { |
|
| 367 | 374 | $this->storeUpdatedTip($request, $id); |
| 368 | 375 | Log::debug('Route ' . Route::currentRouteName() . ' visited by User ID-' . Auth::user()->user_id); |
| 369 | 376 | return response()->json(['tip_id' => $id]); |
@@ -373,7 +380,8 @@ discard block |
||
| 373 | 380 | $save = $receiver->receive(); |
| 374 | 381 | |
| 375 | 382 | // See if the uploade has finished |
| 376 | - if ($save->isFinished()) { |
|
| 383 | + if ($save->isFinished()) |
|
| 384 | + { |
|
| 377 | 385 | $this->saveFile($save->getFile(), $id); |
| 378 | 386 | |
| 379 | 387 | return 'uploaded successfully'; |
@@ -77,7 +77,8 @@ |
||
| 77 | 77 | { |
| 78 | 78 | Log::debug('Route ' . Route::currentRouteName() . ' visited by ' . Auth::user()->full_name); |
| 79 | 79 | |
| 80 | - try { |
|
| 80 | + try |
|
| 81 | + { |
|
| 81 | 82 | SystemCategories::find($id)->delete(); |
| 82 | 83 | Log::notice('Category ID '.$id.' deleted by '.Auth::user()->full_name); |
| 83 | 84 | return response()->json(['success' => true, 'reason' => 'Category Successfully Deleted']); |