Beispiel #1
0
         $str = "";
         $err = $APPLICATION->GetException();
         if ($err) {
             $str = $err->GetString();
         }
         $arError[] = array("id" => "not_add", "text" => $str);
     }
     break;
 case "delete":
 case "remove":
     $arFolders = is_array($_REQUEST["FID"]) && !empty($_REQUEST["FID"]) ? $_REQUEST["FID"] : $arParams["FID"];
     foreach ($arFolders as $iFid) {
         $remMes = true;
         $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"));
                 }
Beispiel #2
0
         }
     }
     break;
 case "save":
     if ($_SERVER['REQUEST_METHOD'] == "POST" && strLen($FOLDER_TITLE) > 0) {
         if (CForumPMFolder::Add($FOLDER_TITLE)) {
             LocalRedirect("pm_folder.php?res=create");
         }
     } 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"));