$candelete = false; if ($_REQUEST['action_target'] == 'selected') { $rsData = CForumSubscribe::GetListEx(array($by => $order), $arFilter); while ($arRes = $rsData->Fetch()) { $arID[] = $arRes['ID']; } } if (check_bitrix_sessid()) { foreach ($arID as $ID) { if (strlen($ID) <= 0) { continue; } $ID = intval($ID); switch ($_REQUEST['action']) { case "delete": if (CForumSubscribe::CanUserDeleteSubscribe($ID, $USER->GetUserGroupArray(), $USER->GetID())) { CForumSubscribe::Delete($ID); } else { $arMsg[] = array("id" => "NO_PERMS", "text" => GetMessage("FSUBSC_NO_SPERMS")); } break; } } } } //************************************/Actions ******************************************************************** if (!empty($arMsg)) { $err = new CAdminException($arMsg); $lAdmin->AddFilterError($err->GetString()); } $rsData = CForumSubscribe::GetListEx(array($by => $order), $arFilter);
if (!$USER->IsAdmin() || $UID <= 0) { $UID = IntVal($USER->GetParam("USER_ID")); } $bUserFound = False; $db_userX = CUser::GetByID($UID); if ($ar_userX = $db_userX->Fetch()) { $bUserFound = True; while (list($key, $val) = each($ar_userX)) { ${"f_" . $key} = htmlspecialchars($val); } } $strErrorMessage = ""; $strOKMessage = ""; $bVarsFromForm = false; if ($_SERVER["REQUEST_METHOD"] == "GET" && $_GET["ACTION"] == "DEL" && IntVal($_GET["ID"]) > 0) { if (CForumSubscribe::CanUserDeleteSubscribe(IntVal($_GET["ID"]), $USER->GetUserGroupArray(), $USER->GetID())) { CForumSubscribe::Delete(IntVal($_GET["ID"])); } else { $strErrorMessage .= GetMessage("FSL_NO_SPERMS") . ". \n"; } } $APPLICATION->AddChainItem(GetMessage("FSL_PROFILE"), "profile.php"); $APPLICATION->SetTitle(GetMessage("FSL_FTITLE")); $APPLICATION->SetTemplateCSS("forum/forum_tmpl_1/forum.css"); $APPLICATION->IncludeFile("forum/forum_tmpl_1/menu.php"); if (!$bUserFound) { $strErrorMessage .= str_replace("#UID#", $UID, GetMessage("FSL_NO_DUSER")) . ". \n"; } ?> <?php
function ForumDeleteSubscribe($ID, &$strErr, &$strOk) { global $USER; $ID = IntVal($ID); if (CForumSubscribe::CanUserDeleteSubscribe($ID, $USER->GetUserGroupArray(), $USER->GetID())) { CForumSubscribe::Delete($ID); return true; } else { $strErr = GetMessage("FSUBSC_NO_SPERMS") . ". \n"; } return false; }
$arParams["SHOW_WEBDAV"] = $ob->CheckRight($arParams["PERMISSION"], "element_edit") >= "U" ? 'Y' : 'N'; /*************** Forum subscribe to document ***********************/ if ($arParams["USE_COMMENTS"] == "Y" && $GLOBALS['USER']->IsAuthorized()) { CModule::IncludeModule("forum"); $cache_id = "/" . $arParams["IBLOCK_ID"] . "/forum_user_subscribe_" . intVal($GLOBALS["USER"]->GetID()) . "_" . $arParams["FORUM_ID"]; $arParams["FORUM_CAN_VIEW"] = CForumNew::CanUserViewForum($arParams["FORUM_ID"], $GLOBALS['USER']->GetUserGroupArray()) ? "Y" : "N"; if ($arParams["FORUM_CAN_VIEW"] == "Y" && $GLOBALS['USER']->IsAuthorized()) { if ((!empty($_REQUEST["SUBSCRIBE_FORUM"]) || !empty($_REQUEST["subscribe_forum"])) && check_bitrix_sessid()) { if ($_REQUEST["SUBSCRIBE_FORUM"] == "Y" || $_REQUEST["subscribe_forum"] == "Y") { ForumSubscribeNewMessagesEx($arParams["FORUM_ID"], 0, "N", $strErrorMessage = "", $strOKMessage = ""); } elseif ($_REQUEST["SUBSCRIBE_FORUM"] == "N" || $_REQUEST["subscribe_forum"] == "N") { $arFilter = array("USER_ID" => $GLOBALS["USER"]->GetId(), "FORUM_ID" => $arParams["FORUM_ID"]); $db_res = CForumSubscribe::GetList(array(), $arFilter); if ($db_res && ($res = $db_res->Fetch())) { do { if (CForumSubscribe::CanUserDeleteSubscribe($res["ID"], $GLOBALS["USER"]->GetUserGroupArray(), $GLOBALS["USER"]->GetID())) { CForumSubscribe::Delete($res["ID"]); } } while ($res = $db_res->Fetch()); } } BXClearCache(true, $cache_path_main); $arNavChain = $arParams["CONVERT"] ? $arResult["NAV_CHAIN_UTF8"] : $arResult["NAV_CHAIN"]; $url = CComponentEngine::MakePathFromTemplate($arParams["~SECTIONS_URL"], array("PATH" => implode("/", $arNavChain), "SECTION_ID" => $arParams["SECTION_ID"])); } $bShowSubscribe = true; $arUserSubscribe = array(); if ($arParams["CACHE_TIME"] > 0 && $cache->InitCache($arParams["CACHE_TIME"], $cache_id, $cache_path_main)) { $res = $cache->GetVars(); $arUserSubscribe = $res["arUserSubscribe"]; } else {