diff --git a/src/Umbraco.Core/Configuration/UmbracoSettings.cs b/src/Umbraco.Core/Configuration/UmbracoSettings.cs
index 1304b284de..15321191f3 100644
--- a/src/Umbraco.Core/Configuration/UmbracoSettings.cs
+++ b/src/Umbraco.Core/Configuration/UmbracoSettings.cs
@@ -1140,6 +1140,71 @@ namespace Umbraco.Core.Configuration
}
}
+ ///
+ /// Enables MVC, and at the same time disable webform masterpage templates.
+ /// This ensure views are automaticly created instead of masterpages.
+ /// Views are display in the tree instead of masterpages and a MVC template editor
+ /// is used instead of the masterpages editor
+ ///
+ /// true if umbraco defaults to using MVC views for templating, otherwise false.
+
+ private static bool? _enableMvc;
+ public static bool EnableMvcSupport
+ {
+ get
+ {
+ if (_enableMvc == null)
+ {
+ try
+ {
+ bool enableMvc = false;
+ string value = GetKey("/settings/templates/enableMvcSupport");
+ if (value != null)
+ if (bool.TryParse(value, out enableMvc))
+ _enableMvc = enableMvc;
+ }
+ catch (Exception ex)
+ {
+ Trace.WriteLine("Could not load /settings/templates/enableMvcSupport from umbracosettings.config:\r\n {0}",
+ ex.Message);
+
+ _enableMvc = false;
+ }
+ }
+ return _enableMvc == true;
+ }
+ }
+
+ private static string[] _mvcViewExtensions;
+ public static string[] MvcViewExtensions
+ {
+ get
+ {
+ string[] defaultValue = "cshtml".Split(',');
+
+ if (_mvcViewExtensions == null)
+ {
+ try
+ {
+ string value = GetKey("/settings/templates/mvcViewExtensions");
+ if (!string.IsNullOrEmpty(value))
+ _mvcViewExtensions = value.Split(',');
+ else
+ _mvcViewExtensions = defaultValue;
+ }
+ catch (Exception ex)
+ {
+ Trace.WriteLine("Could not load /settings/templates/mvcViewExtensions from umbracosettings.config:\r\n {0}",
+ ex.Message);
+
+ _mvcViewExtensions = defaultValue;
+ }
+ }
+
+ return _mvcViewExtensions;
+ }
+ }
+
///
/// Configuration regarding webservices
///
diff --git a/src/Umbraco.Core/IO/IOHelper.cs b/src/Umbraco.Core/IO/IOHelper.cs
index 8a3a0688d5..f718483d0f 100644
--- a/src/Umbraco.Core/IO/IOHelper.cs
+++ b/src/Umbraco.Core/IO/IOHelper.cs
@@ -165,6 +165,23 @@ namespace Umbraco.Core.IO
return true;
}
+ public static bool ValidateEditPath(string filePath, string[] validDirs)
+ {
+ foreach (var dir in validDirs)
+ {
+ var validDir = dir;
+ if (!filePath.StartsWith(MapPath(SystemDirectories.Root)))
+ filePath = MapPath(filePath);
+ if (!validDir.StartsWith(MapPath(SystemDirectories.Root)))
+ validDir = MapPath(validDir);
+
+ if (filePath.StartsWith(validDir))
+ return true;
+ }
+
+ throw new FileSecurityException(String.Format("The filepath '{0}' is not within an allowed directory for this type of files", filePath.Replace(MapPath(SystemDirectories.Root), "")));
+ }
+
public static bool ValidateFileExtension(string filePath, List validFileExtensions)
{
if (!filePath.StartsWith(MapPath(SystemDirectories.Root)))