Exemplo n.º 1
0
     } elseif (!CForumPMFolder::CheckPermissions($arParams["FID"])) {
         $arError[] = array("id" => "bad_permission", "text" => GetMessage("PM_NOT_RIGHT"));
     } elseif (!CForumPMFolder::Update($arParams["FID"], array("TITLE" => $_REQUEST["FOLDER_TITLE"]))) {
         $str = "";
         $err = $APPLICATION->GetException();
         if ($err) {
             $str = $err->GetString();
         }
         $arError[] = array("id" => "not_updated", "text" => $str);
     }
     break;
 case "save":
     $_REQUEST["FOLDER_TITLE"] = trim($_REQUEST["FOLDER_TITLE"]);
     if (empty($_REQUEST["FOLDER_TITLE"])) {
         $arError[] = array("id" => "empty_data", "text" => GetMessage("PM_NOT_FOLDER_TITLE"));
     } elseif (!CForumPMFolder::Add($_REQUEST["FOLDER_TITLE"])) {
         $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) {
Exemplo n.º 2
0
     $res = CForumPMFolder::GetList(array(), array("ID" => $id));
     if (!($resFolder = $res->GetNext())) {
         $APPLICATION->ThrowException(GetMessage("PM_NOT_FOLDER"));
     } else {
         if (CForumPMFolder::CheckPermissions($id)) {
             if (CForumPMFolder::Update($id, array("TITLE" => $FOLDER_TITLE))) {
                 LocalRedirect("pm_folder.php?res=saved");
             }
         } else {
             $APPLICATION->ThrowException(GetMessage("PM_NOT_RIGHT"));
         }
     }
     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()) {