From 4208b640d67c050d3e12b29c8b0a22143fdcceca Mon Sep 17 00:00:00 2001 From: David Anderson Date: Thu, 12 Jun 2014 18:38:38 -0700 Subject: [PATCH] server: fix bug that prevented PHP scripts from working --- html/inc/util_basic.inc | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/html/inc/util_basic.inc b/html/inc/util_basic.inc index 08b8876a86..846e352ace 100644 --- a/html/inc/util_basic.inc +++ b/html/inc/util_basic.inc @@ -21,13 +21,17 @@ $generating_xml = false; +function project_dir() { + return dirname(dirname(getcwd())); +} + function web_stopped() { - $d = dirname(dirname(dirname($_SERVER["SCRIPT_FILENAME"]))); + $d = project_dir(); return file_exists("$d/stop_web"); } function sched_stopped() { - $d = dirname(dirname(dirname($_SERVER["SCRIPT_FILENAME"]))); + $d = project_dir(); return file_exists("$d/stop_sched"); } @@ -68,7 +72,7 @@ $g_config = null; function get_config() { global $g_config; if ($g_config == null) { - $d = dirname(dirname(dirname($_SERVER["SCRIPT_FILENAME"]))); + $d = project_dir(); $g_config = file_get_contents("$d/config.xml"); } return $g_config;