16 $GLOBALS[
"APPLICATION"]->ThrowException(
"System error 870164",
"ERROR");
22 $GLOBALS[
"APPLICATION"]->ThrowException(
GetMessage(
"SONET_M_EMPTY_FROM_USER_ID"),
"EMPTY_FROM_USER_ID");
30 $GLOBALS[
"APPLICATION"]->ThrowException(
GetMessage(
"SONET_M_ERROR_NO_FROM_USER_ID"),
"ERROR_NO_FROM_USER_ID");
37 $GLOBALS[
"APPLICATION"]->ThrowException(
GetMessage(
"SONET_M_EMPTY_TO_USER_ID"),
"EMPTY_TO_USER_ID");
45 $GLOBALS[
"APPLICATION"]->ThrowException(
GetMessage(
"SONET_M_ERROR_NO_TO_USER_ID"),
"ERROR_NO_TO_USER_ID");
52 $GLOBALS[
"APPLICATION"]->ThrowException(
GetMessage(
"SONET_GB_EMPTY_DATE_CREATE"),
"EMPTY_DATE_CREATE");
58 $GLOBALS[
"APPLICATION"]->ThrowException(
GetMessage(
"SONET_MM_EMPTY_DATE_VIEW"),
"EMPTY_DATE_UPDATE");
84 if (!CSocNetGroup::__ValidateID(
$ID))
90 $db_events =
GetModuleEvents(
"socialnetwork",
"OnBeforeSocNetMessagesDelete");
91 while ($arEvent = $db_events->Fetch())
96 while ($arEvent = $events->Fetch())
100 $bSuccess =
$DB->Query(
"DELETE FROM b_sonet_messages WHERE ID = ".
$ID.
"",
true);
112 $GLOBALS[
"APPLICATION"]->ThrowException(
GetMessage(
"SONET_UR_EMPTY_MESSAGE_ID"),
"ERROR_MESSAGE_ID");
116 $userID = intval($userID);
119 $GLOBALS[
"APPLICATION"]->ThrowException(
GetMessage(
"SONET_UR_EMPTY_SENDER_USER_ID"),
"ERROR_SENDER_USER_ID");
124 if (!$arMessage || !is_array($arMessage))
126 $GLOBALS[
"APPLICATION"]->ThrowException(
GetMessage(
"SONET_UR_NO_MESSAGE"),
"ERROR_NO_MESSAGE");
130 if (($arMessage[
"FROM_USER_ID"] == $userID) && ($arMessage[
"TO_USER_ID"] == $userID))
135 if ($e =
$GLOBALS[
"APPLICATION"]->GetException())
143 elseif ($arMessage[
"FROM_USER_ID"] == $userID)
145 if ($arMessage[
"TO_DELETED"] ==
"Y")
150 if ($e =
$GLOBALS[
"APPLICATION"]->GetException())
164 if ($e =
$GLOBALS[
"APPLICATION"]->GetException())
174 elseif ($arMessage[
"TO_USER_ID"] == $userID)
176 if ($arMessage[
"FROM_DELETED"] ==
"Y")
181 if ($e =
$GLOBALS[
"APPLICATION"]->GetException())
195 if ($e =
$GLOBALS[
"APPLICATION"]->GetException())
210 $GLOBALS[
"APPLICATION"]->ThrowException(
GetMessage(
"SONET_UR_NO_MESSAGE"),
"ERROR_NO_MESSAGE");
221 if (!CSocNetGroup::__ValidateID($userID))
224 $userID = intval($userID);
228 $bSuccess =
$DB->Query(
"DELETE FROM b_sonet_messages WHERE FROM_USER_ID = ".$userID.
" OR TO_USER_ID = ".$userID.
"",
true);
242 if (!CSocNetGroup::__ValidateID(
$ID))
259 public static function SendEvent($messageID, $mailTemplate =
"SONET_NEW_MESSAGE")
261 $messageID = intval($messageID);
267 array(
"ID" => $messageID,
"IS_LOG_ALL" =>
"Y"),
270 array(
"ID",
"FROM_USER_ID",
"TO_USER_ID",
"TITLE",
"MESSAGE",
"DATE_CREATE",
"FROM_USER_NAME",
"FROM_USER_LAST_NAME",
"FROM_USER_LOGIN",
"TO_USER_NAME",
"TO_USER_LAST_NAME",
"TO_USER_LOGIN",
"TO_USER_EMAIL",
"TO_USER_LID")
276 $defSiteID = (Defined(
"SITE_ID") ?
SITE_ID : $arMessage[
"TO_USER_LID"]);
283 "MESSAGE_ID" => $messageID,
284 "USER_ID" => $arMessage[
"TO_USER_ID"],
285 "USER_NAME" => $arMessage[
"TO_USER_NAME"],
286 "USER_LAST_NAME" => $arMessage[
"TO_USER_LAST_NAME"],
287 "SENDER_ID" => $arMessage[
"FROM_USER_ID"],
288 "SENDER_NAME" => $arMessage[
"FROM_USER_NAME"],
289 "SENDER_LAST_NAME" => $arMessage[
"FROM_USER_LAST_NAME"],
290 "EMAIL_TO" => $arMessage[
"TO_USER_EMAIL"],
291 "TITLE" => $arMessage[
"TITLE"],
292 "MESSAGE" => $arMessage[
"MESSAGE"]
308 $senderUserID = intval($senderUserID);
309 if ($senderUserID <= 0)
311 $GLOBALS[
"APPLICATION"]->ThrowException(
GetMessage(
"SONET_UR_EMPTY_SENDER_USER_ID"),
"ERROR_SENDER_USER_ID");
315 $messageID = intval($messageID);
318 $GLOBALS[
"APPLICATION"]->ThrowException(
GetMessage(
"SONET_UR_EMPTY_MESSAGE_ID"),
"ERROR_MESSAGE_ID");
324 "TO_USER_ID" => $senderUserID,
335 array(
"ID",
"DATE_CREATE")
348 if ($e =
$GLOBALS[
"APPLICATION"]->GetException())
363 $GLOBALS[
"APPLICATION"]->ThrowException(
GetMessage(
"SONET_UR_NO_MESSAGE"),
"ERROR_NO_MESSAGE");
374 $senderUserID = intval($senderUserID);
375 if ($senderUserID <= 0)
377 $GLOBALS[
"APPLICATION"]->ThrowException(
GetMessage(
"SONET_UR_EMPTY_SENDER_USER_ID"),
"ERROR_SENDER_USER_ID");
381 $targetUserID = intval($targetUserID);
382 if ($targetUserID <= 0)
384 $GLOBALS[
"APPLICATION"]->ThrowException(
GetMessage(
"SONET_UR_EMPTY_TARGET_USER_ID"),
"ERROR_TARGET_USER_ID");
391 $GLOBALS[
"APPLICATION"]->ThrowException(
GetMessage(
"SONET_UR_EMPTY_MESSAGE"),
"ERROR_MESSAGE");
396 "FROM_USER_ID" => $senderUserID,
397 "TO_USER_ID" => $targetUserID,
400 "=DATE_CREATE" =>
$GLOBALS[
"DB"]->CurrentTimeFunction(),
401 "DATE_VIEW" =>
false,
403 "FROM_DELETED" =>
"N",
410 if ($e =
$GLOBALS[
"APPLICATION"]->GetException())
428 $userID = intval($userID);
431 $GLOBALS[
"APPLICATION"]->ThrowException(
GetMessage(
"SONET_UR_EMPTY_SENDER_USER_ID"),
"ERROR_USER_ID");
435 if (!is_array($arIDs))
438 foreach ($arIDs as
$ID)
448 $userID = intval($userID);
451 $GLOBALS[
"APPLICATION"]->ThrowException(
GetMessage(
"SONET_UR_EMPTY_SENDER_USER_ID"),
"ERROR_USER_ID");
455 if (!is_array($arIDs))
458 foreach ($arIDs as
$ID)
468 $CurrentUserID = intval($CurrentUserID);
469 $PartnerUserID = intval($PartnerUserID);
471 if ($CurrentUserID <= 0)
473 $GLOBALS[
"APPLICATION"]->ThrowException(
GetMessage(
"SONET_UR_EMPTY_SENDER_USER_ID"),
"ERROR_USER_ID");
477 if ($PartnerUserID <= 0)
479 $GLOBALS[
"APPLICATION"]->ThrowException(
GetMessage(
"SONET_UR_EMPTY_TARGET_USER_ID"),
"ERROR_USER_ID");
484 while ($arMessages = $dbMessages->GetNext())
496 $userID = intval($userID);
502 "SELECT COUNT(ID) as CNT ".
503 "FROM b_sonet_messages ".
504 "WHERE TO_USER_ID = ".$userID.
" ".
505 " AND DATE_VIEW IS NULL ".
506 " AND TO_DELETED = 'N' "
521 $userID = intval($userID);
545 $userID = intval($userID);
562 $userID = intval($userID);
578 return "CSocNetMessages::SendEventAgent();";
590 array(
"ID",
"FROM_USER_ID",
"TO_USER_ID",
"TITLE",
"MESSAGE",
"DATE_CREATE",
"FROM_USER_NAME",
"FROM_USER_LAST_NAME",
"FROM_USER_LOGIN",
"TO_USER_NAME",
"TO_USER_LAST_NAME",
"TO_USER_LOGIN",
"TO_USER_EMAIL",
"TO_USER_LID",
"EMAIL_TEMPLATE",
"IS_LOG")
595 if (isset($arMessage[
"EMAIL_TEMPLATE"]) && $arMessage[
"EMAIL_TEMPLATE"] <>
'')
596 $mailTemplate = $arMessage[
"EMAIL_TEMPLATE"];
598 $mailTemplate =
"SONET_NEW_MESSAGE";
600 $defSiteID = $arMessage[
"TO_USER_LID"];
609 "MESSAGE_ID" => $arMessage[
"ID"],
610 "USER_ID" => $arMessage[
"TO_USER_ID"],
611 "USER_NAME" => $arMessage[
"TO_USER_NAME"],
612 "USER_LAST_NAME" => $arMessage[
"TO_USER_LAST_NAME"],
613 "SENDER_ID" => $arMessage[
"FROM_USER_ID"],
614 "SENDER_NAME" => $arMessage[
"FROM_USER_NAME"],
615 "SENDER_LAST_NAME" => $arMessage[
"FROM_USER_LAST_NAME"],
616 "EMAIL_TO" => $arMessage[
"TO_USER_EMAIL"],
617 "TITLE" => $arMessage[
"TITLE"],
627 return "CSocNetMessages::SendEventAgent();";
static __SpeedFileDelete($userID)
static SpeedFileExists($userID)
static DeleteConversation($CurrentUserID, $PartnerUserID)
static DeleteMessageMultiple($userID, $arIDs)
static CreateMessage($senderUserID, $targetUserID, $message, $title=false)
static MarkMessageRead($senderUserID, $messageID, $bRead=true)
static SendEvent($messageID, $mailTemplate="SONET_NEW_MESSAGE")
static __SpeedFileCheckMessages($userID)
static CheckFields($ACTION, &$arFields, $ID=0)
static DeleteMessage($ID, $userID, $bCheckMessages=true)
static MarkMessageReadMultiple($userID, $arIDs)
static DeleteNoDemand($userID)
static __SpeedFileCreate($userID)
static GetEventSite($userID, $event, $defSiteID)
static GetList($arOrder=Array("ID"=> "DESC"), $arFilter=Array(), $arGroupBy=false, $arNavStartParams=false, $arSelectFields=array())
static GetMessagesForChat($currentUserID, $userID, $date=false, $arNavStartParams=false, $replyMessId=false)
static Update($ID, $arFields)
</td ></tr ></table ></td ></tr >< tr >< td class="bx-popup-label bx-width30"><?=GetMessage("PAGE_NEW_TAGS")?> array( $site)
while($arParentIBlockProperty=$dbParentIBlockProperty->Fetch()) $errorMessage
ExecuteModuleEventEx($arEvent, $arParams=[])
IsModuleInstalled($module_id)
GetModuleEvents($MODULE_ID, $MESSAGE_ID, $bReturnArray=false)
IncludeModuleLangFile($filepath, $lang=false, $bReturnArray=false)
GetMessage($name, $aReplace=null)
if( $daysToExpire >=0 &&$daysToExpire< 60 elseif)( $daysToExpire< 0)
const SONET_MESSAGE_PRIVATE
const SONET_MESSAGE_SYSTEM
$GLOBALS['_____370096793']