Unix friendly changes.

This commit is contained in:
Mark Crane 2013-04-27 06:40:44 +00:00
parent f3a2e40e6a
commit af3891fe36
3 changed files with 30 additions and 5 deletions

View File

@ -24,7 +24,15 @@
Mark J Crane <markjcrane@fusionpbx.com> Mark J Crane <markjcrane@fusionpbx.com>
*/ */
include "root.php"; include "root.php";
include "includes/config.php"; if (file_exists("/etc/fusionpbx/config.php")) {
include "/etc/fusionpbx/config.php";
}
elseif (file_exists("/usr/local/etc/fusionpbx/config.php")) {
include "/usr/local/etc/fusionpbx/config.php";
}
else {
include "includes/config.php";
}
require_once "includes/lib_php.php"; require_once "includes/lib_php.php";
require "includes/lib_pdo.php"; require "includes/lib_pdo.php";
require_once "includes/lib_functions.php"; require_once "includes/lib_functions.php";

View File

@ -26,7 +26,14 @@
include "root.php"; include "root.php";
//if config.php file does not exist then redirect to the install page //if config.php file does not exist then redirect to the install page
if (!file_exists($_SERVER['DOCUMENT_ROOT'].PROJECT_PATH."/includes/config.php")){ if (file_exists($_SERVER['DOCUMENT_ROOT'].PROJECT_PATH."/includes/config.php")) {
//do nothing
} elseif (file_exists("/etc/fusionpbx/config.php")){
//linux
} elseif (file_exists("/usr/local/etc/fusionpbx/config.php")){
//bsd
}
else {
header("Location: ".PROJECT_PATH."/resources/install.php"); header("Location: ".PROJECT_PATH."/resources/install.php");
exit; exit;
} }

View File

@ -365,7 +365,7 @@ if ($_POST["install_step"] == "3" && count($_POST) > 0 && strlen($_POST["persist
$tmp_config .= "/* \$Id\$ */\n"; $tmp_config .= "/* \$Id\$ */\n";
$tmp_config .= "/*\n"; $tmp_config .= "/*\n";
$tmp_config .= " config.php\n"; $tmp_config .= " config.php\n";
$tmp_config .= " Copyright (C) 2008, 2009 Mark J Crane\n"; $tmp_config .= " Copyright (C) 2008, 20013 Mark J Crane\n";
$tmp_config .= " All rights reserved.\n"; $tmp_config .= " All rights reserved.\n";
$tmp_config .= "\n"; $tmp_config .= "\n";
$tmp_config .= " Redistribution and use in source and binary forms, with or without\n"; $tmp_config .= " Redistribution and use in source and binary forms, with or without\n";
@ -447,13 +447,23 @@ if ($_POST["install_step"] == "3" && count($_POST) > 0 && strlen($_POST["persist
$tmp_config .= " error_reporting(E_ALL ^ E_NOTICE ^ E_WARNING ); //hide notices and warnings"; $tmp_config .= " error_reporting(E_ALL ^ E_NOTICE ^ E_WARNING ); //hide notices and warnings";
$tmp_config .= "\n"; $tmp_config .= "\n";
$tmp_config .= "?>"; $tmp_config .= "?>";
$fout = fopen($_SERVER["DOCUMENT_ROOT"].PROJECT_PATH."/includes/config.php","w"); if (file_exists($_SERVER['DOCUMENT_ROOT'].PROJECT_PATH."/includes/config.php")) {
$config = $_SERVER["DOCUMENT_ROOT"].PROJECT_PATH."/includes/config.php";
} elseif (file_exists("/etc/fusionpbx/config.php")){
$config = "/etc/fusionpbx/config.php";
} elseif (file_exists("/usr/local/etc/fusionpbx/config.php")){
$config = "/usr/local/etc/fusionpbx/config.php";
}
else {
$config = PROJECT_PATH."/includes/config.php";
}
$fout = fopen($config,"w");
fwrite($fout, $tmp_config); fwrite($fout, $tmp_config);
unset($tmp_config); unset($tmp_config);
fclose($fout); fclose($fout);
//include the new config.php file //include the new config.php file
require "includes/config.php"; require $config;
//create the sqlite database //create the sqlite database
if ($db_type == "sqlite") { if ($db_type == "sqlite") {