Exemple #1
0
<?php

$module_id = "security";
CModule::IncludeModule($module_id);
/**
 * @global CUser $USER
 * @global CMain $APPLICATION
 **/
$canRead = $USER->CanDoOperation('security_module_settings_read');
$canWrite = $USER->CanDoOperation('security_module_settings_write');
if ($canRead || $canWrite) {
    IncludeModuleLangFile($_SERVER["DOCUMENT_ROOT"] . BX_ROOT . "/modules/main/options.php");
    IncludeModuleLangFile(__FILE__);
    $arSyslogFacilities = array("reference_id" => array_keys(CSecurityEvent::getSyslogFacilities()), "reference" => CSecurityEvent::getSyslogFacilities());
    $arSyslogPriorities = array("reference_id" => array_keys(CSecurityEvent::getSyslogPriorities()), "reference" => CSecurityEvent::getSyslogPriorities());
    $arAllOptions = array(array("", GetMessage("SEC_OPTIONS_IPCHECK"), array("heading")), array("ipcheck_allow_self_block", GetMessage("SEC_OPTIONS_IPCHECK_ALLOW_SELF_BLOCK"), array("checkbox")), array("ipcheck_disable_file", GetMessage("SEC_OPTIONS_IPCHECK_DISABLE_FILE"), array("text", 45)), array("", GetMessage("SEC_OPTIONS_EVENTS"), array("heading")), array("security_event_format", GetMessage("SEC_OPTIONS_EVENT_FORMAT"), array("text", 60)), array("security_event_userinfo_format", GetMessage("SEC_OPTIONS_EVENT_USERINFO_FORMAT"), array("text", 60)), array("security_event_db_active", GetMessage("SEC_OPTIONS_EVENT_DB_ACTIVE"), array("checkbox")), array("security_event_syslog_active", GetMessage("SEC_OPTIONS_EVENT_SYSLOG_ACTIVE"), array("checkbox")), array("security_event_syslog_facility", GetMessage("SEC_OPTIONS_EVENT_SYSLOG_FACILITY"), array("selectbox", $arSyslogFacilities)), array("security_event_syslog_priority", GetMessage("SEC_OPTIONS_EVENT_SYSLOG_PRIORITY"), array("selectbox", $arSyslogPriorities)), array("security_event_file_active", GetMessage("SEC_OPTIONS_EVENT_FILE_ACTIVE"), array("checkbox")), array("security_event_file_path", GetMessage("SEC_OPTIONS_EVENT_FILE_PATH"), array("text", 45)));
    $aTabs = array(array("DIV" => "edit1", "TAB" => GetMessage("MAIN_TAB_SET"), "ICON" => "security_settings", "TITLE" => GetMessage("MAIN_TAB_TITLE_SET")), array("DIV" => "edit2", "TAB" => GetMessage("MAIN_TAB_RIGHTS"), "ICON" => "security_settings", "TITLE" => GetMessage("MAIN_TAB_TITLE_RIGHTS")));
    $tabControl = new CAdminTabControl("tabControl", $aTabs);
    if ($_SERVER["REQUEST_METHOD"] == "POST" && $_REQUEST["Update"] . $_REQUEST["Apply"] . $_REQUEST["RestoreDefaults"] != "" && $canWrite && check_bitrix_sessid()) {
        if ($_REQUEST["RestoreDefaults"] != "") {
            COption::RemoveOption($module_id);
        } else {
            foreach ($arAllOptions as $arOption) {
                $name = $arOption[0];
                $val = trim($_REQUEST[$name], " \t\n\r");
                $type = $arOption[2][0];
                if ($type === 'heading') {
                    continue;
                }
                if ($type === 'checkbox' && $val != 'Y') {
                    $val = 'N';
Exemple #2
0
<?php

$module_id = "security";
$RIGHT_R = $USER->CanDoOperation('security_module_settings_read');
$RIGHT_W = $USER->CanDoOperation('security_module_settings_write');
if ($RIGHT_R || $RIGHT_W) {
    IncludeModuleLangFile($_SERVER["DOCUMENT_ROOT"] . BX_ROOT . "/modules/main/options.php");
    IncludeModuleLangFile(__FILE__);
    $arSyslogFacilities = array();
    $arSyslogFacilities['reference_id'] = array_keys(CSecurityEvent::getSyslogFacilities());
    $arSyslogFacilities['reference'] = array_values(CSecurityEvent::getSyslogFacilities());
    $arSyslogPriorities = array();
    $arSyslogPriorities['reference_id'] = array_keys(CSecurityEvent::getSyslogPriorities());
    $arSyslogPriorities['reference'] = array_values(CSecurityEvent::getSyslogPriorities());
    $arAllOptions = array(array("", GetMessage("SEC_OPTIONS_IPCHECK") . " ", array("heading")), array("ipcheck_allow_self_block", GetMessage("SEC_OPTIONS_IPCHECK_ALLOW_SELF_BLOCK") . " ", array("checkbox")), array("ipcheck_disable_file", GetMessage("SEC_OPTIONS_IPCHECK_DISABLE_FILE") . " ", array("text", 45)), array("", GetMessage("SEC_OPTIONS_EVENTS") . " ", array("heading")), array("security_event_collect_user_info", GetMessage("SEC_OPTIONS_EVENT_COLLECT_USER_INFO") . " ", array("checkbox")), array("security_event_db_active", GetMessage("SEC_OPTIONS_EVENT_DB_ACTIVE") . " ", array("checkbox")), array("security_event_syslog_active", GetMessage("SEC_OPTIONS_EVENT_SYSLOG_ACTIVE") . " ", array("checkbox")), array("security_event_syslog_facility", GetMessage("SEC_OPTIONS_EVENT_SYSLOG_FACILITY") . " ", array("selectbox", $arSyslogFacilities)), array("security_event_syslog_priority", GetMessage("SEC_OPTIONS_EVENT_SYSLOG_PRIORITY") . " ", array("selectbox", $arSyslogPriorities)), array("security_event_file_active", GetMessage("SEC_OPTIONS_EVENT_FILE_ACTIVE") . " ", array("checkbox")), array("security_event_file_path", GetMessage("SEC_OPTIONS_EVENT_FILE_PATH") . " ", array("text", 45)));
    $aTabs = array(array("DIV" => "edit1", "TAB" => GetMessage("MAIN_TAB_SET"), "ICON" => "security_settings", "TITLE" => GetMessage("MAIN_TAB_TITLE_SET")), array("DIV" => "edit2", "TAB" => GetMessage("MAIN_TAB_RIGHTS"), "ICON" => "security_settings", "TITLE" => GetMessage("MAIN_TAB_TITLE_RIGHTS")));
    $tabControl = new CAdminTabControl("tabControl", $aTabs);
    CModule::IncludeModule($module_id);
    if ($REQUEST_METHOD == "POST" && strlen($Update . $Apply . $RestoreDefaults) > 0 && $RIGHT_W && check_bitrix_sessid()) {
        if (strlen($RestoreDefaults) > 0) {
            COption::RemoveOption($module_id);
        } else {
            foreach ($arAllOptions as $arOption) {
                $name = $arOption[0];
                $val = trim($_REQUEST[$name], " \t\n\r");
                if ($arOption[2][0] == "checkbox" && $val != "Y") {
                    $val = "N";
                }
                COption::SetOptionString($module_id, $name, $val, $arOption[1]);
            }
        }