Project

General

Profile

1
<?php
2

    
3
// $Id: initialize.php 11 2005-09-04 09:20:29Z ryan $
4

    
5
/*
6

    
7
 Website Baker Project <http://www.websitebaker.org/>
8
 Copyright (C) 2004-2005, Ryan Djurovich
9

    
10
 Website Baker is free software; you can redistribute it and/or modify
11
 it under the terms of the GNU General Public License as published by
12
 the Free Software Foundation; either version 2 of the License, or
13
 (at your option) any later version.
14

    
15
 Website Baker is distributed in the hope that it will be useful,
16
 but WITHOUT ANY WARRANTY; without even the implied warranty of
17
 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18
 GNU General Public License for more details.
19

    
20
 You should have received a copy of the GNU General Public License
21
 along with Website Baker; if not, write to the Free Software
22
 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
23

    
24
*/
25

    
26
/*
27
	Initializations common to frontend and backend
28
*/
29

    
30
// Setup database object
31
require_once(WB_PATH.'/framework/class.database.php');
32
if (!defined('DATABASE_CLASS_LOADED')) {
33
  	define('DATABASE_CLASS_LOADED',true);
34
}
35
if(!isset($database)) {
36
	$database = new database();
37
}
38

    
39
// Start a session
40
if(!defined('SESSION_STARTED')) {
41
	session_name(APP_NAME.'_session_id');
42
	session_start();
43
	define('SESSION_STARTED', true);
44
}
45

    
46
// Get users language
47
if(isset($_GET['lang']) AND $_GET['lang'] != '' AND !is_numeric($_GET['lang']) AND strlen($_GET['lang']) == 2) {
48
  	define('LANGUAGE', strtoupper($_GET['lang']));
49
	$_SESSION['LANGUAGE']=LANGUAGE;
50
} else {
51
	if(isset($_SESSION['LANGUAGE']) AND $_SESSION['LANGUAGE'] != '') {
52
		define('LANGUAGE', $_SESSION['LANGUAGE']);
53
	} else {
54
		define('LANGUAGE', DEFAULT_LANGUAGE);
55
	}
56
}
57

    
58
// Get users timezone
59
if(!defined('TIMEZONE')) {
60
	if(isset($_SESSION['TIMEZONE'])) {
61
		define('TIMEZONE', $_SESSION['TIMEZONE']);
62
	} else {
63
		define('TIMEZONE', DEFAULT_TIMEZONE);
64
	}
65
}
66
// Get users date format
67
if(!defined('DATE_FORMAT')) {
68
	if(isset($_SESSION['DATE_FORMAT'])) {
69
		define('DATE_FORMAT', $_SESSION['DATE_FORMAT']);
70
	} else {
71
		define('DATE_FORMAT', DEFAULT_DATE_FORMAT);
72
	}
73
}
74
// Get users time format
75
if(!defined('TIME_FORMAT')) {
76
	if(isset($_SESSION['TIME_FORMAT'])) {
77
		define('TIME_FORMAT', $_SESSION['TIME_FORMAT']);
78
	} else {
79
		define('TIME_FORMAT', DEFAULT_TIME_FORMAT);
80
	}
81
}
82
// Load Language file
83
if(!defined('LANGUAGE_LOADED')) {
84
	if(!file_exists(WB_PATH.'/languages/'.LANGUAGE.'.php')) {
85
		exit('Error loading language file '.LANGUAGE.', please check configuration');
86
	} else {
87
		require_once(WB_PATH.'/languages/'.LANGUAGE.'.php');
88
	}
89
}
90

    
91
?>
(11-11/11)