Example #1
0
     $arNotify = $CIMNotify->GetUnreadNotify(array('SPEED_CHECK' => 'N', 'USE_TIME_ZONE' => 'N'));
     if ($arNotify['result']) {
         $arSend['NOTIFY'] = $arNotify['notify'];
         $arSend['UNREAD_NOTIFY'] = $arNotify['unreadNotify'];
         $arSend['FLASH_NOTIFY'] = CIMNotify::GetFlashNotify($arNotify['unreadNotify']);
         $arSend['ERROR'] = '';
         if ($arNotify['maxNotify'] > 0) {
             $CIMNotify->MarkNotifyRead($arNotify['maxNotify'], true);
         }
     }
     echo CUtil::PhpToJsObject($arSend);
 } else {
     if ($_POST['IM_NOTIFY_HISTORY_LOAD_MORE'] == 'Y') {
         $errorMessage = "";
         $CIMNotify = new CIMNotify();
         $arNotify = $CIMNotify->GetNotifyList(array('PAGE' => $_POST['PAGE'], 'USE_TIME_ZONE' => 'N'));
         echo CUtil::PhpToJsObject(array('NOTIFY' => $arNotify, 'ERROR' => $errorMessage));
     } else {
         if ($_POST['IM_SEND_MESSAGE'] == 'Y') {
             CUtil::decodeURIComponent($_POST);
             $tmpID = $_POST['ID'];
             if ($_POST['CHAT'] == 'Y') {
                 $ar = array("FROM_USER_ID" => intval($USER->GetID()), "TO_CHAT_ID" => intval(substr($_POST['RECIPIENT_ID'], 4)), "MESSAGE" => $_POST['MESSAGE'], "MESSAGE_TYPE" => IM_MESSAGE_GROUP);
             } else {
                 $ar = array("FROM_USER_ID" => intval($USER->GetID()), "TO_USER_ID" => intval($_POST['RECIPIENT_ID']), "MESSAGE" => $_POST['MESSAGE']);
             }
             $errorMessage = "";
             if (!($insertID = CIMMessage::Add($ar))) {
                 if ($e = $GLOBALS["APPLICATION"]->GetException()) {
                     $errorMessage = $e->GetString();
                 }
Example #2
0
<?php

if (!defined("B_PROLOG_INCLUDED") || B_PROLOG_INCLUDED !== true) {
    die;
}
if (isset($_REQUEST['AJAX_CALL']) && $_REQUEST['AJAX_CALL'] == 'Y') {
    return;
}
if (intval($USER->GetID()) <= 0) {
    return;
}
if (!CModule::IncludeModule('im')) {
    return;
}
$CIMNotify = new CIMNotify(false, array('hide_link' => false));
$arResult = $CIMNotify->GetNotifyList();
$GLOBALS["APPLICATION"]->SetPageProperty("BodyClass", "ml-notify");
$GLOBALS["APPLICATION"]->SetPageProperty("Viewport", "user-scalable=no, initial-scale=1.0, maximum-scale=1.0, width=290");
if (!(isset($arParams['TEMPLATE_HIDE']) && $arParams['TEMPLATE_HIDE'] == 'Y')) {
    $this->IncludeComponentTemplate();
}
return $arResult;