/** * Sets isEnable property value * @param bool $isEnable */ public static function setEnable($isEnable = true) { if ($isEnable && !self::$isEnable) { self::$onBeforeHandleKey = AddEventHandler("main", "OnBeforeEndBufferContent", array(__CLASS__, "OnBeforeEndBufferContent")); self::$onHandleKey = AddEventHandler("main", "OnEndBufferContent", array(__CLASS__, "OnEndBufferContent")); self::$isEnable = true; \CJSCore::init(array("fc"), false); $actionType = \Bitrix\Main\Context::getCurrent()->getServer()->get("HTTP_BX_ACTION_TYPE"); if ($actionType == "get_dynamic") { //Is it the background request? self::$isBackgroundRequest = true; } } elseif (!$isEnable && self::$isEnable) { if (self::$onBeforeHandleKey >= 0) { RemoveEventHandler("main", "OnBeforeEndBufferContent", self::$onBeforeHandleKey); } if (self::$onBeforeHandleKey >= 0) { RemoveEventHandler("main", "OnEndBufferContent", self::$onHandleKey); } self::$isEnable = false; } }
<?php echo $FIELD_NAME == 'UF_BLOG_POST_DOC' ? "" : "<b>" . $arPostField["EDIT_FORM_LABEL"] . ":</b> "; ?> <?php $APPLICATION->IncludeComponent("bitrix:system.field.view", $arPostField["USER_TYPE"]["USER_TYPE_ID"], array("arUserField" => $arPostField), null, array("HIDE_ICONS" => "Y")); ?> </div> <?php } ?> <?php } ?> <?php if ($eventHandlerID !== false && intval($eventHandlerID) > 0) { RemoveEventHandler('main', 'system.field.view.file', $eventHandlerID); } } ?> </div> <div class="blog-post-meta"> <div class="blog-post-info-bottom"> <div class="blog-post-info"> <div class="blog-author"> <?php if ($arParams["SEO_USER"] == "Y") { ?> <noindex> <a class="blog-author-icon" href="<?php echo $CurPost["urlToAuthor"];
public static function BuildUFFields($arUF) { $arResult = array("AFTER" => "", "AFTER_MOBILE" => ""); if (is_array($arUF) && count($arUF) > 0) { ob_start(); $eventHandlerID = false; $eventHandlerID = AddEventHandler("main", "system.field.view.file", array("CSocNetLogTools", "logUFfileShow")); foreach ($arUF as $FIELD_NAME => $arUserField) { if (!empty($arUserField["VALUE"])) { $GLOBALS["APPLICATION"]->IncludeComponent("bitrix:system.field.view", $arUserField["USER_TYPE"]["USER_TYPE_ID"], array("arUserField" => $arUserField, "MOBILE" => "Y"), null, array("HIDE_ICONS" => "Y")); } } if ($eventHandlerID !== false && intval($eventHandlerID) > 0) { RemoveEventHandler('main', 'system.field.view.file', $eventHandlerID); } $arResult["AFTER_MOBILE"] = ob_get_clean(); ob_start(); $eventHandlerID = false; $eventHandlerID = AddEventHandler("main", "system.field.view.file", array("CSocNetLogTools", "logUFfileShow")); foreach ($arUF as $FIELD_NAME => $arUserField) { if (!empty($arUserField["VALUE"])) { $GLOBALS["APPLICATION"]->IncludeComponent("bitrix:system.field.view", $arUserField["USER_TYPE"]["USER_TYPE_ID"], array("arUserField" => $arUserField), null, array("HIDE_ICONS" => "Y")); } } if ($eventHandlerID !== false && intval($eventHandlerID) > 0) { RemoveEventHandler('main', 'system.field.view.file', $eventHandlerID); } $arResult["AFTER"] .= ob_get_clean(); } return $arResult; }
function ShowComment($comment, $tabCount = 0, $tabSize = 2.5, $canModerate = false, $User = array(), $use_captcha = false, $bCanUserComment = false, $errorComment = false, $arParams = array()) { $comment["urlToAuthor"] = ""; $comment["urlToBlog"] = ""; if ($comment["SHOW_AS_HIDDEN"] == "Y" || $comment["PUBLISH_STATUS"] == BLOG_PUBLISH_STATUS_PUBLISH || $comment["SHOW_SCREENNED"] == "Y" || $comment["ID"] == "preview") { global $prevTab; $tabCount = IntVal($tabCount); if ($tabCount <= 5) { $paddingSize = 2.5 * $tabCount; } elseif ($tabCount > 5 && $tabCount <= 10) { $paddingSize = 2.5 * 5 + ($tabCount - 5) * 1.5; } elseif ($tabCount > 10) { $paddingSize = 2.5 * 5 + 1.5 * 5 + ($tabCount - 10) * 1; } if ($tabCount + 1 <= 5) { $paddingSizeNew = 2.5 * ($tabCount + 1); } elseif ($tabCount + 1 > 5 && $tabCount + 1 <= 10) { $paddingSizeNew = 2.5 * 5 + ($tabCount + 1 - 5) * 1.5; } elseif ($tabCount + 1 > 10) { $paddingSizeNew = 2.5 * 5 + 1.5 * 5 + ($tabCount + 1 - 10) * 1; } $paddingSizeNew -= $paddingSize; if ($prevTab > $tabCount) { $prevTab = $tabCount; } if ($prevTab <= 5) { $prevPaddingSize = 2.5 * $prevTab; } elseif ($prevTab > 5 && $prevTab <= 10) { $prevPaddingSize = 2.5 * 5 + ($prevTab - 5) * 1.5; } elseif ($prevTab > 10) { $prevPaddingSize = 2.5 * 5 + 1.5 * 5 + ($prevTab - 10) * 1; } $prevTab = $tabCount; ?> <div class="blog-comment-line" style="margin-left:<?php echo $prevPaddingSize; ?> em;"></div> <a name="<?php echo $comment["ID"]; ?> "></a> <div class="blog-comment" style="padding-left:<?php echo $paddingSize; ?> em;"> <div id="blg-comment-<?php echo $comment["ID"]; ?> "> <?php if ($comment["PUBLISH_STATUS"] == BLOG_PUBLISH_STATUS_PUBLISH || $comment["SHOW_SCREENNED"] == "Y" || $comment["ID"] == "preview") { $aditStyle = ""; if ($arParams["is_ajax_post"] == "Y" || $comment["NEW"] == "Y") { $aditStyle .= " blog-comment-new"; } if ($comment["AuthorIsAdmin"] == "Y") { $aditStyle = " blog-comment-admin"; } if (IntVal($comment["AUTHOR_ID"]) > 0) { $aditStyle .= " blog-comment-user-" . IntVal($comment["AUTHOR_ID"]); } if ($comment["AuthorIsPostAuthor"] == "Y") { $aditStyle .= " blog-comment-author"; } if ($comment["PUBLISH_STATUS"] != BLOG_PUBLISH_STATUS_PUBLISH && $comment["ID"] != "preview") { $aditStyle .= " blog-comment-hidden"; } if ($comment["ID"] == "preview") { $aditStyle .= " blog-comment-preview"; } ?> <div class="blog-comment-cont<?php echo $aditStyle; ?> "> <div class="blog-comment-cont-white"> <div class="blog-comment-info"> <?php if ($arParams["SHOW_RATING"] == "Y") { ?> <div class="blog-post-rating rating_vote_graphic"> <?php $GLOBALS['APPLICATION']->IncludeComponent("bitrix:rating.vote", $arParams["RATING_TYPE"], array("ENTITY_TYPE_ID" => "BLOG_COMMENT", "ENTITY_ID" => $comment["ID"], "OWNER_ID" => $comment["arUser"]["ID"], "USER_VOTE" => $arParams["RATING"][$comment["ID"]]["USER_VOTE"], "USER_HAS_VOTED" => $arParams["RATING"][$comment["ID"]]["USER_HAS_VOTED"], "TOTAL_VOTES" => $arParams["RATING"][$comment["ID"]]["TOTAL_VOTES"], "TOTAL_POSITIVE_VOTES" => $arParams["RATING"][$comment["ID"]]["TOTAL_POSITIVE_VOTES"], "TOTAL_NEGATIVE_VOTES" => $arParams["RATING"][$comment["ID"]]["TOTAL_NEGATIVE_VOTES"], "TOTAL_VALUE" => $arParams["RATING"][$comment["ID"]]["TOTAL_VALUE"], "PATH_TO_USER_PROFILE" => $arParams["~PATH_TO_USER"], "AJAX_MODE" => "Y"), $arParams["component"], array("HIDE_ICONS" => "Y")); ?> </div> <?php } ?> <?php if (COption::GetOptionString("blog", "allow_alias", "Y") == "Y" && (strlen($comment["urlToBlog"]) > 0 || strlen($comment["urlToAuthor"]) > 0) && array_key_exists("ALIAS", $comment["BlogUser"]) && strlen($comment["BlogUser"]["ALIAS"]) > 0) { $arTmpUser = array("NAME" => "", "LAST_NAME" => "", "SECOND_NAME" => "", "LOGIN" => "", "NAME_LIST_FORMATTED" => $comment["BlogUser"]["~ALIAS"]); } elseif (strlen($comment["urlToBlog"]) > 0 || strlen($comment["urlToAuthor"]) > 0) { $arTmpUser = array("NAME" => $comment["arUser"]["~NAME"], "LAST_NAME" => $comment["arUser"]["~LAST_NAME"], "SECOND_NAME" => $comment["arUser"]["~SECOND_NAME"], "LOGIN" => $comment["arUser"]["~LOGIN"], "NAME_LIST_FORMATTED" => ""); } if (strlen($comment["urlToBlog"]) > 0) { ?> <div class="blog-author"> <?php $GLOBALS["APPLICATION"]->IncludeComponent("bitrix:main.user.link", '', array("ID" => $comment["arUser"]["ID"], "HTML_ID" => "blog_post_comment_" . $comment["arUser"]["ID"], "NAME" => $arTmpUser["NAME"], "LAST_NAME" => $arTmpUser["LAST_NAME"], "SECOND_NAME" => $arTmpUser["SECOND_NAME"], "LOGIN" => $arTmpUser["LOGIN"], "NAME_LIST_FORMATTED" => $arTmpUser["NAME_LIST_FORMATTED"], "USE_THUMBNAIL_LIST" => "N", "PROFILE_URL" => $comment["urlToAuthor"], "PROFILE_URL_LIST" => $comment["urlToBlog"], "PATH_TO_SONET_MESSAGES_CHAT" => $arParams["~PATH_TO_MESSAGES_CHAT"], "PATH_TO_VIDEO_CALL" => $arParams["~PATH_TO_VIDEO_CALL"], "DATE_TIME_FORMAT" => $arParams["DATE_TIME_FORMAT"], "SHOW_YEAR" => $arParams["SHOW_YEAR"], "CACHE_TYPE" => $arParams["CACHE_TYPE"], "CACHE_TIME" => $arParams["CACHE_TIME"], "NAME_TEMPLATE" => $arParams["NAME_TEMPLATE"], "SHOW_LOGIN" => $arParams["SHOW_LOGIN"], "PATH_TO_CONPANY_DEPARTMENT" => $arParams["~PATH_TO_CONPANY_DEPARTMENT"], "PATH_TO_SONET_USER_PROFILE" => $arParams["USE_SOCNET"] == "Y" ? $comment["urlToAuthor"] : $arParams["~PATH_TO_SONET_USER_PROFILE"], "INLINE" => "Y", "SEO_USER" => $arParams["SEO_USER"]), false, array("HIDE_ICONS" => "Y")); ?> </div> <?php } elseif (strlen($comment["urlToAuthor"]) > 0) { ?> <div class="blog-author"> <?php if ($arParams["SEO_USER"] == "Y") { ?> <noindex> <?php } ?> <?php $GLOBALS["APPLICATION"]->IncludeComponent("bitrix:main.user.link", '', array("ID" => $comment["arUser"]["ID"], "HTML_ID" => "blog_post_comment_" . $comment["arUser"]["ID"], "NAME" => $arTmpUser["NAME"], "LAST_NAME" => $arTmpUser["LAST_NAME"], "SECOND_NAME" => $arTmpUser["SECOND_NAME"], "LOGIN" => $arTmpUser["LOGIN"], "NAME_LIST_FORMATTED" => $arTmpUser["NAME_LIST_FORMATTED"], "USE_THUMBNAIL_LIST" => "N", "PROFILE_URL" => $comment["urlToAuthor"], "PATH_TO_SONET_MESSAGES_CHAT" => $arParams["~PATH_TO_MESSAGES_CHAT"], "PATH_TO_VIDEO_CALL" => $arParams["~PATH_TO_VIDEO_CALL"], "DATE_TIME_FORMAT" => $arParams["DATE_TIME_FORMAT"], "SHOW_YEAR" => $arParams["SHOW_YEAR"], "CACHE_TYPE" => $arParams["CACHE_TYPE"], "CACHE_TIME" => $arParams["CACHE_TIME"], "NAME_TEMPLATE" => $arParams["NAME_TEMPLATE"], "SHOW_LOGIN" => $arParams["SHOW_LOGIN"], "PATH_TO_CONPANY_DEPARTMENT" => $arParams["~PATH_TO_CONPANY_DEPARTMENT"], "PATH_TO_SONET_USER_PROFILE" => $arParams["USE_SOCNET"] == "Y" ? $comment["urlToAuthor"] : $arParams["~PATH_TO_SONET_USER_PROFILE"], "INLINE" => "Y", "SEO_USER" => $arParams["SEO_USER"]), false, array("HIDE_ICONS" => "Y")); ?> <?php if ($arParams["SEO_USER"] == "Y") { ?> </noindex> <?php } ?> </div> <?php } else { ?> <div class="blog-author"><?php echo $comment["AuthorName"]; ?> </div> <?php } if (strlen($comment["urlToDelete"]) > 0 && strlen($comment["AuthorEmail"]) > 0) { ?> (<a href="mailto:<?php echo $comment["AuthorEmail"]; ?> "><?php echo $comment["AuthorEmail"]; ?> </a>) <?php } ?> <div class="blog-comment-date"><?php echo $comment["DateFormated"]; ?> </div> </div> <div class="blog-clear-float"></div> <div class="blog-comment-content"> <?php if (strlen($comment["TitleFormated"]) > 0) { ?> <b><?php echo $comment["TitleFormated"]; ?> </b><br /> <?php } ?> <?php echo $comment["TextFormated"]; ?> <?php if (!empty($arParams["arImages"][$comment["ID"]])) { ?> <div class="feed-com-files"> <div class="feed-com-files-title"><?php echo GetMessage("BLOG_PHOTO"); ?> </div> <div class="feed-com-files-cont"> <?php foreach ($arParams["arImages"][$comment["ID"]] as $val) { ?> <span class="feed-com-files-photo"><img src="<?php echo $val["small"]; ?> " alt="" border="0" data-bx-image="<?php echo $val["full"]; ?> "></span><?php } ?> </div> </div> <?php } if ($comment["COMMENT_PROPERTIES"]["SHOW"] == "Y") { $eventHandlerID = AddEventHandler('main', 'system.field.view.file', array('CBlogTools', 'blogUFfileShow')); ?> <div><?php foreach ($comment["COMMENT_PROPERTIES"]["DATA"] as $FIELD_NAME => $arPostField) { if (!empty($arPostField["VALUE"])) { $GLOBALS["APPLICATION"]->IncludeComponent("bitrix:system.field.view", $arPostField["USER_TYPE"]["USER_TYPE_ID"], array("arUserField" => $arPostField), null, array("HIDE_ICONS" => "Y")); } } ?> </div><?php if ($eventHandlerID !== false && intval($eventHandlerID) > 0) { RemoveEventHandler('main', 'system.field.view.file', $eventHandlerID); } } ?> <div class="blog-comment-meta"> <?php if ($bCanUserComment === true) { ?> <span class="blog-comment-answer"><a href="javascript:void(0)" onclick="return showComment('<?php echo $comment["ID"]; ?> ')"><?php echo GetMessage("B_B_MS_REPLY"); ?> </a></span> <span class="blog-vert-separator"></span> <?php } if (IntVal($comment["PARENT_ID"]) > 0) { ?> <span class="blog-comment-parent"><a href="#<?php echo $comment["PARENT_ID"]; ?> "><?php echo GetMessage("B_B_MS_PARENT"); ?> </a></span> <span class="blog-vert-separator"></span> <?php } ?> <span class="blog-comment-link"><a href="#<?php echo $comment["ID"]; ?> "><?php echo GetMessage("B_B_MS_LINK"); ?> </a></span> <?php if ($comment["CAN_EDIT"] == "Y") { ?> <script> top.text<?php echo $comment["ID"]; ?> = text<?php echo $comment["ID"]; ?> = '<?php echo CUtil::JSEscape($comment["~POST_TEXT"]); ?> '; top.title<?php echo $comment["ID"]; ?> = title<?php echo $comment["ID"]; ?> = '<?php echo CUtil::JSEscape($comment["TITLE"]); ?> '; </script> <span class="blog-vert-separator"></span> <span class="blog-comment-edit"><a href="javascript:void(0)" onclick="return editComment('<?php echo $comment["ID"]; ?> ')"><?php echo GetMessage("BPC_MES_EDIT"); ?> </a></span> <?php } if (strlen($comment["urlToShow"]) > 0) { ?> <span class="blog-vert-separator"></span> <span class="blog-comment-show"> <?php if ($arParams["AJAX_POST"] == "Y") { ?> <a href="javascript:void(0)" onclick="return hideShowComment('<?php echo $comment["urlToShow"] . "&" . bitrix_sessid_get(); ?> ', '<?php echo $comment["ID"]; ?> ');" title="<?php echo GetMessage("BPC_MES_SHOW"); ?> "> <?php } else { ?> <a href="<?php echo $comment["urlToShow"] . "&" . bitrix_sessid_get(); ?> " title="<?php echo GetMessage("BPC_MES_SHOW"); ?> "> <?php } ?> <?php echo GetMessage("BPC_MES_SHOW"); ?> </a></span> <?php } if (strlen($comment["urlToHide"]) > 0) { ?> <span class="blog-vert-separator"></span> <span class="blog-comment-show"> <?php if ($arParams["AJAX_POST"] == "Y") { ?> <a href="javascript:void(0)" onclick="return hideShowComment('<?php echo $comment["urlToHide"] . "&" . bitrix_sessid_get(); ?> &IBLOCK_ID=<?php echo $_REQUEST["IBLOCK_ID"]; ?> &ELEMENT_ID=<?php echo $_REQUEST["ELEMENT_ID"]; ?> ', '<?php echo $comment["ID"]; ?> ');" title="<?php echo GetMessage("BPC_MES_HIDE"); ?> "> <?php } else { ?> <a href="<?php echo $comment["urlToHide"] . "&" . bitrix_sessid_get(); ?> &IBLOCK_ID=<?php echo $_REQUEST["IBLOCK_ID"]; ?> &ELEMENT_ID=<?php echo $_REQUEST["ELEMENT_ID"]; ?> " title="<?php echo GetMessage("BPC_MES_HIDE"); ?> "> <?php } ?> <?php echo GetMessage("BPC_MES_HIDE"); ?> </a></span> <?php } if (strlen($comment["urlToDelete"]) > 0) { ?> <span class="blog-vert-separator"></span> <span class="blog-comment-delete"> <?php if ($arParams["AJAX_POST"] == "Y") { ?> <a href="javascript:void(0)" onclick="if(confirm('<?php echo GetMessage("BPC_MES_DELETE_POST_CONFIRM"); ?> ')) deleteComment('<?php echo $comment["urlToDelete"] . "&" . bitrix_sessid_get(); ?> &IBLOCK_ID=<?php echo $_REQUEST["IBLOCK_ID"]; ?> &ELEMENT_ID=<?php echo $_REQUEST["ELEMENT_ID"]; ?> ', '<?php echo $comment["ID"]; ?> ');" title="<?php echo GetMessage("BPC_MES_DELETE"); ?> "> <?php } else { ?> <a href="javascript:if(confirm('<?php echo GetMessage("BPC_MES_DELETE_POST_CONFIRM"); ?> ')) window.location='<?php echo $comment["urlToDelete"] . "&" . bitrix_sessid_get(); ?> &IBLOCK_ID=<?php echo $_REQUEST["IBLOCK_ID"]; ?> &ELEMENT_ID=<?php echo $_REQUEST["ELEMENT_ID"]; ?> '" title="<?php echo GetMessage("BPC_MES_DELETE"); ?> "> <?php } ?> <?php echo GetMessage("BPC_MES_DELETE"); ?> </a></span> <?php } if (strlen($comment["urlToSpam"]) > 0) { ?> <span class="blog-vert-separator"></span> <span class="blog-comment-delete blog-comment-spam"><a href="<?php echo $comment["urlToSpam"]; ?> " title="<?php echo GetMessage("BPC_MES_SPAM_TITLE"); ?> "><?php echo GetMessage("BPC_MES_SPAM"); ?> </a></span> <?php } if ($arParams["SHOW_RATING"] == "Y") { ?> <span class="rating_vote_text"> <span class="blog-vert-separator"></span> <?php $GLOBALS["APPLICATION"]->IncludeComponent("bitrix:rating.vote", $arParams["RATING_TYPE"], array("ENTITY_TYPE_ID" => "BLOG_COMMENT", "ENTITY_ID" => $comment["ID"], "OWNER_ID" => $comment["arUser"]["ID"], "USER_VOTE" => $arParams["RATING"][$comment["ID"]]["USER_VOTE"], "USER_HAS_VOTED" => $arParams["RATING"][$comment["ID"]]["USER_HAS_VOTED"], "TOTAL_VOTES" => $arParams["RATING"][$comment["ID"]]["TOTAL_VOTES"], "TOTAL_POSITIVE_VOTES" => $arParams["RATING"][$comment["ID"]]["TOTAL_POSITIVE_VOTES"], "TOTAL_NEGATIVE_VOTES" => $arParams["RATING"][$comment["ID"]]["TOTAL_NEGATIVE_VOTES"], "TOTAL_VALUE" => $arParams["RATING"][$comment["ID"]]["TOTAL_VALUE"], "PATH_TO_USER_PROFILE" => $arParams["~PATH_TO_USER"]), $arParams["component"], array("HIDE_ICONS" => "Y")); ?> </span> <?php } ?> </div> </div> </div> </div> <div class="blog-clear-float"></div> <?php if (strlen($errorComment) <= 0 && (strlen($_POST["preview"]) > 0 && $_POST["show_preview"] != "N") && (IntVal($_POST["parentId"]) > 0 || IntVal($_POST["edit_id"]) > 0) && (IntVal($_POST["parentId"]) == $comment["ID"] && IntVal($_POST["edit_id"]) <= 0 || IntVal($_POST["edit_id"]) > 0 && IntVal($_POST["edit_id"]) == $comment["ID"] && $comment["CAN_EDIT"] == "Y")) { $level = 0; $commentPreview = array("ID" => "preview", "TitleFormated" => htmlspecialcharsEx($_POST["subject"]), "TextFormated" => $_POST["commentFormated"], "AuthorName" => $User["NAME"], "DATE_CREATE" => GetMessage("B_B_MS_PREVIEW_TITLE")); ShowComment($commentPreview, IntVal($_POST["edit_id"]) == $comment["ID"] && $comment["CAN_EDIT"] == "Y" ? $level : $level + 1, 2.5, false, array(), false, false, false, $arParams); } if (strlen($errorComment) > 0 && $bCanUserComment === true && (IntVal($_POST["parentId"]) == $comment["ID"] || IntVal($_POST["edit_id"]) == $comment["ID"])) { ?> <div class="blog-errors blog-note-box blog-note-error"> <div class="blog-error-text"> <?php echo $errorComment; ?> </div> </div> <?php } ?> </div> <div id="err_comment_<?php echo $comment['ID']; ?> "></div> <div id="form_comment_<?php echo $comment['ID']; ?> "></div> <div id="new_comment_cont_<?php echo $comment['ID']; ?> " style="padding-left:<?php echo $paddingSizeNew; ?> em;"></div> <div id="new_comment_<?php echo $comment['ID']; ?> " style="display:none;"></div> <?php if ((strlen($errorComment) > 0 || strlen($_POST["preview"]) > 0) && (IntVal($_POST["parentId"]) == $comment["ID"] || IntVal($_POST["edit_id"]) == $comment["ID"]) && $bCanUserComment === true) { ?> <script> top.text<?php echo $comment["ID"]; ?> = text<?php echo $comment["ID"]; ?> = '<?php echo CUtil::JSEscape($_POST["comment"]); ?> '; top.title<?php echo $comment["ID"]; ?> = title<?php echo $comment["ID"]; ?> = '<?php echo CUtil::JSEscape($_POST["subject"]); ?> '; <?php if (IntVal($_POST["edit_id"]) == $comment["ID"]) { ?> editComment('<?php echo $comment["ID"]; ?> ');<?php } else { ?> showComment('<?php echo $comment["ID"]; ?> ', 'Y', '<?php echo CUtil::JSEscape($_POST["user_name"]); ?> ', '<?php echo CUtil::JSEscape($_POST["user_email"]); ?> ', 'Y');<?php } ?> </script> <?php } } elseif ($comment["SHOW_AS_HIDDEN"] == "Y") { echo "<b>" . GetMessage("BPC_HIDDEN_COMMENT") . "</b>"; } ?> </div> <?php } }
/** * Sets isEnable property value and attaches needed handlers. * * @param bool $isEnabled Mode control flag. * * @return void */ public static function setEnable($isEnabled = true) { if ($isEnabled && !self::$isEnabled) { self::$onBeforeHandleKey = AddEventHandler("main", "OnBeforeEndBufferContent", array(self::getInstance(), "onBeforeEndBufferContent")); self::$onRestartBufferHandleKey = AddEventHandler("main", "OnBeforeRestartBuffer", array(__CLASS__, "onBeforeRestartBuffer")); self::$onBeforeLocalRedirect = AddEventHandler("main", "OnBeforeLocalRedirect", array(__CLASS__, "onBeforeLocalRedirect"), 2); self::$isEnabled = true; \CJSCore::init(array("fc"), false); } elseif (!$isEnabled && self::$isEnabled) { if (self::$onBeforeHandleKey >= 0) { RemoveEventHandler("main", "OnBeforeEndBufferContent", self::$onBeforeHandleKey); } if (self::$onRestartBufferHandleKey >= 0) { RemoveEventHandler("main", "OnBeforeRestartBuffer", self::$onRestartBufferHandleKey); } if (self::$onBeforeLocalRedirect >= 0) { RemoveEventHandler("main", "OnBeforeLocalRedirect", self::$onBeforeLocalRedirect); } self::$isEnabled = false; } }
public static function ParseHTMLToBB($html = "") { $id = AddEventHandler("main", "TextParserBeforeTags", array("CCalendar", "_ParseHack")); $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"); $html = $TextParser->convertText($html); $html = htmlspecialcharsback($html); // Replace BR $html = preg_replace("/\\<br\\s*\\/*\\>/is" . BX_UTF_PCRE_MODIFIER, "\n", $html); // Kill $html = preg_replace("/ /is" . BX_UTF_PCRE_MODIFIER, "", $html); // Kill tags $html = preg_replace("/\\<([^>]*?)>/is" . BX_UTF_PCRE_MODIFIER, "", $html); $html = htmlspecialcharsbx($html); RemoveEventHandler("main", "TextParserBeforeTags", $id); return $html; }
function __removeHandlers() { RemoveEventHandler('main', 'OnBeforeRestartBuffer', $this->RestartBufferHandlerId); RemoveEventHandler('main', 'OnBeforeLocalRedirect', $this->LocalRedirectHandlerId); }
return $CID; if ($arParams['EDIT'] == 'Y') $CID = $arResult['UID']; return true; } } ob_start(); $eventHandlerID = AddEventHandler("webdav", "webdav.user.field", "__main_post_form_get_cid_webdav"); $APPLICATION->IncludeComponent( "freetrix:system.field.edit", "webdav_element", array("arUserField" => $arParams["UPLOAD_WEBDAV_ELEMENT"]), null, array("HIDE_ICONS" => "Y") ); RemoveEventHandler("webdav", "webdav.user.field", $eventHandlerID); $arParams["UPLOAD_WEBDAV_ELEMENT_HTML"] = ob_get_clean(); $arParams["UPLOAD_WEBDAV_ELEMENT_CID"] = __main_post_form_get_cid_webdav(); } /***************** Show files from array ***************************/ $b = reset($arParams["FILES"]["VALUE"]); reset($arParams["UPLOAD_FILE"]["INPUT_VALUE"]); $arFile = ($b ? $b : current($arParams["UPLOAD_FILE"]["INPUT_VALUE"])); while ($arFile) { $arFile = (is_array($arFile) ? $arFile : (array_key_exists($arFile, $arParams["UPLOAD_FILE"]["INPUT_VALUE_ARRAY"]) ? $arParams["UPLOAD_FILE"]["INPUT_VALUE_ARRAY"][$arFile] : CFile::GetFileArray($arFile))); $arFile["THUMBNAIL"] = (isset($arFile["src"]) ? $arFile["src"] : $arFile["THUMBNAIL"]); // for Blog only if ((substr($arFile["CONTENT_TYPE"], 0, 6) == "image/") && empty($arFile["THUMBNAIL"])) {
$arResult["arComments"][$key]["EVENT"]["RATING_TOTAL_VOTES"] = 0; } if (strlen($rating_entity_type) > 0) { $arResult["arComments"][$key]["EVENT_FORMATTED"]["ALLOW_VOTE"] = CRatings::CheckAllowVote(array("ENTITY_TYPE_ID" => $rating_entity_type, "OWNER_ID" => $arResult["arComments"][$key]["EVENT"]["USER_ID"])); } if (is_array($arResult["arComments"][$key]["UF"]) && count($arResult["arComments"][$key]["UF"]) > 0) { ob_start(); $eventHandlerID = false; $eventHandlerID = AddEventHandler("main", "system.field.view.file", "__logUFfileShowMobile"); foreach ($arResult["arComments"][$key]["UF"] as $FIELD_NAME => $arUserField) { if (!empty($arUserField["VALUE"])) { $GLOBALS["APPLICATION"]->IncludeComponent("bitrix:system.field.view", $arUserField["USER_TYPE"]["USER_TYPE_ID"], array("arUserField" => $arUserField, "MOBILE" => "Y"), null, array("HIDE_ICONS" => "Y")); } } if ($eventHandlerID !== false && intval($eventHandlerID) > 0) { RemoveEventHandler("main", "system.field.view.file", $eventHandlerID); } $strUFBlock = ob_get_contents(); ob_end_clean(); $arResult["arComments"][$key]["EVENT_FORMATTED"]["UF_FORMATTED"] = $strUFBlock; } $arResult["arComments"][$key]["EVENT_FORMATTED"]["CAN_EDIT"] = $bHasEditCallback && intval($arResult["arComments"][$key]["EVENT"]["USER_ID"]) > 0 && intval($arResult["arComments"][$key]["EVENT"]["USER_ID"]) == $GLOBALS["USER"]->GetId() ? "Y" : "N"; $arResult["arComments"][$key]["EVENT_FORMATTED"]["CAN_DELETE"] = $bHasDeleteCallback && $arResult["arComments"][$key]["EVENT_FORMATTED"]["CAN_EDIT"] == "Y" ? "Y" : "N"; $timestamp = MakeTimeStamp($arResult["arComments"][$key]["EVENT"]["LOG_DATE"]); $arFormat = array("tommorow" => "tommorow, " . GetMessage("SONET_LOG_COMMENT_FORMAT_TIME"), "today" => "today, " . GetMessage("SONET_LOG_COMMENT_FORMAT_TIME"), "yesterday" => "yesterday, " . GetMessage("SONET_LOG_COMMENT_FORMAT_TIME"), "" => date("Y", $timestamp) == date("Y") ? GetMessage("SONET_LOG_COMMENT_FORMAT_DATE") : GetMessage("SONET_LOG_COMMENT_FORMAT_DATE_YEAR")); $arResult["arComments"][$key]["EVENT_FORMATTED"]["DATETIME"] = FormatDate($arFormat, $timestamp); } } } elseif ($action == "get_more_destination") { $arResult["arDestinations"] = false; $log_id = intval($_REQUEST["log_id"]);
$postText = ob_get_contents(); ob_end_clean(); $bSuccess = true; } } $GLOBALS["APPLICATION"]->RestartBuffer(); if (!$bSuccess) { echo $_POST["response_type"] == "json" ? CUtil::PhpToJSObject(array("error" => "*")) : "*"; } else { echo $_POST["response_type"] == "json" ? CUtil::PhpToJSObject(array("text" => $postText)) : $postText; } die; } $LocalRedirectHandlerId = AddEventHandler('main', 'OnBeforeLocalRedirect', "LocalRedirectHandler"); $APPLICATION->IncludeComponent("bitrix:socialnetwork.blog.post.edit", "mobile_empty", array("ID" => $_POST["ACTION"] == "EDIT_POST" && intval($_POST["post_id"]) > 0 ? intval($_POST["post_id"]) : 0, "USER_ID" => $_POST["ACTION"] == "EDIT_POST" && intval($_POST["post_user_id"]) > 0 ? intval($_POST["post_user_id"]) : $GLOBALS["USER"]->GetID(), "PATH_TO_POST_EDIT" => $APPLICATION->GetCurPageParam("success=Y&new_post_id=#post_id#"), "PATH_TO_POST" => "/company/personal/user/" . $GLOBALS["USER"]->GetID() . "/blog/#post_id#/", "USE_SOCNET" => "Y", "SOCNET_GROUP_ID" => intval($_REQUEST["group_id"]), "GROUP_ID" => IsModuleInstalled("bitrix24") ? $GLOBAL_BLOG_GROUP[SITE_ID] : 1, "MOBILE" => "Y"), false, array("HIDE_ICONS" => "Y")); RemoveEventHandler('main', 'OnBeforeLocalRedirect', $LocalRedirectHandlerId); $GLOBALS["APPLICATION"]->RestartBuffer(); echo $_POST["response_type"] == "json" ? CUtil::PhpToJSObject(array("error" => "*")) : "*"; die; } $filter = false; if ($_GET["favorites"] == "Y") { $filter = "favorites"; } elseif ($_GET["my"] == "Y") { $filter = "my"; } elseif ($_GET["important"] == "Y") { $filter = "important"; } elseif ($_GET["work"] == "Y") { $filter = "work"; } elseif ($_GET["bizproc"] == "Y") { $filter = "bizproc";
function ShowComment($comment, $tabCount = 0, $tabSize = 2.5, $canModerate = false, $User = array(), $use_captcha = false, $bCanUserComment = false, $errorComment = false, $arParams = array()) { $comment['urlToAuthor'] = ""; $comment['urlToBlog'] = ""; if ($comment['SHOW_AS_HIDDEN'] == "Y" || $comment['PUBLISH_STATUS'] == BLOG_PUBLISH_STATUS_PUBLISH || $comment['SHOW_SCREENNED'] == "Y" || $comment['ID'] == "preview") { global $prevTab; $tabCount = IntVal($tabCount); if ($tabCount <= 5) { $paddingSize = 2.5 * $tabCount; } elseif ($tabCount > 5 && $tabCount <= 10) { $paddingSize = 2.5 * 5 + ($tabCount - 5) * 1.5; } elseif ($tabCount > 10) { $paddingSize = 2.5 * 5 + 1.5 * 5 + ($tabCount - 10) * 1; } if ($tabCount + 1 <= 5) { $paddingSizeNew = 2.5 * ($tabCount + 1); } elseif ($tabCount + 1 > 5 && $tabCount + 1 <= 10) { $paddingSizeNew = 2.5 * 5 + ($tabCount + 1 - 5) * 1.5; } elseif ($tabCount + 1 > 10) { $paddingSizeNew = 2.5 * 5 + 1.5 * 5 + ($tabCount + 1 - 10) * 1; } $paddingSizeNew -= $paddingSize; $prevTab = $tabCount; ?> <a name="<?php echo $comment['ID']; ?> "></a> <div class="b-comments__item" style="margin-left:<?php echo $paddingSize; ?> em;"> <div id="blg-comment-<?php echo $comment['ID']; ?> "> <?php if ($comment['PUBLISH_STATUS'] == BLOG_PUBLISH_STATUS_PUBLISH || $comment['SHOW_SCREENNED'] == "Y" || $comment['ID'] == "preview") { $expertLink = in_array(COMMUNITY_GROUP_ID, CUser::GetUserGroup($comment['arUser']['ID'])) ? '/community/experts/' . $comment['arUser']['ID'] . '/' : false; $aditStyle = ""; if ($arParams['is_ajax_post'] == "Y" || $comment['NEW'] == "Y") { $aditStyle .= " blog-comment-new"; } if ($comment['AuthorIsAdmin'] == "Y") { $aditStyle = " blog-comment-admin"; } if (IntVal($comment['AUTHOR_ID']) > 0) { $aditStyle .= " blog-comment-user-" . IntVal($comment['AUTHOR_ID']); } if ($comment['AuthorIsPostAuthor'] == "Y") { $aditStyle .= " blog-comment-author"; } if ($comment['PUBLISH_STATUS'] != BLOG_PUBLISH_STATUS_PUBLISH && $comment['ID'] != "preview") { $aditStyle .= " blog-comment-hidden"; } if ($comment['ID'] == "preview") { $aditStyle .= " blog-comment-preview"; } ?> <div class="blog-comment-cont<?php echo $aditStyle; ?> "> <div class="blog-comment-cont-white clearfix"><?php if (!empty($comment['arUser']['PERSONAL_PHOTO'])) { $img = CFile::ResizeImageGet($comment['arUser']['PERSONAL_PHOTO'], array('width' => 100, 'height' => 100), BX_RESIZE_IMAGE_EXACT); if (empty($expertLink)) { ?> <div class="b-comments__avatar"><img src="<?php echo $img['src']; ?> " alt="<?php echo $comment['AuthorName']; ?> " class="b-comments__image"></div><?php } else { ?> <a href="<?php echo $expertLink; ?> " class="b-comments__avatar"><img src="<?php echo $img['src']; ?> " alt="<?php echo $comment['AuthorName']; ?> " class="b-comments__image"></a><?php } } ?> <div class="b-comments__holder"> <?php if ($arParams['SHOW_RATING'] == "Y") { ?> <div class="blog-post-rating rating_vote_graphic"> <?php $GLOBALS['APPLICATION']->IncludeComponent("bitrix:rating.vote", $arParams['RATING_TYPE'], array("ENTITY_TYPE_ID" => "BLOG_COMMENT", "ENTITY_ID" => $comment['ID'], "OWNER_ID" => $comment['arUser']['ID'], "USER_VOTE" => $arParams['RATING'][$comment['ID']]['USER_VOTE'], "USER_HAS_VOTED" => $arParams['RATING'][$comment['ID']]['USER_HAS_VOTED'], "TOTAL_VOTES" => $arParams['RATING'][$comment['ID']]['TOTAL_VOTES'], "TOTAL_POSITIVE_VOTES" => $arParams['RATING'][$comment['ID']]['TOTAL_POSITIVE_VOTES'], "TOTAL_NEGATIVE_VOTES" => $arParams['RATING'][$comment['ID']]['TOTAL_NEGATIVE_VOTES'], "TOTAL_VALUE" => $arParams['RATING'][$comment['ID']]['TOTAL_VALUE'], "PATH_TO_USER_PROFILE" => $arParams['~PATH_TO_USER']), $arParams['component'], array("HIDE_ICONS" => "Y")); ?> </div> <?php } /*if (COption::GetOptionString("blog", "allow_alias", "Y") == "Y" && (strlen($comment['urlToBlog']) > 0 || strlen($comment['urlToAuthor']) > 0) && array_key_exists("ALIAS", $comment['BlogUser']) && strlen($comment['BlogUser']['ALIAS']) > 0) $arTmpUser = array( "NAME" => "", "LAST_NAME" => "", "SECOND_NAME" => "", "LOGIN" => "", "NAME_LIST_FORMATTED" => $comment['BlogUser']['~ALIAS'], ); elseif (strlen($comment['urlToBlog']) > 0 || strlen($comment['urlToAuthor']) > 0) $arTmpUser = array( "NAME" => $comment['arUser']['~NAME'], "LAST_NAME" => $comment['arUser']['~LAST_NAME'], "SECOND_NAME" => $comment['arUser']['~SECOND_NAME'], "LOGIN" => $comment['arUser']['~LOGIN'], "NAME_LIST_FORMATTED" => "", ); if(strlen($comment['urlToBlog'])>0) { $GLOBALS['APPLICATION']->IncludeComponent("bitrix:main.user.link", '', array( "ID" => $comment['arUser']['ID'], "HTML_ID" => "blog_post_comment_".$comment['arUser']['ID'], "NAME" => $arTmpUser['NAME'], "LAST_NAME" => $arTmpUser['LAST_NAME'], "SECOND_NAME" => $arTmpUser['SECOND_NAME'], "LOGIN" => $arTmpUser['LOGIN'], "NAME_LIST_FORMATTED" => $arTmpUser['NAME_LIST_FORMATTED'], "USE_THUMBNAIL_LIST" => "N", "PROFILE_URL" => $comment['urlToAuthor'], "PROFILE_URL_LIST" => $comment['urlToBlog'], "PATH_TO_SONET_MESSAGES_CHAT" => $arParams['~PATH_TO_MESSAGES_CHAT'], "PATH_TO_VIDEO_CALL" => $arParams['~PATH_TO_VIDEO_CALL'], "DATE_TIME_FORMAT" => $arParams['DATE_TIME_FORMAT'], "SHOW_YEAR" => $arParams['SHOW_YEAR'], "CACHE_TYPE" => $arParams['CACHE_TYPE'], "CACHE_TIME" => $arParams['CACHE_TIME'], "NAME_TEMPLATE" => $arParams['NAME_TEMPLATE'], "SHOW_LOGIN" => $arParams['SHOW_LOGIN'], "PATH_TO_CONPANY_DEPARTMENT" => $arParams['~PATH_TO_CONPANY_DEPARTMENT'], "PATH_TO_SONET_USER_PROFILE" => ($arParams['USE_SOCNET'] == "Y" ? $comment['urlToAuthor'] : $arParams['~PATH_TO_SONET_USER_PROFILE']), "INLINE" => "Y", "SEO_USER" => $arParams['SEO_USER'], ), false, array("HIDE_ICONS" => "Y") ); } elseif(strlen($comment['urlToAuthor'])>0) { if($arParams['SEO_USER'] == "Y"):?> <noindex> <?endif;?> <? $GLOBALS['APPLICATION']->IncludeComponent("bitrix:main.user.link", '', array( "ID" => $comment['arUser']['ID'], "HTML_ID" => "blog_post_comment_".$comment['arUser']['ID'], "NAME" => $arTmpUser['NAME'], "LAST_NAME" => $arTmpUser['LAST_NAME'], "SECOND_NAME" => $arTmpUser['SECOND_NAME'], "LOGIN" => $arTmpUser['LOGIN'], "NAME_LIST_FORMATTED" => $arTmpUser['NAME_LIST_FORMATTED'], "USE_THUMBNAIL_LIST" => "N", "PROFILE_URL" => $comment['urlToAuthor'], "PATH_TO_SONET_MESSAGES_CHAT" => $arParams['~PATH_TO_MESSAGES_CHAT'], "PATH_TO_VIDEO_CALL" => $arParams['~PATH_TO_VIDEO_CALL'], "DATE_TIME_FORMAT" => $arParams['DATE_TIME_FORMAT'], "SHOW_YEAR" => $arParams['SHOW_YEAR'], "CACHE_TYPE" => $arParams['CACHE_TYPE'], "CACHE_TIME" => $arParams['CACHE_TIME'], "NAME_TEMPLATE" => $arParams['NAME_TEMPLATE'], "SHOW_LOGIN" => $arParams['SHOW_LOGIN'], "PATH_TO_CONPANY_DEPARTMENT" => $arParams['~PATH_TO_CONPANY_DEPARTMENT'], "PATH_TO_SONET_USER_PROFILE" => ($arParams['USE_SOCNET'] == "Y" ? $comment['urlToAuthor'] : $arParams['~PATH_TO_SONET_USER_PROFILE']), "INLINE" => "Y", "SEO_USER" => $arParams['SEO_USER'], ), false, array("HIDE_ICONS" => "Y") ); ?> <?if($arParams['SEO_USER'] == "Y"):?> </noindex> <?endif; } else { echo $comment['AuthorName']; } if(strlen($comment['urlToDelete'])>0 && strlen($comment['AuthorEmail'])>0) { ?> (<a href="mailto:<?=$comment['AuthorEmail']?>"><?=$comment['AuthorEmail']?></a>) <? } echo $comment['DateFormated']; <a href="#" class="b-comments__name link">Константин Китманов</a>*/ $post = ''; if (!empty($comment['arUser']['WORK_POSITION'])) { $post .= $comment['arUser']['WORK_POSITION']; } if (!empty($comment['arUser']['UF_JOB']) && ($job = CInc::getJobName($comment['arUser']['UF_JOB']))) { if (!empty($post)) { $post .= ', '; } $post .= $job; } ?> <div class="b-comments__name"> <?php if ($comment['arUser']['NAME'] != '') { ?> <span class="name"><?php echo $comment['arUser']['NAME']; ?> </span> <?php if ($comment['arUser']['LAST_NAME]'] != '') { ?> <span class="last-name"><?php echo $comment['arUser']['LAST_NAME']; ?> </span> <?php } ?> <?php } ?> </div> <?php if (!empty($post)) { echo '<div class="b-comments__post">' . $post . '</div>'; } ?> <div class="b-comments__text"><?php if (strlen($comment['TitleFormated']) > 0) { ?> <b><?php echo $comment['TitleFormated']; ?> </b><br /><?php } echo $comment['TextFormated']; if (!empty($arParams['arImages'][$comment['ID']])) { ?> <div class="feed-com-files"> <div class="feed-com-files-title"><?php echo GetMessage("BLOG_PHOTO"); ?> </div> <div class="feed-com-files-cont"> <?php foreach ($arParams['arImages'][$comment['ID']] as $val) { ?> <span class="feed-com-files-photo"><img src="<?php echo $val['small']; ?> " alt="" border="0" data-bx-image="<?php echo $val['full']; ?> "></span><?php } ?> </div> </div> <?php } if ($comment['COMMENT_PROPERTIES']['SHOW'] == "Y") { $eventHandlerID = AddEventHandler('main', 'system.field.view.file', array('CBlogTools', 'blogUFfileShow')); ?> <div><?php foreach ($comment['COMMENT_PROPERTIES']['DATA'] as $FIELD_NAME => $arPostField) { if (!empty($arPostField['VALUE'])) { $GLOBALS['APPLICATION']->IncludeComponent("bitrix:system.field.view", $arPostField['USER_TYPE']['USER_TYPE_ID'], array("arUserField" => $arPostField), null, array("HIDE_ICONS" => "Y")); } } ?> </div><?php if ($eventHandlerID !== false && intval($eventHandlerID) > 0) { RemoveEventHandler('main', 'system.field.view.file', $eventHandlerID); } } ?> </div><?php if ($bCanUserComment === true) { ?> <a href="javascript:void(0)" onclick="return showComment('<?php echo $comment['ID']; ?> ')" class="b-comments__button m_t20"><i class="ico i_bubble-gray"></i><?php echo GetMessage("B_B_MS_REPLY"); ?> </a><?php } if ($comment['CAN_EDIT'] == "Y") { ?> <script> top.text<?php echo $comment['ID']; ?> = text<?php echo $comment['ID']; ?> = '<?php echo CUtil::JSEscape($comment['~POST_TEXT']); ?> '; top.title<?php echo $comment['ID']; ?> = title<?php echo $comment['ID']; ?> = '<?php echo CUtil::JSEscape($comment['TITLE']); ?> '; </script> <a class="b-comments__button m_t20" href="javascript:void(0)" onclick="return editComment('<?php echo $comment['ID']; ?> ')"><?php echo GetMessage("BPC_MES_EDIT"); ?> </a> <?php } if (strlen($comment['urlToShow']) > 0) { if ($arParams['AJAX_POST'] == "Y") { ?> <a href="javascript:void(0)" class="b-comments__button m_t20" onclick="return hideShowComment('<?php echo $comment['urlToShow'] . "&" . bitrix_sessid_get(); ?> ', '<?php echo $comment['ID']; ?> ');" title="<?php echo GetMessage("BPC_MES_SHOW"); ?> "> <?php } else { ?> <a href="<?php echo $comment['urlToShow'] . "&" . bitrix_sessid_get(); ?> " class="b-comments__button m_t20" title="<?php echo GetMessage("BPC_MES_SHOW"); ?> "> <?php } ?> <?php echo GetMessage("BPC_MES_SHOW"); ?> </a> <?php } if (strlen($comment['urlToHide']) > 0) { if ($arParams['AJAX_POST'] == "Y") { ?> <a class="b-comments__button m_t20" href="javascript:void(0)" onclick="return hideShowComment('<?php echo $comment['urlToHide'] . "&" . bitrix_sessid_get(); ?> &IBLOCK_ID=<?php echo $_REQUEST['IBLOCK_ID']; ?> &ELEMENT_ID=<?php echo $_REQUEST['ELEMENT_ID']; ?> ', '<?php echo $comment['ID']; ?> ');" title="<?php echo GetMessage("BPC_MES_HIDE"); ?> "> <?php } else { ?> <a class="b-comments__button m_t20" href="<?php echo $comment['urlToHide'] . "&" . bitrix_sessid_get(); ?> &IBLOCK_ID=<?php echo $_REQUEST['IBLOCK_ID']; ?> &ELEMENT_ID=<?php echo $_REQUEST['ELEMENT_ID']; ?> " title="<?php echo GetMessage("BPC_MES_HIDE"); ?> "> <?php } ?> <?php echo GetMessage("BPC_MES_HIDE"); ?> </a> <?php } if (strlen($comment['urlToDelete']) > 0) { if ($arParams['AJAX_POST'] == "Y") { ?> <a class="b-comments__button m_t20" href="javascript:void(0)" onclick="if(confirm('<?php echo GetMessage("BPC_MES_DELETE_POST_CONFIRM"); ?> ')) deleteComment('<?php echo $comment['urlToDelete'] . "&" . bitrix_sessid_get(); ?> &IBLOCK_ID=<?php echo $_REQUEST['IBLOCK_ID']; ?> &ELEMENT_ID=<?php echo $_REQUEST['ELEMENT_ID']; ?> ', '<?php echo $comment['ID']; ?> ');" title="<?php echo GetMessage("BPC_MES_DELETE"); ?> "> <?php } else { ?> <a class="b-comments__button m_t20" href="javascript:if(confirm('<?php echo GetMessage("BPC_MES_DELETE_POST_CONFIRM"); ?> ')) window.location='<?php echo $comment['urlToDelete'] . "&" . bitrix_sessid_get(); ?> &IBLOCK_ID=<?php echo $_REQUEST['IBLOCK_ID']; ?> &ELEMENT_ID=<?php echo $_REQUEST['ELEMENT_ID']; ?> '" title="<?php echo GetMessage("BPC_MES_DELETE"); ?> "> <?php } ?> <?php echo GetMessage("BPC_MES_DELETE"); ?> </a> <?php } if (strlen($comment['urlToSpam']) > 0) { ?> <a class="b-comments__button m_t20" href="<?php echo $comment['urlToSpam']; ?> " title="<?php echo GetMessage("BPC_MES_SPAM_TITLE"); ?> "><?php echo GetMessage("BPC_MES_SPAM"); ?> </a><?php } /* if(IntVal($comment['PARENT_ID'])>0) { ?> <span class="blog-comment-parent"><a href="#<?=$comment['PARENT_ID']?>"><?=GetMessage("B_B_MS_PARENT")?></a></span> <span class="blog-vert-separator"></span> <? } ?> <span class="blog-comment-link"><a href="#<?=$comment['ID']?>"><?=GetMessage("B_B_MS_LINK")?></a></span> <? if ($arParams['SHOW_RATING'] == "Y") { ?> <span class="rating_vote_text"> <span class="blog-vert-separator"></span> <?$GLOBALS['APPLICATION']->IncludeComponent( "bitrix:rating.vote", $arParams['RATING_TYPE'], Array( "ENTITY_TYPE_ID" => "BLOG_COMMENT", "ENTITY_ID" => $comment['ID'], "OWNER_ID" => $comment['arUser']['ID'], "USER_VOTE" => $arParams['RATING'][$comment['ID']]['USER_VOTE'], "USER_HAS_VOTED" => $arParams['RATING'][$comment['ID']]['USER_HAS_VOTED'], "TOTAL_VOTES" => $arParams['RATING'][$comment['ID']]['TOTAL_VOTES'], "TOTAL_POSITIVE_VOTES" => $arParams['RATING'][$comment['ID']]['TOTAL_POSITIVE_VOTES'], "TOTAL_NEGATIVE_VOTES" => $arParams['RATING'][$comment['ID']]['TOTAL_NEGATIVE_VOTES'], "TOTAL_VALUE" => $arParams['RATING'][$comment['ID']]['TOTAL_VALUE'], "PATH_TO_USER_PROFILE" => $arParams['~PATH_TO_USER'], ), $arParams['component'], array("HIDE_ICONS" => "Y") );?> </span> <? }*/ ?> </div> </div> </div><?php if (strlen($errorComment) <= 0 && (strlen($_POST['preview']) > 0 && $_POST['show_preview'] != "N") && (IntVal($_POST['parentId']) > 0 || IntVal($_POST['edit_id']) > 0) && (IntVal($_POST['parentId']) == $comment['ID'] && IntVal($_POST['edit_id']) <= 0 || IntVal($_POST['edit_id']) > 0 && IntVal($_POST['edit_id']) == $comment['ID'] && $comment['CAN_EDIT'] == "Y")) { $level = 0; $commentPreview = array("ID" => "preview", "TitleFormated" => htmlspecialcharsEx($_POST['subject']), "TextFormated" => $_POST['commentFormated'], "AuthorName" => $User['NAME'], "DATE_CREATE" => GetMessage("B_B_MS_PREVIEW_TITLE")); ShowComment($commentPreview, IntVal($_POST['edit_id']) == $comment['ID'] && $comment['CAN_EDIT'] == "Y" ? $level : $level + 1, 2.5, false, array(), false, false, false, $arParams); } if (strlen($errorComment) > 0 && $bCanUserComment === true && (IntVal($_POST['parentId']) == $comment['ID'] || IntVal($_POST['edit_id']) == $comment['ID'])) { ?> <div class="blog-errors blog-note-box blog-note-error"> <div class="blog-error-text"> <?php echo $errorComment; ?> </div> </div> <?php } ?> </div> <div id="err_comment_<?php echo $comment['ID']; ?> "></div> <div id="form_comment_<?php echo $comment['ID']; ?> "></div> <div id="new_comment_cont_<?php echo $comment['ID']; ?> " style="padding-left:<?php echo $paddingSizeNew; ?> em;"></div> <div id="new_comment_<?php echo $comment['ID']; ?> " style="display:none;"></div> <?php if ((strlen($errorComment) > 0 || strlen($_POST['preview']) > 0) && (IntVal($_POST['parentId']) == $comment['ID'] || IntVal($_POST['edit_id']) == $comment['ID']) && $bCanUserComment === true) { ?> <script> top.text<?php echo $comment['ID']; ?> = text<?php echo $comment['ID']; ?> = '<?php echo CUtil::JSEscape($_POST['comment']); ?> '; top.title<?php echo $comment['ID']; ?> = title<?php echo $comment['ID']; ?> = '<?php echo CUtil::JSEscape($_POST['subject']); ?> '; <?php if (IntVal($_POST['edit_id']) == $comment['ID']) { ?> editComment('<?php echo $comment['ID']; ?> ');<?php } else { ?> showComment('<?php echo $comment['ID']; ?> ', 'Y', '<?php echo CUtil::JSEscape($_POST['user_name']); ?> ', '<?php echo CUtil::JSEscape($_POST['user_email']); ?> ', 'Y');<?php } ?> </script> <?php } } elseif ($comment['SHOW_AS_HIDDEN'] == "Y") { echo "<b>" . GetMessage("BPC_HIDDEN_COMMENT") . "</b>"; } ?> </div> <?php } }
function _ib_elm_add($arFields, $bWorkFlow = false, $bUpdateSearch = true, $bResizePictures = false) { global $USER_FIELD_MANAGER; global $APPLICATION; $bUF = isset($arFields['USER_FIELDS']); if ($bUF) { $UF_ENTITY = $this->GetUfEntity(); if (!$USER_FIELD_MANAGER->CheckFields($UF_ENTITY, 0, $arFields['USER_FIELDS'])) { if (is_object($APPLICATION) && $APPLICATION->GetException()) { $e = $APPLICATION->GetException(); $this->LAST_ERROR .= $e->GetString(); return false; } } $handlerID = AddEventHandler('search', 'BeforeIndex', array($this, 'IndexUfValues')); } if ($bUpdateSearch && $bUF) { $bUpdateSearch = false; } $el = new CIBlockElement(); $result = $el->Add($arFields, $bWorkFlow, $bUpdateSearch, $bResizePictures); $ID = intval($result); if ($ID <= 0) { $this->LAST_ERROR = $el->LAST_ERROR; return false; } else { if (isset($arFields['PROPERTY_VALUES']) && !$this->ValidatePropertyValues($ID, $arFields['PROPERTY_VALUES'], $arFields['IBLOCK_ID'])) { $this->LAST_ERROR = GetMessage("WD_FILE_ERROR111"); $el->Delete($ID); return false; } if ($bUF) { $USER_FIELD_MANAGER->Update($UF_ENTITY, $ID, $arFields['USER_FIELDS']); $el->UpdateSearch($ID, true); } $this->_onEvent('Add', $ID); } if ($bUF) { RemoveEventHandler('search', 'BeforeIndex', $handlerID); } CWebDavDiskDispatcher::sendEventToOwners(null, array('IBLOCK_ID' => (int) $arFields['IBLOCK_ID'], 'ID' => (int) $arFields['IBLOCK_SECTION_ID']), 'add'); return (int) $result; }
} $arParams["UPLOADS"][] = $val; } } } if (empty($arParams["UPLOADS"])) { return; } __main_post_form_image_resize($bNull = null, $arParams["UPLOAD_FILE_PARAMS"]); if ($_SERVER['REQUEST_METHOD'] == 'POST' && isset($_REQUEST['mfi_mode']) && $_REQUEST['mfi_mode'] == "upload") { $handlers["main.file.input.upload"] = AddEventHandler('main', "main.file.input.upload", '__main_post_form_image_resize'); } ob_start(); foreach ($arParams["UPLOADS"] as $v) { if (in_array($v["USER_TYPE_ID"], array("file", "webdav_element", "disk_file"))) { $APPLICATION->IncludeComponent("bitrix:system.field.edit", $v["USER_TYPE_ID"], array("arUserField" => $v), null, array("HIDE_ICONS" => "Y")); $arParams["UPLOADS_CID"][__main_post_form_replace_template()] = array("parser" => $v["USER_TYPE_ID"], "value" => $v["USER_TYPE_ID"] == "file" ? $v["VALUE"] : array(), "postfix" => $v["POSTFIX"]); } else { if (!empty($v["INPUT_NAME"])) { $cid = $GLOBALS["APPLICATION"]->IncludeComponent('bitrix:main.file.input', 'drag_n_drop', array('CONTROL_ID' => $v["CONTROL_ID"], 'INPUT_NAME' => $v["INPUT_NAME"], 'INPUT_NAME_UNSAVED' => 'FILE_NEW_TMP', 'INPUT_VALUE' => $v["INPUT_VALUE"], 'MAX_FILE_SIZE' => $v["MAX_FILE_SIZE"], 'MULTIPLE' => $v["MULTIPLE"], 'MODULE_ID' => $v["MODULE_ID"], 'ALLOW_UPLOAD' => $v["ALLOW_UPLOAD"], 'ALLOW_UPLOAD_EXT' => $v["ALLOW_UPLOAD_EXT"], 'INPUT_CAPTION' => $v["INPUT_CAPTION"]), null, array("HIDE_ICONS" => true)); $parser = "file"; $arParams["UPLOADS_CID"][$cid] = array("storage" => "bfile", "parser" => $parser, "postfix" => $v["POSTFIX"]); } } } $arParams["UPLOADS_HTML"] = ob_get_clean(); foreach ($handlers as $eventName => $handlerID) { if ($handlerID) { RemoveEventHandler("main", $eventName, $handlerID); } }
public static function ConvertHtmlToBbCode($html) { $eventID = AddEventHandler('main', 'TextParserBeforeTags', array('CAllCrmMailTemplate', '__ConvertHtmlToBbCode')); $parser = new CTextParser(); $parser->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'); $html = $parser->convertText($html); $html = htmlspecialcharsback($html); $html = preg_replace("/\\<br\\s*\\/*\\>/i" . BX_UTF_PCRE_MODIFIER, "\n", $html); $html = preg_replace("/ /i" . BX_UTF_PCRE_MODIFIER, ' ', $html); $html = preg_replace("/\\<[^>]+>/" . BX_UTF_PCRE_MODIFIER, '', $html); $html = htmlspecialcharsbx($html); RemoveEventHandler('main', 'TextParserBeforeTags', $eventID); return $html; }