Installation.php 795 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. <?php
  2. namespace Lychee\Access;
  3. use Lychee\Modules\Config;
  4. use Lychee\Modules\Validator;
  5. final class Installation extends Access {
  6. public static function init($fn) {
  7. switch ($fn) {
  8. case 'Config::create': self::configCreateAction(); break;
  9. // Error
  10. default: self::initAction(); break;
  11. }
  12. return true;
  13. }
  14. private static function configCreateAction() {
  15. Validator::required(isset($_POST['dbHost'], $_POST['dbUser'], $_POST['dbPassword'], $_POST['dbName'], $_POST['dbTablePrefix']));
  16. echo Config::create($_POST['dbHost'], $_POST['dbUser'], $_POST['dbPassword'], $_POST['dbName'], $_POST['dbTablePrefix']);
  17. }
  18. private static function initAction() {
  19. $return = array(
  20. 'status' => LYCHEE_STATUS_NOCONFIG
  21. );
  22. echo json_encode($return);
  23. }
  24. }
  25. ?>