当前位置: 首页>>代码示例>>PHP>>正文


PHP CIMNotify::DeleteByTag方法代码示例

本文整理汇总了PHP中CIMNotify::DeleteByTag方法的典型用法代码示例。如果您正苦于以下问题:PHP CIMNotify::DeleteByTag方法的具体用法?PHP CIMNotify::DeleteByTag怎么用?PHP CIMNotify::DeleteByTag使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CIMNotify的用法示例。


在下文中一共展示了CIMNotify::DeleteByTag方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: OnUserInitialize

 function OnUserInitialize($user_id, $arFields = array())
 {
     if (intval($user_id) <= 0) {
         return false;
     }
     if (CModule::IncludeModule("im")) {
         $bIM = true;
     }
     $dbRelation = CSocNetUserToGroup::GetList(array(), array("USER_ID" => $user_id, "ROLE" => SONET_ROLES_REQUEST, "INITIATED_BY_TYPE" => SONET_INITIATED_BY_GROUP), false, false, array("ID", "GROUP_ID"));
     while ($arRelation = $dbRelation->Fetch()) {
         if (CSocNetUserToGroup::UserConfirmRequestToBeMember($user_id, $arRelation["ID"], false) && defined("BX_COMP_MANAGED_CACHE")) {
             $GLOBALS["CACHE_MANAGER"]->ClearByTag("sonet_user2group_G" . $arRelation["GROUP_ID"]);
             $GLOBALS["CACHE_MANAGER"]->ClearByTag("sonet_user2group_U" . $user_id);
             if ($bIM) {
                 CIMNotify::DeleteByTag("SOCNET|INVITE_GROUP|" . $user_id . "|" . intval($arRelation["ID"]));
             }
         }
     }
 }
开发者ID:k-kalashnikov,项目名称:geekcon_new,代码行数:19,代码来源:user.php

示例2: SetMeetingStatus

 public static function SetMeetingStatus($userId, $eventId, $status = 'Q', $comment = '')
 {
     global $DB;
     $eventId = intVal($eventId);
     $userId = intVal($userId);
     if (!in_array($status, array("Q", "Y", "N"))) {
         $status = "Q";
     }
     // Select meeting info about event
     CTimeZone::Disable();
     $res = CCalendarEvent::GetList(array('arFilter' => array("ID" => $eventId, "DELETED" => "N"), 'fetchMeetings' => true, 'parseRecursion' => false, 'setDefaultLimit' => false));
     $Event = $res[0];
     if ($Event && $Event['IS_MEETING']) {
         if ($Event['IS_MEETING']) {
             $arAffectedSections = array($Event['SECT_ID']);
             // Try to find this user into attendees for this event
             $strSql = "SELECT * FROM b_calendar_attendees WHERE USER_KEY={$userId} AND EVENT_ID={$eventId}";
             $dbAtt = $DB->Query($strSql, false, "File: " . __FILE__ . "<br>Line: " . __LINE__);
             $curStatus = "Q";
             if ($att = $dbAtt->Fetch()) {
                 $curStatus = $att["STATUS"];
                 //Set status
                 if ($att["STATUS"] != $status) {
                     $strSql = "UPDATE b_calendar_attendees SET " . $DB->PrepareUpdate("b_calendar_attendees", array("STATUS" => $status, "DESCRIPTION" => $comment)) . " WHERE EVENT_ID=" . $eventId . " AND USER_KEY=" . $userId;
                     $DB->Query($strSql, false, "File: " . __FILE__ . "<br>Line: " . __LINE__);
                 }
             } else {
                 if ($Event['MEETING'] && $Event['MEETING']['OPEN'] && $status == "Y") {
                     //Set status
                     $strSql = "INSERT INTO b_calendar_attendees(EVENT_ID, USER_KEY, USER_ID, STATUS, DESCRIPTION, ACCESSIBILITY) " . "VALUES (" . $eventId . ", '" . $userId . "', " . $userId . ", '" . $status . "', '" . $DB->ForSql($comment) . "','')";
                     $res = $DB->Query($strSql, false, "FILE: " . __FILE__ . "<br> LINE: " . __LINE__);
                 }
             }
             if (($status == 'Y' || ($status = 'N')) && CModule::IncludeModule("im")) {
                 CIMNotify::DeleteByTag("CALENDAR|INVITE|" . $eventId . "|" . $userId);
             }
             if ($Event['MEETING']['NOTIFY'] && $status != 'Q' && $userId != $Event['CREATED_BY'] && $curStatus != $status) {
                 // Send message to the author
                 CCalendar::SendMessage(array('mode' => $status == "Y" ? 'accept' : 'decline', 'name' => $Event['NAME'], "from" => $Event["DT_FROM"], "to" => $Event["DT_TO"], "location" => CCalendar::GetTextLocation($Event["LOCATION"]), "comment" => $comment, "guestId" => $userId, "eventId" => $eventId, "userId" => $Event['CREATED_BY']));
             }
             $arAffectedSections[] = CCalendar::GetMeetingSection($userId);
             if (count($arAffectedSections) > 0) {
                 CCalendarSect::UpdateModificationLabel($arAffectedSections);
             }
         }
     }
     CTimeZone::Enable();
     CCalendar::ClearCache(array('attendees_list', 'event_list'));
 }
开发者ID:mrdeadmouse,项目名称:u136006,代码行数:49,代码来源:calendar_event.php

示例3: UserConfirmRequestToBeMember

 function UserConfirmRequestToBeMember($targetUserID, $relationID, $bAutoSubscribe = true)
 {
     global $APPLICATION;
     $targetUserID = IntVal($targetUserID);
     if ($targetUserID <= 0) {
         $GLOBALS["APPLICATION"]->ThrowException(GetMessage("SONET_UR_EMPTY_USERID"), "ERROR_SENDER_USER_ID");
         return false;
     }
     $relationID = IntVal($relationID);
     if ($relationID <= 0) {
         $GLOBALS["APPLICATION"]->ThrowException(GetMessage("SONET_UR_EMPTY_RELATIONID"), "ERROR_RELATION_ID");
         return false;
     }
     $dbResult = CSocNetUserToGroup::GetList(array(), array("ID" => $relationID, "USER_ID" => $targetUserID, "ROLE" => SONET_ROLES_REQUEST, "INITIATED_BY_TYPE" => SONET_INITIATED_BY_GROUP), false, false, array("ID", "USER_ID", "INITIATED_BY_USER_ID", "GROUP_ID", "GROUP_VISIBLE", "GROUP_SITE_ID", "GROUP_NAME"));
     if ($arResult = $dbResult->Fetch()) {
         $arFields = array("ROLE" => SONET_ROLES_USER, "=DATE_UPDATE" => $GLOBALS["DB"]->CurrentTimeFunction());
         if (CSocNetUserToGroup::Update($arResult["ID"], $arFields)) {
             $events = GetModuleEvents("socialnetwork", "OnSocNetUserConfirmRequestToBeMember");
             while ($arEvent = $events->Fetch()) {
                 ExecuteModuleEventEx($arEvent, array($arResult["ID"], $arResult));
             }
             if ($bAutoSubscribe) {
                 CSocNetLogEvents::AutoSubscribe($targetUserID, SONET_ENTITY_GROUP, $arResult["GROUP_ID"]);
             }
             if (CModule::IncludeModule("im")) {
                 $groupSiteId = CSocNetGroup::GetDefaultSiteId($arResult["GROUP_ID"], $arResult["GROUP_SITE_ID"]);
                 CIMNotify::DeleteByTag("SOCNET|INVITE_GROUP|" . intval($targetUserID) . "|" . intval($relationID));
                 $workgroupsPage = COption::GetOptionString("socialnetwork", "workgroups_page", "/workgroups/", $groupSiteId);
                 $groupUrlTemplate = COption::GetOptionString("socialnetwork", "group_path_template", "/workgroups/group/#group_id#/", $groupSiteId);
                 $groupUrlTemplate = "#GROUPS_PATH#" . substr($groupUrlTemplate, strlen($workgroupsPage), strlen($groupUrlTemplate) - strlen($workgroupsPage));
                 $groupUrl = str_replace(array("#group_id#", "#GROUP_ID#"), $arResult["GROUP_ID"], $groupUrlTemplate);
                 $arTmp = CSocNetLogTools::ProcessPath(array("GROUP_URL" => $groupUrl), $arResult["INITIATED_BY_USER_ID"], $groupSiteId);
                 $url = $arTmp["URLS"]["GROUP_URL"];
                 $serverName = strpos($url, "http://") === 0 || strpos($url, "https://") === 0 ? "" : $arTmp["SERVER_NAME"];
                 $domainName = strpos($url, "http://") === 0 || strpos($url, "https://") === 0 ? "" : (isset($arTmp["DOMAIN"]) && !empty($arTmp["DOMAIN"]) ? "//" . $arTmp["DOMAIN"] : "");
                 $arMessageFields = array("MESSAGE_TYPE" => IM_MESSAGE_SYSTEM, "TO_USER_ID" => $arResult["INITIATED_BY_USER_ID"], "FROM_USER_ID" => $arResult['USER_ID'], "NOTIFY_TYPE" => IM_NOTIFY_FROM, "NOTIFY_MODULE" => "socialnetwork", "NOTIFY_EVENT" => "invite_group", "NOTIFY_TAG" => "SOCNET|INVITE_GROUP_SUCCESS|" . intval($arResult["GROUP_ID"]), "NOTIFY_MESSAGE" => str_replace("#NAME#", "<a href=\"" . $domainName . $url . "\" class=\"bx-notifier-item-action\">" . $arResult["GROUP_NAME"] . "</a>", GetMessage("SONET_UG_CONFIRM_MEMBER_MESSAGE")), "NOTIFY_MESSAGE_OUT" => str_replace("#NAME#", $arResult["GROUP_NAME"], GetMessage("SONET_UG_CONFIRM_MEMBER_MESSAGE") . " (" . $serverName . $url . ")"));
                 CIMNotify::Add($arMessageFields);
                 $arMessageFields = array("MESSAGE_TYPE" => IM_MESSAGE_SYSTEM, "TO_USER_ID" => $arResult['USER_ID'], "NOTIFY_TYPE" => IM_NOTIFY_SYSTEM, "NOTIFY_MODULE" => "socialnetwork", "NOTIFY_EVENT" => "invite_group", "NOTIFY_TAG" => "SOCNET|INVITE_GROUP|" . intval($arResult['USER_ID']) . "|" . $relationID, "NOTIFY_MESSAGE" => str_replace("#NAME#", "<a href=\"" . $domainName . $url . "\" class=\"bx-notifier-item-action\">" . $arResult["GROUP_NAME"] . "</a>", GetMessage("SONET_UG_CONFIRM_MEMBER_MESSAGE_G")), "NOTIFY_MESSAGE_OUT" => str_replace("#NAME#", $arResult["GROUP_NAME"], GetMessage("SONET_UG_CONFIRM_MEMBER_MESSAGE_G") . " (" . $serverName . $url . ")"));
                 CIMNotify::Add($arMessageFields);
                 $arNotifyParams = array("TYPE" => "join", "RELATION_ID" => $arResult["ID"], "USER_ID" => $arResult["USER_ID"], "GROUP_ID" => $arResult["GROUP_ID"], "GROUP_NAME" => htmlspecialcharsbx($arResult["GROUP_NAME"]), "EXCLUDE_USERS" => array($arResult["INITIATED_BY_USER_ID"]));
                 CSocNetUserToGroup::NotifyImToModerators($arNotifyParams);
             }
         } else {
             $errorMessage = "";
             if ($e = $APPLICATION->GetException()) {
                 $errorMessage = $e->GetString();
             }
             if (StrLen($errorMessage) <= 0) {
                 $errorMessage = GetMessage("SONET_UR_ERROR_CREATE_USER2GROUP");
             }
             $GLOBALS["APPLICATION"]->ThrowException($errorMessage, "ERROR_CREATE_RELATION");
             return false;
         }
     } else {
         $GLOBALS["APPLICATION"]->ThrowException(GetMessage("SONET_NO_USER2GROUP"), "ERROR_NO_GROUP_REQUEST");
         return false;
     }
     CSocNetUserToGroup::__SpeedFileCheckMessages($targetUserID);
     return true;
 }
开发者ID:DarneoStudio,项目名称:bitrix,代码行数:60,代码来源:user_group.php

示例4: KeepVoting


//.........这里部分代码省略.........
                             $MESSAGE = trim($GLOBALS[$fieldName]);
                             if ($MESSAGE != "") {
                                 $arSqlAnswers[$qID][$aID] = array("ANSWER_ID" => $aID, "MESSAGE" => "'" . $DB->ForSql(trim($MESSAGE), 2000) . "'");
                             }
                             break;
                     }
                 }
                 if (empty($arSqlAnswers[$qID])) {
                     unset($arSqlAnswers[$qID]);
                     if ($arQuestion['REQUIRED'] == 'Y') {
                         $aMsg[] = array("id" => "QUESTION_" . $qID, "text" => GetMessage("VOTE_REQUIRED_MISSING"));
                         $GLOBALS["VOTE_REQUIRED_MISSING"] = "Y";
                         break;
                     }
                 }
             }
             if (!empty($aMsg)) {
                 /* do nothing; */
             } elseif (!empty($arSqlAnswers)) {
                 // vote event
                 $arFields = array("VOTE_ID" => $VOTE_ID, "VOTE_USER_ID" => intval($_SESSION["VOTE_USER_ID"]), "DATE_VOTE" => $DB->GetNowFunction(), "STAT_SESSION_ID" => intval($_SESSION["SESS_SESSION_ID"]), "IP" => "'" . $DB->ForSql($_SERVER["REMOTE_ADDR"], 15) . "'", "VALID" => "'Y'");
                 /***************** Event onBeforeVoting ****************************/
                 foreach (GetModuleEvents("vote", "onBeforeVoting", true) as $arEvent) {
                     if (ExecuteModuleEventEx($arEvent, array(&$arFields, &$arSqlAnswers)) === false) {
                         return false;
                     }
                 }
                 /***************** /Event ******************************************/
                 if ($StatusVote == 8 && $_REQUEST["REVOTE_ID"] == $VOTE_ID) {
                     $strSql = "SELECT VE.ID, VEQ.QUESTION_ID, VEA.ANSWER_ID" . " FROM b_vote_event VE " . "\tLEFT JOIN b_vote_event_question VEQ ON (VEQ.EVENT_ID=VE.ID)" . "\tLEFT JOIN b_vote_event_answer VEA ON (VEA.EVENT_QUESTION_ID=VEQ.ID)" . "\tLEFT JOIN b_vote_user VU ON (VE.VOTE_USER_ID = VU.ID)" . " WHERE VE.VOTE_ID=" . $VOTE_ID . " AND VU.AUTH_USER_ID=" . intval($USER->GetID()) . " ORDER BY VE.ID ASC, VEQ.QUESTION_ID ASC";
                     $db_res = $DB->Query($strSql, false, $err_mess . __LINE__);
                     if ($db_res && ($res = $db_res->Fetch())) {
                         if ($USER->GetID() > 0 && CModule::IncludeModule("im")) {
                             CIMNotify::DeleteByTag("VOTING|" . $VOTE_ID, $USER->GetID());
                         }
                         $del = false;
                         $delQ = false;
                         do {
                             if ($delQ !== $res["QUESTION_ID"]) {
                                 if ($del !== $res["ID"]) {
                                     CVoteEvent::Delete($res["ID"]);
                                     $del = $res["ID"];
                                     $arVote["COUNTER"] = intval($arVote["COUNTER"]) - 1;
                                 }
                                 $delQ = $res["QUESTION_ID"];
                                 $arQuestions[$res["QUESTION_ID"]]["COUNTER"] = intval($arQuestions[$res["QUESTION_ID"]]["COUNTER"]) - 1;
                             }
                             $arQuestions[$res["QUESTION_ID"]]["ANSWERS"][$res["ANSWER_ID"]]["COUNTER"] = intval($arQuestions[$res["QUESTION_ID"]]["ANSWERS"][$res["ANSWER_ID"]]["COUNTER"]) - 1;
                         } while ($res = $db_res->Fetch());
                     }
                     $USER_ALREADY_VOTE = "N";
                 }
                 unset($GLOBALS["VOTE_CACHE_VOTING"][$VOTE_ID]);
                 unset($GLOBALS["VOTE_CACHE"]["VOTE"][$VOTE_ID]);
                 $EVENT_ID = intval($DB->Insert("b_vote_event", $arFields, $err_mess . __LINE__));
                 if ($EVENT_ID > 0) {
                     $arSqlQuestionsID = array();
                     $arSqlAnswersID = array();
                     foreach ($arSqlAnswers as $qID => $arSqlAnswer) {
                         $arFields = array("EVENT_ID" => $EVENT_ID, "QUESTION_ID" => $qID);
                         $EVENT_QUESTION_ID = intval($DB->Insert("b_vote_event_question", $arFields, $err_mess . __LINE__));
                         if ($EVENT_QUESTION_ID > 0) {
                             $arSqlQuestionsID[] = $qID;
                             $arQuestions[$qID]["COUNTER"] = intval($arQuestions[$qID]["COUNTER"]) + 1;
                             foreach ($arSqlAnswer as $aID => $res) {
                                 $res["EVENT_QUESTION_ID"] = $EVENT_QUESTION_ID;
开发者ID:andy-profi,项目名称:bxApiDocs,代码行数:67,代码来源:vote.php

示例5: Add


//.........这里部分代码省略.........
				if (isset($arFields['NOTIFY_TAG']))
					$arParams['NOTIFY_TAG'] = $arFields['NOTIFY_TAG'];

				if (isset($arFields['NOTIFY_SUB_TAG']))
					$arParams['NOTIFY_SUB_TAG'] = $arFields['NOTIFY_SUB_TAG'];

				if (isset($arFields['NOTIFY_TITLE']) && strlen(trim($arFields['NOTIFY_TITLE']))>0)
					$arParams['NOTIFY_TITLE'] = trim($arFields['NOTIFY_TITLE']);

				if ($arParams['NOTIFY_TYPE'] == IM_NOTIFY_CONFIRM)
				{
					if (isset($arFields['NOTIFY_BUTTONS']))
					{
						foreach ($arFields['NOTIFY_BUTTONS'] as $key => $arButtons)
						{
							if (is_array($arButtons))
							{
								if (isset($arButtons['TITLE']) && strlen($arButtons['TITLE']) > 0
								&& isset($arButtons['VALUE']) && strlen($arButtons['VALUE']) > 0
								&& isset($arButtons['TYPE']) && strlen($arButtons['TYPE']) > 0)
								{
									$arButtons['TITLE'] = htmlspecialcharsbx($arButtons['TITLE']);
									$arButtons['VALUE'] = htmlspecialcharsbx($arButtons['VALUE']);
									$arButtons['TYPE'] = htmlspecialcharsbx($arButtons['TYPE']);
									$arFields['NOTIFY_BUTTONS'][$key] = $arButtons;
								}
								else
									unset($arFields['NOTIFY_BUTTONS'][$key]);
							}
							else
								unset($arFields['NOTIFY_BUTTONS'][$key]);
						}
					}
					else
					{
						$arFields['NOTIFY_BUTTONS'] = Array(
							Array('TITLE' => GetMessage('IM_ERROR_BUTTON_ACCEPT'), 'VALUE' => 'Y', 'TYPE' => 'accept'),
							Array('TITLE' => GetMessage('IM_ERROR_BUTTON_CANCEL'), 'VALUE' => 'N', 'TYPE' => 'cancel'),
						);
					}
					$arParams['NOTIFY_BUTTONS'] = serialize($arFields["NOTIFY_BUTTONS"]);

					if (isset($arParams['NOTIFY_TAG']) && strlen($arParams['NOTIFY_TAG'])>0)
						CIMNotify::DeleteByTag($arParams['NOTIFY_TAG']);
				}

				$messageID = IntVal($DB->Add("b_im_message", $arParams, Array('MESSAGE', 'MESSAGE_OUT', 'NOTIFY_BUTTONS')));
				if ($messageID <= 0)
					return false;

				if ($sendToSite)
					CIMMessenger::SpeedFileDelete($arFields['TO_USER_ID'], IM_SPEED_NOTIFY);

				if (!$bConvert)
				{
					//CUserCounter::Increment($arFields['TO_USER_ID'], 'im_notify_v2', '**', false);
					$strSql = "UPDATE b_im_relation SET STATUS = '".IM_STATUS_UNREAD."' WHERE USER_ID = ".intval($arFields['TO_USER_ID'])." AND MESSAGE_TYPE = '".IM_MESSAGE_SYSTEM."' AND CHAT_ID = ".$chatId;
					$DB->Query($strSql, false, "File: ".__FILE__."<br>Line: ".__LINE__);

					if (CModule::IncludeModule("pull"))
					{
						CPullStack::AddByUser(intval($arFields['TO_USER_ID']), Array(
							'module_id' => 'im',
							'command' => 'notify',
							'params' => CIMNotify::GetFormatNotify(Array(
								'ID' => $messageID,
								'DATE_CREATE' => time(),
								'FROM_USER_ID' => intval($arFields['FROM_USER_ID']),
								'MESSAGE' => $arParams['MESSAGE'],
								'NOTIFY_MODULE' => $arParams['NOTIFY_MODULE'],
								'NOTIFY_EVENT' => $arParams['NOTIFY_EVENT'],
								'NOTIFY_TAG' => $arParams['NOTIFY_TAG'],
								'NOTIFY_TYPE' => $arParams['NOTIFY_TYPE'],
								'NOTIFY_BUTTONS' => isset($arParams['NOTIFY_BUTTONS'])? $arParams['NOTIFY_BUTTONS']: serialize(Array()),
								'NOTIFY_TITLE' => isset($arParams['NOTIFY_TITLE'])? $arParams['NOTIFY_TITLE']: '',
								'NOTIFY_SILENT' => $sendToSite? false: true,
							)),
						));
						self::SendBadges($arFields['TO_USER_ID']);
					}
					foreach(GetModuleEvents("im", "OnAfterNotifyAdd", true) as $arEvent)
						ExecuteModuleEventEx($arEvent, array(intval($messageID), $arFields));
				}

				return $messageID;
			}
			else
			{
				$GLOBALS["APPLICATION"]->ThrowException(GetMessage("IM_ERROR_MESSAGE_CREATE"), "CHAT_ID");
				return false;
			}
		}
		else
		{
			$GLOBALS["APPLICATION"]->ThrowException(GetMessage("IM_ERROR_MESSAGE_TYPE"), "MESSAGE_TYPE");
			return false;
		}

		return false;
	}
开发者ID:ASDAFF,项目名称:1C_Bitrix_info_site,代码行数:101,代码来源:im_messenger.php

示例6: CIMNotify

     $errorMessage = "";
     $CIMNotify = new CIMNotify();
     $CIMNotify->Confirm($_POST['NOTIFY_ID'], $_POST['NOTIFY_VALUE']);
     echo CUtil::PhpToJsObject(array('NOTIFY_ID' => intval($_POST['NOTIFY_ID']), 'NOTIFY_VALUE' => $_POST['NOTIFY_VALUE'], 'ERROR' => $errorMessage));
 } else {
     if ($_POST['IM_NOTIFY_REMOVE'] == 'Y') {
         $errorMessage = "";
         $CIMNotify = new CIMNotify();
         $CIMNotify->DeleteWithCheck($_POST['NOTIFY_ID']);
         echo CUtil::PhpToJsObject(array('NOTIFY_ID' => intval($_POST['NOTIFY_ID']), 'ERROR' => $errorMessage));
     } else {
         if ($_POST['IM_NOTIFY_GROUP_REMOVE'] == 'Y') {
             $errorMessage = "";
             $CIMNotify = new CIMNotify();
             if ($arNotify = $CIMNotify->GetNotify($_POST['NOTIFY_ID'])) {
                 CIMNotify::DeleteByTag($arNotify['NOTIFY_TAG']);
             }
             echo CUtil::PhpToJsObject(array('NOTIFY_ID' => intval($_POST['NOTIFY_ID']), 'ERROR' => $errorMessage));
         } else {
             if ($_POST['IM_RECENT_HIDE'] == 'Y') {
                 if (substr($_POST['USER_ID'], 0, 4) == 'chat') {
                     CIMContactList::DeleteRecent(substr($_POST['USER_ID'], 4), true);
                 } else {
                     CIMContactList::DeleteRecent($_POST['USER_ID']);
                 }
                 echo CUtil::PhpToJsObject(array('USER_ID' => htmlspecialcharsbx($_POST['USER_ID']), 'ERROR' => ''));
             } else {
                 if ($_POST['IM_CHAT_ADD'] == 'Y') {
                     $_POST['USERS'] = CUtil::JsObjectToPhp($_POST['USERS']);
                     $errorMessage = "";
                     $CIMChat = new CIMChat();
开发者ID:k-kalashnikov,项目名称:geekcon_new,代码行数:31,代码来源:im.ajax.php

示例7: RejectRequestToBeFriend

	function RejectRequestToBeFriend($senderUserID, $relationID)
	{
		global $APPLICATION;

		$senderUserID = IntVal($senderUserID);
		if ($senderUserID <= 0)
		{
			$GLOBALS["APPLICATION"]->ThrowException(GetMessage("SONET_UR_EMPTY_SENDER_USER_ID"), "ERROR_SENDER_USER_ID");
			return false;
		}

		$relationID = IntVal($relationID);
		if ($relationID <= 0)
		{
			$GLOBALS["APPLICATION"]->ThrowException(GetMessage("SONET_UR_EMPTY_TARGET_USER_ID"), "ERROR_RELATION_ID");
			return false;
		}

		$dbResult = CSocNetUserRelations::GetList(
			array(),
			array(
				"ID" => $relationID,
				"SECOND_USER_ID" => $senderUserID,
				"RELATION" => SONET_RELATIONS_REQUEST
			),
			false,
			false,
			array("ID", "FIRST_USER_ID")
		);

		if ($arResult = $dbResult->Fetch())
		{
			if (CSocNetUserRelations::Delete($arResult["ID"]))
			{
				if (CModule::IncludeModule("im"))
				{
					CIMNotify::DeleteByTag("SOCNET|INVITE_USER|".intval($senderUserID)."|".intval($arResult["ID"]));
					$arMessageFields = array(
						"MESSAGE_TYPE" => IM_MESSAGE_SYSTEM,
						"TO_USER_ID" => $arResult["FIRST_USER_ID"],
						"FROM_USER_ID" => $senderUserID,
						"NOTIFY_TYPE" => IM_NOTIFY_FROM,
						"NOTIFY_MODULE" => "socialnetwork",
						"NOTIFY_EVENT" => "invite_user",
						"NOTIFY_TAG" => "SOCNET|INVITE_USER_REJECT",
						"NOTIFY_MESSAGE" => GetMessage("SONET_UR_REJECT_FRIEND_MESSAGE"),
					);
					CIMNotify::Add($arMessageFields);
				}
				else
				{
					$arMessageFields = array(
						"FROM_USER_ID" => $senderUserID,
						"TO_USER_ID" => $arResult["FIRST_USER_ID"],
						"MESSAGE" => GetMessage("SONET_UR_REJECT_FRIEND_MESSAGE"),
						"=DATE_CREATE" => $GLOBALS["DB"]->CurrentTimeFunction(),
						"MESSAGE_TYPE" => SONET_MESSAGE_SYSTEM
					);
					CSocNetMessages::Add($arMessageFields);
				}
			}
			else
			{
				$errorMessage = "";
				if ($e = $APPLICATION->GetException())
					$errorMessage = $e->GetString();
				if (StrLen($errorMessage) <= 0)
					$errorMessage = GetMessage("SONET_UR_RELATION_DELETE_ERROR");

				$GLOBALS["APPLICATION"]->ThrowException($errorMessage, "ERROR_DELETE_RELATION");
				return false;
			}
		}
		else
		{
			$GLOBALS["APPLICATION"]->ThrowException(GetMessage("SONET_UR_NO_FRIEND_REQUEST"), "ERROR_NO_FRIEND_REQUEST");
			return false;
		}

		CSocNetUserRelations::__SpeedFileCheckMessages($senderUserID);

		return true;
	}
开发者ID:ASDAFF,项目名称:bitrix-5,代码行数:83,代码来源:user_relations.php

示例8: OnCancelRatingVote

 public static function OnCancelRatingVote($id, $arParams)
 {
     CIMNotify::DeleteByTag("RATING|" . $arParams['ENTITY_TYPE_ID'] . "|" . $arParams['ENTITY_ID'], $arParams['USER_ID']);
 }
开发者ID:DarneoStudio,项目名称:bitrix,代码行数:4,代码来源:im_event.php

示例9: OnAfterUserAuthorize

 public static function OnAfterUserAuthorize($arParams)
 {
     if (isset($arParams['update']) && $arParams['update'] === false) {
         return false;
     }
     if ($arParams['user_fields']['ID'] <= 0) {
         return false;
     }
     if (array_key_exists('CONFIRM_CODE', $arParams['user_fields']) && strlen(trim($arParams['user_fields']['CONFIRM_CODE'])) >= 0 && CModule::IncludeModule("socialnetwork")) {
         $dbRelation = CSocNetUserToGroup::GetList(array(), array("USER_ID" => $arParams['user_fields']['ID'], "ROLE" => SONET_ROLES_REQUEST, "INITIATED_BY_TYPE" => SONET_INITIATED_BY_GROUP), false, false, array("ID", "GROUP_ID"));
         while ($arRelation = $dbRelation->Fetch()) {
             if (CSocNetUserToGroup::UserConfirmRequestToBeMember($arParams['user_fields']['ID'], $arRelation["ID"], false)) {
                 if (defined("BX_COMP_MANAGED_CACHE")) {
                     $GLOBALS["CACHE_MANAGER"]->ClearByTag("sonet_user2group_G" . $arRelation["GROUP_ID"]);
                     $GLOBALS["CACHE_MANAGER"]->ClearByTag("sonet_user2group_U" . $arParams['user_fields']['ID']);
                 }
                 if (CModule::IncludeModule("im")) {
                     CIMNotify::DeleteByTag("SOCNET|INVITE_GROUP|" . $arParams['user_fields']['ID'] . "|" . intval($arRelation["ID"]));
                 }
             }
         }
     }
 }
开发者ID:mrdeadmouse,项目名称:u136006,代码行数:23,代码来源:invite_dialog.php

示例10: Add


//.........这里部分代码省略.........
                 }
                 return $messageID;
             } else {
                 $GLOBALS["APPLICATION"]->ThrowException(GetMessage("IM_ERROR_MESSAGE_CREATE"), "CHAT_ID");
                 return false;
             }
         } else {
             if ($arFields['MESSAGE_TYPE'] == IM_MESSAGE_SYSTEM) {
                 $chatId = 0;
                 $strSql = "\n\t\t\t\tSELECT CHAT_ID\n\t\t\t\tFROM b_im_relation\n\t\t\t\tWHERE USER_ID = " . intval($arFields['TO_USER_ID']) . " AND MESSAGE_TYPE = '" . IM_MESSAGE_SYSTEM . "'";
                 $dbRes = $DB->Query($strSql, false, "File: " . __FILE__ . "<br>Line: " . __LINE__);
                 if ($arRes = $dbRes->Fetch()) {
                     $chatId = intval($arRes['CHAT_ID']);
                 } else {
                     $chatId = IntVal($DB->Add("b_im_chat", array('AUTHOR_ID' => intval($arFields['TO_USER_ID'])), array()));
                     if ($chatId <= 0) {
                         $GLOBALS["APPLICATION"]->ThrowException(GetMessage("IM_ERROR_MESSAGE_CREATE"), "CHAT_ID");
                         return false;
                     }
                     $strSql = "INSERT INTO b_im_relation (CHAT_ID, MESSAGE_TYPE, USER_ID, STATUS) VALUES (" . $chatId . ",'" . IM_MESSAGE_SYSTEM . "'," . intval($arFields['TO_USER_ID']) . ", " . ($bConvert ? 2 : 0) . ")";
                     $DB->Query($strSql, false, "File: " . __FILE__ . "<br>Line: " . __LINE__);
                 }
                 if ($chatId > 0) {
                     $arParams = array();
                     $arParams['CHAT_ID'] = $chatId;
                     $arParams['AUTHOR_ID'] = intval($arFields['AUTHOR_ID']);
                     $arParams['MESSAGE'] = trim($arFields['MESSAGE']);
                     $arParams['MESSAGE_OUT'] = trim($arFields['MESSAGE_OUT']);
                     $arParams['NOTIFY_TYPE'] = intval($arFields['NOTIFY_TYPE']);
                     $arParams['NOTIFY_MODULE'] = $arFields['NOTIFY_MODULE'];
                     $arParams['NOTIFY_EVENT'] = $arFields['NOTIFY_EVENT'];
                     if (isset($arFields['IMPORT_ID'])) {
                         $arParams['IMPORT_ID'] = intval($arFields['IMPORT_ID']);
                     }
                     if (isset($arFields['MESSAGE_DATE'])) {
                         $arParams['DATE_CREATE'] = $arFields['MESSAGE_DATE'];
                     } else {
                         $arParams['~DATE_CREATE'] = $DB->CurrentTimeFunction();
                     }
                     if (isset($arFields['EMAIL_TEMPLATE']) && strlen(trim($arFields['EMAIL_TEMPLATE'])) > 0) {
                         $arParams['EMAIL_TEMPLATE'] = trim($arFields['EMAIL_TEMPLATE']);
                     }
                     if (isset($arFields['NOTIFY_TAG'])) {
                         $arParams['NOTIFY_TAG'] = $arFields['NOTIFY_TAG'];
                     }
                     if (isset($arFields['NOTIFY_SUB_TAG'])) {
                         $arParams['NOTIFY_SUB_TAG'] = $arFields['NOTIFY_SUB_TAG'];
                     }
                     if (isset($arFields['NOTIFY_TITLE']) && strlen(trim($arFields['NOTIFY_TITLE'])) > 0) {
                         $arParams['NOTIFY_TITLE'] = trim($arFields['NOTIFY_TITLE']);
                     }
                     if ($arParams['NOTIFY_TYPE'] == IM_NOTIFY_CONFIRM) {
                         if (isset($arFields['NOTIFY_BUTTONS'])) {
                             foreach ($arFields['NOTIFY_BUTTONS'] as $key => $arButtons) {
                                 if (is_array($arButtons)) {
                                     if (isset($arButtons['TITLE']) && strlen($arButtons['TITLE']) > 0 && isset($arButtons['VALUE']) && strlen($arButtons['VALUE']) > 0 && isset($arButtons['TYPE']) && strlen($arButtons['TYPE']) > 0) {
                                         $arButtons['TITLE'] = htmlspecialcharsbx($arButtons['TITLE']);
                                         $arButtons['VALUE'] = htmlspecialcharsbx($arButtons['VALUE']);
                                         $arButtons['TYPE'] = htmlspecialcharsbx($arButtons['TYPE']);
                                         $arFields['NOTIFY_BUTTONS'][$key] = $arButtons;
                                     } else {
                                         unset($arFields['NOTIFY_BUTTONS'][$key]);
                                     }
                                 } else {
                                     unset($arFields['NOTIFY_BUTTONS'][$key]);
                                 }
                             }
                         } else {
                             $arFields['NOTIFY_BUTTONS'] = array(array('TITLE' => GetMessage('IM_ERROR_BUTTON_ACCEPT'), 'VALUE' => 'Y', 'TYPE' => 'accept'), array('TITLE' => GetMessage('IM_ERROR_BUTTON_CANCEL'), 'VALUE' => 'N', 'TYPE' => 'cancel'));
                         }
                         $arParams['NOTIFY_BUTTONS'] = serialize($arFields["NOTIFY_BUTTONS"]);
                         if (isset($arParams['NOTIFY_TAG']) && strlen($arParams['NOTIFY_TAG']) > 0) {
                             CIMNotify::DeleteByTag($arParams['NOTIFY_TAG']);
                         }
                     }
                     $messageID = IntVal($DB->Add("b_im_message", $arParams, array('MESSAGE', 'MESSAGE_OUT', 'NOTIFY_BUTTONS')));
                     CIMMessenger::SpeedFileDelete(intval($arFields['TO_USER_ID']), IM_SPEED_NOTIFY);
                     if (!$bConvert) {
                         if (CModule::IncludeModule("pull")) {
                             CPullStack::AddByUser(intval($arFields['TO_USER_ID']), array('module_id' => 'im', 'command' => 'notify', 'params' => CIMNotify::GetFormatNotify(array('ID' => $messageID, 'TIMESTAMP' => time(), 'FROM_USER_ID' => intval($arFields['FROM_USER_ID']), 'MESSAGE' => $arParams['MESSAGE'], 'NOTIFY_TAG' => $arParams['NOTIFY_TAG'], 'NOTIFY_TYPE' => $arParams['NOTIFY_TYPE'], 'NOTIFY_BUTTONS' => isset($arParams['NOTIFY_BUTTONS']) ? $arParams['NOTIFY_BUTTONS'] : serialize(array()), 'NOTIFY_TITLE' => isset($arParams['NOTIFY_TITLE']) ? $arParams['NOTIFY_TITLE'] : ''))));
                         }
                         $strSql = "\n\t\t\t\t\t\tUPDATE b_im_relation SET STATUS = '" . IM_STATUS_UNREAD . "'\n\t\t\t\t\t\tWHERE USER_ID = " . intval($arFields['TO_USER_ID']) . " AND MESSAGE_TYPE = '" . IM_MESSAGE_SYSTEM . "' AND CHAT_ID = " . $chatId;
                         $dbRes = $DB->Query($strSql, false, "File: " . __FILE__ . "<br>Line: " . __LINE__);
                         foreach (GetModuleEvents("im", "OnAfterNotifyAdd", true) as $arEvent) {
                             ExecuteModuleEventEx($arEvent, array(intval($messageID), $arFields));
                         }
                     }
                     return $messageID;
                 } else {
                     $GLOBALS["APPLICATION"]->ThrowException(GetMessage("IM_ERROR_MESSAGE_CREATE"), "CHAT_ID");
                     return false;
                 }
             } else {
                 $GLOBALS["APPLICATION"]->ThrowException(GetMessage("IM_ERROR_MESSAGE_TYPE"), "MESSAGE_TYPE");
                 return false;
             }
         }
     }
     return false;
 }
开发者ID:k-kalashnikov,项目名称:geekcon_new,代码行数:101,代码来源:im_messenger.php

示例11: OnBeforeConfirmNotify

	function OnBeforeConfirmNotify($module, $tag, $value, $arParams)
	{
		if ($module == "socialnetwork")
		{
			$arTag = explode("|", $tag);
			if (count($arTag) == 4 && $arTag[1] == 'INVITE_GROUP')
			{
				if ($value == 'Y')
				{
					self::UserConfirmRequestToBeMember($arTag[2], $arTag[3]);
					return true;
				}
				else
				{
					self::UserRejectRequestToBeMember($arTag[2], $arTag[3]);
					return true;
				}
			}
			elseif (count($arTag) == 5 && $arTag[1] == "REQUEST_GROUP")
			{
				if ($value == "Y")
					self::ConfirmRequestToBeMember($arTag[2], $arTag[3], array($arTag[4]));
				else
					self::RejectRequestToBeMember($arTag[2], $arTag[3], array($arTag[4]));

				CIMNotify::DeleteByTag("SOCNET|REQUEST_GROUP|".$arTag[2]."|".$arTag[3]."|".$arTag[4]);
				return true;
			}			
		}
	}
开发者ID:ASDAFF,项目名称:bitrix-5,代码行数:30,代码来源:user_group.php

示例12: onBeforeConfirmNotify

 public static function onBeforeConfirmNotify($module, $tag, $value, $arNotify)
 {
     global $USER;
     $userId = $USER->getId();
     if ($module == 'webdav' && $userId) {
         $tagData = explode('|', $tag);
         $folderInviteId = intval($tagData[2]);
         if ($tagData[0] == "WEBDAV" && $tagData[1] == "INVITE" && $folderInviteId > 0 && $userId == $tagData[3]) {
             if (\Bitrix\Main\Loader::includeModule('im')) {
                 CIMNotify::DeleteByTag(\Bitrix\Webdav\FolderInviteTable::getNotifyTag(array('ID' => $folderInviteId, 'INVITE_USER_ID' => $userId)));
             }
             //decline
             if ($value === 'N') {
                 \Bitrix\Webdav\FolderInviteTable::delete($folderInviteId);
                 return false;
             }
             $targetSectionData = CWebDavIblock::getRootSectionDataForUser($userId);
             if (!$targetSectionData) {
                 return false;
             }
             $folderInviteData = \Bitrix\Webdav\FolderInviteTable::getRowById($folderInviteId);
             if (!$folderInviteData) {
                 return false;
             }
             $sectionToShare = CIBlockSection::getList(array(), array('ID' => $folderInviteData['SECTION_ID'], 'IBLOCK_ID' => $folderInviteData['IBLOCK_ID'], 'CHECK_PERMISSIONS' => 'N'), false, array('NAME', 'SOCNET_GROUP_ID'))->fetch();
             if (empty($sectionToShare['NAME']) || empty($sectionToShare['SOCNET_GROUP_ID'])) {
                 return false;
             }
             if (\Bitrix\Main\Loader::includeModule('socialnetwork')) {
                 $group = CSocNetGroup::GetList(array(), array('ID' => $sectionToShare['SOCNET_GROUP_ID']), false, false, array('NAME'))->fetch();
             }
             if (empty($group)) {
                 return false;
             }
             $groupId = $sectionToShare['SOCNET_GROUP_ID'];
             $dispatcher = new \Bitrix\Webdav\InviteDispatcher();
             $attachObjectType = CWebDavSymlinkHelper::ENTITY_TYPE_GROUP;
             $attachObjectId = (int) $groupId;
             $inviteComponentParams = array('attachObject' => array('id' => $attachObjectId, 'type' => $attachObjectType), 'attachToUserId' => $folderInviteData['INVITE_USER_ID'], 'inviteFromUserId' => $folderInviteData['USER_ID'], 'canEdit' => $folderInviteData['CAN_EDIT']);
             $response = $dispatcher->processActionConnect($inviteComponentParams);
             if ($response['status'] == $dispatcher::STATUS_SUCCESS) {
                 \Bitrix\Webdav\FolderInviteTable::update($folderInviteId, array('IS_APPROVED' => true, 'LINK_SECTION_ID' => $response['sectionId']));
             }
             return $response['status'] == $dispatcher::STATUS_SUCCESS;
         }
     }
 }
开发者ID:DarneoStudio,项目名称:bitrix,代码行数:47,代码来源:symlinkhelper.php

示例13: Add


//.........这里部分代码省略.........
                         return false;
                     }
                     IM\RelationTable::add(array("CHAT_ID" => $chatId, "MESSAGE_TYPE" => IM_MESSAGE_SYSTEM, "USER_ID" => intval($arFields['TO_USER_ID']), "STATUS" => $bConvert ? 2 : 0));
                 }
                 if ($chatId > 0) {
                     $arParams = array();
                     $arParams['CHAT_ID'] = $chatId;
                     $arParams['AUTHOR_ID'] = intval($arFields['AUTHOR_ID']);
                     $arParams['MESSAGE'] = trim($arFields['MESSAGE']);
                     $arParams['MESSAGE_OUT'] = trim($arFields['MESSAGE_OUT']);
                     $arParams['NOTIFY_TYPE'] = intval($arFields['NOTIFY_TYPE']);
                     $arParams['NOTIFY_MODULE'] = $arFields['NOTIFY_MODULE'];
                     $arParams['NOTIFY_EVENT'] = $arFields['NOTIFY_EVENT'];
                     //if (strlen($arParams['MESSAGE']) <= 0 && strlen($arParams['MESSAGE_OUT']) <= 0)
                     //	return false;
                     $sendToSite = true;
                     if ($arParams['NOTIFY_TYPE'] != IM_NOTIFY_CONFIRM) {
                         $sendToSite = CIMSettings::GetNotifyAccess($arFields["TO_USER_ID"], $arFields["NOTIFY_MODULE"], $arFields["NOTIFY_EVENT"], CIMSettings::CLIENT_SITE);
                     }
                     if (!$sendToSite) {
                         $arParams['NOTIFY_READ'] = 'Y';
                     }
                     if (isset($arFields['IMPORT_ID'])) {
                         $arParams['IMPORT_ID'] = intval($arFields['IMPORT_ID']);
                     }
                     if (isset($arFields['MESSAGE_DATE'])) {
                         $arParams['DATE_CREATE'] = $arFields['MESSAGE_DATE'];
                     }
                     if (isset($arFields['EMAIL_TEMPLATE']) && strlen(trim($arFields['EMAIL_TEMPLATE'])) > 0) {
                         $arParams['EMAIL_TEMPLATE'] = trim($arFields['EMAIL_TEMPLATE']);
                     }
                     $arParams['NOTIFY_TAG'] = isset($arFields['NOTIFY_TAG']) ? $arFields['NOTIFY_TAG'] : '';
                     $arParams['NOTIFY_SUB_TAG'] = isset($arFields['NOTIFY_SUB_TAG']) ? $arFields['NOTIFY_SUB_TAG'] : '';
                     if (isset($arFields['NOTIFY_TITLE']) && strlen(trim($arFields['NOTIFY_TITLE'])) > 0) {
                         $arParams['NOTIFY_TITLE'] = trim($arFields['NOTIFY_TITLE']);
                     }
                     if ($arParams['NOTIFY_TYPE'] == IM_NOTIFY_CONFIRM) {
                         if (isset($arFields['NOTIFY_BUTTONS'])) {
                             foreach ($arFields['NOTIFY_BUTTONS'] as $key => $arButtons) {
                                 if (is_array($arButtons)) {
                                     if (isset($arButtons['TITLE']) && strlen($arButtons['TITLE']) > 0 && isset($arButtons['VALUE']) && strlen($arButtons['VALUE']) > 0 && isset($arButtons['TYPE']) && strlen($arButtons['TYPE']) > 0) {
                                         $arButtons['TITLE'] = htmlspecialcharsbx($arButtons['TITLE']);
                                         $arButtons['VALUE'] = htmlspecialcharsbx($arButtons['VALUE']);
                                         $arButtons['TYPE'] = htmlspecialcharsbx($arButtons['TYPE']);
                                         $arFields['NOTIFY_BUTTONS'][$key] = $arButtons;
                                     } else {
                                         unset($arFields['NOTIFY_BUTTONS'][$key]);
                                     }
                                 } else {
                                     unset($arFields['NOTIFY_BUTTONS'][$key]);
                                 }
                             }
                         } else {
                             $arFields['NOTIFY_BUTTONS'] = array(array('TITLE' => GetMessage('IM_ERROR_BUTTON_ACCEPT'), 'VALUE' => 'Y', 'TYPE' => 'accept'), array('TITLE' => GetMessage('IM_ERROR_BUTTON_CANCEL'), 'VALUE' => 'N', 'TYPE' => 'cancel'));
                         }
                         $arParams['NOTIFY_BUTTONS'] = serialize($arFields["NOTIFY_BUTTONS"]);
                         if (isset($arParams['NOTIFY_TAG']) && strlen($arParams['NOTIFY_TAG']) > 0) {
                             CIMNotify::DeleteByTag($arParams['NOTIFY_TAG']);
                         }
                     }
                     if (!$bConvert) {
                         if (isset($arFields['PUSH_MESSAGE']) && CIMSettings::GetNotifyAccess($arFields["TO_USER_ID"], $arFields['NOTIFY_MODULE'], $arFields['NOTIFY_EVENT'], CIMSettings::CLIENT_PUSH) && CModule::IncludeModule('pull')) {
                             $CPushManager = new CPushManager();
                             $CPushManager->AddQueue(array('USER_ID' => $arFields['TO_USER_ID'], 'MESSAGE' => str_replace("\n", " ", trim($arFields['PUSH_MESSAGE'])), 'PARAMS' => isset($arFields['PUSH_PARAMS']) ? $arFields['PUSH_PARAMS'] : '', 'TAG' => $arParams['NOTIFY_TAG'], 'SUB_TAG' => $arParams['NOTIFY_SUB_TAG'], 'APP_ID' => isset($arParams['PUSH_APP_ID']) ? $arParams['PUSH_APP_ID'] : ''));
                         }
                         foreach (GetModuleEvents("im", "OnAfterNotifyAdd", true) as $arEvent) {
                             ExecuteModuleEventEx($arEvent, array(intval($messageID), $arFields));
                         }
                     }
                     if (!$sendToSite) {
                         return 0;
                     }
                     $result = IM\MessageTable::add($arParams);
                     $messageID = IntVal($result->getId());
                     if ($messageID <= 0) {
                         return false;
                     }
                     IM\ChatTable::update($chatId, array('LAST_MESSAGE_ID' => $messageID));
                     CIMMessenger::SpeedFileDelete($arFields['TO_USER_ID'], IM_SPEED_NOTIFY);
                     if (!$bConvert) {
                         //CUserCounter::Increment($arFields['TO_USER_ID'], 'im_notify_v2', '**', false);
                         $strSql = "UPDATE b_im_relation SET STATUS = '" . IM_STATUS_UNREAD . "' WHERE USER_ID = " . intval($arFields['TO_USER_ID']) . " AND MESSAGE_TYPE = '" . IM_MESSAGE_SYSTEM . "' AND CHAT_ID = " . $chatId;
                         $DB->Query($strSql, false, "File: " . __FILE__ . "<br>Line: " . __LINE__);
                         if (CModule::IncludeModule("pull")) {
                             CPullStack::AddByUser(intval($arFields['TO_USER_ID']), array('module_id' => 'im', 'command' => 'notify', 'params' => CIMNotify::GetFormatNotify(array('ID' => $messageID, 'DATE_CREATE' => time(), 'FROM_USER_ID' => intval($arFields['FROM_USER_ID']), 'MESSAGE' => $arParams['MESSAGE'], 'NOTIFY_MODULE' => $arParams['NOTIFY_MODULE'], 'NOTIFY_EVENT' => $arParams['NOTIFY_EVENT'], 'NOTIFY_TAG' => $arParams['NOTIFY_TAG'], 'NOTIFY_TYPE' => $arParams['NOTIFY_TYPE'], 'NOTIFY_BUTTONS' => isset($arParams['NOTIFY_BUTTONS']) ? $arParams['NOTIFY_BUTTONS'] : serialize(array()), 'NOTIFY_TITLE' => isset($arParams['NOTIFY_TITLE']) ? $arParams['NOTIFY_TITLE'] : ''))));
                             self::SendBadges($arFields['TO_USER_ID']);
                         }
                     }
                     return $messageID;
                 } else {
                     $GLOBALS["APPLICATION"]->ThrowException(GetMessage("IM_ERROR_MESSAGE_CREATE"), "CHAT_ID");
                     return false;
                 }
             } else {
                 $GLOBALS["APPLICATION"]->ThrowException(GetMessage("IM_ERROR_MESSAGE_TYPE"), "MESSAGE_TYPE");
                 return false;
             }
         }
     }
 }
开发者ID:andy-profi,项目名称:bxApiDocs,代码行数:101,代码来源:im_messenger.php

示例14: UserConfirmRequestToBeMember

 function UserConfirmRequestToBeMember($targetUserID, $relationID, $bAutoSubscribe = true)
 {
     global $APPLICATION;
     $targetUserID = IntVal($targetUserID);
     if ($targetUserID <= 0) {
         $GLOBALS["APPLICATION"]->ThrowException(GetMessage("SONET_UR_EMPTY_USERID"), "ERROR_SENDER_USER_ID");
         return false;
     }
     $relationID = IntVal($relationID);
     if ($relationID <= 0) {
         $GLOBALS["APPLICATION"]->ThrowException(GetMessage("SONET_UR_EMPTY_RELATIONID"), "ERROR_RELATION_ID");
         return false;
     }
     if (CModule::IncludeModule("extranet")) {
         $extranet_site_id = CExtranet::GetExtranetSiteID();
     }
     $dbResult = CSocNetUserToGroup::GetList(array(), array("ID" => $relationID, "USER_ID" => $targetUserID, "ROLE" => SONET_ROLES_REQUEST, "INITIATED_BY_TYPE" => SONET_INITIATED_BY_GROUP), false, false, array("ID", "USER_ID", "INITIATED_BY_USER_ID", "GROUP_ID", "GROUP_VISIBLE", "GROUP_SITE_ID", "GROUP_NAME"));
     if ($arResult = $dbResult->Fetch()) {
         $rsGroupSite = CSocNetGroup::GetSite($arResult["GROUP_ID"]);
         while ($arGroupSite = $rsGroupSite->Fetch()) {
             $arGroupSites[] = $arGroupSite["LID"];
             //get server name
             $rsSites = CSite::GetByID($arGroupSite["LID"]);
             $arSite = $rsSites->Fetch();
             $serverName = $arSite["SERVER_NAME"];
             if (strlen($serverName) <= 0) {
                 if (defined("SITE_SERVER_NAME") && strlen(SITE_SERVER_NAME) > 0) {
                     $serverName = SITE_SERVER_NAME;
                 } else {
                     $serverName = COption::GetOptionString("main", "server_name", $GLOBALS["SERVER_NAME"]);
                 }
             }
             if (strlen($serverName) > 0) {
                 $protocol = CMain::IsHTTPS() ? "https" : "http";
                 $serverName = $protocol . "://" . $serverName;
             }
         }
         if (!$arGroupSites) {
             $arGroupSites = array(SITE_ID);
         }
         $arFields = array("ROLE" => SONET_ROLES_USER, "=DATE_UPDATE" => $GLOBALS["DB"]->CurrentTimeFunction());
         if (CSocNetUserToGroup::Update($arResult["ID"], $arFields)) {
             $events = GetModuleEvents("socialnetwork", "OnSocNetUserConfirmRequestToBeMember");
             while ($arEvent = $events->Fetch()) {
                 ExecuteModuleEventEx($arEvent, array($arResult["ID"], $arResult));
             }
             if ($bAutoSubscribe) {
                 CSocNetLogEvents::AutoSubscribe($targetUserID, SONET_ENTITY_GROUP, $arResult["GROUP_ID"]);
             }
             if (CModule::IncludeModule("im")) {
                 CIMNotify::DeleteByTag("SOCNET|INVITE_GROUP|" . intval($targetUserID) . "|" . intval($relationID));
                 $arMessageFields = array("MESSAGE_TYPE" => IM_MESSAGE_SYSTEM, "TO_USER_ID" => $arResult["INITIATED_BY_USER_ID"], "FROM_USER_ID" => $arResult['USER_ID'], "NOTIFY_TYPE" => IM_NOTIFY_FROM, "NOTIFY_MODULE" => "socialnetwork", "NOTIFY_EVENT" => "invite_group", "NOTIFY_TAG" => "SOCNET|INVITE_GROUP_SUCCESS|" . intval($arResult["GROUP_ID"]), "NOTIFY_MESSAGE" => str_replace("#NAME#", $arResult["GROUP_NAME"], GetMessage("SONET_UG_CONFIRM_MEMBER_MESSAGE")));
                 CIMNotify::Add($arMessageFields);
             } else {
                 $arMessageFields = array("FROM_USER_ID" => $targetUserID, "TO_USER_ID" => $arResult["INITIATED_BY_USER_ID"], "MESSAGE" => str_replace("#NAME#", $arResult["GROUP_NAME"], GetMessage("SONET_UG_CONFIRM_MEMBER_MESSAGE")), "=DATE_CREATE" => $GLOBALS["DB"]->CurrentTimeFunction(), "MESSAGE_TYPE" => SONET_MESSAGE_SYSTEM);
                 CSocNetMessages::Add($arMessageFields);
             }
             $site = in_array($extranet_site_id, $arGroupSites) ? $extranet_site_id : $arGroupSites["0"];
             $groupUrl = $serverName . str_replace("#group_id#", $arResult["GROUP_ID"], COption::GetOptionString("socialnetwork", "group_path_template", "/workgroups/group/#group_id#/", $site));
             $logID = CSocNetLog::Add(array("ENTITY_TYPE" => SONET_ENTITY_GROUP, "ENTITY_ID" => $arResult["GROUP_ID"], "EVENT_ID" => "system", "=LOG_DATE" => $GLOBALS["DB"]->CurrentTimeFunction(), "TITLE_TEMPLATE" => false, "TITLE" => "join", "MESSAGE" => $targetUserID, "URL" => $groupUrl, "MODULE_ID" => false, "CALLBACK_FUNC" => false, "SITE_ID" => $arGroupSites, "USER_ID" => $targetUserID), false);
             if (intval($logID) > 0) {
                 $tmpID = $logID;
                 CSocNetLog::Update($logID, array("TMP_ID" => $tmpID));
                 CSocNetLogRights::Add($logID, array("SA", "U" . $targetUserID, "S" . SONET_ENTITY_GROUP . $arResult["GROUP_ID"], "S" . SONET_ENTITY_GROUP . $arResult["GROUP_ID"] . "_" . SONET_ROLES_OWNER, "S" . SONET_ENTITY_GROUP . $arResult["GROUP_ID"] . "_" . SONET_ROLES_MODERATOR, "S" . SONET_ENTITY_GROUP . $arResult["GROUP_ID"] . "_" . SONET_ROLES_USER));
                 CSocNetLog::SendEvent($logID, "SONET_NEW_EVENT", $tmpID);
             }
         } else {
             $errorMessage = "";
             if ($e = $APPLICATION->GetException()) {
                 $errorMessage = $e->GetString();
             }
             if (StrLen($errorMessage) <= 0) {
                 $errorMessage = GetMessage("SONET_UR_ERROR_CREATE_USER2GROUP");
             }
             $GLOBALS["APPLICATION"]->ThrowException($errorMessage, "ERROR_CREATE_RELATION");
             return false;
         }
     } else {
         $GLOBALS["APPLICATION"]->ThrowException(GetMessage("SONET_NO_USER2GROUP"), "ERROR_NO_GROUP_REQUEST");
         return false;
     }
     CSocNetUserToGroup::__SpeedFileCheckMessages($targetUserID);
     return true;
 }
开发者ID:k-kalashnikov,项目名称:geekcon_new,代码行数:84,代码来源:user_group.php

示例15: Add


//.........这里部分代码省略.........
                     $arParams['NOTIFY_MODULE'] = $arFields['NOTIFY_MODULE'];
                     $arParams['NOTIFY_EVENT'] = $arFields['NOTIFY_EVENT'];
                     //if (strlen($arParams['MESSAGE']) <= 0 && strlen($arParams['MESSAGE_OUT']) <= 0)
                     //	return false;
                     $sendToSite = true;
                     if ($arParams['NOTIFY_TYPE'] != IM_NOTIFY_CONFIRM) {
                         $sendToSite = CIMSettings::GetNotifyAccess($arFields["TO_USER_ID"], $arFields["NOTIFY_MODULE"], $arFields["NOTIFY_EVENT"], CIMSettings::CLIENT_SITE);
                     }
                     if (!$sendToSite) {
                         $arParams['NOTIFY_READ'] = 'Y';
                     }
                     if (isset($arFields['IMPORT_ID'])) {
                         $arParams['IMPORT_ID'] = intval($arFields['IMPORT_ID']);
                     }
                     if (isset($arFields['MESSAGE_DATE'])) {
                         $arParams['DATE_CREATE'] = $arFields['MESSAGE_DATE'];
                     }
                     if (isset($arFields['EMAIL_TEMPLATE']) && strlen(trim($arFields['EMAIL_TEMPLATE'])) > 0) {
                         $arParams['EMAIL_TEMPLATE'] = trim($arFields['EMAIL_TEMPLATE']);
                     }
                     $arParams['NOTIFY_TAG'] = isset($arFields['NOTIFY_TAG']) ? $arFields['NOTIFY_TAG'] : '';
                     $arParams['NOTIFY_SUB_TAG'] = isset($arFields['NOTIFY_SUB_TAG']) ? $arFields['NOTIFY_SUB_TAG'] : '';
                     if (isset($arFields['NOTIFY_TITLE']) && strlen(trim($arFields['NOTIFY_TITLE'])) > 0) {
                         $arParams['NOTIFY_TITLE'] = trim($arFields['NOTIFY_TITLE']);
                     }
                     if ($arParams['NOTIFY_TYPE'] == IM_NOTIFY_CONFIRM) {
                         if (isset($arFields['NOTIFY_BUTTONS'])) {
                             foreach ($arFields['NOTIFY_BUTTONS'] as $key => $arButtons) {
                                 if (is_array($arButtons)) {
                                     if (isset($arButtons['TITLE']) && strlen($arButtons['TITLE']) > 0 && isset($arButtons['VALUE']) && strlen($arButtons['VALUE']) > 0 && isset($arButtons['TYPE']) && strlen($arButtons['TYPE']) > 0) {
                                         $arButtons['TITLE'] = htmlspecialcharsbx($arButtons['TITLE']);
                                         $arButtons['VALUE'] = htmlspecialcharsbx($arButtons['VALUE']);
                                         $arButtons['TYPE'] = htmlspecialcharsbx($arButtons['TYPE']);
                                         $arFields['NOTIFY_BUTTONS'][$key] = $arButtons;
                                     } else {
                                         unset($arFields['NOTIFY_BUTTONS'][$key]);
                                     }
                                 } else {
                                     unset($arFields['NOTIFY_BUTTONS'][$key]);
                                 }
                             }
                         } else {
                             $arFields['NOTIFY_BUTTONS'] = array(array('TITLE' => GetMessage('IM_ERROR_BUTTON_ACCEPT'), 'VALUE' => 'Y', 'TYPE' => 'accept'), array('TITLE' => GetMessage('IM_ERROR_BUTTON_CANCEL'), 'VALUE' => 'N', 'TYPE' => 'cancel'));
                         }
                         $arParams['NOTIFY_BUTTONS'] = serialize($arFields["NOTIFY_BUTTONS"]);
                         if (isset($arParams['NOTIFY_TAG']) && strlen($arParams['NOTIFY_TAG']) > 0) {
                             CIMNotify::DeleteByTag($arParams['NOTIFY_TAG']);
                         }
                     }
                     if ($sendToSite) {
                         $result = IM\MessageTable::add($arParams);
                         $messageID = IntVal($result->getId());
                         if ($messageID <= 0) {
                             return false;
                         }
                     } else {
                         $messageID = time();
                     }
                     if (!$bConvert) {
                         if (CModule::IncludeModule('pull')) {
                             $CPushManager = new CPushManager();
                             if (isset($arFields['PUSH_MESSAGE']) && CIMSettings::GetNotifyAccess($arFields["TO_USER_ID"], $arFields['NOTIFY_MODULE'], $arFields['NOTIFY_EVENT'], CIMSettings::CLIENT_PUSH) && CModule::IncludeModule('pull')) {
                                 $CPushManager->AddQueue(array('USER_ID' => $arFields['TO_USER_ID'], 'MESSAGE' => str_replace("\n", " ", trim($arFields['PUSH_MESSAGE'])), 'PARAMS' => isset($arFields['PUSH_PARAMS']) ? $arFields['PUSH_PARAMS'] : '', 'TAG' => $arParams['NOTIFY_TAG'], 'SUB_TAG' => $arParams['NOTIFY_SUB_TAG'], 'APP_ID' => isset($arParams['PUSH_APP_ID']) ? $arParams['PUSH_APP_ID'] : ''));
                             } else {
                                 $CPushManager->AddQueue(array('USER_ID' => $arFields['TO_USER_ID'], 'APP_ID' => isset($arParams['PUSH_APP_ID']) ? $arParams['PUSH_APP_ID'] : ''));
                             }
                         }
                         foreach (GetModuleEvents("im", "OnAfterNotifyAdd", true) as $arEvent) {
                             ExecuteModuleEventEx($arEvent, array(intval($messageID), $arFields));
                         }
                     }
                     if (!$sendToSite) {
                         return false;
                     }
                     if (!empty($arFields['PARAMS'])) {
                         CIMMessageParam::Set($messageID, $arFields['PARAMS']);
                     }
                     IM\ChatTable::update($chatId, array('LAST_MESSAGE_ID' => $messageID));
                     CIMMessenger::SpeedFileDelete($arFields['TO_USER_ID'], IM_SPEED_NOTIFY);
                     if (!$bConvert) {
                         //CUserCounter::Increment($arFields['TO_USER_ID'], 'im_notify_v2', '**', false);
                         $strSql = "UPDATE b_im_relation SET STATUS = '" . IM_STATUS_UNREAD . "' WHERE USER_ID = " . intval($arFields['TO_USER_ID']) . " AND MESSAGE_TYPE = '" . IM_MESSAGE_SYSTEM . "' AND CHAT_ID = " . $chatId;
                         $DB->Query($strSql, false, "File: " . __FILE__ . "<br>Line: " . __LINE__);
                         if (CModule::IncludeModule("pull")) {
                             CPullStack::AddByUser(intval($arFields['TO_USER_ID']), array('module_id' => 'im', 'command' => 'notify', 'params' => CIMNotify::GetFormatNotify(array('ID' => $messageID, 'DATE_CREATE' => time(), 'FROM_USER_ID' => intval($arFields['FROM_USER_ID']), 'MESSAGE' => $arParams['MESSAGE'], 'PARAMS' => self::PrepareParamsForPull($arFields['PARAMS']), 'NOTIFY_MODULE' => $arParams['NOTIFY_MODULE'], 'NOTIFY_EVENT' => $arParams['NOTIFY_EVENT'], 'NOTIFY_TAG' => $arParams['NOTIFY_TAG'], 'NOTIFY_TYPE' => $arParams['NOTIFY_TYPE'], 'NOTIFY_BUTTONS' => isset($arParams['NOTIFY_BUTTONS']) ? $arParams['NOTIFY_BUTTONS'] : serialize(array()), 'NOTIFY_TITLE' => isset($arParams['NOTIFY_TITLE']) ? $arParams['NOTIFY_TITLE'] : ''))));
                             self::SendBadges($arFields['TO_USER_ID']);
                         }
                     }
                     return $messageID;
                 } else {
                     $GLOBALS["APPLICATION"]->ThrowException(GetMessage("IM_ERROR_MESSAGE_CREATE"), "CHAT_ID");
                     return false;
                 }
             } else {
                 $GLOBALS["APPLICATION"]->ThrowException(GetMessage("IM_ERROR_MESSAGE_TYPE"), "MESSAGE_TYPE");
                 return false;
             }
         }
     }
 }
开发者ID:DarneoStudio,项目名称:bitrix,代码行数:101,代码来源:im_messenger.php


注:本文中的CIMNotify::DeleteByTag方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。