Example #1
0
        /// <summary>
        /// 解析帖子列表附加信息及内容
        /// </summary>
        /// <param name="postpramsInfo">参数对象</param>
        /// <param name="attachList">附件列表</param>
        /// <param name="isModer">是否为版主</param>
        /// <param name="postList">帖子列表</param>
        public static void ParsePostListExtraInfo(PostpramsInfo postpramsInfo, List <ShowtopicPageAttachmentInfo> attachList, bool isModer, List <ShowtopicPagePostInfo> postList)
        {
            int originalHideStatus = postpramsInfo.Hide;
            // 计算是否允许查看附件
            int allowGetAttach = GetAllowGetAttachValue(postpramsInfo);

            #region 计算辩论帖是否被顶过
            string    diggedPidList = string.Empty;
            TopicInfo topicInfo     = postpramsInfo.Topicinfo == null?Topics.GetTopicInfo(postpramsInfo.Tid) : postpramsInfo.Topicinfo;

            if (topicInfo.Special == 4 && UserGroups.GetUserGroupInfo(7).Allowdiggs != 1)
            {
                diggedPidList = Discuz.Data.Debates.GetUesrDiggs(postpramsInfo.Tid, postpramsInfo.CurrentUserid);
            }
            #endregion

            foreach (ShowtopicPagePostInfo postInfo in postList)
            {
                LoadPostMessage(postpramsInfo, attachList, isModer, allowGetAttach, originalHideStatus, postInfo);

                if (topicInfo.Special == 4)
                {
                    if (UserGroups.GetUserGroupInfo(7).Allowdiggs == 1)
                    {
                        postInfo.Digged = Debates.IsDigged(postInfo.Pid, postpramsInfo.CurrentUserid);
                    }
                    else
                    {
                        postInfo.Digged = Utils.InArray(postInfo.Pid.ToString(), diggedPidList); //diggslist.Contains(reader["pid"].ToString());
                    }
                }
            }
        }
Example #2
0
        /// <summary>
        /// 获取当前页数和页面ID
        /// </summary>
        public void BindPageCountAndId()
        {
            ppp = (ppp <= 0 ? config.Ppp : ppp);
            if (DNTRequest.GetInt("stand", 0) == 0)
            {
                postcount = Posts.GetPostCountByPosterId(onlyauthor, topicid, topic.Posterid, topic.Replies);
            }
            else
            {
                postcount = Debates.GetDebatePostCountByPosterId(onlyauthor, topicid, topic.Posterid, topic.Replies, DNTRequest.GetInt("stand", 0));
            }

            //获取总页数
            pagecount = postcount % ppp == 0 ? postcount / ppp : postcount / ppp + 1;
            if (pagecount == 0)
            {
                pagecount = 1;
            }

            // 得到当前用户请求的页数
            pageid = DNTRequest.GetString("page").ToLower().Equals("end") ? pagecount : DNTRequest.GetInt("page", 1);
            //如果指定了要定位的帖子ID
            if (postid > 0)
            {
                pageid = Posts.GetPostCountBeforePid(postid, topicid) / ppp + 1;
            }


            //修正请求页数中可能的错误
            pageid = pageid < 1 ? 1 : pageid;
            pageid = pageid > pagecount ? pagecount : pageid;
        }
        // POST api/debates
        public Response Post([FromBody] Debates newDebate)
        {
            Response answer = new Response();

            try
            {
                var query = from a in db.Users
                            where a.Id == newDebate.Autor
                            select a;
                if (query.Count() == 0)
                {
                    answer.State   = 1;
                    answer.Message = "El usuario no se encuentra registrado";
                }
                else
                {
                    newDebate.FechaPublicacion = DateTime.Now;
                    db.Debates.Add(newDebate);
                    db.SaveChanges();
                    answer.State   = 0;
                    answer.Message = "Debate subido correctamente";
                }
            }
            catch (Exception ex)
            {
                answer.State   = 1;
                answer.Message = ex.Message;
                return(answer);
            }
            return(answer);
        }
Example #4
0
        /// <summary>
        /// 获取辩论信息
        /// </summary>
        public void GetDebateInfo(PostpramsInfo postpramsInfo)
        {
            debateexpand = Debates.GetDebateTopic(topicid);
            debateList   = Debates.GetPostDebateList(topicid);//通过TID得到帖子观点
            if (debateexpand.Terminaltime < DateTime.Now)
            {
                isenddebate = true;
            }

            int positivepostlistcount = Debates.GetDebatesPostCount(postpramsInfo, 1);
            int negativepostlistcount = Debates.GetDebatesPostCount(postpramsInfo, 2);

            positivepagecount = (positivepostlistcount % pagesize == 0) ? (positivepostlistcount / pagesize) : (positivepostlistcount / pagesize + 1);
            negativepagecount = (negativepostlistcount % pagesize == 0) ? (negativepostlistcount / pagesize) : (negativepostlistcount / pagesize + 1);

            positivepagenumbers = Utils.GetAjaxPageNumbers(1, positivepagecount, "showdebatepage('" + forumpath + "tools/ajax.aspx?t=getdebatepostpage&opinion=1&tid=" + topic.Tid + "&{0}'," + parseurloff + ", " + smileyoff + ", " + bbcodeoff + ",'" + isenddebate + "',1," + userid + "," + topicid + ")", 8);
            negativepagenumbers = Utils.GetAjaxPageNumbers(1, negativepagecount, "showdebatepage('" + forumpath + "tools/ajax.aspx?t=getdebatepostpage&opinion=2&tid=" + topic.Tid + "&{0}'," + parseurloff + ", " + smileyoff + ", " + bbcodeoff + ",'" + isenddebate + "',2," + userid + "," + topicid + ")", 8);

            //防止无人参与时0做除数
            if (debateexpand.Negativediggs + debateexpand.Positivediggs != 0)
            {
                positivepercent = (float)debateexpand.Positivediggs / (float)(debateexpand.Negativediggs + debateexpand.Positivediggs) * 100;
                negativepercent = 100 - positivepercent;
            }

            foreach (ShowtopicPagePostInfo postlistinfo in positivepostlist)
            {
                //设置POST的观点属性
                if (debateList != null && debateList.ContainsKey(postlistinfo.Pid))
                {
                    postlistinfo.Debateopinion = Convert.ToInt32(debateList[postlistinfo.Pid]);
                }
            }
        }
Example #5
0
        /// <summary>
        /// 常规项验证
        /// </summary>
        /// <param name="admininfo"></param>
        /// <param name="postmessage"></param>
        private void NormalValidate(AdminGroupInfo admininfo, string postmessage, ShortUserInfo user)
        {
            if (ForumUtils.IsCrossSitePost())
            {
                AddErrLine("您的请求来路不正确,无法提交。如果您安装了某种默认屏蔽来路信息的个人防火墙软件(如 Norton Internet Security),请设置其不要禁止来路信息后再试。");
                return;
            }
            else if (posttitle.Length > 60)
            {
                AddErrLine("标题最大长度为60个字符,当前为 " + posttitle.Length + " 个字符");
            }

            if (Utils.StrIsNullOrEmpty(postmessage.Replace(" ", "")))
            {
                AddErrLine("内容不能为空");
            }

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

            if (topic.Special == 4 && DNTRequest.GetInt("debateopinion", 0) == 0)
            {
                AddErrLine("请选择您在辩论中的观点");
            }

            if (topic.Special == 4)
            {
                DebateInfo debateexpand = Debates.GetDebateTopic(topic.Tid);
                if (debateexpand.Terminaltime < DateTime.Now)
                {
                    AddErrLine("此辩论主题已经到期");
                }
            }

            //新用户广告强力屏蔽检查
            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("发帖失败,内容中有不符合新用户强力广告屏蔽规则的字符,请检查标题和内容,如有疑问请与管理员联系");
                        }
                    }
                }
            }
        }
Example #6
0
 private void Getdebatesjsonlist(string callback, string tidllist)
 {
     HttpContext.Current.Response.ExpiresAbsolute = DateTime.Now.AddSeconds(-1);
     HttpContext.Current.Response.Expires         = -1;
     HttpContext.Current.Response.Clear();
     HttpContext.Current.Response.Write(Debates.GetDebatesJsonList(callback, tidllist));
     HttpContext.Current.Response.End();
 }
Example #7
0
        /// <summary>
        /// 获取辩论信息
        /// </summary>
        public void GetDebateInfo()
        {
            debateexpand = Debates.GetDebateTopic(topicid);
            debateList   = Debates.GetPostDebateList(topicid);//通过TID得到帖子观点
            if (debateexpand.Terminaltime < DateTime.Now)
            {
                isenddebate = true;
            }

            foreach (ShowtopicPagePostInfo postlistinfo in postlist)
            {
                //设置POST的观点属性
                if (debateList != null && debateList.ContainsKey(postlistinfo.Pid))
                {
                    postlistinfo.Debateopinion = debateList[postlistinfo.Pid];
                }
            }
        }
Example #8
0
        public async Task <IActionResult> OnGet(string debateId)
        {
            await RestrictedPageModel.AddSessionIfRemembered(HttpContext);

            var user_id = HttpContext.Session.GetInt32("user_id");

            if (user_id == null)
            {
                return(Redirect("/login?desired_path=" + HttpContext.Request.Path.ToString()));
            }
            UserId = (int)user_id;

            Debate = await Debates.GetById(int.Parse(debateId));

            Comments = await Database.Comments.Get(Debate);

            return(null);
        }
Example #9
0
 public static void Create(IApplicationBuilder app)
 {
     app.Run(async context =>
     {
         var id = context.Session.GetInt32("user_id");
         if (id == null)
         {
             context.Response.Headers.Add("status", "not_registered");
             return;
         }
         var title   = HttpUtility.UrlDecode((string)context.Request.Headers["title"]);
         var text    = HttpUtility.UrlDecode((string)context.Request.Headers["text"]);
         using var r = new StreamReader(context.Request.Body);
         var s       = await r.ReadToEndAsync();
         var tags    = JsonConvert.DeserializeObject <string[]>(s /*.Headers["tags"]*/);
         context.Response.Headers.Add("status", "success");
         context.Response.Headers.Add("id", (await Debates.Create(title, text, tags, (int)id)).ToString());
     });
 }
Example #10
0
 public void GetDebateInfo()
 {
     this.debateexpand = Debate.FindByTid(this.topicid);
     this.debateList   = Debates.GetPostDebateList(this.topicid);
     if (this.debateexpand.Terminaled)
     {
         this.isenddebate = true;
         if (this.isenddebate)
         {
             this.canreply = false;
         }
     }
     foreach (var item in this.postlist)
     {
         if (this.debateList != null && this.debateList.ContainsKey(item.ID))
         {
             item.Debateopinion = this.debateList[item.ID];
         }
     }
 }
Example #11
0
        /// <summary>
        /// 设置相关主题信息
        /// </summary>
        /// <param name="pollitem"></param>
        /// <param name="topicprice"></param>
        /// <param name="postmessage"></param>
        private void SetTopicInfo(string[] pollitem, int topicprice, string postmessage)
        {
            if (postinfo.Layer == 0)
            {
                ///修改投票信息
                StringBuilder itemvaluelist = new StringBuilder("");
                if (topic.Special == 1)
                {
                    string pollItemname = Utils.HtmlEncode(DNTRequest.GetFormString("PollItemname").Trim());

                    if (!Utils.StrIsNullOrEmpty(pollItemname))
                    {
                        int multiple   = DNTRequest.GetString("multiple") == "on" ? 1 : 0;
                        int maxchoices = DNTRequest.GetInt("maxchoices", 0);

                        if (multiple == 1 && maxchoices > pollitem.Length)
                        {
                            maxchoices = pollitem.Length;
                        }

                        if (!Polls.UpdatePoll(topic.Tid, multiple, pollitem.Length, DNTRequest.GetFormString("PollOptionID").Trim(), pollItemname, DNTRequest.GetFormString("PollOptionDisplayOrder").Trim(), DNTRequest.GetString("enddatetime"), maxchoices, DNTRequest.GetString("visiblepoll") == "on" ? 1 : 0, DNTRequest.GetString("allowview") == "on" ? 1 : 0))
                        {
                            AddErrLine("投票错误,请检查显示顺序");
                            return;
                        }
                    }
                    else
                    {
                        AddErrLine("投票项为空");
                        return;
                    }
                }

                //修改辩论信息
                if (topic.Special == 4)
                {
                    debateinfo.Positiveopinion = DNTRequest.GetString("positiveopinion");
                    debateinfo.Negativeopinion = DNTRequest.GetString("negativeopinion");
                    debateinfo.Terminaltime    = TypeConverter.StrToDateTime(DNTRequest.GetString("terminaltime"));
                    if (!Debates.UpdateDebateTopic(debateinfo))
                    {
                        AddErrLine("辩论修改选择了无效的主题");
                        return;
                    }
                }

                int iconid = DNTRequest.GetInt("iconid", 0);
                topic.Iconid = (iconid > 15 || iconid < 0) ? 0 : iconid;
                topic.Title  = postinfo.Title;

                //悬赏差价处理
                if (topic.Special == 2)
                {
                    int pricediff = topicprice - topic.Price;
                    if (pricediff > 0)
                    {
                        if (bonusCreditsTrans < 1 || bonusCreditsTrans > 8)
                        {
                            AddErrLine("系统未设置\"交易积分设置\", 无法判断当前要使用的(扩展)积分字段, 暂时无法发布悬赏"); return;
                        }
                        //扣分
                        if (usergroupinfo.Radminid != 1 && Users.GetUserExtCredits(topic.Posterid, bonusCreditsTrans) < pricediff)
                        {
                            AddErrLine("主题作者 " + Scoresets.GetValidScoreName()[bonusCreditsTrans] + " 不足, 无法追加悬赏");
                            return;
                        }
                        else
                        {
                            topic.Price = topicprice;
                            Users.UpdateUserExtCredits(topic.Posterid, bonusCreditsTrans,
                                                       -pricediff * (Scoresets.GetCreditsTax() + 1)); //计算税后的实际支付
                        }
                    }
                    else if (pricediff < 0 && usergroupinfo.Radminid != 1)
                    {
                        AddErrLine("不能降低悬赏价格");
                        return;
                    }
                }
                else if (topic.Special == 0)//普通主题,出售
                {
                    topic.Price = topicprice;
                }
                if (usergroupinfo.Allowsetreadperm == 1)
                {
                    topic.Readperm = DNTRequest.GetInt("topicreadperm", 0) > 255 ? 255 : DNTRequest.GetInt("topicreadperm", 0);
                }

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

                topic.Typeid = DNTRequest.GetFormInt("typeid", 0);

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

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

                ForumTags.DeleteTopicTags(topic.Tid);
                Topics.DeleteRelatedTopics(topic.Tid);
                string tags = DNTRequest.GetString("tags").Trim();
                if (enabletag && !Utils.StrIsNullOrEmpty(tags))
                {
                    if (ForumUtils.InBanWordArray(tags))
                    {
                        AddErrLine("标签中含有系统禁止词语,请修改");
                        return;
                    }

                    string[] tagArray = Utils.SplitString(tags, " ", true, 2, 10);
                    if (tagArray.Length > 0 && tagArray.Length <= 5)
                    {
                        topic.Magic = Topics.SetMagicValue(topic.Magic, MagicType.TopicTag, 1);
                        ForumTags.CreateTopicTags(tagArray, topic.Tid, userid, Utils.GetDateTime());
                    }
                    else
                    {
                        AddErrLine("超过标签数的最大限制或单个标签长度没有介于2-10之间,最多可填写 5 个标签");
                        return;
                    }
                }

                Topics.UpdateTopic(topic);

                //保存htmltitle
                if (canhtmltitle && !Utils.StrIsNullOrEmpty(htmltitle) && htmltitle != topic.Title)
                {
                    Topics.WriteHtmlTitleFile(Utils.RemoveUnsafeHtml(htmltitle), topic.Tid);
                }
            }
            else
            {
                if (ForumUtils.IsHidePost(postmessage) && usergroupinfo.Allowhidecode == 1)
                {
                    topic.Hide = 1;
                    Topics.UpdateTopic(topic);
                }
            }
        }
Example #12
0
        protected override void ShowPage()
        {
            //pagetitle = "编辑帖子";
            #region 判断是否是灌水
            AdminGroupInfo admininfo = AdminGroups.GetAdminGroupInfo(usergroupid);
            this.disablepostctrl = 0;
            if (admininfo != null)
            {
                disablepostctrl = admininfo.Disablepostctrl;
            }
            #endregion

            if (userid == -1)
            {
                forum    = new ForumInfo();
                topic    = new TopicInfo();
                postinfo = new PostInfo();
                AddErrLine("您尚未登录");
                return;
            }

            #region 获取帖子和主题相关信息
            // 如果帖子ID非数字
            if (postid == -1)
            {
                AddErrLine("无效的帖子ID");
                return;
            }

            postinfo = Posts.GetPostInfo(topicid, postid);
            // 如果帖子不存在
            if (postinfo == null)
            {
                AddErrLine("不存在的帖子ID");
                return;
            }
            pagetitle   = (postinfo.Title == "") ? "编辑帖子" : postinfo.Title;
            htmlon      = postinfo.Htmlon;
            message     = postinfo.Message;
            isfirstpost = postinfo.Layer == 0;

            // 获取主题ID
            if (topicid != postinfo.Tid || postinfo.Tid == -1)
            {
                AddErrLine("无效的主题ID");
                return;
            }

            // 获取该主题的信息
            topic = Topics.GetTopicInfo(postinfo.Tid);
            // 如果该主题不存在
            if (topic == null)
            {
                AddErrLine("不存在的主题ID");
                return;
            }

            if (topic.Special == 1 && postinfo.Layer == 0)
            {
                pollinfo       = Polls.GetPollInfo(topic.Tid);
                polloptionlist = Polls.GetPollOptionList(topic.Tid);
            }

            if (topic.Special == 4 && postinfo.Layer == 0)
            {
                debateinfo = Debates.GetDebateTopic(topic.Tid);
            }

            #endregion

            #region 获取并检查版块信息
            ///得到所在版块信息
            forumid   = topic.Fid;
            forum     = Forums.GetForumInfo(forumid);
            needaudit = UserAuthority.NeedAudit(forum, useradminid, topic, userid, disablepostctrl, usergroupinfo);
            // 如果该版块不存在
            if (forum == null || forum.Layer == 0)
            {
                AddErrLine("版块已不存在");
                forum = new ForumInfo();
                return;
            }

            if (!Utils.StrIsNullOrEmpty(forum.Password) && Utils.MD5(forum.Password) != ForumUtils.GetCookie("forum" + forumid + "password"))
            {
                AddErrLine("本版块被管理员设置了密码");
                SetBackLink(base.ShowForumAspxRewrite(forumid, 0));
                return;
            }

            if (forum.Applytopictype == 1)  //启用主题分类
            {
                topictypeselectoptions = Forums.GetCurrentTopicTypesOption(forum.Fid, forum.Topictypes);
            }
            customeditbuttons = Caches.GetCustomEditButtonList();
            #endregion

            //是否有编辑帖子的权限
            if (!UserAuthority.CanEditPost(postinfo, userid, useradminid, ref msg))
            {
                AddErrLine(msg);
                return;
            }
            #region  附件信息绑定
            //得到用户可以上传的文件类型
            string attachmentTypeSelect = Attachments.GetAllowAttachmentType(usergroupinfo, forum);
            attachextensions       = Attachments.GetAttachmentTypeArray(attachmentTypeSelect);
            attachextensionsnosize = Attachments.GetAttachmentTypeString(attachmentTypeSelect);
            //得到今天允许用户上传的附件总大小(字节)
            int MaxTodaySize = (userid > 0 ? MaxTodaySize = Attachments.GetUploadFileSizeByuserid(userid) : 0);
            attachsize = usergroupinfo.Maxsizeperday - MaxTodaySize;//今天可上传得大小
            //是否有上传附件的权限
            canpostattach = UserAuthority.PostAttachAuthority(forum, usergroupinfo, userid, ref msg);

            userinfo = Users.GetShortUserInfo(userid);
            if (canpostattach && (config.Enablealbum == 1) && apb != null &&
                (UserGroups.GetUserGroupInfo(userinfo.Groupid).Maxspacephotosize - apb.GetPhotoSizeByUserid(userid) > 0))
            {
                caninsertalbum = true;
                albumlist      = apb.GetSpaceAlbumByUserId(userid);
            }
            else
            {
                caninsertalbum = false;
            }

            attachmentlist  = Attachments.GetAttachmentListByPid(postinfo.Pid);
            attachmentcount = attachmentlist.Rows.Count;
            //当前用户是否有允许下载附件权限
            allowviewattach = UserAuthority.DownloadAttachment(forum, userid, usergroupinfo);

            #endregion

            smileyoff          = (!DNTRequest.IsPost()) ? postinfo.Smileyoff : 1 - forum.Allowsmilies;
            allowimg           = forum.Allowimgcode;
            parseurloff        = postinfo.Parseurloff;
            bbcodeoff          = (usergroupinfo.Allowcusbbcode == 1) ? postinfo.Bbcodeoff : 1;
            usesig             = postinfo.Usesig;
            userextcreditsinfo = Scoresets.GetScoreSet(Scoresets.GetTopicAttachCreditsTrans());
            if (bonusCreditsTrans > 0 && bonusCreditsTrans < 9)
            {
                bonusextcreditsinfo = Scoresets.GetScoreSet(bonusCreditsTrans);
                mybonustranscredits = Users.GetUserExtCredits(userid, bonusCreditsTrans);
            }

            //是否有访问当前版块的权限
            if (!UserAuthority.VisitAuthority(forum, usergroupinfo, userid, ref msg))
            {
                AddErrLine(msg);
                return;
            }

            // 判断当前用户是否有修改权限, 检查是否具有版主的身份
            if (!Moderators.IsModer(useradminid, userid, forumid))
            {
                if (postinfo.Posterid != userid)
                {
                    AddErrLine("你并非作者, 且你当前的身份 \"" + usergroupinfo.Grouptitle + "\" 没有修改该帖的权限");
                    return;
                }
                else if (config.Edittimelimit > 0 && Utils.StrDateDiffMinutes(postinfo.Postdatetime, config.Edittimelimit) > 0)
                {
                    AddErrLine("抱歉, 系统规定只能在帖子发表" + config.Edittimelimit + "分钟内才可以修改");
                    return;
                }
                else if (config.Edittimelimit == -1)
                {
                    AddErrLine("抱歉,系统不允许修改帖子");
                    return;
                }
            }

            #region htmltitle标题
            if (postinfo.Layer == 0)
            {
                canhtmltitle = usergroupinfo.Allowhtmltitle == 1;
            }

            if (Topics.GetMagicValue(topic.Magic, MagicType.HtmlTitle) == 1)
            {
                htmltitle = Topics.GetHtmlTitle(topic.Tid).Replace("\"", "\\\"").Replace("'", "\\'");
            }
            #endregion

            #region tag信息
            enabletag = (config.Enabletag & forum.Allowtag) == 1;
            if (enabletag && Topics.GetMagicValue(topic.Magic, MagicType.TopicTag) == 1)
            {
                foreach (TagInfo tag in ForumTags.GetTagsListByTopic(topic.Tid))
                {
                    if (tag.Orderid > -1)
                    {
                        topictags += string.Format(" {0}", tag.Tagname);
                    }
                }
                topictags = topictags.Trim();
            }
            #endregion
            userGroupInfoList.Sort(delegate(UserGroupInfo x, UserGroupInfo y) { return((x.Readaccess - y.Readaccess) + (y.Groupid - x.Groupid)); });
            //如果是提交...
            if (ispost)
            {
                SetBackLink("editpost.aspx?topicid=" + postinfo.Tid + "&postid=" + postinfo.Pid);

                if (ForumUtils.IsCrossSitePost())
                {
                    AddErrLine("您的请求来路不正确,无法提交。如果您安装了某种默认屏蔽来路信息的个人防火墙软件(如 Norton Internet Security),请设置其不要禁止来路信息后再试。");
                    return;
                }

                //设置相关帖子信息
                SetPostInfo(admininfo, userinfo, Utils.StrToInt(DNTRequest.GetString("htmlon"), 0) == 1);

                if (IsErr())
                {
                    return;
                }

                //通过验证的用户可以编辑帖子
                Posts.UpdatePost(postinfo);

                //设置附件相关信息
                System.Text.StringBuilder sb = SetAttachmentInfo();

                if (IsErr())
                {
                    return;
                }

                UserCredits.UpdateUserCredits(userid);

                #region 设置提示信息和跳转链接
                //辩论地址
                if (topic.Special == 4)
                {
                    SetUrl(Urls.ShowDebateAspxRewrite(topic.Tid));
                }
                else if (DNTRequest.GetQueryString("referer") != "")//ajax快速回复将传递referer参数
                {
                    SetUrl(string.Format("showtopic.aspx?page=end&forumpage={2}&topicid={0}#{1}", topic.Tid, postinfo.Pid, forumpageid));
                }
                else if (pageid != "")//如果不是ajax,则应该是带pageid的参数
                {
                    if (config.Aspxrewrite == 1)
                    {
                        SetUrl(string.Format("showtopic-{0}-{2}{1}#{3}", topic.Tid, config.Extname, DNTRequest.GetString("pageid"), postinfo.Pid));
                    }
                    else
                    {
                        SetUrl(string.Format("showtopic.aspx?topicid={0}&forumpage={3}&page={2}#{1}", topic.Tid, postinfo.Pid, DNTRequest.GetString("pageid"), forumpageid));
                    }
                }
                else//如果都为空.就跳转到第一页(以免意外情况)
                {
                    if (config.Aspxrewrite == 1)
                    {
                        SetUrl(string.Format("showtopic-{0}{1}", topic.Tid, config.Extname));
                    }
                    else
                    {
                        SetUrl(string.Format("showtopic.aspx?topicid={0}&forumpage={1}", topic.Tid, forumpageid));
                    }
                }

                if (sb.Length > 0)
                {
                    SetMetaRefresh(5);
                    SetShowBackLink(true);
                    if (infloat == 1)
                    {
                        AddErrLine(sb.ToString());
                        return;
                    }
                    else
                    {
                        sb.Insert(0, "<table cellspacing=\"0\" cellpadding=\"4\" border=\"0\"><tr><td colspan=2 align=\"left\"><span class=\"bold\"><nobr>编辑帖子成功,但图片/附件上传出现问题:</nobr></span><br /></td></tr>");
                        sb.Append("</table>");
                        AddMsgLine(sb.ToString());
                    }
                }
                else
                {
                    //编辑主题和回复需要审核
                    if (postinfo.Layer == 0)
                    {
                        SetMetaRefresh(2, base.ShowForumAspxRewrite(forumid, forumpageid));
                    }
                    else
                    {
                        SetMetaRefresh();
                    }
                    SetShowBackLink(false);

                    if (useradminid != 1 && (needaudit || topic.Displayorder == -2 || postinfo.Invisible == 1))
                    {
                        if (postinfo.Layer == 0)
                        {
                            SetUrl(base.ShowForumAspxRewrite(forumid, forumpageid));
                        }
                        else
                        {
                            SetUrl(base.ShowTopicAspxRewrite(topic.Tid, forumpageid));
                        }
                        AddMsgLine("编辑成功, 但需要经过审核才可以显示");
                    }
                    else
                    {
                        MsgForward("editpost_succeed");
                        AddMsgLine("编辑帖子成功, 返回该主题");
                    }
                }
                #endregion

                // 删除主题游客缓存
                if (postinfo.Layer == 0)
                {
                    ForumUtils.DeleteTopicCacheFile(topic.Tid);
                }
            }
            else
            {
                AddLinkCss(BaseConfigs.GetForumPath + "templates/" + templatepath + "/editor.css", "css");
            }
        }
Example #13
0
        public AjaxPage()
        {
            config = GeneralConfigs.GetConfig();
            //如果是Flash提交
            if (Utils.StrIsNullOrEmpty(DNTRequest.GetUrlReferrer()))
            {
                string[] input    = DecodeUid(DNTRequest.GetString("input")).Split(','); //下标0为Uid,1为Olid
                UserInfo userInfo = Users.GetUserInfo(TypeConverter.StrToInt((input[0])));
                if (userInfo == null || DNTRequest.GetString("appid") != Utils.MD5(userInfo.Username + userInfo.Password + userInfo.Uid + input[1]))
                {
                    return;
                }
            }
            else if (ForumUtils.IsCrossSitePost(DNTRequest.GetUrlReferrer(), DNTRequest.GetHost())) //如果是跨站提交...
            {
                return;
            }


            string type = DNTRequest.GetString("t");

            if (Utils.InArray(type, "deleteattach,getattachlist,deletepostsbyuidanddays,deletepost,ignorepost,passpost,deletetopic,ignoretopic,passtopic,getimagelist,getblocklist,getpagelist,forumtree,topictree,quickreply,report,getdebatepostpage,confirmbuyattach,getnewpms,getnewnotifications,getajaxforums,checkuserextcredit,diggdebates,imagelist,debatevote"))
            {
                //如果需要验证用户身份,跳转至继承了PageBase的页面
                try
                {
                    HttpContext.Current.Server.Transfer("sessionajax.aspx?t=" + type + "&reason=" + DNTRequest.GetString("reason"));
                }
                catch //子页面请求错误,期待更好方案
                { }
                return;
            }
            switch (type)
            {
            case "checkusername":
                CheckUserName();        //检查用户名是否存在
                break;

            case "album":      //相册
                GetAlbum();
                break;

            case "checkrewritename":
                CheckRewriteName();
                break;

            case "ratelist":
                GetRateLogList();       //帖子评分记录
                break;

            case "smilies":
                GetSmilies();
                break;

            case "relatekw":
                GetRelateKeyword();
                break;

            case "gettopictags":
                GetTopicTags();
                break;

            case "topicswithsametag":
                GetTopicsWithSameTag();
                break;

            case "getforumhottags":
                GetForumHotTags();
                break;

            case "getspaceposttags":
                GetSpacePostTags();
                break;

            case "getspacehottags":
                GetSpaceHotTags();
                break;

            case "getphototags":
                GetPhotoTags();
                break;

            case "getphotohottags":
                GetPhotoHotTags();
                break;

            case "getgoodstradelog":
                GetGoodsTradeLog(DNTRequest.GetInt("goodsid", 0), DNTRequest.GetInt("pagesize", 0), DNTRequest.GetInt("pageindex", 0), DNTRequest.GetString("orderby", true), DNTRequest.GetInt("ascdesc", 1));
                break;

            case "getgoodsleavewordbyid":
                GetGoodsLeaveWordById(DNTRequest.GetInt("leavewordid", 0));
                break;

            case "getgoodsleaveword":
                GetGoodsLeaveWord(DNTRequest.GetInt("goodsid", 0), DNTRequest.GetInt("pagesize", 0), DNTRequest.GetInt("pageindex", 0));
                break;

            case "ajaxgetgoodsratelist":
                GetGoodsRatesList(DNTRequest.GetInt("uid", 0), DNTRequest.GetInt("uidtype", 0), DNTRequest.GetInt("ratetype", 0), DNTRequest.GetString("filter", true));
                break;

            case "getmallhottags":
                GetMallHotTags();
                break;

            case "gethotgoods":
                GetHotGoods(DNTRequest.GetInt("days", 0), DNTRequest.GetInt("categoryid", 0), DNTRequest.GetInt("count", 0));
                break;

            case "getshopinfo":     //获取热门或新开的店铺信息
                GetShopInfoJson(DNTRequest.GetInt("shoptype", 0));
                break;

            case "getgoodslist":
                GetGoodsList(DNTRequest.GetInt("categoryid", 0), DNTRequest.GetInt("order", 0), DNTRequest.GetInt("topnumber", 0));
                break;

            case "gethotdebatetopic":
                Getdebatesjsonlist("gethotdebatetopic", DNTRequest.GetString("tidlist", true));
                break;

            case "recommenddebates":
                Getdebatesjsonlist("recommenddebates", DNTRequest.GetString("tidlist", true));
                break;

            case "addcommentdebates":
                ResponseXML(Debates.CommentDabetas(DNTRequest.GetInt("tid", 0), DNTRequest.GetString("commentdebates", true), DNTRequest.IsPost()));
                break;

            case "getpostinfo":
                GetPostInfo();
                break;

            case "getattachpaymentlog":    //获取指定符件id的附件交易日志
                GetAttachPaymentLogByAid(DNTRequest.GetInt("aid", 0));
                break;

            case "getiplist":
                GetIpList();
                break;

            case "getforumtopictypelist":
                GetForumTopicTypeList();
                break;

            case "image":
                GetImage();
                break;

            case "resetemail":
                ResetEmail();
                break;
            }
            if (DNTRequest.GetString("Filename") != "" && DNTRequest.GetString("Upload") != "")
            {
                string uid = DecodeUid(DNTRequest.GetString("input")).Split(',')[0];
                ResponseText(UploadTempAvatar(uid));
                return;
            }
            if (DNTRequest.GetString("avatar1") != "" && DNTRequest.GetString("avatar2") != "" && DNTRequest.GetString("avatar3") != "")
            {
                string uid = DecodeUid(DNTRequest.GetString("input")).Split(',')[0];
                CreateDir(uid);
                if (!(SaveAvatar("avatar1", uid) && SaveAvatar("avatar2", uid) && SaveAvatar("avatar3", uid)))
                {
                    File.Delete(Utils.GetMapPath(BaseConfigs.GetForumPath + "upload\\temp\\avatar_" + uid + ".jpg"));
                    ResponseText("<?xml version=\"1.0\" ?><root><face success=\"0\"/></root>");
                    return;
                }
                File.Delete(Utils.GetMapPath(BaseConfigs.GetForumPath + "upload\\temp\\avatar_" + uid + ".jpg"));
                ResponseText("<?xml version=\"1.0\" ?><root><face success=\"1\"/></root>");
                return;
            }
        }
Example #14
0
        /// <summary>
        /// 获取帖子参数信息(PostPramsInfo)
        /// </summary>
        /// <param name="price"></param>
        /// <returns></returns>
        public PostpramsInfo GetPostPramsInfo(int price)
        {
            //获取当前页主题列表
            PostpramsInfo postpramsInfo = new PostpramsInfo();

            postpramsInfo.Fid                    = forum.Fid;
            postpramsInfo.Tid                    = topicid;
            postpramsInfo.Jammer                 = forum.Jammer;
            postpramsInfo.Pagesize               = ppp; // 得到Ppp设置
            postpramsInfo.Pageindex              = pageid;
            postpramsInfo.Getattachperm          = forum.Getattachperm;
            postpramsInfo.Usergroupid            = usergroupid;
            postpramsInfo.Attachimgpost          = config.Attachimgpost;
            postpramsInfo.Showattachmentpath     = config.Showattachmentpath;
            postpramsInfo.Price                  = price;
            postpramsInfo.Usergroupreadaccess    = (ismoder == 1) ? int.MaxValue : usergroupinfo.Readaccess;
            postpramsInfo.CurrentUserid          = userid;
            postpramsInfo.Showimages             = forum.Allowimgcode;
            postpramsInfo.Smiliesinfo            = Smilies.GetSmiliesListWithInfo();
            postpramsInfo.Customeditorbuttoninfo = Editors.GetCustomEditButtonListWithInfo();
            postpramsInfo.Smiliesmax             = config.Smiliesmax;
            postpramsInfo.Bbcodemode             = config.Bbcodemode;
            postpramsInfo.CurrentUserGroup       = usergroupinfo;
            postpramsInfo.Topicinfo              = topic;
            //判断是否为回复可见帖, hide=0为不解析[hide]标签, hide>0解析为回复可见字样, hide=-1解析为以下内容回复可见字样显示真实内容
            //将逻辑判断放入取列表的循环中处理,此处只做是否为回复人的判断,主题作者也该可见
            postpramsInfo.Hide = topic.Hide >= 1 ? (ismoder == 1 || Posts.IsReplier(topicid, userid) ? -1 : topic.Hide) : topic.Hide;
            //postpramsInfo.Hide = ismoder == 1 || Posts.IsReplier(topicid, userid) ? -1 : 1;
            postpramsInfo.Hide = topic.Posterid == userid ? -2 : postpramsInfo.Hide;
            hide = postpramsInfo.Hide;
            postpramsInfo.Condition     = Posts.GetPostPramsInfoCondition(onlyauthor, topicid, posterid);
            postpramsInfo.TemplateWidth = Templates.GetTemplateWidth(templatepath);//获取当前模版的宽度
            postpramsInfo.Usercredits   = userInfo == null ? 0 : userInfo.Credits;
            postpramsInfo.Invisible     = invisible;
            switch (stand)
            {
            case 0:
                postlist = Posts.GetPostList(postpramsInfo, out attachmentlist, ismoder == 1);
                break;

            case 1:
                postlist = Debates.GetPositivePostList(postpramsInfo, out attachmentlist, ismoder == 1);
                break;

            case 2:
                postlist = Debates.GetNegativePostList(postpramsInfo, out attachmentlist, ismoder == 1);
                break;
            }
            if (topic.Special == 4)
            {
                string pidList = "";
                foreach (ShowtopicPagePostInfo post in postlist)
                {
                    pidList += post.Pid + ",";
                }
                Dictionary <int, int> postdiggs = Debates.GetPostDiggs(pidList.Trim(','));
                foreach (ShowtopicPagePostInfo post in postlist)
                {
                    if (postdiggs.ContainsKey(post.Pid))
                    {
                        post.Diggs = postdiggs[post.Pid];
                    }
                }
            }
            if (postlist.Count == 0)
            {
                TopicAdmins.RepairTopicList(topicid.ToString());
                topic = GetTopicInfo();
                BindPageCountAndId();
                postpramsInfo.Pageindex = pagecount;
                postlist = Posts.GetPostList(postpramsInfo, out attachmentlist, ismoder == 1);
            }

            foreach (ShowtopicPageAttachmentInfo showtopicpageattachinfo in attachmentlist)
            {
                if (Forums.AllowGetAttachByUserID(forum.Permuserlist, userid))
                {
                    showtopicpageattachinfo.Getattachperm = 1;
                    showtopicpageattachinfo.Allowread     = 1;
                }
            }
            BindDownloadAttachmentTip();

            return(postpramsInfo);
        }
Example #15
0
        public AjaxPage()
        {
            //this.config = GeneralConfigInfo.Current;
            string t = DNTRequest.GetString("t");

            switch (t)
            {
            case "checkusername":
                this.CheckUserName();
                break;

            case "checkrewritename":
                //this.CheckRewriteName();
                break;

            case "ratelist":
                this.GetRateLogList();
                break;

            case "smilies":
                this.GetSmilies();
                break;

            case "relatekw":
                this.GetRelateKeyword();
                break;

            case "gettopictags":
                this.GetTopicTags();
                break;

            case "topicswithsametag":
                this.GetTopicsWithSameTag();
                break;

            case "getforumhottags":
                this.GetForumHotTags();
                break;

            case "gethotdebatetopic":
                this.Getdebatesjsonlist("gethotdebatetopic", DNTRequest.GetString("tidlist", true));
                break;

            case "recommenddebates":
                this.Getdebatesjsonlist("recommenddebates", DNTRequest.GetString("tidlist", true));
                break;

            case "addcommentdebates":
                this.ResponseXML(Debates.CommentDabetas(DNTRequest.GetInt("tid", 0), DNTRequest.GetString("commentdebates", true), DNTRequest.IsPost()));
                break;

            case "getpostinfo":
                this.GetPostInfo();
                break;

            case "getattachpaymentlog":
                this.GetAttachPaymentLogByAid(DNTRequest.GetInt("aid", 0));
                break;

            case "getiplist":
                this.GetIpList();
                break;

            case "getforumtopictypelist":
                this.GetForumTopicTypeList();
                break;

            case "image":
                this.GetImage();
                break;

            case "resetemail":
                this.ResetEmail();
                break;

            case "colorfulltags":
                ColorFullTags();
                break;

            case "closedtags":
                ClosedTags();
                break;
            }
            if (DNTRequest.GetString("Filename") != "" && DNTRequest.GetString("Upload") != "")
            {
                var uid = DecodeUid(DNTRequest.GetString("input")).Split(',')[0].ToInt(-1);
                this.ResponseText(this.UploadTempAvatar(uid));
                return;
            }
            if (DNTRequest.GetString("avatar1") != "" && DNTRequest.GetString("avatar2") != "" && DNTRequest.GetString("avatar3") != "")
            {
                var uid = DecodeUid(DNTRequest.GetString("input")).Split(',')[0];
                //this.CreateDir(uid);
                if (!this.SaveAvatar("avatar1", uid) || !this.SaveAvatar("avatar2", uid) || !this.SaveAvatar("avatar3", uid))
                {
                    //File.Delete(Utils.GetMapPath(BaseConfigs.GetForumPath + "upload\\temp\\avatar_" + uid + ".jpg"));
                    this.ResponseText("<?xml version=\"1.0\" ?><root><face success=\"0\"/></root>");
                    return;
                }
                //File.Delete(Utils.GetMapPath(BaseConfigs.GetForumPath + "upload\\temp\\avatar_" + uid + ".jpg"));
                this.ResponseText("<?xml version=\"1.0\" ?><root><face success=\"1\"/></root>");
            }
        }
Example #16
0
        public PostpramsInfo GetPostPramsInfo(int price)
        {
            var pi = new PostpramsInfo();

            pi.Fid                    = this.forum.Fid;
            pi.Tid                    = this.topicid;
            pi.Jammer                 = this.forum.Jammer;
            pi.Pagesize               = this.ppp;
            pi.Pageindex              = this.pageid;
            pi.Getattachperm          = this.forum.Getattachperm;
            pi.Usergroupid            = this.usergroupid;
            pi.Attachimgpost          = this.config.Attachimgpost;
            pi.Showattachmentpath     = this.config.Showattachmentpath;
            pi.Price                  = price;
            pi.Usergroupreadaccess    = ((this.ismoder == 1) ? 0x7FFFFFFF : this.usergroupinfo.Readaccess);
            pi.CurrentUserid          = this.userid;
            pi.Showimages             = this.forum.Allowimgcode;
            pi.Smiliesinfo            = Smilies.GetSmiliesListWithInfo();
            pi.Customeditorbuttoninfo = Editors.GetCustomEditButtonListWithInfo();
            pi.Smiliesmax             = this.config.Smiliesmax;
            pi.Bbcodemode             = this.config.Bbcodemode;
            pi.CurrentUserGroup       = this.usergroupinfo;
            //pi.Topicinfo = this.topic.Cast<TopicInfo>();
            pi.Hide          = ((this.topic.Hide >= 1) ? ((this.ismoder == 1 || Post.IsReplier(this.topicid, this.userid)) ? -1 : this.topic.Hide) : this.topic.Hide);
            pi.Hide          = ((this.topic.PosterID == this.userid) ? -2 : pi.Hide);
            this.hide        = pi.Hide;
            pi.Condition     = Posts.GetPostPramsInfoCondition(this.onlyauthor, this.topicid, this.posterid);
            pi.TemplateWidth = Template.GetWidth(this.templatepath);
            pi.Usercredits   = ((this.userInfo == null) ? 0 : this.userInfo.Credits);
            pi.Invisible     = this.invisible;
            switch (this.stand)
            {
            case 0:
                this.postlist = Posts.GetPostList(pi, out this.attachmentlist, this.ismoder == 1);
                break;

            case 1:
                this.postlist = Debates.GetPositivePostList(pi, out this.attachmentlist, this.ismoder == 1);
                break;

            case 2:
                this.postlist = Debates.GetNegativePostList(pi, out this.attachmentlist, this.ismoder == 1);
                break;
            }
            if (this.topic.Special == 4)
            {
                string text = "";
                foreach (var item in this.postlist)
                {
                    text = text + item.ID + ",";
                }
                var postDiggs = Debates.GetPostDiggs(text.Trim(','));
                foreach (var item in this.postlist)
                {
                    if (postDiggs.ContainsKey(item.ID))
                    {
                        item.Diggs = postDiggs[item.ID];
                    }
                }
            }
            if (this.postlist.Count == 0)
            {
                TopicAdmins.RepairTopicList(this.topicid.ToString());
                this.topic = base.GetTopicInfo();
                this.BindPageCountAndId();
                pi.Pageindex  = this.pagecount;
                this.postlist = Posts.GetPostList(pi, out this.attachmentlist, this.ismoder == 1);
            }
            foreach (var current3 in this.attachmentlist)
            {
                if (Forums.AllowGetAttachByUserID(this.forum.Permuserlist, this.userid))
                {
                    current3.Getattachperm = 1;
                    current3.AllowRead     = true;
                }
            }
            base.BindDownloadAttachmentTip();
            return(pi);
        }
Example #17
0
        protected override void ShowPage()
        {
            //获取主题信息
            topic = GetTopicInfo();
            if (topic == null || IsErr())
            {
                return;
            }

            topicid = topic.Tid;
            forumid = topic.Fid;
            forum   = Forums.GetForumInfo(forumid);
            if (forum == null)
            {
                AddErrLine("不存在的版块ID"); return;
            }

            pagetitle = string.Format("{0} - {1}", topic.Title, Utils.RemoveHtml(forum.Name));
            ///得到广告列表
            GetForumAds(forum.Fid);

            // 检查是否具有版主的身份
            if (useradminid != 0)
            {
                ismoder   = Moderators.IsModer(useradminid, userid, forum.Fid) ? 1 : 0;
                admininfo = AdminGroups.GetAdminGroupInfo(usergroupid); //得到管理组信息
                if (admininfo != null)
                {
                    disablepostctrl = admininfo.Disablepostctrl;
                }
            }

            //验证不通过则返回
            if (!ValidateInfo())
            {
                return;
            }

            Caches.GetTopicTypeArray().TryGetValue(topic.Typeid, out topictypes);
            topictypes = topictypes != "" ? "[" + topictypes + "]" : "";

            showratelog = GeneralConfigs.GetConfig().DisplayRateCount > 0 ? 1 : 0;
            score       = Scoresets.GetValidScoreName();
            scoreunit   = Scoresets.GetValidScoreUnit();

            //编辑器状态
            EditorState();
            navhomemenu = Caches.GetForumListMenuDivCache(usergroupid, userid, config.Extname);
            usesig      = ForumUtils.GetCookie("sigstatus") == "0" ? 0 : 1;

            int price = 0;

            if (topic.Special != 4)//不是辩论帖,就跳转到showtopic页面显示
            {
                HttpContext.Current.Response.Redirect(forumpath + this.ShowTopicAspxRewrite(topic.Tid, 1)); return;
            }

            if (topic.Moderated > 0)
            {
                moderactions = TopicAdmins.GetTopicListModeratorLog(topicid);
            }

            // 获取帖子总数
            onlyauthor = Utils.StrIsNullOrEmpty(onlyauthor) ? "0" : onlyauthor;

            // 获取分页相关信息
            BindPageCountAndId();

            PostpramsInfo postpramsInfo = GetPostPramsInfo(price);

            //获取当前正反方列表
            positivepostlist = Debates.GetPositivePostList(postpramsInfo, out attachmentlist, ismoder == 1);
            negativepostlist = Debates.GetNegativePostList(postpramsInfo, out attachmentlist, ismoder == 1);

            GetPostAds(postpramsInfo, positivepostlist.Count);

            //辩论帖
            if (topic.Special == 4)
            {
                GetDebateInfo(postpramsInfo);
            }

            enabletag = (config.Enabletag & forum.Allowtag) == 1;
            if (enabletag)
            {
                relatedtopics = Topics.GetRelatedTopicList(topicid, 5);
            }

            //更新页面Meta信息
            UpdateMetaInfo(Utils.RemoveHtml(debatepost.Message));

            ///更新主题查看次数和在线用户信息
            TopicStats.Track(topicid, 1);
            Topics.MarkOldTopic(topic);
            topicviews = topic.Views + 1 + (config.TopicQueueStats == 1 ? TopicStats.GetStoredTopicViewCount(topic.Tid) : 0);
            OnlineUsers.UpdateAction(olid, UserAction.ShowTopic.ActionID, forumid, forum.Name, topicid, topic.Title);
            BindDownloadAttachmentTip();
        }
Example #18
0
        //private bool isModer = false;

        protected override void ShowPage()
        {
            if (postid == -1)
            {
                AddErrLine("无效的帖子ID");
                return;
            }

            // 获取该帖子的信息
            post = Posts.GetPostInfo(topicid, postid);
            if (post == null)
            {
                AddErrLine("不存在的帖子ID");
                return;
            }
            // 获取该主题的信息
            topic = Topics.GetTopicInfo(topicid);
            if (topic == null)
            {
                AddErrLine("不存在的主题ID");
                return;
            }
            if (topicid != post.Tid)
            {
                AddErrLine("主题ID无效");
                return;
            }

            topictitle = topic.Title;
            forumid    = topic.Fid;
            forum      = Forums.GetForumInfo(forumid);
            forumname  = forum.Name;
            pagetitle  = string.Format("删除{0}", post.Title);
            forumnav   = ShowForumAspxRewrite(forum.Pathlist.Trim(), forumid, forumpageid);

            if (!CheckPermission(post, DNTRequest.GetInt("opinion", -1)))
            {
                return;
            }

            if (!allowDelPost)
            {
                AddErrLine("当前不允许删帖");
                return;
            }

            // 通过验证的用户可以删除帖子,如果是主题帖则另处理
            if (post.Layer == 0)
            {
                TopicAdmins.DeleteTopics(topicid.ToString(), byte.Parse(forum.Recyclebin.ToString()), false);
                //重新统计论坛帖数
                Forums.SetRealCurrentTopics(forum.Fid);
                ForumTags.DeleteTopicTags(topicid);
            }
            else
            {
                int reval;
                if (topic.Special == 4)
                {
                    if (DNTRequest.GetInt("opinion", -1) != 1 && DNTRequest.GetInt("opinion", -1) != 2)
                    {
                        AddErrLine("参数错误");
                        return;
                    }
                    reval = Posts.DeletePost(Posts.GetPostTableId(topicid), postid, false, true);
                    Debates.DeleteDebatePost(topicid, DNTRequest.GetInt("opinion", -1), postid);
                }
                else
                {
                    reval = Posts.DeletePost(Posts.GetPostTableId(topicid), postid, false, true);
                }

                // 删除主题游客缓存
                ForumUtils.DeleteTopicCacheFile(topicid);
                //再次确保回复数精确
                Topics.UpdateTopicReplyCount(topic.Tid);
                //更新指定版块的最新发帖数信息
                Forums.UpdateLastPost(forum);

                if (reval > 0 && Utils.StrDateDiffHours(post.Postdatetime, config.Losslessdel * 24) < 0)
                {
                    UserCredits.UpdateUserCreditsByDeletePosts(post.Posterid);
                }
            }

            SetUrl(post.Layer == 0 ? base.ShowForumAspxRewrite(post.Fid, 0) : Urls.ShowTopicAspxRewrite(post.Tid, 1));
            SetMetaRefresh();
            SetShowBackLink(false);
            AddMsgLine("删除帖子成功, 返回主题");
        }