From e807f9c14a4c7f673870ed9ba4bc124b46b8d0a9 Mon Sep 17 00:00:00 2001 From: FusionPBX Date: Sat, 22 Oct 2022 17:48:47 -0600 Subject: [PATCH] Move the config.php section --- core/install/install.php | 58 +++++++++++++++++++++------------------- 1 file changed, 30 insertions(+), 28 deletions(-) diff --git a/core/install/install.php b/core/install/install.php index cccb0f9ea5..c498d9d26d 100644 --- a/core/install/install.php +++ b/core/install/install.php @@ -37,6 +37,7 @@ //include required classes require_once "resources/classes/text.php"; require_once "resources/classes/template.php"; + require_once "core/install/resources/classes/install.php"; //add multi-lingual support $language = new text; @@ -69,34 +70,6 @@ //set the default time zone date_default_timezone_set('UTC'); -//if the config.php exists create the config.conf file - if (file_exists("/usr/local/etc/fusionpbx/config.php")) { - //bsd - $config_php = "/usr/local/etc/fusionpbx/config.php"; - } - elseif (file_exists("/etc/fusionpbx/config.php")) { - //linux - $config_php = "/etc/fusionpbx/config.php"; - } - if (isset($config_php)) { - //include the config.php file - include $config_php; - - //build the config file - $install = new install; - $install->database_type = $db_type; - $install->database_host = $db_host; - $install->database_port = $db_port; - $install->database_name = $db_name; - $install->database_username = $db_username; - $install->database_password = $db_password; - $install->config(); - - //redirect the user - header("Location: /"); - exit; - } - //if the config file exists then disable the install page $config_exists = false; if (file_exists("/usr/local/etc/fusionpbx/config.conf")) { @@ -113,6 +86,35 @@ exit; } +//if the config.php exists create the config.conf file + if (!$config_exists) { + if (file_exists("/usr/local/etc/fusionpbx/config.php")) { + //bsd + $config_php = "/usr/local/etc/fusionpbx/config.php"; + } + elseif (file_exists("/etc/fusionpbx/config.php")) { + //linux + $config_php = "/etc/fusionpbx/config.php"; + } + if (isset($config_php)) { + //include the config.php file + include $config_php; + + //build the config file + $install = new install; + $install->database_host = $db_host; + $install->database_port = $db_port; + $install->database_name = $db_name; + $install->database_username = $db_username; + $install->database_password = $db_password; + $install->config(); + + //redirect the user + header("Location: /"); + exit; + } + } + //process and save the data if (count($_POST) > 0) { foreach($_POST as $key => $value) {