Beispiel #1
0
        protected override void OnLoad(EventArgs e)
        {
            LoadTemplate();
            base.OnLoad(e);

            if (this.pagename != "forumlist.aspx" && this.pagename != "forumindex.aspx")
            {
                this.oluserinfo = Online.UpdateInfo();
            }
            else
            {
                try
                {
                    this.oluserinfo = Online.UpdateInfo();
                }
                catch
                {
                    Thread.Sleep(2000);
                    this.oluserinfo = Online.UpdateInfo();
                }
            }
            if (this.config.PostTimeStorageMedia == 1 && Utils.GetCookie("lastposttime") != "")
            {
                var lptime = DateTime.MinValue;
                if (DateTime.TryParse(Utils.GetCookie("lastposttime"), out lptime))
                {
                    this.oluserinfo.LastPostTime = lptime;
                }
            }
            if (userid > 0)
            {
                if (oluserinfo == null)
                {
                    XTrace.WriteLine("发现Cookie记录ID={0}已登录,但是未检测到登录对象", userid);
                }
                else if (userid != oluserinfo.UserID)
                {
                    XTrace.WriteLine("发现Cookie记录ID={0}已登录,实际登录对象ID={1}", userid, oluserinfo.UserID);
                }
            }
            this.userid      = this.oluserinfo.UserID;
            this.usergroupid = (int)this.oluserinfo.GroupID;
            this.username    = this.oluserinfo.UserName;
            this.password    = this.oluserinfo.Password;
            //2014-1-20 增加判断password是否为null,初次使用时使用QQ登陆,密码会为空
            this.userkey        = password != null ? (this.password.Length > 16) ? this.password.Substring(4, 8).Trim() : "" : "";
            this.lastposttime   = this.oluserinfo.LastPostTime;
            this.lastpostpmtime = this.oluserinfo.LastPostpmTime;
            this.lastsearchtime = this.oluserinfo.LastSearchTime;
            this.olid           = this.oluserinfo.ID;
            //this.isopenconnect = DiscuzCloud.GetCloudServiceEnableStatus("connect");
            if (this.userid > 0)
            {
                this.useravatar = Avatars.GetAvatarUrl(this.userid, AvatarSize.Small);
            }

            this.pmsound = ForumUtils.GetCookie("pmsound").ToInt(0);
            if (this.usergroupid == 4 || this.usergroupid == 5)
            {
                var user = BBX.Entity.User.FindByID(this.userid);
                //var user2 = user as IUser;
                if (user.GroupExpiry != 0 && user.GroupExpiry <= DateTime.Now.ToString("yyyyMMdd").ToInt(0))
                {
                    var creditsUserGroupId = CreditsFacade.GetCreditsUserGroupId((float)user.Credits);
                    this.usergroupid = ((creditsUserGroupId.ID != 0) ? creditsUserGroupId.ID : this.usergroupid);
                    //Users.UpdateUserGroup(this.userid, this.usergroupid);
                    user.GroupID = usergroupid;
                    user.Save();
                }
            }
            this.usergroupinfo = UserGroup.FindByID(this.usergroupid);
            this.useradminid   = this.usergroupinfo.RadminID;
            string userCreditsCookie = ForumUtils.GetUserCreditsCookie(this.userid, this.usergroupinfo.GroupTitle);

            if (userCreditsCookie != "")
            {
                string[] array = userCreditsCookie.Split(',');
                this.userinfotips = "<p><a class=\"drop\" onmouseover=\"showMenu(this.id);\" href=\"" + BaseConfigs.GetForumPath + "usercpcreditspay.aspx\" id=\"extcreditmenu\">" + array[0] + "</a> ";
                string text = this.userinfotips;
                this.userinfotips  = text + "<span class=\"pipe\">|</span>用户组: <a class=\"xi2\" id=\"g_upmine\" href=\"" + BaseConfigs.GetForumPath + "usercp.aspx\">" + array[1].Split(':')[1] + "</a></p>";
                this.userinfotips += "<ul id=\"extcreditmenu_menu\" class=\"p_pop\" style=\"display:none;\">";
                for (int i = 2; i < array.Length; i++)
                {
                    this.userinfotips += string.Format("<li><a> {0}</a></li>", array[i]);
                }
                this.userinfotips += "</ul>";
            }
            this.mainnavigation       = Nav.GetNavigationString(this.userid, this.useradminid);
            this.subnavigation        = Nav.GetSubNavigation();
            this.mainnavigationhassub = Nav.Root.Childs.GetItem <Int32>(Nav._.ID).ToArray();
            if (this.config.Closed == 1 && this.pagename != "login.aspx" && this.pagename != "logout.aspx" && this.pagename != "register.aspx" && this.useradminid != 1)
            {
                this.ShowMessage(1);
                return;
            }
            if (!Utils.InArray(this.pagename, "attachment.aspx"))
            {
                //this.onlineusercount = Online.Meta.Count;
                var st = Online.GetStat();
                this.onlineusercount = st.Total;
            }
            if (!this.ValidateUserPermission())
            {
                return;
            }

            if (this.userid != -1 && !Utils.InArray(this.pagename, "attachment.aspx"))
            {
                Online.UpdateOnlineTime(this.config.Oltimespan, this.userid);
            }
            var tmp = Template.FindByID(this.templateid);

            this.templatepath = tmp.Directory;
            if (!String.IsNullOrEmpty(tmp.Url) && tmp.Url.StartsWithIgnoreCase("http://"))
            {
                imagedir = tmp.Url.TrimEnd('/') + "/images";
                cssdir   = tmp.Url.TrimEnd('/');
            }
            else
            {
                imagedir = forumpath + "templates/" + tmp.Directory + "/images";
                cssdir   = forumpath + "templates/" + tmp.Directory;
            }
            if (!config.ImageServer.IsNullOrEmpty())
            {
                imagedir = config.ImageServer.TrimEnd("/") + imagedir;
            }
            if (!config.CssServer.IsNullOrEmpty())
            {
                cssdir = config.CssServer.TrimEnd("/") + cssdir;
            }

            this.topicidentifydir = this.forumpath + "images/identify";
            this.posticondir      = this.forumpath + "images/posticons";
            this.jsdir            = "javascript";
            if (!config.JsServer.IsNullOrEmpty())
            {
                jsdir = config.JsServer.EnsureEnd("/") + jsdir;
            }
            else
            {
                jsdir = this.rooturl + jsdir;
            }

            //this.nowdatetime = Utils.GetDateTime();
            //this.ispost = DNTRequest.IsPost();
            //this.isget = DNTRequest.IsGet();
            //this.link = "";
            //this.script = "";
            this.templatelistboxoptions = Caches.GetTemplateListBoxOptionsCache();
            string oldValue = string.Format("<li><a href=\"###\" onclick=\"window.location.href='{0}showtemplate.aspx?templateid={1}'\">", "", BaseConfigs.GetForumPath, this.templateid);
            string newValue = string.Format("<li class=\"current\"><a href=\"###\" onclick=\"window.location.href='{0}showtemplate.aspx?templateid={1}'\">", BaseConfigs.GetForumPath, this.templateid);

            this.templatelistboxoptions = this.templatelistboxoptions.Replace(oldValue, newValue);
            this.isLoginCode            = this.config.Seccodestatus.Contains("login.aspx");
            this.isseccode = (Utils.InArray(this.pagename, this.config.Seccodestatus) && this.usergroupinfo.IgnoresecCode == 0);
            this.headerad  = Advertisement.GetOneHeaderAd("", 0);
            this.footerad  = Advertisement.GetOneFooterAd("", 0);
            if (this.config.Allowchangewidth == 0)
            {
                Utils.WriteCookie("allowchangewidth", "");
            }

            if (this.pagename != "website.aspx" && (Utils.GetCookie("allowchangewidth") == "0" || (string.IsNullOrEmpty(Utils.GetCookie("allowchangewidth")) && this.config.Showwidthmode == 1)))
            {
                this.isnarrowpage = true;
            }
            if (this.isseccode && this.ispost && !this.ValidateVerifyCode())
            {
                return;
            }

            this.newtopicminute = this.config.Viewnewtopicminute;

            CanShow = true;

            this.ShowPage();
        }
Beispiel #2
0
        protected override void ShowPage()
        {
            this.pagetitle = "首页";
            if (this.userid > 0 && this.useradminid > 0)
            {
                var adminGroupInfo = AdminGroup.FindByID(this.usergroupid);
                if (adminGroupInfo != null)
                {
                    this.disablepostctrl = adminGroupInfo.DisablePostctrl;
                }
            }
            int num = DNTRequest.GetInt("f", 1);

            if (num == 0)
            {
                ForumUtils.WriteCookie("isframe", "1");
            }
            else
            {
                num = ForumUtils.GetCookie("isframe").ToInt(-1);
                if (num == -1)
                {
                    num = this.config.Isframeshow;
                }
            }
            if (num == 2)
            {
                HttpContext.Current.Response.Redirect(BaseConfigs.GetForumPath + "frame.aspx");
                HttpContext.Current.Response.End();
                return;
            }
            if (this.config.Rssstatus == 1)
            {
                base.AddLinkRss("tools/rss.aspx", "最新主题");
            }
            Online.UpdateAction(this.olid, UserAction.IndexShow, 0, this.config.Onlinetimeout);
            if (this.userid != -1)
            {
                this.userinfo = BBX.Entity.User.FindByID(this.userid);
                if (this.userinfo == null)
                {
                    this.userid = -1;
                    ForumUtils.ClearUserCookie();
                }
                else
                {
                    //this.newpmcount = !userinfo.Newpm ? 0 : this.newpmcount;
                    if (!userinfo.Newpm)
                    {
                        newpmcount = 0;
                    }
                    this.lastvisit  = this.userinfo.LastVisit.ToString();
                    this.showpmhint = (this.userinfo.NewsLetter.ToInt() > 4);
                }
            }
            this.navhomemenu    = Caches.GetForumListMenuDivCache(this.usergroupid, this.userid, this.config.Extname);
            this.forumlist      = Forums.GetForumIndexCollection(this.config.Hideprivate, this.usergroupid, this.config.Moddisplay, out this.totaltopic, out this.totalpost, out this.todayposts);
            this.forumlinkcount = this.forumlinklist.Rows.Count;
            //if (this.config.Enablespace == 1)
            //{
            //    this.GetSpacePerm();
            //}
            this.totalusers       = Statistic.Current.TotalUsers;
            this.lastusername     = Statistic.Current.LastUserName + "";
            this.lastuserid       = Statistic.Current.LastUserID;
            this.yesterdayposts   = Statistic.Current.YesterdayPosts;
            this.highestposts     = Statistic.Current.HighestPosts;
            this.highestpostsdate = Statistic.Current.HighestPostsDate + "";
            if (this.todayposts > this.highestposts)
            {
                this.highestposts     = this.todayposts;
                this.highestpostsdate = DateTime.Now.ToString("yyyy-M-d");
            }
            this.totalonline     = this.onlineusercount;
            this.showforumonline = false;
            this.onlineiconlist  = OnlineList.GetOnlineGroupIconList();
            if (this.totalonline < this.config.Maxonlinelist || DNTRequest.GetString("showonline") == "yes")
            {
                this.showforumonline = true;
                var list = Online.GetList(0, Online._.UserID, true);
                // 根据活跃时间降序
                list.Sort(Online._.LastActivity, true);
                this.onlineuserlist = list;

                var st = Online.GetStat();
                this.totalonline              = st.Total;
                this.totalonlineuser          = st.User;
                this.totalonlineinvisibleuser = st.Invisible;
                this.totalonlineguest         = st.Guest;
            }
            if (DNTRequest.GetString("showonline") == "no")
            {
                this.showforumonline = false;
            }
            this.highestonlineusercount = Statistic.Current.HighestOnlineUserCount + "";
            this.highestonlineusertime  = Statistic.Current.HighestOnlineUserTime.ToString("yyyy-MM-dd HH:mm");
            //this.announcementlist = Announcements.GetSimplifiedAnnouncementList(this.nowdatetime, "2999-01-01 00:00:00");
            announcementlist       = Announcement.GetAvailableList();
            this.announcementcount = this.announcementlist != null ? this.announcementlist.Count : 0;
            var fs = new List <IXForum>();

            foreach (var current in this.forumlist)
            {
                current.Description = UBB.ParseSimpleUBB(current.Description);
                if (current.Layer == 0)
                {
                    fs.Add(current);
                }
            }
            this.taglist    = config.Enabletag ? Tag.GetHotForumTags(config.Hottagcount).ToArray() : new Tag[0];
            this.headerad   = Advertisement.GetOneHeaderAd("indexad", 0);
            this.footerad   = Advertisement.GetOneFooterAd("indexad", 0);
            this.inforumad  = Advertisement.GetInForumAd("indexad", 0, fs, this.templatepath);
            this.pagewordad = Advertisement.GetPageWordAd("indexad", 0);
            this.doublead   = Advertisement.GetDoubleAd("indexad", 0);
            this.floatad    = Advertisement.GetFloatAd("indexad", 0);
            this.mediaad    = Advertisement.GetMediaAd(this.templatepath, "indexad", 0);
            this.pagead     = Advertisement.GetPageAd("indexad", 0);
            if (this.userid > 0 && this.oluserinfo.Newpms < 0)
            {
                Users.UpdateUserNewPMCount(this.userid, this.olid);
            }
        }
Beispiel #3
0
        protected override void ShowPage()
        {
            this.pagetitle = "首页";
            if (this.config.Rssstatus == 1)
            {
                base.AddLinkRss("tools/rss.aspx", "最新主题");
            }
            //this.announcementlist = Announcements.GetSimplifiedAnnouncementList(this.nowdatetime, "2999-01-01 00:00:00");
            announcementlist = Announcement.GetAvailableList();
            if (this.announcementlist != null)
            {
                this.announcementcount = this.announcementlist.Count;
            }
            this.forumlinkcount = this.forumlinklist.Rows.Count;
            Forums.GetForumIndexCollection(this.config.Hideprivate, this.usergroupid, this.config.Moddisplay, out this.totaltopic, out this.totalpost, out this.todayposts);
            this.totalusers       = Statistic.Current.TotalUsers;
            this.lastusername     = Statistic.Current.LastUserName;
            this.lastuserid       = Statistic.Current.LastUserID;
            this.yesterdayposts   = Statistic.Current.YesterdayPosts;
            this.highestposts     = Statistic.Current.HighestPosts;
            this.highestpostsdate = Statistic.Current.HighestPostsDate;
            if (this.todayposts > this.highestposts)
            {
                this.highestposts     = this.todayposts;
                this.highestpostsdate = DateTime.Now.ToString("yyyy-M-d");
            }
            this.totalonline = this.onlineusercount;
            //Online.GetOnlineUserCollection(out this.totalonline, out this.totalonlineguest, out this.totalonlineuser, out this.totalonlineinvisibleuser);
            var st = Online.GetStat();

            this.totalonline              = st.Total;
            this.totalonlineuser          = st.User;
            this.totalonlineinvisibleuser = st.Invisible;
            this.totalonlineguest         = st.Guest;

            this.highestonlineusercount = Statistic.Current.HighestOnlineUserCount + "";
            this.highestonlineusertime  = Statistic.Current.HighestOnlineUserTime.ToFullString();
            if (this.userid != -1)
            {
                this.score = Scoresets.GetValidScoreName();
                IUser shortUserInfo = BBX.Entity.User.FindByID(this.userid);
                this.score1 = ((decimal)shortUserInfo.ExtCredits1).ToString();
                this.score2 = ((decimal)shortUserInfo.ExtCredits2).ToString();
                this.score3 = ((decimal)shortUserInfo.ExtCredits3).ToString();
                this.score4 = ((decimal)shortUserInfo.ExtCredits4).ToString();
                this.score5 = ((decimal)shortUserInfo.ExtCredits5).ToString();
                this.score6 = ((decimal)shortUserInfo.ExtCredits6).ToString();
                this.score7 = ((decimal)shortUserInfo.ExtCredits7).ToString();
                this.score8 = ((decimal)shortUserInfo.ExtCredits8).ToString();
            }
            //if (this.config.Enablealbum == 1 && AlbumPluginProvider.GetInstance() != null)
            //{
            //    this.albumcategorylist = AlbumPluginProvider.GetInstance().GetAlbumCategory();
            //}
            //if (this.config.Enablespace == 1 && AggregationFacade.SpaceAggregation.GetSpaceTopComments() != null)
            //{
            //    this.topspacecomments = AggregationFacade.SpaceAggregation.GetSpaceTopComments();
            //}
            this.taglist  = config.Enabletag ? Tag.GetHotForumTags(this.config.Hottagcount).ToArray() : new Tag[0];
            this.doublead = Advertisement.GetDoubleAd("indexad", 0);
            this.floatad  = Advertisement.GetFloatAd("indexad", 0);
        }
Beispiel #4
0
        protected override void ShowPage()
        {
            this.pagetitle = "在线列表";

            var order = Request["order"];

            if (String.IsNullOrEmpty(order))
            {
                order = WebHelper.ReadCookie("onlinelist", "order");
            }
            dir = Request["dir"];
            if (String.IsNullOrEmpty(dir))
            {
                dir = WebHelper.ReadCookie("onlinelist", "dir");
            }
            var desc = dir == "desc";

            this.onlineusernumber = this.onlineusercount;

            var pagesize = WebHelper.RequestInt("PageSize");

            if (pagesize <= 0)
            {
                pagesize = 16;
            }
            this.pagecount = ((this.onlineusernumber % pagesize == 0) ? (this.onlineusernumber / pagesize) : (this.onlineusernumber / pagesize + 1));
            this.pagecount = ((this.pagecount == 0) ? 1 : this.pagecount);
            if (this.pageid <= 1)
            {
                this.pageid   = 1;
                this.startrow = 0;
                this.endrow   = pagesize - 1;
            }
            else
            {
                this.pageid   = ((this.pageid > this.pagecount) ? this.pagecount : this.pageid);
                this.startrow = (this.pageid - 1) * pagesize;
                this.endrow   = this.pageid * pagesize;
            }

            this.startrow = ((this.startrow >= this.onlineusernumber) ? (this.onlineusernumber - 1) : this.startrow);
            this.endrow   = ((this.endrow >= this.onlineusernumber) ? (this.onlineusernumber - 1) : this.endrow);
            //onlineuserlist = onlineuserlist.Skip(startrow).Take(endrow - startrow + 1).ToList();

            //onlineuserlist = Online.GetOnlineUserList(this.onlineusercount, order, desc, out this.totalonlineguest, out this.totalonlineuser, out this.totalonlineinvisibleuser);
            onlineuserlist = Online.GetList(0, order, desc, startrow, pagesize);

            var st = Online.GetStat();

            this.totalonline              = st.Total;
            this.totalonlineuser          = st.User;
            this.totalonlineinvisibleuser = st.Invisible;
            this.totalonlineguest         = st.Guest;

            // 写入Cookie
            WebHelper.WriteCookie("onlinelist", "order", order);
            WebHelper.WriteCookie("onlinelist", "dir", dir);
            dir = desc ? "asc" : "desc";
            this.pagenumbers            = ((String.IsNullOrEmpty(DNTRequest.GetString("search"))) ? Utils.GetPageNumbers(this.pageid, this.pagecount, "onlineuser.aspx", 8) : Utils.GetPageNumbers(this.pageid, this.pagecount, "onlineuser.aspx", 8));
            this.totalonline            = this.onlineusercount;
            this.highestonlineusercount = Statistic.Current.HighestOnlineUserCount + "";
            this.highestonlineusertime  = Statistic.Current.HighestOnlineUserTime.ToString("yyyy-MM-dd HH:mm:ss");
        }
Beispiel #5
0
        protected override void ShowPage()
        {
            this.GetPostAds(this.forumid);
            if (this.userid > 0 && this.useradminid > 0)
            {
                var adminGroupInfo = AdminGroup.FindByID(this.usergroupid);
                if (adminGroupInfo != null)
                {
                    this.disablepostctrl = adminGroupInfo.DisablePostctrl;
                }
            }
            if (this.forumid == -1)
            {
                base.AddLinkRss(this.forumpath + "tools/rss.aspx", "最新主题");
                base.AddErrLine("无效的版块ID");
                return;
            }
            this.forum = Forums.GetForumInfo(this.forumid);
            if (this.forum == null || this.forum.Fid < 1)
            {
                if (this.config.Rssstatus == 1)
                {
                    base.AddLinkRss(this.forumpath + "tools/rss.aspx", Utils.EncodeHtml(this.config.Forumtitle) + " 最新主题");
                }
                base.AddErrLine("不存在的版块ID");
                return;
            }
            if (this.config.Rssstatus == 1)
            {
                base.AddLinkRss(this.forumpath + "tools/" + Urls.RssAspxRewrite(this.forum.Fid), Utils.EncodeHtml(this.forum.Name) + " 最新主题");
            }
            if (this.JumpUrl(this.forum))
            {
                return;
            }
            this.needaudit = UserAuthority.NeedAudit(forum.Fid, forum.Modnewposts, this.useradminid, this.userid, this.usergroupinfo);
            if (this.useradminid > 0)
            {
                this.ismoder = Moderators.IsModer(this.useradminid, this.userid, this.forumid);
            }
            //this.SetSearchCondition();
            this.showforumlogin      = this.IsShowForumLogin(this.forum);
            this.pagetitle           = Utils.RemoveHtml(this.forum.Name);
            this.navhomemenu         = Caches.GetForumListMenuDivCache(this.usergroupid, this.userid, this.config.Extname);
            this.forumnav            = base.ShowForumAspxRewrite(ForumUtils.UpdatePathListExtname(this.forum.Pathlist.Trim(), this.config.Extname).Replace("\"showforum", "\"" + this.forumurl + "showforum"), this.forumid, this.pageid);
            this.topicextcreditsinfo = Scoresets.GetScoreSet(Scoresets.GetTopicAttachCreditsTrans());
            this.bonusextcreditsinfo = Scoresets.GetScoreSet(Scoresets.GetBonusCreditsTrans());
            if (this.forum.ApplytopicType == 1)
            {
                this.topictypeselectoptions = Forums.GetCurrentTopicTypesOption(this.forum.Fid, this.forum.Topictypes);
            }
            if (this.forum.ApplytopicType == 1)
            {
                this.topictypeselectlink = Forums.GetCurrentTopicTypesLink(this.forum.Fid, this.forum.Topictypes, this.forumurl + "showforum.aspx");
            }
            meta = PageHelper.UpdateMetaInfo(meta, this.forum.Seokeywords.IsNullOrEmpty() ? this.config.Seokeywords : this.forum.Seokeywords, this.forum.Seodescription.IsNullOrEmpty() ? this.forum.Description : this.forum.Seodescription, this.config.Seohead);
            this.SetEditorState();
            if (!UserAuthority.VisitAuthority(this.forum, this.usergroupinfo, this.userid, ref this.msg))
            {
                base.AddErrLine(this.msg);
                this.needlogin = (this.userid == -1);
                return;
            }
            this.canposttopic = UserAuthority.PostAuthority(this.forum, this.usergroupinfo, this.userid, ref this.msg);
            if (this.useradminid != 1 && !this.usergroupinfo.DisablePeriodctrl)
            {
                string text = "";
                if (this.canposttopic && Scoresets.BetweenTime(this.config.Postbanperiods, out text))
                {
                    this.canposttopic = false;
                }
                this.isnewbie = UserAuthority.CheckNewbieSpan(this.userid);
            }
            if ((this.config.Fastpost == 1 || this.config.Fastpost == 3) && !this.forum.AllowSpecialOnly && (this.userid < 0 || (this.canposttopic && !this.isnewbie)))
            {
                this.canquickpost = true;
            }
            if ((forum as XForum).Childs.Count > 0)
            {
                this.subforumlist = Forums.GetSubForumCollection(this.forumid, this.forum.ColCount, this.config.Hideprivate, this.usergroupid, this.config.Moddisplay);
            }
            if (!this.forum.Rules.IsNullOrWhiteSpace())
            {
                this.forum.Rules = UBB.ParseSimpleUBB(this.forum.Rules);
            }
            // 满足条件的主题数
            this.topiccount = Topic.SearchCount(forumid, topictypeid, interval, filter);
            if (tpp <= 0)
            {
                tpp = this.config.Tpp;
            }
            if (this.ppp <= 0)
            {
                this.ppp = this.config.Ppp;
            }
            if (this.pageid < 1)
            {
                this.pageid = 1;
            }

            // 内层板块,需要显示主题列表
            if (this.forum.Layer > 0)
            {
                // 置顶主题列表
                var tops = Topic.GetTop(forumid);
                if (tops.Count > 0)
                {
                    // 加上非本板块的主题数
                    topiccount += tops.Count(e => e.Fid != forumid);
                }

                // 根据主题总数计算分页
                //pagecount = ((topiccount % tpp == 0) ? (topiccount / tpp) : (topiccount / tpp + 1));
                pagecount = topiccount / tpp;
                if (topiccount % tpp > 0)
                {
                    pagecount++;
                }
                if (pagecount == 0)
                {
                    pagecount = 1;
                }
                if (pageid > pagecount)
                {
                    pageid = pagecount;
                }

                // 如果有置顶主题,则先读取置顶主题,再读取部分普通主题以填满一页
                if (tops.Count > 0)
                {
                    // 置顶主题数
                    var toptopiccount = tops.Count;
                    // 置顶主题构成的完整页数,不包括半截
                    int topPageCount = toptopiccount / tpp;
                    // 置顶主题可能满好几页,如果分到当前页还有主题,则需要处理
                    if (toptopiccount > tpp * (pageid - 1))
                    {
                        // 取出本页所属的置顶主题
                        toptopiclist = Topics.GetTopTopicList(tops, tpp, pageid, forum.AutoClose, forum.Topictypeprefix);

                        if (toptopiclist.Count < tpp)
                        {
                            // 本页有一部分置顶主题,要注意计算本页普通主题的数量(总页大小-置顶帖在本页的大小),开始行很简单从0开始即可(因为是第一页普通主题)
                            topiclist = GetTopicInfoList(tpp - toptopiclist.Count, pageid - topPageCount, 0);
                        }
                    }
                    else
                    {
                        // 已经没有置顶主题,取满一页普通主题,注意开始行的计算
                        topiclist = GetTopicInfoList(tpp, pageid - topPageCount, toptopiccount % tpp);
                    }
                }
                else
                {
                    // 如果没有置顶主题,则直接读取一页普通主题
                    topiclist = GetTopicInfoList(tpp, pageid, 0);
                }
                // 如果没有主题,或者实际主题列表大于主题总数,那么更新论坛的主题数
                // 在XCode支持下,即使有缓存,这种可能性也很小很小
                if (topiclist == null || topiclist.Count == 0 || topiclist.Count > topiccount)
                {
                    XForum.SetRealCurrentTopics(this.forum.Fid);
                }
                this.SetPageNumber();

                var vs = visitedforums;
                this.showvisitedforumsmenu = (vs != null && ((vs.Length == 1 && vs[0].Fid != forumid) || vs.Length > 1));
                this.SetVisitedForumsCookie();
                Utils.WriteCookie("forumpageid", this.pageid.ToString(), 30);
                this.IsGuestCachePage();
            }
            this.forum.Description = UBB.ParseSimpleUBB(this.forum.Description);
            Online.UpdateAction(this.olid, UserAction.ShowForum, this.forumid, this.forum.Name, -1, "");
            if ((this.forumtotalonline < this.config.Maxonlinelist && (this.config.Whosonlinestatus == 2 || this.config.Whosonlinestatus == 3)) || DNTRequest.GetString("showonline") == "yes")
            {
                this.showforumonline = true;
                this.onlineuserlist  = Online.GetList(this.forumid, Online._.UserID, true);

                var st = Online.GetStat();
                this.forumtotalonline              = st.Total;
                this.forumtotalonlineuser          = st.User;
                this.forumtotalonlineinvisibleuser = st.Invisible;
                this.forumtotalonlineguest         = st.Guest;
            }
            if (DNTRequest.GetString("showonline") == "no")
            {
                this.showforumonline = false;
            }
            // 这里会导致版主列表不断增大,直到最后内存溢出,临时解决
            if (!forum.Moderators.IsNullOrWhiteSpace() && (forum.ModeratorsHtml.IsNullOrWhiteSpace() || !forum.ModeratorsHtml.Contains("href")))
            {
                string   text2 = string.Empty;
                string[] array = this.forum.Moderators.Split(',');
                for (int i = 0; i < array.Length; i++)
                {
                    text2 += string.Format("<a href=\"{0}userinfo.aspx?username={1}\">{2}</a>,", this.forumpath, Utils.UrlEncode(array[i]), array[i]);
                }
                this.forum.ModeratorsHtml = text2.TrimEnd(',');
            }
            ForumUtils.UpdateVisitedForumsOptions(this.forumid);
        }