function Update($ID, $arFields) { $arCats = array(); $CWikiParser = new CWikiParser(); $arFields['DETAIL_TEXT'] = $CWikiParser->parseBeforeSave($arFields['DETAIL_TEXT'], $arCats, $arFields['NAME_TEMPLATE']); $this->CleanCache($ID, $arFields['NAME'], $arFields['IBLOCK_ID']); //save item $this->cIB_E->Update($ID, $arFields); //serve category / bindings $arCats = str_replace("/", "-", $arCats); //http://jabber.bx/view.php?id=28447 $this->UpdateCategory($ID, $arFields['IBLOCK_ID'], $arCats); $modifyComment = isset($arFields["MODIFY_COMMENT"]) ? $arFields["MODIFY_COMMENT"] : ""; $this->UpdateHistory($ID, $arFields['IBLOCK_ID'], $modifyComment); return true; }
} $arResult['ELEMENT']['NAME'] = CWikiUtils::htmlspecialcharsback($_POST['POST_TITLE']); $arResult['ELEMENT']['DETAIL_TEXT'] = $arResult['ELEMENT']['~DETAIL_TEXT'] = $arFields['DETAIL_TEXT']; $arResult['ELEMENT']['DETAIL_TEXT_TYPE'] = $arFields['DETAIL_TEXT_TYPE']; if (empty($arResult['ERROR_MESSAGE'])) { if (is_array($_POST['IMAGE_ID_del'])) { foreach ($_POST['IMAGE_ID_del'] as $_imgID => $_) { if (in_array($_imgID, $arResult['ELEMENT']['IMAGES'])) { $rsFile = CFile::GetByID($_imgID); $arFile = $rsFile->Fetch(); $CWiki->deleteImage($_imgID, $arResult['ELEMENT']['ID'], $arParams['IBLOCK_ID']); $arFields['DETAIL_TEXT'] = preg_replace('/\\[?\\[(:)?(File|' . GetMessage('FILE_NAME') . '):(' . $_imgID . '|' . preg_quote($arFile['ORIGINAL_NAME'], '/') . ')\\]\\]?/iU' . BX_UTF_PCRE_MODIFIER, '', $arFields['DETAIL_TEXT']); } } } $CWikiParser = new CWikiParser(); $CWiki->Update($arParams['ELEMENT_ID'], $arFields); //we should not post content of wiki page to feed if it redirects to another page if (preg_match("/^\\#(REDIRECT|" . GetMessage('WIKI_REDIRECT') . ")\\s*\\[\\[(.*)\\]\\]/iU" . BX_UTF_PCRE_MODIFIER, $arFields['DETAIL_TEXT'])) { $bPageRedirect = true; } else { $bPageRedirect = false; } if (CWikiSocnet::IsSocNet() && $arResult['POST_TO_FEED'] == "Y" && !$bPageRedirect) { if (strlen($arParams['SOCNET_GROUP_ID']) > 0) { CSocNetGroup::SetLastActivity(intval($arParams['SOCNET_GROUP_ID'])); } $postUrl = str_replace(array('#group_id#', '#wiki_name#'), array(intval($arParams['SOCNET_GROUP_ID']), urlencode($arFields['NAME'])), $arParams['~PATH_TO_POST']); $arCurImages = array(); $rsProperties = CIBlockElement::GetProperty($arParams['IBLOCK_ID'], $arParams['ELEMENT_ID'], 'value_id', 'asc', array('ACTIVE' => 'Y', 'CODE' => 'IMAGES')); while ($arProperty = $rsProperties->Fetch()) {
function IndexIBlockElement($arFields, $entity_id, $entity_type, $feature, $operation, $path_template, $arFieldList) { $ID = intval($arFields["ID"]); $IBLOCK_ID = intval($arFields["IBLOCK_ID"]); $IBLOCK_SECTION_ID = is_array($arFields["IBLOCK_SECTION"]) ? $arFields["IBLOCK_SECTION"][0] : $arFields["IBLOCK_SECTION"]; $arItem = array(); if ($entity_type == "G") { $url = str_replace(array("#group_id#", "#user_alias#", "#section_id#", "#element_id#", "#action#", "#task_id#", "#name#"), array($entity_id, "group_" . $entity_id, $IBLOCK_SECTION_ID, $arFields["ID"], "view", $arFields["ID"], urlencode($arFields["NAME"])), $path_template); } else { $url = str_replace(array("#user_id#", "#user_alias#", "#section_id#", "#element_id#", "#action#", "#task_id#"), array($entity_id, "user_" . $entity_id, $IBLOCK_SECTION_ID, $arFields["ID"], "view", $arFields["ID"]), $path_template); } $body = ""; if ($feature == "wiki") { $CWikiParser = new CWikiParser(); } foreach ($arFieldList as $field) { if ($field == "PREVIEW_TEXT" || $field == "DETAIL_TEXT") { if (isset($CWikiParser)) { $arFields[$field] = HTMLToTxt($CWikiParser->parseForSearch($arFields[$field])); } elseif (isset($arFields[$field . "_TYPE"]) && $arFields[$field . "_TYPE"] === "html") { $arFields[$field] = HTMLToTxt($arFields[$field]); } } $body .= $arFields[$field] . "\n\r"; } if (isset($CWikiParser)) { $title = preg_replace('/^category:/i' . BX_UTF_PCRE_MODIFIER, GetMessage('CATEGORY_NAME') . ':', $arFields['NAME']); } else { $title = $arFields["NAME"]; } $arPermissions = $this->GetSearchGroups($entity_type, $entity_id, $feature, $operation); if (CIBlock::GetArrayByID($IBLOCK_ID, "RIGHTS_MODE") == "E") { $obElementRights = new CIBlockElementRights($IBLOCK_ID, $arFields["ID"]); $arPermissions = $obElementRights->GetGroups(array("element_read")); } $arSearchIndexParams = $this->GetSearchParams($entity_type, $entity_id, $feature, $operation); CSearch::Index("socialnetwork", $ID, array("LAST_MODIFIED" => ConvertTimeStamp(time() + CTimeZone::GetOffset(), "FULL"), "TITLE" => $title, "BODY" => $body, "SITE_ID" => array(SITE_ID => $url), "PARAM1" => CIBlock::GetArrayByID($IBLOCK_ID, "IBLOCK_TYPE_ID"), "PARAM2" => $IBLOCK_ID, "PARAM3" => $feature, "TAGS" => $arFields["TAGS"], "PERMISSIONS" => $arPermissions, "PARAMS" => $arSearchIndexParams), true); if (defined("BX_COMP_MANAGED_CACHE")) { $GLOBALS["CACHE_MANAGER"]->ClearByTag("sonet_search_" . $entity_type . "_" . $entity_id); } }
<?php define('NO_KEEP_STATISTIC', 'Y'); define('NO_AGENT_STATISTIC', 'Y'); require $_SERVER['DOCUMENT_ROOT'] . '/bitrix/modules/main/include/prolog_before.php'; if (!check_bitrix_sessid()) { return false; } CModule::AddAutoloadClasses('wiki', array('CWiki' => 'classes/general/wiki.php', 'CWikiUtils' => 'classes/general/wiki_utils.php', 'CWikiParser' => 'classes/general/wiki_parser.php', 'CWikiDiff' => 'classes/general/wiki_diff.php', 'CWikiSocnet' => 'classes/general/wiki_socnet.php', 'CWikiDocument' => 'classes/general/wiki_document.php', 'CWikiSecurity' => 'classes/general/wiki_security.php', 'CUserTypeWiki' => 'classes/general/wiki_usertypewiki.php', 'CRatingsComponentsWiki' => 'classes/general/ratings_components.php')); $res = ""; switch ($_REQUEST["act"]) { case 'sanitize': if (isset($_REQUEST['text'])) { $res = $_REQUEST['text']; if (LANG_CHARSET != "UTF-8") { $res = $GLOBALS["APPLICATION"]->ConvertCharset($res, "UTF-8", LANG_CHARSET); /* if we recieved the mash from utf-8 and other encodings, lets prevent utf-8 text to be wrong decoded (sender: /components/bitrix/wiki.edit/templates/.default/script.php:599 function insertSanitized()) for example user could copy and insert url from it's browser. http://work.localhost/services/wiki/%C3%EB%E0%E2%ED%E0%FF+%F1%F2%F0%E0%ED%E8%F6%E0/edit/ */ $res = str_replace("##%##", "%", $res); } $CWikiParser = new CWikiParser(); $res = $CWikiParser->Clear($res); } break; } echo $res;
static function OnBeforeIndex($arFields) { $arFields['NAME'] = preg_replace('/^category:/i' . BX_UTF_PCRE_MODIFIER, GetMessage('CATEGORY_NAME') . ':', $arFields['NAME']); $CWikiParser = new CWikiParser(); $arFields['BODY'] = $CWikiParser->parseForSearch($arFields['BODY']); if (SITE_DIR != "/") { //http://www.jabber.bx/view.php?id=29053 if (preg_match("#^" . SITE_DIR . "#", $arFields['SITE_ID'][SITE_ID]) !== false) { $arFields['SITE_ID'][SITE_ID] = preg_replace("#^" . SITE_DIR . "#", "/", $arFields['SITE_ID'][SITE_ID]); } } return $arFields; }
$arHp = array('oldid' => $historyId, 'sessid' => bitrix_sessid()); if ($arParams['IN_COMPLEX'] == 'Y' && $arParams['SEF_MODE'] == 'N') { $arHp[$arParams['OPER_VAR']] = 'history'; } $arResult['VERSION']['CANCEL_LINK'] = CHTTP::urlAddParams(CComponentEngine::MakePathFromTemplate($arParams['PATH_TO_HISTORY'], array('wiki_name' => urlencode($arParams['ELEMENT_NAME']), 'group_id' => CWikiSocnet::$iSocNetId)), $arHp); } } $CACHE_MANAGER->StartTagCache($this->GetCachePath()); $CACHE_MANAGER->RegisterTag('wiki_' . $arParams['ELEMENT_ID']); $CACHE_MANAGER->EndTagCache(); /*$arPages = array('article'); if (isset($arResult['WIKI_oper']) && $arResult['WIKI_oper'] == 'add') $arPages[] = 'add'; $arResult['TOPLINKS'] = CWikiUtils::getRightsLinks($arPages, $arParams);*/ $arCat = array(); $CWikiParser = new CWikiParser(); if ($arResult['REDIRECTED_FROM'] && CWikiUtils::IsWriteable()) { $redirUrl = CHTTP::urlAddParams(CComponentEngine::MakePathFromTemplate($arParams['PATH_TO_POST_EDIT'], array('wiki_name' => urlencode($arResult['REDIRECTED_FROM']), 'group_id' => CWikiSocnet::$iSocNetId)), $arParams['IN_COMPLEX'] == 'Y' && $arParams['SEF_MODE'] == 'N' ? array($arParams['OPER_VAR'] => $arResult['WIKI_oper']) : array()); $redirUrl = (CMain::IsHTTPS() ? "https://" : "http://") . $_SERVER["HTTP_HOST"] . $redirUrl; $arResult['ELEMENT']['~DETAIL_TEXT'] = GetMessage("WIKI_REDIRECT_FROM") . "[" . $redirUrl . " " . $arResult['REDIRECTED_FROM'] . "]<br><br>" . $arResult['ELEMENT']['~DETAIL_TEXT']; } $arResult['ELEMENT']['DETAIL_TEXT'] = $CWikiParser->parseBeforeSave($arResult['ELEMENT']['~DETAIL_TEXT'], $arCat, $arParams["NAME_TEMPLATE"]); $arResult['ELEMENT']['DETAIL_TEXT'] = $CWikiParser->Parse($arResult['ELEMENT']['DETAIL_TEXT'], $arResult['ELEMENT']['DETAIL_TEXT_TYPE'], $arResult['ELEMENT']['IMAGES']); $arResult['ELEMENT']['DETAIL_TEXT'] = $CWikiParser->Clear($arResult['ELEMENT']['DETAIL_TEXT']); $SERVICE_PAGE_NAME = ''; $arResult['SERVICE_PAGE'] = CWikiUtils::CheckServicePage($arParams['ELEMENT_NAME'], $SERVICE_PAGE_NAME); if ($arResult['SERVICE_PAGE'] == 'category') { $this->AbortResultCache(); } $this->IncludeComponentTemplate(); }
function ReindexIBlock($iblock_id, $entity_type, $feature, $operation, $path_template, $arFieldList, $last_id) { global $DB; if (!CModule::IncludeModule("iblock")) { return false; } $arSections = array(); $rsElements = CIBlockElement::GetList(array("ID" => "asc"), array("IBLOCK_ID" => $iblock_id, ">ID" => intval($last_id), "CHECK_PERMISSIONS" => "N"), false, false, array_merge(array("ID", "IBLOCK_ID", "IBLOCK_TYPE_ID", "NAME", "TAGS", "TIMESTAMP_X", "IBLOCK_SECTION_ID"), $arFieldList)); while ($arFields = $rsElements->Fetch()) { if (!array_key_exists($arFields["IBLOCK_SECTION_ID"], $arSections)) { $rsPath = CIBlockSection::GetNavChain($arFields["IBLOCK_ID"], $arFields["IBLOCK_SECTION_ID"]); $arSection = $rsPath->Fetch(); if ($entity_type == "G") { $arSections[$arFields["IBLOCK_SECTION_ID"]] = intval($arSection["SOCNET_GROUP_ID"]); } else { $arSections[$arFields["IBLOCK_SECTION_ID"]] = intval($arSection["CREATED_BY"]); } } $entity_id = $arSections[$arFields["IBLOCK_SECTION_ID"]]; if ($entity_id) { $url = str_replace(array("#user_id#", "#group_id#", "#user_alias#", "#section_id#", "#element_id#", "#task_id#", "#name#"), array($entity_id, $entity_id, ($entity_type == "G" ? "group_" : "user_") . $entity_id, $arFields["IBLOCK_SECTION_ID"], $arFields["ID"], $arFields["ID"], urlencode($arFields["NAME"])), $path_template); $body = ""; if ($feature == "wiki") { $CWikiParser = new CWikiParser(); } foreach ($arFieldList as $field) { $text = ""; if ($field == "PREVIEW_TEXT" || $field == "DETAIL_TEXT") { if (isset($CWikiParser)) { $text = HTMLToTxt($CWikiParser->parseForSearch($arFields[$field])); } elseif (isset($arFields[$field . "_TYPE"]) && $arFields[$field . "_TYPE"] === "html") { $text = HTMLToTxt($arFields[$field]); } else { $text = $arFields[$field]; } } elseif ($field == $this->_file_property) { $arFile = CIBlockElement::__GetFileContent($arFields[$this->_file_property . "_VALUE"]); if (is_array($arFile)) { $text = $arFile["CONTENT"]; $arFields["TAGS"] .= "," . $arFile["PROPERTIES"][COption::GetOptionString("search", "page_tag_property")]; } } elseif ($field == "PROPERTY_FORUM_TOPIC_ID") { $topic_id = intval($arFields["PROPERTY_FORUM_TOPIC_ID_VALUE"]); if ($topic_id) { $this->UpdateForumTopicIndex($topic_id, $entity_type, $entity_id, $feature, $operation, $this->Url($url, array("MID" => "#message_id#"), "message#message_id#")); } } $body .= $text . "\n\r"; } if (isset($CWikiParser)) { $title = preg_replace('/^category:/i' . BX_UTF_PCRE_MODIFIER, GetMessage('CATEGORY_NAME') . ':', $arFields['NAME']); } else { $title = $arFields["NAME"]; } $arPermissions = $this->GetSearchGroups($entity_type, $entity_id, $feature, $operation); if (CIBlock::GetArrayByID($arFields["IBLOCK_ID"], "RIGHTS_MODE") == "E") { $obElementRights = new CIBlockElementRights($arFields["IBLOCK_ID"], $arFields["ID"]); $arPermissions = $obElementRights->GetGroups(array("element_read")); } CSearch::Index("socialnetwork", $arFields["ID"], array("LAST_MODIFIED" => $arFields["TIMESTAMP_X"], "TITLE" => $title, "BODY" => $body, "SITE_ID" => array(SITE_ID => $url), "PARAM1" => $arFields["IBLOCK_TYPE_ID"], "PARAM2" => $arFields["IBLOCK_ID"], "PARAM3" => $entity_id, "TAGS" => $arFields["TAGS"], "PERMISSIONS" => $arPermissions, "PARAMS" => $this->GetSearchParams($entity_type, $entity_id, $feature, $operation), "REINDEX_FLAG" => true), true, $this->_sess_id); $this->_counter++; } if ($this->_end_time && $this->_end_time <= time()) { return $arFields["ID"]; } } return false; }
function onAfterMessageAdd($ID, $arFields) { $bSocNetLogRecordExists = false; // add log comment if ((!array_key_exists('PARAM1', $arFields) || $arFields['PARAM1'] != 'IB') && array_key_exists('PARAM2', $arFields) && intval($arFields['PARAM2']) > 0) { $dbRes = CSocNetLog::GetList(array('ID' => 'DESC'), array("EVENT_ID" => "wiki", "SOURCE_ID" => $arFields["PARAM2"]), false, false, array('ID', 'ENTITY_TYPE', 'ENTITY_ID', 'TMP_ID', 'URL')); if ($arRes = $dbRes->Fetch()) { $log_id = $arRes['TMP_ID']; $url = $arRes['URL']; $bSocNetLogRecordExists = true; } else { $rsElement = CIBlockElement::GetByID($arFields['PARAM2']); if ($arElement = $rsElement->Fetch()) { $arWikiElement = CWiki::GetElementById($arElement['ID'], array('IBLOCK_ID' => $arElement['IBLOCK_ID'])); $CWikiParser = new CWikiParser(); $parserLog = new logTextParser(); $arAllow = array("HTML" => "N", "ANCHOR" => "N", "BIU" => "N", "IMG" => "N", "QUOTE" => "N", "CODE" => "N", "FONT" => "N", "LIST" => "N", "SMILES" => "N", "NL2BR" => "N", "VIDEO" => "N", "TABLE" => "N"); $text4message = $CWikiParser->Parse($arElement['DETAIL_TEXT'], $arElement['DETAIL_TEXT_TYPE'], $arWikiElement['IMAGES']); $text4message = preg_replace("#<br[\\s]*\\/>#is", "#BR#", $text4message); $text4message = htmlspecialcharsback($parserLog->convert($text4message, array(), $arAllow)); $text4message = preg_replace("#\\#BR\\##is", "\n", $text4message); $text4message = $CWikiParser->Clear($text4message); $url = str_replace(array('#group_id#', '#wiki_name#'), array(intval($this->SonetGroupID), urlencode($arElement['NAME'])), $this->arPath['PATH_TO_POST']); $arSoFields = array('ENTITY_TYPE' => SONET_SUBSCRIBE_ENTITY_GROUP, 'IS_CUSTOM_ET' => 'N', 'ENTITY_ID' => intval($this->SonetGroupID), 'EVENT_ID' => 'wiki', 'USER_ID' => $arElement['CREATED_BY'], 'LOG_DATE' => $arElement['DATE_CREATE'], 'LOG_UPDATE' => $arElement['DATE_CREATE'], 'TITLE_TEMPLATE' => GetMessage('WIKI_SONET_LOG_TITLE_TEMPLATE'), 'TITLE' => $arElement['NAME'], 'MESSAGE' => $text4message, 'TEXT_MESSAGE' => '', 'MODULE_ID' => 'wiki', 'URL' => $url, 'CALLBACK_FUNC' => false, 'SOURCE_ID' => $arFields['PARAM2'], 'PARAMS' => 'forum_id=' . $this->ForumID, 'RATING_TYPE_ID' => 'IBLOCK_ELEMENT', 'RATING_ENTITY_ID' => intval($arFields['PARAM2'])); $log_id = CSocNetLog::Add($arSoFields, false); if (intval($log_id) > 0) { CSocNetLog::Update($log_id, array("TMP_ID" => $log_id)); CSocNetLogRights::SetForSonet($log_id, SONET_SUBSCRIBE_ENTITY_GROUP, intval($this->SonetGroupID), "wiki", "view", true); } } } if (intval($log_id) > 0) { $arForum = CForumNew::GetByID($this->ForumID); $parser = new textParser(LANGUAGE_ID, $this->arPath['PATH_TO_SMILE']); $parser->image_params['width'] = false; $parser->image_params['height'] = false; $arAllow = array('HTML' => "N", 'ANCHOR' => "N", 'BIU' => "N", 'IMG' => "N", 'LIST' => "N", 'QUOTE' => "N", 'CODE' => "N", 'FONT' => "N", 'UPLOAD' => $arForum['ALLOW_UPLOAD'], 'NL2BR' => "N", 'SMILES' => "N"); $sAuthorForMail = str_replace('#TITLE#', $arMessage['AUTHOR_NAME'], GetMessage('SONET_FORUM_LOG_TEMPLATE_GUEST')); if ($bSocNetLogRecordExists) { $arMessage = CForumMessage::GetByIDEx($ID); $parser = new textParser(LANGUAGE_ID, $this->arPath['PATH_TO_SMILE']); $parser->image_params['width'] = false; $parser->image_params['height'] = false; if (intVal($arMessage['AUTHOR_ID']) > 0) { $sAuthorForMail = str_replace(array('#URL#', '#TITLE#'), array('http://' . SITE_SERVER_NAME . CComponentEngine::MakePathFromTemplate($this->arPath['PATH_TO_USER'], array('user_id' => $arMessage['AUTHOR_ID'])), $arMessage['AUTHOR_NAME']), GetMessage('SONET_FORUM_LOG_TEMPLATE_AUTHOR')); } $arFieldsForSocnet = array('ENTITY_TYPE' => SONET_SUBSCRIBE_ENTITY_GROUP, 'ENTITY_ID' => intval($this->SonetGroupID), 'EVENT_ID' => 'wiki_comment', '=LOG_DATE' => $GLOBALS['DB']->CurrentTimeFunction(), 'MESSAGE' => $parser->convert($arMessage['POST_MESSAGE'], $arAllow), 'TEXT_MESSAGE' => $parser->convert4mail($arMessage['POST_MESSAGE'] . $sAuthorForMail), 'URL' => $url, 'MODULE_ID' => false, 'SOURCE_ID' => $ID, 'LOG_ID' => $log_id, 'RATING_TYPE_ID' => 'FORUM_POST', 'RATING_ENTITY_ID' => intval($arMessage['ID'])); if (intVal($arMessage['AUTHOR_ID']) > 0) { $arFieldsForSocnet['USER_ID'] = $arMessage['AUTHOR_ID']; } CSocNetLogComments::Add($arFieldsForSocnet); } else { $dbMessage = CForumMessage::GetListEx(array(), array('TOPIC_ID' => $arFields["TOPIC_ID"], "NEW_TOPIC" => "N")); while ($arMessage = $dbMessage->GetNext()) { if (intVal($arMessage['AUTHOR_ID']) > 0) { $sAuthorForMail = str_replace(array('#URL#', '#TITLE#'), array('http://' . SITE_SERVER_NAME . CComponentEngine::MakePathFromTemplate($this->arPath['PATH_TO_USER'], array('user_id' => $arMessage['AUTHOR_ID'])), $arMessage['AUTHOR_NAME']), GetMessage('SONET_FORUM_LOG_TEMPLATE_AUTHOR')); } $arFieldsForSocnet = array('ENTITY_TYPE' => SONET_SUBSCRIBE_ENTITY_GROUP, 'ENTITY_ID' => intval($this->SonetGroupID), 'EVENT_ID' => 'wiki_comment', '=LOG_DATE' => $GLOBALS['DB']->CharToDateFunction($arMessage['POST_DATE'], "FULL", SITE_ID), 'MESSAGE' => $parser->convert($arMessage['POST_MESSAGE'], $arAllow), 'TEXT_MESSAGE' => $parser->convert4mail($arMessage['POST_MESSAGE'] . $sAuthorForMail), 'URL' => $url, 'MODULE_ID' => false, 'SOURCE_ID' => $ID, 'LOG_ID' => $log_id, 'RATING_TYPE_ID' => 'FORUM_POST', 'RATING_ENTITY_ID' => intval($arMessage['ID'])); if (intVal($arMessage['AUTHOR_ID']) > 0) { $arFieldsForSocnet['USER_ID'] = $arMessage['AUTHOR_ID']; } CSocNetLogComments::Add($arFieldsForSocnet); } } } } }
private function createLogEntry($iblockElementID) { $rsElement = CIBlockElement::GetByID($iblockElementID); if ($arElement = $rsElement->Fetch()) { $arWikiElement = CWiki::GetElementById($arElement['ID'], array('IBLOCK_ID' => $arElement['IBLOCK_ID'])); $CWikiParser = new CWikiParser(); $parserLog = new logTextParser(); $arAllow = array("HTML" => "N", "ANCHOR" => "N", "BIU" => "N", "IMG" => "N", "QUOTE" => "N", "CODE" => "N", "FONT" => "N", "LIST" => "N", "SMILES" => "N", "NL2BR" => "N", "VIDEO" => "N", "TABLE" => "N"); $text4message = $CWikiParser->Parse($arElement['DETAIL_TEXT'], $arElement['DETAIL_TEXT_TYPE'], $arWikiElement['IMAGES']); $text4message = preg_replace("#<br[\\s]*\\/>#is", "#BR#", $text4message); $text4message = htmlspecialcharsback($parserLog->convert($text4message, array(), $arAllow)); $text4message = preg_replace("#\\#BR\\##is", "\n", $text4message); $text4message = $CWikiParser->Clear($text4message); $url = str_replace(array('#group_id#', '#wiki_name#'), array(intval($this->SonetGroupID), urlencode($arElement['NAME'])), $this->arPath['PATH_TO_POST']); $arSoFields = array('ENTITY_TYPE' => SONET_SUBSCRIBE_ENTITY_GROUP, 'IS_CUSTOM_ET' => 'N', 'ENTITY_ID' => intval($this->SonetGroupID), 'EVENT_ID' => 'wiki', 'USER_ID' => $arElement['CREATED_BY'], 'LOG_DATE' => $arElement['DATE_CREATE'], 'LOG_UPDATE' => $arElement['DATE_CREATE'], 'TITLE_TEMPLATE' => GetMessage('WIKI_SONET_LOG_TITLE_TEMPLATE'), 'TITLE' => $arElement['NAME'], 'MESSAGE' => $text4message, 'TEXT_MESSAGE' => '', 'MODULE_ID' => 'wiki', 'URL' => $url, 'CALLBACK_FUNC' => false, 'SOURCE_ID' => intval($iblockElementID), 'PARAMS' => 'forum_id=' . $this->ForumID, 'RATING_TYPE_ID' => 'IBLOCK_ELEMENT', 'RATING_ENTITY_ID' => intval($iblockElementID)); $log_id = CSocNetLog::Add($arSoFields, false); $log_user_id = $arElement['CREATED_BY']; $log_title = $arElement["NAME"]; if (intval($log_id) > 0) { CSocNetLog::Update($log_id, array("TMP_ID" => $log_id)); CSocNetLogRights::SetForSonet($log_id, SONET_SUBSCRIBE_ENTITY_GROUP, intval($this->SonetGroupID), "wiki", "view", true); return array("LOG_ID" => $log_id, "LOG_USER_ID" => $log_user_id, "LOG_TITLE" => $log_title, "URL" => $url); } } return false; }
$arResult['VERSION_OLD']['USER_LINK'] = CHTTP::urlAddParams(CComponentEngine::MakePathFromTemplate($arParams['PATH_TO_USER'], array('wiki_name' => urlencode($arParams['ELEMENT_NAME']), 'group_id' => CWikiSocnet::$iSocNetId, 'user_id' => $arHistoryResult['USER_ID'])), array()); } $arHp = array('oldid' => $arHistoryResult['ID'], 'sessid' => bitrix_sessid()); if ($arParams['IN_COMPLEX'] == 'Y' && $arParams['SEF_MODE'] == 'N') { $arHp[$arParams["OPER_VAR"]] = 'history'; } $arResult['CANCEL_LINK'] = CHTTP::urlAddParams(CComponentEngine::MakePathFromTemplate($arParams["PATH_TO_HISTORY"], array('wiki_name' => urlencode($arParams['ELEMENT_NAME']), 'group_id' => CWikiSocnet::$iSocNetId)), $arHp); /* erase if ($arHistoryResult['DOCUMENT']['FIELDS']['DETAIL_TEXT_TYPE'] == 'text') $arHistoryResult['DOCUMENT']['FIELDS']['DETAIL_TEXT'] = nl2br($arHistoryResult['DOCUMENT']['FIELDS']['DETAIL_TEXT']); if ($arDiffResult['DOCUMENT']['FIELDS']['DETAIL_TEXT_TYPE'] == 'text') $arDiffResult['DOCUMENT']['FIELDS']['DETAIL_TEXT'] = nl2br($arDiffResult['DOCUMENT']['FIELDS']['DETAIL_TEXT']); */ $arResult['DIFF_NAME'] = CWikiDiff::getDiff($arHistoryResult['DOCUMENT']['FIELDS']['NAME'], $arDiffResult['DOCUMENT']['FIELDS']['NAME']); $arCat = array(); $CWikiParser = new CWikiParser(); /* erase $arHistoryResult['DOCUMENT']['FIELDS']['DETAIL_TEXT'] = $CWikiParser->Clear($arHistoryResult['DOCUMENT']['FIELDS']['DETAIL_TEXT']); $arDiffResult['DOCUMENT']['FIELDS']['DETAIL_TEXT'] = $CWikiParser->Clear($arDiffResult['DOCUMENT']['FIELDS']['DETAIL_TEXT']); */ $arResult['DIFF'] = CWikiDiff::getDiff($arHistoryResult['DOCUMENT']['FIELDS']['DETAIL_TEXT'], $arDiffResult['DOCUMENT']['FIELDS']['DETAIL_TEXT']); $arResult['DIFF'] = $CWikiParser->parseBeforeSave($arResult['DIFF'], $arCat, $arParams["NAME_TEMPLATE"]); $arResult['DIFF'] = $CWikiParser->Parse($arResult['DIFF'], $arHistoryResult['DOCUMENT']['FIELDS']['DETAIL_TEXT_TYPE']); $arResult['DIFF'] = $CWikiParser->Clear($arResult['DIFF']); $CACHE_MANAGER->StartTagCache($this->GetCachePath()); $CACHE_MANAGER->RegisterTag('wiki_' . $arParams['ELEMENT_ID']); $CACHE_MANAGER->EndTagCache(); $this->IncludeComponentTemplate(); } include_once $_SERVER['DOCUMENT_ROOT'] . '/bitrix/components/bitrix/wiki/include/nav.php'; unset($GLOBALS['arParams']);