public static function OnEpilog() { if (!defined('BX_PULL_SKIP_INIT') && !(isset($_REQUEST['AJAX_CALL']) && $_REQUEST['AJAX_CALL'] == 'Y') && $GLOBALS['USER'] && intval($GLOBALS['USER']->GetID()) > 0 && CModule::IncludeModule('pull')) { define("BX_PULL_SKIP_INIT", true); if (CPullOptions::CheckNeedRun()) { CJSCore::Init(array('pull')); $pullConfig = CPullChannel::GetConfig($GLOBALS['USER']->GetID()); global $APPLICATION; $APPLICATION->AddAdditionalJS('<script type="text/javascript">BX.bind(window, "load", function() { BX.PULL.start(' . (empty($pullConfig) ? '' : CUtil::PhpToJsObject($pullConfig)) . '); });</script>'); /* if(!defined("BX_DESKTOP") && !defined("BX_MOBILE") && !defined("ADMIN_SECTION") && !IsModuleInstalled('b24network') && IsModuleInstalled('bitrix24') && (COption::GetOptionString('bitrix24', 'network', 'N') == 'Y')) { CJSCore::Init(array('npull')); $APPLICATION->AddAdditionalJS('<script type="text/javascript">BX.bind(window, "load", function() { BX.NPULL.start(); });</script>'); } */ } } }
if ($userId <= 0) { // TODO need change AUTHORIZE ERROR callbacks //header("HTTP/1.0 401 Not Authorized"); //header("Content-Type: application/x-javascript"); //header("BX-Authorize: ".bitrix_sessid()); echo CUtil::PhpToJsObject(array('ERROR' => 'AUTHORIZE_ERROR', 'BITRIX_SESSID' => bitrix_sessid())); CMain::FinalActions(); die; } } else { $userId = PULL_USER_ID; } if (check_bitrix_sessid()) { if ($_POST['PULL_GET_CHANNEL'] == 'Y') { session_write_close(); $arConfig = CPullChannel::GetConfig($userId, $_POST['CACHE'] == 'Y', $_POST['CACHE'] == 'Y' ? false : true, $_POST['MOBILE'] == 'Y'); if (is_array($arConfig)) { echo CUtil::PhpToJsObject($arConfig); } else { echo CUtil::PhpToJsObject(array('ERROR' => 'ERROR_OPEN_CHANNEL')); } } elseif ($_POST['PULL_UPDATE_WATCH'] == 'Y') { foreach ($_POST['WATCH'] as $tag) { CPullWatch::Extend($userId, $tag); } echo CUtil::PhpToJsObject(array('ERROR' => '')); } elseif ($_POST['PULL_UPDATE_STATE'] == 'Y') { $arMessage = CPullStack::Get($_POST['CHANNEL_ID'], intval($_POST['CHANNEL_LAST_ID'])); $arResult["COUNTERS"] = CUserCounter::GetAllValues($userId); if (!empty($arResult["COUNTERS"])) { $arMessage[] = array('module_id' => 'main', 'command' => 'user_counter', 'params' => $arResult["COUNTERS"]);
$arSend = Array( 'REVISION' => $arResult["REVISION"], 'MOBILE_REVISION' => $arResult["MOBILE_REVISION"], 'DISK_REVISION' => $arResult["DISK_REVISION"], 'USER_ID' => $USER->GetId(), 'ONLINE' => !empty($arOnline)? $arOnline['users']: array(), 'COUNTERS' => $arResult["COUNTERS"], 'MAIL_COUNTER' => $arResult["MAIL_COUNTER"], 'SERVER_TIME' => time(), 'ERROR' => "" ); if (CModule::IncludeModule('pull')) { $arPullConfig = CPullChannel::GetConfig($USER->GetId(), ($_POST['CACHE'] == 'Y'), false, ($_POST['MOBILE'] == 'Y')); if (is_array($arPullConfig)) { $arSend['PULL_CONFIG'] = $arPullConfig; } } if ($bOpenMessenger && $_POST['TAB'] != 0) CIMMessenger::SetCurrentTab($_POST['TAB']); $CIMMessage = new CIMMessage(); $arMessage = $CIMMessage->GetUnreadMessage(Array( 'USE_TIME_ZONE' => 'N', 'ORDER' => 'ASC' )); if ($arMessage['result']) {
die; } if (isset($_REQUEST['AJAX_CALL']) && $_REQUEST['AJAX_CALL'] == 'Y') { return; } if (!CModule::IncludeModule('pull')) { return; } if (defined('BX_PULL_SKIP_INIT')) { return; } $userId = 0; if (defined('PULL_USER_ID')) { $userId = PULL_USER_ID; } else { if ($GLOBALS['USER'] && intval($GLOBALS['USER']->GetID()) > 0) { $userId = intval($GLOBALS['USER']->GetID()); } } if ($userId == 0) { return; } if (CPullOptions::CheckNeedRun()) { CJSCore::Init(array('pull')); $arResult = CPullChannel::GetConfig($userId); if (!(isset($arParams['TEMPLATE_HIDE']) && $arParams['TEMPLATE_HIDE'] == 'Y')) { define("BX_PULL_SKIP_INIT", true); $this->IncludeComponentTemplate(); } } return $arResult;
<?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('pull')) { return; } if (defined('BX_PULL_SKIP_INIT')) { return; } if (CPullOptions::CheckNeedRun()) { CJSCore::Init(array('pull')); $arResult = CPullChannel::GetConfig($GLOBALS['USER']->GetID()); if (!(isset($arParams['TEMPLATE_HIDE']) && $arParams['TEMPLATE_HIDE'] == 'Y')) { define("BX_PULL_SKIP_INIT", true); $this->IncludeComponentTemplate(); } } return $arResult;
public static function OnEpilog() { $userId = 0; if (defined('PULL_USER_ID')) { $userId = PULL_USER_ID; } else { if ($GLOBALS['USER'] && intval($GLOBALS['USER']->GetID()) > 0) { $userId = intval($GLOBALS['USER']->GetID()); } } if (!defined('BX_PULL_SKIP_INIT') && !(isset($_REQUEST['AJAX_CALL']) && $_REQUEST['AJAX_CALL'] == 'Y') && $userId != 0 && CModule::IncludeModule('pull')) { define("BX_PULL_SKIP_INIT", true); if (CPullOptions::CheckNeedRun()) { CJSCore::Init(array('pull')); $pullConfig = CPullChannel::GetConfig($userId); global $APPLICATION; $APPLICATION->AddAdditionalJS('<script type="text/javascript">BX.bind(window, "load", function() { BX.PULL.start(' . (empty($pullConfig) ? '' : CUtil::PhpToJsObject($pullConfig)) . '); });</script>'); } } }