2007-12-12 17:29:16 +01:00
|
|
|
<?php
|
2008-11-21 11:44:28 +01:00
|
|
|
if(!file_exists(dirname(__FILE__) .'/config.inc.php')) {
|
2009-09-20 19:04:31 +02:00
|
|
|
die('Please copy "config.inc.php.dist" to "config.inc.php"');
|
2008-11-21 11:44:28 +01:00
|
|
|
}
|
2007-12-12 17:29:16 +01:00
|
|
|
|
2008-11-21 12:02:01 +01:00
|
|
|
// 1 // First requirements part (before debug management)
|
2009-09-20 19:04:31 +02:00
|
|
|
require_once(dirname(__FILE__) .'/config.default.inc.php');
|
2008-11-21 11:44:28 +01:00
|
|
|
require_once(dirname(__FILE__) .'/config.inc.php');
|
|
|
|
require_once(dirname(__FILE__) .'/constants.inc.php'); // some constants are based on variables from config file
|
2007-12-12 17:29:16 +01:00
|
|
|
|
|
|
|
|
2008-11-21 11:44:28 +01:00
|
|
|
// Debug Management using constants
|
|
|
|
if(DEBUG_MODE) {
|
|
|
|
ini_set('display_errors', '1');
|
|
|
|
ini_set('mysql.trace_mode', '1');
|
|
|
|
error_reporting(E_ALL);
|
|
|
|
} else {
|
|
|
|
ini_set('display_errors', '0');
|
|
|
|
ini_set('mysql.trace_mode', '0');
|
|
|
|
error_reporting(0);
|
2008-05-09 09:37:54 +02:00
|
|
|
}
|
|
|
|
|
2008-11-21 12:02:01 +01:00
|
|
|
// 2 // Second requirements part which could display bugs (must come after debug management)
|
2007-12-12 17:29:16 +01:00
|
|
|
require_once(dirname(__FILE__) .'/services/servicefactory.php');
|
|
|
|
require_once(dirname(__FILE__) .'/functions.inc.php');
|
|
|
|
|
2008-11-21 11:44:28 +01:00
|
|
|
|
2008-11-21 12:02:01 +01:00
|
|
|
// 3 // Third requirements part which import functions from includes/ directory
|
|
|
|
|
|
|
|
// UTF-8 functions
|
|
|
|
require_once(dirname(__FILE__) .'/includes/utf8.php');
|
|
|
|
|
|
|
|
// Translation
|
|
|
|
require_once(dirname(__FILE__) .'/includes/php-gettext/gettext.inc');
|
|
|
|
$domain = 'messages';
|
|
|
|
T_setlocale(LC_MESSAGES, $locale);
|
|
|
|
T_bindtextdomain($domain, dirname(__FILE__) .'/locales');
|
|
|
|
T_bind_textdomain_codeset($domain, 'UTF-8');
|
|
|
|
T_textdomain($domain);
|
|
|
|
|
2008-12-05 08:25:04 +01:00
|
|
|
// 4 // Session
|
2008-11-21 11:44:28 +01:00
|
|
|
session_start();
|
2008-05-10 10:59:41 +02:00
|
|
|
|
2008-12-05 08:25:04 +01:00
|
|
|
// 5 // Create mandatory services and objects
|
|
|
|
$userservice =& ServiceFactory::getServiceInstance('UserService');
|
|
|
|
$currentUser = $userservice->getCurrentObjectUser();
|
|
|
|
|
|
|
|
$templateservice =& ServiceFactory::getServiceInstance('TemplateService');
|
|
|
|
$tplVars = array();
|
|
|
|
$tplVars['currentUser'] = $currentUser;
|
|
|
|
$tplVars['userservice'] = $userservice;
|
2009-01-22 16:45:32 +01:00
|
|
|
|
|
|
|
// 6 // Force UTF-8 behaviour for server (cannot be move into top.inc.php which is not included into every file)
|
2009-02-16 13:36:45 +01:00
|
|
|
header('Content-Type: text/html; charset=utf-8');
|
2008-01-09 16:51:35 +01:00
|
|
|
?>
|