Installation.php 918 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. <?php
  2. ###
  3. # @name Installation Access
  4. # @copyright 2015 by Tobias Reich
  5. ###
  6. if (!defined('LYCHEE')) exit('Error: Direct access is not allowed!');
  7. if (!defined('LYCHEE_ACCESS_INSTALLATION')) exit('Error: You are not allowed to access this area!');
  8. class Installation extends Access {
  9. public function check($fn) {
  10. switch ($fn) {
  11. case 'Database::createConfig': $this->dbCreateConfig(); break;
  12. # Error
  13. default: $this->init(); break;
  14. }
  15. return true;
  16. }
  17. private function dbCreateConfig() {
  18. Module::dependencies(isset($_POST['dbHost'], $_POST['dbUser'], $_POST['dbPassword'], $_POST['dbName'], $_POST['dbTablePrefix']));
  19. echo Database::createConfig($_POST['dbHost'], $_POST['dbUser'], $_POST['dbPassword'], $_POST['dbName'], $_POST['dbTablePrefix']);
  20. }
  21. private function init() {
  22. $return = array(
  23. 'status' => LYCHEE_STATUS_NOCONFIG
  24. );
  25. echo json_encode($return);
  26. }
  27. }
  28. ?>