1C-Bitrix 25.700.0
Загрузка...
Поиск...
Не найдено
calendar_livefeed.php
См. документацию.
1<?php
2
5
7
9{
10 public static function AddEvent(&$arSocNetFeaturesSettings): void
11 {
12 $arSocNetFeaturesSettings['calendar']['subscribe_events'] = array(
13 'calendar' => array(
14 'ENTITIES' => array(
16 ),
17 "FORUM_COMMENT_ENTITY" => "EV",
18 'OPERATION' => 'view',
19 'CLASS_FORMAT' => 'CCalendarLiveFeed',
20 'METHOD_FORMAT' => 'FormatEvent',
21 'HAS_CB' => 'Y',
22 'FULL_SET' => array("calendar", "calendar_comment"),
23 "COMMENT_EVENT" => array(
24 "MODULE_ID" => "calendar",
25 "EVENT_ID" => "calendar_comment",
26 "OPERATION" => "view",
27 "OPERATION_ADD" => "log_rights",
28 "ADD_CALLBACK" => array("CCalendarLiveFeed", "AddComment_Calendar"),
29 "UPDATE_CALLBACK" => array("CSocNetLogTools", "UpdateComment_Forum"),
30 "DELETE_CALLBACK" => array("CSocNetLogTools", "DeleteComment_Forum"),
31 "CLASS_FORMAT" => "CSocNetLogTools",
32 "METHOD_FORMAT" => "FormatComment_Forum",
33 "METHOD_GET_URL" => array("CCalendarLiveFeed", "GetCommentUrl"),
34 "RATING_TYPE_ID" => "FORUM_POST"
35 )
36 )
37 );
38 }
39
40 public static function FormatEvent($arFields, $arParams): array
41 {
43
45 "EVENT" => $arFields
46 );
47
48 if (defined("BX_COMP_MANAGED_CACHE"))
49 {
50 $CACHE_MANAGER->RegisterTag("CALENDAR_EVENT_" . (int)$arFields["SOURCE_ID"]);
51 $CACHE_MANAGER->RegisterTag("CALENDAR_EVENT_LIST");
52 }
53
54 if ((string)$arFields['~PARAMS'] !== "")
55 {
56 $arFields['~PARAMS'] = unserialize($arFields['~PARAMS'], ['allowed_classes' => false]);
57 if (!is_array($arFields['~PARAMS']))
58 {
59 $arFields['~PARAMS'] = [];
60 }
61 }
62
63 $eventViewResult = $APPLICATION->IncludeComponent('bitrix:calendar.livefeed.view', '', array(
64 "EVENT_ID" => $arFields["SOURCE_ID"],
65 "USER_ID" => $arFields["USER_ID"],
66 "PATH_TO_USER" => $arParams["PATH_TO_USER"],
67 "MOBILE" => ($arParams["MOBILE"] ?? null),
68 "LIVEFEED_ENTRY_PARAMS" => $arFields['~PARAMS']
69 ),
70 null,
71 array('HIDE_ICONS' => 'Y')
72 );
73
74 $arResult["EVENT_FORMATTED"] = Array(
75 "TITLE" => GetMessage("EC_EDEV_EVENT"),
76 "TITLE_24" => GetMessage("EC_EDEV_EVENT"),
77 "MESSAGE" => $eventViewResult['MESSAGE'],
78 "FOOTER_MESSAGE" => $eventViewResult['FOOTER_MESSAGE'],
79 "IS_IMPORTANT" => false,
80 "STYLE" => "calendar-confirm"
81 );
82
83 $eventId = $arFields["SOURCE_ID"];
84 if (!$eventId)
85 {
86 $eventId = 0;
87 }
88
89 $calendarUrl = CCalendar::GetPath('user', $arFields["USER_ID"]);
90
91 $arResult["EVENT_FORMATTED"]["URL"] = $calendarUrl.((mb_strpos($calendarUrl, "?") === false) ? '?' : '&').'EVENT_ID='.$eventId;
92
93 $arRights = [];
94
95 if (Loader::includeModule('socialnetwork'))
96 {
97 $dbRight = CSocNetLogRights::GetList([], ['LOG_ID' => $arFields['ID']]);
98
99 while ($arRight = $dbRight->Fetch())
100 {
101 $arRights[] = $arRight['GROUP_CODE'];
102 }
103 }
104
105 $arResult['EVENT_FORMATTED']['DESTINATION'] = '';
106
107 if (Loader::includeModule('socialnetwork'))
108 {
109 $arResult['EVENT_FORMATTED']['DESTINATION'] = CSocNetLogTools::FormatDestinationFromRights(
110 $arRights,
111 array_merge($arParams, ['CREATED_BY' => $arFields['USER_ID']])
112 );
113 }
114
115 if (isset($eventViewResult['CACHED_JS_PATH']))
116 {
117 $arResult['CACHED_JS_PATH'] = $eventViewResult['CACHED_JS_PATH'];
118 }
119
120 $arResult['ENTITY']['FORMATTED']["NAME"] = "ENTITY FORMATTED NAME";
121 $arResult['ENTITY']['FORMATTED']["URL"] = $arResult["EVENT_FORMATTED"]["URL"];
122
123 $arResult['AVATAR_SRC'] = null;
124
125 if (Loader::includeModule('socialnetwork'))
126 {
128 }
129
130 $arFieldsTooltip = array(
131 'ID' => $arFields['USER_ID'],
132 'NAME' => $arFields['~CREATED_BY_NAME'],
133 'LAST_NAME' => $arFields['~CREATED_BY_LAST_NAME'],
134 'SECOND_NAME' => $arFields['~CREATED_BY_SECOND_NAME'],
135 'LOGIN' => $arFields['~CREATED_BY_LOGIN'],
136 );
137
138 $arResult['CREATED_BY']['TOOLTIP_FIELDS'] = [];
139
140 if (Loader::includeModule('socialnetwork'))
141 {
142 $arResult['CREATED_BY']['TOOLTIP_FIELDS'] = CSocNetLog::FormatEvent_FillTooltip(
143 $arFieldsTooltip,
145 );
146 }
147
148 return $arResult;
149 }
150
151 public static function OnSonetLogEntryMenuCreate($arLogEvent)
152 {
153 if (
154 is_array($arLogEvent["FIELDS_FORMATTED"])
155 && is_array($arLogEvent["FIELDS_FORMATTED"]["EVENT"])
156 && array_key_exists("EVENT_ID", $arLogEvent["FIELDS_FORMATTED"]["EVENT"])
157 && $arLogEvent["FIELDS_FORMATTED"]["EVENT"]["EVENT_ID"] === "calendar"
158 )
159 {
160 global $USER;
161
162 if ((int)$USER->GetId() === (int)$arLogEvent["FIELDS_FORMATTED"]["EVENT"]['USER_ID'])
163 {
164 $eventId = $arLogEvent["FIELDS_FORMATTED"]["EVENT"]["SOURCE_ID"];
165 $editUrl = CCalendar::GetPath('user', $arLogEvent["FIELDS_FORMATTED"]["EVENT"]['USER_ID']);
166 $editUrl .= ((mb_strpos($editUrl, "?") === false) ? '?' : '&') . 'EVENT_ID=EDIT' . $eventId;
167
168 return array(
169 array(
170 'text' => GetMessage("EC_T_EDIT"),
171 'href' => $editUrl
172 ),
173 array(
174 'text' => GetMessage("EC_T_DELETE"),
175 'onclick' => 'if (window.oViewEventManager[\''.$eventId.'\']){window.oViewEventManager[\''.$eventId.'\'].DeleteEvent();};'
176 )
177 );
178 }
179
180 return false;
181 }
182
183 return false;
184 }
185
186 // Sync comments from lifefeed to calendar event
187 public static function AddComment_Calendar($arFields)
188 {
189 if (!Loader::includeModule('forum') || !Loader::includeModule('socialnetwork'))
190 {
191 return false;
192 }
193
194 $messageID = null;
195 $arFieldsMessage = null;
196 $sError = null;
197 $ufFileID = [];
198 $ufDocID = [];
199
201 [],
202 ['ID' => $arFields['LOG_ID']],
203 false,
204 false,
205 [
206 'ID',
207 'SOURCE_ID',
208 'PARAMS',
209 ]
210 );
211
212 if ($arLog = $dbResult->Fetch())
213 {
214 if ((string)$arLog['PARAMS'] !== '')
215 {
216 $arLog['PARAMS'] = unserialize($arLog['PARAMS'], ['allowed_classes' => false]);
217 if (!is_array($arLog['PARAMS']))
218 {
219 $arLog['PARAMS'] = [];
220 }
221 }
222
223 $calendarEvent = CCalendarEvent::GetList([
224 'arFilter' => [
225 'ID' => $arLog['SOURCE_ID'],
226 'DELETED' => 'N'
227 ],
228 'parseRecursion' => true,
229 'maxInstanceCount' => 1,
230 'fetchAttendees' => true,
231 'checkPermissions' => true,
232 'setDefaultLimit' => false
233 ]);
234
235 if ($calendarEvent && is_array($calendarEvent[0]))
236 {
237 $calendarEvent = $calendarEvent[0];
238 $calendarSettings = CCalendar::GetSettings();
239 $forumID = $calendarSettings['forum_id'];
240
241 if (isset($arLog['PARAMS']['COMMENT_XML_ID']) && $arLog['PARAMS']['COMMENT_XML_ID'])
242 {
243 $commentXmlId = $arLog['PARAMS']['COMMENT_XML_ID'];
244 }
245 else
246 {
247 $commentXmlId = CCalendarEvent::GetEventCommentXmlId($calendarEvent);
248
249 if (!$arLog['PARAMS'])
250 {
251 $arLog['PARAMS'] = [];
252 }
253 $arLog['PARAMS']['COMMENT_XML_ID'] = $commentXmlId;
254 CSocNetLog::Update($arFields['LOG_ID'], ['PARAMS' => serialize($arLog['PARAMS'])]);
255 }
256
257 if ($forumID)
258 {
259 $dbTopic = CForumTopic::GetList(null, [
260 'FORUM_ID' => $forumID,
261 'XML_ID' => $commentXmlId
262 ]);
263
264 if ($dbTopic && ($arTopic = $dbTopic->Fetch()))
265 {
266 $topicID = $arTopic['ID'];
267 }
268 else
269 {
270 $topicID = 0;
271 }
272
273 $currentUserId = CCalendar::GetCurUserId();
274 $strPermission = ($currentUserId === (int)$calendarEvent['OWNER_ID'] ? 'Y' : 'M');
275
276 $arFieldsMessage = [
277 'POST_MESSAGE' => $arFields['TEXT_MESSAGE'],
278 'USE_SMILES' => 'Y',
279 'PERMISSION_EXTERNAL' => 'Q',
280 'PERMISSION' => $strPermission,
281 'APPROVED' => 'Y'
282 ];
283
284 if ($topicID === 0)
285 {
286 $arFieldsMessage['TITLE'] = 'EVENT_'.$arLog['SOURCE_ID'];
287 $arFieldsMessage['TOPIC_XML_ID'] = 'EVENT_'.$arLog['SOURCE_ID'];
288 }
289
290 $arTmp = false;
291 $GLOBALS['USER_FIELD_MANAGER']->EditFormAddFields('SONET_COMMENT', $arTmp);
292 if (is_array($arTmp))
293 {
294 if (array_key_exists('UF_SONET_COM_DOC', $arTmp))
295 {
296 $GLOBALS['UF_FORUM_MESSAGE_DOC'] = $arTmp['UF_SONET_COM_DOC'];
297 }
298 else if (array_key_exists('UF_SONET_COM_FILE', $arTmp))
299 {
300 $arFieldsMessage['FILES'] = [];
301 foreach ($arTmp['UF_SONET_COM_FILE'] as $file_id)
302 {
303 $arFieldsMessage['FILES'][] = ['FILE_ID' => $file_id];
304 }
305 }
306 }
307
308 $messageID = ForumAddMessage(($topicID > 0 ? 'REPLY' : 'NEW'), $forumID, $topicID, 0, $arFieldsMessage, $sError, $sNote);
309
310 // get UF DOC value and FILE_ID there
311 if ($messageID > 0)
312 {
313 $messageUrl = self::GetCommentUrl([
314 'ENTRY_ID' => $calendarEvent['ID'],
315 'ENTRY_USER_ID' => $calendarEvent['OWNER_ID'],
316 'COMMENT_ID' => $messageID
317 ]);
318
319 $dbAddedMessageFiles = CForumFiles::GetList(
320 ['ID' => 'ASC'],
321 ['MESSAGE_ID' => $messageID]
322 );
323 while ($arAddedMessageFiles = $dbAddedMessageFiles->Fetch())
324 {
325 $ufFileID[] = $arAddedMessageFiles['FILE_ID'];
326 }
327
328 $ufDocID = $GLOBALS['USER_FIELD_MANAGER']->GetUserFieldValue('FORUM_MESSAGE', 'UF_FORUM_MESSAGE_DOC', $messageID, LANGUAGE_ID);
329 }
330 }
331 }
332 }
333
334 if (!$messageID)
335 {
336 $sError = GetMessage('EC_LF_ADD_COMMENT_SOURCE_ERROR');
337 }
338
339 return [
340 'SOURCE_ID' => $messageID,
341 'MESSAGE' => ($arFieldsMessage ? $arFieldsMessage['POST_MESSAGE'] : false),
342 'RATING_TYPE_ID' => 'FORUM_POST',
343 'RATING_ENTITY_ID' => $messageID,
344 'ERROR' => $sError,
345 'NOTES' => $sNote,
346 'UF' => [
347 'FILE' => $ufFileID,
348 'DOC' => $ufDocID
349 ],
350 'URL' => $messageUrl ?? null
351 ];
352 }
353
354 public static function GetCommentUrl($arFields = [])
355 {
356 $messageUrl = '';
357
358 if (
359 is_array($arFields)
360 && !empty($arFields["ENTRY_ID"])
361 && !empty($arFields["ENTRY_USER_ID"])
362 )
363 {
364 $messageUrl = CCalendar::GetPath("user", $arFields["ENTRY_USER_ID"]);
365 $messageUrl .= ((mb_strpos($messageUrl, "?") === false) ? "?" : "&") . "EVENT_ID=" . $arFields["ENTRY_ID"] . "&MID=#ID#";
366
367 if (!empty($arFields["COMMENT_ID"]))
368 {
369 $messageUrl = str_replace('#ID#', (int)$arFields["COMMENT_ID"], $messageUrl);
370 }
371 }
372
373 return $messageUrl;
374 }
375
376 public static function OnAfterSonetLogEntryAddComment($arSonetLogComment): void
377 {
378 if ($arSonetLogComment["EVENT_ID"] !== "calendar_comment")
379 {
380 return;
381 }
382
383 if (!Loader::includeModule('socialnetwork'))
384 {
385 return;
386 }
387
389 [],
390 array(
391 "ID" => $arSonetLogComment["LOG_ID"],
392 "EVENT_ID" => "calendar"
393 ),
394 false,
395 false,
396 array("ID", "SOURCE_ID", "PARAMS")
397 );
398
399 if (
400 ($arLog = $dbLog->Fetch())
401 && ((int)$arLog["SOURCE_ID"] > 0)
402 )
403 {
404 CCalendarNotify::NotifyComment(
405 $arLog["SOURCE_ID"],
406 array(
407 "LOG" => $arLog,
408 "LOG_ID" => $arLog["ID"],
409 "USER_ID" => $arSonetLogComment["USER_ID"],
410 "MESSAGE" => $arSonetLogComment["MESSAGE"],
411 "URL" => $arSonetLogComment["URL"]
412 )
413 );
414 }
415 }
416
417 public static function OnForumCommentIMNotify($entityType, $eventId, $comment): void
418 {
419 if (
420 $entityType !== "EV"
421 || !Loader::includeModule("im")
422 )
423 {
424 return;
425 }
426
427 if (
428 isset($comment["MESSAGE_ID"])
429 && (int)$comment["MESSAGE_ID"] > 0
430 && ($calendarEvent = CCalendarEvent::GetById($eventId))
431 )
432 {
433 $comment["URL"] = CCalendar::GetPath("user", $calendarEvent["OWNER_ID"], true);
434 $comment["URL"] .= ((mb_strpos($comment["URL"], "?") === false) ? "?" : "&") . "EVENT_ID=".$calendarEvent["ID"] . "&MID=" . (int)$comment["MESSAGE_ID"];
435 }
436
437 CCalendarNotify::NotifyComment($eventId, $comment);
438 }
439
440 public static function OnAfterCommentAddBefore($entityType, $eventId, $arData)
441 {
442 if ($entityType !== "EV")
443 {
444 return;
445 }
446
447 if (!Loader::includeModule('socialnetwork'))
448 {
449 return;
450 }
451
452 $res = [];
453 $logId = false;
454 $commentXmlId = $arData['PARAMS']['XML_ID'];
455 $parentRes = false;
456
457 // Simple events have simple id's like "EVENT_".$eventId, for them
458 // we don't want to create second socnet log entry (mantis: 82011)
459 if ($commentXmlId !== "EVENT_".$eventId)
460 {
461 $dbRes = CSocNetLog::GetList(array("ID" => "DESC"), array("EVENT_ID" => "calendar", "SOURCE_ID" => $eventId), false, false, array("ID", "ENTITY_ID", "USER_ID", "TITLE", "MESSAGE", "SOURCE_ID", "PARAMS"));
462
463 $createNewSocnetLogEntry = true;
464 while ($arRes = $dbRes->Fetch())
465 {
466 if ((string)$arRes['PARAMS'] !== "")
467 {
468 $arRes['PARAMS'] = unserialize($arRes['PARAMS'], ['allowed_classes' => false]);
469 if (!is_array($arRes['PARAMS']))
470 {
471 $arRes['PARAMS'] = [];
472 }
473 }
474
475 if (isset($arRes['PARAMS']['COMMENT_XML_ID']) && $arRes['PARAMS']['COMMENT_XML_ID'] === $commentXmlId)
476 {
477 $logId = $arRes['ID'];
478 $createNewSocnetLogEntry = false;
479 }
480 else
481 {
482 $parentRes = $arRes;
483 }
484 }
485
486 if ($createNewSocnetLogEntry && $parentRes)
487 {
488 $arSoFields = [
489 "ENTITY_TYPE" => SONET_SUBSCRIBE_ENTITY_USER,
490 "ENTITY_ID" => $parentRes["ENTITY_ID"],
491 "EVENT_ID" => "calendar",
492 "USER_ID" => $parentRes["USER_ID"],
493 "SITE_ID" => SITE_ID,
494 "TITLE_TEMPLATE" => "#TITLE#",
495 "TITLE" => $parentRes["TITLE"],
496 "MESSAGE" => $parentRes["MESSAGE"],
497 "TEXT_MESSAGE" => '',
498 "SOURCE_ID" => $parentRes["SOURCE_ID"],
499 "ENABLE_COMMENTS" => "Y",
500 "CALLBACK_FUNC" => false,
501 "=LOG_DATE" => CDatabase::CurrentTimeFunction(),
502 "PARAMS" => serialize([
503 "COMMENT_XML_ID" => $commentXmlId
504 ])
505 ];
506 $logId = CSocNetLog::Add($arSoFields, false);
507
508 $arCodes = [];
509 $rsRights = CSocNetLogRights::GetList([], array("LOG_ID" => $parentRes["ID"]));
510
511 while ($arRights = $rsRights->Fetch())
512 {
513 $arCodes[] = $arRights['GROUP_CODE'];
514 }
516 }
517 }
518
519 if ($logId)
520 {
521 $res['LOG_ENTRY_ID'] = $logId;
522 }
523
524 return $res;
525 }
526
527 public static function OnAfterCommentAddAfter($entityType, $eventID, $arData, $logID = false): void
528 {
529 if ($entityType !== "EV")
530 {
531 return;
532 }
533
534 if ((int)$logID <= 0)
535 {
536 return;
537 }
538
539 self::SetCommentFileRights($arData, $logID);
540
541 $event = CCalendarEvent::GetById($eventID);
542 if (is_array($event))
543 {
544 (new \Bitrix\Calendar\Core\Managers\Comment())->onEventCommentAdd([
545 'ID' => $event['ID'] ?? null,
546 'COMMENT_ID' => $arData['MESSAGE_ID'] ?? null,
547 'ATTENDEE_LIST' => $event['ATTENDEE_LIST'] ?? null,
548 'ATTENDEES_CODES' => $event['ATTENDEES_CODES'] ?? null,
549 ]);
550 }
551 }
552
553 public static function OnAfterCommentUpdateAfter($entityType, $eventID, $arData, $logID = false): void
554 {
555 if ($entityType !== "EV")
556 {
557 return;
558 }
559
560 if ((int)$logID <= 0)
561 {
562 return;
563 }
564
565 if (
566 !is_array($arData)
567 || !array_key_exists("ACTION", $arData)
568 || $arData["ACTION"] !== "EDIT"
569 )
570 {
571 return;
572 }
573
574 self::SetCommentFileRights($arData, $logID);
575 }
576
577 public static function SetCommentFileRights($arData, $logID): void
578 {
579 if ((int)$logID <= 0)
580 {
581 return;
582 }
583
584 $arAccessCodes = [];
585
586 if (Loader::includeModule('socialnetwork'))
587 {
588 $dbRight = CSocNetLogRights::GetList([], ['LOG_ID' => $logID]);
589
590 while ($arRight = $dbRight->Fetch())
591 {
592 $arAccessCodes[] = $arRight['GROUP_CODE'];
593 }
594 }
595
596 $arFilesIds = $arData["PARAMS"]["UF_FORUM_MESSAGE_DOC"];
597 $UF = $GLOBALS["USER_FIELD_MANAGER"]->GetUserFields("FORUM_MESSAGE", $arData["MESSAGE_ID"], LANGUAGE_ID);
598 CCalendar::UpdateUFRights($arFilesIds, $arAccessCodes, $UF["UF_FORUM_MESSAGE_DOC"]);
599 }
600
601 public static function EditCalendarEventEntry($entryFields = [], $userFieldData = [], $accessCodes = [], $params = []): void
602 {
603 if (!$entryFields['SKIP_TIME'])
604 {
605 $entryFields['DATE_FROM'] .= ' '.$entryFields['TIME_FROM'];
606 $entryFields['DATE_TO'] .= ' '.$entryFields['TIME_TO'];
607 }
608
609 // Timezone
610 if (!$entryFields['TZ_FROM'] && isset($entryFields['DEFAULT_TZ']))
611 {
612 $entryFields['TZ_FROM'] = $entryFields['DEFAULT_TZ'];
613 }
614 if (!$entryFields['TZ_TO'] && isset($entryFields['DEFAULT_TZ']))
615 {
616 $entryFields['TZ_TO'] = $entryFields['DEFAULT_TZ'];
617 }
618
619 if (isset($entryFields['DEFAULT_TZ']) && (string)$entryFields['DEFAULT_TZ'] !== '')
620 {
621 CCalendar::SaveUserTimezoneName($params["userId"], $entryFields['DEFAULT_TZ']);
622 }
623
624 if ($entryFields['SECTION'])
625 {
626 $entryFields['SECTIONS'] = array($entryFields['SECTION']);
627 }
628
629 $entryFields["OWNER_ID"] = $params["userId"];
630 $entryFields["CAL_TYPE"] = $params["type"];
631
632 // Add author for new event
633 if (!$entryFields["ID"])
634 {
635 $accessCodes[] = 'U'.$params["userId"];
636 }
637
638 $accessCodes = array_unique($accessCodes);
639 $attendeeList = CCalendar::GetDestinationUsers($accessCodes);
640
641 if (trim($entryFields["NAME"]) === '')
642 {
643 $entryFields["NAME"] = GetMessage('EC_DEFAULT_EVENT_NAME_V2');
644 }
645
646 $entryFields['IS_MEETING'] = (!empty($attendeeList) && $attendeeList != array($params["userId"]));
647
648 if (
649 isset($entryFields['RRULE'])
650 && !empty($entryFields['RRULE'])
651 && is_array($entryFields['RRULE']['BYDAY'])
652 )
653 {
654 $entryFields['RRULE']['BYDAY'] = implode(',', $entryFields['RRULE']['BYDAY']);
655 }
656
657 if ($entryFields['IS_MEETING'])
658 {
659 $entryFields['ATTENDEES_CODES'] = $accessCodes;
660 $entryFields['ATTENDEES'] = $attendeeList;
661 $entryFields['MEETING_HOST'] = $params["userId"];
662 $entryFields['MEETING'] = array(
663 'HOST_NAME' => CCalendar::GetUserName($params["userId"]),
664 'TEXT' => '',
665 'OPEN' => false,
666 'NOTIFY' => true,
667 'REINVITE' => false
668 );
669 }
670 else
671 {
672 $entryFields['ATTENDEES'] = false;
673 }
674
675 $eventId = CCalendar::SaveEvent(
676 array(
677 'arFields' => $entryFields,
678 'autoDetectSection' => true
679 )
680 );
681
682 if ($eventId > 0)
683 {
684 if (count($userFieldData) > 0)
685 {
686 CCalendarEvent::UpdateUserFields($eventId, $userFieldData);
687 }
688
689 foreach ($accessCodes as $key => $value)
690 {
691 if ($value === "UA")
692 {
693 unset($accessCodes[$key]);
694 $accessCodes[] = "G2";
695 break;
696 }
697 }
698
699 if ($entryFields['IS_MEETING'] && !empty($userFieldData['UF_WEBDAV_CAL_EVENT']))
700 {
701 $UF = $GLOBALS['USER_FIELD_MANAGER']->GetUserFields("CALENDAR_EVENT", $eventId, LANGUAGE_ID);
702 CCalendar::UpdateUFRights($userFieldData['UF_WEBDAV_CAL_EVENT'], $accessCodes, $UF['UF_WEBDAV_CAL_EVENT']);
703 }
704
705 $socnetLogFields = Array(
706 "ENTITY_TYPE" => SONET_SUBSCRIBE_ENTITY_USER,
707 "ENTITY_ID" => $params["userId"],
708 "USER_ID" => $params["userId"],
709 "=LOG_DATE" => CDatabase::CurrentTimeFunction(),
710 "TITLE_TEMPLATE" => "#TITLE#",
711 "TITLE" => $entryFields["NAME"],
712 "MESSAGE" => '',
713 "TEXT_MESSAGE" => ''
714 );
715
716 $codes = [];
717 foreach ($accessCodes as $value)
718 {
719 if (mb_strpos($value, 'SG') === 0)
720 {
721 $codes[] = $value . '_K';
722 }
723 $codes[] = $value;
724 }
725 $codes = array_unique($codes);
726
727 if (Loader::includeModule('socialnetwork'))
728 {
730 array("ID" => "DESC"),
731 array(
732 "EVENT_ID" => "calendar",
733 "SOURCE_ID" => $eventId
734 ),
735 false,
736 false,
737 array("ID")
738 );
739
740 if ($arRes = $dbRes->Fetch())
741 {
742 CSocNetLog::Update($arRes["ID"], $socnetLogFields);
744 CSocNetLogRights::Add($arRes["ID"], $codes);
745 }
746 else
747 {
748 $socnetLogFields = array_merge($socnetLogFields, array(
749 "EVENT_ID" => "calendar",
750 "SITE_ID" => SITE_ID,
751 "SOURCE_ID" => $eventId,
752 "ENABLE_COMMENTS" => "Y",
753 "CALLBACK_FUNC" => false
754 ));
755
756 $logId = CSocNetLog::Add($socnetLogFields, false);
757 CSocNetLogRights::Add($logId, $codes);
758 }
759 }
760 }
761 }
762
763 // Called after creation or edition of calendar event
764 public static function OnEditCalendarEventEntry($params): void
765 {
766 $eventId = (int)$params['eventId'];
767
768 $currentEvent = CCalendarEvent::GetList(
769 [
770 'arFilter' => [
771 "PARENT_ID" => $eventId,
772 "ID" => $eventId,
773 "DELETED" => "N",
774 ],
775 'parseRecursion' => false,
776 'fetchAttendees' => true,
777 'fetchMeetings' => true,
778 'checkPermissions' => false,
779 'setDefaultLimit' => false,
780 ]
781 );
782
783 if ($currentEvent && count($currentEvent) > 0)
784 {
785 $currentEvent = $currentEvent[0];
786 }
787 $arFields = $params['arFields'];
788 $attendeesCodes = $params['attendeesCodes'];
789
790 if (isset($attendeesCodes) && !is_array($attendeesCodes))
791 {
792 $attendeesCodes = explode(',', $attendeesCodes);
793 }
794 if (empty($attendeesCodes) && $arFields['CREATED_BY'])
795 {
796 $attendeesCodes[] = 'U' . (int)$arFields['CREATED_BY'];
797 }
798 if (!is_array($attendeesCodes))
799 {
800 $attendeesCodes = [];
801 }
802
803 $folowersList = [];
804 $unfolowersList = [];
805
806 if (
807 $currentEvent['IS_MEETING']
808 && !empty($currentEvent['ATTENDEE_LIST'])
809 && is_array($currentEvent['ATTENDEE_LIST'])
810 )
811 {
812 foreach ($currentEvent['ATTENDEE_LIST'] as $attendee)
813 {
814 if ($attendee['status'] !== 'N')
815 {
816 $folowersList[] = (int)$attendee['id'];
817 }
818 else
819 {
820 $unfolowersList[] = $attendee['id'];
821 }
822 }
823 }
824 else
825 {
826 $folowersList[] = (int)$arFields['CREATED_BY'];
827 }
828
829 $newlogId = false;
830
831 if ($eventId > 0)
832 {
833 $arSoFields = Array(
834 "ENTITY_ID" => $arFields["CREATED_BY"],
835 "USER_ID" => $arFields["CREATED_BY"],
836 "=LOG_DATE" => CDatabase::CurrentTimeFunction(),
837 "TITLE_TEMPLATE" => "#TITLE#",
838 "TITLE" => $arFields["NAME"],
839 "MESSAGE" => "",
840 "TEXT_MESSAGE" => ""
841 );
842
843 $arAccessCodes = [];
844 foreach ($attendeesCodes as $value)
845 {
846 $arAccessCodes[] = ($value === "UA") ? "G2" : $value;
847 }
848
849 $arCodes = [];
850 foreach ($arAccessCodes as $value)
851 {
852 if (mb_strpos($value, 'U') === 0)
853 {
854 $attendeeId = (int)mb_substr($value, 1);
855 if (in_array($attendeeId, $folowersList, true))
856 {
857 $arCodes[] = $value;
858 }
859 }
860 else
861 {
862 if (mb_strpos($value, 'SG') === 0)
863 {
864 $arCodes[] = $value . '_K';
865 }
866 $arCodes[] = $value;
867 }
868 }
869
870 if (
871 $arFields['IS_MEETING']
872 && $arFields['MEETING_HOST']
873 && !in_array('U' . $arFields['MEETING_HOST'], $arCodes, true)
874 )
875 {
876 $arCodes[] = 'U'.$arFields['MEETING_HOST'];
877 }
878 $arCodes = array_unique($arCodes);
879
880 if (Loader::includeModule('socialnetwork'))
881 {
883 array("ID" => "DESC"),
884 array(
885 "EVENT_ID" => "calendar",
886 "SOURCE_ID" => $eventId
887 ),
888 false,
889 false,
890 array("ID")
891 );
892
893 if ($arRes = $dbRes->Fetch())
894 {
895 if (
896 isset($arRes["ID"])
897 && (int)$arRes["ID"] > 0
898 )
899 {
900 CSocNetLog::Update($arRes["ID"], $arSoFields);
903
904 foreach ($unfolowersList as $value)
905 {
906 CSocNetLogFollow::Set((int)$value, "L" . $arRes["ID"], 'N');
907 }
908 }
909 }
910 else
911 {
912 $arSoFields = array_merge($arSoFields, array(
913 "ENTITY_TYPE" => SONET_SUBSCRIBE_ENTITY_USER,
914 "EVENT_ID" => "calendar",
915 'MODULE_ID' => 'calendar',
916 "SITE_ID" => SITE_ID,
917 "SOURCE_ID" => $eventId,
918 "ENABLE_COMMENTS" => "Y",
919 "CALLBACK_FUNC" => false,
920 "PARAMS" => $arFields['RELATIONS'] ?? '',
921 ));
922
923 $newlogId = CSocNetLog::Add($arSoFields, false);
925
926 // Increment counter in live feed (mantis:#108212)
927 CSocNetLog::counterIncrement(array(
928 "ENTITY_ID" => $newlogId,
929 "EVENT_ID" => 'calendar',
930 "TYPE" => "L",
931 "FOR_ALL_ACCESS" => false,
932 "SEND_TO_AUTHOR" => "N"
933 ));
934
935 if (!empty($arFields['RELATIONS']) && Loader::includeModule('forum'))
936 {
937 $commentsXmlId = CCalendarEvent::GetEventCommentXmlId($arFields);
938 $calendarSettings = CCalendar::GetSettings();
939 $forumID = $calendarSettings['forum_id'] ?? null;
940
942 'TITLE' => $commentsXmlId,
943 'TAGS' => '',
944 'MESSAGE' => $commentsXmlId,
945 'AUTHOR_ID' => 0,
946 'AUTHOR_NAME' => 'SYSTEM',
947 'FORUM_ID' => $forumID,
948 'USER_START_ID' => 0,
949 'USER_START_NAME' => 'SYSTEM',
950 'LAST_POSTER_NAME' => 'SYSTEM',
951 'XML_ID' => $commentsXmlId,
952 'APPROVED' => 'Y',
953 ]);
954 }
955
956 foreach ($unfolowersList as $value)
957 {
958 CSocNetLogFollow::Set((int)$value, "L" . $newlogId, 'N');
959 }
960 }
961 }
962
963 // Find if we already have socialnetwork livefeed entry for this event
964 if ($newlogId && ($arFields['RECURRENCE_ID'] ?? null) > 0)
965 {
966 $commentXmlId = false;
967 if (!empty($arFields['RELATIONS']))
968 {
969 if (!isset($arFields['~RELATIONS']) || !is_array($arFields['~RELATIONS']))
970 {
971 $arFields['~RELATIONS'] = unserialize($arFields['RELATIONS'], ['allowed_classes' => false]);
972 }
973 if (is_array($arFields['~RELATIONS']) && array_key_exists('COMMENT_XML_ID', $arFields['~RELATIONS']) && $arFields['~RELATIONS']['COMMENT_XML_ID'])
974 {
975 $commentXmlId = $arFields['~RELATIONS']['COMMENT_XML_ID'];
976 }
977 }
978
979 $event = CCalendarEvent::GetById($arFields['RECURRENCE_ID']);
980
981 $rrule = CCalendarEvent::ParseRRULE($event['RRULE'] ?? null);
982 $until = $rrule['~UNTIL'] ?? null;
983
984 if (Loader::includeModule('socialnetwork'))
985 {
987 array("ID" => "DESC"),
988 array(
989 "EVENT_ID" => "calendar",
990 "SOURCE_ID" => $arFields['RECURRENCE_ID']
991 ),
992 false,
993 false,
994 array("ID", "SOURCE_ID", "PARAMS", "COMMENTS_COUNT")
995 );
996
997 while ($arRes = $dbRes->Fetch())
998 {
999 if (isset($arRes['PARAMS']) && is_string($arRes['PARAMS']))
1000 {
1001 $arRes['PARAMS'] = unserialize($arRes['PARAMS'], ['allowed_classes' => false]);
1002 if (!is_array($arRes['PARAMS']))
1003 {
1004 $arRes['PARAMS'] = [];
1005 }
1006 }
1007
1008 if (isset($arRes['PARAMS']['COMMENT_XML_ID']))
1009 {
1010 if ($commentXmlId && $arRes['PARAMS']['COMMENT_XML_ID'] === $commentXmlId)
1011 {
1012 // Move comments from old entry to new one
1014
1015 // Delete old entry
1017
1018 // Update comments count for new entry
1019 // And put COMMENT_XML_ID from old antry to preserve syncrinization
1020 CSocNetLog::Update($newlogId, array(
1021 "COMMENTS_COUNT" => (int)($arRes['COMMENTS_COUNT'] ?? 0),
1022 "PARAMS" => serialize(array(
1023 "COMMENT_XML_ID" => $commentXmlId
1024 ))
1025 ));
1026 }
1027 else
1028 {
1029 $instanceDate = CCalendarEvent::ExtractDateFromCommentXmlId(
1030 $arRes['PARAMS']['COMMENT_XML_ID']
1031 );
1032 if ($instanceDate && $until)
1033 {
1034 $untilTs = CCalendar::Timestamp($until);
1035 $instanceDateTs = CCalendar::Timestamp($instanceDate);
1036 if ($instanceDateTs >= $untilTs)
1037 {
1039 "SOURCE_ID" => $eventId
1040 ));
1041 }
1042 }
1043 }
1044 }
1045 }
1046 }
1047 }
1048 }
1049 }
1050
1051 // Do delete from socialnetwork live feed here
1052 public static function OnDeleteCalendarEventEntry($eventId): void
1053 {
1054 if (Loader::includeModule("socialnetwork"))
1055 {
1057 array("ID" => "DESC"),
1058 array(
1059 "EVENT_ID" => "calendar",
1060 "SOURCE_ID" => $eventId
1061 ),
1062 false,
1063 false,
1064 array("ID")
1065 );
1066 while ($arRes = $dbRes->Fetch())
1067 {
1069 }
1070 }
1071 }
1072
1073 public static function FixForumCommentURL($arData)
1074 {
1075 if (
1076 ($arData['ENTITY_TYPE_ID'] ?? null) === 'FORUM_POST'
1077 && (int)($arData['PARAM1'] ?? null) > 0
1078 && in_array($arData["MODULE_ID"], array("forum", "FORUM"))
1079 && preg_match('/^EVENT_(\d+)/', $arData["TITLE"], $match)
1080 )
1081 {
1082 $arCalendarSettings = CCalendar::GetSettings();
1083 $forumID = (int)$arCalendarSettings["forum_id"];
1084 $eventID = (int)$match[1];
1085
1086 if (
1087 (int)$arData['PARAM1'] === $forumID
1088 && $eventID > 0
1089 && ($arCalendarEvent = CCalendarEvent::GetById($eventID))
1090 && (string)$arCalendarEvent["CAL_TYPE"] !== ''
1091 && !empty($arCalendarSettings["pathes"])
1092 && (int)$arCalendarEvent["OWNER_ID"] > 0
1093 && in_array($arCalendarEvent["CAL_TYPE"], array("user", "group"))
1094 )
1095 {
1096 foreach ($arData['LID'] as $siteId => $value)
1097 {
1098 $messageUrl = false;
1099
1100 if (
1101 array_key_exists($siteId, $arCalendarSettings["pathes"])
1102 && is_array($arCalendarSettings["pathes"][$siteId])
1103 && !empty($arCalendarSettings["pathes"][$siteId])
1104 )
1105 {
1106 if ($arCalendarEvent["CAL_TYPE"] === "user")
1107 {
1108 if (
1109 array_key_exists("path_to_user_calendar", $arCalendarSettings["pathes"][$siteId])
1110 && !empty($arCalendarSettings["pathes"][$siteId]["path_to_user_calendar"])
1111 )
1112 {
1113 $messageUrl = CComponentEngine::MakePathFromTemplate(
1114 $arCalendarSettings["pathes"][$siteId]["path_to_user_calendar"],
1115 array(
1116 "user_id" => $arCalendarEvent['OWNER_ID'],
1117 )
1118 );
1119 }
1120 }
1121 elseif (
1122 array_key_exists("path_to_group_calendar", $arCalendarSettings["pathes"][$siteId])
1123 && !empty($arCalendarSettings["pathes"][$siteId]["path_to_group_calendar"])
1124 )
1125 {
1126 $messageUrl = CComponentEngine::MakePathFromTemplate(
1127 $arCalendarSettings["pathes"][$siteId]["path_to_group_calendar"],
1128 array(
1129 "group_id" => $arCalendarEvent['OWNER_ID'],
1130 )
1131 );
1132 }
1133 }
1134
1135 $arData['LID'][$siteId] = ($messageUrl ? $messageUrl."?EVENT_ID=".$arCalendarEvent["ID"]."&MID=".$arData['ENTITY_ID']."#message".$arData['ENTITY_ID'] : "");
1136 }
1137
1138 return $arData;
1139 }
1140
1141 $arData['TITLE'] = '';
1142 $arData['BODY'] = '';
1143
1144 return $arData;
1145 }
1146 }
1147
1148 public static function OnChangeMeetingStatusEventEntry($params): void
1149 {
1150 $codesList = [];
1151 $unfolowersList = [];
1152
1153 if (isset($params['event']))
1154 {
1155 if ($params['event']['IS_MEETING'])
1156 {
1157 if (
1158 isset($params['event']['MEETING_HOST'])
1159 && (int)$params['event']['MEETING_HOST'] > 0
1160 )
1161 {
1162 $codesList[] = 'U' . (int)$params['event']['MEETING_HOST'];
1163 }
1164
1165 if (isset($params['event']['ATTENDEE_LIST']) && is_array($params['event']['ATTENDEE_LIST']))
1166 {
1167 foreach ($params['event']['ATTENDEE_LIST'] as $attendee)
1168 {
1169 if (
1170 (
1171 (int)$attendee['id'] === (int)$params['userId']
1172 && $params['status'] === 'N'
1173 )
1174 || (
1175 (int)$attendee['id'] !== (int)$params['userId']
1176 && $attendee['status'] === 'N'
1177 )
1178 )
1179 {
1180 $unfolowersList[] = (int)$attendee['id'];
1181 }
1182 }
1183 }
1184 }
1185
1186 if (isset($params['event']['ATTENDEES_CODES']) && is_array($params['event']['ATTENDEES_CODES']))
1187 {
1188 foreach ($params['event']['ATTENDEES_CODES'] as $code)
1189 {
1190 if ($code === 'UA')
1191 {
1192 $codesList[] = 'G2';
1193 }
1194 else if (mb_strpos($code, 'U') === 0)
1195 {
1196 $attendeeId = (int)mb_substr($code, 1);
1197 if (!in_array($attendeeId, $unfolowersList, true))
1198 {
1199 $codesList[] = $code;
1200 }
1201 }
1202 else
1203 {
1204 if (mb_strpos($code, 'SG') === 0)
1205 {
1206 $codesList[] = $code . '_K';
1207 }
1208 $codesList[] = $code;
1209 }
1210 }
1211 }
1212 }
1213
1214 if (
1215 ($params['status'] === 'N' || $params['status'] === 'Y')
1216 && (int)$params['userId']
1217 && Loader::includeModule('socialnetwork')
1218 )
1219 {
1220 $dbRes = CSocNetLog::GetList(array("ID" => "DESC"), array("EVENT_ID" => "calendar", "SOURCE_ID" => $params['eventId']), false, false, array("ID"));
1221
1222 while ($logEntry = $dbRes->Fetch())
1223 {
1224 CSocNetLogRights::DeleteByLogID($logEntry['ID']);
1225 foreach ($unfolowersList as $value)
1226 {
1227 CSocNetLogFollow::Set((int)$value, "L" . $logEntry['ID'], 'N');
1228 }
1229 CSocNetLogFollow::Set((int)$params['userId'], "L" . $logEntry['ID'], $params['status']);
1230
1231 if (
1232 $params['status'] === 'Y'
1233 && method_exists(ComponentHelper::class, 'userLogSubscribe')
1234 )
1235 {
1236 ComponentHelper::userLogSubscribe(array(
1237 'logId' => $logEntry['ID'],
1238 'userId' => (int)$params['userId'],
1239 'typeList' => [
1240 'COUNTER_COMMENT_PUSH',
1241 ]
1242 ));
1243 }
1244
1245 if (!empty($codesList))
1246 {
1247 $codesList = array_unique($codesList);
1248 CSocNetLogRights::Add($logEntry['ID'], $codesList);
1249 }
1250 }
1251 }
1252 }
1253}
$arParams
Определения access_dialog.php:21
global $APPLICATION
Определения include.php:80
$arResult
Определения generate_coupon.php:16
Определения loader.php:13
static Add($arFields)
Определения topic.php:213
static BatchUpdateLogId($oldLogId, $newLogId)
Определения log_comments.php:1067
static FormatEvent_CreateAvatar($arFields, $arParams, $source="CREATED_BY_")
Определения log.php:950
static FormatEvent_FillTooltip($arFields, $arParams)
Определения log.php:945
static OnChangeMeetingStatusEventEntry($params)
Определения calendar_livefeed.php:1148
static OnSonetLogEntryMenuCreate($arLogEvent)
Определения calendar_livefeed.php:151
static OnAfterCommentAddAfter($entityType, $eventID, $arData, $logID=false)
Определения calendar_livefeed.php:527
static FixForumCommentURL($arData)
Определения calendar_livefeed.php:1073
static AddEvent(&$arSocNetFeaturesSettings)
Определения calendar_livefeed.php:10
static OnDeleteCalendarEventEntry($eventId)
Определения calendar_livefeed.php:1052
static OnForumCommentIMNotify($entityType, $eventId, $comment)
Определения calendar_livefeed.php:417
static SetCommentFileRights($arData, $logID)
Определения calendar_livefeed.php:577
static OnAfterSonetLogEntryAddComment($arSonetLogComment)
Определения calendar_livefeed.php:376
static OnAfterCommentUpdateAfter($entityType, $eventID, $arData, $logID=false)
Определения calendar_livefeed.php:553
static FormatEvent($arFields, $arParams)
Определения calendar_livefeed.php:40
static EditCalendarEventEntry($entryFields=[], $userFieldData=[], $accessCodes=[], $params=[])
Определения calendar_livefeed.php:601
static AddComment_Calendar($arFields)
Определения calendar_livefeed.php:187
static OnAfterCommentAddBefore($entityType, $eventId, $arData)
Определения calendar_livefeed.php:440
static GetCommentUrl($arFields=[])
Определения calendar_livefeed.php:354
static OnEditCalendarEventEntry($params)
Определения calendar_livefeed.php:764
static GetList($arOrder=Array("ID"=>"ASC"), $arFilter=Array(), $iNum=0, $arAddParams=array())
Определения message.php:884
static GetList($arOrder=Array("SORT"=>"ASC"), $arFilter=Array(), $bCount=false, $iNum=0, $arAddParams=array())
Определения topic.php:6
static Delete($ID)
Определения log.php:1294
static Add($arFields, $bSendEvent=true)
Определения log.php:20
static GetList($arOrder=Array("ID"=> "DESC"), $arFilter=Array(), $arGroupBy=false, $arNavStartParams=false, $arSelectFields=array(), $arParams=array())
Определения log.php:338
static Update($ID, $arFields)
Определения log.php:151
static DeleteByLogID($LOG_ID)
Определения log_rights.php:232
static GetList($aSort=array(), $aFilter=array())
Определения log_rights.php:256
static Add($LOG_ID, $GROUP_CODE, $bShare=false, $followSet=true)
Определения log_rights.php:8
static FormatDestinationFromRights($arRights, $arParams, &$iMoreCount=false)
Определения log_tools.php:4389
global $CACHE_MANAGER
Определения clear_component_cache.php:7
$arFields
Определения dblapprove.php:5
</td ></tr ></table ></td ></tr >< tr >< td class="bx-popup-label bx-width30"><?=GetMessage("PAGE_NEW_TAGS")?> array( $site)
Определения file_new.php:804
$res
Определения filter_act.php:7
ForumAddMessage( $MESSAGE_TYPE, $FID, $TID, $MID, $arFieldsG, &$strErrorMessage, &$strOKMessage, $iFileSize=false, $captcha_word="", $captcha_sid=0, $captcha_code="")
Определения include.php:317
global $USER
Определения csv_new_run.php:40
if(!is_null($config))($config as $configItem)(! $configItem->isVisible()) $code
Определения options.php:195
$arCodes
Определения options.php:154
$siteId
Определения ajax.php:8
IncludeModuleLangFile($filepath, $lang=false, $bReturnArray=false)
Определения tools.php:3778
GetMessage($name, $aReplace=null)
Определения tools.php:3397
if(intval($iTestTransaction) > 0) $arTmp
Определения payment.php:22
$event
Определения prolog_after.php:141
if( $daysToExpire >=0 &&$daysToExpire< 60 elseif)( $daysToExpire< 0)
Определения prolog_main_admin.php:393
if(empty($signedUserToken)) $key
Определения quickway.php:257
</p ></td >< td valign=top style='border-top:none;border-left:none;border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt;padding:0cm 2.0pt 0cm 2.0pt;height:9.0pt'>< p class=Normal align=center style='margin:0cm;margin-bottom:.0001pt;text-align:center;line-height:normal'>< a name=ТекстовоеПоле54 ></a ><?=($taxRate > count( $arTaxList) > 0) ? $taxRate."%"
Определения waybill.php:936
$comment
Определения template.php:15
if($inWords) echo htmlspecialcharsbx(Number2Word_Rus(roundEx($totalVatSum $params['CURRENCY']
Определения template.php:799
const SONET_SUBSCRIBE_ENTITY_USER
Определения include.php:121
if( $_SERVER $arSocNetFeaturesSettings['REQUEST_METHOD']=="GET" &&($RestoreDefaults ?? null)<> '' && $SONET_RIGHT=="W" &&check_bitrix_sessid())
Определения options.php:35
$arRes
Определения options.php:104
const SITE_ID
Определения sonet_set_content_view.php:12
$GLOBALS['_____370096793']
Определения update_client.php:1
if(CModule::IncludeModule("forum")) if(CModule::IncludeModule("blog")) $dbLog
Определения updtr1007.php:132
$dbResult
Определения updtr957.php:3
$dbRes
Определения yandex_detail.php:168