From 0dc9aaabe8c6970ec902bf4d0ed4cbba489f43b8 Mon Sep 17 00:00:00 2001 From: frytimo Date: Sat, 17 Jun 2023 17:07:06 -0300 Subject: [PATCH] Minor Changes (#6756) * Update installer to use magic __DIR__ * move setting default step to near top * spacing * move session start before text object creation --- core/install/install.php | 27 +++++++++++++++++++-------- 1 file changed, 19 insertions(+), 8 deletions(-) diff --git a/core/install/install.php b/core/install/install.php index da14891038..13efb1a7c5 100644 --- a/core/install/install.php +++ b/core/install/install.php @@ -25,7 +25,7 @@ */ //set the include path - $document_root = substr(getcwd(), 0, strlen(getcwd()) - strlen('/core/install')); + $document_root = dirname(__DIR__, 2); set_include_path($document_root); $_SERVER["DOCUMENT_ROOT"] = $document_root; $_SERVER["PROJECT_ROOT"] = $document_root; @@ -37,8 +37,13 @@ //include required classes require_once "resources/classes/text.php"; require_once "resources/classes/template.php"; + require_once "resources/classes/message.php"; require_once "core/install/resources/classes/install.php"; +//start the session before text object stores values in session + //ini_set("session.cookie_httponly", True); + session_start(); + //add multi-lingual support $language = new text; $text = $language->get(); @@ -46,10 +51,6 @@ //set debug to true or false $debug = false; -//start the session - //ini_set("session.cookie_httponly", True); - session_start(); - //set the default domain_uuid $domain_uuid = uuid(); //$_SESSION["domain_uuid"] = uuid(); @@ -64,7 +65,7 @@ //error reporting ini_set('display_errors', '1'); //error_reporting (E_ALL); // Report everything - error_reporting (E_ALL ^ E_NOTICE); // Report everything + error_reporting (E_ALL ^ E_NOTICE); // Report warnings //error_reporting(E_ALL ^ E_NOTICE ^ E_WARNING ); //hide notices and warnings //set the default time zone @@ -81,7 +82,10 @@ $config_exists = true; } if ($config_exists) { - $msg .= "Already Installed"; + $msg = "Already Installed"; + //report to user + message::add($msg); + //redirect with message header("Location: ".PROJECT_PATH."/index.php?msg=".urlencode($msg)); exit; } @@ -332,6 +336,11 @@ $_SESSION['theme']['menu_brand_image']['text'] = PROJECT_PATH.'/themes/default/images/logo.png'; $_SESSION['theme']['menu_brand_type']['text'] = 'image'; +//set a default step if not already set + if(empty($_REQUEST['step'])) { + $_REQUEST['step'] = '1'; + } + //save an install log if debug is true //if ($debug) { // $fp = fopen(sys_get_temp_dir()."/install.log", "w"); @@ -359,6 +368,7 @@ $view->assign("database_port", "5432"); $view->assign("database_name", "fusionpbx"); $view->assign("database_username", "fusionpbx"); + $view->assign("database_password", "fusionpbx"); //add translations foreach($text as $key => $value) { @@ -379,7 +389,8 @@ //if ($_GET["step"] == "" || $_GET["step"] == "1") { // $content = $view->render('language.htm'); //} - if ($_REQUEST["step"] == "" || $_REQUEST["step"] == "1") { + + if ($_REQUEST["step"] == "1") { $content = $view->render('configuration.htm'); } if ($_REQUEST["step"] == "2") {