1
|
<?php
|
2
|
/**
|
3
|
*
|
4
|
* @category framework
|
5
|
* @package initialize
|
6
|
* @author WebsiteBaker Project
|
7
|
* @copyright 2004-2009, Ryan Djurovich
|
8
|
* @copyright 2009-2010, 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 4.4.9 and higher
|
13
|
* @version $Id: initialize.php 1290 2010-02-19 01:49:22Z Luisehahne $
|
14
|
* @filesource $HeadURL: svn://isteam.dynxs.de/wb-archiv/branches/2.8.x/wb/framework/initialize.php $
|
15
|
* @lastmodified $Date: 2010-02-19 02:49:22 +0100 (Fri, 19 Feb 2010) $
|
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
|
// set error-reporting
|
68
|
if(is_numeric(ER_LEVEL)) {
|
69
|
error_reporting(ER_LEVEL);
|
70
|
}
|
71
|
|
72
|
// Start a session
|
73
|
if(!defined('SESSION_STARTED')) {
|
74
|
session_name(APP_NAME.'_session_id');
|
75
|
@session_start();
|
76
|
define('SESSION_STARTED', true);
|
77
|
}
|
78
|
if(defined('ENABLED_ASP') && ENABLED_ASP && !isset($_SESSION['session_started']))
|
79
|
$_SESSION['session_started'] = time();
|
80
|
|
81
|
// Get users language
|
82
|
if(isset($_GET['lang']) AND $_GET['lang'] != '' AND !is_numeric($_GET['lang']) AND strlen($_GET['lang']) == 2) {
|
83
|
define('LANGUAGE', strtoupper($_GET['lang']));
|
84
|
$_SESSION['LANGUAGE']=LANGUAGE;
|
85
|
} else {
|
86
|
if(isset($_SESSION['LANGUAGE']) AND $_SESSION['LANGUAGE'] != '') {
|
87
|
define('LANGUAGE', $_SESSION['LANGUAGE']);
|
88
|
} else {
|
89
|
define('LANGUAGE', DEFAULT_LANGUAGE);
|
90
|
}
|
91
|
}
|
92
|
|
93
|
// Load Language file
|
94
|
if(!defined('LANGUAGE_LOADED')) {
|
95
|
if(!file_exists(WB_PATH.'/languages/'.LANGUAGE.'.php')) {
|
96
|
exit('Error loading language file '.LANGUAGE.', please check configuration');
|
97
|
} else {
|
98
|
require_once(WB_PATH.'/languages/'.LANGUAGE.'.php');
|
99
|
}
|
100
|
}
|
101
|
|
102
|
// Get users timezone
|
103
|
if(isset($_SESSION['TIMEZONE'])) {
|
104
|
define('TIMEZONE', $_SESSION['TIMEZONE']);
|
105
|
} else {
|
106
|
define('TIMEZONE', DEFAULT_TIMEZONE);
|
107
|
}
|
108
|
// Get users date format
|
109
|
if(isset($_SESSION['DATE_FORMAT'])) {
|
110
|
define('DATE_FORMAT', $_SESSION['DATE_FORMAT']);
|
111
|
} else {
|
112
|
define('DATE_FORMAT', DEFAULT_DATE_FORMAT);
|
113
|
}
|
114
|
// Get users time format
|
115
|
if(isset($_SESSION['TIME_FORMAT'])) {
|
116
|
define('TIME_FORMAT', $_SESSION['TIME_FORMAT']);
|
117
|
} else {
|
118
|
define('TIME_FORMAT', DEFAULT_TIME_FORMAT);
|
119
|
}
|
120
|
|
121
|
// Set Theme dir
|
122
|
define('THEME_URL', WB_URL.'/templates/'.DEFAULT_THEME);
|
123
|
define('THEME_PATH', WB_PATH.'/templates/'.DEFAULT_THEME);
|
124
|
|
125
|
// extended wb_settings
|
126
|
define('EDIT_ONE_SECTION', false);
|
127
|
|
128
|
define('EDITOR_WIDTH', 0);
|
129
|
|
130
|
}
|
131
|
|
132
|
?>
|