Project

General

Profile

« Previous | Next » 

Revision 1241

Added by Dietmar almost 15 years ago

Ticket #906 Search Template bug
update editor min width logic
dragableresize table

View differences:

index.php
1
<?php
2

  
3
// $Id$
4

  
5
/*
6

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

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

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

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

  
24
*/
25

  
26
require('../../config.php');
27
require_once(WB_PATH.'/framework/class.admin.php');
28
if(isset($_GET['advanced']) AND $_GET['advanced'] == 'yes') {
29
	$admin = new admin('Settings', 'settings_advanced');
30
} else {
31
	$admin = new admin('Settings', 'settings_basic');
32
}
33

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

  
38
// Create new template object
39
$template = new Template(THEME_PATH.'/templates');
40
$template->set_file('page', 'settings.htt');
41
$template->set_block('page', 'main_block', 'main');
42

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

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

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

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

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

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

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

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

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

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

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

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

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

  
281
// Insert templates for search settings
282
$template->set_block('main_block', 'search_template_list_block', 'search_template_list');
283
if($search_template == '') { $selected = ' selected="selected"'; } else { $selected = ''; }
284
$template->set_var(array('FILE' => '', 'NAME' => $TEXT['SYSTEM_DEFAULT'], 'SELECTED' => $selected));
285
$template->parse('search_template_list', 'search_template_list_block', true);
286
$result = $database->query("SELECT * FROM ".TABLE_PREFIX."addons WHERE type = 'template' order by name");
287
if($result->numRows() > 0) {
288
	while($addon = $result->fetchRow()) {
289
		$template->set_var('FILE', $addon['directory']);
290
		$template->set_var('NAME', $addon['name']);
291
		if($addon['directory'] == $search_template ? $selected = ' selected="selected"' : $selected = '');
292
		$template->set_var('SELECTED', $selected);
293
		$template->parse('search_template_list', 'search_template_list_block', true);
294
	}
295
}
296

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

  
649
$admin->print_footer();
650

  
651
?>
1
<?php
2
/****************************************************************************
3
* SVN Version information:
4
*
5
* $Id$
6
*
7
*****************************************************************************
8
*                          WebsiteBaker
9
*
10
* WebsiteBaker Project <http://www.websitebaker2.org/>
11
* Copyright (C) 2009, Website Baker Org. e.V.
12
*         http://start.websitebaker2.org/impressum-datenschutz.php
13
* Copyright (C) 2004-2009, Ryan Djurovich
14
*
15
*                        About WebsiteBaker
16
*
17
* Website Baker is a PHP-based Content Management System (CMS)
18
* designed with one goal in mind: to enable its users to produce websites
19
* with ease.
20
*
21
*****************************************************************************
22
*
23
*****************************************************************************
24
*                        LICENSE INFORMATION
25
*
26
* WebsiteBaker is free software; you can redistribute it and/or
27
* modify it under the terms of the GNU General Public License
28
* as published by the Free Software Foundation; either version 2
29
* of the License, or (at your option) any later version.
30
*
31
* WebsiteBaker is distributed in the hope that it will be useful,
32
* but WITHOUT ANY WARRANTY; without even the implied warranty of
33
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
34
* See the GNU General Public License for more details.
35
*
36
* You should have received a copy of the GNU General Public License
37
* along with this program; if not, write to the Free Software
38
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
39
****************************************************************************
40
*
41
*                   WebsiteBaker Extra Information
42
*
43
*
44
*
45
*
46
*****************************************************************************/
47
/**
48
 *
49
 * @category     admin
50
 * @package      settings
51
 * @author       Ryan Djurovich
52
 * @copyright    2004-2009, Ryan Djurovich
53
 * @copyright    2009-2010, Website Baker Org. e.V.
54
 * @version      $Id$
55
 * @platform     WebsiteBaker 2.8.x
56
 * @requirements >= PHP 4.3.4
57
 * @license      http://www.gnu.org/licenses/gpl.html
58
 *
59
 */
60

  
61
require('../../config.php');
62
require_once(WB_PATH.'/framework/class.admin.php');
63
if(isset($_GET['advanced']) AND $_GET['advanced'] == 'yes') {
64
	$admin = new admin('Settings', 'settings_advanced');
65
} else {
66
	$admin = new admin('Settings', 'settings_basic');
67
}
68

  
69
// Include the WB functions file
70
require_once(WB_PATH.'/framework/functions.php');
71
require_once(WB_PATH.'/framework/functions-utf8.php');
72

  
73
// Create new template object
74
$template = new Template(THEME_PATH.'/templates');
75
$template->set_file('page', 'settings.htt');
76
$template->set_block('page', 'main_block', 'main');
77

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

  
88
// Query current settings in the db, then loop through them and print them
89
$query = "SELECT * FROM ".TABLE_PREFIX."search WHERE extra = ''";
90
$results = $database->query($query);
91
while($setting = $results->fetchRow()) {
92
	$setting_name = $setting['name'];
93
	$setting_value = htmlspecialchars(($setting['value']));
94
	switch($setting_name) {
95
		// Search header
96
		case 'header':
97
			$template->set_var('SEARCH_HEADER', $setting_value);
98
		break;
99
		// Search results header
100
		case 'results_header':
101
			$template->set_var('SEARCH_RESULTS_HEADER', $setting_value);
102
		break;
103
		// Search results loop
104
		case 'results_loop':
105
			$template->set_var('SEARCH_RESULTS_LOOP', $setting_value);
106
		break;
107
		// Search results footer
108
		case 'results_footer':
109
			$template->set_var('SEARCH_RESULTS_FOOTER', $setting_value);
110
		break;
111
		// Search no results
112
		case 'no_results':
113
			$template->set_var('SEARCH_NO_RESULTS', $setting_value);
114
		break;
115
		// Search footer
116
		case 'footer':
117
			$template->set_var('SEARCH_FOOTER', $setting_value);
118
		break;
119
		// Search module-order
120
		case 'module_order':
121
			$template->set_var('SEARCH_MODULE_ORDER', $setting_value);
122
		break;
123
		// Search max lines of excerpt
124
		case 'max_excerpt':
125
			$template->set_var('SEARCH_MAX_EXCERPT', $setting_value);
126
		break;
127
		// time-limit
128
		case 'time_limit':
129
			$template->set_var('SEARCH_TIME_LIMIT', $setting_value);
130
		break;
131
		// Search template
132
		case 'template':
133
			$search_template = $setting_value;
134
		break;
135
	}
136
}
137

  
138
// Do the same for settings stored in config file as with ones in db
139
$database_type = '';
140

  
141
// Tell the browser whether or not to show advanced options
142
if(isset($_GET['advanced']) AND $_GET['advanced'] == 'yes') {
143
	$template->set_var('DISPLAY_ADVANCED', '');
144
	$template->set_var('ADVANCED', 'yes');
145
	$template->set_var('ADVANCED_BUTTON', '&lt;&lt; '.$TEXT['HIDE_ADVANCED']);
146
	$template->set_var('ADVANCED_LINK', 'index.php?advanced=no');
147
	$template->set_var('BASIC_FILE_PERMS_ID', 'hide');
148
	$template->set_var('ADVANCED_FILE_PERMS_ID', 'file_perms_box');
149
} else {
150
	$template->set_var('DISPLAY_ADVANCED', ' style="display: none;"');
151
	$template->set_var('ADVANCED', 'no');
152
	$template->set_var('ADVANCED_BUTTON', $TEXT['SHOW_ADVANCED'].' &gt;&gt;');
153
	$template->set_var('ADVANCED_LINK', 'index.php?advanced=yes');
154
	$template->set_var('BASIC_FILE_PERMS_ID', 'file_perms_box');
155
	$template->set_var('ADVANCED_FILE_PERMS_ID', 'hide');
156
}
157

  
158
$template->set_var(array(	
159
									'PAGES_DIRECTORY' => PAGES_DIRECTORY,
160
									'MEDIA_DIRECTORY' => MEDIA_DIRECTORY,
161
									'PAGE_EXTENSION' => PAGE_EXTENSION,
162
									'PAGE_SPACER' => PAGE_SPACER,
163
									'WB_PATH' => WB_PATH,
164
									'WB_URL' => WB_URL,
165
									'THEME_URL' => THEME_URL,
166
									'ADMIN_PATH' => ADMIN_PATH,
167
									'ADMIN_URL' => ADMIN_URL,
168
									'DATABASE_TYPE' => DB_TYPE,
169
									'DATABASE_HOST' => DB_HOST,
170
									'DATABASE_USERNAME' => DB_USERNAME,
171
									'DATABASE_NAME' => DB_NAME,
172
									'TABLE_PREFIX' => TABLE_PREFIX
173
								 )
174
						 );
175

  
176
// Insert language values
177
$template->set_block('main_block', 'language_list_block', 'language_list');
178
$result = $database->query("SELECT * FROM ".TABLE_PREFIX."addons WHERE type = 'language' order by name");
179
if($result->numRows() > 0) {
180
	while($addon = $result->fetchRow()) {
181
		$l_codes[$addon['name']] = $addon['directory'];
182
		$l_names[$addon['name']] = entities_to_7bit($addon['name']); // sorting-problem workaround
183
	}
184
	asort($l_names);
185
	foreach($l_names as $l_name=>$v) {
186
		// Insert code and name
187
		$template->set_var(array(
188
								'CODE' => $l_codes[$l_name],
189
								'NAME' => $l_name,
190
								'FLAG' => THEME_URL.'/images/flags/'.strtolower($l_codes[$l_name]),
191
								));
192
		// Check if it is selected
193
		if(DEFAULT_LANGUAGE == $l_codes[$l_name]) {
194
			$template->set_var('SELECTED', ' selected="selected"');
195
		} else {
196
			$template->set_var('SELECTED', '');
197
		}
198
		$template->parse('language_list', 'language_list_block', true);
199
	}
200
}
201

  
202
// Insert default timezone values
203
require(ADMIN_PATH.'/interface/timezones.php');
204
$template->set_block('main_block', 'timezone_list_block', 'timezone_list');
205
foreach($TIMEZONES AS $hour_offset => $title) {
206
	// Make sure we dont list "System Default" as we are setting this value!
207
	if($hour_offset != '-20') {
208
		$template->set_var('VALUE', $hour_offset);
209
		$template->set_var('NAME', $title);
210
		if(DEFAULT_TIMEZONE == $hour_offset*60*60) {
211
			$template->set_var('SELECTED', ' selected="selected"');
212
		} else {
213
			$template->set_var('SELECTED', '');
214
		}
215
		$template->parse('timezone_list', 'timezone_list_block', true);
216
	}
217
}
218

  
219
// Insert default charset values
220
require(ADMIN_PATH.'/interface/charsets.php');
221
$template->set_block('main_block', 'charset_list_block', 'charset_list');
222
foreach($CHARSETS AS $code => $title) {
223
	$template->set_var('VALUE', $code);
224
	$template->set_var('NAME', $title);
225
	if(DEFAULT_CHARSET == $code) {
226
		$template->set_var('SELECTED', ' selected="selected"');
227
	} else {
228
		$template->set_var('SELECTED', '');
229
	}
230
	$template->parse('charset_list', 'charset_list_block', true);
231
}
232

  
233
// Insert date format list
234
require(ADMIN_PATH.'/interface/date_formats.php');
235
$template->set_block('main_block', 'date_format_list_block', 'date_format_list');
236
foreach($DATE_FORMATS AS $format => $title) {
237
	$format = str_replace('|', ' ', $format); // Add's white-spaces (not able to be stored in array key)
238
	if($format != 'system_default') {
239
		$template->set_var('VALUE', $format);
240
	} else {
241
		$template->set_var('VALUE', '');
242
	}
243
	$template->set_var('NAME', $title);
244
	if(DEFAULT_DATE_FORMAT == $format) {
245
		$template->set_var('SELECTED', ' selected="selected"');
246
	} else {
247
		$template->set_var('SELECTED', '');
248
	}
249
	$template->parse('date_format_list', 'date_format_list_block', true);
250
}
251

  
252
// Insert time format list
253
require(ADMIN_PATH.'/interface/time_formats.php');
254
$template->set_block('main_block', 'time_format_list_block', 'time_format_list');
255
foreach($TIME_FORMATS AS $format => $title) {
256
	$format = str_replace('|', ' ', $format); // Add's white-spaces (not able to be stored in array key)
257
	if($format != 'system_default') {
258
		$template->set_var('VALUE', $format);
259
	} else {
260
		$template->set_var('VALUE', '');
261
	}
262
	$template->set_var('NAME', $title);
263
	if(DEFAULT_TIME_FORMAT == $format) {
264
		$template->set_var('SELECTED', ' selected="selected"');
265
	} else {
266
		$template->set_var('SELECTED', '');
267
	}
268
	$template->parse('time_format_list', 'time_format_list_block', true);
269
}
270

  
271
// Insert templates
272
$template->set_block('main_block', 'template_list_block', 'template_list');
273
$result = $database->query("SELECT * FROM ".TABLE_PREFIX."addons WHERE type = 'template' AND function != 'theme' order by name");
274
if($result->numRows() > 0) {
275
	while($addon = $result->fetchRow()) {
276
		$template->set_var('FILE', $addon['directory']);
277
		$template->set_var('NAME', $addon['name']);
278
		if(($addon['directory'] == DEFAULT_TEMPLATE) ? $selected = ' selected="selected"' : $selected = '');
279
		$template->set_var('SELECTED', $selected);
280
		$template->parse('template_list', 'template_list_block', true);
281
	}
282
}
283

  
284
// Insert backend theme
285
$template->set_block('main_block', 'theme_list_block', 'theme_list');
286
$result = $database->query("SELECT * FROM ".TABLE_PREFIX."addons WHERE type = 'template' AND function = 'theme' order by name");
287
if($result->numRows() > 0) {
288
	while($addon = $result->fetchRow()) {
289
		$template->set_var('FILE', $addon['directory']);
290
		$template->set_var('NAME', $addon['name']);
291
		if(($addon['directory'] == DEFAULT_THEME) ? $selected = ' selected="selected"' : $selected = '');
292
		$template->set_var('SELECTED', $selected);
293
		$template->parse('theme_list', 'theme_list_block', true);
294
	}
295
}
296

  
297
// Insert WYSIWYG modules
298
$template->set_block('main_block', 'editor_list_block', 'editor_list');
299
$file='none';  
300
$module_name=$TEXT['NONE'];  
301
$template->set_var('FILE', $file);  
302
$template->set_var('NAME', $module_name);  
303
if((!defined('WYSIWYG_EDITOR') OR $file == WYSIWYG_EDITOR) ? $selected = ' selected="selected"' : $selected = '');
304
$template->set_var('SELECTED', $selected);
305
$template->parse('editor_list', 'editor_list_block', true);  
306
$result = $database->query("SELECT * FROM ".TABLE_PREFIX."addons WHERE type = 'module' AND function = 'wysiwyg'");
307
if($result->numRows() > 0) {
308
	while($addon = $result->fetchRow()) {
309
		$template->set_var('FILE', $addon['directory']);
310
		$template->set_var('NAME', $addon['name']);
311
		if((defined('WYSIWYG_EDITOR') AND $addon['directory'] == WYSIWYG_EDITOR) ? $selected = ' selected="selected"' : $selected = '');
312
		$template->set_var('SELECTED', $selected);
313
		$template->parse('editor_list', 'editor_list_block', true);
314
	}
315
}
316

  
317
// Insert templates for search settings
318
$template->set_block('main_block', 'search_template_list_block', 'search_template_list');
319
$search_template = ($search_template == DEFAULT_TEMPLATE) ? '' : $search_template;
320
if( $search_template == '')
321
{
322
    $selected = ' selected="selected"';
323
}
324
else
325
{
326
  $selected = '';
327
}
328

  
329
$template->set_var(array(
330
        'FILE' => DEFAULT_TEMPLATE,
331
        'NAME' => $TEXT['SYSTEM_DEFAULT'],
332
        'SELECTED' => $selected
333
    ));
334

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

  
338
if($result->numRows() > 0)
339
{
340
	while($addon = $result->fetchRow())
341
    {
342
		$template->set_var('FILE', $addon['directory']);
343
		$template->set_var('NAME', $addon['name']);
344

  
345
		if($addon['directory'] == $search_template)
346
        {
347
            $selected = ' selected="selected"';
348
        }
349
        else
350
        {
351
            $selected = '';
352
        }
353

  
354
		$template->set_var('SELECTED', $selected);
355
		$template->parse('search_template_list', 'search_template_list_block', true);
356
	}
357
}
358

  
359
// Insert default error reporting values
360
require(ADMIN_PATH.'/interface/er_levels.php');
361
$template->set_block('main_block', 'error_reporting_list_block', 'error_reporting_list');
362
foreach($ER_LEVELS AS $value => $title) {
363
	$template->set_var('VALUE', $value);
364
	$template->set_var('NAME', $title);
365
	if(ER_LEVEL == $value) {
366
		$template->set_var('SELECTED', ' selected="selected"');
367
	} else {
368
		$template->set_var('SELECTED', '');
369
	}
370
	$template->parse('error_reporting_list', 'error_reporting_list_block', true);
371
}
372

  
373
// Insert permissions values
374
if($admin->get_permission('settings_advanced') != true) {
375
	$template->set_var('DISPLAY_ADVANCED_BUTTON', 'hide');
376
}
377

  
378
// Insert page level limits
379
$template->set_block('main_block', 'page_level_limit_list_block', 'page_level_limit_list');
380
for($i = 1; $i <= 10; $i++) {
381
	$template->set_var('NUMBER', $i);
382
	if(PAGE_LEVEL_LIMIT == $i) {
383
		$template->set_var('SELECTED', ' selected="selected"');
384
	} else {
385
		$template->set_var('SELECTED', '');
386
	}
387
	$template->parse('page_level_limit_list', 'page_level_limit_list_block', true);
388
}
389

  
390
// Work-out if multiple menus feature is enabled
391
if(defined('MULTIPLE_MENUS') AND MULTIPLE_MENUS == true) {
392
	$template->set_var('MULTIPLE_MENUS_ENABLED', ' checked="checked"');
393
} else {
394
	$template->set_var('MULTIPLE_MENUS_DISABLED', ' checked="checked"');
395
}
396

  
397
// Work-out if page languages feature is enabled
398
if(defined('PAGE_LANGUAGES') AND PAGE_LANGUAGES == true) {
399
        $template->set_var('PAGE_LANGUAGES_ENABLED', ' checked="checked"');
400
} else {
401
        $template->set_var('PAGE_LANGUAGES_DISABLED', ' checked="checked"');
402
}
403

  
404
// Work-out if smart login feature is enabled
405
if(defined('SMART_LOGIN') AND SMART_LOGIN == true) {
406
	$template->set_var('SMART_LOGIN_ENABLED', ' checked="checked"');
407
} else {
408
	$template->set_var('SMART_LOGIN_DISABLED', ' checked="checked"');
409
}
410

  
411
if(extension_loaded('gd') AND function_exists('imageCreateFromJpeg')) { /* Make's sure GD library is installed */
412
	$template->set_var('GD_EXTENSION_ENABLED', '');
413
} else {
414
	$template->set_var('GD_EXTENSION_ENABLED', 'none');
415
}
416

  
417
// Work-out if section blocks feature is enabled
418
if(defined('SECTION_BLOCKS') AND SECTION_BLOCKS == true) {
419
	$template->set_var('SECTION_BLOCKS_ENABLED', ' checked="checked"');
420
} else {
421
	$template->set_var('SECTION_BLOCKS_DISABLED', ' checked="checked"');
422
}
423

  
424
// Work-out if homepage redirection feature is enabled
425
if(defined('HOMEPAGE_REDIRECTION') AND HOMEPAGE_REDIRECTION == true) {
426
	$template->set_var('HOMEPAGE_REDIRECTION_ENABLED', ' checked="checked"');
427
} else {
428
	$template->set_var('HOMEPAGE_REDIRECTION_DISABLED', ' checked="checked"');
429
}
430

  
431
// Work-out which server os should be checked
432
if(OPERATING_SYSTEM == 'linux') {
433
	$template->set_var('LINUX_SELECTED', ' checked="checked"');
434
} elseif(OPERATING_SYSTEM == 'windows') {
435
	$template->set_var('WINDOWS_SELECTED', ' checked="checked"');
436
}
437

  
438
// Work-out if manage sections feature is enabled
439
if(MANAGE_SECTIONS) {
440
	$template->set_var('MANAGE_SECTIONS_ENABLED', ' checked="checked"');
441
} else {
442
	$template->set_var('MANAGE_SECTIONS_DISABLED', ' checked="checked"');
443
}
444

  
445
// Work-out which wbmailer routine should be checked
446
if(WBMAILER_ROUTINE == 'phpmail') {
447
	$template->set_var('PHPMAIL_SELECTED', ' checked="checked"');
448
	$template->set_var('SMTP_VISIBILITY', 'none');
449
	$template->set_var('SMTP_VISIBILITY_AUTH', 'none');
450
} elseif(WBMAILER_ROUTINE == 'smtp') {
451
	$template->set_var('SMTPMAIL_SELECTED', ' checked="checked"');
452
	$template->set_var('SMTP_VISIBILITY', '');
453
}
454

  
455
// Work-out if SMTP authentification should be checked
456
if(WBMAILER_SMTP_AUTH) {
457
	$template->set_var('SMTP_AUTH_SELECTED', ' checked="checked"');
458
	if(WBMAILER_ROUTINE == 'smtp') {
459
		$template->set_var('SMTP_VISIBILITY_AUTH', '');
460
	} else {
461
		$template->set_var('SMTP_VISIBILITY_AUTH', 'none');
462
	}
463
} else {
464
	$template->set_var('SMTP_VISIBILITY_AUTH', 'none');
465
}
466

  
467
// Work-out if intro feature is enabled
468
if(INTRO_PAGE) {
469
	$template->set_var('INTRO_PAGE_ENABLED', ' checked="checked"');
470
} else {
471
	$template->set_var('INTRO_PAGE_DISABLED', ' checked="checked"');
472
}
473

  
474
// Work-out if frontend login feature is enabled
475
if(FRONTEND_LOGIN) {
476
	$template->set_var('PRIVATE_ENABLED', ' checked="checked"');
477
} else {
478
	$template->set_var('PRIVATE_DISABLED', ' checked="checked"');
479
}
480

  
481
// Work-out if page trash feature is disabled, in-line, or separate
482
if(PAGE_TRASH == 'disabled') {
483
	$template->set_var('PAGE_TRASH_DISABLED', ' checked="checked"');
484
	$template->set_var('DISPLAY_PAGE_TRASH_SEPARATE', ' display: none;');
485
} elseif(PAGE_TRASH == 'inline') {
486
	$template->set_var('PAGE_TRASH_INLINE', ' checked="checked"');
487
	$template->set_var('DISPLAY_PAGE_TRASH_SEPARATE', ' display: none;');
488
} elseif(PAGE_TRASH == 'separate') {
489
	$template->set_var('PAGE_TRASH_SEPARATE', ' checked="checked"');
490
	$template->set_var('DISPLAY_PAGE_TRASH_SEPARATE', ' display: inline;');
491
}
492

  
493
// Work-out if media home folde feature is enabled
494
if(HOME_FOLDERS) {
495
	$template->set_var('HOME_FOLDERS_ENABLED', ' checked="checked"');
496
} else {
497
	$template->set_var('HOME_FOLDERS_DISABLED', ' checked="checked"');
498
}
499

  
500
// Insert search select
501
if(SEARCH == 'private') {
502
	$template->set_var('PRIVATE_SEARCH', ' selected="selected"');
503
} elseif(SEARCH == 'registered') {
504
	$template->set_var('REGISTERED_SEARCH', ' selected="selected"');
505
} elseif(SEARCH == 'none') {
506
	$template->set_var('NONE_SEARCH', ' selected="selected"');
507
}
508

  
509
// Work-out if 777 permissions are set
510
if(STRING_FILE_MODE == '0777' AND STRING_DIR_MODE == '0777') {
511
	$template->set_var('WORLD_WRITEABLE_SELECTED', ' checked="checked"');
512
}
513

  
514
// Work-out which file mode boxes are checked
515
if(extract_permission(STRING_FILE_MODE, 'u', 'r')) {
516
	$template->set_var('FILE_U_R_CHECKED', ' checked="checked"');
517
}
518
if(extract_permission(STRING_FILE_MODE, 'u', 'w')) {
519
	$template->set_var('FILE_U_W_CHECKED', ' checked="checked"');
520
}
521
if(extract_permission(STRING_FILE_MODE, 'u', 'e')) {
522
	$template->set_var('FILE_U_E_CHECKED', ' checked="checked"');
523
}
524
if(extract_permission(STRING_FILE_MODE, 'g', 'r')) {
525
	$template->set_var('FILE_G_R_CHECKED', ' checked="checked"');
526
}
527
if(extract_permission(STRING_FILE_MODE, 'g', 'w')) {
528
	$template->set_var('FILE_G_W_CHECKED', ' checked="checked"');
529
}
530
if(extract_permission(STRING_FILE_MODE, 'g', 'e')) {
531
	$template->set_var('FILE_G_E_CHECKED', ' checked="checked"');
532
}
533
if(extract_permission(STRING_FILE_MODE, 'o', 'r')) {
534
	$template->set_var('FILE_O_R_CHECKED', ' checked="checked"');
535
}
536
if(extract_permission(STRING_FILE_MODE, 'o', 'w')) {
537
	$template->set_var('FILE_O_W_CHECKED', ' checked="checked"');
538
}
539
if(extract_permission(STRING_FILE_MODE, 'o', 'e')) {
540
	$template->set_var('FILE_O_E_CHECKED', ' checked="checked"');
541
}
542
// Work-out which dir mode boxes are checked
543
if(extract_permission(STRING_DIR_MODE, 'u', 'r')) {
544
	$template->set_var('DIR_U_R_CHECKED', ' checked="checked"');
545
}
546
if(extract_permission(STRING_DIR_MODE, 'u', 'w')) {
547
	$template->set_var('DIR_U_W_CHECKED', ' checked="checked"');
548
}
549
if(extract_permission(STRING_DIR_MODE, 'u', 'e')) {
550
	$template->set_var('DIR_U_E_CHECKED', ' checked="checked"');
551
}
552
if(extract_permission(STRING_DIR_MODE, 'g', 'r')) {
553
	$template->set_var('DIR_G_R_CHECKED', ' checked="checked"');
554
}
555
if(extract_permission(STRING_DIR_MODE, 'g', 'w')) {
556
	$template->set_var('DIR_G_W_CHECKED', ' checked="checked"');
557
}
558
if(extract_permission(STRING_DIR_MODE, 'g', 'e')) {
559
	$template->set_var('DIR_G_E_CHECKED', ' checked="checked"');
560
}
561
if(extract_permission(STRING_DIR_MODE, 'o', 'r')) {
562
	$template->set_var('DIR_O_R_CHECKED', ' checked="checked"');
563
}
564
if(extract_permission(STRING_DIR_MODE, 'o', 'w')) {
565
	$template->set_var('DIR_O_W_CHECKED', ' checked="checked"');
566
}
567
if(extract_permission(STRING_DIR_MODE, 'o', 'e')) {
568
	$template->set_var('DIR_O_E_CHECKED', ' checked="checked"');
569
}
570

  
571
// Insert Server Email value into template
572
$template->set_var('SERVER_EMAIL', SERVER_EMAIL);
573

  
574
// Insert groups into signup list
575
$template->set_block('main_block', 'group_list_block', 'group_list');
576
$results = $database->query("SELECT group_id, name FROM ".TABLE_PREFIX."groups WHERE group_id != '1'");
577
if($results->numRows() > 0) {
578
	while($group = $results->fetchRow()) {
579
		$template->set_var('ID', $group['group_id']);
580
		$template->set_var('NAME', $group['name']);
581
		if(FRONTEND_SIGNUP == $group['group_id']) {
582
			$template->set_var('SELECTED', ' selected="selected"');
583
		} else {
584
			$template->set_var('SELECTED', '');
585
		}
586
		$template->parse('group_list', 'group_list_block', true);
587
	}
588
} else {
589
	$template->set_var('ID', 'disabled');
590
	$template->set_var('NAME', $MESSAGE['GROUPS']['NO_GROUPS_FOUND']);
591
	$template->parse('group_list', 'group_list_block', true);
592
}
593

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

  
707
// Parse template objects output
708
$template->parse('main', 'main_block', false);
709
$template->pparse('output', 'page');
710

  
711
$admin->print_footer();
712

  
713
?>

Also available in: Unified diff