本文整理汇总了PHP中CPullOptions类的典型用法代码示例。如果您正苦于以下问题:PHP CPullOptions类的具体用法?PHP CPullOptions怎么用?PHP CPullOptions使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了CPullOptions类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: CheckExpireAgent
public static function CheckExpireAgent()
{
global $DB;
if (!CPullOptions::ModuleEnable()) {
return false;
}
$sqlDateFunction = null;
$dbType = strtolower($DB->type);
if ($dbType == "mysql") {
$sqlDateFunction = "DATE_SUB(NOW(), INTERVAL 12 HOUR)";
} else {
if ($dbType == "mssql") {
$sqlDateFunction = "dateadd(HOUR, -12, getdate())";
} else {
if ($dbType == "oracle") {
$sqlDateFunction = "SYSDATE-1/12";
}
}
}
if (!is_null($sqlDateFunction)) {
$strSql = "\n\t\t\t\t\tSELECT CHANNEL_ID\n\t\t\t\t\tFROM b_pull_channel\n\t\t\t\t\tWHERE DATE_CREATE < " . $sqlDateFunction;
$dbRes = $DB->Query($strSql, false, "File: " . __FILE__ . "<br>Line: " . __LINE__);
while ($arRes = $dbRes->Fetch()) {
self::Delete($arRes['CHANNEL_ID']);
}
}
return "CPullChannel::CheckExpireAgent();";
}
示例2: CheckExpireAgent
public static function CheckExpireAgent()
{
global $DB;
if (!CPullOptions::ModuleEnable())
return false;
CAgent::RemoveAgent("CPullWatch::CheckExpireAgent();", "pull");
$strSql = "SELECT count(ID) CNT FROM b_pull_watch WHERE DATE_CREATE < DATE_SUB(NOW(), INTERVAL 30 MINUTE)";
$dbRes = $DB->Query($strSql, false, "File: ".__FILE__."<br>Line: ".__LINE__);
if ($arRes = $dbRes->Fetch())
{
$strSql = "DELETE FROM b_pull_watch WHERE DATE_CREATE < DATE_SUB(NOW(), INTERVAL 30 MINUTE) LIMIT 1000";
$DB->Query($strSql, false, "File: ".__FILE__."<br>Line: ".__LINE__);
if ($arRes['CNT'] > 1000)
{
CAgent::AddAgent("CPullWatch::CheckExpireAgent();", "pull", "N", 180, "", "Y", ConvertTimeStamp(time()+CTimeZone::GetOffset()+180, "FULL"));
return false;
}
}
CAgent::AddAgent("CPullWatch::CheckExpireAgent();", "pull", "N", 600, "", "Y", ConvertTimeStamp(time()+CTimeZone::GetOffset()+600, "FULL"));
return false;
}
示例3: CheckModules
function CheckModules()
{
global $APPLICATION;
if (!CModule::IncludeModule('pull') || !CPullOptions::GetQueueServerStatus()) {
$this->errors[] = GetMessage('VI_CHECK_PULL');
}
if (!IsModuleInstalled('im')) {
$this->errors[] = GetMessage('VI_CHECK_IM');
}
include $_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/main/classes/general/version.php";
if (version_compare("14.9.2", SM_VERSION) == 1) {
$this->errors[] = GetMessage('VI_CHECK_MAIN');
}
if (IsModuleInstalled('intranet')) {
include $_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/intranet/install/version.php";
if (version_compare("14.5.6", $arModuleVersion["VERSION"]) == 1) {
$this->errors[] = GetMessage('VI_CHECK_INTRANET');
}
} else {
$this->errors[] = GetMessage('VI_CHECK_INTRANET_INSTALL');
}
if (is_array($this->errors) && !empty($this->errors)) {
$APPLICATION->ThrowException(implode("<br>", $this->errors));
return false;
} else {
return true;
}
}
示例4: AddShared
public static function AddShared($arMessage, $channelType = 'shared')
{
if (!CPullOptions::GetQueueServerStatus()) {
return false;
}
$arChannel = CPullChannel::GetChannelShared($channelType);
return self::AddByChannel($arChannel['CHANNEL_ID'], $arMessage);
}
示例5: 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;
}
示例6: SendPullEvent
public static function SendPullEvent($params)
{
// TODO check params
if (!CModule::IncludeModule('pull') || !CPullOptions::GetQueueServerStatus() || $params['USER_ID'] <= 0) {
return false;
}
$config = array();
if ($params['COMMAND'] == 'outgoing') {
$config = array("callId" => $params['CALL_ID'], "callIdTmp" => $params['CALL_ID_TMP'] ? $params['CALL_ID_TMP'] : '', "callDevice" => $params['CALL_DEVICE'] == 'PHONE' ? 'PHONE' : 'WEBRTC', "phoneNumber" => $params['PHONE_NUMBER'], "external" => $params['EXTERNAL'] ? true : false, "CRM" => $params['CRM'] ? $params['CRM'] : array());
} else {
if ($params['COMMAND'] == 'timeout') {
$config = array("callId" => $params['CALL_ID'], "failedCode" => intval($params['FAILED_CODE']));
}
}
CPullStack::AddByUser($params['USER_ID'], array('module_id' => 'voximplant', 'command' => $params['COMMAND'], 'params' => $config));
return true;
}
示例7: CheckExpireAgent
public static function CheckExpireAgent()
{
global $DB, $pPERIOD;
if (!CPullOptions::ModuleEnable()) {
return "CPullWatch::CheckExpireAgent();";
}
$pPERIOD = 1200;
$strSql = "SELECT count(ID) CNT FROM b_pull_watch WHERE DATE_CREATE < DATE_SUB(NOW(), INTERVAL 32 MINUTE)";
$dbRes = $DB->Query($strSql, false, "File: " . __FILE__ . "<br>Line: " . __LINE__);
if ($arRes = $dbRes->Fetch()) {
$strSql = "DELETE FROM b_pull_watch WHERE DATE_CREATE < DATE_SUB(NOW(), INTERVAL 32 MINUTE) LIMIT 1000";
$DB->Query($strSql, false, "File: " . __FILE__ . "<br>Line: " . __LINE__);
if ($arRes['CNT'] > 1000) {
$pPERIOD = 180;
}
}
return "CPullWatch::CheckExpireAgent();";
}
示例8: CheckNeedRun
public static function CheckNeedRun($bGetSectionStatus = true)
{
$arExcludeSites = CPullOptions::GetExcludeSites();
if (isset($arExcludeSites[SITE_ID]))
return false;
global $CACHE_MANAGER;
$bAdminSection = false;
if(defined("ADMIN_SECTION") && ADMIN_SECTION == true)
$bAdminSection = true;
$arResult = Array();
$res = $CACHE_MANAGER->Read(2592000, "pull_cnr");
if ($res)
$arResult = $CACHE_MANAGER->Get("pull_cnr");
if(!$res)
{
$arResult = Array(
'ADMIN_SECTION' => false,
'PUBLIC_SECTION' => false
);
$arModule = self::GetDependentModule();
foreach ($arModule as $moduleId => $options)
{
if (isset($options['ADMIN_SECTION']) && $options['ADMIN_SECTION'] == 'Y')
$arResult['ADMIN_SECTION'] = true;
if (isset($options['PUBLIC_SECTION']) && $options['PUBLIC_SECTION'] == 'Y')
$arResult['PUBLIC_SECTION'] = true;
}
$CACHE_MANAGER->Set("pull_cnr", $arResult);
}
return $bGetSectionStatus? $arResult[$bAdminSection? 'ADMIN_SECTION': 'PUBLIC_SECTION']: $arResult;
}
示例9: 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;
}
示例10: AddLiveComment
function AddLiveComment($commentId = 0, $path = "")
{
if(IntVal($commentId) <= 0)
return;
if(CModule::IncludeModule("pull") && CPullOptions::GetNginxStatus())
{
if($arComment = CBlogComment::GetByID($commentId))
{
if(strlen($path) <= 0 && strlen($arComment["PATH"]) > 0)
$path = CComponentEngine::MakePathFromTemplate($arComment["PATH"], array("post_id" =>$arComment["POST_ID"], "comment_id"=>$arComment["ID"]));
if(strlen($path) <= 0)
{
$arPost = CBlogPost::GetByID($arComment["POST_ID"]);
$path = $path = CComponentEngine::MakePathFromTemplate($arPost["PATH"], array("post_id" =>$arComment["POST_ID"], "comment_id"=>$arComment["ID"]))."?commentId=".$arComment["ID"];
}
CPullWatch::AddToStack("UNICOMMENTSBLOG_".$arComment["POST_ID"],
array(
'module_id' => "unicomments",
'command' => "comment",
'params' => Array(
"AUTHOR_ID" => $arComment["AUTHOR_ID"],
"ID" => $arComment["ID"],
"POST_ID" => $arComment["POST_ID"],
"TS" => time(),
"ACTION" => "REPLY",
"URL" => array(
"LINK" => $path,
),
"ENTITY_XML_ID" => "BLOG_".$arComment["POST_ID"],
"APPROVED" => "Y",
"NEED_REQUEST" => "Y",
),
)
);
}
}
}
示例11: define
<?php
define("PUBLIC_AJAX_MODE", true);
define("NO_KEEP_STATISTIC", "Y");
define("NO_AGENT_STATISTIC", "Y");
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, 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;
}
示例12: afterInsertTrigger
/**
* Method will be invoked after new database record inserted.
*
* @param array $newRecord All fields of inserted record.
*
* @return void
*/
public function afterInsertTrigger(array $newRecord)
{
$arParams = array();
$chatId = $newRecord['CHAT_ID'];
$arRel = \CIMChat::GetRelationById($chatId);
$arFields['MESSAGE_TYPE'] = '';
foreach ($arRel as $rel) {
$arFields['MESSAGE_TYPE'] = $rel["MESSAGE_TYPE"];
break;
}
$arFields['PARAMS'] = array();
$arFields['FILES'] = array();
//CUserCounter::Increment($arFields['TO_USER_ID'], 'im_message_v2', '**', false);
if ($arFields['MESSAGE_TYPE'] == IM_MESSAGE_PRIVATE) {
foreach ($arRel as $rel) {
if ($rel['USER_ID'] == $newRecord['AUTHOR_ID']) {
$arFields['FROM_USER_ID'] = $rel['USER_ID'];
} else {
$arFields['TO_USER_ID'] = $rel['USER_ID'];
}
}
\CIMContactList::SetRecent(array('ENTITY_ID' => $arFields['TO_USER_ID'], 'MESSAGE_ID' => $newRecord['ID'], 'CHAT_TYPE' => IM_MESSAGE_PRIVATE, 'USER_ID' => $arFields['FROM_USER_ID']));
\CIMContactList::SetRecent(array('ENTITY_ID' => $arFields['FROM_USER_ID'], 'MESSAGE_ID' => $newRecord['ID'], 'CHAT_TYPE' => IM_MESSAGE_PRIVATE, 'USER_ID' => $arFields['TO_USER_ID']));
if (\CModule::IncludeModule('pull')) {
$pullMessage = array('module_id' => 'im', 'command' => 'message', 'params' => \CIMMessage::GetFormatMessage(array('ID' => $newRecord['ID'], 'CHAT_ID' => $chatId, 'TO_USER_ID' => $arFields['TO_USER_ID'], 'FROM_USER_ID' => $arFields['FROM_USER_ID'], 'SYSTEM' => $newRecord['NOTIFY_EVENT'] == 'private_system' ? 'Y' : 'N', 'MESSAGE' => $newRecord['MESSAGE'], 'DATE_CREATE' => time(), 'PARAMS' => $arFields['PARAMS'], 'FILES' => $arFields['FILES'])));
$pullMessageTo = $pullMessage;
if (\CPullOptions::GetPushStatus()) {
if (\CIMSettings::GetNotifyAccess($arFields["TO_USER_ID"], 'im', 'message', \CIMSettings::CLIENT_PUSH)) {
$pushParams = \CIMMessenger::PreparePushForPrivate(array('FROM_USER_ID' => $arFields['FROM_USER_ID'], 'MESSAGE' => $newRecord['MESSAGE'], 'SYSTEM' => $arFields['SYSTEM'], 'FILES' => $arFields['FILES']));
$pullMessageTo = array_merge($pullMessage, $pushParams);
}
}
\CPullStack::AddByUser($arFields['TO_USER_ID'], $pullMessageTo);
\CPullStack::AddByUser($arFields['FROM_USER_ID'], $pullMessage);
\CPushManager::DeleteFromQueueBySubTag($arFields['FROM_USER_ID'], 'IM_MESS');
//self::SendBadges($arFields['TO_USER_ID']);
}
} else {
if ($arFields['MESSAGE_TYPE'] == IM_MESSAGE_CHAT || $arFields['MESSAGE_TYPE'] == IM_MESSAGE_OPEN) {
foreach ($arRel as $relation) {
\CIMContactList::SetRecent(array('ENTITY_ID' => $relation['CHAT_ID'], 'MESSAGE_ID' => $newRecord['ID'], 'CHAT_TYPE' => $relation['MESSAGE_TYPE'], 'USER_ID' => $relation['USER_ID']));
}
if (\CModule::IncludeModule('pull')) {
$pullMessage = array('module_id' => 'im', 'command' => 'messageChat', 'params' => \CIMMessage::GetFormatMessage(array('ID' => $newRecord['ID'], 'CHAT_ID' => $chatId, 'TO_CHAT_ID' => $chatId, 'FROM_USER_ID' => $newRecord['AUTHOR_ID'], 'MESSAGE' => $newRecord['MESSAGE'], 'SYSTEM' => $newRecord['AUTHOR_ID'] > 0 ? 'N' : 'Y', 'DATE_CREATE' => time(), 'PARAMS' => $arFields['PARAMS'], 'FILES' => $arFields['FILES'])));
$chat = \Bitrix\Im\ChatTable::getById($chatId);
$chatData = $chat->fetch();
if ($chatData && \CPullOptions::GetPushStatus()) {
$pushParams = \CIMMessenger::PreparePushForChat(array('CHAT_ID' => $chatId, 'CHAT_TITLE' => $chatData['TITLE'], 'FROM_USER_ID' => $newRecord['AUTHOR_ID'], 'MESSAGE' => $newRecord['MESSAGE'], 'SYSTEM' => $newRecord['AUTHOR_ID'] > 0 ? 'N' : 'Y', 'FILES' => $arFields['FILES']));
$pullMessage = array_merge($pullMessage, $pushParams);
}
$pullUsers = array();
$pullUsersSkip = array();
foreach ($arRel as $rel) {
$pullUsers[] = $rel['USER_ID'];
if ($rel['USER_ID'] == $newRecord['AUTHOR_ID']) {
$pullUsersSkip[] = $rel['USER_ID'];
\CPushManager::DeleteFromQueueBySubTag($newRecord['AUTHOR_ID'], 'IM_MESS');
} else {
if ($rel['NOTIFY_BLOCK'] == 'Y' || !\CIMSettings::GetNotifyAccess($rel['USER_ID'], 'im', $arFields['MESSAGE_TYPE'] == IM_MESSAGE_OPEN ? 'openChat' : 'chat', \CIMSettings::CLIENT_PUSH)) {
$pullUsersSkip[] = $rel['USER_ID'];
}
}
}
$pullMessage['push']['skip_users'] = $pullUsersSkip;
\CPullStack::AddByUsers($pullUsers, $pullMessage);
if ($arFields['MESSAGE_TYPE'] == IM_MESSAGE_OPEN) {
\CPullWatch::AddToStack('IM_PUBLIC_' . $chatId, $pullMessage);
}
/* TODO uncomment after fix mantis:66363
\CIMMessenger::SendMention(Array(
'CHAT_ID' => $chatId,
'CHAT_TITLE' => $chatData['TITLE'],
'CHAT_RELATION' => $arRel,
'CHAT_TYPE' => $chatData['TYPE'],
'MESSAGE' => $newRecord['MESSAGE'],
'FILES' => $arFields['FILES'],
'FROM_USER_ID' => $newRecord['AUTHOR_ID'],
));
*/
//\CIMMessenger::SendBadges($usersForBadges);
foreach (\GetModuleEvents("im", "OnAfterMessagesAdd", true) as $arEvent) {
\ExecuteModuleEventEx($arEvent, array($newRecord['ID'], $newRecord));
}
}
}
}
}
示例13: CheckLiveMode
protected static function CheckLiveMode()
{
return CModule::IncludeModule('pull') && CPullOptions::GetNginxStatus();
}
示例14: AddLiveComment
function AddLiveComment($commentId = 0, $path = "", $arParams = array())
{
if (IntVal($commentId) <= 0) {
return;
}
if (CModule::IncludeModule("pull") && CPullOptions::GetNginxStatus() && ($arComment = CBlogComment::GetByID($commentId)) && ($arPost = CBlogPost::GetByID($arComment["POST_ID"]))) {
if (strlen($path) <= 0 && strlen($arComment["PATH"]) > 0) {
$path = CComponentEngine::MakePathFromTemplate($arComment["PATH"], array("post_id" => $arComment["POST_ID"], "comment_id" => $commentId));
}
if (strlen($path) <= 0) {
$path = CComponentEngine::MakePathFromTemplate($arPost["PATH"], array("post_id" => $arComment["POST_ID"], "comment_id" => $commentId)) . "?commentId=" . $commentId;
}
$arFormatParams = array("PATH_TO_USER" => isset($arParams["PATH_TO_USER"]) ? $arParams["PATH_TO_USER"] : '', "PATH_TO_POST" => $path, "NAME_TEMPLATE" => isset($arParams["NAME_TEMPLATE"]) ? $arParams["NAME_TEMPLATE"] : CSite::GetNameFormat(), "SHOW_LOGIN" => isset($arParams["SHOW_LOGIN"]) ? $arParams["SHOW_LOGIN"] : true, "AVATAR_SIZE_COMMENT" => isset($arParams["AVATAR_SIZE_COMMENT"]) ? $arParams["AVATAR_SIZE_COMMENT"] : 58, "PATH_TO_SMILE" => isset($arParams["PATH_TO_SMILE"]) ? $arParams["PATH_TO_SMILE"] : '', "DATE_TIME_FORMAT" => isset($arParams["DATE_TIME_FORMAT"]) ? $arParams["DATE_TIME_FORMAT"] : '', "SHOW_RATING" => isset($arParams["SHOW_RATING"]) ? $arParams["SHOW_RATING"] : '', "RATING_TYPE" => "like");
$arComment["DateFormated"] = FormatDateFromDB($arComment["DATE_CREATE"], $arFormatParams["DATE_TIME_FORMAT"], true);
if (strcasecmp(LANGUAGE_ID, 'EN') !== 0 && strcasecmp(LANGUAGE_ID, 'DE') !== 0) {
$arComment["DateFormated"] = ToLower($arComment["DateFormated"]);
}
$arComment["UF"] = $GLOBALS["USER_FIELD_MANAGER"]->GetUserFields("BLOG_COMMENT", $commentId, LANGUAGE_ID);
$arAuthor = CBlogUser::GetUserInfo($arComment["AUTHOR_ID"], $arFormatParams["PATH_TO_USER"], array("AVATAR_SIZE_COMMENT" => $arFormatParams["AVATAR_SIZE_COMMENT"]));
if (IsModuleInstalled('extranet') && CModule::IncludeModule('socialnetwork')) {
CSocNetTools::InitGlobalExtranetArrays();
}
$arTmpUser = array("NAME" => $arAuthor["~NAME"], "LAST_NAME" => $arAuthor["~LAST_NAME"], "SECOND_NAME" => $arAuthor["~SECOND_NAME"], "LOGIN" => $arAuthor["~LOGIN"], "NAME_LIST_FORMATTED" => "");
$arAuthor["NAME_FORMATED"] = CUser::FormatName($arFormatParams["NAME_TEMPLATE"], $arTmpUser, $arFormatParams["SHOW_LOGIN"] != "N");
if (intval($arAuthor["PERSONAL_PHOTO"]) > 0) {
$image_resize = CFile::ResizeImageGet($arAuthor["PERSONAL_PHOTO"], array("width" => $arFormatParams["AVATAR_SIZE_COMMENT"], "height" => $arFormatParams["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($arComment["UF"][$ufCode])) {
$p->arUserfields = array($ufCode => array_merge($arComment["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);
$arComment["TextFormated"] = $p->convert($arComment["POST_TEXT"], false, array(), $arAllow, $arParserParams);
$p->bMobile = true;
$arComment["TextFormatedMobile"] = $p->convert($arComment["POST_TEXT"], false, array(), $arAllow, $arParserParams);
if ($perm >= BLOG_PERMS_MODERATE) {
if ($arComment["PUBLISH_STATUS"] == BLOG_PUBLISH_STATUS_PUBLISH) {
$arComment["CAN_HIDE"] = "Y";
} else {
$arComment["CAN_SHOW"] = "Y";
}
} else {
$arComment["CAN_SHOW"] = $arComment["CAN_HIDE"] = "N";
}
$urlToPost = CComponentEngine::MakePathFromTemplate(htmlspecialcharsBack($arFormatParams["PATH_TO_POST"]), array("post_id" => "#source_post_id#", "user_id" => $arPost["AUTHOR_ID"]));
$urlToPost .= strpos($urlToPost, "?") !== false ? "&" : "?";
$arUrl = array("LINK" => $urlToPost, "SHOW" => $urlToPost . "show_comment_id=#comment_id#&comment_post_id=#post_id#&" . bitrix_sessid_get(), "HIDE" => $urlToPost . "hide_comment_id=#comment_id#&comment_post_id=#post_id#&" . bitrix_sessid_get(), "DELETE" => $urlToPost . "delete_comment_id=#comment_id#&comment_post_id=#post_id#&" . bitrix_sessid_get(), "USER" => htmlspecialcharsback($arFormatParams["PATH_TO_USER"]));
CRatingsComponentsMain::GetShowRating($arFormatParams);
if ($arFormatParams["SHOW_RATING"] == "Y") {
$arRating = CRatings::GetRatingVoteResult('BLOG_COMMENT', array($arComment["ID"]));
}
$arCommentParams = array("ID" => $commentId, "ENTITY_XML_ID" => "BLOG_" . $arPost["ID"], "FULL_ID" => array("BLOG_" . $arPost["ID"], $commentId), "ACTION" => "REPLY", "APPROVED" => "Y", "PANELS" => array("EDIT" => "N", "MODERATE" => "N", "DELETE" => "N"), "NEW" => "Y", "AUTHOR" => array("ID" => $GLOBALS["USER"]->GetID(), "NAME" => $arAuthor["NAME_FORMATED"], "URL" => $arAuthor["url"], "E-MAIL" => $arComment["AuthorEmail"], "AVATAR" => $arAuthor["PERSONAL_PHOTO_resized"]["src"], "IS_EXTRANET" => is_array($GLOBALS["arExtranetUserID"]) && in_array($GLOBALS["USER"]->GetID(), $GLOBALS["arExtranetUserID"])), "POST_TIMESTAMP" => $arComment["DATE_CREATE_TS"], "POST_TIME" => $arComment["DATE_CREATE_TIME"], "POST_DATE" => $arComment["DateFormated"], "POST_MESSAGE_TEXT" => $arComment["TextFormated"], "POST_MESSAGE_TEXT_MOBILE" => $arComment["TextFormatedMobile"], "URL" => array("LINK" => str_replace(array("##comment_id#", "#comment_id#"), array("", $commentId), $arUrl["LINK"]), "EDIT" => "__blogEditComment('" . $commentId . "', '" . $arPost["ID"] . "');", "MODERATE" => str_replace(array("#source_post_id#", "#post_id#", "#comment_id#", "&" . bitrix_sessid_get()), array($arPost["ID"], $arPost["ID"], $commentId, ""), $arComment["CAN_SHOW"] == "Y" ? $arUrl["SHOW"] : ($arComment["CAN_HIDE"] == "Y" ? $arUrl["HIDE"] : "")), "DELETE" => str_replace(array("#source_post_id#", "#post_id#", "#comment_id#", "&" . bitrix_sessid_get()), array($arPost["ID"], $arPost["ID"], $commentId, ""), $arUrl["DELETE"])), "AFTER" => "", "BEFORE_ACTIONS_MOBILE" => "", "AFTER_MOBILE" => "");
if ($arFormatParams["SHOW_RATING"] == "Y") {
$arRatingData = array("ENTITY_TYPE_ID" => "BLOG_COMMENT", "ENTITY_ID" => $commentId, "OWNER_ID" => $arComment["AUTHOR_ID"], "USER_VOTE" => $arRating[$commentId]["USER_VOTE"], "USER_HAS_VOTED" => $arRating[$commentId]["USER_HAS_VOTED"], "TOTAL_VOTES" => $arRating[$commentId]["TOTAL_VOTES"], "TOTAL_POSITIVE_VOTES" => $arRating[$commentId]["TOTAL_POSITIVE_VOTES"], "TOTAL_NEGATIVE_VOTES" => $arRating[$commentId]["TOTAL_NEGATIVE_VOTES"], "TOTAL_VALUE" => $arRating[$commentId]["TOTAL_VALUE"], "PATH_TO_USER_PROFILE" => $arUrl["USER"]);
ob_start();
$GLOBALS["APPLICATION"]->IncludeComponent("bitrix:rating.vote", $arFormatParams["RATING_TYPE"], $arRatingData, false, array("HIDE_ICONS" => "Y"));
$arCommentParams["BEFORE_ACTIONS"] = ob_get_clean();
ob_start();
$GLOBALS["APPLICATION"]->IncludeComponent("bitrix:rating.vote", "mobile_comment_" . $arFormatParams["RATING_TYPE"], $arRatingData, false, array("HIDE_ICONS" => "Y"));
$arCommentParams["BEFORE_ACTIONS_MOBILE"] = ob_get_clean();
}
$arUFResult = self::BuildUFFields($arComment["UF"]);
$arCommentParams["AFTER"] .= $arUFResult["AFTER"];
$arCommentParams["AFTER_MOBILE"] .= $arUFResult["AFTER_MOBILE"];
if ($arComment["CAN_EDIT"] == "Y") {
ob_start();
?>
<script>
top.text<?php
echo $commentId;
?>
= text<?php
echo $commentId;
?>
= '<?php
echo CUtil::JSEscape(htmlspecialcharsBack($arComment["POST_TEXT"]));
?>
';
top.title<?php
echo $commentId;
?>
= title<?php
echo $commentId;
?>
= '<?php
echo isset($arComment["TITLE"]) ? CUtil::JSEscape($arComment["TITLE"]) : '';
?>
';
top.arComFiles<?php
echo $commentId;
?>
= [];<?php
?>
</script><?php
$arCommentParams["AFTER"] .= ob_get_clean();
}
CPullWatch::AddToStack('UNICOMMENTSBLOG_' . $arPost["ID"], array('module_id' => 'unicomments', 'command' => 'comment', 'params' => $arCommentParams));
//.........这里部分代码省略.........
示例15: getPullingInfo
/**
* 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;
}