@@ -22,7 +22,7 @@ |
||
22 | 22 | Route::get('account/change-password', 'AccountController@changePassword')->name('changePassword'); |
23 | 23 | Route::post('account/change-password', 'AccountController@submitPassword')->name('submitPassword'); |
24 | 24 | |
25 | -Route::middleware(['password_expired'])->group(function () |
|
25 | +Route::middleware(['password_expired'])->group(function() |
|
26 | 26 | { |
27 | 27 | // Tech/Registered User Routes |
28 | 28 | Route::group(['middleware' => 'roles', 'roles' => ['tech', 'report', 'admin', 'installer']], function() |
@@ -290,22 +290,22 @@ discard block |
||
290 | 290 | |
291 | 291 | if(!empty($over)) |
292 | 292 | { |
293 | - foreach($over as $ov) |
|
294 | - { |
|
295 | - $res[] = [ |
|
296 | - 'type' => 'error', |
|
297 | - 'value' => ' Link for '.$ov['username'].' is '.$ov['age'].' days old' |
|
298 | - ]; |
|
293 | + foreach($over as $ov) |
|
294 | + { |
|
295 | + $res[] = [ |
|
296 | + 'type' => 'error', |
|
297 | + 'value' => ' Link for '.$ov['username'].' is '.$ov['age'].' days old' |
|
298 | + ]; |
|
299 | 299 | |
300 | - if($this->fix) |
|
301 | - { |
|
302 | - UserInitialize::where('username', $ov['username'])->delete(); |
|
303 | - $res[] = [ |
|
304 | - 'type' => 'info', |
|
305 | - 'value' => ' Corrected' |
|
306 | - ]; |
|
307 | - } |
|
308 | - } |
|
300 | + if($this->fix) |
|
301 | + { |
|
302 | + UserInitialize::where('username', $ov['username'])->delete(); |
|
303 | + $res[] = [ |
|
304 | + 'type' => 'info', |
|
305 | + 'value' => ' Corrected' |
|
306 | + ]; |
|
307 | + } |
|
308 | + } |
|
309 | 309 | } |
310 | 310 | } |
311 | 311 | |
@@ -425,7 +425,7 @@ discard block |
||
425 | 425 | } |
426 | 426 | } |
427 | 427 | |
428 | - $res = array_merge($res, $res2); |
|
428 | + $res = array_merge($res, $res2); |
|
429 | 429 | |
430 | 430 | return $res; |
431 | 431 | } |
@@ -434,7 +434,7 @@ discard block |
||
434 | 434 | private function customerFiles() |
435 | 435 | { |
436 | 436 | $res = []; |
437 | - $res2 = []; |
|
437 | + $res2 = []; |
|
438 | 438 | |
439 | 439 | $badPointer = 0; |
440 | 440 | $missingFile = 0; |
@@ -528,7 +528,7 @@ discard block |
||
528 | 528 | } |
529 | 529 | } |
530 | 530 | |
531 | - $res = array_merge($res, $res2); |
|
531 | + $res = array_merge($res, $res2); |
|
532 | 532 | |
533 | 533 | return $res; |
534 | 534 | } |
@@ -537,7 +537,7 @@ discard block |
||
537 | 537 | private function linkFiles() |
538 | 538 | { |
539 | 539 | $res = []; |
540 | - $res2 = []; |
|
540 | + $res2 = []; |
|
541 | 541 | |
542 | 542 | $badPointer = 0; |
543 | 543 | $missingFile = 0; |
@@ -631,7 +631,7 @@ discard block |
||
631 | 631 | } |
632 | 632 | } |
633 | 633 | |
634 | - $res = array_merge($res, $res2); |
|
634 | + $res = array_merge($res, $res2); |
|
635 | 635 | |
636 | 636 | return $res; |
637 | 637 | } |
@@ -640,7 +640,7 @@ discard block |
||
640 | 640 | private function tipFiles() |
641 | 641 | { |
642 | 642 | $res = []; |
643 | - $res2 = []; |
|
643 | + $res2 = []; |
|
644 | 644 | |
645 | 645 | $badPointer = 0; |
646 | 646 | $missingFile = 0; |
@@ -734,7 +734,7 @@ discard block |
||
734 | 734 | } |
735 | 735 | } |
736 | 736 | |
737 | - $res = array_merge($res, $res2); |
|
737 | + $res = array_merge($res, $res2); |
|
738 | 738 | |
739 | 739 | return $res; |
740 | 740 | } |
@@ -749,36 +749,36 @@ discard block |
||
749 | 749 | 'value' => 'Unknown Files.....................'.count($this->fileArr) |
750 | 750 | ]; |
751 | 751 | |
752 | - if(count($this->fileArr) > 0) |
|
753 | - { |
|
754 | - foreach($this->fileArr as $file) |
|
755 | - { |
|
756 | - $fileData = Files::find($file); |
|
752 | + if(count($this->fileArr) > 0) |
|
753 | + { |
|
754 | + foreach($this->fileArr as $file) |
|
755 | + { |
|
756 | + $fileData = Files::find($file); |
|
757 | 757 | |
758 | - $res[] = [ |
|
759 | - 'type' => 'line', |
|
760 | - 'value' => ' Unknown File ID - '.$fileData->file_id.' - '.$fileData->file_link.$fileData->file_name, |
|
761 | - 'repOnly' => true |
|
762 | - ]; |
|
758 | + $res[] = [ |
|
759 | + 'type' => 'line', |
|
760 | + 'value' => ' Unknown File ID - '.$fileData->file_id.' - '.$fileData->file_link.$fileData->file_name, |
|
761 | + 'repOnly' => true |
|
762 | + ]; |
|
763 | 763 | |
764 | - if($this->fix) |
|
765 | - { |
|
766 | - $res[] = [ |
|
767 | - 'type' => 'info', |
|
768 | - 'value' => ' Corrected', |
|
764 | + if($this->fix) |
|
765 | + { |
|
766 | + $res[] = [ |
|
767 | + 'type' => 'info', |
|
768 | + 'value' => ' Corrected', |
|
769 | 769 | 'repOnly' => true |
770 | - ]; |
|
770 | + ]; |
|
771 | 771 | |
772 | - if(!Storage::exists($fileData->file_link.$fileData->file_name)) |
|
773 | - { |
|
774 | - Storage::delete($fileData->file_link.$fileData->file_name); |
|
775 | - } |
|
772 | + if(!Storage::exists($fileData->file_link.$fileData->file_name)) |
|
773 | + { |
|
774 | + Storage::delete($fileData->file_link.$fileData->file_name); |
|
775 | + } |
|
776 | 776 | |
777 | - $fileData->delete(); |
|
777 | + $fileData->delete(); |
|
778 | 778 | |
779 | - } |
|
780 | - } |
|
781 | - } |
|
779 | + } |
|
780 | + } |
|
781 | + } |
|
782 | 782 | |
783 | 783 | |
784 | 784 | /* |
@@ -817,7 +817,7 @@ discard block |
||
817 | 817 | { |
818 | 818 | $res = []; |
819 | 819 | |
820 | - $allFiles = File::allFiles(config('filesystems.disks.local.root')); |
|
820 | + $allFiles = File::allFiles(config('filesystems.disks.local.root')); |
|
821 | 821 | |
822 | 822 | foreach($allFiles as $pos => $file) |
823 | 823 | { |
@@ -125,7 +125,7 @@ discard block |
||
125 | 125 | $this->output($output); |
126 | 126 | |
127 | 127 | // Generate a PDF report if the option is selected |
128 | - if($this->rep) |
|
128 | + if ($this->rep) |
|
129 | 129 | { |
130 | 130 | Storage::disk('logs')->append('dbCheck-'.$today->year.'-'.$today->month.'-'.$today->day.'.log', $this->repData); |
131 | 131 | } |
@@ -134,10 +134,10 @@ discard block |
||
134 | 134 | // Print the output to the screen and write for PDF report |
135 | 135 | private function output($data) |
136 | 136 | { |
137 | - foreach($data as $d) |
|
137 | + foreach ($data as $d) |
|
138 | 138 | { |
139 | 139 | // Console Output |
140 | - if(!isset($d['repOnly'])) |
|
140 | + if (!isset($d['repOnly'])) |
|
141 | 141 | { |
142 | 142 | $type = $d['type']; |
143 | 143 | $this->$type($d['value']); |
@@ -162,8 +162,8 @@ discard block |
||
162 | 162 | ->where('user_role.role_id', '<=', 2) |
163 | 163 | ->get(); |
164 | 164 | |
165 | - $res[] = [ 'type' => 'info', 'value' => 'System Administrators ('.count($admins).')']; |
|
166 | - foreach($admins as $admin) |
|
165 | + $res[] = ['type' => 'info', 'value' => 'System Administrators ('.count($admins).')']; |
|
166 | + foreach ($admins as $admin) |
|
167 | 167 | { |
168 | 168 | $res[] = [ |
169 | 169 | 'type' => 'line', 'value' => ' '.$admin->first_name.' '.$admin->last_name |
@@ -202,19 +202,19 @@ discard block |
||
202 | 202 | $settings = UserSettings::all(); |
203 | 203 | |
204 | 204 | $failedItems = []; |
205 | - foreach($users as $user) |
|
205 | + foreach ($users as $user) |
|
206 | 206 | { |
207 | 207 | $match = false; |
208 | - foreach($settings as $setting) |
|
208 | + foreach ($settings as $setting) |
|
209 | 209 | { |
210 | - if($user->user_id == $setting->user_id) |
|
210 | + if ($user->user_id == $setting->user_id) |
|
211 | 211 | { |
212 | 212 | $match = true; |
213 | 213 | break; |
214 | 214 | } |
215 | 215 | } |
216 | 216 | |
217 | - if(!$match) |
|
217 | + if (!$match) |
|
218 | 218 | { |
219 | 219 | $failedItems[] = [ |
220 | 220 | 'user_id' => $user->user_id, |
@@ -223,21 +223,21 @@ discard block |
||
223 | 223 | } |
224 | 224 | } |
225 | 225 | |
226 | - if($failedItems) |
|
226 | + if ($failedItems) |
|
227 | 227 | { |
228 | 228 | $res[] = [ |
229 | 229 | 'type' => 'error', |
230 | 230 | 'value' => count($failedItems).' user(s) missing settings information' |
231 | 231 | ]; |
232 | 232 | |
233 | - foreach($failedItems as $item) |
|
233 | + foreach ($failedItems as $item) |
|
234 | 234 | { |
235 | 235 | $res[] = [ |
236 | 236 | 'type' => 'line', |
237 | 237 | 'value' => ' User ID - '.$item['user_id'].'-'.$item['name'] |
238 | 238 | ]; |
239 | 239 | |
240 | - if($this->fix) |
|
240 | + if ($this->fix) |
|
241 | 241 | { |
242 | 242 | UserSettings::create([ |
243 | 243 | 'user_id' => $item['user_id'] |
@@ -263,10 +263,10 @@ discard block |
||
263 | 263 | |
264 | 264 | $links = []; |
265 | 265 | $over = []; |
266 | - if(!empty($initLinks)) |
|
266 | + if (!empty($initLinks)) |
|
267 | 267 | { |
268 | 268 | // List each expired link |
269 | - foreach($initLinks as $link) |
|
269 | + foreach ($initLinks as $link) |
|
270 | 270 | { |
271 | 271 | $links[] = [ |
272 | 272 | 'username' => $link->username, |
@@ -274,7 +274,7 @@ discard block |
||
274 | 274 | ]; |
275 | 275 | |
276 | 276 | // See if the link is more than two weeks old |
277 | - if($link->created_at->diffInDays(Carbon::now()) > 14) |
|
277 | + if ($link->created_at->diffInDays(Carbon::now())>14) |
|
278 | 278 | { |
279 | 279 | $over[] = [ |
280 | 280 | 'username' => $link->username, |
@@ -288,16 +288,16 @@ discard block |
||
288 | 288 | 'value' => count($links).' Users are awaiting to be initialized' |
289 | 289 | ]; |
290 | 290 | |
291 | - if(!empty($over)) |
|
291 | + if (!empty($over)) |
|
292 | 292 | { |
293 | - foreach($over as $ov) |
|
293 | + foreach ($over as $ov) |
|
294 | 294 | { |
295 | 295 | $res[] = [ |
296 | 296 | 'type' => 'error', |
297 | 297 | 'value' => ' Link for '.$ov['username'].' is '.$ov['age'].' days old' |
298 | 298 | ]; |
299 | 299 | |
300 | - if($this->fix) |
|
300 | + if ($this->fix) |
|
301 | 301 | { |
302 | 302 | UserInitialize::where('username', $ov['username'])->delete(); |
303 | 303 | $res[] = [ |
@@ -318,7 +318,7 @@ discard block |
||
318 | 318 | $files = Files::all(); |
319 | 319 | |
320 | 320 | $fileArr = []; |
321 | - foreach($files as $f) |
|
321 | + foreach ($files as $f) |
|
322 | 322 | { |
323 | 323 | $fileArr[] = $f->file_id; |
324 | 324 | } |
@@ -343,10 +343,10 @@ discard block |
||
343 | 343 | ]; |
344 | 344 | |
345 | 345 | // Verify all files have a database pointer and a valid file |
346 | - foreach($sysFiles as $file) |
|
346 | + foreach ($sysFiles as $file) |
|
347 | 347 | { |
348 | 348 | // Verify database pointer |
349 | - if(!in_array($file->file_id, $this->fileArr)) |
|
349 | + if (!in_array($file->file_id, $this->fileArr)) |
|
350 | 350 | { |
351 | 351 | $badPointer++; |
352 | 352 | $res2[] = [ |
@@ -355,7 +355,7 @@ discard block |
||
355 | 355 | 'repOnly' => true |
356 | 356 | ]; |
357 | 357 | |
358 | - if($this->fix) |
|
358 | + if ($this->fix) |
|
359 | 359 | { |
360 | 360 | SystemFiles::find($file->sys_file_id)->delete(); |
361 | 361 | $res2[] = [ |
@@ -369,7 +369,7 @@ discard block |
||
369 | 369 | { |
370 | 370 | // Verify that the file exists |
371 | 371 | $fileData = Files::find($file->file_id); |
372 | - if(!Storage::exists($fileData->file_link.$fileData->file_name)) |
|
372 | + if (!Storage::exists($fileData->file_link.$fileData->file_name)) |
|
373 | 373 | { |
374 | 374 | $missingFile++; |
375 | 375 | $res2[] = [ |
@@ -378,7 +378,7 @@ discard block |
||
378 | 378 | 'repOnly' => true |
379 | 379 | ]; |
380 | 380 | |
381 | - if($this->fix) |
|
381 | + if ($this->fix) |
|
382 | 382 | { |
383 | 383 | $file->delete(); |
384 | 384 | $fileData->delete(); |
@@ -396,13 +396,13 @@ discard block |
||
396 | 396 | } |
397 | 397 | |
398 | 398 | // Error messages if pointer bad or file missing |
399 | - if($badPointer) |
|
399 | + if ($badPointer) |
|
400 | 400 | { |
401 | 401 | $res[] = [ |
402 | 402 | 'type' => 'error', |
403 | 403 | 'value' => ' Bad file pointers............'.$badPointer |
404 | 404 | ]; |
405 | - if($this->fix) |
|
405 | + if ($this->fix) |
|
406 | 406 | { |
407 | 407 | $res[] = [ |
408 | 408 | 'type' => 'info', |
@@ -410,13 +410,13 @@ discard block |
||
410 | 410 | ]; |
411 | 411 | } |
412 | 412 | } |
413 | - if($missingFile) |
|
413 | + if ($missingFile) |
|
414 | 414 | { |
415 | 415 | $res[] = [ |
416 | 416 | 'type' => 'error', |
417 | 417 | 'value' => ' Missing Files................'.$missingFile |
418 | 418 | ]; |
419 | - if($this->fix) |
|
419 | + if ($this->fix) |
|
420 | 420 | { |
421 | 421 | $res[] = [ |
422 | 422 | 'type' => 'info', |
@@ -447,10 +447,10 @@ discard block |
||
447 | 447 | ]; |
448 | 448 | |
449 | 449 | // Verify all files have a database pointer and a valid file |
450 | - foreach($custFiles as $file) |
|
450 | + foreach ($custFiles as $file) |
|
451 | 451 | { |
452 | 452 | // Verify database pointer |
453 | - if(!in_array($file->file_id, $this->fileArr)) |
|
453 | + if (!in_array($file->file_id, $this->fileArr)) |
|
454 | 454 | { |
455 | 455 | $badPointer++; |
456 | 456 | $res2[] = [ |
@@ -459,7 +459,7 @@ discard block |
||
459 | 459 | 'repOnly' => true |
460 | 460 | ]; |
461 | 461 | |
462 | - if($this->fix) |
|
462 | + if ($this->fix) |
|
463 | 463 | { |
464 | 464 | CustomerFiles::find($file->cust_file_id)->delete(); |
465 | 465 | $res2[] = [ |
@@ -473,7 +473,7 @@ discard block |
||
473 | 473 | { |
474 | 474 | // Verify that the file exists |
475 | 475 | $fileData = Files::find($file->file_id); |
476 | - if(!Storage::exists($fileData->file_link.$fileData->file_name)) |
|
476 | + if (!Storage::exists($fileData->file_link.$fileData->file_name)) |
|
477 | 477 | { |
478 | 478 | $missingFile++; |
479 | 479 | $res2[] = [ |
@@ -482,7 +482,7 @@ discard block |
||
482 | 482 | 'repOnly' => true |
483 | 483 | ]; |
484 | 484 | |
485 | - if($this->fix) |
|
485 | + if ($this->fix) |
|
486 | 486 | { |
487 | 487 | $file->delete(); |
488 | 488 | $fileData->delete(); |
@@ -499,13 +499,13 @@ discard block |
||
499 | 499 | } |
500 | 500 | |
501 | 501 | // Error messages if pointer bad or file missing |
502 | - if($badPointer) |
|
502 | + if ($badPointer) |
|
503 | 503 | { |
504 | 504 | $res[] = [ |
505 | 505 | 'type' => 'error', |
506 | 506 | 'value' => ' Bad file pointers............'.$badPointer |
507 | 507 | ]; |
508 | - if($this->fix) |
|
508 | + if ($this->fix) |
|
509 | 509 | { |
510 | 510 | $res[] = [ |
511 | 511 | 'type' => 'info', |
@@ -513,13 +513,13 @@ discard block |
||
513 | 513 | ]; |
514 | 514 | } |
515 | 515 | } |
516 | - if($missingFile) |
|
516 | + if ($missingFile) |
|
517 | 517 | { |
518 | 518 | $res[] = [ |
519 | 519 | 'type' => 'error', |
520 | 520 | 'value' => ' Missing Files................'.$missingFile |
521 | 521 | ]; |
522 | - if($this->fix) |
|
522 | + if ($this->fix) |
|
523 | 523 | { |
524 | 524 | $res[] = [ |
525 | 525 | 'type' => 'info', |
@@ -550,10 +550,10 @@ discard block |
||
550 | 550 | ]; |
551 | 551 | |
552 | 552 | // Verify all files have a database pointer and a valid file |
553 | - foreach($linkFiles as $file) |
|
553 | + foreach ($linkFiles as $file) |
|
554 | 554 | { |
555 | 555 | // Verify database pointer |
556 | - if(!in_array($file->file_id, $this->fileArr)) |
|
556 | + if (!in_array($file->file_id, $this->fileArr)) |
|
557 | 557 | { |
558 | 558 | $badPointer++; |
559 | 559 | $res2[] = [ |
@@ -562,7 +562,7 @@ discard block |
||
562 | 562 | 'repOnly' => true |
563 | 563 | ]; |
564 | 564 | |
565 | - if($this->fix) |
|
565 | + if ($this->fix) |
|
566 | 566 | { |
567 | 567 | FileLinkFiles::find($file->cust_file_id)->delete(); |
568 | 568 | $res2[] = [ |
@@ -576,7 +576,7 @@ discard block |
||
576 | 576 | { |
577 | 577 | // Verify that the file exists |
578 | 578 | $fileData = Files::find($file->file_id); |
579 | - if(!Storage::exists($fileData->file_link.$fileData->file_name)) |
|
579 | + if (!Storage::exists($fileData->file_link.$fileData->file_name)) |
|
580 | 580 | { |
581 | 581 | $missingFile++; |
582 | 582 | $res2[] = [ |
@@ -585,7 +585,7 @@ discard block |
||
585 | 585 | 'repOnly' => true |
586 | 586 | ]; |
587 | 587 | |
588 | - if($this->fix) |
|
588 | + if ($this->fix) |
|
589 | 589 | { |
590 | 590 | $file->delete(); |
591 | 591 | $fileData->delete(); |
@@ -602,13 +602,13 @@ discard block |
||
602 | 602 | } |
603 | 603 | |
604 | 604 | // Error messages if pointer bad or file missing |
605 | - if($badPointer) |
|
605 | + if ($badPointer) |
|
606 | 606 | { |
607 | 607 | $res[] = [ |
608 | 608 | 'type' => 'error', |
609 | 609 | 'value' => ' Bad file pointers............'.$badPointer |
610 | 610 | ]; |
611 | - if($this->fix) |
|
611 | + if ($this->fix) |
|
612 | 612 | { |
613 | 613 | $res[] = [ |
614 | 614 | 'type' => 'info', |
@@ -616,13 +616,13 @@ discard block |
||
616 | 616 | ]; |
617 | 617 | } |
618 | 618 | } |
619 | - if($missingFile) |
|
619 | + if ($missingFile) |
|
620 | 620 | { |
621 | 621 | $res[] = [ |
622 | 622 | 'type' => 'error', |
623 | 623 | 'value' => ' Missing Files................'.$missingFile |
624 | 624 | ]; |
625 | - if($this->fix) |
|
625 | + if ($this->fix) |
|
626 | 626 | { |
627 | 627 | $res[] = [ |
628 | 628 | 'type' => 'info', |
@@ -653,10 +653,10 @@ discard block |
||
653 | 653 | ]; |
654 | 654 | |
655 | 655 | // Verify all files have a database pointer and a valid file |
656 | - foreach($tipFiles as $file) |
|
656 | + foreach ($tipFiles as $file) |
|
657 | 657 | { |
658 | 658 | // Verify database pointer |
659 | - if(!in_array($file->file_id, $this->fileArr)) |
|
659 | + if (!in_array($file->file_id, $this->fileArr)) |
|
660 | 660 | { |
661 | 661 | $badPointer++; |
662 | 662 | $res2[] = [ |
@@ -665,7 +665,7 @@ discard block |
||
665 | 665 | 'repOnly' => true |
666 | 666 | ]; |
667 | 667 | |
668 | - if($this->fix) |
|
668 | + if ($this->fix) |
|
669 | 669 | { |
670 | 670 | TechTipFiles::find($file->cust_file_id)->delete(); |
671 | 671 | $res2[] = [ |
@@ -679,7 +679,7 @@ discard block |
||
679 | 679 | { |
680 | 680 | // Verify that the file exists |
681 | 681 | $fileData = Files::find($file->file_id); |
682 | - if(!Storage::exists($fileData->file_link.$fileData->file_name)) |
|
682 | + if (!Storage::exists($fileData->file_link.$fileData->file_name)) |
|
683 | 683 | { |
684 | 684 | $missingFile++; |
685 | 685 | $res2[] = [ |
@@ -688,7 +688,7 @@ discard block |
||
688 | 688 | 'repOnly' => true |
689 | 689 | ]; |
690 | 690 | |
691 | - if($this->fix) |
|
691 | + if ($this->fix) |
|
692 | 692 | { |
693 | 693 | $file->delete(); |
694 | 694 | $fileData->delete(); |
@@ -705,13 +705,13 @@ discard block |
||
705 | 705 | } |
706 | 706 | |
707 | 707 | // Error messages if pointer bad or file missing |
708 | - if($badPointer) |
|
708 | + if ($badPointer) |
|
709 | 709 | { |
710 | 710 | $res[] = [ |
711 | 711 | 'type' => 'error', |
712 | 712 | 'value' => ' Bad file pointers............'.$badPointer |
713 | 713 | ]; |
714 | - if($this->fix) |
|
714 | + if ($this->fix) |
|
715 | 715 | { |
716 | 716 | $res[] = [ |
717 | 717 | 'type' => 'info', |
@@ -719,13 +719,13 @@ discard block |
||
719 | 719 | ]; |
720 | 720 | } |
721 | 721 | } |
722 | - if($missingFile) |
|
722 | + if ($missingFile) |
|
723 | 723 | { |
724 | 724 | $res[] = [ |
725 | 725 | 'type' => 'error', |
726 | 726 | 'value' => ' Missing Files................'.$missingFile |
727 | 727 | ]; |
728 | - if($this->fix) |
|
728 | + if ($this->fix) |
|
729 | 729 | { |
730 | 730 | $res[] = [ |
731 | 731 | 'type' => 'info', |
@@ -745,13 +745,13 @@ discard block |
||
745 | 745 | $res = []; |
746 | 746 | |
747 | 747 | $res[] = [ |
748 | - 'type' => count($this->fileArr) > 0 ? 'error' : 'line', |
|
748 | + 'type' => count($this->fileArr)>0 ? 'error' : 'line', |
|
749 | 749 | 'value' => 'Unknown Files.....................'.count($this->fileArr) |
750 | 750 | ]; |
751 | 751 | |
752 | - if(count($this->fileArr) > 0) |
|
752 | + if (count($this->fileArr)>0) |
|
753 | 753 | { |
754 | - foreach($this->fileArr as $file) |
|
754 | + foreach ($this->fileArr as $file) |
|
755 | 755 | { |
756 | 756 | $fileData = Files::find($file); |
757 | 757 | |
@@ -761,7 +761,7 @@ discard block |
||
761 | 761 | 'repOnly' => true |
762 | 762 | ]; |
763 | 763 | |
764 | - if($this->fix) |
|
764 | + if ($this->fix) |
|
765 | 765 | { |
766 | 766 | $res[] = [ |
767 | 767 | 'type' => 'info', |
@@ -769,7 +769,7 @@ discard block |
||
769 | 769 | 'repOnly' => true |
770 | 770 | ]; |
771 | 771 | |
772 | - if(!Storage::exists($fileData->file_link.$fileData->file_name)) |
|
772 | + if (!Storage::exists($fileData->file_link.$fileData->file_name)) |
|
773 | 773 | { |
774 | 774 | Storage::delete($fileData->file_link.$fileData->file_name); |
775 | 775 | } |
@@ -819,22 +819,22 @@ discard block |
||
819 | 819 | |
820 | 820 | $allFiles = File::allFiles(config('filesystems.disks.local.root')); |
821 | 821 | |
822 | - foreach($allFiles as $pos => $file) |
|
822 | + foreach ($allFiles as $pos => $file) |
|
823 | 823 | { |
824 | 824 | $dbFile = Files::where('file_name', basename($file))->get(); |
825 | 825 | |
826 | - if(!$dbFile->isEmpty()) |
|
826 | + if (!$dbFile->isEmpty()) |
|
827 | 827 | { |
828 | 828 | unset($allFiles[$pos]); |
829 | 829 | } |
830 | 830 | } |
831 | 831 | |
832 | 832 | $res[] = [ |
833 | - 'type' => count($allFiles) > 0 ? 'error' : 'line', |
|
833 | + 'type' => count($allFiles)>0 ? 'error' : 'line', |
|
834 | 834 | 'value' => 'Rogue Files.......................'.count($allFiles) |
835 | 835 | ]; |
836 | 836 | |
837 | - if($this->fix && count($allFiles) > 0) |
|
837 | + if ($this->fix && count($allFiles)>0) |
|
838 | 838 | { |
839 | 839 | $res[] = [ |
840 | 840 | 'type' => 'info', |
@@ -842,9 +842,9 @@ discard block |
||
842 | 842 | ]; |
843 | 843 | } |
844 | 844 | |
845 | - if(count($allFiles) > 0) |
|
845 | + if (count($allFiles)>0) |
|
846 | 846 | { |
847 | - foreach($allFiles as $file) |
|
847 | + foreach ($allFiles as $file) |
|
848 | 848 | { |
849 | 849 | $res[] = [ |
850 | 850 | 'type' => 'info', |
@@ -852,7 +852,7 @@ discard block |
||
852 | 852 | 'repOnly' => true |
853 | 853 | ]; |
854 | 854 | |
855 | - if($this->fix) |
|
855 | + if ($this->fix) |
|
856 | 856 | { |
857 | 857 | Storage::delete($file); |
858 | 858 | $res[] = [ |
@@ -364,8 +364,7 @@ discard block |
||
364 | 364 | 'repOnly' => true |
365 | 365 | ]; |
366 | 366 | } |
367 | - } |
|
368 | - else |
|
367 | + } else |
|
369 | 368 | { |
370 | 369 | // Verify that the file exists |
371 | 370 | $fileData = Files::find($file->file_id); |
@@ -468,8 +467,7 @@ discard block |
||
468 | 467 | 'repOnly' => true |
469 | 468 | ]; |
470 | 469 | } |
471 | - } |
|
472 | - else |
|
470 | + } else |
|
473 | 471 | { |
474 | 472 | // Verify that the file exists |
475 | 473 | $fileData = Files::find($file->file_id); |
@@ -571,8 +569,7 @@ discard block |
||
571 | 569 | 'repOnly' => true |
572 | 570 | ]; |
573 | 571 | } |
574 | - } |
|
575 | - else |
|
572 | + } else |
|
576 | 573 | { |
577 | 574 | // Verify that the file exists |
578 | 575 | $fileData = Files::find($file->file_id); |
@@ -674,8 +671,7 @@ discard block |
||
674 | 671 | 'repOnly' => true |
675 | 672 | ]; |
676 | 673 | } |
677 | - } |
|
678 | - else |
|
674 | + } else |
|
679 | 675 | { |
680 | 676 | // Verify that the file exists |
681 | 677 | $fileData = Files::find($file->file_id); |
@@ -42,7 +42,7 @@ discard block |
||
42 | 42 | { |
43 | 43 | $hash = strtolower(str_random(15)); |
44 | 44 | $dup = FileLinks::where('link_hash', $hash)->get()->count(); |
45 | - }while($dup != 0); |
|
45 | + } while ($dup != 0); |
|
46 | 46 | |
47 | 47 | // Create the new file link |
48 | 48 | $link = FileLinks::create([ |
@@ -55,10 +55,10 @@ discard block |
||
55 | 55 | $linkID = $link->link_id; |
56 | 56 | |
57 | 57 | // If there are any files, process them |
58 | - if(!empty($request->file)) |
|
58 | + if (!empty($request->file)) |
|
59 | 59 | { |
60 | 60 | $filePath = config('filesystems.paths.links').DIRECTORY_SEPARATOR.$linkID; |
61 | - foreach($request->file as $file) |
|
61 | + foreach ($request->file as $file) |
|
62 | 62 | { |
63 | 63 | // Clean the file and store it |
64 | 64 | $fileName = Files::cleanFilename($filePath, $file->getClientOriginalName()); |
@@ -107,7 +107,7 @@ discard block |
||
107 | 107 | { |
108 | 108 | $linkData = FileLinks::find($id); |
109 | 109 | |
110 | - if(empty($linkData)) |
|
110 | + if (empty($linkData)) |
|
111 | 111 | { |
112 | 112 | return view('links.badLink'); |
113 | 113 | } |
@@ -124,7 +124,7 @@ discard block |
||
124 | 124 | public function getFiles($type, $linkID) |
125 | 125 | { |
126 | 126 | $files = null; |
127 | - switch($type) |
|
127 | + switch ($type) |
|
128 | 128 | { |
129 | 129 | case 'down': |
130 | 130 | $files = FileLInkFiles::where('link_id', $linkID) |
@@ -160,7 +160,7 @@ discard block |
||
160 | 160 | public function submitAddFile($id, Request $request) |
161 | 161 | { |
162 | 162 | $filePath = config('filesystems.paths.links').DIRECTORY_SEPARATOR.$id; |
163 | - foreach($request->file as $file) |
|
163 | + foreach ($request->file as $file) |
|
164 | 164 | { |
165 | 165 | // Clean the file and store it |
166 | 166 | $fileName = Files::cleanFilename($filePath, $file->getClientOriginalName()); |
@@ -215,7 +215,7 @@ discard block |
||
215 | 215 | $path = config('filesystems.disks.local.root').DIRECTORY_SEPARATOR; |
216 | 216 | |
217 | 217 | $zip = Zip::create($path.'download.zip'); |
218 | - foreach($files as $file) |
|
218 | + foreach ($files as $file) |
|
219 | 219 | { |
220 | 220 | $zip->add($path.$file->file_link.$file->file_name); |
221 | 221 | } |
@@ -257,9 +257,9 @@ discard block |
||
257 | 257 | { |
258 | 258 | // Remove the file from database |
259 | 259 | $data = FileLinkFiles::where('link_id', $id)->get(); |
260 | - if(!$data->isEmpty()) |
|
260 | + if (!$data->isEmpty()) |
|
261 | 261 | { |
262 | - foreach($data as $file) |
|
262 | + foreach ($data as $file) |
|
263 | 263 | { |
264 | 264 | $fileID = $file->file_id; |
265 | 265 | $file->delete(); |