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 1488 2011-08-11 13:11:09Z DarkViper $
|
14
|
* @filesource $HeadURL: svn://isteam.dynxs.de/wb-archiv/branches/2.8.x/wb/framework/initialize.php $
|
15
|
* @lastmodified $Date: 2011-08-11 15:11:09 +0200 (Thu, 11 Aug 2011) $
|
16
|
*
|
17
|
*/
|
18
|
|
19
|
/* -------------------------------------------------------- */
|
20
|
// Must include code to stop this file being accessed directly
|
21
|
require_once('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
|
$string_file_mode = STRING_FILE_MODE;
|
53
|
define('OCTAL_FILE_MODE',(int) octdec($string_file_mode));
|
54
|
$string_dir_mode = STRING_DIR_MODE;
|
55
|
define('OCTAL_DIR_MODE',(int) octdec($string_dir_mode));
|
56
|
$sSecMod = (defined('SECURE_FORM_MODULE') && SECURE_FORM_MODULE != '') ? '.'.SECURE_FORM_MODULE : '';
|
57
|
$sSecMod = WB_PATH.'/framework/SecureForm'.$sSecMod.'.php';
|
58
|
require_once($sSecMod);
|
59
|
if (!defined("WB_INSTALL_PROCESS")) {
|
60
|
// get CAPTCHA and ASP settings
|
61
|
$table = TABLE_PREFIX.'mod_captcha_control';
|
62
|
if( ($get_settings = $database->query("SELECT * FROM $table LIMIT 1")) ) {
|
63
|
if($get_settings->numRows() == 0) { die("CAPTCHA-Settings not found"); }
|
64
|
$setting = $get_settings->fetchRow();
|
65
|
if($setting['enabled_captcha'] == '1') define('ENABLED_CAPTCHA', true);
|
66
|
else define('ENABLED_CAPTCHA', false);
|
67
|
if($setting['enabled_asp'] == '1') define('ENABLED_ASP', true);
|
68
|
else define('ENABLED_ASP', false);
|
69
|
define('CAPTCHA_TYPE', $setting['captcha_type']);
|
70
|
define('ASP_SESSION_MIN_AGE', (int)$setting['asp_session_min_age']);
|
71
|
define('ASP_VIEW_MIN_AGE', (int)$setting['asp_view_min_age']);
|
72
|
define('ASP_INPUT_MIN_AGE', (int)$setting['asp_input_min_age']);
|
73
|
}
|
74
|
}
|
75
|
|
76
|
// set error-reporting
|
77
|
if(intval(ER_LEVEL) > 0 )
|
78
|
{
|
79
|
error_reporting(ER_LEVEL);
|
80
|
if( intval(ini_get ( 'display_errors' )) == 0 )
|
81
|
{
|
82
|
ini_set('display_errors', 1);
|
83
|
}
|
84
|
}
|
85
|
// Start a session
|
86
|
if(!defined('SESSION_STARTED')) {
|
87
|
session_name(APP_NAME.'_session_id');
|
88
|
@session_start();
|
89
|
define('SESSION_STARTED', true);
|
90
|
}
|
91
|
if(defined('ENABLED_ASP') && ENABLED_ASP && !isset($_SESSION['session_started']))
|
92
|
$_SESSION['session_started'] = time();
|
93
|
|
94
|
// Get users language
|
95
|
if(isset($_GET['lang']) AND $_GET['lang'] != '' AND !is_numeric($_GET['lang']) AND strlen($_GET['lang']) == 2) {
|
96
|
define('LANGUAGE', strtoupper($_GET['lang']));
|
97
|
$_SESSION['LANGUAGE']=LANGUAGE;
|
98
|
} else {
|
99
|
if(isset($_SESSION['LANGUAGE']) AND $_SESSION['LANGUAGE'] != '') {
|
100
|
define('LANGUAGE', $_SESSION['LANGUAGE']);
|
101
|
} else {
|
102
|
define('LANGUAGE', DEFAULT_LANGUAGE);
|
103
|
}
|
104
|
}
|
105
|
|
106
|
// Load Language file
|
107
|
if(!defined('LANGUAGE_LOADED')) {
|
108
|
if(!file_exists(WB_PATH.'/languages/'.LANGUAGE.'.php')) {
|
109
|
exit('Error loading language file '.LANGUAGE.', please check configuration');
|
110
|
} else {
|
111
|
require_once(WB_PATH.'/languages/'.LANGUAGE.'.php');
|
112
|
}
|
113
|
}
|
114
|
|
115
|
// Get users timezone
|
116
|
if(isset($_SESSION['TIMEZONE'])) {
|
117
|
define('TIMEZONE', $_SESSION['TIMEZONE']);
|
118
|
} else {
|
119
|
define('TIMEZONE', DEFAULT_TIMEZONE);
|
120
|
}
|
121
|
// Get users date format
|
122
|
if(isset($_SESSION['DATE_FORMAT'])) {
|
123
|
define('DATE_FORMAT', $_SESSION['DATE_FORMAT']);
|
124
|
} else {
|
125
|
define('DATE_FORMAT', DEFAULT_DATE_FORMAT);
|
126
|
}
|
127
|
// Get users time format
|
128
|
if(isset($_SESSION['TIME_FORMAT'])) {
|
129
|
define('TIME_FORMAT', $_SESSION['TIME_FORMAT']);
|
130
|
} else {
|
131
|
define('TIME_FORMAT', DEFAULT_TIME_FORMAT);
|
132
|
}
|
133
|
|
134
|
// Set Theme dir
|
135
|
define('THEME_URL', WB_URL.'/templates/'.DEFAULT_THEME);
|
136
|
define('THEME_PATH', WB_PATH.'/templates/'.DEFAULT_THEME);
|
137
|
|
138
|
// extended wb_settings
|
139
|
define('EDIT_ONE_SECTION', false);
|
140
|
|
141
|
define('EDITOR_WIDTH', 0);
|
142
|
|
143
|
}
|
144
|
|
145
|
?>
|