コード例 #1
0
ファイル: RSS.aspx.cs プロジェクト: zahedbri/mojoportal
        private void LoadSettings()
        {
            siteSettings = CacheHelper.GetCurrentSiteSettings();
            pageSettings = CacheHelper.GetCurrentPage();
            //pageId = WebUtils.ParseInt32FromQueryString("pageid", -1);
            //moduleId = WebUtils.ParseInt32FromQueryString("mid", -1);
            //itemId = WebUtils.ParseInt32FromQueryString("ItemID", -1);
            //threadId = WebUtils.ParseInt32FromQueryString("thread", -1);

            FeedParameterParser feedParams = new FeedParameterParser();

            feedParams.Parse();

            pageId   = feedParams.PageId;
            moduleId = feedParams.ModuleId;
            itemId   = feedParams.ItemId;
            threadId = feedParams.ThreadId;

            // old format still supported for backward compat
            //  /Forums/RSS.aspx?mid=34&pageid=5
            //  /Forums/RSS.aspx?ItemID=2&mid=34&pageid=5
            //  /Forums/RSS.aspx?ItemID=2&mid=34&pageid=5&thread=10373

            // new format reduces to 2 params with the 2nd one a combination of ~ delimited: moduelid~itemId~threadid
            //  /Forums/RSS.aspx?pageid=5&m=34~-1~-1


            securityBypassGuid = WebUtils.ParseGuidFromQueryString("g", securityBypassGuid);
            //module = GetModule();

            //if ((moduleId == -1) || (module == null) || (siteSettings == null)) { return; }

            bypassPageSecurity = false;

            if ((securityBypassGuid != Guid.Empty) && (securityBypassGuid == WebConfigSettings.InternalFeedSecurityBypassKey))
            {
                bypassPageSecurity = true;
            }

            // this old security logic is not needed since we are filtering the items by page and module roles

            //if(
            //    (bypassPageSecurity)
            //    ||(WebUser.IsInRoles(pageSettings.AuthorizedRoles))
            //    || (WebUser.IsInRoles(module.ViewRoles))
            //    )
            //{
            //    canView = true;
            //}

            //if (!canView) { return; }

            //baseUrl = Request.Url.ToString().Replace("RSS.aspx", "Thread.aspx");

            if (WebConfigSettings.UseFoldersInsteadOfHostnamesForMultipleSites)
            {
                navigationSiteRoot = SiteUtils.GetNavigationSiteRoot();
                imageSiteRoot      = WebUtils.GetSiteRoot();
                cssBaseUrl         = imageSiteRoot;
            }
            else
            {
                navigationSiteRoot = SiteUtils.GetNavigationSiteRoot();
                imageSiteRoot      = navigationSiteRoot;
                cssBaseUrl         = WebUtils.GetSiteRoot();
            }


            moduleSettings = ModuleSettings.GetModuleSettings(moduleId);

            maxDaysOld = WebUtils.ParseInt32FromHashtable(moduleSettings, "RSSFeedMaxDaysOldSetting", 90);

            entriesLimit = WebUtils.ParseInt32FromHashtable(moduleSettings, "RSSFeedMaxPostsSetting", 90);

            //Feedfetcher-Google
            isGoogleFeedReader = ((Request.UserAgent != null) && (Request.UserAgent.Contains("Feedfetcher-Google")));
        }
コード例 #2
0
ファイル: RSS.aspx.cs プロジェクト: saiesh86/TravelBlog
        private void LoadSettings()
        {
            siteSettings = CacheHelper.GetCurrentSiteSettings();
            pageSettings = CacheHelper.GetCurrentPage();
            //pageId = WebUtils.ParseInt32FromQueryString("pageid", -1);
            //moduleId = WebUtils.ParseInt32FromQueryString("mid", -1);
            //itemId = WebUtils.ParseInt32FromQueryString("ItemID", -1);
            //threadId = WebUtils.ParseInt32FromQueryString("thread", -1);

            FeedParameterParser feedParams = new FeedParameterParser();
            feedParams.Parse();

            pageId = feedParams.PageId;
            moduleId = feedParams.ModuleId;
            itemId = feedParams.ItemId;
            threadId = feedParams.ThreadId;

            // old format still supported for backward compat
            //  /Forums/RSS.aspx?mid=34&pageid=5
            //  /Forums/RSS.aspx?ItemID=2&mid=34&pageid=5
            //  /Forums/RSS.aspx?ItemID=2&mid=34&pageid=5&thread=10373

            // new format reduces to 2 params with the 2nd one a combination of ~ delimited: moduelid~itemId~threadid
            //  /Forums/RSS.aspx?pageid=5&m=34~-1~-1

            securityBypassGuid = WebUtils.ParseGuidFromQueryString("g", securityBypassGuid);
            //module = GetModule();

            //if ((moduleId == -1) || (module == null) || (siteSettings == null)) { return; }

            bypassPageSecurity = false;

            if ((securityBypassGuid != Guid.Empty) && (securityBypassGuid == WebConfigSettings.InternalFeedSecurityBypassKey))
            {
                bypassPageSecurity = true;
            }

            // this old security logic is not needed since we are filtering the items by page and module roles

            //if(
            //    (bypassPageSecurity)
            //    ||(WebUser.IsInRoles(pageSettings.AuthorizedRoles))
            //    || (WebUser.IsInRoles(module.ViewRoles))
            //    )
            //{
            //    canView = true;
            //}

            //if (!canView) { return; }

            //baseUrl = Request.Url.ToString().Replace("RSS.aspx", "Thread.aspx");

            if (WebConfigSettings.UseFoldersInsteadOfHostnamesForMultipleSites)
            {
                navigationSiteRoot = SiteUtils.GetNavigationSiteRoot();
                imageSiteRoot = WebUtils.GetSiteRoot();
                cssBaseUrl = imageSiteRoot;

            }
            else
            {
                navigationSiteRoot = SiteUtils.GetNavigationSiteRoot();
                imageSiteRoot = navigationSiteRoot;
                cssBaseUrl = WebUtils.GetSiteRoot();

            }

            moduleSettings = ModuleSettings.GetModuleSettings(moduleId);

            maxDaysOld = WebUtils.ParseInt32FromHashtable(moduleSettings, "RSSFeedMaxDaysOldSetting", 90);

            entriesLimit = WebUtils.ParseInt32FromHashtable( moduleSettings, "RSSFeedMaxPostsSetting", 90);

            //Feedfetcher-Google
            isGoogleFeedReader = ((Request.UserAgent != null) && (Request.UserAgent.Contains("Feedfetcher-Google")));
        }