Example #1
0
 public static function GetUnsendMessage($order = "ASC")
 {
     global $DB;
     CTimeZone::Disable();
     $strSql = "\n\t\t\tSELECT\n\t\t\t\tM.ID,\n\t\t\t\tM.CHAT_ID,\n\t\t\t\tM.MESSAGE,\n\t\t\t\tM.MESSAGE_OUT,\n\t\t\t\t" . $DB->DatetimeToTimestampFunction('M.DATE_CREATE') . " DATE_CREATE,\n\t\t\t\tM.EMAIL_TEMPLATE,\n\t\t\t\tR.LAST_SEND_ID,\n\t\t\t\tR.USER_ID TO_USER_ID,\n\t\t\t\tU1.ACTIVE TO_USER_ACTIVE,\n\t\t\t\tU1.LOGIN TO_USER_LOGIN,\n\t\t\t\tU1.NAME TO_USER_NAME,\n\t\t\t\tU1.LAST_NAME TO_USER_LAST_NAME,\n\t\t\t\tU1.EMAIL TO_USER_EMAIL,\n\t\t\t\tU1.LID TO_USER_LID,\n\t\t\t\tU1.AUTO_TIME_ZONE AUTO_TIME_ZONE,\n\t\t\t\tU1.TIME_ZONE TIME_ZONE,\n\t\t\t\tU1.TIME_ZONE_OFFSET TIME_ZONE_OFFSET,\n\t\t\t\tM.AUTHOR_ID FROM_USER_ID,\n\t\t\t\tU2.LOGIN FROM_USER_LOGIN,\n\t\t\t\tU2.NAME FROM_USER_NAME,\n\t\t\t\tU2.LAST_NAME FROM_USER_LAST_NAME\n\t\t\tFROM b_im_relation R\n\t\t\tINNER JOIN b_im_message M ON M.ID > R.LAST_ID AND M.ID > R.LAST_SEND_ID AND M.CHAT_ID = R.CHAT_ID AND IMPORT_ID IS NULL AND R.USER_ID != M.AUTHOR_ID\n\t\t\tLEFT JOIN b_user U1 ON U1.ID = R.USER_ID\n\t\t\tLEFT JOIN b_user U2 ON U2.ID = M.AUTHOR_ID\n\t\t\tWHERE R.MESSAGE_TYPE = '" . IM_MESSAGE_PRIVATE . "' AND R.STATUS < " . IM_STATUS_NOTIFY . "\n\t\t\t" . ($order == "DESC" ? "ORDER BY DATE_CREATE DESC, ID DESC" : "") . "\n\t\t";
     CTimeZone::Enable();
     $dbRes = $DB->Query($strSql, false, "File: " . __FILE__ . "<br>Line: " . __LINE__);
     $arMessages = array();
     while ($arRes = $dbRes->Fetch()) {
         $arRes["DATE_CREATE"] = $arRes["DATE_CREATE"] + CIMMail::GetUserOffset($arRes);
         $arMessages[$arRes['ID']] = $arRes;
     }
     return $arMessages;
 }
Example #2
0
			{
				foreach ($_POST['FM'] as $userId => $data)
					foreach ($data as $key => $value)
						$_SESSION['IM_FLASHED_MESSAGE'][$key] = $key;
			}
		}

		$bOpenMessenger = isset($_POST['OPEN_MESSENGER']) && intval($_POST['OPEN_MESSENGER']) == 1? true: false;

		// Online
		$arOnline = CIMStatus::GetList();

		// Counters
		$arResult["COUNTERS"] = CUserCounter::GetValues($USER->GetID(), $_POST['SITE_ID']);

		if (CIMMail::IsExternalMailAvailable())
		{
			$arResult["MAIL_COUNTER"] = intval($arResult["COUNTERS"]["mail_unseen"]);
		}
		else if (CModule::IncludeModule("dav"))
		{
			// Exchange
			$ar = CDavExchangeMail::GetTicker($GLOBALS["USER"]);
			if ($ar !== null)
				$arResult["MAIL_COUNTER"] = intval($ar["numberOfUnreadMessages"]);
		}

		$arSend = Array(
			'REVISION' => $arResult["REVISION"],
			'MOBILE_REVISION' => $arResult["MOBILE_REVISION"],
			'DISK_REVISION' => $arResult["DISK_REVISION"],
Example #3
0
 public static function GetUnsendNotify()
 {
     global $DB;
     $strSqlRelation = "\n\t\t\tSELECT\n\t\t\t\tR.CHAT_ID,\n\t\t\t\tR.LAST_SEND_ID,\n\t\t\t\tR.USER_ID TO_USER_ID,\n\t\t\t\tU1.LOGIN TO_USER_LOGIN,\n\t\t\t\tU1.NAME TO_USER_NAME,\n\t\t\t\tU1.LAST_NAME TO_USER_LAST_NAME,\n\t\t\t\tU1.SECOND_NAME TO_USER_SECOND_NAME,\n\t\t\t\tU1.EMAIL TO_USER_EMAIL,\n\t\t\t\tU1.ACTIVE TO_USER_ACTIVE,\n\t\t\t\tU1.LID TO_USER_LID,\n\t\t\t\tU1.AUTO_TIME_ZONE AUTO_TIME_ZONE,\n\t\t\t\tU1.TIME_ZONE TIME_ZONE,\n\t\t\t\tU1.TIME_ZONE_OFFSET TIME_ZONE_OFFSET\n\t\t\tFROM b_im_relation R\n\t\t\tLEFT JOIN b_user U1 ON U1.ID = R.USER_ID\n\t\t\tWHERE R.MESSAGE_TYPE = '" . IM_MESSAGE_SYSTEM . "' AND R.STATUS < " . IM_STATUS_NOTIFY . "\n\t\t";
     $dbResRelation = $DB->Query($strSqlRelation, false, "File: " . __FILE__ . "<br>Line: " . __LINE__);
     $arNotify = array();
     CTimeZone::Disable();
     while ($arResRelation = $dbResRelation->Fetch()) {
         $strSql = "\n\t\t\t\tSELECT\n\t\t\t\t\tM.ID,\n\t\t\t\t\tM.CHAT_ID,\n\t\t\t\t\tM.MESSAGE,\n\t\t\t\t\tM.MESSAGE_OUT,\n\t\t\t\t\t" . $DB->DatetimeToTimestampFunction('M.DATE_CREATE') . "+" . CIMMail::GetUserOffset($arResRelation) . " DATE_CREATE,\n\t\t\t\t\tM.NOTIFY_TYPE,\n\t\t\t\t\tM.NOTIFY_MODULE,\n\t\t\t\t\tM.NOTIFY_EVENT,\n\t\t\t\t\tM.NOTIFY_TITLE,\n\t\t\t\t\tM.NOTIFY_BUTTONS,\n\t\t\t\t\tM.NOTIFY_TAG,\n\t\t\t\t\tM.NOTIFY_SUB_TAG,\n\t\t\t\t\tM.EMAIL_TEMPLATE,\n\t\t\t\t\tM.AUTHOR_ID FROM_USER_ID,\n\t\t\t\t\tU2.LOGIN FROM_USER_LOGIN,\n\t\t\t\t\tU2.NAME FROM_USER_NAME,\n\t\t\t\t\tU2.LAST_NAME FROM_USER_LAST_NAME,\n\t\t\t\t\tU2.SECOND_NAME FROM_USER_SECOND_NAME\n\t\t\t\tFROM b_im_message M\n\t\t\t\tLEFT JOIN b_user U2 ON U2.ID = M.AUTHOR_ID\n\t\t\t\tWHERE M.ID > " . intval($arResRelation['LAST_SEND_ID']) . " AND M.CHAT_ID = " . intval($arResRelation['CHAT_ID']) . "\n\t\t\t\tORDER BY ID DESC\n\t\t\t";
         $strSql = $DB->TopSql($strSql, 200);
         $dbRes = $DB->Query($strSql, false, "File: " . __FILE__ . "<br>Line: " . __LINE__);
         while ($arRes = $dbRes->Fetch()) {
             $arRes = array_merge($arRes, $arResRelation);
             $arNotify[$arRes['ID']] = $arRes;
         }
         if (count($arNotify) > 5000) {
             break;
         }
     }
     CTimeZone::Enable();
     return $arNotify;
 }