From aa6b6863b8b23aad2198b301d2b0979987f8b087 Mon Sep 17 00:00:00 2001 From: Christian Weiske Date: Thu, 7 Oct 2010 19:02:06 +0200 Subject: CS on constants --- src/SemanticScuttle/constants.php | 70 ++++++++++++++++++++++++--------------- 1 file changed, 43 insertions(+), 27 deletions(-) (limited to 'src/SemanticScuttle/constants.php') diff --git a/src/SemanticScuttle/constants.php b/src/SemanticScuttle/constants.php index aebc059..c76f7b2 100644 --- a/src/SemanticScuttle/constants.php +++ b/src/SemanticScuttle/constants.php @@ -1,35 +1,49 @@ + * @author Christian Weiske + * @author Eric Dane + * @license GPL http://www.gnu.org/licenses/gpl.html + * @link http://sourceforge.net/projects/semanticscuttle */ // Debug managament -if(isset($GLOBALS['debugMode'])) { - define('DEBUG_MODE', $GLOBALS['debugMode']); - define('DEBUG_EXTRA', $GLOBALS['debugMode']); // Constant used exclusively into db/ directory +if (isset($GLOBALS['debugMode'])) { + define('DEBUG_MODE', $GLOBALS['debugMode']); + // Constant used exclusively into db/ directory + define('DEBUG_EXTRA', $GLOBALS['debugMode']); } // Determine the base URL as ROOT if (!isset($GLOBALS['root'])) { - $pieces = explode('/', $_SERVER['SCRIPT_NAME']); - - $rootTmp = '/'; - foreach ($pieces as $piece) { - //we eliminate possible sscuttle subfolders (like gsearch for example) + $pieces = explode('/', $_SERVER['SCRIPT_NAME']); + + $rootTmp = '/'; + foreach ($pieces as $piece) { + //we eliminate possible sscuttle subfolders (like gsearch for example) if ($piece != '' && !strstr($piece, '.php') && $piece != 'gsearch' && $piece != 'ajax' ) { - $rootTmp .= $piece .'/'; - } - } - if (($rootTmp != '/') && (substr($rootTmp, -1, 1) != '/')) { - $rootTmp .= '/'; - } + $rootTmp .= $piece .'/'; + } + } + if (($rootTmp != '/') && (substr($rootTmp, -1, 1) != '/')) { + $rootTmp .= '/'; + } - define('ROOT', 'http://'. $_SERVER['HTTP_HOST'] . $rootTmp); + define('ROOT', 'http://'. $_SERVER['HTTP_HOST'] . $rootTmp); } else { - define('ROOT', $GLOBALS['root']); + define('ROOT', $GLOBALS['root']); } // Error codes @@ -46,19 +60,21 @@ define('PAGE_WATCHLIST', "watchlist"); // Miscellanous -// INSTALLATION_ID is based on directory DB and used as prefix (in session and cookie) to prevent mutual login for different installations on the same host server +// INSTALLATION_ID is based on directory DB and used as prefix +// (in session and cookie) to prevent mutual login for different +// installations on the same host server define('INSTALLATION_ID', md5($GLOBALS['dbname'].$GLOBALS['tableprefix'])); // Correct bugs with PATH_INFO (maybe for Apache 1 or CGI) -- for 1&1 host... if (isset($_SERVER['PATH_INFO']) && isset($_SERVER['ORIG_PATH_INFO'])) { - if(strlen($_SERVER["PATH_INFO"]) -- cgit v1.2.3