예제 #1
0
/**
 * Read and parse the content of the general settings template.
 *
 * @return string Parsed HTML code for the general settings panel.
 */
function sucuriscan_settings_general()
{
    global $sucuriscan_emails_per_hour, $sucuriscan_maximum_failed_logins;
    // Check the nonce here to populate the value through other functions.
    $page_nonce = SucuriScanInterface::check_nonce();
    // Process all form submissions.
    sucuriscan_settings_form_submissions($page_nonce);
    // Get initial variables to decide some things bellow.
    $emails_per_hour = SucuriScanOption::get_option(':emails_per_hour');
    $maximum_failed_logins = SucuriScanOption::get_option(':maximum_failed_logins');
    $audit_report = SucuriScanOption::get_option(':audit_report');
    $logs4report = SucuriScanOption::get_option(':logs4report');
    // Generate the HTML code for the option list in the form select fields.
    $emails_per_hour_options = SucuriScanTemplate::get_select_options($sucuriscan_emails_per_hour, $emails_per_hour);
    $maximum_failed_logins_options = SucuriScanTemplate::get_select_options($sucuriscan_maximum_failed_logins, $maximum_failed_logins);
    $template_variables = array('NotifyTo' => SucuriScanOption::get_option(':notify_to'), 'EmailsPerHour' => 'Undefined', 'EmailsPerHourOptions' => $emails_per_hour_options, 'MaximumFailedLogins' => 'Undefined', 'MaximumFailedLoginsOptions' => $maximum_failed_logins_options, 'AuditReportStatus' => 'Enabled', 'AuditReportSwitchText' => 'Disable', 'AuditReportSwitchValue' => 'disable', 'AuditReportSwitchCssClass' => 'button-danger', 'AuditReportLimit' => $logs4report, 'CustomTimezone' => '', 'CurrentDatetime' => '');
    // Keep the reset options panel and form submission processor before anything else.
    $template_variables['SettingsSection.ResetOptions'] = sucuriscan_settings_general_resetoptions($page_nonce);
    // Build HTML code for the additional general settings panels.
    $template_variables['SettingsSection.ApiKey'] = sucuriscan_settings_general_apikey($page_nonce);
    $template_variables['SettingsSection.DataStorage'] = sucuriscan_settings_general_datastorage($page_nonce);
    $template_variables['SettingsSection.ApiProxy'] = sucuriscan_settings_general_apiproxy();
    $template_variables['SettingsSection.ApiSSL'] = sucuriscan_settings_general_apissl($page_nonce);
    $template_variables['SettingsSection.ApiTimeout'] = sucuriscan_settings_general_apitimeout($page_nonce);
    $template_variables['SettingsSection.ReverseProxy'] = sucuriscan_settings_general_reverseproxy($page_nonce);
    $template_variables['SettingsSection.PasswordCollector'] = sucuriscan_settings_general_pwdcollector($page_nonce);
    $template_variables['SettingsSection.IPDiscoverer'] = sucuriscan_settings_general_ipdiscoverer($page_nonce);
    $template_variables['SettingsSection.CommentMonitor'] = sucuriscan_settings_general_commentmonitor($page_nonce);
    $template_variables['SettingsSection.XhrMonitor'] = sucuriscan_settings_general_xhrmonitor($page_nonce);
    sucuriscan_settings_general_adsvisibility($page_nonce);
    if (array_key_exists($emails_per_hour, $sucuriscan_emails_per_hour)) {
        $template_variables['EmailsPerHour'] = $sucuriscan_emails_per_hour[$emails_per_hour];
    }
    if (array_key_exists($maximum_failed_logins, $sucuriscan_maximum_failed_logins)) {
        $template_variables['MaximumFailedLogins'] = $sucuriscan_maximum_failed_logins[$maximum_failed_logins];
    }
    if ($audit_report == 'disabled') {
        $template_variables['AuditReportStatus'] = 'Disabled';
        $template_variables['AuditReportSwitchText'] = 'Enable';
        $template_variables['AuditReportSwitchValue'] = 'enable';
        $template_variables['AuditReportSwitchCssClass'] = 'button-success';
    }
    if (function_exists('wp_timezone_choice')) {
        $gmt_offset = SucuriScanOption::get_option('gmt_offset');
        $tzstring = SucuriScanOption::get_option('timezone_string');
        $template_variables['CurrentDatetime'] = SucuriScan::current_datetime();
        $template_variables['CustomTimezone'] = empty($tzstring) ? 'UTC' . $gmt_offset : $tzstring;
    }
    return SucuriScanTemplate::get_section('settings-general', $template_variables);
}
예제 #2
0
파일: sucuri.php 프로젝트: yarwalker/ecobyt
/**
 * Read and parse the content of the general settings template.
 *
 * @return string Parsed HTML code for the general settings panel.
 */
function sucuriscan_settings_general($nonce)
{
    // Process all form submissions.
    sucuriscan_settings_form_submissions($nonce);
    $params = array();
    // Keep the reset options panel and form submission processor before anything else.
    $params['SettingsSection.ResetOptions'] = sucuriscan_settings_general_resetoptions($nonce);
    // Build HTML code for the additional general settings panels.
    $params['SettingsSection.ApiKey'] = sucuriscan_settings_general_apikey($nonce);
    $params['SettingsSection.DataStorage'] = sucuriscan_settings_general_datastorage($nonce);
    $params['SettingsSection.ReverseProxy'] = sucuriscan_settings_general_reverseproxy($nonce);
    $params['SettingsSection.PasswordCollector'] = sucuriscan_settings_general_pwdcollector($nonce);
    $params['SettingsSection.IPDiscoverer'] = sucuriscan_settings_general_ipdiscoverer($nonce);
    $params['SettingsSection.CommentMonitor'] = sucuriscan_settings_general_commentmonitor($nonce);
    $params['SettingsSection.XhrMonitor'] = sucuriscan_settings_general_xhrmonitor($nonce);
    $params['SettingsSection.AuditLogStats'] = sucuriscan_settings_general_auditlogstats($nonce);
    $params['SettingsSection.Datetime'] = sucuriscan_settings_general_datetime($nonce);
    sucuriscan_settings_general_adsvisibility($nonce);
    return SucuriScanTemplate::getSection('settings-general', $params);
}