Project

General

Profile

1
<?php
2
/*
3
*
4
*                       About WebsiteBaker
5
*
6
* Website Baker is a PHP-based Content Management System (CMS)
7
* designed with one goal in mind: to enable its users to produce websites
8
* with ease.
9
*
10
*                       LICENSE INFORMATION
11
*
12
* WebsiteBaker is free software; you can redistribute it and/or
13
* modify it under the terms of the GNU General Public License
14
* as published by the Free Software Foundation; either version 2
15
* of the License, or (at your option) any later version.
16
*
17
* WebsiteBaker is distributed in the hope that it will be useful,
18
* but WITHOUT ANY WARRANTY; without even the implied warranty of
19
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
20
* See the GNU General Public License for more details.
21
*
22
* You should have received a copy of the GNU General Public License
23
* along with this program; if not, write to the Free Software
24
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
25
*
26
*                   WebsiteBaker Extra Information
27
*
28
*
29
*/
30
/**
31
 *
32
 * @category        framework
33
 * @package         initialize
34
 * @author          Ryan Djurovich
35
 * @copyright       2004-2009, Ryan Djurovich
36
 * @copyright       2009-2010, Website Baker Org. e.V.
37
 * @filesource		$HeadURL: svn://isteam.dynxs.de/wb-archiv/branches/2.8.x/wb/framework/initialize.php $
38
 * @author          Ryan Djurovich
39
 * @copyright       2004-2009, Ryan Djurovich
40
 *
41
 * @author          WebsiteBaker Project
42
 * @link			http://www.websitebaker2.org/
43
 * @copyright       2009-2010, Website Baker Org. e.V.
44
 * @link			http://start.websitebaker2.org/impressum-datenschutz.php
45
 * @license         http://www.gnu.org/licenses/gpl.html
46
 * @version         $Id: initialize.php 1265 2010-01-22 04:40:25Z Luisehahne $
47
 * @platform        WebsiteBaker 2.8.x
48
 * @requirements    PHP 4.3.4 and higher
49
 * @lastmodified    $Date: 2010-01-22 05:40:25 +0100 (Fri, 22 Jan 2010) $
50
 *
51
 */
52

    
53
//set_include_path(get_include_path() . PATH_SEPARATOR . WB_PATH);
54

    
55
if (file_exists(WB_PATH.'/framework/class.database.php')) {
56

    
57
	require_once(WB_PATH.'/framework/class.database.php');
58

    
59
	// Create database class
60
	$database = new database();
61

    
62
    if(version_compare(PHP_VERSION, '5.3.0', '<'))
63
    {
64
        set_magic_quotes_runtime(0); // Disable magic_quotes_runtime
65
    }
66
	// Get website settings (title, keywords, description, header, and footer)
67
	$query_settings = "SELECT name,value FROM ".TABLE_PREFIX."settings";
68
	$get_settings = $database->query($query_settings);
69
	if($database->is_error()) { die($database->get_error()); }
70
	if($get_settings->numRows() == 0) { die("Settings not found"); }
71
	while($setting = $get_settings->fetchRow()) {
72
		$setting_name=strtoupper($setting['name']);
73
		$setting_value=$setting['value'];
74
		if ($setting_value=='false')
75
			$setting_value=false;
76
		if ($setting_value=='true')
77
			$setting_value=true;
78
		@define($setting_name,$setting_value);
79
	}
80
	$string_file_mode = STRING_FILE_MODE;
81
	define('OCTAL_FILE_MODE',(int) octdec($string_file_mode));
82
	$string_dir_mode = STRING_DIR_MODE;
83
	define('OCTAL_DIR_MODE',(int) octdec($string_dir_mode));
84
	
85
	if (!defined("WB_INSTALL_PROCESS")) {
86
		// get CAPTCHA and ASP settings
87
		$table = TABLE_PREFIX.'mod_captcha_control';
88
		if($get_settings = $database->query("SELECT * FROM $table LIMIT 1")) {
89
			if($get_settings->numRows() == 0) { die("CAPTCHA-Settings not found"); }
90
			$setting = $get_settings->fetchRow();
91
			if($setting['enabled_captcha'] == '1') define('ENABLED_CAPTCHA', true);
92
			else define('ENABLED_CAPTCHA', false);
93
			if($setting['enabled_asp'] == '1') define('ENABLED_ASP', true);
94
			else define('ENABLED_ASP', false);
95
			define('CAPTCHA_TYPE', $setting['captcha_type']);
96
			define('ASP_SESSION_MIN_AGE', (int)$setting['asp_session_min_age']);
97
			define('ASP_VIEW_MIN_AGE', (int)$setting['asp_view_min_age']);
98
			define('ASP_INPUT_MIN_AGE', (int)$setting['asp_input_min_age']);
99
		}
100
	}
101
	// set error-reporting
102
	if(is_numeric(ER_LEVEL)) {
103
		error_reporting(ER_LEVEL);
104
	}
105

    
106
	// Start a session
107
	if(!defined('SESSION_STARTED')) {
108
		session_name(APP_NAME.'_session_id');
109
		@session_start();
110
		define('SESSION_STARTED', true);
111
	}
112
	if(defined('ENABLED_ASP') && ENABLED_ASP && !isset($_SESSION['session_started']))
113
		$_SESSION['session_started'] = time();
114

    
115
	// Get users language
116
	if(isset($_GET['lang']) AND $_GET['lang'] != '' AND !is_numeric($_GET['lang']) AND strlen($_GET['lang']) == 2) {
117
	  	define('LANGUAGE', strtoupper($_GET['lang']));
118
		$_SESSION['LANGUAGE']=LANGUAGE;
119
	} else {
120
		if(isset($_SESSION['LANGUAGE']) AND $_SESSION['LANGUAGE'] != '') {
121
			define('LANGUAGE', $_SESSION['LANGUAGE']);
122
		} else {
123
			define('LANGUAGE', DEFAULT_LANGUAGE);
124
		}
125
	}
126
	
127
	// Load Language file
128
	if(!defined('LANGUAGE_LOADED')) {
129
		if(!file_exists(WB_PATH.'/languages/'.LANGUAGE.'.php')) {
130
			exit('Error loading language file '.LANGUAGE.', please check configuration');
131
		} else {
132
			require_once(WB_PATH.'/languages/'.LANGUAGE.'.php');
133
		}
134
	}
135
	
136
	// Get users timezone
137
	if(isset($_SESSION['TIMEZONE'])) {
138
		define('TIMEZONE', $_SESSION['TIMEZONE']);
139
	} else {
140
		define('TIMEZONE', DEFAULT_TIMEZONE);
141
	}
142
	// Get users date format
143
	if(isset($_SESSION['DATE_FORMAT'])) {
144
		define('DATE_FORMAT', $_SESSION['DATE_FORMAT']);
145
	} else {
146
		define('DATE_FORMAT', DEFAULT_DATE_FORMAT);
147
	}
148
	// Get users time format
149
	if(isset($_SESSION['TIME_FORMAT'])) {
150
		define('TIME_FORMAT', $_SESSION['TIME_FORMAT']);
151
	} else {
152
		define('TIME_FORMAT', DEFAULT_TIME_FORMAT);
153
	}
154

    
155
	// Set Theme dir
156
	define('THEME_URL', WB_URL.'/templates/'.DEFAULT_THEME);
157
	define('THEME_PATH', WB_PATH.'/templates/'.DEFAULT_THEME);
158

    
159
    // extended wb_settings
160
	define('EDIT_ONE_SECTION', true);
161

    
162
	define('EDITOR_WIDTH', 0);
163

    
164
}
165

    
166
?>
(14-14/15)