From 0fb32844033c00580e401712668415f44163d502 Mon Sep 17 00:00:00 2001 From: Ben Roberts Date: Mon, 29 Aug 2011 23:46:07 +0100 Subject: [PATCH] Check for config or environment variable defining base directory --- source/lib/SihnonFramework/Main.class.php | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/source/lib/SihnonFramework/Main.class.php b/source/lib/SihnonFramework/Main.class.php index f3cbb76..0f6917b 100644 --- a/source/lib/SihnonFramework/Main.class.php +++ b/source/lib/SihnonFramework/Main.class.php @@ -278,7 +278,16 @@ class SihnonFramework_Main { return realpath($relative_path); } - $absolute_path = getcwd() . DIRECTORY_SEPARATOR . $relative_path; + // Use the base path in order of precedence + $prefix = ''; + if (isset($_SERVER['SihnonFramework_Base'])) { + $prefix = $_SERVER['SihnonFramework_Base']; + } elseif (defined('SihnonFramework_Base')) { + $prefix = SihnonFramework_Base; + } else { + $prefix = getcwd() . DIRECTORY_SEPARATOR; + } + $absolute_path = $prefix . $relative_path; return realpath($absolute_path); }