public void AddRange(TopicIdentify[] value) { for (int i = 0; (i < value.Length); i = (i + 1)) { this.Add(value[i]); } }
public void Remove(TopicIdentify value) { List.Remove(value); }
public void Insert(int index, TopicIdentify value) { List.Insert(index, value); }
public int IndexOf(TopicIdentify value) { return this.List.IndexOf(value); }
public void CopyTo(TopicIdentify[] array, int index) { this.List.CopyTo(array, index); }
public bool Contains(TopicIdentify value) { return this.List.Contains(value); }
public TopicIdentifyCollection(TopicIdentify[] value) { this.AddRange(value); }
public int Add(TopicIdentify value) { return this.List.Add(value); }
protected override void ShowPage() { headerad = ""; footerad = ""; postleaderboardad = ""; doublead = ""; floatad = ""; allowrate = false; disablepostctrl = 0; // 获取主题ID topicid = DNTRequest.GetInt("topicid", -1); // 获取该主题的信息 string go = DNTRequest.GetString("go").Trim().ToLower(); int fid = DNTRequest.GetInt("forumid", 0); firstpagesmilies = Caches.GetSmiliesFirstPageCache(); if (go == "") { fid = 0; } else if (fid == 0) { go = ""; } string errmsg = ""; switch (go) { case "prev": topic = Topics.GetTopicInfo(topicid, fid, 1); errmsg = "没有更旧的主题, 请返回"; break; case "next": topic = Topics.GetTopicInfo(topicid, fid, 2); errmsg = "没有更新的主题, 请返回"; break; default: topic = Topics.GetTopicInfo(topicid); errmsg = "该主题不存在"; break; } if (topic == null) { AddErrLine(errmsg); headerad = Advertisements.GetOneHeaderAd("", 0); footerad = Advertisements.GetOneFooterAd("", 0); pagewordad = Advertisements.GetPageWordAd("", 0); doublead = Advertisements.GetDoubleAd("", 0); floatad = Advertisements.GetFloatAd("", 0); return; } if (topic.Identify > 0) { topicidentify = Caches.GetTopicIdentify(topic.Identify); } topicid = topic.Tid; forumid = topic.Fid; forum = Forums.GetForumInfo(forumid); forumname = forum.Name; pagetitle = topic.Title; forumnav = ForumUtils.UpdatePathListExtname(forum.Pathlist.Trim(), config.Extname); navhomemenu = Caches.GetForumListMenuDivCache(usergroupid, userid, config.Extname); fid = forumid; ///得到广告列表 ///头部 headerad = Advertisements.GetOneHeaderAd("", fid); footerad = Advertisements.GetOneFooterAd("", fid); postleaderboardad = Advertisements.GetOnePostLeaderboardAD("", fid); pagewordad = Advertisements.GetPageWordAd("", fid); doublead = Advertisements.GetDoubleAd("", fid); floatad = Advertisements.GetFloatAd("", fid); // 检查是否具有版主的身份 if (useradminid != 0) { ismoder = Moderators.IsModer(useradminid, userid, forumid) ? 1 : 0; //得到管理组信息 admininfo = AdminGroups.GetAdminGroupInfo(useradminid); if (admininfo != null) { disablepostctrl = admininfo.Disablepostctrl; } } //验证不通过则返回 if (!IsConditionsValid()) return; showratelog = GeneralConfigs.GetConfig().DisplayRateCount > 0 ? 1 : 0; topictitle = topic.Title.Trim(); replytitle = topictitle; if (replytitle.Length >= 50) { replytitle = Utils.CutString(replytitle, 0, 50) + "..."; } //topicmagic = ForumUtils.ShowTopicMagic(topic.Magic); topicviews = topic.Views + 1 + (config.TopicQueueStats == 1 ? TopicStats.GetStoredTopicViewCount(topic.Tid) : 0); smilies = Caches.GetSmiliesCache(); smilietypes = Caches.GetSmilieTypesCache(); //编辑器状态 StringBuilder sb = new StringBuilder(); sb.Append("var Allowhtml=1;\r\n"); //+ allhtml.ToString() + " parseurloff = 0; smileyoff = 1 - forum.Allowsmilies; sb.Append("var Allowsmilies=" + (1 - smileyoff).ToString() + ";\r\n"); bbcodeoff = 1; if (forum.Allowbbcode == 1) { if (usergroupinfo.Allowcusbbcode == 1) { bbcodeoff = 0; } } sb.Append("var Allowbbcode=" + (1 - bbcodeoff).ToString() + ";\r\n"); usesig = ForumUtils.GetCookie("sigstatus") == "0" ? 0 : 1; allowimg = forum.Allowimgcode; sb.Append("var Allowimgcode=" + allowimg.ToString() + ";\r\n"); AddScript(sb.ToString()); int price = 0; if (topic.Special == 0)//普通主题 { //购买帖子操作 //判断是否为购买可见帖, price=0为非购买可见(正常), price>0 为购买可见, price=-1为购买可见但当前用户已购买 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; } } try { if (price > 0) { if (userid > 0) { float extcredits2 = Discuz.Forum.Users.GetUserExtCredits(userid, 2); if (extcredits2 < price) { //HttpContext.Current.Response.Redirect(forumpath + "buytopic.aspx?topicid=" + topic.Tid); AddErrLine("抱歉,您的金币已不足以浏览该帖!"); return; } } else { AddErrLine("您当前的身份是游客,需要登录才能浏览该帖"); } } } catch { AddErrLine("您当前的身份是游客,需要登录才能浏览该帖"); } } if (topic.Special == 3)//已给分的悬赏帖 { bonuslogs = Bonus.GetLogs(topic.Tid); } if (topic.Moderated > 0) { moderactions = TopicAdmins.GetTopicListModeratorLog(topicid); } try { topictypes = Caches.GetTopicTypeArray()[topic.Typeid].ToString(); topictypes = topictypes != "" ? "[" + topictypes + "]" : ""; } catch { } userextcreditsinfo = Scoresets.GetScoreSet(Scoresets.GetCreditsTrans()); if (newpmcount > 0) { pmlist = PrivateMessages.GetPrivateMessageCollectionForIndex(userid, 5, 1, 1); showpmhint = Convert.ToInt32(Discuz.Forum.Users.GetShortUserInfo(userid).Newsletter) > 4; } ispoll = false; allowvote = false; if (topic.Special == 1) { ispoll = true; polloptionlist = Polls.GetPollOptionList(topicid); pollinfo = Polls.GetPollInfo(topicid); voters = Polls.GetVoters(topicid, userid, username, out allowvote); if (pollinfo.Uid != userid && useradminid != 1) //当前用户不是投票发起人或不是管理组成员 { if (pollinfo.Visible == 1 && //当为投票才可见时 (allowvote || (userid == -1 && !Utils.InArray(topicid.ToString(), ForumUtils.GetCookie("dnt_polled")))))//当允许投票或为游客(且并未投过票时)时 { showpollresult = false; } } } if (ispoll) { if (Utils.StrIsNullOrEmpty(pollinfo.Expiration)) { //AddErrLine("读取信息失败"); //return; pollinfo.Expiration = DateTime.Now.ToString(); } if (DateTime.Parse(pollinfo.Expiration) < DateTime.Now) { allowvote = false; } } // 获取帖子总数 //postcount = Posts.GetPostCount(topicid); onlyauthor = DNTRequest.GetString("onlyauthor"); if (onlyauthor == "" || onlyauthor == "0") { postcount = topic.Replies + 1; } else { postcount = DatabaseProvider.GetInstance().GetPostCount(Posts.GetPostTableID(topicid), topicid, topic.Posterid); } // 得到Ppp设置 ppp = Utils.StrToInt(ForumUtils.GetCookie("ppp"), config.Ppp); if (ppp <= 0) { ppp = config.Ppp; } //获取总页数 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; } //判断是否为回复可见帖, hide=0为不解析[hide]标签, hide>0解析为回复可见字样, hide=-1解析为以下内容回复可见字样显示真实内容 //将逻辑判断放入取列表的循环中处理,此处只做是否为回复人的判断,主题作者也该可见 int hide = 1; if (topic.Hide == 1 && (Posts.IsReplier(topicid, userid) || ismoder == 1)) { hide = -1; } //获取当前页主题列表 DataSet ds = new DataSet(); 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 = usergroupid; postpramsInfo.Attachimgpost = config.Attachimgpost; postpramsInfo.Showattachmentpath = config.Showattachmentpath; postpramsInfo.Hide = hide; postpramsInfo.Price = price; postpramsInfo.Usergroupreadaccess = usergroupinfo.Readaccess; if (ismoder == 1) postpramsInfo.Usergroupreadaccess = int.MaxValue; 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; if (!(onlyauthor.Equals("") || onlyauthor.Equals("0"))) { postpramsInfo.Condition = string.Format(" {0}.posterid={1}", Posts.GetPostTableName(topicid), topic.Posterid); } 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; } } if (topic.Special == 4) { 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 = Convert.ToInt32(debateList[postlistinfo.Pid]); } } //加载帖内广告 inpostad = Advertisements.GetInPostAd("", fid, templatepath, postlist.Count > ppp ? ppp : postlist.Count); //快速发帖广告 quickeditorad = Advertisements.GetQuickEditorAD("", fid); //快速编辑器背景广告 string[] quickbgad = Advertisements.GetQuickEditorBgAd("", fid); if (quickbgad.Length > 1) { quickbgadimg = quickbgad[0]; quickbgadlink = quickbgad[1]; } if (postlist.Count <= 0) { AddErrLine("读取信息失败"); return; } //更新页面Meta中的Description项, 提高SEO友好性 string metadescritpion = Utils.RemoveHtml(postlist[0].Message); metadescritpion = metadescritpion.Length > 100 ? metadescritpion.Substring(0, 100) : metadescritpion; UpdateMetaInfo(config.Seokeywords, metadescritpion, config.Seohead); //获取相关主题集合 enabletag = (config.Enabletag & forum.Allowtag) == 1; if (enabletag) { relatedtopics = Topics.GetRelatedTopics(topicid, 5); } //得到页码链接 if (onlyauthor == "" || onlyauthor == "0") { if (config.Aspxrewrite == 1) { pagenumbers = Utils.GetStaticPageNumbers(pageid, pagecount, "showtopic-" + topicid.ToString(), config.Extname, 8); } else { pagenumbers = Utils.GetPageNumbers(pageid, pagecount, "showtopic.aspx?topicid=" + topicid.ToString(), 8); } } else { pagenumbers = Utils.GetPageNumbers(pageid, pagecount, "showtopic.aspx?onlyauthor=1&topicid=" + topicid, 8); } //更新查看次数 //Topics.UpdateTopicViews(topicid); TopicStats.Track(topicid, 1); OnlineUsers.UpdateAction(olid, UserAction.ShowTopic.ActionID, forumid, forumname, topicid, topictitle, config.Onlinetimeout); forumlistboxoptions = Caches.GetForumListBoxOptionsCache(); //得到页码链接 if (onlyauthor == "" || onlyauthor == "0") { ForumUtils.WriteCookie("referer", string.Format("showtopic.aspx?topicid={0}&page={1}", topicid.ToString(), pageid.ToString())); } else { ForumUtils.WriteCookie("referer", string.Format("showtopic.aspx?onlyauthor=1&topicid={0}&page={1}", topicid.ToString(), pageid.ToString())); } score = Scoresets.GetValidScoreName(); scoreunit = Scoresets.GetValidScoreUnit(); string oldtopic = ForumUtils.GetCookie("oldtopic") + "D"; if (oldtopic.IndexOf("D" + topic.Tid.ToString() + "D") == -1 && DateTime.Now.AddMinutes(-1 * 600) < DateTime.Parse(topic.Lastpost)) { oldtopic = "D" + topic.Tid.ToString() + Utils.CutString(oldtopic, 0, oldtopic.Length - 1); if (oldtopic.Length > 3000) { oldtopic = Utils.CutString(oldtopic, 0, 3000); oldtopic = Utils.CutString(oldtopic, 0, oldtopic.LastIndexOf("D")); } ForumUtils.WriteCookie("oldtopic", oldtopic); } // 判断是否需要生成游客缓存页面 if (userid == -1 && pageid == 1) { int topiccachemark = 100 - (int) (topic.Displayorder * 15 + topic.Digest * 10 + Math.Min(topic.Views / 20, 50) + Math.Min(topic.Replies / config.Ppp * 1.5, 15)); if (topiccachemark < config.Topiccachemark) { isguestcachepage = 1; } } }
public static Discuz.Common.Generic.List<TopicIdentify> GetTopicIdentifyCollection() #endif { Discuz.Cache.DNTCache cache = Discuz.Cache.DNTCache.GetCacheService(); #if NET1 TopicIdentifyCollection topicidentifyList = cache.RetrieveObject("/TopicIdentifys") as TopicIdentifyCollection; #else Discuz.Common.Generic.List<TopicIdentify> topicidentifyList = cache.RetrieveObject("/TopicIdentifys") as Discuz.Common.Generic.List<TopicIdentify>; #endif if (topicidentifyList == null) { #if NET1 topicidentifyList = new TopicIdentifyCollection(); #else topicidentifyList = new Discuz.Common.Generic.List<TopicIdentify>(); #endif IDataReader reader = DatabaseProvider.GetInstance().GetTopicsIdentifyItem(); StringBuilder jsArray = new StringBuilder("<script type='text/javascript'>var topicidentify = { "); while (reader.Read()) { TopicIdentify topic = new TopicIdentify(); topic.Identifyid = Int32.Parse(reader["identifyid"].ToString()); topic.Name = reader["name"].ToString(); topic.Filename = reader["filename"].ToString(); topicidentifyList.Add(topic); jsArray.AppendFormat("'{0}':'{1}',", reader["identifyid"].ToString(), reader["filename"].ToString()); } reader.Close(); jsArray.Remove(jsArray.Length - 1, 1); jsArray.Append("};</script>"); cache.AddObject("/TopicIdentifys", topicidentifyList); cache.AddObject("/TopicIndentifysJsArray", jsArray.ToString()); } return topicidentifyList; }
public int IndexOf(TopicIdentify value) { return(this.List.IndexOf(value)); }
public bool Contains(TopicIdentify value) { return(this.List.Contains(value)); }
public int Add(TopicIdentify value) { return(this.List.Add(value)); }