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/components/realcommenter_2.0/tape.show.tree/ |
Upload File : |
<?php /** * ����� "��������� ����������� D7" ��� ������� * �������� ���� �����: www.realcommenter.com * �������� ���� �����������: burlaka.studio * ����� � ����������: ������� ������� (AlexeyGfi) -> alexeygfi@gmail.com */ use Bitrix\Main\Loader; use Bitrix\Main\Localization\Loc; use Burlakastudio\Realcommenter\DEBUGGER; use Burlakastudio\Realcommenter\TalkGroups; use Burlakastudio\Realcommenter\TOOLS; /** * @var CBitrixComponent $this */ if (!defined('B_PROLOG_INCLUDED') || B_PROLOG_INCLUDED !== true) { die(); } class RealcommenterComponent extends CBitrixComponent { /** * ������: �������� �������� ���������� ����� �� ������ ����������. * ������: * 'LANG_NAME' => $_GET[ 'lang_name' ] * 'LANG_NAME' => '={$lang_name}' * * ����� ��� (� ������) ��������� � ������ ����� ����������, � ����������� �� ��������. * * ���� � ����� ������ �������� ���������� ����� ���, ��� ������ �� ����� ��� �������, * �� � � ����� ���� �����, � ������ �����. * * ������� ������� ������ ���� ����, ���� ��� ������ ��������� ������� * ��� ������ � ����������� ���������� * */ public function getComponentOutsideVariables() { $toScriptPath = ''; if (file_exists(ITAPE_DOCUMENT_ROOT . $this->arParams['my_script_on_server'])) { $toScriptPath = ITAPE_DOCUMENT_ROOT . $this->arParams['my_script_on_server']; } else if (file_exists($_SERVER['DOCUMENT_ROOT'] . $this->arParams['my_script_on_server'])) { $toScriptPath = $_SERVER['DOCUMENT_ROOT'] . $this->arParams['my_script_on_server']; } $componentsInfo = \PHPParser::ParseScript(file_get_contents($toScriptPath)); $this->arParams['ITAPE_OUTSIDE_VARIABLES'] = []; foreach ($componentsInfo as $ci) { if ($ci['DATA']['COMPONENT_NAME'] === $this->getName()) { foreach ($ci['DATA']['PARAMS'] as $paramKey => $paramValue) { $getKey = false; /** * �������, ��� ����������� ������ ����� ����� � ������ */ if (is_array($paramValue)) { foreach ($paramValue as $pv) { if ( strpos($pv, '={') !== false || strpos($pv, '{$') !== false || preg_match('!^\$.+!', $pv) ) { $getKey = true; break; } } } else if ( strpos($paramValue, '={') !== false || strpos($paramValue, '{$') !== false || preg_match('!^\$.+!', $paramValue) ) { $getKey = true; } if ($getKey) { $this->arParams['ITAPE_OUTSIDE_VARIABLES'][$paramKey] = $this->arParams[$paramKey]; } } } } } public function onPrepareComponentParams($arParams) { if (!Loader::includeModule('burlakastudio.realcommenter')) { return false; } TOOLS::prepareComponentArParams($arParams); return $arParams; } public function executeComponent() { if (!Loader::includeModule('burlakastudio.realcommenter')) { \ShowMessage([ 'MESSAGE' => Loc::getMessage('REALCOMMENTER_MODULE_NEEDS'), 'TYPE' => 'OK' ]); return false; } /** * @var RealcommenterComponent $this */ if (!$this->requiredParamsSet()) { DEBUGGER::error( Loc::getMessage('REQUIRED_PARAMS_NOT_COMPLETE') ); return false; } if (!TalkGroups::valid($this->arParams['TALK_GROUP_ID'])) { DEBUGGER::error( Loc::getMessage('WRONG_TALK_GROUP') ); return false; } return parent::executeComponent(); } /** * ��������, ��� �� �������� �������� ���������� ���������� * @return bool */ public function requiredParamsSet() { foreach ($this->requiredParams() as $rp_key) { if (!isset($this->arParams[$rp_key]) || empty($this->arParams[$rp_key])) { return false; } } return true; } private function requiredParams() { return [ 'TALK_GROUP_ID', ]; } }