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