2008-04-18 11:57:32 +02:00
< ? php
2008-11-21 11:44:28 +01:00
/*
2008-11-25 16:57:29 +01:00
* Define constants used in all the application .
2008-11-21 11:44:28 +01:00
* 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' ]);
2008-12-03 11:06:02 +01:00
2008-11-21 11:44:28 +01:00
$rootTmp = '/' ;
foreach ( $pieces as $piece ) {
2008-12-03 11:06:02 +01:00
//we eliminate possible sscuttle subfolders (like gsearch for example)
if ( $piece != '' && ! strstr ( $piece , '.php' ) && $piece != 'gsearch' ) {
2008-11-21 11:44:28 +01:00
$rootTmp .= $piece . '/' ;
}
}
if (( $rootTmp != '/' ) && ( substr ( $rootTmp , - 1 , 1 ) != '/' )) {
$rootTmp .= '/' ;
}
define ( 'ROOT' , 'http://' . $_SERVER [ 'HTTP_HOST' ] . $rootTmp );
2008-12-03 11:06:02 +01:00
} else {
define ( 'ROOT' , $GLOBALS [ 'root' ]);
2008-11-21 11:44:28 +01:00
}
2008-04-18 11:57:32 +02:00
// Error codes
define ( 'GENERAL_MESSAGE' , 200 );
define ( 'GENERAL_ERROR' , 202 );
define ( 'CRITICAL_MESSAGE' , 203 );
define ( 'CRITICAL_ERROR' , 204 );
2008-05-14 10:55:38 +02:00
// Page name
define ( 'PAGE_INDEX' , " index " );
define ( 'PAGE_BOOKMARKS' , " bookmarks " );
2009-02-16 11:38:11 +01:00
define ( 'PAGE_WATCHLIST' , " watchlist " );
2008-05-14 10:55:38 +02:00
2008-04-18 11:57:32 +02:00
// Miscellanous
2008-06-01 15:17:54 +02:00
// 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
2008-05-09 10:16:05 +02:00
define ( 'INSTALLATION_ID' , md5 ( $GLOBALS [ 'dbname' ] . $GLOBALS [ 'tableprefix' ]));
2008-04-18 11:57:32 +02:00
2009-03-05 10:24:21 +01:00
// Correct bugs with PATH_INFO (maybe for Apache 1 or CGI) -- for 1&1 host...
2009-09-20 10:38:16 +02:00
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 " ]);
}
2009-03-05 10:24:21 +01:00
}
2008-04-18 11:57:32 +02:00
?>