Added table prefix to create dialog (#214 #196)

This commit is contained in:
Tobias Reich 2014-08-29 19:55:21 +02:00
parent 52b530f85e
commit 32af951c77
5 changed files with 18 additions and 15 deletions

View File

@ -13,6 +13,7 @@ var settings = {
dbUser,
dbPassword,
dbHost,
dbTablePrefix,
buttons,
params;
@ -23,11 +24,12 @@ var settings = {
dbUser = $(".message input.text#dbUser").val();
dbPassword = $(".message input.text#dbPassword").val();
dbName = $(".message input.text#dbName").val();
dbTablePrefix = $(".message input.text#dbTablePrefix").val();
if (dbHost.length<1) dbHost = "localhost";
if (dbName.length<1) dbName = "lychee";
params = "dbCreateConfig&dbName=" + escape(dbName) + "&dbUser=" + escape(dbUser) + "&dbPassword=" + escape(dbPassword) + "&dbHost=" + escape(dbHost);
params = "dbCreateConfig&dbName=" + escape(dbName) + "&dbUser=" + escape(dbUser) + "&dbPassword=" + escape(dbPassword) + "&dbHost=" + escape(dbHost) + "&dbTablePrefix=" + escape(dbTablePrefix);
lychee.api(params, function(data) {
if (data!==true) {
@ -94,7 +96,7 @@ var settings = {
["", function() {}]
];
modal.show("Configuration", "Enter your database connection details below: <input id='dbHost' class='text less' type='text' placeholder='Host (optional)' value=''><input id='dbUser' class='text less' type='text' placeholder='Username' value=''><input id='dbPassword' class='text more' type='password' placeholder='Password' value=''><br>Lychee will create its own database. If required, you can enter the name of an existing database instead:<input id='dbName' class='text more' type='text' placeholder='Database (optional)' value=''>", buttons, -215, false);
modal.show("Configuration", "Enter your database connection details below: <input id='dbHost' class='text less' type='text' placeholder='Database Host (optional)' value=''><input id='dbUser' class='text less' type='text' placeholder='Database Username' value=''><input id='dbPassword' class='text more' type='password' placeholder='Database Password' value=''><br>Lychee will create its own database. If required, you can enter the name of an existing database instead:<input id='dbName' class='text less' type='text' placeholder='Database Name (optional)' value=''><input id='dbTablePrefix' class='text more' type='text' placeholder='Table prefix (optional)' value=''>", buttons, -235, false);
},

0
assets/min/main.css Normal file → Executable file
View File

File diff suppressed because one or more lines are too long

View File

@ -29,8 +29,8 @@ class Installation extends Access {
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']);
Module::dependencies(isset($_POST['dbHost'], $_POST['dbUser'], $_POST['dbPassword'], $_POST['dbName'], $_POST['dbTablePrefix']));
echo Database::createConfig($_POST['dbHost'], $_POST['dbUser'], $_POST['dbPassword'], $_POST['dbName'], $_POST['dbTablePrefix']);
}

View File

@ -66,7 +66,7 @@ class Database extends Module {
}
static function createConfig($host = 'localhost', $user, $password, $name = 'lychee') {
static function createConfig($host = 'localhost', $user, $password, $name = 'lychee', $prefix = '') {
# Check dependencies
Module::dependencies(isset($host, $user, $password, $name));
@ -102,6 +102,7 @@ if(!defined('LYCHEE')) exit('Error: Direct access is not allowed!');
\$dbUser = '$user'; # Username of the database
\$dbPassword = '$password'; # Password of the database
\$dbName = '$name'; # Database name
\$dbTablePrefix = '$prefix'; # Table prefix
?>";