本文整理汇总了PHP中CPullOptions::GetNginxStatus方法的典型用法代码示例。如果您正苦于以下问题:PHP CPullOptions::GetNginxStatus方法的具体用法?PHP CPullOptions::GetNginxStatus怎么用?PHP CPullOptions::GetNginxStatus使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CPullOptions
的用法示例。
在下文中一共展示了CPullOptions::GetNginxStatus方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: Add
public static function Add($userId)
{
global $DB, $APPLICATION;
$channelId = md5(uniqid().$_SERVER["REMOTE_ADDR"].$_SERVER["SERVER_NAME"].(is_object($APPLICATION)? $APPLICATION->GetServerUniqID(): ''));
$arParams = Array(
'USER_ID' => intval($userId),
'CHANNEL_ID' => $channelId,
'LAST_ID' => 0,
'~DATE_CREATE' => $DB->CurrentTimeFunction(),
);
$result = IntVal($DB->Add("b_pull_channel", $arParams, Array()));
if (CPullOptions::GetNginxStatus())
{
$result = false;
$arData = Array(
'module_id' => 'pull',
'command' => 'open',
'params' => Array(),
);
$CHTTP = new CHTTP();
$CHTTP->http_timeout = 10;
if ($CHTTP->HTTPQuery('POST', CPullOptions::GetPublishUrl($channelId), CUtil::PhpToJsObject(Array('MESSAGE' => Array($arData), 'ERROR' => ''))))
$result = $CHTTP->result;
}
return ($result? $channelId: false);
}
示例2: AddByChannel
public static function AddByChannel($channelId, $arMessage)
{
global $DB;
if (strlen($arMessage['module_id'])<=0 || strlen($arMessage['command'])<=0)
return false;
$arData = Array(
'module_id' => $arMessage['module_id'],
'command' => $arMessage['command'],
'params' => is_array($arMessage['params'])?$arMessage['params']: Array(),
);
if (CPullOptions::GetNginxStatus())
{
$message = CUtil::PhpToJsObject(Array('CHANNEL_ID' => $channelId, 'MESSAGE' => Array($arData), 'ERROR' => ''));
if (!defined('BX_UTF') || !BX_UTF)
$message = $GLOBALS['APPLICATION']->ConvertCharset($message, SITE_CHARSET,'utf-8');
$CHTTP = new CHTTP();
$CHTTP->http_timeout = 10;
if ($CHTTP->HTTPQuery('POST', CPullOptions::GetPublishUrl($channelId), str_replace("\n", " ", $message)))
$result = $CHTTP->result;
}
else
{
$arParams = Array(
'CHANNEL_ID' => $channelId,
'MESSAGE' => str_replace("\n", " ", serialize($arData)),
'~DATE_CREATE' => $DB->CurrentTimeFunction(),
);
$id = IntVal($DB->Add("b_pull_stack", $arParams, Array("MESSAGE")));
$result = $id? '{"channel": "'.$channelId.'", "id": "'.$id.'"}': false;
}
if (isset($arMessage['push_text']) && strlen($arMessage['push_text'])>0
&& isset($arMessage['push_user']) && intval($arMessage['push_user'])>0)
{
$CPushManager = new CPushManager();
$CPushManager->AddQueue(Array(
'USER_ID' => $arMessage['push_user'],
'MESSAGE' => str_replace("\n", " ", $arMessage['push_text']),
'PARAMS' => $arMessage['push_params'],
'TAG' => isset($arMessage['push_tag'])? $arMessage['push_tag']: '',
));
}
return $result;
}
示例3: AddByChannel
public static function AddByChannel($channelId, $arMessage)
{
global $DB;
if (strlen($arMessage['module_id']) <= 0 || strlen($arMessage['command']) <= 0) {
return false;
}
$arData = array('module_id' => $arMessage['module_id'], 'command' => $arMessage['command'], 'params' => is_array($arMessage['params']) ? $arMessage['params'] : array());
if (CPullOptions::GetNginxStatus()) {
$CHTTP = new CHTTP();
$CHTTP->http_timeout = 10;
if ($CHTTP->HTTPQuery('POST', CPullOptions::GetPublishUrl($channelId), str_replace("\n", " ", CUtil::PhpToJsObject(array('CHANNEL_ID' => $channelId, 'MESSAGE' => array($arData), 'ERROR' => ''))))) {
$result = $CHTTP->result;
}
} else {
$arParams = array('CHANNEL_ID' => $channelId, 'MESSAGE' => str_replace("\n", " ", serialize($arData)), '~DATE_CREATE' => $DB->CurrentTimeFunction());
$id = IntVal($DB->Add("b_pull_stack", $arParams, array("MESSAGE")));
$result = $id ? '{"channel": "' . $channelId . '", "id": "' . $id . '"}' : false;
}
if (isset($arMessage['push_text']) && strlen($arMessage['push_text']) > 0 && isset($arMessage['push_user']) && intval($arMessage['push_user']) > 0) {
$CPushManager = new CPushManager();
$CPushManager->AddQueue(array('USER_ID' => $arMessage['push_user'], 'MESSAGE' => str_replace("\n", " ", $arMessage['push_text']), 'PARAMS' => $arMessage['push_params'], 'TAG' => isset($arMessage['push_tag']) ? $arMessage['push_tag'] : ''));
}
return $result;
}
示例4: AddShared
public static function AddShared($arMessage)
{
if (!CPullOptions::GetNginxStatus())
return false;
$arChannel = CPullChannel::GetShared();
return self::AddByChannel($arChannel['CHANNEL_ID'], $arMessage);
}
示例5: GetMobileTemplateJS
public static function GetMobileTemplateJS($arParams, $arTemplate)
{
global $USER;
$ppStatus = 'false';
$ppServerStatus = 'false';
$updateStateInterval = 'auto';
if (CModule::IncludeModule("pull")) {
$ppStatus = CPullOptions::ModuleEnable() ? 'true' : 'false';
$ppServerStatus = CPullOptions::GetNginxStatus() ? 'true' : 'false';
$updateStateInterval = CPullOptions::GetNginxStatus() ? self::GetSessionLifeTime() : 80;
if ($updateStateInterval > 100) {
if ($updateStateInterval > 3600) {
$updateStateInterval = 3600;
}
$updateStateInterval = $updateStateInterval - 60;
}
}
$diskStatus = CIMDisk::Enabled();
$phoneSipAvailable = false;
$phoneDeviceActive = false;
$phoneEnabled = self::CheckPhoneStatus() && CModule::IncludeModule('mobileapp') && \Bitrix\MobileApp\Mobile::getInstance()->isWebRtcSupported();
if ($phoneEnabled && CModule::IncludeModule('voximplant')) {
$phoneSipAvailable = CVoxImplantConfig::GetModeStatus(CVoxImplantConfig::MODE_SIP);
$phoneDeviceActive = CVoxImplantUser::GetPhoneActive($USER->GetId());
}
$mobileAction = isset($arTemplate["ACTION"]) ? $arTemplate["ACTION"] : 'none';
$mobileCallMethod = isset($arTemplate["CALL_METHOD"]) ? $arTemplate["CALL_METHOD"] : 'device';
$userColor = isset($arTemplate['CONTACT_LIST']['users'][$USER->GetID()]['color']) ? $arTemplate['CONTACT_LIST']['users'][$USER->GetID()]['color'] : '';
$sJS = "\n\t\t\tBX.ready(function() {\n\t\t\t\tBXIM = new BX.ImMobile({\n\t\t\t\t\t'mobileAction': '" . $mobileAction . "',\n\t\t\t\t\t'mobileCallMethod': '" . $mobileCallMethod . "',\n\n\t\t\t\t\t'colors': " . (IM\Color::isEnabled() ? CUtil::PhpToJSObject(IM\Color::getSafeColorNames()) : 'false') . ",\n\t\t\t\t\t'mailCount': " . intval($arTemplate["MAIL_COUNTER"]) . ",\n\t\t\t\t\t'notifyCount': " . intval($arTemplate["NOTIFY_COUNTER"]) . ",\n\t\t\t\t\t'messageCount': " . intval($arTemplate["MESSAGE_COUNTER"]) . ",\n\t\t\t\t\t'counters': " . (empty($arTemplate['COUNTERS']) ? '{}' : CUtil::PhpToJSObject($arTemplate['COUNTERS'])) . ",\n\t\t\t\t\t'ppStatus': " . $ppStatus . ",\n\t\t\t\t\t'ppServerStatus': " . $ppServerStatus . ",\n\t\t\t\t\t'updateStateInterval': '" . $updateStateInterval . "',\n\t\t\t\t\t'openChatEnable': " . (CIMMessenger::CheckEnableOpenChat() ? 'true' : 'false') . ",\n\t\t\t\t\t'xmppStatus': " . (CIMMessenger::CheckXmppStatusOnline() ? 'true' : 'false') . ",\n\t\t\t\t\t'bitrixNetwork': " . (CIMMessenger::CheckNetwork() ? 'true' : 'false') . ",\n\t\t\t\t\t'bitrixNetwork2': " . (CIMMessenger::CheckNetwork2() ? 'true' : 'false') . ",\n\t\t\t\t\t'bitrix24': " . (IsModuleInstalled('bitrix24') ? 'true' : 'false') . ",\n\t\t\t\t\t'bitrix24Admin': " . (CModule::IncludeModule('bitrix24') && CBitrix24::IsPortalAdmin($USER->GetId()) ? 'true' : 'false') . ",\n\t\t\t\t\t'bitrix24net': " . (IsModuleInstalled('b24network') ? 'true' : 'false') . ",\n\t\t\t\t\t'bitrixIntranet': " . (IsModuleInstalled('intranet') ? 'true' : 'false') . ",\n\t\t\t\t\t'bitrixXmpp': " . (IsModuleInstalled('xmpp') ? 'true' : 'false') . ",\n\t\t\t\t\t'bitrixMobile': " . (IsModuleInstalled('mobile') ? 'true' : 'false') . ",\n\t\t\t\t\t'desktopStatus': " . (CIMMessenger::CheckDesktopStatusOnline() ? 'true' : 'false') . ",\n\t\t\t\t\t'desktopVersion': " . CIMMessenger::GetDesktopVersion() . ",\n\t\t\t\t\t'language': '" . LANGUAGE_ID . "',\n\n\t\t\t\t\t'smile': " . (empty($arTemplate['SMILE']) ? '{}' : CUtil::PhpToJSObject($arTemplate["SMILE"])) . ",\n\t\t\t\t\t'smileSet': " . (empty($arTemplate['SMILE_SET']) ? '{}' : CUtil::PhpToJSObject($arTemplate["SMILE_SET"])) . ",\n\t\t\t\t\t'settings': " . (empty($arTemplate['SETTINGS']) ? '{}' : CUtil::PhpToJSObject($arTemplate['SETTINGS'])) . ",\n\t\t\t\t\t'settingsNotifyBlocked': " . (empty($arTemplate['SETTINGS_NOTIFY_BLOCKED']) ? '{}' : CUtil::PhpToJSObject($arTemplate['SETTINGS_NOTIFY_BLOCKED'])) . ",\n\n\t\t\t\t\t'notify': " . (empty($arTemplate['NOTIFY']['notify']) ? '{}' : CUtil::PhpToJSObject($arTemplate['NOTIFY']['notify'])) . ",\n\t\t\t\t\t'unreadNotify' : " . (empty($arTemplate['NOTIFY']['unreadNotify']) ? '{}' : CUtil::PhpToJSObject($arTemplate['NOTIFY']['unreadNotify'])) . ",\n\t\t\t\t\t'flashNotify' : " . (empty($arTemplate['NOTIFY']['flashNotify']) ? '{}' : CUtil::PhpToJSObject($arTemplate['NOTIFY']['flashNotify'])) . ",\n\t\t\t\t\t'countNotify' : " . intval($arTemplate['NOTIFY']['countNotify']) . ",\n\t\t\t\t\t'loadNotify' : " . ($arTemplate['NOTIFY']['loadNotify'] ? 'true' : 'false') . ",\n\n\t\t\t\t\t'recent': " . (empty($arTemplate['RECENT']) && $arTemplate['RECENT'] !== false ? '[]' : CUtil::PhpToJSObject($arTemplate['RECENT'])) . ",\n\t\t\t\t\t'users': " . (empty($arTemplate['CONTACT_LIST']['users']) ? '{}' : CUtil::PhpToJSObject($arTemplate['CONTACT_LIST']['users'])) . ",\n\t\t\t\t\t'groups': " . (empty($arTemplate['CONTACT_LIST']['groups']) ? '{}' : CUtil::PhpToJSObject($arTemplate['CONTACT_LIST']['groups'])) . ",\n\t\t\t\t\t'userInGroup': " . (empty($arTemplate['CONTACT_LIST']['userInGroup']) ? '{}' : CUtil::PhpToJSObject($arTemplate['CONTACT_LIST']['userInGroup'])) . ",\n\t\t\t\t\t'woGroups': " . (empty($arTemplate['CONTACT_LIST']['woGroups']) ? '{}' : CUtil::PhpToJSObject($arTemplate['CONTACT_LIST']['woGroups'])) . ",\n\t\t\t\t\t'woUserInGroup': " . (empty($arTemplate['CONTACT_LIST']['woUserInGroup']) ? '{}' : CUtil::PhpToJSObject($arTemplate['CONTACT_LIST']['woUserInGroup'])) . ",\n\t\t\t\t\t'chat': " . (empty($arTemplate['CHAT']['chat']) ? '{}' : CUtil::PhpToJSObject($arTemplate['CHAT']['chat'])) . ",\n\t\t\t\t\t'userInChat': " . (empty($arTemplate['CHAT']['userInChat']) ? '{}' : CUtil::PhpToJSObject($arTemplate['CHAT']['userInChat'])) . ",\n\t\t\t\t\t'userChatBlockStatus': " . (empty($arTemplate['CHAT']['userChatBlockStatus']) ? '{}' : CUtil::PhpToJSObject($arTemplate['CHAT']['userChatBlockStatus'])) . ",\n\t\t\t\t\t'message' : " . (empty($arTemplate['MESSAGE']['message']) ? '{}' : CUtil::PhpToJSObject($arTemplate['MESSAGE']['message'])) . ",\n\t\t\t\t\t'files' : " . (empty($arTemplate['MESSAGE']['files']) ? '{}' : CUtil::PhpToJSObject($arTemplate['MESSAGE']['files'])) . ",\n\t\t\t\t\t'showMessage' : " . (empty($arTemplate['MESSAGE']['usersMessage']) ? '{}' : CUtil::PhpToJSObject($arTemplate['MESSAGE']['usersMessage'])) . ",\n\t\t\t\t\t'unreadMessage' : " . (empty($arTemplate['MESSAGE']['unreadMessage']) ? '{}' : CUtil::PhpToJSObject($arTemplate['MESSAGE']['unreadMessage'])) . ",\n\t\t\t\t\t'flashMessage' : " . (empty($arTemplate['MESSAGE']['flashMessage']) ? '{}' : CUtil::PhpToJSObject($arTemplate['MESSAGE']['flashMessage'])) . ",\n\t\t\t\t\t'history' : {},\n\t\t\t\t\t'openMessenger' : " . (isset($_GET['IM_DIALOG']) ? "'" . CUtil::JSEscape(htmlspecialcharsbx($_GET['IM_DIALOG'])) . "'" : 'false') . ",\n\t\t\t\t\t'openHistory' : " . (isset($_GET['IM_HISTORY']) ? "'" . CUtil::JSEscape(htmlspecialcharsbx($_GET['IM_HISTORY'])) . "'" : 'false') . ",\n\t\t\t\t\t'openNotify' : " . (isset($_GET['IM_NOTIFY']) && $_GET['IM_NOTIFY'] == 'Y' ? 'true' : 'false') . ",\n\t\t\t\t\t'openSettings' : " . (isset($_GET['IM_SETTINGS']) ? $_GET['IM_SETTINGS'] == 'Y' ? "'true'" : "'" . CUtil::JSEscape(htmlspecialcharsbx($_GET['IM_SETTINGS'])) . "'" : 'false') . ",\n\n\t\t\t\t\t'currentTab' : '" . ($arTemplate['CURRENT_TAB'] ? CUtil::JSEscape($arTemplate['CURRENT_TAB']) : 0) . "',\n\t\t\t\t\t'generalChatId': " . CIMChat::GetGeneralChatId() . ",\n\t\t\t\t\t'canSendMessageGeneralChat': " . (CIMChat::CanSendMessageToGeneralChat($USER->GetID()) ? 'true' : 'false') . ",\n\t\t\t\t\t'userId': " . $USER->GetID() . ",\n\t\t\t\t\t'userEmail': '" . CUtil::JSEscape($USER->GetEmail()) . "',\n\t\t\t\t\t'userColor': '" . IM\Color::getCode($userColor) . "',\n\t\t\t\t\t'userGender': '" . IM\User::getInstance()->getGender() . "',\n\t\t\t\t\t'userExtranet': " . (IM\User::getInstance()->isExtranet() ? 'true' : 'false') . ",\n\t\t\t\t\t'webrtc': {'turnServer' : '" . (empty($arTemplate['TURN_SERVER']) ? '' : CUtil::JSEscape($arTemplate['TURN_SERVER'])) . "', 'turnServerLogin' : '" . (empty($arTemplate['TURN_SERVER_LOGIN']) ? '' : CUtil::JSEscape($arTemplate['TURN_SERVER_LOGIN'])) . "', 'turnServerPassword' : '" . (empty($arTemplate['TURN_SERVER_PASSWORD']) ? '' : CUtil::JSEscape($arTemplate['TURN_SERVER_PASSWORD'])) . "', 'mobileSupport': " . ($arTemplate['WEBRTC_MOBILE_SUPPORT'] ? 'true' : 'false') . ", 'phoneEnabled': " . ($phoneEnabled ? 'true' : 'false') . ", 'phoneSipAvailable': " . ($phoneSipAvailable ? 'true' : 'false') . "},\n\t\t\t\t\t'disk': {'enable' : " . ($diskStatus ? 'true' : 'false') . "},\n\t\t\t\t\t'path' : {'profile' : '" . (empty($arTemplate['PATH_TO_USER_PROFILE']) ? '' : CUtil::JSEscape($arTemplate['PATH_TO_USER_PROFILE'])) . "', 'profileTemplate' : '" . (empty($arTemplate['PATH_TO_USER_PROFILE_TEMPLATE']) ? '' : CUtil::JSEscape($arTemplate['PATH_TO_USER_PROFILE_TEMPLATE'])) . "', 'mail' : '" . (empty($arTemplate['PATH_TO_USER_MAIL']) ? '' : CUtil::JSEscape($arTemplate['PATH_TO_USER_MAIL'])) . "'}\n\t\t\t\t});\n\t\t\t});\n\t\t";
return $sJS;
}
示例6: GetMobileTemplateJS
public static function GetMobileTemplateJS($arParams, $arTemplate)
{
global $USER;
$ppStatus = 'false';
$ppServerStatus = 'false';
$updateStateInterval = 'auto';
if (CModule::IncludeModule("pull"))
{
$ppStatus = CPullOptions::ModuleEnable()? 'true': 'false';
$ppServerStatus = CPullOptions::GetNginxStatus()? 'true': 'false';
$updateStateInterval = CPullOptions::GetNginxStatus()? self::GetSessionLifeTime(): 80;
if ($updateStateInterval > 100)
{
if ($updateStateInterval > 3600)
$updateStateInterval = 3600;
$updateStateInterval = $updateStateInterval-60;
}
}
$diskStatus = CIMDisk::Enabled();
$phoneSipAvailable = 0;
$phoneEnabled = false;
$mobileAction = isset($arTemplate["ACTION"])? $arTemplate["ACTION"]: 'none';
$sJS = "
BX.ready(function() {
BXIM = new BX.ImMobile({
'mobileAction': '".$mobileAction."',
'mailCount': ".intval($arTemplate["MAIL_COUNTER"]).",
'notifyCount': ".intval($arTemplate["NOTIFY_COUNTER"]).",
'messageCount': ".intval($arTemplate["MESSAGE_COUNTER"]).",
'counters': ".(empty($arTemplate['COUNTERS'])? '{}': CUtil::PhpToJSObject($arTemplate['COUNTERS'])).",
'ppStatus': ".$ppStatus.",
'ppServerStatus': ".$ppServerStatus.",
'updateStateInterval': '".$updateStateInterval."',
'xmppStatus': ".(CIMMessenger::CheckXmppStatusOnline()? 'true': 'false').",
'bitrixNetworkStatus': ".(CIMMessenger::CheckNetworkStatus()? 'true': 'false').",
'bitrix24Status': ".(IsModuleInstalled('bitrix24')? 'true': 'false').",
'bitrix24Admin': ".(CModule::IncludeModule('bitrix24') && CBitrix24::IsPortalAdmin($USER->GetId())? 'true': 'false').",
'bitrix24net': ".(IsModuleInstalled('b24network')? 'true': 'false').",
'bitrixIntranet': ".(IsModuleInstalled('intranet')? 'true': 'false').",
'bitrixXmpp': ".(IsModuleInstalled('xmpp')? 'true': 'false').",
'desktopStatus': ".(CIMMessenger::CheckDesktopStatusOnline()? 'true': 'false').",
'desktopVersion': ".CIMMessenger::GetDesktopVersion().",
'language': '".LANGUAGE_ID."',
'smile': ".(empty($arTemplate['SMILE'])? '{}': CUtil::PhpToJSObject($arTemplate["SMILE"])).",
'smileSet': ".(empty($arTemplate['SMILE_SET'])? '{}': CUtil::PhpToJSObject($arTemplate["SMILE_SET"])).",
'settings': ".(empty($arTemplate['SETTINGS'])? '{}': CUtil::PhpToJSObject($arTemplate['SETTINGS'])).",
'settingsNotifyBlocked': ".(empty($arTemplate['SETTINGS_NOTIFY_BLOCKED'])? '{}': CUtil::PhpToJSObject($arTemplate['SETTINGS_NOTIFY_BLOCKED'])).",
'notify': ".(empty($arTemplate['NOTIFY']['notify'])? '{}': CUtil::PhpToJSObject($arTemplate['NOTIFY']['notify'])).",
'unreadNotify' : ".(empty($arTemplate['NOTIFY']['unreadNotify'])? '{}': CUtil::PhpToJSObject($arTemplate['NOTIFY']['unreadNotify'])).",
'flashNotify' : ".(empty($arTemplate['NOTIFY']['flashNotify'])? '{}': CUtil::PhpToJSObject($arTemplate['NOTIFY']['flashNotify'])).",
'countNotify' : ".intval($arTemplate['NOTIFY']['countNotify']).",
'loadNotify' : ".($arTemplate['NOTIFY']['loadNotify']? 'true': 'false').",
'recent': ".(empty($arTemplate['RECENT'])? '{}': CUtil::PhpToJSObject($arTemplate['RECENT'])).",
'users': ".(empty($arTemplate['CONTACT_LIST']['users'])? '{}': CUtil::PhpToJSObject($arTemplate['CONTACT_LIST']['users'])).",
'groups': ".(empty($arTemplate['CONTACT_LIST']['groups'])? '{}': CUtil::PhpToJSObject($arTemplate['CONTACT_LIST']['groups'])).",
'userInGroup': ".(empty($arTemplate['CONTACT_LIST']['userInGroup'])? '{}': CUtil::PhpToJSObject($arTemplate['CONTACT_LIST']['userInGroup'])).",
'woGroups': ".(empty($arTemplate['CONTACT_LIST']['woGroups'])? '{}': CUtil::PhpToJSObject($arTemplate['CONTACT_LIST']['woGroups'])).",
'woUserInGroup': ".(empty($arTemplate['CONTACT_LIST']['woUserInGroup'])? '{}': CUtil::PhpToJSObject($arTemplate['CONTACT_LIST']['woUserInGroup'])).",
'chat': ".(empty($arTemplate['CHAT']['chat'])? '{}': CUtil::PhpToJSObject($arTemplate['CHAT']['chat'])).",
'userInChat': ".(empty($arTemplate['CHAT']['userInChat'])? '{}': CUtil::PhpToJSObject($arTemplate['CHAT']['userInChat'])).",
'userChatBlockStatus': ".(empty($arTemplate['CHAT']['userChatBlockStatus'])? '{}': CUtil::PhpToJSObject($arTemplate['CHAT']['userChatBlockStatus'])).",
'message' : ".(empty($arTemplate['MESSAGE']['message'])? '{}': CUtil::PhpToJSObject($arTemplate['MESSAGE']['message'])).",
'files' : ".(empty($arTemplate['MESSAGE']['files'])? '{}': CUtil::PhpToJSObject($arTemplate['MESSAGE']['files'])).",
'showMessage' : ".(empty($arTemplate['MESSAGE']['usersMessage'])? '{}': CUtil::PhpToJSObject($arTemplate['MESSAGE']['usersMessage'])).",
'unreadMessage' : ".(empty($arTemplate['MESSAGE']['unreadMessage'])? '{}': CUtil::PhpToJSObject($arTemplate['MESSAGE']['unreadMessage'])).",
'flashMessage' : ".(empty($arTemplate['MESSAGE']['flashMessage'])? '{}': CUtil::PhpToJSObject($arTemplate['MESSAGE']['flashMessage'])).",
'history' : {},
'openMessenger' : ".(isset($_GET['IM_DIALOG'])? "'".CUtil::JSEscape(htmlspecialcharsbx($_GET['IM_DIALOG']))."'": 'false').",
'openHistory' : ".(isset($_GET['IM_HISTORY'])? "'".CUtil::JSEscape(htmlspecialcharsbx($_GET['IM_HISTORY']))."'": 'false').",
'openNotify' : ".(isset($_GET['IM_NOTIFY']) && $_GET['IM_NOTIFY'] == 'Y'? 'true': 'false').",
'openSettings' : ".(isset($_GET['IM_SETTINGS'])? $_GET['IM_SETTINGS'] == 'Y'? "'true'": "'".CUtil::JSEscape(htmlspecialcharsbx($_GET['IM_SETTINGS']))."'": 'false').",
'currentTab' : '".($arTemplate['CURRENT_TAB']? CUtil::JSEscape($arTemplate['CURRENT_TAB']): 0)."',
'userId': ".$USER->GetID().",
'userEmail': '".CUtil::JSEscape($USER->GetEmail())."',
'webrtc': {'turnServer' : '".(empty($arTemplate['TURN_SERVER'])? '': CUtil::JSEscape($arTemplate['TURN_SERVER']))."', 'turnServerLogin' : '".(empty($arTemplate['TURN_SERVER_LOGIN'])? '': CUtil::JSEscape($arTemplate['TURN_SERVER_LOGIN']))."', 'turnServerPassword' : '".(empty($arTemplate['TURN_SERVER_PASSWORD'])? '': CUtil::JSEscape($arTemplate['TURN_SERVER_PASSWORD']))."', 'mobileSupport': ".($arTemplate['WEBRTC_MOBILE_SUPPORT']? 'true': 'false').", 'phoneEnabled': ".($phoneEnabled? 'true': 'false').", 'phoneSipAvailable': ".($phoneSipAvailable? 'true': 'false')."},
'disk': {'enable' : ".($diskStatus? 'true': 'false')."},
'path' : {'profile' : '".(empty($arTemplate['PATH_TO_USER_PROFILE'])? '': CUtil::JSEscape($arTemplate['PATH_TO_USER_PROFILE']))."', 'profileTemplate' : '".(empty($arTemplate['PATH_TO_USER_PROFILE_TEMPLATE'])? '': CUtil::JSEscape($arTemplate['PATH_TO_USER_PROFILE_TEMPLATE']))."', 'mail' : '".(empty($arTemplate['PATH_TO_USER_MAIL'])? '': CUtil::JSEscape($arTemplate['PATH_TO_USER_MAIL']))."'}
});
});
";
return $sJS;
}
示例7: CheckLiveMode
protected static function CheckLiveMode()
{
return CModule::IncludeModule('pull') && CPullOptions::GetNginxStatus();
}
示例8: htmlspecialcharsback
if ($type == "U" && IntVal($id) > 0) {
$arNewRightsName[] = "[user=" . $id . "]" . htmlspecialcharsback($name) . "[/user]";
} else {
$arNewRightsName[] = "[url=" . $link . "]" . htmlspecialcharsback($name) . "[/url]";
}
} else {
$arNewRightsName[] = htmlspecialcharsback($name);
}
}
}
}
$UserIP = CBlogUser::GetUserIP();
$arComFields = array("POST_ID" => $arParams["ID"], "BLOG_ID" => $arPost["BLOG_ID"], "POST_TEXT" => (count($arNewRightsName) > 1 ? GetMessage("B_B_SHARE") : GetMessage("B_B_SHARE_1")) . implode(", ", $arNewRightsName), "DATE_CREATE" => ConvertTimeStamp(time() + $arResult["TZ_OFFSET"], "FULL"), "AUTHOR_IP" => $UserIP[0], "AUTHOR_IP1" => $UserIP[1], "PARENT_ID" => false, "AUTHOR_ID" => $user_id, "SHARE_DEST" => implode(",", $arNewRights));
if ($comId = CBlogComment::Add($arComFields)) {
BXClearCache(true, "/blog/comment/" . intval($arParams["ID"] / 100) . "/" . $arParams["ID"] . "/");
if (CModule::IncludeModule("pull") && CPullOptions::GetNginxStatus() && ($arComment = CBlogComment::GetByID($comId))) {
$arAuthor = CBlogUser::GetUserInfo($arComment["AUTHOR_ID"], $arParams["PATH_TO_USER"], array("AVATAR_SIZE" => isset($arParams["AVATAR_SIZE_COMMON"]) ? $arParams["AVATAR_SIZE_COMMON"] : $arParams["AVATAR_SIZE"], "AVATAR_SIZE_COMMENT" => $arParams["AVATAR_SIZE_COMMENT"]));
$arPullFields = array("ID" => $arComment["ID"], "ENTITY_XML_ID" => "BLOG_" . $arComment["POST_ID"], "FULL_ID" => array("BLOG_" . $arComment["POST_ID"], $arComment["ID"]), "NEW" => "N", "APPROVED" => "Y", "POST_TIMESTAMP" => time() + $arResult["TZ_OFFSET"], "PANELS" => array("EDIT" => "N", "MODERATE" => "N", "DELETE" => "N"), "URL" => array("LINK" => $arResult['urlToPost'] . (strpos($arResult['urlToPost'], "?") !== false ? "&" : "?") . "commentId=" . $arComment["ID"] . "#com" . $arComment["ID"]), "AUTHOR" => array("ID" => $arComment["AUTHOR_ID"], "NAME" => CUser::FormatName($arParams["NAME_TEMPLATE"], $arAuthor, $arParams["SHOW_LOGIN"] != "N" ? true : false), "URL" => $arAuthor["url"], "AVATAR" => $arAuthor["PERSONAL_PHOTO_resized"]["src"], "IS_EXTRANET" => is_array($GLOBALS["arExtranetUserID"]) && in_array($arComment["AUTHOR_ID"], $GLOBALS["arExtranetUserID"])), "ACTION" => "REPLY");
$p = new blogTextParser(false, "");
$arPullFields["POST_MESSAGE_TEXT"] = $p->convert($arComment["POST_TEXT"], false, array(), array("HTML" => "N"), array("pathToUser" => $arParams["PATH_TO_USER"]));
if (IsModuleInstalled("mobile")) {
$p->bMobile = true;
$arPullFields["POST_MESSAGE_TEXT_MOBILE"] = $p->convert($arComment["POST_TEXT"], false, array(), array("HTML" => "N"), array("pathToUser" => "/mobile/users/?user_id=#user_id#"));
}
$arPullFields["POST_TIME"] = FormatDateFromDB($arComment["DATE_CREATE"], strpos($arParams["DATE_TIME_FORMAT_S"], 'a') !== false || ($arParams["DATE_TIME_FORMAT_S"] == 'FULL' && IsAmPmMode()) !== false ? strpos(FORMAT_DATETIME, 'TT') !== false ? 'G:MI TT' : 'G:MI T' : 'GG:MI');
$arPullFields["POST_DATE"] = FormatDateFromDB($arComment["DATE_CREATE"], $arParams["DATE_TIME_FORMAT"], true);
if (strcasecmp(LANGUAGE_ID, 'EN') !== 0 && strcasecmp(LANGUAGE_ID, 'DE') !== 0) {
$arPullFields["POST_DATE"] = ToLower($arPullFields["POST_DATE"]);
}
if (!empty($arParams['DATE_TIME_FORMAT_S']) && ($arParams['DATE_TIME_FORMAT_S'] == 'j F Y G:i' || $arParams['DATE_TIME_FORMAT_S'] == 'j F Y g:i a')) {
$arPullFields["POST_DATE"] = ltrim($arPullFields["POST_DATE"], '0');
示例9: array
require $_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/main/include/prolog_before.php";
/**
* Bitrix vars
* @global CUser $GLOBALS["USER"]
* @global CMain $APPLICATION
* @var array $arParams
*/
$arParams = array();
$arParams["AVATAR_SIZE"] = intval($_REQUEST["AVATAR_SIZE"]);
$arParams["AVATAR_SIZE"] = $arParams["AVATAR_SIZE"] > 0 ? $arParams["AVATAR_SIZE"] : 42;
$arParams["NAME_TEMPLATE"] = !!$_REQUEST["NAME_TEMPLATE"] ? $_REQUEST["NAME_TEMPLATE"] : CSite::GetNameFormat();
$arParams["SHOW_LOGIN"] = $_REQUEST["SHOW_LOGIN"] == "Y" ? "Y" : "N";
$sign = new \Bitrix\Main\Security\Sign\Signer();
$arParams["SIGN"] = $sign->unsign($_REQUEST["sign"], "main.post.list");
if (!is_array($_SESSION["UC_LAST_ACTIVITY"])) {
$_SESSION["UC_LAST_ACTIVITY"] = array("TIME" => 0, "ENTITY_XML_ID" => $_REQUEST["ENTITY_XML_ID"]);
}
if (check_bitrix_sessid() && $_REQUEST["MODE"] == "PUSH&PULL" && $GLOBALS["USER"]->IsAuthorized() && $arParams["SIGN"] == $_REQUEST["ENTITY_XML_ID"] && ($_SESSION["UC_ACTIVITY"]["ENTITY_XML_ID"] != $_REQUEST["ENTITY_XML_ID"] || time() - $_SESSION["UC_ACTIVITY"]["TIME"] > 10) && CModule::IncludeModule("pull") && CPullOptions::GetNginxStatus()) {
$_SESSION["UC_ACTIVITY"]["TIME"] = time();
$_SESSION["UC_ACTIVITY"]["ENTITY_XML_ID"] = $_REQUEST["ENTITY_XML_ID"];
$dbUser = CUser::GetList($sort_by = array('ID' => 'desc'), $dummy = '', array("ID" => $GLOBALS["USER"]->GetId()), array("FIELDS" => array("ID", "LAST_NAME", "NAME", "SECOND_NAME", "LOGIN", "PERSONAL_PHOTO", "PERSONAL_GENDER")));
$arUser = array();
if ($dbUser && ($arUser = $dbUser->GetNext()) && intval($arUser["PERSONAL_PHOTO"]) > 0) {
$arUser["PERSONAL_PHOTO_file"] = CFile::GetFileArray($arUser["PERSONAL_PHOTO"]);
$arUser["PERSONAL_PHOTO_resized_30"] = CFile::ResizeImageGet($arUser["PERSONAL_PHOTO_file"], array("width" => $arParams["AVATAR_SIZE"], "height" => $arParams["AVATAR_SIZE"]), BX_RESIZE_IMAGE_EXACT, false, false, true);
}
$arUserInfo = !!$arUser ? $arUser : array("PERSONAL_PHOTO_resized_30" => array("src" => ""));
$arUserInfo["NAME_FORMATED"] = CUser::FormatName($arParams["NAME_TEMPLATE"], array("NAME" => $arUserInfo["~NAME"], "LAST_NAME" => $arUserInfo["~LAST_NAME"], "SECOND_NAME" => $arUserInfo["~SECOND_NAME"], "LOGIN" => $arUserInfo["~LOGIN"], "NAME_LIST_FORMATTED" => ""), $arParams["SHOW_LOGIN"] != "N" ? true : false, false);
CPullWatch::AddToStack('UNICOMMENTS' . $_REQUEST["ENTITY_XML_ID"], array('module_id' => 'unicomments', 'command' => 'answer', 'expiry' => 60, 'params' => array("USER_ID" => $GLOBALS["USER"]->GetId(), "ENTITY_XML_ID" => $_REQUEST["ENTITY_XML_ID"], "TS" => time(), "NAME" => $arUserInfo["NAME_FORMATED"], "AVATAR" => $arUserInfo["PERSONAL_PHOTO_resized_30"]["src"])));
die;
}
示例10: define
define("NO_AGENT_CHECK", true);
define("DisableEventsCheck", true);
require($_SERVER["DOCUMENT_ROOT"]."/bitrix/modules/main/include/prolog_before.php");
$arParams["AVATAR_SIZE"] = intval($_REQUEST["AVATAR_SIZE"]);
$arParams["AVATAR_SIZE"] = ($arParams["AVATAR_SIZE"] > 0 ? $arParams["AVATAR_SIZE"] : 42);
$arParams["NAME_TEMPLATE"] = (!!$_REQUEST["NAME_TEMPLATE"] ? $_REQUEST["NAME_TEMPLATE"] : CSite::GetNameFormat());
$arParams["SHOW_LOGIN"] = ($_REQUEST["SHOW_LOGIN"] == "Y" ? "Y" : "N");
$arResult = array();
if (check_bitrix_sessid() && $_REQUEST["MODE"] == "PUSH&PULL" &&
$GLOBALS["USER"]->IsAuthorized() && !!$_REQUEST["ENTITY_XML_ID"] &&
is_array($_SESSION["UC"]) && array_key_exists($_REQUEST["ENTITY_XML_ID"], $_SESSION["UC"]) &&
(time() - $_SESSION["UC"][$_REQUEST["ENTITY_XML_ID"]]["ACTIVITY"] > 10) &&
CModule::IncludeModule("pull") && CPullOptions::GetNginxStatus())
{
$_SESSION["UC"][$_REQUEST["ENTITY_XML_ID"]]["ACTIVITY"] = time();
$dbUser = CUser::GetList(($sort_by = Array('ID'=>'desc')), ($dummy=''), Array("ID" => $GLOBALS["USER"]->GetId()),
Array("FIELDS" => Array("ID", "LAST_NAME", "NAME", "SECOND_NAME", "LOGIN", "PERSONAL_PHOTO", "PERSONAL_GENDER")));
$arUser = array();
if($dbUser && ($arUser = $dbUser->GetNext()) && (intval($arUser["PERSONAL_PHOTO"]) > 0))
{
$arUser["PERSONAL_PHOTO_file"] = CFile::GetFileArray($arUser["PERSONAL_PHOTO"]);
$arUser["PERSONAL_PHOTO_resized_30"] = CFile::ResizeImageGet(
$arUser["PERSONAL_PHOTO_file"],
array("width" => $arParams["AVATAR_SIZE"], "height" => $arParams["AVATAR_SIZE"]),
BX_RESIZE_IMAGE_EXACT,
false,
false,
示例11: GetTemplateJS
public static function GetTemplateJS($arParams, $arTemplate)
{
global $USER;
$ppStatus = 'false';
$ppServerStatus = 'false';
$updateStateInterval = 'auto';
if (CModule::IncludeModule("pull"))
{
$ppStatus = CPullOptions::ModuleEnable()? 'true': 'false';
$ppServerStatus = CPullOptions::GetNginxStatus()? 'true': 'false';
$updateStateInterval = CPullOptions::GetNginxStatus()? self::GetSessionLifeTime(): 80;
if ($updateStateInterval > 100)
{
if ($arTemplate['DESKTOP'] == 'true')
$updateStateInterval = intval($updateStateInterval/2);
else
$updateStateInterval = $updateStateInterval-20;
}
}
if ($arTemplate['INIT'] == 'Y')
{
$sJS = "
BX.ready(function() {
BXIM = new BX.IM(BX('bx-notifier-panel'), {
'mailCount': ".$arTemplate["MAIL_COUNTER"].",
'notifyCount': ".$arTemplate["NOTIFY_COUNTER"].",
'messageCount': ".$arTemplate["MESSAGE_COUNTER"].",
'counters': ".(empty($arTemplate['COUNTERS'])? '{}': CUtil::PhpToJSObject($arTemplate['COUNTERS'])).",
'ppStatus': ".$ppStatus.",
'ppServerStatus': ".$ppServerStatus.",
'updateStateInterval': '".$updateStateInterval."',
'xmppStatus': ".(CIMMessenger::CheckXmppStatusOnline()? 'true': 'false').",
'bitrix24Status': ".(IsModuleInstalled('bitrix24')? 'true': 'false').",
'bitrixIntranet': ".(IsModuleInstalled('intranet')? 'true': 'false').",
'bitrixXmpp': ".(IsModuleInstalled('xmpp')? 'true': 'false').",
'desktop': ".$arTemplate["DESKTOP"].",
'desktopStatus': ".(CIMMessenger::CheckDesktopStatusOnline()? 'true': 'false').",
'desktopLinkOpen': ".$arTemplate["DESKTOP_LINK_OPEN"].",
'language': '".LANGUAGE_ID."',
'smile': ".CUtil::PhpToJSObject($arTemplate["SMILE"]).",
'smileSet': ".CUtil::PhpToJSObject($arTemplate["SMILE_SET"]).",
'settings': ".CUtil::PhpToJSObject($arTemplate['SETTINGS']).",
'settingsNotifyBlocked': ".(empty($arTemplate['SETTINGS_NOTIFY_BLOCKED'])? '{}': CUtil::PhpToJSObject($arTemplate['SETTINGS_NOTIFY_BLOCKED'])).",
'notify': ".(empty($arTemplate['NOTIFY']['notify'])? '{}': CUtil::PhpToJSObject($arTemplate['NOTIFY']['notify'])).",
'unreadNotify' : ".(empty($arTemplate['NOTIFY']['unreadNotify'])? '{}': CUtil::PhpToJSObject($arTemplate['NOTIFY']['unreadNotify'])).",
'flashNotify' : ".(empty($arTemplate['NOTIFY']['flashNotify'])? '{}': CUtil::PhpToJSObject($arTemplate['NOTIFY']['flashNotify'])).",
'countNotify' : ".intval($arTemplate['NOTIFY']['countNotify']).",
'loadNotify' : ".($arTemplate['NOTIFY']['loadNotify']? 'true': 'false').",
'recent': ".CUtil::PhpToJSObject($arTemplate['RECENT']).",
'users': ".(empty($arTemplate['CONTACT_LIST']['users'])? '{}': CUtil::PhpToJSObject($arTemplate['CONTACT_LIST']['users'])).",
'groups': ".(empty($arTemplate['CONTACT_LIST']['groups'])? '{}': CUtil::PhpToJSObject($arTemplate['CONTACT_LIST']['groups'])).",
'userInGroup': ".(empty($arTemplate['CONTACT_LIST']['userInGroup'])? '{}': CUtil::PhpToJSObject($arTemplate['CONTACT_LIST']['userInGroup'])).",
'woGroups': ".(empty($arTemplate['CONTACT_LIST']['woGroups'])? '{}': CUtil::PhpToJSObject($arTemplate['CONTACT_LIST']['woGroups'])).",
'woUserInGroup': ".(empty($arTemplate['CONTACT_LIST']['woUserInGroup'])? '{}': CUtil::PhpToJSObject($arTemplate['CONTACT_LIST']['woUserInGroup'])).",
'chat': ".(empty($arTemplate['CHAT']['chat'])? '{}': CUtil::PhpToJSObject($arTemplate['CHAT']['chat'])).",
'userInChat': ".(empty($arTemplate['CHAT']['userInChat'])? '{}': CUtil::PhpToJSObject($arTemplate['CHAT']['userInChat'])).",
'message' : ".(empty($arTemplate['MESSAGE']['message'])? '{}': CUtil::PhpToJSObject($arTemplate['MESSAGE']['message'])).",
'showMessage' : ".(empty($arTemplate['MESSAGE']['usersMessage'])? '{}': CUtil::PhpToJSObject($arTemplate['MESSAGE']['usersMessage'])).",
'unreadMessage' : ".(empty($arTemplate['MESSAGE']['unreadMessage'])? '{}': CUtil::PhpToJSObject($arTemplate['MESSAGE']['unreadMessage'])).",
'flashMessage' : ".(empty($arTemplate['MESSAGE']['flashMessage'])? '{}': CUtil::PhpToJSObject($arTemplate['MESSAGE']['flashMessage'])).",
'history' : {},
'openMessenger' : ".(isset($_GET['IM_DIALOG'])? "'".CUtil::JSEscape(htmlspecialcharsbx($_GET['IM_DIALOG']))."'": 'false').",
'openHistory' : ".(isset($_GET['IM_HISTORY'])? "'".CUtil::JSEscape(htmlspecialcharsbx($_GET['IM_HISTORY']))."'": 'false').",
'openSettings' : ".(isset($_GET['IM_SETTINGS']) && $_GET['IM_SETTINGS'] == 'Y'? "'true'": 'false').",
'currentTab' : '".CUtil::JSEscape($arTemplate['CURRENT_TAB'])."',
'userId': ".$USER->GetID().",
'userEmail': '".CUtil::JSEscape($USER->GetEmail())."',
'webrtc': {'turnServer' : '".CUtil::JSEscape($arTemplate['TURN_SERVER'])."', 'turnServerFirefox' : '".CUtil::JSEscape($arTemplate['TURN_SERVER_FIREFOX'])."', 'turnServerLogin' : '".CUtil::JSEscape($arTemplate['TURN_SERVER_LOGIN'])."', 'turnServerPassword' : '".CUtil::JSEscape($arTemplate['TURN_SERVER_PASSWORD'])."'},
'path' : {'profile' : '".CUtil::JSEscape($arTemplate['PATH_TO_USER_PROFILE'])."', 'profileTemplate' : '".CUtil::JSEscape($arTemplate['PATH_TO_USER_PROFILE_TEMPLATE'])."', 'mail' : '".CUtil::JSEscape($arTemplate['PATH_TO_USER_MAIL'])."'}
});
});
";
}
else
{
$sJS = "
BX.ready(function() {
BXIM = new BX.IM(BX('bx-notifier-panel'), {
'init': false,
'settings': ".CUtil::PhpToJSObject($arTemplate['SETTINGS']).",
'updateStateInterval': '".$updateStateInterval."',
'desktop': ".$arTemplate["DESKTOP"].",
'ppStatus': ".$ppStatus.",
'ppServerStatus': ".$ppServerStatus.",
'xmppStatus': ".(CIMMessenger::CheckXmppStatusOnline()? 'true': 'false').",
'bitrix24Status': ".(IsModuleInstalled('bitrix24')? 'true': 'false').",
'bitrixIntranet': ".(IsModuleInstalled('intranet')? 'true': 'false').",
'bitrixXmpp': ".(IsModuleInstalled('xmpp')? 'true': 'false').",
'notify' : {},
'users' : {},
'userId': ".$USER->GetID().",
'userEmail': '".CUtil::JSEscape($USER->GetEmail())."',
'openMessenger' : ".(isset($_GET['IM_DIALOG'])? "'".CUtil::JSEscape(htmlspecialcharsbx($_GET['IM_DIALOG']))."'": 'false').",
'openHistory' : ".(isset($_GET['IM_HISTORY'])? "'".CUtil::JSEscape(htmlspecialcharsbx($_GET['IM_HISTORY']))."'": 'false').",
//.........这里部分代码省略.........
示例12: CheckOnlineChannel
public static function CheckOnlineChannel()
{
if (!CPullOptions::GetNginxStatus())
return false;
global $DB;
$arUser = Array();
$sqlDateFunction = null;
$dbType = strtolower($DB->type);
if ($dbType == "mysql")
$sqlDateFunction = "DATE_SUB(NOW(), INTERVAL 13 HOUR)";
else if ($dbType == "mssql")
$sqlDateFunction = "dateadd(HOUR, -13, getdate())";
else if ($dbType == "oracle")
$sqlDateFunction = "SYSDATE-1/13";
if (!is_null($sqlDateFunction))
{
$strSql = "
SELECT USER_ID, CHANNEL_ID
FROM b_pull_channel
WHERE DATE_CREATE >= ".$sqlDateFunction;
$dbRes = $DB->Query($strSql, false, "File: ".__FILE__."<br>Line: ".__LINE__);
while ($arRes = $dbRes->Fetch())
$arUser[$arRes['USER_ID']] = $arRes['CHANNEL_ID'];
}
if (count($arUser) > 0)
{
$arOnline = Array();
$arOffline = Array();
global $USER;
$agentUserId = 0;
if (is_object($USER) && $USER->GetId() > 0)
{
$agentUserId = $USER->GetId();
$arOnline[$agentUserId] = $agentUserId;
}
foreach ($arUser as $userId => $channelId)
{
if ($userId <= 0 || $agentUserId == $userId)
continue;
$result = self::Send($channelId, 'ping', 'GET', 5, false);
$result = json_decode($result);
if (is_object($result))
{
if ($result->subscribers > 0)
$arOnline[$userId] = $userId;
else
$arOffline[$userId] = $userId;
}
}
if (count($arOnline) > 0)
{
ksort($arOnline);
CUser::SetLastActivityDateByArray($arOnline);
}
}
$arSend = Array();
$dbUsers = CUser::GetList(($sort_by = 'ID'), ($sort_dir = 'asc'), array('LAST_ACTIVITY' => '180'), array('FIELDS' => array("ID")));
while ($arUser = $dbUsers->Fetch())
{
$arSend[$arUser["ID"]] = Array(
'id' => $arUser["ID"],
'status' => 'online',
);
}
CPullStack::AddShared(Array(
'module_id' => 'main',
'command' => 'online_list',
'params' => Array(
'USERS' => $arSend
),
));
return "CPullChannel::CheckOnlineChannel();";
}
示例13: sendIntoPull
protected function sendIntoPull(array &$arParams, array &$arResult)
{
if ((check_bitrix_sessid() && ($this->request->getPost("ENTITY_XML_ID") == $arParams["ENTITY_XML_ID"] || $this->request->getQuery("ENTITY_XML_ID") == $arParams["ENTITY_XML_ID"]) || $arParams["MODE"] == "PULL_MESSAGE") && is_array($arParams["PUSH&PULL"]) && $arParams["PUSH&PULL"]["ID"] > 0 && CModule::IncludeModule("pull") && \CPullOptions::GetNginxStatus()) {
if ($arParams["PUSH&PULL"]["ACTION"] != "DELETE") {
if (($res = $arParams["RECORDS"][$arParams["PUSH&PULL"]["ID"]]) && $res) {
$comment = array_merge($res, $res["WEB"]);
unset($comment["WEB"]);
unset($comment["MOBILE"]);
$comment["ACTION"] = $arParams["PUSH&PULL"]["ACTION"];
$comment["USER_ID"] = $this->getUser()->getId();
\CPullWatch::AddToStack('UNICOMMENTSEXTENDED' . $arParams["ENTITY_XML_ID"], array('module_id' => 'unicomments', 'command' => 'comment', 'params' => $comment));
if ($comment["APPROVED"] == "Y") {
\CPullWatch::AddToStack('UNICOMMENTS' . $arParams["ENTITY_XML_ID"], array('module_id' => 'unicomments', 'command' => 'comment', 'params' => $comment));
} else {
if ($comment["ACTION"] == "MODERATE") {
\CPullWatch::AddToStack('UNICOMMENTS' . $arParams["ENTITY_XML_ID"], array('module_id' => 'unicomments', 'command' => 'comment', 'params' => array("ID" => $comment["ID"], "ENTITY_XML_ID" => $comment["ENTITY_XML_ID"], "APPROVED" => "N", "ACTION" => "HIDE", "USER_ID" => $comment["USER_ID"])));
}
}
if (IsModuleInstalled("mobile")) {
$comment = array_merge($comment, $res["MOBILE"]);
\CPullWatch::AddToStack('UNICOMMENTSMOBILEEXTENDED' . $arParams["ENTITY_XML_ID"], array('module_id' => 'unicomments', 'command' => 'comment_mobile', 'params' => $comment));
if ($comment["APPROVED"] == "Y") {
\CPullWatch::AddToStack('UNICOMMENTSMOBILE' . $arParams["ENTITY_XML_ID"], array('module_id' => 'unicomments', 'command' => 'comment_mobile', 'params' => $comment));
} else {
if ($comment["ACTION"] == "MODERATE") {
\CPullWatch::AddToStack('UNICOMMENTSMOBILE' . $arParams["ENTITY_XML_ID"], array('module_id' => 'unicomments', 'command' => 'comment_mobile', 'params' => array("ID" => $comment["ID"], "ENTITY_XML_ID" => $comment["ENTITY_XML_ID"], "APPROVED" => "N", "ACTION" => "HIDE", "USER_ID" => $comment["USER_ID"])));
}
}
}
}
} else {
\CPullWatch::AddToStack('UNICOMMENTS' . $arParams["ENTITY_XML_ID"], array('module_id' => 'unicomments', 'command' => 'comment', 'params' => array("ID" => $arParams["PUSH&PULL"]["ID"], "ENTITY_XML_ID" => $arParams["ENTITY_XML_ID"], "ACTION" => "DELETE", "USER_ID" => $this->getUser()->getId())));
\CPullWatch::AddToStack('UNICOMMENTSEXTENDED' . $arParams["ENTITY_XML_ID"], array('module_id' => 'unicomments', 'command' => 'comment', 'params' => array("ID" => $arParams["PUSH&PULL"]["ID"], "ENTITY_XML_ID" => $arParams["ENTITY_XML_ID"], "ACTION" => "DELETE", "USER_ID" => $this->getUser()->getId())));
if (IsModuleInstalled("mobile")) {
\CPullWatch::AddToStack('UNICOMMENTSMOBILEEXTENDED' . $arParams["ENTITY_XML_ID"], array('module_id' => 'unicomments', 'command' => 'comment_mobile', 'params' => array("ID" => $arParams["PUSH&PULL"]["ID"], "ENTITY_XML_ID" => $arParams["ENTITY_XML_ID"], "ACTION" => "DELETE", "USER_ID" => $this->getUser()->getId())));
\CPullWatch::AddToStack('UNICOMMENTSMOBILE' . $arParams["ENTITY_XML_ID"], array('module_id' => 'unicomments', 'command' => 'comment_mobile', 'params' => array("ID" => $arParams["PUSH&PULL"]["ID"], "ENTITY_XML_ID" => $arParams["ENTITY_XML_ID"], "ACTION" => "DELETE", "USER_ID" => $this->getUser()->getId())));
}
}
}
}
示例14: GetMessage
?>
" name="path_to_listener" <?php
echo CPullOptions::GetNginxStatus() ? '' : 'disabled="true"';
?>
></td>
</tr>
<tr>
<td><?php
echo GetMessage("PULL_OPTIONS_PATH_TO_PUBLISH");
?>
:</td>
<td><input id="config_path_to_publish" type="text" size="40" value="<?php
echo CPullOptions::GetPublishUrl();
?>
" name="path_to_publish" <?php
echo CPullOptions::GetNginxStatus() ? '' : 'disabled="true"';
?>
></td>
</tr>
<?php
if (IsModuleInstalled('mobileapp')) {
?>
<tr>
<td align="right" width="50%"><?php
echo GetMessage("PULL_OPTIONS_PUSH");
?>
:</td>
<td><input type="checkbox" size="40" value="Y" <?php
echo CPullOptions::GetPushStatus() ? ' checked' : '';
?>
name="push"></td>
示例15: addLiveComment
/**
* Use component main.post.list to work with LiveFeed
* @param int $commentId Comment ID which needs to send.
* @param array $arParams Array of settings (DATE_TIME_FORMAT, SHOW_RATING, PATH_TO_USER, AVATAR_SIZE, NAME_TEMPLATE, SHOW_LOGIN)
* @return string
*/
public static function addLiveComment($commentId = 0, $arParams = array())
{
$res = "";
if ($commentId > 0 && CModule::IncludeModule("pull") && \CPullOptions::GetNginxStatus() && ($comment = CBlogComment::GetByID($commentId)) && ($arPost = CBlogPost::GetByID($comment["POST_ID"]))) {
global $DB, $APPLICATION;
$arParams["DATE_TIME_FORMAT"] = isset($arParams["DATE_TIME_FORMAT"]) ? $arParams["DATE_TIME_FORMAT"] : $DB->DateFormatToPHP(CSite::GetDateFormat("FULL"));
$arParams["SHOW_RATING"] = $arParams["SHOW_RATING"] == "N" ? "N" : "Y";
$arParams["PATH_TO_USER"] = isset($arParams["PATH_TO_USER"]) ? $arParams["PATH_TO_USER"] : '';
$arParams["AVATAR_SIZE_COMMENT"] = $arParams["AVATAR_SIZE_COMMENT"] > 0 ? $arParams["AVATAR_SIZE_COMMENT"] : ($arParams["AVATAR_SIZE"] > $arParams["AVATAR_SIZE"] ? $arParams["AVATAR_SIZE"] : 58);
$arParams["NAME_TEMPLATE"] = isset($arParams["NAME_TEMPLATE"]) ? $arParams["NAME_TEMPLATE"] : CSite::GetNameFormat();
$arParams["SHOW_LOGIN"] = $arParams["SHOW_LOGIN"] == "N" ? "N" : "Y";
$comment["DateFormated"] = FormatDateFromDB($comment["DATE_CREATE"], $arParams["DATE_TIME_FORMAT"], true);
$timestamp = MakeTimeStamp($comment["DATE_CREATE"]);
if (strcasecmp(LANGUAGE_ID, 'EN') !== 0 && strcasecmp(LANGUAGE_ID, 'DE') !== 0) {
$comment["DateFormated"] = ToLower($comment["DateFormated"]);
}
$comment["UF"] = $GLOBALS["USER_FIELD_MANAGER"]->GetUserFields("BLOG_COMMENT", $commentId, LANGUAGE_ID);
$arAuthor = CBlogUser::GetUserInfo($comment["AUTHOR_ID"], $arParams["PATH_TO_USER"], array("AVATAR_SIZE_COMMENT" => $arParams["AVATAR_SIZE_COMMENT"]));
if (intval($arAuthor["PERSONAL_PHOTO"]) > 0) {
$image_resize = CFile::ResizeImageGet($arAuthor["PERSONAL_PHOTO"], array("width" => $arParams["AVATAR_SIZE_COMMENT"], "height" => $arParams["AVATAR_SIZE_COMMENT"]), BX_RESIZE_IMAGE_EXACT);
$arAuthor["PERSONAL_PHOTO_RESIZED"] = array("src" => $image_resize["src"]);
}
$p = new blogTextParser(false, '');
$ufCode = "UF_BLOG_COMMENT_FILE";
if (is_array($comment["UF"][$ufCode])) {
$p->arUserfields = array($ufCode => array_merge($comment["UF"][$ufCode], array("TAG" => "DOCUMENT ID")));
}
$arAllow = array("HTML" => "N", "ANCHOR" => "Y", "BIU" => "Y", "IMG" => "Y", "QUOTE" => "Y", "CODE" => "Y", "FONT" => "Y", "LIST" => "Y", "SMILES" => "Y", "NL2BR" => "N", "VIDEO" => "Y", "SHORT_ANCHOR" => "Y");
$arParserParams = array("imageWidth" => 800, "imageHeight" => 800);
$comment["TextFormated"] = $p->convert($comment["POST_TEXT"], false, array(), $arAllow, $arParserParams);
$p->bMobile = true;
$comment["TextFormatedMobile"] = $p->convert($comment["POST_TEXT"], false, array(), $arAllow, $arParserParams);
$comment["TextFormatedJS"] = CUtil::JSEscape(htmlspecialcharsBack($comment["POST_TEXT"]));
$comment["TITLE"] = CUtil::JSEscape(htmlspecialcharsBack($comment["TITLE"]));
$eventHandlerID = AddEventHandler("main", "system.field.view.file", array("CSocNetLogTools", "logUFfileShow"));
$res = $APPLICATION->IncludeComponent("bitrix:main.post.list", "", array("TEMPLATE_ID" => 'BLOG_COMMENT_BG_', "RATING_TYPE_ID" => $arParams["SHOW_RATING"] == "Y" ? "BLOG_COMMENT" : "", "ENTITY_XML_ID" => "BLOG_" . $arPost["ID"], "RECORDS" => array($commentId => array("ID" => $comment["ID"], "NEW" => $arParams["FOLLOW"] != "N" && $comment["NEW"] == "Y" ? "Y" : "N", "APPROVED" => $comment["PUBLISH_STATUS"] == BLOG_PUBLISH_STATUS_PUBLISH ? "Y" : "N", "POST_TIMESTAMP" => $timestamp, "POST_TIME" => $comment["DATE_CREATE_TIME"], "POST_DATE" => $comment["DateFormated"], "AUTHOR" => array("ID" => $arAuthor["ID"], "NAME" => $arAuthor["~NAME"], "LAST_NAME" => $arAuthor["~LAST_NAME"], "SECOND_NAME" => $arAuthor["~SECOND_NAME"], "AVATAR" => $arAuthor["PERSONAL_PHOTO_resized"]["src"]), "FILES" => false, "UF" => $comment["UF"], "~POST_MESSAGE_TEXT" => $comment["POST_TEXT"], "WEB" => array("POST_TIME" => $comment["DATE_CREATE_TIME"], "POST_DATE" => $comment["DateFormated"], "CLASSNAME" => "", "POST_MESSAGE_TEXT" => $comment["TextFormated"], "AFTER" => <<<HTML
<script>top.text{$commentId} = text{$commentId} = '{$comment["TextFormatedJS"]}';top.title{$commentId} = title{$commentId} = '{$comment["TITLE"]}';top.arComFiles{$commentId} = [];</script>
HTML
), "MOBILE" => array("POST_TIME" => $comment["DATE_CREATE_TIME"], "POST_DATE" => $comment["DateFormated"], "CLASSNAME" => "", "POST_MESSAGE_TEXT" => $comment["TextFormatedMobile"]))), "NAV_STRING" => "", "NAV_RESULT" => "", "PREORDER" => "N", "RIGHTS" => array("MODERATE" => "N", "EDIT" => "N", "DELETE" => "N"), "VISIBLE_RECORDS_COUNT" => 1, "ERROR_MESSAGE" => "", "OK_MESSAGE" => "", "RESULT" => $commentId, "PUSH&PULL" => array("ACTION" => "REPLY", "ID" => $commentId), "MODE" => "PULL_MESSAGE", "VIEW_URL" => "", "EDIT_URL" => "", "MODERATE_URL" => "", "DELETE_URL" => "", "AUTHOR_URL" => "", "AVATAR_SIZE" => $arParams["AVATAR_SIZE_COMMENT"], "NAME_TEMPLATE" => $arParams["NAME_TEMPLATE"], "SHOW_LOGIN" => $arParams["SHOW_LOGIN"], "DATE_TIME_FORMAT" => "", "LAZYLOAD" => "", "NOTIFY_TAG" => "", "NOTIFY_TEXT" => "", "SHOW_MINIMIZED" => "Y", "SHOW_POST_FORM" => "", "IMAGE_SIZE" => "", "mfi" => ""), array(), null);
if ($eventHandlerID !== false && intval($eventHandlerID) > 0) {
RemoveEventHandler('main', 'system.field.view.file', $eventHandlerID);
}
}
return $res;
}