当前位置: 首页>>代码示例>>PHP>>正文


PHP CForumMessage::CanUserUpdateMessage方法代码示例

本文整理汇总了PHP中CForumMessage::CanUserUpdateMessage方法的典型用法代码示例。如果您正苦于以下问题:PHP CForumMessage::CanUserUpdateMessage方法的具体用法?PHP CForumMessage::CanUserUpdateMessage怎么用?PHP CForumMessage::CanUserUpdateMessage使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CForumMessage的用法示例。


在下文中一共展示了CForumMessage::CanUserUpdateMessage方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: while

                        if (is_set($arResult["~QUESTIONS"], $res["QUESTION_ID"])) {
                            $arResult["~QUESTIONS"][$res["QUESTION_ID"]]["ANSWERS"][$res["ID"]] = $res;
                        }
                    } while ($res = $db_res->Fetch());
                }
            }
            $arResult["QUESTIONS"] = $arResult["~QUESTIONS"];
        }
    } else {
        $arError[] = array("id" => "mid_is_lost", "text" => GetMessage("F_MID_IS_LOST"));
    }
}
/************** Permission *****************************************/
if ($arParams["MESSAGE_TYPE"] == "NEW" && !CForumTopic::CanUserAddTopic($arParams["FID"], $USER->GetUserGroupArray(), $USER->GetID(), false, $arParams["PERMISSION"])) {
    $arError[] = array("id" => "acces denied", "text" => GetMessage("F_NO_NPERMS"));
} elseif ($arParams["MESSAGE_TYPE"] == "EDIT" && !CForumMessage::CanUserUpdateMessage($arParams["MID"], $USER->GetUserGroupArray(), $USER->GetID(), $arParams["PERMISSION"])) {
    $arError[] = array("id" => "acces denied", "text" => GetMessage("F_NO_EPERMS"));
}
/************** Fatal Errors ***************************************/
if (!empty($arError)) {
    $e = new CAdminException($arError);
    $res = $e->GetString();
    ShowError($res);
    return false;
}
/*******************************************************************/
$strErrorMessage = "";
$strOKMessage = "";
$bVarsFromForm = false;
$arResult["VIEW"] = strToUpper($_REQUEST["MESSAGE_MODE"]) == "VIEW" && $_SERVER["REQUEST_METHOD"] == "POST" ? "Y" : "N";
$_REQUEST["FILES"] = is_array($_REQUEST["FILES"]) ? $_REQUEST["FILES"] : array();
开发者ID:k-kalashnikov,项目名称:geekcon_new,代码行数:31,代码来源:component.php

示例2: array

$arResult["ForumPrintSmilesList"] = "";
$arResult["TOPIC_FILTER"] = array();
$arResult["TOPIC"] = array();
$arResult["MESSAGE"] = array("AUTHOR_ID" => $USER->GetParam("USER_ID"), "USE_SMILES" => "Y", "AUTHOR_NAME" => $GLOBALS["FORUM_STATUS_NAME"]["guest"], "AUTHOR_EMAIL" => "", "POST_MESSAGE" => "", "EDITOR_NAME" => $GLOBALS["FORUM_STATUS_NAME"]["guest"], "EDITOR_EMAIL" => "quest@guest.com", "EDIT_REASON" => "", "FILES" => array());
$arResult["TOPIC"] = array("TITLE" => "", "TAGS" => "", "DESCRIPTION" => "", "ICON_ID" => "");
$arResult["QUESTIONS"] = array();
$arResult["~QUESTIONS"] = array();
$arResult['DATE_END'] = GetTime(time() + 30 * 86400);
/********************************************************************
				/Default params
********************************************************************/
$bShowForm = false;
if ($arParams["MESSAGE_TYPE"] == "REPLY" && $arParams["TID"] > 0) {
    $bShowForm = CForumMessage::CanUserAddMessage($arParams["TID"], $USER->GetUserGroupArray(), $USER->GetID());
} elseif ($arParams["MESSAGE_TYPE"] == "EDIT" && $arParams["MID"] > 0) {
    $bShowForm = CForumMessage::CanUserUpdateMessage($arParams["MID"], $USER->GetUserGroupArray(), intVal($USER->GetID()));
} elseif ($arParams["MESSAGE_TYPE"] == "NEW" && $arParams["FID"] > 0) {
    $bShowForm = CForumTopic::CanUserAddTopic($arParams["FID"], $USER->GetUserGroupArray(), $USER->GetID());
}
if (!$bShowForm) {
    return 0;
}
if ($arParams["SHOW_VOTE"] == "Y") {
    CModule::IncludeModule("vote");
    $permission = isset($arParams['PERMISSION']) && intval($arParams['PERMISSION'] > 0 || $arParams['PERMISSION'] === 0) ? intval($arParams['PERMISSION']) : CVoteChannel::GetGroupPermission($arParams["VOTE_CHANNEL_ID"]);
    if ($permission < 2) {
        $arParams["SHOW_VOTE"] = "N";
    }
    $res = array_intersect($USER->GetUserGroupArray(), $arParams["VOTE_GROUP_ID"]);
    $arParams["SHOW_VOTE"] = empty($res) ? "N" : $arParams["SHOW_VOTE"];
}
开发者ID:k-kalashnikov,项目名称:geekcon_new,代码行数:31,代码来源:component.php

示例3: LocalRedirect

         LocalRedirect("index.php");
         die;
     }
     $FID = IntVal($arMessage["FORUM_ID"]);
     $TID = IntVal($arMessage["TOPIC_ID"]);
 }
 $arForum = CForumNew::GetByID($FID);
 ForumSetLastVisit();
 if (!$arForum) {
     LocalRedirect("index.php");
     die;
 }
 if ($MESSAGE_TYPE == "NEW" && !CForumTopic::CanUserAddTopic($FID, $USER->GetUserGroupArray(), $USER->GetID())) {
     $APPLICATION->AuthForm(GetMessage("FNT_NO_NPERMS"));
 }
 if ($MESSAGE_TYPE == "EDIT" && !CForumMessage::CanUserUpdateMessage($MID, $USER->GetUserGroupArray(), IntVal($USER->GetID()))) {
     $APPLICATION->AuthForm(GetMessage("FNT_NO_EPERMS"));
 }
 if ($GLOBALS["SHOW_FORUM_DEBUG_INFO"]) {
     $arForumDebugInfo[] = "<br><font color=\"#FF0000\">Initializing Variables: " . Round(getmicrotime() - $prexectime, 3) . " sec</font>";
 }
 if ($GLOBALS["SHOW_FORUM_DEBUG_INFO"]) {
     $prexectime = getmicrotime();
 }
 $strErrorMessage = "";
 $strOKMessage = "";
 $bVarsFromForm = false;
 $View = false;
 if ($_POST["MESSAGE_MODE"] == "VIEW") {
     $View = true;
     $bVarsFromForm = true;
开发者ID:,项目名称:,代码行数:31,代码来源:

示例4: while

                                $arResult["~QUESTIONS"][$res["QUESTION_ID"]]["ANSWERS"][$res["ID"]] = $res;
                            }
                        } while ($res = $db_res->Fetch());
                    }
                }
                $arResult["QUESTIONS"] = $arResult["~QUESTIONS"];
            }
        }
    }
} else {
    $arResult["FORUM"] = CForumNew::GetByID($arParams["FID"]);
    if (empty($arResult["FORUM"])) {
        $arError = array("code" => "fid_is_lost", "title" => GetMessage("F_FID_IS_LOST"), "link" => $arResult["index"]);
    }
}
if (empty($arError) && ($arParams["MESSAGE_TYPE"] == "NEW" && !CForumTopic::CanUserAddTopic($arParams["FID"], $USER->GetUserGroupArray(), $USER->GetID())) || $arParams["MESSAGE_TYPE"] == "EDIT" && !CForumMessage::CanUserUpdateMessage($arParams["MID"], $USER->GetUserGroupArray(), $USER->GetID())) {
    $arError = array("code" => "rightsn_new", "title" => $arParams["MESSAGE_TYPE"] == "NEW" ? GetMessage("F_NO_NPERMS") : GetMessage("F_NO_EPERMS"), "link" => $arResult["index"]);
}
if (!empty($arError)) {
    if ($arParams["AJAX_CALL"] == "Y") {
        $res = array("error" => $arError, "note" => $arNote, "id" => $arParams["MID"], "post" => ShowError($arError["title"]));
        if ($_REQUEST["CONVERT_DATA"] == "Y") {
            array_walk($res, "htmlspecialcharsEx");
        }
        $APPLICATION->RestartBuffer();
        echo CUtil::PhpToJSObject($res);
        die;
    }
    ShowError($arError["title"]);
    return false;
}
开发者ID:Satariall,项目名称:izurit,代码行数:31,代码来源:component.php

示例5: ForumModerateMessage

function ForumModerateMessage($message, $TYPE, &$strErrorMessage, &$strOKMessage, $arAddParams = array())
{
    global $USER;
    $arError = array();
    $arOK = array();
    $arAddParams = !is_array($arAddParams) ? array($arAddParams) : $arAddParams;
    $arAddParams["PERMISSION"] = !empty($arAddParams["PERMISSION"]) ? $arAddParams["PERMISSION"] : false;
    $message = ForumDataToArray($message);
    if (empty($message)) {
        $arError[] = GetMessage("DELMES_NO_MESS") . ". \n";
    } else {
        $db_res = CForumMessage::GetList(array(), array("@ID" => implode(",", $message)));
        if ($db_res) {
            while ($arMessage = $db_res->Fetch()) {
                if (!(ForumCurrUserPermissions($arMessage["FORUM_ID"], $arAddParams) >= "Q" || CForumMessage::CanUserUpdateMessage($arMessage["ID"], $USER->GetUserGroupArray(), $USER->GetID(), $arAddParams["PERMISSION"]))) {
                    $arError[] = GetMessage("MODMESS_NO_PERMS") . " (MID=" . $arMessage["ID"] . "). \n";
                } else {
                    $arFields = array("APPROVED" => $TYPE == "SHOW" ? "Y" : "N");
                    $ID = CForumMessage::Update($arMessage["ID"], $arFields);
                    if ($ID > 0) {
                        $TID = $arMessage["TOPIC_ID"];
                        $arTopic = CForumTopic::GetByID($TID);
                        /***************** Events onMessageModerate ************************/
                        foreach (GetModuleEvents("forum", "onMessageModerate", true) as $arEvent) {
                            ExecuteModuleEventEx($arEvent, array($ID, $TYPE, $arMessage, $arTopic));
                        }
                        /***************** /Events *****************************************/
                        $res = array("ID" => $arMessage["ID"], "AUTHOR_NAME" => $arMessage["AUTHOR_NAME"], "POST_MESSAGE" => $arMessage["POST_MESSAGE"], "TITLE" => $arTopic["TITLE"], "TOPIC_ID" => $TID, "FORUM_ID" => $arMessage["FORUM_ID"]);
                        $res = serialize($res);
                        if ($TYPE == "SHOW") {
                            $arOK[] = GetMessage("MODMESS_SUCCESS_SHOW") . " (MID=" . $arMessage["ID"] . "). \n";
                            CForumMessage::SendMailMessage($arMessage["ID"], array(), false, "NEW_FORUM_MESSAGE");
                            CForumEventLog::Log("message", "approve", $arMessage["ID"], $res);
                        } else {
                            $arOK[] = GetMessage("MODMESS_SUCCESS_HIDE") . " (MID=" . $arMessage["ID"] . "). \n";
                            CForumMessage::SendMailMessage($arMessage["ID"], array(), false, "EDIT_FORUM_MESSAGE");
                            CForumEventLog::Log("message", "unapprove", $arMessage["ID"], $res);
                        }
                    } else {
                        $arError[] = GetMessage("MODMESS_ERROR_MODER") . " (MID=" . $arMessage["ID"] . "). \n";
                    }
                }
            }
        } else {
            $arError[] = GetMessage("DELMES_NO_MESS") . ". \n";
        }
    }
    $strErrorMessage .= implode("", $arError);
    $strOKMessage .= implode("", $arOK);
    if (count($arError) <= 0) {
        return true;
    } else {
        return false;
    }
}
开发者ID:DarneoStudio,项目名称:bitrix,代码行数:55,代码来源:include.php


注:本文中的CForumMessage::CanUserUpdateMessage方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。