diff --git a/umbraco/businesslogic/Utils/TypeResolver.cs b/umbraco/businesslogic/Utils/TypeResolver.cs
index 7b1dcedeb4..55b7dc5930 100644
--- a/umbraco/businesslogic/Utils/TypeResolver.cs
+++ b/umbraco/businesslogic/Utils/TypeResolver.cs
@@ -5,15 +5,18 @@ using System.Collections.Generic;
using System.Reflection;
using System.Web;
+using System.Security;
+using System.Security.Permissions;
+
namespace umbraco.BusinessLogic.Utils
{
///
/// Represents the Umbraco Typeresolver class.
/// The typeresolver is a collection of utillities for finding and determining types and classes with reflection.
///
- [Serializable]
- public class TypeResolver : MarshalByRefObject
- {
+ [Serializable]
+ public class TypeResolver : MarshalByRefObject
+ {
///
/// Gets a collection of assignables of type T from a collection of a specific file type from a specified path.
///
@@ -21,15 +24,15 @@ namespace umbraco.BusinessLogic.Utils
/// The path.
/// The file pattern.
///
- public static string[] GetAssignablesFromType(string path, string filePattern)
- {
- FileInfo[] fis = Array.ConvertAll(
- Directory.GetFiles(path, filePattern),
- delegate(string s) { return new FileInfo(s); });
- string[] absoluteFiles = Array.ConvertAll(
- fis, delegate(FileInfo fi) { return fi.FullName; });
- return GetAssignablesFromType(absoluteFiles);
- }
+ public static string[] GetAssignablesFromType(string path, string filePattern)
+ {
+ FileInfo[] fis = Array.ConvertAll(
+ Directory.GetFiles(path, filePattern),
+ delegate(string s) { return new FileInfo(s); });
+ string[] absoluteFiles = Array.ConvertAll(
+ fis, delegate(FileInfo fi) { return fi.FullName; });
+ return GetAssignablesFromType(absoluteFiles);
+ }
///
/// Gets a collection of assignables of type T from a collection of files
@@ -37,12 +40,13 @@ namespace umbraco.BusinessLogic.Utils
///
/// The files.
///
- public static string[] GetAssignablesFromType(string[] files)
- {
+ public static string[] GetAssignablesFromType(string[] files)
+ {
AppDomain sandbox = AppDomain.CurrentDomain;
- if ((!GlobalSettings.UseMediumTrust) && (GlobalSettings.ApplicationTrustLevel > AspNetHostingPermissionLevel.Medium)) {
+ if ((!GlobalSettings.UseMediumTrust) && (GlobalSettings.ApplicationTrustLevel > AspNetHostingPermissionLevel.Medium))
+ {
AppDomainSetup domainSetup = new AppDomainSetup();
domainSetup.ApplicationBase = AppDomain.CurrentDomain.SetupInformation.ApplicationBase;
domainSetup.ApplicationName = "Umbraco_Sandbox_" + Guid.NewGuid();
@@ -55,7 +59,9 @@ namespace umbraco.BusinessLogic.Utils
domainSetup.PrivateBinPathProbe = AppDomain.CurrentDomain.SetupInformation.PrivateBinPathProbe;
domainSetup.ShadowCopyFiles = "false";
- sandbox = AppDomain.CreateDomain("Sandbox", AppDomain.CurrentDomain.Evidence, domainSetup);
+ PermissionSet trustedLoadFromRemoteSourceGrantSet = new PermissionSet(PermissionState.Unrestricted);
+ sandbox = AppDomain.CreateDomain("Sandbox", AppDomain.CurrentDomain.Evidence, domainSetup, trustedLoadFromRemoteSourceGrantSet);
+// sandbox = AppDomain.CreateDomain("Sandbox", AppDomain.CurrentDomain.Evidence, domainSetup);
}
try
@@ -78,8 +84,8 @@ namespace umbraco.BusinessLogic.Utils
}
}
- return new string[0];
- }
+ return new string[0];
+ }
///
/// Returns of a collection of type names from a collection of assembky files.
@@ -87,29 +93,31 @@ namespace umbraco.BusinessLogic.Utils
/// The assign type.
/// The assembly files.
///
- public string[] GetTypes(Type assignTypeFrom, string[] assemblyFiles)
- {
- List result = new List();
- foreach(string fileName in assemblyFiles)
- {
- if(!File.Exists(fileName))
- continue;
- try
- {
- Assembly assembly = Assembly.LoadFile(fileName);
+ public string[] GetTypes(Type assignTypeFrom, string[] assemblyFiles)
+ {
+ List result = new List();
+ foreach (string fileName in assemblyFiles)
+ {
+ if (!File.Exists(fileName))
+ continue;
+ try
+ {
+ Assembly assembly = Assembly.LoadFile(fileName);
- if (assembly != null) {
- foreach (Type t in assembly.GetTypes()) {
+ if (assembly != null)
+ {
+ foreach (Type t in assembly.GetTypes())
+ {
if (!t.IsInterface && assignTypeFrom.IsAssignableFrom(t))
result.Add(t.AssemblyQualifiedName);
}
}
- }
- catch(Exception e)
- {
- Debug.WriteLine(string.Format("Error loading assembly: {0}\n{1}", fileName, e));
- }
- }
+ }
+ catch (Exception e)
+ {
+ Debug.WriteLine(string.Format("Error loading assembly: {0}\n{1}", fileName, e));
+ }
+ }
/*
try{
@@ -135,7 +143,7 @@ namespace umbraco.BusinessLogic.Utils
}
*/
- return result.ToArray();
- }
- }
+ return result.ToArray();
+ }
+ }
}
diff --git a/umbraco/presentation/umbraco/js/language.aspx.cs b/umbraco/presentation/umbraco/js/language.aspx.cs
index 706b48c710..234b16181d 100644
--- a/umbraco/presentation/umbraco/js/language.aspx.cs
+++ b/umbraco/presentation/umbraco/js/language.aspx.cs
@@ -36,7 +36,8 @@ namespace umbraco.js
continue;
string _tempKey = string.Format("{0}_{1}", n1.Value, n2.Value);
- string tmpStr = key.FirstChild.Value.Replace("\\", "\\\\").Replace("'", "\\'").Replace("\r\n", "\\r\\n");
+ // we need to remove linie breaks as they can't break js
+ string tmpStr = key.FirstChild.Value.Replace("\\", "\\\\").Replace("'", "\\'").Replace("\r", "").Replace("\n", "");
Response.Write(string.Format("uiKeys['{0}'] = '{1}';\n", _tempKey, tmpStr));
}
}