本文整理汇总了PHP中CForumNew::CanUserAddForum方法的典型用法代码示例。如果您正苦于以下问题:PHP CForumNew::CanUserAddForum方法的具体用法?PHP CForumNew::CanUserAddForum怎么用?PHP CForumNew::CanUserAddForum使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CForumNew
的用法示例。
在下文中一共展示了CForumNew::CanUserAddForum方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: GetMessage
/Input params
********************************************************************/
$APPLICATION->SetTitle($ID > 0 ? GetMessage("FORUM_EDIT_RECORD", array("#ID#" => $ID)) : GetMessage("FORUM_NEW_RECORD"));
/********************************************************************
Action
********************************************************************/
$fileName = '';
if ($REQUEST_METHOD == "POST" && $forumPermissions >= "W" && (strlen($save) > 0 || strlen($apply) > 0)) {
if (isset($_FILES["IMAGE"]["name"])) {
$fileName = RemoveScriptExtension($_FILES["IMAGE"]["name"]);
}
if (!check_bitrix_sessid()) {
$arError[] = array("id" => "bad_sessid", "text" => GetMessage("ERROR_BAD_SESSID"));
} elseif ($ID > 0 && !CForumNew::CanUserUpdateForum($ID, $USER->GetUserGroupArray(), $USER->GetID())) {
$arError[] = array("id" => "not_right_for_edit", "text" => GetMessage("FE_NO_PERMS2UPDATE"));
} elseif ($ID <= 0 && !CForumNew::CanUserAddForum($USER->GetUserGroupArray(), $USER->GetID())) {
$arError[] = array("id" => "not_right_for_add", "text" => GetMessage("FE_NO_PERMS2ADD"));
} elseif (!empty($_FILES["IMAGE"]["tmp_name"])) {
$sUploadDir = $_SERVER["DOCUMENT_ROOT"] . BX_ROOT . "/images/forum/" . ($_REQUEST["TYPE"] == "I" ? "icon" : "smile") . "/";
CheckDirPath($sUploadDir);
$arSmile = $ID > 0 ? CForumSmile::GetByID($ID) : $arSmile;
$res = CFile::CheckImageFile($_FILES["IMAGE"], COption::GetOptionString("forum", "file_max_size", 50000), 0, 0);
if (strLen($res) > 0) {
$arError[] = array("id" => "IMAGE", "text" => $res);
} elseif (file_exists($sUploadDir . $fileName) && !(isset($arSmile["IMAGE"]) && $arSmile["IMAGE"] != $fileName)) {
$arError[] = array("id" => "IMAGE", "text" => GetMessage("ERROR_EXISTS_IMAGE", array("#FILE#" => str_replace("//", "/", "/" . BX_ROOT . "/images/forum/" . ($_REQUEST["TYPE"] == "I" ? "icon" : "smile") . "/" . $fileName))));
} elseif (!@copy($_FILES["IMAGE"]["tmp_name"], $sUploadDir . $fileName)) {
$arError[] = array("id" => "IMAGE", "text" => GetMessage("ERROR_COPY_IMAGE"));
} else {
@chmod($sUploadDir . $fileName, BX_FILE_PERMISSIONS);
}