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 1420 2011-01-26 17:43:56Z Luisehahne $
14
 * @filesource		$HeadURL: svn://isteam.dynxs.de/wb-archiv/branches/2.8.x/wb/framework/initialize.php $
15
 * @lastmodified    $Date: 2011-01-26 18:43:56 +0100 (Wed, 26 Jan 2011) $
16
 *
17
 */
18

    
19
// Must include code to stop this file being access directly
20
if(defined('WB_PATH') == false) { die("Cannot access this file directly"); }
21
//set_include_path(get_include_path() . PATH_SEPARATOR . WB_PATH);
22

    
23
if (file_exists(WB_PATH.'/framework/class.database.php')) {
24

    
25
	require_once(WB_PATH.'/framework/class.database.php');
26

    
27
	// Create database class
28
	$database = new database();
29

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

    
70
	// set error-reporting
71
	if(intval(ER_LEVEL) > 0 )
72
	{
73
		error_reporting(ER_LEVEL);
74
		if( intval(ini_get ( 'display_errors' )) == 0 )
75
		{
76
			ini_set('display_errors', 1);
77
		}
78
	}
79
	// Start a session
80
	if(!defined('SESSION_STARTED')) {
81
		session_name(APP_NAME.'_session_id');
82
		@session_start();
83
		define('SESSION_STARTED', true);
84
	}
85
	if(defined('ENABLED_ASP') && ENABLED_ASP && !isset($_SESSION['session_started']))
86
		$_SESSION['session_started'] = time();
87

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

    
128
	// Set Theme dir
129
	define('THEME_URL', WB_URL.'/templates/'.DEFAULT_THEME);
130
	define('THEME_PATH', WB_PATH.'/templates/'.DEFAULT_THEME);
131

    
132
    // extended wb_settings
133
	define('EDIT_ONE_SECTION', false);
134

    
135
	define('EDITOR_WIDTH', 0);
136

    
137
}
138

    
139
?>
(15-15/16)