Revision 95
Added by stefan about 19 years ago
class.wb.php | ||
---|---|---|
31 | 31 |
|
32 | 32 |
*/ |
33 | 33 |
if (file_exists(WB_PATH.'/framework/class.database.php')) |
34 |
require_once(WB_PATH.'/framework/class.database.php'); |
|
34 |
require_once(WB_PATH.'/framework/class.database.php');
|
|
35 | 35 |
|
36 | 36 |
|
37 | 37 |
class wb |
38 |
{
|
|
38 |
{ |
|
39 | 39 |
// General initialization function |
40 | 40 |
// performed when frontend or backend is loaded. |
41 | 41 |
function wb() { |
42 | 42 |
// set global database variable |
43 | 43 |
global $database; |
44 | 44 |
// Create database class |
45 |
$database = new database(); |
|
46 |
$this->database = $database;
|
|
45 |
$this->database = new database();
|
|
46 |
$database=$this->database;
|
|
47 | 47 |
|
48 | 48 |
// Start a session |
49 | 49 |
if(!defined('SESSION_STARTED')) { |
... | ... | |
51 | 51 |
session_start(); |
52 | 52 |
define('SESSION_STARTED', true); |
53 | 53 |
} |
54 |
|
|
55 |
set_magic_quotes_runtime(0); |
|
54 | 56 |
|
57 |
// Get website settings (title, keywords, description, header, and footer) |
|
58 |
$query_settings = "SELECT name,value FROM ".TABLE_PREFIX."settings"; |
|
59 |
$get_settings = $database->query($query_settings); |
|
60 |
while($setting = $get_settings->fetchRow()) { |
|
61 |
$setting_name=strtoupper($setting['name']); |
|
62 |
$setting_value=$setting['value']; |
|
63 |
if ($setting_value=='false') |
|
64 |
$setting_value=false; |
|
65 |
if ($setting_value=='true') |
|
66 |
$setting_value=true; |
|
67 |
define($setting_name,$setting_value); |
|
68 |
} |
|
69 |
$string_file_mode = STRING_FILE_MODE; |
|
70 |
define('OCTAL_FILE_MODE',(int) $string_file_mode); |
|
71 |
$string_dir_mode = STRING_DIR_MODE; |
|
72 |
define('OCTAL_DIR_MODE',(int) $string_dir_mode); |
|
73 |
|
|
55 | 74 |
// Get users language |
56 | 75 |
if(isset($_GET['lang']) AND $_GET['lang'] != '' AND !is_numeric($_GET['lang']) AND strlen($_GET['lang']) == 2) { |
57 | 76 |
define('LANGUAGE', strtoupper($_GET['lang'])); |
... | ... | |
77 | 96 |
} |
78 | 97 |
|
79 | 98 |
// Get users timezone |
80 |
if(!defined('TIMEZONE')) { |
|
81 |
if(isset($_SESSION['TIMEZONE'])) { |
|
82 |
define('TIMEZONE', $_SESSION['TIMEZONE']); |
|
83 |
} else { |
|
84 |
define('TIMEZONE', DEFAULT_TIMEZONE); |
|
85 |
} |
|
99 |
if(isset($_SESSION['TIMEZONE'])) { |
|
100 |
define('TIMEZONE', $_SESSION['TIMEZONE']); |
|
101 |
} else { |
|
102 |
define('TIMEZONE', DEFAULT_TIMEZONE); |
|
86 | 103 |
} |
87 | 104 |
// Get users date format |
88 |
if(!defined('DATE_FORMAT')) { |
|
89 |
if(isset($_SESSION['DATE_FORMAT'])) { |
|
90 |
define('DATE_FORMAT', $_SESSION['DATE_FORMAT']); |
|
91 |
} else { |
|
92 |
define('DATE_FORMAT', DEFAULT_DATE_FORMAT); |
|
93 |
} |
|
105 |
if(isset($_SESSION['DATE_FORMAT'])) { |
|
106 |
define('DATE_FORMAT', $_SESSION['DATE_FORMAT']); |
|
107 |
} else { |
|
108 |
define('DATE_FORMAT', DEFAULT_DATE_FORMAT); |
|
94 | 109 |
} |
95 | 110 |
// Get users time format |
96 |
if(!defined('TIME_FORMAT')) { |
|
97 |
if(isset($_SESSION['TIME_FORMAT'])) { |
|
98 |
define('TIME_FORMAT', $_SESSION['TIME_FORMAT']); |
|
99 |
} else { |
|
100 |
define('TIME_FORMAT', DEFAULT_TIME_FORMAT); |
|
101 |
} |
|
111 |
if(isset($_SESSION['TIME_FORMAT'])) { |
|
112 |
define('TIME_FORMAT', $_SESSION['TIME_FORMAT']); |
|
113 |
} else { |
|
114 |
define('TIME_FORMAT', DEFAULT_TIME_FORMAT); |
|
102 | 115 |
} |
103 |
|
|
104 |
set_magic_quotes_runtime(0); |
|
105 | 116 |
} |
106 | 117 |
|
107 | 118 |
// Check whether we should show a page or not (for front-end) |
Also available in: Unified diff
Moved settings from config.php into database.
NOT FULLY WORKING!!!