日期:2014-05-18 浏览次数:20411 次
using System; using System.IO; using System.Web; using System.Text.RegularExpressions; using Discuz.Forum; using Discuz.Common; using Discuz.Config; using Discuz.Entity; namespace Discuz.Web.UI.Pages { /// <summary> /// Discuz!NT页面基类 /// </summary> public class BasePage : System.Web.UI.Page { public string forumpath = BaseConfigs.GetForumPath; /// <summary> /// BasePage类构造函数 /// </summary> public BasePage() { config = GeneralConfigs.GetConfig(); LoadUrlConfig(); userid = Utils.StrToInt(ForumUtils.GetCookie("userid"), -1); //清空当前页面查询统计 Discuz.Data.DbHelper.QueryCount = 0; // 如果启用游客页面缓存 if (userid == -1) { if (config.Guestcachepagetimeout > 0) { 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); if (pageid == 1 && DNTRequest.GetParamCount() == 2 && topicid > 0 && ForumUtils.ResponseTopicCacheFile(topicid, config.Guestcachepagetimeout)) { TopicStats.Track(topicid, 1); return; } break; default: // break; } } } AddMetaInfo(config.Seokeywords, config.Seodescription, config.Seohead); if (config.Nocacheheaders == 1) { System.Web.HttpContext.Current.Response.BufferOutput = false; System.Web.HttpContext.Current.Response.ExpiresAbsolute = DateTime.Now.AddDays(-1); System.Web.HttpContext.Current.Response.Cache.SetExpires(DateTime.Now.AddDays(-1)); System.Web.HttpContext.Current.Response.Expires = 0; System.Web.HttpContext.Current.Response.CacheControl = "no-cache"; System.Web.HttpContext.Current.Response.Cache.SetNoStore(); } //当为forumlist.aspx或focuslist_aspx,可能出现在线并发问题,这时系统会延时2秒 if((pagename != "forumlist.aspx") && (pagename != "focuslist.aspx")) { oluserinfo = OnlineUsers.Update