Server IP : 80.87.202.40 / Your IP : 216.73.216.169 Web Server : Apache System : Linux rospirotorg.ru 5.14.0-539.el9.x86_64 #1 SMP PREEMPT_DYNAMIC Thu Dec 5 22:26:13 UTC 2024 x86_64 User : bitrix ( 600) PHP Version : 8.2.27 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : ON Directory : /home/bitrix/ext_www/rospirotorg.ru/bitrix/modules/burlakastudio.realcommenter/lib/ |
Upload File : |
<?php /** * ����� "��������� ����������� D7" ��� ������� * �������� ���� �����: www.realcommenter.com * �������� ���� �����������: burlaka.studio * ����� � ����������: ������� ������� (AlexeyGfi) -> alexeygfi@gmail.com */ namespace Burlakastudio\Realcommenter; use Bitrix\Main\Application; use Bitrix\Main\ArgumentNullException; use Bitrix\Main\ArgumentOutOfRangeException; use Bitrix\Main\Config\Option; require_once 'OptionsDb.php'; class OPTIONS extends REALCOMMENTER_HL_GENERAL_PROVIDER { /** * @param string $name * @return bool|string * @throws ArgumentNullException * @throws ArgumentOutOfRangeException */ public static function get($name = '') { if (!$name) { return false; } $module_id = TOOLS::getModuleName(); return Option::get( $module_id, $name, self::get_option_default_value($name) ); } public static function set($name = '', $value = '') { if (!$name) { return; } $module_id = TOOLS::getModuleName(); Option::set($module_id, $name, $value); /** * ���� � ��� �������� � �������� css, �������� ��� ����� ������������ � ������ */ if ($name == 'custom_css_code') { \Burlakastudio\Realcommenter\TOOLS::customCssSyns($value); } } public static function get_option_default_value($name = '') { $tab_tree = self::getModuleOptions(); foreach ($tab_tree as $tab_struct) { if (isset($tab_struct['LIST'][$name]) && $tab_struct['LIST'][$name]) { return $tab_struct['LIST'][$name]['DEFAULT']; } } return ''; } public static function getModuleOptions() { return OptionsDb::getModuleOptions(); } public static function set_module_options_to_default() { if (!USER::is_admin()) { return; } $tab_tree = self::getModuleOptions(); foreach ($tab_tree as $tab_struct) { foreach ($tab_struct['LIST'] as $option_key => $option_info) { self::set($option_key, $option_info['DEFAULT']); } } } public static function saveModuleOptions() { if (!USER::is_admin()) { return; } $request = Application::getInstance()->getContext()->getRequest(); if (!$request->isPost()) { return; } $tab_tree = self::getModuleOptions(); foreach ($tab_tree as $tab_struct) { foreach ($tab_struct['LIST'] as $option_key => $option_info) { $option_from_POST = $request->getPost($option_key); $option_value_current = self::get($option_key); if (isset($option_info['TYPE'])) { if ($option_info['TYPE'] === 'checkbox') { $option_from_POST = ($option_from_POST == '1'); } else if ($option_info['TYPE'] === 'number') { $option_from_POST = (int)$option_from_POST; } } if ($option_from_POST == $option_value_current) { continue; } self::set($option_key, $option_from_POST); } } // �����, ����� ������ �������� �������������/����� �� ��������� ���������� ������� SanctionsAgent::agentCpu(); // ��������, ��� �� hl-����� ������ CHECKER::checkState(); // ��������, �� ��� �� ����� �������� CHECKER::checkHlEvents(); // ������ ����� � ������ POST_TEMPLATES::checkAndSync(); } public static function getModuleDomains() { $siteDomains = self::get('domain_for_security'); $siteDomains = preg_replace('~\s~', '', $siteDomains); if (!$siteDomains) { return []; } $siteDomains = explode(',', $siteDomains); $siteDomains = array_filter($siteDomains); return $siteDomains; } }