Project

General

Profile

1 1182 Luisehahne
<?php
2 1241 Luisehahne
/****************************************************************************
3
* SVN Version information:
4
*
5
* $Id$
6
*
7
*****************************************************************************
8
*                          WebsiteBaker
9
*
10
* WebsiteBaker Project <http://www.websitebaker2.org/>
11
* Copyright (C) 2009, Website Baker Org. e.V.
12
*         http://start.websitebaker2.org/impressum-datenschutz.php
13
* Copyright (C) 2004-2009, Ryan Djurovich
14
*
15
*                        About WebsiteBaker
16
*
17
* Website Baker is a PHP-based Content Management System (CMS)
18
* designed with one goal in mind: to enable its users to produce websites
19
* with ease.
20
*
21
*****************************************************************************
22
*
23
*****************************************************************************
24
*                        LICENSE INFORMATION
25
*
26
* WebsiteBaker is free software; you can redistribute it and/or
27
* modify it under the terms of the GNU General Public License
28
* as published by the Free Software Foundation; either version 2
29
* of the License, or (at your option) any later version.
30
*
31
* WebsiteBaker is distributed in the hope that it will be useful,
32
* but WITHOUT ANY WARRANTY; without even the implied warranty of
33
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
34
* See the GNU General Public License for more details.
35
*
36
* You should have received a copy of the GNU General Public License
37
* along with this program; if not, write to the Free Software
38
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
39
****************************************************************************
40
*
41
*                   WebsiteBaker Extra Information
42
*
43
*
44
*
45
*
46
*****************************************************************************/
47
/**
48
 *
49
 * @category     framework
50
 * @package      config
51
 * @author       Ryan Djurovich
52
 * @copyright    2004-2009, Ryan Djurovich
53
 * @copyright    2009-2010, Website Baker Org. e.V.
54
 * @version      $Id$
55
 * @platform     WebsiteBaker 2.8.x
56
 * @requirements >= PHP 4.3.4
57
 * @license      http://www.gnu.org/licenses/gpl.html
58
 *
59
 */
60 1182 Luisehahne
61
//set_include_path(get_include_path() . PATH_SEPARATOR . WB_PATH);
62
63
64
if (file_exists(WB_PATH.'/framework/class.database.php')) {
65 1241 Luisehahne
66 1182 Luisehahne
	require_once(WB_PATH.'/framework/class.database.php');
67 1241 Luisehahne
68 1182 Luisehahne
	// Create database class
69
	$database = new database();
70
71 1189 Luisehahne
    if(version_compare(PHP_VERSION, '5.3.0', '<'))
72 1182 Luisehahne
    {
73 1189 Luisehahne
        set_magic_quotes_runtime(0); // Disable magic_quotes_runtime
74
    }
75 1182 Luisehahne
	// Get website settings (title, keywords, description, header, and footer)
76
	$query_settings = "SELECT name,value FROM ".TABLE_PREFIX."settings";
77
	$get_settings = $database->query($query_settings);
78
	if($database->is_error()) { die($database->get_error()); }
79
	if($get_settings->numRows() == 0) { die("Settings not found"); }
80
	while($setting = $get_settings->fetchRow()) {
81
		$setting_name=strtoupper($setting['name']);
82
		$setting_value=$setting['value'];
83
		if ($setting_value=='false')
84
			$setting_value=false;
85
		if ($setting_value=='true')
86
			$setting_value=true;
87
		@define($setting_name,$setting_value);
88
	}
89
	$string_file_mode = STRING_FILE_MODE;
90
	define('OCTAL_FILE_MODE',(int) octdec($string_file_mode));
91
	$string_dir_mode = STRING_DIR_MODE;
92
	define('OCTAL_DIR_MODE',(int) octdec($string_dir_mode));
93
94
	if (!defined("WB_INSTALL_PROCESS")) {
95
		// get CAPTCHA and ASP settings
96
		$table = TABLE_PREFIX.'mod_captcha_control';
97
		if($get_settings = $database->query("SELECT * FROM $table LIMIT 1")) {
98
			if($get_settings->numRows() == 0) { die("CAPTCHA-Settings not found"); }
99
			$setting = $get_settings->fetchRow();
100
			if($setting['enabled_captcha'] == '1') define('ENABLED_CAPTCHA', true);
101
			else define('ENABLED_CAPTCHA', false);
102
			if($setting['enabled_asp'] == '1') define('ENABLED_ASP', true);
103
			else define('ENABLED_ASP', false);
104
			define('CAPTCHA_TYPE', $setting['captcha_type']);
105
			define('ASP_SESSION_MIN_AGE', (int)$setting['asp_session_min_age']);
106
			define('ASP_VIEW_MIN_AGE', (int)$setting['asp_view_min_age']);
107
			define('ASP_INPUT_MIN_AGE', (int)$setting['asp_input_min_age']);
108
		}
109
	}
110
	// set error-reporting
111
	if(is_numeric(ER_LEVEL)) {
112
		error_reporting(ER_LEVEL);
113
	}
114
115
	// Start a session
116
	if(!defined('SESSION_STARTED')) {
117
		session_name(APP_NAME.'_session_id');
118
		@session_start();
119
		define('SESSION_STARTED', true);
120
	}
121
	if(defined('ENABLED_ASP') && ENABLED_ASP && !isset($_SESSION['session_started']))
122
		$_SESSION['session_started'] = time();
123
124
	// Get users language
125
	if(isset($_GET['lang']) AND $_GET['lang'] != '' AND !is_numeric($_GET['lang']) AND strlen($_GET['lang']) == 2) {
126
	  	define('LANGUAGE', strtoupper($_GET['lang']));
127
		$_SESSION['LANGUAGE']=LANGUAGE;
128
	} else {
129
		if(isset($_SESSION['LANGUAGE']) AND $_SESSION['LANGUAGE'] != '') {
130
			define('LANGUAGE', $_SESSION['LANGUAGE']);
131
		} else {
132
			define('LANGUAGE', DEFAULT_LANGUAGE);
133
		}
134
	}
135
136
	// Load Language file
137
	if(!defined('LANGUAGE_LOADED')) {
138
		if(!file_exists(WB_PATH.'/languages/'.LANGUAGE.'.php')) {
139
			exit('Error loading language file '.LANGUAGE.', please check configuration');
140
		} else {
141
			require_once(WB_PATH.'/languages/'.LANGUAGE.'.php');
142
		}
143
	}
144
145
	// Get users timezone
146
	if(isset($_SESSION['TIMEZONE'])) {
147
		define('TIMEZONE', $_SESSION['TIMEZONE']);
148
	} else {
149
		define('TIMEZONE', DEFAULT_TIMEZONE);
150
	}
151
	// Get users date format
152
	if(isset($_SESSION['DATE_FORMAT'])) {
153
		define('DATE_FORMAT', $_SESSION['DATE_FORMAT']);
154
	} else {
155
		define('DATE_FORMAT', DEFAULT_DATE_FORMAT);
156
	}
157
	// Get users time format
158
	if(isset($_SESSION['TIME_FORMAT'])) {
159
		define('TIME_FORMAT', $_SESSION['TIME_FORMAT']);
160
	} else {
161
		define('TIME_FORMAT', DEFAULT_TIME_FORMAT);
162
	}
163 1241 Luisehahne
164 1182 Luisehahne
	// Set Theme dir
165
	define('THEME_URL', WB_URL.'/templates/'.DEFAULT_THEME);
166
	define('THEME_PATH', WB_PATH.'/templates/'.DEFAULT_THEME);
167
168
    // extended wb_settings
169
	define('EDIT_ONE_SECTION', true);
170
171 1241 Luisehahne
	define('EDITOR_WIDTH', 925); // no prozent
172 1182 Luisehahne
173
}
174
175 1241 Luisehahne
?>