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