Browse Source

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

Tobias Reich 10 years ago
parent
commit
32af951c77
4 changed files with 13 additions and 10 deletions
  1. 8 6
      assets/js/settings.js
  2. 0 0
      assets/min/main.css
  3. 2 2
      php/access/Installation.php
  4. 3 2
      php/modules/Database.php

+ 8 - 6
assets/js/settings.js

@@ -13,21 +13,23 @@ var settings = {
 			dbUser,
 			dbPassword,
 			dbHost,
+			dbTablePrefix,
 			buttons,
 			params;
 
 		buttons = [
 			["Connect", function() {
 
-				dbHost = $(".message input.text#dbHost").val();
-				dbUser = $(".message input.text#dbUser").val();
-				dbPassword = $(".message input.text#dbPassword").val();
-				dbName = $(".message input.text#dbName").val();
+				dbHost			= $(".message input.text#dbHost").val();
+				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);
 
 	},
 

File diff suppressed because it is too large
+ 0 - 0
assets/min/main.css


+ 2 - 2
php/access/Installation.php

@@ -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']);
 
 	}
 

+ 3 - 2
php/modules/Database.php

@@ -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));
@@ -90,7 +90,7 @@ class Database extends Module {
 $config = "<?php
 
 ###
-# @name		Configuration
+# @name			Configuration
 # @author		Tobias Reich
 # @copyright	2014 Tobias Reich
 ###
@@ -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
 
 ?>";
 

Some files were not shown because too many files changed in this diff