Esempio n. 1
0
        protected override void ShowPage()
        {
            pagetitle = "首页";

            score = Scoresets.GetValidScoreName();

            if (config.Rssstatus == 1)
            {
                AddLinkRss("tools/rss.aspx", string.Format("{0} 最新主题", config.Forumtitle));
            }

            OnlineUsers.UpdateAction(olid, UserAction.IndexShow.ActionID, 0, config.Onlinetimeout);

            if (newpmcount > 0)
            {
                pmlist = PrivateMessages.GetPrivateMessageCollectionForIndex(userid, 5, 1, 1);
            }

            userinfo = new ShortUserInfo();
            if (userid != -1)
            {
                userinfo = Discuz.Forum.Users.GetShortUserInfo(userid);
                if (userinfo.Newpm == 0)
                {
                    base.newpmcount = 0;
                }
                lastvisit  = userinfo.Lastvisit.ToString();
                showpmhint = Convert.ToInt32(userinfo.Newsletter) > 4;
            }

            Statistics.GetPostCountFromForum(0, out totaltopic, out totalpost, out todayposts);
            digesttopiclist = Focuses.GetDigestTopicList(16);
            hottopiclist    = Focuses.GetHotTopicList(16, 30);
            forumlinklist   = Caches.GetForumLinkList();
            forumlinkcount  = forumlinklist.Rows.Count;

            // 获得统计信息
            totalusers   = Utils.StrToInt(Statistics.GetStatisticsRowItem("totalusers"), 0);
            lastusername = Statistics.GetStatisticsRowItem("lastusername");
            lastuserid   = Utils.StrToInt(Statistics.GetStatisticsRowItem("lastuserid"), 0);

            totalonline = onlineusercount;

            showforumonline = false;
            if (totalonline < config.Maxonlinelist || DNTRequest.GetString("showonline") == "yes")
            {
                showforumonline = true;
                onlineuserlist  = OnlineUsers.GetOnlineUserList(onlineusercount, out totalonlineguest, out totalonlineuser, out totalonlineinvisibleuser);
                onlineiconlist  = Caches.GetOnlineGroupIconList();
            }

            if (DNTRequest.GetString("showonline") == "no")
            {
                showforumonline = false;
            }

            highestonlineusercount = Statistics.GetStatisticsRowItem("highestonlineusercount");
            highestonlineusertime  = Statistics.GetStatisticsRowItem("highestonlineusertime");

            // 得到公告
            announcementlist  = Announcements.GetSimplifiedAnnouncementList(nowdatetime, "2999-01-01 00:00:00");
            announcementcount = 0;
            if (announcementlist != null)
            {
                announcementcount = announcementlist.Rows.Count;
            }

            ///得到广告列表
            headerad   = Advertisements.GetOneHeaderAd("indexad", 0);
            footerad   = Advertisements.GetOneFooterAd("indexad", 0);
            pagewordad = Advertisements.GetPageWordAd("indexad", 0);
            doublead   = Advertisements.GetDoubleAd("indexad", 0);
            floatad    = Advertisements.GetFloatAd("indexad", 0);
        }