Project

General

Profile

1
<?php
2
/**
3
 *
4
 * @category        admin
5
 * @package         settings
6
 * @author          WebsiteBaker Project
7
 * @copyright       Ryan Djurovich
8
 * @copyright       WebsiteBaker Org. e.V.
9
 * @link            http://websitebaker.org/
10
 * @license         http://www.gnu.org/licenses/gpl.html
11
 * @platform        WebsiteBaker 2.8.3
12
 * @requirements    PHP 5.3.6 and higher
13
 * @version         $Id: index.php 35 2018-01-01 20:35:30Z Manuela $
14
 * @filesource      $HeadURL: svn://isteam.dynxs.de/wb/2.10.x/branches/main/admin/settings/index.php $
15
 * @lastmodified    $Date: 2018-01-01 21:35:30 +0100 (Mon, 01 Jan 2018) $
16
 *
17
 */
18
if ( !defined( 'WB_PATH' ) ){ require( dirname(dirname((__DIR__))).'/config.php' ); }
19
if ( !class_exists('admin', false) ) { require(WB_PATH.'/framework/class.admin.php'); }
20
/*---------------------------------------------------------------------------------------------------*/
21
$bAdvanced = intval ((@intval($_GET['advanced'])) ?: 0);
22
if($bAdvanced) {
23
    $admin = new admin('Settings', 'settings_advanced');
24
} else {
25
    $admin = new admin('Settings', 'settings_basic');
26
}
27
/*---------------------------------------------------------------------------------------------------*/
28
// Include the WB functions file
29
require_once(WB_PATH.'/framework/functions.php');
30
require_once(WB_PATH.'/framework/functions-utf8.php');
31
$cfg = array(
32
    'website_signature' => (defined('WEBSITE_SIGNATURE')?WEBSITE_SIGNATURE:'')
33
);
34
foreach($cfg as $key=>$value) {
35
    db_update_key_value('settings', $key, $value);
36
}
37

    
38
// Setup template object, parse vars to it, then parse it
39
// Create new template object
40
    $template = new Template(dirname($admin->correct_theme_source('settings.htt')), 'remove');
41
// $template->debug = true;
42
    $template->set_file('page',  'settings.htt');
43
    $template->set_block('page', 'main_block', 'main');
44
/*---------------------------------------------------------------------------------------------------*/
45
    $template->set_block('main_block', 'show_page_level_limit_block', 'show_page_level_limit');
46
    $template->set_block('main_block', 'show_checkbox_1_block',       'show_checkbox_1');
47
    $template->set_block('main_block', 'show_checkbox_2_block',       'show_checkbox_2');
48
    $template->set_block('main_block', 'show_checkbox_3_block',       'show_checkbox_3');
49
    $template->set_block('main_block', 'show_redirect_timer_block',   'show_redirect_timer');
50
    $template->set_block('main_block', 'show_php_error_level_block',  'show_php_error_level');
51
    $template->set_block('main_block', 'show_wysiwyg_block',          'show_wysiwyg');
52
    $template->set_block('main_block', 'show_charset_block',          'show_charset');
53
    $template->set_block('main_block', 'show_search_block',           'show_search');
54
    $template->set_block('main_block', 'show_access_block',           'show_access');
55
    $template->set_block('main_block', 'show_chmod_js_block',         'show_chmod_js');
56
    $template->set_block('main_block', 'show_setting_js_block',       'show_setting_js');
57
/*---------------------------------------------------------------------------------------------------*/
58
    if (!$oTrans) {
59
        $oTrans = Translate::getInstance();
60
    }
61
    $oTrans->enableAddon('templates\\'.basename(THEME_PATH));
62
    $aLang = $oTrans->getLangArray();
63
    $template->set_var($aLang);
64
// Query current settings in the db, then loop through them and print them
65
$query = "SELECT * FROM `".TABLE_PREFIX."settings`";
66
if($results = $database->query($query)) {
67
    $aSetting = array();
68
    $settings = array();
69
    while($aSetting = $results->fetchRow(MYSQLI_ASSOC))
70
    {
71
        $setting_name  = $aSetting['name'];
72
        $setting_value = $aSetting['value'];
73
        switch ($setting_name) :
74
            case 'wbmailer_smtp_password':
75
                break;
76
            default :
77
                $sFilterApi = WB_PATH.'/modules/output_filter/OutputFilterApi.php';
78
                if (is_readable($sFilterApi)) {
79
                    require_once($sFilterApi);
80
                    $setting_value = OutputFilterApi('ReplaceSysvar', $setting_value);
81
                }
82
                $setting_value = htmlspecialchars($setting_value);
83
                break;
84
        endswitch;
85
//        $setting_value = ( $setting_name != 'wbmailer_smtp_password' ) ? htmlspecialchars($aSetting['value']) : $aSetting['value'];
86
        $settings[$setting_name] = $setting_value;
87
        $template->set_var(strtoupper($setting_name),$setting_value);
88
    }
89
} else {
90

    
91
}
92
$SecureTokenLifeTime = $admin->getTokenLifeTime();
93
array_walk(
94
    $SecureTokenLifeTime,
95
    function (&$aItem) {
96
        $aItem /= 60;
97
    }
98
);
99
$template->set_var( $SecureTokenLifeTime );
100
/*---------------------------------------------------------------------------------------------------*/
101
$template->set_var('EDITOR_WEBSITE_HEADER', '');
102
$template->set_var('EDITOR_WEBSITE_FOOTER', '');
103
$template->set_var('EDITOR_WEBSITE_SIGNATURE', '');
104
if (defined('WYSIWYG_EDITOR') && is_readable(WB_PATH.'/modules/'.WYSIWYG_EDITOR.'/include1.php'))
105
{
106
    require(WB_PATH.'/modules/'.WYSIWYG_EDITOR.'/include.php');
107
    $template->set_block('main_block', 'show_website_header_block', 'show_website_header');
108
    if (defined('WYSIWYG_EDITOR')) {
109
        $template->set_block('show_website_header', '');
110
        $WebsiteHeader = show_wysiwyg_editor('website_header','content_header', WEBSITE_HEADER,'100%','200', 'WB_Mini', true);
111
        $template->set_var('EDITOR_WEBSITE_HEADER', $WebsiteHeader);
112
    } else {
113
        $template->parse('show_website_header','show_website_header_block',true);
114
    }
115
    $template->set_block('main_block', 'show_website_footer_block', 'show_website_footer');
116
    if (defined('WYSIWYG_EDITOR')) {
117
        $template->set_block('show_website_footer', '');
118
        $WebsiteFooter = show_wysiwyg_editor('website_footer','content_footer', WEBSITE_FOOTER, '100%','200', 'WB_Mini', true);
119
        $template->set_var('EDITOR_WEBSITE_FOOTER', $WebsiteFooter);
120
    } else {
121
        $template->parse('show_website_footer','show_website_footer_block',true);
122
    }
123
//
124
    $template->set_block('main_block', 'show_website_signature_block', 'show_website_signature');
125
    if (defined('WYSIWYG_EDITOR')) {
126
        $template->set_block('show_website_signature', '');
127
        $WebsiteSignature = show_wysiwyg_editor('website_header','content_header', WEBSITE_SIGNATURE,'100%','200', 'WB_Mini', true);
128
        $template->set_var('EDITOR_WEBSITE_SIGNATURE', $WebsiteSignature);
129
    } else {
130
        $template->parse('show_website_signature','show_website_signature_block',true);
131
    }
132
}
133
/*---------------------------------------------------------------------------------------------------*/
134
// Do the same for settings stored in config file as with ones in db
135
$database_type = '';
136
$is_advanced = (boolean)$bAdvanced;
137
// Tell the browser whether or not to show advanced options
138
if($is_advanced)
139
{
140
    $template->set_var('DISPLAY_ADVANCED', '');
141
    $template->set_var('ADVANCED_FILE_PERMS_ID', 'file_perms_box');
142
    $template->set_var('BASIC_FILE_PERMS_ID', 'hide');
143
    $template->set_var('ADVANCED_VALUE', 1);
144
    $template->set_var('ADVANCED_BUTTON', '&lt;&lt; '.$TEXT['HIDE_ADVANCED']);
145
    $template->set_var('ADVANCED_LINK', 'index.php?advanced=0');
146
} else {
147
    $template->set_var('DISPLAY_ADVANCED', ' style="display: none;"');
148
    $template->set_var('BASIC_FILE_PERMS_ID', 'file_perms_box');
149
    $template->set_var('ADVANCED_FILE_PERMS_ID', 'hide');
150
    $template->set_var('ADVANCED_VALUE', 0);
151
    $template->set_var('ADVANCED_BUTTON', $TEXT['SHOW_ADVANCED'].' &gt;&gt;');
152
    $template->set_var('ADVANCED_LINK', 'index.php?advanced=1');
153
}
154
/*---------------------------------------------------------------------------------------------------*/
155
    $query = 'SELECT * FROM `'.TABLE_PREFIX.'search` WHERE `extra` = \'\'';
156
    $results = $database->query($query);
157
    // Query current settings in the db, then loop through them and print them
158
    while($aSearch = $results->fetchRow(MYSQLI_ASSOC))
159
    {
160
        $search_name = $aSearch['name'];
161
        $search_value = htmlspecialchars(($aSearch['value']));
162
        switch($search_name) {
163
            // Search header
164
            case 'header':
165
                $template->set_var('SEARCH_HEADER', $search_value);
166
            break;
167
            // Search results header
168
            case 'results_header':
169
                $template->set_var('SEARCH_RESULTS_HEADER', $search_value);
170
            break;
171
            // Search results loop
172
            case 'results_loop':
173
                $template->set_var('SEARCH_RESULTS_LOOP', $search_value);
174
            break;
175
            // Search results footer
176
            case 'results_footer':
177
                $template->set_var('SEARCH_RESULTS_FOOTER', $search_value);
178
            break;
179
            // Search no results
180
            case 'no_results':
181
                $template->set_var('SEARCH_NO_RESULTS', $search_value);
182
            break;
183
            // Search footer
184
            case 'footer':
185
                $template->set_var('SEARCH_FOOTER', $search_value);
186
            break;
187
            // Search module-order
188
            case 'module_order':
189
                $template->set_var('SEARCH_MODULE_ORDER', $search_value);
190
            break;
191
            // Search max lines of excerpt
192
            case 'max_excerpt':
193
                $template->set_var('SEARCH_MAX_EXCERPT', $search_value);
194
            break;
195
            // time-limit
196
            case 'time_limit':
197
                $template->set_var('SEARCH_TIME_LIMIT', $search_value);
198
            break;
199
            // Search template
200
            case 'template':
201
                $search_template = $search_value;
202
            break;
203
        }
204
    }
205
/*---------------------------------------------------------------------------------------------------*/
206
    $template->set_var(array(
207
                        'WB_URL' => WB_URL,
208
                        'THEME_URL' => THEME_URL,
209
                        'ADMIN_URL' => ADMIN_URL,
210
                     ));
211
    $template->set_var('FTAN', $admin->getFTAN());
212
/*---------------------------------------------------------------------------------------------------*/
213
    // Insert page level limits
214
    $template->set_block('show_page_level_limit_block', 'page_level_limit_list_block', 'page_level_limit_list');
215
    $template->set_var('PAGE_LEVEL_LIMIT', $settings['page_level_limit']);
216
    // if select list
217
    for($i = 1; $i <= 10; $i++)
218
    {
219
        $template->set_var('NUMBER', $i);
220
        $template->set_var('SELECTED', ((PAGE_LEVEL_LIMIT == $i) ? ' selected="selected"' : '') );
221
        $template->parse('page_level_limit_list', 'page_level_limit_list_block', true);
222
    }
223
/*---------------------------------------------------------------------------------------------------*/
224
    // Insert groups into signup list
225
    $template->set_block('main_block', 'group_list_block', 'group_list');
226
    $sqlGroup = 'SELECT `group_id`, `name` FROM `'.TABLE_PREFIX.'groups` '
227
              . 'WHERE `group_id` != 1'
228
              . '';
229
    if($results = $database->query($sqlGroup))
230
    {
231
        while($group = $results->fetchRow(MYSQLI_ASSOC))
232
        {
233
            $template->set_var('ID', $group['group_id']);
234
            $template->set_var('NAME', $group['name']);
235
            $template->set_var('SELECTED', ((FRONTEND_SIGNUP == $group['group_id']) ? ' selected="selected"' : '') );
236
            $template->parse('group_list', 'group_list_block', true);
237
        }
238
    } else {
239
        $template->set_var('ID', 'disabled');
240
        $template->set_var('NAME', $MESSAGE['GROUPS']['NO_GROUPS_FOUND']);
241
        $template->parse('group_list', 'group_list_block', true);
242
    }
243
/*---------------------------------------------------------------------------------------------------*/
244
    // Insert default error reporting values
245
    $template->set_block('show_php_error_level_block', 'error_reporting_list_block',  'error_reporting_list');
246
        $template->set_var(['VALUE'=>'-1', 'NAME'=>'E_ALL', 'SELECTED'=>' selected="selected"']);
247
        $template->parse('error_reporting_list', 'error_reporting_list_block', true);
248
/*-------------------------------------------------------------------------------------*/
249
    // Insert WYSIWYG modules
250
    $template->set_block('show_wysiwyg_block', 'wysiwyg_list_block', 'wysiwyg_list');
251
    $file='none';
252
    $module_name=$TEXT['NONE'];
253
    $template->set_var('FILE', $file);
254
    $template->set_var('NAME', $module_name);
255
    $template->set_var('SELECTED', ((!defined('WYSIWYG_EDITOR') || $file == WYSIWYG_EDITOR) ? ' selected="selected"' : '') );
256
    $template->parse('wysiwyg_list', 'wysiwyg_list_block', true);
257
    $sqlEditor  = 'SELECT * FROM `'.TABLE_PREFIX.'addons` '
258
          . 'WHERE `type` = \'module\' '
259
          .   'AND `function` = \'wysiwyg\' '
260
          . 'ORDER BY `name`';
261
    if($result = $database->query($sqlEditor))
262
    {
263
        while($aWysiwyg = $result->fetchRow(MYSQLI_ASSOC))
264
        {
265
            $template->set_var('FILE', $aWysiwyg['directory']);
266
            $template->set_var('NAME', $aWysiwyg['name']);
267
            $template->set_var('SELECTED', ((!defined('WYSIWYG_EDITOR') || $aWysiwyg['directory'] == WYSIWYG_EDITOR) ? ' selected="selected"' : '') );
268
            $template->parse('wysiwyg_list', 'wysiwyg_list_block', true);
269
        }
270
    }
271
/*---------------------------------------------------------------------------------------------------*/
272
    // Insert language values
273
    $template->set_block('main_block', 'language_list_block', 'language_list');
274
    $sqlLang  = 'SELECT * FROM `'.TABLE_PREFIX.'addons` '
275
              . 'WHERE `type` = \'language\' '
276
              . 'ORDER BY `directory`';
277
    if($result = $database->query($sqlLang))
278
    {
279
        while($aLang = $result->fetchRow(MYSQLI_ASSOC)) {
280
            $langIcons = (empty($aLang['directory']) ? 'none' : strtolower($aLang['directory']));
281
            $template->set_var('CODE',        $aLang['directory']);
282
            $template->set_var('NAME',        $aLang['name']);
283
            $template->set_var('FLAG',        THEME_URL.'/images/flags/'.$langIcons);
284
            $template->set_var('SELECTED',    (DEFAULT_LANGUAGE == $aLang['directory'] ? ' selected="selected"' : '') );
285
            $template->parse('language_list', 'language_list_block', true);
286
        }
287
    }
288
/*---------------------------------------------------------------------------------------------------*/
289
    // Insert default timezone values
290
    $template->set_block('main_block', 'timezone_list_block', 'timezone_list');
291
    require(ADMIN_PATH.'/interface/timezones.php');
292
    foreach($TIMEZONES AS $hour_offset => $title)
293
    {
294
        // Make sure we dont list "System Default" as we are setting this value!
295
        if($hour_offset != '-20') {
296
            $template->set_var('VALUE', $hour_offset);
297
            $template->set_var('NAME', $title);
298
            $template->set_var('SELECTED', ( (DEFAULT_TIMEZONE == $hour_offset*60*60)?' selected="selected"':'' ) );
299
            $template->parse('timezone_list', 'timezone_list_block', true);
300
        }
301
    }
302
/*---------------------------------------------------------------------------------------------------*/
303
    // Insert default charset values
304
    $template->set_block('show_charset_block', 'charset_list_block', 'charset_list');
305
    require(ADMIN_PATH.'/interface/charsets.php');
306
    foreach($CHARSETS AS $code => $title) {
307
        $template->set_var('VALUE', $code);
308
        $template->set_var('NAME', $title);
309
        $template->set_var('SELECTED', ( (DEFAULT_CHARSET == $code)?' selected="selected"':'' ) );
310
        $template->parse('charset_list', 'charset_list_block', true);
311
    }
312
/*---------------------------------------------------------------------------------------------------*/
313
    // Insert date format list
314
    $template->set_block('main_block', 'date_format_list_block', 'date_format_list');
315
    require(ADMIN_PATH.'/interface/date_formats.php');
316
    foreach($DATE_FORMATS AS $format => $title) {
317
        $format = str_replace('|', ' ', $format); // Add's white-spaces (not able to be stored in array key)
318
        if($format != 'system_default') {
319
            $template->set_var('VALUE', $format);
320
        } else {
321
            $template->set_var('VALUE', '');
322
        }
323
        $template->set_var('NAME', $title);
324
        $template->set_var('SELECTED', ( (DEFAULT_DATE_FORMAT == $format)?' selected="selected"':'' ) );
325
        $template->parse('date_format_list', 'date_format_list_block', true);
326
    }
327
/*---------------------------------------------------------------------------------------------------*/
328
    // Insert time format list
329
    $template->set_block('main_block', 'time_format_list_block', 'time_format_list');
330
    require(ADMIN_PATH.'/interface/time_formats.php');
331
    foreach($TIME_FORMATS AS $format => $title) {
332
        $format = str_replace('|', ' ', $format); // Add's white-spaces (not able to be stored in array key)
333
        if($format != 'system_default') {
334
            $template->set_var('VALUE', $format);
335
        } else {
336
            $template->set_var('VALUE', '');
337
        }
338
        $template->set_var('NAME', $title);
339
        $template->set_var('SELECTED', ( (DEFAULT_TIME_FORMAT == $format)?' selected="selected"':'' ) );
340
        $template->parse('time_format_list', 'time_format_list_block', true);
341
    }
342
/*---------------------------------------------------------------------------------------------------*/
343
    // Insert templates
344
    $template->set_block('main_block', 'template_list_block', 'template_list');
345
    $sqlTheme = 'SELECT * FROM `'.TABLE_PREFIX.'addons` '
346
              . 'WHERE `type` = \'template\' '
347
              .   'AND `function` != \'theme\' '
348
              . 'ORDER BY `name`';
349
    if($result = $database->query($sqlTheme)) {
350
//    $result = $database->query("SELECT * FROM `".TABLE_PREFIX."addons` WHERE `type` = 'template' AND `function` != 'theme' ORDER BY `name`");
351
//    if($result->numRows() > 0) {
352
        while($addon = $result->fetchRow( MYSQLI_ASSOC )) {
353
            $template->set_var('FILE', $addon['directory']);
354
            $template->set_var('NAME', $addon['name']);
355
            $template->set_var('SELECTED', (($addon['directory'] == DEFAULT_TEMPLATE)?' selected="selected"':'') );
356
            $template->parse('template_list', 'template_list_block', true);
357
        }
358
    }
359
/*---------------------------------------------------------------------------------------------------*/
360
    // Insert backend theme
361
    $template->set_block('main_block', 'theme_list_block', 'theme_list');
362
    $sqlTheme = 'SELECT * FROM `'.TABLE_PREFIX.'addons` '
363
              . 'WHERE `type` = \'template\' '
364
              .   'AND `function` = \'theme\' '
365
              . 'ORDER BY `name`';
366
    if($result = $database->query($sqlTheme)) {
367
        while($addon = $result->fetchRow( MYSQLI_ASSOC )) {
368
            $template->set_var('FILE', $addon['directory']);
369
            $template->set_var('NAME', $addon['name']);
370
            $template->set_var('SELECTED', (($addon['directory'] == DEFAULT_THEME)?' selected="selected"':'') );
371
            $template->parse('theme_list', 'theme_list_block', true);
372
        }
373
    }
374
/*---------------------------------------------------------------------------------------------------*/
375
// Insert templates for search settings
376
    $template->set_block('main_block', 'search_template_list_block', 'search_template_list');
377
    $search_template = ( ($search_template == DEFAULT_TEMPLATE) || ($search_template == '') ) ? '' : $search_template;
378
    $selected = ( ($search_template != DEFAULT_TEMPLATE) ) ?  ' selected="selected"' : '';
379
    $template->set_var(array(
380
            'FILE' => '',
381
            'NAME' => $TEXT['SYSTEM_DEFAULT'],
382
            'SELECTED' => $selected
383
        ));
384
    $template->parse('search_template_list', 'search_template_list_block', true);
385
    $sqlSearch = 'SELECT * FROM `'.TABLE_PREFIX.'addons` '
386
              . ' WHERE `type` = \'template\' '
387
              .    'AND `function` =\'template\' '
388
              . 'ORDER BY `name`';
389
    if ($result = $database->query($sqlSearch))
390
    {
391
        while($addon = $result->fetchRow(MYSQLI_ASSOC))
392
        {
393
            $template->set_var('FILE', $addon['directory']);
394
            $template->set_var('NAME', $addon['name']);
395
            $template->set_var('SELECTED', (($addon['directory'] == $search_template) ? ' selected="selected"' :  '') );
396
            $template->parse('search_template_list', 'search_template_list_block', true);
397
        }
398
    }
399
/*--------------------------------------------------------------------------------------------------------*/
400
    // Insert permissions values
401
    if($admin->get_permission('settings_advanced') != true)
402
    {
403
        $template->set_var('DISPLAY_ADVANCED_BUTTON', 'hide');
404
    }
405
/*---------------------------------------------------------------------------------------------------*/
406
    // Work-out if multiple menus feature is enabled
407
    if(defined('MULTIPLE_MENUS') && MULTIPLE_MENUS == true)
408
    {
409
        $template->set_var('MULTIPLE_MENUS_ENABLED', ' checked="checked"');
410
    } else {
411
        $template->set_var('MULTIPLE_MENUS_DISABLED', ' checked="checked"');
412
    }
413
/*---------------------------------------------------------------------------------------------------*/
414
    // Work-out if page languages feature is enabled
415
    if(defined('PAGE_LANGUAGES') && PAGE_LANGUAGES == true)
416
    {
417
            $template->set_var('PAGE_LANGUAGES_ENABLED', ' checked="checked"');
418
    } else {
419
            $template->set_var('PAGE_LANGUAGES_DISABLED', ' checked="checked"');
420
    }
421
/*---------------------------------------------------------------------------------------------------*/
422
    // Work-out if warn_page_leave feature is enabled
423
    if (defined('WARN_PAGE_LEAVE') && WARN_PAGE_LEAVE == true)
424
    {
425
        $template->set_var('WARN_PAGE_LEAVE_ENABLED', ' checked="checked"');
426
    } else {
427
        $template->set_var('WARN_PAGE_LEAVE_DISABLED', ' checked="checked"');
428
    }
429
/*---------------------------------------------------------------------------------------------------*/
430
    // Work-out if smart login feature is enabled
431
    if(defined('SMART_LOGIN') && SMART_LOGIN == true)
432
    {
433
        $template->set_var('SMART_LOGIN_ENABLED', ' checked="checked"');
434
    } else {
435
        $template->set_var('SMART_LOGIN_DISABLED', ' checked="checked"');
436
    }
437
/*---------------------------------------------------------------------------------------------------*/
438
    /* Make's sure GD library is installed */
439
    if(extension_loaded('gd') && function_exists('imageCreateFromJpeg'))
440
    {
441
        $template->set_var('GD_EXTENSION_ENABLED', '');
442
    } else {
443
        $template->set_var('GD_EXTENSION_ENABLED', ' style="display: none;"');
444
    }
445
/*---------------------------------------------------------------------------------------------------*/
446
    // Work-out if section blocks feature is enabled
447
    if(defined('SECTION_BLOCKS') && SECTION_BLOCKS == true)
448
    {
449
        $template->set_var('SECTION_BLOCKS_ENABLED', ' checked="checked"');
450
    } else {
451
        $template->set_var('SECTION_BLOCKS_DISABLED', ' checked="checked"');
452
    }
453
/*---------------------------------------------------------------------------------------------------*/
454
    // Work-out if homepage redirection feature is enabled
455
    if(defined('HOMEPAGE_REDIRECTION') && HOMEPAGE_REDIRECTION == true)
456
    {
457
        $template->set_var('HOMEPAGE_REDIRECTION_ENABLED', ' checked="checked"');
458
    } else {
459
        $template->set_var('HOMEPAGE_REDIRECTION_DISABLED', ' checked="checked"');
460
    }
461
/*---------------------------------------------------------------------------------------------------*/
462
    // Work-out if debug mode feature is enabled
463
    if(defined('DEBUG') && DEBUG == true)
464
    {
465
        $template->set_var('DEBUG_ENABLED', ' checked="checked"');
466
    } else {
467
        $template->set_var('DEBUG_DISABLED', ' checked="checked"');
468
    }
469
/*---------------------------------------------------------------------------------------------------*/
470
    // Work-out if token_fingerprint feature is enabled
471
    if(defined('SEC_TOKEN_FINGERPRINT') && SEC_TOKEN_FINGERPRINT == true)
472
    {
473
        $template->set_var('FINGERPRINT_ENABLED', ' checked="checked"');
474
    } else {
475
        $template->set_var('FINGERPRINT_DISABLED', ' checked="checked"');
476
    }
477
/*---------------------------------------------------------------------------------------------------*/
478
    // Work-out which server os should be checked   {DISPLAY_CHMOD}
479
    if(OPERATING_SYSTEM == 'linux')
480
    {
481
        $template->set_var('LINUX_SELECTED', ' checked="checked"');
482
        $template->set_var('DISPLAY_CHMOD', ' style="display: block;"');
483
    } elseif(OPERATING_SYSTEM == 'windows') {
484
        $template->set_var('WINDOWS_SELECTED', ' checked="checked"');
485
        $template->set_var('DISPLAY_CHMOD', ' style="display: none;"');
486
    }
487
/*---------------------------------------------------------------------------------------------------*/
488
    // Work-out if manage sections feature is enabled
489
    if(MANAGE_SECTIONS)
490
    {
491
        $template->set_var('MANAGE_SECTIONS_ENABLED', ' checked="checked"');
492
    } else {
493
        $template->set_var('MANAGE_SECTIONS_DISABLED', ' checked="checked"');
494
    }
495
/*---------------------------------------------------------------------------------------------------*/
496
    // Work-out which wbmailer routine should be checked
497
    $template->set_var(array(
498
                'TEXT_WBMAILER_DEFAULT_SETTINGS_NOTICE' => $TEXT['WBMAILER_DEFAULT_SETTINGS_NOTICE'],
499
                'TEXT_WBMAILER_DEFAULT_SENDER_MAIL' => $TEXT['WBMAILER_DEFAULT_SENDER_MAIL'],
500
                'TEXT_WBMAILER_DEFAULT_SENDER_NAME' => $TEXT['WBMAILER_DEFAULT_SENDER_NAME'],
501
                'TEXT_WBMAILER_NOTICE' => $TEXT['WBMAILER_NOTICE'],
502
                'TEXT_WBMAILER_FUNCTION' => $TEXT['WBMAILER_FUNCTION'],
503
                'TEXT_WBMAILER_SMTP_HOST' => $TEXT['WBMAILER_SMTP_HOST'],
504
                'TEXT_WBMAILER_PHP' => $TEXT['WBMAILER_PHP'],
505
                'TEXT_WBMAILER_SMTP' => $TEXT['WBMAILER_SMTP'],
506
                'TEXT_WBMAILER_SMTP_AUTH' => $TEXT['WBMAILER_SMTP_AUTH'],
507
                'TEXT_WBMAILER_SMTP_AUTH_NOTICE' => $TEXT['REQUIRED'].' '.$TEXT['WBMAILER_SMTP_AUTH'],
508
                'TEXT_WBMAILER_SMTP_USERNAME' => $TEXT['WBMAILER_SMTP_USERNAME'],
509
                'TEXT_WBMAILER_SMTP_PASSWORD' => $TEXT['WBMAILER_SMTP_PASSWORD'],
510
                'SMTP_AUTH_SELECTED' => ' checked="checked"'
511
                ));
512
    if(WBMAILER_ROUTINE == 'phpmail')
513
    {
514
        $template->set_var('PHPMAIL_SELECTED', ' checked="checked"');
515
        $template->set_var('SMTP_VISIBILITY', ' style="display: none;"');
516
        $template->set_var('SMTP_VISIBILITY_AUTH', '');
517
        // $template->set_var('SMTP_AUTH_SELECTED', '');
518
    } elseif(WBMAILER_ROUTINE == 'smtp')
519
    {
520
        $template->set_var('SMTPMAIL_SELECTED', ' checked="checked"');
521
        $template->set_var('SMTP_VISIBILITY', '');
522
        $template->set_var('SMTP_VISIBILITY_AUTH', '');
523
    }
524
//$template->set_var('SMTP_AUTH_SELECTED',( (WBMAILER_SMTP_AUTH === true) ?' checked="checked"':'') );
525
    $template->set_block('show_access_block', 'smtp_port_list_block', 'smtp_port_list');
526
    $aSmtpPorts = array( '25', '465', '587', '2525');
527
    foreach($aSmtpPorts as $sPort)
528
    {
529
        $template->set_var('VALUE', $sPort);
530
        $template->set_var('PNAME', $sPort);
531
        $template->set_var('SELECTED', ((WBMAILER_SMTP_PORT == $sPort) ? ' selected="selected"' : '') );
532
        $template->parse('smtp_port_list', 'smtp_port_list_block', true);
533
    }
534
/*---------------------------------------------------------------------------------------------------*/
535
    $template->set_block('show_access_block', 'smtp_secure_list_block', 'smtp_secure_list');
536
    $aSmtpSecure = array( 'TLS', 'SSL' );
537
    foreach($aSmtpSecure as $sSecure)
538
    {
539
        $template->set_var('VALUE', $sSecure);
540
        $template->set_var('SNAME', $sSecure);
541
        $template->set_var('SELECTED', ((WBMAILER_SMTP_SECURE == $sSecure) ? ' selected="selected"' : '') );
542
        $template->parse('smtp_secure_list', 'smtp_secure_list_block', true);
543
    }
544
/*---------------------------------------------------------------------------------------------------*/
545
    // Work-out if intro feature is enabled
546
    if(INTRO_PAGE)
547
    {
548
        $template->set_var('INTRO_PAGE_ENABLED', ' checked="checked"');
549
    } else {
550
        $template->set_var('INTRO_PAGE_DISABLED', ' checked="checked"');
551
    }
552
/*---------------------------------------------------------------------------------------------------*/
553
    // Work-out if frontend login feature is enabled
554
    if(FRONTEND_LOGIN)
555
    {
556
        $template->set_var('PRIVATE_ENABLED', ' checked="checked"');
557
    } else {
558
        $template->set_var('PRIVATE_DISABLED', ' checked="checked"');
559
    }
560
/*---------------------------------------------------------------------------------------------------*/
561
    // Work-out if page trash feature is disabled, in-line, or separate
562
    if(PAGE_TRASH == 'disabled')
563
    {
564
        $template->set_var('PAGE_TRASH_DISABLED', ' checked="checked"');
565
        $template->set_var('DISPLAY_PAGE_TRASH_SEPARATE', 'display: none;');
566
    } elseif(PAGE_TRASH == 'inline')
567
    {
568
        $template->set_var('PAGE_TRASH_INLINE', ' checked="checked"');
569
        $template->set_var('DISPLAY_PAGE_TRASH_SEPARATE', 'display: none;');
570
    } elseif(PAGE_TRASH == 'separate')
571
    {
572
        $template->set_var('PAGE_TRASH_SEPARATE', ' checked="checked"');
573
        $template->set_var('DISPLAY_PAGE_TRASH_SEPARATE', 'display: inline;');
574
    }
575
/*---------------------------------------------------------------------------------------------------*/
576
    // Work-out if media home folde feature is enabled
577
    if(HOME_FOLDERS)
578
    {
579
        $template->set_var('HOME_FOLDERS_ENABLED', ' checked="checked"');
580
    } else {
581
        $template->set_var('HOME_FOLDERS_DISABLED', ' checked="checked"');
582
    }
583
/*---------------------------------------------------------------------------------------------------*/
584
    // Insert search select
585
    if(SEARCH == 'private')
586
    {
587
        $template->set_var('PRIVATE_SEARCH', ' selected="selected"');
588
    } elseif(SEARCH == 'registered') {
589
        $template->set_var('REGISTERED_SEARCH', ' selected="selected"');
590
    } elseif(SEARCH == 'none') {
591
        $template->set_var('NONE_SEARCH', ' selected="selected"');
592
    }
593
/*---------------------------------------------------------------------------------------------------*/
594
    // Work-out if 777 permissions are set
595
    if(STRING_FILE_MODE == '0777' AND STRING_DIR_MODE == '0777')
596
    {
597
        $template->set_var('WORLD_WRITEABLE_SELECTED', ' checked="checked"');
598
    }
599
/*---------------------------------------------------------------------------------------------------*/
600
    // Work-out which file mode boxes are checked
601
    if(extract_permission(STRING_FILE_MODE, 'u', 'r'))
602
    {
603
        $template->set_var('FILE_U_R_CHECKED', ' checked="checked"');
604
    }
605
    if(extract_permission(STRING_FILE_MODE, 'u', 'w'))
606
    {
607
        $template->set_var('FILE_U_W_CHECKED', ' checked="checked"');
608
    }
609
    if(extract_permission(STRING_FILE_MODE, 'u', 'e'))
610
    {
611
        $template->set_var('FILE_U_E_CHECKED', ' checked="checked"');
612
    }
613
    if(extract_permission(STRING_FILE_MODE, 'g', 'r'))
614
    {
615
        $template->set_var('FILE_G_R_CHECKED', ' checked="checked"');
616
    }
617
    if(extract_permission(STRING_FILE_MODE, 'g', 'w'))
618
    {
619
        $template->set_var('FILE_G_W_CHECKED', ' checked="checked"');
620
    }
621
    if(extract_permission(STRING_FILE_MODE, 'g', 'e'))
622
    {
623
        $template->set_var('FILE_G_E_CHECKED', ' checked="checked"');
624
    }
625
    if(extract_permission(STRING_FILE_MODE, 'o', 'r'))
626
    {
627
        $template->set_var('FILE_O_R_CHECKED', ' checked="checked"');
628
    }
629
    if(extract_permission(STRING_FILE_MODE, 'o', 'w'))
630
    {
631
        $template->set_var('FILE_O_W_CHECKED', ' checked="checked"');
632
    }
633
    if(extract_permission(STRING_FILE_MODE, 'o', 'e'))
634
    {
635
        $template->set_var('FILE_O_E_CHECKED', ' checked="checked"');
636
    }
637
/*---------------------------------------------------------------------------------------------------*/
638
    // Work-out which dir mode boxes are checked
639
    if(extract_permission(STRING_DIR_MODE, 'u', 'r'))
640
    {
641
        $template->set_var('DIR_U_R_CHECKED', ' checked="checked"');
642
    }
643
    if(extract_permission(STRING_DIR_MODE, 'u', 'w'))
644
    {
645
        $template->set_var('DIR_U_W_CHECKED', ' checked="checked"');
646
    }
647
    if(extract_permission(STRING_DIR_MODE, 'u', 'e'))
648
    {
649
        $template->set_var('DIR_U_E_CHECKED', ' checked="checked"');
650
    }
651
    if(extract_permission(STRING_DIR_MODE, 'g', 'r'))
652
    {
653
        $template->set_var('DIR_G_R_CHECKED', ' checked="checked"');
654
    }
655
    if(extract_permission(STRING_DIR_MODE, 'g', 'w'))
656
    {
657
        $template->set_var('DIR_G_W_CHECKED', ' checked="checked"');
658
    }
659
    if(extract_permission(STRING_DIR_MODE, 'g', 'e'))
660
    {
661
        $template->set_var('DIR_G_E_CHECKED', ' checked="checked"');
662
    }
663
    if(extract_permission(STRING_DIR_MODE, 'o', 'r'))
664
    {
665
        $template->set_var('DIR_O_R_CHECKED', ' checked="checked"');
666
    }
667
    if(extract_permission(STRING_DIR_MODE, 'o', 'w'))
668
    {
669
        $template->set_var('DIR_O_W_CHECKED', ' checked="checked"');
670
    }
671
    if(extract_permission(STRING_DIR_MODE, 'o', 'e'))
672
    {
673
        $template->set_var('DIR_O_E_CHECKED', ' checked="checked"');
674
    }
675
/*---------------------------------------------------------------------------------------------------*/
676
    $template->set_var(array(
677
                        'PAGES_DIRECTORY' => PAGES_DIRECTORY,
678
                        'MEDIA_DIRECTORY' => MEDIA_DIRECTORY,
679
                        'PAGE_EXTENSION' => PAGE_EXTENSION,
680
                        'PAGE_SPACER' => PAGE_SPACER,
681
                        'TABLE_PREFIX' => TABLE_PREFIX
682
                     ));
683
/*---------------------------------------------------------------------------------------------------*/
684
    // Insert Server Email value into template
685
    $template->set_var('SERVER_EMAIL', SERVER_EMAIL);
686
/*---------------------------------------------------------------------------------------------------*/
687
    // Insert language headings
688
    $template->set_var(array(
689
                    'HEADING_GENERAL_SETTINGS' => $HEADING['GENERAL_SETTINGS'],
690
                    'HEADING_DEFAULT_SETTINGS' => $HEADING['DEFAULT_SETTINGS'],
691
                    'HEADING_SEARCH_SETTINGS' => $HEADING['SEARCH_SETTINGS'],
692
                    'HEADING_SERVER_SETTINGS' => $HEADING['SERVER_SETTINGS'],
693
                    'HEADING_WBMAILER_SETTINGS' => $HEADING['WBMAILER_SETTINGS'],
694
                    'HEADING_ADMINISTRATION_TOOLS' => $HEADING['ADMINISTRATION_TOOLS']
695
                    )
696
            );
697
/*---------------------------------------------------------------------------------------------------*/
698
    $template->set_block('show_access_block', 'input_pages_directory_block', 'input_pages_directory');
699
    $template->set_block('show_access_block', 'show_pages_directory_block',  'show_pages_directory');
700
    $sql = 'SELECT COUNT(`page_id`) `numRows` FROM `'.TABLE_PREFIX.'pages` ';
701
    if (!$database->get_one($sql) ) {
702
        $template->parse('input_pages_directory', 'input_pages_directory_block', true);
703
        $template->set_block('show_pages_directory', '');
704
    } else {
705
        $template->parse('show_pages_directory', 'show_pages_directory_block', true);
706
        $template->set_block('input_pages_directory', '');
707
    }
708
/*---------------------------------------------------------------------------------------------------*/
709
    // Insert language text and messages
710
    $template->set_var(array(
711
                    'TEXT_WEBSITE_TITLE' => $TEXT['WEBSITE_TITLE'],
712
                    'TEXT_WEBSITE_DESCRIPTION' => $TEXT['WEBSITE_DESCRIPTION'],
713
                    'TEXT_WEBSITE_KEYWORDS' => $TEXT['WEBSITE_KEYWORDS'],
714
                    'TEXT_WEBSITE_HEADER' => $TEXT['WEBSITE_HEADER'],
715
                    'TEXT_WEBSITE_FOOTER' => $TEXT['WEBSITE_FOOTER'],
716
                    'TEXT_WEBSITE_SIGNATURE' => 'Signature',
717
                    'TEXT_HEADER' => $TEXT['HEADER'],
718
                    'TEXT_FOOTER' => $TEXT['FOOTER'],
719
                    'TEXT_VISIBILITY' => $TEXT['VISIBILITY'],
720
                    'TEXT_RESULTS_HEADER' => $TEXT['RESULTS_HEADER'],
721
                    'TEXT_RESULTS_LOOP' => $TEXT['RESULTS_LOOP'],
722
                    'TEXT_RESULTS_FOOTER' => $TEXT['RESULTS_FOOTER'],
723
                    'TEXT_NO_RESULTS' => $TEXT['NO_RESULTS'],
724
                    'TEXT_TEXT' => $TEXT['TEXT'],
725
                    'TEXT_DEFAULT' => $TEXT['DEFAULT'],
726
                    'TEXT_LANGUAGE' => $TEXT['LANGUAGE'],
727
                    'TEXT_TIMEZONE' => $TEXT['TIMEZONE'],
728
                    'TEXT_CHARSET' => $TEXT['CHARSET'],
729
                    'TEXT_DATE_FORMAT' => $TEXT['DATE_FORMAT'],
730
                    'TEXT_TIME_FORMAT' => $TEXT['TIME_FORMAT'],
731
                    'TEXT_TEMPLATE' => $TEXT['TEMPLATE'],
732
                    'TEXT_THEME' => $TEXT['THEME'],
733
                    'TEXT_WYSIWYG_EDITOR' => $TEXT['WYSIWYG_EDITOR'],
734
                    'TEXT_PAGE_LEVEL_LIMIT' => $TEXT['PAGE_LEVEL_LIMIT'],
735
                    'TEXT_INTRO_PAGE' => $TEXT['INTRO_PAGE'],
736
                    'TEXT_FRONTEND' => $TEXT['FRONTEND'],
737
                    'TEXT_LOGIN' => $TEXT['LOGIN'],
738
                    'TEXT_REDIRECT_AFTER' => $TEXT['REDIRECT_AFTER'],
739
                    'TEXT_SIGNUP' => $TEXT['SIGNUP'],
740
                    'TEXT_PHP_ERROR_LEVEL' => $TEXT['PHP_ERROR_LEVEL'],
741
                    'TEXT_PAGES_DIRECTORY' => $TEXT['PAGES_DIRECTORY'],
742
                    'TEXT_MEDIA_DIRECTORY' => $TEXT['MEDIA_DIRECTORY'],
743
                    'TEXT_PAGE_EXTENSION' => $TEXT['PAGE_EXTENSION'],
744
                    'TEXT_PAGE_SPACER' => $TEXT['PAGE_SPACER'],
745
                    'TEXT_RENAME_FILES_ON_UPLOAD' => $TEXT['RENAME_FILES_ON_UPLOAD'],
746
                    'TEXT_APP_NAME' => $TEXT['APP_NAME'],
747
                    'TEXT_SESSION_IDENTIFIER' => $TEXT['SESSION_IDENTIFIER'],
748
                    'TEXT_SEC_ANCHOR' => $TEXT['SEC_ANCHOR'],
749
                    'TEXT_SERVER_OPERATING_SYSTEM' => $TEXT['SERVER_OPERATING_SYSTEM'],
750
                    'TEXT_LINUX_UNIX_BASED' => $TEXT['LINUX_UNIX_BASED'],
751
                    'TEXT_WINDOWS' => $TEXT['WINDOWS'],
752
                    'TEXT_ADMIN' => $TEXT['ADMIN'],
753
                    'TEXT_TYPE' => $TEXT['TYPE'],
754
                    'TEXT_DATABASE' => $TEXT['DATABASE'],
755
                    'TEXT_HOST' => $TEXT['HOST'],
756
                    'TEXT_USERNAME' => $TEXT['USERNAME'],
757
                    'TEXT_PASSWORD' => $TEXT['PASSWORD'],
758
                    'TEXT_NAME' => $TEXT['NAME'],
759
                    'TEXT_TABLE_PREFIX' => $TEXT['TABLE_PREFIX'],
760
                    'TEXT_SAVE' => $TEXT['SAVE'],
761
                    'TEXT_RESET' => $TEXT['RESET'],
762
                    'TEXT_CHANGES' => $TEXT['CHANGES'],
763
                    'TEXT_ENABLED' => $TEXT['ENABLED'],
764
                    'TEXT_DISABLED' => $TEXT['DISABLED'],
765
                    'TEXT_MANAGE_SECTIONS' => $HEADING['MANAGE_SECTIONS'],
766
                    'TEXT_MANAGE' => $TEXT['MANAGE'],
767
                    'TEXT_SEARCH' => $TEXT['SEARCH'],
768
                    'TEXT_PUBLIC' => $TEXT['PUBLIC'],
769
                    'TEXT_PRIVATE' => $TEXT['PRIVATE'],
770
                    'TEXT_REGISTERED' => $TEXT['REGISTERED'],
771
                    'TEXT_NONE' => $TEXT['NONE'],
772
                    'TEXT_FILES' => strtoupper(substr($TEXT['FILES'], 0, 1)).substr($TEXT['FILES'], 1),
773
                    'TEXT_DIRECTORIES' => $TEXT['DIRECTORIES'],
774
                    'TEXT_FILESYSTEM_PERMISSIONS' => $TEXT['FILESYSTEM_PERMISSIONS'],
775
                    'TEXT_USER' => $TEXT['USER'],
776
                    'TEXT_GROUP' => $TEXT['GROUP'],
777
                    'TEXT_OTHERS' => $TEXT['OTHERS'],
778
                    'TEXT_READ' => $TEXT['READ'],
779
                    'TEXT_WRITE' => $TEXT['WRITE'],
780
                    'TEXT_EXECUTE' => $TEXT['EXECUTE'],
781
                    'TEXT_WARN_PAGE_LEAVE' => '',
782
                    'TEXT_SMART_LOGIN' => $TEXT['SMART_LOGIN'],
783
                    'TEXT_MULTIPLE_MENUS' => $TEXT['MULTIPLE_MENUS'],
784
                    'TEXT_HOMEPAGE_REDIRECTION' => $TEXT['HOMEPAGE_REDIRECTION'],
785
                    'TEXT_SECTION_BLOCKS' => $TEXT['SECTION_BLOCKS'],
786
                    'TEXT_PLEASE_SELECT' => $TEXT['PLEASE_SELECT'],
787
                    'TEXT_PAGE_TRASH' => $TEXT['PAGE_TRASH'],
788
                    'TEXT_PAGE_LANGUAGES' => $TEXT['PAGE_LANGUAGES'],
789
                    'TEXT_INLINE' => $TEXT['INLINE'],
790
                    'TEXT_SEPARATE' => $TEXT['SEPARATE'],
791
                    'TEXT_HOME_FOLDERS' => $TEXT['HOME_FOLDERS'],
792
                    'TEXT_WYSIWYG_STYLE' => $TEXT['WYSIWYG_STYLE'],
793
                    'TEXT_WORLD_WRITEABLE_FILE_PERMISSIONS' => $TEXT['WORLD_WRITEABLE_FILE_PERMISSIONS'],
794
                    'MODE_SWITCH_WARNING' => $MESSAGE['SETTINGS']['MODE_SWITCH_WARNING'],
795
                    'WORLD_WRITEABLE_WARNING' => $MESSAGE['SETTINGS']['WORLD_WRITEABLE_WARNING'],
796
                    'TEXT_MODULE_ORDER' => $TEXT['MODULE_ORDER'],
797
                    'TEXT_MAX_EXCERPT' => $TEXT['MAX_EXCERPT'],
798
                    'TEXT_TIME_LIMIT' => $TEXT['TIME_LIMIT']
799
                    ));
800
/*---------------------------------------------------------------------------------------------------*/
801
if($is_advanced)
802
{
803
    $template->parse('show_page_level_limit', 'show_page_level_limit_block', true);
804
    $template->parse('show_checkbox_1',       'show_checkbox_1_block', true);
805
    $template->parse('show_checkbox_2',       'show_checkbox_2_block', true);
806
    $template->parse('show_checkbox_3',       'show_checkbox_3_block', true);
807
    $template->set_block('show_php_error_level', '');
808
    $template->set_block('show_charset', '');
809
    $template->parse('show_wysiwyg',          'show_wysiwyg_block', true);
810
    $template->parse('show_search',           'show_search_block', true);
811
    $template->parse('show_redirect_timer',   'show_redirect_timer_block', true);
812
}else {
813
    $template->set_block('show_page_level_limit', '');
814
    $template->set_block('show_checkbox_1', '');
815
    $template->set_block('show_checkbox_2', '');
816
    $template->set_block('show_checkbox_3', '');
817
    $template->set_block('show_php_error_level', '');
818
    $template->set_block('show_charset', '');
819
    $template->set_block('show_wysiwyg', '');
820
    $template->set_block('show_search', '');
821
    $template->set_block('show_redirect_timer', '');
822
}
823
if($is_advanced && $admin->get_user_id()=='1')
824
{
825
    $template->parse('show_access', 'show_access_block', true);
826
    $template->parse('show_chmod_js', 'show_chmod_js_block', true);
827
    $template->parse('show_setting_js', 'show_setting_js_block', true);
828
}else {
829
    $template->set_block('show_access_block', '');
830
    $template->set_block('show_chmod_js_block', '');
831
    $template->set_block('show_setting_js_block', '');
832
}
833
/*---------------------------------------------------------------------------------------------------*/
834
// Parse template objects output
835
$template->parse('main', 'main_block', false);
836
$template->pparse('output', 'page');
837

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