本文整理匯總了PHP中forumTextParser::convert方法的典型用法代碼示例。如果您正苦於以下問題:PHP forumTextParser::convert方法的具體用法?PHP forumTextParser::convert怎麽用?PHP forumTextParser::convert使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類forumTextParser
的用法示例。
在下文中一共展示了forumTextParser::convert方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: forumCommentsCommentMobile
function forumCommentsCommentMobile(array $comment, array $arParams, array $arResult, ForumCommentsComponent $component)
{
global $APPLICATION;
$arParams["AVATAR_SIZE"] = intval($arParams["AVATAR_SIZE"]) ?: 58;
static $parser = null;
if ($parser == null) {
$parser = new forumTextParser(false);
$parser->bMobile = true;
$parser->LAZYLOAD = $arParams["LAZYLOAD"] == "Y";
$parser->arFiles = $arResult["FILES"];
}
$parser->arUserfields = $comment["PROPS"];
$text = $parser->convert($comment["~POST_MESSAGE_TEXT"], $comment["ALLOW"]);
$res = array("ID" => $comment["ID"], "NEW" => $comment["NEW"] == "Y" ? "Y" : "N", "APPROVED" => $comment["APPROVED"], "POST_TIMESTAMP" => $comment["POST_TIMESTAMP"], "AUTHOR" => array("ID" => $comment["AUTHOR_ID"], "NAME" => $comment["~NAME"], "LAST_NAME" => $comment["~LAST_NAME"], "SECOND_NAME" => $comment["~SECOND_NAME"], "AVATAR" => $comment["AVATAR"] && $comment["AVATAR"]["FILE"] ? $comment["AVATAR"]["FILE"]['src'] : ""), "FILES" => $comment["FILES"], "UF" => $comment["PROPS"], "POST_MESSAGE_TEXT" => $text, "~POST_MESSAGE_TEXT" => $comment["~POST_MESSAGE_TEXT"], "CLASSNAME" => "", "BEFORE_HEADER" => "", "BEFORE_ACTIONS" => "", "AFTER_ACTIONS" => "", "AFTER_HEADER" => "", "BEFORE" => "", "AFTER" => "", "BEFORE_RECORD" => "", "AFTER_RECORD" => "");
return $res;
}
示例2: Fetch
function Fetch()
{
global $DB;
$arFields = array();
if ($res = parent::Fetch()) {
if (COption::GetOptionString("forum", "MESSAGE_HTML", "N") == "Y" || COption::GetOptionString("forum", "FILTER", "Y") == "Y") {
$res["POST_MESSAGE_HTML"] = trim($res["POST_MESSAGE_HTML"]);
$res["POST_MESSAGE_FILTER"] = trim($res["POST_MESSAGE_FILTER"]);
if (empty($res["POST_MESSAGE_HTML"]) && COption::GetOptionString("forum", "MESSAGE_HTML", "N") == "Y" || empty($res["POST_MESSAGE_FILTER"]) && COption::GetOptionString("forum", "FILTER", "Y") == "Y") {
$arForum = CForumNew::GetByID($res["FORUM_ID"]);
if (COption::GetOptionString("forum", "FILTER", "Y") == "Y" && empty($res["POST_MESSAGE_FILTER"])) {
$arFields["POST_MESSAGE_FILTER"] = CFilterUnquotableWords::Filter($res["POST_MESSAGE"]);
$arFields["POST_MESSAGE_FILTER"] = empty($arFields["POST_MESSAGE_FILTER"]) ? "*" : $arFields["POST_MESSAGE_FILTER"];
}
if (COption::GetOptionString("forum", "MESSAGE_HTML", "N") == "Y" && empty($res["POST_MESSAGE_HTML"])) {
/* Info about one file is saved in old table field ATTACH_IMG */
$arFiles = false;
if (intval($res["ATTACH_IMG"]) > 0) {
$arFiles = array();
$db_files = CForumFiles::GetList(array("MESSAGE_ID" => "ASC"), array("MESSAGE_ID" => $res["ID"]));
if ($db_files && ($res_file = $db_files->Fetch())) {
do {
$res_file["SRC"] = CFile::GetFileSRC($res);
$arFiles[$res_file["ID"]] = $res_file;
} while ($res_file = $db_files->Fetch());
}
}
$parser = new forumTextParser(LANGUAGE_ID);
$allow = forumTextParser::GetFeatures($arForum);
$allow['SMILES'] = $res["USE_SMILES"] == "Y" ? $allow['SMILES'] : "N";
$POST_MESSAGE_HTML = is_set($arFields, "POST_MESSAGE_FILTER") ? $arFields["POST_MESSAGE_FILTER"] : $res["POST_MESSAGE"];
$arFields["POST_MESSAGE_HTML"] = $parser->convert($POST_MESSAGE_HTML, $allow, "html", $arFiles);
}
$strUpdate = $DB->PrepareUpdate("b_forum_message", $arFields);
$strSql = "UPDATE b_forum_message SET " . $strUpdate . " WHERE ID = " . intVal($res["ID"]);
if ($DB->QueryBind($strSql, $arFields, false, "File: " . __FILE__ . "<br>Line: " . __LINE__)) {
foreach ($arFields as $key => $val) {
$res[$key] = $val;
}
}
}
}
if (COption::GetOptionString("forum", "FILTER", "Y") == "Y") {
if (is_set($res, "HTML") || is_set($res, "FM_HTML")) {
$arr = @unserialize(is_set($res, "HTML") ? $res["HTML"] : $res["FM_HTML"]);
if (empty($arr) || !is_array($arr)) {
$arr = array("AUTHOR_NAME" => $res["AUTHOR_NAME"], "AUTHOR_EMAIL" => $res["AUTHOR_EMAIL"], "EDITOR_NAME" => $res["EDITOR_NAME"], "EDITOR_EMAIL" => $res["EDITOR_EMAIL"], "EDIT_REASON" => $res["EDIT_REASON"]);
foreach ($arr as $key => $val) {
if (!empty($val)) {
$val = CFilterUnquotableWords::Filter($val);
$arr[$key] = empty($val) ? "*" : $val;
} else {
$arr[$key] = '';
}
}
$arFields = array("HTML" => serialize($arr));
$strUpdate = $DB->PrepareUpdate("b_forum_message", $arFields);
$strSql = "UPDATE b_forum_message SET " . $strUpdate . " WHERE ID = " . intVal($res["ID"]);
$DB->QueryBind($strSql, $arFields, false, "File: " . __FILE__ . "<br>Line: " . __LINE__);
}
foreach ($arr as $key => $val) {
$res["~" . $key] = $res[$key];
$res["" . $key] = $val;
}
}
if (!empty($res["FT_HTML"])) {
$arr = @unserialize($res["FT_HTML"]);
if (is_array($arr) && !empty($arr["TITLE"])) {
foreach ($arr as $key => $val) {
$res["~FT_" . $key] = $res["FT_" . $key];
$res["FT_" . $key] = $val;
}
}
}
if (!empty($res["F_HTML"])) {
$arr = @unserialize($res["F_HTML"]);
if (is_array($arr)) {
foreach ($arr as $key => $val) {
$res["~F_" . $key] = $res["F_" . $key];
$res["F_" . $key] = $val;
}
}
if (!empty($res["FT_TITLE"])) {
$res["F_TITLE"] = $res["FT_TITLE"];
}
}
}
if (!empty($this->sNameTemplate)) {
$arTmp = array();
foreach (array("AUTHOR_ID" => "AUTHOR_NAME", "EDITOR_ID" => "EDITOR_NAME", "USER_START_ID" => "USER_START_NAME") as $id => $name) {
if (array_key_exists($id, $res)) {
$tmp = "";
if (!empty($res[$id])) {
if (in_array($res[$id], $arTmp)) {
$tmp = $arTmp[$res[$id]];
} else {
$arTmp[$res[$id]] = $tmp = !empty($res[$name . "_FRMT"]) ? $res[$name . "_FRMT"] : CForumUser::GetFormattedNameByUserID($res[$id], $this->sNameTemplate, $id == "AUTHOR_ID" ? $res : array());
}
}
$res[$name] = !empty($tmp) ? $tmp : $res[$name];
//.........這裏部分代碼省略.........
示例3: intVal
$arResult["NAV_STYLE"] = $APPLICATION->GetAdditionalCSS();
$arResult["PAGE_COUNT"] = $db_res->NavPageCount;
$arResult['PAGE_NUMBER'] = $db_res->NavPageNomer;
$number = intVal($db_res->NavPageNomer - 1) * $arParams["MESSAGES_PER_PAGE"] + 1;
$GLOBALS['forumComponent'] =& $this;
while ($res = $db_res->GetNext()) {
/************** Message info ***************************************/
// number in topic
$res["NUMBER"] = $number++;
// data
$res["POST_DATE"] = CForumFormat::DateFormat($arParams["DATE_TIME_FORMAT"], MakeTimeStamp($res["POST_DATE"], CSite::GetDateFormat()));
$res["EDIT_DATE"] = CForumFormat::DateFormat($arParams["DATE_TIME_FORMAT"], MakeTimeStamp($res["EDIT_DATE"], CSite::GetDateFormat()));
// text
$arAllow["SMILES"] = $res["USE_SMILES"] == "Y" ? $arResult["FORUM"]["ALLOW_SMILES"] : "N";
$res["~POST_MESSAGE_TEXT"] = COption::GetOptionString("forum", "FILTER", "Y") == "Y" ? $res["~POST_MESSAGE_FILTER"] : $res["~POST_MESSAGE"];
$res["POST_MESSAGE_TEXT"] = $parser->convert($res["~POST_MESSAGE_TEXT"], $arAllow);
$arAllow["SMILES"] = $arResult["FORUM"]["ALLOW_SMILES"];
// links
if ($arResult["SHOW_PANEL"] == "Y") {
$res["URL"]["REVIEWS"] = $APPLICATION->GetCurPageParam();
$res["URL"]["MODERATE"] = ForumAddPageParams($res["URL"]["REVIEWS"], array("MID" => $res["ID"], "REVIEW_ACTION" => $res["APPROVED"] == "Y" ? "HIDE" : "SHOW")) . "&" . bitrix_sessid_get();
$res["URL"]["DELETE"] = ForumAddPageParams($res["URL"]["REVIEWS"], array("MID" => $res["ID"], "REVIEW_ACTION" => "DEL")) . "&" . bitrix_sessid_get();
}
/************** Message info/***************************************/
/************** Author info ****************************************/
$res["AUTHOR_ID"] = intVal($res["AUTHOR_ID"]);
$res["AUTHOR_URL"] = "";
if (!empty($arParams["URL_TEMPLATES_PROFILE_VIEW"])) {
$res["AUTHOR_URL"] = CComponentEngine::MakePathFromTemplate($arParams["URL_TEMPLATES_PROFILE_VIEW"], array("UID" => $res["AUTHOR_ID"], "USER_ID" => $res["AUTHOR_ID"], "ID" => $res["AUTHOR_ID"]));
}
// avatar
示例4: FormatComment_Report
public static function FormatComment_Report($arFields, $arParams, $bMail = false, $arLog = array())
{
$arResult = array("EVENT_FORMATTED" => array());
if (!CModule::IncludeModule("socialnetwork")) {
return $arResult;
}
if (!$bMail && $arParams["USE_COMMENT"] != "Y") {
$arLog["ENTITY_ID"] = $arFields["ENTITY_ID"];
$arLog["ENTITY_TYPE"] = $arFields["ENTITY_TYPE"];
}
$news_tmp = $arLog["TITLE"];
$title_tmp = GetMessage("REPORT_NEW_COMMENT") . '"' . $arLog["TITLE"] . '"' . "\n";
$title_tmp .= GetMessage("COMMENT_AUTHOR") . CUser::FormatName(CSite::GetNameFormat(false), array("NAME" => $arFields["CREATED_BY_NAME"], "LAST_NAME" => $arFields["CREATED_BY_LAST_NAME"], "SECOND_NAME" => $arFields["CREATED_BY_SECOND_NAME"], "LOGIN" => $arFields["CREATED_BY_LOGIN"]), true) . "\n";
$title_tmp .= GetMessage("COMMENT_TEXT");
$title = str_replace(array("#TITLE#", "#ENTITY#"), array($news_tmp, $bMail ? $arResult["ENTITY"]["FORMATTED"] : $arResult["ENTITY"]["FORMATTED"]["NAME"]), $title_tmp);
$arResult["EVENT_FORMATTED"] = array("TITLE" => $bMail || $arParams["USE_COMMENT"] != "Y" ? $title : "", "MESSAGE" => $bMail ? $arFields["TEXT_MESSAGE"] : $arFields["MESSAGE"]);
$arResult["ENTITY"]["TYPE_MAIL"] = GetMessage("REPORT_TITLE_FOR_MAIL");
if ($bMail) {
$reportURL = COption::GetOptionString("timeman", "WORK_REPORT_PATH", "/company/work_report.php");
if (strlen($reportURL) == 0) {
$reportURL = "/company/work_report.php";
}
$reportURL = CSocNetLogTools::FormatEvent_GetURL(array("URL" => $reportURL, "SITE_ID" => $arFields["LOG_SITE_ID"]));
if (strlen($reportURL) > 0) {
$arResult["EVENT_FORMATTED"]["URL"] = $reportURL . "#user_id=" . $arLog["ENTITY_ID"] . "&report=" . $arLog["SOURCE_ID"];
}
} else {
static $parserLog = false;
if (CModule::IncludeModule("forum")) {
$arAllow = array("HTML" => "N", "ANCHOR" => "Y", "BIU" => "Y", "IMG" => "Y", "LOG_IMG" => "N", "QUOTE" => "Y", "LOG_QUOTE" => "N", "CODE" => "Y", "LOG_CODE" => "N", "FONT" => "Y", "LOG_FONT" => "N", "LIST" => "Y", "SMILES" => "Y", "NL2BR" => "Y", "MULTIPLE_BR" => "N", "VIDEO" => "Y", "LOG_VIDEO" => "N", "USERFIELDS" => $arFields["UF"], "USER" => "Y");
if (!$parserLog) {
$parserLog = new forumTextParser(LANGUAGE_ID);
}
$parserLog->pathToUser = $parserLog->userPath = $arParams["PATH_TO_USER"];
$parserLog->bMobile = $arParams["MOBILE"] == "Y";
$arResult["EVENT_FORMATTED"]["MESSAGE"] = htmlspecialcharsbx($parserLog->convert(htmlspecialcharsback($arResult["EVENT_FORMATTED"]["MESSAGE"]), $arAllow));
} else {
$arAllow = array("HTML" => "N", "ANCHOR" => "Y", "BIU" => "Y", "IMG" => "N", "LOG_IMG" => "N", "QUOTE" => "Y", "LOG_QUOTE" => "N", "CODE" => "Y", "LOG_CODE" => "N", "FONT" => "Y", "LOG_FONT" => "N", "LIST" => "Y", "SMILES" => "Y", "NL2BR" => "Y", "MULTIPLE_BR" => "N", "VIDEO" => "Y", "LOG_VIDEO" => "N", "USERFIELDS" => $arFields["UF"]);
if (!$parserLog) {
$parserLog = new logTextParser(false, $arParams["PATH_TO_SMILE"]);
}
$arResult["EVENT_FORMATTED"]["MESSAGE"] = htmlspecialcharsbx($parserLog->convert(htmlspecialcharsback($arResult["EVENT_FORMATTED"]["MESSAGE"]), array(), $arAllow));
}
if ($arParams["MOBILE"] != "Y" && $arParams["NEW_TEMPLATE"] != "Y") {
if (CModule::IncludeModule("forum")) {
$arResult["EVENT_FORMATTED"]["SHORT_MESSAGE"] = $parserLog->html_cut($parserLog->convert(htmlspecialcharsback($arResult["EVENT_FORMATTED"]["MESSAGE"]), $arAllow), 500);
} else {
$arResult["EVENT_FORMATTED"]["SHORT_MESSAGE"] = $parserLog->html_cut($parserLog->convert(htmlspecialcharsback($arResult["EVENT_FORMATTED"]["MESSAGE"]), array(), $arAllow), 500);
}
$arResult["EVENT_FORMATTED"]["IS_MESSAGE_SHORT"] = CSocNetLogTools::FormatEvent_IsMessageShort($arResult["EVENT_FORMATTED"]["MESSAGE"], $arResult["EVENT_FORMATTED"]["SHORT_MESSAGE"]);
}
}
return $arResult;
}
示例5: array
}
if (!empty($arFiles)) {
$res = CForumFiles::Save($arFiles, $arFields);
$res1 = $GLOBALS['APPLICATION']->GetException();
if ($res1) {
$arError[] = array("id" => "bad files", "text" => $res1->GetString());
}
}
$res = is_array($res) ? $res : array();
foreach ($res as $key => $val) {
$arFilesExists[$key] = $val;
}
$arFilesExists = array_keys($arFilesExists);
sort($arFilesExists);
$arResult["MESSAGE_VIEW"]["FILES"] = $_REQUEST["FILES"] = $arFilesExists;
$arResult["MESSAGE_VIEW"]["TEXT"] = $arResult["POST_MESSAGE_VIEW"] = $parser->convert($_POST["POST_MESSAGE"], $arAllow, "html", $arResult["MESSAGE_VIEW"]["FILES"]);
$arResult["MESSAGE_VIEW"]["FILES_PARSED"] = $parser->arFilesIDParsed;
if ($arParams['AUTOSAVE']) {
$arParams['AUTOSAVE']->Reset();
}
}
if (!empty($arError)) {
$e = new CAdminException($arError);
$arResult["ERROR_MESSAGE"] = $e->GetString();
$bVarsFromForm = true;
}
}
/********************************************************************
/Action
********************************************************************/
$this->IncludeComponentTemplate();
示例6: array
/********************************************************************
/Default values
********************************************************************/
$arResult["PANELS"] = array("MODERATE" => $arResult["USER"]["RIGHTS"]["MODERATE"], "EDIT" => $arResult["USER"]["RIGHTS"]["EDIT"], "DELETE" => $arResult["USER"]["RIGHTS"]["EDIT"]);
/************** Show post form **********************************/
$arResult["SHOW_POST_FORM"] = $arResult["USER"]["RIGHTS"]["ADD_MESSAGE"];
if ($arResult["SHOW_POST_FORM"] == "Y") {
// Author name
$arResult["~REVIEW_AUTHOR"] = $arResult["USER"]["SHOWED_NAME"];
$arResult["~REVIEW_USE_SMILES"] = $arParams["ALLOW_SMILES"] == "Y" ? "Y" : "N";
if ($this->request->getPost("comment_review") == "Y" && $arParams["AUTOSAVE"]) {
$arParams["AUTOSAVE"]->Reset();
}
if (array_key_exists("MESSAGE_VIEW", $arResult)) {
$arParams["SHOW_MINIMIZED"] = "N";
$arResult["MESSAGE_VIEW"] = array("POST_MESSAGE_TEXT" => $parser->convert($arResult["MESSAGE_VIEW"]["POST_MESSAGE"], array_merge($arAllow, array("SMILES" => $arAllow["ALLOW_SMILES"] == "Y" && $arResult["MESSAGE_VIEW"]["USE_SMILES"] == "Y" ? "Y" : "N"))), "AUTHOR_NAME" => htmlspecialcharsEx($arResult["USER"]["SHOWED_NAME"]), "AUTHOR_ID" => intval($arResult["USER"]["ID"]), "AUTHOR_URL" => CComponentEngine::MakePathFromTemplate($arParams["URL_TEMPLATES_PROFILE_VIEW"], array("UID" => $arResult["MESSAGE_VIEW"]["AUTHOR_ID"])), "POST_DATE" => CForumFormat::DateFormat($arParams["DATE_TIME_FORMAT"], time() + CTimeZone::GetOffset()), "FILES" => array());
}
if (!empty($_POST["REVIEW_AUTHOR"])) {
$arResult["~REVIEW_AUTHOR"] = $_POST["REVIEW_AUTHOR"];
}
$arResult["~REVIEW_EMAIL"] = $_POST["REVIEW_EMAIL"];
$arResult["~REVIEW_TEXT"] = $_POST["REVIEW_TEXT"];
$arResult["~REVIEW_USE_SMILES"] = $_POST["REVIEW_USE_SMILES"] == "Y" ? "Y" : "N";
$arResult["REVIEW_AUTHOR"] = htmlspecialcharsEx($arResult["~REVIEW_AUTHOR"]);
$arResult["REVIEW_EMAIL"] = htmlspecialcharsEx($arResult["~REVIEW_EMAIL"]);
$arResult["REVIEW_TEXT"] = htmlspecialcharsEx($arResult["~REVIEW_TEXT"]);
$arResult["REVIEW_USE_SMILES"] = $arResult["~REVIEW_USE_SMILES"];
// Form Info
$arResult["SHOW_PANEL_ATTACH_IMG"] = in_array($arParams["ALLOW_UPLOAD"], array("A", "F", "Y")) ? "Y" : "N";
$arResult["TRANSLIT"] = LANGUAGE_ID == "ru" ? "Y" : " N";
if ($arParams["ALLOW_SMILES"] == "Y") {
示例7: GetMessage
if ($arResult["USER"]["PERSONAL_GENDER"] == "M") {
$arResult["USER"]["PERSONAL_GENDER"] = GetMessage("F_SEX_MALE");
} elseif ($arResult["USER"]["PERSONAL_GENDER"] == "F") {
$arResult["USER"]["PERSONAL_GENDER"] = GetMessage("F_SEX_FEMALE");
}
$arResult["USER"]["PERSONAL_LOCATION"] = GetCountryByID($arResult["USER"]["PERSONAL_COUNTRY"]);
if (!empty($arResult["USER"]["PERSONAL_LOCATION"]) && !empty($arResult["USER"]["PERSONAL_CITY"])) {
$arResult["USER"]["PERSONAL_LOCATION"] .= ", ";
}
$arResult["USER"]["PERSONAL_LOCATION"] .= $arResult["USER"]["PERSONAL_CITY"];
$arResult["USER"]["WORK_LOCATION"] = GetCountryByID($arResult["USER"]["WORK_COUNTRY"]);
if (strlen($arResult["USER"]["WORK_LOCATION"]) > 0 && strlen($arResult["USER"]["WORK_CITY"]) > 0) {
$arResult["USER"]["WORK_LOCATION"] .= ", ";
}
$arResult["USER"]["WORK_LOCATION"] .= $arResult["USER"]["WORK_CITY"];
$arResult["FORUM_USER"]["INTERESTS"] = $parser->convert($arResult["FORUM_USER"]["INTERESTS"], array("HTML" => "N", "ANCHOR" => "Y", "BIU" => "Y", "IMG" => "Y", "VIDEO" => "Y", "LIST" => "Y", "QUOTE" => "Y", "CODE" => "Y", "FONT" => "Y", "SMILES" => "N", "NL2BR" => "Y", "TABLE" => "N", "ALIGN" => "N"));
$arResult["FORUM_USER"]["AVATAR"] = "";
if (!empty($arResult["FORUM_USER"]["~AVATAR"])) {
$arResult["FORUM_USER"]["AVATAR_FILE"] = CFile::GetFileArray($arResult["FORUM_USER"]["~AVATAR"]);
if ($arResult["FORUM_USER"]["AVATAR_FILE"] !== false) {
$arResult["FORUM_USER"]["AVATAR"] = CFile::ShowImage($arResult["FORUM_USER"]["AVATAR_FILE"], COption::GetOptionString("forum", "avatar_max_width", 90), COption::GetOptionString("forum", "avatar_max_height", 90), "border=0", "", true);
}
}
$arResult["USER"]["PERSONAL_PHOTO"] = "";
if (!empty($arResult["USER"]["~PERSONAL_PHOTO"])) {
$arResult["USER"]["PERSONAL_PHOTO_FILE"] = CFile::GetFileArray($arResult["USER"]["~PERSONAL_PHOTO"]);
if ($arResult["USER"]["PERSONAL_PHOTO_FILE"] !== false) {
$arResult["USER"]["PERSONAL_PHOTO"] = CFile::ShowImage($arResult["USER"]["PERSONAL_PHOTO_FILE"], 200, 200, "border=0 alt=\"\"", "", true);
}
}
/************** Getting User rank **********************************/
示例8: SocnetLogMessageAdd
public static function SocnetLogMessageAdd($arParams, $arMessageFields, $action = "")
{
static $parser = null;
if ($parser == null) {
$parser = new forumTextParser();
}
$arAllow = array("HTML" => "N", "ANCHOR" => "N", "BIU" => "N", "IMG" => "N", "LIST" => "N", "QUOTE" => "N", "CODE" => "N", "FONT" => "N", "SMILES" => "N", "UPLOAD" => "Y", "NL2BR" => "N", "TABLE" => "N", "ALIGN" => "N");
// $arParams["LOG_ID"], $arParams["LANG"] ....
$arFieldsForSocnet = array("ENTITY_TYPE" => SONET_ENTITY_GROUP, "ENTITY_ID" => $arParams["ENTITY_ID"], "EVENT_ID" => "forum", "=LOG_DATE" => !!$arMessageFields["DATE_CREATE"] ? $arMessageFields["DATE_CREATE"] : $GLOBALS["DB"]->CurrentTimeFunction(), "LOG_UPDATE" => !!$arMessageFields["POST_DATE"] ? $arMessageFields["POST_DATE"] : null, "TITLE_TEMPLATE" => str_replace("#AUTHOR_NAME#", $arMessageFields["AUTHOR_NAME"], CForumEmail::GetLangMessage("FORUM_MAIL_SOCNET_TITLE_TOPIC", $arParams["LANG"])), "TITLE" => $arMessageFields["TITLE"], "MESSAGE" => $parser->convert($arMessageFields["POST_MESSAGE"], $arAllow), "TEXT_MESSAGE" => $parser->convert4mail($arMessageFields["POST_MESSAGE"]), "URL" => CComponentEngine::MakePathFromTemplate($arParams["URL_TEMPLATES_MESSAGE"], array("UID" => $arMessageFields["AUTHOR_ID"], "FID" => $arMessageFields["FORUM_ID"], "TID" => $arMessageFields["TOPIC_ID"], "TITLE_SEO" => $arMessageFields["TOPIC_ID"], "MID" => $arMessageFields["ID"])), "PARAMS" => serialize(array("PATH_TO_MESSAGE" => CComponentEngine::MakePathFromTemplate($arParams["URL_TEMPLATES_MESSAGE"], array("TID" => $arMessageFields["TOPIC_ID"])))), "MODULE_ID" => false, "CALLBACK_FUNC" => false, "SOURCE_ID" => $arMessageFields["ID"], "RATING_TYPE_ID" => "FORUM_TOPIC", "RATING_ENTITY_ID" => $arMessageFields["TOPIC_ID"]);
if ($arMessageFields["AUTHOR_ID"] > 0) {
$arFieldsForSocnet["USER_ID"] = $arMessageFields["AUTHOR_ID"];
}
$db_res = CForumFiles::GetList(array("ID" => "ASC"), array("MESSAGE_ID" => $arMessageFields["ID"]));
$ufFileID = array();
while ($res = $db_res->Fetch()) {
$ufFileID[] = $res["FILE_ID"];
}
$ufDocID = $GLOBALS["USER_FIELD_MANAGER"]->GetUserFieldValue("FORUM_MESSAGE", "UF_FORUM_MESSAGE_DOC", $arMessageFields["ID"], LANGUAGE_ID);
$logID = $arParams["LOG_ID"];
if ($logID <= 0) {
if (!empty($ufFileID)) {
$arFieldsForSocnet["UF_SONET_LOG_FILE"] = $ufFileID;
}
if ($ufDocID) {
$arFieldsForSocnet["UF_SONET_LOG_DOC"] = $ufDocID;
}
$logID = CSocNetLog::Add($arFieldsForSocnet, false);
if (intval($logID) > 0) {
CSocNetLog::Update($logID, array("TMP_ID" => $logID));
CSocNetLogRights::SetForSonet($logID, $arFieldsForSocnet["ENTITY_TYPE"], $arFieldsForSocnet["ENTITY_ID"], "forum", "view", true);
if ($action == "SEND_EVENT") {
CSocNetLog::SendEvent($logID, "SONET_NEW_EVENT", $logID);
}
}
}
if ($logID > 0 && $action == "ADD_COMMENT") {
if (!empty($ufFileID)) {
$arFieldsForSocnet["UF_SONET_COM_FILE"] = $ufFileID;
}
if ($ufDocID) {
$arFieldsForSocnet["UF_SONET_COM_DOC"] = $ufDocID;
}
$arFieldsForSocnet["LOG_ID"] = $logID;
$arFieldsForSocnet["RATING_TYPE_ID"] = "FORUM_POST";
$arFieldsForSocnet["RATING_ENTITY_ID"] = $arMessageFields["ID"];
$commentID = CSocNetLogComments::Add($arFieldsForSocnet);
CSocNetLog::CounterIncrement($commentID, false, false, "LC");
return $commentID;
}
return $logID;
}
示例9: array
function FormatComment_PhotoAlbum($arFields, $arParams, $bMail = false, $arLog = array())
{
$arResult = array("EVENT_FORMATTED" => array("TITLE" => $bMail || $arParams["USE_COMMENT"] != "Y" ? GetMessage("SONET_GL_COMMENT_TITLE_PHOTO_ALBUM") : "", "MESSAGE" => $bMail ? $arFields["TEXT_MESSAGE"] : $arFields["MESSAGE"]));
if ($bMail) {
} elseif ($arParams["USE_COMMENT"] != "Y") {
$arResult["ENTITY"] = CSocNetLogTools::FormatEvent_GetEntity($arFields, $arParams, false);
}
if ($bMail) {
} else {
static $parserLog = false;
if (CModule::IncludeModule("forum")) {
$arAllow = array("HTML" => "N", "ANCHOR" => "Y", "BIU" => "Y", "IMG" => "Y", "LOG_IMG" => "N", "QUOTE" => "Y", "LOG_QUOTE" => "N", "CODE" => "Y", "LOG_CODE" => "N", "FONT" => "Y", "LOG_FONT" => "N", "LIST" => "Y", "SMILES" => "Y", "NL2BR" => "Y", "MULTIPLE_BR" => "N", "VIDEO" => "Y", "LOG_VIDEO" => "N", "USERFIELDS" => $arFields["UF"], "USER" => $arParams["IM"] == "Y" ? "N" : "Y");
if (!$parserLog) {
$parserLog = new forumTextParser(LANGUAGE_ID);
}
$parserLog->arUserfields = $arFields["UF"];
$parserLog->pathToUser = $parserLog->userPath = $arParams["PATH_TO_USER"];
$parserLog->bMobile = $arParams["MOBILE"] == "Y";
$arResult["EVENT_FORMATTED"]["MESSAGE"] = htmlspecialcharsbx($parserLog->convert(htmlspecialcharsback($arResult["EVENT_FORMATTED"]["MESSAGE"]), $arAllow));
$arResult["EVENT_FORMATTED"]["MESSAGE"] = preg_replace("/\\[user\\s*=\\s*([^\\]]*)\\](.+?)\\[\\/user\\]/is" . BX_UTF_PCRE_MODIFIER, "\\2", $arResult["EVENT_FORMATTED"]["MESSAGE"]);
} else {
$arAllow = array("HTML" => "Y", "ANCHOR" => "Y", "BIU" => "Y", "IMG" => "Y", "LOG_IMG" => "N", "QUOTE" => "Y", "LOG_QUOTE" => "N", "CODE" => "Y", "LOG_CODE" => "N", "FONT" => "Y", "LOG_FONT" => "N", "LIST" => "Y", "SMILES" => "Y", "NL2BR" => "Y", "MULTIPLE_BR" => "N", "VIDEO" => "Y", "LOG_VIDEO" => "N");
if (!$parserLog) {
$parserLog = new logTextParser(false, $arParams["PATH_TO_SMILE"]);
}
$arResult["EVENT_FORMATTED"]["MESSAGE"] = htmlspecialcharsbx($parserLog->convert(htmlspecialcharsback($arResult["EVENT_FORMATTED"]["MESSAGE"]), array(), $arAllow));
}
}
return $arResult;
}
示例10: array
$files = array();
$props = array();
$db_files = CForumFiles::GetList(array("MESSAGE_ID" => "ASC"), array("@MESSAGE_ID" => $ids));
while ($res = $db_files->Fetch()) {
$files[$res["MESSAGE_ID"]] = $files[$res["MESSAGE_ID"]] ?: array();
$files[$res["MESSAGE_ID"]][$res["FILE_ID"]] = $res;
}
if (!empty($arParams["USER_FIELDS"])) {
$db_props = CForumMessage::GetList(array("ID" => "ASC"), array("@ID" => $ids), false, 0, array("SELECT" => $arParams["USER_FIELDS"]));
while ($res = $db_props->Fetch()) {
$props[$res["ID"]] = array_intersect_key($res, array_flip($arParams["USER_FIELDS"]));
}
}
$arAllow = array("HTML" => $arParams["ALLOW_HTML"], "ANCHOR" => $arParams["ALLOW_ANCHOR"], "BIU" => $arParams["ALLOW_BIU"], "IMG" => $arParams["ALLOW_IMG"], "VIDEO" => $arParams["ALLOW_VIDEO"], "LIST" => $arParams["ALLOW_LIST"], "QUOTE" => $arParams["ALLOW_QUOTE"], "CODE" => $arParams["ALLOW_CODE"], "FONT" => $arParams["ALLOW_FONT"], "SMILES" => $arParams["ALLOW_SMILES"], "NL2BR" => $arParams["ALLOW_NL2BR"], "TABLE" => $arParams["ALLOW_TABLE"], "UPLOAD" => $arParams["ALLOW_UPLOAD"], "ALIGN" => $arParams["ALLOW_ALIGN"]);
foreach ($arTopics as &$topic) {
$topic['MESSAGE']["POST_MESSAGE_TEXT"] = $parser->convert($topic['MESSAGE']["~POST_MESSAGE_TEXT"], array_merge($arAllow, array("SMILES" => $topic["MESSAGE"]["USE_SMILES"] == "Y" ? $arParams["ALLOW_SMILES"] : "N", "USERFIELDS" => $props[$topic["MESSAGE"]["ID"]])), "html", $files[$topic["MESSAGE"]["ID"]]);
if ($arParams['TOPIC_POST_MESSAGE_LENGTH'] > 0) {
$symbols_len = strlen(strip_tags($topic['MESSAGE']["POST_MESSAGE_TEXT"]));
if ($symbols_len > $arParams['TOPIC_POST_MESSAGE_LENGTH']) {
$strip_text = $parser->strip_words($topic['MESSAGE']["POST_MESSAGE_TEXT"], $arParams['TOPIC_POST_MESSAGE_LENGTH']);
if ($symbols_len > $arParams['TOPIC_POST_MESSAGE_LENGTH']) {
$strip_text = $strip_text . "...";
}
$topic['MESSAGE']["POST_MESSAGE_TEXT"] = $parser->closetags($strip_text);
}
}
$topic['MESSAGE']["FILES"] = $files[$topic["MESSAGE"]["ID"]];
$topic['MESSAGE']["FILES_PARSED"] = $parser->arFilesIDParsed;
unset($topic["MESSAGE"]["USE_SMILES"]);
}
}
示例11: forumTextParser
if ($arParams["FORUM_ID"]) {
$FORUM_TOPIC_ID = 0;
if ($arParams["REPORT_ID"]) {
$dbReport = CTimeManReportFull::GetByID($arParams["REPORT_ID"]);
$arReport = $dbReport->Fetch();
$FORUM_TOPIC_ID = $arReport["FORUM_TOPIC_ID"];
} else {
if ($arParams['ENTRY_ID']) {
$dbRes = CTimeManEntry::GetByID($arParams['ENTRY_ID']);
$arEntry = $dbRes->Fetch();
$FORUM_TOPIC_ID = $arEntry["FORUM_TOPIC_ID"];
}
}
if ($FORUM_TOPIC_ID > 0) {
CModule::IncludeModule("forum");
$parser = new forumTextParser(LANGUAGE_ID);
$allow = forumTextParser::GetFeatures(CForumNew::GetByID($arParams["FORUM_ID"]));
$db_res = CForumMessage::GetList(array("ID" => "ASC"), array("TOPIC_ID" => $FORUM_TOPIC_ID));
while ($ar_res = $db_res->Fetch()) {
$dbAuthor = CUser::GetByID($ar_res["AUTHOR_ID"]);
$arAuthor = $dbAuthor->Fetch();
$ar_res["AUTHOR_PHOTO"] = $arAuthor['PERSONAL_PHOTO'] > 0 ? CIntranetUtils::InitImage($arAuthor['PERSONAL_PHOTO'], 32, 0, BX_RESIZE_IMAGE_EXACT) : array();
$ar_res["AUTHOR_URL"] = str_replace(array('#ID#', '#USER_ID#'), $ar_res["AUTHOR_ID"], $user_url);
$ar_res["POST_MESSAGE_HTML"] = $parser->convert(COption::GetOptionString("forum", "FILTER", "Y") == "Y" ? $ar_res["POST_MESSAGE_FILTER"] : $ar_res["POST_MESSAGE"], $allow, "html");
$arResult["COMMENTS"][] = $ar_res;
}
}
$this->IncludeComponentTemplate();
}
// *****************************************************************************************
// *****************************************************************************************
示例12: unset
unset($arTmpUserData);
foreach ($arMessagesTmp as $res) {
/* * ************ Message info ************************************** */
// data
$res["~POST_DATE"] = $res["POST_DATE"];
$res["~EDIT_DATE"] = $res["EDIT_DATE"];
$res["POST_DATE"] = CForumFormat::DateFormat($arParams["DATE_TIME_FORMAT"], MakeTimeStamp($res["POST_DATE"], CSite::GetDateFormat()));
$res["EDIT_DATE"] = CForumFormat::DateFormat($arParams["DATE_TIME_FORMAT"], MakeTimeStamp($res["EDIT_DATE"], CSite::GetDateFormat()));
// text
$res["~POST_MESSAGE_TEXT"] = COption::GetOptionString("forum", "FILTER", "Y") == "Y" ? $res["POST_MESSAGE_FILTER"] : $res["POST_MESSAGE"];
if (array_key_exists($res["ID"], $arResult["UFS"])) {
$parser->arUserfields = $res["UF"] = $arResult["UFS"][$res["ID"]];
} else {
$parser->arUserfields = $res["UF"] = array();
}
$res['POST_MESSAGE_TEXT'] = $parser->convert($res['~POST_MESSAGE_TEXT']);
if (is_array($res["UF"])) {
ob_start();
foreach ($res["UF"] as $arPostField) {
if (!empty($arPostField["VALUE"])) {
echo ' <br> ';
$GLOBALS["APPLICATION"]->IncludeComponent("bitrix:system.field.view", $arPostField["USER_TYPE"]["USER_TYPE_ID"], array("arUserField" => $arPostField, "MOBILE" => "Y"), null, array("HIDE_ICONS" => "Y"));
}
}
?>
<script>
BX.ready(function(){
__MB_TASKS_TASK_TOPIC_REVIEWS_viewImageBind(
'tasks-comment-block-<?php
echo $res['ID'];
?>
示例13: array
}
if (!empty($arFiles)) {
$res = CForumFiles::Save($arFiles, $arFields);
$res1 = $GLOBALS['APPLICATION']->GetException();
if ($res1) {
$strErrorMessage .= $res1->GetString();
}
}
$res = is_array($res) ? $res : array();
foreach ($res as $key => $val) {
$arFilesExists[$key] = $val;
}
$arFilesExists = array_keys($arFilesExists);
sort($arFilesExists);
$arResult["MESSAGE_VIEW"]["FILES"] = $_REQUEST["FILES"] = $arFilesExists;
$arResult["MESSAGE_VIEW"]["TEXT"] = $arResult["POST_MESSAGE_VIEW"] = $parser->convert($_POST["POST_MESSAGE"], $arAllow, "html", $arFilesExists);
$arResult["MESSAGE_VIEW"]["FILES_PARSED"] = $parser->arFilesIDParsed;
if ($arParams['AUTOSAVE']) {
$arParams['AUTOSAVE']->Reset();
}
}
}
if (!empty($strErrorMessage)) {
$arResult["ERROR_MESSAGE"] = $strErrorMessage;
$bVarsFromForm = true;
}
}
/************** Show message for ajax ******************************/
if ($arResult["SHOW_MESSAGE_FOR_AJAX"] == "Y") {
$APPLICATION->RestartBuffer();
if (empty($arResult["MESSAGE"])) {
示例14: intval
$arUData["AVATAR"]["HTML"] = CFile::ShowImage($arUData["AVATAR"]["FILE"], COption::GetOptionString("forum", "avatar_max_width", 90), COption::GetOptionString("forum", "avatar_max_height", 90), "border=\"0\"", "", true);
}
// Voting
$arUData["VOTING"] = "N";
if (COption::GetOptionString("forum", "SHOW_VOTES", "Y") == "Y" && $USER->IsAuthorized() && (CForumUser::IsAdmin() || $USER->GetID() != $res["AUTHOR_ID"])) {
$bUnVote = $arUser["Points"];
$bVote = !$arUser["Points"] ? $arResult["USER"]["RANK"]["VOTES"] : intval($arUser["Points"]["POINTS"]) < intval($arResult["USER"]["RANK"]["VOTES"]);
$arUData["VOTING"] = $bVote ? "VOTE" : ($bUnVote ? "UNVOTE" : $res["VOTING"]);
}
// data
$arUData["DATE_REG"] = CForumFormat::DateFormat($arParams["DATE_FORMAT"], MakeTimeStamp($res["DATE_REG"], CSite::GetDateFormat()));
// Another data
$arUData["DESCRIPTION"] = $parser->wrap_long_words($res["DESCRIPTION"]);
$arUData["SIGNATURE"] = "";
if ($arResult["FORUM"]["ALLOW_SIGNATURE"] == "Y" && !empty($res["~SIGNATURE"])) {
$arUData["SIGNATURE"] = $parser->convert($res["~SIGNATURE"], array_merge($arAllow, array("SMILES" => "N")));
}
$UserInfo[$res["AUTHOR_ID"]] = $arUData;
}
$res = array_merge($res, $UserInfo[$res["AUTHOR_ID"]]);
}
// Another data
$res["FOR_JS"]["AUTHOR_NAME"] = Cutil::JSEscape(htmlspecialcharsbx($res["~AUTHOR_NAME"]));
$res["FOR_JS"]["POST_MESSAGE"] = Cutil::JSEscape(htmlspecialcharsbx($res["~POST_MESSAGE_TEXT"]));
/************** Author info/****************************************/
/************** Panels *********************************************/
$res["PANELS"] = array("MODERATE" => $arResult["PANELS"]["MODERATE"], "DELETE" => $arResult["PANELS"]["DELETE"], "SUPPORT" => $arResult["PANELS"]["SUPPORT"] == "Y" && $res["AUTHOR_ID"] > 0 ? "Y" : "N", "EDIT" => $arResult["PANELS"]["EDIT"], "STATISTIC" => $arResult["PANELS"]["STATISTIC"] == "Y" && intVal($res["GUEST_ID"]) > 0 ? "Y" : "N", "MAIN" => $arResult["PANELS"]["MAIN"] == "Y" && $res["AUTHOR_ID"] > 0 ? "Y" : "N", "VOTES" => $res["VOTING"] != "N" ? "Y" : "N");
if ($arResult["USER"]["RIGHTS"]["EDIT_MESSAGE"] == "Y" && $res["AUTHOR_ID"] == $USER->GetId() && ($arResult["USER"]["RIGHTS"]["EDIT_OWN_POST"] == "Y" || $arResult["TOPIC"]["iLAST_TOPIC_MESSAGE"] == intVal($res["ID"]))) {
$res["PANELS"]["EDIT"] = "Y";
}
$res["SHOW_PANEL"] = in_array("Y", $res["PANELS"]) ? "Y" : "N";
示例15: ParseText
function ParseText($text, $arUF, $arParams)
{
static $parser = false;
if (CModule::IncludeModule("forum")) {
if (!$parser) {
$parser = new forumTextParser(LANGUAGE_ID);
}
$parser->pathToUser = $arParams["PATH_TO_USER"];
$parser->arUserfields = $arUF;
$textFormatted = $parser->convert($text, array("HTML" => "N", "ALIGN" => "Y", "ANCHOR" => "Y", "BIU" => "Y", "IMG" => "Y", "QUOTE" => "Y", "CODE" => "Y", "FONT" => "Y", "LIST" => "Y", "SMILES" => "Y", "NL2BR" => "Y", "MULTIPLE_BR" => "N", "VIDEO" => "Y", "LOG_VIDEO" => "N", "SHORT_ANCHOR" => "Y", "USERFIELDS" => $arUF), "html");
} else {
$parser = new logTextParser(false, $arParams["PATH_TO_SMILE"]);
$textFormatted = $parser->convert($text, array(), array("HTML" => "N", "ALIGN" => "Y", "ANCHOR" => "Y", "BIU" => "Y", "IMG" => "Y", "QUOTE" => "Y", "CODE" => "Y", "FONT" => "Y", "LIST" => "Y", "SMILES" => "Y", "NL2BR" => "Y", "MULTIPLE_BR" => "N", "VIDEO" => "Y", "LOG_VIDEO" => "N", "SHORT_ANCHOR" => "Y", "USERFIELDS" => $arUF));
}
if (isset($arParams["MAX_LENGTH"]) && intval($arParams["MAX_LENGTH"]) > 0) {
$textFormatted = $parser->html_cut($textFormatted, $arParams["MAX_LENGTH"]);
}
return $textFormatted;
}