Пример #1
0
    LocalRedirect(ForumAddPageParams(CComponentEngine::MakePathFromTemplate($arParams["URL_TEMPLATES_PM_LIST"], array("FID" => $arParams["FID"])), array("result" => "no_mid")));
}
$db_res = CForumPrivateMessage::GetListEx(array(), array("ID" => $arParams["MID"]), false, 0, array("sNameTemplate" => $arParams["NAME_TEMPLATE"]));
if (!($db_res && ($res = $db_res->GetNext()))) {
    LocalRedirect(ForumAddPageParams(CComponentEngine::MakePathFromTemplate($arParams["URL_TEMPLATES_PM_LIST"], array("FID" => $arParams["FID"])), array("result" => "no_mid")));
} elseif (!CForumPrivateMessage::CheckPermissions($arParams["MID"])) {
    LocalRedirect(ForumAddPageParams(CComponentEngine::MakePathFromTemplate($arParams["URL_TEMPLATES_PM_LIST"], array("FID" => $arParams["FID"])), array("result" => "no_perm")));
    die;
}
$arParams["FID"] = $arParams["FID"] != 2 ? intVal($res["FOLDER_ID"]) : $arParams["FID"];
$arResult["MESSAGE"] = $res;
/********************************************************************
				Action
********************************************************************/
if ($res["IS_READ"] != "Y" && $arParams["FID"] != 2) {
    CForumPrivateMessage::MakeRead($arParams["MID"]);
    BXClearCache(true, "/bitrix/forum/user/" . $USER->GetId() . "/");
    $arComponentPath = array("bitrix:forum");
    foreach ($arComponentPath as $path) {
        $componentRelativePath = CComponentEngine::MakeComponentPath($path);
        $arComponentDescription = CComponentUtil::GetComponentDescr($path);
        if (strLen($componentRelativePath) <= 0 || !is_array($arComponentDescription)) {
            continue;
        } elseif (!array_key_exists("CACHE_PATH", $arComponentDescription)) {
            continue;
        }
        $path = str_replace("//", "/", $componentRelativePath . "/user" . $USER->GetID());
        if ($arComponentDescription["CACHE_PATH"] == "Y") {
            $path = "/" . SITE_ID . $path;
        }
        if (!empty($path)) {