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 2 2017-07-02 15:14:29Z Manuela $
14
 * @filesource      $HeadURL: svn://isteam.dynxs.de/wb/2.10.x/trunk/admin/settings/index.php $
15
 * @lastmodified    $Date: 2017-07-02 17:14:29 +0200 (Sun, 02 Jul 2017) $
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
    require(ADMIN_PATH.'/interface/er_levels.php');
247
    foreach($ER_LEVELS AS $value => $title)
248
    {
249
        $template->set_var('VALUE', $value);
250
        $template->set_var('NAME', $title);
251
        $template->set_var('SELECTED', ((ER_LEVEL == $value) ? ' selected="selected"' : '') );
252
        $template->parse('error_reporting_list', 'error_reporting_list_block', true);
253
    }
254
/*-------------------------------------------------------------------------------------*/
255
    // Insert WYSIWYG modules
256
    $template->set_block('show_wysiwyg_block', 'wysiwyg_list_block', 'wysiwyg_list');
257
    $file='none';
258
    $module_name=$TEXT['NONE'];
259
    $template->set_var('FILE', $file);
260
    $template->set_var('NAME', $module_name);
261
    $template->set_var('SELECTED', ((!defined('WYSIWYG_EDITOR') || $file == WYSIWYG_EDITOR) ? ' selected="selected"' : '') );
262
    $template->parse('wysiwyg_list', 'wysiwyg_list_block', true);
263
    $sqlEditor  = 'SELECT * FROM `'.TABLE_PREFIX.'addons` '
264
          . 'WHERE `type` = \'module\' '
265
          .   'AND `function` = \'wysiwyg\' '
266
          . 'ORDER BY `name`';
267
    if($result = $database->query($sqlEditor))
268
    {
269
        while($aWysiwyg = $result->fetchRow(MYSQLI_ASSOC))
270
        {
271
            $template->set_var('FILE', $aWysiwyg['directory']);
272
            $template->set_var('NAME', $aWysiwyg['name']);
273
            $template->set_var('SELECTED', ((!defined('WYSIWYG_EDITOR') || $aWysiwyg['directory'] == WYSIWYG_EDITOR) ? ' selected="selected"' : '') );
274
            $template->parse('wysiwyg_list', 'wysiwyg_list_block', true);
275
        }
276
    }
277
/*---------------------------------------------------------------------------------------------------*/
278
    // Insert language values
279
    $template->set_block('main_block', 'language_list_block', 'language_list');
280
    $sqlLang  = 'SELECT * FROM `'.TABLE_PREFIX.'addons` '
281
              . 'WHERE `type` = \'language\' '
282
              . 'ORDER BY `directory`';
283
    if($result = $database->query($sqlLang))
284
    {
285
        while($aLang = $result->fetchRow(MYSQLI_ASSOC)) {
286
            $langIcons = (empty($aLang['directory']) ? 'none' : strtolower($aLang['directory']));
287
            $template->set_var('CODE',        $aLang['directory']);
288
            $template->set_var('NAME',        $aLang['name']);
289
            $template->set_var('FLAG',        THEME_URL.'/images/flags/'.$langIcons);
290
            $template->set_var('SELECTED',    (DEFAULT_LANGUAGE == $aLang['directory'] ? ' selected="selected"' : '') );
291
            $template->parse('language_list', 'language_list_block', true);
292
        }
293
    }
294
/*---------------------------------------------------------------------------------------------------*/
295
    // Insert default timezone values
296
    $template->set_block('main_block', 'timezone_list_block', 'timezone_list');
297
    require(ADMIN_PATH.'/interface/timezones.php');
298
    foreach($TIMEZONES AS $hour_offset => $title)
299
    {
300
        // Make sure we dont list "System Default" as we are setting this value!
301
        if($hour_offset != '-20') {
302
            $template->set_var('VALUE', $hour_offset);
303
            $template->set_var('NAME', $title);
304
            $template->set_var('SELECTED', ( (DEFAULT_TIMEZONE == $hour_offset*60*60)?' selected="selected"':'' ) );
305
            $template->parse('timezone_list', 'timezone_list_block', true);
306
        }
307
    }
308
/*---------------------------------------------------------------------------------------------------*/
309
    // Insert default charset values
310
    $template->set_block('show_charset_block', 'charset_list_block', 'charset_list');
311
    require(ADMIN_PATH.'/interface/charsets.php');
312
    foreach($CHARSETS AS $code => $title) {
313
        $template->set_var('VALUE', $code);
314
        $template->set_var('NAME', $title);
315
        $template->set_var('SELECTED', ( (DEFAULT_CHARSET == $code)?' selected="selected"':'' ) );
316
        $template->parse('charset_list', 'charset_list_block', true);
317
    }
318
/*---------------------------------------------------------------------------------------------------*/
319
    // Insert date format list
320
    $template->set_block('main_block', 'date_format_list_block', 'date_format_list');
321
    require(ADMIN_PATH.'/interface/date_formats.php');
322
    foreach($DATE_FORMATS AS $format => $title) {
323
        $format = str_replace('|', ' ', $format); // Add's white-spaces (not able to be stored in array key)
324
        if($format != 'system_default') {
325
            $template->set_var('VALUE', $format);
326
        } else {
327
            $template->set_var('VALUE', '');
328
        }
329
        $template->set_var('NAME', $title);
330
        $template->set_var('SELECTED', ( (DEFAULT_DATE_FORMAT == $format)?' selected="selected"':'' ) );
331
        $template->parse('date_format_list', 'date_format_list_block', true);
332
    }
333
/*---------------------------------------------------------------------------------------------------*/
334
    // Insert time format list
335
    $template->set_block('main_block', 'time_format_list_block', 'time_format_list');
336
    require(ADMIN_PATH.'/interface/time_formats.php');
337
    foreach($TIME_FORMATS AS $format => $title) {
338
        $format = str_replace('|', ' ', $format); // Add's white-spaces (not able to be stored in array key)
339
        if($format != 'system_default') {
340
            $template->set_var('VALUE', $format);
341
        } else {
342
            $template->set_var('VALUE', '');
343
        }
344
        $template->set_var('NAME', $title);
345
        $template->set_var('SELECTED', ( (DEFAULT_TIME_FORMAT == $format)?' selected="selected"':'' ) );
346
        $template->parse('time_format_list', 'time_format_list_block', true);
347
    }
348
/*---------------------------------------------------------------------------------------------------*/
349
    // Insert templates
350
    $template->set_block('main_block', 'template_list_block', 'template_list');
351
    $sqlTheme = 'SELECT * FROM `'.TABLE_PREFIX.'addons` '
352
              . 'WHERE `type` = \'template\' '
353
              .   'AND `function` != \'theme\' '
354
              . 'ORDER BY `name`';
355
    if($result = $database->query($sqlTheme)) {
356
//    $result = $database->query("SELECT * FROM `".TABLE_PREFIX."addons` WHERE `type` = 'template' AND `function` != 'theme' ORDER BY `name`");
357
//    if($result->numRows() > 0) {
358
        while($addon = $result->fetchRow( MYSQLI_ASSOC )) {
359
            $template->set_var('FILE', $addon['directory']);
360
            $template->set_var('NAME', $addon['name']);
361
            $template->set_var('SELECTED', (($addon['directory'] == DEFAULT_TEMPLATE)?' selected="selected"':'') );
362
            $template->parse('template_list', 'template_list_block', true);
363
        }
364
    }
365
/*---------------------------------------------------------------------------------------------------*/
366
    // Insert backend theme
367
    $template->set_block('main_block', 'theme_list_block', 'theme_list');
368
    $sqlTheme = 'SELECT * FROM `'.TABLE_PREFIX.'addons` '
369
              . 'WHERE `type` = \'template\' '
370
              .   'AND `function` = \'theme\' '
371
              . 'ORDER BY `name`';
372
    if($result = $database->query($sqlTheme)) {
373
        while($addon = $result->fetchRow( MYSQLI_ASSOC )) {
374
            $template->set_var('FILE', $addon['directory']);
375
            $template->set_var('NAME', $addon['name']);
376
            $template->set_var('SELECTED', (($addon['directory'] == DEFAULT_THEME)?' selected="selected"':'') );
377
            $template->parse('theme_list', 'theme_list_block', true);
378
        }
379
    }
380
/*---------------------------------------------------------------------------------------------------*/
381
// Insert templates for search settings
382
    $template->set_block('main_block', 'search_template_list_block', 'search_template_list');
383
    $search_template = ( ($search_template == DEFAULT_TEMPLATE) || ($search_template == '') ) ? '' : $search_template;
384
    $selected = ( ($search_template != DEFAULT_TEMPLATE) ) ?  ' selected="selected"' : '';
385
    $template->set_var(array(
386
            'FILE' => '',
387
            'NAME' => $TEXT['SYSTEM_DEFAULT'],
388
            'SELECTED' => $selected
389
        ));
390
    $template->parse('search_template_list', 'search_template_list_block', true);
391
    $sqlSearch = 'SELECT * FROM `'.TABLE_PREFIX.'addons` '
392
              . ' WHERE `type` = \'template\' '
393
              .    'AND `function` =\'template\' '
394
              . 'ORDER BY `name`';
395
    if ($result = $database->query($sqlSearch))
396
    {
397
        while($addon = $result->fetchRow(MYSQLI_ASSOC))
398
        {
399
            $template->set_var('FILE', $addon['directory']);
400
            $template->set_var('NAME', $addon['name']);
401
            $template->set_var('SELECTED', (($addon['directory'] == $search_template) ? ' selected="selected"' :  '') );
402
            $template->parse('search_template_list', 'search_template_list_block', true);
403
        }
404
    }
405
/*--------------------------------------------------------------------------------------------------------*/
406
    // Insert permissions values
407
    if($admin->get_permission('settings_advanced') != true)
408
    {
409
        $template->set_var('DISPLAY_ADVANCED_BUTTON', 'hide');
410
    }
411
/*---------------------------------------------------------------------------------------------------*/
412
    // Work-out if multiple menus feature is enabled
413
    if(defined('MULTIPLE_MENUS') && MULTIPLE_MENUS == true)
414
    {
415
        $template->set_var('MULTIPLE_MENUS_ENABLED', ' checked="checked"');
416
    } else {
417
        $template->set_var('MULTIPLE_MENUS_DISABLED', ' checked="checked"');
418
    }
419
/*---------------------------------------------------------------------------------------------------*/
420
    // Work-out if page languages feature is enabled
421
    if(defined('PAGE_LANGUAGES') && PAGE_LANGUAGES == true)
422
    {
423
            $template->set_var('PAGE_LANGUAGES_ENABLED', ' checked="checked"');
424
    } else {
425
            $template->set_var('PAGE_LANGUAGES_DISABLED', ' checked="checked"');
426
    }
427
/*---------------------------------------------------------------------------------------------------*/
428
    // Work-out if warn_page_leave feature is enabled
429
    if (defined('WARN_PAGE_LEAVE') && WARN_PAGE_LEAVE == true)
430
    {
431
        $template->set_var('WARN_PAGE_LEAVE_ENABLED', ' checked="checked"');
432
    } else {
433
        $template->set_var('WARN_PAGE_LEAVE_DISABLED', ' checked="checked"');
434
    }
435
/*---------------------------------------------------------------------------------------------------*/
436
    // Work-out if smart login feature is enabled
437
    if(defined('SMART_LOGIN') && SMART_LOGIN == true)
438
    {
439
        $template->set_var('SMART_LOGIN_ENABLED', ' checked="checked"');
440
    } else {
441
        $template->set_var('SMART_LOGIN_DISABLED', ' checked="checked"');
442
    }
443
/*---------------------------------------------------------------------------------------------------*/
444
    /* Make's sure GD library is installed */
445
    if(extension_loaded('gd') && function_exists('imageCreateFromJpeg'))
446
    {
447
        $template->set_var('GD_EXTENSION_ENABLED', '');
448
    } else {
449
        $template->set_var('GD_EXTENSION_ENABLED', ' style="display: none;"');
450
    }
451
/*---------------------------------------------------------------------------------------------------*/
452
    // Work-out if section blocks feature is enabled
453
    if(defined('SECTION_BLOCKS') && SECTION_BLOCKS == true)
454
    {
455
        $template->set_var('SECTION_BLOCKS_ENABLED', ' checked="checked"');
456
    } else {
457
        $template->set_var('SECTION_BLOCKS_DISABLED', ' checked="checked"');
458
    }
459
/*---------------------------------------------------------------------------------------------------*/
460
    // Work-out if homepage redirection feature is enabled
461
    if(defined('HOMEPAGE_REDIRECTION') && HOMEPAGE_REDIRECTION == true)
462
    {
463
        $template->set_var('HOMEPAGE_REDIRECTION_ENABLED', ' checked="checked"');
464
    } else {
465
        $template->set_var('HOMEPAGE_REDIRECTION_DISABLED', ' checked="checked"');
466
    }
467
/*---------------------------------------------------------------------------------------------------*/
468
    // Work-out if debug mode feature is enabled
469
    if(defined('DEBUG') && DEBUG == true)
470
    {
471
        $template->set_var('DEBUG_ENABLED', ' checked="checked"');
472
    } else {
473
        $template->set_var('DEBUG_DISABLED', ' checked="checked"');
474
    }
475
/*---------------------------------------------------------------------------------------------------*/
476
    // Work-out if token_fingerprint feature is enabled
477
    if(defined('SEC_TOKEN_FINGERPRINT') && SEC_TOKEN_FINGERPRINT == true)
478
    {
479
        $template->set_var('FINGERPRINT_ENABLED', ' checked="checked"');
480
    } else {
481
        $template->set_var('FINGERPRINT_DISABLED', ' checked="checked"');
482
    }
483
/*---------------------------------------------------------------------------------------------------*/
484
    // Work-out which server os should be checked   {DISPLAY_CHMOD}
485
    if(OPERATING_SYSTEM == 'linux')
486
    {
487
        $template->set_var('LINUX_SELECTED', ' checked="checked"');
488
        $template->set_var('DISPLAY_CHMOD', ' style="display: block;"');
489
    } elseif(OPERATING_SYSTEM == 'windows') {
490
        $template->set_var('WINDOWS_SELECTED', ' checked="checked"');
491
        $template->set_var('DISPLAY_CHMOD', ' style="display: none;"');
492
    }
493
/*---------------------------------------------------------------------------------------------------*/
494
    // Work-out if manage sections feature is enabled
495
    if(MANAGE_SECTIONS)
496
    {
497
        $template->set_var('MANAGE_SECTIONS_ENABLED', ' checked="checked"');
498
    } else {
499
        $template->set_var('MANAGE_SECTIONS_DISABLED', ' checked="checked"');
500
    }
501
/*---------------------------------------------------------------------------------------------------*/
502
    // Work-out which wbmailer routine should be checked
503
    $template->set_var(array(
504
                'TEXT_WBMAILER_DEFAULT_SETTINGS_NOTICE' => $TEXT['WBMAILER_DEFAULT_SETTINGS_NOTICE'],
505
                'TEXT_WBMAILER_DEFAULT_SENDER_MAIL' => $TEXT['WBMAILER_DEFAULT_SENDER_MAIL'],
506
                'TEXT_WBMAILER_DEFAULT_SENDER_NAME' => $TEXT['WBMAILER_DEFAULT_SENDER_NAME'],
507
                'TEXT_WBMAILER_NOTICE' => $TEXT['WBMAILER_NOTICE'],
508
                'TEXT_WBMAILER_FUNCTION' => $TEXT['WBMAILER_FUNCTION'],
509
                'TEXT_WBMAILER_SMTP_HOST' => $TEXT['WBMAILER_SMTP_HOST'],
510
                'TEXT_WBMAILER_PHP' => $TEXT['WBMAILER_PHP'],
511
                'TEXT_WBMAILER_SMTP' => $TEXT['WBMAILER_SMTP'],
512
                'TEXT_WBMAILER_SMTP_AUTH' => $TEXT['WBMAILER_SMTP_AUTH'],
513
                'TEXT_WBMAILER_SMTP_AUTH_NOTICE' => $TEXT['REQUIRED'].' '.$TEXT['WBMAILER_SMTP_AUTH'],
514
                'TEXT_WBMAILER_SMTP_USERNAME' => $TEXT['WBMAILER_SMTP_USERNAME'],
515
                'TEXT_WBMAILER_SMTP_PASSWORD' => $TEXT['WBMAILER_SMTP_PASSWORD'],
516
                'SMTP_AUTH_SELECTED' => ' checked="checked"'
517
                ));
518
    if(WBMAILER_ROUTINE == 'phpmail')
519
    {
520
        $template->set_var('PHPMAIL_SELECTED', ' checked="checked"');
521
        $template->set_var('SMTP_VISIBILITY', ' style="display: none;"');
522
        $template->set_var('SMTP_VISIBILITY_AUTH', '');
523
        // $template->set_var('SMTP_AUTH_SELECTED', '');
524
    } elseif(WBMAILER_ROUTINE == 'smtp')
525
    {
526
        $template->set_var('SMTPMAIL_SELECTED', ' checked="checked"');
527
        $template->set_var('SMTP_VISIBILITY', '');
528
        $template->set_var('SMTP_VISIBILITY_AUTH', '');
529
    }
530
//$template->set_var('SMTP_AUTH_SELECTED',( (WBMAILER_SMTP_AUTH === true) ?' checked="checked"':'') );
531
    $template->set_block('show_access_block', 'smtp_port_list_block', 'smtp_port_list');
532
    $aSmtpPorts = array( '25', '465', '587', '2525');
533
    foreach($aSmtpPorts as $sPort)
534
    {
535
        $template->set_var('VALUE', $sPort);
536
        $template->set_var('PNAME', $sPort);
537
        $template->set_var('SELECTED', ((WBMAILER_SMTP_PORT == $sPort) ? ' selected="selected"' : '') );
538
        $template->parse('smtp_port_list', 'smtp_port_list_block', true);
539
    }
540
/*---------------------------------------------------------------------------------------------------*/
541
    $template->set_block('show_access_block', 'smtp_secure_list_block', 'smtp_secure_list');
542
    $aSmtpSecure = array( 'TLS', 'SSL' );
543
    foreach($aSmtpSecure as $sSecure)
544
    {
545
        $template->set_var('VALUE', $sSecure);
546
        $template->set_var('SNAME', $sSecure);
547
        $template->set_var('SELECTED', ((WBMAILER_SMTP_SECURE == $sSecure) ? ' selected="selected"' : '') );
548
        $template->parse('smtp_secure_list', 'smtp_secure_list_block', true);
549
    }
550
/*---------------------------------------------------------------------------------------------------*/
551
    // Work-out if intro feature is enabled
552
    if(INTRO_PAGE)
553
    {
554
        $template->set_var('INTRO_PAGE_ENABLED', ' checked="checked"');
555
    } else {
556
        $template->set_var('INTRO_PAGE_DISABLED', ' checked="checked"');
557
    }
558
/*---------------------------------------------------------------------------------------------------*/
559
    // Work-out if frontend login feature is enabled
560
    if(FRONTEND_LOGIN)
561
    {
562
        $template->set_var('PRIVATE_ENABLED', ' checked="checked"');
563
    } else {
564
        $template->set_var('PRIVATE_DISABLED', ' checked="checked"');
565
    }
566
/*---------------------------------------------------------------------------------------------------*/
567
    // Work-out if page trash feature is disabled, in-line, or separate
568
    if(PAGE_TRASH == 'disabled')
569
    {
570
        $template->set_var('PAGE_TRASH_DISABLED', ' checked="checked"');
571
        $template->set_var('DISPLAY_PAGE_TRASH_SEPARATE', 'display: none;');
572
    } elseif(PAGE_TRASH == 'inline')
573
    {
574
        $template->set_var('PAGE_TRASH_INLINE', ' checked="checked"');
575
        $template->set_var('DISPLAY_PAGE_TRASH_SEPARATE', 'display: none;');
576
    } elseif(PAGE_TRASH == 'separate')
577
    {
578
        $template->set_var('PAGE_TRASH_SEPARATE', ' checked="checked"');
579
        $template->set_var('DISPLAY_PAGE_TRASH_SEPARATE', 'display: inline;');
580
    }
581
/*---------------------------------------------------------------------------------------------------*/
582
    // Work-out if media home folde feature is enabled
583
    if(HOME_FOLDERS)
584
    {
585
        $template->set_var('HOME_FOLDERS_ENABLED', ' checked="checked"');
586
    } else {
587
        $template->set_var('HOME_FOLDERS_DISABLED', ' checked="checked"');
588
    }
589
/*---------------------------------------------------------------------------------------------------*/
590
    // Insert search select
591
    if(SEARCH == 'private')
592
    {
593
        $template->set_var('PRIVATE_SEARCH', ' selected="selected"');
594
    } elseif(SEARCH == 'registered') {
595
        $template->set_var('REGISTERED_SEARCH', ' selected="selected"');
596
    } elseif(SEARCH == 'none') {
597
        $template->set_var('NONE_SEARCH', ' selected="selected"');
598
    }
599
/*---------------------------------------------------------------------------------------------------*/
600
    // Work-out if 777 permissions are set
601
    if(STRING_FILE_MODE == '0777' AND STRING_DIR_MODE == '0777')
602
    {
603
        $template->set_var('WORLD_WRITEABLE_SELECTED', ' checked="checked"');
604
    }
605
/*---------------------------------------------------------------------------------------------------*/
606
    // Work-out which file mode boxes are checked
607
    if(extract_permission(STRING_FILE_MODE, 'u', 'r'))
608
    {
609
        $template->set_var('FILE_U_R_CHECKED', ' checked="checked"');
610
    }
611
    if(extract_permission(STRING_FILE_MODE, 'u', 'w'))
612
    {
613
        $template->set_var('FILE_U_W_CHECKED', ' checked="checked"');
614
    }
615
    if(extract_permission(STRING_FILE_MODE, 'u', 'e'))
616
    {
617
        $template->set_var('FILE_U_E_CHECKED', ' checked="checked"');
618
    }
619
    if(extract_permission(STRING_FILE_MODE, 'g', 'r'))
620
    {
621
        $template->set_var('FILE_G_R_CHECKED', ' checked="checked"');
622
    }
623
    if(extract_permission(STRING_FILE_MODE, 'g', 'w'))
624
    {
625
        $template->set_var('FILE_G_W_CHECKED', ' checked="checked"');
626
    }
627
    if(extract_permission(STRING_FILE_MODE, 'g', 'e'))
628
    {
629
        $template->set_var('FILE_G_E_CHECKED', ' checked="checked"');
630
    }
631
    if(extract_permission(STRING_FILE_MODE, 'o', 'r'))
632
    {
633
        $template->set_var('FILE_O_R_CHECKED', ' checked="checked"');
634
    }
635
    if(extract_permission(STRING_FILE_MODE, 'o', 'w'))
636
    {
637
        $template->set_var('FILE_O_W_CHECKED', ' checked="checked"');
638
    }
639
    if(extract_permission(STRING_FILE_MODE, 'o', 'e'))
640
    {
641
        $template->set_var('FILE_O_E_CHECKED', ' checked="checked"');
642
    }
643
/*---------------------------------------------------------------------------------------------------*/
644
    // Work-out which dir mode boxes are checked
645
    if(extract_permission(STRING_DIR_MODE, 'u', 'r'))
646
    {
647
        $template->set_var('DIR_U_R_CHECKED', ' checked="checked"');
648
    }
649
    if(extract_permission(STRING_DIR_MODE, 'u', 'w'))
650
    {
651
        $template->set_var('DIR_U_W_CHECKED', ' checked="checked"');
652
    }
653
    if(extract_permission(STRING_DIR_MODE, 'u', 'e'))
654
    {
655
        $template->set_var('DIR_U_E_CHECKED', ' checked="checked"');
656
    }
657
    if(extract_permission(STRING_DIR_MODE, 'g', 'r'))
658
    {
659
        $template->set_var('DIR_G_R_CHECKED', ' checked="checked"');
660
    }
661
    if(extract_permission(STRING_DIR_MODE, 'g', 'w'))
662
    {
663
        $template->set_var('DIR_G_W_CHECKED', ' checked="checked"');
664
    }
665
    if(extract_permission(STRING_DIR_MODE, 'g', 'e'))
666
    {
667
        $template->set_var('DIR_G_E_CHECKED', ' checked="checked"');
668
    }
669
    if(extract_permission(STRING_DIR_MODE, 'o', 'r'))
670
    {
671
        $template->set_var('DIR_O_R_CHECKED', ' checked="checked"');
672
    }
673
    if(extract_permission(STRING_DIR_MODE, 'o', 'w'))
674
    {
675
        $template->set_var('DIR_O_W_CHECKED', ' checked="checked"');
676
    }
677
    if(extract_permission(STRING_DIR_MODE, 'o', 'e'))
678
    {
679
        $template->set_var('DIR_O_E_CHECKED', ' checked="checked"');
680
    }
681
/*---------------------------------------------------------------------------------------------------*/
682
    $template->set_var(array(
683
                        'PAGES_DIRECTORY' => PAGES_DIRECTORY,
684
                        'MEDIA_DIRECTORY' => MEDIA_DIRECTORY,
685
                        'PAGE_EXTENSION' => PAGE_EXTENSION,
686
                        'PAGE_SPACER' => PAGE_SPACER,
687
                        'TABLE_PREFIX' => TABLE_PREFIX
688
                     ));
689
/*---------------------------------------------------------------------------------------------------*/
690
    // Insert Server Email value into template
691
    $template->set_var('SERVER_EMAIL', SERVER_EMAIL);
692
/*---------------------------------------------------------------------------------------------------*/
693
    // Insert language headings
694
    $template->set_var(array(
695
                    'HEADING_GENERAL_SETTINGS' => $HEADING['GENERAL_SETTINGS'],
696
                    'HEADING_DEFAULT_SETTINGS' => $HEADING['DEFAULT_SETTINGS'],
697
                    'HEADING_SEARCH_SETTINGS' => $HEADING['SEARCH_SETTINGS'],
698
                    'HEADING_SERVER_SETTINGS' => $HEADING['SERVER_SETTINGS'],
699
                    'HEADING_WBMAILER_SETTINGS' => $HEADING['WBMAILER_SETTINGS'],
700
                    'HEADING_ADMINISTRATION_TOOLS' => $HEADING['ADMINISTRATION_TOOLS']
701
                    )
702
            );
703
/*---------------------------------------------------------------------------------------------------*/
704
    $template->set_block('show_access_block', 'input_pages_directory_block', 'input_pages_directory');
705
    $template->set_block('show_access_block', 'show_pages_directory_block',  'show_pages_directory');
706
    $sql = 'SELECT COUNT(`page_id`) `numRows` FROM `'.TABLE_PREFIX.'pages` ';
707
    if (!$database->get_one($sql) ) {
708
        $template->parse('input_pages_directory', 'input_pages_directory_block', true);
709
        $template->set_block('show_pages_directory', '');
710
    } else {
711
        $template->parse('show_pages_directory', 'show_pages_directory_block', true);
712
        $template->set_block('input_pages_directory', '');
713
    }
714
/*---------------------------------------------------------------------------------------------------*/
715
    // Insert language text and messages
716
    $template->set_var(array(
717
                    'TEXT_WEBSITE_TITLE' => $TEXT['WEBSITE_TITLE'],
718
                    'TEXT_WEBSITE_DESCRIPTION' => $TEXT['WEBSITE_DESCRIPTION'],
719
                    'TEXT_WEBSITE_KEYWORDS' => $TEXT['WEBSITE_KEYWORDS'],
720
                    'TEXT_WEBSITE_HEADER' => $TEXT['WEBSITE_HEADER'],
721
                    'TEXT_WEBSITE_FOOTER' => $TEXT['WEBSITE_FOOTER'],
722
                    'TEXT_WEBSITE_SIGNATURE' => 'Signature',
723
                    'TEXT_HEADER' => $TEXT['HEADER'],
724
                    'TEXT_FOOTER' => $TEXT['FOOTER'],
725
                    'TEXT_VISIBILITY' => $TEXT['VISIBILITY'],
726
                    'TEXT_RESULTS_HEADER' => $TEXT['RESULTS_HEADER'],
727
                    'TEXT_RESULTS_LOOP' => $TEXT['RESULTS_LOOP'],
728
                    'TEXT_RESULTS_FOOTER' => $TEXT['RESULTS_FOOTER'],
729
                    'TEXT_NO_RESULTS' => $TEXT['NO_RESULTS'],
730
                    'TEXT_TEXT' => $TEXT['TEXT'],
731
                    'TEXT_DEFAULT' => $TEXT['DEFAULT'],
732
                    'TEXT_LANGUAGE' => $TEXT['LANGUAGE'],
733
                    'TEXT_TIMEZONE' => $TEXT['TIMEZONE'],
734
                    'TEXT_CHARSET' => $TEXT['CHARSET'],
735
                    'TEXT_DATE_FORMAT' => $TEXT['DATE_FORMAT'],
736
                    'TEXT_TIME_FORMAT' => $TEXT['TIME_FORMAT'],
737
                    'TEXT_TEMPLATE' => $TEXT['TEMPLATE'],
738
                    'TEXT_THEME' => $TEXT['THEME'],
739
                    'TEXT_WYSIWYG_EDITOR' => $TEXT['WYSIWYG_EDITOR'],
740
                    'TEXT_PAGE_LEVEL_LIMIT' => $TEXT['PAGE_LEVEL_LIMIT'],
741
                    'TEXT_INTRO_PAGE' => $TEXT['INTRO_PAGE'],
742
                    'TEXT_FRONTEND' => $TEXT['FRONTEND'],
743
                    'TEXT_LOGIN' => $TEXT['LOGIN'],
744
                    'TEXT_REDIRECT_AFTER' => $TEXT['REDIRECT_AFTER'],
745
                    'TEXT_SIGNUP' => $TEXT['SIGNUP'],
746
                    'TEXT_PHP_ERROR_LEVEL' => $TEXT['PHP_ERROR_LEVEL'],
747
                    'TEXT_PAGES_DIRECTORY' => $TEXT['PAGES_DIRECTORY'],
748
                    'TEXT_MEDIA_DIRECTORY' => $TEXT['MEDIA_DIRECTORY'],
749
                    'TEXT_PAGE_EXTENSION' => $TEXT['PAGE_EXTENSION'],
750
                    'TEXT_PAGE_SPACER' => $TEXT['PAGE_SPACER'],
751
                    'TEXT_RENAME_FILES_ON_UPLOAD' => $TEXT['RENAME_FILES_ON_UPLOAD'],
752
                    'TEXT_APP_NAME' => $TEXT['APP_NAME'],
753
                    'TEXT_SESSION_IDENTIFIER' => $TEXT['SESSION_IDENTIFIER'],
754
                    'TEXT_SEC_ANCHOR' => $TEXT['SEC_ANCHOR'],
755
                    'TEXT_SERVER_OPERATING_SYSTEM' => $TEXT['SERVER_OPERATING_SYSTEM'],
756
                    'TEXT_LINUX_UNIX_BASED' => $TEXT['LINUX_UNIX_BASED'],
757
                    'TEXT_WINDOWS' => $TEXT['WINDOWS'],
758
                    'TEXT_ADMIN' => $TEXT['ADMIN'],
759
                    'TEXT_TYPE' => $TEXT['TYPE'],
760
                    'TEXT_DATABASE' => $TEXT['DATABASE'],
761
                    'TEXT_HOST' => $TEXT['HOST'],
762
                    'TEXT_USERNAME' => $TEXT['USERNAME'],
763
                    'TEXT_PASSWORD' => $TEXT['PASSWORD'],
764
                    'TEXT_NAME' => $TEXT['NAME'],
765
                    'TEXT_TABLE_PREFIX' => $TEXT['TABLE_PREFIX'],
766
                    'TEXT_SAVE' => $TEXT['SAVE'],
767
                    'TEXT_RESET' => $TEXT['RESET'],
768
                    'TEXT_CHANGES' => $TEXT['CHANGES'],
769
                    'TEXT_ENABLED' => $TEXT['ENABLED'],
770
                    'TEXT_DISABLED' => $TEXT['DISABLED'],
771
                    'TEXT_MANAGE_SECTIONS' => $HEADING['MANAGE_SECTIONS'],
772
                    'TEXT_MANAGE' => $TEXT['MANAGE'],
773
                    'TEXT_SEARCH' => $TEXT['SEARCH'],
774
                    'TEXT_PUBLIC' => $TEXT['PUBLIC'],
775
                    'TEXT_PRIVATE' => $TEXT['PRIVATE'],
776
                    'TEXT_REGISTERED' => $TEXT['REGISTERED'],
777
                    'TEXT_NONE' => $TEXT['NONE'],
778
                    'TEXT_FILES' => strtoupper(substr($TEXT['FILES'], 0, 1)).substr($TEXT['FILES'], 1),
779
                    'TEXT_DIRECTORIES' => $TEXT['DIRECTORIES'],
780
                    'TEXT_FILESYSTEM_PERMISSIONS' => $TEXT['FILESYSTEM_PERMISSIONS'],
781
                    'TEXT_USER' => $TEXT['USER'],
782
                    'TEXT_GROUP' => $TEXT['GROUP'],
783
                    'TEXT_OTHERS' => $TEXT['OTHERS'],
784
                    'TEXT_READ' => $TEXT['READ'],
785
                    'TEXT_WRITE' => $TEXT['WRITE'],
786
                    'TEXT_EXECUTE' => $TEXT['EXECUTE'],
787
                    'TEXT_WARN_PAGE_LEAVE' => '',
788
                    'TEXT_SMART_LOGIN' => $TEXT['SMART_LOGIN'],
789
                    'TEXT_MULTIPLE_MENUS' => $TEXT['MULTIPLE_MENUS'],
790
                    'TEXT_HOMEPAGE_REDIRECTION' => $TEXT['HOMEPAGE_REDIRECTION'],
791
                    'TEXT_SECTION_BLOCKS' => $TEXT['SECTION_BLOCKS'],
792
                    'TEXT_PLEASE_SELECT' => $TEXT['PLEASE_SELECT'],
793
                    'TEXT_PAGE_TRASH' => $TEXT['PAGE_TRASH'],
794
                    'TEXT_PAGE_LANGUAGES' => $TEXT['PAGE_LANGUAGES'],
795
                    'TEXT_INLINE' => $TEXT['INLINE'],
796
                    'TEXT_SEPARATE' => $TEXT['SEPARATE'],
797
                    'TEXT_HOME_FOLDERS' => $TEXT['HOME_FOLDERS'],
798
                    'TEXT_WYSIWYG_STYLE' => $TEXT['WYSIWYG_STYLE'],
799
                    'TEXT_WORLD_WRITEABLE_FILE_PERMISSIONS' => $TEXT['WORLD_WRITEABLE_FILE_PERMISSIONS'],
800
                    'MODE_SWITCH_WARNING' => $MESSAGE['SETTINGS']['MODE_SWITCH_WARNING'],
801
                    'WORLD_WRITEABLE_WARNING' => $MESSAGE['SETTINGS']['WORLD_WRITEABLE_WARNING'],
802
                    'TEXT_MODULE_ORDER' => $TEXT['MODULE_ORDER'],
803
                    'TEXT_MAX_EXCERPT' => $TEXT['MAX_EXCERPT'],
804
                    'TEXT_TIME_LIMIT' => $TEXT['TIME_LIMIT']
805
                    ));
806
/*---------------------------------------------------------------------------------------------------*/
807
if($is_advanced)
808
{
809
    $template->parse('show_page_level_limit', 'show_page_level_limit_block', true);
810
    $template->parse('show_checkbox_1',       'show_checkbox_1_block', true);
811
    $template->parse('show_checkbox_2',       'show_checkbox_2_block', true);
812
    $template->parse('show_checkbox_3',       'show_checkbox_3_block', true);
813
    $template->set_block('show_php_error_level', '');
814
    $template->set_block('show_charset', '');
815
    $template->parse('show_wysiwyg',          'show_wysiwyg_block', true);
816
    $template->parse('show_search',           'show_search_block', true);
817
    $template->parse('show_redirect_timer',   'show_redirect_timer_block', true);
818
}else {
819
    $template->set_block('show_page_level_limit', '');
820
    $template->set_block('show_checkbox_1', '');
821
    $template->set_block('show_checkbox_2', '');
822
    $template->set_block('show_checkbox_3', '');
823
    $template->set_block('show_php_error_level', '');
824
    $template->set_block('show_charset', '');
825
    $template->set_block('show_wysiwyg', '');
826
    $template->set_block('show_search', '');
827
    $template->set_block('show_redirect_timer', '');
828
}
829
if($is_advanced && $admin->get_user_id()=='1')
830
{
831
    $template->parse('show_access', 'show_access_block', true);
832
    $template->parse('show_chmod_js', 'show_chmod_js_block', true);
833
    $template->parse('show_setting_js', 'show_setting_js_block', true);
834
}else {
835
    $template->set_block('show_access_block', '');
836
    $template->set_block('show_chmod_js_block', '');
837
    $template->set_block('show_setting_js_block', '');
838
}
839
/*---------------------------------------------------------------------------------------------------*/
840
// Parse template objects output
841
$template->parse('main', 'main_block', false);
842
$template->pparse('output', 'page');
843

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