Project

General

Profile

« Previous | Next » 

Revision 1289

Added by kweitzel almost 15 years ago

Branch 2.8.1 merged back into Trunk

View differences:

index.php
1
<?php
2

  
3
// $Id$
4

  
5
/*
6

  
7
 Website Baker Project <http://www.websitebaker.org/>
8
 Copyright (C) 2004-2009, Ryan Djurovich
9

  
10
 Website Baker is free software; you can redistribute it and/or modify
11
 it under the terms of the GNU General Public License as published by
12
 the Free Software Foundation; either version 2 of the License, or
13
 (at your option) any later version.
14

  
15
 Website Baker is distributed in the hope that it will be useful,
16
 but WITHOUT ANY WARRANTY; without even the implied warranty of
17
 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18
 GNU General Public License for more details.
19

  
20
 You should have received a copy of the GNU General Public License
21
 along with Website Baker; if not, write to the Free Software
22
 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
23

  
24
*/
25

  
26
require('../../config.php');
27
require_once(WB_PATH.'/framework/class.admin.php');
28
if(isset($_GET['advanced']) AND $_GET['advanced'] == 'yes') {
29
	$admin = new admin('Settings', 'settings_advanced');
30
} else {
31
	$admin = new admin('Settings', 'settings_basic');
32
}
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
// Create new template object
39
$template = new Template(THEME_PATH.'/templates');
40
$template->set_file('page', 'settings.htt');
41
$template->set_block('page', 'main_block', 'main');
42

  
43
// Query current settings in the db, then loop through them and print them
44
$query = "SELECT * FROM ".TABLE_PREFIX."settings";
45
$results = $database->query($query);
46
while($setting = $results->fetchRow()) {
47
	$setting_name = $setting['name'];
48
	$setting_value = ( $setting_name != 'wbmailer_smtp_password' ) ? htmlspecialchars($setting['value']) : $setting['value'];
49
	$template->set_var(strtoupper($setting_name),$setting_value);
50
}
51

  
52
// Query current settings in the db, then loop through them and print them
53
$query = "SELECT * FROM ".TABLE_PREFIX."search WHERE extra = ''";
54
$results = $database->query($query);
55
while($setting = $results->fetchRow()) {
56
	$setting_name = $setting['name'];
57
	$setting_value = htmlspecialchars(($setting['value']));
58
	switch($setting_name) {
59
		// Search header
60
		case 'header':
61
			$template->set_var('SEARCH_HEADER', $setting_value);
62
		break;
63
		// Search results header
64
		case 'results_header':
65
			$template->set_var('SEARCH_RESULTS_HEADER', $setting_value);
66
		break;
67
		// Search results loop
68
		case 'results_loop':
69
			$template->set_var('SEARCH_RESULTS_LOOP', $setting_value);
70
		break;
71
		// Search results footer
72
		case 'results_footer':
73
			$template->set_var('SEARCH_RESULTS_FOOTER', $setting_value);
74
		break;
75
		// Search no results
76
		case 'no_results':
77
			$template->set_var('SEARCH_NO_RESULTS', $setting_value);
78
		break;
79
		// Search footer
80
		case 'footer':
81
			$template->set_var('SEARCH_FOOTER', $setting_value);
82
		break;
83
		// Search module-order
84
		case 'module_order':
85
			$template->set_var('SEARCH_MODULE_ORDER', $setting_value);
86
		break;
87
		// Search max lines of excerpt
88
		case 'max_excerpt':
89
			$template->set_var('SEARCH_MAX_EXCERPT', $setting_value);
90
		break;
91
		// time-limit
92
		case 'time_limit':
93
			$template->set_var('SEARCH_TIME_LIMIT', $setting_value);
94
		break;
95
		// Search template
96
		case 'template':
97
			$search_template = $setting_value;
98
		break;
99
	}
100
}
101

  
102
// Do the same for settings stored in config file as with ones in db
103
$database_type = '';
104

  
105
// Tell the browser whether or not to show advanced options
106
if(isset($_GET['advanced']) AND $_GET['advanced'] == 'yes') {
107
	$template->set_var('DISPLAY_ADVANCED', '');
108
	$template->set_var('ADVANCED', 'yes');
109
	$template->set_var('ADVANCED_BUTTON', '&lt;&lt; '.$TEXT['HIDE_ADVANCED']);
110
	$template->set_var('ADVANCED_LINK', 'index.php?advanced=no');
111
	$template->set_var('BASIC_FILE_PERMS_ID', 'hide');
112
	$template->set_var('ADVANCED_FILE_PERMS_ID', 'file_perms_box');
113
} else {
114
	$template->set_var('DISPLAY_ADVANCED', ' style="display: none;"');
115
	$template->set_var('ADVANCED', 'no');
116
	$template->set_var('ADVANCED_BUTTON', $TEXT['SHOW_ADVANCED'].' &gt;&gt;');
117
	$template->set_var('ADVANCED_LINK', 'index.php?advanced=yes');
118
	$template->set_var('BASIC_FILE_PERMS_ID', 'file_perms_box');
119
	$template->set_var('ADVANCED_FILE_PERMS_ID', 'hide');
120
}
121

  
122
$template->set_var(array(	
123
									'PAGES_DIRECTORY' => PAGES_DIRECTORY,
124
									'MEDIA_DIRECTORY' => MEDIA_DIRECTORY,
125
									'PAGE_EXTENSION' => PAGE_EXTENSION,
126
									'PAGE_SPACER' => PAGE_SPACER,
127
									'WB_PATH' => WB_PATH,
128
									'WB_URL' => WB_URL,
129
									'THEME_URL' => THEME_URL,
130
									'ADMIN_PATH' => ADMIN_PATH,
131
									'ADMIN_URL' => ADMIN_URL,
132
									'DATABASE_TYPE' => DB_TYPE,
133
									'DATABASE_HOST' => DB_HOST,
134
									'DATABASE_USERNAME' => DB_USERNAME,
135
									'DATABASE_NAME' => DB_NAME,
136
									'TABLE_PREFIX' => TABLE_PREFIX
137
								 )
138
						 );
139

  
140
// Insert language values
141
$template->set_block('main_block', 'language_list_block', 'language_list');
142
$result = $database->query("SELECT * FROM ".TABLE_PREFIX."addons WHERE type = 'language' order by name");
143
if($result->numRows() > 0) {
144
	while($addon = $result->fetchRow()) {
145
		$l_codes[$addon['name']] = $addon['directory'];
146
		$l_names[$addon['name']] = entities_to_7bit($addon['name']); // sorting-problem workaround
147
	}
148
	asort($l_names);
149
	foreach($l_names as $l_name=>$v) {
150
		// Insert code and name
151
		$template->set_var(array(
152
								'CODE' => $l_codes[$l_name],
153
								'NAME' => $l_name,
154
								'FLAG' => THEME_URL.'/images/flags/'.strtolower($l_codes[$l_name]),
155
								));
156
		// Check if it is selected
157
		if(DEFAULT_LANGUAGE == $l_codes[$l_name]) {
158
			$template->set_var('SELECTED', ' selected="selected"');
159
		} else {
160
			$template->set_var('SELECTED', '');
161
		}
162
		$template->parse('language_list', 'language_list_block', true);
163
	}
164
}
165

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

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

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

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

  
235
// Insert templates
236
$template->set_block('main_block', 'template_list_block', 'template_list');
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
$template->set_block('main_block', 'theme_list_block', 'theme_list');
250
$result = $database->query("SELECT * FROM ".TABLE_PREFIX."addons WHERE type = 'template' AND function = 'theme' order by name");
251
if($result->numRows() > 0) {
252
	while($addon = $result->fetchRow()) {
253
		$template->set_var('FILE', $addon['directory']);
254
		$template->set_var('NAME', $addon['name']);
255
		if(($addon['directory'] == DEFAULT_THEME) ? $selected = ' selected="selected"' : $selected = '');
256
		$template->set_var('SELECTED', $selected);
257
		$template->parse('theme_list', 'theme_list_block', true);
258
	}
259
}
260

  
261
// Insert WYSIWYG modules
262
$template->set_block('main_block', 'editor_list_block', 'editor_list');
263
$file='none';  
264
$module_name=$TEXT['NONE'];  
265
$template->set_var('FILE', $file);  
266
$template->set_var('NAME', $module_name);  
267
if((!defined('WYSIWYG_EDITOR') OR $file == WYSIWYG_EDITOR) ? $selected = ' selected="selected"' : $selected = '');
268
$template->set_var('SELECTED', $selected);
269
$template->parse('editor_list', 'editor_list_block', true);  
270
$result = $database->query("SELECT * FROM ".TABLE_PREFIX."addons WHERE type = 'module' AND function = 'wysiwyg'");
271
if($result->numRows() > 0) {
272
	while($addon = $result->fetchRow()) {
273
		$template->set_var('FILE', $addon['directory']);
274
		$template->set_var('NAME', $addon['name']);
275
		if((defined('WYSIWYG_EDITOR') AND $addon['directory'] == WYSIWYG_EDITOR) ? $selected = ' selected="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
$template->set_block('main_block', 'search_template_list_block', 'search_template_list');
283
if($search_template == '') { $selected = ' selected="selected"'; } else { $selected = ''; }
284
$template->set_var(array('FILE' => '', 'NAME' => $TEXT['SYSTEM_DEFAULT'], 'SELECTED' => $selected));
285
$template->parse('search_template_list', 'search_template_list_block', true);
286
$result = $database->query("SELECT * FROM ".TABLE_PREFIX."addons WHERE type = 'template' order by name");
287
if($result->numRows() > 0) {
288
	while($addon = $result->fetchRow()) {
289
		$template->set_var('FILE', $addon['directory']);
290
		$template->set_var('NAME', $addon['name']);
291
		if($addon['directory'] == $search_template ? $selected = ' selected="selected"' : $selected = '');
292
		$template->set_var('SELECTED', $selected);
293
		$template->parse('search_template_list', 'search_template_list_block', true);
294
	}
295
}
296

  
297
// Insert default error reporting values
298
require(ADMIN_PATH.'/interface/er_levels.php');
299
$template->set_block('main_block', 'error_reporting_list_block', 'error_reporting_list');
300
foreach($ER_LEVELS AS $value => $title) {
301
	$template->set_var('VALUE', $value);
302
	$template->set_var('NAME', $title);
303
	if(ER_LEVEL == $value) {
304
		$template->set_var('SELECTED', ' selected="selected"');
305
	} else {
306
		$template->set_var('SELECTED', '');
307
	}
308
	$template->parse('error_reporting_list', 'error_reporting_list_block', true);
309
}
310

  
311
// Insert permissions values
312
if($admin->get_permission('settings_advanced') != true) {
313
	$template->set_var('DISPLAY_ADVANCED_BUTTON', 'hide');
314
}
315

  
316
// Insert page level limits
317
$template->set_block('main_block', 'page_level_limit_list_block', 'page_level_limit_list');
318
for($i = 1; $i <= 10; $i++) {
319
	$template->set_var('NUMBER', $i);
320
	if(PAGE_LEVEL_LIMIT == $i) {
321
		$template->set_var('SELECTED', ' selected="selected"');
322
	} else {
323
		$template->set_var('SELECTED', '');
324
	}
325
	$template->parse('page_level_limit_list', 'page_level_limit_list_block', true);
326
}
327

  
328
// Work-out if multiple menus feature is enabled
329
if(defined('MULTIPLE_MENUS') AND MULTIPLE_MENUS == true) {
330
	$template->set_var('MULTIPLE_MENUS_ENABLED', ' checked="checked"');
331
} else {
332
	$template->set_var('MULTIPLE_MENUS_DISABLED', ' checked="checked"');
333
}
334

  
335
// Work-out if page languages feature is enabled
336
if(defined('PAGE_LANGUAGES') AND PAGE_LANGUAGES == true) {
337
        $template->set_var('PAGE_LANGUAGES_ENABLED', ' checked="checked"');
338
} else {
339
        $template->set_var('PAGE_LANGUAGES_DISABLED', ' checked="checked"');
340
}
341

  
342
// Work-out if smart login feature is enabled
343
if(defined('SMART_LOGIN') AND SMART_LOGIN == true) {
344
	$template->set_var('SMART_LOGIN_ENABLED', ' checked="checked"');
345
} else {
346
	$template->set_var('SMART_LOGIN_DISABLED', ' checked="checked"');
347
}
348

  
349
if(extension_loaded('gd') AND function_exists('imageCreateFromJpeg')) { /* Make's sure GD library is installed */
350
	$template->set_var('GD_EXTENSION_ENABLED', '');
351
} else {
352
	$template->set_var('GD_EXTENSION_ENABLED', 'none');
353
}
354

  
355
// Work-out if section blocks feature is enabled
356
if(defined('SECTION_BLOCKS') AND SECTION_BLOCKS == true) {
357
	$template->set_var('SECTION_BLOCKS_ENABLED', ' checked="checked"');
358
} else {
359
	$template->set_var('SECTION_BLOCKS_DISABLED', ' checked="checked"');
360
}
361

  
362
// Work-out if homepage redirection feature is enabled
363
if(defined('HOMEPAGE_REDIRECTION') AND HOMEPAGE_REDIRECTION == true) {
364
	$template->set_var('HOMEPAGE_REDIRECTION_ENABLED', ' checked="checked"');
365
} else {
366
	$template->set_var('HOMEPAGE_REDIRECTION_DISABLED', ' checked="checked"');
367
}
368

  
369
// Work-out which server os should be checked
370
if(OPERATING_SYSTEM == 'linux') {
371
	$template->set_var('LINUX_SELECTED', ' checked="checked"');
372
} elseif(OPERATING_SYSTEM == 'windows') {
373
	$template->set_var('WINDOWS_SELECTED', ' checked="checked"');
374
}
375

  
376
// Work-out if manage sections feature is enabled
377
if(MANAGE_SECTIONS) {
378
	$template->set_var('MANAGE_SECTIONS_ENABLED', ' checked="checked"');
379
} else {
380
	$template->set_var('MANAGE_SECTIONS_DISABLED', ' checked="checked"');
381
}
382

  
383
// Work-out which wbmailer routine should be checked
384
if(WBMAILER_ROUTINE == 'phpmail') {
385
	$template->set_var('PHPMAIL_SELECTED', ' checked="checked"');
386
	$template->set_var('SMTP_VISIBILITY', 'none');
387
	$template->set_var('SMTP_VISIBILITY_AUTH', 'none');
388
} elseif(WBMAILER_ROUTINE == 'smtp') {
389
	$template->set_var('SMTPMAIL_SELECTED', ' checked="checked"');
390
	$template->set_var('SMTP_VISIBILITY', '');
391
}
392

  
393
// Work-out if SMTP authentification should be checked
394
if(WBMAILER_SMTP_AUTH) {
395
	$template->set_var('SMTP_AUTH_SELECTED', ' checked="checked"');
396
	if(WBMAILER_ROUTINE == 'smtp') {
397
		$template->set_var('SMTP_VISIBILITY_AUTH', '');
398
	} else {
399
		$template->set_var('SMTP_VISIBILITY_AUTH', 'none');
400
	}
401
} else {
402
	$template->set_var('SMTP_VISIBILITY_AUTH', 'none');
403
}
404

  
405
// Work-out if intro feature is enabled
406
if(INTRO_PAGE) {
407
	$template->set_var('INTRO_PAGE_ENABLED', ' checked="checked"');
408
} else {
409
	$template->set_var('INTRO_PAGE_DISABLED', ' checked="checked"');
410
}
411

  
412
// Work-out if frontend login feature is enabled
413
if(FRONTEND_LOGIN) {
414
	$template->set_var('PRIVATE_ENABLED', ' checked="checked"');
415
} else {
416
	$template->set_var('PRIVATE_DISABLED', ' checked="checked"');
417
}
418

  
419
// Work-out if page trash feature is disabled, in-line, or separate
420
if(PAGE_TRASH == 'disabled') {
421
	$template->set_var('PAGE_TRASH_DISABLED', ' checked="checked"');
422
	$template->set_var('DISPLAY_PAGE_TRASH_SEPARATE', ' display: none;');
423
} elseif(PAGE_TRASH == 'inline') {
424
	$template->set_var('PAGE_TRASH_INLINE', ' checked="checked"');
425
	$template->set_var('DISPLAY_PAGE_TRASH_SEPARATE', ' display: none;');
426
} elseif(PAGE_TRASH == 'separate') {
427
	$template->set_var('PAGE_TRASH_SEPARATE', ' checked="checked"');
428
	$template->set_var('DISPLAY_PAGE_TRASH_SEPARATE', ' display: inline;');
429
}
430

  
431
// Work-out if media home folde feature is enabled
432
if(HOME_FOLDERS) {
433
	$template->set_var('HOME_FOLDERS_ENABLED', ' checked="checked"');
434
} else {
435
	$template->set_var('HOME_FOLDERS_DISABLED', ' checked="checked"');
436
}
437

  
438
// Insert search select
439
if(SEARCH == 'private') {
440
	$template->set_var('PRIVATE_SEARCH', ' selected="selected"');
441
} elseif(SEARCH == 'registered') {
442
	$template->set_var('REGISTERED_SEARCH', ' selected="selected"');
443
} elseif(SEARCH == 'none') {
444
	$template->set_var('NONE_SEARCH', ' selected="selected"');
445
}
446

  
447
// Work-out if 777 permissions are set
448
if(STRING_FILE_MODE == '0777' AND STRING_DIR_MODE == '0777') {
449
	$template->set_var('WORLD_WRITEABLE_SELECTED', ' checked="checked"');
450
}
451

  
452
// Work-out which file mode boxes are checked
453
if(extract_permission(STRING_FILE_MODE, 'u', 'r')) {
454
	$template->set_var('FILE_U_R_CHECKED', ' checked="checked"');
455
}
456
if(extract_permission(STRING_FILE_MODE, 'u', 'w')) {
457
	$template->set_var('FILE_U_W_CHECKED', ' checked="checked"');
458
}
459
if(extract_permission(STRING_FILE_MODE, 'u', 'e')) {
460
	$template->set_var('FILE_U_E_CHECKED', ' checked="checked"');
461
}
462
if(extract_permission(STRING_FILE_MODE, 'g', 'r')) {
463
	$template->set_var('FILE_G_R_CHECKED', ' checked="checked"');
464
}
465
if(extract_permission(STRING_FILE_MODE, 'g', 'w')) {
466
	$template->set_var('FILE_G_W_CHECKED', ' checked="checked"');
467
}
468
if(extract_permission(STRING_FILE_MODE, 'g', 'e')) {
469
	$template->set_var('FILE_G_E_CHECKED', ' checked="checked"');
470
}
471
if(extract_permission(STRING_FILE_MODE, 'o', 'r')) {
472
	$template->set_var('FILE_O_R_CHECKED', ' checked="checked"');
473
}
474
if(extract_permission(STRING_FILE_MODE, 'o', 'w')) {
475
	$template->set_var('FILE_O_W_CHECKED', ' checked="checked"');
476
}
477
if(extract_permission(STRING_FILE_MODE, 'o', 'e')) {
478
	$template->set_var('FILE_O_E_CHECKED', ' checked="checked"');
479
}
480
// Work-out which dir mode boxes are checked
481
if(extract_permission(STRING_DIR_MODE, 'u', 'r')) {
482
	$template->set_var('DIR_U_R_CHECKED', ' checked="checked"');
483
}
484
if(extract_permission(STRING_DIR_MODE, 'u', 'w')) {
485
	$template->set_var('DIR_U_W_CHECKED', ' checked="checked"');
486
}
487
if(extract_permission(STRING_DIR_MODE, 'u', 'e')) {
488
	$template->set_var('DIR_U_E_CHECKED', ' checked="checked"');
489
}
490
if(extract_permission(STRING_DIR_MODE, 'g', 'r')) {
491
	$template->set_var('DIR_G_R_CHECKED', ' checked="checked"');
492
}
493
if(extract_permission(STRING_DIR_MODE, 'g', 'w')) {
494
	$template->set_var('DIR_G_W_CHECKED', ' checked="checked"');
495
}
496
if(extract_permission(STRING_DIR_MODE, 'g', 'e')) {
497
	$template->set_var('DIR_G_E_CHECKED', ' checked="checked"');
498
}
499
if(extract_permission(STRING_DIR_MODE, 'o', 'r')) {
500
	$template->set_var('DIR_O_R_CHECKED', ' checked="checked"');
501
}
502
if(extract_permission(STRING_DIR_MODE, 'o', 'w')) {
503
	$template->set_var('DIR_O_W_CHECKED', ' checked="checked"');
504
}
505
if(extract_permission(STRING_DIR_MODE, 'o', 'e')) {
506
	$template->set_var('DIR_O_E_CHECKED', ' checked="checked"');
507
}
508

  
509
// Insert Server Email value into template
510
$template->set_var('SERVER_EMAIL', SERVER_EMAIL);
511

  
512
// Insert groups into signup list
513
$template->set_block('main_block', 'group_list_block', 'group_list');
514
$results = $database->query("SELECT group_id, name FROM ".TABLE_PREFIX."groups WHERE group_id != '1'");
515
if($results->numRows() > 0) {
516
	while($group = $results->fetchRow()) {
517
		$template->set_var('ID', $group['group_id']);
518
		$template->set_var('NAME', $group['name']);
519
		if(FRONTEND_SIGNUP == $group['group_id']) {
520
			$template->set_var('SELECTED', ' selected="selected"');
521
		} else {
522
			$template->set_var('SELECTED', '');
523
		}
524
		$template->parse('group_list', 'group_list_block', true);
525
	}
526
} else {
527
	$template->set_var('ID', 'disabled');
528
	$template->set_var('NAME', $MESSAGE['GROUPS']['NO_GROUPS_FOUND']);
529
	$template->parse('group_list', 'group_list_block', true);
530
}
531

  
532
// Insert language headings
533
$template->set_var(array(
534
								'HEADING_GENERAL_SETTINGS' => $HEADING['GENERAL_SETTINGS'],
535
								'HEADING_DEFAULT_SETTINGS' => $HEADING['DEFAULT_SETTINGS'],
536
								'HEADING_SEARCH_SETTINGS' => $HEADING['SEARCH_SETTINGS'],
537
								'HEADING_SERVER_SETTINGS' => $HEADING['SERVER_SETTINGS'],
538
								'HEADING_WBMAILER_SETTINGS' => $HEADING['WBMAILER_SETTINGS'],
539
								'HEADING_ADMINISTRATION_TOOLS' => $HEADING['ADMINISTRATION_TOOLS']
540
								)
541
						);
542
// Insert language text and messages
543
$template->set_var(array(
544
								'TEXT_WEBSITE_TITLE' => $TEXT['WEBSITE_TITLE'],
545
								'TEXT_WEBSITE_DESCRIPTION' => $TEXT['WEBSITE_DESCRIPTION'],
546
								'TEXT_WEBSITE_KEYWORDS' => $TEXT['WEBSITE_KEYWORDS'],
547
								'TEXT_WEBSITE_HEADER' => $TEXT['WEBSITE_HEADER'],
548
								'TEXT_WEBSITE_FOOTER' => $TEXT['WEBSITE_FOOTER'],
549
								'TEXT_HEADER' => $TEXT['HEADER'],
550
								'TEXT_FOOTER' => $TEXT['FOOTER'],
551
								'TEXT_VISIBILITY' => $TEXT['VISIBILITY'],
552
								'TEXT_RESULTS_HEADER' => $TEXT['RESULTS_HEADER'],
553
								'TEXT_RESULTS_LOOP' => $TEXT['RESULTS_LOOP'],
554
								'TEXT_RESULTS_FOOTER' => $TEXT['RESULTS_FOOTER'],
555
								'TEXT_NO_RESULTS' => $TEXT['NO_RESULTS'],
556
								'TEXT_TEXT' => $TEXT['TEXT'],
557
								'TEXT_DEFAULT' => $TEXT['DEFAULT'],
558
								'TEXT_LANGUAGE' => $TEXT['LANGUAGE'],
559
								'TEXT_TIMEZONE' => $TEXT['TIMEZONE'],
560
								'TEXT_CHARSET' => $TEXT['CHARSET'],
561
								'TEXT_DATE_FORMAT' => $TEXT['DATE_FORMAT'],
562
								'TEXT_TIME_FORMAT' => $TEXT['TIME_FORMAT'],
563
								'TEXT_TEMPLATE' => $TEXT['TEMPLATE'],
564
								'TEXT_THEME' => $TEXT['THEME'],
565
								'TEXT_WYSIWYG_EDITOR' => $TEXT['WYSIWYG_EDITOR'],
566
								'TEXT_PAGE_LEVEL_LIMIT' => $TEXT['PAGE_LEVEL_LIMIT'],
567
								'TEXT_INTRO_PAGE' => $TEXT['INTRO_PAGE'],
568
								'TEXT_FRONTEND' => $TEXT['FRONTEND'],
569
								'TEXT_LOGIN' => $TEXT['LOGIN'],
570
								'TEXT_REDIRECT_AFTER' => $TEXT['REDIRECT_AFTER'],
571
								'TEXT_SIGNUP' => $TEXT['SIGNUP'],
572
								'TEXT_PHP_ERROR_LEVEL' => $TEXT['PHP_ERROR_LEVEL'],
573
								'TEXT_PAGES_DIRECTORY' => $TEXT['PAGES_DIRECTORY'],
574
								'TEXT_MEDIA_DIRECTORY' => $TEXT['MEDIA_DIRECTORY'],
575
								'TEXT_PAGE_EXTENSION' => $TEXT['PAGE_EXTENSION'],
576
								'TEXT_PAGE_SPACER' => $TEXT['PAGE_SPACER'],
577
								'TEXT_RENAME_FILES_ON_UPLOAD' => $TEXT['RENAME_FILES_ON_UPLOAD'],
578
								'TEXT_APP_NAME' => $TEXT['APP_NAME'],
579
								'TEXT_SESSION_IDENTIFIER' => $TEXT['SESSION_IDENTIFIER'],
580
								'TEXT_SEC_ANCHOR' => $TEXT['SEC_ANCHOR'],
581
								'TEXT_SERVER_OPERATING_SYSTEM' => $TEXT['SERVER_OPERATING_SYSTEM'],
582
								'TEXT_LINUX_UNIX_BASED' => $TEXT['LINUX_UNIX_BASED'],
583
								'TEXT_WINDOWS' => $TEXT['WINDOWS'],
584
								'TEXT_ADMIN' => $TEXT['ADMIN'],
585
								'TEXT_TYPE' => $TEXT['TYPE'],
586
								'TEXT_DATABASE' => $TEXT['DATABASE'],
587
								'TEXT_HOST' => $TEXT['HOST'],
588
								'TEXT_USERNAME' => $TEXT['USERNAME'],
589
								'TEXT_PASSWORD' => $TEXT['PASSWORD'],
590
								'TEXT_NAME' => $TEXT['NAME'],
591
								'TEXT_TABLE_PREFIX' => $TEXT['TABLE_PREFIX'],
592
								'TEXT_SAVE' => $TEXT['SAVE'],
593
								'TEXT_RESET' => $TEXT['RESET'],
594
								'TEXT_CHANGES' => $TEXT['CHANGES'],
595
								'TEXT_ENABLED' => $TEXT['ENABLED'],
596
								'TEXT_DISABLED' => $TEXT['DISABLED'],
597
								'TEXT_MANAGE_SECTIONS' => $HEADING['MANAGE_SECTIONS'],
598
								'TEXT_MANAGE' => $TEXT['MANAGE'],
599
								'TEXT_SEARCH' => $TEXT['SEARCH'],
600
								'TEXT_PUBLIC' => $TEXT['PUBLIC'],
601
								'TEXT_PRIVATE' => $TEXT['PRIVATE'],
602
								'TEXT_REGISTERED' => $TEXT['REGISTERED'],
603
								'TEXT_NONE' => $TEXT['NONE'],
604
								'TEXT_FILES' => strtoupper(substr($TEXT['FILES'], 0, 1)).substr($TEXT['FILES'], 1),
605
								'TEXT_DIRECTORIES' => $TEXT['DIRECTORIES'],
606
								'TEXT_FILESYSTEM_PERMISSIONS' => $TEXT['FILESYSTEM_PERMISSIONS'],
607
								'TEXT_USER' => $TEXT['USER'],
608
								'TEXT_GROUP' => $TEXT['GROUP'],
609
								'TEXT_OTHERS' => $TEXT['OTHERS'],
610
								'TEXT_READ' => $TEXT['READ'],
611
								'TEXT_WRITE' => $TEXT['WRITE'],
612
								'TEXT_EXECUTE' => $TEXT['EXECUTE'],
613
								'TEXT_SMART_LOGIN' => $TEXT['SMART_LOGIN'],
614
								'TEXT_MULTIPLE_MENUS' => $TEXT['MULTIPLE_MENUS'],
615
								'TEXT_HOMEPAGE_REDIRECTION' => $TEXT['HOMEPAGE_REDIRECTION'],
616
								'TEXT_SECTION_BLOCKS' => $TEXT['SECTION_BLOCKS'],
617
								'TEXT_PLEASE_SELECT' => $TEXT['PLEASE_SELECT'],
618
								'TEXT_PAGE_TRASH' => $TEXT['PAGE_TRASH'],
619
								'TEXT_PAGE_LANGUAGES' => $TEXT['PAGE_LANGUAGES'],
620
								'TEXT_INLINE' => $TEXT['INLINE'],
621
								'TEXT_SEPARATE' => $TEXT['SEPARATE'],
622
								'TEXT_HOME_FOLDERS' => $TEXT['HOME_FOLDERS'],
623
								'TEXT_WYSIWYG_STYLE' => $TEXT['WYSIWYG_STYLE'],
624
								'TEXT_WORLD_WRITEABLE_FILE_PERMISSIONS' => $TEXT['WORLD_WRITEABLE_FILE_PERMISSIONS'],
625
								'TEXT_WBMAILER_DEFAULT_SETTINGS_NOTICE' => $TEXT['WBMAILER_DEFAULT_SETTINGS_NOTICE'],
626
								'TEXT_WBMAILER_DEFAULT_SENDER_MAIL' => $TEXT['WBMAILER_DEFAULT_SENDER_MAIL'],
627
								'TEXT_WBMAILER_DEFAULT_SENDER_NAME' => $TEXT['WBMAILER_DEFAULT_SENDER_NAME'],
628
								'TEXT_WBMAILER_NOTICE' => $TEXT['WBMAILER_NOTICE'],
629
								'TEXT_WBMAILER_FUNCTION' => $TEXT['WBMAILER_FUNCTION'],
630
								'TEXT_WBMAILER_SMTP_HOST' => $TEXT['WBMAILER_SMTP_HOST'],
631
								'TEXT_WBMAILER_PHP' => $TEXT['WBMAILER_PHP'],
632
								'TEXT_WBMAILER_SMTP' => $TEXT['WBMAILER_SMTP'],
633
								'TEXT_WBMAILER_SMTP_AUTH' => $TEXT['WBMAILER_SMTP_AUTH'],
634
								'TEXT_WBMAILER_SMTP_AUTH_NOTICE' => $TEXT['WBMAILER_SMTP_AUTH_NOTICE'],
635
								'TEXT_WBMAILER_SMTP_USERNAME' => $TEXT['WBMAILER_SMTP_USERNAME'],
636
								'TEXT_WBMAILER_SMTP_PASSWORD' => $TEXT['WBMAILER_SMTP_PASSWORD'],
637
								'MODE_SWITCH_WARNING' => $MESSAGE['SETTINGS']['MODE_SWITCH_WARNING'],
638
								'WORLD_WRITEABLE_WARNING' => $MESSAGE['SETTINGS']['WORLD_WRITEABLE_WARNING'],
639
								'TEXT_MODULE_ORDER' => $TEXT['MODULE_ORDER'],
640
								'TEXT_MAX_EXCERPT' => $TEXT['MAX_EXCERPT'],
641
								'TEXT_TIME_LIMIT' => $TEXT['TIME_LIMIT']
642
								)
643
						);
644

  
645
// Parse template objects output
646
$template->parse('main', 'main_block', false);
647
$template->pparse('output', 'page');
648

  
649
$admin->print_footer();
650

  
651
?>
1
<?php
2
/**
3
 *
4
 * @category        admin
5
 * @package         settings
6
 * @author          WebsiteBaker Project
7
 * @copyright       2004-2009, Ryan Djurovich
8
 * @copyright       2009-2010, Website Baker Org. e.V.
9
 * @link			http://www.websitebaker2.org/
10
 * @license         http://www.gnu.org/licenses/gpl.html
11
 * @platform        WebsiteBaker 2.8.x
12
 * @requirements    PHP 4.3.4 and higher
13
 * @version         $Id$
14
 * @filesource		$HeadURL$
15
 * @lastmodified    $Date$
16
 *
17
 */
18

  
19
require('../../config.php');
20
require_once(WB_PATH.'/framework/class.admin.php');
21
if(isset($_GET['advanced']) AND $_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
// Create new template object
32
$template = new Template(THEME_PATH.'/templates');
33
$template->set_file('page', 'settings.htt');
34
$template->set_block('page', 'main_block', 'main');
35

  
36
// Query current settings in the db, then loop through them and print them
37
$query = "SELECT * FROM ".TABLE_PREFIX."settings";
38
$results = $database->query($query);
39
while($setting = $results->fetchRow())
40
{
41
	$setting_name = $setting['name'];
42
	$setting_value = ( $setting_name != 'wbmailer_smtp_password' ) ? htmlspecialchars($setting['value']) : $setting['value'];
43
	$template->set_var(strtoupper($setting_name),$setting_value);
44
}
45

  
46
// Query current settings in the db, then loop through them and print them
47
$query = "SELECT * FROM ".TABLE_PREFIX."search WHERE extra = ''";
48
$results = $database->query($query);
49
while($setting = $results->fetchRow()) {
50
	$setting_name = $setting['name'];
51
	$setting_value = htmlspecialchars(($setting['value']));
52
	switch($setting_name) {
53
		// Search header
54
		case 'header':
55
			$template->set_var('SEARCH_HEADER', $setting_value);
56
		break;
57
		// Search results header
58
		case 'results_header':
59
			$template->set_var('SEARCH_RESULTS_HEADER', $setting_value);
60
		break;
61
		// Search results loop
62
		case 'results_loop':
63
			$template->set_var('SEARCH_RESULTS_LOOP', $setting_value);
64
		break;
65
		// Search results footer
66
		case 'results_footer':
67
			$template->set_var('SEARCH_RESULTS_FOOTER', $setting_value);
68
		break;
69
		// Search no results
70
		case 'no_results':
71
			$template->set_var('SEARCH_NO_RESULTS', $setting_value);
72
		break;
73
		// Search footer
74
		case 'footer':
75
			$template->set_var('SEARCH_FOOTER', $setting_value);
76
		break;
77
		// Search module-order
78
		case 'module_order':
79
			$template->set_var('SEARCH_MODULE_ORDER', $setting_value);
80
		break;
81
		// Search max lines of excerpt
82
		case 'max_excerpt':
83
			$template->set_var('SEARCH_MAX_EXCERPT', $setting_value);
84
		break;
85
		// time-limit
86
		case 'time_limit':
87
			$template->set_var('SEARCH_TIME_LIMIT', $setting_value);
88
		break;
89
		// Search template
90
		case 'template':
91
			$search_template = $setting_value;
92
		break;
93
	}
94
}
95

  
96
// Do the same for settings stored in config file as with ones in db
97
$database_type = '';
98

  
99
// Tell the browser whether or not to show advanced options
100
if(isset($_GET['advanced']) AND $_GET['advanced'] == 'yes') {
101
	$template->set_var('DISPLAY_ADVANCED', '');
102
	$template->set_var('ADVANCED', 'yes');
103
	$template->set_var('ADVANCED_BUTTON', '&lt;&lt; '.$TEXT['HIDE_ADVANCED']);
104
	$template->set_var('ADVANCED_LINK', 'index.php?advanced=no');
105
	$template->set_var('BASIC_FILE_PERMS_ID', 'hide');
106
	$template->set_var('ADVANCED_FILE_PERMS_ID', 'file_perms_box');
107
} else {
108
	$template->set_var('DISPLAY_ADVANCED', ' style="display: none;"');
109
	$template->set_var('ADVANCED', 'no');
110
	$template->set_var('ADVANCED_BUTTON', $TEXT['SHOW_ADVANCED'].' &gt;&gt;');
111
	$template->set_var('ADVANCED_LINK', 'index.php?advanced=yes');
112
	$template->set_var('BASIC_FILE_PERMS_ID', 'file_perms_box');
113
	$template->set_var('ADVANCED_FILE_PERMS_ID', 'hide');
114
}
115

  
116
$template->set_var(array(	
117
									'PAGES_DIRECTORY' => PAGES_DIRECTORY,
118
									'MEDIA_DIRECTORY' => MEDIA_DIRECTORY,
119
									'PAGE_EXTENSION' => PAGE_EXTENSION,
120
									'PAGE_SPACER' => PAGE_SPACER,
121
									'WB_PATH' => WB_PATH,
122
									'WB_URL' => WB_URL,
123
									'THEME_URL' => THEME_URL,
124
									'ADMIN_PATH' => ADMIN_PATH,
125
									'ADMIN_URL' => ADMIN_URL,
126
									'DATABASE_TYPE' => DB_TYPE,
127
									'DATABASE_HOST' => DB_HOST,
128
									'DATABASE_USERNAME' => DB_USERNAME,
129
									'DATABASE_NAME' => DB_NAME,
130
									'TABLE_PREFIX' => TABLE_PREFIX
131
								 )
132
						 );
133

  
134
// Insert language values
135
$template->set_block('main_block', 'language_list_block', 'language_list');
136
$result = $database->query("SELECT * FROM ".TABLE_PREFIX."addons WHERE type = 'language' order by name");
137
if($result->numRows() > 0) {
138
	while($addon = $result->fetchRow()) {
139
		$l_codes[$addon['name']] = $addon['directory'];
140
		$l_names[$addon['name']] = entities_to_7bit($addon['name']); // sorting-problem workaround
141
	}
142
	asort($l_names);
143
	foreach($l_names as $l_name=>$v) {
144
		// Insert code and name
145
		$template->set_var(array(
146
								'CODE' => $l_codes[$l_name],
147
								'NAME' => $l_name,
148
								'FLAG' => THEME_URL.'/images/flags/'.strtolower($l_codes[$l_name]),
149
								));
150
		// Check if it is selected
151
		if(DEFAULT_LANGUAGE == $l_codes[$l_name]) {
152
			$template->set_var('SELECTED', ' selected="selected"');
153
		} else {
154
			$template->set_var('SELECTED', '');
155
		}
156
		$template->parse('language_list', 'language_list_block', true);
157
	}
158
}
159

  
160
// Insert default timezone values
161
require(ADMIN_PATH.'/interface/timezones.php');
162
$template->set_block('main_block', 'timezone_list_block', 'timezone_list');
163
foreach($TIMEZONES AS $hour_offset => $title) {
164
	// Make sure we dont list "System Default" as we are setting this value!
165
	if($hour_offset != '-20') {
166
		$template->set_var('VALUE', $hour_offset);
167
		$template->set_var('NAME', $title);
168
		if(DEFAULT_TIMEZONE == $hour_offset*60*60) {
169
			$template->set_var('SELECTED', ' selected="selected"');
170
		} else {
171
			$template->set_var('SELECTED', '');
172
		}
173
		$template->parse('timezone_list', 'timezone_list_block', true);
174
	}
175
}
176

  
177
// Insert default charset values
178
require(ADMIN_PATH.'/interface/charsets.php');
179
$template->set_block('main_block', 'charset_list_block', 'charset_list');
180
foreach($CHARSETS AS $code => $title) {
181
	$template->set_var('VALUE', $code);
182
	$template->set_var('NAME', $title);
183
	if(DEFAULT_CHARSET == $code) {
184
		$template->set_var('SELECTED', ' selected="selected"');
185
	} else {
186
		$template->set_var('SELECTED', '');
187
	}
188
	$template->parse('charset_list', 'charset_list_block', true);
189
}
190

  
191
// Insert date format list
192
require(ADMIN_PATH.'/interface/date_formats.php');
193
$template->set_block('main_block', 'date_format_list_block', 'date_format_list');
194
foreach($DATE_FORMATS AS $format => $title) {
195
	$format = str_replace('|', ' ', $format); // Add's white-spaces (not able to be stored in array key)
196
	if($format != 'system_default') {
197
		$template->set_var('VALUE', $format);
198
	} else {
199
		$template->set_var('VALUE', '');
200
	}
201
	$template->set_var('NAME', $title);
202
	if(DEFAULT_DATE_FORMAT == $format) {
203
		$template->set_var('SELECTED', ' selected="selected"');
204
	} else {
205
		$template->set_var('SELECTED', '');
206
	}
207
	$template->parse('date_format_list', 'date_format_list_block', true);
208
}
209

  
210
// Insert time format list
211
require(ADMIN_PATH.'/interface/time_formats.php');
212
$template->set_block('main_block', 'time_format_list_block', 'time_format_list');
213
foreach($TIME_FORMATS AS $format => $title) {
214
	$format = str_replace('|', ' ', $format); // Add's white-spaces (not able to be stored in array key)
215
	if($format != 'system_default') {
216
		$template->set_var('VALUE', $format);
217
	} else {
218
		$template->set_var('VALUE', '');
219
	}
220
	$template->set_var('NAME', $title);
221
	if(DEFAULT_TIME_FORMAT == $format) {
222
		$template->set_var('SELECTED', ' selected="selected"');
223
	} else {
224
		$template->set_var('SELECTED', '');
225
	}
226
	$template->parse('time_format_list', 'time_format_list_block', true);
227
}
228

  
229
// Insert templates
230
$template->set_block('main_block', 'template_list_block', 'template_list');
231
$result = $database->query("SELECT * FROM ".TABLE_PREFIX."addons WHERE type = 'template' AND function != 'theme' order by name");
232
if($result->numRows() > 0) {
233
	while($addon = $result->fetchRow()) {
234
		$template->set_var('FILE', $addon['directory']);
235
		$template->set_var('NAME', $addon['name']);
236
		if(($addon['directory'] == DEFAULT_TEMPLATE) ? $selected = ' selected="selected"' : $selected = '');
237
		$template->set_var('SELECTED', $selected);
238
		$template->parse('template_list', 'template_list_block', true);
239
	}
240
}
241

  
242
// Insert backend theme
243
$template->set_block('main_block', 'theme_list_block', 'theme_list');
244
$result = $database->query("SELECT * FROM ".TABLE_PREFIX."addons WHERE type = 'template' AND function = 'theme' order by name");
245
if($result->numRows() > 0) {
246
	while($addon = $result->fetchRow()) {
247
		$template->set_var('FILE', $addon['directory']);
248
		$template->set_var('NAME', $addon['name']);
249
		if(($addon['directory'] == DEFAULT_THEME) ? $selected = ' selected="selected"' : $selected = '');
250
		$template->set_var('SELECTED', $selected);
251
		$template->parse('theme_list', 'theme_list_block', true);
252
	}
253
}
254

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

  
277
// Insert templates for search settings
278
$template->set_block('main_block', 'search_template_list_block', 'search_template_list');
279

  
280
$search_template = ( ($search_template == DEFAULT_TEMPLATE) OR ($search_template == '') ) ? '' : $search_template;
281

  
282
$selected = ( ($search_template != DEFAULT_TEMPLATE) ) ?  ' selected="selected"' : $selected = '';
283

  
284
$template->set_var(array(
285
        'FILE' => '',
286
        'NAME' => $TEXT['SYSTEM_DEFAULT'],
287
        'SELECTED' => $selected
288
    ));
289

  
290
$template->parse('search_template_list', 'search_template_list_block', true);
291
$result = $database->query("SELECT * FROM ".TABLE_PREFIX."addons WHERE type = 'template' AND function = 'template' order by name");
292

  
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

  
302
		$template->parse('search_template_list', 'search_template_list_block', true);
303
	}
304
}
305

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

  
316
	$template->parse('error_reporting_list', 'error_reporting_list_block', true);
317
}
318

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

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

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

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

  
355
// Work-out if smart login feature is enabled
356
if(defined('SMART_LOGIN') AND SMART_LOGIN == true)
357
{
358
	$template->set_var('SMART_LOGIN_ENABLED', ' checked="checked"');
359
} else {
360
	$template->set_var('SMART_LOGIN_DISABLED', ' checked="checked"');
361
}
362

  
363
/* Make's sure GD library is installed */
364
if(extension_loaded('gd') AND function_exists('imageCreateFromJpeg'))
365
{
366
	$template->set_var('GD_EXTENSION_ENABLED', '');
367
} else {
368
	$template->set_var('GD_EXTENSION_ENABLED', ' style="display: none;"');
369
}
370

  
371
// Work-out if section blocks feature is enabled
372
if(defined('SECTION_BLOCKS') AND SECTION_BLOCKS == true)
373
{
374
	$template->set_var('SECTION_BLOCKS_ENABLED', ' checked="checked"');
375
} else {
376
	$template->set_var('SECTION_BLOCKS_DISABLED', ' checked="checked"');
377
}
378

  
379
// Work-out if homepage redirection feature is enabled
380
if(defined('HOMEPAGE_REDIRECTION') AND HOMEPAGE_REDIRECTION == true)
381
{
382
	$template->set_var('HOMEPAGE_REDIRECTION_ENABLED', ' checked="checked"');
383
} else {
384
	$template->set_var('HOMEPAGE_REDIRECTION_DISABLED', ' checked="checked"');
385
}
386

  
387
// Work-out which server os should be checked
388
if(OPERATING_SYSTEM == 'linux')
389
{
390
	$template->set_var('LINUX_SELECTED', ' checked="checked"');
391
} elseif(OPERATING_SYSTEM == 'windows') {
392
	$template->set_var('WINDOWS_SELECTED', ' checked="checked"');
393
}
394

  
395
// Work-out if manage sections feature is enabled
396
if(MANAGE_SECTIONS)
397
{
398
	$template->set_var('MANAGE_SECTIONS_ENABLED', ' checked="checked"');
399
} else {
400
	$template->set_var('MANAGE_SECTIONS_DISABLED', ' checked="checked"');
401
}
402

  
403
// Work-out which wbmailer routine should be checked
404
if(WBMAILER_ROUTINE == 'phpmail')
405
{
406
	$template->set_var('PHPMAIL_SELECTED', ' checked="checked"');
407
	$template->set_var('SMTP_VISIBILITY', ' style="display: none;"');
408
	$template->set_var('SMTP_VISIBILITY_AUTH', ' style="display: none;"');
409
} elseif(WBMAILER_ROUTINE == 'smtp')
410
{
411
	$template->set_var('SMTPMAIL_SELECTED', ' checked="checked"');
412
	$template->set_var('SMTP_VISIBILITY', '');
413
}
414

  
415
// Work-out if SMTP authentification should be checked
416
if(WBMAILER_SMTP_AUTH)
417
{
418
	$template->set_var('SMTP_AUTH_SELECTED', ' checked="checked"');
419
	if(WBMAILER_ROUTINE == 'smtp')
420
    {
421
		$template->set_var('SMTP_VISIBILITY_AUTH', '');
422
	} else {
423
		$template->set_var('SMTP_VISIBILITY_AUTH', ' style="display: none;"');
424
	}
425
} else {
426
	$template->set_var('SMTP_VISIBILITY_AUTH', ' style="display: none;"');
427
}
428

  
429
// Work-out if intro feature is enabled
430
if(INTRO_PAGE)
431
{
432
	$template->set_var('INTRO_PAGE_ENABLED', ' checked="checked"');
433
} else {
434
	$template->set_var('INTRO_PAGE_DISABLED', ' checked="checked"');
435
}
436

  
437
// Work-out if frontend login feature is enabled
438
if(FRONTEND_LOGIN)
439
{
440
	$template->set_var('PRIVATE_ENABLED', ' checked="checked"');
441
} else {
442
	$template->set_var('PRIVATE_DISABLED', ' checked="checked"');
443
}
444

  
445
// Work-out if page trash feature is disabled, in-line, or separate
446
if(PAGE_TRASH == 'disabled')
447
{
448
	$template->set_var('PAGE_TRASH_DISABLED', ' checked="checked"');
449
	$template->set_var('DISPLAY_PAGE_TRASH_SEPARATE', 'display: none;');
450
} elseif(PAGE_TRASH == 'inline')
451
{
452
	$template->set_var('PAGE_TRASH_INLINE', ' checked="checked"');
453
	$template->set_var('DISPLAY_PAGE_TRASH_SEPARATE', 'display: none;');
454
} elseif(PAGE_TRASH == 'separate')
455
{
456
	$template->set_var('PAGE_TRASH_SEPARATE', ' checked="checked"');
457
	$template->set_var('DISPLAY_PAGE_TRASH_SEPARATE', 'display: inline;');
458
}
459

  
460
// Work-out if media home folde feature is enabled
461
if(HOME_FOLDERS)
462
{
463
	$template->set_var('HOME_FOLDERS_ENABLED', ' checked="checked"');
464
} else {
465
	$template->set_var('HOME_FOLDERS_DISABLED', ' checked="checked"');
466
}
467

  
468
// Insert search select
469
if(SEARCH == 'private')
470
{
471
	$template->set_var('PRIVATE_SEARCH', ' selected="selected"');
472
} elseif(SEARCH == 'registered') {
473
	$template->set_var('REGISTERED_SEARCH', ' selected="selected"');
474
} elseif(SEARCH == 'none') {
475
	$template->set_var('NONE_SEARCH', ' selected="selected"');
476
}
477

  
478
// Work-out if 777 permissions are set
479
if(STRING_FILE_MODE == '0777' AND STRING_DIR_MODE == '0777')
480
{
481
	$template->set_var('WORLD_WRITEABLE_SELECTED', ' checked="checked"');
482
}
483

  
484
// Work-out which file mode boxes are checked
485
if(extract_permission(STRING_FILE_MODE, 'u', 'r'))
486
{
487
	$template->set_var('FILE_U_R_CHECKED', ' checked="checked"');
488
}
489
if(extract_permission(STRING_FILE_MODE, 'u', 'w'))
490
{
491
	$template->set_var('FILE_U_W_CHECKED', ' checked="checked"');
492
}
493
if(extract_permission(STRING_FILE_MODE, 'u', 'e'))
494
{
495
	$template->set_var('FILE_U_E_CHECKED', ' checked="checked"');
496
}
497
if(extract_permission(STRING_FILE_MODE, 'g', 'r'))
498
{
499
	$template->set_var('FILE_G_R_CHECKED', ' checked="checked"');
500
}
501
if(extract_permission(STRING_FILE_MODE, 'g', 'w'))
502
{
503
	$template->set_var('FILE_G_W_CHECKED', ' checked="checked"');
504
}
505
if(extract_permission(STRING_FILE_MODE, 'g', 'e'))
506
{
507
	$template->set_var('FILE_G_E_CHECKED', ' checked="checked"');
508
}
509
if(extract_permission(STRING_FILE_MODE, 'o', 'r'))
510
{
511
	$template->set_var('FILE_O_R_CHECKED', ' checked="checked"');
512
}
513
if(extract_permission(STRING_FILE_MODE, 'o', 'w'))
514
{
515
	$template->set_var('FILE_O_W_CHECKED', ' checked="checked"');
516
}
517
if(extract_permission(STRING_FILE_MODE, 'o', 'e'))
518
{
519
	$template->set_var('FILE_O_E_CHECKED', ' checked="checked"');
520
}
521
// Work-out which dir mode boxes are checked
522
if(extract_permission(STRING_DIR_MODE, 'u', 'r'))
523
{
524
	$template->set_var('DIR_U_R_CHECKED', ' checked="checked"');
525
}
526
if(extract_permission(STRING_DIR_MODE, 'u', 'w'))
527
{
528
	$template->set_var('DIR_U_W_CHECKED', ' checked="checked"');
529
}
530
if(extract_permission(STRING_DIR_MODE, 'u', 'e'))
531
{
532
	$template->set_var('DIR_U_E_CHECKED', ' checked="checked"');
533
}
534
if(extract_permission(STRING_DIR_MODE, 'g', 'r'))
535
{
536
	$template->set_var('DIR_G_R_CHECKED', ' checked="checked"');
537
}
538
if(extract_permission(STRING_DIR_MODE, 'g', 'w'))
539
{
540
	$template->set_var('DIR_G_W_CHECKED', ' checked="checked"');
541
}
542
if(extract_permission(STRING_DIR_MODE, 'g', 'e'))
543
{
544
	$template->set_var('DIR_G_E_CHECKED', ' checked="checked"');
545
}
546
if(extract_permission(STRING_DIR_MODE, 'o', 'r'))
547
{
548
	$template->set_var('DIR_O_R_CHECKED', ' checked="checked"');
549
}
550
if(extract_permission(STRING_DIR_MODE, 'o', 'w'))
551
{
552
	$template->set_var('DIR_O_W_CHECKED', ' checked="checked"');
553
}
554
if(extract_permission(STRING_DIR_MODE, 'o', 'e'))
555
{
556
	$template->set_var('DIR_O_E_CHECKED', ' checked="checked"');
557
}
558

  
559
// Insert Server Email value into template
560
$template->set_var('SERVER_EMAIL', SERVER_EMAIL);
561

  
562
// Insert groups into signup list
563
$template->set_block('main_block', 'group_list_block', 'group_list');
564
$results = $database->query("SELECT group_id, name FROM ".TABLE_PREFIX."groups WHERE group_id != '1'");
565
if($results->numRows() > 0)
566
{
567
	while($group = $results->fetchRow())
568
    {
569
		$template->set_var('ID', $group['group_id']);
570
		$template->set_var('NAME', $group['name']);
571
		if(FRONTEND_SIGNUP == $group['group_id'])
572
        {
573
			$template->set_var('SELECTED', ' selected="selected"');
574
		} else {
575
			$template->set_var('SELECTED', '');
576
		}
577
		$template->parse('group_list', 'group_list_block', true);
578
	}
579
} else {
580
	$template->set_var('ID', 'disabled');
581
	$template->set_var('NAME', $MESSAGE['GROUPS']['NO_GROUPS_FOUND']);
582
	$template->parse('group_list', 'group_list_block', true);
583
}
584

  
585
// Insert language headings
586
$template->set_var(array(
587
								'HEADING_GENERAL_SETTINGS' => $HEADING['GENERAL_SETTINGS'],
588
								'HEADING_DEFAULT_SETTINGS' => $HEADING['DEFAULT_SETTINGS'],
589
								'HEADING_SEARCH_SETTINGS' => $HEADING['SEARCH_SETTINGS'],
590
								'HEADING_SERVER_SETTINGS' => $HEADING['SERVER_SETTINGS'],
591
								'HEADING_WBMAILER_SETTINGS' => $HEADING['WBMAILER_SETTINGS'],
592
								'HEADING_ADMINISTRATION_TOOLS' => $HEADING['ADMINISTRATION_TOOLS']
593
								)
594
						);
595
// Insert language text and messages
596
$template->set_var(array(
597
								'TEXT_WEBSITE_TITLE' => $TEXT['WEBSITE_TITLE'],
598
								'TEXT_WEBSITE_DESCRIPTION' => $TEXT['WEBSITE_DESCRIPTION'],
599
								'TEXT_WEBSITE_KEYWORDS' => $TEXT['WEBSITE_KEYWORDS'],
600
								'TEXT_WEBSITE_HEADER' => $TEXT['WEBSITE_HEADER'],
601
								'TEXT_WEBSITE_FOOTER' => $TEXT['WEBSITE_FOOTER'],
602
								'TEXT_HEADER' => $TEXT['HEADER'],
603
								'TEXT_FOOTER' => $TEXT['FOOTER'],
604
								'TEXT_VISIBILITY' => $TEXT['VISIBILITY'],
605
								'TEXT_RESULTS_HEADER' => $TEXT['RESULTS_HEADER'],
606
								'TEXT_RESULTS_LOOP' => $TEXT['RESULTS_LOOP'],
607
								'TEXT_RESULTS_FOOTER' => $TEXT['RESULTS_FOOTER'],
608
								'TEXT_NO_RESULTS' => $TEXT['NO_RESULTS'],
609
								'TEXT_TEXT' => $TEXT['TEXT'],
610
								'TEXT_DEFAULT' => $TEXT['DEFAULT'],
611
								'TEXT_LANGUAGE' => $TEXT['LANGUAGE'],
612
								'TEXT_TIMEZONE' => $TEXT['TIMEZONE'],
613
								'TEXT_CHARSET' => $TEXT['CHARSET'],
614
								'TEXT_DATE_FORMAT' => $TEXT['DATE_FORMAT'],
615
								'TEXT_TIME_FORMAT' => $TEXT['TIME_FORMAT'],
616
								'TEXT_TEMPLATE' => $TEXT['TEMPLATE'],
617
								'TEXT_THEME' => $TEXT['THEME'],
618
								'TEXT_WYSIWYG_EDITOR' => $TEXT['WYSIWYG_EDITOR'],
619
								'TEXT_PAGE_LEVEL_LIMIT' => $TEXT['PAGE_LEVEL_LIMIT'],
620
								'TEXT_INTRO_PAGE' => $TEXT['INTRO_PAGE'],
621
								'TEXT_FRONTEND' => $TEXT['FRONTEND'],
622
								'TEXT_LOGIN' => $TEXT['LOGIN'],
623
								'TEXT_REDIRECT_AFTER' => $TEXT['REDIRECT_AFTER'],
624
								'TEXT_SIGNUP' => $TEXT['SIGNUP'],
625
								'TEXT_PHP_ERROR_LEVEL' => $TEXT['PHP_ERROR_LEVEL'],
626
								'TEXT_PAGES_DIRECTORY' => $TEXT['PAGES_DIRECTORY'],
627
								'TEXT_MEDIA_DIRECTORY' => $TEXT['MEDIA_DIRECTORY'],
628
								'TEXT_PAGE_EXTENSION' => $TEXT['PAGE_EXTENSION'],
629
								'TEXT_PAGE_SPACER' => $TEXT['PAGE_SPACER'],
630
								'TEXT_RENAME_FILES_ON_UPLOAD' => $TEXT['RENAME_FILES_ON_UPLOAD'],
631
								'TEXT_APP_NAME' => $TEXT['APP_NAME'],
632
								'TEXT_SESSION_IDENTIFIER' => $TEXT['SESSION_IDENTIFIER'],
633
								'TEXT_SEC_ANCHOR' => $TEXT['SEC_ANCHOR'],
634
								'TEXT_SERVER_OPERATING_SYSTEM' => $TEXT['SERVER_OPERATING_SYSTEM'],
635
								'TEXT_LINUX_UNIX_BASED' => $TEXT['LINUX_UNIX_BASED'],
636
								'TEXT_WINDOWS' => $TEXT['WINDOWS'],
637
								'TEXT_ADMIN' => $TEXT['ADMIN'],
638
								'TEXT_TYPE' => $TEXT['TYPE'],
639
								'TEXT_DATABASE' => $TEXT['DATABASE'],
640
								'TEXT_HOST' => $TEXT['HOST'],
641
								'TEXT_USERNAME' => $TEXT['USERNAME'],
642
								'TEXT_PASSWORD' => $TEXT['PASSWORD'],
643
								'TEXT_NAME' => $TEXT['NAME'],
644
								'TEXT_TABLE_PREFIX' => $TEXT['TABLE_PREFIX'],
645
								'TEXT_SAVE' => $TEXT['SAVE'],
646
								'TEXT_RESET' => $TEXT['RESET'],
647
								'TEXT_CHANGES' => $TEXT['CHANGES'],
648
								'TEXT_ENABLED' => $TEXT['ENABLED'],
649
								'TEXT_DISABLED' => $TEXT['DISABLED'],
650
								'TEXT_MANAGE_SECTIONS' => $HEADING['MANAGE_SECTIONS'],
651
								'TEXT_MANAGE' => $TEXT['MANAGE'],
652
								'TEXT_SEARCH' => $TEXT['SEARCH'],
653
								'TEXT_PUBLIC' => $TEXT['PUBLIC'],
654
								'TEXT_PRIVATE' => $TEXT['PRIVATE'],
655
								'TEXT_REGISTERED' => $TEXT['REGISTERED'],
656
								'TEXT_NONE' => $TEXT['NONE'],
657
								'TEXT_FILES' => strtoupper(substr($TEXT['FILES'], 0, 1)).substr($TEXT['FILES'], 1),
658
								'TEXT_DIRECTORIES' => $TEXT['DIRECTORIES'],
659
								'TEXT_FILESYSTEM_PERMISSIONS' => $TEXT['FILESYSTEM_PERMISSIONS'],
660
								'TEXT_USER' => $TEXT['USER'],
661
								'TEXT_GROUP' => $TEXT['GROUP'],
662
								'TEXT_OTHERS' => $TEXT['OTHERS'],
663
								'TEXT_READ' => $TEXT['READ'],
664
								'TEXT_WRITE' => $TEXT['WRITE'],
665
								'TEXT_EXECUTE' => $TEXT['EXECUTE'],
666
								'TEXT_SMART_LOGIN' => $TEXT['SMART_LOGIN'],
667
								'TEXT_MULTIPLE_MENUS' => $TEXT['MULTIPLE_MENUS'],
668
								'TEXT_HOMEPAGE_REDIRECTION' => $TEXT['HOMEPAGE_REDIRECTION'],
669
								'TEXT_SECTION_BLOCKS' => $TEXT['SECTION_BLOCKS'],
670
								'TEXT_PLEASE_SELECT' => $TEXT['PLEASE_SELECT'],
671
								'TEXT_PAGE_TRASH' => $TEXT['PAGE_TRASH'],
672
								'TEXT_PAGE_LANGUAGES' => $TEXT['PAGE_LANGUAGES'],
673
								'TEXT_INLINE' => $TEXT['INLINE'],
674
								'TEXT_SEPARATE' => $TEXT['SEPARATE'],
675
								'TEXT_HOME_FOLDERS' => $TEXT['HOME_FOLDERS'],
676
								'TEXT_WYSIWYG_STYLE' => $TEXT['WYSIWYG_STYLE'],
677
								'TEXT_WORLD_WRITEABLE_FILE_PERMISSIONS' => $TEXT['WORLD_WRITEABLE_FILE_PERMISSIONS'],
678
								'TEXT_WBMAILER_DEFAULT_SETTINGS_NOTICE' => $TEXT['WBMAILER_DEFAULT_SETTINGS_NOTICE'],
679
								'TEXT_WBMAILER_DEFAULT_SENDER_MAIL' => $TEXT['WBMAILER_DEFAULT_SENDER_MAIL'],
680
								'TEXT_WBMAILER_DEFAULT_SENDER_NAME' => $TEXT['WBMAILER_DEFAULT_SENDER_NAME'],
681
								'TEXT_WBMAILER_NOTICE' => $TEXT['WBMAILER_NOTICE'],
682
								'TEXT_WBMAILER_FUNCTION' => $TEXT['WBMAILER_FUNCTION'],
683
								'TEXT_WBMAILER_SMTP_HOST' => $TEXT['WBMAILER_SMTP_HOST'],
684
								'TEXT_WBMAILER_PHP' => $TEXT['WBMAILER_PHP'],
685
								'TEXT_WBMAILER_SMTP' => $TEXT['WBMAILER_SMTP'],
686
								'TEXT_WBMAILER_SMTP_AUTH' => $TEXT['WBMAILER_SMTP_AUTH'],
687
								'TEXT_WBMAILER_SMTP_AUTH_NOTICE' => $TEXT['WBMAILER_SMTP_AUTH_NOTICE'],
688
								'TEXT_WBMAILER_SMTP_USERNAME' => $TEXT['WBMAILER_SMTP_USERNAME'],
689
								'TEXT_WBMAILER_SMTP_PASSWORD' => $TEXT['WBMAILER_SMTP_PASSWORD'],
690
								'MODE_SWITCH_WARNING' => $MESSAGE['SETTINGS']['MODE_SWITCH_WARNING'],
691
								'WORLD_WRITEABLE_WARNING' => $MESSAGE['SETTINGS']['WORLD_WRITEABLE_WARNING'],
692
								'TEXT_MODULE_ORDER' => $TEXT['MODULE_ORDER'],
693
								'TEXT_MAX_EXCERPT' => $TEXT['MAX_EXCERPT'],
694
								'TEXT_TIME_LIMIT' => $TEXT['TIME_LIMIT']
695
								)
696
						);
697

  
698
// Parse template objects output
699
$template->parse('main', 'main_block', false);
700
$template->pparse('output', 'page');
701

  
702
$admin->print_footer();
703

  
704
?>
652 705

  

Also available in: Unified diff