@@ -31,7 +31,7 @@ discard block |
||
31 | 31 | { |
32 | 32 | $fileName = str_replace(' ', '_', $fileName); |
33 | 33 | |
34 | - if(Storage::exists($path.DIRECTORY_SEPARATOR.$fileName)) |
|
34 | + if (Storage::exists($path.DIRECTORY_SEPARATOR.$fileName)) |
|
35 | 35 | { |
36 | 36 | |
37 | 37 | $fileParts = pathinfo($fileName); |
@@ -72,7 +72,7 @@ discard block |
||
72 | 72 | |
73 | 73 | Log::info('File Deleted', ['file_id' => $fileID, 'file_name' => $fileLink, 'user_id' => Auth::user()->user_id]); |
74 | 74 | } |
75 | - catch(Exception $e) |
|
75 | + catch (Exception $e) |
|
76 | 76 | { |
77 | 77 | return false; |
78 | 78 | } |
@@ -26,10 +26,10 @@ |
||
26 | 26 | */ |
27 | 27 | public function register() |
28 | 28 | { |
29 | - if(Schema::hasTable('settings')) |
|
29 | + if (Schema::hasTable('settings')) |
|
30 | 30 | { |
31 | 31 | $settings = DB::table('settings')->get(); |
32 | - foreach($settings as $setting) |
|
32 | + foreach ($settings as $setting) |
|
33 | 33 | { |
34 | 34 | Config([$setting->key => $setting->value]); |
35 | 35 | } |
@@ -16,13 +16,13 @@ |
||
16 | 16 | $navBarSys = []; |
17 | 17 | $navBarSub = []; |
18 | 18 | |
19 | - foreach($navItems as $item) |
|
19 | + foreach ($navItems as $item) |
|
20 | 20 | { |
21 | - if(!in_array($item->category, $navBarCat)) |
|
21 | + if (!in_array($item->category, $navBarCat)) |
|
22 | 22 | { |
23 | 23 | $navBarCat[] = $item->category; |
24 | 24 | } |
25 | - if(empty($item->parent_id)) |
|
25 | + if (empty($item->parent_id)) |
|
26 | 26 | { |
27 | 27 | $navBarSys[$item->sys_id]['category'] = $item->category; |
28 | 28 | $navBarSys[$item->sys_id]['name'] = $item->sys_name; |
@@ -73,11 +73,11 @@ discard block |
||
73 | 73 | |
74 | 74 | public function hasAnyRole($roles) |
75 | 75 | { |
76 | - if(is_array($roles)) |
|
76 | + if (is_array($roles)) |
|
77 | 77 | { |
78 | - foreach($roles as $role) |
|
78 | + foreach ($roles as $role) |
|
79 | 79 | { |
80 | - if($this->hasRole($role)) |
|
80 | + if ($this->hasRole($role)) |
|
81 | 81 | { |
82 | 82 | return true; |
83 | 83 | } |
@@ -85,7 +85,7 @@ discard block |
||
85 | 85 | } |
86 | 86 | else |
87 | 87 | { |
88 | - if($this->hasRole($roles)) |
|
88 | + if ($this->hasRole($roles)) |
|
89 | 89 | { |
90 | 90 | return true; |
91 | 91 | } |
@@ -96,7 +96,7 @@ discard block |
||
96 | 96 | |
97 | 97 | public function hasRole($role) |
98 | 98 | { |
99 | - if($this->roles()->where('name', $role)->first()) |
|
99 | + if ($this->roles()->where('name', $role)->first()) |
|
100 | 100 | { |
101 | 101 | return true; |
102 | 102 | } |
@@ -40,7 +40,7 @@ discard block |
||
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 |
||
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('filesystem.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 |
||
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 |
||
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 |
||
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 |
||
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(); |
@@ -73,13 +73,13 @@ |
||
73 | 73 | public function submitPassword(Request $request) |
74 | 74 | { |
75 | 75 | // Make sure that the old password is valid |
76 | - if(!(Hash::check($request->oldPass, Auth::user()->password))) |
|
76 | + if (!(Hash::check($request->oldPass, Auth::user()->password))) |
|
77 | 77 | { |
78 | 78 | return redirect()->back()->with('error', 'Your Current Password is not valid. Please try again.'); |
79 | 79 | } |
80 | 80 | |
81 | 81 | // Make sure that the new password is not the same as the old password |
82 | - if(strcmp($request->newPass, $request->oldPass) == 0) |
|
82 | + if (strcmp($request->newPass, $request->oldPass) == 0) |
|
83 | 83 | { |
84 | 84 | return redirect()->back()->with('error', 'New Password cannot be the same as the old password'); |
85 | 85 | } |
@@ -20,7 +20,7 @@ |
||
20 | 20 | { |
21 | 21 | $fileData = Files::where('file_id', $fileID)->where('file_name', $fileName)->first(); |
22 | 22 | // Check that the file exists before allowing it to be downloaded |
23 | - if(!empty($fileData) && Storage::exists($fileData->file_link.$fileData->file_name)) |
|
23 | + if (!empty($fileData) && Storage::exists($fileData->file_link.$fileData->file_name)) |
|
24 | 24 | { |
25 | 25 | Log::info('File Downloaded', ['file_id' => $fileID]); |
26 | 26 | return Storage::download($fileData->file_link.$fileData->file_name); |
@@ -32,7 +32,7 @@ discard block |
||
32 | 32 | { |
33 | 33 | // Make sure that the category is valid |
34 | 34 | $valid = SystemCategories::where('name', $cat)->get(); |
35 | - if($valid->isEmpty()) |
|
35 | + if ($valid->isEmpty()) |
|
36 | 36 | { |
37 | 37 | return view('err.badCategory'); |
38 | 38 | } |
@@ -55,7 +55,7 @@ discard block |
||
55 | 55 | // Make sure that the system is valid |
56 | 56 | $sys = urldecode($sys); |
57 | 57 | $valid = SystemTypes::where('name', $sys)->first(); |
58 | - if(empty($valid)) |
|
58 | + if (empty($valid)) |
|
59 | 59 | { |
60 | 60 | return view('err.badSystem'); |
61 | 61 | } |
@@ -25,12 +25,12 @@ discard block |
||
25 | 25 | $cats = SystemCategories::all(); |
26 | 26 | $sysArr = []; |
27 | 27 | // Populate that list with the matching systems |
28 | - foreach($cats as $cat) |
|
28 | + foreach ($cats as $cat) |
|
29 | 29 | { |
30 | 30 | $systems = SystemTypes::where('cat_id', $cat->cat_id)->get(); |
31 | - if(!$systems->isEmpty()) |
|
31 | + if (!$systems->isEmpty()) |
|
32 | 32 | { |
33 | - foreach($systems as $sys) |
|
33 | + foreach ($systems as $sys) |
|
34 | 34 | { |
35 | 35 | $sysArr[$cat->name][] = $sys->name; |
36 | 36 | } |
@@ -65,7 +65,7 @@ discard block |
||
65 | 65 | |
66 | 66 | Log::info('Tech Bench Settings Updated', ['user_id' => Auth::user()->user_id]); |
67 | 67 | |
68 | - return redirect()->back()->with('success', 'Tech Bench Successfully Updated');// |
|
68 | + return redirect()->back()->with('success', 'Tech Bench Successfully Updated'); // |
|
69 | 69 | } |
70 | 70 | |
71 | 71 | // Email settings form |
@@ -89,12 +89,12 @@ discard block |
||
89 | 89 | Settings::where('key', 'mail.port')->update(['value' => $request->port]); |
90 | 90 | Settings::where('key', 'mail.encryption')->update(['value' => $request->encryption]); |
91 | 91 | Settings::where('key', 'mail.username')->update(['value' => $request->username]); |
92 | - if(!empty($request->password)) |
|
92 | + if (!empty($request->password)) |
|
93 | 93 | { |
94 | 94 | Settings::where('key', 'mail.password')->update(['value' => $request->password]); |
95 | 95 | } |
96 | 96 | |
97 | - return redirect()->back()->with('success', 'Tech Bench Successfully Updated');// |
|
97 | + return redirect()->back()->with('success', 'Tech Bench Successfully Updated'); // |
|
98 | 98 | } |
99 | 99 | |
100 | 100 | // Form to create a new Category |
@@ -143,13 +143,13 @@ discard block |
||
143 | 143 | $sysID = $sysData->sys_id; |
144 | 144 | $i = 0; |
145 | 145 | |
146 | - foreach($request->custField as $field) |
|
146 | + foreach ($request->custField as $field) |
|
147 | 147 | { |
148 | - if(!empty($field)) |
|
148 | + if (!empty($field)) |
|
149 | 149 | { |
150 | 150 | $id = SystemCustDataTypes::where('name', $field)->first(); |
151 | 151 | |
152 | - if(is_null($id)) |
|
152 | + if (is_null($id)) |
|
153 | 153 | { |
154 | 154 | $newField = SystemCustDataTypes::create([ |
155 | 155 | 'name' => $field |
@@ -173,7 +173,7 @@ discard block |
||
173 | 173 | |
174 | 174 | Log::info('New System Created', ['cat_id' => $request->catName, 'sys_name' => $request->name, 'user_id' => Auth::user()->user_id]); |
175 | 175 | |
176 | - return redirect()->back()->with('success', 'System Successfully Added');// |
|
176 | + return redirect()->back()->with('success', 'System Successfully Added'); // |
|
177 | 177 | } |
178 | 178 | |
179 | 179 | // Form to edit an existing system |
@@ -200,7 +200,7 @@ discard block |
||
200 | 200 | $sysName = SystemTypes::find($sysID)->name; |
201 | 201 | |
202 | 202 | // Change the name of the system if it has been modified |
203 | - if($sysName !== $request->name) |
|
203 | + if ($sysName !== $request->name) |
|
204 | 204 | { |
205 | 205 | SystemTypes::find($sysID)->update([ |
206 | 206 | 'name' => $request->name |
@@ -213,19 +213,19 @@ discard block |
||
213 | 213 | ->get(); |
214 | 214 | |
215 | 215 | $i = 0; |
216 | - foreach($request->custField as $field) |
|
216 | + foreach ($request->custField as $field) |
|
217 | 217 | { |
218 | 218 | $found = false; |
219 | - if(!empty($field)) |
|
219 | + if (!empty($field)) |
|
220 | 220 | { |
221 | 221 | // Check if the field already exists |
222 | - foreach($dataType as $type) |
|
222 | + foreach ($dataType as $type) |
|
223 | 223 | { |
224 | - if($type->name === $field) |
|
224 | + if ($type->name === $field) |
|
225 | 225 | { |
226 | 226 | $found = true; |
227 | 227 | // See if the order has changed |
228 | - if($type->order != $i) |
|
228 | + if ($type->order != $i) |
|
229 | 229 | { |
230 | 230 | SystemCustDataFields::find($type->field_id)->update( |
231 | 231 | [ |
@@ -235,11 +235,11 @@ discard block |
||
235 | 235 | } |
236 | 236 | } |
237 | 237 | // If the field does not exist, create it |
238 | - if(!$found) |
|
238 | + if (!$found) |
|
239 | 239 | { |
240 | 240 | $id = SystemCustDataTypes::where('name', $field)->first(); |
241 | 241 | |
242 | - if(is_null($id)) |
|
242 | + if (is_null($id)) |
|
243 | 243 | { |
244 | 244 | $newField = SystemCustDataTypes::create([ |
245 | 245 | 'name' => $field |