1
|
<?php
|
2
|
|
3
|
// $Id: initialize.php 1182 2009-11-24 19:36:04Z Luisehahne $
|
4
|
|
5
|
/*
|
6
|
|
7
|
Website Baker Project <http://www.websitebaker.org/>
|
8
|
Copyright (C) 2004-2009, Ryan Djurovich
|
9
|
|
10
|
Website Baker is free software; you can redistribute it and/or modify
|
11
|
it under the terms of the GNU General Public License as published by
|
12
|
the Free Software Foundation; either version 2 of the License, or
|
13
|
(at your option) any later version.
|
14
|
|
15
|
Website Baker is distributed in the hope that it will be useful,
|
16
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
17
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
18
|
GNU General Public License for more details.
|
19
|
|
20
|
You should have received a copy of the GNU General Public License
|
21
|
along with Website Baker; if not, write to the Free Software
|
22
|
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
23
|
|
24
|
*/
|
25
|
|
26
|
//set_include_path(get_include_path() . PATH_SEPARATOR . WB_PATH);
|
27
|
|
28
|
|
29
|
if (file_exists(WB_PATH.'/framework/class.database.php')) {
|
30
|
|
31
|
require_once(WB_PATH.'/framework/class.database.php');
|
32
|
|
33
|
// Create database class
|
34
|
$database = new database();
|
35
|
|
36
|
if (function_exists("set_magic_quotes_runtime"))
|
37
|
{
|
38
|
set_magic_quotes_runtime(0);
|
39
|
}
|
40
|
// Get website settings (title, keywords, description, header, and footer)
|
41
|
$query_settings = "SELECT name,value FROM ".TABLE_PREFIX."settings";
|
42
|
$get_settings = $database->query($query_settings);
|
43
|
if($database->is_error()) { die($database->get_error()); }
|
44
|
if($get_settings->numRows() == 0) { die("Settings not found"); }
|
45
|
while($setting = $get_settings->fetchRow()) {
|
46
|
$setting_name=strtoupper($setting['name']);
|
47
|
$setting_value=$setting['value'];
|
48
|
if ($setting_value=='false')
|
49
|
$setting_value=false;
|
50
|
if ($setting_value=='true')
|
51
|
$setting_value=true;
|
52
|
@define($setting_name,$setting_value);
|
53
|
}
|
54
|
$string_file_mode = STRING_FILE_MODE;
|
55
|
define('OCTAL_FILE_MODE',(int) octdec($string_file_mode));
|
56
|
$string_dir_mode = STRING_DIR_MODE;
|
57
|
define('OCTAL_DIR_MODE',(int) octdec($string_dir_mode));
|
58
|
|
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
|
// set error-reporting
|
76
|
if(is_numeric(ER_LEVEL)) {
|
77
|
error_reporting(ER_LEVEL);
|
78
|
}
|
79
|
|
80
|
// Start a session
|
81
|
if(!defined('SESSION_STARTED')) {
|
82
|
session_name(APP_NAME.'_session_id');
|
83
|
@session_start();
|
84
|
define('SESSION_STARTED', true);
|
85
|
}
|
86
|
if(defined('ENABLED_ASP') && ENABLED_ASP && !isset($_SESSION['session_started']))
|
87
|
$_SESSION['session_started'] = time();
|
88
|
|
89
|
// Get users language
|
90
|
if(isset($_GET['lang']) AND $_GET['lang'] != '' AND !is_numeric($_GET['lang']) AND strlen($_GET['lang']) == 2) {
|
91
|
define('LANGUAGE', strtoupper($_GET['lang']));
|
92
|
$_SESSION['LANGUAGE']=LANGUAGE;
|
93
|
} else {
|
94
|
if(isset($_SESSION['LANGUAGE']) AND $_SESSION['LANGUAGE'] != '') {
|
95
|
define('LANGUAGE', $_SESSION['LANGUAGE']);
|
96
|
} else {
|
97
|
define('LANGUAGE', DEFAULT_LANGUAGE);
|
98
|
}
|
99
|
}
|
100
|
|
101
|
// Load Language file
|
102
|
if(!defined('LANGUAGE_LOADED')) {
|
103
|
if(!file_exists(WB_PATH.'/languages/'.LANGUAGE.'.php')) {
|
104
|
exit('Error loading language file '.LANGUAGE.', please check configuration');
|
105
|
} else {
|
106
|
require_once(WB_PATH.'/languages/'.LANGUAGE.'.php');
|
107
|
}
|
108
|
}
|
109
|
|
110
|
// Get users timezone
|
111
|
if(isset($_SESSION['TIMEZONE'])) {
|
112
|
define('TIMEZONE', $_SESSION['TIMEZONE']);
|
113
|
} else {
|
114
|
define('TIMEZONE', DEFAULT_TIMEZONE);
|
115
|
}
|
116
|
// Get users date format
|
117
|
if(isset($_SESSION['DATE_FORMAT'])) {
|
118
|
define('DATE_FORMAT', $_SESSION['DATE_FORMAT']);
|
119
|
} else {
|
120
|
define('DATE_FORMAT', DEFAULT_DATE_FORMAT);
|
121
|
}
|
122
|
// Get users time format
|
123
|
if(isset($_SESSION['TIME_FORMAT'])) {
|
124
|
define('TIME_FORMAT', $_SESSION['TIME_FORMAT']);
|
125
|
} else {
|
126
|
define('TIME_FORMAT', DEFAULT_TIME_FORMAT);
|
127
|
}
|
128
|
|
129
|
// Set Theme dir
|
130
|
define('THEME_URL', WB_URL.'/templates/'.DEFAULT_THEME);
|
131
|
define('THEME_PATH', WB_PATH.'/templates/'.DEFAULT_THEME);
|
132
|
|
133
|
// extended wb_settings
|
134
|
define('EDIT_ONE_SECTION', true);
|
135
|
|
136
|
define('EDITOR_WIDTH', 900);
|
137
|
|
138
|
}
|
139
|
|
140
|
?>
|