public static ContentPage GetPage(string sCurrentPage) { ContentPage pageContents = null; using (ContentPageHelper pageHelper = new ContentPageHelper()) { if (SecurityData.IsAdmin || SecurityData.IsSiteEditor) { if (sCurrentPage.Length <= 1 || sCurrentPage == SiteData.DefaultDirectoryFilename) { pageContents = pageHelper.FindHome(SiteData.CurrentSiteID); } else { pageContents = pageHelper.FindByFilename(SiteData.CurrentSiteID, sCurrentPage); } } else { if (sCurrentPage.Length <= 1 || sCurrentPage == SiteData.DefaultDirectoryFilename) { pageContents = pageHelper.FindHome(SiteData.CurrentSiteID, true); } else { pageContents = pageHelper.GetLatestContentByURL(SiteData.CurrentSiteID, true, sCurrentPage); } } } return pageContents; }
public static ContentPage GetCurrentLivePage() { ContentPage pageContents = null; using (ContentPageHelper pageHelper = new ContentPageHelper()) { bool IsPageTemplate = false; string sCurrentPage = SiteData.CurrentScriptName; string sScrubbedURL = SiteData.AlternateCurrentScriptName; if (sScrubbedURL.ToLower() != sCurrentPage.ToLower()) { sCurrentPage = sScrubbedURL; } if (SecurityData.IsAdmin || SecurityData.IsSiteEditor) { if (sCurrentPage.Length <= 1 || sCurrentPage == SiteData.DefaultDirectoryFilename) { pageContents = pageHelper.FindHome(SiteData.CurrentSiteID); } else { pageContents = pageHelper.FindByFilename(SiteData.CurrentSiteID, sCurrentPage); } } else { if (sCurrentPage.Length <= 1 || sCurrentPage == SiteData.DefaultDirectoryFilename) { pageContents = pageHelper.FindHome(SiteData.CurrentSiteID, true); } else { pageContents = pageHelper.GetLatestContentByURL(SiteData.CurrentSiteID, true, sCurrentPage); } } if (pageContents == null && SiteData.IsPageReal) { IsPageTemplate = true; } if ((SiteData.IsPageSampler || IsPageTemplate || !IsWebView) && pageContents == null) { pageContents = ContentPageHelper.GetSamplerView(); } if (IsPageTemplate) { pageContents.TemplateFile = sCurrentPage; } } return pageContents; }