Ejemplo n.º 1
0
        protected override void ShowPage()
        {
            pagetitle = "撰写短消息";

            if (userid == -1)
            {
                AddErrLine("你尚未登录");

                return;
            }
            user = Discuz.Forum.Users.GetUserInfo(userid);

            if (!CheckPermission())
            {
                return;
            }

            if (DNTRequest.IsPost())
            {
                if (!CheckPermissionAfterPost())
                {
                    return;
                }

                #region 创建并发送短消息

                PrivateMessageInfo pm = new PrivateMessageInfo();

                string curdatetime = Utils.GetDateTime();
                // 收件箱
                if (useradminid == 1)
                {
                    pm.Message = Utils.HtmlEncode(DNTRequest.GetString("message"));
                    pm.Subject = Utils.HtmlEncode(DNTRequest.GetString("subject"));
                }
                else
                {
                    pm.Message =
                        Utils.HtmlEncode(ForumUtils.BanWordFilter(DNTRequest.GetString("message")));
                    pm.Subject =
                        Utils.HtmlEncode(ForumUtils.BanWordFilter(DNTRequest.GetString("subject")));
                }

                if (ForumUtils.HasBannedWord(pm.Message) || ForumUtils.HasBannedWord(pm.Subject))
                {
                    //HasBannedWord 指定的字符串中是否含有禁止词汇

                    AddErrLine("对不起, 您提交的内容包含不良信息, 因此无法提交, 请返回修改!");
                    return;
                }


                if (ForumUtils.HasAuditWord(pm.Message) || ForumUtils.HasAuditWord(pm.Subject))
                {
                    AddErrLine("对不起, 您提交的内容包含不良信息, 因此无法提交, 请返回修改!");
                    return;
                }

                pm.Message = ForumUtils.BanWordFilter(pm.Message);
                pm.Subject = ForumUtils.BanWordFilter(pm.Subject);

                pm.Msgto        = DNTRequest.GetString("msgto");
                pm.Msgtoid      = msgtoid;
                pm.Msgfrom      = username;
                pm.Msgfromid    = userid;
                pm.New          = 1;
                pm.Postdatetime = curdatetime;


                if (!DNTRequest.GetString("savetousercpdraftbox").Equals(""))
                {
                    // 检查发送人的短消息是否已超过发送人用户组的上限
                    if (PrivateMessages.GetPrivateMessageCount(userid, -1) >= usergroupinfo.Maxpmnum)
                    {
                        AddErrLine("抱歉,您的短消息已达到上限,无法保存到草稿箱");
                        return;
                    }
                    // 只将消息保存到草稿箱
                    pm.Folder = 2;
                    if (UserCredits.UpdateUserCreditsBySendpms(base.userid) == -1)
                    {
                        AddErrLine("您的金币不足, 不能发送短消息");
                        return;
                    }
                    pm.Pmid = PrivateMessages.CreatePrivateMessage(pm, 0);

                    //发送邮件通知
                    if (DNTRequest.GetString("emailnotify") == "on")
                    {
                        SendNotifyEmail(Discuz.Forum.Users.GetUserInfo(msgtoid).Email.Trim(), pm);
                    }

                    SetUrl("usercpdraftbox.aspx");
                    SetMetaRefresh();
                    SetShowBackLink(true);
                    AddMsgLine("已将消息保存到草稿箱");
                }
                else if (!DNTRequest.GetString("savetosentbox").Equals(""))
                {
                    // 检查接收人的短消息是否已超过接收人用户组的上限
                    UserInfo touser = Discuz.Forum.Users.GetUserInfo(msgtoid);
                    //管理组不受接收人短消息上限限制
                    int radminId = UserGroups.GetUserGroupInfo(usergroupid).Radminid;
                    if (!(radminId > 0 && radminId <= 3) && PrivateMessages.GetPrivateMessageCount(msgtoid, -1) >=
                        UserGroups.GetUserGroupInfo(touser.Groupid).Maxpmnum)
                    {
                        AddErrLine("抱歉,接收人的短消息已达到上限,无法接收");
                        return;
                    }

                    if (!Utils.InArray(Convert.ToInt32(touser.Newsletter).ToString(), "2,3,6,7"))
                    {
                        AddErrLine("抱歉,接收人拒绝接收短消息");
                        return;
                    }
                    // 检查发送人的短消息是否已超过发送人用户组的上限
                    if (PrivateMessages.GetPrivateMessageCount(userid, -1) >= usergroupinfo.Maxpmnum)
                    {
                        AddErrLine("抱歉,您的短消息已达到上限,无法保存到发件箱");
                        return;
                    }
                    // 发送消息且保存到发件箱
                    pm.Folder = 0;
                    if (UserCredits.UpdateUserCreditsBySendpms(base.userid) == -1)
                    {
                        AddErrLine("您的金币不足, 不能发送短消息");
                        return;
                    }
                    pm.Pmid = PrivateMessages.CreatePrivateMessage(pm, 1);

                    //发送邮件通知
                    if (DNTRequest.GetString("emailnotify") == "on")
                    {
                        SendNotifyEmail(touser.Email.Trim(), pm);
                    }

                    // 更新在线表中的用户最后发帖时间
                    OnlineUsers.UpdatePostPMTime(olid);

                    SetUrl("usercpsentbox.aspx");
                    SetMetaRefresh();
                    SetShowBackLink(true);
                    AddMsgLine("发送完毕, 且已将消息保存到发件箱");
                }
                else
                {
                    UserInfo touser = Discuz.Forum.Users.GetUserInfo(msgtoid);
                    // 检查接收人的短消息是否已超过接收人用户组的上限,管理组不受接收人短消息上限限制
                    int radminId = UserGroups.GetUserGroupInfo(usergroupid).Radminid;
                    if (!(radminId > 0 && radminId <= 3) && PrivateMessages.GetPrivateMessageCount(msgtoid, -1) >=
                        UserGroups.GetUserGroupInfo(touser.Groupid).Maxpmnum)
                    {
                        AddErrLine("抱歉,接收人的短消息已达到上限,无法接收");
                        return;
                    }
                    if (!Utils.InArray(Convert.ToInt32(touser.Newsletter).ToString(), "2,3,6,7"))
                    {
                        AddErrLine("抱歉,接收人拒绝接收短消息");
                        return;
                    }

                    // 发送消息但不保存到发件箱
                    pm.Folder = 0;
                    if (UserCredits.UpdateUserCreditsBySendpms(base.userid) == -1)
                    {
                        AddErrLine("您的金币不足, 不能发送短消息");
                        return;
                    }
                    pm.Pmid = PrivateMessages.CreatePrivateMessage(pm, 0);

                    //发送邮件通知
                    if (DNTRequest.GetString("emailnotify") == "on")
                    {
                        SendNotifyEmail(touser.Email.Trim(), pm);
                    }

                    SetUrl("usercpinbox.aspx");
                    SetMetaRefresh();
                    SetShowBackLink(true);
                    AddMsgLine("发送完毕");
                }

                #endregion
            }

            msgto = Utils.HtmlEncode(DNTRequest.GetString("msgto"));

            msgtoid = DNTRequest.GetInt("msgtoid", 0);
            if (msgtoid > 0)
            {
                msgto = Discuz.Forum.Users.GetUserName(msgtoid).Trim();
            }

            subject = Utils.HtmlEncode(DNTRequest.GetString("subject"));
            message = Utils.HtmlEncode(DNTRequest.GetString("message"));

            string action = DNTRequest.GetQueryString("action").ToLower();
            if (action.CompareTo("re") == 0 || action.CompareTo("fw") == 0) //回复或者转发
            {
                int pmid = DNTRequest.GetQueryInt("pmid", -1);
                if (pmid != -1)
                {
                    PrivateMessageInfo pm = PrivateMessages.GetPrivateMessageInfo(pmid);
                    if (pm != null)
                    {
                        if (pm.Msgtoid == userid || pm.Msgfromid == userid)
                        {
                            if (action.CompareTo("re") == 0)
                            {
                                msgto = Utils.HtmlEncode(pm.Msgfrom);
                            }
                            else
                            {
                                msgto = "";
                            }
                            subject = Utils.HtmlEncode(action) + ":" + pm.Subject;
                            message = Utils.HtmlEncode("> ") + pm.Message.Replace("\n", "\n> ") + "\r\n\r\n";
                        }
                    }
                }
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// 验证帖子信息
        /// </summary>
        /// <param name="admininfo"></param>
        /// <param name="user"></param>
        /// <param name="ishtmlon"></param>
        private void SetPostInfo(AdminGroupInfo admininfo, ShortUserInfo user, bool ishtmlon)
        {
            if (postinfo.Layer == 0 && forum.Applytopictype == 1 && forum.Postbytopictype == 1 && topictypeselectoptions != string.Empty)
            {
                if (Utils.StrIsNullOrEmpty(DNTRequest.GetString("typeid")) || DNTRequest.GetString("typeid").Trim() == "0")
                {
                    AddErrLine("主题类型不能为空");
                    return;
                }

                if (!Forums.IsCurrentForumTopicType(DNTRequest.GetString("typeid").Trim(), forum.Topictypes))
                {
                    AddErrLine("错误的主题类型");
                    return;
                }
            }

            //这段代码有什么作用,和下面的SetAttachmentInfo方法做的事情是否有重复?能否拿掉?
            ///删除附件
            if (DNTRequest.GetInt("isdeleteatt", 0) == 1)
            {
                if (DNTRequest.GetFormInt("aid", 0) > 0 && Attachments.DeleteAttachment(DNTRequest.GetFormInt("aid", 0)) > 0)
                {
                    attachmentlist  = Attachments.GetAttachmentListByPid(postinfo.Pid);
                    attachmentcount = Attachments.GetAttachmentCountByPid(postinfo.Pid);
                }
                AddLinkCss(BaseConfigs.GetForumPath + "templates/" + templatepath + "/editor.css", "css");
                // 帖子内容
                message = postinfo.Message;
                ispost  = false;

                return;
            }
            //
            #region 检查标题和内容信息
            if (string.IsNullOrEmpty(postTitle.Trim().Replace(" ", "")) && postinfo.Layer == 0)
            {
                AddErrLine("标题不能为空");
            }
            else if (postTitle.Length > 60)
            {
                AddErrLine("标题最大长度为60个字符,当前为 " + postTitle.Length.ToString() + " 个字符");
            }

            //string postmessage = DNTRequest.GetString("message");
            if (postMessage.Equals("") || postMessage.Replace(" ", "").Equals(""))
            {
                AddErrLine("内容不能为空");
            }

            if (admininfo != null && disablepostctrl != 1)
            {
                if (postMessage.Length < config.Minpostsize)
                {
                    AddErrLine("您发表的内容过少, 系统设置要求帖子内容不得少于 " + config.Minpostsize.ToString() + " 字多于 " + config.Maxpostsize.ToString() + " 字");
                }
                else if (postMessage.Length > config.Maxpostsize)
                {
                    AddErrLine("您发表的内容过多, 系统设置要求帖子内容不得少于 " + config.Minpostsize.ToString() + " 字多于 " + config.Maxpostsize.ToString() + " 字");
                }
            }

            //新用户广告强力屏蔽检查
            if ((config.Disablepostad == 1) && useradminid < 1)  //如果开启新用户广告强力屏蔽检查或是游客
            {
                if ((config.Disablepostadpostcount != 0 && user.Posts <= config.Disablepostadpostcount) ||
                    (config.Disablepostadregminute != 0 && DateTime.Now.AddMinutes(-config.Disablepostadregminute) <= Convert.ToDateTime(user.Joindate)))
                {
                    foreach (string regular in config.Disablepostadregular.Replace("\r", "").Split('\n'))
                    {
                        if (Posts.IsAD(regular, postTitle, postMessage))
                        {
                            AddErrLine("发帖失败,内容中有不符合新用户强力广告屏蔽规则的字符,请检查标题和内容,如有疑问请与管理员联系");
                            return;
                        }
                    }
                }
            }

            #endregion
            string[] pollitem   = Utils.SplitString(DNTRequest.GetString("PollItemname"), "\r\n");
            int      topicprice = 0;
            string   tmpprice   = DNTRequest.GetString("topicprice");

            if (postinfo.Layer == 0)
            {
                #region 投票信息
                //string[] pollitem = Utils.SplitString(DNTRequest.GetString("PollItemname"), "\r\n");

                if (!Utils.StrIsNullOrEmpty(DNTRequest.GetString("updatepoll")) && topic.Special == 1)
                {
                    pollinfo.Multiple = DNTRequest.GetInt("multiple", 0);

                    // 验证用户是否有发布投票的权限
                    if (usergroupinfo.Allowpostpoll != 1)
                    {
                        AddErrLine("您当前的身份 \"" + usergroupinfo.Grouptitle + "\" 没有发布投票的权限");
                        return;
                    }

                    if (pollitem.Length < 2)
                    {
                        AddErrLine("投票项不得少于2个");
                    }
                    else if (pollitem.Length > config.Maxpolloptions)
                    {
                        AddErrLine("系统设置为投票项不得多于" + config.Maxpolloptions + "个");
                    }
                    else
                    {
                        for (int i = 0; i < pollitem.Length; i++)
                        {
                            if (Utils.StrIsNullOrEmpty(pollitem[i]))
                            {
                                AddErrLine("投票项不能为空");
                            }
                        }
                    }
                }
                #endregion

                #region 悬赏信息
                //int topicprice = 0;
                //string tmpprice = DNTRequest.GetString("topicprice");

                if (Regex.IsMatch(tmpprice, "^[0-9]*[0-9][0-9]*$") || tmpprice == string.Empty)
                {
                    topicprice = Utils.StrToInt(tmpprice, 0) > 32767 ? 32767 : Utils.StrToInt(tmpprice, 0);
                    //当不是正在进行的悬赏...
                    if (topic.Special != 2)
                    {
                        if (topicprice > usergroupinfo.Maxprice && usergroupinfo.Maxprice > 0)
                        {
                            if (userextcreditsinfo.Unit.Equals(""))
                            {
                                AddErrLine(string.Format("主题售价不能高于 {0} {1}", usergroupinfo.Maxprice, userextcreditsinfo.Name));
                            }
                            else
                            {
                                AddErrLine(string.Format("主题售价不能高于 {0} {1}({2})", usergroupinfo.Maxprice, userextcreditsinfo.Name, userextcreditsinfo.Unit));
                            }
                        }
                        else if (topicprice > 0 && usergroupinfo.Maxprice <= 0)
                        {
                            AddErrLine(string.Format("您当前的身份 \"{0}\" 未被允许出售主题", usergroupinfo.Grouptitle));
                        }
                        else if (topicprice < 0)
                        {
                            AddErrLine("主题售价不能为负数");
                        }
                    }
                    else
                    {
                        if (usergroupinfo.Radminid != 1)
                        {
                            if (usergroupinfo.Allowbonus == 0)
                            {
                                AddErrLine(string.Format("您当前的身份 \"{0}\" 未被允许进行悬赏", usergroupinfo.Grouptitle));
                            }

                            if (topicprice < usergroupinfo.Minbonusprice || topicprice > usergroupinfo.Maxbonusprice)
                            {
                                AddErrLine(string.Format("悬赏价格超出范围, 您应在 {0} - {1} {2}{3} 范围内进行悬赏", usergroupinfo.Minbonusprice, usergroupinfo.Maxbonusprice,
                                                         userextcreditsinfo.Unit, userextcreditsinfo.Name));
                            }
                        }
                    }
                }
                else
                {
                    if (topic.Special != 2)
                    {
                        AddErrLine("主题售价只能为整数");
                    }
                    else
                    {
                        AddErrLine("悬赏价格只能为整数");
                    }
                }
                #endregion

                #region 辩论信息
                if (!Utils.StrIsNullOrEmpty(DNTRequest.GetString("updatedebate")) && topic.Special == 4)
                {
                    if (usergroupinfo.Allowdebate != 1)
                    {
                        AddErrLine("您当前的身份 \"" + usergroupinfo.Grouptitle + "\" 没有发布辩论的权限");
                        return;
                    }
                    if (Utils.StrIsNullOrEmpty(DNTRequest.GetString("positiveopinion")))
                    {
                        AddErrLine("正方观点不能为空");
                        return;
                    }
                    if (Utils.StrIsNullOrEmpty(DNTRequest.GetString("negativeopinion")))
                    {
                        AddErrLine("反方观点不能为空");
                        return;
                    }
                    if (Utils.StrIsNullOrEmpty(DNTRequest.GetString("terminaltime")))
                    {
                        AddErrLine("辩论的结束日期不能为空");
                        return;
                    }
                    if (!Utils.IsDateString(DNTRequest.GetString("terminaltime")))
                    {
                        AddErrLine("结束日期格式不正确");
                        return;
                    }
                }
                #endregion
            }

            #region 绑定并检查主题和帖子信息
            if (useradminid == 1)
            {
                postinfo.Title = Utils.HtmlEncode(postTitle);

                if (usergroupinfo.Allowhtml == 0)
                {
                    postinfo.Message = Utils.HtmlEncode(postMessage);
                }
                else
                {
                    postinfo.Message = ishtmlon ? postMessage :
                                       Utils.HtmlEncode(postMessage);
                }
            }
            else
            {
                postinfo.Title = Utils.HtmlEncode(ForumUtils.BanWordFilter(postTitle));

                if (usergroupinfo.Allowhtml == 0)
                {
                    postinfo.Message = Utils.HtmlEncode(ForumUtils.BanWordFilter(postMessage));
                }
                else
                {
                    postinfo.Message = ishtmlon ? ForumUtils.BanWordFilter(postMessage) :
                                       Utils.HtmlEncode(ForumUtils.BanWordFilter(postMessage));
                }
            }
            postinfo.Title = postinfo.Title.Length > 60 ? postinfo.Title.Substring(0, 60) : postinfo.Title;

            if (useradminid != 1 && (ForumUtils.HasBannedWord(postTitle) || ForumUtils.HasBannedWord(postMessage)))
            {
                string bannedWord = ForumUtils.GetBannedWord(postTitle) == string.Empty ? ForumUtils.GetBannedWord(postMessage) : ForumUtils.GetBannedWord(postTitle);
                AddErrLine(string.Format("对不起, 您提交的内容包含不良信息  <font color=\"red\">{0}</font>, 请返回修改!", bannedWord));
                return;
            }

            //if (useradminid != 1 && (ForumUtils.HasAuditWord(postinfo.Title) || ForumUtils.HasAuditWord(postinfo.Message)))
            //{
            //    AddErrLine("对不起, 管理员设置了需要对发帖进行审核, 您没有权力编辑已通过审核的帖子, 请返回修改!");
            //    return;
            //}

            topic.Displayorder = Topics.GetTitleDisplayOrder(usergroupinfo, useradminid, forum, topic, message, disablepostctrl);

            #endregion
            // 检察上面验证是否有错误
            if (IsErr())
            {
                return;
            }
            //如果是不是管理员组,或者编辑间隔超过60秒,则附加编辑信息
            if (Utils.StrDateDiffSeconds(postinfo.Postdatetime, 60) > 0 && config.Editedby == 1 && useradminid != 1)
            {
                postinfo.Lastedit = username + " 最后编辑于 " + Utils.GetDateTime();
            }

            postinfo.Usesig      = Utils.StrToInt(DNTRequest.GetString("usesig"), 0);
            postinfo.Htmlon      = (usergroupinfo.Allowhtml == 1 && ishtmlon ? 1 : 0);
            postinfo.Smileyoff   = smileyoff == 0 ? TypeConverter.StrToInt(DNTRequest.GetString("smileyoff")) : smileyoff;
            postinfo.Bbcodeoff   = (usergroupinfo.Allowcusbbcode == 1 ? TypeConverter.StrToInt(DNTRequest.GetString("bbcodeoff")) : 1);
            postinfo.Parseurloff = TypeConverter.StrToInt(DNTRequest.GetString("parseurloff"));
            postinfo.Invisible   = needaudit ? 1 : 0;

            //如果当前用户就是作者或所在管理组有编辑的权限
            if (userid == postinfo.Posterid || (admininfo != null && admininfo.Alloweditpost == 1 && Moderators.IsModer(useradminid, userid, forumid)))
            {
                alloweditpost = true;
            }
            else
            {
                AddErrLine("您当前的身份不是作者");
                return;
            }

            if (!alloweditpost)
            {
                AddErrLine("您当前的身份没有编辑帖子的权限");
                return;
            }

            if (alloweditpost)
            {
                SetTopicInfo(pollitem, topicprice, postMessage);
            }
        }
Ejemplo n.º 3
0
        /// <summary>
        /// 创建帖子信息
        /// </summary>
        /// <param name="postmessage"></param>
        /// <returns></returns>
        public PostInfo CreatePostInfo(string postmessage)
        {
            PostInfo postinfo = new PostInfo();

            postinfo.Fid      = forumid;
            postinfo.Tid      = topicid;
            postinfo.Parentid = postinfo.Parentid;
            postinfo.Layer    = postinfo.Layer + 1;
            postinfo.Poster   = username;
            postinfo.Posterid = userid;
            bool ishtmlon = (Utils.StrToInt(DNTRequest.GetString("htmlon"), 0) == 1);

            if (useradminid == 1)
            {
                postinfo.Title = Utils.HtmlEncode(posttitle);
                if (usergroupinfo.Allowhtml == 0)
                {
                    postinfo.Message = Utils.HtmlEncode(postmessage);
                }
                else
                {
                    postinfo.Message = ishtmlon ? postmessage : Utils.HtmlEncode(postmessage);
                }
            }
            else
            {
                postinfo.Title = Utils.HtmlEncode(ForumUtils.BanWordFilter(DNTRequest.GetString(config.Antispamposttitle)));
                if (usergroupinfo.Allowhtml == 0)
                {
                    postinfo.Message = Utils.HtmlEncode(ForumUtils.BanWordFilter(postmessage));
                }
                else
                {
                    postinfo.Message = ishtmlon ? ForumUtils.BanWordFilter(postmessage) :
                                       Utils.HtmlEncode(ForumUtils.BanWordFilter(postmessage));
                }
            }
            postinfo.Postdatetime = Utils.GetDateTime();

            if (Utils.StrIsNullOrEmpty(postinfo.Message.Replace(" ", "")))
            {
                AddErrLine("内容不能为空, 请返回修改!");
                return(postinfo);
            }

            if (useradminid != 1 && (ForumUtils.HasBannedWord(posttitle) || ForumUtils.HasBannedWord(postmessage)))
            {
                string bannedWord = ForumUtils.GetBannedWord(posttitle) == string.Empty ? ForumUtils.GetBannedWord(postmessage) : ForumUtils.GetBannedWord(posttitle);
                AddErrLine(string.Format("对不起, 您提交的内容包含不良信息  <font color=\"red\">{0}</font>, 请返回修改!", bannedWord));
                return(postinfo);
            }

            postinfo.Ip            = DNTRequest.GetIP();
            postinfo.Lastedit      = "";
            postinfo.Debateopinion = DNTRequest.GetInt("debateopinion", 0);
            postinfo.Invisible     = needaudit ? 1 : 0;

            // 如果当前用户非管理员并且论坛设定了发帖审核时间段,当前时间如果在其中的一个时间段内,则用户所发帖均为待审核状态
            if (useradminid != 1 && !Moderators.IsModer(useradminid, userid, forumid))
            {
                if (Scoresets.BetweenTime(config.Postmodperiods) || ForumUtils.HasAuditWord(postinfo.Title) || ForumUtils.HasAuditWord(postinfo.Message))
                {
                    postinfo.Invisible = 1;
                }
            }

            postinfo.Usesig      = TypeConverter.StrToInt(DNTRequest.GetString("usesig"));
            postinfo.Htmlon      = (usergroupinfo.Allowhtml == 1 && ishtmlon) ? 1 : postinfo.Htmlon;
            postinfo.Smileyoff   = (smileyoff != 0) ? smileyoff : TypeConverter.StrToInt(DNTRequest.GetString("smileyoff"));
            postinfo.Bbcodeoff   = (usergroupinfo.Allowcusbbcode == 1 && forum.Allowbbcode == 1) ? TypeConverter.StrToInt(DNTRequest.GetString("bbcodeoff")) : 1;
            postinfo.Parseurloff = TypeConverter.StrToInt(DNTRequest.GetString("parseurloff"));
            postinfo.Attachment  = 0;
            postinfo.Rate        = 0;
            postinfo.Ratetimes   = 0;
            postinfo.Topictitle  = topic.Title;

            if ((postinfo.Title != "" && Utils.GetCookie("lastposttitle") == Utils.MD5(postinfo.Title)) || Utils.GetCookie("lastpostmessage") == Utils.MD5(postinfo.Message))
            {
                AddErrLine("请勿重复发帖");
                return(postinfo);
            }
            postinfo.Pid = Posts.CreatePost(postinfo);
            Utils.WriteCookie("lastposttitle", Utils.MD5(postinfo.Title));
            Utils.WriteCookie("lastpostmessage", Utils.MD5(postinfo.Message));
            return(postinfo);
        }
Ejemplo n.º 4
0
        public void SendPM()
        {
            if (pm == null)
            {
                pm = new ShortMessage();
            }

            if (this.useradminid == 1)
            {
                this.pm.Message = DNTRequest.GetHtmlEncodeString("message");
                this.pm.Subject = DNTRequest.GetHtmlEncodeString("subject");
            }
            else
            {
                this.pm.Message = Utils.HtmlEncode(ForumUtils.BanWordFilter(DNTRequest.GetString("message")));
                this.pm.Subject = Utils.HtmlEncode(ForumUtils.BanWordFilter(DNTRequest.GetString("subject")));
            }
            if (this.useradminid != 1 && (ForumUtils.HasBannedWord(this.pm.Message) || ForumUtils.HasBannedWord(this.pm.Subject) || ForumUtils.HasAuditWord(this.pm.Message) || ForumUtils.HasAuditWord(this.pm.Subject)))
            {
                string arg = (ForumUtils.GetBannedWord(this.pm.Message) == string.Empty) ? ForumUtils.GetBannedWord(this.pm.Subject) : ForumUtils.GetBannedWord(this.pm.Message);
                base.AddErrLine(string.Format("对不起, 您提交的内容包含不良信息 <font color=\"red\">{0}</font>, 因此无法提交, 请返回修改!", arg));
                return;
            }
            string text = "," + Users.GetUserInfo(this.msgtoid).Ignorepm + ",";

            if (text.IndexOf("{ALL}") >= 0 || text.IndexOf("," + this.username + ",") >= 0)
            {
                base.AddErrLine("短消息发送失败!");
                return;
            }
            this.pm.Message   = ForumUtils.BanWordFilter(this.pm.Message);
            this.pm.Subject   = ForumUtils.BanWordFilter(this.pm.Subject);
            this.pm.Msgto     = DNTRequest.GetString("msgto");
            this.pm.MsgtoID   = this.msgtoid;
            this.pm.Msgfrom   = this.username;
            this.pm.MsgfromID = this.userid;
            if (!Utils.StrIsNullOrEmpty(DNTRequest.GetString("savetousercpdraftbox")))
            {
                this.CreatePM(2, 0, "usercpdraftbox.aspx", "已将消息保存到草稿箱");
                return;
            }
            if (!Utils.StrIsNullOrEmpty(DNTRequest.GetString("savetosentbox")))
            {
                this.CreatePM(0, 1, "usercpsentbox.aspx", "发送完毕, 且已将消息保存到发件箱");
            }
            else
            {
                this.CreatePM(0, 0, "usercpinbox.aspx", "发送完毕");
            }
            if (!base.IsErr())
            {
                Online.UpdatePostPMTime(this.olid);
                //int olidByUid = OnlineUsers.GetOlidByUid(this.pm.MsgtoID);
                //if (olidByUid > 0)
                var entity = Online.FindByUserID(pm.MsgtoID);
                if (entity != null)
                {
                    Users.UpdateUserNewPMCount(this.pm.MsgtoID, entity.ID);
                }
            }
        }
Ejemplo n.º 5
0
        /// <summary>
        /// 创建并发送短消息
        /// </summary>
        public void SendPM()
        {
            #region 创建并发送短消息

            // 收件箱
            if (useradminid == 1)
            {
                pm.Message = DNTRequest.GetHtmlEncodeString("message");
                pm.Subject = DNTRequest.GetHtmlEncodeString("subject");
            }
            else
            {
                pm.Message = Utils.HtmlEncode(ForumUtils.BanWordFilter(DNTRequest.GetString("message")));
                pm.Subject = Utils.HtmlEncode(ForumUtils.BanWordFilter(DNTRequest.GetString("subject")));
            }

            if (useradminid != 1 && (ForumUtils.HasBannedWord(pm.Message) || ForumUtils.HasBannedWord(pm.Subject) || ForumUtils.HasAuditWord(pm.Message) || ForumUtils.HasAuditWord(pm.Subject)))
            {
                string bannedWord = ForumUtils.GetBannedWord(pm.Message) == string.Empty ? ForumUtils.GetBannedWord(pm.Subject) : ForumUtils.GetBannedWord(pm.Message);
                AddErrLine(string.Format("对不起, 您提交的内容包含不良信息 <font color=\"red\">{0}</font>, 因此无法提交, 请返回修改!", bannedWord));
                return;
            }
            string Ignorepm = "," + Users.GetUserInfo(msgtoid).Ignorepm + ",";
            //禁止所有用户或当前用户在忽略列表内时
            if (Ignorepm.IndexOf("{ALL}") >= 0 || Ignorepm.IndexOf("," + username + ",") >= 0)
            {
                AddErrLine("短消息发送失败!");
                return;
            }

            pm.Message      = ForumUtils.BanWordFilter(pm.Message);
            pm.Subject      = ForumUtils.BanWordFilter(pm.Subject);
            pm.Msgto        = DNTRequest.GetString("msgto");
            pm.Msgtoid      = msgtoid;
            pm.Msgfrom      = username;
            pm.Msgfromid    = userid;
            pm.New          = 1;
            pm.Postdatetime = Utils.GetDateTime();

            // 只将消息保存到草稿箱
            if (!Utils.StrIsNullOrEmpty(DNTRequest.GetString("savetousercpdraftbox")))
            {
                CreatePM(2, 0, "usercpdraftbox.aspx", "已将消息保存到草稿箱");
                return;
            }
            else if (!Utils.StrIsNullOrEmpty(DNTRequest.GetString("savetosentbox")))// 发送消息且保存到发件箱
            {
                CreatePM(0, 1, "usercpsentbox.aspx", "发送完毕, 且已将消息保存到发件箱");
            }
            else// 发送消息但不保存到发件箱
            {
                CreatePM(0, 0, "usercpinbox.aspx", "发送完毕");
            }

            if (!IsErr())
            {
                // 更新在线表中的用户最后发帖时间
                OnlineUsers.UpdatePostPMTime(olid);

                //为在线用户更新短消息数
                int targetolid = OnlineUsers.GetOlidByUid(pm.Msgtoid);
                if (targetolid > 0)
                {
                    Users.UpdateUserNewPMCount(pm.Msgtoid, targetolid);
                }
            }
            #endregion
        }
Ejemplo n.º 6
0
        /// <summary>
        /// 创建主题信息
        /// </summary>
        /// <param name="admininfo"></param>
        /// <param name="postmessage"></param>
        /// <param name="isbonus"></param>
        /// <param name="topicprice"></param>
        /// <returns></returns>
        public TopicInfo CreateTopic(AdminGroupInfo admininfo, string postmessage, bool isbonus, int topicprice)
        {
            TopicInfo topicinfo = new TopicInfo();

            topicinfo.Fid    = forumid;
            topicinfo.Iconid = (DNTRequest.GetInt("iconid", 0) < 0 || DNTRequest.GetInt("iconid", 0) > 15) ? 0 :
                               DNTRequest.GetInt("iconid", 0);
            message = Posts.GetPostMessage(usergroupinfo, admininfo, postmessage,
                                           (TypeConverter.StrToInt(DNTRequest.GetString("htmlon")) == 1));

            topicinfo.Title = (useradminid == 1) ? Utils.HtmlEncode(posttitle) :
                              Utils.HtmlEncode(ForumUtils.BanWordFilter(posttitle));

            if (useradminid != 1 && (ForumUtils.HasBannedWord(posttitle) || ForumUtils.HasBannedWord(postmessage)))
            {
                string bannedWord = ForumUtils.GetBannedWord(posttitle) == string.Empty ? ForumUtils.GetBannedWord(postmessage) : ForumUtils.GetBannedWord(posttitle);
                AddErrLine(string.Format("对不起, 您提交的内容包含不良信息  <font color=\"red\">{0}</font>, 请返回修改!", bannedWord));
                return(topicinfo);
            }

            if (Utils.GetCookie("lasttopictitle") == Utils.MD5(topicinfo.Title) || Utils.GetCookie("lasttopicmessage") == Utils.MD5(message))
            {
                AddErrLine("请勿重复发帖");
                return(topicinfo);
            }

            topicinfo.Typeid = DNTRequest.GetInt("typeid", 0);
            if (usergroupinfo.Allowsetreadperm == 1)
            {
                topicinfo.Readperm = DNTRequest.GetInt("topicreadperm", 0) > 255 ? 255 : DNTRequest.GetInt("topicreadperm", 0);
            }

            topicinfo.Price        = topicprice;
            topicinfo.Poster       = username;
            topicinfo.Posterid     = userid;
            topicinfo.Postdatetime = curdatetime;
            topicinfo.Lastpost     = curdatetime;
            topicinfo.Lastposter   = username;
            topicinfo.Displayorder = Topics.GetTitleDisplayOrder(usergroupinfo, useradminid, forum, topicinfo, message, disablepost);


            string htmltitle = DNTRequest.GetString("htmltitle").Trim();

            if (!Utils.StrIsNullOrEmpty(htmltitle) && Utils.HtmlDecode(htmltitle).Trim() != topicinfo.Title)
            {
                //按照  附加位/htmltitle(1位)/magic(3位)/以后扩展(未知位数) 的方式来存储  例: 11001
                topicinfo.Magic = 11000;
            }

            //标签(Tag)操作
            string tags = DNTRequest.GetString("tags").Trim();

            string[] tagArray = null;
            if (enabletag && !Utils.StrIsNullOrEmpty(tags))
            {
                if (ForumUtils.InBanWordArray(tags))
                {
                    AddErrLine("标签中含有系统禁止词语,请修改");
                    return(topicinfo);
                }

                tagArray = Utils.SplitString(tags, " ", true, 2, 10);
                if (tagArray.Length > 0 && tagArray.Length <= 5)
                {
                    if (topicinfo.Magic == 0)
                    {
                        topicinfo.Magic = 10000;
                    }

                    topicinfo.Magic = Utils.StrToInt(topicinfo.Magic.ToString() + "1", 0);
                }
                else
                {
                    AddErrLine("超过标签数的最大限制或单个标签长度没有介于2-10之间,最多可填写 5 个标签");
                    return(topicinfo);
                }
            }

            if (isbonus)
            {
                topicinfo.Special = 2;

                //检查积分是否足够
                if (mybonustranscredits < topicprice && usergroupinfo.Radminid != 1)
                {
                    AddErrLine(string.Format("无法进行悬赏<br /><br />您当前的{0}为 {1} {3}<br/>悬赏需要{0} {2} {3}", bonusextcreditsinfo.Name, mybonustranscredits, topicprice, bonusextcreditsinfo.Unit));
                    return(topicinfo);
                }
                else
                {
                    Users.UpdateUserExtCredits(topicinfo.Posterid, Scoresets.GetBonusCreditsTrans(),
                                               -topicprice * (Scoresets.GetCreditsTax() + 1)); //计算税后的实际支付
                }
            }

            if (type == "poll")
            {
                topicinfo.Special = 1;
            }

            if (type == "debate") //辩论帖
            {
                topicinfo.Special = 4;
            }

            if (!Moderators.IsModer(useradminid, userid, forumid))
            {
                topicinfo.Attention = 1;
            }

            if (ForumUtils.IsHidePost(postmessage) && usergroupinfo.Allowhidecode == 1)
            {
                topicinfo.Hide = 1;
            }

            topicinfo.Tid = Topics.CreateTopic(topicinfo);

            //canhtmltitle = config.Htmltitle == 1 && Utils.InArray(usergroupid.ToString(), config.Htmltitleusergroup);
            //canhtmltitle = config.Htmltitle == 1 && usergroupinfo.Allowhtml == 1;
            //保存htmltitle

            if (canhtmltitle && !Utils.StrIsNullOrEmpty(htmltitle) && htmltitle != topicinfo.Title)
            {
                Topics.WriteHtmlTitleFile(Utils.RemoveUnsafeHtml(htmltitle), topicinfo.Tid);
            }

            if (enabletag && tagArray != null && tagArray.Length > 0)
            {
                if (useradminid != 1 && ForumUtils.HasBannedWord(tags))
                {
                    string bannedWord = ForumUtils.GetBannedWord(tags);
                    AddErrLine(string.Format("标签中含有系统禁止词语 <font color=\"red\">{0}</font>,请修改", bannedWord));
                    return(topicinfo);
                }
                ForumTags.CreateTopicTags(tagArray, topicinfo.Tid, userid, curdatetime);
            }

            if (type == "debate")
            {
                DebateInfo debatetopic = new DebateInfo();
                debatetopic.Tid             = topicinfo.Tid;
                debatetopic.Positiveopinion = DNTRequest.GetString("positiveopinion");
                debatetopic.Negativeopinion = DNTRequest.GetString("negativeopinion");
                debatetopic.Terminaltime    = Convert.ToDateTime(DNTRequest.GetString("terminaltime"));
                Topics.CreateDebateTopic(debatetopic);
            }

            Topics.AddParentForumTopics(forum.Parentidlist.Trim(), 1);
            return(topicinfo);
        }
Ejemplo n.º 7
0
        public Post CreatePostInfo(string postmessage)
        {
            var pi = new Post();

            pi.Fid = this.forumid;
            pi.Tid = this.topicid;
            pi.Layer++;
            //pi.Poster = this.username;
            //pi.Posterid = this.userid;
            bool flag = DNTRequest.GetString("htmlon").ToInt(0) == 1;
            var  msg  = pi.Message;

            if (this.useradminid == 1)
            {
                pi.Title = Utils.HtmlEncode(this.posttitle);
                if (!this.usergroupinfo.AllowHtml)
                {
                    msg = Utils.HtmlEncode(postmessage);
                }
                else
                {
                    msg = (flag ? postmessage : Utils.HtmlEncode(postmessage));
                }
            }
            else
            {
                pi.Title = Utils.HtmlEncode(ForumUtils.BanWordFilter(DNTRequest.GetString(this.config.Antispamposttitle)));
                if (!this.usergroupinfo.AllowHtml)
                {
                    msg = Utils.HtmlEncode(ForumUtils.BanWordFilter(postmessage));
                }
                else
                {
                    msg = (flag ? ForumUtils.BanWordFilter(postmessage) : Utils.HtmlEncode(ForumUtils.BanWordFilter(postmessage)));
                }
            }
            pi.Message = msg;
            //pi.Postdatetime = Utils.GetDateTime();
            if (Utils.StrIsNullOrEmpty(msg.Replace("\u3000", "")))
            {
                base.AddErrLine("内容不能为空, 请返回修改!");
                return(pi);
            }
            if (this.useradminid != 1 && (ForumUtils.HasBannedWord(this.posttitle) || ForumUtils.HasBannedWord(postmessage)))
            {
                string arg = (ForumUtils.GetBannedWord(this.posttitle) == string.Empty) ? ForumUtils.GetBannedWord(postmessage) : ForumUtils.GetBannedWord(this.posttitle);
                base.AddErrLine(string.Format("对不起, 您提交的内容包含不良信息  <font color=\"red\">{0}</font>, 请返回修改!", arg));
                return(pi);
            }
            //pi.Ip = WebHelper.UserHost;
            //pi.Lastedit = "";
            //pi.Debateopinion = DNTRequest.GetInt("debateopinion", 0);
            var debateopinion = DNTRequest.GetInt("debateopinion", 0);

            pi.Invisible = (this.needaudit ? 1 : 0);
            if (this.useradminid != 1 && !Moderators.IsModer(this.useradminid, this.userid, this.forumid) && (Scoresets.BetweenTime(this.config.Postmodperiods) || ForumUtils.HasAuditWord(pi.Title) || ForumUtils.HasAuditWord(msg)))
            {
                pi.Invisible = 1;
            }
            pi.UseSig      = DNTRequest.GetInt("usesig");
            pi.HtmlOn      = (this.usergroupinfo.AllowHtml && flag) ? 1 : 0;
            pi.SmileyOff   = ((this.smileyoff != 0) ? this.smileyoff : DNTRequest.GetInt("smileyoff"));
            pi.BBCodeOff   = ((this.usergroupinfo.AllowCusbbCode && this.forum.Allowbbcode == 1) ? DNTRequest.GetInt("bbcodeoff") : 1);
            pi.ParseUrlOff = DNTRequest.GetInt("parseurloff");
            //pi.Attachment = 0;
            //pi.Rate = 0;
            //pi.Ratetimes = 0;
            //pi.Title = this.topic.Title;
            if ((pi.Title != "" && Utils.GetCookie("lastposttitle") == Utils.MD5(pi.Title)) || Utils.GetCookie("lastpostmessage") == Utils.MD5(msg))
            {
                base.AddErrLine("请勿重复发帖");
                return(pi);
            }
            //pi.Pid = Posts.CreatePost(pi);
            pi.Create();

            if (debateopinion > 0)
            {
                Debate.CreateDebateExpandInfo(pi.Tid, pi.ID, debateopinion, 0);
            }

            Utils.WriteCookie("lastposttitle", Utils.MD5(pi.Title));
            Utils.WriteCookie("lastpostmessage", Utils.MD5(msg));
            ForumUtils.WriteCookie("clearUserdata", "forum");
            return(pi);
        }
Ejemplo n.º 8
0
        public Topic CreateTopic(AdminGroup admininfo, string postmessage, bool isbonus, int topicprice)
        {
            var tp = new Topic();

            tp.Fid = this.forumid;

            var iconid = DNTRequest.GetInt("iconid", 0);

            if (iconid < 0 || iconid > 15)
            {
                iconid = 0;
            }
            tp.IconID    = iconid;
            this.message = Posts.GetPostMessage(this.usergroupinfo, admininfo, postmessage, DNTRequest.GetInt("htmlon") == 1);
            tp.Title     = ((this.useradminid == 1) ? Utils.HtmlEncode(this.posttitle) : Utils.HtmlEncode(ForumUtils.BanWordFilter(this.posttitle)));
            if (this.useradminid != 1 && (ForumUtils.HasBannedWord(this.posttitle) || ForumUtils.HasBannedWord(postmessage)))
            {
                string arg = (ForumUtils.GetBannedWord(this.posttitle) == string.Empty) ? ForumUtils.GetBannedWord(postmessage) : ForumUtils.GetBannedWord(this.posttitle);
                base.AddErrLine(string.Format("对不起, 您提交的内容包含不良信息  <font color=\"red\">{0}</font>, 请返回修改!", arg));
                return(tp);
            }
            if (Utils.GetCookie("lasttopictitle") == Utils.MD5(tp.Title) || Utils.GetCookie("lasttopicmessage") == Utils.MD5(this.message))
            {
                base.AddErrLine("请勿重复发帖");
                return(tp);
            }
            tp.TypeID = DNTRequest.GetInt("typeid", 0);
            if (this.usergroupinfo.AllowSetreadPerm)
            {
                tp.ReadPerm = ((DNTRequest.GetInt("topicreadperm", 0) > 255) ? 255 : DNTRequest.GetInt("topicreadperm", 0));
            }
            tp.Price = topicprice;
            //tp.Poster = this.username;
            //tp.Posterid = this.userid;
            //tp.Postdatetime = this.curdatetime;
            //tp.Lastpost = this.curdatetime;
            //tp.Lastposter = this.username;
            tp.DisplayOrder = Topics.GetTitleDisplayOrder(this.usergroupinfo, this.useradminid, this.forum, tp, this.message, this.disablepost);
            string text = DNTRequest.GetString("htmltitle").Trim();

            if (!text.IsNullOrEmpty() && Utils.HtmlDecode(text).Trim() != tp.Title)
            {
                tp.Magic = 11000;
            }
            string text2 = DNTRequest.GetString("tags").Trim();

            string[] array = null;
            if (this.enabletag && !text2.IsNullOrEmpty())
            {
                if (ForumUtils.InBanWordArray(text2))
                {
                    base.AddErrLine("标签中含有系统禁止词语,请修改");
                    return(tp);
                }
                array = Utils.SplitString(text2, " ", true, 2, 10);
                if (array.Length <= 0 || array.Length > 5)
                {
                    base.AddErrLine("超过标签数的最大限制或单个标签长度没有介于2-10之间,最多可填写 5 个标签");
                    return(tp);
                }
                if (tp.Magic == 0)
                {
                    tp.Magic = 10000;
                }
                tp.Magic = (tp.Magic + "1").ToInt();
            }
            if (isbonus)
            {
                tp.Special = 2;
                if (this.mybonustranscredits < (float)topicprice && !usergroupinfo.Is管理员)
                {
                    base.AddErrLine(string.Format("无法进行悬赏<br /><br />您当前的{0}为 {1} {3}<br/>悬赏需要{0} {2} {3}", new object[]
                    {
                        this.bonusextcreditsinfo.Name,
                        this.mybonustranscredits,
                        topicprice,
                        this.bonusextcreditsinfo.Unit
                    }));
                    return(tp);
                }
                BBX.Entity.User.UpdateUserExtCredits(userid, Scoresets.GetBonusCreditsTrans(), (float)(-(float)topicprice) * (Scoresets.GetCreditsTax() + 1f));
            }
            if (this.type == "poll")
            {
                tp.Special = 1;
            }
            if (this.type == "debate")
            {
                tp.Special = 4;
            }
            if (!Moderators.IsModer(this.useradminid, this.userid, this.forumid))
            {
                tp.Attention = 1;
            }
            if (ForumUtils.IsHidePost(postmessage) && this.usergroupinfo.AllowHideCode)
            {
                tp.Hide = 1;
            }
            //tp.Tid = Topics.CreateTopic(tp);
            //tp.Insert();
            var postInfo = this.CreatePost(tp);

            tp.Create(postInfo);
            if (this.canhtmltitle && !text.IsNullOrEmpty() && text != tp.Title)
            {
                Topics.WriteHtmlTitleFile(Utils.RemoveUnsafeHtml(text), tp.ID);
            }
            if (this.enabletag && array != null && array.Length > 0)
            {
                if (this.useradminid != 1 && ForumUtils.HasBannedWord(text2))
                {
                    string bannedWord = ForumUtils.GetBannedWord(text2);
                    base.AddErrLine(string.Format("标签中含有系统禁止词语 <font color=\"red\">{0}</font>,请修改", bannedWord));
                    return(tp);
                }
                Tag.CreateTopicTags(array, tp.ID, this.userid, DateTime.Now.ToFullString());
            }
            if (this.type == "debate")
            {
                var db = new Debate();
                db.Tid             = tp.ID;
                db.PositiveOpinion = DNTRequest.GetString("positiveopinion");
                db.NegativeOpinion = DNTRequest.GetString("negativeopinion");
                db.TerminalTime    = Request["terminaltime"].ToDateTime();
                db.Insert();
                //Topics.CreateDebateTopic(new DebateInfo
                //{
                //    Tid = tp.ID,
                //    Positiveopinion = DNTRequest.GetString("positiveopinion"),
                //    Negativeopinion = DNTRequest.GetString("negativeopinion"),
                //    Terminaltime = Convert.ToDateTime(DNTRequest.GetString("terminaltime"))
                //});
            }
            //Topics.AddParentForumTopics(this.forum.Parentidlist.Trim(), 1);
            //// 所有上级论坛帖子数增加
            //var ff = forum;
            //while (ff != null && ff.ID != 0)
            //{
            //	ff.Topics++;
            //	ff.Save();

            //	ff = ff.Parent;
            //}

            return(tp);
        }
Ejemplo n.º 9
0
        private void SetPostInfo(AdminGroup admininfo, IUser user, bool ishtmlon)
        {
            if (this.postinfo.Layer == 0 && this.forum.ApplytopicType == 1 && this.forum.PostbytopicType == 1 && this.topictypeselectoptions != string.Empty)
            {
                var typeid = Request["typeid"].ToInt();
                if (typeid == 0)
                {
                    base.AddErrLine("主题类型不能为空");
                    return;
                }
                if (!Forums.IsCurrentForumTopicType(typeid, this.forum.Topictypes))
                {
                    base.AddErrLine("错误的主题类型");
                    return;
                }
            }
            if (DNTRequest.GetInt("isdeleteatt", 0) == 1)
            {
                var id  = WebHelper.RequestInt("aid");
                var att = Attachment.FindByID(id);
                if (att != null)
                {
                    att.Delete();
                    this.attachmentlist  = Attachment.FindAllByPid(this.postinfo.ID);
                    this.attachmentcount = attachmentlist.Count;
                }
                base.AddLinkCss(BaseConfigs.GetForumPath + "templates/" + this.templatepath + "/editor.css", "css");
                this.message = this.postinfo.Message;
                this.ispost  = false;
                return;
            }
            if (string.IsNullOrEmpty(this.postTitle.Trim().Replace("\u3000", "")) && this.postinfo.Layer == 0)
            {
                base.AddErrLine("标题不能为空");
            }
            else
            {
                if (this.postTitle.Length > 60)
                {
                    base.AddErrLine("标题最大长度为60个字符,当前为 " + this.postTitle.Length.ToString() + " 个字符");
                }
            }
            if (String.IsNullOrEmpty(this.postMessage) || this.postMessage.Replace("\u3000", "").Equals(""))
            {
                base.AddErrLine("内容不能为空");
            }
            if (admininfo != null && !disablepostctrl)
            {
                if (this.postMessage.Length < this.config.Minpostsize)
                {
                    base.AddErrLine("您发表的内容过少, 系统设置要求帖子内容不得少于 " + this.config.Minpostsize.ToString() + " 字多于 " + this.config.Maxpostsize.ToString() + " 字");
                }
                else
                {
                    if (this.postMessage.Length > this.config.Maxpostsize)
                    {
                        base.AddErrLine("您发表的内容过多, 系统设置要求帖子内容不得少于 " + this.config.Minpostsize.ToString() + " 字多于 " + this.config.Maxpostsize.ToString() + " 字");
                    }
                }
            }
            if (this.config.DisablePostAD && this.useradminid < 1 && ((this.config.DisablePostADPostCount != 0 && user.Posts <= this.config.DisablePostADPostCount) || (this.config.DisablePostADRegMinute != 0 && DateTime.Now.AddMinutes((double)(-(double)this.config.DisablePostADRegMinute)) <= user.JoinDate.ToDateTime())))
            {
                string[] array = this.config.DisablePostADRegular.Replace("\r", "").Split('\n');
                for (int i = 0; i < array.Length; i++)
                {
                    string regular = array[i];
                    if (Posts.IsAD(regular, this.postTitle, this.postMessage))
                    {
                        base.AddErrLine("发帖失败,内容中有不符合新用户强力广告屏蔽规则的字符,请检查标题和内容,如有疑问请与管理员联系");
                        return;
                    }
                }
            }
            string[] array2  = Utils.SplitString(DNTRequest.GetString("PollItemname"), "\r\n");
            int      num     = 0;
            string   @string = DNTRequest.GetString("topicprice");

            if (this.postinfo.Layer == 0)
            {
                if (!Utils.StrIsNullOrEmpty(DNTRequest.GetString("updatepoll")) && this.topic.Special == 1)
                {
                    this.pollinfo.Multiple = DNTRequest.GetInt("multiple", 0);
                    if (!this.usergroupinfo.AllowPostpoll)
                    {
                        base.AddErrLine("您当前的身份 \"" + this.usergroupinfo.GroupTitle + "\" 没有发布投票的权限");
                        return;
                    }
                    if (array2.Length < 2)
                    {
                        base.AddErrLine("投票项不得少于2个");
                    }
                    else
                    {
                        if (array2.Length > this.config.Maxpolloptions)
                        {
                            base.AddErrLine("系统设置为投票项不得多于" + this.config.Maxpolloptions + "个");
                        }
                        else
                        {
                            for (int j = 0; j < array2.Length; j++)
                            {
                                if (Utils.StrIsNullOrEmpty(array2[j]))
                                {
                                    base.AddErrLine("投票项不能为空");
                                }
                            }
                        }
                    }
                }
                if (Regex.IsMatch(@string, "^[0-9]*[0-9][0-9]*$") || @string == string.Empty)
                {
                    num = ((@string.ToInt(0) > 32767) ? 32767 : @string.ToInt(0));
                    if (this.topic.Special != 2)
                    {
                        if (num > this.usergroupinfo.MaxPrice && this.usergroupinfo.MaxPrice > 0)
                        {
                            if (String.IsNullOrEmpty(this.userextcreditsinfo.Unit))
                            {
                                base.AddErrLine(string.Format("主题售价不能高于 {0} {1}", this.usergroupinfo.MaxPrice, this.userextcreditsinfo.Name));
                            }
                            else
                            {
                                base.AddErrLine(string.Format("主题售价不能高于 {0} {1}({2})", this.usergroupinfo.MaxPrice, this.userextcreditsinfo.Name, this.userextcreditsinfo.Unit));
                            }
                        }
                        else
                        {
                            if (num > 0 && this.usergroupinfo.MaxPrice <= 0)
                            {
                                base.AddErrLine(string.Format("您当前的身份 \"{0}\" 未被允许出售主题", this.usergroupinfo.GroupTitle));
                            }
                            else
                            {
                                if (num < 0)
                                {
                                    base.AddErrLine("主题售价不能为负数");
                                }
                            }
                        }
                    }
                    else
                    {
                        if (!usergroupinfo.Is管理员)
                        {
                            if (!this.usergroupinfo.AllowBonus)
                            {
                                base.AddErrLine(string.Format("您当前的身份 \"{0}\" 未被允许进行悬赏", this.usergroupinfo.GroupTitle));
                            }
                            if (num < this.usergroupinfo.MinBonusprice || num > this.usergroupinfo.MaxBonusprice)
                            {
                                base.AddErrLine(string.Format("悬赏价格超出范围, 您应在 {0} - {1} {2}{3} 范围内进行悬赏", new object[]
                                {
                                    this.usergroupinfo.MinBonusprice,
                                    this.usergroupinfo.MaxBonusprice,
                                    this.userextcreditsinfo.Unit,
                                    this.userextcreditsinfo.Name
                                }));
                            }
                        }
                    }
                }
                else
                {
                    if (this.topic.Special != 2)
                    {
                        base.AddErrLine("主题售价只能为整数");
                    }
                    else
                    {
                        base.AddErrLine("悬赏价格只能为整数");
                    }
                }
                if (!Utils.StrIsNullOrEmpty(DNTRequest.GetString("updatedebate")) && this.topic.Special == 4)
                {
                    if (!this.usergroupinfo.AllowDebate)
                    {
                        base.AddErrLine("您当前的身份 \"" + this.usergroupinfo.GroupTitle + "\" 没有发布辩论的权限");
                        return;
                    }
                    if (Utils.StrIsNullOrEmpty(DNTRequest.GetString("positiveopinion")))
                    {
                        base.AddErrLine("正方观点不能为空");
                        return;
                    }
                    if (Utils.StrIsNullOrEmpty(DNTRequest.GetString("negativeopinion")))
                    {
                        base.AddErrLine("反方观点不能为空");
                        return;
                    }
                    if (Utils.StrIsNullOrEmpty(DNTRequest.GetString("terminaltime")))
                    {
                        base.AddErrLine("辩论的结束日期不能为空");
                        return;
                    }
                    if (!Utils.IsDateString(DNTRequest.GetString("terminaltime")))
                    {
                        base.AddErrLine("结束日期格式不正确");
                        return;
                    }
                }
            }
            var msg = postinfo.Message;

            if (this.useradminid == 1)
            {
                this.postinfo.Title = Utils.HtmlEncode(this.postTitle);
                if (!this.usergroupinfo.AllowHtml)
                {
                    msg = Utils.HtmlEncode(this.postMessage);
                }
                else
                {
                    msg = (ishtmlon ? this.postMessage : Utils.HtmlEncode(this.postMessage));
                }
            }
            else
            {
                this.postinfo.Title = Utils.HtmlEncode(ForumUtils.BanWordFilter(this.postTitle));
                if (!this.usergroupinfo.AllowHtml)
                {
                    msg = Utils.HtmlEncode(ForumUtils.BanWordFilter(this.postMessage));
                }
                else
                {
                    msg = (ishtmlon ? ForumUtils.BanWordFilter(this.postMessage) : Utils.HtmlEncode(ForumUtils.BanWordFilter(this.postMessage)));
                }
            }
            //postinfo.Html = msg;
            postinfo.Message    = msg;
            this.postinfo.Title = ((this.postinfo.Title.Length > 60) ? this.postinfo.Title.Substring(0, 60) : this.postinfo.Title);
            if (this.useradminid != 1 && (ForumUtils.HasBannedWord(this.postTitle) || ForumUtils.HasBannedWord(this.postMessage)))
            {
                string arg = (ForumUtils.GetBannedWord(this.postTitle) == string.Empty) ? ForumUtils.GetBannedWord(this.postMessage) : ForumUtils.GetBannedWord(this.postTitle);
                base.AddErrLine(string.Format("对不起, 您提交的内容包含不良信息  <font color=\"red\">{0}</font>, 请返回修改!", arg));
                return;
            }
            this.topic.DisplayOrder = Topics.GetTitleDisplayOrder(this.usergroupinfo, this.useradminid, this.forum, this.topic, this.message, this.disablepostctrl);
            if (base.IsErr())
            {
                return;
            }
            if (this.postinfo.PostDateTime.AddSeconds(60) < DateTime.Now && this.config.Editedby == 1 && this.useradminid != 1)
            {
                this.postinfo.LastEdit = this.username + " 最后编辑于 " + Utils.GetDateTime();
            }
            this.postinfo.UseSig      = DNTRequest.GetString("usesig").ToInt(0);
            this.postinfo.HtmlOn      = ((this.usergroupinfo.AllowHtml && ishtmlon) ? 1 : 0);
            this.postinfo.SmileyOff   = ((this.smileyoff == 0) ? DNTRequest.GetInt("smileyoff") : this.smileyoff);
            this.postinfo.BBCodeOff   = ((this.usergroupinfo.AllowCusbbCode) ? DNTRequest.GetInt("bbcodeoff") : 1);
            this.postinfo.ParseUrlOff = DNTRequest.GetInt("parseurloff");
            this.postinfo.Invisible   = (this.needaudit ? 1 : 0);
            if (this.alloweditpost)
            {
                this.SetTopicInfo(array2, num, this.postMessage);
            }
            return;
        }