Example #1
0
        private string GetPageSource()
        {
            var pages = this.Get <IEnumerable <ILocatablePage> >().ToList();

            if (this.Get <HttpRequestBase>().QueryString.GetFirstOrDefault("g") != null)
            {
                var pageQuery = this.Get <HttpRequestBase>().QueryString.GetFirstOrDefault("g");

                this.page = pages.GetPage(pageQuery);
            }

            if (this.page == null)
            {
                this.page = pages.GetPage("forum");
            }

            /*if (!this.IsValidForLockedForum(this._page))
             * {
             * /  YafBuildLink.Redirect(ForumPages.topics, "f={0}", this.LockedForum);
             * }*/
            string[] src = { "{0}pages/{1}.ascx".FormatWith(YafForumInfo.ForumServerFileRoot, this.page.PageName) };

            var controlOverride = this.Get <ITheme>().GetItem("PAGE_OVERRIDE", this.page.PageName.ToLower(), null);

            if (controlOverride.IsSet())
            {
                src[0] = controlOverride;
            }

            var replacementPaths = new List <string> {
                "moderate", "admin", "help"
            };

            foreach (var path in replacementPaths.Where(
                         path => src[0].IndexOf("/{0}_".FormatWith(path), StringComparison.Ordinal) >= 0))
            {
                src[0] = src[0].Replace("/{0}_".FormatWith(path), "/{0}/".FormatWith(path));
            }

            return(src[0]);
        }
Example #2
0
        private string GetPageSource()
        {
            var pages = this.Get<IEnumerable<ILocatablePage>>();

            if (this.Get<HttpRequestBase>().QueryString.GetFirstOrDefault("g") != null)
            {
                var pageQuery = this.Get<HttpRequestBase>().QueryString.GetFirstOrDefault("g");

                this._page = pages.GetPage(pageQuery);
            }

            if (this._page == null)
            {
                this._page = pages.GetPage("forum");
            }

            /*if (!this.IsValidForLockedForum(this._page))
            {
            /  YafBuildLink.Redirect(ForumPages.topics, "f={0}", this.LockedForum);
            }*/
            string[] src = { "{0}pages/{1}.ascx".FormatWith(YafForumInfo.ForumServerFileRoot, this._page.PageName) };

            string controlOverride = this.Get<ITheme>().GetItem("PAGE_OVERRIDE", this._page.PageName.ToLower(), null);

            if (controlOverride.IsSet())
            {
                src[0] = controlOverride;
            }

            var replacementPaths = new List<string> { "moderate", "admin", "help" };

            foreach (var path in replacementPaths.Where(path => src[0].IndexOf("/{0}_".FormatWith(path)) >= 0))
            {
                src[0] = src[0].Replace("/{0}_".FormatWith(path), "/{0}/".FormatWith(path));
            }

            return src[0];
        }