-
Notifications
You must be signed in to change notification settings - Fork 0
/
settings.php
executable file
·338 lines (272 loc) · 7.4 KB
/
settings.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
<?php
/**
* WoWRoster.net WoWRoster
*
* Here is where all the magic happens
* All of the includes, defines, locales, this file loads everything
*
* LICENSE: Licensed under the Creative Commons
* "Attribution-NonCommercial-ShareAlike 2.5" license
*
* @copyright 2002-2008 WoWRoster.net
* @license http://creativecommons.org/licenses/by-nc-sa/2.5 Creative Commons "Attribution-NonCommercial-ShareAlike 2.5"
* @version SVN: $Id: settings.php 1791 2008-06-15 16:59:24Z Zanix $
* @link http://www.wowroster.net
* @since File available since Release 1.7.0
* @package WoWRoster
*/
if( !defined('IN_ROSTER') )
{
exit('Detected invalid access to this file!');
}
/**
* Set PHP error reporting
*/
//error_reporting(E_ALL ^ E_NOTICE);
error_reporting(E_ALL);
/**
* Attempt to detect a current session and not set it
* Sometimes it doesn't work...
*/
if( session_id() == '' )
{
session_start();
}
// Be paranoid with passed vars
// Destroy GET/POST/Cookie variables from the global scope
if( intval(ini_get('register_globals')) != 0 )
{
foreach( $_REQUEST AS $key => $val )
{
if( isset($$key) )
{
unset($$key);
}
}
}
// Unset old style global vars, we use only php 4.3+ style globals
unset($HTTP_GET_VARS,$HTTP_POST_VARS,$HTTP_COOKIE_VARS);
/**
* Set magic quotes runtime off
* Checking for function existance for php6
*/
//if( function_exists('set_magic_quotes_runtime') ) // deprecated since php 5.3.0
//{
// set_magic_quotes_runtime(0);
//}
/**
* Begin Roster Timing
*/
$sec = explode(' ', microtime());
define('ROSTER_STARTTIME',$sec[0] + $sec[1]);
unset($sec);
/**
* Can we use ini_set
*/
define('CAN_INI_SET', !preg_match('/ini_set/', ini_get('disable_functions')));
define('WIN', (strtoupper(substr(PHP_OS, 0, 3)) == 'WIN'));
if( !function_exists('posix_getpwuid') || WIN )
{
define('ROSTER_PROCESS_UID', '0');
define('ROSTER_PROCESS_OWNER', 'nobody');
}
else
{
define('ROSTER_PROCESS_UID', posix_geteuid());
$processUser = posix_getpwuid(ROSTER_PROCESS_UID);
define('ROSTER_PROCESS_OWNER', $processUser['name']);
}
/**
* OS specific Directory Seperator
*/
define('DIR_SEP',DIRECTORY_SEPARATOR);
/**
* Base, absolute roster directory
*/
define('ROSTER_BASE',dirname(__FILE__) . DIR_SEP);
/**
* Check PHP version
*/
if( version_compare(phpversion(), '4.3.0','<') )
{
die('You must have PHP version 4.3 or later to run WoWRoster');
}
/**
* Base, absolute roster library directory
*/
define('ROSTER_LIB',ROSTER_BASE . 'lib' . DIR_SEP);
/**
* Include constants file
*/
require_once (ROSTER_LIB . 'constants.php');
/**
* Include common functions
**/
require_once (ROSTER_LIB . 'functions.lib.php');
/**
* Slash global data if magic_quotes_gpc is off.
* Checking for function existance for php6
*/
if( function_exists('get_magic_quotes_gpc') )
{
if( !get_magic_quotes_gpc() )
{
$_GET = escape_array($_GET);
$_POST = escape_array($_POST);
$_COOKIE = escape_array($_COOKIE);
$_REQUEST = escape_array($_REQUEST);
}
}
else
{
$_GET = escape_array($_GET);
$_POST = escape_array($_POST);
$_COOKIE = escape_array($_COOKIE);
$_REQUEST = escape_array($_REQUEST);
}
// --[ Check to see if we need to install ]--
if( !file_exists(ROSTER_CONF_FILE) )
{
require(ROSTER_BASE . 'install.php');
die();
}
else
{
require_once (ROSTER_CONF_FILE);
}
if( !defined('ROSTER_INSTALLED') )
{
require(ROSTER_BASE . 'install.php');
die();
}
include( ROSTER_LIB . 'roster.php' );
$roster = new roster;
/**
* Roster Error Handler
*/
include( ROSTER_LIB . 'roster_error.php' );
$roster->error =& new roster_error();
/**
* Load the dbal
*/
$roster->load_dbal();
unset($db_config);
/**
* Include cache class
*/
require_once(ROSTER_LIB . 'cache.php');
$roster->cache = new RosterCache();
/**
* Load the config
*/
$roster->load_config();
/**
* Inject some different locale setting if the locale url switch is set
*/
$locale = (isset($_GET['locale']) ? $_GET['locale'] : isset($_POST['locale']) ? $_POST['locale'] : '');
if( $locale != '' )
{
$_SESSION['locale'] = $locale;
$roster->config['locale'] = $locale;
}
unset($locale);
/**
* Include linking file
*/
require_once (ROSTER_LIB . 'cmslink.lib.php');
/**
* Load the Template Parser
*/
include( ROSTER_LIB . 'template.php' );
$roster->tpl = new RosterTemplate;
if( file_exists($roster->tpl->root . DIR_SEP . 'theme.php') )
{
include_once($roster->tpl->root . DIR_SEP . 'theme.php');
}
/**
* Cache addon data
*/
$roster->get_addon_data();
/**
* Load the locale class
*/
include(ROSTER_LIB . 'locale.php');
$roster->locale = new roster_locale;
/**
* Include the Roster Menu class
*/
require_once(ROSTER_LIB . 'menu.php');
/**
* Figure out the page
*/
$roster->get_page_name();
/**
* Run the scope algorithm to load the data and figure out the file to load
*/
$roster->get_scope_data();
/**
* Include Login class, external or Roster's
*/
if( file_exists(ROSTER_ADDONS . $roster->config['external_auth'] . DIR_SEP . 'inc' . DIR_SEP . 'login.php') )
{
require_once(ROSTER_ADDONS . $roster->config['external_auth'] . DIR_SEP . 'inc' . DIR_SEP . 'login.php');
}
else
{
$roster->config['external_auth'] = 'roster';
require_once(ROSTER_LIB . 'login.php');
}
$roster->auth = new RosterLogin();
/**
* Assign initial template vars
*/
$roster->tpl->assign_vars(array(
'S_SEO_URL' => $roster->config['seo_url'],
'S_HEADER_LOGO' => ( !empty($roster->config['logo']) ? true : false ),
'U_MAKELINK' => makelink(),
'U_LINKFORM' => linkform(),
'ROSTER_URL' => ROSTER_URL,
'ROSTER_PATH' => ROSTER_PATH,
'WEBSITE_ADDRESS' => $roster->config['website_address'],
'HEADER_LOGO' => $roster->config['logo'],
'IMG_URL' => $roster->config['img_url'],
'INTERFACE_URL' => $roster->config['interface_url'],
'IMG_SUFFIX' => $roster->config['img_suffix'],
'ROSTER_VERSION' => $roster->config['version'],
'ROSTER_CREDITS' => sprintf($roster->locale->act['roster_credits'], makelink('credits')),
'XML_LANG' => substr($roster->config['locale'],0,2),
'T_BORDER_WHITE' => border('swhite','start'),
'T_BORDER_GRAY' => border('sgray','start'),
'T_BORDER_GOLD' => border('sgold','start'),
'T_BORDER_RED' => border('sred','start'),
'T_BORDER_ORANGE' => border('sorange','start'),
'T_BORDER_YELLOW' => border('syellow','start'),
'T_BORDER_GREEN' => border('sgreen','start'),
'T_BORDER_PURPLE' => border('spurple','start'),
'T_BORDER_BLUE' => border('sblue','start'),
'T_BORDER_END' => border('sgray','end'),
'PAGE_TITLE' => '',
'ROSTER_HEAD' => '',
'ROSTER_BODY' => '',
'ROSTER_ONLOAD' => '',
'ROSTER_MENU_BEFORE' => '',
)
);
/**
* If the version doesnt match the one in constants, redirect to upgrader
*/
if( empty($roster->config['version']) || version_compare($roster->config['version'],ROSTER_VERSION,'<') )
{
require(ROSTER_PAGES . 'upgrade.php');
die();
}
/**
* If the install directory or files exist, die()
*/
if( file_exists(ROSTER_BASE . 'install.php') )
{
if( !file_exists(ROSTER_BASE . 'version_match.php') )
{
roster_die($roster->locale->act['remove_install_files_text'],$roster->locale->act['remove_install_files'],'sred');
}
}