Project

General

Profile

« Previous | Next » 

Revision 106

Added by stefan about 19 years ago

Renamed compatibility.php to frontend.functions.php.
Moved frontend functions from class frontend to frontend.functions.php.
Removed instances of strip_slashes_dummy. Replaced $this by $wb in a couple of places.
Created file initialize.php, where all initializations now take place (moved from class wb constructor).

View differences:

class.wb.php
30 30
This class is the basis for admin and frontend classes.
31 31

  
32 32
*/
33
if (file_exists(WB_PATH.'/framework/class.database.php'))
34
	require_once(WB_PATH.'/framework/class.database.php');
35
		
36 33

  
34
require_once(WB_PATH.'/framework/class.database.php');
35

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

  
48
		// Start a session
49
		if(!defined('SESSION_STARTED')) {
50
			session_name(APP_NAME.'_session_id');
51
			session_start();
52
			define('SESSION_STARTED', true);
53
		}
54

  
55
		set_magic_quotes_runtime(0);
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
		
74
		// Get users language
75
		if(isset($_GET['lang']) AND $_GET['lang'] != '' AND !is_numeric($_GET['lang']) AND strlen($_GET['lang']) == 2) {
76
		  	define('LANGUAGE', strtoupper($_GET['lang']));
77
			$_SESSION['LANGUAGE']=LANGUAGE;
78
		} else {
79
			if(isset($_SESSION['LANGUAGE']) AND $_SESSION['LANGUAGE'] != '') {
80
				define('LANGUAGE', $_SESSION['LANGUAGE']);
81
			} else {
82
				define('LANGUAGE', DEFAULT_LANGUAGE);
83
			}
84
		}
85

  
86
		// make language variables globally accessible
87
		global $language_code, $language_name, $language_author, $language_version, $language_designed_for;
88
		global $MENU, $OVERVIEW, $TEXT, $HEADING, $MESSAGE;
89
		// Load Language file
90
		if(!defined('LANGUAGE_LOADED')) {
91
			if(!file_exists(WB_PATH.'/languages/'.LANGUAGE.'.php')) {
92
				exit('Error loading language file '.LANGUAGE.', please check configuration');
93
			} else {
94
				require_once(WB_PATH.'/languages/'.LANGUAGE.'.php');
95
			}
96
		}
97
		
98
		// Get users timezone
99
		if(isset($_SESSION['TIMEZONE'])) {
100
			define('TIMEZONE', $_SESSION['TIMEZONE']);
101
		} else {
102
			define('TIMEZONE', DEFAULT_TIMEZONE);
103
		}
104
		// Get users date format
105
		if(isset($_SESSION['DATE_FORMAT'])) {
106
			define('DATE_FORMAT', $_SESSION['DATE_FORMAT']);
107
		} else {
108
			define('DATE_FORMAT', DEFAULT_DATE_FORMAT);
109
		}
110
		// Get users time format
111
		if(isset($_SESSION['TIME_FORMAT'])) {
112
			define('TIME_FORMAT', $_SESSION['TIME_FORMAT']);
113
		} else {
114
			define('TIME_FORMAT', DEFAULT_TIME_FORMAT);
115
		}
116 41
	}
117 42

  
118 43
	// Check whether we should show a page or not (for front-end)
......
233 158

  
234 159
	// Get the current users display name
235 160
	function get_display_name() {
236
		return $this->strip_slashes_dummy($_SESSION['DISPLAY_NAME']);
161
		return ($_SESSION['DISPLAY_NAME']);
237 162
	}
238 163

  
239 164
	// Get the current users email address

Also available in: Unified diff