|
8 | 8 | use Illuminate\Support\Facades\Schema;
|
9 | 9 | use Illuminate\Support\Facades\File;
|
10 | 10 |
|
| 11 | +use GeoSot\EnvEditor\Controllers\EnvController; |
| 12 | +use GeoSot\EnvEditor\Exceptions\EnvException; |
| 13 | +use GeoSot\EnvEditor\Helpers\EnvFileContentManager; |
| 14 | +use GeoSot\EnvEditor\Helpers\EnvFilesManager; |
| 15 | +use GeoSot\EnvEditor\Helpers\EnvKeysManager; |
| 16 | +use GeoSot\EnvEditor\Facades\EnvEditor; |
| 17 | +use GeoSot\EnvEditor\ServiceProvider; |
| 18 | + |
11 | 19 | use Auth;
|
12 | 20 | use Exception;
|
13 | 21 | use ZipArchive;
|
@@ -289,11 +297,11 @@ public function editAC(request $request)
|
289 | 297 | //Saves .env config
|
290 | 298 | public function editENV(request $request)
|
291 | 299 | {
|
292 |
| - $AdvancedConfig = $request->AdvancedConfig; |
| 300 | + $config = $request->altConfig; |
293 | 301 |
|
294 |
| - file_put_contents('.env', $AdvancedConfig); |
| 302 | + file_put_contents('.env', $config); |
295 | 303 |
|
296 |
| - return view('/panel/config'); |
| 304 | + return Redirect('/panel/config'); |
297 | 305 | }
|
298 | 306 |
|
299 | 307 | //Shows config file editor page
|
@@ -458,6 +466,64 @@ public function updateThemes()
|
458 | 466 | }
|
459 | 467 |
|
460 | 468 | //Shows config file editor page
|
| 469 | + public function showConfig(request $request) |
| 470 | + { |
| 471 | + return view('/panel/config-editor'); |
| 472 | + } |
| 473 | + |
| 474 | + //Shows config file editor page |
| 475 | + public function editConfig(request $request) |
| 476 | + { |
| 477 | + |
| 478 | + $type = $request->type; |
| 479 | + $entry = $request->entry; |
| 480 | + $value = $request->value; |
| 481 | + |
| 482 | + if($type === "toggle"){ |
| 483 | + if($request->toggle != ''){$value = "auth";}else{$value = "false";} |
| 484 | + if(EnvEditor::keyExists($entry)){EnvEditor::editKey($entry, $value);} |
| 485 | + } elseif($type === "toggle2") { |
| 486 | + if($request->toggle != ''){$value = "verified";}else{$value = "auth";} |
| 487 | + if(EnvEditor::keyExists($entry)){EnvEditor::editKey($entry, $value);} |
| 488 | + } elseif($type === "text") { |
| 489 | + if(EnvEditor::keyExists($entry)){EnvEditor::editKey($entry, '"' . $value . '"');} |
| 490 | + } elseif($type === "debug") { |
| 491 | + if($request->toggle != ''){ |
| 492 | + if(EnvEditor::keyExists('APP_DEBUG')){EnvEditor::editKey('APP_DEBUG', 'true');} |
| 493 | + if(EnvEditor::keyExists('APP_ENV')){EnvEditor::editKey('APP_ENV', 'local');} |
| 494 | + if(EnvEditor::keyExists('LOG_LEVEL')){EnvEditor::editKey('LOG_LEVEL', 'debug');} |
| 495 | + } else { |
| 496 | + if(EnvEditor::keyExists('APP_DEBUG')){EnvEditor::editKey('APP_DEBUG', 'false');} |
| 497 | + if(EnvEditor::keyExists('APP_ENV')){EnvEditor::editKey('APP_ENV', 'production');} |
| 498 | + if(EnvEditor::keyExists('LOG_LEVEL')){EnvEditor::editKey('LOG_LEVEL', 'error');} |
| 499 | + } |
| 500 | + } elseif($type === "register") { |
| 501 | + if($request->toggle != ''){$register = "true";}else{$register = "false";} |
| 502 | + Page::first()->update(['register' => $register]); |
| 503 | + } elseif($type === "smtp") { |
| 504 | + if($request->toggle != ''){$value = "built-in";}else{$value = "smtp";} |
| 505 | + if(EnvEditor::keyExists('MAIL_MAILER')){EnvEditor::editKey('MAIL_MAILER', $value);} |
| 506 | + |
| 507 | + if(EnvEditor::keyExists('MAIL_HOST')){EnvEditor::editKey('MAIL_HOST', $request->MAIL_HOST);} |
| 508 | + if(EnvEditor::keyExists('MAIL_PORT')){EnvEditor::editKey('MAIL_PORT', $request->MAIL_PORT);} |
| 509 | + if(EnvEditor::keyExists('MAIL_USERNAME')){EnvEditor::editKey('MAIL_USERNAME', $request->MAIL_USERNAME);} |
| 510 | + if(EnvEditor::keyExists('MAIL_PASSWORD')){EnvEditor::editKey('MAIL_PASSWORD', $request->MAIL_PASSWORD);} |
| 511 | + if(EnvEditor::keyExists('MAIL_ENCRYPTION')){EnvEditor::editKey('MAIL_ENCRYPTION', $request->MAIL_ENCRYPTION);} |
| 512 | + if(EnvEditor::keyExists('MAIL_FROM_ADDRESS')){EnvEditor::editKey('MAIL_FROM_ADDRESS', $request->MAIL_FROM_ADDRESS);} |
| 513 | + } elseif($type === "homeurl") { |
| 514 | + if($request->value == 'default'){$value = "";}else{$value = '"' . $request->value . '"';} |
| 515 | + if(EnvEditor::keyExists($entry)){EnvEditor::editKey($entry, $value);} |
| 516 | + } else { |
| 517 | + if(EnvEditor::keyExists($entry)){EnvEditor::editKey($entry, $value);} |
| 518 | + } |
| 519 | + |
| 520 | + |
| 521 | + |
| 522 | + |
| 523 | + return Redirect('/panel/config'); |
| 524 | + } |
| 525 | + |
| 526 | + //Shows theme editor page |
461 | 527 | public function showThemes(request $request)
|
462 | 528 | {
|
463 | 529 | return view('/panel/theme');
|
|
0 commit comments