Project

General

Profile

« Previous | Next » 

Revision 552

Added by thorn almost 17 years ago

added new module-based search-function and publish-by-date code

View differences:

index.php
1
<?php
2

  
3
// $Id$
4

  
5
/*
6

  
7
 Website Baker Project <http://www.websitebaker.org/>
8
 Copyright (C) 2004-2008, 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

  
37
// Create new template object
38
$template = new Template(ADMIN_PATH.'/settings');
39
$template->set_file('page', 'template.html');
40
$template->set_block('page', 'main_block', 'main');
41

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

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

  
89
// Do the same for settings stored in config file as with ones in db
90
$database_type = '';
91

  
92
// Tell the browser whether or not to show advanced options
93
if(isset($_GET['advanced']) AND $_GET['advanced'] == 'yes') {
94
	$template->set_var('DISPLAY_ADVANCED', '');
95
	$template->set_var('ADVANCED', 'yes');
96
	$template->set_var('ADVANCED_BUTTON', '<< '.$TEXT['HIDE_ADVANCED']);
97
	$template->set_var('ADVANCED_LINK', 'index.php?advanced=no');
98
	$template->set_var('BASIC_FILE_PERMS_ID', 'hide');
99
	$template->set_var('ADVANCED_FILE_PERMS_ID', 'file_perms_box');
100
} else {
101
	$template->set_var('DISPLAY_ADVANCED', 'none');
102
	$template->set_var('ADVANCED', 'no');
103
	$template->set_var('ADVANCED_BUTTON', $TEXT['SHOW_ADVANCED'].' >>');
104
	$template->set_var('ADVANCED_LINK', 'index.php?advanced=yes');
105
	$template->set_var('BASIC_FILE_PERMS_ID', 'file_perms_box');
106
	$template->set_var('ADVANCED_FILE_PERMS_ID', 'hide');
107
}
108

  
109
$template->set_var(array(	
110
									'PAGES_DIRECTORY' => PAGES_DIRECTORY,
111
									'MEDIA_DIRECTORY' => MEDIA_DIRECTORY,
112
									'PAGE_EXTENSION' => PAGE_EXTENSION,
113
									'PAGE_SPACER' => PAGE_SPACER,
114
									'WB_PATH' => WB_PATH,
115
									'WB_URL' => WB_URL,
116
									'ADMIN_PATH' => ADMIN_PATH,
117
									'ADMIN_URL' => ADMIN_URL,
118
									'DATABASE_TYPE' => DB_TYPE,
119
									'DATABASE_HOST' => DB_HOST,
120
									'DATABASE_USERNAME' => DB_USERNAME,
121
									'DATABASE_NAME' => DB_NAME,
122
									'TABLE_PREFIX' => TABLE_PREFIX
123
								 )
124
						 );
125

  
126
// Insert language values
127
$template->set_block('main_block', 'language_list_block', 'language_list');
128
$result = $database->query("SELECT * FROM ".TABLE_PREFIX."addons WHERE type = 'language' order by directory");
129
if($result->numRows() > 0) {
130
	while ($addon = $result->fetchRow()) {
131
		// Insert code and name
132
		$template->set_var(array(
133
								'CODE' => $addon['directory'],
134
								'NAME' => $addon['name']
135
								));
136
		// Check if it is selected
137
		if(DEFAULT_LANGUAGE == $addon['directory']) {
138
			$template->set_var('SELECTED', ' selected');
139
		} else {
140
			$template->set_var('SELECTED', '');
141
		}
142
		$template->parse('language_list', 'language_list_block', true);
143
	}
144
}
145

  
146
// Insert default timezone values
147
require(ADMIN_PATH.'/interface/timezones.php');
148
$template->set_block('main_block', 'timezone_list_block', 'timezone_list');
149
foreach($TIMEZONES AS $hour_offset => $title) {
150
	// Make sure we dont list "System Default" as we are setting this value!
151
	if($hour_offset != '-20') {
152
		$template->set_var('VALUE', $hour_offset);
153
		$template->set_var('NAME', $title);
154
		if(DEFAULT_TIMEZONE == $hour_offset*60*60) {
155
			$template->set_var('SELECTED', 'selected');
156
		} else {
157
			$template->set_var('SELECTED', '');
158
		}
159
		$template->parse('timezone_list', 'timezone_list_block', true);
160
	}
161
}
162

  
163
// Insert default charset values
164
require(ADMIN_PATH.'/interface/charsets.php');
165
$template->set_block('main_block', 'charset_list_block', 'charset_list');
166
foreach($CHARSETS AS $code => $title) {
167
	$template->set_var('VALUE', $code);
168
	$template->set_var('NAME', $title);
169
	if(DEFAULT_CHARSET == $code) {
170
		$template->set_var('SELECTED', 'selected');
171
	} else {
172
		$template->set_var('SELECTED', '');
173
	}
174
	$template->parse('charset_list', 'charset_list_block', true);
175
}
176

  
177
// Insert date format list
178
require(ADMIN_PATH.'/interface/date_formats.php');
179
$template->set_block('main_block', 'date_format_list_block', 'date_format_list');
180
foreach($DATE_FORMATS AS $format => $title) {
181
	$format = str_replace('|', ' ', $format); // Add's white-spaces (not able to be stored in array key)
182
	if($format != 'system_default') {
183
		$template->set_var('VALUE', $format);
184
	} else {
185
		$template->set_var('VALUE', '');
186
	}
187
	$template->set_var('NAME', $title);
188
	if(DEFAULT_DATE_FORMAT == $format) {
189
		$template->set_var('SELECTED', 'selected');
190
	} else {
191
		$template->set_var('SELECTED', '');
192
	}
193
	$template->parse('date_format_list', 'date_format_list_block', true);
194
}
195

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

  
215
// Insert templates
216
$template->set_block('main_block', 'template_list_block', 'template_list');
217
$result = $database->query("SELECT * FROM ".TABLE_PREFIX."addons WHERE type = 'template' order by name");
218
if($result->numRows() > 0) {
219
	while($addon = $result->fetchRow()) {
220
		$template->set_var('FILE', $addon['directory']);
221
		$template->set_var('NAME', $addon['name']);
222
		if(($addon['directory'] == DEFAULT_TEMPLATE) ? $selected = ' selected' : $selected = '');
223
		$template->set_var('SELECTED', $selected);
224
		$template->parse('template_list', 'template_list_block', true);
225
	}
226
}
227

  
228
// Insert WYSIWYG modules
229
$template->set_block('main_block', 'editor_list_block', 'editor_list');
230
$file='none';  
231
$module_name=$TEXT['NONE'];  
232
$template->set_var('FILE', $file);  
233
$template->set_var('NAME', $module_name);  
234
if((!defined('WYSIWYG_EDITOR') OR $file == WYSIWYG_EDITOR) ? $selected = ' selected' : $selected = '');  
235
$template->set_var('SELECTED', $selected);  
236
$template->parse('editor_list', 'editor_list_block', true);  
237
$result = $database->query("SELECT * FROM ".TABLE_PREFIX."addons WHERE type = 'module' AND function = 'wysiwyg'");
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((defined('WYSIWYG_EDITOR') AND $addon['directory'] == WYSIWYG_EDITOR) ? $selected = ' selected' : $selected = '');
243
		$template->set_var('SELECTED', $selected);
244
		$template->parse('editor_list', 'editor_list_block', true);
245
	}
246
}
247

  
248
// Insert templates for search settings
249
$template->set_block('main_block', 'search_template_list_block', 'search_template_list');
250
if($search_template == '') { $selected = ' selected'; } else { $selected = ''; }
251
$template->set_var(array('FILE' => '', 'NAME' => $TEXT['SYSTEM_DEFAULT'], 'SELECTED' => $selected));
252
$template->parse('search_template_list', 'search_template_list_block', true);
253
$result = $database->query("SELECT * FROM ".TABLE_PREFIX."addons WHERE type = 'template' order by name");
254
if($result->numRows() > 0) {
255
	while($addon = $result->fetchRow()) {
256
		$template->set_var('FILE', $addon['directory']);
257
		$template->set_var('NAME', $addon['name']);
258
		if($addon['directory'] == $search_template ? $selected = ' selected' : $selected = '');
259
		$template->set_var('SELECTED', $selected);
260
		$template->parse('search_template_list', 'search_template_list_block', true);
261
	}
262
}
263

  
264
// Insert default error reporting values
265
require(ADMIN_PATH.'/interface/er_levels.php');
266
$template->set_block('main_block', 'error_reporting_list_block', 'error_reporting_list');
267
foreach($ER_LEVELS AS $value => $title) {
268
	$template->set_var('VALUE', $value);
269
	$template->set_var('NAME', $title);
270
	if(ER_LEVEL == $value) {
271
		$template->set_var('SELECTED', 'selected');
272
	} else {
273
		$template->set_var('SELECTED', '');
274
	}
275
	$template->parse('error_reporting_list', 'error_reporting_list_block', true);
276
}
277

  
278
// Insert permissions values
279
if($admin->get_permission('settings_advanced') != true) {
280
	$template->set_var('DISPLAY_ADVANCED_BUTTON', 'hide');
281
}
282

  
283
// Insert page level limits
284
$template->set_block('main_block', 'page_level_limit_list_block', 'page_level_limit_list');
285
for($i = 1; $i <= 10; $i++) {
286
	$template->set_var('NUMBER', $i);
287
	if(PAGE_LEVEL_LIMIT == $i) {
288
		$template->set_var('SELECTED', 'selected');
289
	} else {
290
		$template->set_var('SELECTED', '');
291
	}
292
	$template->parse('page_level_limit_list', 'page_level_limit_list_block', true);
293
}
294

  
295
// Work-out if multiple menus feature is enabled
296
if(defined('MULTIPLE_MENUS') AND MULTIPLE_MENUS == true) {
297
	$template->set_var('MULTIPLE_MENUS_ENABLED', ' checked');
298
} else {
299
	$template->set_var('MULTIPLE_MENUS_DISABLED', ' checked');
300
}
301

  
302
// Work-out if page languages feature is enabled
303
if(defined('PAGE_LANGUAGES') AND PAGE_LANGUAGES == true) {
304
        $template->set_var('PAGE_LANGUAGES_ENABLED', ' checked');
305
} else {
306
        $template->set_var('PAGE_LANGUAGES_DISABLED', ' checked');
307
}
308

  
309
// Work-out if smart login feature is enabled
310
if(defined('SMART_LOGIN') AND SMART_LOGIN == true) {
311
	$template->set_var('SMART_LOGIN_ENABLED', ' checked');
312
} else {
313
	$template->set_var('SMART_LOGIN_DISABLED', ' checked');
314
}
315

  
316
// Work-out if captcha verification feature is enabled
317
if(defined('CAPTCHA_VERIFICATION') AND CAPTCHA_VERIFICATION == true) {
318
	$template->set_var('CAPTCHA_VERIFICATION_ENABLED', ' checked');
319
} else {
320
	$template->set_var('CAPTCHA_VERIFICATION_DISABLED', ' checked');
321
}
322
if(extension_loaded('gd') AND function_exists('imageCreateFromJpeg')) { /* Make's sure GD library is installed */
323
	$template->set_var('GD_EXTENSION_ENABLED', '');
324
} else {
325
	$template->set_var('GD_EXTENSION_ENABLED', 'none');
326
}
327

  
328
// Work-out if section blocks feature is enabled
329
if(defined('SECTION_BLOCKS') AND SECTION_BLOCKS == true) {
330
	$template->set_var('SECTION_BLOCKS_ENABLED', ' checked');
331
} else {
332
	$template->set_var('SECTION_BLOCKS_DISABLED', ' checked');
333
}
334

  
335
// Work-out if homepage redirection feature is enabled
336
if(defined('HOMEPAGE_REDIRECTION') AND HOMEPAGE_REDIRECTION == true) {
337
	$template->set_var('HOMEPAGE_REDIRECTION_ENABLED', ' checked');
338
} else {
339
	$template->set_var('HOMEPAGE_REDIRECTION_DISABLED', ' checked');
340
}
341

  
342
// Work-out which server os should be checked
343
if(OPERATING_SYSTEM == 'linux') {
344
	$template->set_var('LINUX_SELECTED', ' checked');
345
} elseif(OPERATING_SYSTEM == 'windows') {
346
	$template->set_var('WINDOWS_SELECTED', ' checked');
347
}
348

  
349
// Work-out if manage sections feature is enabled
350
if(MANAGE_SECTIONS) {
351
	$template->set_var('MANAGE_SECTIONS_ENABLED', ' checked');
352
} else {
353
	$template->set_var('MANAGE_SECTIONS_DISABLED', ' checked');
354
}
355

  
356
// Work-out which wbmailer routine should be checked
357
if(WBMAILER_ROUTINE == 'phpmail') {
358
	$template->set_var('PHPMAIL_SELECTED', ' checked');
359
	$template->set_var('SMTP_VISIBILITY', 'hidden');
360
	$template->set_var('SMTP_VISIBILITY_AUTH', 'hidden');
361
} elseif(WBMAILER_ROUTINE == 'smtp') {
362
	$template->set_var('SMTPMAIL_SELECTED', ' checked');
363
	$template->set_var('SMTP_VISIBILITY', 'visible');
364
}
365

  
366
// Work-out if SMTP authentification should be checked
367
if(WBMAILER_SMTP_AUTH) {
368
	$template->set_var('SMTP_AUTH_SELECTED', ' checked');
369
	if(WBMAILER_ROUTINE == 'smtp') {
370
		$template->set_var('SMTP_VISIBILITY_AUTH', 'visible');
371
	} else {
372
		$template->set_var('SMTP_VISIBILITY_AUTH', 'hidden');
373
	}
374
} else {
375
	$template->set_var('SMTP_VISIBILITY_AUTH', 'hidden');
376
}
377

  
378
// Work-out if intro feature is enabled
379
if(INTRO_PAGE) {
380
	$template->set_var('INTRO_PAGE_ENABLED', ' checked');
381
} else {
382
	$template->set_var('INTRO_PAGE_DISABLED', ' checked');
383
}
384

  
385
// Work-out if frontend login feature is enabled
386
if(FRONTEND_LOGIN) {
387
	$template->set_var('PRIVATE_ENABLED', ' checked');
388
} else {
389
	$template->set_var('PRIVATE_DISABLED', ' checked');
390
}
391

  
392
// Work-out if page trash feature is disabled, in-line, or separate
393
if(PAGE_TRASH == 'disabled') {
394
	$template->set_var('PAGE_TRASH_DISABLED', ' checked');
395
	$template->set_var('DISPLAY_PAGE_TRASH_SEPARATE', ' display: none;');
396
} elseif(PAGE_TRASH == 'inline') {
397
	$template->set_var('PAGE_TRASH_INLINE', ' checked');
398
	$template->set_var('DISPLAY_PAGE_TRASH_SEPARATE', ' display: none;');
399
} elseif(PAGE_TRASH == 'separate') {
400
	$template->set_var('PAGE_TRASH_SEPARATE', ' checked');
401
	$template->set_var('DISPLAY_PAGE_TRASH_SEPARATE', ' display: inline;');
402
}
403

  
404
// Work-out if media home folde feature is enabled
405
if(HOME_FOLDERS) {
406
	$template->set_var('HOME_FOLDERS_ENABLED', ' checked');
407
} else {
408
	$template->set_var('HOME_FOLDERS_DISABLED', ' checked');
409
}
410

  
411
// Insert search select
412
if(SEARCH == 'private') {
413
	$template->set_var('PRIVATE_SEARCH', 'selected');
414
} elseif(SEARCH == 'registered') {
415
	$template->set_var('REGISTERED_SEARCH', 'selected');
416
} elseif(SEARCH == 'none') {
417
	$template->set_var('NONE_SEARCH', 'selected');
418
}
419

  
420
// Work-out if 777 permissions are set
421
if(STRING_FILE_MODE == '0777' AND STRING_DIR_MODE == '0777') {
422
	$template->set_var('WORLD_WRITEABLE_SELECTED', ' checked');
423
}
424

  
425
// Work-out which file mode boxes are checked
426
if(extract_permission(STRING_FILE_MODE, 'u', 'r')) {
427
	$template->set_var('FILE_U_R_CHECKED', 'checked');
428
}
429
if(extract_permission(STRING_FILE_MODE, 'u', 'w')) {
430
	$template->set_var('FILE_U_W_CHECKED', 'checked');
431
}
432
if(extract_permission(STRING_FILE_MODE, 'u', 'e')) {
433
	$template->set_var('FILE_U_E_CHECKED', 'checked');
434
}
435
if(extract_permission(STRING_FILE_MODE, 'g', 'r')) {
436
	$template->set_var('FILE_G_R_CHECKED', 'checked');
437
}
438
if(extract_permission(STRING_FILE_MODE, 'g', 'w')) {
439
	$template->set_var('FILE_G_W_CHECKED', 'checked');
440
}
441
if(extract_permission(STRING_FILE_MODE, 'g', 'e')) {
442
	$template->set_var('FILE_G_E_CHECKED', 'checked');
443
}
444
if(extract_permission(STRING_FILE_MODE, 'o', 'r')) {
445
	$template->set_var('FILE_O_R_CHECKED', 'checked');
446
}
447
if(extract_permission(STRING_FILE_MODE, 'o', 'w')) {
448
	$template->set_var('FILE_O_W_CHECKED', 'checked');
449
}
450
if(extract_permission(STRING_FILE_MODE, 'o', 'e')) {
451
	$template->set_var('FILE_O_E_CHECKED', 'checked');
452
}
453
// Work-out which dir mode boxes are checked
454
if(extract_permission(STRING_DIR_MODE, 'u', 'r')) {
455
	$template->set_var('DIR_U_R_CHECKED', 'checked');
456
}
457
if(extract_permission(STRING_DIR_MODE, 'u', 'w')) {
458
	$template->set_var('DIR_U_W_CHECKED', 'checked');
459
}
460
if(extract_permission(STRING_DIR_MODE, 'u', 'e')) {
461
	$template->set_var('DIR_U_E_CHECKED', 'checked');
462
}
463
if(extract_permission(STRING_DIR_MODE, 'g', 'r')) {
464
	$template->set_var('DIR_G_R_CHECKED', 'checked');
465
}
466
if(extract_permission(STRING_DIR_MODE, 'g', 'w')) {
467
	$template->set_var('DIR_G_W_CHECKED', 'checked');
468
}
469
if(extract_permission(STRING_DIR_MODE, 'g', 'e')) {
470
	$template->set_var('DIR_G_E_CHECKED', 'checked');
471
}
472
if(extract_permission(STRING_DIR_MODE, 'o', 'r')) {
473
	$template->set_var('DIR_O_R_CHECKED', 'checked');
474
}
475
if(extract_permission(STRING_DIR_MODE, 'o', 'w')) {
476
	$template->set_var('DIR_O_W_CHECKED', 'checked');
477
}
478
if(extract_permission(STRING_DIR_MODE, 'o', 'e')) {
479
	$template->set_var('DIR_O_E_CHECKED', 'checked');
480
}
481

  
482
// Insert Server Email value into template
483
$template->set_var('SERVER_EMAIL', SERVER_EMAIL);
484

  
485
// Insert groups into signup list
486
$template->set_block('main_block', 'group_list_block', 'group_list');
487
$results = $database->query("SELECT group_id, name FROM ".TABLE_PREFIX."groups WHERE group_id != '1'");
488
if($results->numRows() > 0) {
489
	while($group = $results->fetchRow()) {
490
		$template->set_var('ID', $group['group_id']);
491
		$template->set_var('NAME', $group['name']);
492
		if(FRONTEND_SIGNUP == $group['group_id']) {
493
			$template->set_var('SELECTED', 'selected');
494
		} else {
495
			$template->set_var('SELECTED', '');
496
		}
497
		$template->parse('group_list', 'group_list_block', true);
498
	}
499
} else {
500
	$template->set_var('ID', 'disabled');
501
	$template->set_var('NAME', $MESSAGE['GROUPS']['NO_GROUPS_FOUND']);
502
	$template->parse('group_list', 'group_list_block', true);
503
}
504

  
505
// Insert language headings
506
$template->set_var(array(
507
								'HEADING_GENERAL_SETTINGS' => $HEADING['GENERAL_SETTINGS'],
508
								'HEADING_DEFAULT_SETTINGS' => $HEADING['DEFAULT_SETTINGS'],
509
								'HEADING_SEARCH_SETTINGS' => $HEADING['SEARCH_SETTINGS'],
510
								'HEADING_SERVER_SETTINGS' => $HEADING['SERVER_SETTINGS'],
511
								'HEADING_WBMAILER_SETTINGS' => $HEADING['WBMAILER_SETTINGS'],
512
								'HEADING_ADMINISTRATION_TOOLS' => $HEADING['ADMINISTRATION_TOOLS']
513
								)
514
						);
515
// Insert language text and messages
516
$template->set_var(array(
517
								'TEXT_WEBSITE_TITLE' => $TEXT['WEBSITE_TITLE'],
518
								'TEXT_WEBSITE_DESCRIPTION' => $TEXT['WEBSITE_DESCRIPTION'],
519
								'TEXT_WEBSITE_KEYWORDS' => $TEXT['WEBSITE_KEYWORDS'],
520
								'TEXT_WEBSITE_HEADER' => $TEXT['WEBSITE_HEADER'],
521
								'TEXT_WEBSITE_FOOTER' => $TEXT['WEBSITE_FOOTER'],
522
								'TEXT_HEADER' => $TEXT['HEADER'],
523
								'TEXT_FOOTER' => $TEXT['FOOTER'],
524
								'TEXT_VISIBILITY' => $TEXT['VISIBILITY'],
525
								'TEXT_RESULTS_HEADER' => $TEXT['RESULTS_HEADER'],
526
								'TEXT_RESULTS_LOOP' => $TEXT['RESULTS_LOOP'],
527
								'TEXT_RESULTS_FOOTER' => $TEXT['RESULTS_FOOTER'],
528
								'TEXT_NO_RESULTS' => $TEXT['NO_RESULTS'],
529
								'TEXT_TEXT' => $TEXT['TEXT'],
530
								'TEXT_DEFAULT' => $TEXT['DEFAULT'],
531
								'TEXT_LANGUAGE' => $TEXT['LANGUAGE'],
532
								'TEXT_TIMEZONE' => $TEXT['TIMEZONE'],
533
								'TEXT_CHARSET' => $TEXT['CHARSET'],
534
								'TEXT_DATE_FORMAT' => $TEXT['DATE_FORMAT'],
535
								'TEXT_TIME_FORMAT' => $TEXT['TIME_FORMAT'],
536
								'TEXT_TEMPLATE' => $TEXT['TEMPLATE'],
537
								'TEXT_WYSIWYG_EDITOR' => $TEXT['WYSIWYG_EDITOR'],
538
								'TEXT_PAGE_LEVEL_LIMIT' => $TEXT['PAGE_LEVEL_LIMIT'],
539
								'TEXT_INTRO_PAGE' => $TEXT['INTRO_PAGE'],
540
								'TEXT_FRONTEND' => $TEXT['FRONTEND'],
541
								'TEXT_LOGIN' => $TEXT['LOGIN'],
542
								'TEXT_SIGNUP' => $TEXT['SIGNUP'],
543
								'TEXT_PHP_ERROR_LEVEL' => $TEXT['PHP_ERROR_LEVEL'],
544
								'TEXT_PAGES_DIRECTORY' => $TEXT['PAGES_DIRECTORY'],
545
								'TEXT_MEDIA_DIRECTORY' => $TEXT['MEDIA_DIRECTORY'],
546
								'TEXT_PAGE_EXTENSION' => $TEXT['PAGE_EXTENSION'],
547
								'TEXT_PAGE_SPACER' => $TEXT['PAGE_SPACER'],
548
								'TEXT_RENAME_FILES_ON_UPLOAD' => $TEXT['RENAME_FILES_ON_UPLOAD'],
549
								'TEXT_APP_NAME' => $TEXT['APP_NAME'],
550
								'TEXT_SESSION_IDENTIFIER' => $TEXT['SESSION_IDENTIFIER'],
551
								'TEXT_SERVER_OPERATING_SYSTEM' => $TEXT['SERVER_OPERATING_SYSTEM'],
552
								'TEXT_LINUX_UNIX_BASED' => $TEXT['LINUX_UNIX_BASED'],
553
								'TEXT_WINDOWS' => $TEXT['WINDOWS'],
554
								'TEXT_ADMIN' => $TEXT['ADMIN'],
555
								'TEXT_TYPE' => $TEXT['TYPE'],
556
								'TEXT_DATABASE' => $TEXT['DATABASE'],
557
								'TEXT_HOST' => $TEXT['HOST'],
558
								'TEXT_USERNAME' => $TEXT['USERNAME'],
559
								'TEXT_PASSWORD' => $TEXT['PASSWORD'],
560
								'TEXT_NAME' => $TEXT['NAME'],
561
								'TEXT_TABLE_PREFIX' => $TEXT['TABLE_PREFIX'],
562
								'TEXT_SAVE' => $TEXT['SAVE'],
563
								'TEXT_RESET' => $TEXT['RESET'],
564
								'TEXT_CHANGES' => $TEXT['CHANGES'],
565
								'TEXT_ENABLED' => $TEXT['ENABLED'],
566
								'TEXT_DISABLED' => $TEXT['DISABLED'],
567
								'TEXT_MANAGE_SECTIONS' => $HEADING['MANAGE_SECTIONS'],
568
								'TEXT_MANAGE' => $TEXT['MANAGE'],
569
								'TEXT_SEARCH' => $TEXT['SEARCH'],
570
								'TEXT_PUBLIC' => $TEXT['PUBLIC'],
571
								'TEXT_PRIVATE' => $TEXT['PRIVATE'],
572
								'TEXT_REGISTERED' => $TEXT['REGISTERED'],
573
								'TEXT_NONE' => $TEXT['NONE'],
574
								'TEXT_FILES' => strtoupper(substr($TEXT['FILES'], 0, 1)).substr($TEXT['FILES'], 1),
575
								'TEXT_DIRECTORIES' => $TEXT['DIRECTORIES'],
576
								'TEXT_FILESYSTEM_PERMISSIONS' => $TEXT['FILESYSTEM_PERMISSIONS'],
577
								'TEXT_USER' => $TEXT['USER'],
578
								'TEXT_GROUP' => $TEXT['GROUP'],
579
								'TEXT_OTHERS' => $TEXT['OTHERS'],
580
								'TEXT_READ' => $TEXT['READ'],
581
								'TEXT_WRITE' => $TEXT['WRITE'],
582
								'TEXT_EXECUTE' => $TEXT['EXECUTE'],
583
								'TEXT_SMART_LOGIN' => $TEXT['SMART_LOGIN'],
584
								'TEXT_CAPTCHA_VERIFICATION' => $TEXT['CAPTCHA_VERIFICATION'],
585
								'TEXT_MULTIPLE_MENUS' => $TEXT['MULTIPLE_MENUS'],
586
								'TEXT_HOMEPAGE_REDIRECTION' => $TEXT['HOMEPAGE_REDIRECTION'],
587
								'TEXT_SECTION_BLOCKS' => $TEXT['SECTION_BLOCKS'],
588
								'TEXT_PLEASE_SELECT' => $TEXT['PLEASE_SELECT'],
589
								'TEXT_PAGE_TRASH' => $TEXT['PAGE_TRASH'],
590
								'TEXT_PAGE_LANGUAGES' => $TEXT['PAGE_LANGUAGES'],
591
								'TEXT_INLINE' => $TEXT['INLINE'],
592
								'TEXT_SEPARATE' => $TEXT['SEPARATE'],
593
								'TEXT_HOME_FOLDERS' => $TEXT['HOME_FOLDERS'],
594
								'TEXT_WYSIWYG_STYLE' => $TEXT['WYSIWYG_STYLE'],
595
								'TEXT_SERVER_EMAIL' => $TEXT['SERVER_EMAIL'],
596
								'TEXT_WORLD_WRITEABLE_FILE_PERMISSIONS' => $TEXT['WORLD_WRITEABLE_FILE_PERMISSIONS'],
597
								'TEXT_WBMAILER_NOTICE' => $TEXT['WBMAILER_NOTICE'],
598
								'TEXT_WBMAILER_FUNCTION' => $TEXT['WBMAILER_FUNCTION'],
599
								'TEXT_WBMAILER_SMTP_HOST' => $TEXT['WBMAILER_SMTP_HOST'],
600
								'TEXT_WBMAILER_PHP' => $TEXT['WBMAILER_PHP'],
601
								'TEXT_WBMAILER_SMTP' => $TEXT['WBMAILER_SMTP'],
602
								'TEXT_WBMAILER_SMTP_AUTH' => $TEXT['WBMAILER_SMTP_AUTH'],
603
								'TEXT_WBMAILER_SMTP_AUTH_NOTICE' => $TEXT['WBMAILER_SMTP_AUTH_NOTICE'],
604
								'TEXT_WBMAILER_SMTP_USERNAME' => $TEXT['WBMAILER_SMTP_USERNAME'],
605
								'TEXT_WBMAILER_SMTP_PASSWORD' => $TEXT['WBMAILER_SMTP_PASSWORD'],
606
								'MODE_SWITCH_WARNING' => $MESSAGE['SETTINGS']['MODE_SWITCH_WARNING'],
607
								'WORLD_WRITEABLE_WARNING' => $MESSAGE['SETTINGS']['WORLD_WRITEABLE_WARNING']
608
								)
609
						);
610

  
611
// Parse template objects output
612
$template->parse('main', 'main_block', false);
613
$template->pparse('output', 'page');
614

  
615
$admin->print_footer();
616

  
617
?>
1
<?php
2

  
3
// $Id$
4

  
5
/*
6

  
7
 Website Baker Project <http://www.websitebaker.org/>
8
 Copyright (C) 2004-2008, 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

  
37
// Create new template object
38
$template = new Template(ADMIN_PATH.'/settings');
39
$template->set_file('page', 'template.html');
40
$template->set_block('page', 'main_block', 'main');
41

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

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

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

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

  
117
$template->set_var(array(	
118
									'PAGES_DIRECTORY' => PAGES_DIRECTORY,
119
									'MEDIA_DIRECTORY' => MEDIA_DIRECTORY,
120
									'PAGE_EXTENSION' => PAGE_EXTENSION,
121
									'PAGE_SPACER' => PAGE_SPACER,
122
									'WB_PATH' => WB_PATH,
123
									'WB_URL' => WB_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 directory");
137
if($result->numRows() > 0) {
138
	while ($addon = $result->fetchRow()) {
139
		// Insert code and name
140
		$template->set_var(array(
141
								'CODE' => $addon['directory'],
142
								'NAME' => $addon['name']
143
								));
144
		// Check if it is selected
145
		if(DEFAULT_LANGUAGE == $addon['directory']) {
146
			$template->set_var('SELECTED', ' selected');
147
		} else {
148
			$template->set_var('SELECTED', '');
149
		}
150
		$template->parse('language_list', 'language_list_block', true);
151
	}
152
}
153

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

  
171
// Insert default charset values
172
require(ADMIN_PATH.'/interface/charsets.php');
173
$template->set_block('main_block', 'charset_list_block', 'charset_list');
174
foreach($CHARSETS AS $code => $title) {
175
	$template->set_var('VALUE', $code);
176
	$template->set_var('NAME', $title);
177
	if(DEFAULT_CHARSET == $code) {
178
		$template->set_var('SELECTED', 'selected');
179
	} else {
180
		$template->set_var('SELECTED', '');
181
	}
182
	$template->parse('charset_list', 'charset_list_block', true);
183
}
184

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

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

  
223
// Insert templates
224
$template->set_block('main_block', 'template_list_block', 'template_list');
225
$result = $database->query("SELECT * FROM ".TABLE_PREFIX."addons WHERE type = 'template' order by name");
226
if($result->numRows() > 0) {
227
	while($addon = $result->fetchRow()) {
228
		$template->set_var('FILE', $addon['directory']);
229
		$template->set_var('NAME', $addon['name']);
230
		if(($addon['directory'] == DEFAULT_TEMPLATE) ? $selected = ' selected' : $selected = '');
231
		$template->set_var('SELECTED', $selected);
232
		$template->parse('template_list', 'template_list_block', true);
233
	}
234
}
235

  
236
// Insert WYSIWYG modules
237
$template->set_block('main_block', 'editor_list_block', 'editor_list');
238
$file='none';  
239
$module_name=$TEXT['NONE'];  
240
$template->set_var('FILE', $file);  
241
$template->set_var('NAME', $module_name);  
242
if((!defined('WYSIWYG_EDITOR') OR $file == WYSIWYG_EDITOR) ? $selected = ' selected' : $selected = '');  
243
$template->set_var('SELECTED', $selected);  
244
$template->parse('editor_list', 'editor_list_block', true);  
245
$result = $database->query("SELECT * FROM ".TABLE_PREFIX."addons WHERE type = 'module' AND function = 'wysiwyg'");
246
if($result->numRows() > 0) {
247
	while($addon = $result->fetchRow()) {
248
		$template->set_var('FILE', $addon['directory']);
249
		$template->set_var('NAME', $addon['name']);
250
		if((defined('WYSIWYG_EDITOR') AND $addon['directory'] == WYSIWYG_EDITOR) ? $selected = ' selected' : $selected = '');
251
		$template->set_var('SELECTED', $selected);
252
		$template->parse('editor_list', 'editor_list_block', true);
253
	}
254
}
255

  
256
// Insert templates for search settings
257
$template->set_block('main_block', 'search_template_list_block', 'search_template_list');
258
if($search_template == '') { $selected = ' selected'; } else { $selected = ''; }
259
$template->set_var(array('FILE' => '', 'NAME' => $TEXT['SYSTEM_DEFAULT'], 'SELECTED' => $selected));
260
$template->parse('search_template_list', 'search_template_list_block', true);
261
$result = $database->query("SELECT * FROM ".TABLE_PREFIX."addons WHERE type = 'template' order by name");
262
if($result->numRows() > 0) {
263
	while($addon = $result->fetchRow()) {
264
		$template->set_var('FILE', $addon['directory']);
265
		$template->set_var('NAME', $addon['name']);
266
		if($addon['directory'] == $search_template ? $selected = ' selected' : $selected = '');
267
		$template->set_var('SELECTED', $selected);
268
		$template->parse('search_template_list', 'search_template_list_block', true);
269
	}
270
}
271

  
272
// Insert default error reporting values
273
require(ADMIN_PATH.'/interface/er_levels.php');
274
$template->set_block('main_block', 'error_reporting_list_block', 'error_reporting_list');
275
foreach($ER_LEVELS AS $value => $title) {
276
	$template->set_var('VALUE', $value);
277
	$template->set_var('NAME', $title);
278
	if(ER_LEVEL == $value) {
279
		$template->set_var('SELECTED', 'selected');
280
	} else {
281
		$template->set_var('SELECTED', '');
282
	}
283
	$template->parse('error_reporting_list', 'error_reporting_list_block', true);
284
}
285

  
286
// Insert permissions values
287
if($admin->get_permission('settings_advanced') != true) {
288
	$template->set_var('DISPLAY_ADVANCED_BUTTON', 'hide');
289
}
290

  
291
// Insert page level limits
292
$template->set_block('main_block', 'page_level_limit_list_block', 'page_level_limit_list');
293
for($i = 1; $i <= 10; $i++) {
294
	$template->set_var('NUMBER', $i);
295
	if(PAGE_LEVEL_LIMIT == $i) {
296
		$template->set_var('SELECTED', 'selected');
297
	} else {
298
		$template->set_var('SELECTED', '');
299
	}
300
	$template->parse('page_level_limit_list', 'page_level_limit_list_block', true);
301
}
302

  
303
// Work-out if multiple menus feature is enabled
304
if(defined('MULTIPLE_MENUS') AND MULTIPLE_MENUS == true) {
305
	$template->set_var('MULTIPLE_MENUS_ENABLED', ' checked');
306
} else {
307
	$template->set_var('MULTIPLE_MENUS_DISABLED', ' checked');
308
}
309

  
310
// Work-out if page languages feature is enabled
311
if(defined('PAGE_LANGUAGES') AND PAGE_LANGUAGES == true) {
312
        $template->set_var('PAGE_LANGUAGES_ENABLED', ' checked');
313
} else {
314
        $template->set_var('PAGE_LANGUAGES_DISABLED', ' checked');
315
}
316

  
317
// Work-out if smart login feature is enabled
318
if(defined('SMART_LOGIN') AND SMART_LOGIN == true) {
319
	$template->set_var('SMART_LOGIN_ENABLED', ' checked');
320
} else {
321
	$template->set_var('SMART_LOGIN_DISABLED', ' checked');
322
}
323

  
324
// Work-out if captcha verification feature is enabled
325
if(defined('CAPTCHA_VERIFICATION') AND CAPTCHA_VERIFICATION == true) {
326
	$template->set_var('CAPTCHA_VERIFICATION_ENABLED', ' checked');
327
} else {
328
	$template->set_var('CAPTCHA_VERIFICATION_DISABLED', ' checked');
329
}
330
if(extension_loaded('gd') AND function_exists('imageCreateFromJpeg')) { /* Make's sure GD library is installed */
331
	$template->set_var('GD_EXTENSION_ENABLED', '');
332
} else {
333
	$template->set_var('GD_EXTENSION_ENABLED', 'none');
334
}
335

  
336
// Work-out if section blocks feature is enabled
337
if(defined('SECTION_BLOCKS') AND SECTION_BLOCKS == true) {
338
	$template->set_var('SECTION_BLOCKS_ENABLED', ' checked');
339
} else {
340
	$template->set_var('SECTION_BLOCKS_DISABLED', ' checked');
341
}
342

  
343
// Work-out if homepage redirection feature is enabled
344
if(defined('HOMEPAGE_REDIRECTION') AND HOMEPAGE_REDIRECTION == true) {
345
	$template->set_var('HOMEPAGE_REDIRECTION_ENABLED', ' checked');
346
} else {
347
	$template->set_var('HOMEPAGE_REDIRECTION_DISABLED', ' checked');
348
}
349

  
350
// Work-out which server os should be checked
351
if(OPERATING_SYSTEM == 'linux') {
352
	$template->set_var('LINUX_SELECTED', ' checked');
353
} elseif(OPERATING_SYSTEM == 'windows') {
354
	$template->set_var('WINDOWS_SELECTED', ' checked');
355
}
356

  
357
// Work-out if manage sections feature is enabled
358
if(MANAGE_SECTIONS) {
359
	$template->set_var('MANAGE_SECTIONS_ENABLED', ' checked');
360
} else {
361
	$template->set_var('MANAGE_SECTIONS_DISABLED', ' checked');
362
}
363

  
364
// Work-out which wbmailer routine should be checked
365
if(WBMAILER_ROUTINE == 'phpmail') {
366
	$template->set_var('PHPMAIL_SELECTED', ' checked');
367
	$template->set_var('SMTP_VISIBILITY', 'hidden');
368
	$template->set_var('SMTP_VISIBILITY_AUTH', 'hidden');
369
} elseif(WBMAILER_ROUTINE == 'smtp') {
370
	$template->set_var('SMTPMAIL_SELECTED', ' checked');
371
	$template->set_var('SMTP_VISIBILITY', 'visible');
372
}
373

  
374
// Work-out if SMTP authentification should be checked
375
if(WBMAILER_SMTP_AUTH) {
376
	$template->set_var('SMTP_AUTH_SELECTED', ' checked');
377
	if(WBMAILER_ROUTINE == 'smtp') {
378
		$template->set_var('SMTP_VISIBILITY_AUTH', 'visible');
379
	} else {
380
		$template->set_var('SMTP_VISIBILITY_AUTH', 'hidden');
381
	}
382
} else {
383
	$template->set_var('SMTP_VISIBILITY_AUTH', 'hidden');
384
}
385

  
386
// Work-out if intro feature is enabled
387
if(INTRO_PAGE) {
388
	$template->set_var('INTRO_PAGE_ENABLED', ' checked');
389
} else {
390
	$template->set_var('INTRO_PAGE_DISABLED', ' checked');
391
}
392

  
393
// Work-out if frontend login feature is enabled
394
if(FRONTEND_LOGIN) {
395
	$template->set_var('PRIVATE_ENABLED', ' checked');
396
} else {
397
	$template->set_var('PRIVATE_DISABLED', ' checked');
398
}
399

  
400
// Work-out if page trash feature is disabled, in-line, or separate
401
if(PAGE_TRASH == 'disabled') {
402
	$template->set_var('PAGE_TRASH_DISABLED', ' checked');
403
	$template->set_var('DISPLAY_PAGE_TRASH_SEPARATE', ' display: none;');
404
} elseif(PAGE_TRASH == 'inline') {
405
	$template->set_var('PAGE_TRASH_INLINE', ' checked');
406
	$template->set_var('DISPLAY_PAGE_TRASH_SEPARATE', ' display: none;');
407
} elseif(PAGE_TRASH == 'separate') {
408
	$template->set_var('PAGE_TRASH_SEPARATE', ' checked');
409
	$template->set_var('DISPLAY_PAGE_TRASH_SEPARATE', ' display: inline;');
410
}
411

  
412
// Work-out if media home folde feature is enabled
413
if(HOME_FOLDERS) {
414
	$template->set_var('HOME_FOLDERS_ENABLED', ' checked');
415
} else {
416
	$template->set_var('HOME_FOLDERS_DISABLED', ' checked');
417
}
418

  
419
// Insert search select
420
if(SEARCH == 'private') {
421
	$template->set_var('PRIVATE_SEARCH', 'selected');
422
} elseif(SEARCH == 'registered') {
423
	$template->set_var('REGISTERED_SEARCH', 'selected');
424
} elseif(SEARCH == 'none') {
425
	$template->set_var('NONE_SEARCH', 'selected');
426
}
427

  
428
// Work-out if 777 permissions are set
429
if(STRING_FILE_MODE == '0777' AND STRING_DIR_MODE == '0777') {
430
	$template->set_var('WORLD_WRITEABLE_SELECTED', ' checked');
431
}
432

  
433
// Work-out which file mode boxes are checked
434
if(extract_permission(STRING_FILE_MODE, 'u', 'r')) {
435
	$template->set_var('FILE_U_R_CHECKED', 'checked');
436
}
437
if(extract_permission(STRING_FILE_MODE, 'u', 'w')) {
438
	$template->set_var('FILE_U_W_CHECKED', 'checked');
439
}
440
if(extract_permission(STRING_FILE_MODE, 'u', 'e')) {
441
	$template->set_var('FILE_U_E_CHECKED', 'checked');
442
}
443
if(extract_permission(STRING_FILE_MODE, 'g', 'r')) {
444
	$template->set_var('FILE_G_R_CHECKED', 'checked');
445
}
446
if(extract_permission(STRING_FILE_MODE, 'g', 'w')) {
447
	$template->set_var('FILE_G_W_CHECKED', 'checked');
448
}
449
if(extract_permission(STRING_FILE_MODE, 'g', 'e')) {
450
	$template->set_var('FILE_G_E_CHECKED', 'checked');
451
}
452
if(extract_permission(STRING_FILE_MODE, 'o', 'r')) {
453
	$template->set_var('FILE_O_R_CHECKED', 'checked');
454
}
455
if(extract_permission(STRING_FILE_MODE, 'o', 'w')) {
456
	$template->set_var('FILE_O_W_CHECKED', 'checked');
457
}
458
if(extract_permission(STRING_FILE_MODE, 'o', 'e')) {
459
	$template->set_var('FILE_O_E_CHECKED', 'checked');
460
}
461
// Work-out which dir mode boxes are checked
462
if(extract_permission(STRING_DIR_MODE, 'u', 'r')) {
463
	$template->set_var('DIR_U_R_CHECKED', 'checked');
464
}
465
if(extract_permission(STRING_DIR_MODE, 'u', 'w')) {
466
	$template->set_var('DIR_U_W_CHECKED', 'checked');
467
}
468
if(extract_permission(STRING_DIR_MODE, 'u', 'e')) {
469
	$template->set_var('DIR_U_E_CHECKED', 'checked');
470
}
471
if(extract_permission(STRING_DIR_MODE, 'g', 'r')) {
472
	$template->set_var('DIR_G_R_CHECKED', 'checked');
473
}
474
if(extract_permission(STRING_DIR_MODE, 'g', 'w')) {
475
	$template->set_var('DIR_G_W_CHECKED', 'checked');
476
}
477
if(extract_permission(STRING_DIR_MODE, 'g', 'e')) {
478
	$template->set_var('DIR_G_E_CHECKED', 'checked');
479
}
480
if(extract_permission(STRING_DIR_MODE, 'o', 'r')) {
481
	$template->set_var('DIR_O_R_CHECKED', 'checked');
482
}
483
if(extract_permission(STRING_DIR_MODE, 'o', 'w')) {
484
	$template->set_var('DIR_O_W_CHECKED', 'checked');
485
}
486
if(extract_permission(STRING_DIR_MODE, 'o', 'e')) {
487
	$template->set_var('DIR_O_E_CHECKED', 'checked');
488
}
489

  
490
// Insert Server Email value into template
491
$template->set_var('SERVER_EMAIL', SERVER_EMAIL);
492

  
493
// Insert groups into signup list
494
$template->set_block('main_block', 'group_list_block', 'group_list');
495
$results = $database->query("SELECT group_id, name FROM ".TABLE_PREFIX."groups WHERE group_id != '1'");
496
if($results->numRows() > 0) {
497
	while($group = $results->fetchRow()) {
498
		$template->set_var('ID', $group['group_id']);
499
		$template->set_var('NAME', $group['name']);
500
		if(FRONTEND_SIGNUP == $group['group_id']) {
501
			$template->set_var('SELECTED', 'selected');
502
		} else {
503
			$template->set_var('SELECTED', '');
504
		}
505
		$template->parse('group_list', 'group_list_block', true);
506
	}
507
} else {
508
	$template->set_var('ID', 'disabled');
509
	$template->set_var('NAME', $MESSAGE['GROUPS']['NO_GROUPS_FOUND']);
510
	$template->parse('group_list', 'group_list_block', true);
511
}
512

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

  
621
// Parse template objects output
622
$template->parse('main', 'main_block', false);
623
$template->pparse('output', 'page');
624

  
625
$admin->print_footer();
626

  
627
?>

Also available in: Unified diff