From d05d2942259c6c99494097d889bb2d7a9933a738 Mon Sep 17 00:00:00 2001 From: Alexey Melnichuk Date: Thu, 2 Jul 2015 12:21:53 +0400 Subject: [PATCH 1/2] Add. Allow edit domain name while installing. On my Windows machine default domain now is `127.0.0.1` which is quite useless. --- resources/install.php | 34 ++++++++++++++++++++++++---------- 1 file changed, 24 insertions(+), 10 deletions(-) diff --git a/resources/install.php b/resources/install.php index c677a87e7a..b5f1a4826b 100644 --- a/resources/install.php +++ b/resources/install.php @@ -47,17 +47,10 @@ require_once "resources/functions.php"; //set the default time zone date_default_timezone_set('UTC'); -//get the domain - $domain_array = explode(":", $_SERVER["HTTP_HOST"]); - $domain_name = $domain_array[0]; - //if the config file exists then disable the install page $config_exists = false; if (file_exists($_SERVER['DOCUMENT_ROOT'].PROJECT_PATH."/resources/config.php")) { $config_exists = true; - } elseif (file_exists($_SERVER['DOCUMENT_ROOT'].PROJECT_PATH."/resources/config.php")) { - //original directory - $config_exists = true; } elseif (file_exists("/etc/fusionpbx/config.php")) { //linux $config_exists = true; @@ -86,6 +79,7 @@ require_once "resources/functions.php"; $db_host = $_POST["db_host"]; $db_port = $_POST["db_port"]; $db_name = $_POST["db_name"]; + $domain_name = $_POST["domain_name"]; $db_username = $_POST["db_username"]; $db_password = $_POST["db_password"]; $db_create_username = $_POST["db_create_username"]; @@ -98,6 +92,12 @@ require_once "resources/functions.php"; $install_default_country = $_POST["install_default_country"]; $install_template_name = $_POST["install_template_name"]; + if(!$domain_name){ + //get the domain + $domain_array = explode(":", $_SERVER["HTTP_HOST"]); + $domain_name = $domain_array[0]; + } + //clean up the values if (strlen($install_switch_base_dir) > 0) { $install_switch_base_dir = realpath($install_switch_base_dir); @@ -813,7 +813,7 @@ if ($_POST["install_step"] == "3" && count($_POST) > 0 && strlen($_POST["persist else { $filename = $_SERVER["DOCUMENT_ROOT"].PROJECT_PATH.'/resources/install/sql/mysql.sql'; } - $file_contents = file_get_contents($filename); + $file_contents = file_get_contents($filename); //replace \r\n with \n then explode on \n $file_contents = str_replace("\r\n", "\n", $file_contents); @@ -1231,7 +1231,7 @@ if ($_POST["install_step"] == "3" && count($_POST) > 0 && strlen($_POST["persist $sql .= "'$menu_description' "; $sql .= ");"; if ($v_debug) { - fwrite($fp, $sql."\n"); + fwrite($fp, $sql."\n"); } $db->exec(check_sql($sql)); unset($sql); @@ -1244,7 +1244,7 @@ if ($_POST["install_step"] == "3" && count($_POST) > 0 && strlen($_POST["persist $menu->restore(); unset($menu); - //setup the switch config directory if it exists + //setup the switch config directory if it exists if (file_exists($switch_conf_dir) && $switch_conf_dir != "/conf") { if ($v_debug) { fwrite($fp, "switch_base_dir: ".$install_switch_base_dir."\n"); @@ -1764,6 +1764,17 @@ EOL; echo " \n"; echo " \n"; + echo "\n"; + echo "\n"; + echo " Domain name\n"; + echo "\n"; + echo "\n"; + echo "
\n"; + echo " Enter the default domain name. \n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo " \n"; echo " \n"; echo " \n"; @@ -1816,6 +1827,7 @@ EOL; echo " \n"; echo " \n"; echo " \n"; + echo " \n"; echo " \n"; echo " \n"; echo " \n"; @@ -1931,6 +1943,7 @@ EOL; echo " \n"; echo " \n"; echo " \n"; + echo " \n"; echo " \n"; echo " \n"; echo " \n"; @@ -2044,6 +2057,7 @@ EOL; echo " \n"; echo " \n"; echo " \n"; + echo " \n"; echo " \n"; echo " \n"; echo " \n"; From d61f2b281714367d1ade7a3786211da3acb50416 Mon Sep 17 00:00:00 2001 From: Alexey Melnichuk Date: Thu, 2 Jul 2015 12:24:58 +0400 Subject: [PATCH 2/2] Fix. indent. --- resources/install.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/resources/install.php b/resources/install.php index b5f1a4826b..569128b763 100644 --- a/resources/install.php +++ b/resources/install.php @@ -1231,12 +1231,12 @@ if ($_POST["install_step"] == "3" && count($_POST) > 0 && strlen($_POST["persist $sql .= "'$menu_description' "; $sql .= ");"; if ($v_debug) { - fwrite($fp, $sql."\n"); + fwrite($fp, $sql."\n"); } $db->exec(check_sql($sql)); unset($sql); - //add the menu items + //add the menu items require_once "resources/classes/menu.php"; $menu = new menu; $menu->db = $db; @@ -1244,7 +1244,7 @@ if ($_POST["install_step"] == "3" && count($_POST) > 0 && strlen($_POST["persist $menu->restore(); unset($menu); - //setup the switch config directory if it exists + //setup the switch config directory if it exists if (file_exists($switch_conf_dir) && $switch_conf_dir != "/conf") { if ($v_debug) { fwrite($fp, "switch_base_dir: ".$install_switch_base_dir."\n");