Esempio n. 1
0
        protected override void ShowPage()
        {
            this.pagetitle = "统计";
            if (!this.usergroupinfo.AllowViewstats && (!(DNTRequest.GetString("type") == "trend") || !(DNTRequest.GetString("xml") == "1")))
            {
                base.AddErrLine("您所在的用户组 ( <b>" + this.usergroupinfo.GroupTitle + "</b> ) 没有查看统计信息的权限");
                this.needlogin = (this.userid < 1);
                return;
            }
            this.statscachelife = ((this.statscachelife <= 0) ? this.statscachelife : this.config.Statscachelife);

            var allStats = Stat.GetAll();

            this.statstatus             = this.config.Statstatus;
            this.totalstats["hits"]     = 0;
            this.totalstats["maxmonth"] = 0;
            this.totalstats["guests"]   = 0;
            this.totalstats["visitors"] = 0;
            foreach (Stat item in allStats)
            {
                string a;
                if ((a = item.Type) != null)
                {
                    if (!(a == "total"))
                    {
                        if (!(a == "os"))
                        {
                            if (!(a == "browser"))
                            {
                                if (!(a == "month"))
                                {
                                    if (!(a == "week"))
                                    {
                                        if (a == "hour")
                                        {
                                            this.SetValue(item, this.hourstats);
                                            if (item.Count > this.maxhour)
                                            {
                                                this.maxhour     = item.Count;
                                                this.maxhourfrom = item.Variable.ToInt(0);
                                                this.maxhourto   = this.maxhourfrom + 1;
                                            }
                                        }
                                    }
                                    else
                                    {
                                        this.SetValue(item, this.weekstats);
                                        if (item.Count > this.maxweek)
                                        {
                                            this.maxweek      = item.Count;
                                            this.dayofmaxweek = item.Variable;
                                        }
                                    }
                                }
                                else
                                {
                                    this.SetValue(item, this.monthstats);
                                    if (item.Count > this.maxmonth)
                                    {
                                        this.maxmonth        = item.Count;
                                        this.yearofmaxmonth  = item.Variable.ToInt(0) / 100;
                                        this.monthofmaxmonth = item.Variable.ToInt(0) - this.yearofmaxmonth * 100;
                                    }
                                }
                            }
                            else
                            {
                                this.SetValue(item, this.browserstats);
                                this.maxbrowser = ((item.Count > this.maxbrowser) ? item.Count : this.maxbrowser);
                            }
                        }
                        else
                        {
                            this.SetValue(item, this.osstats);
                            this.maxos = ((item.Count > this.maxos) ? item.Count : this.maxos);
                        }
                    }
                    else
                    {
                        this.SetValue(item, this.totalstats);
                    }
                }
            }
            //List<StatVarInfo> allStatVars = Stats.GetAllStatVars();
            //var allStatVars = StatVar.GetAll();
            foreach (var item in StatVar.GetAll())
            {
                if ((item.Variable != "lastupdate" || !Utils.IsNumeric(item.Value)) && item.Type != null)
                {
                    switch (item.Type)
                    {
                    case "dayposts":
                        this.SetValue(item, this.daypostsstats);
                        break;

                    case "creditsrank":
                        this.SetValue(item, this.creditsrankstats);
                        break;

                    case "forumsrank":
                        this.SetValue(item, this.forumsrankstats);
                        break;

                    case "postsrank":
                        this.SetValue(item, this.postsrankstats);
                        break;

                    case "main":
                        //this.SetValue(item, this.mainstats);
                        mainstats[item.Variable] = item.Value;
                        break;

                    case "monthposts":
                        this.SetValue(item, this.monthpostsstats);
                        break;

                    case "onlines":
                        this.SetValue(item, this.onlinesstats);
                        break;

                    case "team":
                        this.SetValue(item, this.teamstats);
                        break;

                    case "trade":
                        this.SetValue(item, this.tradestats);
                        break;
                    }
                }
            }
            this.type = DNTRequest.GetString("type");
            if ((String.IsNullOrEmpty(this.type) && !this.statstatus) || this.type == "posts")
            {
                StatVar.DeleteOldDayposts();
                this.monthpostsstats = Stats.GetMonthPostsStats(this.monthpostsstats);
                this.maxmonthposts   = (int)this.monthpostsstats["maxcount"];
                this.monthpostsstats.Remove("maxcount");
                this.daypostsstats = Stats.GetDayPostsStats(this.daypostsstats);
                this.maxdayposts   = (int)this.daypostsstats["maxcount"];
                this.daypostsstats.Remove("maxcount");
            }
            string key2;

            switch (key2 = this.type)
            {
            case "views":
                this.GetViews();
                return;

            case "client":
                this.GetClient();
                return;

            case "posts":
                this.GetPosts();
                return;

            case "forumsrank":
                this.GetForumsRank();
                return;

            case "topicsrank":
                this.GetTopicsRank();
                return;

            case "postsrank":
                this.GetPostsRank();
                return;

            case "creditsrank":
                this.GetCreditsRank();
                return;

            case "trade":
                this.GetTrade();
                return;

            case "onlinetime":
                this.GetOnlinetime();
                return;

            case "team":
                this.GetTeam();
                return;

            case "modworks":
                this.GetModWorks();
                return;

            case "trend":
                this.GetTrend();
                return;

            case "":
                this.Default();
                return;
            }
            base.AddErrLine("未定义操作请返回");
            base.SetShowBackLink(false);
        }