Inheritance: IDisposable, ISiteNavHelper
Esempio n. 1
0
 protected SiteNav GetHomePage(SiteData site)
 {
     if (_navHome == null) {
         using (SiteNavHelper navHelper = new SiteNavHelper()) {
             _navHome = navHelper.FindHome(site.SiteID, false);
         }
     }
     return _navHome;
 }
Esempio n. 2
0
        public static void RegisterRoutes(RouteCollection routes, bool OverrideRefresh)
        {
            try {
                string sKeyPrefix = "CarrotCakeCMS_";

                if (!HasRegisteredRoutes || OverrideRefresh)
                {
                    List <string> listFiles = SiteNavHelper.GetSiteDirectoryPaths();
                    int           iRoute    = 0;
                    List <Route>  lstRoute  = new List <Route>();

                    //routes.Clear();
                    //only remove routes that are tagged as coming from the CMS
                    foreach (Route rr in routes)
                    {
                        if (rr.DataTokens != null && rr.DataTokens["RouteName"] != null && rr.DataTokens["RouteName"].ToString().StartsWith(sKeyPrefix))
                        {
                            lstRoute.Add(rr);
                        }
                    }
                    foreach (Route rr in lstRoute)
                    {
                        RouteTable.Routes.Remove(rr);
                    }

                    foreach (string fileName in listFiles)
                    {
                        string sKeyName = sKeyPrefix + iRoute.ToString();

                        VirtualDirectory vd = new VirtualDirectory(fileName);
                        Route            r  = new Route(fileName.Substring(1, fileName.LastIndexOf("/")), vd);
                        if (r.DataTokens == null)
                        {
                            r.DataTokens = new RouteValueDictionary();
                        }
                        r.DataTokens["RouteName"] = sKeyName;
                        routes.Add(sKeyName, r);

                        iRoute++;
                    }

                    HasRegisteredRoutes = true;
                }
            } catch (Exception ex) {
                //assumption is database is probably empty / needs updating, so trigger the under construction view
                if (DatabaseUpdate.SystemNeedsChecking(ex) || DatabaseUpdate.AreCMSTablesIncomplete())
                {
                    routes.Clear();
                    HasRegisteredRoutes = false;
                }
                else
                {
                    //something bad has gone down, toss back the error
                    throw;
                }
            }
        }
        public string SendTrackback(string sourceURL, Guid siteID, string sTgtURL)
        {
            this.DestinationUrl = new Uri(sTgtURL);
            this.BlogSite = SiteData.GetSiteFromCache(siteID);

            using (SiteNavHelper snh = new SiteNavHelper()) {
                this.SourcePage = snh.FindByFilename(siteID, sourceURL);
            }

            return SendTrackback();
        }
        public string SendTrackback(Guid sourceGuid, Guid siteID, string sTgtURL)
        {
            this.DestinationUrl = new Uri(sTgtURL);
            this.BlogSite = SiteData.GetSiteFromCache(siteID);

            using (SiteNavHelper snh = new SiteNavHelper()) {
                this.SourcePage = snh.GetLatestVersion(siteID, sourceGuid);
            }

            return SendTrackback();
        }
Esempio n. 5
0
        public void RenderSiteMap(HttpContext context)
        {
            HttpRequest request = context.Request;
            HttpResponse response = context.Response;

            SiteData site = SiteData.CurrentSite;
            List<SiteNav> lstNav = new List<SiteNav>();

            using (SiteNavHelper navHelper = new SiteNavHelper()) {
                //lstNav = navHelper.GetTwoLevelNavigation(SiteData.CurrentSiteID, true);
                lstNav = navHelper.GetLevelDepthNavigation(SiteData.CurrentSiteID, 4, true);
            }
            lstNav.RemoveAll(x => x.ShowInSiteMap == false);

            DateTime dtMax = lstNav.Min(x => x.EditDate);
            string DateFormat = "yyyy-MM-dd";

            response.Buffer = false;
            response.Clear();
            response.ContentType = "application/xml";

            XmlWriter writer = XmlWriter.Create(response.Output);

            writer.WriteStartDocument();
            writer.WriteRaw("\n");
            writer.WriteStartElement("urlset", "http://www.sitemaps.org/schemas/sitemap/0.9");
            writer.WriteAttributeString("xmlns", "xsi", null, "http://www.w3.org/2001/XMLSchema-instance");
            writer.WriteAttributeString("xsi", "schemaLocation", null, "http://www.sitemaps.org/schemas/sitemap/0.9    http://www.sitemaps.org/schemas/sitemap/0.9/sitemap.xsd");

            writer.WriteRaw("\n");
            writer.WriteStartElement("url");
            writer.WriteElementString("loc", site.MainURL);
            writer.WriteElementString("lastmod", dtMax.ToString(DateFormat));
            writer.WriteElementString("priority", "1.0");
            writer.WriteEndElement();
            writer.WriteRaw("\n");

            // always, hourly, daily, weekly, monthly, yearly, never

            foreach (SiteNav n in lstNav) {
                writer.WriteStartElement("url");
                writer.WriteElementString("loc", site.ConstructedCanonicalURL(n));
                writer.WriteElementString("lastmod", n.EditDate.ToString(DateFormat));
                writer.WriteElementString("changefreq", "weekly");
                writer.WriteElementString("priority", n.Parent_ContentID.HasValue ? "0.60" : "0.80");
                writer.WriteEndElement();
                writer.WriteRaw("\n");
            }

            writer.WriteEndDocument();

            writer.Flush();
            writer.Close();
        }
Esempio n. 6
0
        public List <SiteNav> GetTwoLevelNavigation(Guid siteID, bool bActiveOnly)
        {
            List <SiteNav> lstNav  = SiteNavHelper.GetSamplerFakeNav();
            List <SiteNav> lstNav2 = new List <SiteNav>();

            foreach (SiteNav l in lstNav)
            {
                lstNav2 = lstNav2.Union(SiteNavHelper.GetSamplerFakeNav(l.Root_ContentID)).ToList();
            }

            lstNav = lstNav.Union(lstNav2).ToList();
            return(lstNav);
        }
Esempio n. 7
0
        protected void DoDataBind()
        {
            List<SiteNav> lstNav = null;

            using (SiteNavHelper navHelper = new SiteNavHelper()) {
                lstNav = navHelper.GetChildNavigation(SiteData.CurrentSiteID, guidContentID, !SecurityData.IsAuthEditor);
            }

            if (bClickedSort && ddlAlternateSort.SelectedIndex > 0) {
                switch (ddlAlternateSort.SelectedValue) {
                    case "alpha":
                        lstNav = lstNav.OrderBy(x => x.NavMenuText).ToList();
                        break;

                    case "datecreated":
                        lstNav = lstNav.OrderBy(x => x.CreateDate).ToList();
                        break;

                    case "dateupdated":
                        lstNav = lstNav.OrderBy(x => x.EditDate).ToList();
                        break;

                    case "alpha2":
                        lstNav = lstNav.OrderByDescending(x => x.NavMenuText).ToList();
                        break;

                    case "datecreated2":
                        lstNav = lstNav.OrderByDescending(x => x.CreateDate).ToList();
                        break;

                    case "dateupdated2":
                        lstNav = lstNav.OrderByDescending(x => x.EditDate).ToList();
                        break;

                    default:
                        lstNav = lstNav.OrderBy(x => x.NavOrder).ToList();
                        break;
                }
            }

            lstNav.ToList().ForEach(q => CMSConfigHelper.IdentifyLinkAsInactive(q));

            GeneralUtilities.BindRepeater(rpPages, lstNav);

            if (lstNav.Count < 2) {
                btnSave.Visible = false;
            }
        }
Esempio n. 8
0
        public SiteNav GetSiteNav()
        {
            SiteNav sd = null;

            if (SiteData.IsPageSampler || !SiteData.IsWebView)
            {
                sd = SiteNavHelper.GetSamplerView();
            }
            else
            {
                using (ISiteNavHelper navHelper = SiteNavFactory.GetSiteNavHelper()) {
                    sd = navHelper.GetLatestVersion(this.SiteID, this.Root_ContentID);
                }
            }
            return(sd);
        }
        public void SortChildren()
        {
            List<SiteNav> lstNav = null;
            using (SiteNavHelper navHelper = new SiteNavHelper()) {
                lstNav = navHelper.GetChildNavigation(SiteData.CurrentSiteID, this.Root_ContentID, !SecurityData.IsAuthEditor);
            }

            if (!String.IsNullOrEmpty(this.SelectedSort)) {
                switch (this.SelectedSort) {
                    case "alpha":
                        lstNav = lstNav.OrderBy(x => x.NavMenuText).ToList();
                        break;

                    case "datecreated":
                        lstNav = lstNav.OrderBy(x => x.CreateDate).ToList();
                        break;

                    case "dateupdated":
                        lstNav = lstNav.OrderBy(x => x.EditDate).ToList();
                        break;

                    case "alpha2":
                        lstNav = lstNav.OrderByDescending(x => x.NavMenuText).ToList();
                        break;

                    case "datecreated2":
                        lstNav = lstNav.OrderByDescending(x => x.CreateDate).ToList();
                        break;

                    case "dateupdated2":
                        lstNav = lstNav.OrderByDescending(x => x.EditDate).ToList();
                        break;

                    default:
                        lstNav = lstNav.OrderBy(x => x.NavOrder).ToList();
                        break;
                }
            }

            lstNav.ToList().ForEach(q => CMSConfigHelper.IdentifyLinkAsInactive(q));

            this.Pages = lstNav;
        }
Esempio n. 10
0
        public List <SiteNav> GetLevelDepthNavigation(Guid siteID, int iDepth, bool bActiveOnly)
        {
            List <SiteNav> lstNav  = SiteNavHelper.GetSamplerFakeNav();
            List <SiteNav> lstNav2 = new List <SiteNav>();

            foreach (SiteNav l1 in lstNav)
            {
                List <SiteNav> lst = SiteNavHelper.GetSamplerFakeNav(l1.Root_ContentID);
                lstNav2 = lstNav2.Union(lst).ToList();

                foreach (SiteNav l2 in lst)
                {
                    List <SiteNav> lst2 = SiteNavHelper.GetSamplerFakeNav(l2.Root_ContentID);
                    lstNav2 = lstNav2.Union(lst2).ToList();
                }
            }

            lstNav = lstNav.Union(lstNav2).ToList();
            return(lstNav);
        }
Esempio n. 11
0
        protected BasicContentData GetFileInfoFromList(SiteData site, string sFilename)
        {
            if (sitePageList == null || sitePageList.Count < 1 || iAccessCounter % 25 == 0) {
                sitePageList = site.GetFullSiteFileList();
                iAccessCounter = 0;
            }
            iAccessCounter++;

            BasicContentData pageData = (from m in sitePageList
                                         where m.FileName.ToLower() == sFilename.ToLower()
                                         select m).FirstOrDefault();

            if (pageData == null) {
                using (SiteNavHelper navHelper = new SiteNavHelper()) {
                    pageData = BasicContentData.CreateBasicContentDataFromSiteNav(navHelper.GetLatestVersion(site.SiteID, false, sFilename.ToLower()));
                }
            }

            return pageData;
        }
Esempio n. 12
0
        public void GenerateSuccessResponse(HttpRequest request, XmlWriter writer, TrackBackInfo tb)
        {
            SiteNav navData = null;
            using (SiteNavHelper snh = new SiteNavHelper()) {
                navData = snh.FindByFilename(SiteData.CurrentSiteID, tb.BlogPostID);
            }
            string sReferer = null;
            string sIP = request.ServerVariables["REMOTE_ADDR"].ToString();
            try { sReferer = request.ServerVariables["HTTP_REFERER"].ToString(); } catch { }

            PostComment pc = new PostComment();
            pc.ContentCommentID = Guid.NewGuid();
            pc.Root_ContentID = navData.Root_ContentID;
            pc.CreateDate = SiteData.CurrentSite.Now;
            pc.IsApproved = false;
            pc.IsSpam = false;
            pc.CommenterIP = sIP;
            pc.CommenterEmail = "trackback";

            pc.CommenterName = tb.BlogName;
            pc.PostCommentText = tb.BlogExcerpt;

            #if DEBUG
            pc.PostCommentText = request.UserAgent + "\r\n" + tb.RequestSourceURL + "\r\n" + tb.BlogExcerpt;
            #endif

            pc.CommenterURL = tb.RequestSourceURL;
            if (!String.IsNullOrEmpty(sReferer)) {
                pc.CommenterURL = sReferer;
            }

            pc.Save();

            writer.WriteStartElement("response");
            writer.WriteElementString("error", "0");
            writer.WriteStartElement("rss");
            writer.WriteAttributeString("version", "0.91");
            writer.WriteStartElement("channel");

            if (navData != null) {
                writer.WriteElementString("title", navData.NavMenuText);
                writer.WriteElementString("link", SiteData.CurrentSite.ConstructedCanonicalURL(navData));
                writer.WriteElementString("description", navData.PageTextPlainSummary.ToString());
            }

            writer.WriteElementString("language", "");

            writer.WriteEndElement();
            writer.WriteEndElement();
            writer.WriteEndElement();

            writer.Flush();
            writer.Close();
        }
        protected void btnSearch_Click(object sender, EventArgs e)
        {
            List<SiteNav> lstContents = new List<SiteNav>();
            int iTake = 10;
            int iTotal = -1;

            phResults.Visible = true;
            sSearchTerm = txtSearchTerm.Text;
            hdnSelectedItem.Value = "";

            GeneralUtilities.BindDataBoundControl(gvWidgets, null);

            if (!string.IsNullOrEmpty(gvPages.DefaultSort)) {
                int pos = gvPages.DefaultSort.LastIndexOf(" ");
                sSortFld = gvPages.DefaultSort.Substring(0, pos).Trim();
                sSortDir = gvPages.DefaultSort.Substring(pos).Trim();
            }

            bool bLimit = chkActive.Checked;

            using (SiteNavHelper navHelper = new SiteNavHelper()) {
                if (!string.IsNullOrEmpty(sSearchTerm)) {
                    iTotal = navHelper.GetSiteSearchCount(SiteData.CurrentSiteID, sSearchTerm, bLimit);
                    lstContents = navHelper.GetLatestContentSearchList(SiteData.CurrentSiteID, sSearchTerm, bLimit, iTake, 0, sSortFld, sSortDir);
                }
            }

            if (iTotal > 0) {
                if (iTotal > lstContents.Count) {
                    litResults.Text = String.Format("Showing {0} of {1} total results", lstContents.Count, iTotal);
                } else {
                    litResults.Text = String.Format("Showing {0} results", lstContents.Count);
                }
            }

            GeneralUtilities.BindDataBoundControl(gvPages, lstContents);
        }
Esempio n. 14
0
 public SiteNav FindHome(Guid siteID, bool bActiveOnly)
 {
     return(SiteNavHelper.GetSamplerView());
 }
Esempio n. 15
0
 public SiteNav FindHome(Guid siteID)
 {
     return(SiteNavHelper.GetSamplerView());
 }
Esempio n. 16
0
 public SiteNav GetLatestVersion(Guid siteID, Guid rootContentID)
 {
     return(SiteNavHelper.GetSamplerView());
 }
Esempio n. 17
0
 public List <SiteNav> GetTopNavigation(Guid siteID, bool bActiveOnly)
 {
     return(SiteNavHelper.GetSamplerFakeNav());
 }
Esempio n. 18
0
 public List <SiteNav> GetChildNavigation(Guid siteID, Guid?parentPageID, bool bActiveOnly)
 {
     return(SiteNavHelper.GetSamplerFakeNav(parentPageID));
 }
Esempio n. 19
0
 public SiteNav GetParentPageNavigation(Guid siteID, Guid rootContentID)
 {
     return(SiteNavHelper.GetSamplerView());
 }
Esempio n. 20
0
 public List <SiteNav> GetSiblingNavigation(Guid siteID, string sPage, bool bActiveOnly)
 {
     return(SiteNavHelper.GetSamplerFakeNav(Guid.NewGuid()));
 }
Esempio n. 21
0
        private void ImportStuff()
        {
            SiteData.CurrentSite = null;

            SiteData site = SiteData.CurrentSite;

            litMessage.Text = "<p>No Items Selected For Import</p>";
            string sMsg = "";

            if (chkSite.Checked || chkPages.Checked || chkPosts.Checked) {
                List<string> tags = site.GetTagList().Select(x => x.TagSlug.ToLower()).ToList();
                List<string> cats = site.GetCategoryList().Select(x => x.CategorySlug.ToLower()).ToList();

                wpSite.Tags.RemoveAll(x => tags.Contains(x.InfoKey.ToLower()));
                wpSite.Categories.RemoveAll(x => cats.Contains(x.InfoKey.ToLower()));

                sMsg += "<p>Imported Tags and Categories</p>";

                List<ContentTag> lstTag = (from l in wpSite.Tags.Distinct()
                                           select new ContentTag {
                                               ContentTagID = Guid.NewGuid(),
                                               IsPublic = true,
                                               SiteID = site.SiteID,
                                               TagSlug = l.InfoKey,
                                               TagText = l.InfoLabel
                                           }).Distinct().ToList();

                List<ContentCategory> lstCat = (from l in wpSite.Categories.Distinct()
                                                select new ContentCategory {
                                                    ContentCategoryID = Guid.NewGuid(),
                                                    IsPublic = true,
                                                    SiteID = site.SiteID,
                                                    CategorySlug = l.InfoKey,
                                                    CategoryText = l.InfoLabel
                                                }).Distinct().ToList();

                foreach (var v in lstTag) {
                    v.Save();
                }
                foreach (var v in lstCat) {
                    v.Save();
                }
            }
            SetMsg(sMsg);

            if (chkSite.Checked) {
                sMsg += "<p>Updated Site Name</p>";
                site.SiteName = wpSite.SiteTitle;
                site.SiteTagline = wpSite.SiteDescription;
                site.Save();
            }
            SetMsg(sMsg);

            if (!chkMapAuthor.Checked) {
                wpSite.Authors = new List<WordPressUser>();
            }

            //itterate author collection and find if in the system
            foreach (WordPressUser wpu in wpSite.Authors) {
                wpu.ImportUserID = Guid.Empty;

                MembershipUser usr = null;
                //attempt to find the user in the userbase
                usr = SecurityData.GetUserListByEmail(wpu.Email).FirstOrDefault();
                if (usr != null) {
                    wpu.ImportUserID = new Guid(usr.ProviderUserKey.ToString());
                } else {
                    usr = SecurityData.GetUserListByName(wpu.Login).FirstOrDefault();
                    if (usr != null) {
                        wpu.ImportUserID = new Guid(usr.ProviderUserKey.ToString());
                    }
                }

                if (chkAuthors.Checked) {
                    if (wpu.ImportUserID == Guid.Empty) {
                        usr = Membership.CreateUser(wpu.Login, ProfileManager.GenerateSimplePassword(), wpu.Email);
                        Roles.AddUserToRole(wpu.Login, SecurityData.CMSGroup_Users);
                        wpu.ImportUserID = new Guid(usr.ProviderUserKey.ToString());
                    }

                    if (wpu.ImportUserID != Guid.Empty) {
                        ExtendedUserData ud = new ExtendedUserData(wpu.ImportUserID);
                        if (!string.IsNullOrEmpty(wpu.FirstName) || !string.IsNullOrEmpty(wpu.LastName)) {
                            ud.FirstName = wpu.FirstName;
                            ud.LastName = wpu.LastName;
                            ud.Save();
                        }
                    }
                }
            }

            wpSite.Comments.ForEach(r => r.ImportRootID = Guid.Empty);

            using (SiteNavHelper navHelper = new SiteNavHelper()) {
                if (chkPages.Checked) {
                    sMsg += "<p>Imported Pages</p>";

                    int iOrder = 0;
                    SiteNav navHome = navHelper.FindHome(site.SiteID, false);
                    if (navHome != null) {
                        iOrder = 2;
                    }

                    foreach (var wpp in (from c in wpSite.Content
                                         where c.PostType == WordPressPost.WPPostType.Page
                                         orderby c.PostOrder, c.PostTitle
                                         select c).ToList()) {
                        GrabAttachments(wpp);
                        RepairBody(wpp);

                        ContentPage cp = ContentImportExportUtils.CreateWPContentPage(wpSite, wpp, site);
                        cp.SiteID = site.SiteID;
                        cp.ContentType = ContentPageType.PageType.ContentEntry;
                        cp.EditDate = SiteData.CurrentSite.Now;
                        cp.NavOrder = iOrder;
                        cp.TemplateFile = ddlTemplatePage.SelectedValue;

                        WordPressPost parent = (from c in wpSite.Content
                                                where c.PostType == WordPressPost.WPPostType.Page
                                                  && c.PostID == wpp.ParentPostID
                                                select c).FirstOrDefault();

                        SiteNav navParent = null;

                        SiteNav navData = navHelper.GetLatestVersion(site.SiteID, false, cp.FileName.ToLower());
                        if (parent != null) {
                            navParent = navHelper.GetLatestVersion(site.SiteID, false, parent.ImportFileName.ToLower());
                        }

                        //if URL exists already, make this become a new version in the current series
                        if (navData != null) {
                            cp.Root_ContentID = navData.Root_ContentID;
                            if (navData.NavOrder == 0) {
                                cp.NavOrder = 0;
                            }
                        }

                        if (navParent != null) {
                            cp.Parent_ContentID = navParent.Root_ContentID;
                        } else {
                            if (parent != null) {
                                cp.Parent_ContentID = parent.ImportRootID;
                            }
                        }
                        //preserve homepage
                        if (navHome != null && navHome.FileName.ToLower() == cp.FileName.ToLower()) {
                            cp.NavOrder = 0;
                        }

                        cp.RetireDate = CalcNearestFiveMinTime(cp.CreateDate).AddYears(200);
                        cp.GoLiveDate = CalcNearestFiveMinTime(cp.CreateDate).AddMinutes(-5);

                        //if URL exists already, make this become a new version in the current series
                        if (navData != null) {
                            cp.Root_ContentID = navData.Root_ContentID;
                            cp.RetireDate = navData.RetireDate;
                            cp.GoLiveDate = navData.GoLiveDate;
                        }

                        cp.SavePageEdit();

                        wpSite.Comments.Where(x => x.PostID == wpp.PostID).ToList().ForEach(r => r.ImportRootID = cp.Root_ContentID);

                        iOrder++;
                    }
                }

                if (chkPosts.Checked) {
                    sMsg += "<p>Imported Posts</p>";

                    foreach (var wpp in (from c in wpSite.Content
                                         where c.PostType == WordPressPost.WPPostType.BlogPost
                                         orderby c.PostOrder
                                         select c).ToList()) {
                        GrabAttachments(wpp);
                        RepairBody(wpp);

                        ContentPage cp = ContentImportExportUtils.CreateWPContentPage(wpSite, wpp, site);
                        cp.SiteID = site.SiteID;
                        cp.Parent_ContentID = null;
                        cp.ContentType = ContentPageType.PageType.BlogEntry;
                        cp.EditDate = SiteData.CurrentSite.Now;
                        cp.NavOrder = SiteData.BlogSortOrderNumber;
                        cp.TemplateFile = ddlTemplatePost.SelectedValue;

                        SiteNav navData = navHelper.GetLatestVersion(site.SiteID, false, cp.FileName.ToLower());

                        cp.RetireDate = CalcNearestFiveMinTime(cp.CreateDate).AddYears(200);
                        cp.GoLiveDate = CalcNearestFiveMinTime(cp.CreateDate).AddMinutes(-5);

                        //if URL exists already, make this become a new version in the current series
                        if (navData != null) {
                            cp.Root_ContentID = navData.Root_ContentID;
                            cp.RetireDate = navData.RetireDate;
                            cp.GoLiveDate = navData.GoLiveDate;
                        }

                        cp.SavePageEdit();

                        wpSite.Comments.Where(x => x.PostID == wpp.PostID).ToList().ForEach(r => r.ImportRootID = cp.Root_ContentID);
                    }

                    using (ContentPageHelper cph = new ContentPageHelper()) {
                        //cph.BulkBlogFileNameUpdateFromDate(site.SiteID);
                        cph.ResolveDuplicateBlogURLs(site.SiteID);
                        cph.FixBlogNavOrder(site.SiteID);
                    }
                }
            }
            SetMsg(sMsg);

            wpSite.Comments.RemoveAll(r => r.ImportRootID == Guid.Empty);

            if (wpSite.Comments.Any()) {
                sMsg += "<p>Imported Comments</p>";
            }

            foreach (WordPressComment wpc in wpSite.Comments) {
                int iCommentCount = -1;

                iCommentCount = PostComment.GetCommentCountByContent(site.SiteID, wpc.ImportRootID, wpc.CommentDateUTC, wpc.AuthorIP, wpc.CommentContent);
                if (iCommentCount < 1) {
                    iCommentCount = PostComment.GetCommentCountByContent(site.SiteID, wpc.ImportRootID, wpc.CommentDateUTC, wpc.AuthorIP);
                }

                if (iCommentCount < 1) {
                    PostComment pc = new PostComment();
                    pc.ContentCommentID = Guid.NewGuid();
                    pc.Root_ContentID = wpc.ImportRootID;
                    pc.CreateDate = site.ConvertUTCToSiteTime(wpc.CommentDateUTC);
                    pc.IsApproved = false;
                    pc.IsSpam = false;

                    pc.CommenterIP = wpc.AuthorIP;
                    pc.CommenterName = wpc.Author;
                    pc.CommenterEmail = wpc.AuthorEmail;
                    pc.PostCommentText = wpc.CommentContent;
                    pc.CommenterURL = wpc.AuthorURL;

                    if (wpc.Approved == "1") {
                        pc.IsApproved = true;
                    }
                    if (wpc.Approved.ToLower() == "trash") {
                        pc.IsSpam = true;
                    }
                    if (wpc.Type.ToLower() == "trackback" || wpc.Type.ToLower() == "pingback") {
                        pc.CommenterEmail = wpc.Type;
                    }

                    pc.Save();
                }
            }
            SetMsg(sMsg);

            BindData();
        }
Esempio n. 22
0
        public List<ContentTag> GetSiteTags(int iTakeTop, bool ShowNonZeroCountOnly)
        {
            List<ContentTag> lstNav = new List<ContentTag>();
            if (iTakeTop < 0) {
                iTakeTop = 100000;
            }
            using (SiteNavHelper navHelper = new SiteNavHelper()) {
                lstNav = navHelper.GetTagList(this.TheSite.SiteID, iTakeTop);
            }

            lstNav.RemoveAll(x => x.Count < 1 && ShowNonZeroCountOnly);
            lstNav = lstNav.OrderByDescending(x => x.Count).ToList();

            return lstNav;
        }
Esempio n. 23
0
        public List<ContentDateTally> GetSiteDates(int iTakeTop)
        {
            List<ContentDateTally> lstNav = new List<ContentDateTally>();
            if (iTakeTop < 0) {
                iTakeTop = 100000;
            }
            using (SiteNavHelper navHelper = new SiteNavHelper()) {
                lstNav = navHelper.GetMonthBlogUpdateList(SiteData.CurrentSiteID, iTakeTop, !SecurityData.IsAuthEditor);
            }

            lstNav.RemoveAll(x => x.Count < 1);
            lstNav = lstNav.OrderByDescending(x => x.TallyDate).ToList();

            return lstNav;
        }
Esempio n. 24
0
        public List<ContentTag> GetPageTags(int iTakeTop)
        {
            if (iTakeTop < 0) {
                iTakeTop = 100000;
            }

            using (SiteNavHelper navHelper = new SiteNavHelper()) {
                return navHelper.GetTagListForPost(this.TheSite.SiteID, iTakeTop, this.ThePage.Root_ContentID);
            }
        }
Esempio n. 25
0
        public void ProcessRequest(HttpContext context)
        {
            using (SiteNavHelper navHelper = new SiteNavHelper()) {

                SiteNav navData = null;
                string sFileRequested = context.Request.Path;
                sRequestedURL = sFileRequested;
                string sScrubbedURL = sFileRequested;

                sRequestedURL = SiteData.AppendDefaultPath(sRequestedURL);

                try {
                    sScrubbedURL = SiteData.AlternateCurrentScriptName;

                    if (sScrubbedURL.ToLower() != sRequestedURL.ToLower()) {
                        sFileRequested = sScrubbedURL;
                        bURLOverride = true;
                    }

                    VirtualDirectory.RegisterRoutes();

                } catch (Exception ex) {
                    //assumption is database is probably empty / needs updating, so trigger the under construction view
                    if (DatabaseUpdate.SystemNeedsChecking(ex) || DatabaseUpdate.AreCMSTablesIncomplete()) {
                        if (navData == null) {
                            navData = SiteNavHelper.GetEmptyHome();
                        }
                    } else {
                        //something bad has gone down, toss back the error
                        throw;
                    }
                }

                sFileRequested = SiteData.AppendDefaultPath(sFileRequested);

                if (context.User.Identity.IsAuthenticated) {
                    try {
                        if (context.Request.UrlReferrer != null && !string.IsNullOrEmpty(context.Request.UrlReferrer.AbsolutePath)) {
                            if (context.Request.UrlReferrer.AbsolutePath.ToLower().Contains(FormsAuthentication.LoginUrl.ToLower())
                                || FormsAuthentication.LoginUrl.ToLower() == sFileRequested.ToLower()) {
                                if (SiteFilename.DashboardURL.ToLower() != sFileRequested.ToLower()
                                && SiteFilename.SiteInfoURL.ToLower() != sFileRequested.ToLower()) {
                                    sFileRequested = SiteData.AdminDefaultFile;
                                }
                            }
                        }
                    } catch (Exception ex) { }
                }

                if (sFileRequested.ToLower().EndsWith(".aspx") || sFileRequested.Length < 3) {
                    bool bIgnorePublishState = SecurityData.AdvancedEditMode || SecurityData.IsAdmin || SecurityData.IsSiteEditor;

                    string queryString = String.Empty;
                    queryString = context.Request.QueryString.ToString();
                    if (string.IsNullOrEmpty(queryString)) {
                        queryString = String.Empty;
                    }

                    if (!CMSConfigHelper.CheckRequestedFileExistence(sFileRequested, SiteData.CurrentSiteID) || sFileRequested.ToLower() == SiteData.DefaultDirectoryFilename) {

                        context.Items[REQ_PATH] = context.Request.PathInfo;
                        context.Items[REQ_QUERY] = context.Request.QueryString.ToString();

                        // handle a case where this site was migrated from a format where all pages varied on a consistent querystring
                        // allow this QS parm to be set in a config file.
                        if (sFileRequested.Length < 3 || sFileRequested.ToLower() == SiteData.DefaultDirectoryFilename) {
                            string sParm = String.Empty;
                            if (SiteData.OldSiteQuerystring != string.Empty) {
                                if (context.Request.QueryString[SiteData.OldSiteQuerystring] != null) {
                                    sParm = context.Request.QueryString[SiteData.OldSiteQuerystring].ToString();
                                }
                            }
                            if (!string.IsNullOrEmpty(sParm)) {
                                sFileRequested = "/" + sParm + ".aspx";

                                SiteData.Show301Message(sFileRequested);

                                context.Response.Redirect(sFileRequested);
                                context.Items[REQ_PATH] = sFileRequested;
                                context.Items[REQ_QUERY] = String.Empty;
                            }
                        }

                        try {
                            bool bIsHomePage = false;
                            if (sFileRequested.Length < 3 || sFileRequested.ToLower() == SiteData.DefaultDirectoryFilename) {

                                navData = navHelper.FindHome(SiteData.CurrentSiteID, !bIgnorePublishState);

                                if (sFileRequested.ToLower() == SiteData.DefaultDirectoryFilename && navData != null) {
                                    sFileRequested = navData.FileName;
                                    bIsHomePage = true;
                                }
                            }

                            if (!bIsHomePage) {
                                string pageName = sFileRequested;
                                navData = navHelper.GetLatestVersion(SiteData.CurrentSiteID, !bIgnorePublishState, pageName);
                            }

                            if (sFileRequested.ToLower() == SiteData.DefaultDirectoryFilename && navData == null) {
                                navData = SiteNavHelper.GetEmptyHome();
                            }

                        } catch (Exception ex) {
                            //assumption is database is probably empty / needs updating, so trigger the under construction view
                            if (DatabaseUpdate.SystemNeedsChecking(ex) || DatabaseUpdate.AreCMSTablesIncomplete()) {
                                if (navData == null) {
                                    navData = SiteNavHelper.GetEmptyHome();
                                }
                            } else {
                                //something bad has gone down, toss back the error
                                throw;
                            }
                        }

                        if (navData != null) {
                            string sSelectedTemplate = navData.TemplateFile;

                            // selectivly engage the cms helper only if in advance mode
                            if (SecurityData.AdvancedEditMode) {
                                using (CMSConfigHelper cmsHelper = new CMSConfigHelper()) {
                                    if (cmsHelper.cmsAdminContent != null) {
                                        try { sSelectedTemplate = cmsHelper.cmsAdminContent.TemplateFile.ToLower(); } catch { }
                                    }
                                }
                            }

                            if (!CMSConfigHelper.CheckFileExistence(sSelectedTemplate)) {
                                sSelectedTemplate = SiteData.DefaultTemplateFilename;
                            }

                            sVirtualReqFile = sFileRequested;

                            if (bURLOverride) {
                                sVirtualReqFile = sRequestedURL;
                                sFileRequested = sRequestedURL;
                            }

                            RewriteCMSPath(context, sSelectedTemplate, queryString);

                        } else {

                            SiteData.PerformRedirectToErrorPage(404, sFileRequested);
                            SiteData.Show404MessageFull(true);

                        }

                    } else {
                        sVirtualReqFile = sFileRequested;

                        RewriteCMSPath(context, sVirtualReqFile, queryString);
                    }
                }

                context.ApplicationInstance.CompleteRequest();
            }
        }
Esempio n. 26
0
 public SiteNav GetParentPageNavigation(Guid siteID, string sPage)
 {
     return(SiteNavHelper.GetSamplerView());
 }
        public void ProcessRequest(HttpContext context)
        {
            using (ISiteNavHelper navHelper = SiteNavFactory.GetSiteNavHelper()) {
                SiteNav navData        = null;
                string  sFileRequested = context.Request.Path;
                sRequestedURL = sFileRequested;
                string sScrubbedURL = sFileRequested;

                sRequestedURL = SiteData.AppendDefaultPath(sRequestedURL);

                try {
                    sScrubbedURL = SiteData.AlternateCurrentScriptName;

                    if (sScrubbedURL.ToLower() != sRequestedURL.ToLower())
                    {
                        sFileRequested = sScrubbedURL;
                        bURLOverride   = true;
                    }

                    VirtualDirectory.RegisterRoutes();
                } catch (Exception ex) {
                    //assumption is database is probably empty / needs updating, so trigger the under construction view
                    if (DatabaseUpdate.SystemNeedsChecking(ex) || DatabaseUpdate.AreCMSTablesIncomplete())
                    {
                        if (navData == null)
                        {
                            navData = SiteNavHelper.GetEmptyHome();
                        }
                    }
                    else
                    {
                        //something bad has gone down, toss back the error
                        throw;
                    }
                }

                sFileRequested = SiteData.AppendDefaultPath(sFileRequested);

                if (context.User.Identity.IsAuthenticated)
                {
                    try {
                        if (context.Request.UrlReferrer != null && !string.IsNullOrEmpty(context.Request.UrlReferrer.AbsolutePath))
                        {
                            if (context.Request.UrlReferrer.AbsolutePath.ToLower().Contains(FormsAuthentication.LoginUrl.ToLower()) ||
                                FormsAuthentication.LoginUrl.ToLower() == sFileRequested.ToLower())
                            {
                                if (SiteFilename.DashboardURL.ToLower() != sFileRequested.ToLower() &&
                                    SiteFilename.SiteInfoURL.ToLower() != sFileRequested.ToLower())
                                {
                                    sFileRequested = SiteData.AdminDefaultFile;
                                }
                            }
                        }
                    } catch (Exception ex) { }
                }

                if (sFileRequested.ToLower().EndsWith(".aspx") || SiteData.IsLikelyHomePage(sFileRequested))
                {
                    bool bIgnorePublishState = SecurityData.AdvancedEditMode || SecurityData.IsAdmin || SecurityData.IsSiteEditor;

                    string queryString = String.Empty;
                    queryString = context.Request.QueryString.ToString();
                    if (string.IsNullOrEmpty(queryString))
                    {
                        queryString = String.Empty;
                    }

                    if (!CMSConfigHelper.CheckRequestedFileExistence(sFileRequested, SiteData.CurrentSiteID) || SiteData.IsLikelyHomePage(sFileRequested))
                    {
                        context.Items[REQ_PATH]  = context.Request.PathInfo;
                        context.Items[REQ_QUERY] = context.Request.QueryString.ToString();

                        // handle a case where this site was migrated from a format where all pages varied on a consistent querystring
                        // allow this QS parm to be set in a config file.
                        if (SiteData.IsLikelyHomePage(sFileRequested))
                        {
                            string sParm = String.Empty;
                            if (SiteData.OldSiteQuerystring != string.Empty)
                            {
                                if (context.Request.QueryString[SiteData.OldSiteQuerystring] != null)
                                {
                                    sParm = context.Request.QueryString[SiteData.OldSiteQuerystring].ToString();
                                }
                            }
                            if (!string.IsNullOrEmpty(sParm))
                            {
                                sFileRequested = "/" + sParm + ".aspx";

                                SiteData.Show301Message(sFileRequested);

                                context.Response.Redirect(sFileRequested);
                                context.Items[REQ_PATH]  = sFileRequested;
                                context.Items[REQ_QUERY] = String.Empty;
                            }
                        }

                        try {
                            //periodic test of database up-to-dated-ness
                            if (DatabaseUpdate.TablesIncomplete)
                            {
                                navData = SiteNavHelper.GetEmptyHome();
                            }
                            else
                            {
                                bool bIsHomePage = false;

                                if (SiteData.IsLikelyHomePage(sFileRequested))
                                {
                                    navData = navHelper.FindHome(SiteData.CurrentSiteID, !bIgnorePublishState);

                                    if (SiteData.IsLikelyHomePage(sFileRequested) && navData != null)
                                    {
                                        sFileRequested = navData.FileName;
                                        bIsHomePage    = true;
                                    }
                                }

                                if (!bIsHomePage)
                                {
                                    string pageName = sFileRequested;
                                    navData = navHelper.GetLatestVersion(SiteData.CurrentSiteID, !bIgnorePublishState, pageName);
                                }

                                if (SiteData.IsLikelyHomePage(sFileRequested) && navData == null)
                                {
                                    navData = SiteNavHelper.GetEmptyHome();
                                }
                            }
                        } catch (Exception ex) {
                            //assumption is database is probably empty / needs updating, so trigger the under construction view
                            if (DatabaseUpdate.SystemNeedsChecking(ex) || DatabaseUpdate.AreCMSTablesIncomplete())
                            {
                                if (navData == null)
                                {
                                    navData = SiteNavHelper.GetEmptyHome();
                                }
                            }
                            else
                            {
                                //something bad has gone down, toss back the error
                                throw;
                            }
                        }

                        if (navData != null)
                        {
                            string sSelectedTemplate = navData.TemplateFile;

                            // selectivly engage the cms helper only if in advance mode
                            if (SecurityData.AdvancedEditMode)
                            {
                                using (CMSConfigHelper cmsHelper = new CMSConfigHelper()) {
                                    if (cmsHelper.cmsAdminContent != null)
                                    {
                                        try { sSelectedTemplate = cmsHelper.cmsAdminContent.TemplateFile.ToLower(); } catch { }
                                    }
                                }
                            }

                            if (!CMSConfigHelper.CheckFileExistence(sSelectedTemplate))
                            {
                                sSelectedTemplate = SiteData.DefaultTemplateFilename;
                            }

                            sVirtualReqFile = sFileRequested;

                            if (bURLOverride)
                            {
                                sVirtualReqFile = sRequestedURL;
                                sFileRequested  = sRequestedURL;
                            }

                            RewriteCMSPath(context, sSelectedTemplate, queryString);
                        }
                        else
                        {
                            SiteData.PerformRedirectToErrorPage(404, sFileRequested);
                            SiteData.Show404MessageFull(true);
                        }
                    }
                    else
                    {
                        sVirtualReqFile = sFileRequested;

                        RewriteCMSPath(context, sVirtualReqFile, queryString);
                    }
                }

                context.ApplicationInstance.CompleteRequest();
            }
        }
Esempio n. 28
0
 public SiteNav GetNextPost(Guid siteID, Guid rootContentID, bool bActiveOnly)
 {
     return(SiteNavHelper.GetSamplerView());
 }
Esempio n. 29
0
        protected void Page_Load(object sender, EventArgs e)
        {
            using (SiteNavHelper navHelper = new SiteNavHelper()) {

                string sCurrentPage = SiteData.CurrentScriptName;
                string sScrubbedURL = SiteData.AlternateCurrentScriptName;

                if (sScrubbedURL.ToLower() != sCurrentPage.ToLower()) {
                    sCurrentPage = sScrubbedURL;
                }

                ContentPage currentPage = pageHelper.FindByFilename(SiteData.CurrentSiteID, sCurrentPage);

                if (currentPage == null && SiteData.IsPageReal) {
                    IsPageTemplate = true;
                }

                if ((SiteData.IsPageSampler || IsPageTemplate) && currentPage == null) {
                    currentPage = ContentPageHelper.GetSamplerView();
                }

                litVersion.Text = SiteData.CarrotCakeCMSVersion;
                litRelease.Text = currentPage.GoLiveDate.ToString();
                litRetire.Text = currentPage.RetireDate.ToString();
                litTemplate.Text = currentPage.TemplateFile;

                CurrentPageID = currentPage.Root_ContentID;
                lnkCurrent.HRef = SiteData.CurrentScriptName;

                EditPageURL = SiteFilename.PageAddEditURL;
                PageIndexURL = SiteFilename.PageIndexURL;

                if (currentPage.ContentType == ContentPageType.PageType.BlogEntry) {
                    EditPageURL = SiteFilename.BlogPostAddEditURL;
                    PageIndexURL = SiteFilename.BlogPostIndexURL;
                }

                if (!IsPostBack) {
                    List<SiteNav> nav = navHelper.GetChildNavigation(SiteData.CurrentSiteID, CurrentPageID, !SecurityData.IsAuthEditor);

                    SiteNav pageContents2 = navHelper.GetParentPageNavigation(SiteData.CurrentSiteID, CurrentPageID);
                    if (pageContents2 != null) {
                        pageContents2.NavMenuText = "Parent: " + pageContents2.NavMenuText;
                        pageContents2.NavOrder = -110;
                        lnkParent.Visible = true;
                        lnkParent.HRef = pageContents2.FileName;
                    } else {
                        lnkParent.Visible = false;
                    }

                    ContentPage homePage = pageHelper.FindHome(SiteData.CurrentSiteID);

                    List<SiteNav> lstNavTop = null;
                    if (homePage != null && homePage.Root_ContentID == CurrentPageID) {
                        lstNavTop = (from n in navHelper.GetTopNavigation(SiteData.CurrentSiteID, !SecurityData.IsAuthEditor)
                                     where n.Root_ContentID != CurrentPageID
                                     orderby n.NavOrder
                                     select new SiteNav {
                                         NavOrder = n.NavOrder,
                                         FileName = n.FileName,
                                         NavMenuText = (n.NavOrder > 0 ? "  -- " : "") + n.FileName + "  [[" + (n.PageActive ? "" : "{*U*}  ") + n.NavMenuText + "]]",
                                         PageActive = n.PageActive,
                                         ContentID = n.ContentID,
                                         Root_ContentID = n.Root_ContentID,
                                         PageHead = n.PageHead,
                                         SiteID = n.SiteID
                                     }).ToList();
                    }

                    List<SiteNav> lstNav = (from n in nav
                                            orderby n.NavOrder
                                            select new SiteNav {
                                                NavOrder = n.NavOrder,
                                                FileName = n.FileName,
                                                NavMenuText = (n.NavOrder > 0 ? "  -- " : "") + n.FileName + "  [[" + (n.PageActive ? "" : "{*U*}  ") + n.NavMenuText + "]]",
                                                PageActive = n.PageActive,
                                                ContentID = n.ContentID,
                                                Root_ContentID = n.Root_ContentID,
                                                PageHead = n.PageHead,
                                                SiteID = n.SiteID
                                            }).ToList();

                    if (lstNavTop != null) {
                        lstNav = lstNavTop.Union(lstNav).ToList();
                    }

                    GeneralUtilities.BindListDefaultText(ddlCMSLinks, lstNav, null, "Navigate", "00000");

                    if (lstNav.Count < 1) {
                        ddlCMSLinks.Visible = false;
                        lblChildDDL.Visible = false;
                    }
                }
            }
        }
Esempio n. 30
0
 public List <SiteNav> GetSiblingNavigation(Guid siteID, Guid PageID, bool bActiveOnly)
 {
     return(SiteNavHelper.GetSamplerFakeNav(PageID));
 }
Esempio n. 31
0
 public List <SiteNav> GetLatestContentSearchList(Guid siteID, string searchTerm, bool bActiveOnly, int pageSize, int pageNumber, string sortField, string sortDir)
 {
     return(SiteNavHelper.GetSamplerFakeNav(pageSize));
 }
Esempio n. 32
0
 public List <SiteNav> GetLatestPostUpdates(Guid siteID, int iUpdates, bool bActiveOnly)
 {
     return(SiteNavHelper.GetSamplerFakeNav(iUpdates));
 }
Esempio n. 33
0
 public List <SiteNav> GetFilteredContentByIDPagedList(SiteData currentSite, List <Guid> lstCategoryGUIDs, List <string> lstCategorySlugs, bool bActiveOnly, int pageSize, int pageNumber, string sortField, string sortDir)
 {
     return(SiteNavHelper.GetSamplerFakeNav(pageSize));
 }
Esempio n. 34
0
 public SiteNav GetLatestVersion(Guid siteID, bool bActiveOnly, string sPage)
 {
     return(SiteNavHelper.GetSamplerView());
 }
Esempio n. 35
0
 public List <SiteNav> GetLatestBlogPagedList(Guid siteID, bool bActiveOnly, int pageSize, int pageNumber)
 {
     return(SiteNavHelper.GetSamplerFakeNav(pageSize));
 }
Esempio n. 36
0
 public SiteNav FindByFilename(Guid siteID, string urlFileName)
 {
     return(SiteNavHelper.GetSamplerView());
 }
Esempio n. 37
0
 public List <SiteNav> GetLatestContentPagedList(Guid siteID, ContentPageType.PageType postType, bool bActiveOnly, int pageSize, int pageNumber, string sortField, string sortDir)
 {
     return(SiteNavHelper.GetSamplerFakeNav(pageSize));
 }
Esempio n. 38
0
 public List <SiteNav> PerformDataPagingQueryableContent(Guid siteID, bool bActiveOnly, int pageSize, int pageNumber, string sortField, string sortDir, IQueryable <Data.vw_carrot_Content> QueryInput)
 {
     return(SiteNavHelper.GetSamplerFakeNav(pageSize));
 }
Esempio n. 39
0
 public SiteNav GetSiteNav()
 {
     SiteNav sd = null;
     if (SiteData.IsPageSampler || !SiteData.IsWebView) {
         sd = SiteNavHelper.GetSamplerView();
     } else {
         using (SiteNavHelper sdh = new SiteNavHelper()) {
             sd = sdh.GetLatestVersion(this.SiteID, this.Root_ContentID);
         }
     }
     return sd;
 }
Esempio n. 40
0
 public List <SiteNav> GetFilteredContentPagedList(SiteData currentSite, string sFilterPath, bool bActiveOnly, int pageSize, int pageNumber, string sortField, string sortDir)
 {
     return(SiteNavHelper.GetSamplerFakeNav(pageSize));
 }
        protected override IHttpHandler GetHttpHandler(System.Web.Routing.RequestContext requestCtx)
        {
            string requestedUri = (string)requestCtx.RouteData.Values["RequestedUri"];

            requestedUri = String.IsNullOrEmpty(requestedUri) ? String.Empty : requestedUri.ToLower();
            if (!requestedUri.StartsWith("/"))
            {
                requestedUri = String.Format("/{0}", requestedUri);
            }
            if (requestedUri.EndsWith("/"))
            {
                requestedUri = requestedUri.Substring(0, requestedUri.Length - 1);
            }

            if (requestedUri.EndsWith(".ashx"))
            {
                if (requestedUri == "/rss.ashx")
                {
                    requestCtx.RouteData.Values["controller"] = ContentCtrlr;
                    requestCtx.RouteData.Values["action"]     = "RSSFeed";
                    return(base.GetHttpHandler(requestCtx));
                }
                if (requestedUri == "/sitemap.ashx")
                {
                    requestCtx.RouteData.Values["controller"] = ContentCtrlr;
                    requestCtx.RouteData.Values["action"]     = "SiteMap";
                    return(base.GetHttpHandler(requestCtx));
                }

                //if (requestedUri == "/trackback.ashx") {	// will be dead link
                //	requestCtx.RouteData.Values["controller"] = ContentCtrlr;
                //	requestCtx.RouteData.Values["action"] = "Trackback";
                //	return base.GetHttpHandler(requestCtx);
                //}

                requestCtx.RouteData.Values["controller"] = ContentCtrlr;
                requestCtx.RouteData.Values["action"]     = "PageNotFound";
                requestCtx.RouteData.Values["id"]         = null;

                SiteData.WriteDebugException("cmsroutehandler ashx not matched", new Exception(String.Format("RequestedUri: {0}", requestedUri)));

                return(base.GetHttpHandler(requestCtx));
            }
            else if (requestedUri.EndsWith(".aspx"))
            {
                //since .aspx is not supported
                requestCtx.RouteData.Values["controller"] = ContentCtrlr;
                requestCtx.RouteData.Values["action"]     = "PageNotFound";
                requestCtx.RouteData.Values["id"]         = null;
            }
            else
            {
                string sCurrentPage = SiteData.CurrentScriptName;

                try {
                    string sScrubbedURL = SiteData.AlternateCurrentScriptName;

                    if (sScrubbedURL.ToLower() != sCurrentPage.ToLower())
                    {
                        requestedUri = sScrubbedURL;
                    }

                    SiteNav navData             = null;
                    bool    bIsHomePage         = false;
                    bool    bIgnorePublishState = SecurityData.AdvancedEditMode || SecurityData.IsAdmin || SecurityData.IsSiteEditor;

                    using (ISiteNavHelper navHelper = SiteNavFactory.GetSiteNavHelper()) {
                        if (SiteData.IsLikelyHomePage(requestedUri))
                        {
                            navData = navHelper.FindHome(SiteData.CurrentSiteID, !bIgnorePublishState);

                            if (navData != null)
                            {
                                requestedUri = navData.FileName;
                                bIsHomePage  = true;
                            }
                        }

                        if (!bIsHomePage)
                        {
                            navData = navHelper.GetLatestVersion(SiteData.CurrentSiteID, !bIgnorePublishState, requestedUri);
                        }

                        if ((SiteData.IsLikelyHomePage(requestedUri)) && navData == null)
                        {
                            navData = SiteNavHelper.GetEmptyHome();
                        }

                        requestCtx.RouteData.Values["controller"] = ContentCtrlr;
                        if (navData != null)
                        {
                            SiteData.WriteDebugException("cmsroutehandler != null", new Exception(String.Format("Default: {0}", navData.FileName)));
                            requestCtx.RouteData.Values["action"] = "Default";
                        }
                        else
                        {
                            SiteData.WriteDebugException("cmsroutehandler == null", new Exception(String.Format("_PageNotFound: {0}", sCurrentPage)));
                            requestCtx.RouteData.Values["action"] = "PageNotFound";
                        }
                        requestCtx.RouteData.Values["id"] = null;
                    }
                } catch (Exception ex) {
                    SiteData.WriteDebugException("cmsroutehandler_exception_uri", new Exception(String.Format("Exception: {0}", sCurrentPage)));

                    if (DatabaseUpdate.SystemNeedsChecking(ex) || DatabaseUpdate.AreCMSTablesIncomplete())
                    {
                        requestCtx.RouteData.Values["controller"] = ContentCtrlr;
                        requestCtx.RouteData.Values["action"]     = "Default";
                        requestCtx.RouteData.Values["id"]         = null;
                        SiteData.WriteDebugException("cmsroutehandler_exception_systemneedschecking", ex);
                    }
                    else
                    {
                        //something bad has gone down, toss back the error
                        SiteData.WriteDebugException("cmsroutehandler_exception", ex);
                        throw;
                    }
                }
            }

            return(base.GetHttpHandler(requestCtx));
        }
Esempio n. 42
0
 public List <SiteNav> GetLatestBlogPagedList(Guid siteID, bool bActiveOnly, int pageNumber, string sortField, string sortDir)
 {
     return(SiteNavHelper.GetSamplerFakeNav(10));
 }
Esempio n. 43
0
        private List<SyndicationItem> GetRecentPagesOrPosts(RSSFeedInclude feedData)
        {
            List<SyndicationItem> syndRSS = new List<SyndicationItem>();
            List<SiteNav> lst = new List<SiteNav>();

            ContentPageType PageType = new ContentPageType();

            using (SiteNavHelper navHelper = new SiteNavHelper()) {
                if (feedData == RSSFeedInclude.PageOnly || feedData == RSSFeedInclude.BlogAndPages) {
                    List<SiteNav> lst1 = navHelper.GetLatest(this.SiteID, 8, true);
                    lst = lst.Union(lst1).ToList();
                    List<SiteNav> lst2 = navHelper.GetLatestUpdates(this.SiteID, 10, true);
                    lst = lst.Union(lst2).ToList();
                }
                if (feedData == RSSFeedInclude.BlogOnly || feedData == RSSFeedInclude.BlogAndPages) {
                    List<SiteNav> lst1 = navHelper.GetLatestPosts(this.SiteID, 8, true);
                    lst = lst.Union(lst1).ToList();
                    List<SiteNav> lst2 = navHelper.GetLatestPostUpdates(this.SiteID, 10, true);
                    lst = lst.Union(lst2).ToList();
                }
            }

            lst.RemoveAll(x => x.ShowInSiteMap == false && x.ContentType == ContentPageType.PageType.ContentEntry);
            lst.RemoveAll(x => x.BlockIndex == true);

            foreach (SiteNav sn in lst) {
                SyndicationItem si = new SyndicationItem();

                string sPageURI = RemoveDupeSlashesURL(this.ConstructedCanonicalURL(sn));

                Uri PageURI = new Uri(sPageURI);

                si.Content = new TextSyndicationContent(sn.PageTextPlainSummaryMedium);
                si.Title = new TextSyndicationContent(sn.NavMenuText);
                si.Links.Add(SyndicationLink.CreateSelfLink(PageURI));
                si.AddPermalink(PageURI);

                si.LastUpdatedTime = sn.EditDate;
                si.PublishDate = sn.CreateDate;

                syndRSS.Add(si);
            }

            return syndRSS.OrderByDescending(p => p.PublishDate).ToList();
        }
Esempio n. 44
0
 public List <SiteNav> GetLatestContentPagedList(Guid siteID, ContentPageType.PageType postType, bool bActiveOnly, int pageNumber)
 {
     return(SiteNavHelper.GetSamplerFakeNav(10));
 }
Esempio n. 45
0
        public static string CheckForSpecialURL(SiteData site)
        {
            string sRequestedURL = "/";

            if (IsWebView) {
                sRequestedURL = CurrentScriptName;
                string sFileRequested = sRequestedURL;

                if (!sRequestedURL.ToLower().StartsWith(AdminFolderPath) && site != null) {
                    if (sFileRequested.ToLower().StartsWith(site.BlogFolderPath.ToLower())) {
                        if (site.GetSpecialFilePathPrefixes().Where(x => sFileRequested.ToLower().StartsWith(x)).Count() > 0) {
                            if (site.Blog_Root_ContentID.HasValue) {
                                using (SiteNavHelper navHelper = new SiteNavHelper()) {
                                    SiteNav blogNavPage = navHelper.GetLatestVersion(site.SiteID, site.Blog_Root_ContentID.Value);
                                    if (blogNavPage != null) {
                                        sRequestedURL = blogNavPage.FileName;
                                    }
                                }
                            }
                        }
                    }
                }
            }

            return sRequestedURL;
        }
Esempio n. 46
0
 public List <SiteNav> GetLatestChildContentPagedList(Guid siteID, string parentPage, bool bActiveOnly, int pageSize, int pageNumber, string sortField, string sortDir)
 {
     return(SiteNavHelper.GetSamplerFakeNav(pageSize, Guid.NewGuid()));
 }
Esempio n. 47
0
 public List <SiteNav> GetPageCrumbNavigation(Guid siteID, Guid rootContentID, bool bActiveOnly)
 {
     return(SiteNavHelper.GetSamplerFakeNav(rootContentID));
 }
Esempio n. 48
0
 public List <SiteNav> GetChildNavigation(Guid siteID, string sparentPageID, bool bActiveOnly)
 {
     return(SiteNavHelper.GetSamplerFakeNav(Guid.NewGuid()));
 }
Esempio n. 49
0
        protected override IHttpHandler GetHttpHandler(System.Web.Routing.RequestContext requestCtx)
        {
            string requestedUri = (string)requestCtx.RouteData.Values["RequestedUri"];

            requestedUri = String.IsNullOrEmpty(requestedUri) ? String.Empty : requestedUri.ToLower();
            if (!requestedUri.StartsWith("/")) {
                requestedUri = String.Format("/{0}", requestedUri);
            }
            if (requestedUri.EndsWith("/")) {
                requestedUri = requestedUri.Substring(0, requestedUri.Length - 1);
            }

            if (requestedUri.EndsWith(".ashx")) {
                if (requestedUri == "/rss.ashx") {
                    requestCtx.RouteData.Values["controller"] = ContentCtrlr;
                    requestCtx.RouteData.Values["action"] = "RSSFeed";
                    return base.GetHttpHandler(requestCtx);
                }
                if (requestedUri == "/sitemap.ashx") {
                    requestCtx.RouteData.Values["controller"] = ContentCtrlr;
                    requestCtx.RouteData.Values["action"] = "SiteMap";
                    return base.GetHttpHandler(requestCtx);
                }

                //if (requestedUri == "/trackback.ashx") {	// will be dead link
                //	requestCtx.RouteData.Values["controller"] = ContentCtrlr;
                //	requestCtx.RouteData.Values["action"] = "Trackback";
                //	return base.GetHttpHandler(requestCtx);
                //}

                requestCtx.RouteData.Values["controller"] = "Carrotware.CMS.Core.CmsHome";
                requestCtx.RouteData.Values["action"] = "Default_ashx";

                return base.GetHttpHandler(requestCtx);
            } else {
                string sCurrentPage = SiteData.CurrentScriptName;

                try {
                    string sScrubbedURL = SiteData.AlternateCurrentScriptName;

                    if (sScrubbedURL.ToLower() != sCurrentPage.ToLower()) {
                        requestedUri = sScrubbedURL;
                    }

                    SiteNav navData = null;
                    bool bIsHomePage = false;
                    bool bIgnorePublishState = SecurityData.AdvancedEditMode || SecurityData.IsAdmin || SecurityData.IsSiteEditor;

                    using (SiteNavHelper navHelper = new SiteNavHelper()) {
                        if (requestedUri.Length < 2 || requestedUri == SiteData.DefaultDirectoryFilename) {
                            navData = navHelper.FindHome(SiteData.CurrentSiteID, !bIgnorePublishState);

                            if (navData != null) {
                                requestedUri = navData.FileName;
                                bIsHomePage = true;
                            }
                        }

                        if (!bIsHomePage) {
                            navData = navHelper.GetLatestVersion(SiteData.CurrentSiteID, !bIgnorePublishState, requestedUri);
                        }

                        if ((requestedUri.Length < 2 || requestedUri == SiteData.DefaultDirectoryFilename) && navData == null) {
                            navData = SiteNavHelper.GetEmptyHome();
                        }

                        requestCtx.RouteData.Values["controller"] = ContentCtrlr;
                        if (navData != null) {
                            requestCtx.RouteData.Values["action"] = "Default";
                        } else {
                            requestCtx.RouteData.Values["action"] = "_PageNotFound";
                        }
                        requestCtx.RouteData.Values["id"] = null;
                    }

                } catch (Exception ex) {
                    if (DatabaseUpdate.SystemNeedsChecking(ex) || DatabaseUpdate.AreCMSTablesIncomplete()) {
                        requestCtx.RouteData.Values["controller"] = ContentCtrlr;
                        requestCtx.RouteData.Values["action"] = "Default";
                        requestCtx.RouteData.Values["id"] = null;
                    } else {
                        //something bad has gone down, toss back the error
                        throw;
                    }
                }
            }

            return base.GetHttpHandler(requestCtx);
        }