@@ -2,10 +2,6 @@ |
||
| 2 | 2 | |
| 3 | 3 | namespace App\Http\Controllers; |
| 4 | 4 | |
| 5 | -use Illuminate\Http\Request; |
|
| 6 | - |
|
| 7 | -use App\Http\Requests; |
|
| 8 | -use App\User; |
|
| 9 | 5 | use Auth; |
| 10 | 6 | |
| 11 | 7 | class UserController extends Controller |
@@ -29,6 +29,7 @@ discard block |
||
| 29 | 29 | /** |
| 30 | 30 | * Get the content of the .env file. |
| 31 | 31 | * |
| 32 | + * @param Request $request |
|
| 32 | 33 | * @return string |
| 33 | 34 | */ |
| 34 | 35 | public function getEnvContent($request) |
@@ -48,7 +49,6 @@ discard block |
||
| 48 | 49 | /** |
| 49 | 50 | * Save the edited content to the file. |
| 50 | 51 | * |
| 51 | - * @param Request $input |
|
| 52 | 52 | * @return boolean |
| 53 | 53 | */ |
| 54 | 54 | public function saveFile(Request $request) |
@@ -36,9 +36,9 @@ discard block |
||
| 36 | 36 | $data = $request->session()->all(); |
| 37 | 37 | |
| 38 | 38 | $env = ''; |
| 39 | - foreach($data as $key => $value) { |
|
| 40 | - if(preg_match('/^[A-Z]+_[A-Z]+$/', $key)) { |
|
| 41 | - $env .= "${key}=${value}" . PHP_EOL; |
|
| 39 | + foreach ($data as $key => $value) { |
|
| 40 | + if (preg_match('/^[A-Z]+_[A-Z]+$/', $key)) { |
|
| 41 | + $env .= "${key}=${value}".PHP_EOL; |
|
| 42 | 42 | } |
| 43 | 43 | } |
| 44 | 44 | |
@@ -58,7 +58,7 @@ discard block |
||
| 58 | 58 | |
| 59 | 59 | try { |
| 60 | 60 | file_put_contents($this->envPath, $request->get('envConfig')); |
| 61 | - } catch(Exception $e) { |
|
| 61 | + } catch (Exception $e) { |
|
| 62 | 62 | $status = false; |
| 63 | 63 | } |
| 64 | 64 | |
@@ -75,7 +75,7 @@ |
||
| 75 | 75 | * |
| 76 | 76 | * @param $folder |
| 77 | 77 | * @param $permission |
| 78 | - * @param $isSet |
|
| 78 | + * @param boolean $isSet |
|
| 79 | 79 | */ |
| 80 | 80 | private function addFileAndSetErrors($folder, $permission, $isSet) |
| 81 | 81 | { |
@@ -29,9 +29,9 @@ |
||
| 29 | 29 | */ |
| 30 | 30 | public function check(array $folders) |
| 31 | 31 | { |
| 32 | - foreach($folders as $folder => $permission) |
|
| 32 | + foreach ($folders as $folder => $permission) |
|
| 33 | 33 | { |
| 34 | - if(!($this->getPermission($folder) >= $permission)) |
|
| 34 | + if (!($this->getPermission($folder) >= $permission)) |
|
| 35 | 35 | { |
| 36 | 36 | $this->addFileAndSetErrors($folder, $permission, false); |
| 37 | 37 | } |
@@ -34,8 +34,7 @@ |
||
| 34 | 34 | if(!($this->getPermission($folder) >= $permission)) |
| 35 | 35 | { |
| 36 | 36 | $this->addFileAndSetErrors($folder, $permission, false); |
| 37 | - } |
|
| 38 | - else { |
|
| 37 | + } else { |
|
| 39 | 38 | $this->addFile($folder, $permission, true); |
| 40 | 39 | } |
| 41 | 40 | } |
@@ -3,7 +3,6 @@ |
||
| 3 | 3 | namespace App\Http\Middleware; |
| 4 | 4 | |
| 5 | 5 | use Closure; |
| 6 | -use Illuminate\Support\Facades\Auth; |
|
| 7 | 6 | use App\Http\Middleware\RedirectIfInstalled; |
| 8 | 7 | |
| 9 | 8 | class RedirectIfNotInstalled extends RedirectIfInstalled |
@@ -13,7 +13,6 @@ |
||
| 13 | 13 | * |
| 14 | 14 | * @param \Illuminate\Http\Request $request |
| 15 | 15 | * @param \Closure $next |
| 16 | - * @param string|null $guard |
|
| 17 | 16 | * @return mixed |
| 18 | 17 | */ |
| 19 | 18 | public function handle($request, Closure $next) |
@@ -40,31 +40,31 @@ |
||
| 40 | 40 | * |
| 41 | 41 | * @return mixed |
| 42 | 42 | */ |
| 43 | - public function handle() |
|
| 44 | - { |
|
| 45 | - $categories = Category::get(); |
|
| 43 | + public function handle() |
|
| 44 | + { |
|
| 45 | + $categories = Category::get(); |
|
| 46 | 46 | |
| 47 | - if ($categories->isEmpty()) { |
|
| 48 | - $this->info("No categories to export"); |
|
| 49 | - return; |
|
| 50 | - } |
|
| 47 | + if ($categories->isEmpty()) { |
|
| 48 | + $this->info("No categories to export"); |
|
| 49 | + return; |
|
| 50 | + } |
|
| 51 | 51 | |
| 52 | - foreach ($categories as $category){ |
|
| 53 | - $name = static::stringNormalise($category->name); |
|
| 54 | - $filename = 'export/categories/' . $name . '.txt'; |
|
| 55 | - $accounts = Account::where('status', 1) |
|
| 52 | + foreach ($categories as $category){ |
|
| 53 | + $name = static::stringNormalise($category->name); |
|
| 54 | + $filename = 'export/categories/' . $name . '.txt'; |
|
| 55 | + $accounts = Account::where('status', 1) |
|
| 56 | 56 | ->where('category_id', $category->id) |
| 57 | 57 | ->orderBy('netlogin', 'desc') |
| 58 | 58 | ->get(); |
| 59 | - Storage::put($filename, ''); |
|
| 60 | - $count = count($accounts); |
|
| 61 | - $bar = $this->output->createProgressBar($count); |
|
| 62 | - foreach ($accounts as $account) { |
|
| 63 | - Storage::prepend($filename, "{$account->netlogin}:{$account->netpass}"); |
|
| 64 | - $bar->advance(); |
|
| 65 | - } |
|
| 66 | - $bar->finish(); |
|
| 67 | - $this->info("\n{$count} accounts '{$category->name}' exported into file 'storage/app/{$filename}'"); |
|
| 68 | - } |
|
| 69 | - } |
|
| 59 | + Storage::put($filename, ''); |
|
| 60 | + $count = count($accounts); |
|
| 61 | + $bar = $this->output->createProgressBar($count); |
|
| 62 | + foreach ($accounts as $account) { |
|
| 63 | + Storage::prepend($filename, "{$account->netlogin}:{$account->netpass}"); |
|
| 64 | + $bar->advance(); |
|
| 65 | + } |
|
| 66 | + $bar->finish(); |
|
| 67 | + $this->info("\n{$count} accounts '{$category->name}' exported into file 'storage/app/{$filename}'"); |
|
| 68 | + } |
|
| 69 | + } |
|
| 70 | 70 | } |
@@ -49,9 +49,9 @@ |
||
| 49 | 49 | return; |
| 50 | 50 | } |
| 51 | 51 | |
| 52 | - foreach ($categories as $category){ |
|
| 52 | + foreach ($categories as $category) { |
|
| 53 | 53 | $name = static::stringNormalise($category->name); |
| 54 | - $filename = 'export/categories/' . $name . '.txt'; |
|
| 54 | + $filename = 'export/categories/'.$name.'.txt'; |
|
| 55 | 55 | $accounts = Account::where('status', 1) |
| 56 | 56 | ->where('category_id', $category->id) |
| 57 | 57 | ->orderBy('netlogin', 'desc') |
@@ -40,31 +40,31 @@ |
||
| 40 | 40 | * |
| 41 | 41 | * @return mixed |
| 42 | 42 | */ |
| 43 | - public function handle() |
|
| 44 | - { |
|
| 45 | - $groups = Group::get(); |
|
| 43 | + public function handle() |
|
| 44 | + { |
|
| 45 | + $groups = Group::get(); |
|
| 46 | 46 | |
| 47 | - if ($groups->isEmpty()) { |
|
| 48 | - $this->info("No groups to export"); |
|
| 49 | - return; |
|
| 50 | - } |
|
| 47 | + if ($groups->isEmpty()) { |
|
| 48 | + $this->info("No groups to export"); |
|
| 49 | + return; |
|
| 50 | + } |
|
| 51 | 51 | |
| 52 | - foreach ($groups as $group){ |
|
| 53 | - $name = static::stringNormalise($group->name); |
|
| 54 | - $filename = 'export/groups/' . $name . '.txt'; |
|
| 55 | - $accounts = Account::where('status', 1) |
|
| 52 | + foreach ($groups as $group){ |
|
| 53 | + $name = static::stringNormalise($group->name); |
|
| 54 | + $filename = 'export/groups/' . $name . '.txt'; |
|
| 55 | + $accounts = Account::where('status', 1) |
|
| 56 | 56 | ->where('group_id', $group->id) |
| 57 | 57 | ->orderBy('netlogin', 'desc') |
| 58 | 58 | ->get(); |
| 59 | - Storage::put($filename, ''); |
|
| 60 | - $count = count($accounts); |
|
| 61 | - $bar = $this->output->createProgressBar($count); |
|
| 62 | - foreach ($accounts as $account) { |
|
| 63 | - Storage::prepend($filename, "{$account->netlogin}:{$account->netpass}"); |
|
| 64 | - $bar->advance(); |
|
| 65 | - } |
|
| 66 | - $bar->finish(); |
|
| 67 | - $this->info("\n{$count} accounts '{$group->name}' exported into file 'storage/app/{$filename}'"); |
|
| 68 | - } |
|
| 69 | - } |
|
| 59 | + Storage::put($filename, ''); |
|
| 60 | + $count = count($accounts); |
|
| 61 | + $bar = $this->output->createProgressBar($count); |
|
| 62 | + foreach ($accounts as $account) { |
|
| 63 | + Storage::prepend($filename, "{$account->netlogin}:{$account->netpass}"); |
|
| 64 | + $bar->advance(); |
|
| 65 | + } |
|
| 66 | + $bar->finish(); |
|
| 67 | + $this->info("\n{$count} accounts '{$group->name}' exported into file 'storage/app/{$filename}'"); |
|
| 68 | + } |
|
| 69 | + } |
|
| 70 | 70 | } |
@@ -49,9 +49,9 @@ |
||
| 49 | 49 | return; |
| 50 | 50 | } |
| 51 | 51 | |
| 52 | - foreach ($groups as $group){ |
|
| 52 | + foreach ($groups as $group) { |
|
| 53 | 53 | $name = static::stringNormalise($group->name); |
| 54 | - $filename = 'export/groups/' . $name . '.txt'; |
|
| 54 | + $filename = 'export/groups/'.$name.'.txt'; |
|
| 55 | 55 | $accounts = Account::where('status', 1) |
| 56 | 56 | ->where('group_id', $group->id) |
| 57 | 57 | ->orderBy('netlogin', 'desc') |
@@ -7,27 +7,27 @@ |
||
| 7 | 7 | class User extends Authenticatable |
| 8 | 8 | { |
| 9 | 9 | const USER_STATUS = [ |
| 10 | - 0 => [ 'text' => 'users.disabled', |
|
| 10 | + 0 => ['text' => 'users.disabled', |
|
| 11 | 11 | 'icon' => '', |
| 12 | - 'unicon' => '' ], |
|
| 13 | - 1 => [ 'text' => 'users.enabled', |
|
| 12 | + 'unicon' => ''], |
|
| 13 | + 1 => ['text' => 'users.enabled', |
|
| 14 | 14 | 'icon' => 'fa-check', |
| 15 | - 'unicon' => '' ] |
|
| 15 | + 'unicon' => ''] |
|
| 16 | 16 | ]; |
| 17 | 17 | |
| 18 | 18 | const USER_LEVEL = [ |
| 19 | - 1 => [ 'text' => 'users.access.local', |
|
| 19 | + 1 => ['text' => 'users.access.local', |
|
| 20 | 20 | 'icon' => 'fa-support', |
| 21 | - 'unicon' => '' ], |
|
| 22 | - 3 => [ 'text' => 'users.access.global', |
|
| 21 | + 'unicon' => ''], |
|
| 22 | + 3 => ['text' => 'users.access.global', |
|
| 23 | 23 | 'icon' => 'fa-globe', |
| 24 | - 'unicon' => '' ], |
|
| 25 | - 5 => [ 'text' => 'users.access.admin', |
|
| 24 | + 'unicon' => ''], |
|
| 25 | + 5 => ['text' => 'users.access.admin', |
|
| 26 | 26 | 'icon' => 'fa-shield', |
| 27 | - 'unicon' => '' ], |
|
| 28 | - 9 => [ 'text' => 'users.access.super', |
|
| 27 | + 'unicon' => ''], |
|
| 28 | + 9 => ['text' => 'users.access.super', |
|
| 29 | 29 | 'icon' => 'fa-rocket', |
| 30 | - 'unicon' => '' ], |
|
| 30 | + 'unicon' => ''], |
|
| 31 | 31 | ]; |
| 32 | 32 | |
| 33 | 33 | const SEARCH_CRITERIA = [ |
@@ -15,7 +15,7 @@ |
||
| 15 | 15 | */ |
| 16 | 16 | public function handle($request, Closure $next) |
| 17 | 17 | { |
| 18 | - if($this->alreadyInstalled() || !config('kleis.installer')) { |
|
| 18 | + if ($this->alreadyInstalled() || !config('kleis.installer')) { |
|
| 19 | 19 | return redirect('/'); |
| 20 | 20 | } |
| 21 | 21 | |
@@ -15,11 +15,11 @@ |
||
| 15 | 15 | { |
| 16 | 16 | $results = []; |
| 17 | 17 | |
| 18 | - foreach($requirements as $requirement) |
|
| 18 | + foreach ($requirements as $requirement) |
|
| 19 | 19 | { |
| 20 | 20 | $results['requirements'][$requirement] = true; |
| 21 | 21 | |
| 22 | - if(!extension_loaded($requirement)) |
|
| 22 | + if (!extension_loaded($requirement)) |
|
| 23 | 23 | { |
| 24 | 24 | $results['requirements'][$requirement] = false; |
| 25 | 25 | |