• Модуль: im
  • Путь к файлу: ~/bitrix/modules/im/classes/general/im_notify.php
  • Класс: CIMNotify
  • Вызов: CIMNotify::Confirm
public function Confirm($id, $value)
{
	global $DB;

	$id = intval($id);

	$strSql = "
		SELECT M.*
		FROM b_im_relation R, b_im_message M
		WHERE M.ID = ".$id." AND R.USER_ID = ".$this->user_id." AND R.MESSAGE_TYPE = '".IM_MESSAGE_SYSTEM."' AND R.CHAT_ID = M.CHAT_ID AND M.NOTIFY_TYPE = ".IM_NOTIFY_CONFIRM;
	$dbRes = $DB->Query($strSql, false, "File: ".__FILE__."
Line: ".__LINE__); if (!($arRes = $dbRes->Fetch())) return false; $arRes['RELATION_USER_ID'] = $this->user_id; $arRes['NOTIFY_BUTTONS'] = unserialize($arRes['NOTIFY_BUTTONS'], ['allowed_classes' => false]); $resultMessages = Array(); if ($arRes['NOTIFY_TAG'] <> '') { $CBXSanitizer = new CBXSanitizer; $CBXSanitizer->AddTags(array( 'a' => array('href','style', 'target'), 'b' => array(), 'u' => array(), 'i' => array(), 'br' => array(), 'span' => array('style'), )); foreach(GetModuleEvents("im", "OnBeforeConfirmNotify", true) as $arEvent) { $resultEvent = ExecuteModuleEventEx($arEvent, Array($arRes['NOTIFY_MODULE'], $arRes['NOTIFY_TAG'], $value, $arRes)); if($resultEvent===false || is_array($resultEvent) && $resultEvent['result'] === false) { $resultMessages = Array(); if (is_array($resultEvent) && $resultEvent['text']) { $resultMessages[] = $CBXSanitizer->SanitizeHtml($resultEvent['text']); } break; } else if (is_array($resultEvent) && $resultEvent['text'] || is_string($resultEvent) && $resultEvent <> '') { $resultMessages[] = $CBXSanitizer->SanitizeHtml(is_string($resultEvent)? $resultEvent: $resultEvent['text']); } } } if (empty($resultMessages)) { foreach ($arRes['NOTIFY_BUTTONS'] as $button) { if ($button['VALUE'] == $value) { $resultMessages[] = GetMessage('IM_CONFIRM_CHOICE', Array('#BUTTON#' => $button['TITLE'])); break; } } } self::Delete($id); if ($arRes['NOTIFY_TAG'] <> '') { foreach(GetModuleEvents("im", "OnAfterConfirmNotify", true) as $arEvent) ExecuteModuleEventEx($arEvent, array($arRes['NOTIFY_MODULE'], $arRes['NOTIFY_TAG'], $value, $arRes, $resultMessages)); } if (CModule::IncludeModule("pull")) { BitrixPullEvent::add($this->user_id, Array( 'module_id' => 'im', 'command' => 'notifyConfirm', 'params' => Array( 'id' => $id, 'chatId' => intval($arRes['CHAT_ID']), 'confirmMessages' => $resultMessages, 'counter' => self::GetRealCounter($arRes['CHAT_ID']), ), 'extra' => BitrixImCommon::getPullExtra() )); } CIMMessenger::SpeedFileDelete($this->user_id, IM_SPEED_NOTIFY); return $resultMessages; }