Project

General

Profile

1
<?php
2
/**
3
 *
4
 * @category        admin
5
 * @package         settings
6
 * @author          Ryan Djurovich, WebsiteBaker Project
7
 * @copyright       2009-2011, Website Baker Org. e.V.
8
 * @link			http://www.websitebaker2.org/
9
 * @license         http://www.gnu.org/licenses/gpl.html
10
 * @platform        WebsiteBaker 2.8.x
11
 * @requirements    PHP 5.2.2 and higher
12
 * @version         $Id: index.php 1668 2012-04-17 12:53:12Z Luisehahne $
13
 * @filesource		$HeadURL: svn://isteam.dynxs.de/wb-archiv/branches/2.8.x/wb/admin/settings/index.php $
14
 * @lastmodified    $Date: 2012-04-17 14:53:12 +0200 (Tue, 17 Apr 2012) $
15
 *
16
 */
17

    
18
require('../../config.php');
19
require_once(WB_PATH.'/framework/class.admin.php');
20

    
21
if(isset($_GET['advanced']) && $_GET['advanced'] == 'yes') {
22
	$admin = new admin('Settings', 'settings_advanced');
23
} else {
24
	$admin = new admin('Settings', 'settings_basic');
25
}
26

    
27
// Include the WB functions file
28
require_once(WB_PATH.'/framework/functions.php');
29
require_once(WB_PATH.'/framework/functions-utf8.php');
30

    
31
// Setup template object, parse vars to it, then parse it
32
// Create new template object
33
$template = new Template(dirname($admin->correct_theme_source('settings.htt')));
34
// $template->debug = true;
35
$template->set_file('page',        'settings.htt');
36
$template->set_block('page',       'main_block', 'main');
37
$template->set_var('FTAN', $admin->getFTAN());
38

    
39
$template->set_block('main_block', 'template_list_block',         'template_list');
40
$template->set_block('main_block', 'timezone_list_block',         'timezone_list');
41
$template->set_block('main_block', 'language_list_block',         'language_list');
42
$template->set_block('main_block', 'date_format_list_block',      'date_format_list');
43
$template->set_block('main_block', 'time_format_list_block',      'time_format_list');
44
$template->set_block('main_block', 'theme_list_block',            'theme_list');
45
$template->set_block('main_block', 'search_template_list_block',  'search_template_list');
46
$template->set_block('main_block', 'group_list_block',            'group_list');
47
$template->set_block('main_block', 'charset_list_block',          'charset_list');
48
$template->set_block('main_block', 'error_reporting_list_block',  'error_reporting_list');
49
$template->set_block('main_block', 'editor_list_block',           'editor_list');
50
$template->set_block('main_block', 'page_level_limit_list_block', 'page_level_limit_list');
51

    
52
$template->set_block('main_block', 'show_page_level_limit_block', 'show_page_level_limit');
53
$template->set_block('main_block', 'show_checkbox_1_block',       'show_checkbox_1');
54
$template->set_block('main_block', 'show_checkbox_2_block',       'show_checkbox_2');
55
$template->set_block('main_block', 'show_checkbox_3_block',       'show_checkbox_3');
56
$template->set_block('main_block', 'show_php_error_level_block',  'show_php_error_level');
57
$template->set_block('main_block', 'show_charset_block',          'show_charset');
58
$template->set_block('main_block', 'show_wysiwyg_block',          'show_wysiwyg');
59
$template->set_block('main_block', 'show_access_block',           'show_access');
60
$template->set_block('main_block', 'show_search_block',           'show_search');
61
$template->set_block('main_block', 'show_redirect_timer_block',   'show_redirect_timer');
62

    
63
// Query current settings in the db, then loop through them and print them
64
$query = "SELECT * FROM ".TABLE_PREFIX."settings";
65
$results = $database->query($query);
66
while($setting = $results->fetchRow())
67
{
68
	$setting_name = $setting['name'];
69
	$setting_value = ( $setting_name != 'wbmailer_smtp_password' ) ? htmlspecialchars($setting['value']) : $setting['value'];
70
	$template->set_var(strtoupper($setting_name),$setting_value);
71
}
72

    
73
// Do the same for settings stored in config file as with ones in db
74
$database_type = '';
75
$is_advanced = (isset($_GET['advanced']) && $_GET['advanced'] == 'yes');
76
// Tell the browser whether or not to show advanced options
77
if($is_advanced)
78
{
79
	$template->set_var('DISPLAY_ADVANCED', '');
80
	$template->set_var('ADVANCED_FILE_PERMS_ID', 'file_perms_box');
81
	$template->set_var('BASIC_FILE_PERMS_ID', 'hide');
82
	$template->set_var('ADVANCED', 'yes');
83
	$template->set_var('ADVANCED_BUTTON', '&lt;&lt; '.$TEXT['HIDE_ADVANCED']);
84
	$template->set_var('ADVANCED_LINK', 'index.php?advanced=no');
85

    
86
} else {
87
	$template->set_var('DISPLAY_ADVANCED', ' style="display: none;"');
88
	$template->set_var('BASIC_FILE_PERMS_ID', 'file_perms_box');
89
	$template->set_var('ADVANCED_FILE_PERMS_ID', 'hide');
90

    
91
	$template->set_var('ADVANCED', 'no');
92
	$template->set_var('ADVANCED_BUTTON', $TEXT['SHOW_ADVANCED'].' &gt;&gt;');
93
	$template->set_var('ADVANCED_LINK', 'index.php?advanced=yes');
94
}
95

    
96
	$query = "SELECT * FROM ".TABLE_PREFIX."search WHERE extra = ''";
97
	$results = $database->query($query);
98

    
99
	// Query current settings in the db, then loop through them and print them
100
	while($setting = $results->fetchRow())
101
	{
102
		$setting_name = $setting['name'];
103
		$setting_value = htmlspecialchars(($setting['value']));
104
		switch($setting_name) {
105
			// Search header
106
			case 'header':
107
				$template->set_var('SEARCH_HEADER', $setting_value);
108
			break;
109
			// Search results header
110
			case 'results_header':
111
				$template->set_var('SEARCH_RESULTS_HEADER', $setting_value);
112
			break;
113
			// Search results loop
114
			case 'results_loop':
115
				$template->set_var('SEARCH_RESULTS_LOOP', $setting_value);
116
			break;
117
			// Search results footer
118
			case 'results_footer':
119
				$template->set_var('SEARCH_RESULTS_FOOTER', $setting_value);
120
			break;
121
			// Search no results
122
			case 'no_results':
123
				$template->set_var('SEARCH_NO_RESULTS', $setting_value);
124
			break;
125
			// Search footer
126
			case 'footer':
127
				$template->set_var('SEARCH_FOOTER', $setting_value);
128
			break;
129
			// Search module-order
130
			case 'module_order':
131
				$template->set_var('SEARCH_MODULE_ORDER', $setting_value);
132
			break;
133
			// Search max lines of excerpt
134
			case 'max_excerpt':
135
				$template->set_var('SEARCH_MAX_EXCERPT', $setting_value);
136
			break;
137
			// time-limit
138
			case 'time_limit':
139
				$template->set_var('SEARCH_TIME_LIMIT', $setting_value);
140
			break;
141
			// Search template
142
			case 'template':
143
				$search_template = $setting_value;
144
			break;
145
		}
146
	}
147

    
148
	$template->set_var(array(
149
						'WB_URL' => WB_URL,
150
						'THEME_URL' => THEME_URL,
151
						'ADMIN_URL' => ADMIN_URL,
152
					 ));
153

    
154
	// Insert language values
155
	$result = $database->query("SELECT * FROM ".TABLE_PREFIX."addons WHERE type = 'language' ORDER BY directory");
156
	if($result->numRows() > 0)
157
	{
158
		while($addon = $result->fetchRow()) {
159
	        $langIcons = (empty($addon['directory'])) ? 'none' : strtolower($addon['directory']);
160

    
161
			$template->set_var('CODE',        $addon['directory']);
162
			$template->set_var('NAME',        $addon['name']);
163
			$template->set_var('FLAG',        THEME_URL.'/images/flags/'.$langIcons);
164
			$template->set_var('SELECTED',    (DEFAULT_LANGUAGE == $addon['directory'] ? ' selected="selected"' : '') );
165
			$template->parse('language_list', 'language_list_block', true);
166
		}
167
	}
168

    
169
	// Insert default timezone values
170
	require(ADMIN_PATH.'/interface/timezones.php');
171
	foreach($TIMEZONES AS $hour_offset => $title)
172
	{
173
		// Make sure we dont list "System Default" as we are setting this value!
174
		if($hour_offset != '-20') {
175
			$template->set_var('VALUE', $hour_offset);
176
			$template->set_var('NAME', $title);
177
			if(DEFAULT_TIMEZONE == $hour_offset*60*60) {
178
				$template->set_var('SELECTED', ' selected="selected"');
179
			} else {
180
				$template->set_var('SELECTED', '');
181
			}
182
			$template->parse('timezone_list', 'timezone_list_block', true);
183
		}
184
	}
185

    
186
	// Insert default charset values
187
	require(ADMIN_PATH.'/interface/charsets.php');
188
	foreach($CHARSETS AS $code => $title) {
189
		$template->set_var('VALUE', $code);
190
		$template->set_var('NAME', $title);
191
		if(DEFAULT_CHARSET == $code) {
192
			$template->set_var('SELECTED', ' selected="selected"');
193
		} else {
194
			$template->set_var('SELECTED', '');
195
		}
196
		$template->parse('charset_list', 'charset_list_block', true);
197
	}
198

    
199

    
200
	// Insert date format list
201
	require(ADMIN_PATH.'/interface/date_formats.php');
202
	foreach($DATE_FORMATS AS $format => $title) {
203
		$format = str_replace('|', ' ', $format); // Add's white-spaces (not able to be stored in array key)
204
		if($format != 'system_default') {
205
			$template->set_var('VALUE', $format);
206
		} else {
207
			$template->set_var('VALUE', '');
208
		}
209
		$template->set_var('NAME', $title);
210
		if(DEFAULT_DATE_FORMAT == $format) {
211
			$template->set_var('SELECTED', ' selected="selected"');
212
		} else {
213
			$template->set_var('SELECTED', '');
214
		}
215
		$template->parse('date_format_list', 'date_format_list_block', true);
216
	}
217

    
218
	// Insert time format list
219
	require(ADMIN_PATH.'/interface/time_formats.php');
220
	foreach($TIME_FORMATS AS $format => $title) {
221
		$format = str_replace('|', ' ', $format); // Add's white-spaces (not able to be stored in array key)
222
		if($format != 'system_default') {
223
			$template->set_var('VALUE', $format);
224
		} else {
225
			$template->set_var('VALUE', '');
226
		}
227
		$template->set_var('NAME', $title);
228
		if(DEFAULT_TIME_FORMAT == $format) {
229
			$template->set_var('SELECTED', ' selected="selected"');
230
		} else {
231
			$template->set_var('SELECTED', '');
232
		}
233
		$template->parse('time_format_list', 'time_format_list_block', true);
234
	}
235

    
236
	// Insert templates
237
	$result = $database->query("SELECT * FROM ".TABLE_PREFIX."addons WHERE type = 'template' AND function != 'theme' ORDER BY name");
238
	if($result->numRows() > 0) {
239
		while($addon = $result->fetchRow()) {
240
			$template->set_var('FILE', $addon['directory']);
241
			$template->set_var('NAME', $addon['name']);
242
			if(($addon['directory'] == DEFAULT_TEMPLATE) ? $selected = ' selected="selected"' : $selected = '');
243
			$template->set_var('SELECTED', $selected);
244
			$template->parse('template_list', 'template_list_block', true);
245
		}
246
	}
247

    
248
	// Insert backend theme
249
	$result = $database->query("SELECT * FROM ".TABLE_PREFIX."addons WHERE type = 'template' AND function = 'theme' ORDER BY name");
250
	if($result->numRows() > 0) {
251
		while($addon = $result->fetchRow()) {
252
			$template->set_var('FILE', $addon['directory']);
253
			$template->set_var('NAME', $addon['name']);
254
			if(($addon['directory'] == DEFAULT_THEME) ? $selected = ' selected="selected"' : $selected = '');
255
			$template->set_var('SELECTED', $selected);
256
			$template->parse('theme_list', 'theme_list_block', true);
257
		}
258
	}
259

    
260
	// Insert WYSIWYG modules
261
	$file='none';
262
	$module_name=$TEXT['NONE'];
263
	$template->set_var('FILE', $file);
264
	$template->set_var('NAME', $module_name);
265
	$selected = (!defined('WYSIWYG_EDITOR') || $file == WYSIWYG_EDITOR) ? ' selected="selected"' : '';
266
	$template->set_var('SELECTED', $selected);
267
	$template->parse('editor_list', 'editor_list_block', true);
268
	$result = $database->query("SELECT * FROM ".TABLE_PREFIX."addons WHERE type = 'module' AND function = 'wysiwyg' ORDER BY name");
269
	if($result->numRows() > 0)
270
	{
271
		while($addon = $result->fetchRow())
272
	    {
273
			$template->set_var('FILE', $addon['directory']);
274
			$template->set_var('NAME', $addon['name']);
275
			$selected = (!defined('WYSIWYG_EDITOR') || $addon['directory'] == WYSIWYG_EDITOR) ? ' selected="selected"' : '';
276
			$template->set_var('SELECTED', $selected);
277
			$template->parse('editor_list', 'editor_list_block', true);
278
		}
279
	}
280

    
281
// Insert templates for search settings
282
	$search_template = ( ($search_template == DEFAULT_TEMPLATE) || ($search_template == '') ) ? '' : $search_template;
283
	$selected = ( ($search_template != DEFAULT_TEMPLATE) ) ?  ' selected="selected"' : $selected = '';
284

    
285
	$template->set_var(array(
286
	        'FILE' => '',
287
	        'NAME' => $TEXT['SYSTEM_DEFAULT'],
288
	        'SELECTED' => $selected
289
	    ));
290
	$template->parse('search_template_list', 'search_template_list_block', true);
291

    
292
	$result = $database->query("SELECT * FROM ".TABLE_PREFIX."addons WHERE type = 'template' AND function = 'template' ORDER BY name");
293
	if($result->numRows() > 0)
294
	{
295
		while($addon = $result->fetchRow())
296
	    {
297
			$template->set_var('FILE', $addon['directory']);
298
			$template->set_var('NAME', $addon['name']);
299
	        $selected = ($addon['directory'] == $search_template) ? ' selected="selected"' :  $selected = '';
300
			$template->set_var('SELECTED', $selected);
301
			$template->parse('search_template_list', 'search_template_list_block', true);
302

    
303
		}
304
	}
305

    
306
	// Insert default error reporting values
307
	require(ADMIN_PATH.'/interface/er_levels.php');
308
	foreach($ER_LEVELS AS $value => $title)
309
	{
310
		$template->set_var('VALUE', $value);
311
		$template->set_var('NAME', $title);
312
	    $selected = (ER_LEVEL == $value) ? ' selected="selected"' : '';
313
	    $template->set_var('SELECTED', $selected);
314
		$template->parse('error_reporting_list', 'error_reporting_list_block', true);
315
	}
316

    
317
	// Insert permissions values
318
	if($admin->get_permission('settings_advanced') != true)
319
	{
320
		$template->set_var('DISPLAY_ADVANCED_BUTTON', 'hide');
321
	}
322

    
323
	// Insert page level limits
324
	for($i = 1; $i <= 10; $i++)
325
	{
326
		$template->set_var('NUMBER', $i);
327
		if(PAGE_LEVEL_LIMIT == $i)
328
	    {
329
			$template->set_var('SELECTED', ' selected="selected"');
330
		} else {
331
			$template->set_var('SELECTED', '');
332
		}
333
		$template->parse('page_level_limit_list', 'page_level_limit_list_block', true);
334
	}
335

    
336
	// Work-out if multiple menus feature is enabled
337
	if(defined('MULTIPLE_MENUS') && MULTIPLE_MENUS == true)
338
	{
339
		$template->set_var('MULTIPLE_MENUS_ENABLED', ' checked="checked"');
340
	} else {
341
		$template->set_var('MULTIPLE_MENUS_DISABLED', ' checked="checked"');
342
	}
343

    
344
	// Work-out if page languages feature is enabled
345
	if(defined('PAGE_LANGUAGES') && PAGE_LANGUAGES == true)
346
	{
347
	        $template->set_var('PAGE_LANGUAGES_ENABLED', ' checked="checked"');
348
	} else {
349
	        $template->set_var('PAGE_LANGUAGES_DISABLED', ' checked="checked"');
350
	}
351

    
352
	// Work-out if warn_page_leave feature is enabled
353
	if (defined('WARN_PAGE_LEAVE') && WARN_PAGE_LEAVE == true)
354
	{
355
		$template->set_var('WARN_PAGE_LEAVE_ENABLED', ' checked="checked"');
356
	} else {
357
		$template->set_var('WARN_PAGE_LEAVE_DISABLED', ' checked="checked"');
358
	}
359

    
360
	// Work-out if smart login feature is enabled
361
	if(defined('SMART_LOGIN') && SMART_LOGIN == true)
362
	{
363
		$template->set_var('SMART_LOGIN_ENABLED', ' checked="checked"');
364
	} else {
365
		$template->set_var('SMART_LOGIN_DISABLED', ' checked="checked"');
366
	}
367

    
368
	/* Make's sure GD library is installed */
369
	if(extension_loaded('gd') && function_exists('imageCreateFromJpeg'))
370
	{
371
		$template->set_var('GD_EXTENSION_ENABLED', '');
372
	} else {
373
		$template->set_var('GD_EXTENSION_ENABLED', ' style="display: none;"');
374
	}
375

    
376
	// Work-out if section blocks feature is enabled
377
	if(defined('SECTION_BLOCKS') && SECTION_BLOCKS == true)
378
	{
379
		$template->set_var('SECTION_BLOCKS_ENABLED', ' checked="checked"');
380
	} else {
381
		$template->set_var('SECTION_BLOCKS_DISABLED', ' checked="checked"');
382
	}
383

    
384
	// Work-out if homepage redirection feature is enabled
385
	if(defined('HOMEPAGE_REDIRECTION') && HOMEPAGE_REDIRECTION == true)
386
	{
387
		$template->set_var('HOMEPAGE_REDIRECTION_ENABLED', ' checked="checked"');
388
	} else {
389
		$template->set_var('HOMEPAGE_REDIRECTION_DISABLED', ' checked="checked"');
390
	}
391

    
392
	// Work-out which server os should be checked
393
	if(OPERATING_SYSTEM == 'linux')
394
	{
395
		$template->set_var('LINUX_SELECTED', ' checked="checked"');
396
	} elseif(OPERATING_SYSTEM == 'windows') {
397
		$template->set_var('WINDOWS_SELECTED', ' checked="checked"');
398
	}
399

    
400
	// Work-out if developer infos feature is enabled
401
	if(defined('DEV_INFOS') && DEV_INFOS == true)
402
	{
403
		$template->set_var('DEV_INFOS_ENABLED', ' checked="checked"');
404
	} else {
405
		$template->set_var('DEV_INFOS_DISABLED', ' checked="checked"');
406
	}
407

    
408
	// Work-out if manage sections feature is enabled
409
	if(MANAGE_SECTIONS)
410
	{
411
		$template->set_var('MANAGE_SECTIONS_ENABLED', ' checked="checked"');
412
	} else {
413
		$template->set_var('MANAGE_SECTIONS_DISABLED', ' checked="checked"');
414
	}
415

    
416
	// Work-out which wbmailer routine should be checked
417
	$template->set_var(array(
418
				'TEXT_WBMAILER_DEFAULT_SETTINGS_NOTICE' => $TEXT['WBMAILER_DEFAULT_SETTINGS_NOTICE'],
419
				'TEXT_WBMAILER_DEFAULT_SENDER_MAIL' => $TEXT['WBMAILER_DEFAULT_SENDER_MAIL'],
420
				'TEXT_WBMAILER_DEFAULT_SENDER_NAME' => $TEXT['WBMAILER_DEFAULT_SENDER_NAME'],
421
				'TEXT_WBMAILER_NOTICE' => $TEXT['WBMAILER_NOTICE'],
422
				'TEXT_WBMAILER_FUNCTION' => $TEXT['WBMAILER_FUNCTION'],
423
				'TEXT_WBMAILER_SMTP_HOST' => $TEXT['WBMAILER_SMTP_HOST'],
424
				'TEXT_WBMAILER_PHP' => $TEXT['WBMAILER_PHP'],
425
				'TEXT_WBMAILER_SMTP' => $TEXT['WBMAILER_SMTP'],
426
				'TEXT_WBMAILER_SMTP_AUTH' => $TEXT['WBMAILER_SMTP_AUTH'],
427
				'TEXT_WBMAILER_SMTP_AUTH_NOTICE' => $TEXT['REQUIRED'].' '.$TEXT['WBMAILER_SMTP_AUTH'],
428
				'TEXT_WBMAILER_SMTP_USERNAME' => $TEXT['WBMAILER_SMTP_USERNAME'],
429
				'TEXT_WBMAILER_SMTP_PASSWORD' => $TEXT['WBMAILER_SMTP_PASSWORD'],
430
				'SMTP_AUTH_SELECTED' => ' checked="checked"'
431
				));
432
	if(WBMAILER_ROUTINE == 'phpmail')
433
	{
434
		$template->set_var('PHPMAIL_SELECTED', ' checked="checked"');
435
		$template->set_var('SMTP_VISIBILITY', ' style="display: none;"');
436
		$template->set_var('SMTP_VISIBILITY_AUTH', '');
437
		// $template->set_var('SMTP_AUTH_SELECTED', '');
438
	} elseif(WBMAILER_ROUTINE == 'smtp')
439
	{
440
		$template->set_var('SMTPMAIL_SELECTED', ' checked="checked"');
441
		$template->set_var('SMTP_VISIBILITY', '');
442
		$template->set_var('SMTP_VISIBILITY_AUTH', '');
443
	}
444
/* deprecated
445
	// Work-out if SMTP authentification should be checked
446
	if(WBMAILER_SMTP_AUTH)
447
	{
448
		$template->set_var('SMTP_AUTH_SELECTED', ' checked="checked"');
449
		if(WBMAILER_ROUTINE == 'smtp')
450
	    {
451
			$template->set_var('SMTP_VISIBILITY_AUTH', '');
452

    
453
		} else {
454
			$template->set_var('SMTP_VISIBILITY_AUTH', ' style="display: none;"');
455
		}
456
	} else {
457
		$template->set_var('SMTP_VISIBILITY_AUTH', ' style="display: none;"');
458
	}
459
*/
460
	// Work-out if intro feature is enabled
461
	if(INTRO_PAGE)
462
	{
463
		$template->set_var('INTRO_PAGE_ENABLED', ' checked="checked"');
464
	} else {
465
		$template->set_var('INTRO_PAGE_DISABLED', ' checked="checked"');
466
	}
467

    
468
	// Work-out if frontend login feature is enabled
469
	if(FRONTEND_LOGIN)
470
	{
471
		$template->set_var('PRIVATE_ENABLED', ' checked="checked"');
472
	} else {
473
		$template->set_var('PRIVATE_DISABLED', ' checked="checked"');
474
	}
475

    
476
	// Work-out if page trash feature is disabled, in-line, or separate
477
	if(PAGE_TRASH == 'disabled')
478
	{
479
		$template->set_var('PAGE_TRASH_DISABLED', ' checked="checked"');
480
		$template->set_var('DISPLAY_PAGE_TRASH_SEPARATE', 'display: none;');
481
	} elseif(PAGE_TRASH == 'inline')
482
	{
483
		$template->set_var('PAGE_TRASH_INLINE', ' checked="checked"');
484
		$template->set_var('DISPLAY_PAGE_TRASH_SEPARATE', 'display: none;');
485
	} elseif(PAGE_TRASH == 'separate')
486
	{
487
		$template->set_var('PAGE_TRASH_SEPARATE', ' checked="checked"');
488
		$template->set_var('DISPLAY_PAGE_TRASH_SEPARATE', 'display: inline;');
489
	}
490

    
491
	// Work-out if media home folde feature is enabled
492
	if(HOME_FOLDERS)
493
	{
494
		$template->set_var('HOME_FOLDERS_ENABLED', ' checked="checked"');
495
	} else {
496
		$template->set_var('HOME_FOLDERS_DISABLED', ' checked="checked"');
497
	}
498

    
499
	// Insert search select
500
	if(SEARCH == 'private')
501
	{
502
		$template->set_var('PRIVATE_SEARCH', ' selected="selected"');
503
	} elseif(SEARCH == 'registered') {
504
		$template->set_var('REGISTERED_SEARCH', ' selected="selected"');
505
	} elseif(SEARCH == 'none') {
506
		$template->set_var('NONE_SEARCH', ' selected="selected"');
507
	}
508

    
509
	// Work-out if 777 permissions are set
510
	if(STRING_FILE_MODE == '0777' AND STRING_DIR_MODE == '0777')
511
	{
512
		$template->set_var('WORLD_WRITEABLE_SELECTED', ' checked="checked"');
513
	}
514

    
515
	// Work-out which file mode boxes are checked
516
	if(extract_permission(STRING_FILE_MODE, 'u', 'r'))
517
	{
518
		$template->set_var('FILE_U_R_CHECKED', ' checked="checked"');
519
	}
520
	if(extract_permission(STRING_FILE_MODE, 'u', 'w'))
521
	{
522
		$template->set_var('FILE_U_W_CHECKED', ' checked="checked"');
523
	}
524
	if(extract_permission(STRING_FILE_MODE, 'u', 'e'))
525
	{
526
		$template->set_var('FILE_U_E_CHECKED', ' checked="checked"');
527
	}
528
	if(extract_permission(STRING_FILE_MODE, 'g', 'r'))
529
	{
530
		$template->set_var('FILE_G_R_CHECKED', ' checked="checked"');
531
	}
532
	if(extract_permission(STRING_FILE_MODE, 'g', 'w'))
533
	{
534
		$template->set_var('FILE_G_W_CHECKED', ' checked="checked"');
535
	}
536
	if(extract_permission(STRING_FILE_MODE, 'g', 'e'))
537
	{
538
		$template->set_var('FILE_G_E_CHECKED', ' checked="checked"');
539
	}
540
	if(extract_permission(STRING_FILE_MODE, 'o', 'r'))
541
	{
542
		$template->set_var('FILE_O_R_CHECKED', ' checked="checked"');
543
	}
544
	if(extract_permission(STRING_FILE_MODE, 'o', 'w'))
545
	{
546
		$template->set_var('FILE_O_W_CHECKED', ' checked="checked"');
547
	}
548
	if(extract_permission(STRING_FILE_MODE, 'o', 'e'))
549
	{
550
		$template->set_var('FILE_O_E_CHECKED', ' checked="checked"');
551
	}
552
	// Work-out which dir mode boxes are checked
553
	if(extract_permission(STRING_DIR_MODE, 'u', 'r'))
554
	{
555
		$template->set_var('DIR_U_R_CHECKED', ' checked="checked"');
556
	}
557
	if(extract_permission(STRING_DIR_MODE, 'u', 'w'))
558
	{
559
		$template->set_var('DIR_U_W_CHECKED', ' checked="checked"');
560
	}
561
	if(extract_permission(STRING_DIR_MODE, 'u', 'e'))
562
	{
563
		$template->set_var('DIR_U_E_CHECKED', ' checked="checked"');
564
	}
565
	if(extract_permission(STRING_DIR_MODE, 'g', 'r'))
566
	{
567
		$template->set_var('DIR_G_R_CHECKED', ' checked="checked"');
568
	}
569
	if(extract_permission(STRING_DIR_MODE, 'g', 'w'))
570
	{
571
		$template->set_var('DIR_G_W_CHECKED', ' checked="checked"');
572
	}
573
	if(extract_permission(STRING_DIR_MODE, 'g', 'e'))
574
	{
575
		$template->set_var('DIR_G_E_CHECKED', ' checked="checked"');
576
	}
577
	if(extract_permission(STRING_DIR_MODE, 'o', 'r'))
578
	{
579
		$template->set_var('DIR_O_R_CHECKED', ' checked="checked"');
580
	}
581
	if(extract_permission(STRING_DIR_MODE, 'o', 'w'))
582
	{
583
		$template->set_var('DIR_O_W_CHECKED', ' checked="checked"');
584
	}
585
	if(extract_permission(STRING_DIR_MODE, 'o', 'e'))
586
	{
587
		$template->set_var('DIR_O_E_CHECKED', ' checked="checked"');
588
	}
589

    
590
	$template->set_var(array(
591
						'PAGES_DIRECTORY' => PAGES_DIRECTORY,
592
						'PAGE_ICON_DIR'   => PAGE_ICON_DIR,
593
						'MEDIA_DIRECTORY' => MEDIA_DIRECTORY,
594
						'PAGE_EXTENSION' => PAGE_EXTENSION,
595
						'PAGE_SPACER' => PAGE_SPACER,
596
						'TABLE_PREFIX' => TABLE_PREFIX
597
					 ));
598

    
599
	// Insert Server Email value into template
600
	$template->set_var('SERVER_EMAIL', SERVER_EMAIL);
601

    
602
	// Insert groups into signup list
603
	$results = $database->query("SELECT group_id, name FROM ".TABLE_PREFIX."groups WHERE group_id != '1'");
604
	if($results->numRows() > 0)
605
	{
606
		while($group = $results->fetchRow())
607
	    {
608
			$template->set_var('ID', $group['group_id']);
609
			$template->set_var('NAME', $group['name']);
610
			if(FRONTEND_SIGNUP == $group['group_id'])
611
	        {
612
				$template->set_var('SELECTED', ' selected="selected"');
613
			} else {
614
				$template->set_var('SELECTED', '');
615
			}
616
			$template->parse('group_list', 'group_list_block', true);
617
		}
618
	} else {
619
		$template->set_var('ID', 'disabled');
620
		$template->set_var('NAME', $MESSAGE['GROUPS']['NO_GROUPS_FOUND']);
621
		$template->parse('group_list', 'group_list_block', true);
622
	}
623

    
624
	// Insert language headings
625
	$template->set_var(array(
626
					'HEADING_GENERAL_SETTINGS' => $HEADING['GENERAL_SETTINGS'],
627
					'HEADING_DEFAULT_SETTINGS' => $HEADING['DEFAULT_SETTINGS'],
628
					'HEADING_SEARCH_SETTINGS' => $HEADING['SEARCH_SETTINGS'],
629
					'HEADING_SERVER_SETTINGS' => $HEADING['SERVER_SETTINGS'],
630
					'HEADING_WBMAILER_SETTINGS' => $HEADING['WBMAILER_SETTINGS'],
631
					'HEADING_ADMINISTRATION_TOOLS' => $HEADING['ADMINISTRATION_TOOLS']
632
					)
633
			);
634
	// Insert language text and messages
635
	$template->set_var(array(
636
					'TEXT_WEBSITE_TITLE' => $TEXT['WEBSITE_TITLE'],
637
					'TEXT_WEBSITE_DESCRIPTION' => $TEXT['WEBSITE_DESCRIPTION'],
638
					'TEXT_WEBSITE_KEYWORDS' => $TEXT['WEBSITE_KEYWORDS'],
639
					'TEXT_WEBSITE_HEADER' => $TEXT['WEBSITE_HEADER'],
640
					'TEXT_WEBSITE_FOOTER' => $TEXT['WEBSITE_FOOTER'],
641
					'TEXT_HEADER' => $TEXT['HEADER'],
642
					'TEXT_FOOTER' => $TEXT['FOOTER'],
643
					'TEXT_VISIBILITY' => $TEXT['VISIBILITY'],
644
					'TEXT_RESULTS_HEADER' => $TEXT['RESULTS_HEADER'],
645
					'TEXT_RESULTS_LOOP' => $TEXT['RESULTS_LOOP'],
646
					'TEXT_RESULTS_FOOTER' => $TEXT['RESULTS_FOOTER'],
647
					'TEXT_NO_RESULTS' => $TEXT['NO_RESULTS'],
648
					'TEXT_TEXT' => $TEXT['TEXT'],
649
					'TEXT_DEFAULT' => $TEXT['DEFAULT'],
650
					'TEXT_LANGUAGE' => $TEXT['LANGUAGE'],
651
					'TEXT_TIMEZONE' => $TEXT['TIMEZONE'],
652
					'TEXT_CHARSET' => $TEXT['CHARSET'],
653
					'TEXT_DATE_FORMAT' => $TEXT['DATE_FORMAT'],
654
					'TEXT_TIME_FORMAT' => $TEXT['TIME_FORMAT'],
655
					'TEXT_TEMPLATE' => $TEXT['TEMPLATE'],
656
					'TEXT_THEME' => $TEXT['THEME'],
657
					'TEXT_WYSIWYG_EDITOR' => $TEXT['WYSIWYG_EDITOR'],
658
					'TEXT_PAGE_LEVEL_LIMIT' => $TEXT['PAGE_LEVEL_LIMIT'],
659
					'TEXT_INTRO_PAGE' => $TEXT['INTRO_PAGE'],
660
					'TEXT_FRONTEND' => $TEXT['FRONTEND'],
661
					'TEXT_LOGIN' => $TEXT['LOGIN'],
662
					'TEXT_REDIRECT_AFTER' => $TEXT['REDIRECT_AFTER'],
663
					'TEXT_SIGNUP' => $TEXT['SIGNUP'],
664
					'TEXT_PHP_ERROR_LEVEL' => $TEXT['PHP_ERROR_LEVEL'],
665
					'TEXT_MULTILINGUAL' => $TEXT['MULTILINGUAL'],
666
					'TEXT_DEV_INFOS' => $TEXT['DEV_INFOS'],
667
					'TEXT_PAGES_DIRECTORY' => $TEXT['PAGES_DIRECTORY'],
668
					'TEXT_PAGE_ICON_DIR' => $TEXT['PAGE_ICON_DIR'],
669
					'TEXT_MEDIA_DIRECTORY' => $TEXT['MEDIA_DIRECTORY'],
670
					'TEXT_PAGE_EXTENSION' => $TEXT['PAGE_EXTENSION'],
671
					'TEXT_PAGE_SPACER' => $TEXT['PAGE_SPACER'],
672
					'TEXT_RENAME_FILES_ON_UPLOAD' => $TEXT['RENAME_FILES_ON_UPLOAD'],
673
					'TEXT_APP_NAME' => $TEXT['APP_NAME'],
674
					'TEXT_SESSION_IDENTIFIER' => $TEXT['SESSION_IDENTIFIER'],
675
					'TEXT_SEC_ANCHOR' => $TEXT['SEC_ANCHOR'],
676
					'TEXT_SERVER_OPERATING_SYSTEM' => $TEXT['SERVER_OPERATING_SYSTEM'],
677
					'TEXT_LINUX_UNIX_BASED' => $TEXT['LINUX_UNIX_BASED'],
678
					'TEXT_WINDOWS' => $TEXT['WINDOWS'],
679
					'TEXT_ADMIN' => $TEXT['ADMIN'],
680
					'TEXT_TYPE' => $TEXT['TYPE'],
681
					'TEXT_DATABASE' => $TEXT['DATABASE'],
682
					'TEXT_HOST' => $TEXT['HOST'],
683
					'TEXT_USERNAME' => $TEXT['USERNAME'],
684
					'TEXT_PASSWORD' => $TEXT['PASSWORD'],
685
					'TEXT_NAME' => $TEXT['NAME'],
686
					'TEXT_TABLE_PREFIX' => $TEXT['TABLE_PREFIX'],
687
					'TEXT_SAVE' => $TEXT['SAVE'],
688
					'TEXT_RESET' => $TEXT['RESET'],
689
					'TEXT_CHANGES' => $TEXT['CHANGES'],
690
					'TEXT_ENABLED' => $TEXT['ENABLED'],
691
					'TEXT_DISABLED' => $TEXT['DISABLED'],
692
					'TEXT_MANAGE_SECTIONS' => $HEADING['MANAGE_SECTIONS'],
693
					'TEXT_MANAGE' => $TEXT['MANAGE'],
694
					'TEXT_SEARCH' => $TEXT['SEARCH'],
695
					'TEXT_PUBLIC' => $TEXT['PUBLIC'],
696
					'TEXT_PRIVATE' => $TEXT['PRIVATE'],
697
					'TEXT_REGISTERED' => $TEXT['REGISTERED'],
698
					'TEXT_NONE' => $TEXT['NONE'],
699
					'TEXT_FILES' => strtoupper(substr($TEXT['FILES'], 0, 1)).substr($TEXT['FILES'], 1),
700
					'TEXT_DIRECTORIES' => $TEXT['DIRECTORIES'],
701
					'TEXT_FILESYSTEM_PERMISSIONS' => $TEXT['FILESYSTEM_PERMISSIONS'],
702
					'TEXT_USER' => $TEXT['USER'],
703
					'TEXT_GROUP' => $TEXT['GROUP'],
704
					'TEXT_OTHERS' => $TEXT['OTHERS'],
705
					'TEXT_READ' => $TEXT['READ'],
706
					'TEXT_WRITE' => $TEXT['WRITE'],
707
					'TEXT_EXECUTE' => $TEXT['EXECUTE'],
708
					'TEXT_WARN_PAGE_LEAVE' => '',
709
					'TEXT_SMART_LOGIN' => $TEXT['SMART_LOGIN'],
710
					'TEXT_MULTIPLE_MENUS' => $TEXT['MULTIPLE_MENUS'],
711
					'TEXT_HOMEPAGE_REDIRECTION' => $TEXT['HOMEPAGE_REDIRECTION'],
712
					'TEXT_SECTION_BLOCKS' => $TEXT['SECTION_BLOCKS'],
713
					'TEXT_PLEASE_SELECT' => $TEXT['PLEASE_SELECT'],
714
					'TEXT_PAGE_TRASH' => $TEXT['PAGE_TRASH'],
715
					'TEXT_PAGE_LANGUAGES' => $TEXT['PAGE_LANGUAGES'],
716
					'TEXT_INLINE' => $TEXT['INLINE'],
717
					'TEXT_SEPARATE' => $TEXT['SEPARATE'],
718
					'TEXT_HOME_FOLDERS' => $TEXT['HOME_FOLDERS'],
719
					'TEXT_WYSIWYG_STYLE' => $TEXT['WYSIWYG_STYLE'],
720
					'TEXT_WORLD_WRITEABLE_FILE_PERMISSIONS' => $TEXT['WORLD_WRITEABLE_FILE_PERMISSIONS'],
721
					'MODE_SWITCH_WARNING' => $MESSAGE['SETTINGS']['MODE_SWITCH_WARNING'],
722
					'WORLD_WRITEABLE_WARNING' => $MESSAGE['SETTINGS']['WORLD_WRITEABLE_WARNING'],
723
					'TEXT_MODULE_ORDER' => $TEXT['MODULE_ORDER'],
724
					'TEXT_MAX_EXCERPT' => $TEXT['MAX_EXCERPT'],
725
					'TEXT_TIME_LIMIT' => $TEXT['TIME_LIMIT']
726
					));
727

    
728
if($is_advanced)
729
{
730
	$template->parse('show_page_level_limit', 'show_page_level_limit_block', true);
731
	$template->parse('show_checkbox_1',       'show_checkbox_1_block', true);
732
 	$template->parse('show_checkbox_2',       'show_checkbox_2_block', true);
733
	$template->parse('show_checkbox_3',       'show_checkbox_3_block', true);
734
	$template->parse('show_php_error_level',  'show_php_error_level_block', true);
735
	$template->parse('show_charset',          'show_charset_block', true);
736
	$template->parse('show_wysiwyg',          'show_wysiwyg_block', true);
737
	$template->parse('show_search',           'show_search_block', false);
738
	$template->parse('show_redirect_timer',   'show_redirect_timer_block', true);
739
}else {
740
	$template->set_block('show_page_level_limit', '');
741
	$template->set_block('show_checkbox_1', '');
742
	$template->set_block('show_checkbox_2', '');
743
	$template->set_block('show_checkbox_3', '');
744
	$template->set_block('show_php_error_level', '');
745
	$template->set_block('show_charset', '');
746
	$template->set_block('show_wysiwyg', '');
747
	$template->set_block('show_search', '');
748
	$template->set_block('show_redirect_timer', '');
749
}
750
if($is_advanced && $admin->get_user_id()=='1')
751
{
752
	$template->parse('show_access', 'show_access_block', true);
753
}else {
754
	$template->set_block('show_access', '');
755
}
756

    
757
// Parse template objects output
758
$template->parse('main', 'main_block', false);
759
$template->pparse('output', 'page');
760

    
761
$admin->print_footer();
(1-1/3)