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/cvetdv.ru/bitrix/components/realcommenter_2.0/tape.last.comments/ |
Upload File : |
<?php /** * ����� "��������� ����������� D7" ��� ������� * �������� ���� �����: www.realcommenter.com * �������� ���� �����������: burlaka.studio * ����� � ����������: ������� ������� (AlexeyGfi) -> alexeygfi@gmail.com */ use Bitrix\Main\Entity\ReferenceField; use Bitrix\Main\Loader; use Burlakastudio\Realcommenter\CACHE; use Burlakastudio\Realcommenter\COMMENTS; use Burlakastudio\Realcommenter\PARSER; use Burlakastudio\Realcommenter\TOOLS; use Burlakastudio\Realcommenter\URL; /** * @var CBitrixComponent $this */ if (!defined('B_PROLOG_INCLUDED') || B_PROLOG_INCLUDED !== true) { die(); } $arResult['comments'] = []; if (!Loader::includeModule('burlakastudio.realcommenter') ) { return; } $arParams['showPageTitle'] = $arParams['showPageTitle'] ?? 'Y'; $arParams['showPageTitle'] = $arParams['showPageTitle'] === 'Y'; $arParams['placePageTitleInline'] = $arParams['placePageTitleInline'] ?? 'Y'; $arParams['placePageTitleInline'] = $arParams['placePageTitleInline'] === 'Y'; // ������� ������� ��� $cacheObj = CACHE::getCacheObj(); $cacheKey = CACHE::getLastCommentsCacheKey(); $cacheKey .= serialize($arParams); $cacheTtl = CACHE::getTtl(); $cachePath = TOOLS::getModuleName() . '_last_comments'; if ( CACHE::HAVE_CACHE === $cacheObj->startDataCache( $cacheTtl, $cacheKey, $cachePath ) ) { // ���� �������� �� ��� $arResult['comments'] = $cacheObj->getVars(); } else { // ����� $commentsFilter = [ // ����������� ������� // 'UF_ACTIVE' => true, // ��� ��������� � ����� ��� ������ '!UF_UFO' => true, ]; $activityFilter = $arParams['activity'] ?? 'Y'; if ($activityFilter === 'Y') { $commentsFilter['UF_ACTIVE'] = true; } elseif ($activityFilter === 'N') { $commentsFilter['UF_ACTIVE'] = false; } // ���������� $commentSort = [ // �� ���� ���� ������ ������ 'UF_CREATED_DATE' => 'DESC', // ��������� ����� 'ID' => 'ASC' ]; // ����� $commentLimit = (int)$arParams['commentLimit']; if (!$commentLimit) { $commentLimit = 10; } // �������� $commentRuntime = []; // ...� ����� $commentsReferences[] = new ReferenceField( 'URL', URL::getDataClass(), ['=this.UF_URL_ID' => 'ref.ID'] ); // ...� ����������� $commentsReferences[] = new ReferenceField( 'USER', '\Bitrix\Main\UserTable', ['=this.UF_USER_ID' => 'ref.ID'] ); // ���� ����� �������� �� ���� ��������� $groupId = (int)$arParams['groupId']; if ($groupId) { $commentsFilter['URL.UF_GROUP_ID'] = $groupId; } // ��� �������� $commentsSelect = [ '*', 'URL_NAME' => 'URL.UF_URL', 'USER_NAME' => 'USER.NAME', 'USER_LAST_NAME' => 'USER.LAST_NAME', 'USER_EMAIL' => 'USER.EMAIL', 'GROUP_ID' => 'URL.UF_GROUP_ID', 'PAGE_TITLE' => 'URL.UF_PAGE_TITLE' ]; CTimeZone::Disable(); $result = COMMENTS::getList([ 'filter' => $commentsFilter, 'order' => $commentSort, 'limit' => $commentLimit, 'runtime' => $commentsReferences, 'select' => $commentsSelect, ]); CTimeZone::Enable(); $commentMaxLength = (int)$arParams['commentMaxLength']; if (!$commentMaxLength) { $commentMaxLength = 120; } while ($row = $result->fetch()) { TOOLS::normalizeValues($row, [ 'UF_COMMENT', 'UF_SIGNATURE', 'UF_EMAIL', 'UF_CREATED_DATE', 'UF_UPLOADS' ]); // ��������, ���� �������� �� ��� $row = array_filter($row); PARSER::simplify($row['UF_COMMENT']); PARSER::trimmer($row['UF_COMMENT'], $commentMaxLength); if ($arParams['showPageTitle'] && !$row['PAGE_TITLE']) { $row['PAGE_TITLE'] = \Burlakastudio\Realcommenter\URL::syncTitles([ 'id' => $row['UF_URL_ID'] ]); } $arResult['comments'][] = $row; } $taggedCache = \Bitrix\Main\Application::getInstance()->getTaggedCache(); if ($taggedCache) { $taggedCache->startTagCache($cachePath); $taggedCache->registerTag(CACHE::getLastCommentsCacheKey()); $taggedCache->endTagCache(); } // ... ������������ �� $cacheObj->endDataCache($arResult['comments']); } $this->IncludeComponentTemplate();