Project

General

Profile

« Previous | Next » 

Revision 417

Added by doc almost 18 years ago

Updated some core files to allow the configuration of PHPMailer via the admin settings panel instead of config.php. PHPMailer related settings are now stored in the Website Baker database. The following settings can be configured:
SMTP-host, SMTP-authentification , SMTP-password and SMTP-username.

View differences:

index.php
1
<?php
2

  
3
// $Id$
4

  
5
/*
6

  
7
 Website Baker Project <http://www.websitebaker.org/>
8
 Copyright (C) 2004-2007, 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 tools into tool list
127
$template->set_block('main_block', 'tool_list_block', 'tool_list');
128
$results = $database->query("SELECT * FROM ".TABLE_PREFIX."addons WHERE type = 'module' AND function = 'tool'");
129
if($results->numRows() > 0) {
130
	while($tool = $results->fetchRow()) {
131
		$template->set_var('TOOL_NAME', $tool['name']);
132
		$template->set_var('TOOL_DIR', $tool['directory']);
133
		$template->set_var('TOOL_DESCRIPTION', $tool['description']);
134
		$template->parse('tool_list', 'tool_list_block', true);
135
	}
136
} else {
137
	$template->set_var('TOOL_LIST', $TEXT['NONE_FOUND']);	
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 directory");
143
if($result->numRows() > 0) {
144
	while ($addon = $result->fetchRow()) {
145
		// Insert code and name
146
		$template->set_var(array(
147
								'CODE' => $addon['directory'],
148
								'NAME' => $addon['name']
149
								));
150
		// Check if it is selected
151
		if(DEFAULT_LANGUAGE == $addon['directory']) {
152
			$template->set_var('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');
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');
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');
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');
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' 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 = '');
237
		$template->set_var('SELECTED', $selected);
238
		$template->parse('template_list', 'template_list_block', true);
239
	}
240
}
241

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

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

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

  
292
// Insert permissions values
293
if($admin->get_permission('settings_advanced') != true) {
294
	$template->set_var('DISPLAY_ADVANCED_BUTTON', 'hide');
295
}
296

  
297
// Insert page level limits
298
$template->set_block('main_block', 'page_level_limit_list_block', 'page_level_limit_list');
299
for($i = 1; $i <= 10; $i++) {
300
	$template->set_var('NUMBER', $i);
301
	if(PAGE_LEVEL_LIMIT == $i) {
302
		$template->set_var('SELECTED', 'selected');
303
	} else {
304
		$template->set_var('SELECTED', '');
305
	}
306
	$template->parse('page_level_limit_list', 'page_level_limit_list_block', true);
307
}
308

  
309
// Work-out if multiple menus feature is enabled
310
if(defined('MULTIPLE_MENUS') AND MULTIPLE_MENUS == true) {
311
	$template->set_var('MULTIPLE_MENUS_ENABLED', ' checked');
312
} else {
313
	$template->set_var('MULTIPLE_MENUS_DISABLED', ' checked');
314
}
315

  
316
// Work-out if page languages feature is enabled
317
if(defined('PAGE_LANGUAGES') AND PAGE_LANGUAGES == true) {
318
        $template->set_var('PAGE_LANGUAGES_ENABLED', ' checked');
319
} else {
320
        $template->set_var('PAGE_LANGUAGES_DISABLED', ' checked');
321
}
322

  
323
// Work-out if smart login feature is enabled
324
if(defined('SMART_LOGIN') AND SMART_LOGIN == true) {
325
	$template->set_var('SMART_LOGIN_ENABLED', ' checked');
326
} else {
327
	$template->set_var('SMART_LOGIN_DISABLED', ' checked');
328
}
329

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

  
342
// Work-out if section blocks feature is enabled
343
if(defined('SECTION_BLOCKS') AND SECTION_BLOCKS == true) {
344
	$template->set_var('SECTION_BLOCKS_ENABLED', ' checked');
345
} else {
346
	$template->set_var('SECTION_BLOCKS_DISABLED', ' checked');
347
}
348

  
349
// Work-out if homepage redirection feature is enabled
350
if(defined('HOMEPAGE_REDIRECTION') AND HOMEPAGE_REDIRECTION == true) {
351
	$template->set_var('HOMEPAGE_REDIRECTION_ENABLED', ' checked');
352
} else {
353
	$template->set_var('HOMEPAGE_REDIRECTION_DISABLED', ' checked');
354
}
355

  
356
// Work-out which server os should be checked
357
if(OPERATING_SYSTEM == 'linux') {
358
	$template->set_var('LINUX_SELECTED', ' checked');
359
} elseif(OPERATING_SYSTEM == 'windows') {
360
	$template->set_var('WINDOWS_SELECTED', ' checked');
361
}
362

  
363
// Work-out if manage sections feature is enabled
364
if(MANAGE_SECTIONS) {
365
	$template->set_var('MANAGE_SECTIONS_ENABLED', ' checked');
366
} else {
367
	$template->set_var('MANAGE_SECTIONS_DISABLED', ' checked');
368
}
369

  
370
// Work-out if intro feature is enabled
371
if(INTRO_PAGE) {
372
	$template->set_var('INTRO_PAGE_ENABLED', ' checked');
373
} else {
374
	$template->set_var('INTRO_PAGE_DISABLED', ' checked');
375
}
376

  
377
// Work-out if frontend login feature is enabled
378
if(FRONTEND_LOGIN) {
379
	$template->set_var('PRIVATE_ENABLED', ' checked');
380
} else {
381
	$template->set_var('PRIVATE_DISABLED', ' checked');
382
}
383

  
384
// Work-out if page trash feature is disabled, in-line, or separate
385
if(PAGE_TRASH == 'disabled') {
386
	$template->set_var('PAGE_TRASH_DISABLED', ' checked');
387
	$template->set_var('DISPLAY_PAGE_TRASH_SEPARATE', ' display: none;');
388
} elseif(PAGE_TRASH == 'inline') {
389
	$template->set_var('PAGE_TRASH_INLINE', ' checked');
390
	$template->set_var('DISPLAY_PAGE_TRASH_SEPARATE', ' display: none;');
391
} elseif(PAGE_TRASH == 'separate') {
392
	$template->set_var('PAGE_TRASH_SEPARATE', ' checked');
393
	$template->set_var('DISPLAY_PAGE_TRASH_SEPARATE', ' display: inline;');
394
}
395

  
396
// Work-out if media home folde feature is enabled
397
if(HOME_FOLDERS) {
398
	$template->set_var('HOME_FOLDERS_ENABLED', ' checked');
399
} else {
400
	$template->set_var('HOME_FOLDERS_DISABLED', ' checked');
401
}
402

  
403
// Insert search select
404
if(SEARCH == 'private') {
405
	$template->set_var('PRIVATE_SEARCH', 'selected');
406
} elseif(SEARCH == 'registered') {
407
	$template->set_var('REGISTERED_SEARCH', 'selected');
408
} elseif(SEARCH == 'none') {
409
	$template->set_var('NONE_SEARCH', 'selected');
410
}
411

  
412
// Work-out if 777 permissions are set
413
if(STRING_FILE_MODE == '0777' AND STRING_DIR_MODE == '0777') {
414
	$template->set_var('WORLD_WRITEABLE_SELECTED', ' checked');
415
}
416

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

  
474
// Insert Server Email value into template
475
$template->set_var('SERVER_EMAIL', SERVER_EMAIL);
476

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

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

  
593
// Parse template objects output
594
$template->parse('main', 'main_block', false);
595
$template->pparse('output', 'page');
596

  
597
$admin->print_footer();
598

  
1
<?php
2

  
3
// $Id$
4

  
5
/*
6

  
7
 Website Baker Project <http://www.websitebaker.org/>
8
 Copyright (C) 2004-2007, 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 tools into tool list
127
$template->set_block('main_block', 'tool_list_block', 'tool_list');
128
$results = $database->query("SELECT * FROM ".TABLE_PREFIX."addons WHERE type = 'module' AND function = 'tool'");
129
if($results->numRows() > 0) {
130
	while($tool = $results->fetchRow()) {
131
		$template->set_var('TOOL_NAME', $tool['name']);
132
		$template->set_var('TOOL_DIR', $tool['directory']);
133
		$template->set_var('TOOL_DESCRIPTION', $tool['description']);
134
		$template->parse('tool_list', 'tool_list_block', true);
135
	}
136
} else {
137
	$template->set_var('TOOL_LIST', $TEXT['NONE_FOUND']);	
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 directory");
143
if($result->numRows() > 0) {
144
	while ($addon = $result->fetchRow()) {
145
		// Insert code and name
146
		$template->set_var(array(
147
								'CODE' => $addon['directory'],
148
								'NAME' => $addon['name']
149
								));
150
		// Check if it is selected
151
		if(DEFAULT_LANGUAGE == $addon['directory']) {
152
			$template->set_var('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');
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');
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');
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');
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' 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 = '');
237
		$template->set_var('SELECTED', $selected);
238
		$template->parse('template_list', 'template_list_block', true);
239
	}
240
}
241

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

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

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

  
292
// Insert permissions values
293
if($admin->get_permission('settings_advanced') != true) {
294
	$template->set_var('DISPLAY_ADVANCED_BUTTON', 'hide');
295
}
296

  
297
// Insert page level limits
298
$template->set_block('main_block', 'page_level_limit_list_block', 'page_level_limit_list');
299
for($i = 1; $i <= 10; $i++) {
300
	$template->set_var('NUMBER', $i);
301
	if(PAGE_LEVEL_LIMIT == $i) {
302
		$template->set_var('SELECTED', 'selected');
303
	} else {
304
		$template->set_var('SELECTED', '');
305
	}
306
	$template->parse('page_level_limit_list', 'page_level_limit_list_block', true);
307
}
308

  
309
// Work-out if multiple menus feature is enabled
310
if(defined('MULTIPLE_MENUS') AND MULTIPLE_MENUS == true) {
311
	$template->set_var('MULTIPLE_MENUS_ENABLED', ' checked');
312
} else {
313
	$template->set_var('MULTIPLE_MENUS_DISABLED', ' checked');
314
}
315

  
316
// Work-out if page languages feature is enabled
317
if(defined('PAGE_LANGUAGES') AND PAGE_LANGUAGES == true) {
318
        $template->set_var('PAGE_LANGUAGES_ENABLED', ' checked');
319
} else {
320
        $template->set_var('PAGE_LANGUAGES_DISABLED', ' checked');
321
}
322

  
323
// Work-out if smart login feature is enabled
324
if(defined('SMART_LOGIN') AND SMART_LOGIN == true) {
325
	$template->set_var('SMART_LOGIN_ENABLED', ' checked');
326
} else {
327
	$template->set_var('SMART_LOGIN_DISABLED', ' checked');
328
}
329

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

  
342
// Work-out if section blocks feature is enabled
343
if(defined('SECTION_BLOCKS') AND SECTION_BLOCKS == true) {
344
	$template->set_var('SECTION_BLOCKS_ENABLED', ' checked');
345
} else {
346
	$template->set_var('SECTION_BLOCKS_DISABLED', ' checked');
347
}
348

  
349
// Work-out if homepage redirection feature is enabled
350
if(defined('HOMEPAGE_REDIRECTION') AND HOMEPAGE_REDIRECTION == true) {
351
	$template->set_var('HOMEPAGE_REDIRECTION_ENABLED', ' checked');
352
} else {
353
	$template->set_var('HOMEPAGE_REDIRECTION_DISABLED', ' checked');
354
}
355

  
356
// Work-out which server os should be checked
357
if(OPERATING_SYSTEM == 'linux') {
358
	$template->set_var('LINUX_SELECTED', ' checked');
359
} elseif(OPERATING_SYSTEM == 'windows') {
360
	$template->set_var('WINDOWS_SELECTED', ' checked');
361
}
362

  
363
// Work-out if manage sections feature is enabled
364
if(MANAGE_SECTIONS) {
365
	$template->set_var('MANAGE_SECTIONS_ENABLED', ' checked');
366
} else {
367
	$template->set_var('MANAGE_SECTIONS_DISABLED', ' checked');
368
}
369

  
370
// Work-out which wbmailer routine should be checked
371
if(WBMAILER_ROUTINE == 'phpmail') {
372
	$template->set_var('PHPMAIL_SELECTED', ' checked');
373
	$template->set_var('SMTP_VISIBILITY', 'hidden');
374
	$template->set_var('SMTP_VISIBILITY_AUTH', 'hidden');
375
} elseif(WBMAILER_ROUTINE == 'smtp') {
376
	$template->set_var('SMTPMAIL_SELECTED', ' checked');
377
	$template->set_var('SMTP_VISIBILITY', 'visible');
378
}
379

  
380
// Work-out if SMTP authentification should be checked
381
if(WBMAILER_SMTP_AUTH) {
382
	$template->set_var('SMTP_AUTH_SELECTED', ' checked');
383
	if(WBMAILER_ROUTINE == 'smtp') {
384
		$template->set_var('SMTP_VISIBILITY_AUTH', 'visible');
385
	} else {
386
		$template->set_var('SMTP_VISIBILITY_AUTH', 'hidden');
387
	}
388
} else {
389
	$template->set_var('SMTP_VISIBILITY_AUTH', 'hidden');
390
}
391

  
392
// Work-out if intro feature is enabled
393
if(INTRO_PAGE) {
394
	$template->set_var('INTRO_PAGE_ENABLED', ' checked');
395
} else {
396
	$template->set_var('INTRO_PAGE_DISABLED', ' checked');
397
}
398

  
399
// Work-out if frontend login feature is enabled
400
if(FRONTEND_LOGIN) {
401
	$template->set_var('PRIVATE_ENABLED', ' checked');
402
} else {
403
	$template->set_var('PRIVATE_DISABLED', ' checked');
404
}
405

  
406
// Work-out if page trash feature is disabled, in-line, or separate
407
if(PAGE_TRASH == 'disabled') {
408
	$template->set_var('PAGE_TRASH_DISABLED', ' checked');
409
	$template->set_var('DISPLAY_PAGE_TRASH_SEPARATE', ' display: none;');
410
} elseif(PAGE_TRASH == 'inline') {
411
	$template->set_var('PAGE_TRASH_INLINE', ' checked');
412
	$template->set_var('DISPLAY_PAGE_TRASH_SEPARATE', ' display: none;');
413
} elseif(PAGE_TRASH == 'separate') {
414
	$template->set_var('PAGE_TRASH_SEPARATE', ' checked');
415
	$template->set_var('DISPLAY_PAGE_TRASH_SEPARATE', ' display: inline;');
416
}
417

  
418
// Work-out if media home folde feature is enabled
419
if(HOME_FOLDERS) {
420
	$template->set_var('HOME_FOLDERS_ENABLED', ' checked');
421
} else {
422
	$template->set_var('HOME_FOLDERS_DISABLED', ' checked');
423
}
424

  
425
// Insert search select
426
if(SEARCH == 'private') {
427
	$template->set_var('PRIVATE_SEARCH', 'selected');
428
} elseif(SEARCH == 'registered') {
429
	$template->set_var('REGISTERED_SEARCH', 'selected');
430
} elseif(SEARCH == 'none') {
431
	$template->set_var('NONE_SEARCH', 'selected');
432
}
433

  
434
// Work-out if 777 permissions are set
435
if(STRING_FILE_MODE == '0777' AND STRING_DIR_MODE == '0777') {
436
	$template->set_var('WORLD_WRITEABLE_SELECTED', ' checked');
437
}
438

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

  
496
// Insert Server Email value into template
497
$template->set_var('SERVER_EMAIL', SERVER_EMAIL);
498

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

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

  
625
// Parse template objects output
626
$template->parse('main', 'main_block', false);
627
$template->pparse('output', 'page');
628

  
629
$admin->print_footer();
630

  
599 631
?>

Also available in: Unified diff