Пример #1
0
 $iFid = intVal($iFid);
 if ($iFid <= 0) {
 } elseif (!CForumPMFolder::CheckPermissions($iFid)) {
     $arError[] = array("id" => "bad_permission", "text" => GetMessage("PM_NOT_RIGHT"));
 } elseif ($action == "delete" && $iFid <= FORUM_SystemFolder) {
     $arError[] = array("id" => "bad_folders", "text" => GetMessage("F_ERR_SYSTEM_FOLDERS"));
 } else {
     $arFilter = array("FOLDER_ID" => $iFid, "USER_ID" => $USER->GetId());
     if ($version == "2" && ($iFid == 2 || $iFid == 3)) {
         $arFilter = array("OWNER_ID" => $USER->GetId());
     } elseif ($version != "2" && $iFid == 2) {
         $arFilter = array("FOLDER_ID" => 2, "USER_ID" => $USER->GetId(), "OWNER_ID" => $USER->GetId());
     }
     $arMessage = CForumPrivateMessage::GetListEx(array(), $arFilter);
     while ($res = $arMessage->GetNext()) {
         if (!CForumPrivateMessage::Delete($res["ID"])) {
             $arError[] = array("id" => "bad_delete_" . $res["ID"], "text" => GetMessage("PM_NOT_DELETE"));
         }
     }
     if (empty($arError) && $action == "delete" && !CForumPMFolder::Delete($iFid)) {
         $arError[] = array("id" => "not_delete", "text" => GetMessage("PM_NOT_DELETE"));
     }
     if (empty($arError)) {
         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)) {
Пример #2
0
if (!empty($arResult["action"])) {
    $arError = array();
    $strOK = "";
    $APPLICATION->ResetException();
    $APPLICATION->ThrowException(" ");
    $folder_id = 0;
    if (!check_bitrix_sessid()) {
        $arError[] = array("id" => "BAD_SESSID", "text" => GetMessage("F_ERR_SESS_FINISH"));
    } elseif (empty($message)) {
        $arError[] = array("id" => "BAD_DATA", "text" => GetMessage("PM_ERR_NO_DATA"));
    } elseif ($arResult["action"] == "delete") {
        $folder_id = 4;
        foreach ($message as $MID) {
            if (!CForumPrivateMessage::CheckPermissions($MID)) {
                $arError[] = array("id" => "BAD_PERMISSION_" . $MID, "text" => str_replace("#MID#", $MID, GetMessage("PM_ERR_DELETE_NO_PERM")));
            } elseif (!CForumPrivateMessage::Delete($MID, array("FOLDER_ID" => 4))) {
                $arError[] = array("id" => "BAD_DELETE_" . $MID, "text" => str_replace("#MID#", $MID, GetMessage("PM_ERR_DELETE")));
            } else {
                $strOK .= str_replace("#MID#", $MID, GetMessage("PM_OK_DELETE"));
            }
        }
    } elseif (($arResult["action"] == "copy" || $arResult["action"] == "move") && intVal($_REQUEST["folder_id"]) <= 0) {
        $arError[] = array("id" => "BAD_DATA", "text" => GetMessage("PM_ERR_MOVE_NO_FOLDER"));
    } elseif ($arResult["action"] == "copy" || $arResult["action"] == "move") {
        $folder_id = intVal($_REQUEST["folder_id"]);
        foreach ($message as $MID) {
            $arrVars = array("FOLDER_ID" => intVal($folder_id), "USER_ID" => $USER->GetId());
            if ($folder_id == 4 || $arResult["action"] != "move") {
                $arrVars["IS_READ"] = "Y";
            }
            if (!CForumPrivateMessage::CheckPermissions($MID)) {
Пример #3
0
         }
     } else {
         $APPLICATION->ThrowException(GetMessage("PM_NOT_FOLDER_TITLE"));
     }
     break;
 case "delete":
 case "remove":
     $remMes = true;
     if (CForumPMFolder::CheckPermissions($id)) {
         $arFilter = $id == 2 ? array("FOLDER_ID" => 2, "USER_ID" => $USER->GetId(), "OWNER_ID" => $USER->GetId()) : array("FOLDER_ID" => $id, "USER_ID" => $USER->GetId());
         $arMessage = CForumPrivateMessage::GetList(array(), $arFilter);
         //						print_r($arMessage);
         //						die();
         while ($MID = $arMessage->GetNext()) {
             //							print_r($MID);
             if (!CForumPrivateMessage::Delete($MID["ID"])) {
                 $remMes = false;
             }
         }
         if ($action == "delete" && $remMes) {
             if (CForumPMFolder::Delete($id)) {
                 LocalRedirect("pm_folder.php?res=delete");
             } else {
                 $APPLICATION->ThrowException(GetMessage("PM_NOT_DELETE"));
             }
         } elseif ($action == "remove" && $remMes) {
             LocalRedirect("pm_folder.php?res=remove");
         }
     } else {
         $APPLICATION->ThrowException(GetMessage("PM_NOT_RIGHT"));
     }