public static function CheckFields(&$arFields, $update = false) { global $APPLICATION, $USER; $strError = ""; if (CForumPrivateMessage::PMSize($USER->GetId()) < COption::GetOptionInt("forum", "MaxPrivateMessages", 100)) { if (is_set($arFields, "USER_ID") && strlen($arFields["USER_ID"]) <= 0) { $strError .= GetMessage("PM_ERR_USER_EMPTY"); } if (is_set($arFields, "POST_SUBJ") && strlen(trim($arFields["POST_SUBJ"])) <= 0) { $strError .= GetMessage("PM_ERR_SUBJ_EMPTY"); } if (is_set($arFields, "POST_MESSAGE") && strlen(trim($arFields["POST_MESSAGE"])) <= 0) { $strError .= GetMessage("PM_ERR_TEXT_EMPTY"); } } else { $strError = GetMessage("PM_ERR_NO_SPACE"); if ($update) { return true; } } if ($strError) { $APPLICATION->ThrowException($strError); return false; } $arFields["REQUEST_IS_READ"] = $arFields["REQUEST_IS_READ"] != "Y" ? "N" : "Y"; if (is_set($arFields, "FOLDER_ID") && intval($arFields["FOLDER_ID"]) == 4) { $arFields["IS_READ"] = "Y"; } return true; }
} else { $e = new CAdminException(array_reverse($arError)); $GLOBALS["APPLICATION"]->ThrowException($e); $err = $GLOBALS['APPLICATION']->GetException(); $arResult["ERROR_MESSAGE"] = $err->GetString(); $bVarsFromForm = true; } } /******************************************************************** Action ********************************************************************/ /******************************************************************** Data ********************************************************************/ $arResult["action"] = $mode == "edit" ? "save" : "send"; $arResult["count"] = CForumPrivateMessage::PMSize($USER->GetID(), COption::GetOptionInt("forum", "MaxPrivateMessages", 100)); $arResult["count"] = round($arResult["count"] * 100); $arResult["sessid"] = bitrix_sessid_post(); $arResult["FID"] = intVal($arParams["FID"]); $arResult["MID"] = intVal($arParams["MID"]); $arResult["mode"] = $mode; $arResult["SystemFolder"] = FORUM_SystemFolder; $resFolder = CForumPMFolder::GetList(array(), array("USER_ID" => $USER->GetID())); $arResult["UserFolder"] = array(); if ($resFolder && ($resF = $resFolder->GetNext())) { do { $arResult["UserFolder"][$resF["ID"]] = $resF; } while ($resF = $resFolder->GetNext()); } // ***************************************************************************************** // Info about current user
} } elseif ($action == "remove" && $remMes) { LocalRedirect("pm_folder.php?res=remove"); } } else { $APPLICATION->ThrowException(GetMessage("PM_NOT_RIGHT")); } break; default: break; } //**********************************/action*********************************** //**********************************output/*********************************** $APPLICATION->SetTemplateCSS("forum/forum_tmpl_1/forum.css"); $APPLICATION->IncludeFile("forum/forum_tmpl_1/menu.php"); $count = CForumPrivateMessage::PMSize($USER->GetId(), COption::GetOptionInt("forum", "MaxPrivateMessages", 100)); echo "<table width='100%' border='0'><tr><td align='right'>\r\n\t\t\t<table width=200 cellpadding=0 cellspacing=0 border=0>\r\n\t\t\t\t<tr>\r\n\t\t\t\t\t<td width='100%'>\r\n\t\t\t\t\t<div class=out>\r\n\t\t\t\t\t\t<div class=in style='width:" . round($count * 100) . "%;'> </div>\r\n\t\t\t\t\t</div>\r\n\t\t\t\t\t<div class=out1>\r\n\t\t\t\t\t\t<div class=in1 align=center style='width:100%'>" . GetMessage("PM_POST_FULLY") . " " . round($count * 100) . "%</div>\r\n\t\t\t\t\t</div>\r\n\t\t\t\t\t</td>\r\n\t\t\t\t</tr>\r\n\t\t\t</table>\r\n\t\t</td></tr></table>"; // Вывод ошибок и неошибок $err = $APPLICATION->GetException(); $strError = $err->GetString(); ShowError($strError); ShowNote($strNote); //**********************************mode/************************************* switch ($mode) { case "edit": case "new": $title = GetMessage("PM_TITLE_CREATE"); if ($mode == "edit" && empty($FOLDER_TITLE)) { $res = CForumPMFolder::GetList(array(), array("ID" => $id)); $res = $res->Fetch(); $FOLDER_TITLE = $res["TITLE"];