aboutsummaryrefslogtreecommitdiff
path: root/constants.inc.php
blob: e779852ed8891ec46fa3e70fbd69e26eda89d6e1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
<?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);
define('GENERAL_ERROR', 202);
define('CRITICAL_MESSAGE', 203);
define('CRITICAL_ERROR', 204);

// Page name
define('PAGE_INDEX', "index");
define('PAGE_BOOKMARKS', "bookmarks");


// 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 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"];
}

?>