Missing UmbracoSettings change in umbraco.core
IOHelper in umbraco.core Both related to mvc views in template tree
This commit is contained in:
@@ -1140,6 +1140,71 @@ namespace Umbraco.Core.Configuration
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 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
|
||||
/// </summary>
|
||||
/// <value><c>true</c> if umbraco defaults to using MVC views for templating, otherwise <c>false</c>.</value>
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Configuration regarding webservices
|
||||
/// </summary>
|
||||
|
||||
@@ -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<string> validFileExtensions)
|
||||
{
|
||||
if (!filePath.StartsWith(MapPath(SystemDirectories.Root)))
|
||||
|
||||
Reference in New Issue
Block a user