/** * Sets right search path for comments, likes etc. * http://jabber.bx/view.php?id=25340 * @param int $forumID - forum's ID were comments saving (for example $arParams['FORUM_ID']) * @param str $rightPath - wich path must leads to the comment ( for example: "/comment/#MESSAGE_ID#/" ) * @param str $urlRewriterPath - wich path leads to curent module (complex component) ( for example: "/services/wiki.php" ) * @return bool true|false */ static function SetCommentPath($forumID, $rightPath, $urlRewriterPath) { if (!$forumID || !CModule::IncludeModule('forum') || !$rightPath || !$urlRewriterPath) { return false; } $arRewriter = CUrlRewriter::GetList(array("PATH" => $urlRewriterPath)); //http://jabber.bx/view.php?id=25340 if (!is_array($arRewriter) || empty($arRewriter)) { return false; } $rewriteCondition = str_replace(array("#", "^"), "", $arRewriter[0]["CONDITION"]); $rightCommentsPath = $rewriteCondition . $rightPath; $arActualCommentsPath = CWikiUtils::GetCommentPath($forumID); if (!is_array($arActualCommentsPath)) { return false; } $arUpdateForum = array(); foreach ($arActualCommentsPath as $site => $path) { if ($path != $rightCommentsPath) { $arUpdateForum["SITES"][$site] = $rightCommentsPath; } } if (!empty($arUpdateForum)) { CForumNew::Update($forumID, $arUpdateForum); } return true; }