Project

General

Profile

1 106 stefan
<?php
2
3
// $Id$
4
5
6
/*
7
8
 Website Baker Project <http://www.websitebaker.org/>
9
 Copyright (C) 2004-2005, Ryan Djurovich
10
11
 Website Baker is free software; you can redistribute it and/or modify
12
 it under the terms of the GNU General Public License as published by
13
 the Free Software Foundation; either version 2 of the License, or
14
 (at your option) any later version.
15
16
 Website Baker is distributed in the hope that it will be useful,
17
 but WITHOUT ANY WARRANTY; without even the implied warranty of
18
 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
19
 GNU General Public License for more details.
20
21
 You should have received a copy of the GNU General Public License
22
 along with Website Baker; if not, write to the Free Software
23
 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
24
25
*/
26
27
if (file_exists(WB_PATH.'/framework/class.database.php'))
28
{
29
	require_once(WB_PATH.'/framework/class.database.php');
30
31
	// Create database class
32
	$database = new database();
33
34
	set_magic_quotes_runtime(0);
35
36
	// Get website settings (title, keywords, description, header, and footer)
37
	$query_settings = "SELECT name,value FROM ".TABLE_PREFIX."settings";
38
	$get_settings = $database->query($query_settings);
39
	while($setting = $get_settings->fetchRow()) {
40
		$setting_name=strtoupper($setting['name']);
41
		$setting_value=$setting['value'];
42
		if ($setting_value=='false')
43
			$setting_value=false;
44
		if ($setting_value=='true')
45
			$setting_value=true;
46
		define($setting_name,$setting_value);
47
	}
48
	$string_file_mode = STRING_FILE_MODE;
49
	define('OCTAL_FILE_MODE',(int) $string_file_mode);
50
	$string_dir_mode = STRING_DIR_MODE;
51
	define('OCTAL_DIR_MODE',(int) $string_dir_mode);
52
53 107 stefan
	// Start a session
54
	if(!defined('SESSION_STARTED')) {
55
		session_name(APP_NAME.'_session_id');
56
		session_start();
57
		define('SESSION_STARTED', true);
58
	}
59
60 106 stefan
	// Get users language
61
	if(isset($_GET['lang']) AND $_GET['lang'] != '' AND !is_numeric($_GET['lang']) AND strlen($_GET['lang']) == 2) {
62
	  	define('LANGUAGE', strtoupper($_GET['lang']));
63
		$_SESSION['LANGUAGE']=LANGUAGE;
64
	} else {
65
		if(isset($_SESSION['LANGUAGE']) AND $_SESSION['LANGUAGE'] != '') {
66
			define('LANGUAGE', $_SESSION['LANGUAGE']);
67
		} else {
68
			define('LANGUAGE', DEFAULT_LANGUAGE);
69
		}
70
	}
71
72
	// Load Language file
73
	if(!defined('LANGUAGE_LOADED')) {
74
		if(!file_exists(WB_PATH.'/languages/'.LANGUAGE.'.php')) {
75
			exit('Error loading language file '.LANGUAGE.', please check configuration');
76
		} else {
77
			require_once(WB_PATH.'/languages/'.LANGUAGE.'.php');
78
		}
79
	}
80
81
	// Get users timezone
82
	if(isset($_SESSION['TIMEZONE'])) {
83
		define('TIMEZONE', $_SESSION['TIMEZONE']);
84
	} else {
85
		define('TIMEZONE', DEFAULT_TIMEZONE);
86
	}
87
	// Get users date format
88
	if(isset($_SESSION['DATE_FORMAT'])) {
89
		define('DATE_FORMAT', $_SESSION['DATE_FORMAT']);
90
	} else {
91
		define('DATE_FORMAT', DEFAULT_DATE_FORMAT);
92
	}
93
	// Get users time format
94
	if(isset($_SESSION['TIME_FORMAT'])) {
95
		define('TIME_FORMAT', $_SESSION['TIME_FORMAT']);
96
	} else {
97
		define('TIME_FORMAT', DEFAULT_TIME_FORMAT);
98
	}
99
100
101
}
102
?>