Minor Changes (#6756)

* Update installer to use magic __DIR__

* move setting default step to near top

* spacing

* move session start before text object creation
This commit is contained in:
frytimo 2023-06-17 17:07:06 -03:00 committed by GitHub
parent cfda1ab335
commit 0dc9aaabe8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 19 additions and 8 deletions

View File

@ -25,7 +25,7 @@
*/ */
//set the include path //set the include path
$document_root = substr(getcwd(), 0, strlen(getcwd()) - strlen('/core/install')); $document_root = dirname(__DIR__, 2);
set_include_path($document_root); set_include_path($document_root);
$_SERVER["DOCUMENT_ROOT"] = $document_root; $_SERVER["DOCUMENT_ROOT"] = $document_root;
$_SERVER["PROJECT_ROOT"] = $document_root; $_SERVER["PROJECT_ROOT"] = $document_root;
@ -37,8 +37,13 @@
//include required classes //include required classes
require_once "resources/classes/text.php"; require_once "resources/classes/text.php";
require_once "resources/classes/template.php"; require_once "resources/classes/template.php";
require_once "resources/classes/message.php";
require_once "core/install/resources/classes/install.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 //add multi-lingual support
$language = new text; $language = new text;
$text = $language->get(); $text = $language->get();
@ -46,10 +51,6 @@
//set debug to true or false //set debug to true or false
$debug = false; $debug = false;
//start the session
//ini_set("session.cookie_httponly", True);
session_start();
//set the default domain_uuid //set the default domain_uuid
$domain_uuid = uuid(); $domain_uuid = uuid();
//$_SESSION["domain_uuid"] = uuid(); //$_SESSION["domain_uuid"] = uuid();
@ -64,7 +65,7 @@
//error reporting //error reporting
ini_set('display_errors', '1'); ini_set('display_errors', '1');
//error_reporting (E_ALL); // Report everything //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 //error_reporting(E_ALL ^ E_NOTICE ^ E_WARNING ); //hide notices and warnings
//set the default time zone //set the default time zone
@ -81,7 +82,10 @@
$config_exists = true; $config_exists = true;
} }
if ($config_exists) { 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)); header("Location: ".PROJECT_PATH."/index.php?msg=".urlencode($msg));
exit; exit;
} }
@ -332,6 +336,11 @@
$_SESSION['theme']['menu_brand_image']['text'] = PROJECT_PATH.'/themes/default/images/logo.png'; $_SESSION['theme']['menu_brand_image']['text'] = PROJECT_PATH.'/themes/default/images/logo.png';
$_SESSION['theme']['menu_brand_type']['text'] = 'image'; $_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 //save an install log if debug is true
//if ($debug) { //if ($debug) {
// $fp = fopen(sys_get_temp_dir()."/install.log", "w"); // $fp = fopen(sys_get_temp_dir()."/install.log", "w");
@ -359,6 +368,7 @@
$view->assign("database_port", "5432"); $view->assign("database_port", "5432");
$view->assign("database_name", "fusionpbx"); $view->assign("database_name", "fusionpbx");
$view->assign("database_username", "fusionpbx"); $view->assign("database_username", "fusionpbx");
$view->assign("database_password", "fusionpbx");
//add translations //add translations
foreach($text as $key => $value) { foreach($text as $key => $value) {
@ -379,7 +389,8 @@
//if ($_GET["step"] == "" || $_GET["step"] == "1") { //if ($_GET["step"] == "" || $_GET["step"] == "1") {
// $content = $view->render('language.htm'); // $content = $view->render('language.htm');
//} //}
if ($_REQUEST["step"] == "" || $_REQUEST["step"] == "1") {
if ($_REQUEST["step"] == "1") {
$content = $view->render('configuration.htm'); $content = $view->render('configuration.htm');
} }
if ($_REQUEST["step"] == "2") { if ($_REQUEST["step"] == "2") {