Project

General

Profile

1 1349 Luisehahne
<?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 1373 Luisehahne
 *  * @requirements    PHP 5.2.2 and higher
13 1349 Luisehahne
 * @version         $Id$
14
 * @filesource		$HeadURL$
15
 * @lastmodified    $Date$
16
 *
17
 */
18
19
//set_include_path(get_include_path() . PATH_SEPARATOR . WB_PATH);
20
21
if (file_exists(WB_PATH.'/framework/class.database.php')) {
22
23
	require_once(WB_PATH.'/framework/class.database.php');
24
25
	// Create database class
26
	$database = new database();
27
28
    if(version_compare(PHP_VERSION, '5.3.0', '<'))
29
    {
30
        set_magic_quotes_runtime(0); // Disable magic_quotes_runtime
31
    }
32
	// Get website settings (title, keywords, description, header, and footer)
33
	$query_settings = "SELECT name,value FROM ".TABLE_PREFIX."settings";
34
	$get_settings = $database->query($query_settings);
35
	if($database->is_error()) { die($database->get_error()); }
36
	if($get_settings->numRows() == 0) { die("Settings not found"); }
37
	while($setting = $get_settings->fetchRow()) {
38
		$setting_name=strtoupper($setting['name']);
39
		$setting_value=$setting['value'];
40
		if ($setting_value=='false')
41
			$setting_value=false;
42
		if ($setting_value=='true')
43
			$setting_value=true;
44
		@define($setting_name,$setting_value);
45
	}
46
	$string_file_mode = STRING_FILE_MODE;
47
	define('OCTAL_FILE_MODE',(int) octdec($string_file_mode));
48
	$string_dir_mode = STRING_DIR_MODE;
49
	define('OCTAL_DIR_MODE',(int) octdec($string_dir_mode));
50
51
	if (!defined("WB_INSTALL_PROCESS")) {
52
		// get CAPTCHA and ASP settings
53
		$table = TABLE_PREFIX.'mod_captcha_control';
54
		if($get_settings = $database->query("SELECT * FROM $table LIMIT 1")) {
55
			if($get_settings->numRows() == 0) { die("CAPTCHA-Settings not found"); }
56
			$setting = $get_settings->fetchRow();
57
			if($setting['enabled_captcha'] == '1') define('ENABLED_CAPTCHA', true);
58
			else define('ENABLED_CAPTCHA', false);
59
			if($setting['enabled_asp'] == '1') define('ENABLED_ASP', true);
60
			else define('ENABLED_ASP', false);
61
			define('CAPTCHA_TYPE', $setting['captcha_type']);
62
			define('ASP_SESSION_MIN_AGE', (int)$setting['asp_session_min_age']);
63
			define('ASP_VIEW_MIN_AGE', (int)$setting['asp_view_min_age']);
64
			define('ASP_INPUT_MIN_AGE', (int)$setting['asp_input_min_age']);
65
		}
66
	}
67
68
	// set error-reporting
69
	if(intval(ER_LEVEL) > 0 )
70
	{
71
		error_reporting(ER_LEVEL);
72 1352 Luisehahne
		if( intval(ini_get ( 'display_errors' )) == 0 )
73 1349 Luisehahne
		{
74
			ini_set('display_errors', 1);
75
		}
76
	}
77
	// Start a session
78
	if(!defined('SESSION_STARTED')) {
79
		session_name(APP_NAME.'_session_id');
80
		@session_start();
81
		define('SESSION_STARTED', true);
82
	}
83
	if(defined('ENABLED_ASP') && ENABLED_ASP && !isset($_SESSION['session_started']))
84
		$_SESSION['session_started'] = time();
85
86
	// Get users language
87
	if(isset($_GET['lang']) AND $_GET['lang'] != '' AND !is_numeric($_GET['lang']) AND strlen($_GET['lang']) == 2) {
88
	  	define('LANGUAGE', strtoupper($_GET['lang']));
89
		$_SESSION['LANGUAGE']=LANGUAGE;
90
	} else {
91
		if(isset($_SESSION['LANGUAGE']) AND $_SESSION['LANGUAGE'] != '') {
92
			define('LANGUAGE', $_SESSION['LANGUAGE']);
93
		} else {
94
			define('LANGUAGE', DEFAULT_LANGUAGE);
95
		}
96
	}
97
98
	// Load Language file
99
	if(!defined('LANGUAGE_LOADED')) {
100
		if(!file_exists(WB_PATH.'/languages/'.LANGUAGE.'.php')) {
101
			exit('Error loading language file '.LANGUAGE.', please check configuration');
102
		} else {
103
			require_once(WB_PATH.'/languages/'.LANGUAGE.'.php');
104
		}
105
	}
106
107
	// Get users timezone
108
	if(isset($_SESSION['TIMEZONE'])) {
109
		define('TIMEZONE', $_SESSION['TIMEZONE']);
110
	} else {
111
		define('TIMEZONE', DEFAULT_TIMEZONE);
112
	}
113
	// Get users date format
114
	if(isset($_SESSION['DATE_FORMAT'])) {
115
		define('DATE_FORMAT', $_SESSION['DATE_FORMAT']);
116
	} else {
117
		define('DATE_FORMAT', DEFAULT_DATE_FORMAT);
118
	}
119
	// Get users time format
120
	if(isset($_SESSION['TIME_FORMAT'])) {
121
		define('TIME_FORMAT', $_SESSION['TIME_FORMAT']);
122
	} else {
123
		define('TIME_FORMAT', DEFAULT_TIME_FORMAT);
124
	}
125
126
	// Set Theme dir
127
	define('THEME_URL', WB_URL.'/templates/'.DEFAULT_THEME);
128
	define('THEME_PATH', WB_PATH.'/templates/'.DEFAULT_THEME);
129
130
    // extended wb_settings
131
	define('EDIT_ONE_SECTION', false);
132
133
	define('EDITOR_WIDTH', 0);
134
135
}
136
137 1241 Luisehahne
?>