Rewritten Installation Access
This commit is contained in:
parent
091381a2a3
commit
aaca8b42c0
@ -1,23 +0,0 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @name Installation Access
|
||||
* @author Tobias Reich
|
||||
* @copyright 2014 by Tobias Reich
|
||||
*/
|
||||
|
||||
if (!defined('LYCHEE')) exit('Error: Direct access is not allowed!');
|
||||
if (!defined('LYCHEE_ACCESS_INSTALLATION')) exit('Error: You are not allowed to access this area!');
|
||||
|
||||
switch ($_POST['function']) {
|
||||
|
||||
case 'dbCreateConfig': Module::dependencies(isset($_POST['dbHost'], $_POST['dbUser'], $_POST['dbPassword'], $_POST['dbName']));
|
||||
echo Database::createConfig($_POST['dbHost'], $_POST['dbUser'], $_POST['dbPassword'], $_POST['dbName']);
|
||||
break;
|
||||
|
||||
default: echo 'Warning: No configuration!';
|
||||
break;
|
||||
|
||||
}
|
||||
|
||||
?>
|
39
php/access/installation_foo.php
Normal file
39
php/access/installation_foo.php
Normal file
@ -0,0 +1,39 @@
|
||||
<?php
|
||||
|
||||
###
|
||||
# @name Installation Access
|
||||
# @author Tobias Reich
|
||||
# @copyright 2014 by Tobias Reich
|
||||
###
|
||||
|
||||
if (!defined('LYCHEE')) exit('Error: Direct access is not allowed!');
|
||||
if (!defined('LYCHEE_ACCESS_INSTALLATION')) exit('Error: You are not allowed to access this area!');
|
||||
|
||||
class Installation extends Access {
|
||||
|
||||
public function check($fn) {
|
||||
|
||||
switch ($fn) {
|
||||
|
||||
case 'dbCreateConfig': $this->dbCreateConfig(); break;
|
||||
|
||||
# Error
|
||||
default: exit('Warning: No configuration!');
|
||||
return false; break;
|
||||
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
}
|
||||
|
||||
private function dbCreateConfig() {
|
||||
|
||||
Module::dependencies(isset($_POST['dbHost'], $_POST['dbUser'], $_POST['dbPassword'], $_POST['dbName']));
|
||||
echo Database::createConfig($_POST['dbHost'], $_POST['dbUser'], $_POST['dbPassword'], $_POST['dbName']);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
?>
|
@ -35,7 +35,11 @@ if (!empty($_POST['function'])||!empty($_GET['function'])) {
|
||||
###
|
||||
|
||||
define('LYCHEE_ACCESS_INSTALLATION', true);
|
||||
require(__DIR__ . '/access/installation.php');
|
||||
require(__DIR__ . '/access/installation_foo.php');
|
||||
|
||||
$installation = new Installation(null, null, null);
|
||||
$installation->check($_POST['function']);
|
||||
|
||||
exit();
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user