本文整理汇总了PHP中CPullStack类的典型用法代码示例。如果您正苦于以下问题:PHP CPullStack类的具体用法?PHP CPullStack怎么用?PHP CPullStack使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了CPullStack类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: afterUpdateTrigger
/**
* Method will be invoked after an database record updated.
*
* @param array $oldRecord All fields before update.
* @param array $newRecord All fields after update.
*
* @return void
*/
public static function afterUpdateTrigger(array $oldRecord, array $newRecord)
{
if ($oldRecord['TITLE'] !== $newRecord['TITLE']) {
if (\CModule::IncludeModule("pull")) {
$ar = \CIMChat::GetRelationById($newRecord['CHAT_ID']);
foreach ($ar as $rel) {
\CIMContactList::CleanChatCache($rel['USER_ID']);
\CPullStack::AddByUser($rel['USER_ID'], array('module_id' => 'im', 'command' => 'chatRename', 'params' => array('chatId' => $newRecord['CHAT_ID'], 'chatTitle' => htmlspecialcharsbx($newRecord['TITLE']))));
}
}
}
if ($oldRecord['AVATAR'] !== $newRecord['AVATAR']) {
if (\CModule::IncludeModule('pull')) {
$avatarImage = \CIMChat::GetAvatarImage($newRecord['AVATAR']);
$ar = \CIMChat::GetRelationById($newRecord['CHAT_ID']);
foreach ($ar as $relation) {
\CIMContactList::CleanChatCache($relation['USER_ID']);
\CPullStack::AddByUser($relation['USER_ID'], array('module_id' => 'im', 'command' => 'chatAvatar', 'params' => array('chatId' => $newRecord['CHAT_ID'], 'chatAvatar' => $avatarImage)));
}
}
}
if ($oldRecord['COLOR'] !== $newRecord['COLOR']) {
if (\CModule::IncludeModule('pull')) {
$ar = \CIMChat::GetRelationById($newRecord['CHAT_ID']);
foreach ($ar as $relation) {
\CIMContactList::CleanChatCache($relation['USER_ID']);
\CPullStack::AddByUser($relation['USER_ID'], array('module_id' => 'im', 'command' => 'chatChangeColor', 'params' => array('chatId' => $newRecord['CHAT_ID'], 'chatColor' => \Bitrix\Im\Color::getColor($newRecord['COLOR']))));
}
}
}
}
开发者ID:andy-profi,项目名称:bxApiDocs,代码行数:39,代码来源:chathandler.php
示例2: onExecuteStartWriting
function onExecuteStartWriting(\Bitrix\Main\Event $event)
{
$parameters = $event->getParameters();
$userId = $parameters[0];
$dialogId = $parameters[1] . $parameters[2];
if ($userId > 0) {
if (!\Bitrix\Main\Loader::includeModule('pull')) {
return;
}
\CPushManager::DeleteFromQueueBySubTag($userId, 'IM_MESS');
if (intval($dialogId) > 0) {
\CPullStack::AddByUser($dialogId, array('module_id' => 'im', 'command' => 'startWriting', 'expiry' => 60, 'params' => array('senderId' => $userId, 'dialogId' => $dialogId)));
} elseif (substr($dialogId, 0, 4) == 'chat') {
$chatId = substr($dialogId, 4);
$arRelation = \CIMChat::GetRelationById($chatId);
unset($arRelation[$userId]);
$pullMessage = array('module_id' => 'im', 'command' => 'startWriting', 'expiry' => 60, 'params' => array('senderId' => $userId, 'dialogId' => $dialogId));
\CPullStack::AddByUsers(array_keys($arRelation), $pullMessage);
$orm = \Bitrix\Im\ChatTable::getById($chatId);
$chat = $orm->fetch();
if ($chat['TYPE'] == IM_MESSAGE_OPEN) {
\CPullWatch::AddToStack('IM_PUBLIC_' . $chatId, $pullMessage);
}
}
}
}
开发者ID:DarneoStudio,项目名称:bitrix,代码行数:26,代码来源:startwritinghandler.php
示例3: Set
public static function Set($userId, $params)
{
$userId = intval($userId);
if ($userId <= 0) {
return false;
}
if (isset($params['STATUS'])) {
$params['IDLE'] = null;
}
$needToUpdate = false;
$params = self::PrepereFields($params);
$res = IM\StatusTable::getById($userId);
if ($status = $res->fetch()) {
foreach ($params as $key => $value) {
$oldValue = is_object($status[$key]) ? $status[$key]->toString() : $status[$key];
$newValue = is_object($value) ? $value->toString() : $value;
if ($oldValue != $newValue) {
$status[$key] = $value;
$needToUpdate = true;
}
}
if ($needToUpdate) {
IM\StatusTable::update($userId, $params);
}
} else {
$params['USER_ID'] = $userId;
IM\StatusTable::add($params);
$needToUpdate = true;
$status = $params;
}
if ($needToUpdate && self::Enable()) {
CPullStack::AddShared(array('module_id' => 'online', 'command' => 'user_status', 'params' => self::PrepereToPush($status)));
}
return true;
}
开发者ID:rasuldev,项目名称:torino,代码行数:35,代码来源:im_status.php
示例4: afterUpdateTrigger
/**
* Method will be invoked after an database record updated.
*
* @param array $oldRecord All fields before update.
* @param array $newRecord All fields after update.
*
* @return void
*/
public function afterUpdateTrigger(array $oldRecord, array $newRecord)
{
if ($oldRecord["STATUS"] !== $newRecord["STATUS"]) {
if (\CIMStatus::Enable()) {
\CPullStack::AddShared(array('module_id' => 'online', 'command' => 'user_status', 'expiry' => 120, 'params' => array("USER_ID" => $newRecord["USER_ID"], "STATUS" => $newRecord["STATUS"])));
}
}
}
开发者ID:Satariall,项目名称:izurit,代码行数:16,代码来源:statushandler.php
示例5: Delete
public static function Delete($channelId)
{
global $DB;
$arMessage = array('module_id' => 'pull', 'command' => 'channel_die', 'params' => '');
CPullStack::AddByChannel($channelId, $arMessage);
$strSql = "DELETE FROM b_pull_channel WHERE CHANNEL_ID = '" . $DB->ForSQL($channelId) . "'";
$dbRes = $DB->Query($strSql, false, "File: " . __FILE__ . "<br>Line: " . __LINE__);
return true;
}
开发者ID:k-kalashnikov,项目名称:geekcon_new,代码行数:9,代码来源:pull_channel.php
示例6: AddToStack
public static function AddToStack($tag, $arMessage)
{
global $DB;
$result = false;
$strSql = "SELECT CHANNEL_ID FROM b_pull_watch WHERE TAG = '" . $DB->ForSQL($tag) . "'";
$dbRes = $DB->Query($strSql, false, "File: " . __FILE__ . "<br>Line: " . __LINE__);
while ($arRes = $dbRes->Fetch()) {
$result = CPullStack::AddByChannel($arRes['CHANNEL_ID'], $arMessage);
if (!$result) {
break;
}
}
return !$result ? false : true;
}
开发者ID:k-kalashnikov,项目名称:geekcon_new,代码行数:14,代码来源:pull_watch.php
示例7: afterInsertTrigger
/**
* Method will be invoked after new database record inserted.
*
* @param array $newRecord All fields of inserted record.
*
* @return void
*/
public function afterInsertTrigger(array $newRecord)
{
$id = intval($newRecord['MESSAGE_ID']);
if (!\Bitrix\Main\Loader::includeModule('pull')) {
return;
}
$message = \CIMMessenger::GetById($id, array('WITH_FILES' => 'Y'));
if (!$message) {
return;
}
if ($newRecord['PARAM_NAME'] === 'LIKE' && $newRecord["PARAM_VALUE"]) {
$like = $message['PARAMS']['LIKE'];
$result = \Bitrix\IM\ChatTable::getList(array('filter' => array('=ID' => $message['CHAT_ID'])));
$chat = $result->fetch();
$relations = \CIMMessenger::GetRelationById($id);
if (!isset($relations[$newRecord["PARAM_VALUE"]])) {
return;
}
if ($message['AUTHOR_ID'] > 0 && $message['AUTHOR_ID'] != $newRecord["PARAM_VALUE"]) {
$CCTP = new \CTextParser();
$CCTP->MaxStringLen = 200;
$CCTP->allow = array("HTML" => "N", "ANCHOR" => "N", "BIU" => "N", "IMG" => "N", "QUOTE" => "N", "CODE" => "N", "FONT" => "N", "LIST" => "N", "SMILES" => "N", "NL2BR" => "Y", "VIDEO" => "N", "TABLE" => "N", "CUT_ANCHOR" => "N", "ALIGN" => "N");
$message['MESSAGE'] = str_replace('<br />', ' ', $CCTP->convertText($message['MESSAGE']));
$message['MESSAGE'] = preg_replace("/\\[s\\].*?\\[\\/s\\]/i", "", $message['MESSAGE']);
$message['MESSAGE'] = preg_replace("/\\[[bui]\\](.*?)\\[\\/[bui]\\]/i", "\$1", $message['MESSAGE']);
$message['MESSAGE'] = preg_replace("/\\[USER=([0-9]{1,})\\](.*?)\\[\\/USER\\]/i", "\$2", $message['MESSAGE']);
$message['MESSAGE'] = preg_replace("/------------------------------------------------------(.*)------------------------------------------------------/mi", " [" . GetMessage('IM_QUOTE') . "] ", str_replace(array("#BR#"), array(" "), $message['MESSAGE']));
if (count($message['FILES']) > 0 && strlen($message['MESSAGE']) < 200) {
foreach ($message['FILES'] as $file) {
$file = " [" . GetMessage('IM_MESSAGE_FILE') . ": " . $file['name'] . "]";
if (strlen($message['MESSAGE'] . $file) > 200) {
break;
}
$message['MESSAGE'] .= $file;
}
$message['MESSAGE'] = trim($message['MESSAGE']);
}
$isChat = $chat && strlen($chat['TITLE']) > 0;
$dot = strlen($message['MESSAGE']) >= 200 ? '...' : '';
$message['MESSAGE'] = substr($message['MESSAGE'], 0, 199) . $dot;
$message['MESSAGE'] = strlen($message['MESSAGE']) > 0 ? $message['MESSAGE'] : '-';
$arMessageFields = array("MESSAGE_TYPE" => IM_MESSAGE_SYSTEM, "TO_USER_ID" => $message['AUTHOR_ID'], "FROM_USER_ID" => $newRecord["PARAM_VALUE"], "NOTIFY_TYPE" => IM_NOTIFY_FROM, "NOTIFY_MODULE" => "main", "NOTIFY_EVENT" => "rating_vote", "NOTIFY_TAG" => "RATING|IM|" . ($isChat ? 'G' : 'P') . "|" . ($isChat ? $chat['ID'] : $newRecord["PARAM_VALUE"]) . "|" . $id, "NOTIFY_MESSAGE" => GetMessage($isChat ? 'IM_MESSAGE_LIKE' : 'IM_MESSAGE_LIKE_PRIVATE', array('#MESSAGE#' => $message['MESSAGE'], '#TITLE#' => $chat['TITLE'])));
\CIMNotify::Add($arMessageFields);
}
$arPullMessage = array('id' => $id, 'chatId' => $relations[$newRecord["PARAM_VALUE"]]['CHAT_ID'], 'senderId' => $newRecord["PARAM_VALUE"], 'users' => $like);
foreach ($relations as $rel) {
\CPullStack::AddByUser($rel['USER_ID'], array('module_id' => 'im', 'command' => 'messageLike', 'params' => $arPullMessage));
}
}
}
开发者ID:Satariall,项目名称:izurit,代码行数:57,代码来源:messageparamhandler.php
示例8: afterUpdateTrigger
/**
* Method will be invoked after an database record updated.
*
* @param array $oldRecord All fields before update.
* @param array $newRecord All fields after update.
*
* @return void
*/
public function afterUpdateTrigger(array $oldRecord, array $newRecord)
{
if ($newRecord["MESSAGE_TYPE"] === "P" && intval($oldRecord["LAST_ID"]) < intval($newRecord["LAST_ID"])) {
$oldLastRead = $oldRecord["LAST_READ"] instanceof \Bitrix\Main\Type\DateTime ? $oldRecord["LAST_READ"]->getTimestamp() : 0;
$newLastRead = $newRecord["LAST_READ"] instanceof \Bitrix\Main\Type\DateTime ? $newRecord["LAST_READ"]->getTimestamp() : 0;
if ($oldLastRead < $newLastRead) {
if (\Bitrix\Main\Loader::includeModule('pull')) {
$relationList = \Bitrix\IM\RelationTable::getList(array("select" => array("ID", "USER_ID"), "filter" => array("=CHAT_ID" => $newRecord["CHAT_ID"], "!=USER_ID" => $newRecord["USER_ID"])));
if ($relation = $relationList->fetch()) {
\CPullStack::AddByUser($relation['USER_ID'], array('module_id' => 'im', 'command' => 'readMessageApponent', 'params' => array('chatId' => intval($newRecord['CHAT_ID']), 'userId' => intval($newRecord['USER_ID']), 'lastId' => $newRecord['LAST_ID'], 'date' => $newLastRead, 'count' => 1)));
}
}
}
}
}
开发者ID:Satariall,项目名称:izurit,代码行数:23,代码来源:relationhandler.php
示例9: SendPullEvent
public static function SendPullEvent($params)
{
// TODO check params
if (!CModule::IncludeModule('pull') || !CPullOptions::GetQueueServerStatus() || $params['USER_ID'] <= 0) {
return false;
}
$config = array();
if ($params['COMMAND'] == 'outgoing') {
$config = array("callId" => $params['CALL_ID'], "callIdTmp" => $params['CALL_ID_TMP'] ? $params['CALL_ID_TMP'] : '', "callDevice" => $params['CALL_DEVICE'] == 'PHONE' ? 'PHONE' : 'WEBRTC', "phoneNumber" => $params['PHONE_NUMBER'], "external" => $params['EXTERNAL'] ? true : false, "CRM" => $params['CRM'] ? $params['CRM'] : array());
} else {
if ($params['COMMAND'] == 'timeout') {
$config = array("callId" => $params['CALL_ID'], "failedCode" => intval($params['FAILED_CODE']));
}
}
CPullStack::AddByUser($params['USER_ID'], array('module_id' => 'voximplant', 'command' => $params['COMMAND'], 'params' => $config));
return true;
}
开发者ID:mrdeadmouse,项目名称:u136006,代码行数:17,代码来源:vi_outgoing.php
示例10: onExecuteStartWriting
function onExecuteStartWriting(\Bitrix\Main\Event $event)
{
$parameters = $event->getParameters();
$userId = $parameters[0];
$dialogId = $parameters[1] . $parameters[2];
if ($userId > 0) {
if (!\Bitrix\Main\Loader::includeModule('pull')) {
return;
}
\CPushManager::DeleteFromQueueBySubTag($userId, 'IM_MESS');
if (intval($dialogId) > 0) {
\CPullStack::AddByUser($dialogId, array('module_id' => 'im', 'command' => 'startWriting', 'expiry' => 60, 'params' => array('senderId' => $userId, 'dialogId' => $dialogId)));
} elseif (substr($dialogId, 0, 4) == 'chat') {
$arRelation = \CIMChat::GetRelationById(substr($dialogId, 4));
foreach ($arRelation as $rel) {
if ($rel['USER_ID'] == $userId) {
continue;
}
\CPullStack::AddByUser($rel['USER_ID'], array('module_id' => 'im', 'command' => 'startWriting', 'expiry' => 60, 'params' => array('senderId' => $userId, 'dialogId' => $dialogId)));
}
}
}
}
开发者ID:Satariall,项目名称:izurit,代码行数:23,代码来源:startwritinghandler.php
示例11: Edit
//.........这里部分代码省略.........
$offset = CCalendar::GetOffset();
$arFields['LOCATION'] = CCalendar::SetLocation($arFields['LOCATION']['OLD'], $arFields['LOCATION']['NEW'], array('dateFrom' => CCalendar::Date($arFields['DT_FROM_TS'] + $offset), 'dateTo' => CCalendar::Date($arFields['DT_TO_TS'] + $offset), 'name' => $arFields['NAME'], 'persons' => count($attendees), 'attendees' => $attendees, 'bRecreateReserveMeetings' => $arFields['LOCATION']['RE_RESERVE'] !== 'N'));
$bSendInvitations = false;
if (!isset($arFields['IS_MEETING']) && isset($arFields['ATTENDEES']) && is_array($arFields['ATTENDEES']) && empty($arFields['ATTENDEES'])) {
$arFields['IS_MEETING'] = false;
}
$attendeesCodes = array();
if ($arFields['IS_MEETING'] && is_array($arFields['MEETING'])) {
if (!empty($arFields['ATTENDEES_CODES'])) {
$attendeesCodes = $arFields['ATTENDEES_CODES'];
$arFields['ATTENDEES_CODES'] = implode(',', $arFields['ATTENDEES_CODES']);
}
// Organizer
$bSendInvitations = $Params['bSendInvitations'] !== false;
$arFields['~MEETING'] = array('HOST_NAME' => $arFields['MEETING']['HOST_NAME'], 'TEXT' => $arFields['MEETING']['TEXT'], 'OPEN' => $arFields['MEETING']['OPEN'], 'NOTIFY' => $arFields['MEETING']['NOTIFY'], 'REINVITE' => $arFields['MEETING']['REINVITE']);
$arFields['MEETING'] = serialize($arFields['~MEETING']);
}
$arReminders = array();
if ($arFields['REMIND'] && is_array($arFields['REMIND'])) {
foreach ($arFields['REMIND'] as $remind) {
if (in_array($remind['type'], array('min', 'hour', 'day'))) {
$arReminders[] = array('type' => $remind['type'], 'count' => floatVal($remind['count']));
}
}
}
$arFields['REMIND'] = count($arReminders) > 0 ? serialize($arReminders) : '';
$AllFields = self::GetFields();
$dbFields = array();
foreach ($arFields as $field => $val) {
if (isset($AllFields[$field]) && $field != "ID") {
$dbFields[$field] = $arFields[$field];
}
}
CTimeZone::Disable();
if ($bNew) {
$ID = CDatabase::Add("b_calendar_event", $dbFields, array('DESCRIPTION', 'MEETING', 'RDATE', 'EXDATE'));
} else {
$ID = $arFields['ID'];
$strUpdate = $DB->PrepareUpdate("b_calendar_event", $dbFields);
$strSql = "UPDATE b_calendar_event SET " . $strUpdate . " WHERE ID=" . IntVal($arFields['ID']);
$DB->QueryBind($strSql, array('DESCRIPTION' => $arFields['DESCRIPTION'], 'MEETING' => $arFields['MEETING'], 'RDATE' => $arFields['RDATE'], 'EXDATE' => $arFields['EXDATE']));
}
CTimeZone::Enable();
if ($bNew && !isset($dbFields['DAV_XML_ID'])) {
$strSql = "UPDATE b_calendar_event SET " . $DB->PrepareUpdate("b_calendar_event", array('DAV_XML_ID' => $ID)) . " WHERE ID=" . IntVal($ID);
$DB->Query($strSql, false, "File: " . __FILE__ . "<br>Line: " . __LINE__);
}
// Clean links
// Del link from table
if (!$bNew) {
$arAffectedSections = CCalendarEvent::GetCurrentSectionIds($ID);
$DB->Query("DELETE FROM b_calendar_event_sect WHERE EVENT_ID=" . IntVal($ID), false, "FILE: " . __FILE__ . "<br> LINE: " . __LINE__);
} else {
$arAffectedSections = array();
}
$strSections = "0";
foreach ($arFields['SECTIONS'] as $sect) {
if (IntVal($sect) > 0) {
$strSections .= "," . IntVal($sect);
$arAffectedSections[] = IntVal($sect);
}
}
if (count($arAffectedSections) > 0) {
CCalendarSect::UpdateModificationLabel($arAffectedSections);
}
// We don't have any section for this event
// and we have to create default one.
if ($strSections == "0") {
$defCalendar = CCalendarSect::CreateDefault(array('type' => CCalendar::GetType(), 'ownerId' => CCalendar::GetOwnerId()));
$strSections .= "," . IntVal($defCalendar['ID']);
}
// Add links
$strSql = "INSERT INTO b_calendar_event_sect(EVENT_ID, SECT_ID) " . "SELECT " . intVal($ID) . ", ID " . "FROM b_calendar_section " . "WHERE ID in (" . $strSections . ")";
$DB->Query($strSql, false, "FILE: " . __FILE__ . "<br> LINE: " . __LINE__);
$bPull = CModule::IncludeModule("pull");
if ($arFields['IS_MEETING']) {
if (isset($arFields['ATTENDEES'])) {
self::InviteAttendees($ID, $arFields, $arFields['ATTENDEES'], is_array($Params['attendeesStatuses']) ? $Params['attendeesStatuses'] : array(), $bSendInvitations, $userId);
if ($bPull) {
// TODO: CACHE IT!
$attendees = self::GetAttendees($ID);
$attendees = $attendees[$ID];
foreach ($attendees as $user) {
CPullStack::AddByUser($user['USER_ID'], array('module_id' => 'calendar', 'command' => 'event_update', 'params' => array('EVENT' => CCalendarEvent::OnPullPrepareArFields($arFields), 'ATTENDEES' => $attendees, 'NEW' => $bNew ? 'Y' : 'N')));
}
}
}
} else {
if ($bPull) {
CPullStack::AddByUser($userId, array('module_id' => 'calendar', 'command' => 'event_update', 'params' => array('EVENT' => CCalendarEvent::OnPullPrepareArFields($arFields), 'ATTENDEES' => array(), 'NEW' => $bNew ? 'Y' : 'N')));
}
}
// Clean old reminders and add new reminders
self::UpdateReminders(array('id' => $ID, 'reminders' => $arReminders, 'arFields' => $arFields, 'userId' => $userId, 'path' => $path, 'bNew' => $bNew));
if ($arFields['CAL_TYPE'] == 'user' && $arFields['IS_MEETING'] && !empty($attendeesCodes)) {
CCalendarLiveFeed::OnEditCalendarEventEntry($ID, $arFields, $attendeesCodes);
}
CCalendar::ClearCache('event_list');
return $ID;
}
开发者ID:mrdeadmouse,项目名称:u136006,代码行数:101,代码来源:calendar_event.php
示例12: SendConfigDie
public static function SendConfigDie()
{
$arMessage = array('module_id' => 'pull', 'command' => 'config_die', 'params' => '');
CPullStack::AddBroadcast($arMessage);
}
开发者ID:mrdeadmouse,项目名称:u136006,代码行数:5,代码来源:pull_options.php
示例13: 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__."<br>Line: ".__LINE__);
if ($arRes = $dbRes->Fetch())
{
$arRes['RELATION_USER_ID'] = $this->user_id;
if (strlen($arRes['NOTIFY_TAG'])>0)
{
foreach(GetModuleEvents("im", "OnBeforeConfirmNotify", true) as $arEvent)
if (ExecuteModuleEventEx($arEvent, Array($arRes['NOTIFY_MODULE'], $arRes['NOTIFY_TAG'], $VALUE, $arRes))===false)
return false;
}
$strSql = "DELETE FROM b_im_message WHERE ID = ".$ID;
$DB->Query($strSql, false, "File: ".__FILE__."<br>Line: ".__LINE__);
//CUserCounter::Decrement($this->user_id, 'im_notify', '**', false);
if (strlen($arRes['NOTIFY_TAG'])>0)
{
foreach(GetModuleEvents("im", "OnAfterConfirmNotify", true) as $arEvent)
ExecuteModuleEventEx($arEvent, array($arRes['NOTIFY_MODULE'], $arRes['NOTIFY_TAG'], $VALUE, $arRes));
}
if (CModule::IncludeModule("pull"))
{
CPullStack::AddByUser($this->user_id, Array(
'module_id' => 'im',
'command' => 'confirmNotify',
'params' => Array(
'chatId' => intval($arRes['CHAT_ID']),
'id' => $ID
),
));
//CIMMessenger::SendBadges($this->user_id);
}
CIMMessenger::SpeedFileDelete($this->user_id, IM_SPEED_NOTIFY);
return true;
}
return false;
}
开发者ID:ASDAFF,项目名称:bxApiDocs,代码行数:48,代码来源:im_notify.php
示例14: Command
public static function Command($chatId, $recipientId, $command, $params = Array())
{
if (!CModule::IncludeModule("pull"))
return false;
$chatId = intval($chatId);
$recipientId = intval($recipientId);
if ($recipientId <= 0 || $chatId <= 0 || empty($command) || !is_array($params))
return false;
global $USER;
$params['senderId'] = $USER->GetID();
$params['chatId'] = $chatId;
$params['command'] = $command;
CPullStack::AddByUser($recipientId, Array(
'module_id' => 'im',
'command' => 'call',
'params' => $params,
));
return true;
}
开发者ID:ASDAFF,项目名称:bxApiDocs,代码行数:23,代码来源:im_call.php
示例15: SetReadMessage
public function SetReadMessage($fromUserId, $lastId = null)
{
global $DB;
$fromUserId = intval($fromUserId);
if ($fromUserId <= 0) {
return false;
}
$bReadMessage = false;
if ($lastId == null) {
$strSql = "\n\t\t\t\tSELECT MAX(M.ID) ID, M.CHAT_ID\n\t\t\t\tFROM b_im_relation RF\n\t\t\t\t\tINNER JOIN b_im_relation RT on RF.CHAT_ID = RT.CHAT_ID\n\t\t\t\t\tINNER JOIN b_im_message M ON M.ID >= RT.LAST_ID AND M.CHAT_ID = RT.CHAT_ID\n\t\t\t\tWHERE RT.USER_ID = " . $this->user_id . "\n\t\t\t\t\tand RF.USER_ID = " . $fromUserId . "\n\t\t\t\t\tand RT.MESSAGE_TYPE = '" . IM_MESSAGE_PRIVATE . "' and RT.STATUS < " . IM_STATUS_READ . "\n\t\t\t\tGROUP BY M.CHAT_ID";
$dbRes = $DB->Query($strSql, false, "File: " . __FILE__ . "<br>Line: " . __LINE__);
if ($arRes = $dbRes->Fetch()) {
$bReadMessage = self::SetLastId(intval($arRes['CHAT_ID']), $this->user_id, $arRes['ID']);
}
$lastId = $arRes['ID'];
} else {
$strSql = "\n\t\t\t\tSELECT RF.CHAT_ID\n\t\t\t\tFROM b_im_relation RF INNER JOIN b_im_relation RT on RF.CHAT_ID = RT.CHAT_ID\n\t\t\t\tWHERE RT.USER_ID = " . $this->user_id . "\n\t\t\t\t\tand RF.USER_ID = " . $fromUserId . "\n\t\t\t\t\tand RT.MESSAGE_TYPE = '" . IM_MESSAGE_PRIVATE . "'";
$dbRes = $DB->Query($strSql, false, "File: " . __FILE__ . "<br>Line: " . __LINE__);
if ($arRes = $dbRes->Fetch()) {
$bReadMessage = self::SetLastId(intval($arRes['CHAT_ID']), $this->user_id, intval($lastId));
}
}
if ($bReadMessage) {
CIMMessenger::SpeedFileDelete($this->user_id, IM_SPEED_MESSAGE);
if (CModule::IncludeModule("pull")) {
CPushManager::DeleteFromQueue($this->user_id, 'IM_MESS_' . $fromUserId);
CPullStack::AddByUser($this->user_id, array('module_id' => 'im', 'command' => 'readMessage', 'params' => array('chatId' => intval($arRes['CHAT_ID']), 'senderId' => $this->user_id, 'id' => $fromUserId, 'userId' => $fromUserId, 'lastId' => $lastId)));
}
return true;
}
return false;
}
开发者ID:k-kalashnikov,项目名称:geekcon_new,代码行数:32,代码来源:im_message.php
示例16: CancelRatingVote
public static function CancelRatingVote($arParam)
{
global $DB, $CACHE_MANAGER;
$err_mess = CRatings::err_mess() . "<br>Function: CancelRatingVote<br>Line: ";
$sqlStr = "\n\t\t\tSELECT\n\t\t\t\tRVG.ID,\n\t\t\t\tRV.ID AS VOTE_ID,\n\t\t\t\tRV.VALUE AS VOTE_VALUE,\n\t\t\t\tRVG.TOTAL_POSITIVE_VOTES\n\t\t\tFROM\n\t\t\t\tb_rating_voting RVG,\n\t\t\t\tb_rating_vote RV\n\t\t\tWHERE\n\t\t\t\tRVG.ENTITY_TYPE_ID = '" . $DB->ForSql($arParam['ENTITY_TYPE_ID']) . "'\n\t\t\tand RVG.ENTITY_ID = " . intval($arParam['ENTITY_ID']) . "\n\t\t\tand RVG.ID = RV.RATING_VOTING_ID\n\t\t\tand RV.USER_ID = " . intval($arParam['USER_ID']);
$res = $DB->Query($sqlStr, false, $err_mess . __LINE__);
if ($arVote = $res->Fetch()) {
$votePlus = $arVote['VOTE_VALUE'] >= 0 ? true : false;
$arFields = array('TOTAL_VOTES' => "TOTAL_VOTES-1", 'TOTAL_VALUE' => "TOTAL_VALUE" . ($votePlus ? '-' . floatval($arVote['VOTE_VALUE']) : '+' . floatval(-1 * $arVote['VOTE_VALUE'])), 'LAST_CALCULATED' => $DB->GetNowFunction());
$arFields[$votePlus ? 'TOTAL_POSITIVE_VOTES' : 'TOTAL_NEGATIVE_VOTES'] = $votePlus ? 'TOTAL_POSITIVE_VOTES-1' : 'TOTAL_NEGATIVE_VOTES-1';
$DB->Update("b_rating_voting", $arFields, "WHERE ID=" . intval($arVote['ID']), $err_mess . __LINE__);
$DB->Query("DELETE FROM b_rating_vote WHERE ID=" . intval($arVote['VOTE_ID']), false, $err_mess . __LINE__);
foreach (GetModuleEvents("main", "OnCancelRatingVote", true) as $arEvent) {
ExecuteModuleEventEx($arEvent, array(intval($arVote['VOTE_ID']), $arParam));
}
if (CModule::IncludeModule('pull')) {
CPullStack::AddShared(array('module_id' => 'main', 'command' => 'rating_vote', 'params' => array("TYPE" => "CANCEL", "USER_ID" => intval($arParam['USER_ID']), "ENTITY_TYPE_ID" => $arParam["ENTITY_TYPE_ID"], "ENTITY_ID" => intval($arParam['ENTITY_ID']), "TOTAL_POSITIVE_VOTES" => intval($arVote['TOTAL_POSITIVE_VOTES'] + ($votePlus ? -1 : 1)), "RESULT" => $votePlus ? 'PLUS' : 'MINUS')));
}
if (CACHED_b_rating_vote !== false) {
$bucket_size = intval(CACHED_b_rating_bucket_size);
if ($bucket_size <= 0) {
$bucket_size = 100;
}
$bucket = intval(intval($arParam['ENTITY_ID']) / $bucket_size);
$CACHE_MANAGER->Clean("b_rvg_" . $DB->ForSql($arParam["ENTITY_TYPE_ID"]) . $bucket, "b_rating_voting");
}
return true;
}
return false;
}
开发者ID:andy-profi,项目名称:bxApiDocs,代码行数:30,代码来源:ratings.php
示例17: DeleteUser
public function DeleteUser($chatId, $userId, $checkPermission = true)
{
global $DB;
$chatId = intval($chatId);
$userId = intval($userId);
if ($chatId <= 0 || $userId <= 0) {
$GLOBALS["APPLICATION"]->ThrowException(GetMessage("IM_ERROR_EMPTY_USER_OR_CHAT"), "EMPTY_USER_OR_CHAT");
return false;
}
$strSql = "\n\t\t\tSELECT R.CHAT_ID, C.TITLE CHAT_TITLE, C.AUTHOR_ID CHAT_AUTHOR_ID\n\t\t\tFROM b_im_relation R LEFT JOIN b_im_chat C ON R.CHAT_ID = C.ID\n\t\t\tWHERE R.USER_ID = " . $userId . " AND R.MESSAGE_TYPE = '" . IM_MESSAGE_GROUP . "' AND R.CHAT_ID = " . $chatId;
$dbRes = $DB->Query($strSql, false, "File: " . __FILE__ . "<br>Line: " . __LINE__);
if ($arRes = $dbRes->Fetch()) {
$chatTitle = $arRes['CHAT_TITLE'];
$chatAuthorId = intval($arRes['CHAT_AUTHOR_ID']);
if ($chatAuthorId == $userId) {
$strSql = "\n\t\t\t\t\tSELECT R.USER_ID\n\t\t\t\t\tFROM b_im_relation R\n\t\t\t\t\tWHERE R.CHAT_ID = " . $chatId . " AND R.USER_ID <> " . $chatAuthorId;
$strSql = $DB->TopSql($strSql, 1);
$dbRes = $DB->Query($strSql, false, "File: " . __FILE__ . "<br>Line: " . __LINE__);
if ($arRes = $dbRes->Fetch()) {
$strSql = "UPDATE b_im_chat SET AUTHOR_ID = " . $arRes['USER_ID'] . " WHERE ID = " . $chatId;
$DB->Query($strSql, false, "File: " . __FILE__ . "<br>Line: " . __LINE__);
}
}
$bSelf = true;
$arUsers = array($userId);
if (is_object($GLOBALS["USER"]) && $GLOBALS["USER"]->GetId() != $userId) {
if ($checkPermission && $chatAuthorId != $GLOBALS["USER"]->GetId()) {
$GLOBALS["APPLICATION"]->ThrowException(GetMessage("IM_ERROR_KICK"), "IM_ERROR_KICK");
return false;
}
$bSelf = false;
$arUsers[] = $GLOBALS["USER"]->GetId();
}
$arSelect = array("ID", "LAST_NAME", "NAME", "LOGIN", "SECOND_NAME", "PERSONAL_GENDER");
$dbUsers = CUser::GetList($sort_by = false, $dummy = '', array('ID' => implode('|', $arUsers)), array('FIELDS' => $arSelect));
$arUsers = array();
while ($arUser = $dbUsers->Fetch()) {
$arUsers[$arUser['ID']]['NAME'] = CUser::FormatName(CSite::GetNameFormat(false), $arUser, true, false);
$arUsers[$arUser['ID']]['GENDER'] = $arUser["PERSONAL_GENDER"] == 'F' ? 'F' : 'M';
}
if ($bSelf) {
$message = GetMessage("IM_CHAT_LEAVE_" . $arUsers[$userId]['GENDER'], array('#USER_NAME#' => $arUsers[$userId]['NAME']));
} else {
$message = GetMessage("IM_CHAT_KICK_" . $arUsers[$GLOBALS["USER"]->GetId()]['GENDER'], array('#USER_1_NAME#' => $arUsers[$GLOBALS["USER"]->GetId()]['NAME'], '#USER_2_NAME#' => $arUsers[$userId]['NAME']));
}
$arOldRelation = array();
if (CModule::IncludeModule("pull")) {
$arOldRelation = CIMChat::GetRelationById($chatId);
}
$CIMChat = new CIMChat($userId);
$CIMChat->SetReadMessage($chatId);
CIMContactList::CleanChatCache($userId);
$strSql = "DELETE FROM b_im_relation WHERE CHAT_ID = " . $chatId . " AND USER_ID = " . $userId;
$DB->Query($strSql, false, "File: " . __FILE__ . "<br>Line: " . __LINE__);
CIMDisk::ChangeFolderMembers($chatId, $userId, false);
self::AddMessage(array("TO_CHAT_ID" => $chatId, "MESSAGE" => $message, "FROM_USER_ID" => $this->user_id, "SYSTEM" => 'Y'));
foreach ($arOldRelation as $rel) {
CPullStack::AddByUser($rel['USER_ID'], array('module_id' => 'im', 'command' => 'chatUserLeave', 'params' => array('chatId' => $chatId, 'chatTitle' => $chatTitle, 'userId' => $userId, 'message' => $bSelf ? '' : htmlspecialcharsbx($message))));
}
CIMContactList::DeleteRecent($chatId, true, $userId);
return true;
}
$GLOBALS["APPLICATION"]->ThrowException(GetMessage("IM_ERROR_USER_NOT_FOUND"), "USER_NOT_FOUND");
return false;
}
开发者ID:vim84,项目名称:b-markt,代码行数:65,代码来源:im_chat.php
示例18: OnAfterUserLogout
public static function OnAfterUserLogout($arParams)
{
if (!CPullOptions::GetQueueServerStatus())
return false;
if ($arParams['USER_ID'] <= 0)
return false;
$arParams['USER_ID'] = intval($arParams['USER_ID']);
if (isset($_SESSION['USER_LAST_LOGOUT_'.$arParams['USER_ID']])
&& intval($_SESSION['USER_LAST_LOGOUT_'.$arParams['USER_ID']])+100 > time())
return false;
$_SESSION['USER_LAST_LOGOUT_'.$arParams['USER_ID']] = time();
unset($_SESSION['USER_LAST_AUTH_'.$arParams['USER_ID']]);
$arChannel = CPullChannel::GetChannel($arParams['USER_ID']);
$result = CPullChannel::Send($arChannel['CHANNEL_ID'], 'ping', 'GET', 5, false);
if (is_object($result) && isset($result->infos[0]))
{
$sendOffline = $result->infos[0]->subscribers > 0? false: true;
}
else
{
$sendOffline = true;
}
if ($sendOffline)
{
CPullStack::AddShared(Array(
'module_id' => 'online',
'command' => 'user_offline',
'params' => Array(
'USER_ID' => $arParams['USER_ID']
),
));
}
return true;
}
开发者ID:ASDAFF,项目名称:1C_Bitrix_info_site,代码行数:41,代码来源:pull_channel.php
示例19: AddToStack
public static function AddToStack($tag, $arMessage)
{
global $DB;
$arPush = array();
if (isset($arMessage['push'])) {
$arPush = $arMessage['push'];
unset($arMessage['push']);
}
$channels = array();
$strSql = "\n\t\t\t\tSELECT pc.CHANNEL_ID, pc.USER_ID\n\t\t\t\tFROM b_pull_watch pw\n\t\t\t\tLEFT JOIN b_pull_channel pc ON pw.USER_ID = pc.USER_ID\n\t\t\t\tWHERE pw.TAG = '" . $DB->ForSQL($tag) . "'\n\t\t";
$dbRes = $DB->Query($strSql, false, "File: " . __FILE__ . "<br>Line: " . __LINE__);
while ($arRes = $dbRes->Fetch()) {
$channels[$arRes['USER_ID']] = $arRes['CHANNEL_ID'];
}
$result = CPullStack::AddByChannel($channels, $arMessage);
if ($result && !empty($arPush) && (isset($arPush['advanced_params']) || isset($arPush['message']) && strlen($arPush['message']) > 0)) {
$CPushManager = new CPushManager();
$pushUsers = array();
foreach ($channels as $userId => $channelId) {
if (isset($arPush['skip_users']) && in_array($userId, $arPush['skip_users'])) {
continue;
}
$pushUsers[] = $userId;
}
$CPushManager->AddQueue(array('USER_ID' => $pushUsers, 'MESSAGE' => str_replace("\n", " ", $arPush['message']), 'PARAMS' => $arPush['params'], 'ADVANCED_PARAMS' => isset($arPush['advanced_params']) ? $arPush['advanced_params'] : array(), 'BADGE' => isset($arPush['badge']) ? intval($arPush['badge']) : '', 'SOUND' => isset($arPush['sound']) ? $arPush['sound'] : '', 'TAG' => isset($arPush['tag']) ? $arPush['tag'] : '', 'SUB_TAG' => isset($arPush['sub_tag']) ? $arPush['sub_tag'] : '', 'APP_ID' => isset($arPush['app_id']) ? $arPush['app_id'] : '', 'SEND_IMMEDIATELY' => isset($arPush['send_immediately']) && $arPush['send_immediately'] == 'Y' ? 'Y' : 'N'));
}
return true;
}
开发者ID:DarneoStudio,项目名称:bitrix,代码行数:28,代码来源:pull_watch.php
示例20: SendPullEvent
public static function SendPullEvent($params)
{
// TODO check $params
if (!CModule::IncludeModule('pull') || !CPullOptions::GetQueueServ
|
请发表评论