1 |
5
|
stefan
|
<?php
|
2 |
|
|
|
3 |
|
|
/*
|
4 |
|
|
|
5 |
|
|
Website Baker Project <http://www.websitebaker.org/>
|
6 |
|
|
Copyright (C) 2004-2005, Ryan Djurovich
|
7 |
|
|
|
8 |
|
|
Website Baker is free software; you can redistribute it and/or modify
|
9 |
|
|
it under the terms of the GNU General Public License as published by
|
10 |
|
|
the Free Software Foundation; either version 2 of the License, or
|
11 |
|
|
(at your option) any later version.
|
12 |
|
|
|
13 |
|
|
Website Baker is distributed in the hope that it will be useful,
|
14 |
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
15 |
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
16 |
|
|
GNU General Public License for more details.
|
17 |
|
|
|
18 |
|
|
You should have received a copy of the GNU General Public License
|
19 |
|
|
along with Website Baker; if not, write to the Free Software
|
20 |
|
|
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
21 |
|
|
|
22 |
|
|
*/
|
23 |
|
|
|
24 |
|
|
/*
|
25 |
|
|
Initializations common to frontend and backend
|
26 |
|
|
*/
|
27 |
|
|
|
28 |
|
|
// Setup database object
|
29 |
|
|
require_once(WB_PATH.'/framework/class.database.php');
|
30 |
|
|
if (!defined('DATABASE_CLASS_LOADED')) {
|
31 |
|
|
define('DATABASE_CLASS_LOADED',true);
|
32 |
|
|
}
|
33 |
|
|
if(!isset($database)) {
|
34 |
|
|
$database = new database();
|
35 |
|
|
}
|
36 |
|
|
|
37 |
|
|
// Start a session
|
38 |
|
|
if(!defined('SESSION_STARTED')) {
|
39 |
|
|
session_name(APP_NAME.'_session_id');
|
40 |
|
|
session_start();
|
41 |
|
|
define('SESSION_STARTED', true);
|
42 |
|
|
}
|
43 |
|
|
|
44 |
|
|
// Get users language
|
45 |
|
|
if(isset($_GET['lang']) AND $_GET['lang'] != '' AND !is_numeric($_GET['lang']) AND strlen($_GET['lang']) == 2) {
|
46 |
|
|
define('LANGUAGE', strtoupper($_GET['lang']));
|
47 |
|
|
$_SESSION['LANGUAGE']=LANGUAGE;
|
48 |
|
|
} else {
|
49 |
|
|
if(isset($_SESSION['LANGUAGE']) AND $_SESSION['LANGUAGE'] != '') {
|
50 |
|
|
define('LANGUAGE', $_SESSION['LANGUAGE']);
|
51 |
|
|
} else {
|
52 |
|
|
define('LANGUAGE', DEFAULT_LANGUAGE);
|
53 |
|
|
}
|
54 |
|
|
}
|
55 |
|
|
|
56 |
|
|
// Get users timezone
|
57 |
|
|
if(!defined('TIMEZONE')) {
|
58 |
|
|
if(isset($_SESSION['TIMEZONE'])) {
|
59 |
|
|
define('TIMEZONE', $_SESSION['TIMEZONE']);
|
60 |
|
|
} else {
|
61 |
|
|
define('TIMEZONE', DEFAULT_TIMEZONE);
|
62 |
|
|
}
|
63 |
|
|
}
|
64 |
|
|
// Get users date format
|
65 |
|
|
if(!defined('DATE_FORMAT')) {
|
66 |
|
|
if(isset($_SESSION['DATE_FORMAT'])) {
|
67 |
|
|
define('DATE_FORMAT', $_SESSION['DATE_FORMAT']);
|
68 |
|
|
} else {
|
69 |
|
|
define('DATE_FORMAT', DEFAULT_DATE_FORMAT);
|
70 |
|
|
}
|
71 |
|
|
}
|
72 |
|
|
|
73 |
|
|
// Load Language file
|
74 |
|
|
if(!defined('LANGUAGE_LOADED')) {
|
75 |
|
|
if(!file_exists(WB_PATH.'/languages/'.LANGUAGE.'.php')) {
|
76 |
|
|
exit('Error loading language file '.LANGUAGE.', please check configuration');
|
77 |
|
|
} else {
|
78 |
|
|
require_once(WB_PATH.'/languages/'.LANGUAGE.'.php');
|
79 |
|
|
}
|
80 |
|
|
}
|
81 |
|
|
|
82 |
|
|
?>
|