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 1462 2011-06-30 17:21:40Z DarkViper $
14
 * @filesource		$HeadURL: svn://isteam.dynxs.de/wb-archiv/branches/2.8.x/wb/framework/initialize.php $
15
 * @lastmodified    $Date: 2011-06-30 19:21:40 +0200 (Thu, 30 Jun 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
	date_default_timezone_set('UTC');
26
	require_once(WB_PATH.'/framework/class.database.php');
27

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

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

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

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

    
131
	// Set Theme dir
132
	define('THEME_URL', WB_URL.'/templates/'.DEFAULT_THEME);
133
	define('THEME_PATH', WB_PATH.'/templates/'.DEFAULT_THEME);
134

    
135
    // extended wb_settings
136
	define('EDIT_ONE_SECTION', false);
137

    
138
	define('EDITOR_WIDTH', 0);
139

    
140
}
141

    
142
?>
(17-17/18)