From 81b43545c104d4d4a821ddf4f500f2ff423aa009 Mon Sep 17 00:00:00 2001 From: Shannon Date: Mon, 16 Sep 2013 12:36:12 +1000 Subject: [PATCH] Updated the remainder of the legacy UmbracoSettings calls to use the new format, now to just fix up the unit tests --- src/Umbraco.Web/HtmlHelperRenderExtensions.cs | 3 +- src/Umbraco.Web/UriUtility.cs | 5 +- .../umbraco.presentation/NotFoundHandlers.cs | 2 +- .../umbraco.presentation/content.cs | 6 +- .../umbraco.presentation/default.aspx.cs | 2 +- .../umbraco.presentation/library.cs | 53 ++++++++++------- .../umbraco.presentation/publishingService.cs | 57 ++++++++----------- .../umbraco.presentation/requestModule.cs | 4 +- .../ActionHandlers/umbEnsureUniqueName.cs | 4 +- .../umbraco/Trees/loadContent.cs | 3 +- .../umbraco/Trees/loadTemplates.cs | 2 +- .../umbraco/Trees/loadUsers.cs | 4 +- .../umbraco/canvas.aspx.cs | 5 +- .../umbraco/channels/UmbracoMetaWeblogAPI.cs | 9 ++- .../umbraco/controls/ContentControl.cs | 3 +- .../controls/ContentTypeControlNew.ascx.cs | 5 +- .../GenericProperties/GenericProperty.ascx.cs | 4 +- .../umbraco/create/MediaTypeTasks.cs | 3 +- .../umbraco/create/nodetypeTasks.cs | 3 +- .../umbraco/create/script.ascx.cs | 4 +- .../umbraco/create/userTasks.cs | 7 ++- .../umbraco/dashboard/ChangePassword.ascx.cs | 3 +- .../umbraco/login.aspx.cs | 9 +-- .../umbraco/users/EditUser.aspx.cs | 15 ++--- .../umbraco/webservices/MediaUploader.ashx.cs | 3 +- .../webservices/codeEditorSave.asmx.cs | 2 +- .../viewstateMoverModule.cs | 3 +- .../RazorDynamicNode/DynamicNode.cs | 20 +++++-- src/umbraco.businesslogic/UmbracoSettings.cs | 1 + .../businesslogic/Packager/Installer.cs | 6 +- .../businesslogic/workflow/Notification.cs | 5 +- src/umbraco.cms/helpers/xhtml.cs | 3 +- src/umbraco.controls/CodeArea.cs | 3 +- .../tinyMCE3/TinyMCE.cs | 3 +- .../tinymce/tinyMCEImageHelper.cs | 3 +- .../uploadfield/uploadField.cs | 5 +- 36 files changed, 161 insertions(+), 111 deletions(-) diff --git a/src/Umbraco.Web/HtmlHelperRenderExtensions.cs b/src/Umbraco.Web/HtmlHelperRenderExtensions.cs index 2a009dfaa2..2a8539bec9 100644 --- a/src/Umbraco.Web/HtmlHelperRenderExtensions.cs +++ b/src/Umbraco.Web/HtmlHelperRenderExtensions.cs @@ -8,6 +8,7 @@ using System.Web.Mvc; using System.Web.Mvc.Html; using System.Web.Routing; using Umbraco.Core; +using Umbraco.Core.Configuration; using Umbraco.Core.Dynamics; using Umbraco.Core.IO; using Umbraco.Core.Profiling; @@ -65,7 +66,7 @@ namespace Umbraco.Web if (UmbracoContext.Current.InPreviewMode) { var htmlBadge = - String.Format(UmbracoSettings.PreviewBadge, + String.Format(UmbracoConfiguration.Current.UmbracoSettings.Content.PreviewBadge, IOHelper.ResolveUrl(SystemDirectories.Umbraco), IOHelper.ResolveUrl(SystemDirectories.UmbracoClient), UmbracoContext.Current.HttpContext.Server.UrlEncode(UmbracoContext.Current.HttpContext.Request.Path)); diff --git a/src/Umbraco.Web/UriUtility.cs b/src/Umbraco.Web/UriUtility.cs index ee58adf327..4c3b81668d 100644 --- a/src/Umbraco.Web/UriUtility.cs +++ b/src/Umbraco.Web/UriUtility.cs @@ -2,7 +2,8 @@ using System; using System.Text; using System.Web; using Umbraco.Core; -using umbraco; +using Umbraco.Core.Configuration; +using GlobalSettings = umbraco.GlobalSettings; namespace Umbraco.Web { @@ -68,7 +69,7 @@ namespace Umbraco.Web { if (!GlobalSettings.UseDirectoryUrls) path += ".aspx"; - else if (UmbracoSettings.AddTrailingSlash) + else if (UmbracoConfiguration.Current.UmbracoSettings.RequestHandler.AddTrailingSlash) path += "/"; } diff --git a/src/Umbraco.Web/umbraco.presentation/NotFoundHandlers.cs b/src/Umbraco.Web/umbraco.presentation/NotFoundHandlers.cs index 56c15cffc6..9106fcfc4d 100644 --- a/src/Umbraco.Web/umbraco.presentation/NotFoundHandlers.cs +++ b/src/Umbraco.Web/umbraco.presentation/NotFoundHandlers.cs @@ -75,7 +75,7 @@ namespace umbraco { string langXpath = CreateXPathQuery(domainUrl + "/" + url, false); if (content.Instance.XmlContent.DocumentElement.SelectSingleNode(langXpath) != null) return langXpath; - else if (UmbracoSettings.UseDomainPrefixes) + else if (UmbracoConfiguration.Current.UmbracoSettings.RequestHandler.UseDomainPrefixes) return "/domainprefixes-are-used-so-i-do-not-work"; } } diff --git a/src/Umbraco.Web/umbraco.presentation/content.cs b/src/Umbraco.Web/umbraco.presentation/content.cs index 0cec82150c..15ab10b4a4 100644 --- a/src/Umbraco.Web/umbraco.presentation/content.cs +++ b/src/Umbraco.Web/umbraco.presentation/content.cs @@ -187,7 +187,7 @@ namespace umbraco /// Returns true of the XML was not populated, returns false if it was already populated private bool CheckXmlContentPopulation() { - if (UmbracoSettings.XmlContentCheckForDiskChanges) + if (UmbracoConfiguration.Current.UmbracoSettings.Content.XmlContentCheckForDiskChanges) CheckDiskCacheForUpdate(); if (_xmlContent == null) @@ -510,7 +510,7 @@ namespace umbraco { // modify a clone of the cache because even though we're into the write-lock // we may have threads reading at the same time. why is this an option? - XmlDocument wip = UmbracoSettings.CloneXmlCacheOnPublish + XmlDocument wip = UmbracoConfiguration.Current.UmbracoSettings.Content.CloneXmlContent ? CloneXmlDoc(XmlContentInternal) : XmlContentInternal; @@ -1320,7 +1320,7 @@ order by umbracoNode.level, umbracoNode.sortOrder"; else { //// Save copy of content - if (UmbracoSettings.CloneXmlCacheOnPublish) + if (UmbracoConfiguration.Current.UmbracoSettings.Content.CloneXmlContent) { XmlDocument xmlContentCopy = CloneXmlDoc(_xmlContent); diff --git a/src/Umbraco.Web/umbraco.presentation/default.aspx.cs b/src/Umbraco.Web/umbraco.presentation/default.aspx.cs index 405b405859..f19c8fd5f6 100644 --- a/src/Umbraco.Web/umbraco.presentation/default.aspx.cs +++ b/src/Umbraco.Web/umbraco.presentation/default.aspx.cs @@ -156,7 +156,7 @@ namespace umbraco if (pos > -1) { string htmlBadge = - String.Format(UmbracoSettings.PreviewBadge, + String.Format(UmbracoConfiguration.Current.UmbracoSettings.Content.PreviewBadge, IOHelper.ResolveUrl(SystemDirectories.Umbraco), IOHelper.ResolveUrl(SystemDirectories.UmbracoClient), Server.UrlEncode(UmbracoContext.Current.HttpContext.Request.Path)); diff --git a/src/Umbraco.Web/umbraco.presentation/library.cs b/src/Umbraco.Web/umbraco.presentation/library.cs index 43988d45aa..02da9b59aa 100644 --- a/src/Umbraco.Web/umbraco.presentation/library.cs +++ b/src/Umbraco.Web/umbraco.presentation/library.cs @@ -1,6 +1,7 @@ using System; using System.Globalization; using System.IO; +using System.Linq; using System.Net; using System.Net.Mail; using System.Text; @@ -12,6 +13,7 @@ using System.Xml.XPath; using Umbraco.Core; using Umbraco.Core.Cache; using Umbraco.Core.Configuration; +using Umbraco.Core.Configuration.UmbracoSettings; using Umbraco.Core.Logging; using Umbraco.Web; using Umbraco.Web.Cache; @@ -1864,40 +1866,51 @@ namespace umbraco internal static string GetCurrentNotFoundPageId() { - string error404 = ""; - XmlNode error404Node = UmbracoSettings.GetKeyAsNode("/settings/content/errors/error404"); - if (error404Node.SelectNodes("errorPage").Count > 0 && error404Node.SelectNodes("errorPage")[0].HasChildNodes) + //XmlNode error404Node = UmbracoSettings.GetKeyAsNode("/settings/content/errors/error404"); + if (UmbracoConfiguration.Current.UmbracoSettings.Content.Errors.Error404Collection.Count() > 1) { // try to get the 404 based on current culture (via domain) - XmlNode cultureErrorNode; + IContentErrorPage cultureErr; if (Domain.Exists(HttpContext.Current.Request.ServerVariables["SERVER_NAME"])) { - Domain d = Domain.GetDomain(HttpContext.Current.Request.ServerVariables["SERVER_NAME"]); + var d = Domain.GetDomain(HttpContext.Current.Request.ServerVariables["SERVER_NAME"]); + // test if a 404 page exists with current culture - cultureErrorNode = error404Node.SelectSingleNode(String.Format("errorPage [@culture = '{0}']", d.Language.CultureAlias)); - if (cultureErrorNode != null && cultureErrorNode.FirstChild != null) - error404 = cultureErrorNode.FirstChild.Value; + cultureErr = UmbracoConfiguration.Current.UmbracoSettings.Content.Errors.Error404Collection + .FirstOrDefault(x => x.Culture == d.Language.CultureAlias); + + if (cultureErr != null) + { + return cultureErr.ContentId.ToInvariantString(); + } + } - else if (error404Node.SelectSingleNode(string.Format("errorPage [@culture = '{0}']", System.Threading.Thread.CurrentThread.CurrentUICulture.Name)) != null) + + // test if a 404 page exists with current culture thread + cultureErr = UmbracoConfiguration.Current.UmbracoSettings.Content.Errors.Error404Collection + .FirstOrDefault(x => x.Culture == System.Threading.Thread.CurrentThread.CurrentUICulture.Name); + if (cultureErr != null) { - cultureErrorNode = error404Node.SelectSingleNode(string.Format("errorPage [@culture = '{0}']", System.Threading.Thread.CurrentThread.CurrentUICulture.Name)); - if (cultureErrorNode.FirstChild != null) - error404 = cultureErrorNode.FirstChild.Value; + return cultureErr.ContentId.ToInvariantString(); } - else + + // there should be a default one! + cultureErr = UmbracoConfiguration.Current.UmbracoSettings.Content.Errors.Error404Collection + .FirstOrDefault(x => x.Culture == "default"); + if (cultureErr != null) { - cultureErrorNode = error404Node.SelectSingleNode("errorPage [@culture = 'default']"); - if (cultureErrorNode != null && cultureErrorNode.FirstChild != null) - error404 = cultureErrorNode.FirstChild.Value; + return cultureErr.ContentId.ToInvariantString(); } } else - error404 = UmbracoSettings.GetKey("/settings/content/errors/error404"); - return error404; + { + + return UmbracoConfiguration.Current.UmbracoSettings.Content.Errors.Error404Collection.First().ContentId.ToInvariantString(); + } + + return ""; } - - #endregion #region Template Control Mapping Functions diff --git a/src/Umbraco.Web/umbraco.presentation/publishingService.cs b/src/Umbraco.Web/umbraco.presentation/publishingService.cs index d22165d648..3555c6a368 100644 --- a/src/Umbraco.Web/umbraco.presentation/publishingService.cs +++ b/src/Umbraco.Web/umbraco.presentation/publishingService.cs @@ -4,6 +4,7 @@ using System.Diagnostics; using System.Net; using System.Web; using System.Xml; +using Umbraco.Core.Configuration; using Umbraco.Core.Logging; using umbraco.BusinessLogic; using umbraco.cms.businesslogic.web; @@ -61,40 +62,30 @@ namespace umbraco.presentation // run scheduled url tasks try { - XmlNode scheduledTasks = UmbracoSettings.ScheduledTasks; - if(scheduledTasks != null) - { - XmlNodeList tasks = scheduledTasks.SelectNodes("./task"); - if(tasks != null) - { - foreach (XmlNode task in tasks) - { - bool runTask = false; - if (!ScheduledTaskTimes.ContainsKey(task.Attributes.GetNamedItem("alias").Value)) - { - runTask = true; - ScheduledTaskTimes.Add(task.Attributes.GetNamedItem("alias").Value, DateTime.Now); - } - // Add 1 second to timespan to compensate for differencies in timer - else if ( - new TimeSpan(DateTime.Now.Ticks - - ((DateTime) ScheduledTaskTimes[task.Attributes.GetNamedItem("alias").Value]).Ticks).TotalSeconds + - 1 >= - int.Parse(task.Attributes.GetNamedItem("interval").Value)) - { - runTask = true; - ScheduledTaskTimes[task.Attributes.GetNamedItem("alias").Value] = DateTime.Now; - } + foreach (var t in UmbracoConfiguration.Current.UmbracoSettings.ScheduledTasks.Tasks) + { + bool runTask = false; + if (!ScheduledTaskTimes.ContainsKey(t.Alias)) + { + runTask = true; + ScheduledTaskTimes.Add(t.Alias, DateTime.Now); + } + // Add 1 second to timespan to compensate for differencies in timer + else if ( + new TimeSpan( + DateTime.Now.Ticks - ((DateTime)ScheduledTaskTimes[t.Alias]).Ticks).TotalSeconds + 1 >= t.Interval) + { + runTask = true; + ScheduledTaskTimes[t.Alias] = DateTime.Now; + } - if (runTask) - { - bool taskResult = getTaskByHttp(task.Attributes.GetNamedItem("url").Value); - if (bool.Parse(task.Attributes.GetNamedItem("log").Value)) - LogHelper.Info(string.Format("{0} has been called with response: {1}", task.Attributes.GetNamedItem("alias").Value, taskResult)); - } - } - } - } + if (runTask) + { + bool taskResult = getTaskByHttp(t.Url); + if (t.Log) + LogHelper.Info(string.Format("{0} has been called with response: {1}", t.Alias, taskResult)); + } + } } catch(Exception ee) { diff --git a/src/Umbraco.Web/umbraco.presentation/requestModule.cs b/src/Umbraco.Web/umbraco.presentation/requestModule.cs index 179b1831e6..3f830aca21 100644 --- a/src/Umbraco.Web/umbraco.presentation/requestModule.cs +++ b/src/Umbraco.Web/umbraco.presentation/requestModule.cs @@ -157,7 +157,7 @@ namespace umbraco.presentation } // show splash? - else if (UmbracoSettings.EnableSplashWhileLoading && content.Instance.isInitializing) + else if (UmbracoConfiguration.Current.UmbracoSettings.Content.EnableSplashWhileLoading && content.Instance.isInitializing) context.RewritePath(string.Format("{0}/splashes/booting.aspx", SystemDirectories.Config)); // rewrite page path else @@ -361,7 +361,7 @@ namespace umbraco.presentation { LogHelper.Info(string.Format("Application started at {0}", DateTime.Now)); - if (UmbracoSettings.AutoCleanLogs) + if (UmbracoConfiguration.Current.UmbracoSettings.Logging.AutoCleanLogs) { AddTask(LOG_SCRUBBER_TASK_NAME, GetLogScrubbingInterval()); } diff --git a/src/Umbraco.Web/umbraco.presentation/umbraco/ActionHandlers/umbEnsureUniqueName.cs b/src/Umbraco.Web/umbraco.presentation/umbraco/ActionHandlers/umbEnsureUniqueName.cs index d5fab83940..ed922a8709 100644 --- a/src/Umbraco.Web/umbraco.presentation/umbraco/ActionHandlers/umbEnsureUniqueName.cs +++ b/src/Umbraco.Web/umbraco.presentation/umbraco/ActionHandlers/umbEnsureUniqueName.cs @@ -1,5 +1,6 @@ using System; using System.Linq; +using Umbraco.Core.Configuration; using Umbraco.Core.Logging; using umbraco.cms.businesslogic.web; using umbraco.BusinessLogic.Actions; @@ -36,7 +37,8 @@ namespace umbraco.ActionHandlers /// Returns true if successfull, otherwise false public bool Execute(umbraco.cms.businesslogic.web.Document documentObject, interfaces.IAction action) { - if (UmbracoSettings.EnsureUniqueNaming) + + if (UmbracoConfiguration.Current.UmbracoSettings.Content.EnsureUniqueNaming) { string currentName = documentObject.Text; int uniqueNumber = 1; diff --git a/src/Umbraco.Web/umbraco.presentation/umbraco/Trees/loadContent.cs b/src/Umbraco.Web/umbraco.presentation/umbraco/Trees/loadContent.cs index 67d325f118..3b35201928 100644 --- a/src/Umbraco.Web/umbraco.presentation/umbraco/Trees/loadContent.cs +++ b/src/Umbraco.Web/umbraco.presentation/umbraco/Trees/loadContent.cs @@ -1,5 +1,6 @@ using System; using System.Collections.Generic; +using Umbraco.Core.Configuration; using umbraco.BusinessLogic.Actions; using umbraco.businesslogic; using umbraco.cms.businesslogic.web; @@ -114,7 +115,7 @@ namespace umbraco { actions.Clear(); actions.Add(ActionNew.Instance); - if (UmbracoSettings.EnableCanvasEditing) + if (UmbracoConfiguration.Current.UmbracoSettings.Content.EnableCanvasEditing) { actions.Add(ActionLiveEdit.Instance); } diff --git a/src/Umbraco.Web/umbraco.presentation/umbraco/Trees/loadTemplates.cs b/src/Umbraco.Web/umbraco.presentation/umbraco/Trees/loadTemplates.cs index bc0fb6fc5a..bde3301b46 100644 --- a/src/Umbraco.Web/umbraco.presentation/umbraco/Trees/loadTemplates.cs +++ b/src/Umbraco.Web/umbraco.presentation/umbraco/Trees/loadTemplates.cs @@ -72,7 +72,7 @@ namespace umbraco RenderTemplateFolderItems(folder, folderPath, ref tree); else { - if(UmbracoSettings.EnableTemplateFolders) + if (UmbracoConfiguration.Current.UmbracoSettings.Templates.EnableTemplateFolders) RenderTemplateFolders(ref tree); RenderTemplates(ref tree); diff --git a/src/Umbraco.Web/umbraco.presentation/umbraco/Trees/loadUsers.cs b/src/Umbraco.Web/umbraco.presentation/umbraco/Trees/loadUsers.cs index 198af77cec..b763d46320 100644 --- a/src/Umbraco.Web/umbraco.presentation/umbraco/Trees/loadUsers.cs +++ b/src/Umbraco.Web/umbraco.presentation/umbraco/Trees/loadUsers.cs @@ -7,6 +7,7 @@ using System.Text; using System.Web; using System.Xml; using System.Configuration; +using Umbraco.Core.Configuration; using umbraco.BasePages; using umbraco.BusinessLogic; using umbraco.businesslogic; @@ -71,7 +72,8 @@ function openUser(id) { bool currUserIsAdmin = currUser.IsAdmin(); foreach (User u in users.OrderBy(x => x.Disabled)) { - if (!UmbracoSettings.HideDisabledUsersInBackoffice || (UmbracoSettings.HideDisabledUsersInBackoffice && !u.Disabled)) + if (!UmbracoConfiguration.Current.UmbracoSettings.Security.HideDisabledUsersInBackoffice + || (UmbracoConfiguration.Current.UmbracoSettings.Security.HideDisabledUsersInBackoffice && !u.Disabled)) { XmlTreeNode xNode = XmlTreeNode.Create(this); diff --git a/src/Umbraco.Web/umbraco.presentation/umbraco/canvas.aspx.cs b/src/Umbraco.Web/umbraco.presentation/umbraco/canvas.aspx.cs index 02ec618973..9d24ac92aa 100644 --- a/src/Umbraco.Web/umbraco.presentation/umbraco/canvas.aspx.cs +++ b/src/Umbraco.Web/umbraco.presentation/umbraco/canvas.aspx.cs @@ -1,4 +1,5 @@ using System; +using Umbraco.Core.Configuration; using umbraco.BasePages; using umbraco.BusinessLogic; using umbraco.businesslogic.Exceptions; @@ -14,7 +15,7 @@ namespace umbraco.presentation protected void Page_Load(object sender, EventArgs e) { - if ((UmbracoSettings.EnableCanvasEditing || !String.IsNullOrEmpty(Request["umbSkinning"]) ) && getUser() != null) + if ((UmbracoConfiguration.Current.UmbracoSettings.Content.EnableCanvasEditing || !String.IsNullOrEmpty(Request["umbSkinning"])) && getUser() != null) { UmbracoContext.Current.LiveEditingContext.Enabled = true; @@ -27,7 +28,7 @@ namespace umbraco.presentation Response.Redirect(redirUrl + (string.IsNullOrEmpty(Request["umbSkinning"]) ? "" : "?umbSkinning=true") + (string.IsNullOrEmpty(Request["umbSkinningConfigurator"]) ? "" : "&umbSkinningConfigurator=true"), true); } - else if (!UmbracoSettings.EnableCanvasEditing) + else if (!UmbracoConfiguration.Current.UmbracoSettings.Content.EnableCanvasEditing) { throw new UserAuthorizationException( "Canvas editing isn't enabled. It can be enabled via the UmbracoSettings.config"); diff --git a/src/Umbraco.Web/umbraco.presentation/umbraco/channels/UmbracoMetaWeblogAPI.cs b/src/Umbraco.Web/umbraco.presentation/umbraco/channels/UmbracoMetaWeblogAPI.cs index b311b240f1..a6a80513fe 100644 --- a/src/Umbraco.Web/umbraco.presentation/umbraco/channels/UmbracoMetaWeblogAPI.cs +++ b/src/Umbraco.Web/umbraco.presentation/umbraco/channels/UmbracoMetaWeblogAPI.cs @@ -6,6 +6,7 @@ using System.Web; using CookComputing.Blogger; using CookComputing.MetaWeblog; using CookComputing.XmlRpc; +using Umbraco.Core.Configuration; using Umbraco.Core.IO; using umbraco.BusinessLogic; using umbraco.cms.businesslogic; @@ -74,7 +75,8 @@ namespace umbraco.presentation.channels if (userChannel.FieldExcerptAlias != null && userChannel.FieldExcerptAlias != "") doc.getProperty(userChannel.FieldExcerptAlias).Value = removeLeftUrl(post.mt_excerpt); - if (UmbracoSettings.TidyEditorContent) + + if (UmbracoConfiguration.Current.UmbracoSettings.Content.TidyEditorContent) doc.getProperty(userChannel.FieldDescriptionAlias).Value = library.Tidy(removeLeftUrl(post.description), false); else doc.getProperty(userChannel.FieldDescriptionAlias).Value = removeLeftUrl(post.description); @@ -385,7 +387,7 @@ namespace umbraco.presentation.channels // Description - if (UmbracoSettings.TidyEditorContent) + if (UmbracoConfiguration.Current.UmbracoSettings.Content.TidyEditorContent) doc.getProperty(userChannel.FieldDescriptionAlias).Value = library.Tidy(removeLeftUrl(post.description), false); else doc.getProperty(userChannel.FieldDescriptionAlias).Value = removeLeftUrl(post.description); @@ -514,7 +516,8 @@ namespace umbraco.presentation.channels private static bool validateUser(string username, string password) { - return Membership.Providers[UmbracoSettings.DefaultBackofficeProvider].ValidateUser(username, password); + + return Membership.Providers[UmbracoConfiguration.Current.UmbracoSettings.Providers.Users.DefaultBackOfficeProvider].ValidateUser(username, password); } [XmlRpcMethod("blogger.getUsersBlogs", diff --git a/src/Umbraco.Web/umbraco.presentation/umbraco/controls/ContentControl.cs b/src/Umbraco.Web/umbraco.presentation/umbraco/controls/ContentControl.cs index 735dd364aa..25905a8a40 100644 --- a/src/Umbraco.Web/umbraco.presentation/umbraco/controls/ContentControl.cs +++ b/src/Umbraco.Web/umbraco.presentation/umbraco/controls/ContentControl.cs @@ -8,6 +8,7 @@ using System.Web; using System.Web.UI; using System.Web.UI.WebControls; using Umbraco.Core; +using Umbraco.Core.Configuration; using Umbraco.Core.IO; using Umbraco.Core.Models; using umbraco.BasePages; @@ -526,7 +527,7 @@ namespace umbraco.controls { string caption = p.PropertyType.Name; if (p.PropertyType.Description != null && p.PropertyType.Description != String.Empty) - switch (UmbracoSettings.PropertyContextHelpOption) + switch (UmbracoConfiguration.Current.UmbracoSettings.Content.PropertyContextHelpOption) { case "icon": caption += " \"""; diff --git a/src/Umbraco.Web/umbraco.presentation/umbraco/controls/ContentTypeControlNew.ascx.cs b/src/Umbraco.Web/umbraco.presentation/umbraco/controls/ContentTypeControlNew.ascx.cs index 9173f9f681..3731ee8190 100644 --- a/src/Umbraco.Web/umbraco.presentation/umbraco/controls/ContentTypeControlNew.ascx.cs +++ b/src/Umbraco.Web/umbraco.presentation/umbraco/controls/ContentTypeControlNew.ascx.cs @@ -14,6 +14,7 @@ using System.Web.UI.HtmlControls; using System.Web.UI.WebControls; using ClientDependency.Core; using Umbraco.Core; +using Umbraco.Core.Configuration; using Umbraco.Core.Logging; using Umbraco.Core.Models; using Umbraco.Web.UI.Controls; @@ -444,7 +445,7 @@ namespace umbraco.controls { // Still shows the selected even if we tell it to hide sprite duplicates so as not to break an existing selection if (_contentType.IconUrl.Equals(iconClass, StringComparison.InvariantCultureIgnoreCase) == false - && UmbracoSettings.IconPickerBehaviour == IconPickerBehaviour.HideSpriteDuplicates + && UmbracoConfiguration.Current.UmbracoSettings.Content.IconPickerBehaviour == IconPickerBehaviour.HideSpriteDuplicates && diskFileNames.Contains(IconClassToIconFileName(iconClass))) continue; @@ -459,7 +460,7 @@ namespace umbraco.controls // Still shows the selected even if we tell it to hide file duplicates so as not to break an existing selection if (_contentType.IconUrl.Equals(file.Name, StringComparison.InvariantCultureIgnoreCase) == false - && UmbracoSettings.IconPickerBehaviour == IconPickerBehaviour.HideFileDuplicates + && UmbracoConfiguration.Current.UmbracoSettings.Content.IconPickerBehaviour == IconPickerBehaviour.HideFileDuplicates && spriteFileNames.Contains(FileNameToIconFileName(file))) continue; diff --git a/src/Umbraco.Web/umbraco.presentation/umbraco/controls/GenericProperties/GenericProperty.ascx.cs b/src/Umbraco.Web/umbraco.presentation/umbraco/controls/GenericProperties/GenericProperty.ascx.cs index e4dc39b3a2..82aee989aa 100644 --- a/src/Umbraco.Web/umbraco.presentation/umbraco/controls/GenericProperties/GenericProperty.ascx.cs +++ b/src/Umbraco.Web/umbraco.presentation/umbraco/controls/GenericProperties/GenericProperty.ascx.cs @@ -8,6 +8,7 @@ using System.Linq; using System.Web.UI.WebControls; using ClientDependency.Core; using Umbraco.Core; +using Umbraco.Core.Configuration; using Umbraco.Core.IO; using umbraco.BasePages; using umbraco.BusinessLogic; @@ -247,7 +248,8 @@ namespace umbraco.controls.GenericProperties private void SetDefaultDocumentTypeProperty() { - var itemToSelect = ddlTypes.Items.Cast().FirstOrDefault(item => item.Text.ToLowerInvariant() == UmbracoSettings.DefaultDocumentTypeProperty.ToLowerInvariant()); + var itemToSelect = ddlTypes.Items.Cast() + .FirstOrDefault(item => item.Text.ToLowerInvariant() == UmbracoConfiguration.Current.UmbracoSettings.Content.DefaultDocumentTypeProperty.ToLowerInvariant()); if (itemToSelect != null) { diff --git a/src/Umbraco.Web/umbraco.presentation/umbraco/create/MediaTypeTasks.cs b/src/Umbraco.Web/umbraco.presentation/umbraco/create/MediaTypeTasks.cs index d962df1c12..f587d21e7a 100644 --- a/src/Umbraco.Web/umbraco.presentation/umbraco/create/MediaTypeTasks.cs +++ b/src/Umbraco.Web/umbraco.presentation/umbraco/create/MediaTypeTasks.cs @@ -1,3 +1,4 @@ +using Umbraco.Core.Configuration; using Umbraco.Web.UI; using Umbraco.Core; using umbraco.BusinessLogic; @@ -11,7 +12,7 @@ namespace umbraco { var mediaType = cms.businesslogic.media.MediaType.MakeNew(User, Alias.Replace("'", "''")); - mediaType.IconUrl = UmbracoSettings.IconPickerBehaviour == IconPickerBehaviour.HideFileDuplicates ? ".sprTreeFolder" : "folder.gif"; + mediaType.IconUrl = UmbracoConfiguration.Current.UmbracoSettings.Content == IconPickerBehaviour.HideFileDuplicates ? ".sprTreeFolder" : "folder.gif"; if (ParentID != -1) { diff --git a/src/Umbraco.Web/umbraco.presentation/umbraco/create/nodetypeTasks.cs b/src/Umbraco.Web/umbraco.presentation/umbraco/create/nodetypeTasks.cs index 82807cc247..346ea9d1b5 100644 --- a/src/Umbraco.Web/umbraco.presentation/umbraco/create/nodetypeTasks.cs +++ b/src/Umbraco.Web/umbraco.presentation/umbraco/create/nodetypeTasks.cs @@ -3,6 +3,7 @@ using System.Configuration; using System.Data; using System.Web.Security; using Umbraco.Core; +using Umbraco.Core.Configuration; using Umbraco.Core.Models; using Umbraco.Web.UI; using umbraco.BusinessLogic; @@ -27,7 +28,7 @@ namespace umbraco contentType.CreatorId = User.Id; contentType.Alias = Alias.Replace("'", "''"); contentType.Name = Alias.Replace("'", "''"); - contentType.Icon = UmbracoSettings.IconPickerBehaviour == IconPickerBehaviour.HideFileDuplicates + contentType.Icon = UmbracoConfiguration.Current.UmbracoSettings.Content.IconPickerBehaviour == IconPickerBehaviour.HideFileDuplicates ? ".sprTreeFolder" : "folder.gif"; diff --git a/src/Umbraco.Web/umbraco.presentation/umbraco/create/script.ascx.cs b/src/Umbraco.Web/umbraco.presentation/umbraco/create/script.ascx.cs index 940d206561..40d0542347 100644 --- a/src/Umbraco.Web/umbraco.presentation/umbraco/create/script.ascx.cs +++ b/src/Umbraco.Web/umbraco.presentation/umbraco/create/script.ascx.cs @@ -2,12 +2,14 @@ using System; using System.Data; using System.Configuration; using System.Collections; +using System.Linq; using System.Web; using System.Web.Security; using System.Web.UI; using System.Web.UI.WebControls; using System.Web.UI.WebControls.WebParts; using System.Web.UI.HtmlControls; +using Umbraco.Core.Configuration; using Umbraco.Web.UI; using umbraco.cms.helpers; using umbraco.BasePages; @@ -73,7 +75,7 @@ namespace umbraco.presentation.umbraco.create this.sbmt.Click += new System.EventHandler(this.sbmt_Click); this.Load += new System.EventHandler(this.Page_Load); - string[] fileTypes = UmbracoSettings.ScriptFileTypes.Split(','); + string[] fileTypes = UmbracoConfiguration.Current.UmbracoSettings.Content.ScriptEditor.ScriptFileTypes.ToArray(); scriptType.Items.Add(new ListItem(ui.Text("folder"), "")); scriptType.Items.FindByText(ui.Text("folder")).Selected = true; diff --git a/src/Umbraco.Web/umbraco.presentation/umbraco/create/userTasks.cs b/src/Umbraco.Web/umbraco.presentation/umbraco/create/userTasks.cs index eef317507b..cffbb0d10d 100644 --- a/src/Umbraco.Web/umbraco.presentation/umbraco/create/userTasks.cs +++ b/src/Umbraco.Web/umbraco.presentation/umbraco/create/userTasks.cs @@ -1,6 +1,7 @@ using System; using System.Data; using System.Web.Security; +using Umbraco.Core.Configuration; using Umbraco.Core.Logging; using Umbraco.Web.UI; using umbraco.BusinessLogic; @@ -36,10 +37,10 @@ namespace umbraco try { // Password is auto-generated. They are they required to change the password by editing the user information. - var u = Membership.Providers[UmbracoSettings.DefaultBackofficeProvider].CreateUser(Alias, + var u = Membership.Providers[UmbracoConfiguration.Current.UmbracoSettings.Providers.Users.DefaultBackOfficeProvider].CreateUser(Alias, Membership.GeneratePassword( - Membership.Providers[UmbracoSettings.DefaultBackofficeProvider].MinRequiredPasswordLength, - Membership.Providers[UmbracoSettings.DefaultBackofficeProvider].MinRequiredNonAlphanumericCharacters), + Membership.Providers[UmbracoConfiguration.Current.UmbracoSettings.Providers.Users.DefaultBackOfficeProvider].MinRequiredPasswordLength, + Membership.Providers[UmbracoConfiguration.Current.UmbracoSettings.Providers.Users.DefaultBackOfficeProvider].MinRequiredNonAlphanumericCharacters), "", "", "", true, null, out status); _returnUrl = string.Format("users/EditUser.aspx?id={0}", u.ProviderUserKey); diff --git a/src/Umbraco.Web/umbraco.presentation/umbraco/dashboard/ChangePassword.ascx.cs b/src/Umbraco.Web/umbraco.presentation/umbraco/dashboard/ChangePassword.ascx.cs index 47960ae2b8..228f0338d2 100644 --- a/src/Umbraco.Web/umbraco.presentation/umbraco/dashboard/ChangePassword.ascx.cs +++ b/src/Umbraco.Web/umbraco.presentation/umbraco/dashboard/ChangePassword.ascx.cs @@ -5,6 +5,7 @@ using System.Web; using System.Web.UI; using System.Web.UI.WebControls; using System.Web.Security; +using Umbraco.Core.Configuration; using umbraco.BusinessLogic; namespace umbraco.presentation.umbraco.dashboard @@ -19,7 +20,7 @@ namespace umbraco.presentation.umbraco.dashboard protected void changePassword_Click(object sender, EventArgs e) { User u = User.GetCurrent(); - MembershipProvider provider = Membership.Providers[UmbracoSettings.DefaultBackofficeProvider]; + MembershipProvider provider = Membership.Providers[UmbracoConfiguration.Current.UmbracoSettings.Providers.Users.DefaultBackOfficeProvider]; MembershipUser user = provider.GetUser(u.LoginName, true); diff --git a/src/Umbraco.Web/umbraco.presentation/umbraco/login.aspx.cs b/src/Umbraco.Web/umbraco.presentation/umbraco/login.aspx.cs index a533868c28..d8f3cc4f4c 100644 --- a/src/Umbraco.Web/umbraco.presentation/umbraco/login.aspx.cs +++ b/src/Umbraco.Web/umbraco.presentation/umbraco/login.aspx.cs @@ -10,6 +10,7 @@ using System.Web.SessionState; using System.Web.UI; using System.Web.UI.WebControls; using System.Web.UI.HtmlControls; +using Umbraco.Core.Configuration; using Umbraco.Core.Logging; using Umbraco.Core.Models.Membership; using System.Web.Security; @@ -69,16 +70,16 @@ namespace umbraco.cms.presentation protected void Button1_Click(object sender, System.EventArgs e) { // Authenticate users by using the provider specified in umbracoSettings.config - if (Membership.Providers[UmbracoSettings.DefaultBackofficeProvider].ValidateUser(lname.Text, passw.Text)) + if (Membership.Providers[UmbracoConfiguration.Current.UmbracoSettings.Providers.Users.DefaultBackOfficeProvider].ValidateUser(lname.Text, passw.Text)) { - if (Membership.Providers[UmbracoSettings.DefaultBackofficeProvider] is ActiveDirectoryMembershipProvider) - ActiveDirectoryMapping(lname.Text, Membership.Providers[UmbracoSettings.DefaultBackofficeProvider].GetUser(lname.Text, false).Email); + if (Membership.Providers[UmbracoConfiguration.Current.UmbracoSettings.Providers.Users.DefaultBackOfficeProvider] is ActiveDirectoryMembershipProvider) + ActiveDirectoryMapping(lname.Text, Membership.Providers[UmbracoConfiguration.Current.UmbracoSettings.Providers.Users.DefaultBackOfficeProvider].GetUser(lname.Text, false).Email); BusinessLogic.User u = new User(lname.Text); doLogin(u); // Check if the user should be redirected to live editing - if (UmbracoSettings.EnableCanvasEditing && u.DefaultToLiveEditing) + if (UmbracoConfiguration.Current.UmbracoSettings.Content.EnableCanvasEditing && u.DefaultToLiveEditing) { int startNode = u.StartNodeId; // If the startnode is -1 (access to all content), we'll redirect to the top root node diff --git a/src/Umbraco.Web/umbraco.presentation/umbraco/users/EditUser.aspx.cs b/src/Umbraco.Web/umbraco.presentation/umbraco/users/EditUser.aspx.cs index 1569a2d110..782771318e 100644 --- a/src/Umbraco.Web/umbraco.presentation/umbraco/users/EditUser.aspx.cs +++ b/src/Umbraco.Web/umbraco.presentation/umbraco/users/EditUser.aspx.cs @@ -7,6 +7,7 @@ using System.Web.UI; using System.Web.UI.HtmlControls; using System.Web.UI.WebControls; using System.Xml; +using Umbraco.Core.Configuration; using Umbraco.Core.Logging; using umbraco.BasePages; using umbraco.BusinessLogic; @@ -79,7 +80,7 @@ namespace umbraco.cms.presentation.user } // check if canvas editing is enabled - DefaultToLiveEditing.Visible = UmbracoSettings.EnableCanvasEditing; + DefaultToLiveEditing.Visible = UmbracoConfiguration.Current.UmbracoSettings.Content.EnableCanvasEditing; // Populate usertype list foreach (UserType ut in UserType.getAll) @@ -156,7 +157,7 @@ namespace umbraco.cms.presentation.user //Generel umrbaco access Pane ppAccess = new Pane(); - if (UmbracoSettings.EnableCanvasEditing) + if (UmbracoConfiguration.Current.UmbracoSettings.Content.EnableCanvasEditing) { ppAccess.addProperty(ui.Text("user", "defaultToLiveEditing", base.getUser()), DefaultToLiveEditing); } @@ -311,7 +312,7 @@ namespace umbraco.cms.presentation.user if (!IsPostBack) { - MembershipUser user = Membership.Providers[UmbracoSettings.DefaultBackofficeProvider].GetUser(u.LoginName, true); + MembershipUser user = Membership.Providers[UmbracoConfiguration.Current.UmbracoSettings.Providers.Users.DefaultBackOfficeProvider].GetUser(u.LoginName, true); uname.Text = u.Name; lname.Text = (user == null) ? u.LoginName : user.UserName; email.Text = (user == null) ? u.Email : user.Email; @@ -376,7 +377,7 @@ namespace umbraco.cms.presentation.user { try { - MembershipUser user = Membership.Providers[UmbracoSettings.DefaultBackofficeProvider].GetUser(u.LoginName, true); + MembershipUser user = Membership.Providers[UmbracoConfiguration.Current.UmbracoSettings.Providers.Users.DefaultBackOfficeProvider].GetUser(u.LoginName, true); string tempPassword = ((controls.passwordChanger)passw.Controls[0]).Password; @@ -388,14 +389,14 @@ namespace umbraco.cms.presentation.user } // Is it using the default membership provider - if (Membership.Providers[UmbracoSettings.DefaultBackofficeProvider] is UsersMembershipProvider) + if (Membership.Providers[UmbracoConfiguration.Current.UmbracoSettings.Providers.Users.DefaultBackOfficeProvider] is UsersMembershipProvider) { // Save user in membership provider UsersMembershipUser umbracoUser = user as UsersMembershipUser; umbracoUser.FullName = uname.Text.Trim(); umbracoUser.Language = userLanguage.SelectedValue; umbracoUser.UserType = UserType.GetUserType(int.Parse(userType.SelectedValue)); - Membership.Providers[UmbracoSettings.DefaultBackofficeProvider].UpdateUser(umbracoUser); + Membership.Providers[UmbracoConfiguration.Current.UmbracoSettings.Providers.Users.DefaultBackOfficeProvider].UpdateUser(umbracoUser); // Save user details u.Email = email.Text.Trim(); @@ -406,7 +407,7 @@ namespace umbraco.cms.presentation.user u.Name = uname.Text.Trim(); u.Language = userLanguage.SelectedValue; u.UserType = UserType.GetUserType(int.Parse(userType.SelectedValue)); - if (!(Membership.Providers[UmbracoSettings.DefaultBackofficeProvider] is ActiveDirectoryMembershipProvider)) Membership.Providers[UmbracoSettings.DefaultBackofficeProvider].UpdateUser(user); + if (!(Membership.Providers[UmbracoConfiguration.Current.UmbracoSettings.Providers.Users.DefaultBackOfficeProvider] is ActiveDirectoryMembershipProvider)) Membership.Providers[UmbracoConfiguration.Current.UmbracoSettings.Providers.Users.DefaultBackOfficeProvider].UpdateUser(user); } diff --git a/src/Umbraco.Web/umbraco.presentation/umbraco/webservices/MediaUploader.ashx.cs b/src/Umbraco.Web/umbraco.presentation/umbraco/webservices/MediaUploader.ashx.cs index e5902b34eb..322bc0b0ed 100644 --- a/src/Umbraco.Web/umbraco.presentation/umbraco/webservices/MediaUploader.ashx.cs +++ b/src/Umbraco.Web/umbraco.presentation/umbraco/webservices/MediaUploader.ashx.cs @@ -9,6 +9,7 @@ using System.Web.Security; using System.Web.UI; using System.Xml; using System.Xml.Serialization; +using Umbraco.Core.Configuration; using Umbraco.Core.Logging; using umbraco.BasePages; using umbraco.BusinessLogic; @@ -222,7 +223,7 @@ namespace umbraco.presentation.umbraco.webservices if (!string.IsNullOrEmpty(username) && !string.IsNullOrEmpty(password)) { - var mp = Membership.Providers[UmbracoSettings.DefaultBackofficeProvider]; + var mp = Membership.Providers[UmbracoConfiguration.Current.UmbracoSettings.Providers.Users.DefaultBackOfficeProvider]; if (mp != null && mp.ValidateUser(username, password)) { var user = new User(username); diff --git a/src/Umbraco.Web/umbraco.presentation/umbraco/webservices/codeEditorSave.asmx.cs b/src/Umbraco.Web/umbraco.presentation/umbraco/webservices/codeEditorSave.asmx.cs index 002d7ccb6a..16011577bd 100644 --- a/src/Umbraco.Web/umbraco.presentation/umbraco/webservices/codeEditorSave.asmx.cs +++ b/src/Umbraco.Web/umbraco.presentation/umbraco/webservices/codeEditorSave.asmx.cs @@ -380,7 +380,7 @@ namespace umbraco.presentation.webservices SystemDirectories.Scripts); // validate extension IOHelper.ValidateFileExtension(IOHelper.MapPath(SystemDirectories.Scripts + "/" + filename), - UmbracoSettings.ScriptFileTypes.Split(',').ToList()); + UmbracoConfiguration.Current.UmbracoSettings.Content.ScriptEditor.ScriptFileTypes.ToList()); var val = contents; diff --git a/src/Umbraco.Web/umbraco.presentation/viewstateMoverModule.cs b/src/Umbraco.Web/umbraco.presentation/viewstateMoverModule.cs index 9be8514d03..50cbc34fbb 100644 --- a/src/Umbraco.Web/umbraco.presentation/viewstateMoverModule.cs +++ b/src/Umbraco.Web/umbraco.presentation/viewstateMoverModule.cs @@ -6,6 +6,7 @@ using System.Web; using System.Text; using System.Text.RegularExpressions; using System.Collections; +using Umbraco.Core.Configuration; #endregion @@ -26,7 +27,7 @@ namespace umbraco.presentation void IHttpModule.Init(HttpApplication context) { - if (UmbracoSettings.UseViewstateMoverModule) + if (UmbracoConfiguration.Current.UmbracoSettings.ViewstateMoverModule.Enable) { context.BeginRequest += new EventHandler(context_BeginRequest); } diff --git a/src/umbraco.MacroEngines/RazorDynamicNode/DynamicNode.cs b/src/umbraco.MacroEngines/RazorDynamicNode/DynamicNode.cs index d804f97899..b6f0c96d7d 100644 --- a/src/umbraco.MacroEngines/RazorDynamicNode/DynamicNode.cs +++ b/src/umbraco.MacroEngines/RazorDynamicNode/DynamicNode.cs @@ -6,6 +6,7 @@ using System.Linq; using System.Threading; using System.Web; using Umbraco.Core; +using Umbraco.Core.Configuration; using Umbraco.Core.Dynamics; using Umbraco.Core.Logging; using umbraco.interfaces; @@ -483,8 +484,19 @@ namespace umbraco.MacroEngines //contextAlias is the node which the property data was returned from //Guid dataType = ContentType.GetDataType(data.ContextAlias, data.Alias); var dataType = GetDataType(propResult.ContextAlias, propResult.Alias); - - var staticMapping = UmbracoSettings.RazorDataTypeModelStaticMapping + + //now we need to map to the old object until we can clean all this nonsense up + var configMapping = UmbracoConfiguration.Current.UmbracoSettings.Scripting.Razor.DataTypeModelStaticMappings + .Select(x => new RazorDataTypeModelStaticMappingItem() + { + DataTypeGuid = x.DataTypeGuid, + NodeTypeAlias = x.NodeTypeAlias, + PropertyTypeAlias = x.PropertyTypeAlias, + Raw = string.Empty, + TypeName = x.MappingName + }).ToList(); + + var staticMapping = configMapping .FirstOrDefault(mapping => mapping.Applies(dataType, propResult.ContextAlias, propResult.Alias)); if (staticMapping != null) @@ -800,8 +812,8 @@ namespace umbraco.MacroEngines //check that the document element is not one of the disallowed elements //allows RTE to still return as html if it's valid xhtml string documentElement = e.Name.LocalName; - if (UmbracoSettings.NotDynamicXmlDocumentElements.Any(tag => - string.Equals(tag, documentElement, StringComparison.CurrentCultureIgnoreCase)) == false) + if (UmbracoConfiguration.Current.UmbracoSettings.Scripting.Razor.NotDynamicXmlDocumentElements.Any(tag => + string.Equals(tag.Element, documentElement, StringComparison.CurrentCultureIgnoreCase)) == false) { result = new DynamicXml(e); return true; diff --git a/src/umbraco.businesslogic/UmbracoSettings.cs b/src/umbraco.businesslogic/UmbracoSettings.cs index a875815d20..f1480efd85 100644 --- a/src/umbraco.businesslogic/UmbracoSettings.cs +++ b/src/umbraco.businesslogic/UmbracoSettings.cs @@ -18,6 +18,7 @@ namespace umbraco [Obsolete("Use UmbracoConfiguration.Current.UmbracoSettings instead, it offers all settings in strongly typed formats. This class will be removed in future versions.")] public class UmbracoSettings { + [Obsolete("This hasn't been used since 4.1!")] public const string TEMP_FRIENDLY_XML_CHILD_CONTAINER_NODENAME = ""; // "children"; /// diff --git a/src/umbraco.cms/businesslogic/Packager/Installer.cs b/src/umbraco.cms/businesslogic/Packager/Installer.cs index ef6c9c4452..867474f9be 100644 --- a/src/umbraco.cms/businesslogic/Packager/Installer.cs +++ b/src/umbraco.cms/businesslogic/Packager/Installer.cs @@ -8,6 +8,7 @@ using System.Runtime.CompilerServices; using System.Linq; using ICSharpCode.SharpZipLib.Zip; using Umbraco.Core; +using Umbraco.Core.IO; using Umbraco.Core.Logging; using umbraco.cms.businesslogic.web; using umbraco.cms.businesslogic.propertytype; @@ -16,7 +17,6 @@ using umbraco.DataLayer; using System.Diagnostics; using umbraco.cms.businesslogic.macro; using umbraco.cms.businesslogic.template; -using umbraco.IO; namespace umbraco.cms.businesslogic.packager { @@ -35,6 +35,8 @@ namespace umbraco.cms.businesslogic.packager /// public class Installer { + private const string PackageServer = "packages.umbraco.org"; + private string _name; private string _version; private string _url; @@ -918,7 +920,7 @@ namespace umbraco.cms.businesslogic.packager var wc = new System.Net.WebClient(); wc.DownloadFile( - "http://" + UmbracoSettings.PackageServer + "/fetch?package=" + Package.ToString(), + "http://" + PackageServer + "/fetch?package=" + Package.ToString(), IOHelper.MapPath(SystemDirectories.Packages + "/" + Package.ToString() + ".umb")); return "packages\\" + Package.ToString() + ".umb"; diff --git a/src/umbraco.cms/businesslogic/workflow/Notification.cs b/src/umbraco.cms/businesslogic/workflow/Notification.cs index fb98742d31..594d2eb9de 100644 --- a/src/umbraco.cms/businesslogic/workflow/Notification.cs +++ b/src/umbraco.cms/businesslogic/workflow/Notification.cs @@ -4,6 +4,7 @@ using System.Net.Mail; using System.Runtime.CompilerServices; using System.Text; using System.Web; +using Umbraco.Core.Configuration; using Umbraco.Core.Logging; using umbraco.BusinessLogic; using umbraco.cms.businesslogic.property; @@ -157,11 +158,11 @@ namespace umbraco.cms.businesslogic.workflow }; // create the mail message - var mail = new MailMessage(UmbracoSettings.NotificationEmailSender, mailingUser.Email); + var mail = new MailMessage(UmbracoConfiguration.Current.UmbracoSettings.Content.Notifications.EmailAddress, mailingUser.Email); // populate the message mail.Subject = ui.Text("notifications", "mailSubject", subjectVars, mailingUser); - if (UmbracoSettings.NotificationDisableHtmlEmail) + if (UmbracoConfiguration.Current.UmbracoSettings.Content.Notifications.DisableHtmlEmail) { mail.IsBodyHtml = false; mail.Body = ui.Text("notifications", "mailBody", bodyVars, mailingUser); diff --git a/src/umbraco.cms/helpers/xhtml.cs b/src/umbraco.cms/helpers/xhtml.cs index 1e195ad7e7..2c6d7bbf4a 100644 --- a/src/umbraco.cms/helpers/xhtml.cs +++ b/src/umbraco.cms/helpers/xhtml.cs @@ -3,6 +3,7 @@ using System.Collections; using System.Text; using System.Text.RegularExpressions; using System.IO; +using Umbraco.Core.Configuration; namespace umbraco.cms.helpers @@ -39,7 +40,7 @@ namespace umbraco.cms.helpers tidy.Options.TidyMark = false; // To avoid entity encoding - tidy.Options.CharEncoding = (TidyNet.CharEncoding)Enum.Parse(typeof(TidyNet.CharEncoding), UmbracoSettings.TidyCharEncoding); + tidy.Options.CharEncoding = (TidyNet.CharEncoding)Enum.Parse(typeof(TidyNet.CharEncoding), UmbracoConfiguration.Current.UmbracoSettings.Content.TidyCharEncoding); /* Declare the parameters that is needed */ diff --git a/src/umbraco.controls/CodeArea.cs b/src/umbraco.controls/CodeArea.cs index 63a1cef836..ed751bdc39 100644 --- a/src/umbraco.controls/CodeArea.cs +++ b/src/umbraco.controls/CodeArea.cs @@ -11,6 +11,7 @@ using System.Web.UI.HtmlControls; using ClientDependency.Core; using System.Linq; using ClientDependency.Core.Controls; +using Umbraco.Core.Configuration; using umbraco.IO; namespace umbraco.uicontrols @@ -57,7 +58,7 @@ namespace umbraco.uicontrols { get { - return UmbracoSettings.ScriptDisableEditor == false; + return UmbracoConfiguration.Current.UmbracoSettings.Content.ScriptEditor.DisableScriptEditor == false; } } diff --git a/src/umbraco.editorControls/tinyMCE3/TinyMCE.cs b/src/umbraco.editorControls/tinyMCE3/TinyMCE.cs index 4244043f03..a3d6e1c958 100644 --- a/src/umbraco.editorControls/tinyMCE3/TinyMCE.cs +++ b/src/umbraco.editorControls/tinyMCE3/TinyMCE.cs @@ -3,6 +3,7 @@ using System.Collections; using System.Text.RegularExpressions; using System.Web; using System.Web.UI; +using Umbraco.Core.Configuration; using Umbraco.Core.Logging; using umbraco.BasePages; using umbraco.BusinessLogic; @@ -328,7 +329,7 @@ namespace umbraco.editorControls.tinyMCE3 parsedString = replaceMacroTags(parsedString).Trim(); // tidy html - refactored, see #30534 - if (UmbracoSettings.TidyEditorContent) + if (UmbracoConfiguration.Current.UmbracoSettings.Content.TidyEditorContent) { // always wrap in a
- using

was a bad idea parsedString = "

" + parsedString + "
"; diff --git a/src/umbraco.editorControls/tinymce/tinyMCEImageHelper.cs b/src/umbraco.editorControls/tinymce/tinyMCEImageHelper.cs index 0bb52b4dd4..e1015cbd3b 100644 --- a/src/umbraco.editorControls/tinymce/tinyMCEImageHelper.cs +++ b/src/umbraco.editorControls/tinymce/tinyMCEImageHelper.cs @@ -3,6 +3,7 @@ using System.Collections; using System.Linq; using System.Text.RegularExpressions; using System.Web; +using Umbraco.Core.Configuration; using Umbraco.Core.IO; using Umbraco.Core.Logging; using umbraco.cms.businesslogic.Files; @@ -13,7 +14,7 @@ namespace umbraco.editorControls.tinymce { public static string cleanImages(string html) { - var allowedAttributes = UmbracoSettings.ImageAllowedAttributes.ToLower().Split(',').ToList(); + var allowedAttributes = UmbracoConfiguration.Current.UmbracoSettings.Content.Imaging.AllowedAttributes.Select(x => x.ToLower()).ToList(); //Always add src as it's essential to output any image at all if (allowedAttributes.Contains("src") == false) diff --git a/src/umbraco.editorControls/uploadfield/uploadField.cs b/src/umbraco.editorControls/uploadfield/uploadField.cs index 8aea59e7f3..472a094977 100644 --- a/src/umbraco.editorControls/uploadfield/uploadField.cs +++ b/src/umbraco.editorControls/uploadfield/uploadField.cs @@ -6,6 +6,7 @@ using System.Web; using System.Web.UI; using System.Web.UI.HtmlControls; using System.Web.UI.WebControls; +using Umbraco.Core.Configuration; using Umbraco.Core.IO; using umbraco.interfaces; using Umbraco.Core; @@ -88,8 +89,8 @@ namespace umbraco.editorControls //now check the file type var extension = Path.GetExtension(postedFile.FileName).TrimStart("."); - - return UmbracoSettings.DisallowedUploadFiles.Any(x => x.InvariantEquals(extension)) == false; + + return UmbracoConfiguration.Current.UmbracoSettings.Content.DisallowedUploadFiles.Any(x => x.InvariantEquals(extension)) == false; } public string Text