Project

General

Profile

« Previous | Next » 

Revision 55

Added by stefan about 19 years ago

Removed initialize.php, moved initialization code to class wb constructor. Changed attribute no_default_content to default_block_content and changed behavior.

View differences:

class.wb.php
32 32
*/
33 33

  
34 34
class wb
35
{
36
	function wb() {
35
{	
36
	// General initialization function 
37
	// performed when frontend or backend is loaded.
38
	function wb() {
39
		// set global database variable
40
		global $database;
41
		// Create database class
42
		require_once(WB_PATH.'/framework/class.database.php');
43
		$database = new database();
44
		$this->database = $database;
45

  
46
		// Start a session
47
		if(!defined('SESSION_STARTED')) {
48
			session_name(APP_NAME.'_session_id');
49
			session_start();
50
			define('SESSION_STARTED', true);
51
		}
52
		
53
		// Get users language
54
		if(isset($_GET['lang']) AND $_GET['lang'] != '' AND !is_numeric($_GET['lang']) AND strlen($_GET['lang']) == 2) {
55
		  	define('LANGUAGE', strtoupper($_GET['lang']));
56
			$_SESSION['LANGUAGE']=LANGUAGE;
57
		} else {
58
			if(isset($_SESSION['LANGUAGE']) AND $_SESSION['LANGUAGE'] != '') {
59
				define('LANGUAGE', $_SESSION['LANGUAGE']);
60
			} else {
61
				define('LANGUAGE', DEFAULT_LANGUAGE);
62
			}
63
		}
64

  
65
		// make language variables globally accessible
66
		global $language_code, $language_name, $language_author, $language_version, $language_designed_for;
67
		global $MENU, $OVERVIEW, $TEXT, $HEADING, $MESSAGE;
68
		// Load Language file
69
		if(!defined('LANGUAGE_LOADED')) {
70
			if(!file_exists(WB_PATH.'/languages/'.LANGUAGE.'.php')) {
71
				exit('Error loading language file '.LANGUAGE.', please check configuration');
72
			} else {
73
				require_once(WB_PATH.'/languages/'.LANGUAGE.'.php');
74
			}
75
		}
76
		
77
		// Get users timezone
78
		if(!defined('TIMEZONE')) {
79
			if(isset($_SESSION['TIMEZONE'])) {
80
				define('TIMEZONE', $_SESSION['TIMEZONE']);
81
			} else {
82
				define('TIMEZONE', DEFAULT_TIMEZONE);
83
			}
84
		}
85
		// Get users date format
86
		if(!defined('DATE_FORMAT')) {
87
			if(isset($_SESSION['DATE_FORMAT'])) {
88
				define('DATE_FORMAT', $_SESSION['DATE_FORMAT']);
89
			} else {
90
				define('DATE_FORMAT', DEFAULT_DATE_FORMAT);
91
			}
92
		}
93
		// Get users time format
94
		if(!defined('TIME_FORMAT')) {
95
			if(isset($_SESSION['TIME_FORMAT'])) {
96
				define('TIME_FORMAT', $_SESSION['TIME_FORMAT']);
97
			} else {
98
				define('TIME_FORMAT', DEFAULT_TIME_FORMAT);
99
			}
100
		}
101
		
102
		set_magic_quotes_runtime(0);
37 103
	}
38 104

  
39 105
	// Check whether we should show a page or not (for front-end)

Also available in: Unified diff