From a7ca6376924edfad7ff2570d50393c9b99772f4d Mon Sep 17 00:00:00 2001 From: hecht Date: Mon, 7 Nov 2011 21:26:36 +0000 Subject: [PATCH] use one path file for cronjobs and normal usage. Adjust the config.inc.php (because it may not include path.inc.php itself) --- ag/include/config.inc.php | 1 - ag/path.inc.php | 23 ++++++++++++++++------- 2 files changed, 16 insertions(+), 8 deletions(-) diff --git a/ag/include/config.inc.php b/ag/include/config.inc.php index 0da8342..51217b5 100644 --- a/ag/include/config.inc.php +++ b/ag/include/config.inc.php @@ -12,7 +12,6 @@ */ // Immer den ganzen Pfad angeben, dann hat man es einfacher ^^ -include_once('../path.inc.php'); // get the path ;) include_once (ROOT_PATH . '/include/config/db.inc.php'); include_once (ROOT_PATH . '/include/config/server.inc.php'); include_once (ROOT_PATH . '/include/config/settings.inc.php'); diff --git a/ag/path.inc.php b/ag/path.inc.php index 30369dc..f8b5ed5 100644 --- a/ag/path.inc.php +++ b/ag/path.inc.php @@ -4,20 +4,29 @@ // okay and now define the url ;) if(!defined('ROOT_PATH')) { - $actual_path = $_SERVER['SCRIPT_FILENAME']; - $url_path = $_SERVER['SCRIPT_NAME' ]; -//s echo $actual_path .'
'; + if(isset($_SERVER['SCRIPT_FILENAME'])) { + $actual_path = $_SERVER['SCRIPT_FILENAME']; + $url_path = $_SERVER['SCRIPT_NAME' ]; + } else { + $actual_path = __FILE__; + $url_path = NULL; + } // okay this is the script that has included us :) -> lets search for the include/config/ directory while(strlen($actual_path) > 0) { $actual_path = substr($actual_path,0,strrpos($actual_path,'/')); - $url_path = substr($url_path,0,strrpos($url_path,'/')); + if($url_path != null) { + $url_path = substr($url_path,0,strrpos($url_path,'/')); + } if(is_dir($actual_path . '/include/config')) { define('ROOT_PATH', $actual_path); - define('ROOT_URL', $url_path); + if($url_path != null) { + define('ROOT_URL', $url_path); + } else { + define('ROOT_URL', '/ag'); // --> currently no support for cronjobs + } } } } -?> - +?> \ No newline at end of file