Project

General

Profile

1
<?php
2
/**
3
 *
4
 * @category        framework
5
 * @package         initialize
6
 * @author          WebsiteBaker Project
7
 * @copyright       2004-2009, Ryan Djurovich
8
 * @copyright       2009-2011, Website Baker Org. e.V.
9
 * @link			http://www.websitebaker2.org/
10
 * @license         http://www.gnu.org/licenses/gpl.html
11
 * @platform        WebsiteBaker 2.8.x
12
 * @requirements    PHP 5.2.2 and higher
13
 * @version         $Id: initialize.php 1487 2011-08-10 13:20:15Z DarkViper $
14
 * @filesource		$HeadURL: svn://isteam.dynxs.de/wb-archiv/branches/2.8.x/wb/framework/initialize.php $
15
 * @lastmodified    $Date: 2011-08-10 15:20:15 +0200 (Wed, 10 Aug 2011) $
16
 *
17
 */
18

    
19
//require_once(dirname(__FILE__).'/globalExceptionHandler.php');
20
//// Must include code to stop this file being access directly
21
//if(!defined('WB_PATH')) { throw new Exception('Illegaler Aufruf!'); }
22

    
23
require_once('globalExceptionHandler.php');
24
if(!defined('WB_PATH')) { throw new IllegalFileException(); }
25
//if(defined('WB_PATH') == false) { die("Cannot access this file directly"); }
26

    
27
//set_include_path(get_include_path() . PATH_SEPARATOR . WB_PATH);
28

    
29
if (file_exists(WB_PATH.'/framework/class.database.php')) {
30

    
31
	date_default_timezone_set('UTC');
32
	require_once(WB_PATH.'/framework/class.database.php');
33

    
34
	// Create database class
35
	$database = new database();
36

    
37
    if(version_compare(PHP_VERSION, '5.3.0', '<'))
38
    {
39
        set_magic_quotes_runtime(0); // Disable magic_quotes_runtime
40
    }
41
	// Get website settings (title, keywords, description, header, and footer)
42
	$query_settings = "SELECT name,value FROM ".TABLE_PREFIX."settings";
43
	$get_settings = $database->query($query_settings);
44
	if($database->is_error()) { die($database->get_error()); }
45
	if($get_settings->numRows() == 0) { die("Settings not found"); }
46
	while($setting = $get_settings->fetchRow()) {
47
		$setting_name=strtoupper($setting['name']);
48
		$setting_value=$setting['value'];
49
		if ($setting_value=='false')
50
			$setting_value=false;
51
		if ($setting_value=='true')
52
			$setting_value=true;
53
		@define($setting_name,$setting_value);
54
	}
55
	$string_file_mode = STRING_FILE_MODE;
56
	define('OCTAL_FILE_MODE',(int) octdec($string_file_mode));
57
	$string_dir_mode = STRING_DIR_MODE;
58
	define('OCTAL_DIR_MODE',(int) octdec($string_dir_mode));
59
	$sSecMod = (defined('SECURE_FORM_MODULE') && SECURE_FORM_MODULE != '') ? '.'.SECURE_FORM_MODULE : '';
60
	$sSecMod = WB_PATH.'/framework/SecureForm'.$sSecMod.'.php';
61
	require_once($sSecMod);
62
	if (!defined("WB_INSTALL_PROCESS")) {
63
		// get CAPTCHA and ASP settings
64
		$table = TABLE_PREFIX.'mod_captcha_control';
65
		if( ($get_settings = $database->query("SELECT * FROM $table LIMIT 1")) ) {
66
			if($get_settings->numRows() == 0) { die("CAPTCHA-Settings not found"); }
67
			$setting = $get_settings->fetchRow();
68
			if($setting['enabled_captcha'] == '1') define('ENABLED_CAPTCHA', true);
69
			else define('ENABLED_CAPTCHA', false);
70
			if($setting['enabled_asp'] == '1') define('ENABLED_ASP', true);
71
			else define('ENABLED_ASP', false);
72
			define('CAPTCHA_TYPE', $setting['captcha_type']);
73
			define('ASP_SESSION_MIN_AGE', (int)$setting['asp_session_min_age']);
74
			define('ASP_VIEW_MIN_AGE', (int)$setting['asp_view_min_age']);
75
			define('ASP_INPUT_MIN_AGE', (int)$setting['asp_input_min_age']);
76
		}
77
	}
78

    
79
	// set error-reporting
80
	if(intval(ER_LEVEL) > 0 )
81
	{
82
		error_reporting(ER_LEVEL);
83
		if( intval(ini_get ( 'display_errors' )) == 0 )
84
		{
85
			ini_set('display_errors', 1);
86
		}
87
	}
88
	// Start a session
89
	if(!defined('SESSION_STARTED')) {
90
		session_name(APP_NAME.'_session_id');
91
		@session_start();
92
		define('SESSION_STARTED', true);
93
	}
94
	if(defined('ENABLED_ASP') && ENABLED_ASP && !isset($_SESSION['session_started']))
95
		$_SESSION['session_started'] = time();
96

    
97
	// Get users language
98
	if(isset($_GET['lang']) AND $_GET['lang'] != '' AND !is_numeric($_GET['lang']) AND strlen($_GET['lang']) == 2) {
99
	  	define('LANGUAGE', strtoupper($_GET['lang']));
100
		$_SESSION['LANGUAGE']=LANGUAGE;
101
	} else {
102
		if(isset($_SESSION['LANGUAGE']) AND $_SESSION['LANGUAGE'] != '') {
103
			define('LANGUAGE', $_SESSION['LANGUAGE']);
104
		} else {
105
			define('LANGUAGE', DEFAULT_LANGUAGE);
106
		}
107
	}
108
	
109
	// Load Language file
110
	if(!defined('LANGUAGE_LOADED')) {
111
		if(!file_exists(WB_PATH.'/languages/'.LANGUAGE.'.php')) {
112
			exit('Error loading language file '.LANGUAGE.', please check configuration');
113
		} else {
114
			require_once(WB_PATH.'/languages/'.LANGUAGE.'.php');
115
		}
116
	}
117
	
118
	// Get users timezone
119
	if(isset($_SESSION['TIMEZONE'])) {
120
		define('TIMEZONE', $_SESSION['TIMEZONE']);
121
	} else {
122
		define('TIMEZONE', DEFAULT_TIMEZONE);
123
	}
124
	// Get users date format
125
	if(isset($_SESSION['DATE_FORMAT'])) {
126
		define('DATE_FORMAT', $_SESSION['DATE_FORMAT']);
127
	} else {
128
		define('DATE_FORMAT', DEFAULT_DATE_FORMAT);
129
	}
130
	// Get users time format
131
	if(isset($_SESSION['TIME_FORMAT'])) {
132
		define('TIME_FORMAT', $_SESSION['TIME_FORMAT']);
133
	} else {
134
		define('TIME_FORMAT', DEFAULT_TIME_FORMAT);
135
	}
136

    
137
	// Set Theme dir
138
	define('THEME_URL', WB_URL.'/templates/'.DEFAULT_THEME);
139
	define('THEME_PATH', WB_PATH.'/templates/'.DEFAULT_THEME);
140

    
141
    // extended wb_settings
142
	define('EDIT_ONE_SECTION', false);
143

    
144
	define('EDITOR_WIDTH', 0);
145

    
146
}
147

    
148
?>
(17-17/18)