diff --git a/config.php.sample b/config.php.sample index 41b09247..a90981a3 100755 --- a/config.php.sample +++ b/config.php.sample @@ -5,4 +5,4 @@ define('PSM_DB_PASS', 'db_pass'); define('PSM_DB_NAME', 'db_name'); define('PSM_DB_HOST', 'localhost'); define('PSM_DB_PORT', '3306'); - +define('PSM_BASE_URL', ''); diff --git a/src/psm/Module/Install/Controller/InstallController.php b/src/psm/Module/Install/Controller/InstallController.php index 75a7e94a..cae533f8 100644 --- a/src/psm/Module/Install/Controller/InstallController.php +++ b/src/psm/Module/Install/Controller/InstallController.php @@ -120,12 +120,13 @@ class InstallController extends AbstractController { } $config = array( - 'host' => 'localhost', - 'port' => '3306', - 'name' => '', - 'user' => '', - 'pass' => '', - 'prefix' => 'psm_', + 'db_host' => 'localhost', + 'db_port' => '3306' + 'db_name' => '', + 'db_user' => '', + 'db_pass' => '', + 'db_prefix' => 'psm_', + 'base_url' => '', ); $changed = false; @@ -141,11 +142,11 @@ class InstallController extends AbstractController { if($changed) { // test db connection $this->db = new \psm\Service\Database( - $config['host'], - $config['user'], - $config['pass'], - $config['name'], - $config['port'] + $config['db_host'], + $config['db_port'], + $config['db_user'], + $config['db_pass'], + $config['db_name'] ); if($this->db->status()) { @@ -277,11 +278,11 @@ class InstallController extends AbstractController { * @param array $db_vars prefix,user,pass,name,host * @return boolean|string TRUE on success, string with config otherwise */ - protected function writeConfigFile($db_vars) { + protected function writeConfigFile($array_config) { $config = " $value) { - $line = "define('PSM_DB_{key}', '{value}');".PHP_EOL; + foreach($array_config as $key => $value) { + $line = "define('PSM_{key}', '{value}');".PHP_EOL; $line = str_replace( array('{key}', '{value}'), array(strtoupper($key), $value), @@ -311,7 +312,7 @@ class InstallController extends AbstractController { 'host' => '', 'port' => '3306' ); - $pattern = "/define\('SM_DB_{key}', '(.*?)'/u"; + $pattern = "/define\('SM_{key}', '(.*?)'/u"; foreach($vars as $key => $value) { $pattern_key = str_replace('{key}', strtoupper($key), $pattern); diff --git a/src/templates/default/module/install/config_new.tpl.html b/src/templates/default/module/install/config_new.tpl.html index 4a07a4ce..200d45c3 100644 --- a/src/templates/default/module/install/config_new.tpl.html +++ b/src/templates/default/module/install/config_new.tpl.html @@ -10,11 +10,18 @@
{{ macro.csrf_input() }} +

Please enter the application url:

+
+ +
+ +
+

Please enter your database info:

- +
@@ -26,25 +33,25 @@
- +
- +
- +
- +