本文整理汇总了PHP中CForumNew::GetUserPermission方法的典型用法代码示例。如果您正苦于以下问题:PHP CForumNew::GetUserPermission方法的具体用法?PHP CForumNew::GetUserPermission怎么用?PHP CForumNew::GetUserPermission使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CForumNew
的用法示例。
在下文中一共展示了CForumNew::GetUserPermission方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: array
$res["~POST_MESSAGE_TEXT"] = COption::GetOptionString("forum", "FILTER", "Y") == "Y" ? $res["~POST_MESSAGE_FILTER"] : $res["~POST_MESSAGE"];
// attach
$res["ATTACH_IMG"] = "";
$res["FILES"] = array();
$res["~ATTACH_FILE"] = array();
$res["ATTACH_FILE"] = array();
/************** Message info/***************************************/
/************** Author info ****************************************/
$res["AUTHOR_ID"] = intVal($res["AUTHOR_ID"]);
$res["AUTHOR_NAME"] = $parser->wrap_long_words($res["AUTHOR_NAME"]);
if ($res["AUTHOR_ID"] <= 0) {
// Status
list($res["AUTHOR_STATUS_CODE"], $res["AUTHOR_STATUS"]) = ForumGetUserForumStatus(0);
} else {
if (!array_key_exists($res["AUTHOR_ID"], $UserInfo)) {
$perm = CForumNew::GetUserPermission($res["FORUM_ID"], CUser::GetUserGroup($res["AUTHOR_ID"]));
$arUser = array("Perms" => $perm, "Rank" => $perm <= "Q" ? CForumUser::GetUserRank($res["AUTHOR_ID"], LANGUAGE_ID) : "", "Points" => !empty($res["POINTS"]) ? array("POINTS" => $res["POINTS"], "DATE_UPDATE" => $res["DATE_UPDATE"]) : false);
$arUData = array();
// Status
list($arUData["AUTHOR_STATUS_CODE"], $arUData["AUTHOR_STATUS"]) = ForumGetUserForumStatus($res["AUTHOR_ID"], $arUser["Perms"], $arUser);
// Avatar
if (!empty($res["AVATAR"])) {
$arUData["AVATAR"] = array("ID" => $res["~AVATAR"], "FILE" => CFile::GetFileArray($res["~AVATAR"]));
$arUData["AVATAR"]["HTML"] = CFile::ShowImage($arUData["AVATAR"]["FILE"], COption::GetOptionString("forum", "avatar_max_width", 90), COption::GetOptionString("forum", "avatar_max_height", 90), "border=\"0\"", "", true);
}
// Voting
$arUData["VOTING"] = "N";
if (COption::GetOptionString("forum", "SHOW_VOTES", "Y") == "Y" && $USER->IsAuthorized() && ($GLOBALS["APPLICATION"]->GetGroupRight("forum") >= "W" || $USER->GetID() != $res["AUTHOR_ID"])) {
$bUnVote = $arUser["Points"];
$bVote = !$arUser["Points"] ? $arResult["USER"]["RANK"]["VOTES"] : intval($arUser["Points"]["POINTS"]) < intval($arResult["USER"]["RANK"]["VOTES"]);
$bVote = $bVote ? $bVote : $GLOBALS["APPLICATION"]->GetGroupRight("forum") >= "W";
示例2: strlen
$GLOBALS['APPLICATION']->SetAdditionalCSS('/bitrix/components/bitrix/forum/templates/.default/style.css');
$GLOBALS['APPLICATION']->SetAdditionalCSS('/bitrix/components/bitrix/forum/templates/.default/themes/gray/style.css');
$GLOBALS['APPLICATION']->SetAdditionalCSS('/bitrix/components/bitrix/forum/templates/.default/styles/additional.css');
}
$GLOBALS['APPLICATION']->AddHeadString('<script src="/bitrix/js/main/utils.js"></script>', true);
$GLOBALS['APPLICATION']->AddHeadString('<script src="/bitrix/components/bitrix/forum.interface/templates/.default/script.js"></script>', true);
/********************************************************************
Input params
********************************************************************/
/***************** BASE ********************************************/
$arParams["component"] = $component;
$arParams["SHOW_MAIL"] = $arParams["SEND_MAIL"] <= "A" || $arParams["SEND_MAIL"] <= "E" && !$GLOBALS['USER']->IsAuthorized() ? "N" : "Y";
$arParams["SHOW_RSS"] = $arParams["SHOW_RSS"] == "N" ? "N" : "Y";
$arParams["SHOW_VOTE"] = $arParams["SHOW_VOTE"] == "Y" ? "Y" : "N";
$arParams["VOTE_TEMPLATE"] = strlen(trim($arParams["VOTE_TEMPLATE"])) > 0 ? trim($arParams["VOTE_TEMPLATE"]) : "light";
$arParams["VOTE_CHANNEL_ID"] = intval($arParams["VOTE_CHANNEL_ID"]) > 0 ? $arParams["VOTE_CHANNEL_ID"] : 1;
if ($arParams["SHOW_RSS"] == "Y") {
$arParams["SHOW_RSS"] = !$USER->IsAuthorized() ? "Y" : (CForumNew::GetUserPermission($arParams["FID"], array(2)) > "A" ? "Y" : "N");
if ($arParams["SHOW_RSS"] == "Y") {
$APPLICATION->AddHeadString('<link rel="alternate" type="application/rss+xml" href="' . $arResult["URL"]["RSS"] . '" />');
}
}
$arParams["SHOW_NAME_LINK"] = $arParams["SHOW_NAME_LINK"] == "N" ? "N" : "Y";
$arParams["FIRST_MESSAGE_ID"] = $arResult["MESSAGE_FIRST"]["ID"];
$arParams["ATTACH_MODE"] = array("NAME", "THUMB");
$arParams["ATTACH_SIZE"] = $arParams["IMAGE_SIZE"];
/********************************************************************
/Input params
********************************************************************/
include str_replace(array("\\", "//"), "/", dirname(__FILE__) . "/template_message.php");
CUtil::InitJSCore(array("ajax", "fx"));
示例3: array
$arParams["ATTACH_SIZE"] = $arParams["IMAGE_SIZE"];
} else {
$arParams["ATTACH_MODE"] = array("NAME");
$arParams["ATTACH_SIZE"] = 0;
}
}
$arParams["ATTACH_MODE"] = is_array($arParams["ATTACH_MODE"]) ? $arParams["ATTACH_MODE"] : array();
$arParams["ATTACH_MODE"] = !in_array("NAME", $arParams["ATTACH_MODE"]) && !in_array("THUMB", $arParams["ATTACH_MODE"]) ? array("NAME") : $arParams["ATTACH_MODE"];
$arParams["ATTACH_SIZE"] = intVal(intVal($arParams["ATTACH_SIZE"]) > 0 ? $arParams["ATTACH_SIZE"] : 90);
$arParams["SHOW_MAIL"] = $arParams["SEND_MAIL"] <= "A" || $arParams["SEND_MAIL"] <= "E" && !$GLOBALS['USER']->IsAuthorized() ? "N" : "Y";
$arParams["SHOW_ICQ"] = $arParams["SHOW_ICQ"] == "Y" ? "Y" : "N";
$arParams["AJAX_TYPE"] = $arParams["AJAX_TYPE"] == "Y" ? "Y" : "N";
$arParams["SHOW_RSS"] = $arParams["SHOW_RSS"] == "N" ? "N" : "Y";
$arParams["SHOW_FIRST_POST"] = $arParams["SHOW_FIRST_POST"] == "Y" ? "Y" : "N";
if ($arParams["SHOW_RSS"] == "Y") {
$arParams["SHOW_RSS"] = !$USER->IsAuthorized() ? "Y" : (CForumNew::GetUserPermission($arParams["FID"], array(2)) > "A" || $GLOBALS['USER']->IsAdmin() ? "Y" : "N");
}
$arParams["SHOW_NAME_LINK"] = $arParams["SHOW_NAME_LINK"] == "N" ? "N" : "Y";
$arParams["SHOW_VOTE"] = $arParams["SHOW_VOTE"] == "Y" ? "Y" : "N";
$arParams["VOTE_TEMPLATE"] = strlen(trim($arParams["VOTE_TEMPLATE"])) > 0 ? trim($arParams["VOTE_TEMPLATE"]) : "light";
$arParams["SEO_USER"] = $arParams["SEO_USER"];
/********************************************************************
/Input params
********************************************************************/
if (!$this->__component->__parent || empty($this->__component->__parent->__name)) {
$GLOBALS['APPLICATION']->SetAdditionalCSS('/bitrix/components/bitrix/forum/templates/.default/style.css');
$GLOBALS['APPLICATION']->SetAdditionalCSS('/bitrix/components/bitrix/forum/templates/.default/themes/blue/style.css');
$GLOBALS['APPLICATION']->SetAdditionalCSS('/bitrix/components/bitrix/forum/templates/.default/styles/additional.css');
}
$GLOBALS['APPLICATION']->AddHeadScript("/bitrix/js/main/utils.js");
$GLOBALS['APPLICATION']->AddHeadScript("/bitrix/components/bitrix/forum.interface/templates/.default/script.js");
示例4: array
}
/************** Message List/***************************************/
if (!empty($arTopicNeeded)) {
$db_res = CForumUser::UserAddInfo(array(), array("@TOPIC_ID" => implode(",", $arTopicNeeded), "AUTHOR_ID" => $arParams["UID"]), false, false, false);
if ($db_res && ($res = $db_res->GetNext())) {
do {
$arTopics[$res["TOPIC_ID"]] = $res;
} while ($res = $db_res->GetNext());
}
}
foreach ($topics as $topic_id => $res) {
$forum_id = intval($arTopics[$topic_id]["FORUM_ID"]);
if (!array_key_exists($forum_id, $forums)) {
$UserPermStr = "";
$UserPermCode = "";
$UserPerm = CForumNew::GetUserPermission($forum_id, $arResult["USER"]["GROUPS"]);
list($UserPermCode, $UserPermStr) = ForumGetUserForumStatus($arParams["UID"], $UserPerm, $arResult["USER"]["RANK"]);
$forums[$forum_id] = array_merge($arResult["FORUMS_ALL"][$forum_id], array("NUM_POSTS_ALL" => $arForum_posts[$forum_id], "PERMISSION" => $UserPerm, "USER_PERM" => $UserPerm, "AUTHOR_STATUS" => $UserPermStr, "USER_PERM_STR" => $UserPermStr, "AUTHOR_STATUS_CODE" => $UserPermCode, "TOPICS" => array()));
}
$arTopics[$topic_id]["TITLE"] = $arResult["PARSER"]->wrap_long_words($arTopics[$topic_id]["TITLE"]);
$arTopics[$topic_id]["DESCRIPTION"] = $arResult["PARSER"]->wrap_long_words($arTopics[$topic_id]["DESCRIPTION"]);
$arTopics[$topic_id]["URL"] = array("TOPIC" => CComponentEngine::MakePathFromTemplate($arParams["URL_TEMPLATES_READ"], array("FID" => $arTopics[$topic_id]["FORUM_ID"], "TID" => $arTopics[$topic_id]["TOPIC_ID"], "TITLE_SEO" => $arTopics[$topic_id]["TOPIC_ID"], "MID" => "s")), "~TOPIC" => CComponentEngine::MakePathFromTemplate($arParams["~URL_TEMPLATES_READ"], array("FID" => $arTopics[$topic_id]["FORUM_ID"], "TID" => $arTopics[$topic_id]["TOPIC_ID"], "TITLE_SEO" => $arTopics[$topic_id]["TOPIC_ID"], "MID" => "s")));
/************** For custom templates *******************************/
$arTopics[$topic_id]["read"] = $arTopics[$topic_id]["URL"]["TOPIC"];
/************** For custom templates *******************************/
$forums[$forum_id]["TOPICS"][$topic_id] = $topics[$topic_id] = array_merge($arTopics[$topic_id], $res);
}
/*******************************************************************/
/************** Urls ***********************************************/
foreach ($arResult["MESSAGE_LIST"] as $iID => $res) {
$topic = $arTopics[$topic_id];
示例5: SortingEx
$arResult["SortingEx"]["NUM_POSTS"] = SortingEx("NUM_POSTS", $APPLICATION->GetCurPageParam());
$arResult["SortingEx"]["POINTS"] = SortingEx("POINTS", $APPLICATION->GetCurPageParam());
$arResult["SortingEx"]["DATE_REGISTER"] = SortingEx("DATE_REGISTER", $APPLICATION->GetCurPageParam());
$arResult["SortingEx"]["LAST_VISIT"] = SortingEx("LAST_VISIT", $APPLICATION->GetCurPageParam());
if ($res = $db_res->GetNext()) {
do {
$arUserGroup = array();
$UserPerm = array();
$res["AUTHOR_STATUS"] = "";
$res["AUTHOR_STATUS_CODE"] = "";
// geting max permisson of User from all forums
if ($arParams["SHOW_USER_STATUS"] == "Y") {
$arUserGroup = CUser::GetUserGroup($res["USER_ID"]);
sort($arUserGroup);
foreach ($arForums as $forum) {
$UserPerm[] = CForumNew::GetUserPermission($forum["ID"], $arUserGroup);
}
rsort($UserPerm);
list($res["AUTHOR_STATUS_CODE"], $res["AUTHOR_STATUS"]) = ForumGetUserForumStatus($res["USER_ID"], $UserPerm[0]);
}
$res["UserStatus"] = $res["AUTHOR_STATUS"];
$res["URL"] = array("AUTHOR" => CComponentEngine::MakePathFromTemplate($arParams["URL_TEMPLATES_PROFILE_VIEW"], array("UID" => $res["USER_ID"])), "~AUTHOR" => CComponentEngine::MakePathFromTemplate($arParams["~URL_TEMPLATES_PROFILE_VIEW"], array("UID" => $res["USER_ID"])), "POSTS" => CComponentEngine::MakePathFromTemplate($arParams["URL_TEMPLATES_USER_POST"], array("UID" => $res["USER_ID"], "mode" => "all")), "~POSTS" => CComponentEngine::MakePathFromTemplate($arParams["~URL_TEMPLATES_USER_POST"], array("UID" => $res["USER_ID"], "mode" => "all")));
$res["profile_view"] = $res["URL"]["AUTHOR"];
$res["user_post"] = $res["URL"]["POSTS"];
$res["pm_edit"] = CComponentEngine::MakePathFromTemplate($arParams["URL_TEMPLATES_PM_EDIT"], array("FID" => 0, "MID" => 0, "mode" => "new", "UID" => $res["USER_ID"]));
$res["mail"] = CComponentEngine::MakePathFromTemplate($arParams["URL_TEMPLATES_MESSAGE_SEND"], array("TYPE" => "mail", "UID" => $res["USER_ID"]));
$res["DATE_REG"] = !empty($res["DATE_REGISTER_SHORT"]) ? CForumFormat::DateFormat($arParams["DATE_FORMAT"], MakeTimeStamp($res["DATE_REGISTER_SHORT"], CSite::GetDateFormat())) : "";
$res["LAST_VISIT"] = !empty($res["LAST_VISIT"]) ? CForumFormat::DateFormat($arParams["DATE_TIME_FORMAT"], MakeTimeStamp($res["LAST_VISIT"], CSite::GetDateFormat())) : "";
$res["icq"] = CComponentEngine::MakePathFromTemplate($arParams["URL_TEMPLATES_MESSAGE_SEND"], array("TYPE" => "icq", "UID" => $res["USER_ID"]));
if (strLen($res["AVATAR"]) > 0) {
$res["~AVATAR"] = array("ID" => $res["AVATAR"], "FILE" => CFile::GetFileArray($res["AVATAR"]));
示例6: CanUserAddSubscribe
public static function CanUserAddSubscribe($FID, $arUserGroups)
{
if (CForumNew::GetUserPermission($FID, $arUserGroups) >= "E") {
return True;
}
return False;
}
示例7: GetFirstUnreadEx
function GetFirstUnreadEx($FID, $TID, $arUserGroups)
{
$FID = intVal($FID);
$TID = intVal($TID);
if ($FID <= 0) {
return false;
}
$f_PERMISSION = CForumNew::GetUserPermission($FID, $arUserGroups);
return CForumMessage::GetFirstUnread($FID, $TID, $f_PERMISSION);
}
示例8: intVal
} else {
// TODO: this old code section to be removed in next versions.
$forumId = COption::GetOptionString('tasks', 'task_forum_id', -1);
if ($forumId !== -1 && (int) $arResult['FORUM']['ID'] === (int) $forumId) {
$tasksIsTasksJurisdiction = true;
}
}
if ($tasksIsTasksJurisdiction) {
$arParams['PERMISSION'] = 'D';
if (CTasks::CanCurrentUserViewTopic($arResult['TOPIC']['ID'])) {
$arParams['PERMISSION'] = 'M';
}
}
}
if (empty($arParams["PERMISSION"])) {
$arParams["PERMISSION"] = CForumNew::GetUserPermission($arResult["MESSAGE"]["FORUM_ID"], $USER->GetUserGroupArray());
if ($arParams["PERMISSION"] < "E" && (intVal($arResult["TOPIC"]["SOCNET_GROUP_ID"]) > 0 || intVal($arResult["TOPIC"]["OWNER_ID"]) > 0) && CModule::IncludeModule("socialnetwork")) {
$sPermission = $arParams["PERMISSION"];
$user_id = $USER->GetID();
$group_id = intVal($arResult["TOPIC"]["SOCNET_GROUP_ID"]);
$owner_id = intVal($arResult["TOPIC"]["OWNER_ID"]);
if ($group_id) {
$arSonetGroup = CSocNetGroup::GetByID($group_id);
if ($arSonetGroup) {
$site_id_tmp = $arSonetGroup["SITE_ID"];
} else {
$site_id_tmp = false;
}
$bIsCurrentUserModuleAdmin = CSocNetUser::IsCurrentUserModuleAdmin($site_id_tmp);
if (CSocNetFeaturesPerms::CanPerformOperation($user_id, SONET_ENTITY_GROUP, $group_id, "forum", "full", $bIsCurrentUserModuleAdmin)) {
$arParams["PERMISSION"] = "Y";
示例9: SetLabelsBeRead
function SetLabelsBeRead($ID, $arUserGroups)
{
$ID = intVal($ID);
$_SESSION["read_forum_" . $ID] = "0";
$strPerms = CForumNew::GetUserPermission($ID, $arUserGroups);
$iCurFirstReadForum = 0;
if ($strPerms > "Q") {
$db_res = CForumMessage::GetList(array("ID" => "DESC"), array("FORUM_ID" => $ID, "APPROVED" => "N"), false, 1);
if ($db_res && ($res = $db_res->Fetch())) {
$iCurFirstReadForum = intVal($res["ID"]);
}
}
$res = CForumNew::GetByID($ID);
$iCurFirstReadForum = intVal($res["LAST_MESSAGE_ID"]);
$_SESSION["first_read_forum_" . $ID] = $iCurFirstReadForum;
$arForumCookie = array();
$read_forum_cookie = COption::GetOptionString("main", "cookie_name", "BITRIX_SM") . "_FORUM_0";
if (isset($_COOKIE[$read_forum_cookie]) && strlen($_COOKIE[$read_forum_cookie]) > 0) {
$arForumCookie = explode("/", $_COOKIE[$read_forum_cookie]);
}
$i = 0;
$arCookieVal = array();
while ($i < count($arForumCookie)) {
if (intVal($arForumCookie[$i]) != $ID) {
$arCookieVal[] = intVal($arForumCookie[$i]) . "/" . intVal($arForumCookie[$i + 1]);
}
$i += 2;
}
$arCookieVal[] = $ID . "/" . $iCurFirstReadForum;
$_COOKIE[$read_forum_cookie] = implode("/", $arCookieVal);
// $GLOBALS["APPLICATION"]->set_cookie($read_forum_cookie, $strCookieVal, false, "/", false, false, "Y", "");
$GLOBALS["APPLICATION"]->set_cookie("FORUM_0", implode("/", $arCookieVal), false, "/", false, false, "Y", false);
return true;
}
示例10: ForumAddMessage
function ForumAddMessage($MESSAGE_TYPE, $FID, $TID, $MID, $arFieldsG, &$strErrorMessage, &$strOKMessage, $iFileSize = false, $captcha_word = "", $captcha_sid = 0, $captcha_code = "")
{
global $USER, $DB, $APPLICATION;
$APPLICATION->ResetException();
$aMsg = array();
$bUpdateTopic = False;
$bAddEditNote = $MESSAGE_TYPE == "EDIT";
$arParams = array("PERMISSION" => false);
$arUserGroups = $USER->GetUserGroupArray();
// ************ External Permission *********************************
if (!empty($arFieldsG["PERMISSION_EXTERNAL"])) {
$arParams["PERMISSION"] = CForumNew::GetUserPermission($FID, $arUserGroups);
$arParams["PERMISSION"] = $arParams["PERMISSION"] < "Q" ? $arFieldsG["PERMISSION_EXTERNAL"] : $arParams["PERMISSION"];
unset($arFieldsG["PERMISSION_EXTERNAL"]);
} elseif (!empty($arFieldsG["SONET_PERMS"])) {
$arParams["PERMISSION"] = CForumNew::GetUserPermission($FID, $arUserGroups);
if ($arParams["PERMISSION"] < "Q") {
if ($arFieldsG["SONET_PERMS"]["bCanFull"] === true) {
$arParams["PERMISSION"] = "Y";
} elseif ($arFieldsG["SONET_PERMS"]["bCanNew"] === true) {
$arParams["PERMISSION"] = "M";
} elseif ($arFieldsG["SONET_PERMS"]["bCanWrite"] === true) {
$arParams["PERMISSION"] = "I";
} else {
$arParams["PERMISSION"] = "A";
}
}
unset($arFieldsG["SONET_PERMS"]);
}
$DB->StartTransaction();
if (!in_array($MESSAGE_TYPE, array("NEW", "EDIT", "REPLY"))) {
$aMsg[] = array("id" => "MESSAGE_TYPE", "text" => GetMessage("ADDMES_NO_TYPE") . ".");
}
$MID = intval($MID);
$TID = intval($TID);
$FID = intval($FID);
$arFieldsG["EDIT_ADD_REASON"] = $arFieldsG["EDIT_ADD_REASON"] == "Y" ? "Y" : "N";
if ($MID > 0) {
$arMessage = CForumMessage::GetByID($MID, array("FILTER" => "N"));
if ($arMessage) {
$TID = IntVal($arMessage["TOPIC_ID"]);
$FID = IntVal($arMessage["FORUM_ID"]);
}
}
$arTopic = array();
if ($TID > 0) {
$arTopic = CForumTopic::GetByID($TID);
if ($arTopic) {
$FID = IntVal($arTopic["FORUM_ID"]);
}
}
$arForum = CForumNew::GetByID($FID);
//************************* Input params **************************************************************************
if ($MESSAGE_TYPE == "NEW" && !CForumTopic::CanUserAddTopic($FID, $arUserGroups, $USER->GetID(), $arForum, $arParams["PERMISSION"])) {
$aMsg[] = array("id" => "PERMISSION", "text" => GetMessage("ADDMESS_NO_PERMS2NEW") . ".");
} elseif ($MESSAGE_TYPE == "EDIT" && !CForumMessage::CanUserUpdateMessage($MID, $arUserGroups, $USER->GetID(), $arParams["PERMISSION"])) {
$aMsg[] = array("id" => "PERMISSION", "text" => GetMessage("ADDMESS_NO_PERMS2EDIT") . ".");
} elseif ($MESSAGE_TYPE == "REPLY" && !CForumMessage::CanUserAddMessage($TID, $arUserGroups, $USER->GetID(), $arParams["PERMISSION"])) {
$aMsg[] = array("id" => "PERMISSION", "text" => GetMessage("ADDMESS_NO_PERMS2REPLY") . ".");
}
if ($MESSAGE_TYPE == "NEW" || $MESSAGE_TYPE == "EDIT" && array_intersect_key($arFieldsG, array("TITLE" => "", "DESCRIPTION" => "", "ICON" => "", "TAGS" => "", "OWNER_ID" => "", "SOCNET_GROUP_ID" => "")) && CForumTopic::CanUserUpdateTopic($TID, $arUserGroups, $USER->GetID(), $arParams["PERMISSION"])) {
$bUpdateTopic = True;
}
if ($MESSAGE_TYPE == "EDIT" && (ForumCurrUserPermissions($FID, $arParams) > "Q" && $arFieldsG["EDIT_ADD_REASON"] == "N")) {
$bAddEditNote = false;
}
//*************************!CAPTCHA********************************************************************************
if (!$USER->IsAuthorized() && $arForum["USE_CAPTCHA"] == "Y") {
include_once $_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/main/classes/general/captcha.php";
$cpt = new CCaptcha();
if (strlen($captcha_code) > 0) {
$captchaPass = COption::GetOptionString("main", "captcha_password", "");
if (!$cpt->CheckCodeCrypt($captcha_word, $captcha_code, $captchaPass)) {
$aMsg[] = array("id" => "CAPTCHA", "text" => GetMessage("FORUM_POSTM_CAPTCHA") . ".");
}
} else {
if (!$cpt->CheckCode($captcha_word, $captcha_sid)) {
$aMsg[] = array("id" => "CAPTCHA", "text" => GetMessage("FORUM_POSTM_CAPTCHA") . ".");
}
}
}
//*************************!CAPTCHA********************************************************************************
$arFieldsG["POST_MESSAGE"] = trim($arFieldsG["POST_MESSAGE"]);
if (empty($arFieldsG["POST_MESSAGE"])) {
$aMsg[] = array("id" => "POST_MESSAGE", "text" => GetMessage("ADDMESS_INPUT_MESSAGE") . ".");
}
if ($bUpdateTopic && is_set($arFieldsG, "TITLE")) {
$arFieldsG["TITLE"] = trim($arFieldsG["TITLE"]);
if (empty($arFieldsG["TITLE"])) {
$aMsg[] = array("id" => "TITLE", "text" => GetMessage("ADDMESS_INPUT_TITLE") . ".");
}
}
//*************************!QUOTA**********************************************************************************
/* if (empty($aMsg))
{
$quota = new CDiskQuota();
if ($MESSAGE_TYPE=="EDIT")
{
if (!$quota->checkDiskQuota(strLen($arFieldsG["POST_MESSAGE"]) - strLen($arMessage["POST_MESSAGE"])))
{
//.........这里部分代码省略.........
示例11: SetReadLabels
function SetReadLabels($ID, $arUserGroups)
{
$ID = intVal($ID);
$arTopic = CForumTopic::GetByID($ID);
if ($arTopic) {
$FID = intVal($arTopic["FORUM_ID"]);
if (is_null($_SESSION["read_forum_" . $FID]) || strLen($_SESSION["read_forum_" . $FID]) <= 0) {
$_SESSION["read_forum_" . $FID] = "0";
}
$_SESSION["first_read_forum_" . $FID] = intVal($_SESSION["first_read_forum_" . $FID]);
$arFilter = array("FORUM_ID" => $FID, "TOPIC_ID" => $ID);
if (intVal($_SESSION["first_read_forum_" . $FID]) > 0) {
$arFilter[">ID"] = intVal($_SESSION["first_read_forum_" . $FID]);
}
if ($_SESSION["read_forum_" . $FID] != "0") {
$arFilter["!@ID"] = $_SESSION["read_forum_" . $FID];
}
if (CForumNew::GetUserPermission($FID, $arUserGroups) < "Q") {
$arFilter["APPROVED"] = "Y";
}
$db_res = CForumMessage::GetList(array(), $arFilter);
if ($db_res) {
while ($ar_res = $db_res->Fetch()) {
$_SESSION["read_forum_" . $FID] .= "," . intVal($ar_res["ID"]);
}
}
CForumTopic::Update($ID, array("=VIEWS" => "VIEWS+1"));
}
}
示例12: GetFirstUnreadEx
public static function GetFirstUnreadEx($FID, $TID, $arUserGroups) // out-of-date function
{
$FID = intVal($FID);
$TID = intVal($TID);
if ($FID<=0) return false;
$f_PERMISSION = CForumNew::GetUserPermission($FID, $arUserGroups);
return CForumMessage::GetFirstUnread($FID, $TID, $f_PERMISSION);
}
示例13: strToUpper
$arParams["~URL_TEMPLATES_" . strToUpper($URL)] = $arParams["URL_TEMPLATES_" . strToUpper($URL)];
$arParams["URL_TEMPLATES_" . strToUpper($URL)] = htmlspecialcharsbx($arParams["~URL_TEMPLATES_" . strToUpper($URL)]);
}
// ************************* ADDITIONAL ****************************************************************
$arParams["TOPICS_COUNT"] = intVal($arParams["TOPICS_COUNT"]) > 0 ? intVal($arParams["TOPICS_COUNT"]) : 6;
$arParams["DATE_FORMAT"] = trim(empty($arParams["DATE_FORMAT"]) ? $DB->DateFormatToPHP(CSite::GetDateFormat("SHORT")) : $arParams["DATE_FORMAT"]);
$arParams["DATE_TIME_FORMAT"] = trim(empty($arParams["DATE_TIME_FORMAT"]) ? $DB->DateFormatToPHP(CSite::GetDateFormat("FULL")) : $arParams["DATE_TIME_FORMAT"]);
// *************************/Input params***************************************************************
//************** SocNet Activity ***********************************/
if ($arParams["MODE"] == "GROUP" && !CSocNetFeatures::IsActiveFeature(SONET_ENTITY_GROUP, $arParams["SOCNET_GROUP_ID"], "forum") || $arParams["MODE"] != "GROUP" && !CSocNetFeatures::IsActiveFeature(SONET_ENTITY_USER, $arParams["USER_ID"], "forum")) {
ShowError(GetMessage("FORUM_SONET_MODULE_NOT_AVAIBLE"));
return false;
}
//************** Forum *********************************************/
$arResult["FORUM"] = CForumNew::GetByID($arParams["FID"]);
$arParams["PERMISSION"] = CForumNew::GetUserPermission($arParams["FID"], $USER->GetUserGroupArray());
if (!$arResult["FORUM"] || count($arResult["FORUM"]) <= 0) {
ShowError("Bad Forum");
return false;
}
//************** Permission ****************************************/
if ($arParams["PERMISSION"] < "Y") {
$bCurrentUserIsAdmin = CSocNetUser::IsCurrentUserModuleAdmin();
$sPermission = $arParams["PERMISSION"];
$arParams["PERMISSION"] = "A";
$user_id = $USER->GetID();
if ($arParams["MODE"] == "GROUP") {
if (CSocNetFeaturesPerms::CanPerformOperation($user_id, SONET_ENTITY_GROUP, $arParams["SOCNET_GROUP_ID"], "forum", "full", $bCurrentUserIsAdmin)) {
$arParams["PERMISSION"] = "Y";
} elseif (CSocNetFeaturesPerms::CanPerformOperation($user_id, SONET_ENTITY_GROUP, $arParams["SOCNET_GROUP_ID"], "forum", "newtopic", $bCurrentUserIsAdmin)) {
$arParams["PERMISSION"] = "M";
示例14: while
</td>
</tr>
</table>
<font style="font-size:4px;"> <br></font>
<form name="FORUM_MESSAGES" id="FORUM_MESSAGES">
<table width="100%" border="0" cellspacing="0" cellpadding="5">
<?php
while ($arMessage = $db_Message->Fetch()) {
$arUser = array();
//*************************!***************************************************************************************
if ($arMessage["AUTHOR_ID"] > 0 && !isset($UserInfo[$arMessage["AUTHOR_ID"]])) {
$arUser["Groups"] = CUser::GetUserGroup($arMessage["AUTHOR_ID"]);
if (!in_array(2, $arUser["Groups"])) {
$arUser["Groups"][] = 2;
}
$arUser["Perms"] = CForumNew::GetUserPermission($arMessage["FORUM_ID"], $arUser["Groups"]);
if ($arUser["Perms"] <= "Q" && COption::GetOptionString("forum", "SHOW_VOTES", "Y") == "Y") {
$arUser["Rank"] = CForumUser::GetUserRank($arMessage["AUTHOR_ID"], LANGUAGE_ID);
}
if (intVal($arMessage["POINTS"]) > 0) {
$arUser["Points"] = array("POINTS" => $arMessage["POINTS"], "DATE_UPDATE" => $arMessage["DATE_UPDATE"]);
} else {
$arUser["Points"] = false;
}
$UserInfo[$arMessage["AUTHOR_ID"]] = $arUser;
} elseif ($arMessage["AUTHOR_ID"] > 0 && isset($UserInfo[$arMessage["AUTHOR_ID"]])) {
$arUser = $UserInfo[$arMessage["AUTHOR_ID"]];
}
$arMessage["AUTHOR_ID"] = intVal($arMessage["AUTHOR_ID"]);
$arMessage["FOR_JS"]["AUTHOR_NAME"] = Cutil::JSEscape(htmlspecialchars($arMessage["AUTHOR_NAME"]));
$arMessage["FOR_JS"]["POST_MESSAGE"] = Cutil::JSEscape(htmlspecialchars($arMessage["POST_MESSAGE"]));
示例15: htmlspecialcharsEx
?>
<?php
if (ForumCurrUserPermissions($FID) >= "I" && $arTopic["STATE"] == "Y") {
echo "</a>";
}
?>
<?php
if (strlen($ar_Message["DESCRIPTION"]) > 0) {
echo "<br>" . htmlspecialcharsEx($ar_Message["DESCRIPTION"]);
}
?>
<?php
if (IntVal($ar_Message["AUTHOR_ID"]) > 0) {
$arMessageUserGroups = CUser::GetUserGroup($ar_Message["AUTHOR_ID"]);
$arMessageUserGroups[] = 2;
$strMessageUserPerms = CForumNew::GetUserPermission($FID, $arMessageUserGroups);
if ($strMessageUserPerms == "Q") {
echo "<br><b>Модератор</b>";
} elseif ($strMessageUserPerms == "U") {
echo "<br><b>Редактор</b>";
} elseif ($strMessageUserPerms == "Y") {
echo "<br><b>Администратор</b>";
} elseif (IntVal($ar_Message["RANK_ID"]) > 0) {
$arRank = CForumRank::GetLangByID($ar_Message["RANK_ID"], LANGUAGE_ID);
echo "<br>" . $arRank["NAME"];
}
} else {
echo "<br><i>Гость</i>";
}
?>
<br>