summaryrefslogtreecommitdiff
path: root/constants.inc.php
diff options
context:
space:
mode:
authormensonge <mensonge@b3834d28-1941-0410-a4f8-b48e95affb8f>2008-11-21 10:44:28 +0000
committermensonge <mensonge@b3834d28-1941-0410-a4f8-b48e95affb8f>2008-11-21 10:44:28 +0000
commit3c181054dbe60467cc744c447010f525a862c26e (patch)
treecaf19eca71e1339768620b8b2936c12f36dbdac7 /constants.inc.php
parent8ca4455dc7add53f496161eda1e86c455d4ce37c (diff)
downloadsemanticscuttle-3c181054dbe60467cc744c447010f525a862c26e.tar.gz
semanticscuttle-3c181054dbe60467cc744c447010f525a862c26e.tar.bz2
Refactoring: improve debug_mode, constants and other stuff
git-svn-id: https://semanticscuttle.svn.sourceforge.net/svnroot/semanticscuttle/trunk@168 b3834d28-1941-0410-a4f8-b48e95affb8f
Diffstat (limited to 'constants.inc.php')
-rw-r--r--constants.inc.php28
1 files changed, 27 insertions, 1 deletions
diff --git a/constants.inc.php b/constants.inc.php
index 824561f..e779852 100644
--- a/constants.inc.php
+++ b/constants.inc.php
@@ -1,4 +1,30 @@
<?php
+/*
+ * Define constants use 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) {
+ if ($piece != '' && !strstr($piece, '.php')) {
+ $rootTmp .= $piece .'/';
+ }
+ }
+ if (($rootTmp != '/') && (substr($rootTmp, -1, 1) != '/')) {
+ $rootTmp .= '/';
+ }
+
+ define('ROOT', 'http://'. $_SERVER['HTTP_HOST'] . $rootTmp);
+}
// Error codes
define('GENERAL_MESSAGE', 200);
@@ -19,7 +45,7 @@ define('INSTALLATION_ID', md5($GLOBALS['dbname'].$GLOBALS['tableprefix']));
// Correct bug with PATH_INFO (maybe for Apache 1)
if(strlen($_SERVER["PATH_INFO"])<strlen($_SERVER["ORIG_PATH_INFO"])) {
- $_SERVER["PATH_INFO"] = $_SERVER["ORIG_PATH_INFO"];
+ $_SERVER["PATH_INFO"] = $_SERVER["ORIG_PATH_INFO"];
}
?>