本文整理匯總了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);
}