本文整理汇总了PHP中CEvent::Send方法的典型用法代码示例。如果您正苦于以下问题:PHP CEvent::Send方法的具体用法?PHP CEvent::Send怎么用?PHP CEvent::Send使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CEvent
的用法示例。
在下文中一共展示了CEvent::Send方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: Send
public function Send()
{
if(!$this->IsAvailable())
return false;
$arNotification = $this->Notify->getNotification();
//No need to send about updates;
if($arNotification["ACTION"] == "UPDATE")
return 0;
$arEmailSubscribe = array();
$arAllSubscribe = $this->GetList(array(), array("ID" => array(self::SUBSCRIBE_ALL, self::SUBSCRIBE_IDEA_COMMENT.$arNotification["POST_ID"])), false, false, array("USER_ID", "USER_EMAIL"));
while($r = $arAllSubscribe->Fetch())
if(check_email($r["USER_EMAIL"]))
$arEmailSubscribe[$r["USER_ID"]] = $r["USER_EMAIL"];
foreach($arEmailSubscribe as $UserId => $Email)
{
//Avoid to send notification to author
if($UserId == $arNotification["AUTHOR_ID"])
continue;
$arNotification["EMIAL_TO"] = $Email;
//ADD_IDEA_COMMENT, ADD_IDEA
CEvent::Send($arNotification["ACTION"].'_'.$arNotification["TYPE"], SITE_ID, $arNotification);
}
return count($arEmailSubscribe)>0;
}
示例2: sendOnAfterResultStatusChange
function sendOnAfterResultStatusChange($WEB_FORM_ID, $RESULT_ID, $NEW_STATUS_ID = false, $CHECK_RIGHTS = 'Y')
{
$NEW_STATUS_ID = intval($NEW_STATUS_ID);
$dbRes = CForm::GetByID($WEB_FORM_ID);
if (!($arForm = $dbRes->Fetch())) {
return;
}
CTimeZone::Disable();
$dbRes = CFormResult::GetByID($RESULT_ID);
CTimeZone::Enable();
if (!($arResult = $dbRes->Fetch()) || !$arResult['USER_ID']) {
return;
}
$dbRes = CUser::GetByID($arResult['USER_ID']);
if (!($arUser = $dbRes->Fetch())) {
return;
}
if (!$NEW_STATUS_ID) {
$NEW_STATUS_ID = CFormStatus::GetDefault($WEB_FORM_ID);
}
$dbRes = CFormStatus::GetByID($NEW_STATUS_ID);
if (!($arStatus = $dbRes->Fetch()) || strlen($arStatus['MAIL_EVENT_TYPE']) <= 0) {
return;
}
$arTemplates = CFormStatus::GetMailTemplateArray($NEW_STATUS_ID);
if (!is_array($arTemplates) || count($arTemplates) <= 0) {
return;
}
$arEventFields = array("EMAIL_TO" => $arUser['EMAIL'], "RS_FORM_ID" => $arForm["ID"], "RS_FORM_NAME" => $arForm["NAME"], "RS_FORM_VARNAME" => $arForm["SID"], "RS_FORM_SID" => $arForm["SID"], "RS_RESULT_ID" => $arResult["ID"], "RS_DATE_CREATE" => $arResult["DATE_CREATE"], "RS_USER_ID" => $arResult['USER_ID'], "RS_USER_EMAIL" => $arUser['EMAIL'], "RS_USER_NAME" => $arUser["NAME"] . " " . $arUser["LAST_NAME"], "RS_STATUS_ID" => $arStatus["ID"], "RS_STATUS_NAME" => $arStatus["TITLE"]);
$dbRes = CEventMessage::GetList($by = "id", $order = "asc", array('ID' => implode('|', $arTemplates), "ACTIVE" => "Y", "EVENT_NAME" => $arStatus["MAIL_EVENT_TYPE"]));
while ($arTemplate = $dbRes->Fetch()) {
CEvent::Send($arTemplate["EVENT_NAME"], $arTemplate["SITE_ID"], $arEventFields, "Y", $arTemplate["ID"]);
}
}
示例3: Delivery
function Delivery(&$arFields){
CModule::IncludeModule("iblock");
$arSelect = Array("ID","PROPERTY_iblock","PROPERTY_send","NAME");
$arFilter = Array("IBLOCK_ID"=>38, "ACTIVE"=>"Y");
$res = CIBlockElement::GetList(Array(), $arFilter, false, Array("nPageSize"=>50), $arSelect);
while($ob = $res->GetNextElement())
{
$arFields1 = $ob->GetFields();
$delivery[$arFields1["PROPERTY_IBLOCK_VALUE"]]=$arFields1;
$id_ac[]=$arFields1["PROPERTY_IBLOCK_VALUE"];
}
if (in_array($arFields['IBLOCK_ID'],$id_ac))
{
$arSelect = Array("ID","PROPERTY_email","NAME");
$arFilter = Array("IBLOCK_ID"=>34, "ACTIVE"=>"Y","PROPERTY_delivery"=>$arFields['IBLOCK_ID']);
$res = CIBlockElement::GetList(Array(), $arFilter, false, Array("nPageSize"=>50000), $arSelect);
while($ob = $res->GetNextElement())
{
$arFields1 = $ob->GetFields();
$receivers[]=$arFields1;
}
foreach ($receivers as $receiver){
$arEventFields = array(
"ID" => $arFields["ID"],
"EMAIL_TO" => $receiver["PROPERTY_EMAIL_VALUE"],
"TITLE" => $arFields["NAME"],
);
$ev_id[]=CEvent::Send('DELIVERY', 's1', $arEventFields,"N",$delivery[$arFields['IBLOCK_ID']]["PROPERTY_SEND_VALUE"]);
}
}
}
示例4: my_OnAfterIBlockElementAdd
function my_OnAfterIBlockElementAdd(&$arFields)
{
$elem = CIBlockElement::GetList(array(), array("IBLOCK_ID" => 12, "ID" => $arFields["ID"]), false, false, array("NAME", "PROPERTY_email", "PROPERTY_phone", "PROPERTY_message"));
while ($elem_info = $elem->Fetch()) {
$mailFields = array("EMAIL_TO" => "raulschokino@yandex.ru", "AUTHOR" => $elem_info["NAME"], "AUTHOR_EMAIL" => $elem_info["PROPERTY_EMAIL_VALUE"], "AUTHOR_PHONE" => $elem_info["PROPERTY_PHONE_VALUE"], "TEXT" => $elem_info["PROPERTY_MESSAGE_VALUE"]);
}
CEvent::Send("FEEDBACK_FORM", "s1", $mailFields, "N");
//получим сообщение
}
示例5: send
/**
* @param MailPackage $package
* @param bool $duplicate
* @return int
*/
public function send(MailPackage $package, $duplicate = false)
{
$rsSites = \CSite::GetList($by = "sort", $order = "desc", array());
$siteIds = array();
while ($arSite = $rsSites->Fetch()) {
$siteIds[] = $arSite['ID'];
}
return \CEvent::Send($package->getEventName(), $siteIds, $package->getFields(), $duplicate ? 'Y' : 'N', $package->getMessageId());
}
示例6: json_request
protected function json_request()
{
if($_REQUEST["json_request_callback_form"] && $_REQUEST["json_request_callback_form"] == "Y"){
global $APPLICATION;
$APPLICATION->restartBuffer();
$this->arResult = array();
$this->arResult["error"] = array();
if(!empty($_REQUEST["form"])){
foreach($_REQUEST["form"] as $val){
$this->arResult["form"][$val["name"]]=$val["value"];
if(($val["name"] == "USER_NAME" && strlen($val["value"]) < 2) || ($val["name"] == "USER_PHONE" && strlen($val["value"] < 6))){
$this->arResult["error"][] = array(
"name" => $val["name"],
"message" => GetMessage("ERROR_".$val["name"])
);
}else{
$this->arResult["field"][$val["name"]] = $val["value"];
}
}
}
if(count($this->arResult["error"]) == 0){
CEvent::Send("SB_CALLBACK_FORM",SITE_ID,$this->arResult["form"]);
\Bitrix\Main\Loader::includeModule("softbalance.callback");
$data = array(
"CREATED" => new \Bitrix\Main\Type\DateTime(),
"NAME" => $this->arResult["field"]["USER_NAME"],
"STATUS" => "new",
"PHONE" => $this->arResult["field"]["USER_PHONE"],
"USER_COMMENT"=> $this->arResult["field"]["USER_COMMENT"],
"ADMIN_COMMENT" => "",
"SITE_ID" => SITE_ID
);
$result = \Softbalance\Callback\CallbackTable::add($data);
if($result){
$this->arResult["complete"]=true;
$this->arResult["ok"]=GetMessage("ok");
}
}
echo json_encode($this->arResult);
die();
}
}
示例7: execute
public function execute(Form $form)
{
$sendData = $form->getData();
if ($this->fieldsUppercase) {
$submitArray = array_change_key_case($sendData, CASE_UPPER);
}
$result = \CEvent::Send($this->emailEvent, SITE_ID, $submitArray);
if (!$result && $this->isCritical) {
throw new \Exception('CEvent::Send false');
} elseif (!$result && !$this->isCritical) {
$form->setErrors(array($this->getErrorMessage('ошибка отправки почты (CEvent::Send)')));
}
}
示例8: afterRecord
/**
* После окончания записи передачи уведомление пользователю
*
* @param array $arParams
* @return boolean
*/
public static function afterRecord($arParams)
{
if (!empty($arParams["USER_EMAIL"])) {
$arEventFields = array("RECORD_ID" => $arParams["RECORD_ID"], "RECORD_TITLE" => $arParams["RECORD_NAME"], "EMAIL" => $arParams["USER_EMAIL"], "USER_ID" => $arParams["USER_ID"], "USER_NAME" => $arParams["USER_NAME"], "URL" => $arParams["URL"], "PICTURE" => $arParams["PICTURE"]);
if (CEvent::Send("RECORD_AFTER", array(SITE_ID), $arEventFields)) {
return true;
} else {
return false;
}
} else {
return true;
}
}
示例9: send
/**
* Created by JetBrains PhpStorm.
* User: professor
* Date: 28.10.12
* Time: 15:45
* To change this template use File | Settings | File Templates.
*/
function send()
{
die;
require_once $_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/main/include/prolog_before.php";
CModule::IncludeModule("iblock");
$ob = CIBlockElement::GetList(array("SORT" => "ASC"), array("!PROPERTY_EMAIL_MANAGER" => fale, "IBLOCK_ID" => IB_CLUB_ID), FALSE, FALSE, array("ID", "NAME", "PROPERTY_EMAIL_MANAGER"));
while ($row = $ob->Fetch()) {
if (trim($row['PROPERTY_EMAIL_MANAGER_VALUE'] != "")) {
$arEventFields = array("EMAIL" => $row['PROPERTY_EMAIL_MANAGER_VALUE']);
CEvent::Send("RASSYLKA", "s1", $arEventFields);
}
}
return true;
}
示例10: _OnUserAdd
function _OnUserAdd(&$arFields, &$userID)
{
$GLOBALS["cntUsersImport"]++;
unset($arFields["GROUP_ID"]);
$arFields["ID"] = $arFields["USER_ID"] = $userID;
$arFields["URL_LOGIN"] = urlencode($arFields["LOGIN"]);
if (isset($arFields["EXTERNAL_AUTH_ID"]) && strlen($arFields["EXTERNAL_AUTH_ID"]) > 0 && strlen($GLOBALS["eventLdapLangID"]) > 0) {
$arFields["BACK_URL"] = "/";
$event = new CEvent();
$event->Send("LDAP_USER_CONFIRM", $GLOBALS["eventLdapLangID"], $arFields);
} elseif ($GLOBALS["sendEmail"] == "Y" && $arFields["EMAIL"] != $GLOBALS["defaultUserEmail"] && strlen($GLOBALS["eventLangID"]) > 0) {
$event = new CEvent();
$event->Send("USER_INVITE", $GLOBALS["eventLangID"], $arFields);
}
}
示例11: addOrder
function addOrder($data)
{
if ($data['product'] > 0 and strlen(trim($data['name'])) > 0 and (strlen(trim($data['phone'])) > 0 or strlen(trim($data['email'])) > 0)) {
/**
* save form
*/
$arFields = array('IBLOCK_ID' => (int) $GLOBALS['AQW_ORDER']['IBLOCK_ID'], 'NAME' => GetMessage("AQW_SHOP_NOVYY_ZAKAZ_OT") . date("d.m.Y H:i:s"), 'PROPERTY_VALUES' => array('PRODUCT' => $data['product'], 'COLOR' => $data['color'], 'SIZE' => $data['size'], 'NAME' => $data['name'], 'PHONE' => $data['phone'], 'EMAIL' => $data['email'], 'ORDER_URL' => getenv("REQUEST_URI")));
$iBlock = new CIBlockElement();
$ORDER_ID = $iBlock->Add($arFields);
/**
* send email
*/
$arEventFields = array("IBLOCK_TYPE" => $GLOBALS['AQW_ORDER']['IBLOCK_TYPE'], "IBLOCK_ID" => (int) $GLOBALS['AQW_ORDER']['IBLOCK_ID'], "ORDER_ID" => $ORDER_ID, "PRODUCT" => $data['product'], "COLOR" => $data['color'], "SIZE" => $data['size'], "NAME" => $data['name'], "PHONE" => $data['phone'], "EMAIL" => $data['email'], "ORDER_URL" => getenv("REQUEST_URI"));
CEvent::Send("NEW_ORDER", SITE_ID, $arEventFields);
}
}
示例12: sendMessOnEmail
/**
* @param string $emailFrom
* @param string $emailUser
* @param string $text
* @param string $title
* @return int
*/
public static function sendMessOnEmail($emailFrom, $emailUser, $title, $text = "")
{
$nameMessageTemplate = "NEW_NOTICE";
switch ($title) {
case "NEW_ANSWER":
$titleMessage = "Новый ответ";
$textMessage = "На Ваш вопрос поступил новый ответ";
break;
default:
$titleMessage = "Приятные пожелания";
$textMessage = "Удачного Вам сегодня Дня!!!";
break;
}
$arEventFields = array("FROM_EMAIL" => $emailFrom, "EMAIL" => $emailUser, "TITLE" => $titleMessage, "TEXT" => $textMessage);
$idTemplateMessage = 70;
$result = CEvent::Send($nameMessageTemplate, "s1", $arEventFields, $idTemplateMessage);
return $result;
}
示例13: array
"ORDER_LIST" => $strOrderList,
"SALE_EMAIL" => COption::GetOptionString("sale", "order_email", "order@".$SERVER_NAME),
"DELIVERY_PRICE" => $arOrder["DELIVERY_PRICE"],
);
$eventName = "SALE_NEW_ORDER";
$bSend = true;
foreach(GetModuleEvents("sale", "OnOrderNewSendEmail", true) as $arEvent)
if (ExecuteModuleEventEx($arEvent, array($ID, &$eventName, &$arFields))===false)
$bSend = false;
if($bSend)
{
$event = new CEvent;
$event->Send($eventName, $LID, $arFields, "N");
}
CSaleMobileOrderPush::send("ORDER_CREATED", array("ORDER" => $arOrderNew));
}
}
else
{
foreach($arErrors as $val)
{
if (is_array($val))
$errorMessage .= $val["TEXT"]."<br>";
else
$errorMessage .= $val;
}
}
示例14: GetMessage
continue;
}
$strOrderList .= $val["NAME"] . " - " . $val["QUANTITY"] . " " . GetMessage("SOA_SHT") . ": " . SaleFormatCurrency($val["PRICE"], $arBasketItems["CURRENCY"]);
$strOrderList .= "\n";
}
$arFields = array("ORDER_ID" => $ORDER_ID, "ORDER_DATE" => Date($DB->DateFormatToPHP(CLang::GetDateFormat("SHORT", SITE_ID))), "ORDER_USER" => strlen($payerName) > 0 ? $payerName : $USER->GetFullName(), "PRICE" => SaleFormatCurrency($arBasketItems["PRICE"], $arBasketItems["CURRENCY"]), "BCC" => COption::GetOptionString("sale", "order_email", "order@" . $SERVER_NAME), "EMAIL" => strlen($payerEMail) > 0 ? $payerEMail : $USER->GetEmail(), "ORDER_LIST" => $strOrderList, "SALE_EMAIL" => COption::GetOptionString("sale", "order_email", "order@" . $SERVER_NAME), "DELIVERY_PRICE" => $arBasketItems["PRICE_DELIVERY"]);
$eventName = "SALE_NEW_ORDER";
$bSend = true;
foreach (GetModuleEvents("sale", "OnOrderNewSendEmail", true) as $arEvent) {
if (ExecuteModuleEventEx($arEvent, array($ORDER_ID, &$eventName, &$arFields)) === false) {
$bSend = false;
}
}
if ($bSend) {
$event = new CEvent();
$event->Send($eventName, SITE_ID, $arFields, "N");
}
/*end mail*/
CSaleMobileOrderPush::send("ORDER_CREATED", array("ORDER_ID" => $arFields["ORDER_ID"]));
if (Loader::includeModule("statistic")) {
$event1 = "eStore";
$event2 = "order_confirm";
$event3 = $arResult["ORDER_ID"];
$e = $event1 . "/" . $event2 . "/" . $event3;
if (!is_array($_SESSION["ORDER_EVENTS"]) || is_array($_SESSION["ORDER_EVENTS"]) && !in_array($e, $_SESSION["ORDER_EVENTS"])) {
CStatistic::Set_Event($event1, $event2, $event3);
$_SESSION["ORDER_EVENTS"][] = $e;
}
}
$urlError = "";
if ($PAYSYSTEM_ID == "account") {
示例15: SendEvent
function SendEvent($ID, $mailTemplate = "SONET_NEW_EVENT")
{
$ID = IntVal($ID);
if ($ID <= 0) {
return false;
}
$arFilter = array("ID" => $ID);
$dbLogComments = CSocNetLogComments::GetList(array(), $arFilter, false, false, array("ID", "LOG_ID", "ENTITY_TYPE", "ENTITY_ID", "USER_ID", "USER_NAME", "USER_LAST_NAME", "USER_SECOND_NAME", "USER_LOGIN", "EVENT_ID", "LOG_DATE", "MESSAGE", "TEXT_MESSAGE", "URL", "MODULE_ID", "GROUP_NAME", "CREATED_BY_NAME", "CREATED_BY_SECOND_NAME", "CREATED_BY_LAST_NAME", "CREATED_BY_LOGIN", "LOG_SITE_ID", "SOURCE_ID", "LOG_SOURCE_ID"));
$arLogComment = $dbLogComments->Fetch();
if (!$arLogComment) {
return false;
}
$arLog = array();
if (intval($arLogComment["LOG_ID"]) > 0) {
$dbLog = CSocNetLog::GetList(array(), array("ID" => $arLogComment["LOG_ID"]));
$arLog = $dbLog->Fetch();
if (!$arLog) {
$arLog = array();
}
}
$arEvent = CSocNetLogTools::FindLogCommentEventByID($arLogComment["EVENT_ID"]);
if ($arEvent && array_key_exists("CLASS_FORMAT", $arEvent) && array_key_exists("METHOD_FORMAT", $arEvent) && strlen($arEvent["CLASS_FORMAT"]) > 0 && strlen($arEvent["METHOD_FORMAT"]) > 0) {
$dbSiteCurrent = CSite::GetByID(SITE_ID);
if ($arSiteCurrent = $dbSiteCurrent->Fetch()) {
if ($arSiteCurrent["LANGUAGE_ID"] != LANGUAGE_ID) {
$arLogComment["MAIL_LANGUAGE_ID"] = $arSiteCurrent["LANGUAGE_ID"];
}
}
$arLogComment["FIELDS_FORMATTED"] = call_user_func(array($arEvent["CLASS_FORMAT"], $arEvent["METHOD_FORMAT"]), $arLogComment, array(), true, $arLog);
}
if (array_key_exists($arLogComment["ENTITY_TYPE"], $GLOBALS["arSocNetAllowedSubscribeEntityTypesDesc"]) && array_key_exists("HAS_MY", $GLOBALS["arSocNetAllowedSubscribeEntityTypesDesc"][$arLogComment["ENTITY_TYPE"]]) && $GLOBALS["arSocNetAllowedSubscribeEntityTypesDesc"][$arLogComment["ENTITY_TYPE"]]["HAS_MY"] == "Y" && array_key_exists("CLASS_OF", $GLOBALS["arSocNetAllowedSubscribeEntityTypesDesc"][$arLogComment["ENTITY_TYPE"]]) && array_key_exists("METHOD_OF", $GLOBALS["arSocNetAllowedSubscribeEntityTypesDesc"][$arLogComment["ENTITY_TYPE"]]) && strlen($GLOBALS["arSocNetAllowedSubscribeEntityTypesDesc"][$arLogComment["ENTITY_TYPE"]]["CLASS_OF"]) > 0 && strlen($GLOBALS["arSocNetAllowedSubscribeEntityTypesDesc"][$arLogComment["ENTITY_TYPE"]]["METHOD_OF"]) > 0 && method_exists($GLOBALS["arSocNetAllowedSubscribeEntityTypesDesc"][$arLogComment["ENTITY_TYPE"]]["CLASS_OF"], $GLOBALS["arSocNetAllowedSubscribeEntityTypesDesc"][$arLogComment["ENTITY_TYPE"]]["METHOD_OF"])) {
$arOfEntities = call_user_func(array($GLOBALS["arSocNetAllowedSubscribeEntityTypesDesc"][$arLogComment["ENTITY_TYPE"]]["CLASS_OF"], $GLOBALS["arSocNetAllowedSubscribeEntityTypesDesc"][$arLogComment["ENTITY_TYPE"]]["METHOD_OF"]), $arLogComment["ENTITY_ID"]);
}
$arListParams = array("USE_SUBSCRIBE" => "Y", "ENTITY_TYPE" => $arLogComment["ENTITY_TYPE"], "ENTITY_ID" => $arLogComment["ENTITY_ID"], "EVENT_ID" => $arLogComment["EVENT_ID"], "USER_ID" => $arLogComment["USER_ID"], "OF_ENTITIES" => $arOfEntities, "TRANSPORT" => array("M", "X"));
$arLogSites = array();
$rsLogSite = CSocNetLog::GetSite($arLog["ID"]);
while ($arLogSite = $rsLogSite->Fetch()) {
$arLogSites[] = $arLogSite["LID"];
}
if (CModule::IncludeModule("extranet")) {
if ($arLogComment["ENTITY_TYPE"] == SONET_ENTITY_GROUP) {
$arSites = array();
$dbSite = CSite::GetList($by = "sort", $order = "desc", array("ACTIVE" => "Y"));
while ($arSite = $dbSite->Fetch()) {
$arSites[$arSite["ID"]] = array("DIR" => strlen(trim($arSite["DIR"])) > 0 ? $arSite["DIR"] : "/", "SERVER_NAME" => strlen(trim($arSite["SERVER_NAME"])) > 0 ? $arSite["SERVER_NAME"] : COption::GetOptionString("main", "server_name", $_SERVER["HTTP_HOST"]));
}
$intranet_site_id = CSite::GetDefSite();
}
$arIntranetUsers = CExtranet::GetIntranetUsers();
$extranet_site_id = CExtranet::GetExtranetSiteID();
}
$dbSubscribers = CSocNetLogEvents::GetList(array("TRANSPORT" => "DESC"), array("USER_ACTIVE" => "Y", "SITE_ID" => array_merge($arLogSites, array(false))), false, false, array("USER_ID", "ENTITY_TYPE", "ENTITY_ID", "ENTITY_CB", "ENTITY_MY", "USER_NAME", "USER_LAST_NAME", "USER_LOGIN", "USER_LID", "USER_EMAIL", "TRANSPORT"), $arListParams);
$arListParams = array("USE_SUBSCRIBE" => "Y", "ENTITY_TYPE" => $arLogComment["ENTITY_TYPE"], "ENTITY_ID" => $arLogComment["ENTITY_ID"], "EVENT_ID" => $arLogComment["EVENT_ID"], "USER_ID" => $arLogComment["USER_ID"], "OF_ENTITIES" => $arOfEntities, "TRANSPORT" => "N");
$dbUnSubscribers = CSocNetLogEvents::GetList(array("TRANSPORT" => "DESC"), array("USER_ACTIVE" => "Y", "SITE_ID" => array_merge($arLogSites, array(false))), false, false, array("USER_ID", "SITE_ID", "ENTITY_TYPE", "ENTITY_ID", "ENTITY_CB", "ENTITY_MY", "TRANSPORT", "EVENT_ID"), $arListParams);
$arUnSubscribers = array();
while ($arUnSubscriber = $dbUnSubscribers->Fetch()) {
$arUnSubscribers[] = $arUnSubscriber["USER_ID"] . "_" . $arUnSubscriber["ENTITY_TYPE"] . "_" . $arUnSubscriber["ENTITY_ID"] . "_" . $arUnSubscriber["ENTITY_MY"] . "_" . $arUnSubscriber["ENTITY_CB"] . "_" . $arUnSubscriber["EVENT_ID"];
}
$bHasAccessAll = CSocNetLogRights::CheckForUserAll($arLog["ID"] ? $arLog["ID"] : $arLogComment["LOG_ID"]);
$arSentUserID = array("M" => array(), "X" => array());
while ($arSubscriber = $dbSubscribers->Fetch()) {
if (is_array($arIntranetUsers) && !in_array($arSubscriber["USER_ID"], $arIntranetUsers) && !in_array($extranet_site_id, $arLogSites)) {
continue;
}
if (array_key_exists($arSubscriber["TRANSPORT"], $arSentUserID) && in_array($arSubscriber["USER_ID"], $arSentUserID[$arSubscriber["TRANSPORT"]])) {
continue;
}
if (intval($arSubscriber["ENTITY_ID"]) != 0 && $arSubscriber["EVENT_ID"] == "all" && (in_array($arSubscriber["USER_ID"] . "_" . $arSubscriber["ENTITY_TYPE"] . "_" . $arSubscriber["ENTITY_ID"] . "_N_" . $arSubscriber["ENTITY_CB"] . "_" . $arLogComment["EVENT_ID"], $arUnSubscribers) || in_array($arSubscriber["USER_ID"] . "_" . $arSubscriber["ENTITY_TYPE"] . "_" . $arSubscriber["ENTITY_ID"] . "_Y_" . $arSubscriber["ENTITY_CB"] . "_" . $arLogComment["EVENT_ID"], $arUnSubscribers))) {
continue;
} elseif (intval($arSubscriber["ENTITY_ID"]) == 0 && $arSubscriber["ENTITY_CB"] == "N" && $arSubscriber["EVENT_ID"] != "all" && (in_array($arSubscriber["USER_ID"] . "_" . $arSubscriber["ENTITY_TYPE"] . "_" . $arLogComment["ENTITY_ID"] . "_Y_N_all", $arUnSubscribers) || in_array($arSubscriber["USER_ID"] . "_" . $arSubscriber["ENTITY_TYPE"] . "_" . $arLogComment["ENTITY_ID"] . "_N_N_all", $arUnSubscribers) || in_array($arSubscriber["USER_ID"] . "_" . $arSubscriber["ENTITY_TYPE"] . "_" . $arLogComment["ENTITY_ID"] . "_Y_N_" . $arLogComment["EVENT_ID"], $arUnSubscribers) || in_array($arSubscriber["USER_ID"] . "_" . $arSubscriber["ENTITY_TYPE"] . "_" . $arLogComment["ENTITY_ID"] . "_N_N_" . $arLogComment["EVENT_ID"], $arUnSubscribers))) {
continue;
}
$arSentUserID[$arSubscriber["TRANSPORT"]][] = $arSubscriber["USER_ID"];
if (!$bHasAccessAll) {
$bHasAccess = CSocNetLogRights::CheckForUserOnly($arLog["ID"] ? $arLog["ID"] : $arLogComment["LOG_ID"], $arSubscriber["USER_ID"]);
if (!$bHasAccess) {
continue;
}
}
if ($arLogComment["ENTITY_TYPE"] == SONET_ENTITY_GROUP && is_array($arIntranetUsers) && CModule::IncludeModule("extranet")) {
$server_name = $arSites[!in_array($arSubscriber["USER_ID"], $arIntranetUsers) && $extranet_site_id ? $extranet_site_id : $intranet_site_id]["SERVER_NAME"];
$arLogComment["FIELDS_FORMATTED"]["EVENT_FORMATTED"]["URL_TO_SEND"] = str_replace(array("#SERVER_NAME#", "#GROUPS_PATH#"), array($server_name, COption::GetOptionString("socialnetwork", "workgroups_page", false, !in_array($arSubscriber["USER_ID"], $arIntranetUsers) && $extranet_site_id ? $extranet_site_id : $intranet_site_id)), $arLogComment["FIELDS_FORMATTED"]["EVENT_FORMATTED"]["URL"]);
} else {
$arLogComment["FIELDS_FORMATTED"]["EVENT_FORMATTED"]["URL_TO_SEND"] = $arLogComment["FIELDS_FORMATTED"]["EVENT_FORMATTED"]["URL"];
}
switch ($arSubscriber["TRANSPORT"]) {
case "X":
if (array_key_exists("URL_TO_SEND", $arLogComment["FIELDS_FORMATTED"]["EVENT_FORMATTED"]) && strlen($arLogComment["FIELDS_FORMATTED"]["EVENT_FORMATTED"]["URL_TO_SEND"]) > 0) {
$link = GetMessage("SONET_GLC_SEND_EVENT_LINK") . $arLogComment["FIELDS_FORMATTED"]["EVENT_FORMATTED"]["URL_TO_SEND"];
} else {
$link = "";
}
$arMessageFields = array("FROM_USER_ID" => intval($arLogComment["USER_ID"]) > 0 ? $arLogComment["USER_ID"] : 1, "TO_USER_ID" => $arSubscriber["USER_ID"], "MESSAGE" => $arLogComment["FIELDS_FORMATTED"]["EVENT_FORMATTED"]["TITLE"] . " #BR# " . $arLogComment["FIELDS_FORMATTED"]["EVENT_FORMATTED"]["MESSAGE"] . (strlen($link) > 0 ? "#BR# " . $link : ""), "=DATE_CREATE" => $GLOBALS["DB"]->CurrentTimeFunction(), "MESSAGE_TYPE" => SONET_MESSAGE_SYSTEM, "IS_LOG" => "Y");
CSocNetMessages::Add($arMessageFields);
break;
case "M":
$arFields["SUBSCRIBER_ID"] = $arSubscriber["USER_ID"];
$arFields["SUBSCRIBER_NAME"] = $arSubscriber["USER_NAME"];
$arFields["SUBSCRIBER_LAST_NAME"] = $arSubscriber["USER_LAST_NAME"];
$arFields["SUBSCRIBER_LOGIN"] = $arSubscriber["USER_LOGIN"];
//.........这里部分代码省略.........