/// <summary> /// 发主题是否需要审核 /// </summary> /// <param name="forum">主题所在的版块</param> /// <param name="useradminid">用户的管理组ID</param> /// <param name="userid">用户ID</param> /// <param name="userGroup">当前用户的用户组</param> /// <returns>true需要审核;false不需要审核</returns> public static bool NeedAudit(ForumInfo forum, int useradminid, int userid, UserGroupInfo userGroup) { if (useradminid == 1 || Moderators.IsModer(useradminid, userid, forum.Fid)) { return(false); } if (Scoresets.BetweenTime(GeneralConfigs.GetConfig().Postmodperiods) || forum.Modnewtopics == 1 || userGroup.ModNewTopics == 1) { return(true); } return(false); }
/// <summary> /// 获取指定用户组和版信息下主题的DisplayOrder /// </summary> /// <param name="usergroupinfo">用户组信息</param> /// <param name="useradminid">管理组ID</param> /// <param name="forum">当前版块</param> /// <param name="topicInfo">当前主题信息</param> /// <param name="message">帖子内容</param> /// <param name="disablepost">是否受灌水限制 1,不受限制;0,受限制</param> /// <returns>0:正常显示;-2:待审核</returns> public static int GetTitleDisplayOrder(UserGroupInfo usergroupinfo, int useradminid, ForumInfo forum, TopicInfo topicInfo, string message, int disablepost) { if (useradminid == 1 || Moderators.IsModer(useradminid, topicInfo.Posterid, forum.Fid)) { return(topicInfo.Displayorder); } if (forum.Modnewtopics == 1 || usergroupinfo.ModNewTopics == 1 || Scoresets.BetweenTime(GeneralConfigs.GetConfig().Postmodperiods) && disablepost != 1 || ForumUtils.HasAuditWord(topicInfo.Title) || ForumUtils.HasAuditWord(message)) { return(-2); } return(topicInfo.Displayorder); }
/// <summary> /// 发回复是否需要审核 /// </summary> /// <param name="forum">主题所在的版块</param> /// <param name="useradminid">用户的管理组ID</param> ///<param name="topicInfo">所回复的主题信息</param> /// <param name="userid">用户ID</param> /// <param name="disablepost">是否受灌水限制</param> /// <returns>true需要审核;false不需要审核</returns> public static bool NeedAudit(ForumInfo forum, int useradminid, TopicInfo topicInfo, int userid, int disablepost, UserGroupInfo userGroup) { if (useradminid == 1 || Moderators.IsModer(useradminid, userid, forum.Fid)) { return(false); } if (Scoresets.BetweenTime(GeneralConfigs.GetConfig().Postmodperiods)) { return(true); } if (forum.Modnewposts == 1 || userGroup.ModNewPosts == 1) { return(true); } else if (topicInfo.Displayorder == -2) { return(true); } return(false); //bool needaudit = false; //是否需要审核 //if (Scoresets.BetweenTime(GeneralConfigs.GetConfig().Postmodperiods)) //{ // needaudit = true; //} //else //{ // if (forum.Modnewposts == 1 && useradminid != 1) // { // if (useradminid > 1) // { // if (disablepost == 1 && topicInfo.Displayorder != -2) // { // if (useradminid == 3 && !Moderators.IsModer(useradminid, userid, forum.Fid)) // needaudit = true; // } // else // needaudit = true; // } // else // needaudit = true; // } // else if (userGroup.ModNewPosts == 1 && !Moderators.IsModer(useradminid, userid, forum.Fid) && useradminid != 1) // needaudit = true; // else if (useradminid != 1 && topicInfo.Displayorder == -2) // needaudit = true; //} //return needaudit; }
/// <summary> /// 校验用户是否可以访问论坛 /// </summary> /// <returns></returns> private bool ValidateUserPermission() { if (onlineusercount >= config.Maxonlines && useradminid != 1 && pagename != "login.aspx" && pagename != "logout.aspx") { ShowMessage("抱歉,目前访问人数太多,你暂时无法访问论坛.", 0); return(false); } if (usergroupinfo.Allowvisit != 1 && useradminid != 1 && pagename != "login.aspx" && pagename != "register.aspx" && pagename != "logout.aspx" && pagename != "activationuser.aspx" && pagename != "getpassword.aspx") { ShowMessage("抱歉, 您所在的用户组不允许访问论坛", 2); return(false); } // 如果IP访问列表有设置则进行判断 if (config.Ipaccess.Trim() != "") { string[] regctrl = Utils.SplitString(config.Ipaccess, "\n"); if (!Utils.InIPArray(DNTRequest.GetIP(), regctrl)) { ShowMessage("抱歉, 系统设置了IP访问列表限制, 您无法访问本论坛", 0); return(false); } } // 如果IP访问列表有设置则进行判断 if (config.Ipdenyaccess.Trim() != "") { string[] regctrl = Utils.SplitString(config.Ipdenyaccess, "\n"); if (Utils.InIPArray(DNTRequest.GetIP(), regctrl)) { ShowMessage("由于您严重违反了论坛的相关规定, 已被禁止访问.", 2); return(false); } } // 如果当前用户请求页面不是登录页面并且当前用户非管理员并且论坛设定了时间段,当时间在其中的一个时间段内,则跳转到论坛登录页面 if (useradminid != 1 && pagename != "login.aspx" && pagename != "logout.aspx" && usergroupinfo.Disableperiodctrl != 1) { if (Scoresets.BetweenTime(config.Visitbanperiods)) { ShowMessage("在此时间段内不允许访问本论坛", 2); return(false); } } return(true); }
/// <summary> /// 搜索权限判断 /// </summary> /// <param name="userid"></param> /// <param name="lastsearchtime"></param> /// <param name="useradminid"></param> /// <param name="usergroupinfo"></param> /// <param name="msg"></param> /// <returns></returns> public static bool Search(int userid, string lastsearchtime, int useradminid, UserGroupInfo usergroupinfo, ref string msg) { // 如果当前用户非管理员并且论坛设定了禁止全文搜索时间段,当前时间如果在其中的一个时间段内,不允许全文搜索 if (useradminid != 1 && DNTRequest.GetInt("keywordtype", 0) == 1 && usergroupinfo.Disableperiodctrl != 1) { string visittime = ""; if (Scoresets.BetweenTime(GeneralConfigs.GetConfig().Searchbanperiods, out visittime)) { msg = "在此时间段( " + visittime + " )内用户不可以进行全文搜索"; return(false); } } if (useradminid != 1) { //判断一分钟内搜索的次数是不是超过限制值 if (!Statistics.CheckSearchCount(GeneralConfigs.GetConfig().Maxspm)) { msg = "抱歉,系统在一分钟内搜索的次数超过了系统安全设置的上限,请稍候再试"; return(false); } int Interval = Utils.StrDateDiffSeconds(lastsearchtime, GeneralConfigs.GetConfig().Searchctrl); if (Interval <= 0) { msg = "系统规定搜索间隔为" + GeneralConfigs.GetConfig().Searchctrl + "秒, 您还需要等待 " + (Interval * -1) + " 秒"; return(false); } //不是管理员,则如果设置搜索扣积分时扣除用户积分 if (UserCredits.UpdateUserCreditsBySearch(userid) == -1) { string addExtCreditsTip = ""; if (EPayments.IsOpenEPayments()) { addExtCreditsTip = "<br/><span><a href=\"usercpcreditspay.aspx\">点击充值积分</a></span>"; } msg = "您的积分不足, 不能执行搜索操作" + addExtCreditsTip; return(false); } } return(true); }
public static bool CheckPostTimeSpan(UserGroupInfo userGroupInfo, AdminGroupInfo admininfo, OnlineUserInfo olUserInfo, ShortUserInfo shortUserInfo, ref string msg) { // 如果当前用户非管理员并且论坛设定了禁止发帖时间段,当前时间如果在其中的一个时间段内,不允许用户发帖 if (olUserInfo.Adminid != 1 && userGroupInfo.Disableperiodctrl != 1) { string visittime = ""; if (Scoresets.BetweenTime(GeneralConfigs.GetConfig().Postbanperiods, out visittime)) { msg = "在此时间段( " + visittime + " )内用户不可以发帖"; return(false); } } if (admininfo == null || admininfo.Disablepostctrl != 1) { int Interval = Utils.StrDateDiffSeconds(olUserInfo.Lastposttime, GeneralConfigs.GetConfig().Postinterval); if (Interval < 0) { msg = "系统规定发帖间隔为" + GeneralConfigs.GetConfig().Postinterval.ToString() + "秒, 您还需要等待 " + (Interval * -1).ToString() + " 秒"; return(false); } else if (olUserInfo.Userid != -1) { //ShortUserInfo shortUserInfo = Discuz.Data.Users.GetShortUserInfo(olUserInfo.Userid); string joindate = (shortUserInfo != null) ? shortUserInfo.Joindate : ""; if (joindate == "") { msg = "您的用户资料出现错误"; return(false); } Interval = Utils.StrDateDiffMinutes(joindate, GeneralConfigs.GetConfig().Newbiespan); if (Interval < 0) { msg = "系统规定新注册用户必须要在" + GeneralConfigs.GetConfig().Newbiespan.ToString() + "分钟后才可以发帖, 您还需要等待 " + (Interval * -1).ToString() + " 分钟"; return(false); } } } return(true); }
/// <summary> /// 获取主题帖是否可见信息 /// </summary> /// <param name="forum">版块信息</param> /// <param name="useradminid">当前用户adminid</param> /// <param name="uid">当前用户id</param> /// <param name="userGroup">当前用户组信息</param> /// <param name="postinfo">帖子信息</param> /// <returns>0显示;1隐藏</returns> public static int GetTopicPostInvisible(ForumInfo forum, int useradminid, int uid, UserGroupInfo userGroup, PostInfo postinfo) { if (useradminid == 1 || Moderators.IsModer(useradminid, uid, forum.Fid)) { return(0); } if (!ForumUtils.HasAuditWord(postinfo.Message) && forum.Modnewtopics == 0 && userGroup.ModNewTopics == 0 && !Scoresets.BetweenTime(GeneralConfigs.GetConfig().Postmodperiods)) { return(0); } return(1); }