Project

General

Profile

1
<?php
2

    
3
// $Id: initialize.php 106 2005-09-15 19:15:43Z stefan $
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
	// Start a session
35
	if(!defined('SESSION_STARTED')) {
36
		session_name(APP_NAME.'_session_id');
37
		session_start();
38
		define('SESSION_STARTED', true);
39
	}
40
	
41
	set_magic_quotes_runtime(0);
42
	
43
	// Get website settings (title, keywords, description, header, and footer)
44
	$query_settings = "SELECT name,value FROM ".TABLE_PREFIX."settings";
45
	$get_settings = $database->query($query_settings);
46
	while($setting = $get_settings->fetchRow()) {
47
		$setting_name=strtoupper($setting['name']);
48
		$setting_value=$setting['value'];
49
		if ($setting_value=='false')
50
			$setting_value=false;
51
		if ($setting_value=='true')
52
			$setting_value=true;
53
		define($setting_name,$setting_value);
54
	}
55
	$string_file_mode = STRING_FILE_MODE;
56
	define('OCTAL_FILE_MODE',(int) $string_file_mode);
57
	$string_dir_mode = STRING_DIR_MODE;
58
	define('OCTAL_DIR_MODE',(int) $string_dir_mode);
59
	
60
	// 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
?>
(11-11/11)