/// <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); }
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(); }
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); }