$cache_path_main = str_replace(array(":", "//"), "/", "/" . SITE_ID . "/" . $componentName . "/"); /******************************************************************** /Default values ********************************************************************/ /******************************************************************** Action ********************************************************************/ if (strToUpper($_REQUEST["action"]) == "MOVE" && check_bitrix_sessid()) { $strErrorMessage = ""; $strOKMessage = ""; $result = false; if (intVal($arParams["newFID"]) <= 0) { $strErrorMessage = GetMessage("FM_EMPTY_DEST_FORUM") . ". \n"; } else { $arResult["FORUM_NEW"] = CForumNew::GetByID($arParams["newFID"]); if (ForumCurrUserPermissions($arParams["newFID"]) < "Q" && $arResult["FORUM_NEW"]["ALLOW_MOVE_TOPIC"] != "Y") { $strErrorMessage = GetMessage("FM_NO_DEST_FPERMS") . ". \n"; } else { $result = CForumTopic::MoveTopic2Forum($topics, $arParams["newFID"], $_REQUEST["leaveLink"]); } } if (!$result) { if ($GLOBALS['APPLICATION']->GetException()) { $arErr = $GLOBALS['APPLICATION']->ERROR_STACK; if (is_array($arErr) && count($arErr) > 0) { foreach ($arErr as $res) { $strErrorMessage .= $res["msg"] . "\n"; } } $err = $GLOBALS['APPLICATION']->GetException(); $strErrorMessage .= $err->GetString();
function __forumIndexGetPermissions(&$arRes, &$arNewMessage = null) { static $arNew = null; $result = false; if ($arNew === null && $arNewMessage !== null) { $arNew = $arNewMessage; } $arForums = array(); if (isset($arRes['FORUMS']) && is_array($arRes['FORUMS'])) { $arForums =& $arRes['FORUMS']; } elseif (isset($arRes['FORUM']) && is_array($arRes['FORUM'])) { $arForums =& $arRes['FORUM']; } foreach ($arForums as &$res) { $res["PERMISSION"] = ForumCurrUserPermissions($res["ID"]); if ($res["PERMISSION"] >= "Q") { foreach (array("POSTER_ID", "POST_DATE", "POSTER_NAME", "MESSAGE_ID") as $key) { $res["~LAST_" . $key] = $res["~ABS_LAST_" . $key]; $res["LAST_" . $key] = $res["ABS_LAST_" . $key]; } $res["TID"] = $res["ABS_TID"]; $res["TITLE"] = $res["ABS_TITLE"]; $result = true; } $res["~NewMessage"] = isset($arNew[$res['ID']]) ? intval($arNew[$res['ID']]) : 0; $res["NewMessage"] = $res["~NewMessage"] > 0 ? "Y" : "N"; } if (isset($arRes['GROUPS']) && is_array($arRes['GROUPS'])) { foreach ($arRes['GROUPS'] as &$res1) { $result = __forumIndexGetPermissions($res1) || $result; } } return $result; }
} if ($arParams["CACHE_TIME"] > 0) { $cache->StartDataCache(); CForumCacheManager::SetTag($cache_path_main, "forum_".$arParams["FORUM_ID"]); $cache->EndDataCache(array("arIblock" => $arIblock)); } } $arResult["ELEMENT"] = $arIblock; // FORUM $arResult["FORUM"] = CForumNew::GetByIDEx($arParams["FORUM_ID"], SITE_ID); // USER PERMISSION $arResult["USER"] = array( "ID" => $USER->GetID(), "GROUPS" => $USER->GetUserGroupArray(), "PERMISSION" => ForumCurrUserPermissions($arParams["FORUM_ID"]), "SHOWED_NAME" => $GLOBALS["FORUM_STATUS_NAME"]["guest"], "SUBSCRIBE" => array(), "FORUM_SUBSCRIBE" => "N", "TOPIC_SUBSCRIBE" => "N"); /******************************************************************** /Main Params ********************************************************************/ if (empty($arResult["FORUM"])): ShowError(str_replace("#FORUM_ID#", $arParams["FORUM_ID"], GetMessage("F_ERR_FID_IS_NOT_EXIST"))); return false; elseif (empty($arResult["ELEMENT"])): ShowError(str_replace("#ELEMENT_ID#", $arParams["ELEMENT_ID"], GetMessage("F_ERR_EID_IS_NOT_EXIST"))); return false; elseif ($arResult["USER"]["PERMISSION"] <= "A"):
if (empty($arResult["FORUM"])) { CHTTP::SetStatus("404 Not Found"); ShowError(GetMessage("F_ERROR_FORUM_NOT_EXISTS")); return false; } elseif (!CForumNew::CanUserViewForum($arParams["FID"], $USER->GetUserGroupArray())) { $APPLICATION->AuthForm(GetMessage("F_NO_FPERMS")); return false; } elseif (!array_key_exists(SITE_ID, CForumNew::GetSites($arParams["FID"])) && ($arParams["SHOW_FORUM_ANOTHER_SITE"] == "N" || !CForumUser::IsAdmin())) { CHTTP::SetStatus("404 Not Found"); ShowError(GetMessage("F_ERROR_FORUM_NOT_EXISTS")); return false; } /******************************************************************** Default values ********************************************************************/ $arParams["PERMISSION"] = $arResult["PERMISSION"] = ForumCurrUserPermissions($arParams["FID"]); $arResult["Topics"] = array(); $arResult["TOPICS"] = array(); $arResult["URL"] = array("INDEX" => CComponentEngine::MakePathFromTemplate($arParams["URL_TEMPLATES_INDEX"], array()), "~INDEX" => CComponentEngine::MakePathFromTemplate($arParams["~URL_TEMPLATES_INDEX"], array()), "TOPIC_LIST" => CComponentEngine::MakePathFromTemplate($arParams["URL_TEMPLATES_LIST"], array("FID" => $arParams["FID"])), "~TOPIC_LIST" => CComponentEngine::MakePathFromTemplate($arParams["~URL_TEMPLATES_LIST"], array("FID" => $arParams["FID"])), "TOPIC_NEW" => CComponentEngine::MakePathFromTemplate($arParams["URL_TEMPLATES_TOPIC_NEW"], array("FID" => $arParams["FID"])), "~TOPIC_NEW" => CComponentEngine::MakePathFromTemplate($arParams["~URL_TEMPLATES_TOPIC_NEW"], array("FID" => $arParams["FID"])), "RSS" => CComponentEngine::MakePathFromTemplate($arParams["URL_TEMPLATES_RSS"], array("TYPE" => "default", "MODE" => "forum", "IID" => $arParams["FID"])), "~RSS" => CComponentEngine::MakePathFromTemplate($arParams["~URL_TEMPLATES_RSS"], array("TYPE" => "default", "MODE" => "forum", "IID" => $arParams["FID"])), "RSS_DEFAULT" => CComponentEngine::MakePathFromTemplate($arParams["URL_TEMPLATES_RSS"], array("TYPE" => "rss2", "MODE" => "forum", "IID" => $arParams["FID"])), "~RSS_DEFAULT" => CComponentEngine::MakePathFromTemplate($arParams["~URL_TEMPLATES_RSS"], array("TYPE" => "rss2", "MODE" => "forum", "IID" => $arParams["FID"]))); $arResult["CanUserAddTopic"] = CForumTopic::CanUserAddTopic($arParams["FID"], $USER->GetUserGroupArray(), $USER->GetID(), $arResult["FORUM"]); $arResult["ERROR_MESSAGE"] = ""; $arResult["OK_MESSAGE"] = ""; $parser = new forumTextParser(false, false, false, "light"); $parser->MaxStringLen = $arParams["WORD_LENGTH"]; if ($_SERVER['REQUEST_METHOD'] == "POST") { $arResult["TID"] = empty($_POST["TID_ARRAY"]) ? $_POST["TID"] : $_POST["TID_ARRAY"]; } if (empty($arResult["TID"])) { $arResult["TID"] = empty($_REQUEST["TID_ARRAY"]) ? $_REQUEST["TID"] : $_REQUEST["TID_ARRAY"]; } $ACTION = $_REQUEST["ACTION"];
echo GetMessage("FI_FORUM_MESS"); ?> </td> <td width="27%" nowrap class="forumheadtext"> <?php echo GetMessage("FI_FORUM_LAST_MESS"); ?> </td> </tr> <?php $currentGroupID = -1; while ($ar_Forum = $db_Forum->Fetch()) { if ($USER->IsAdmin()) { $perm = "Y"; } else { $perm = ForumCurrUserPermissions($ar_Forum["ID"]); } if ($currentGroupID != IntVal($ar_Forum["FORUM_GROUP_ID"])) { if (IntVal($ar_Forum["FORUM_GROUP_ID"]) > 0) { $arCurForumGroup = CForumGroup::GetLangByID($ar_Forum["FORUM_GROUP_ID"], LANGUAGE_ID); ?> <tr class="forumbody"> <td class="forumbodytext" colspan="6"> <b><?php echo htmlspecialcharsEx($arCurForumGroup["NAME"]); ?> </b> <?php if (strlen($arCurForumGroup["DESCRIPTION"]) > 0) { ?> <br><?php
} $db_res = CIBlockElement::GetList(array(), $arFilter, false, false, array("IBLOCK_ID", "ID", "NAME", "TAGS", "CODE", "IBLOCK_SECTION_ID", "DETAIL_PAGE_URL", "CREATED_BY", "PREVIEW_PICTURE", "PREVIEW_TEXT", "PROPERTY_FORUM_TOPIC_ID", "PROPERTY_FORUM_MESSAGE_CNT")); if ($db_res && ($res = $db_res->GetNext())) { $arIblock = $res; } if ($arParams["CACHE_TIME"] > 0) { $cache->StartDataCache(); CForumCacheManager::SetTag($cache_path_main, "forum_" . $arParams["FORUM_ID"]); $cache->EndDataCache(array("arIblock" => $arIblock)); } } $arResult["ELEMENT"] = $arIblock; // FORUM $arResult["FORUM"] = CForumNew::GetByIDEx($arParams["FORUM_ID"], SITE_ID); // USER PERMISSION $arResult["USER"] = array("ID" => $USER->GetID(), "GROUPS" => $USER->GetUserGroupArray(), "PERMISSION" => ForumCurrUserPermissions($arParams["FORUM_ID"]), "SHOWED_NAME" => $GLOBALS["FORUM_STATUS_NAME"]["guest"], "SUBSCRIBE" => array(), "FORUM_SUBSCRIBE" => "N", "TOPIC_SUBSCRIBE" => "N"); /******************************************************************** /Main Params ********************************************************************/ if (empty($arResult["FORUM"])) { ShowError(str_replace("#FORUM_ID#", $arParams["FORUM_ID"], GetMessage("F_ERR_FID_IS_NOT_EXIST"))); return false; } elseif (empty($arResult["ELEMENT"])) { ShowError(str_replace("#ELEMENT_ID#", $arParams["ELEMENT_ID"], GetMessage("F_ERR_EID_IS_NOT_EXIST"))); return false; } elseif ($arResult["USER"]["PERMISSION"] <= "A") { return false; } /******************************************************************** Default values ********************************************************************/
} elseif (CSocNetFeaturesPerms::CanPerformOperation($user_id, SONET_ENTITY_USER, $owner_id, "forum", "answer", $bIsCurrentUserModuleAdmin)) { $arParams["PERMISSION"] = "I"; } elseif (CSocNetFeaturesPerms::CanPerformOperation($user_id, SONET_ENTITY_USER, $owner_id, "forum", "view", $bIsCurrentUserModuleAdmin)) { $arParams["PERMISSION"] = "E"; } } $arParams["PERMISSION"] = $arParams["PERMISSION"] < $sPermission ? $sPermission : $arParams["PERMISSION"]; } } if (empty($arResult["MESSAGE"])) { $arError = array("code" => "EMPTY MESSAGE", "title" => GetMessage("F_EMPTY_MID")); } elseif ($arParams["PERMISSION"]) { if ($arParams["PERMISSION"] < "E") { $arError = array("code" => "NOT RIGHT", "title" => GetMessage("F_NOT_RIGHT")); } } elseif (ForumCurrUserPermissions($arResult["MESSAGE"]["FORUM_ID"]) < "E") { $arError = array("code" => "NOT RIGHT", "title" => GetMessage("F_NOT_RIGHT")); } } if (!empty($arError)) { require $_SERVER["DOCUMENT_ROOT"] . BX_ROOT . "/modules/main/include/prolog_after.php"; echo ShowError(!empty($arError["title"]) ? $arError["title"] : $arError["code"]); require $_SERVER["DOCUMENT_ROOT"] . BX_ROOT . "/modules/main/include/epilog.php"; die; } // *************************/Default params************************************************************* set_time_limit(0); if ($arParams["ACTION"] == "download") { CFile::ViewByUser($arResult["FILE"], array("force_download" => true)); } else { if (CFile::CheckImageFile(CFile::MakeFileArray($arResult["FILE"]["FILE_ID"])) === null && (file_exists($_SERVER["DOCUMENT_ROOT"] . $arResult["FILE"]["SRC"]) && CFile::GetImageSize($_SERVER["DOCUMENT_ROOT"] . $arResult["FILE"]["SRC"]) || $arResult["FILE"]["WIDTH"] > 0 && $arResult["FILE"]["HEIGHT"] > 0)) {
</table> </td></tr> </table> <table width="100%" border="0"> <tr> <td align="left"> <?php echo $db_Message->NavPrint("Сообщения"); ?> </td> <td align="center" width="0%"> <?php if (ForumCurrUserPermissions($FID) >= "Q") { ?> <font class="forumheadtext"><a href="move.php?FID=<?php echo $FID; ?> &TID=<?php echo $TID; ?> ">Перенести тему</a></font> | <font class="forumheadtext"><a href="read.php?FID=<?php echo $FID; ?> &TID=<?php echo $TID; ?>
function NewMessageForum($FID, $LAST_POST_DATE = false) { if (intVal($_SESSION["FORUM"]["LAST_VISIT_FORUM_0"]) <= 0) { ForumInitParams(); } $FID = intVal($FID); $LAST_VISIT = max($_SESSION["FORUM"]["LAST_VISIT_FORUM_0"], $_SESSION["FORUM"]["LAST_VISIT_FORUM_" . $FID]); $LAST_POST_DATE = MakeTimeStamp($LAST_POST_DATE); if (intVal($LAST_POST_DATE) > 0 && $LAST_POST_DATE < $LAST_VISIT) { ""; } elseif ($GLOBALS["USER"]->IsAuthorized()) { $arFilter = array("FORUM_ID" => $FID, "RENEW" => $GLOBALS["USER"]->GetID()); if (ForumCurrUserPermissions($FID) < "Q") { $arFilter["APPROVED"] = "Y"; } $db_res = CForumTopic::GetListEx(array("ID" => "DESC"), $arFilter, false, 1); if ($db_res && ($res = $db_res->Fetch())) { return true; } } else { $arFilter = array("FORUM_ID" => $FID); if (is_array($_SESSION["FORUM"]["GUEST_TID"]) && !empty($_SESSION["FORUM"]["GUEST_TID"])) { $arFilter["RENEW_TOPIC"][0] = ConvertTimeStamp($LAST_VISIT, "FULL"); foreach ($_SESSION["FORUM"]["GUEST_TID"] as $key => $val) { $arFilter["RENEW_TOPIC"][intVal($key)] = ConvertTimeStamp($val, "FULL"); } } else { $arFilter[">LAST_POST_DATE"] = ConvertTimeStamp($LAST_VISIT, "FULL"); } if (ForumCurrUserPermissions($FID) < "Q") { $arFilter["APPROVED"] = "Y"; } $db_res = CForumTopic::GetList(array(), $arFilter, false, 1); if ($db_res && ($res = $db_res->Fetch())) { return true; } } ForumInitParams(); return false; }
continue; } $arrTOPICS[] = $arTopic; } $rsTopics = new CDBResult(); $rsTopics->InitFromArray($arrTOPICS); } else { $rsTopics = CForumTopic::GetListEx(array($by => $order, "POSTS" => "DESC"), $arFilter, false, 0, array("bDescPageNumbering" => false, "nPageSize" => $arParams["TOPICS_PER_PAGE"], "bShowAll" => false, "sNameTemplate" => $arParams["NAME_TEMPLATE"])); } $rsTopics->nPageWindow = $arParams["PAGE_NAVIGATION_WINDOW"]; $rsTopics->NavStart($arParams["TOPICS_PER_PAGE"], false); $arResult["NAV_RESULT"] = $rsTopics; $arResult["NAV_STRING"] = $rsTopics->GetPageNavStringEx($navComponentObject, GetMessage("FL_TOPIC_LIST"), $arParams["PAGE_NAVIGATION_TEMPLATE"]); while ($res = $rsTopics->GetNext()) { if (!$USER->IsAuthorized()) { $res["PERMISSION"] = ForumCurrUserPermissions($res["FORUM_ID"]); // elseif ($res["PERMISSION"] >= "Q"): } /*******************************************************************/ $res["URL"] = array("TOPIC" => CComponentEngine::MakePathFromTemplate($arParams["URL_TEMPLATES_READ"], array("FID" => $res["FORUM_ID"], "TID" => $res["ID"], "TITLE_SEO" => $res["TITLE_SEO"], "MID" => "s")), "~TOPIC" => CComponentEngine::MakePathFromTemplate($arParams["~URL_TEMPLATES_READ"], array("FID" => $res["FORUM_ID"], "TID" => $res["ID"], "TITLE_SEO" => $res["TITLE_SEO"], "MID" => "s")), "LAST_MESSAGE" => CComponentEngine::MakePathFromTemplate($arParams["URL_TEMPLATES_MESSAGE"], array("FID" => $res["FORUM_ID"], "TID" => $res["ID"], "TITLE_SEO" => $res["TITLE_SEO"], "MID" => intVal($res["LAST_MESSAGE_ID"]))), "~LAST_MESSAGE" => CComponentEngine::MakePathFromTemplate($arParams["~URL_TEMPLATES_MESSAGE"], array("FID" => $res["FORUM_ID"], "TID" => $res["ID"], "TITLE_SEO" => $res["TITLE_SEO"], "MID" => intVal($res["LAST_MESSAGE_ID"]))), "MESSAGE_UNREAD" => CComponentEngine::MakePathFromTemplate($arParams["URL_TEMPLATES_MESSAGE"], array("FID" => $res["FORUM_ID"], "TID" => $res["ID"], "TITLE_SEO" => $res["TITLE_SEO"], "MID" => "unread_mid")), "~MESSAGE_UNREAD" => CComponentEngine::MakePathFromTemplate($arParams["~URL_TEMPLATES_MESSAGE"], array("FID" => $res["FORUM_ID"], "TID" => $res["ID"], "TITLE_SEO" => $res["TITLE_SEO"], "MID" => "unread_mid")), "USER_START" => CComponentEngine::MakePathFromTemplate($arParams["URL_TEMPLATES_PROFILE_VIEW"], array("UID" => $res["USER_START_ID"])), "~USER_START" => CComponentEngine::MakePathFromTemplate($arParams["~URL_TEMPLATES_PROFILE_VIEW"], array("UID" => $res["USER_START_ID"])), "LAST_POSTER" => CComponentEngine::MakePathFromTemplate($arParams["URL_TEMPLATES_PROFILE_VIEW"], array("UID" => $res["LAST_POSTER_ID"])), "~LAST_POSTER" => CComponentEngine::MakePathFromTemplate($arParams["~URL_TEMPLATES_PROFILE_VIEW"], array("UID" => $res["LAST_POSTER_ID"]))); $res["TopicStatus"] = "NEW"; /*******************************************************************/ if ($res["PERMISSION"] >= "Q") { $res["LAST_POSTER_ID"] = $res["ABS_LAST_POSTER_ID"]; $res["LAST_POST_DATE"] = $res["ABS_LAST_POST_DATE"]; $res["LAST_POSTER_NAME"] = $res["ABS_LAST_POSTER_NAME"]; $res["LAST_MESSAGE_ID"] = $res["ABS_LAST_MESSAGE_ID"]; $res["mCnt"] = intVal($res["POSTS_UNAPPROVED"]); $res["numMessages"] = $res["POSTS"] + $res["mCnt"]; $res["mCntURL"] = $res["URL"]["MODERATE_MESSAGE"]; } else {
if (!defined("B_PROLOG_INCLUDED") || B_PROLOG_INCLUDED !== true) { die; } if (!CModule::IncludeModule("forum")) { return false; } elseif (!($_REQUEST["save_product_review"] == "Y" || in_array($_REQUEST['REVIEW_ACTION'], array('DEL', 'HIDE', 'SHOW')))) { return false; } elseif (is_set($_REQUEST["ELEMENT_ID"]) && $arParams["ELEMENT_ID"] != $_REQUEST["ELEMENT_ID"]) { return false; } $this->IncludeComponentLang("action.php"); // 1.1. Check gross errors message data if (!check_bitrix_sessid()) { $arError[] = array("code" => "session time is up", "title" => GetMessage("F_ERR_SESSION_TIME_IS_UP")); } elseif (ForumCurrUserPermissions($arParams["FORUM_ID"]) <= "E") { $arError[] = array("code" => "access denied", "title" => GetMessage("F_ERR_NOT_RIGHT_FOR_ADD")); } elseif ((empty($_REQUEST["preview_comment"]) || $_REQUEST["preview_comment"] == "N") && $_REQUEST["save_product_review"] == "Y") { $FORUM_TOPIC_ID = 0; $arProperties = array(); $needProperty = array(); $strErrorMessage = ""; // 1.2 Check Post Text if (strLen($_REQUEST["REVIEW_TEXT"]) < 3) { $arError[] = array("code" => "post is empty", "title" => GetMessage("F_ERR_NO_REVIEW_TEXT")); } elseif (!$GLOBALS["USER"]->IsAuthorized() && ($arParams["USE_CAPTCHA"] == "Y" || $arResult["FORUM"]["USE_CAPTCHA"] == "Y")) { include_once $_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/main/classes/general/captcha.php"; $captchaPass = COption::GetOptionString("main", "captcha_password", ""); if ($arResult["FORUM"]["USE_CAPTCHA"] == "Y") { if (!class_exists("CForumTmpCaptcha")) { class CForumTmpCaptcha extends CCaptcha
function PrintMessages($mass, $arUser) { global $USER; $parser = new textParser(LANGUAGE_ID); ?> <table width="100%" border="0" cellspacing="0" cellpadding="5"><?php if (count($mass) <= 0) { ?> <tr><td class="forumtitle" colspan="2"> <table width="100%" border="0" cellspacing="0" cellpadding="0"><tr valign="top"> <td width="99%" class="forumtitletext"><b><?php echo GetMessage("LU_NONE_MESSAGE"); ?> </b></td> </tr></table></td></tr><?php } else { foreach ($mass as $arForum) { $strPerms = ForumCurrUserPermissions($arForum["ID"]); if ($strPerms < "E" || $arForum["ACTIVE"] != "Y") { continue; } ?> <tr><td colspan="2"><font style="font-size:4px;"> <br></font></td></tr><?php ?> <tr><td class="forumtitle" colspan="2"> <table width="100%" border="0" cellspacing="0" cellpadding="0"><tr valign="top"> <td width="99%" class="forumtitletext"><?php echo GetMessage("FL_FORUM"); ?> <a href="list.php?FID=<?php echo $arForum["ID"]; ?> "><b><?php echo $arForum["NAME"]; ?> </b></a></td> <td nowrap width="1%" align="right" class="forumtitletext"><?php echo GetMessage("LU_USER_POSTS_ON_FORUM"); ?> : <?php echo $arForum["NUM_POSTS_ALL"]; ?> </td> </tr></table></td></tr><?php ?> <tr><td colspan="2"><font style="font-size:4px;"> <br></font></td></tr><?php foreach ($arForum["TOPIC"] as $arTopic) { if ($strPerms < "Q" && $arTopic["APPROVED"] != "Y") { continue; } ?> <tr><td class="forumtitle" colspan="2"> <table width="100%" border="0" cellspacing="0" cellpadding="0" background="red"> <tr valign="top"> <?php if (strlen($arTopic["IMAGE"]) > 0) { ?> <td width="0%"><img src="/bitrix/images/forum/icon/<?php echo $arTopic["IMAGE"]; ?> " alt="<?php echo $arTopic["IMAGE_DESCR"]; ?> " border="0" width="15" height="15" vspace="0"><br></td> <td class="forumtitletext" width="0%"> </td> <?php } ?> <td class="forumtitletext" width="99%"><font class="forumtitletext"> <?php echo GetMessage("FR_TOPIC"); ?> «<a href="read.php?FID=<?php echo $arForum["ID"]; ?> &TID=<?php echo $arTopic["ID"]; ?> &UID=<?php echo $arUser["USER_ID"]; ?> "><b><?php echo htmlspecialcharsEx($arTopic["TITLE"]); ?> </b><?php if (strlen($arTopic["DESCRIPTION"]) > 0) { echo ", " . htmlspecialcharsEx($arTopic["DESCRIPTION"]); } ?> </a >» <?php echo GetMessage("FR_ON_FORUM"); ?> <a href="list.php?FID=<?php echo $arForum["ID"]; ?> "><b><?php echo $arForum["NAME"]; ?> </b></a></font></td> <td nowrap width="1%" align="right" valign="middle" class="forumtitletext"><?php echo GetMessage("FR_ON_VIEWS"); ?> <?php echo $arTopic["VIEWS"]; ?> <br> <?php echo GetMessage("LU_USER_POSTS_ON_TOPIC"); ?> : <?php echo $arTopic["COUNT_MESSAGE"]; ?> </td> </tr> </table> </td></tr><?php ?> <tr><td colspan="2"><font style="font-size:4px;"> <br></font></td></tr><?php foreach ($arTopic["MESSAGE"] as $arMessage) { if ($strPerms < "Q" && $arMessage["APPROVED"] != "Y") { continue; } ?> <tr valign="top" class="forumbody"> <td align="left" rowspan="2" width="140" class="forumbrd" style="border-right:none;"> <a name="message<?php echo $arMessage["ID"]; ?> "></a> <font class="forumbodytext"><b><?php echo htmlspecialcharsEx($arMessage["AUTHOR_NAME"]); ?> </b> <br><font class=\"forumheadcolor\"><?php echo htmlSpecialCharsEx($arForum["USER_PERM_STR"]); ?> </font> <br> <?php if (strlen($arUser["AVATAR"]) > 0) { ?> <a href="view_profile.php?UID=<?php echo $arUser["USER_ID"]; ?> &FID=<?php echo $arForum["ID"]; ?> &TID=<?php echo $arTopic["ID"]; ?> &MID=<?php echo $arMessage["ID"]; ?> " title="<?php echo GetMessage("FR_AUTHOR_PROFILE"); ?> "><?php echo CFile::ShowImage($arUser["AVATAR"], 90, 90, "border=0 vspace=5", "", true); ?> </a><br> <?php } ?> <?php if (strlen($arUser["DESCRIPTION"]) > 0) { ?> <i><?php echo htmlspecialcharsEx($arUser["DESCRIPTION"]); ?> </i><br> <?php } ?> <font style="font-size:8px;"> <br></font> <?php if (IntVal($arUser["NUM_POSTS"]) > 0) { ?> <font class="forumheadcolor"><?php echo GetMessage("FR_NUM_MESS"); ?> </font> <?php echo $arUser["NUM_POSTS"]; ?> <br> <?php } ?> <?php if (strlen($arUser["DATE_REG"]) > 0) { ?> <font class="forumheadcolor"><?php echo GetMessage("FR_DATE_REGISTER"); ?> </font> <?php echo $arUser["DATE_REG"]; ?> <br> <?php } ?> </font> </td> <td class="forumbrd forumbrd1" style="border-bottom:none;"> <table border="0" cellspacing="0" cellpadding="0" width="100%"> <tr><td width="100%"><font class="forumbodytext"><font class="forumheadcolor"><?php echo GetMessage("FR_DATE_CREATE"); ?> </font><nobr><?php echo $arMessage["POST_DATE"]; ?> </nobr><br></font></td></tr></table> <font style="font-size:5px;"> <br></font> <table width="100%" border="0" cellspacing="0" cellpadding="0"><tr><td class="forumhr"><img src="/bitrix/images/1.gif" width="1" height="1" alt=""></td></tr></table> <font style="font-size:8px;"> <br></font> <font class="forumbodytext"> <?php $arForum["ALLOW"]["SMILES"] = $arForum["ALLOW_SMILES"]; if ($arMessage["USE_SMILES"] != "Y") { $arForum["ALLOW"]["SMILES"] = "N"; } if (COption::GetOptionString("forum", "FILTER", "Y") == "Y" || COption::GetOptionString("forum", "MESSAGE_HTML", "Y") == "Y") { $message = $arMessage["POST_MESSAGE_HTML"]; } else { $message = $arMessage["POST_MESSAGE"]; } if (COption::GetOptionString("forum", "MESSAGE_HTML", "Y") == "N") { $message = $parser->convert($message, $arAllow); } echo $message; if (IntVal($arMessage["ATTACH_IMG"]) > 0) { echo "<br><br>"; if ($arForum["ALLOW_UPLOAD"] == "Y" || $arForum["ALLOW_UPLOAD"] == "F" || $arForum["ALLOW_UPLOAD"] == "A") { echo CFile::ShowFile($arMessage["ATTACH_IMG"], 0, 300, 300, true, "border=0", false); } } if (strlen($arUser["SIGNATURE"]) > 0) { echo "<br><br><font class=\"forumsigntext\">"; $arForum["ALLOW"]["SMILES"] = "N"; echo $parser->convert($arUser["SIGNATURE"], $arForum["ALLOW"]); echo "</font>"; } ?> </font> </td> </tr> <tr> <td valign="bottom" class="forumbody forumbrd forumbrd1" style="border-top:none;"> <table width="100%" border="0" cellspacing="0" cellpadding="0"> <tr><td class="forumhr"><img src="/bitrix/images/1.gif" width="1" height="1" alt=""></td></tr></table> <font style="font-size:5px;"> <br></font> <table width="100%" border="0" cellspacing="0" cellpadding="0"> <tr valign="top"> <td> <table border="0" cellspacing="0" cellpadding="0"> <tr> <td nowrap class="forummessbutton"><a href="view_profile.php?UID=<?php echo $arMessage["AUTHOR_ID"]; ?> &FID=<?php echo $arForum["ID"]; ?> &TID=<?php echo $arTopic["ID"]; ?> &MID=<?php echo $arMessage["ID"]; ?> " title="<?php echo GetMessage("FR_AUTHOR_PROFILE"); ?> " class="forummessbuttontext"><?php echo GetMessage("FR_PROFILE"); ?> </a></td> <td><div class="forummessbuttonsep"></div></td> <?php if (strlen($arUser["EMAIL"]) > 0) { ?> <td nowrap class="forummessbutton"><a href="send_message.php?TYPE=MAIL&UID=<?php echo $arMessage["AUTHOR_ID"]; ?> " title="<?php echo GetMessage("FR_EMAIL_AUTHOR"); ?> " class="forummessbuttontext">E-Mail</a></td> <td><div class="forummessbuttonsep"></div></td> <?php } ?> <?php if (strLen($arUser["PERSONAL_ICQ"]) > 0 && COption::GetOptionString("forum", "SHOW_ICQ_CONTACT", "N") == "Y") { ?> <td nowrap class="forummessbutton"><a href="send_message.php?TYPE=ICQ&UID=<?php echo $arMessage["AUTHOR_ID"]; ?> " title="<?php echo GetMessage("FR_ICQ_AUTHOR"); ?> " class="forummessbuttontext">ICQ</a></td> <td><div class="forummessbuttonsep"></div></td> <?php } ?> <?php if ($USER->IsAuthorized()) { ?> <td nowrap class="forummessbutton"><a href="pm_message.php?mode=new&USER_ID=<?php echo $arMessage["AUTHOR_ID"]; ?> " title="<?php echo GetMessage("FR_PRIVATE_MESSAGE"); ?> " class="forummessbuttontext">P-Mess</a></td> <td><div class="forummessbuttonsep"></div></td> <?php } ?> <?php ?> </tr> </table> <?php if (ForumCurrUserPermissions($arForum["ID"]) >= "Q" || $arTopic["LAST_TOPIC_MESSAGE"] == IntVal($arMessage["ID"]) && $USER->IsAuthorized() && IntVal($ar_Message["AUTHOR_ID"]) == IntVal($USER->GetParam("USER_ID")) || $arTopic["USER_PERM_DELETE"]) { ?> <font style="font-size:4px;"> <br></font> <table border="0" cellspacing="0" cellpadding="0"> <tr> <?php if ($arMessage["APPROVED"] == "Y" && ForumCurrUserPermissions($arForum["ID"]) >= "Q") { ?> <td nowrap class="forummessbutton"><a href="read.php?FID=<?php echo $arForum["ID"]; ?> &TID=<?php echo $arTopic["ID"]; ?> &MID=<?php echo $arMessage["ID"]; ?> &ACTION=HIDE&<?php echo bitrix_sessid_get(); ?> " title="<?php echo GetMessage("FR_HIDE_MESS"); ?> " class="forummessbuttontext"><?php echo GetMessage("FR_HIDE"); ?> </a></td> <td><div class="forummessbuttonsep"></div></td> <?php } elseif (ForumCurrUserPermissions($arForum["ID"]) >= "Q") { ?> <td nowrap class="forummessbutton"><a href="read.php?FID=<?php echo $arForum["ID"]; ?> &TID=<?php echo $arTopic["ID"]; ?> &MID=<?php echo $arMessage["ID"]; ?> &ACTION=SHOW&<?php echo bitrix_sessid_get(); ?> " title="<?php echo GetMessage("FR_SHOW_MESS"); ?> " class="forummessbuttontext"><i><b><?php echo GetMessage("FR_SHOW"); ?> </b></i></a></td> <td><div class="forummessbuttonsep"></div></td> <?php } ?> <?php if (ForumCurrUserPermissions($arForum["ID"]) >= "U" || $arTopic["LAST_TOPIC_MESSAGE"] == IntVal($arMessage["ID"]) && $USER->IsAuthorized() && IntVal($arMessage["AUTHOR_ID"]) == IntVal($USER->GetParam("USER_ID"))) { ?> <td nowrap class="forummessbutton"><a href="new_topic.php?FID=<?php echo $arForum["ID"]; ?> &TID=<?php echo $arTopic["ID"]; ?> &MID=<?php echo $arMessage["ID"]; ?> &MESSAGE_TYPE=EDIT" title="<?php echo GetMessage("FR_EDIT_MESS"); ?> " class="forummessbuttontext"><?php echo GetMessage("FR_EDIT"); ?> </a></td> <td><div class="forummessbuttonsep"></div></td> <?php } ?> <?php if ($arTopic["USER_PERM_DELETE"]) { ?> <td nowrap class="forummessbutton"><a href="read.php?FID=<?php echo $arForum["ID"]; ?> &TID=<?php echo $arTopic["ID"]; ?> &MID=<?php echo $arMessage["ID"]; ?> &ACTION=DEL&<?php echo bitrix_sessid_get(); ?> " title="<?php echo GetMessage("FR_DELETE_MESS"); ?> " class="forummessbuttontext"><?php echo GetMessage("FR_DELETE"); ?> </a></td> <td><div class="forummessbuttonsep"></div></td> <?php if (IntVal($arMessage["AUTHOR_ID"]) > 0 && CModule::IncludeModule("support")) { ?> <td nowrap class="forummessbutton"><a href="read.php?FID=<?php echo $arForum["ID"]; ?> &TID=<?php echo $arTopic["ID"]; ?> &MID=<?php echo $arMessage["ID"]; ?> &ACTION=FORUM_MESSAGE2SUPPORT&<?php echo bitrix_sessid_get(); ?> " title="<?php echo GetMessage("FR_MOVE2SUPPORT"); ?> " class="forummessbuttontext"><?php echo GetMessage("FR_2SUPPORT"); ?> </a></td> <td><div class="forummessbuttonsep"></div></td> <?php } ?> <?php } ?> </font> </tr> </table> <?php } ?> </td> <td align="right"> <table border="0" cellspacing="0" cellpadding="0"> <tr> <td nowrap class="forummessbutton" style="padding-left:2px; padding-right:2px;"><a href="javascript:scroll(0,0);" title="<?php echo GetMessage("FR_2TOP"); ?> " class="forummessbuttontext"><?php echo GetMessage("FR_TOP"); ?> </a></td> </tr> </table> </td> </tr> </table> </td> </tr><?php ?> <tr><td colspan="2"><font style="font-size:4px;"> <br></font></td></tr><?php } } } } ?> </table><?php }
$db_Message = CForumMessage::GetListEx(array("ID" => "ASC"), $arFilter); global $HTTP_GET_VARS; unset($_GET["MID"]); unset($HTTP_GET_VARS["MID"]); unset($_GET["ACTION"]); unset($HTTP_GET_VARS["ACTION"]); if ($MID > 0) { $db_Message->NavStart($GLOBALS["FORUM_MESSAGES_PER_PAGE"], false, CForumMessage::GetMessagePage($MID, $GLOBALS["FORUM_MESSAGES_PER_PAGE"], $USER->GetUserGroupArray())); } else { $db_Message->NavStart($GLOBALS["FORUM_MESSAGES_PER_PAGE"], false); } $UserInfo = array(); $arCurrUser = array(); $arCurrUser["Rank"] = CForumUser::GetUserRank(IntVal($USER->GetParam("USER_ID"))); $arCurrUser["bCanUserDeleteMessages"] = CForumTopic::CanUserDeleteTopicMessage($TID, $USER->GetUserGroupArray(), $USER->GetID()); $arCurrUser["Perms"] = ForumCurrUserPermissions($FID); $parser = new textParser(LANGUAGE_ID); $arAllow = array("HTML" => $arForum["ALLOW_HTML"], "ANCHOR" => $arForum["ALLOW_ANCHOR"], "BIU" => $arForum["ALLOW_BIU"], "IMG" => $arForum["ALLOW_IMG"], "LIST" => $arForum["ALLOW_LIST"], "QUOTE" => $arForum["ALLOW_QUOTE"], "CODE" => $arForum["ALLOW_CODE"], "FONT" => $arForum["ALLOW_FONT"], "SMILES" => $arForum["ALLOW_SMILES"], "UPLOAD" => $arForum["ALLOW_UPLOAD"], "NL2BR" => $arForum["ALLOW_NL2BR"]); ?> <table width="100%" border="0"> <tr> <td align="left"><?php echo $db_Message->NavPrint(GetMessage("FR_MESS")); ?> </td> <?php if (CForumTopic::CanUserAddTopic($FID, $USER->GetUserGroupArray(), $USER->GetID())) { ?> <form action='new_topic.php' method='GET'><td align='right'> <input type='hidden' name='FID' value='<?php echo $FID;
/***************** STANDART ****************************************/ if ($arParams["CACHE_TYPE"] == "Y" || $arParams["CACHE_TYPE"] == "A" && COption::GetOptionString("main", "component_cache_on", "Y") == "Y") { $arParams["CACHE_TIME"] = intval($arParams["CACHE_TIME"]); } else { $arParams["CACHE_TIME"] = 0; } $arParams["SET_TITLE"] = $arParams["SET_TITLE"] == "N" ? "N" : "Y"; /******************************************************************** /Input params ********************************************************************/ /******************************************************************** Default params # 1 ********************************************************************/ $arResult["TOPIC"] = array(); $arResult["FORUM"] = CForumNew::GetByID($arParams["FID"]); $arParams["PERMISSION_ORIGINAL"] = ForumCurrUserPermissions($arParams["FID"]); $arParams["PERMISSION"] = "A"; $arError = array(); $arNote = array(); /******************************************************************** /Default params #1 ********************************************************************/ /******************************************************************** Main Data & Permissions ********************************************************************/ $bCurrentUserIsAdmin = CSocNetUser::IsCurrentUserModuleAdmin(); if (empty($arResult["FORUM"])) { ShowError(GetMessage("F_FID_IS_LOST")); CHTTP::SetStatus("404 Not Found"); return false; } elseif ($arParams["MODE"] == "GROUP" && !CSocNetFeatures::IsActiveFeature(SONET_ENTITY_GROUP, $arParams["SOCNET_GROUP_ID"], "forum") || $arParams["MODE"] != "GROUP" && !CSocNetFeatures::IsActiveFeature(SONET_ENTITY_USER, $arParams["USER_ID"], "forum")) {
unset($_GET["result"]); unset($GLOBALS["HTTP_GET_VARS"]["result"]); DeleteParam(array("result")); $arResult["MESSAGES"] = array(); $arResult["MESSAGE_VIEW"] = array(); // FORUM CPageOption::SetOptionString("main", "nav_page_in_session", "N"); $arResult['FORUM_TOPIC_ID'] = null; $arResult["TOPIC"] = array(); $arFilter = array("FORUM_ID" => $arParams['FORUM_ID'], "XML_ID" => $arParams['ENTITY_XML_ID']); $dbRes = CForumTopic::GetList(null, $arFilter); if ($dbRes && ($arResult["TOPIC"] = $dbRes->Fetch())) { $arResult['FORUM_TOPIC_ID'] = $arResult["TOPIC"]['ID']; } $arResult["ELEMENT"] = array(); $arResult["USER"] = array("PERMISSION" => $arParams['PERMISSION'] !== null ? $arParams['PERMISSION'] : ForumCurrUserPermissions($arParams["FORUM_ID"]), "SHOWED_NAME" => $GLOBALS["FORUM_STATUS_NAME"]["guest"], "SUBSCRIBE" => array(), "FORUM_SUBSCRIBE" => "N", "TOPIC_SUBSCRIBE" => "N"); // A - NO ACCESS E - READ I - ANSWER // M - NEW TOPIC Q - MODERATE U - EDIT Y - FULL_ACCESS $userId = $USER->GetID(); $arUserGroups = $USER->GetUserGroupArray(); if ($arResult["USER"]["PERMISSION"] !== null && !CForumUser::IsAdmin()) { $arResult["USER"]["RIGHTS"] = array("ADD_TOPIC" => $arParams['PERMISSION'] >= 'M' ? "Y" : "N", "MODERATE" => $arParams['PERMISSION'] >= 'Q' ? "Y" : "N", "EDIT" => $arParams['PERMISSION'] >= 'U' ? "Y" : "N", "ADD_MESSAGE" => $arParams['PERMISSION'] >= 'I' ? "Y" : "N"); } else { $arResult["USER"]["RIGHTS"] = array("ADD_TOPIC" => CForumTopic::CanUserAddTopic($arParams["FORUM_ID"], $arUserGroups, $userId, $arResult["FORUM"]) ? "Y" : "N", "MODERATE" => CForumNew::CanUserModerateForum($arParams["FORUM_ID"], $arUserGroups, $userId) == true ? "Y" : "N", "EDIT" => CForumNew::CanUserEditForum($arParams["FORUM_ID"], $arUserGroups, $userId) ? "Y" : "N", "ADD_MESSAGE" => CForumMessage::CanUserAddMessage($arResult['FORUM_TOPIC_ID'], $arUserGroups, $userId) ? "Y" : "N"); } if ($USER->IsAuthorized()) { $arResult["USER"]["ID"] = $GLOBALS["USER"]->GetID(); $tmpName = empty($arParams["NAME_TEMPLATE"]) ? $GLOBALS["USER"]->GetFormattedName(false) : CUser::FormatName($arParams["NAME_TEMPLATE"], array("NAME" => $USER->GetFirstName(), "LAST_NAME" => $USER->GetLastName(), "SECOND_NAME" => $USER->GetSecondName(), "LOGIN" => $USER->GetLogin())); $arResult["USER"]["SHOWED_NAME"] = trim($_SESSION["FORUM"]["SHOW_NAME"] == "Y" ? $tmpName : $GLOBALS["USER"]->GetLogin()); $arResult["USER"]["SHOWED_NAME"] = trim(!empty($arResult["USER"]["SHOWED_NAME"]) ? $arResult["USER"]["SHOWED_NAME"] : $GLOBALS["USER"]->GetLogin()); }
$GLOBALS['NavNum'] = intVal(substr($key, strlen('PAGEN_'))) - 1; break; } } } $arParams["COMMENTS_COUNT"] = $arParams["COMMENTS_COUNT"] > 0 ? $arParams["COMMENTS_COUNT"] : 5; $arParams["USE_COMMENTS"] = $arParams["USE_COMMENTS"] == "N" ? "N" : "Y"; if ($arParams["USE_COMMENTS"] == "Y" && $arParams["COMMENTS_TYPE"] == "FORUM" && !$arParams["FORUM_ID"]) { $arParams["USE_COMMENTS"] = "N"; $arParams["SHOW_COMMENTS"] = "N"; } if ($arParams["USE_COMMENTS"] == "Y") { $arParams["COMMENTS_PERM_VIEW"] = "Y"; $arParams["COMMENTS_PERM_ADD"] = "Y"; if ($arParams["COMMENTS_TYPE"] == "FORUM" && CModule::IncludeModule("forum")) { $forumPerm = ForumCurrUserPermissions($arParams["FORUM_ID"]); $arParams["COMMENTS_PERM_VIEW"] = $forumPerm >= "E" ? "Y" : "N"; $arParams["COMMENTS_PERM_ADD"] = $forumPerm >= "I" ? "Y" : "N"; } elseif (CModule::IncludeModule("blog")) { $arBlog = CBlog::GetByUrl($arParams["BLOG_URL"]); if (IntVal($arBlog["ID"]) > 0) { $blogComPerm = CBlog::GetBlogUserCommentPerms(IntVal($arBlog["ID"]), $USER->GetId()); $arParams["COMMENTS_PERM_VIEW"] = $blogComPerm >= "I" ? "Y" : "N"; $arParams["COMMENTS_PERM_ADD"] = $blogComPerm >= "P" ? "Y" : "N"; } } if ($arParams["COMMENTS_PERM_VIEW"] == "N") { $arParams["USE_COMMENTS"] = "N"; $arParams["SHOW_COMMENTS"] = "N"; } }
} if (count($arTopic) <= 0) { LocalRedirect("list.php?FID=" . $FID); die; } define("FORUM_MODULE_PAGE", "MOVE"); if (ForumCurrUserPermissions($FID) < "Q") { $APPLICATION->AuthForm(GetMessage("FM_NO_FPERMS")); } if ($_SERVER["REQUEST_METHOD"] == "POST" && $_POST["action"] == "move" && check_bitrix_sessid()) { if (IntVal($newFID) <= 0) { $strErrorMessage .= GetMessage("FM_EMPTY_DEST_FORUM") . ". \n"; } if (strlen($strErrorMessage) <= 0) { $NewForum = CForumNew::GetByIDEx($newFID); if (ForumCurrUserPermissions($newFID) < "Q" && $NewForum["ALLOW_MOVE_TOPIC"] != "Y") { $strErrorMessage .= GetMessage("FM_NO_DEST_FPERMS") . ". \n"; } } if (strlen($strErrorMessage) <= 0) { foreach ($arTopic as $Topic) { $res = CForumTopic::MoveTopic2Forum($Topic["ID"], $newFID); if (!$res) { $strErrorMessage .= GetMessage("FM_ERR_MOVE_TOPIC") . ". \n"; } // elseif ($MakeNew) // { // foreach ($res as $MID) // { // CForumMessage::SendMailMessage($MID, array(), false, "NEW_FORUM_MESSAGE"); // }