Procházet zdrojové kódy

Unix friendly changes.

Mark Crane před 12 roky
rodič
revize
95deca91fe
3 změnil soubory, kde provedl 30 přidání a 5 odebrání
  1. 9 1
      includes/require.php
  2. 8 1
      index.php
  3. 13 3
      resources/install.php

+ 9 - 1
includes/require.php

@@ -24,7 +24,15 @@
 	Mark J Crane <[email protected]>
 */
 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 "includes/lib_pdo.php";
 require_once "includes/lib_functions.php";

+ 8 - 1
index.php

@@ -26,7 +26,14 @@
 include "root.php";
 
 //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");
 		exit;
 	}

+ 13 - 3
resources/install.php

@@ -365,7 +365,7 @@ if ($_POST["install_step"] == "3" && count($_POST) > 0 && strlen($_POST["persist
 		$tmp_config .= "/* \$Id\$ */\n";
 		$tmp_config .= "/*\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 .= "\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 .= "\n";
 		$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);
 		unset($tmp_config);
 		fclose($fout);
 
 	//include the new config.php file
-		require "includes/config.php";
+		require $config;
 
 	//create the sqlite database
 		if ($db_type == "sqlite") {