Ejemplo n.º 1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            //   Response.Write(Server.UrlDecode(Request.Url.ToString()));

            if (pageType == "checkurlrewriter")
            {
                Response.Clear();
                Response.Write("支持当前设置的URL重写规则");
                Response.End();
            }

            UpdateViewCount();

            if (SettingManager.GetSetting().SiteStatus == 0)
            {
                ResponseError("网站已关闭", "网站已关闭,请与站长联系!");
            }

            themeName = SettingManager.GetSetting().Theme;
            if (RequestHelper.IsMobile)
            {
                themeName = SettingManager.GetSetting().MobileTheme;
            }
            if (!string.IsNullOrEmpty(previewThemeName))
            {
                themeName = previewThemeName;
            }
            // Response.Write("ismobile:" + RequestHelper.IsMobile + ",IsMobileDevice:" + Request.Browser.IsMobileDevice + ",BrowserType:" + Request.Browser.Type + ",UserAgent:" + Request.UserAgent + ",HTTP_ACCEPT:" + Request.ServerVariables["HTTP_ACCEPT"]);

            templatePath = Server.MapPath(string.Format("{0}/themes/{1}/template/", ConfigHelper.SitePath, themeName));

            //if (!System.IO.Directory.Exists(templatePath) && !string.IsNullOrEmpty(previewThemeName))
            //{
            //    ResponseError("预览主题不存在", "预览的主题不存在,是否修改了URL地址?");
            //}

            //非预览时
            if (!System.IO.Directory.Exists(templatePath) && string.IsNullOrEmpty(previewThemeName))
            {
                SettingInfo s = SettingManager.GetSetting();
                if (RequestHelper.IsMobile)
                {
                    s.MobileTheme = "default";
                }
                else
                {
                    s.Theme = "default";
                }
                themeName = "default";

                SettingManager.UpdateSetting();

                templatePath = Server.MapPath(string.Format("{0}/themes/default/template/", ConfigHelper.SitePath));
            }

            th = new TemplateHelper(templatePath);

            LoadDefault();

            LoachsDataManager loachs = new LoachsDataManager();

            th.Put("loachs", loachs);

            switch (pageType)
            {
                case "feed":
                    LoadFeed();
                    break;
                case "post":
                    LoadPost();
                    break;
                case "rsd":
                    LoadRsd();
                    break;
                case "wlwmanifest":
                    LoadWlwmanifest();
                    break;
                case "metaweblog":
                    LoadMetaweblog();
                    break;
                default:
                    //if (IsXmlrpcPost() == true)
                    //{
                    //    LoadMetaweblog();
                    //}
                    //else
                    //{
                    LoadPostList();
                    //    }
                    break;
            }
        }
Ejemplo n.º 2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            //   Response.Write(Server.UrlDecode(Request.Url.ToString()));

            if (pageType == "checkurlrewriter")
            {
                Response.Clear();
                Response.Write("支持当前设置的URL重写规则");
                Response.End();
            }

            UpdateViewCount();

            if (SettingManager.GetSetting().SiteStatus == 0)
            {
                ResponseError("网站已关闭", "网站已关闭,请与站长联系!");
            }

            themeName = SettingManager.GetSetting().Theme;
            if (RequestHelper.IsMobile)
            {
                themeName = SettingManager.GetSetting().MobileTheme;
            }
            if (!string.IsNullOrEmpty(previewThemeName))
            {
                themeName = previewThemeName;
            }
            // Response.Write("ismobile:" + RequestHelper.IsMobile + ",IsMobileDevice:" + Request.Browser.IsMobileDevice + ",BrowserType:" + Request.Browser.Type + ",UserAgent:" + Request.UserAgent + ",HTTP_ACCEPT:" + Request.ServerVariables["HTTP_ACCEPT"]);


            templatePath = Server.MapPath(string.Format("{0}/themes/{1}/template/", ConfigHelper.SitePath, themeName));

            //if (!System.IO.Directory.Exists(templatePath) && !string.IsNullOrEmpty(previewThemeName))
            //{
            //    ResponseError("预览主题不存在", "预览的主题不存在,是否修改了URL地址?");
            //}

            //非预览时
            if (!System.IO.Directory.Exists(templatePath) && string.IsNullOrEmpty(previewThemeName))
            {
                SettingInfo s = SettingManager.GetSetting();
                if (RequestHelper.IsMobile)
                {
                    s.MobileTheme = "default";
                }
                else
                {
                    s.Theme = "default";
                }
                themeName = "default";

                SettingManager.UpdateSetting();

                templatePath = Server.MapPath(string.Format("{0}/themes/default/template/", ConfigHelper.SitePath));
            }

            th = new TemplateHelper(templatePath);



            LoadDefault();

            LoachsDataManager loachs = new LoachsDataManager();

            th.Put("loachs", loachs);

            switch (pageType)
            {
            case "feed":
                LoadFeed();
                break;

            case "post":
                LoadPost();
                break;

            case "rsd":
                LoadRsd();
                break;

            case "wlwmanifest":
                LoadWlwmanifest();
                break;

            case "metaweblog":
                LoadMetaweblog();
                break;

            default:
                //if (IsXmlrpcPost() == true)
                //{
                //    LoadMetaweblog();
                //}
                //else
                //{
                LoadPostList();
                //    }
                break;
            }
        }