diff options
author | cweiske <cweiske@b3834d28-1941-0410-a4f8-b48e95affb8f> | 2009-10-03 14:00:33 +0000 |
---|---|---|
committer | cweiske <cweiske@b3834d28-1941-0410-a4f8-b48e95affb8f> | 2009-10-03 14:00:33 +0000 |
commit | 29422fa55379aa61a61019b832c83dab6d450264 (patch) | |
tree | e5884ce6fed2cf1d02165a1b5667b99cd80262e5 /src/SemanticScuttle/constants.php | |
parent | b8b1d06b2d899658fae64d0de506439ca0ea067c (diff) | |
download | semanticscuttle-29422fa55379aa61a61019b832c83dab6d450264.tar.gz semanticscuttle-29422fa55379aa61a61019b832c83dab6d450264.tar.bz2 |
move files to new locations
git-svn-id: https://semanticscuttle.svn.sourceforge.net/svnroot/semanticscuttle/trunk@386 b3834d28-1941-0410-a4f8-b48e95affb8f
Diffstat (limited to 'src/SemanticScuttle/constants.php')
-rw-r--r-- | src/SemanticScuttle/constants.php | 62 |
1 files changed, 62 insertions, 0 deletions
diff --git a/src/SemanticScuttle/constants.php b/src/SemanticScuttle/constants.php new file mode 100644 index 0000000..4940af8 --- /dev/null +++ b/src/SemanticScuttle/constants.php @@ -0,0 +1,62 @@ +<?php +/* + * Define constants used in all the application. + * Some constants are based on variables from configuration file. + */ + +// Debug managament +if(isset($GLOBALS['debugMode'])) { + define('DEBUG_MODE', $GLOBALS['debugMode']); + define('DEBUG_EXTRA', $GLOBALS['debugMode']); // Constant used exclusively into db/ directory +} + +// 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) + if ($piece != '' && !strstr($piece, '.php') && $piece != 'gsearch') { + $rootTmp .= $piece .'/'; + } + } + if (($rootTmp != '/') && (substr($rootTmp, -1, 1) != '/')) { + $rootTmp .= '/'; + } + + define('ROOT', 'http://'. $_SERVER['HTTP_HOST'] . $rootTmp); +} else { + define('ROOT', $GLOBALS['root']); +} + +// Error codes +define('GENERAL_MESSAGE', 200); +define('GENERAL_ERROR', 202); +define('CRITICAL_MESSAGE', 203); +define('CRITICAL_ERROR', 204); + +// Page name +define('PAGE_INDEX', "index"); +define('PAGE_BOOKMARKS', "bookmarks"); +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 +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"])<strlen($_SERVER["ORIG_PATH_INFO"])) { + $_SERVER["PATH_INFO"] = $_SERVER["ORIG_PATH_INFO"]; + } + if(strcasecmp($_SERVER["PATH_INFO"], $_SERVER["SCRIPT_NAME "]) == 0) { + unset($_SERVER["PATH_INFO"]); + } + if(strpos($_SERVER["PATH_INFO"], '.php') !== false) { + unset($_SERVER["PATH_INFO"]); + } +} +?> |