aboutsummaryrefslogtreecommitdiff
path: root/src/SemanticScuttle/header.php
blob: 0e8974a942b4f30a1e93e0e7e19d2e79792b9ff1 (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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
<?php
if(!file_exists(dirname(__FILE__) .'/../../data/config.php')) {
	die('Please copy "config.php.dist" to "config.php"');
}
set_include_path(
    get_include_path() . PATH_SEPARATOR
    . dirname(__FILE__) . '/../'
);

// 1 // First requirements part (before debug management)
$datadir = dirname(__FILE__) . '/../../data/';
require_once($datadir . '/config.default.php');
require_once($datadir . '/config.php');
require_once 'SemanticScuttle/constants.php'; // some constants are based on variables from config file


// 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);
}

// 2 // Second requirements part which could display bugs (must come after debug management)
require_once 'SemanticScuttle/Service.php';
require_once 'SemanticScuttle/Service/Factory.php';
require_once 'SemanticScuttle/functions.php';


// 3 // Third requirements part which import functions from includes/ directory

// UTF-8 functions
require_once 'SemanticScuttle/utf8.php';

// Translation
require_once '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);

// 4 // Session
if (!defined('UNIT_TEST_MODE')) {
    session_start();
}

// 5 // Create mandatory services and objects
$userservice =SemanticScuttle_Service_Factory::get('User');
$currentUser = $userservice->getCurrentObjectUser();

$templateservice =SemanticScuttle_Service_Factory::get('Template');
$tplVars = array();
$tplVars['currentUser'] = $currentUser;
$tplVars['userservice'] = $userservice;

// 6 // Force UTF-8 behaviour for server (cannot be move into top.inc.php which is not included into every file)
if (!defined('UNIT_TEST_MODE')) {
    header('Content-Type: text/html; charset=utf-8');
}
?>