本文整理汇总了PHP中CTextParser类的典型用法代码示例。如果您正苦于以下问题:PHP CTextParser类的具体用法?PHP CTextParser怎么用?PHP CTextParser使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了CTextParser类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: addSignature
public static function addSignature(&$message, $contentType = 0)
{
if (!Bitrix24Manager::isEnabled()) {
return false;
}
self::includeLangFile();
$text = '';
if (!Bitrix24Manager::isPaidAccount()) {
$text = GetMessage('CRM_B24_EMAIL_FREE_LICENSE_SIGNATURE');
} elseif (self::isSignatureEnabled()) {
$text = GetMessage('CRM_B24_EMAIL_PAID_LICENSE_SIGNATURE');
}
if ($text === '') {
return false;
}
if (!\CCrmContentType::IsDefined($contentType)) {
$contentType = \CCrmContentType::PlainText;
}
if ($contentType === \CCrmContentType::BBCode) {
$message .= "\n\n" . $text;
} elseif ($contentType === \CCrmContentType::Html) {
//Convert BBCODE to HTML
$parser = new \CTextParser();
$message .= "<br/><br/>" . $parser->convertText($text);
} elseif ($contentType === \CCrmContentType::PlainText) {
$message .= "\n\n" . preg_replace('/\\[[^\\]]+\\]/', '', $text);
}
return true;
}
示例2: 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)
{
$id = intval($newRecord['MESSAGE_ID']);
if (!\Bitrix\Main\Loader::includeModule('pull')) {
return;
}
$message = \CIMMessenger::GetById($id, array('WITH_FILES' => 'Y'));
if (!$message) {
return;
}
if ($newRecord['PARAM_NAME'] === 'LIKE' && $newRecord["PARAM_VALUE"]) {
$like = $message['PARAMS']['LIKE'];
$result = \Bitrix\IM\ChatTable::getList(array('filter' => array('=ID' => $message['CHAT_ID'])));
$chat = $result->fetch();
$relations = \CIMMessenger::GetRelationById($id);
if (!isset($relations[$newRecord["PARAM_VALUE"]])) {
return;
}
if ($message['AUTHOR_ID'] > 0 && $message['AUTHOR_ID'] != $newRecord["PARAM_VALUE"]) {
$CCTP = new \CTextParser();
$CCTP->MaxStringLen = 200;
$CCTP->allow = array("HTML" => "N", "ANCHOR" => "N", "BIU" => "N", "IMG" => "N", "QUOTE" => "N", "CODE" => "N", "FONT" => "N", "LIST" => "N", "SMILES" => "N", "NL2BR" => "Y", "VIDEO" => "N", "TABLE" => "N", "CUT_ANCHOR" => "N", "ALIGN" => "N");
$message['MESSAGE'] = str_replace('<br />', ' ', $CCTP->convertText($message['MESSAGE']));
$message['MESSAGE'] = preg_replace("/\\[s\\].*?\\[\\/s\\]/i", "", $message['MESSAGE']);
$message['MESSAGE'] = preg_replace("/\\[[bui]\\](.*?)\\[\\/[bui]\\]/i", "\$1", $message['MESSAGE']);
$message['MESSAGE'] = preg_replace("/\\[USER=([0-9]{1,})\\](.*?)\\[\\/USER\\]/i", "\$2", $message['MESSAGE']);
$message['MESSAGE'] = preg_replace("/------------------------------------------------------(.*)------------------------------------------------------/mi", " [" . GetMessage('IM_QUOTE') . "] ", str_replace(array("#BR#"), array(" "), $message['MESSAGE']));
if (count($message['FILES']) > 0 && strlen($message['MESSAGE']) < 200) {
foreach ($message['FILES'] as $file) {
$file = " [" . GetMessage('IM_MESSAGE_FILE') . ": " . $file['name'] . "]";
if (strlen($message['MESSAGE'] . $file) > 200) {
break;
}
$message['MESSAGE'] .= $file;
}
$message['MESSAGE'] = trim($message['MESSAGE']);
}
$isChat = $chat && strlen($chat['TITLE']) > 0;
$dot = strlen($message['MESSAGE']) >= 200 ? '...' : '';
$message['MESSAGE'] = substr($message['MESSAGE'], 0, 199) . $dot;
$message['MESSAGE'] = strlen($message['MESSAGE']) > 0 ? $message['MESSAGE'] : '-';
$arMessageFields = array("MESSAGE_TYPE" => IM_MESSAGE_SYSTEM, "TO_USER_ID" => $message['AUTHOR_ID'], "FROM_USER_ID" => $newRecord["PARAM_VALUE"], "NOTIFY_TYPE" => IM_NOTIFY_FROM, "NOTIFY_MODULE" => "main", "NOTIFY_EVENT" => "rating_vote", "NOTIFY_TAG" => "RATING|IM|" . ($isChat ? 'G' : 'P') . "|" . ($isChat ? $chat['ID'] : $newRecord["PARAM_VALUE"]) . "|" . $id, "NOTIFY_MESSAGE" => GetMessage($isChat ? 'IM_MESSAGE_LIKE' : 'IM_MESSAGE_LIKE_PRIVATE', array('#MESSAGE#' => $message['MESSAGE'], '#TITLE#' => $chat['TITLE'])));
\CIMNotify::Add($arMessageFields);
}
$arPullMessage = array('id' => $id, 'chatId' => $relations[$newRecord["PARAM_VALUE"]]['CHAT_ID'], 'senderId' => $newRecord["PARAM_VALUE"], 'users' => $like);
foreach ($relations as $rel) {
\CPullStack::AddByUser($rel['USER_ID'], array('module_id' => 'im', 'command' => 'messageLike', 'params' => $arPullMessage));
}
}
}
示例3: convertHtmlToBbCode
public static function convertHtmlToBbCode($html)
{
$html = strval($html);
if ($html === '') {
return '';
}
$eventManager = \Bitrix\Main\EventManager::getInstance();
$eventKey = $eventManager->addEventHandlerCompatible("main", "TextParserBeforeTags", array("\\Bitrix\\Crm\\Format\\TextHelper", "onTextParserBeforeTags"));
$textParser = new \CTextParser();
$textParser->allow = array("HTML" => "N", "ANCHOR" => "Y", "BIU" => "Y", "IMG" => "Y", "QUOTE" => "Y", "CODE" => "Y", "FONT" => "Y", "LIST" => "Y", "SMILES" => "Y", "NL2BR" => "Y", "VIDEO" => "Y", "TABLE" => "Y", "CUT_ANCHOR" => "Y", "ALIGN" => "Y");
$result = $textParser->convertText($html);
$result = htmlspecialcharsback($result);
$result = preg_replace("/\\<br\\s*\\/*\\>/is" . BX_UTF_PCRE_MODIFIER, "\n", $result);
$result = preg_replace("/ /is" . BX_UTF_PCRE_MODIFIER, "", $result);
$result = preg_replace("/\\<([^>]*?)>/is" . BX_UTF_PCRE_MODIFIER, "", $result);
$result = htmlspecialcharsbx($result);
$eventManager->removeEventHandler("main", "TextParserBeforeTags", $eventKey);
return $result;
}
示例4: SendUnreadMessages
public function SendUnreadMessages($receiverJId, $domain = "")
{
$receiverJId = trim($receiverJId);
if (strlen($receiverJId) <= 0) {
return false;
}
$receiver = CXMPPUtility::GetUserByJId($receiverJId, $domain);
if (!$receiver) {
return false;
}
$factory = CXMPPFactory::GetFactory();
if (IsModuleInstalled("im") && CModule::IncludeModule("im")) {
$CIMMessage = new CIMMessage($receiverJId, array('hide_link' => true));
$arMessage = $CIMMessage->GetUnreadMessage(array('SPEED_CHECK' => 'N', 'ORDER' => 'ASC', 'USE_SMILES' => 'N', 'USER_LOAD' => 'N', 'LOAD_DEPARTMENT' => 'N'));
if ($arMessage['result']) {
foreach ($arMessage['message'] as $id => $arMessage) {
$factory->__SendMessage($arMessage["senderId"], $arMessage["recipientId"], $arMessage["id"], IM_MESSAGE_PRIVATE, htmlspecialcharsbx(CTextParser::convert4mail(str_replace(array("#BR#", "<br />", "<br>", "<br/>"), "\n", $arMessage["text"]))), $domain);
}
}
// Notify
$CIMNotify = new CIMNotify($receiverJId);
$arNotify = $CIMNotify->GetUnreadNotify(array('SPEED_CHECK' => 'N', 'ORDER' => 'ASC'));
if ($arNotify['result']) {
foreach ($arNotify['original_notify'] as $id => $arNotify) {
if (isset($arNotify["NOTIFY_MODULE"]) && isset($arNotify["NOTIFY_EVENT"]) && !CIMSettings::GetNotifyAccess($arNotify["TO_USER_ID"], $arNotify["NOTIFY_MODULE"], $arNotify["NOTIFY_EVENT"], CIMSettings::CLIENT_XMPP)) {
continue;
}
if ($arNotify["MESSAGE_OUT"] == IM_MAIL_SKIP) {
$arNotify["MESSAGE_OUT"] = '';
}
$factory->__SendMessage($arNotify["FROM_USER_ID"], $arNotify["TO_USER_ID"], $arNotify["ID"], IM_MESSAGE_SYSTEM, htmlspecialcharsbx(CTextParser::convert4mail(str_replace(array("#BR#", "<br />", "<br>", "<br/>"), "\n", strlen($arNotify["MESSAGE_OUT"]) > 0 ? $arNotify["MESSAGE_OUT"] : $arNotify["MESSAGE"]))), $domain);
}
}
} else {
$parser = new CSocNetTextParser();
$dbMessages = CSocNetMessages::GetList(array("DATE_CREATE" => "ASC"), array("TO_USER_ID" => $receiver["ID"], "DATE_VIEW" => "", "TO_DELETED" => "N", "IS_LOG_ALL" => "Y"), false, false, array("ID", "FROM_USER_ID", "TO_USER_ID", "MESSAGE", "DATE_VIEW", "MESSAGE_TYPE", "FROM_DELETED", "TO_DELETED", "IS_LOG"));
while ($arMessage = $dbMessages->Fetch()) {
$factory->__SendMessage($arMessage["IS_LOG"] == "Y" ? -5 : $arMessage["FROM_USER_ID"], $arMessage["TO_USER_ID"], $arMessage["ID"], $arMessage["MESSAGE_TYPE"], htmlspecialcharsbx($parser->convert4mail(str_replace(array("#BR#", "<br />", "<br>", "<br/>"), "\n", $arMessage["MESSAGE"]))), $domain);
}
}
return true;
}
示例5: GetRecentList
public static function GetRecentList($arParams = Array())
{
global $DB, $USER;
$bLoadUnreadMessage = isset($arParams['LOAD_UNREAD_MESSAGE']) && $arParams['LOAD_UNREAD_MESSAGE'] == 'Y'? true: false;
$bTimeZone = isset($arParams['USE_TIME_ZONE']) && $arParams['USE_TIME_ZONE'] == 'N'? false: true;
$bSmiles = isset($arParams['USE_SMILES']) && $arParams['USE_SMILES'] == 'N'? false: true;
$nameTemplate = COption::GetOptionString("im", "user_name_template", "#LAST_NAME# #NAME#", SITE_ID);
$nameTemplateSite = CSite::GetNameFormat(false);
$nameOfSite = CModule::IncludeModule('extranet') && !CExtranet::IsIntranetUser()? "ex": false;
$bIntranetEnable = IsModuleInstalled('intranet') && CModule::IncludeModule('intranet')? true: false;
$arRecent = Array();
$arUsers = Array();
$cache_ttl = 2592000;
$cache_id = $GLOBALS['USER']->GetID();
$cache_dir = '/bx/imc/rec'.CIMMessenger::GetCachePath($cache_id);
$obCache = new CPHPCache();
if($obCache->InitCache($cache_ttl, $cache_id, $cache_dir))
{
$ar = $obCache->GetVars();
$arRecent = $ar['recent'];
$arUsers = $ar['users'];
}
else
{
if (!$bTimeZone)
CTimeZone::Disable();
$strSql = "
SELECT
R.ITEM_TYPE, R.ITEM_ID,
R.ITEM_MID M_ID, M.AUTHOR_ID M_AUTHOR_ID, M.MESSAGE M_MESSAGE, ".$DB->DatetimeToTimestampFunction('M.DATE_CREATE')." M_DATE_CREATE,
C.TITLE C_TITLE, C.AUTHOR_ID C_OWNER_ID,
U.LOGIN, U.NAME, U.LAST_NAME, U.PERSONAL_PHOTO, U.SECOND_NAME, U.PERSONAL_BIRTHDAY, U.PERSONAL_GENDER
FROM
b_im_recent R
LEFT JOIN b_user U ON R.ITEM_TYPE = '".IM_MESSAGE_PRIVATE."' AND R.ITEM_ID = U.ID
LEFT JOIN b_im_chat C ON R.ITEM_TYPE = '".IM_MESSAGE_GROUP."' AND R.ITEM_ID = C.ID
LEFT JOIN b_im_message M ON R.ITEM_MID = M.ID
WHERE R.USER_ID = ".$USER->GetId();
if (!$bTimeZone)
CTimeZone::Enable();
$toDelete = Array();
$CCTP = new CTextParser();
$CCTP->MaxStringLen = 255;
$CCTP->allow = array("HTML" => "N", "ANCHOR" => "Y", "BIU" => "Y", "IMG" => "N", "QUOTE" => "N", "CODE" => "N", "FONT" => "N", "LIST" => "N", "SMILES" => ($bSmiles? "Y": "N"), "NL2BR" => "Y", "VIDEO" => "N", "TABLE" => "N", "CUT_ANCHOR" => "N", "ALIGN" => "N");
$dbRes = $DB->Query($strSql, false, "File: ".__FILE__."<br>Line: ".__LINE__);
while ($arRes = $dbRes->GetNext(true, false))
{
$arRes['ITEM_TYPE'] = trim($arRes['ITEM_TYPE']);
if ($arRes['M_DATE_CREATE']+2592000 < time())
{
$toDelete[$arRes['ITEM_TYPE']][] = $arRes['ITEM_ID'];
continue;
}
$itemId = $arRes['ITEM_ID'];
$item = Array(
'TYPE' => $arRes['ITEM_TYPE'],
'MESSAGE' => Array(
'id' => $arRes['M_ID'],
'senderId' => $arRes['M_AUTHOR_ID'],
'date' => $arRes['M_DATE_CREATE'],
'text' => $CCTP->convertText(preg_replace("/\[s\].*?\[\/s\]/i", "", $arRes['M_MESSAGE']))
)
);
$item['MESSAGE']['text'] = preg_replace("/------------------------------------------------------(.*)------------------------------------------------------/mi", " [".GetMessage('IM_QUOTE')."] ", strip_tags(str_replace(array("<br>","<br/>","<br />", "#BR#"), Array(" "," ", " ", " "), $item['MESSAGE']['text']), "<img>"));
if ($arRes['ITEM_TYPE'] == IM_MESSAGE_PRIVATE)
{
$arUsers[] = $arRes['ITEM_ID'];
$arFileTmp = CFile::ResizeImageGet(
$arRes["PERSONAL_PHOTO"],
array('width' => 58, 'height' => 58),
BX_RESIZE_IMAGE_EXACT,
false
);
$item['USER'] = Array(
'id' => $arRes['ITEM_ID'],
'name' => CUser::FormatName($nameTemplateSite, $arRes, true, false),
'nameList' => CUser::FormatName($nameTemplate, $arRes, true, false),
'avatar' => empty($arFileTmp['src'])? '/bitrix/js/im/images/blank.gif': $arFileTmp['src'],
'gender' => $arRes['PERSONAL_GENDER'] == 'F'? 'F': 'M',
'status' => 'offline',
'birthday' => $arRes['PERSONAL_BIRTHDAY'],
'profile' => CComponentEngine::MakePathFromTemplate(COption::GetOptionString('im', 'path_to_user_profile', "", $nameOfSite), array("user_id" => $arRes["ITEM_ID"]))
);
}
else
{
$itemId = 'chat'.$itemId;
$item['CHAT'] = Array(
'id' => $arRes['ITEM_ID'],
'name' => $arRes["C_TITLE"],
'owner' => $arRes["C_OWNER_ID"],
);
}
//.........这里部分代码省略.........
示例6: getDescription
public function getDescription($format = self::DESCR_FORMAT_HTML)
{
$rc = null;
$format = intval($format);
CTaskAssert::assert(in_array($format, array(self::DESCR_FORMAT_RAW, self::DESCR_FORMAT_HTML, self::DESCR_FORMAT_PLAIN_TEXT), true));
$arTask = $this->getData($bSpecialChars = false);
$description = $arTask['DESCRIPTION'];
if ($format === self::DESCR_FORMAT_RAW) {
return $description;
}
// Now, convert description to HTML
if ($arTask['DESCRIPTION_IN_BBCODE'] === 'Y') {
$parser = new CTextParser();
$description = str_replace("\t", ' ', $parser->convertText($description));
} else {
$description = CTasksTools::SanitizeHtmlDescriptionIfNeed($description);
}
if ($format === self::DESCR_FORMAT_HTML) {
$rc = $description;
} elseif ($format === self::DESCR_FORMAT_PLAIN_TEXT) {
$rc = strip_tags(str_replace(array('<br>', '<br/>', '<br />'), "\n", $description));
} else {
CTaskAssert::log('CTaskItem->getTaskDescription(): unexpected format: ' . $format, CTaskAssert::ELL_ERROR);
CTaskAssert::assert(false);
}
return $rc;
}
示例7: CTextParser
if ('Y' == $arParams['CONVERT_CURRENCY']) {
if (!CModule::IncludeModule('currency')) {
$arParams['CONVERT_CURRENCY'] = 'N';
$arParams['CURRENCY_ID'] = '';
} else {
$arCurrencyInfo = CCurrency::GetByID($arParams['CURRENCY_ID']);
if (!(is_array($arCurrencyInfo) && !empty($arCurrencyInfo))) {
$arParams['CONVERT_CURRENCY'] = 'N';
$arParams['CURRENCY_ID'] = '';
} else {
$arParams['CURRENCY_ID'] = $arCurrencyInfo['CURRENCY'];
$arConvertParams['CURRENCY_ID'] = $arCurrencyInfo['CURRENCY'];
}
}
}
$obParser = new CTextParser();
if (is_array($arParams["PRICE_CODE"])) {
$arResult["PRICES"] = CIBlockPriceTools::GetCatalogPrices(0, $arParams["PRICE_CODE"]);
} else {
$arResult["PRICES"] = array();
}
$arSelect = array("ID", "IBLOCK_ID", "PREVIEW_TEXT", "PREVIEW_PICTURE", "DETAIL_PICTURE");
$arFilter = array("IBLOCK_LID" => SITE_ID, "IBLOCK_ACTIVE" => "Y", "ACTIVE_DATE" => "Y", "ACTIVE" => "Y", "CHECK_PERMISSIONS" => "Y", "MIN_PERMISSION" => "R");
foreach ($arResult["PRICES"] as $value) {
$arSelect[] = $value["SELECT"];
$arFilter["CATALOG_SHOP_QUANTITY_" . $value["ID"]] = 1;
}
$arFilter["=ID"] = $arResult["ELEMENTS"];
$rsElements = CIBlockElement::GetList(array(), $arFilter, false, false, $arSelect);
while ($arElement = $rsElements->Fetch()) {
$arElement["PRICES"] = CIBlockPriceTools::GetItemPrices($arElement["IBLOCK_ID"], $arResult["PRICES"], $arElement, $arParams['PRICE_VAT_INCLUDE'], $arConvertParams);
示例8: killAllTags
public static function killAllTags($text)
{
if (method_exists("CTextParser", "clearAllTags")) {
return CTextParser::clearAllTags($text);
}
$text = strip_tags($text);
$text = preg_replace("#<(/?)quote(.*?)>#is", "", $text);
$text = preg_replace("#<(/?)code(.*?)>#is", "", $text);
$text = preg_replace("#\\[(/?)(b|u|i|list|code|quote|url|img)(.*?)\\]#is", "", $text);
$text = preg_replace("/^(\r|\n)+?(.*)\$/", "\\2", $text);
$text = preg_replace("/^<br>+?(.*)\$/", "\\2", $text);
return $text;
}
示例9: GetFormatNotify
public static function GetFormatNotify($arFields)
{
$CCTP = new CTextParser();
if (isset($arFields['HIDE_LINK']) && $arFields['HIDE_LINK'] == 'Y')
$CCTP->allow["ANCHOR"] = "N";
$CCTP->link_target = "_self";
$arNotify = Array(
'id' => $arFields['ID'],
'type' => $arFields['NOTIFY_TYPE'],
'date' => $arFields['DATE_CREATE'],
'silent' => $arFields['NOTIFY_SILENT']? 'Y': 'N',
'text' => str_replace('#BR#', '<br>', $CCTP->convertText($arFields['MESSAGE'])),
'tag' => strlen($arFields['NOTIFY_TAG'])>0? md5($arFields['NOTIFY_TAG']): '',
'original_tag' => $arFields['NOTIFY_TAG'],
'settingName' => $arFields['NOTIFY_MODULE'].'|'.$arFields['NOTIFY_EVENT']
);
if (!isset($arFields["FROM_USER_DATA"]))
{
$arUsers = CIMContactList::GetUserData(Array('ID' => $arFields['FROM_USER_ID'], 'DEPARTMENT' => 'N', 'USE_CACHE' => 'Y', 'CACHE_TTL' => 86400));
$arFields["FROM_USER_DATA"] = $arUsers['users'];
}
$arNotify['userId'] = $arFields["FROM_USER_ID"];
$arNotify['userName'] = $arFields["FROM_USER_DATA"][$arFields["FROM_USER_ID"]]['name'];
$arNotify['userAvatar'] = $arFields["FROM_USER_DATA"][$arFields["FROM_USER_ID"]]['avatar'];
$arNotify['userLink'] = $arFields["FROM_USER_DATA"][$arFields["FROM_USER_ID"]]['profile'];
if ($arFields['NOTIFY_TYPE'] == IM_NOTIFY_CONFIRM)
{
$arNotify['buttons'] = unserialize($arFields['NOTIFY_BUTTONS']);
}
else
{
$arNotify['title'] = htmlspecialcharsbx($arFields['NOTIFY_TITLE']);
}
return $arNotify;
}
示例10: GetRecentList
public static function GetRecentList($arParams = array())
{
global $DB, $USER;
$bLoadUnreadMessage = isset($arParams['LOAD_UNREAD_MESSAGE']) && $arParams['LOAD_UNREAD_MESSAGE'] == 'Y' ? true : false;
$bTimeZone = isset($arParams['USE_TIME_ZONE']) && $arParams['USE_TIME_ZONE'] == 'N' ? false : true;
$bSmiles = isset($arParams['USE_SMILES']) && $arParams['USE_SMILES'] == 'N' ? false : true;
$userId = isset($arParams['USER_ID']) ? $arParams['USER_ID'] : $USER->GetId();
$nameTemplate = self::GetUserNameTemplate(SITE_ID);
$nameTemplateSite = CSite::GetNameFormat(false);
$bIntranetEnable = IsModuleInstalled('intranet') && CModule::IncludeModule('intranet') ? true : false;
$arRecent = array();
$arUsers = array();
$bColorEnabled = IM\Color::isEnabled();
$cache_ttl = 2592000;
$cache_id = 'im_recent_v8_' . $userId . '_' . $bColorEnabled;
$cache_dir = '/bx/imc/recent' . CIMMessenger::GetCachePath($userId);
$obCache = new CPHPCache();
if ($obCache->InitCache($cache_ttl, $cache_id, $cache_dir)) {
$ar = $obCache->GetVars();
$arRecent = $ar['recent'];
$arUsers = $ar['users'];
} else {
if (!$bTimeZone) {
CTimeZone::Disable();
}
$strSql = "\n\t\t\t\tSELECT\n\t\t\t\t\tR.ITEM_TYPE, R.ITEM_ID,\n\t\t\t\t\tR.ITEM_MID M_ID, M.AUTHOR_ID M_AUTHOR_ID, M.ID M_ID, M.CHAT_ID M_CHAT_ID, M.MESSAGE M_MESSAGE, " . $DB->DatetimeToTimestampFunction('M.DATE_CREATE') . " M_DATE_CREATE,\n\t\t\t\t\tC.TITLE C_TITLE, C.AUTHOR_ID C_OWNER_ID, C.ENTITY_TYPE C_ENTITY_TYPE, C.AVATAR C_AVATAR, C.CALL_NUMBER C_CALL_NUMBER, C.EXTRANET CHAT_EXTRANET, C.COLOR CHAT_COLOR, C.TYPE CHAT_TYPE,\n\t\t\t\t\tU.LOGIN, U.NAME, U.LAST_NAME, U.PERSONAL_PHOTO, U.SECOND_NAME, U.PERSONAL_BIRTHDAY, U.PERSONAL_GENDER, U.EXTERNAL_AUTH_ID, U.WORK_POSITION,\n\t\t\t\t\tC1.USER_ID RID\n\t\t\t\tFROM\n\t\t\t\tb_im_recent R\n\t\t\t\tLEFT JOIN b_user U ON R.ITEM_TYPE = '" . IM_MESSAGE_PRIVATE . "' AND R.ITEM_ID = U.ID\n\t\t\t\tLEFT JOIN b_im_chat C ON R.ITEM_TYPE != '" . IM_MESSAGE_PRIVATE . "' AND R.ITEM_ID = C.ID\n\t\t\t\tLEFT JOIN b_im_message M ON R.ITEM_MID = M.ID\n\t\t\t\tLEFT JOIN b_im_relation C1 ON C1.CHAT_ID = C.ID AND C1.USER_ID = " . $userId . "\n\t\t\t\tWHERE R.USER_ID = " . $userId;
if (!$bTimeZone) {
CTimeZone::Enable();
}
$toDelete = array();
$arMessageId = array();
$CCTP = new CTextParser();
$CCTP->MaxStringLen = 255;
$CCTP->allow = array("HTML" => "N", "ANCHOR" => "Y", "BIU" => "Y", "IMG" => "N", "QUOTE" => "N", "CODE" => "N", "FONT" => "N", "LIST" => "N", "SMILES" => $bSmiles ? "Y" : "N", "NL2BR" => "Y", "VIDEO" => "N", "TABLE" => "N", "CUT_ANCHOR" => "N", "ALIGN" => "N");
$dbRes = $DB->Query($strSql, false, "File: " . __FILE__ . "<br>Line: " . __LINE__);
while ($arRes = $dbRes->GetNext(true, false)) {
$arRes['ITEM_TYPE'] = trim($arRes['ITEM_TYPE']);
if ($arRes['ITEM_TYPE'] == IM_MESSAGE_OPEN) {
if (intval($arRes['RID']) <= 0 && IM\User::getInstance($userId)->isExtranet()) {
continue;
}
} else {
if ($arRes['ITEM_TYPE'] == IM_MESSAGE_CHAT) {
if (intval($arRes['RID']) <= 0) {
continue;
}
}
}
$arMessageId[] = $arRes['M_ID'];
if ($arRes['M_DATE_CREATE'] + 2592000 < time()) {
$toDelete[$arRes['ITEM_TYPE']][] = $arRes['ITEM_ID'];
continue;
}
$itemId = $arRes['ITEM_ID'];
$item = array('TYPE' => $arRes['ITEM_TYPE'], 'MESSAGE' => array('id' => $arRes['M_ID'], 'chatId' => $arRes['M_CHAT_ID'], 'senderId' => $arRes['M_AUTHOR_ID'], 'date' => $arRes['M_DATE_CREATE'], 'text' => $CCTP->convertText(preg_replace("/\\[s\\].*?\\[\\/s\\]/i", "", $arRes['M_MESSAGE']))));
$item['MESSAGE']['text'] = preg_replace('#\\-{54}.+?\\-{54}#s', " [" . GetMessage('IM_QUOTE') . "] ", strip_tags(str_replace(array("<br>", "<br/>", "<br />", "#BR#"), array(" ", " ", " ", " "), $item['MESSAGE']['text']), "<img>"));
if ($arRes['ITEM_TYPE'] == IM_MESSAGE_PRIVATE) {
$arUsers[] = $arRes['ITEM_ID'];
$arFileTmp = CFile::ResizeImageGet($arRes["PERSONAL_PHOTO"], array('width' => 58, 'height' => 58), BX_RESIZE_IMAGE_EXACT, false, false, true);
$item['USER'] = array('id' => $arRes['ITEM_ID'], 'name' => CUser::FormatName($nameTemplateSite, $arRes, true, false), 'nameList' => CUser::FormatName($nameTemplate, $arRes, true, false), 'workPosition' => $arRes['WORK_POSITION'], 'color' => self::GetUserColor($arRes["ID"], $arRes['PERSONAL_GENDER'] == 'M' ? 'M' : 'F'), 'avatar' => empty($arFileTmp['src']) ? '/bitrix/js/im/images/blank.gif' : $arFileTmp['src'], 'status' => 'offline', 'birthday' => $arRes['PERSONAL_BIRTHDAY'], 'gender' => $arRes['PERSONAL_GENDER'] == 'F' ? 'F' : 'M', 'extranet' => false, 'network' => $arRes['EXTERNAL_AUTH_ID'] == self::NETWORK_AUTH_ID, 'phoneDevice' => false, 'profile' => CIMContactList::GetUserPath($arRes["ITEM_ID"]));
} else {
$chatType = $arRes["ITEM_TYPE"] == IM_MESSAGE_OPEN ? 'open' : 'chat';
if ($arRes["C_ENTITY_TYPE"] == 'CALL') {
$chatType = 'call';
}
$itemId = 'chat' . $itemId;
$item['CHAT'] = array('id' => $arRes['ITEM_ID'], 'name' => $arRes["C_TITLE"], 'color' => $arRes["CHAT_COLOR"] == "" ? IM\Color::getColorByNumber($arRes['ITEM_ID']) : IM\Color::getColor($arRes['CHAT_COLOR']), 'avatar' => CIMChat::GetAvatarImage($arRes["C_AVATAR"]), 'extranet' => $arRes["CHAT_EXTRANET"] == "" ? "" : ($arRes["CHAT_EXTRANET"] == "Y" ? true : false), 'owner' => $arRes["C_OWNER_ID"], 'type' => $chatType, 'messageType' => $arRes['CHAT_TYPE'], 'call_number' => $arRes["C_CALL_NUMBER"]);
}
$arRecent[$itemId] = $item;
}
$params = CIMMessageParam::Get($arMessageId);
foreach ($arRecent as $key => $value) {
if (isset($params[$value['MESSAGE']['id']])) {
if (count($params[$value['MESSAGE']['id']]['FILE_ID']) > 0 && strlen(trim($arRecent[$key]['MESSAGE']['text'])) <= 0) {
$arRecent[$key]['MESSAGE']['text'] = "[" . GetMessage('IM_FILE') . "]";
}
$arRecent[$key]['MESSAGE']['params'] = $params[$value['MESSAGE']['id']];
}
}
if (!empty($toDelete)) {
if (isset($toDelete[IM_MESSAGE_PRIVATE])) {
self::DeleteRecent($toDelete[IM_MESSAGE_PRIVATE]);
}
if (isset($toDelete[IM_MESSAGE_CHAT])) {
self::DeleteRecent($toDelete[IM_MESSAGE_CHAT], true);
}
if (isset($toDelete[IM_MESSAGE_OPEN])) {
self::DeleteRecent($toDelete[IM_MESSAGE_OPEN], true);
}
}
$bExtranetEnable = IsModuleInstalled('extranet');
$bVoximplantEnable = IsModuleInstalled('voximplant');
if ($bExtranetEnable || $bVoximplantEnable) {
$arUserPhone = array();
$arUserDepartment = array();
$arSelectParams = array();
if ($bExtranetEnable) {
$arSelectParams[] = 'UF_DEPARTMENT';
}
if ($bVoximplantEnable) {
//.........这里部分代码省略.........
示例11: if
CIMContactList::SetOnline();
CIMMessenger::SetCurrentTab($_POST['TAB']);
}
else if ($_POST['IM_EDIT_MESSAGE'] == 'Y')
{
CUtil::decodeURIComponent($_POST);
if(!CIMMessenger::Update($_POST['ID'], $_POST['MESSAGE']))
{
$arResult = Array(
'ERROR' => 'CANT_EDIT_MESSAGE'
);
}
else
{
$CCTP = new CTextParser();
$CCTP->MaxStringLen = 200;
$CCTP->allow = array("HTML" => "N", "ANCHOR" => "Y", "BIU" => "Y", "IMG" => "N", "QUOTE" => "N", "CODE" => "N", "FONT" => "N", "LIST" => "N", "SMILES" => "Y", "NL2BR" => "Y", "VIDEO" => "N", "TABLE" => "N", "CUT_ANCHOR" => "N", "ALIGN" => "N");
$userTzOffset = isset($_POST['USER_TZ_OFFSET'])? intval($_POST['USER_TZ_OFFSET']): CTimeZone::GetOffset();
$arResult = Array(
'ID' => $insertID,
'MESSAGE' => $CCTP->convertText(htmlspecialcharsbx($_POST['MESSAGE'])),
'DATE' => time()+$userTzOffset,
'ERROR' => ''
);
}
echo CUtil::PhpToJsObject($arResult);
}
示例12: getProgInfoChannel
//.........这里部分代码省略.........
}
?>
"
data-type="broadcast" data-broadcast-id="<?php
echo $arProg["ID"];
?>
"
>
<div class="item-image-holder">
<img data-src="<?php
echo $arProg["PICTURE"]["SRC"];
?>
" alt="">
</div>
<?php
if ($time_pointer) {
?>
<span class="badge" data-channel-id="<?php
echo $arProg["UF_CHANNEL_ID"];
?>
">в эфире</span>
<?php
}
?>
<?php
echo $status_icon;
?>
<?php
echo self::driveNotifyMessage();
?>
<div class="item-header">
<time><?php
echo substr($arProg["DATE_START"], 11, 5);
?>
</time>
<a href="<?php
echo $arProg["DETAIL_PAGE_URL"];
?>
">
<?php
echo self::cutName(\Hawkart\Megatv\ProgTable::getName($arProg));
?>
</a>
</div>
<div class="item-header">
<?php
if (\CTimeEx::dateDiff($start, $datetime) && \CTimeEx::dateDiff($datetime, $end)) {
?>
<?php
$allSecs = strtotime($end) - strtotime($start);
$secs = strtotime($datetime) - strtotime($start);
$proc = ceil($secs / ($allSecs / 100));
$duration = \CTimeEx::secToStr($secs);
?>
<div class="timeline" data-progress="<?php
echo $proc;
?>
">
<span class="progress-bg"></span>
<span>прошло <?php
echo $duration;
?>
</span>
</div>
<?php
}
?>
<span class="descr-trigger" data-type="descr-trigger"><span>×</span></span>
<time><?php
echo substr($arProg["DATE_START"], 11, 5);
?>
</time>
<a href="<?php
echo $arProg["DETAIL_PAGE_URL"];
?>
">
<?php
echo self::cutName(\Hawkart\Megatv\ProgTable::getName($arProg));
?>
</a>
<div class="item-descr">
<?php
$obParser = new \CTextParser();
?>
<p><?php
echo $obParser->html_cut($arProg["UF_DESC"], 600);
?>
</p>
</div>
</div>
</div>
<?php
$content = ob_get_contents();
ob_end_clean();
return $content;
}
示例13: __deprecated_Add
//.........这里部分代码省略.........
if (COption::GetOptionString("tasks", "task_comment_allow_edit") && ($MESSAGE_ID = intval($commentId))) {
$MESSAGE_TYPE = "EDIT";
}
$strErrorMessage = '';
$strOKMessage = '';
$MID = ForumAddMessage($MESSAGE_TYPE, $forumId, $TOPIC_ID, $MESSAGE_ID, $arFieldsG, $strErrorMessage, $strOKMessage, false, $_POST["captcha_word"], 0, $_POST["captcha_code"], $nameTemplate);
if ($MID <= 0 || !empty($strErrorMessage)) {
$arErrorCodes[] = array('code' => 'message is not added 2', 'title' => empty($strErrorMessage) ? NULL : $strErrorMessage);
} else {
$arMessage = CForumMessage::GetByID($MID);
if ($forumTopicId <= 0) {
$forumTopicId = $TID = intVal($arMessage["TOPIC_ID"]);
}
$outForumTopicId = intVal($forumTopicId);
if ($componentName !== null) {
ForumClearComponentCache($componentName);
}
// NOTIFICATION
$arTask["ACCOMPLICES"] = $arTask["AUDITORS"] = array();
$rsMembers = CTaskMembers::GetList(array(), array("TASK_ID" => $arTask["ID"]));
while ($arMember = $rsMembers->Fetch()) {
if ($arMember["TYPE"] == "A") {
$arTask["ACCOMPLICES"][] = $arMember["USER_ID"];
} elseif ($arMember["TYPE"] == "U") {
$arTask["AUDITORS"][] = $arMember["USER_ID"];
}
}
$arEmailUserIDs = array($arTask["RESPONSIBLE_ID"], $arTask["CREATED_BY"]);
$arEmailUserIDs = array_unique(array_merge($arEmailUserIDs, $arTask["ACCOMPLICES"], $arTask["AUDITORS"]));
$currentUserPos = array_search($givenUserId, $arEmailUserIDs);
if ($currentUserPos !== false) {
unset($arEmailUserIDs[$currentUserPos]);
}
$parser = new CTextParser();
$parser->imageWidth = $imageWidth;
$parser->imageHeight = $imageHeight;
$parser->smiles = $arSmiles;
$parser->allow = array("HTML" => $arForum["ALLOW_HTML"], "ANCHOR" => $arForum["ALLOW_ANCHOR"], "BIU" => $arForum["ALLOW_BIU"], "IMG" => "N", "VIDEO" => "N", "LIST" => $arForum["ALLOW_LIST"], "QUOTE" => $arForum["ALLOW_QUOTE"], "CODE" => $arForum["ALLOW_CODE"], "FONT" => $arForum["ALLOW_FONT"], "SMILES" => "N", "UPLOAD" => $arForum["ALLOW_UPLOAD"], "NL2BR" => $arForum["ALLOW_NL2BR"], "TABLE" => "Y");
$arAllow = NULL;
$MESSAGE = HTMLToTxt($parser->convertText($commentText, $arAllow));
// remove [ url] for socialnetwork log
$MESSAGE = preg_replace("/(\\s\\[\\s(http:\\/\\/|https:\\/\\/|ftp:\\/\\/))(.*?)(\\s\\])/is", "", $MESSAGE);
$parser->allow = array("HTML" => 'Y', "ANCHOR" => 'Y', "BIU" => 'Y', "IMG" => "Y", "VIDEO" => "Y", "LIST" => 'N', "QUOTE" => 'Y', "CODE" => 'Y', "FONT" => 'Y', "SMILES" => "N", "UPLOAD" => 'N', "NL2BR" => 'N', "TABLE" => "Y");
$message_notify = $parser->convertText($commentText);
$arRecipientsIDs = CTaskNotifications::GetRecipientsIDs($arTask);
// Instant Messages
if (IsModuleInstalled("im") && CModule::IncludeModule("im") && sizeof($arRecipientsIDs)) {
$pageNumber = CForumMessage::GetMessagePage($MID, $messagesPerPage, $arUserGroupArray);
// There are different links for extranet users
$isExtranetEnabled = false;
if (CModule::IncludeModule("extranet")) {
$isExtranetEnabled = true;
}
if ($isExtranetEnabled) {
$arSites = array();
$dbSite = CSite::GetList($by = "sort", $order = "desc", array("ACTIVE" => "Y"));
while ($arSite = $dbSite->Fetch()) {
if (strlen(trim($arSite["DIR"])) > 0) {
$arSites[$arSite['ID']]['DIR'] = $arSite['DIR'];
} else {
$arSites[$arSite['ID']]['DIR'] = '/';
}
if (strlen(trim($arSite["SERVER_NAME"])) > 0) {
$arSites[$arSite['ID']]['SERVER_NAME'] = $arSite["SERVER_NAME"];
} else {
$arSites[$arSite['ID']]['SERVER_NAME'] = COption::GetOptionString("main", "server_name", $_SERVER["HTTP_HOST"]);
示例14: FormatDate
$arResult["FIELDS_FORMATTED"][$key] = $oFormat->showField($arField);
}
}
$arResult["DATE_WEEK_DAY"] = FormatDate("D", MakeTimeStamp($arParams["~ACTIVITY"]["START_END_TIME"]));
$arResult["DATE_MONTH_DAY"] = FormatDate("j", MakeTimeStamp($arParams["~ACTIVITY"]["START_END_TIME"]));
$arResult["IS_COMPLETED"] = $arParams["~ACTIVITY"]["COMPLETED"] == "Y";
if (!empty($arParams["ACTIVITY"]["DESCRIPTION"])) {
switch ($arParams["ACTIVITY"]["DESCRIPTION_TYPE"]) {
case CCrmContentType::BBCode:
$arResult["DESCRIPTION"] = CCrmLiveFeedComponent::ParseText(htmlspecialcharsback($arParams["ACTIVITY"]["DESCRIPTION"]), array(), array());
break;
case CCrmContentType::Html:
$convertedText = htmlspecialcharsback($arParams["ACTIVITY"]["DESCRIPTION"]);
$convertedText = preg_replace('/<br\\s*\\/*>/i', '#TMPBR#', $convertedText);
$convertedText = preg_replace('/<\\/p>/i', '#TMPBR#', $convertedText);
$convertedText = CTextParser::clearAllTags($convertedText);
$convertedText = str_replace('#TMPBR#', '<br>', $convertedText);
$arResult["DESCRIPTION"] = $convertedText;
break;
default:
$arResult["DESCRIPTION"] = $arParams["ACTIVITY"]["DESCRIPTION"];
}
} else {
$arResult["DESCRIPTION"] = $arParams["ACTIVITY"]["DESCRIPTION"];
}
if (count($arActivity["COMMUNICATIONS"]) > 1) {
$arResult["COMMUNICATION_MORE_CNT"] = count($arActivity["COMMUNICATIONS"]) - 1;
$arResult["CLIENTS_FOR_JS"] = array();
$i = 0;
foreach ($arActivity["COMMUNICATIONS"] as $arCommunication) {
$i++;
示例15: __getRow
function __getRow($arRes, $listName, &$last_change)
{
global $APPLICATION, $USER;
static $tzOffset = null;
if ($tzOffset === null) {
$tzOffset = CTasksTools::getTimeZoneOffset();
}
// Make correct unix timestamp
$change = MakeTimeStamp($arRes['CHANGED_DATE']) - $tzOffset;
if ($last_change < $change) {
$last_change = $change;
}
$obRow = new CXMLCreator('z:row');
$obRow->setAttribute('ows_ID', $arRes['ID']);
$version = $arRes['OUTLOOK_VERSION'] ? $arRes['OUTLOOK_VERSION'] : 1;
if (is_array($arRes['FILES']) && count($arRes['FILES']) > 0) {
$obRow->setAttribute('ows_Attachments', 1);
} else {
$obRow->setAttribute('ows_Attachments', 0);
}
$obRow->setAttribute('ows_owshiddenversion', $version);
$obRow->setAttribute('ows_MetaInfo_vti_versionhistory', md5($arRes['ID']) . ':' . $version);
$obRow->setAttribute('ows_Created', $this->__makeDateTime(MakeTimeStamp($arRes['CREATED_DATE']) - $tzOffset));
$obRow->setAttribute('ows_Modified', $this->__makeDateTime($change));
$obRow->setAttribute('ows_Title', $arRes['TITLE']);
if ($arRes['DESCRIPTION_IN_BBCODE'] === 'Y') {
$parser = new CTextParser();
$obRow->setAttribute('ows_Body', str_replace("\t", ' ', $parser->convertText($arRes['DESCRIPTION'])));
} else {
$obRow->setAttribute('ows_Body', $arRes['DESCRIPTION']);
}
if ($arRes['START_DATE_PLAN']) {
$obRow->setAttribute('ows_StartDate', $this->__makeDateTime(MakeTimeStamp($arRes['START_DATE_PLAN']), true));
}
if ($arRes['DEADLINE']) {
$obRow->setAttribute('ows_DueDate', $this->__makeDateTime(MakeTimeStamp($arRes['DEADLINE']), true));
}
if ($arRes['RESPONSIBLE_ID'] > 0) {
$obRow->setAttribute('ows_AssignedTo', $this->__makeUser($arRes['RESPONSIBLE_ID']));
}
$obRow->setAttribute('ows_Editor', $this->__makeUser($arRes['CHANGED_BY'] ? $arRes['CHANGED_BY'] : $arRes['CREATED_BY']));
$obRow->setAttribute('ows_Priority', $arRes["PRIORITY"]);
$obRow->setAttribute('ows_Status', in_array($arRes["REAL_STATUS"], $this->arNotChoiceStatuses) ? GetMessage("TASKS_STATUS_" . $arRes["REAL_STATUS"]) : $arRes["REAL_STATUS"]);
$obRow->setAttribute('ows_MetaInfo_DateComplete', $this->__makeDateTime(MakeTimeStamp($arRes['CLOSED_DATE'])));
$obRow->setAttribute('ows_MetaInfo_TotalWork', $arRes['DURATION_PLAN'] * 60);
$obRow->setAttribute('ows_MetaInfo_ActualWork', $arRes['DURATION_FACT'] * 60);
$obRow->setAttribute('ows_UniqueId', $arRes['ID'] . ';#' . $listName);
$obRow->setAttribute('ows_FSObjType', $arRes['ID'] . ';#0');
$obRow->setAttribute('ows_PermMask', '0x7fffffffffffffff');
$obRow->setAttribute('ows_ContentTypeId', '0x0108001E749911F9D25F4D90C446E16EEB2C0E');
return $obRow;
}