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 1721 2012-08-29 17:00:22Z Luisehahne $
13
 * @filesource		$HeadURL: svn://isteam.dynxs.de/wb-archiv/branches/2.8.x/wb/admin/settings/index.php $
14
 * @lastmodified    $Date: 2012-08-29 19:00:22 +0200 (Wed, 29 Aug 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
	);
32
db_update_key_value( 'settings', $cfg );
33

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

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

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

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

    
62
$template->set_block('main_block', 'show_page_level_limit_block', 'show_page_level_limit');
63
$template->set_block('main_block', 'show_checkbox_1_block',       'show_checkbox_1');
64
$template->set_block('main_block', 'show_checkbox_2_block',       'show_checkbox_2');
65
$template->set_block('main_block', 'show_checkbox_3_block',       'show_checkbox_3');
66
$template->set_block('main_block', 'show_php_error_level_block',  'show_php_error_level');
67
$template->set_block('main_block', 'show_charset_block',          'show_charset');
68
$template->set_block('main_block', 'show_wysiwyg_block',          'show_wysiwyg');
69
$template->set_block('main_block', 'show_access_block',           'show_access');
70
$template->set_block('main_block', 'show_search_block',           'show_search');
71
$template->set_block('main_block', 'show_redirect_timer_block',   'show_redirect_timer');
72

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

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

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

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

    
106
	$query = "SELECT * FROM ".TABLE_PREFIX."search WHERE extra = ''";
107
	$results = $database->query($query);
108

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

    
158
	$sSelected = ' selected="selected"';
159
	$checked   = ' checked="checked"';
160
/*-- insert all needed vars from language files ----------------------------------------*/
161
	$template->set_var($mLang->getLangArray());
162

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

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

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

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

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

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

    
220

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

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

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

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

    
285

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

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

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

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

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

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

    
377

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

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

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

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

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

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

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

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

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

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

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

    
519
	// Work-out if manage sections feature is enabled
520
	if(MANAGE_SECTIONS)
521
	{
522
    	$template->set_var(array(
523
				'MANAGE_SECTIONS_ENABLED' => $checked,
524
				'MANAGE_SECTIONS_DISABLED' => '',
525
				));
526
	} else {
527
    	$template->set_var(array(
528
				'MANAGE_SECTIONS_DISABLED' => $checked,
529
				'MANAGE_SECTIONS_ENABLED' => '',
530
				));
531
	}
532

    
533
	// Work-out which wbmailer routine should be checked
534
	$template->set_var(array(
535
				'TEXT_WBMAILER_DEFAULT_SETTINGS_NOTICE' => $TEXT['WBMAILER_DEFAULT_SETTINGS_NOTICE'],
536
				'TEXT_WBMAILER_DEFAULT_SENDER_MAIL' => $TEXT['WBMAILER_DEFAULT_SENDER_MAIL'],
537
				'TEXT_WBMAILER_DEFAULT_SENDER_NAME' => $TEXT['WBMAILER_DEFAULT_SENDER_NAME'],
538
				'TEXT_WBMAILER_NOTICE' => $TEXT['WBMAILER_NOTICE'],
539
				'TEXT_WBMAILER_FUNCTION' => $TEXT['WBMAILER_FUNCTION'],
540
				'TEXT_WBMAILER_SMTP_HOST' => $TEXT['WBMAILER_SMTP_HOST'],
541
				'TEXT_WBMAILER_PHP' => $TEXT['WBMAILER_PHP'],
542
				'TEXT_WBMAILER_SMTP' => $TEXT['WBMAILER_SMTP'],
543
				'TEXT_WBMAILER_SMTP_AUTH' => $TEXT['WBMAILER_SMTP_AUTH'],
544
				'TEXT_WBMAILER_SMTP_AUTH_NOTICE' => $TEXT['REQUIRED'].' '.$TEXT['WBMAILER_SMTP_AUTH'],
545
				'TEXT_WBMAILER_SMTP_USERNAME' => $TEXT['WBMAILER_SMTP_USERNAME'],
546
				'TEXT_WBMAILER_SMTP_PASSWORD' => $TEXT['WBMAILER_SMTP_PASSWORD'],
547
				'SMTP_AUTH_SELECTED' => $checked
548
				));
549
	if(WBMAILER_ROUTINE == 'phpmail')
550
	{
551
		$template->set_var('PHPMAIL_SELECTED', $checked);
552
		$template->set_var('SMTP_VISIBILITY', ' style="display: none;"');
553
		$template->set_var('SMTP_VISIBILITY_AUTH', '');
554
		// $template->set_var('SMTP_AUTH_SELECTED', '');
555
	} elseif(WBMAILER_ROUTINE == 'smtp')
556
	{
557
		$template->set_var('SMTPMAIL_SELECTED', $checked);
558
		$template->set_var('SMTP_VISIBILITY', '');
559
		$template->set_var('SMTP_VISIBILITY_AUTH', '');
560
	}
561
/* deprecated
562
	// Work-out if SMTP authentification should be checked
563
	if(WBMAILER_SMTP_AUTH)
564
	{
565
		$template->set_var('SMTP_AUTH_SELECTED', $checked);
566
		if(WBMAILER_ROUTINE == 'smtp')
567
	    {
568
			$template->set_var('SMTP_VISIBILITY_AUTH', '');
569

    
570
		} else {
571
			$template->set_var('SMTP_VISIBILITY_AUTH', ' style="display: none;"');
572
		}
573
	} else {
574
		$template->set_var('SMTP_VISIBILITY_AUTH', ' style="display: none;"');
575
	}
576
*/
577
	// Work-out if intro feature is enabled
578
	if(INTRO_PAGE)
579
	{
580
    	$template->set_var(array(
581
				'INTRO_PAGE_ENABLED' => $checked,
582
				'INTRO_PAGE_DISABLED' => '',
583
				));
584
	} else {
585
    	$template->set_var(array(
586
				'INTRO_PAGE_DISABLED' => $checked,
587
				'INTRO_PAGE_ENABLED' => '',
588
				));
589
	}
590

    
591
	// Work-out if frontend login feature is enabled
592
	if(FRONTEND_LOGIN)
593
	{
594
    	$template->set_var(array(
595
				'PRIVATE_ENABLED' => $checked,
596
				'PRIVATE_DISABLED' => '',
597
				));
598
	} else {
599
    	$template->set_var(array(
600
				'PRIVATE_DISABLED' => $checked,
601
				'INTRO_PAGE_ENABLED' => '',
602
				));
603
	}
604
	// Work-out if frontend login feature is enabled
605

    
606
	if(CONFIRMED_REGISTRATION)
607
	{
608
    	$template->set_var(array(
609
				'CONFIRMED_REGISTRATION_ENABLED' => $checked,
610
				'CONFIRMED_REGISTRATION_DISABLED' => '',
611
				));
612
	} else {
613
    	$template->set_var(array(
614
				'CONFIRMED_REGISTRATION_DISABLED' => $checked,
615
				'CONFIRMED_REGISTRATION_ENABLED' => '',
616
				));
617
	}
618

    
619
	// Work-out if page trash feature is disabled, in-line, or separate
620
	if(PAGE_TRASH == 'disabled')
621
	{
622
//		$template->set_var('PAGE_TRASH_DISABLED', $checked);
623
//		$template->set_var('DISPLAY_PAGE_TRASH_SEPARATE', 'display: none;');
624
    	$template->set_var(array(
625
				'PAGE_TRASH_DISABLED' => $checked,
626
				'PAGE_TRASH_INLINE' => '',
627
				'DISPLAY_PAGE_TRASH_SEPARATE' => 'display: none;',
628
				));
629
	} elseif(PAGE_TRASH == 'inline')
630
	{
631
//		$template->set_var('PAGE_TRASH_INLINE', $checked);
632
//		$template->set_var('DISPLAY_PAGE_TRASH_SEPARATE', 'display: none;');
633
    	$template->set_var(array(
634
				'PAGE_TRASH_INLINE' => $checked,
635
				'PAGE_TRASH_DISABLED' => '',
636
				'DISPLAY_PAGE_TRASH_SEPARATE' => 'display: none;',
637
				));
638
	} elseif(PAGE_TRASH == 'separate')
639
	{
640
		$template->set_var('PAGE_TRASH_SEPARATE', $checked);
641
		$template->set_var('DISPLAY_PAGE_TRASH_SEPARATE', 'display: inline;');
642
	}
643

    
644
	// Work-out if media home folde feature is enabled
645
	if(HOME_FOLDERS)
646
	{
647
    	$template->set_var(array(
648
				'HOME_FOLDERS_ENABLED' => $checked,
649
				'HOME_FOLDERS_DISABLED' => '',
650
				));
651
	} else {
652
    	$template->set_var(array(
653
				'HOME_FOLDERS_DISABLED' => $checked,
654
				'HOME_FOLDERS_ENABLED' => '',
655
				));
656
	}
657

    
658
	// Insert search select
659
	if(SEARCH == 'private')
660
	{
661
    	$template->set_var(array(
662
				'PRIVATE_SEARCH' => $sSelected,
663
				'REGISTERED_SEARCH' => '',
664
				'NONE_SEARCH' => '',
665
				));
666
	} elseif(SEARCH == 'public') {
667
    	$template->set_var(array(
668
				'PRIVATE_SEARCH' => '',
669
				'REGISTERED_SEARCH' => '',
670
				'NONE_SEARCH' => '',
671
				));
672
	} elseif(SEARCH == 'registered') {
673
    	$template->set_var(array(
674
				'PRIVATE_SEARCH' => '',
675
				'REGISTERED_SEARCH' => $sSelected,
676
				'NONE_SEARCH' => '',
677
				));
678
	} elseif(SEARCH == 'none') {
679
    	$template->set_var(array(
680
				'PRIVATE_SEARCH' => '',
681
				'REGISTERED_SEARCH' => '',
682
				'NONE_SEARCH' => $sSelected,
683
				));
684
	}
685

    
686
	// Work-out if 777 permissions are set
687
	$template->set_var('WORLD_WRITEABLE_SELECTED', '');
688
	if(STRING_FILE_MODE == '0777' AND STRING_DIR_MODE == '0777')
689
	{
690
		$template->set_var('WORLD_WRITEABLE_SELECTED', $checked);
691
	}
692

    
693
	// Work-out which file mode boxes are checked
694
	if(extract_permission(STRING_FILE_MODE, 'u', 'r'))
695
	{
696
		$template->set_var('FILE_U_R_CHECKED', $checked);
697
	}
698
	if(extract_permission(STRING_FILE_MODE, 'u', 'w'))
699
	{
700
		$template->set_var('FILE_U_W_CHECKED', $checked);
701
	}
702
	if(extract_permission(STRING_FILE_MODE, 'u', 'e'))
703
	{
704
		$template->set_var('FILE_U_E_CHECKED', $checked);
705
	}
706
	if(extract_permission(STRING_FILE_MODE, 'g', 'r'))
707
	{
708
		$template->set_var('FILE_G_R_CHECKED', $checked);
709
	}
710
	if(extract_permission(STRING_FILE_MODE, 'g', 'w'))
711
	{
712
		$template->set_var('FILE_G_W_CHECKED', $checked);
713
	}
714
	if(extract_permission(STRING_FILE_MODE, 'g', 'e'))
715
	{
716
		$template->set_var('FILE_G_E_CHECKED', $checked);
717
	}
718
	if(extract_permission(STRING_FILE_MODE, 'o', 'r'))
719
	{
720
		$template->set_var('FILE_O_R_CHECKED', $checked);
721
	}
722
	if(extract_permission(STRING_FILE_MODE, 'o', 'w'))
723
	{
724
		$template->set_var('FILE_O_W_CHECKED', $checked);
725
	}
726
	if(extract_permission(STRING_FILE_MODE, 'o', 'e'))
727
	{
728
		$template->set_var('FILE_O_E_CHECKED', $checked);
729
	}
730
	// Work-out which dir mode boxes are checked
731
	if(extract_permission(STRING_DIR_MODE, 'u', 'r'))
732
	{
733
		$template->set_var('DIR_U_R_CHECKED', $checked);
734
	}
735
	if(extract_permission(STRING_DIR_MODE, 'u', 'w'))
736
	{
737
		$template->set_var('DIR_U_W_CHECKED', $checked);
738
	}
739
	if(extract_permission(STRING_DIR_MODE, 'u', 'e'))
740
	{
741
		$template->set_var('DIR_U_E_CHECKED', $checked);
742
	}
743
	if(extract_permission(STRING_DIR_MODE, 'g', 'r'))
744
	{
745
		$template->set_var('DIR_G_R_CHECKED', $checked);
746
	}
747
	if(extract_permission(STRING_DIR_MODE, 'g', 'w'))
748
	{
749
		$template->set_var('DIR_G_W_CHECKED', $checked);
750
	}
751
	if(extract_permission(STRING_DIR_MODE, 'g', 'e'))
752
	{
753
		$template->set_var('DIR_G_E_CHECKED', $checked);
754
	}
755
	if(extract_permission(STRING_DIR_MODE, 'o', 'r'))
756
	{
757
		$template->set_var('DIR_O_R_CHECKED', $checked);
758
	}
759
	if(extract_permission(STRING_DIR_MODE, 'o', 'w'))
760
	{
761
		$template->set_var('DIR_O_W_CHECKED', $checked);
762
	}
763
	if(extract_permission(STRING_DIR_MODE, 'o', 'e'))
764
	{
765
		$template->set_var('DIR_O_E_CHECKED', $checked);
766
	}
767

    
768
	$template->set_var(array(
769
						'PAGES_DIRECTORY' => PAGES_DIRECTORY,
770
						'PAGE_ICON_DIR'   => PAGE_ICON_DIR,
771
						'MEDIA_DIRECTORY' => MEDIA_DIRECTORY,
772
						'PAGE_EXTENSION' => PAGE_EXTENSION,
773
						'PAGE_SPACER' => PAGE_SPACER,
774
						'TABLE_PREFIX' => TABLE_PREFIX
775
					 ));
776

    
777
	// Insert Server Email value into template
778
	$template->set_var('SERVER_EMAIL', SERVER_EMAIL);
779

    
780
	// Insert groups into signup list
781
	$results = $database->query("SELECT group_id, name FROM ".TABLE_PREFIX."groups WHERE group_id != '1'");
782
	if($results->numRows() > 0)
783
	{
784
		while($group = $results->fetchRow())
785
	    {
786
			$template->set_var('ID', $group['group_id']);
787
			$template->set_var('NAME', $group['name']);
788
			if(FRONTEND_SIGNUP == $group['group_id'])
789
	        {
790
				$template->set_var('SELECTED', $sSelected);
791
			} else {
792
				$template->set_var('SELECTED', '');
793
			}
794
			$template->parse('group_list', 'group_list_block', true);
795
		}
796
	} else {
797
		$template->set_var('ID', 'disabled');
798
		$template->set_var('NAME', $MESSAGE['GROUPS']['NO_GROUPS_FOUND']);
799
		$template->parse('group_list', 'group_list_block', true);
800
	}
801

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

    
907
if($is_advanced)
908
{
909
	$template->parse('show_page_level_limit', 'show_page_level_limit_block', true);
910
	$template->parse('show_checkbox_1',       'show_checkbox_1_block', true);
911
 	$template->parse('show_checkbox_2',       'show_checkbox_2_block', true);
912
	$template->parse('show_checkbox_3',       'show_checkbox_3_block', true);
913
	$template->parse('show_php_error_level',  'show_php_error_level_block', true);
914
	$template->parse('show_charset',          'show_charset_block', true);
915
	$template->parse('show_wysiwyg',          'show_wysiwyg_block', true);
916
	$template->parse('show_search',           'show_search_block', false);
917
	$template->parse('show_redirect_timer',   'show_redirect_timer_block', true);
918
}else {
919
	$template->set_block('show_page_level_limit', '');
920
	$template->set_block('show_checkbox_1', '');
921
	$template->set_block('show_checkbox_2', '');
922
	$template->set_block('show_checkbox_3', '');
923
	$template->set_block('show_php_error_level', '');
924
	$template->set_block('show_charset', '');
925
	$template->set_block('show_wysiwyg', '');
926
	$template->set_block('show_search', '');
927
	$template->set_block('show_redirect_timer', '');
928
}
929
if($is_advanced && $admin->get_user_id()=='1')
930
{
931
	$template->parse('show_access', 'show_access_block', true);
932
}else {
933
	$template->set_block('show_access', '');
934
}
935

    
936
// Parse template objects output
937
$template->parse('main', 'main_block', false);
938
$template->pparse('output', 'page');
939

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