Esempio n. 1
0
					$arChannels[] = $arChannelShared['CHANNEL_ID'];
					if ($arChannel['CHANNEL_DT'] > $arChannelShared['CHANNEL_DT'])
						$arChannel['CHANNEL_DT'] = $arChannelShared['CHANNEL_DT'];
				}
			}
			if ($_POST['MOBILE'] == 'Y')
				$pullPath = ($nginxStatus? (CMain::IsHTTPS()? CPullOptions::GetListenSecureUrl($arChannels, true): CPullOptions::GetListenUrl($arChannels, true)): '/bitrix/components/bitrix/pull.request/ajax.php?UPDATE_STATE');
			else
				$pullPath = ($nginxStatus? (CMain::IsHTTPS()? CPullOptions::GetListenSecureUrl($arChannels): CPullOptions::GetListenUrl($arChannels)): '/bitrix/components/bitrix/pull.request/ajax.php?UPDATE_STATE');

			echo CUtil::PhpToJsObject(Array(
				'CHANNEL_ID' => implode('/', $arChannels),
				'CHANNEL_DT' => $arChannel['CHANNEL_DT'],
				'LAST_ID' => $pullChannel['LAST_ID'],
				'PATH' => $pullPath,
				'PATH_WS' => ($nginxStatus && $webSocketStatus? (CMain::IsHTTPS()? CPullOptions::GetWebSocketSecureUrl($arChannels): CPullOptions::GetWebSocketUrl($arChannels)): ''),
				'METHOD' => ($nginxStatus? 'LONG': 'PULL'),
				'REVISION' => PULL_REVISION,
				'ERROR' => '',
			));
		}
		else
			echo CUtil::PhpToJsObject(Array('ERROR' => 'ERROR_OPEN_CHANNEL'));
	}
	elseif ($_POST['PULL_UPDATE_WATCH'] == 'Y')
	{
		foreach ($_POST['WATCH'] as $tag)
			CPullWatch::Extend($USER->GetID(), $tag);

		echo CUtil::PhpToJsObject(Array('ERROR' => ''));
	}
Esempio n. 2
0
 /**
  * Return some information about P&P, such as publish url
  *
  * @since 14.5.4
  * @return array
  */
 protected static function getPullingInfo()
 {
     $result = array('enabled' => CModule::IncludeModule('pull') && CPullOptions::ModuleEnable());
     if ($result['enabled']) {
         $result['nginx_used'] = CPullOptions::GetQueueServerStatus();
         if ($result['nginx_used']) {
             $result['server_protocol'] = CPullOptions::GetQueueServerVersion();
             $result['publish_url'] = CPullOptions::GetPublishUrl();
             $result['pulling_url'] = CPullOptions::GetListenUrl();
             $result['pulling_url_secure'] = CPullOptions::GetListenSecureUrl();
             $result['websocket_url'] = CPullOptions::GetWebSocketUrl();
             $result['websocket_url_secure'] = CPullOptions::GetWebSocketSecureUrl();
         }
     }
     return $result;
 }
	public static function GetConfig($userId, $cache = true, $reopen = false, $mobile = false)
	{
		$pullConfig = Array();

		if (defined('BX_PULL_SKIP_LS'))
			$pullConfig['LOCAL_STORAGE'] = 'N';

		if (IsModuleInstalled('bitrix24'))
			$pullConfig['BITRIX24'] = 'Y';

		$arChannel = CPullChannel::Get($userId, $cache, $reopen);
		if (is_array($arChannel))
		{
			$nginxStatus = CPullOptions::GetQueueServerStatus();
			$webSocketStatus = false;

			$arChannels = Array($arChannel['CHANNEL_ID']);
			if ($nginxStatus)
			{
				if (defined('BX_PULL_SKIP_WEBSOCKET'))
				{
					$pullConfig['WEBSOCKET'] = 'N';
				}
				else
				{
					$webSocketStatus = CPullOptions::GetWebSocketStatus();
				}

				$arChannelShared = CPullChannel::GetShared($cache, $reopen);
				if (is_array($arChannelShared))
				{
					$arChannels[] = $arChannelShared['CHANNEL_ID'];
					$arChannel['CHANNEL_DT'] = $arChannel['CHANNEL_DT'].'/'.$arChannelShared['CHANNEL_DT'];
				}
			}
			if ($mobile || defined('BX_MOBILE') || defined('BX_PULL_MOBILE'))
			{
				$pullConfig['MOBILE'] = 'Y';
				$pullPath = ($nginxStatus? (CMain::IsHTTPS()? CPullOptions::GetListenSecureUrl($arChannels, true): CPullOptions::GetListenUrl($arChannels, true)): '/bitrix/components/bitrix/pull.request/ajax.php?UPDATE_STATE');
			}
			else
			{
				$pullPath = ($nginxStatus? (CMain::IsHTTPS()? CPullOptions::GetListenSecureUrl($arChannels): CPullOptions::GetListenUrl($arChannels)): '/bitrix/components/bitrix/pull.request/ajax.php?UPDATE_STATE');
			}

			$pullPathWs = ($nginxStatus && $webSocketStatus? (CMain::IsHTTPS()? CPullOptions::GetWebSocketSecureUrl($arChannels): CPullOptions::GetWebSocketUrl($arChannels)): '');

			return $pullConfig+Array(
				'CHANNEL_ID' => implode('/', $arChannels),
				'CHANNEL_DT' => $arChannel['CHANNEL_DT'],
				'LAST_ID' => $arChannel['LAST_ID'],
				'PATH' => $pullPath,
				'PATH_WS' => $pullPathWs,
				'PATH_COMMAND' => defined('BX_PULL_COMMAND_PATH')? BX_PULL_COMMAND_PATH: '',
				'METHOD' => ($nginxStatus? 'LONG': 'PULL'),
				'REVISION' => PULL_REVISION,
				'ERROR' => '',
			);
		}
		return false;
	}
Esempio n. 4
0
             $nginxStatus = CPullOptions::GetNginxStatus();
             $webSocketStatus = CPullOptions::GetWebSocketStatus();
             $arChannels = array($arChannel['CHANNEL_ID']);
             if ($nginxStatus) {
                 $arChannelShared = CPullChannel::GetShared();
                 $arChannels[] = $arChannelShared['CHANNEL_ID'];
                 if ($arChannel['CHANNEL_DT'] > $arChannelShared['CHANNEL_DT']) {
                     $arChannel['CHANNEL_DT'] = $arChannelShared['CHANNEL_DT'];
                 }
             }
             if ($_POST['MOBILE'] == 'Y') {
                 $pullPath = $nginxStatus ? CMain::IsHTTPS() ? CPullOptions::GetListenSecureUrl($arChannels, true) : CPullOptions::GetListenUrl($arChannels, true) : '/bitrix/components/bitrix/pull.request/ajax.php?UPDATE_STATE';
             } else {
                 $pullPath = $nginxStatus ? CMain::IsHTTPS() ? CPullOptions::GetListenSecureUrl($arChannels) : CPullOptions::GetListenUrl($arChannels) : '/bitrix/components/bitrix/pull.request/ajax.php?UPDATE_STATE';
             }
             $arResult['PULL_CONFIG'] = array('CHANNEL_ID' => implode('/', $arChannels), 'CHANNEL_DT' => $arChannel['CHANNEL_DT'], 'PATH' => $pullPath, 'PATH_WS' => $nginxStatus && $webSocketStatus ? CMain::IsHTTPS() ? CPullOptions::GetWebSocketSecureUrl($arChannels) : CPullOptions::GetWebSocketUrl($arChannels) : '', 'METHOD' => $nginxStatus ? 'LONG' : 'PULL', 'ERROR' => '');
         }
     }
     // Counters
     $arLastDate = array();
     $arResult["COUNTERS"] = CUserCounter::GetValues($USER->GetID(), $_POST['SITE_ID'], $arLastDate);
     $arResult["COUNTERS_ZERO_DATE"] = isset($arLastDate[$USER->GetID()]) && isset($arLastDate[$USER->GetID()][$_POST['SITE_ID']]) ? $arLastDate[$USER->GetID()][$_POST['SITE_ID']] : array();
     $arResult["ERROR"] = $errorMessage;
     echo CUtil::PhpToJsObject($arResult);
 } else {
     if ($_POST['IM_NOTIFY_LOAD'] == 'Y') {
         $CIMNotify = new CIMNotify();
         $arNotify = $CIMNotify->GetUnreadNotify(array('SPEED_CHECK' => 'N', 'USE_TIME_ZONE' => 'N'));
         if ($arNotify['result']) {
             $arSend['NOTIFY'] = $arNotify['notify'];
             $arSend['UNREAD_NOTIFY'] = $arNotify['unreadNotify'];
Esempio n. 5
0
	</tr>
	<tr>
		<td width="40%"></td>
		<td width="60%"></td>
	</tr>
	<tr>
		<td align="right" width="50%"><?=GetMessage("PULL_OPTIONS_WEBSOCKET")?>:</td>
		<td><input type="checkbox" size="40" value="Y" <?=(CPullOptions::GetWebSocket()?' checked':'')?> id="config_websocket" name="websocket" <?=(CPullOptions::GetQueueServerStatus() && CPullOptions::GetQueueServerVersion() > 1 ? '': 'disabled="true"')?>></td>
	</tr>
	<tr>
		<td ><?=GetMessage("PULL_OPTIONS_PATH_TO_WEBSOCKET")?>:</td>
		<td><input id="config_path_to_websocket" type="text" size="40" value="<?=htmlspecialcharsbx(CPullOptions::GetWebSocketUrl())?>" name="path_to_websocket" <?=(!CPullOptions::GetQueueServerStatus() || !CPullOptions::GetWebSocketStatus() ? 'disabled="true"': '')?></td>
	</tr>
	<tr>
		<td ><?=GetMessage("PULL_OPTIONS_PATH_TO_WEBSOCKET_SECURE")?>:</td>
		<td><input id="config_path_to_websocket_secure" type="text" size="40" value="<?=htmlspecialcharsbx(CPullOptions::GetWebSocketSecureUrl())?>" name="path_to_websocket_secure" <?=(!CPullOptions::GetQueueServerStatus() || !CPullOptions::GetWebSocketStatus() ? 'disabled="true"': '')?></td>
	</tr>
	<tr>
		<td width="40%"></td>
		<td width="60%">
			<?=GetMessage("PULL_OPTIONS_WEBSOCKET_DESC")?>
		</td>
	</tr>
	<tr>
		<td width="40%"></td>
		<td width="60%"></td>
	</tr>
	<tr>
		<td width="40%"></td>
		<td width="60%"></td>
	</tr>
Esempio n. 6
0
:</td>
		<td><input id="config_path_to_websocket" type="text" size="40" value="<?php 
echo htmlspecialcharsbx(CPullOptions::GetWebSocketUrl());
?>
" name="path_to_websocket" <?php 
echo !CPullOptions::GetQueueServerStatus() || !CPullOptions::GetWebSocketStatus() ? 'disabled="true"' : '';
?>
</td>
	</tr>
	<tr>
		<td ><?php 
echo GetMessage("PULL_OPTIONS_PATH_TO_LISTENER_SECURE");
?>
:</td>
		<td><input id="config_path_to_websocket_secure" type="text" size="40" value="<?php 
echo htmlspecialcharsbx(CPullOptions::GetWebSocketSecureUrl());
?>
" name="path_to_websocket_secure" <?php 
echo !CPullOptions::GetQueueServerStatus() || !CPullOptions::GetWebSocketStatus() ? 'disabled="true"' : '';
?>
</td>
	</tr>
	<tr>
		<td width="40%"></td>
		<td width="60%">
			<?php 
echo GetMessage("PULL_OPTIONS_WEBSOCKET_DESC");
?>
		</td>
	</tr>
	<?php 
Esempio n. 7
0
 public static function GetUserConfig($userId)
 {
     $pullConfig = array();
     if (defined('BX_PULL_SKIP_LS')) {
         $pullConfig['LOCAL_STORAGE'] = 'N';
     }
     if (IsModuleInstalled('bitrix24')) {
         $pullConfig['BITRIX24'] = 'Y';
     }
     $pullChannel = CPullChannel::Get($userId);
     if (is_array($pullChannel)) {
         $pullWebSocketStatus = false;
         $pullNginxStatus = CPullOptions::GetQueueServerStatus();
         $pullChannels = array($pullChannel['CHANNEL_ID']);
         if ($pullNginxStatus) {
             if (defined('BX_PULL_SKIP_WEBSOCKET')) {
                 $pullWebSocketStatus = false;
                 $pullConfig['WEBSOCKET'] = 'N';
             } else {
                 $pullWebSocketStatus = CPullOptions::GetWebSocketStatus();
             }
             $pullChannelShared = CPullChannel::GetShared();
             if (is_array($pullChannelShared)) {
                 $pullChannels[] = $pullChannelShared['CHANNEL_ID'];
                 if ($pullChannel['CHANNEL_DT'] > $pullChannelShared['CHANNEL_DT']) {
                     $pullChannel['CHANNEL_DT'] = $pullChannelShared['CHANNEL_DT'];
                 }
             }
         }
         if (defined('BX_MOBILE') || defined('BX_PULL_MOBILE')) {
             $pullConfig['MOBILE'] = 'Y';
             $pullPath = $pullNginxStatus ? CMain::IsHTTPS() ? CPullOptions::GetListenSecureUrl($pullChannels, true) : CPullOptions::GetListenUrl($pullChannels, true) : '/bitrix/components/bitrix/pull.request/ajax.php?UPDATE_STATE';
         } else {
             $pullPath = $pullNginxStatus ? CMain::IsHTTPS() ? CPullOptions::GetListenSecureUrl($pullChannels) : CPullOptions::GetListenUrl($pullChannels) : '/bitrix/components/bitrix/pull.request/ajax.php?UPDATE_STATE';
         }
         $pullConfig = $pullConfig + array('CHANNEL_ID' => implode('/', $pullChannels), 'LAST_ID' => $pullChannel['LAST_ID'], 'CHANNEL_DT' => $pullChannel['CHANNEL_DT'], 'PATH' => $pullPath, 'PATH_WS' => $pullNginxStatus && $pullWebSocketStatus ? CMain::IsHTTPS() ? CPullOptions::GetWebSocketSecureUrl($pullChannels) : CPullOptions::GetWebSocketUrl($pullChannels) : '', 'PATH_COMMAND' => defined('BX_PULL_COMMAND_PATH') ? BX_PULL_COMMAND_PATH : '', 'METHOD' => $pullNginxStatus ? 'LONG' : 'PULL');
     }
     return $pullConfig;
 }