aboutsummaryrefslogtreecommitdiff
path: root/constants.inc.php
diff options
context:
space:
mode:
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"];
}
?>