Project

General

Profile

1
<?php
2
/**
3
 *
4
 * @category        admin
5
 * @package         settings
6
 * @author          Ryan Djurovich, WebsiteBaker Project
7
 * @copyright       2009-2012, WebsiteBaker 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 1767 2012-09-22 20:30:37Z Luisehahne $
13
 * @filesource		$HeadURL: svn://isteam.dynxs.de/wb-archiv/branches/2.8.x/wb/admin/settings/index.php $
14
 * @lastmodified    $Date: 2012-09-22 22:30:37 +0200 (Sat, 22 Sep 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
// add new values, later in upgrade-script
28
$cfg = array(
29
	'website_signature' => defined('WEBSITE_SIGNATURE') ? WEBSITE_SIGNATURE : '',
30
	'confirmed_registration' => (defined('CONFIRMED_REGISTRATION') ? CONFIRMED_REGISTRATION : '0'),
31
	'modules_upgrade_list' => (defined('MODULES_UPGRADE_LIST') ? MODULES_UPGRADE_LIST : ''),
32
	);
33
db_update_key_value( 'settings', $cfg );
34

    
35
// Include the WB functions file
36
require_once(WB_PATH.'/framework/functions.php');
37
require_once(WB_PATH.'/framework/functions-utf8.php');
38

    
39
$mLang = ModLanguage::getInstance();
40
$mLang->setLanguage(dirname(__FILE__).'/languages/', LANGUAGE, DEFAULT_LANGUAGE);
41

    
42
// Setup template object, parse vars to it, then parse it
43
// Create new template object
44
$template = new Template(dirname($admin->correct_theme_source('settings.htt')),'keep');
45
// $template->debug = true;
46
$template->set_file('page',        'settings.htt');
47
$template->set_block('page',       'main_block', 'main');
48
$template->set_var('FTAN', $admin->getFTAN());
49

    
50
$template->set_block('main_block', 'template_list_block',         'template_list');
51
$template->set_block('main_block', 'timezone_list_block',         'timezone_list');
52
$template->set_block('main_block', 'language_list_block',         'language_list');
53
$template->set_block('main_block', 'date_format_list_block',      'date_format_list');
54
$template->set_block('main_block', 'time_format_list_block',      'time_format_list');
55
$template->set_block('main_block', 'theme_list_block',            'theme_list');
56
$template->set_block('main_block', 'search_template_list_block',  'search_template_list');
57
$template->set_block('main_block', 'group_list_block',            'group_list');
58
$template->set_block('main_block', 'charset_list_block',          'charset_list');
59
$template->set_block('main_block', 'error_reporting_list_block',  'error_reporting_list');
60
$template->set_block('main_block', 'editor_list_block',           'editor_list');
61
$template->set_block('main_block', 'page_level_limit_list_block', 'page_level_limit_list');
62

    
63
$template->set_block('main_block', 'show_page_level_limit_block', 'show_page_level_limit');
64
$template->set_block('main_block', 'show_checkbox_1_block',       'show_checkbox_1');
65
$template->set_block('main_block', 'show_checkbox_2_block',       'show_checkbox_2');
66
$template->set_block('main_block', 'show_checkbox_3_block',       'show_checkbox_3');
67
$template->set_block('main_block', 'show_php_error_level_block',  'show_php_error_level');
68
$template->set_block('main_block', 'show_charset_block',          'show_charset');
69
$template->set_block('main_block', 'show_wysiwyg_block',          'show_wysiwyg');
70
$template->set_block('main_block', 'show_access_block',           'show_access');
71
$template->set_block('main_block', 'show_search_block',           'show_search');
72
$template->set_block('main_block', 'show_redirect_timer_block',   'show_redirect_timer');
73
/*-- insert all needed vars from language files ----------------------------------------*/
74
$template->set_var($mLang->getLangArray());
75

    
76
// Query current settings in the db, then loop through them and print them
77
$query = "SELECT * FROM ".TABLE_PREFIX."settings";
78
$results = $database->query($query);
79
while($setting = $results->fetchRow())
80
{
81
	$setting_name = $setting['name'];
82
	$setting_value = ( $setting_name != 'wbmailer_smtp_password' ) ? htmlspecialchars($setting['value']) : $setting['value'];
83
	$template->set_var(strtoupper($setting_name),$setting_value);
84
}
85

    
86
// Do the same for settings stored in config file as with ones in db
87
$database_type = '';
88
$is_advanced = (isset($_GET['advanced']) && $_GET['advanced'] == 'yes');
89
// Tell the browser whether or not to show advanced options
90
if($is_advanced)
91
{
92
	$template->set_var('DISPLAY_ADVANCED', '');
93
	$template->set_var('ADVANCED_FILE_PERMS_ID', 'file_perms_box');
94
	$template->set_var('BASIC_FILE_PERMS_ID', 'hide');
95
	$template->set_var('ADVANCED', 'yes');
96
	$template->set_var('ADVANCED_BUTTON', '&lt;&lt; '.$TEXT['HIDE_ADVANCED']);
97
	$template->set_var('ADVANCED_LINK', 'index.php?advanced=no');
98

    
99
} else {
100
	$template->set_var('DISPLAY_ADVANCED', ' style="display: none;"');
101
	$template->set_var('BASIC_FILE_PERMS_ID', 'file_perms_box');
102
	$template->set_var('ADVANCED_FILE_PERMS_ID', 'hide');
103

    
104
	$template->set_var('ADVANCED', 'no');
105
	$template->set_var('ADVANCED_BUTTON', $TEXT['SHOW_ADVANCED'].' &gt;&gt;');
106
	$template->set_var('ADVANCED_LINK', 'index.php?advanced=yes');
107
}
108

    
109
	$query = "SELECT * FROM ".TABLE_PREFIX."search WHERE extra = ''";
110
	$results = $database->query($query);
111

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

    
161
	$sSelected = ' selected="selected"';
162
	$checked   = ' checked="checked"';
163

    
164
	$template->set_var(array(
165
						'WB_URL' => WB_URL,
166
						'THEME_URL' => THEME_URL,
167
						'ADMIN_URL' => ADMIN_URL,
168
					 ));
169

    
170
	// Insert language values
171
	$sql  = 'SELECT `name`, `directory` FROM `'.TABLE_PREFIX.'addons` ';
172
	$sql .= 'WHERE `type` = \'language\' ';
173
	$sql .= 'AND `function` != \'theme\' ';
174
	$sql .= 'ORDER BY `directory`';
175

    
176
	if( ($result = $database->query($sql)) && ($result->numRows() > 0) )
177
//	$result = $database->query("SELECT * FROM ".TABLE_PREFIX."addons WHERE type = 'language' ORDER BY directory");
178
//	if($result->numRows() > 0)
179
	{
180
		while($addon = $result->fetchRow()) {
181
	        $langIcons = (empty($addon['directory'])) ? 'none' : strtolower($addon['directory']);
182

    
183
			$template->set_var('CODE',        $addon['directory']);
184
			$template->set_var('NAME',        $addon['name']);
185
			$template->set_var('FLAG',        THEME_URL.'/images/flags/'.$langIcons);
186
			$template->set_var('SELECTED',    (DEFAULT_LANGUAGE == $addon['directory'] ? $sSelected : '') );
187
			$template->parse('language_list', 'language_list_block', true);
188
		}
189
	}
190

    
191
	// Insert default timezone values
192
	require(ADMIN_PATH.'/interface/timezones.php');
193
	foreach($TIMEZONES AS $hour_offset => $title)
194
	{
195
		// Make sure we dont list "System Default" as we are setting this value!
196
		if($hour_offset != '-20') {
197
			$template->set_var('VALUE', $hour_offset);
198
			$template->set_var('NAME', $title);
199
			if(DEFAULT_TIMEZONE == $hour_offset*60*60) {
200
				$template->set_var('SELECTED', $sSelected);
201
			} else {
202
				$template->set_var('SELECTED', '');
203
			}
204
			$template->parse('timezone_list', 'timezone_list_block', true);
205
		}
206
	}
207

    
208
	// Insert default charset values
209
	require(ADMIN_PATH.'/interface/charsets.php');
210
	foreach($CHARSETS AS $code => $title) {
211
		$template->set_var('VALUE', $code);
212
		$template->set_var('NAME', $title);
213
		if(DEFAULT_CHARSET == $code) {
214
			$template->set_var('SELECTED', $sSelected);
215
		} else {
216
			$template->set_var('SELECTED', '');
217
		}
218
		$template->parse('charset_list', 'charset_list_block', true);
219
	}
220

    
221

    
222
	// Insert date format list
223
	require(ADMIN_PATH.'/interface/date_formats.php');
224
	foreach($DATE_FORMATS AS $format => $title) {
225
		$format = str_replace('|', ' ', $format); // Add's white-spaces (not able to be stored in array key)
226
		if($format != 'system_default') {
227
			$template->set_var('VALUE', $format);
228
		} else {
229
			$template->set_var('VALUE', '');
230
		}
231
		$template->set_var('NAME', $title);
232
		if(DEFAULT_DATE_FORMAT == $format) {
233
			$template->set_var('SELECTED', $sSelected);
234
		} else {
235
			$template->set_var('SELECTED', '');
236
		}
237
		$template->parse('date_format_list', 'date_format_list_block', true);
238
	}
239

    
240
	// Insert time format list
241
	require(ADMIN_PATH.'/interface/time_formats.php');
242
	foreach($TIME_FORMATS AS $format => $title) {
243
		$format = str_replace('|', ' ', $format); // Add's white-spaces (not able to be stored in array key)
244
		if($format != 'system_default') {
245
			$template->set_var('VALUE', $format);
246
		} else {
247
			$template->set_var('VALUE', '');
248
		}
249
		$template->set_var('NAME', $title);
250
		if(DEFAULT_TIME_FORMAT == $format) {
251
			$template->set_var('SELECTED', $sSelected);
252
		} else {
253
			$template->set_var('SELECTED', '');
254
		}
255
		$template->parse('time_format_list', 'time_format_list_block', true);
256
	}
257

    
258
// Insert templates
259
	$sql  = 'SELECT `name`, `directory` FROM `'.TABLE_PREFIX.'addons` ';
260
	$sql .= 'WHERE `type` = \'template\' ';
261
	$sql .= 'AND `function` != \'theme\' ';
262
	$sql .= 'ORDER BY `name`';
263
	if( ($result = $database->query($sql)) && ($result->numRows() > 0) )
264
	{
265
//	$result = $database->query("SELECT * FROM ".TABLE_PREFIX."addons WHERE type = 'template' AND function != 'theme' ORDER BY name");
266
//	if($result->numRows() > 0) {
267
		while($addon = $result->fetchRow())
268
		{
269
			if( $admin->get_permission($addon['directory'],'template' ) )
270
			{
271
				$template->set_var('FILE', $addon['directory']);
272
				$template->set_var('NAME', $addon['name']);
273
				$selected = (($addon['directory'] == DEFAULT_TEMPLATE) ? $sSelected : '');
274
				$template->set_var('SELECTED', $selected);
275
				$template->parse('template_list', 'template_list_block', true);
276
			}
277
		}
278
	}
279

    
280
// Insert backend theme
281
	$sql  = 'SELECT `name`, `directory` FROM `'.TABLE_PREFIX.'addons` ';
282
	$sql .= 'WHERE `type` = \'template\' ';
283
	$sql .= 'AND `function` = \'theme\' ';
284
	$sql .= 'ORDER BY `name`';
285

    
286

    
287
	if( ($result = $database->query($sql)) && ($result->numRows() > 0) )
288
	{
289
//	$result = $database->query("SELECT * FROM ".TABLE_PREFIX."addons WHERE type = 'template' AND function = 'theme' ORDER BY name");
290
//	if($result->numRows() > 0) {
291
		while($addon = $result->fetchRow())
292
		{
293
			if( $admin->get_permission($addon['directory'],'template' ) )
294
			{
295
				$template->set_var('FILE', $addon['directory']);
296
				$template->set_var('NAME', $addon['name']);
297
				$selected = (($addon['directory'] == DEFAULT_THEME) ? $sSelected : '');
298
				$template->set_var('SELECTED', $selected);
299
				$template->parse('theme_list', 'theme_list_block', true);
300
			}
301
		}
302
	}
303

    
304
	// Insert WYSIWYG modules
305
	$file='none';
306
	$module_name=$TEXT['NONE'];
307
	$template->set_var('FILE', $file);
308
	$template->set_var('NAME', $module_name);
309
	$selected = (!defined('WYSIWYG_EDITOR') || $file == WYSIWYG_EDITOR) ? $sSelected : '';
310
	$template->set_var('SELECTED', $selected);
311
	$template->parse('editor_list', 'editor_list_block', true);
312
	$sql  = 'SELECT `name`, `directory` FROM `'.TABLE_PREFIX.'addons` ';
313
	$sql .= 'WHERE `type` = \'module\' ';
314
	$sql .= 'AND `function` = \'wysiwyg\' ';
315
	$sql .= 'ORDER BY `name`';
316
	if( ($result = $database->query($sql)) && ($result->numRows() > 0) )
317
	{
318
//	$result = $database->query("SELECT * FROM ".TABLE_PREFIX."addons WHERE type = 'module' AND function = 'wysiwyg' ORDER BY name");
319
//	if($result->numRows() > 0)
320
//	{
321
		while($addon = $result->fetchRow())
322
	    {
323
			if( $admin->get_permission($addon['directory'],'module' ) )
324
			{
325
				$template->set_var('FILE', $addon['directory']);
326
				$template->set_var('NAME', $addon['name']);
327
				$selected = (!defined('WYSIWYG_EDITOR') || $addon['directory'] == WYSIWYG_EDITOR) ? $sSelected : '';
328
				$template->set_var('SELECTED', $selected);
329
				$template->parse('editor_list', 'editor_list_block', true);
330
			}
331
		}
332
	}
333

    
334
// Insert templates for search settings
335
	$search_template = ( ($search_template == DEFAULT_TEMPLATE) || ($search_template == '') ) ? '' : $search_template;
336
	$selected = ( ($search_template != DEFAULT_TEMPLATE) ) ?  $sSelected : '';
337

    
338
	$template->set_var(array(
339
	        'FILE' => '',
340
	        'NAME' => $TEXT['SYSTEM_DEFAULT'],
341
	        'SELECTED' => $selected
342
	    ));
343
	$template->parse('search_template_list', 'search_template_list_block', true);
344

    
345
	$sql  = 'SELECT `name`, `directory` FROM `'.TABLE_PREFIX.'addons` ';
346
	$sql .= 'WHERE `type` = \'template\' ';
347
	$sql .= 'AND `function` = \'template\' ';
348
	$sql .= 'ORDER BY `name`';
349
    if( ($result = $database->query($sql)) && ($result->numRows() > 0) )
350
	{
351
//	$result = $database->query("SELECT * FROM ".TABLE_PREFIX."addons WHERE type = 'template' AND function = 'template' ORDER BY name");
352
//	if($result->numRows() > 0)
353
//	{
354
		while($addon = $result->fetchRow())
355
	    {
356
			if( $admin->get_permission($addon['directory'],'template' ) )
357
			{
358
				$template->set_var('FILE', $addon['directory']);
359
				$template->set_var('NAME', $addon['name']);
360
		        $selected = ($addon['directory'] == $search_template) ? $sSelected :  '';
361
				$template->set_var('SELECTED', $selected);
362
				$template->parse('search_template_list', 'search_template_list_block', true);
363
			}
364
		}
365
	}
366

    
367
	// Insert default error reporting values
368
	require(ADMIN_PATH.'/interface/er_levels.php');
369
	foreach($ER_LEVELS AS $value => $title)
370
	{
371
		$template->set_var('VALUE', $value);
372
		$template->set_var('NAME', $title);
373
	    $selected = (ER_LEVEL == $value) ? $sSelected : '';
374
	    $template->set_var('SELECTED', $selected);
375
		$template->parse('error_reporting_list', 'error_reporting_list_block', true);
376
	}
377

    
378

    
379
	// Insert permissions values
380
	if($admin->get_permission('settings_advanced') != true)
381
	{
382
		$template->set_var('DISPLAY_ADVANCED_BUTTON', 'hide');
383
	}
384

    
385
	// Insert page level limits
386
	for($i = 1; $i <= 10; $i++)
387
	{
388
		$template->set_var('NUMBER', $i);
389
		if(PAGE_LEVEL_LIMIT == $i)
390
	    {
391
			$template->set_var('SELECTED', $sSelected);
392
		} else {
393
			$template->set_var('SELECTED', '');
394
		}
395
		$template->parse('page_level_limit_list', 'page_level_limit_list_block', true);
396
	}
397

    
398
	// Work-out if multiple menus feature is enabled
399
	if(defined('MULTIPLE_MENUS') && MULTIPLE_MENUS == true)
400
	{
401
    	$template->set_var(array(
402
				'MULTIPLE_MENUS_ENABLED' => $checked,
403
				'MULTIPLE_MENUS_DISABLED' => '',
404
				));
405
	} else {
406
    	$template->set_var(array(
407
				'MULTIPLE_MENUS_DISABLED' => $checked,
408
				'MULTIPLE_MENUS_ENABLED' => '',
409
				));
410
	}
411

    
412
	// Work-out if page languages feature is enabled
413
	if(defined('PAGE_LANGUAGES') && PAGE_LANGUAGES == true)
414
	{
415
    	$template->set_var(array(
416
				'PAGE_LANGUAGES_ENABLED' => $checked,
417
				'PAGE_LANGUAGES_DISABLED' => '',
418
				));
419
	} else {
420
    	$template->set_var(array(
421
				'PAGE_LANGUAGES_DISABLED' => $checked,
422
				'PAGE_LANGUAGES_ENABLED' => '',
423
				));
424
	}
425

    
426
	// Work-out if warn_page_leave feature is enabled
427
	if (defined('WARN_PAGE_LEAVE') && WARN_PAGE_LEAVE == true)
428
	{
429
		$template->set_var('WARN_PAGE_LEAVE_ENABLED', $checked);
430
    	$template->set_var(array(
431
				'WARN_PAGE_LEAVE_ENABLED' => $checked,
432
				'WARN_PAGE_LEAVE_DISABLED' => '',
433
				));
434
	} else {
435
		$template->set_var('WARN_PAGE_LEAVE_DISABLED', $checked);
436
    	$template->set_var(array(
437
				'MANAGE_SECTIONS_DISABLED' => $checked,
438
				'WARN_PAGE_LEAVE_DISABLED' => '',
439
				));
440
	}
441

    
442
	// Work-out if smart login feature is enabled
443
	if(defined('SMART_LOGIN') && SMART_LOGIN == true)
444
	{
445
		$template->set_var('SMART_LOGIN_ENABLED', $checked);
446
    	$template->set_var(array(
447
				'SMART_LOGIN_ENABLED' => $checked,
448
				'SMART_LOGIN_DISABLED' => '',
449
				));
450
	} else {
451
		$template->set_var('SMART_LOGIN_DISABLED', $checked);
452
    	$template->set_var(array(
453
				'SMART_LOGIN_DISABLED' => $checked,
454
				'SMART_LOGIN_ENABLED' => '',
455
				));
456
	}
457

    
458
	/* Make's sure GD library is installed */
459
	if(extension_loaded('gd') && function_exists('imageCreateFromJpeg'))
460
	{
461
		$template->set_var('GD_EXTENSION_ENABLED', '');
462
	} else {
463
		$template->set_var('GD_EXTENSION_ENABLED', ' style="display: none;"');
464
	}
465

    
466
	// Work-out if section blocks feature is enabled
467
	if(defined('SECTION_BLOCKS') && SECTION_BLOCKS == true)
468
	{
469
    	$template->set_var(array(
470
				'SECTION_BLOCKS_ENABLED' => $checked,
471
				'SECTION_BLOCKS_DISABLED' => '',
472
				));
473
	} else {
474
    	$template->set_var(array(
475
				'SECTION_BLOCKS_DISABLED' => $checked,
476
				'SECTION_BLOCKS_ENABLED' => '',
477
				));
478
	}
479

    
480
	// Work-out if homepage redirection feature is enabled
481
	if(defined('HOMEPAGE_REDIRECTION') && HOMEPAGE_REDIRECTION == true)
482
	{
483
//		$template->set_var('HOMEPAGE_REDIRECTION_ENABLED', $checked);
484
    	$template->set_var(array(
485
				'HOMEPAGE_REDIRECTION_ENABLED' => $checked,
486
				'HOMEPAGE_REDIRECTION_DISABLED' => '',
487
				));
488
	} else {
489
//		$template->set_var('HOMEPAGE_REDIRECTION_DISABLED', $checked);
490
    	$template->set_var(array(
491
				'HOMEPAGE_REDIRECTION_DISABLED' => $checked,
492
				'HOMEPAGE_REDIRECTION_ENABLED' => '',
493
				));
494
	}
495

    
496
	// Work-out which server os should be checked
497
	if(OPERATING_SYSTEM == 'linux')
498
	{
499
		$template->set_var('LINUX_SELECTED', $checked);
500
	} elseif(OPERATING_SYSTEM == 'windows') {
501
		$template->set_var('WINDOWS_SELECTED', $checked);
502
	}
503

    
504
	// Work-out if developer infos feature is enabled
505
	if(defined('DEV_INFOS') && DEV_INFOS == true)
506
	{
507
		//$template->set_var('DEV_INFOS_ENABLED', $checked);
508
    	$template->set_var(array(
509
				'DEV_INFOS_ENABLED' => $checked,
510
				'DEV_INFOS_DISABLED' => '',
511
				));
512
	} else {
513
		//$template->set_var('DEV_INFOS_DISABLED', $checked);
514
    	$template->set_var(array(
515
				'DEV_INFOS_DISABLED' => $checked,
516
				'DEV_INFOS_ENABLED' => '',
517
				));
518
	}
519

    
520
	// Work-out if developer infos feature is enabled
521
	if(defined('PAGE_EXTENDED') && PAGE_EXTENDED == true)
522
	{
523
		//$template->set_var('DEV_INFOS_ENABLED', $checked);
524
    	$template->set_var(array(
525
				'PAGE_EXTENDED_ENABLED' => $checked,
526
				'PAGE_EXTENDED_DISABLED' => '',
527
				));
528
	} else {
529
		//$template->set_var('PAGE_EXTENDED_DISABLED', $checked);
530
    	$template->set_var(array(
531
				'PAGE_EXTENDED_DISABLED' => $checked,
532
				'PAGE_EXTENDED_ENABLED' => '',
533
				));
534
	}
535

    
536
	// Work-out if manage sections feature is enabled
537
	if(MANAGE_SECTIONS)
538
	{
539
    	$template->set_var(array(
540
				'MANAGE_SECTIONS_ENABLED' => $checked,
541
				'MANAGE_SECTIONS_DISABLED' => '',
542
				));
543
	} else {
544
    	$template->set_var(array(
545
				'MANAGE_SECTIONS_DISABLED' => $checked,
546
				'MANAGE_SECTIONS_ENABLED' => '',
547
				));
548
	}
549

    
550
	// Work-out which wbmailer routine should be checked
551
	$template->set_var(array(
552
				'TEXT_WBMAILER_DEFAULT_SETTINGS_NOTICE' => $TEXT['WBMAILER_DEFAULT_SETTINGS_NOTICE'],
553
				'TEXT_WBMAILER_DEFAULT_SENDER_MAIL' => $TEXT['WBMAILER_DEFAULT_SENDER_MAIL'],
554
				'TEXT_WBMAILER_DEFAULT_SENDER_NAME' => $TEXT['WBMAILER_DEFAULT_SENDER_NAME'],
555
				'TEXT_WBMAILER_NOTICE' => $TEXT['WBMAILER_NOTICE'],
556
				'TEXT_WBMAILER_FUNCTION' => $TEXT['WBMAILER_FUNCTION'],
557
				'TEXT_WBMAILER_SMTP_HOST' => $TEXT['WBMAILER_SMTP_HOST'],
558
				'TEXT_WBMAILER_PHP' => $TEXT['WBMAILER_PHP'],
559
				'TEXT_WBMAILER_SMTP' => $TEXT['WBMAILER_SMTP'],
560
				'TEXT_WBMAILER_SMTP_AUTH' => $TEXT['WBMAILER_SMTP_AUTH'],
561
				'TEXT_WBMAILER_SMTP_AUTH_NOTICE' => $TEXT['REQUIRED'].' '.$TEXT['WBMAILER_SMTP_AUTH'],
562
				'TEXT_WBMAILER_SMTP_USERNAME' => $TEXT['WBMAILER_SMTP_USERNAME'],
563
				'TEXT_WBMAILER_SMTP_PASSWORD' => $TEXT['WBMAILER_SMTP_PASSWORD'],
564
				'SMTP_AUTH_SELECTED' => $checked
565
				));
566
	if(WBMAILER_ROUTINE == 'phpmail')
567
	{
568
		$template->set_var('PHPMAIL_SELECTED', $checked);
569
		$template->set_var('SMTP_VISIBILITY', ' style="display: none;"');
570
		$template->set_var('SMTP_VISIBILITY_AUTH', '');
571
		// $template->set_var('SMTP_AUTH_SELECTED', '');
572
	} elseif(WBMAILER_ROUTINE == 'smtp')
573
	{
574
		$template->set_var('SMTPMAIL_SELECTED', $checked);
575
		$template->set_var('SMTP_VISIBILITY', '');
576
		$template->set_var('SMTP_VISIBILITY_AUTH', '');
577
	}
578
/* deprecated
579
	// Work-out if SMTP authentification should be checked
580
	if(WBMAILER_SMTP_AUTH)
581
	{
582
		$template->set_var('SMTP_AUTH_SELECTED', $checked);
583
		if(WBMAILER_ROUTINE == 'smtp')
584
	    {
585
			$template->set_var('SMTP_VISIBILITY_AUTH', '');
586

    
587
		} else {
588
			$template->set_var('SMTP_VISIBILITY_AUTH', ' style="display: none;"');
589
		}
590
	} else {
591
		$template->set_var('SMTP_VISIBILITY_AUTH', ' style="display: none;"');
592
	}
593
*/
594
	// Work-out if intro feature is enabled
595
	if(INTRO_PAGE)
596
	{
597
    	$template->set_var(array(
598
				'INTRO_PAGE_ENABLED' => $checked,
599
				'INTRO_PAGE_DISABLED' => '',
600
				));
601
	} else {
602
    	$template->set_var(array(
603
				'INTRO_PAGE_DISABLED' => $checked,
604
				'INTRO_PAGE_ENABLED' => '',
605
				));
606
	}
607

    
608
	// Work-out if frontend login feature is enabled
609
	if(FRONTEND_LOGIN)
610
	{
611
    	$template->set_var(array(
612
				'PRIVATE_ENABLED' => $checked,
613
				'PRIVATE_DISABLED' => '',
614
				));
615
	} else {
616
    	$template->set_var(array(
617
				'PRIVATE_DISABLED' => $checked,
618
				'INTRO_PAGE_ENABLED' => '',
619
				));
620
	}
621
	// Work-out if frontend login feature is enabled
622

    
623
	if(CONFIRMED_REGISTRATION)
624
	{
625
    	$template->set_var(array(
626
				'CONFIRMED_REGISTRATION_ENABLED' => $checked,
627
				'CONFIRMED_REGISTRATION_DISABLED' => '',
628
				));
629
	} else {
630
    	$template->set_var(array(
631
				'CONFIRMED_REGISTRATION_DISABLED' => $checked,
632
				'CONFIRMED_REGISTRATION_ENABLED' => '',
633
				));
634
	}
635

    
636
	// Work-out if page trash feature is disabled, in-line, or separate
637
	if(PAGE_TRASH == 'disabled')
638
	{
639
//		$template->set_var('PAGE_TRASH_DISABLED', $checked);
640
//		$template->set_var('DISPLAY_PAGE_TRASH_SEPARATE', 'display: none;');
641
    	$template->set_var(array(
642
				'PAGE_TRASH_DISABLED' => $checked,
643
				'PAGE_TRASH_INLINE' => '',
644
				'DISPLAY_PAGE_TRASH_SEPARATE' => 'display: none;',
645
				));
646
	} elseif(PAGE_TRASH == 'inline')
647
	{
648
//		$template->set_var('PAGE_TRASH_INLINE', $checked);
649
//		$template->set_var('DISPLAY_PAGE_TRASH_SEPARATE', 'display: none;');
650
    	$template->set_var(array(
651
				'PAGE_TRASH_INLINE' => $checked,
652
				'PAGE_TRASH_DISABLED' => '',
653
				'DISPLAY_PAGE_TRASH_SEPARATE' => 'display: none;',
654
				));
655
	} elseif(PAGE_TRASH == 'separate')
656
	{
657
		$template->set_var('PAGE_TRASH_SEPARATE', $checked);
658
		$template->set_var('DISPLAY_PAGE_TRASH_SEPARATE', 'display: inline;');
659
	}
660

    
661
	// Work-out if media home folde feature is enabled
662
	if(HOME_FOLDERS)
663
	{
664
    	$template->set_var(array(
665
				'HOME_FOLDERS_ENABLED' => $checked,
666
				'HOME_FOLDERS_DISABLED' => '',
667
				));
668
	} else {
669
    	$template->set_var(array(
670
				'HOME_FOLDERS_DISABLED' => $checked,
671
				'HOME_FOLDERS_ENABLED' => '',
672
				));
673
	}
674

    
675
	// Insert search select
676
	if(SEARCH == 'private')
677
	{
678
    	$template->set_var(array(
679
				'PRIVATE_SEARCH' => $sSelected,
680
				'REGISTERED_SEARCH' => '',
681
				'NONE_SEARCH' => '',
682
				));
683
	} elseif(SEARCH == 'public') {
684
    	$template->set_var(array(
685
				'PRIVATE_SEARCH' => '',
686
				'REGISTERED_SEARCH' => '',
687
				'NONE_SEARCH' => '',
688
				));
689
	} elseif(SEARCH == 'registered') {
690
    	$template->set_var(array(
691
				'PRIVATE_SEARCH' => '',
692
				'REGISTERED_SEARCH' => $sSelected,
693
				'NONE_SEARCH' => '',
694
				));
695
	} elseif(SEARCH == 'none') {
696
    	$template->set_var(array(
697
				'PRIVATE_SEARCH' => '',
698
				'REGISTERED_SEARCH' => '',
699
				'NONE_SEARCH' => $sSelected,
700
				));
701
	}
702

    
703
	// Work-out if 777 permissions are set
704
	$template->set_var('WORLD_WRITEABLE_SELECTED', '');
705
	if(STRING_FILE_MODE == '0777' AND STRING_DIR_MODE == '0777')
706
	{
707
		$template->set_var('WORLD_WRITEABLE_SELECTED', $checked);
708
	}
709

    
710
	// Work-out which file mode boxes are checked
711
	if(extract_permission(STRING_FILE_MODE, 'u', 'r'))
712
	{
713
		$template->set_var('FILE_U_R_CHECKED', $checked);
714
	}
715
	if(extract_permission(STRING_FILE_MODE, 'u', 'w'))
716
	{
717
		$template->set_var('FILE_U_W_CHECKED', $checked);
718
	}
719
	if(extract_permission(STRING_FILE_MODE, 'u', 'e'))
720
	{
721
		$template->set_var('FILE_U_E_CHECKED', $checked);
722
	}
723
	if(extract_permission(STRING_FILE_MODE, 'g', 'r'))
724
	{
725
		$template->set_var('FILE_G_R_CHECKED', $checked);
726
	}
727
	if(extract_permission(STRING_FILE_MODE, 'g', 'w'))
728
	{
729
		$template->set_var('FILE_G_W_CHECKED', $checked);
730
	}
731
	if(extract_permission(STRING_FILE_MODE, 'g', 'e'))
732
	{
733
		$template->set_var('FILE_G_E_CHECKED', $checked);
734
	}
735
	if(extract_permission(STRING_FILE_MODE, 'o', 'r'))
736
	{
737
		$template->set_var('FILE_O_R_CHECKED', $checked);
738
	}
739
	if(extract_permission(STRING_FILE_MODE, 'o', 'w'))
740
	{
741
		$template->set_var('FILE_O_W_CHECKED', $checked);
742
	}
743
	if(extract_permission(STRING_FILE_MODE, 'o', 'e'))
744
	{
745
		$template->set_var('FILE_O_E_CHECKED', $checked);
746
	}
747
	// Work-out which dir mode boxes are checked
748
	if(extract_permission(STRING_DIR_MODE, 'u', 'r'))
749
	{
750
		$template->set_var('DIR_U_R_CHECKED', $checked);
751
	}
752
	if(extract_permission(STRING_DIR_MODE, 'u', 'w'))
753
	{
754
		$template->set_var('DIR_U_W_CHECKED', $checked);
755
	}
756
	if(extract_permission(STRING_DIR_MODE, 'u', 'e'))
757
	{
758
		$template->set_var('DIR_U_E_CHECKED', $checked);
759
	}
760
	if(extract_permission(STRING_DIR_MODE, 'g', 'r'))
761
	{
762
		$template->set_var('DIR_G_R_CHECKED', $checked);
763
	}
764
	if(extract_permission(STRING_DIR_MODE, 'g', 'w'))
765
	{
766
		$template->set_var('DIR_G_W_CHECKED', $checked);
767
	}
768
	if(extract_permission(STRING_DIR_MODE, 'g', 'e'))
769
	{
770
		$template->set_var('DIR_G_E_CHECKED', $checked);
771
	}
772
	if(extract_permission(STRING_DIR_MODE, 'o', 'r'))
773
	{
774
		$template->set_var('DIR_O_R_CHECKED', $checked);
775
	}
776
	if(extract_permission(STRING_DIR_MODE, 'o', 'w'))
777
	{
778
		$template->set_var('DIR_O_W_CHECKED', $checked);
779
	}
780
	if(extract_permission(STRING_DIR_MODE, 'o', 'e'))
781
	{
782
		$template->set_var('DIR_O_E_CHECKED', $checked);
783
	}
784

    
785
	$template->set_var(array(
786
						'PAGES_DIRECTORY' => PAGES_DIRECTORY,
787
						'MODULES_DIRECTORY' => MODULES_UPGRADE_LIST,
788
						'PAGE_ICON_DIR'   => PAGE_ICON_DIR,
789
						'MEDIA_DIRECTORY' => MEDIA_DIRECTORY,
790
						'PAGE_EXTENSION' => PAGE_EXTENSION,
791
						'PAGE_SPACER' => PAGE_SPACER,
792
						'TABLE_PREFIX' => TABLE_PREFIX
793
					 ));
794

    
795
	// Insert Server Email value into template
796
	$template->set_var('SERVER_EMAIL', SERVER_EMAIL);
797

    
798
	// Insert groups into signup list
799
	$results = $database->query("SELECT group_id, name FROM ".TABLE_PREFIX."groups WHERE group_id != '1'");
800
	if($results->numRows() > 0)
801
	{
802
		while($group = $results->fetchRow())
803
	    {
804
			$template->set_var('ID', $group['group_id']);
805
			$template->set_var('NAME', $group['name']);
806
			if(FRONTEND_SIGNUP == $group['group_id'])
807
	        {
808
				$template->set_var('SELECTED', $sSelected);
809
			} else {
810
				$template->set_var('SELECTED', '');
811
			}
812
			$template->parse('group_list', 'group_list_block', true);
813
		}
814
	} else {
815
		$template->set_var('ID', 'disabled');
816
		$template->set_var('NAME', $MESSAGE['GROUPS']['NO_GROUPS_FOUND']);
817
		$template->parse('group_list', 'group_list_block', true);
818
	}
819

    
820
	// Insert language headings
821
	$template->set_var(array(
822
					'HEADING_GENERAL_SETTINGS' => $HEADING['GENERAL_SETTINGS'],
823
					'HEADING_DEFAULT_SETTINGS' => $HEADING['DEFAULT_SETTINGS'],
824
					'HEADING_SEARCH_SETTINGS' => $HEADING['SEARCH_SETTINGS'],
825
					'HEADING_SERVER_SETTINGS' => $HEADING['SERVER_SETTINGS'],
826
					'HEADING_WBMAILER_SETTINGS' => $HEADING['WBMAILER_SETTINGS'],
827
					'HEADING_ADMINISTRATION_TOOLS' => $HEADING['ADMINISTRATION_TOOLS']
828
					)
829
			);
830
	// Insert language text and messages
831
	$template->set_var(array(
832
					'TEXT_WEBSITE_TITLE' => $TEXT['WEBSITE_TITLE'],
833
					'TEXT_WEBSITE_DESCRIPTION' => $TEXT['WEBSITE_DESCRIPTION'],
834
					'TEXT_WEBSITE_KEYWORDS' => $TEXT['WEBSITE_KEYWORDS'],
835
					'TEXT_WEBSITE_HEADER' => $TEXT['WEBSITE_HEADER'],
836
					'TEXT_WEBSITE_FOOTER' => $TEXT['WEBSITE_FOOTER'],
837
					'TEXT_HEADER' => $TEXT['HEADER'],
838
					'TEXT_FOOTER' => $TEXT['FOOTER'],
839
					'TEXT_VISIBILITY' => $TEXT['VISIBILITY'],
840
					'TEXT_RESULTS_HEADER' => $TEXT['RESULTS_HEADER'],
841
					'TEXT_RESULTS_LOOP' => $TEXT['RESULTS_LOOP'],
842
					'TEXT_RESULTS_FOOTER' => $TEXT['RESULTS_FOOTER'],
843
					'TEXT_NO_RESULTS' => $TEXT['NO_RESULTS'],
844
					'TEXT_TEXT' => $TEXT['TEXT'],
845
					'TEXT_DEFAULT' => $TEXT['DEFAULT'],
846
					'TEXT_LANGUAGE' => $TEXT['LANGUAGE'],
847
					'TEXT_TIMEZONE' => $TEXT['TIMEZONE'],
848
					'TEXT_CHARSET' => $TEXT['CHARSET'],
849
					'TEXT_DATE_FORMAT' => $TEXT['DATE_FORMAT'],
850
					'TEXT_TIME_FORMAT' => $TEXT['TIME_FORMAT'],
851
					'TEXT_TEMPLATE' => $TEXT['TEMPLATE'],
852
					'TEXT_THEME' => $TEXT['THEME'],
853
					'TEXT_WYSIWYG_EDITOR' => $TEXT['WYSIWYG_EDITOR'],
854
					'TEXT_PAGE_LEVEL_LIMIT' => $TEXT['PAGE_LEVEL_LIMIT'],
855
					'TEXT_INTRO_PAGE' => $TEXT['INTRO_PAGE'],
856
					'TEXT_FRONTEND' => $TEXT['FRONTEND'],
857
					'TEXT_LOGIN' => $TEXT['LOGIN'],
858
					'TEXT_REDIRECT_AFTER' => $TEXT['REDIRECT_AFTER'],
859
					'TEXT_SIGNUP' => $TEXT['SIGNUP'].' '.$TEXT['GROUP'],
860
					'TEXT_PHP_ERROR_LEVEL' => $TEXT['PHP_ERROR_LEVEL'],
861
					'TEXT_MULTILINGUAL' => $TEXT['MULTILINGUAL'],
862
					'TEXT_DEV_INFOS' => $TEXT['DEV_INFOS'],
863
					'TEXT_PAGES_DIRECTORY' => $TEXT['PAGES_DIRECTORY'],
864
					'TEXT_PAGE_ICON_DIR' => $TEXT['PAGE_ICON_DIR'],
865
					'TEXT_MEDIA_DIRECTORY' => $TEXT['MEDIA_DIRECTORY'],
866
					'TEXT_PAGE_EXTENSION' => $TEXT['PAGE_EXTENSION'],
867
					'TEXT_PAGE_SPACER' => $TEXT['PAGE_SPACER'],
868
					'TEXT_RENAME_FILES_ON_UPLOAD' => $TEXT['RENAME_FILES_ON_UPLOAD'],
869
					'TEXT_APP_NAME' => $TEXT['APP_NAME'],
870
					'TEXT_SESSION_IDENTIFIER' => $TEXT['SESSION_IDENTIFIER'],
871
					'TEXT_SEC_ANCHOR' => $TEXT['SEC_ANCHOR'],
872
					'TEXT_SERVER_OPERATING_SYSTEM' => $TEXT['SERVER_OPERATING_SYSTEM'],
873
					'TEXT_LINUX_UNIX_BASED' => $TEXT['LINUX_UNIX_BASED'],
874
					'TEXT_WINDOWS' => $TEXT['WINDOWS'],
875
					'TEXT_ADMIN' => $TEXT['ADMIN'],
876
					'TEXT_TYPE' => $TEXT['TYPE'],
877
					'TEXT_DATABASE' => $TEXT['DATABASE'],
878
					'TEXT_HOST' => $TEXT['HOST'],
879
					'TEXT_USERNAME' => $TEXT['USERNAME'],
880
					'TEXT_PASSWORD' => $TEXT['PASSWORD'],
881
					'TEXT_NAME' => $TEXT['NAME'],
882
					'TEXT_TABLE_PREFIX' => $TEXT['TABLE_PREFIX'],
883
					'TEXT_SAVE' => $TEXT['SAVE'],
884
					'TEXT_RESET' => $TEXT['RESET'],
885
					'TEXT_CHANGES' => $TEXT['CHANGES'],
886
					'TEXT_ENABLED' => $TEXT['ENABLED'],
887
					'TEXT_DISABLED' => $TEXT['DISABLED'],
888
					'TEXT_MANAGE_SECTIONS' => $HEADING['MANAGE_SECTIONS'],
889
					'TEXT_MANAGE' => $TEXT['MANAGE'],
890
					'TEXT_SEARCH' => $TEXT['SEARCH'],
891
					'TEXT_PUBLIC' => $TEXT['PUBLIC'],
892
					'TEXT_PRIVATE' => $TEXT['PRIVATE'],
893
					'TEXT_REGISTERED' => $TEXT['REGISTERED'],
894
					'TEXT_NONE' => $TEXT['NONE'],
895
					'TEXT_FILES' => strtoupper(substr($TEXT['FILES'], 0, 1)).substr($TEXT['FILES'], 1),
896
					'TEXT_DIRECTORIES' => $TEXT['DIRECTORIES'],
897
					'TEXT_FILESYSTEM_PERMISSIONS' => $TEXT['FILESYSTEM_PERMISSIONS'],
898
					'TEXT_USER' => $TEXT['USER'],
899
					'TEXT_GROUP' => $TEXT['GROUP'],
900
					'TEXT_OTHERS' => $TEXT['OTHERS'],
901
					'TEXT_READ' => $TEXT['READ'],
902
					'TEXT_WRITE' => $TEXT['WRITE'],
903
					'TEXT_EXECUTE' => $TEXT['EXECUTE'],
904
					'TEXT_WARN_PAGE_LEAVE' => '',
905
					'TEXT_SMART_LOGIN' => $TEXT['SMART_LOGIN'],
906
					'TEXT_MULTIPLE_MENUS' => $TEXT['MULTIPLE_MENUS'],
907
					'TEXT_HOMEPAGE_REDIRECTION' => $TEXT['HOMEPAGE_REDIRECTION'],
908
					'TEXT_SECTION_BLOCKS' => $TEXT['SECTION_BLOCKS'],
909
					'TEXT_PLEASE_SELECT' => $TEXT['PLEASE_SELECT'],
910
					'TEXT_PAGE_TRASH' => $TEXT['PAGE_TRASH'],
911
					'TEXT_PAGE_LANGUAGES' => $TEXT['PAGE_LANGUAGES'],
912
					'TEXT_INLINE' => $TEXT['INLINE'],
913
					'TEXT_SEPARATE' => $TEXT['SEPARATE'],
914
					'TEXT_HOME_FOLDERS' => $TEXT['HOME_FOLDERS'],
915
					'TEXT_WYSIWYG_STYLE' => $TEXT['WYSIWYG_STYLE'],
916
					'TEXT_WORLD_WRITEABLE_FILE_PERMISSIONS' => $TEXT['WORLD_WRITEABLE_FILE_PERMISSIONS'],
917
					'MODE_SWITCH_WARNING' => $MESSAGE['SETTINGS_MODE_SWITCH_WARNING'],
918
					'WORLD_WRITEABLE_WARNING' => $MESSAGE['SETTINGS_WORLD_WRITEABLE_WARNING'],
919
					'TEXT_MODULE_ORDER' => $TEXT['MODULE_ORDER'],
920
					'TEXT_MAX_EXCERPT' => $TEXT['MAX_EXCERPT'],
921
					'TEXT_TIME_LIMIT' => $TEXT['TIME_LIMIT']
922
					));
923

    
924
if($is_advanced)
925
{
926
	$template->parse('show_page_level_limit', 'show_page_level_limit_block', true);
927
	$template->parse('show_checkbox_1',       'show_checkbox_1_block', true);
928
 	$template->parse('show_checkbox_2',       'show_checkbox_2_block', true);
929
	$template->parse('show_checkbox_3',       'show_checkbox_3_block', true);
930
	$template->parse('show_php_error_level',  'show_php_error_level_block', true);
931
	$template->parse('show_charset',          'show_charset_block', true);
932
	$template->parse('show_wysiwyg',          'show_wysiwyg_block', true);
933
	$template->parse('show_search',           'show_search_block', false);
934
	$template->parse('show_redirect_timer',   'show_redirect_timer_block', true);
935
}else {
936
	$template->set_block('show_page_level_limit', '');
937
	$template->set_block('show_checkbox_1', '');
938
	$template->set_block('show_checkbox_2', '');
939
	$template->set_block('show_checkbox_3', '');
940
	$template->set_block('show_php_error_level', '');
941
	$template->set_block('show_charset', '');
942
	$template->set_block('show_wysiwyg', '');
943
	$template->set_block('show_search', '');
944
	$template->set_block('show_redirect_timer', '');
945
}
946
if($is_advanced && $admin->get_user_id()=='1')
947
{
948
	$template->parse('show_access', 'show_access_block', true);
949
}else {
950
	$template->set_block('show_access', '');
951
}
952

    
953
// Parse template objects output
954
$template->parse('main', 'main_block', false);
955
$template->pparse('output', 'page');
956
unset($template);
957
$admin->print_footer();
(1-1/3)