Преглед на файлове

Fix a problem with the document_root when using command line fax_to_email.php.

Mark Crane преди 13 години
родител
ревизия
9c2e2b59a1
променени са 1 файла, в които са добавени 7 реда и са изтрити 2 реда
  1. 7 2
      includes/lib_pdo.php

+ 7 - 2
includes/lib_pdo.php

@@ -94,6 +94,12 @@ if (!function_exists('get_db_field_names')) {
 }
 
 if ($db_type == "sqlite") {
+
+	//set the document_root
+		if (strlen($document_root) == 0) {
+			$document_root = $_SERVER["DOCUMENT_ROOT"];
+		}
+
 	//prepare the database connection
 		if (strlen($db_name) == 0) {
 			//if (strlen($_SERVER["SERVER_NAME"]) == 0) { $_SERVER["SERVER_NAME"] = "http://localhost"; }
@@ -107,8 +113,7 @@ if ($db_type == "sqlite") {
 			$db_name_short = $db_name;
 		}
 
-		$filepath = $_SERVER["DOCUMENT_ROOT"].PROJECT_PATH.'/secure';
-		$db_path = $_SERVER["DOCUMENT_ROOT"].PROJECT_PATH.'/secure';
+		$db_path = $document_root.PROJECT_PATH.'/secure';
 		$db_path = realpath($db_path);
 		if (file_exists($db_path.'/'.$db_name)) {
 			//echo "database file exists<br>";