/// <summary> /// 判断页面是否需要游客缓存页 /// </summary> /// <param name="pagename"></param> /// <returns>不需要返回false</returns> private bool GetUserCachePage(string pagename) { switch (pagename) { case "website.aspx": isguestcachepage = GetCachePage(pagename); break; case "forumindex.aspx": isguestcachepage = GetCachePage(pagename); break; case "spaceindex.aspx": isguestcachepage = GetCachePage(pagename); break; case "albumindex.aspx": isguestcachepage = GetCachePage(pagename); break; case "showtopic.aspx": { int pageid = DNTRequest.GetQueryInt("page", 1); int topicid = DNTRequest.GetQueryInt("topicid", 0); //参数数目为2或0表示当前页面可能为第一页帖子列表 if ((DNTRequest.GetParamCount() == 2 || DNTRequest.GetParamCount() == 3) && topicid > 0 && ForumUtils.ResponseShowTopicCacheFile(topicid, pageid)) { TopicStats.Track(topicid, 1); return(true); } break; } case "showforum.aspx": { int pageid = DNTRequest.GetQueryInt("page", 1); int forumid = DNTRequest.GetQueryInt("forumid", 0); //参数数目为2或0表示当前页面可能为第一页帖子列表 if ((DNTRequest.GetParamCount() == 2 || DNTRequest.GetParamCount() == 3) && forumid > 0 && ForumUtils.ResponseShowForumCacheFile(forumid, pageid)) { return(true); } break; } default: break; } return(false); }
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 showtopic() { // 获取主题ID int topicid = DNTRequest.GetInt("topicid", -1); // 如果主题ID非数字 if (topicid == -1) { ShowMsg("无效的主题ID"); return; } // 获取该主题的信息 TopicInfo topic = Topics.GetTopicInfo(topicid); // 如果该主题不存在 if (topic == null) { ShowMsg("不存在的主题ID"); return; } if (topic.Readperm > usergroupinfo.Readaccess && topic.Posterid != userid) { ShowMsg(string.Format("本主题阅读权限为: {0}, 您当前的身份 \"{1}\" 阅读权限不够", topic.Readperm.ToString(), usergroupinfo.Grouptitle)); return; } ForumInfo forum = Forums.GetForumInfo(topic.Fid); if (forum.Viewperm == null || forum.Viewperm == string.Empty) //当板块权限为空时,按照用户组权限 { if (usergroupinfo.Allowvisit != 1) { ShowMsg("您当前的身份 \"" + usergroupinfo.Grouptitle + "\" 没有浏览该版块的权限"); return; } } else //当板块权限不为空,按照板块权限 { if (!Forums.AllowView(forum.Viewperm, usergroupinfo.Groupid)) { ShowMsg("您没有浏览该版块的权限"); return; } } if (forum.Password != "") { ShowMsg("简洁版本无法浏览设置了密码的版块"); return; } //验证用户是否为本版版主 int ismoder = Moderators.IsModer(useradminid, userid, forum.Fid) ? 1 : 0; //购买帖子操作 //判断是否为回复可见帖, price=0为非购买可见(正常), price>0 为购买可见, price=-1为购买可见但当前用户已购买 int price = 0; if (topic.Price > 0 && userid != topic.Posterid && ismoder != 1) { price = topic.Price; //时间乘以-1是因为当Configs.GetMaxChargeSpan()==0时,帖子始终为购买帖 if (PaymentLogs.IsBuyer(topicid, userid) || (Utils.StrDateDiffHours(topic.Postdatetime, Scoresets.GetMaxChargeSpan()) > 0 && Scoresets.GetMaxChargeSpan() != 0))//判断当前用户是否已经购买 { price = -1; } } if (price > 0) { ShowMsg(string.Format("此帖需转到完整版处购买后才可查看.<a href=\"{0}buytopic.aspx?topicid={1}\">点击购买</a>", "/Forum/", topic.Tid)); return; } // 获取帖子总数 //postcount = Posts.GetPostCount(topicid); int postcount = topic.Replies + 1; int pageid = 1; // 得到Tpp设置 int ppp = 30; //获取总页数 int pagecount = postcount % ppp == 0 ? postcount / ppp : postcount / ppp + 1; if (pagecount == 0) { pagecount = 1; } // 得到当前用户请求的页数 if (DNTRequest.GetString("page").ToLower().Equals("end")) { pageid = pagecount; } else { pageid = DNTRequest.GetInt("page", 1); } //修正请求页数中可能的错误 if (pageid < 1) { pageid = 1; } if (pageid > pagecount) { pageid = pagecount; } int hide = 1; if (topic.Hide == 1 && (Posts.IsReplier(topicid, userid) || ismoder == 1)) { hide = -1; } //获取当前页主题列表 PostpramsInfo postpramsInfo = new PostpramsInfo(); postpramsInfo.Fid = forum.Fid; postpramsInfo.Tid = topicid; postpramsInfo.Jammer = forum.Jammer; postpramsInfo.Pagesize = ppp; postpramsInfo.Pageindex = pageid; postpramsInfo.Getattachperm = forum.Getattachperm; postpramsInfo.Usergroupid = usergroupinfo.Groupid; postpramsInfo.Attachimgpost = config.Attachimgpost; postpramsInfo.Showattachmentpath = config.Showattachmentpath; postpramsInfo.Hide = hide; postpramsInfo.Price = topic.Price; postpramsInfo.Usergroupreadaccess = usergroupinfo.Readaccess; postpramsInfo.CurrentUserid = userid; postpramsInfo.Showimages = forum.Allowimgcode; // 简洁版本中关闭表情符的解析 postpramsInfo.Smileyoff = 1; postpramsInfo.Smiliesmax = 0; postpramsInfo.Smiliesinfo = null; postpramsInfo.Customeditorbuttoninfo = null; postpramsInfo.Bbcodemode = 0; // 简洁版本中关闭ubb转换 postpramsInfo.Bbcodeoff = 1; postpramsInfo.CurrentUserGroup = usergroupinfo; postpramsInfo.Onlinetimeout = config.Onlinetimeout; postlist = Posts.GetPostList(postpramsInfo, out attachmentlist, ismoder == 1); if (postlist.Count <= 0) { ShowMsg("读取信息失败"); return; } ShowTitle(topic.Title); ShowBody(); HttpContext.Current.Response.Write("<h1>" + config.Forumtitle + "</h1>"); HttpContext.Current.Response.Write("<div class=\"forumnav\">"); HttpContext.Current.Response.Write("<a href=\"index.aspx\">首页</a> » "); if (config.Aspxrewrite == 1) { HttpContext.Current.Response.Write(string.Format("{0} » <a href=\"showtopic-{1}{2}\">{3}</a>", ForumUtils.UpdatePathListExtname(forum.Pathlist.Trim(), config.Extname).Replace("</a><", "</a> » <"), topicid.ToString(), config.Extname, topic.Title)); } else { HttpContext.Current.Response.Write(string.Format("{0} » <a href=\"showtopic.aspx?topicid={1}\">{2}</a>", ForumUtils.UpdatePathListExtname(forum.Pathlist.Trim(), "aspx").Replace("</a><", "</a> » <"), topicid.ToString(), topic.Title)); } HttpContext.Current.Response.Write("</div>\r\n"); foreach (ShowtopicPagePostInfo postinfo in postlist) { HttpContext.Current.Response.Write("<div class=\"postitem\">\r\n"); HttpContext.Current.Response.Write("\t<div class=\"postitemtitle\">\r\n"); HttpContext.Current.Response.Write(Utils.HtmlEncode(postinfo.Poster) + " - " + postinfo.Postdatetime); HttpContext.Current.Response.Write("</div><div class=\"postitemcontent\">"); HttpContext.Current.Response.Write(postinfo.Message); foreach (ShowtopicPageAttachmentInfo attinfo in attachmentlist) { if (attinfo.Pid == postinfo.Pid) { HttpContext.Current.Response.Write(string.Format("<br /><br />附件: <a href=\"../attachment.aspx?attachmentid={0}\">{1}</a>", attinfo.Aid.ToString(), Utils.HtmlEncode(attinfo.Attachment))); } } HttpContext.Current.Response.Write("\t</div>\r\n</div>\r\n"); } //得到页码链接 HttpContext.Current.Response.Write("<div class=\"pagenumbers\">"); if (config.Aspxrewrite == 1) { HttpContext.Current.Response.Write(Utils.GetStaticPageNumbers(pageid, pagecount, "showtopic-" + topicid.ToString(), config.Extname, 8)); } else { HttpContext.Current.Response.Write(Utils.GetPageNumbers(pageid, pagecount, "showtopic.aspx?topicid=" + topicid.ToString(), 8, "page")); } HttpContext.Current.Response.Write("</div>\r\n"); //更新查看次数 //Topics.UpdateTopicViews(topicid); TopicStats.Track(topicid, 1); if (config.Aspxrewrite == 1) { HttpContext.Current.Response.Write(string.Format("<div class=\"fullversion\">查看完整版本: <a href=\"../showtopic-{0}{1}\">{2}</a></div>\r\n", topicid.ToString(), config.Extname, topic.Title)); } else { HttpContext.Current.Response.Write(string.Format("<div class=\"fullversion\">查看完整版本: <a href=\"../showtopic.aspx?topicid={0}\">{1}</a></div>\r\n", topicid.ToString(), topic.Title)); } ShowFooter(); HttpContext.Current.Response.End(); }
protected override void ShowPage() { //获取主题信息 topic = GetTopicInfo(); if (topic == null || IsErr()) { return; } //未结束的悬赏 if (topic.Special != 3) { HttpContext.Current.Response.Redirect(BaseConfigs.GetForumPath + ShowTopicAspxRewrite(topic.Tid, 1)); 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); //检查是否具有版主的身份 IsModer(); //验证不通过则返回 if (!ValidateInfo()) { return; } //编辑器状态 EditorState(); navhomemenu = Caches.GetForumListMenuDivCache(usergroupid, userid, config.Extname); bonuslogs = Bonus.GetLogs(topic); if (topic.Moderated > 0) { moderactions = TopicAdmins.GetTopicListModeratorLog(topicid); } Caches.GetTopicTypeArray().TryGetValue(topic.Typeid, out topictypes); topictypes = topictypes != "" ? "[" + topictypes + "]" : ""; if (newpmcount > 0) { pmlist = PrivateMessages.GetPrivateMessageListForIndex(userid, 5, 1, 1); } score = Scoresets.GetValidScoreName(); scoreunit = Scoresets.GetValidScoreUnit(); GetPostAds(GetPostPramsInfo(), postlist.Count); if (postlist.Count <= 0) { AddErrLine("读取信息失败"); return; } //更新页面Meta信息 UpdateMetaInfo(Utils.RemoveHtml(postlist[0].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(); ForumUtils.WriteCookie("referer", string.Format("showbonus.aspx?topicid={0}", topicid.ToString())); }
protected override void ShowPage() { //获取主题信息 topic = GetTopicInfo(); if (topic == null) { return; } topicid = topic.Tid; forumid = topic.Fid; forum = Forums.GetForumInfo(forumid); if (forum == null) { AddErrLine("不存在的版块ID"); return; } //验证不通过则返回 if (!ValidateInfo() || IsErr()) { return; } //检查是否具有管理权限 IsModer(); int price = GetTopicPrice(topic); if (topic.Special == 0 && price > 0) { HttpContext.Current.Response.Redirect(forumpath + "buytopic.aspx?topicid=" + topic.Tid); return; } if (postid > 0 && Posts.GetPostInfo(topicid, postid) == null) { AddErrLine("该帖可能已被删除 " + string.Format("<a href=\"{0}\">[返回主题]</a>", ShowTopicAspxRewrite(topicid, 1))); return; } //将版块加入到已访问版块列表中 ForumUtils.SetVisitedForumsCookie(forumid.ToString()); if (userid > 0) { userInfo = Users.GetShortUserInfo(userid); } if (topic.Identify > 0) { topicidentify = Caches.GetTopicIdentify(topic.Identify); } pagetitle = string.Format("{0} - {1}", topic.Title, Utils.RemoveHtml(forum.Name)); ///得到广告列表 GetForumAds(forum.Fid); //获取主题类型 Caches.GetTopicTypeArray().TryGetValue(topic.Typeid, out topictypes); topictypes = Utils.StrIsNullOrEmpty(topictypes) ? "" : "[" + topictypes + "]"; userextcreditsinfo = Scoresets.GetScoreSet(Scoresets.GetTopicAttachCreditsTrans()); score = Scoresets.GetValidScoreName(); scoreunit = Scoresets.GetValidScoreUnit(); navhomemenu = Caches.GetForumListMenuDivCache(usergroupid, userid, config.Extname); //编辑器状态 EditorState(); string[] customauthorinfo = config.Customauthorinfo.Split('|'); postleftshow = customauthorinfo[0].Split(','); //帖子左边要显示的用户信息项目 userfaceshow = customauthorinfo[1].Split(','); //头像上方要显示的项目 //if (newpmcount > 0) // pmlist = PrivateMessages.GetPrivateMessageListForIndex(userid, 5, 1, 1); onlyauthor = (onlyauthor == "1" || onlyauthor == "2") ? onlyauthor : "0"; // 获取分页相关信息 BindPageCountAndId(); GetPostAds(GetPostPramsInfo(price), postlist.Count); #region 获取特殊主题相关信息 bonuslogs = Bonus.GetLogs(topic); if (topic.Special == 1)//获取投票信息 { GetPollInfo(); } if (topic.Special == 4) //获取辩论信息 { GetDebateInfo(); } #endregion enabletag = (config.Enabletag & forum.Allowtag) == 1; //if (enabletag) // relatedtopics = Topics.GetRelatedTopicList(topicid, 5); //更新页面Meta信息 if (postlist != null && postlist.Count > 0) { UpdateMetaInfo(Utils.RemoveHtml(postlist[0].Message)); } //判断是否需要生成游客缓存页面 IsGuestCachePage(); //更新主题查看次数和在线用户信息 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); //如果是从 if (DNTRequest.GetInt("fromfav", 0) > 0) { Favorites.UpdateUserFavoriteViewTime(userid, topicid); } //UserCredits.UpdateUserCredits(userInfo);此方法与后台积分设置中的条目不匹配,故注释 }