Exemplo n.º 1
0
            $properties['active'] = true;
        } else {
            $properties['active'] = false;
        }
        if (is_set($properties['logging']) && $properties['logging'] === 'Y') {
            $properties['logging'] = true;
        } else {
            $properties['logging'] = false;
        }
        if (!is_set($properties['action']) || !$properties['action']) {
            throw new Security\LogicException('Action not presents', 'SECURITY_HOST_EMPTY_ACTION');
        }
        if (!is_set($properties['hosts']) || !trim($properties['hosts'])) {
            throw new Security\LogicException('Hosts not presents', 'SECURITY_HOST_EMPTY_HOSTS');
        }
        $hosts->setProperties($properties)->save();
        if ($request['save'] && $request['return_url'] != '') {
            LocalRedirect($request['return_url']);
        }
        LocalRedirect('/bitrix/admin/security_hosts.php?lang=' . LANGUAGE_ID . $returnUrlQuery . '&' . $tabControl->ActiveTabParam());
    } catch (Security\LogicException $e) {
        $errorMessage = $e->getLocMessage();
    } catch (Main\ArgumentException $e) {
        $errorMessage = Loc::getMessage('SECURITY_HOSTS_SAVE_UNKNOWN_ERROR', array('#CODE#' => $e->getMessage()));
    }
}
if ($hosts->getActive()) {
    $messageType = 'OK';
    $messageText = Loc::getMessage('SECURITY_HOSTS_ON');
} else {
    $messageType = 'ERROR';