Beispiel #1
0
 } 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)) {
                 continue;
             }
             $path = str_replace("//", "/", $componentRelativePath . "/user" . $USER->GetID());
             if ($arComponentDescription["CACHE_PATH"] == "Y") {
Beispiel #2
0
     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"));
         }
         break;
     default:
         break;
 }
 //**********************************/action***********************************