Merge branch 'refs/heads/dev-v7.6' into temp-template-editor
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
Umbraco CMS
|
||||
===========
|
||||
The friendliest, most flexible and fastest growing ASP.NET CMS used by more than 350,000 websites worldwide: [https://umbraco.com](https://umbraco.com)
|
||||
The friendliest, most flexible and fastest growing ASP.NET CMS used by more than 390,000 websites worldwide: [https://umbraco.com](https://umbraco.com)
|
||||
|
||||
[](https://vimeo.com/172382998/)
|
||||
|
||||
|
||||
@@ -33,6 +33,12 @@ namespace Umbraco.Core
|
||||
private string _connectionString;
|
||||
private string _providerName;
|
||||
private DatabaseSchemaResult _result;
|
||||
private DateTime? _connectionLastChecked = null;
|
||||
|
||||
/// <summary>
|
||||
/// The number of minutes to throttle the checks to CanConnect
|
||||
/// </summary>
|
||||
private const int ConnectionCheckMinutes = 1;
|
||||
|
||||
[Obsolete("Use the constructor specifying all dependencies instead")]
|
||||
public DatabaseContext(IDatabaseFactory factory)
|
||||
@@ -148,13 +154,28 @@ namespace Umbraco.Core
|
||||
{
|
||||
get
|
||||
{
|
||||
if (IsDatabaseConfigured == false) return false;
|
||||
var canConnect = DbConnectionExtensions.IsConnectionAvailable(ConnectionString, DatabaseProvider);
|
||||
LogHelper.Info<DatabaseContext>("CanConnect = " + canConnect);
|
||||
return canConnect;
|
||||
if (IsDatabaseConfigured == false)
|
||||
return false;
|
||||
|
||||
//Don't check again if the timeout period hasn't elapsed
|
||||
//this ensures we don't keep checking the connection too many times in a row like during startup.
|
||||
//Do check if the _connectionLastChecked is null which means we're just initializing or it could
|
||||
//not connect last time it was checked.
|
||||
if ((_connectionLastChecked.HasValue && (DateTime.Now - _connectionLastChecked.Value).TotalMinutes > ConnectionCheckMinutes)
|
||||
|| _connectionLastChecked.HasValue == false)
|
||||
{
|
||||
var canConnect = DbConnectionExtensions.IsConnectionAvailable(ConnectionString, DatabaseProvider);
|
||||
LogHelper.Info<DatabaseContext>("CanConnect = " + canConnect);
|
||||
|
||||
_connectionLastChecked = canConnect == false ? null : (DateTime?) DateTime.Now;
|
||||
return canConnect;
|
||||
}
|
||||
|
||||
return _connectionLastChecked.HasValue;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Gets the configured umbraco db connection string.
|
||||
/// </summary>
|
||||
|
||||
@@ -4,9 +4,11 @@ using System.Configuration;
|
||||
using System.Data;
|
||||
using System.Data.Common;
|
||||
using System.Data.SqlClient;
|
||||
using System.Data.SqlServerCe;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using MySql.Data.MySqlClient;
|
||||
using Umbraco.Core.Logging;
|
||||
|
||||
namespace Umbraco.Core.Persistence
|
||||
@@ -69,6 +71,38 @@ namespace Umbraco.Core.Persistence
|
||||
}
|
||||
}
|
||||
|
||||
public static string GetConnStringExSecurityInfo(this IDbConnection connection)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (connection is SqlConnection)
|
||||
{
|
||||
var builder = new SqlConnectionStringBuilder(connection.ConnectionString);
|
||||
return string.Format("DataSource: {0}, InitialCatalog: {1}", builder.DataSource, builder.InitialCatalog);
|
||||
}
|
||||
|
||||
if (connection is SqlCeConnection)
|
||||
{
|
||||
var builder = new SqlCeConnectionStringBuilder(connection.ConnectionString);
|
||||
return string.Format("DataSource: {0}", builder.DataSource);
|
||||
}
|
||||
|
||||
if (connection is MySqlConnection)
|
||||
{
|
||||
var builder = new MySqlConnectionStringBuilder(connection.ConnectionString);
|
||||
return string.Format("Server: {0}, Database: {1}", builder.Server, builder.Database);
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
LogHelper.WarnWithException(typeof(DbConnectionExtensions),
|
||||
"Could not resolve connection string parameters", ex);
|
||||
return "(Could not resolve)";
|
||||
}
|
||||
|
||||
throw new ArgumentException(string.Format("The connection type {0} is not supported", connection.GetType()));
|
||||
}
|
||||
|
||||
public static bool IsAvailable(this IDbConnection connection)
|
||||
{
|
||||
try
|
||||
@@ -79,7 +113,8 @@ namespace Umbraco.Core.Persistence
|
||||
catch (DbException exc)
|
||||
{
|
||||
// Don't swallow this error, the exception is super handy for knowing "why" its not available
|
||||
LogHelper.WarnWithException<IDbConnection>("Configured database is reporting as not being available!", exc);
|
||||
LogHelper.WarnWithException(typeof(DbConnectionExtensions),
|
||||
"Configured database is reporting as not being available! {0}", exc, connection.GetConnStringExSecurityInfo);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -852,7 +852,8 @@ order by umbracoNode.level, umbracoNode.parentID, umbracoNode.sortOrder";
|
||||
if (withCache)
|
||||
{
|
||||
var cached = RuntimeCache.GetCacheItem<IContent>(GetCacheIdKey<IContent>(dto.NodeId));
|
||||
if (cached != null && cached.Published)
|
||||
//only use this cached version if the dto returned is also the publish version, they must match
|
||||
if (cached != null && cached.Published && dto.Published)
|
||||
{
|
||||
content[i] = cached;
|
||||
continue;
|
||||
|
||||
@@ -172,6 +172,55 @@ angular.module("umbraco.directives")
|
||||
|
||||
});
|
||||
|
||||
// pin toolbar to top of screen if we have focus and it scrolls off the screen
|
||||
var pinToolbar = function () {
|
||||
|
||||
var _toolbar = $(editor.editorContainer).find(".mce-toolbar");
|
||||
var toolbarHeight = _toolbar.height();
|
||||
|
||||
var _tinyMce = $(editor.editorContainer);
|
||||
var tinyMceRect = _tinyMce[0].getBoundingClientRect();
|
||||
var tinyMceTop = tinyMceRect.top;
|
||||
var tinyMceBottom = tinyMceRect.bottom;
|
||||
var tinyMceWidth = tinyMceRect.width;
|
||||
|
||||
var _tinyMceEditArea = _tinyMce.find(".mce-edit-area");
|
||||
|
||||
// set padding in top of mce so the content does not "jump" up
|
||||
_tinyMceEditArea.css("padding-top", toolbarHeight);
|
||||
|
||||
if (tinyMceTop < 160 && ((160 + toolbarHeight) < tinyMceBottom)) {
|
||||
_toolbar
|
||||
.css("visibility", "visible")
|
||||
.css("position", "fixed")
|
||||
.css("top", "160px")
|
||||
.css("margin-top", "0")
|
||||
.css("width", tinyMceWidth);
|
||||
} else {
|
||||
_toolbar
|
||||
.css("visibility", "visible")
|
||||
.css("position", "absolute")
|
||||
.css("top", "auto")
|
||||
.css("margin-top", "0")
|
||||
.css("width", tinyMceWidth);
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
// unpin toolbar to top of screen
|
||||
var unpinToolbar = function() {
|
||||
|
||||
var _toolbar = $(editor.editorContainer).find(".mce-toolbar");
|
||||
var _tinyMce = $(editor.editorContainer);
|
||||
var _tinyMceEditArea = _tinyMce.find(".mce-edit-area");
|
||||
|
||||
// reset padding in top of mce so the content does not "jump" up
|
||||
_tinyMceEditArea.css("padding-top", "0");
|
||||
|
||||
_toolbar.css("position", "static");
|
||||
|
||||
};
|
||||
|
||||
//when we leave the editor (maybe)
|
||||
editor.on('blur', function (e) {
|
||||
editor.save();
|
||||
@@ -185,6 +234,9 @@ angular.module("umbraco.directives")
|
||||
scope.onBlur();
|
||||
}
|
||||
|
||||
unpinToolbar();
|
||||
$('.umb-panel-body').off('scroll', pinToolbar);
|
||||
|
||||
});
|
||||
});
|
||||
|
||||
@@ -196,6 +248,9 @@ angular.module("umbraco.directives")
|
||||
scope.onFocus();
|
||||
}
|
||||
|
||||
pinToolbar();
|
||||
$('.umb-panel-body').on('scroll', pinToolbar);
|
||||
|
||||
});
|
||||
});
|
||||
|
||||
@@ -207,6 +262,9 @@ angular.module("umbraco.directives")
|
||||
scope.onClick();
|
||||
}
|
||||
|
||||
pinToolbar();
|
||||
$('.umb-panel-body').on('scroll', pinToolbar);
|
||||
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
@@ -66,7 +66,7 @@
|
||||
if(cfg != null)
|
||||
foreach (JProperty property in cfg.Properties())
|
||||
{
|
||||
var propertyValue = TemplateUtilities.CleanForXss(property.Value.ToString());
|
||||
var propertyValue = HttpUtility.HtmlAttributeEncode(property.Value.ToString());
|
||||
attrs.Add(property.Name + "=\"" + propertyValue + "\"");
|
||||
}
|
||||
|
||||
@@ -76,7 +76,7 @@
|
||||
var cssVals = new List<string>();
|
||||
foreach (JProperty property in style.Properties())
|
||||
{
|
||||
var propertyValue = TemplateUtilities.CleanForXss(property.Value.ToString());
|
||||
var propertyValue = property.Value.ToString();
|
||||
if (string.IsNullOrWhiteSpace(propertyValue) == false)
|
||||
{
|
||||
cssVals.Add(property.Name + ":" + propertyValue + ";");
|
||||
@@ -84,7 +84,7 @@
|
||||
}
|
||||
|
||||
if (cssVals.Any())
|
||||
attrs.Add("style='" + string.Join(" ", cssVals) + "'");
|
||||
attrs.Add("style='" + HttpUtility.HtmlAttributeEncode(string.Join(" ", cssVals)) + "'");
|
||||
}
|
||||
|
||||
return new MvcHtmlString(string.Join(" ", attrs));
|
||||
|
||||
@@ -66,7 +66,7 @@
|
||||
if(cfg != null)
|
||||
foreach (JProperty property in cfg.Properties())
|
||||
{
|
||||
var propertyValue = TemplateUtilities.CleanForXss(property.Value.ToString());
|
||||
var propertyValue = HttpUtility.HtmlAttributeEncode(property.Value.ToString());
|
||||
attrs.Add(property.Name + "=\"" + propertyValue + "\"");
|
||||
}
|
||||
|
||||
@@ -76,7 +76,7 @@
|
||||
var cssVals = new List<string>();
|
||||
foreach (JProperty property in style.Properties())
|
||||
{
|
||||
var propertyValue = TemplateUtilities.CleanForXss(property.Value.ToString());
|
||||
var propertyValue = property.Value.ToString();
|
||||
if (string.IsNullOrWhiteSpace(propertyValue) == false)
|
||||
{
|
||||
cssVals.Add(property.Name + ":" + propertyValue + ";");
|
||||
@@ -84,7 +84,7 @@
|
||||
}
|
||||
|
||||
if (cssVals.Any())
|
||||
attrs.Add("style=\"" + string.Join(" ", cssVals) + "\"");
|
||||
attrs.Add("style=\"" + HttpUtility.HtmlAttributeEncode(string.Join(" ", cssVals)) + "\"");
|
||||
}
|
||||
|
||||
return new MvcHtmlString(string.Join(" ", attrs));
|
||||
|
||||
@@ -62,7 +62,7 @@
|
||||
if(cfg != null)
|
||||
foreach (JProperty property in cfg.Properties())
|
||||
{
|
||||
var propertyValue = TemplateUtilities.CleanForXss(property.Value.ToString());
|
||||
var propertyValue = HttpUtility.HtmlAttributeEncode(property.Value.ToString());
|
||||
attrs.Add(property.Name + "=\"" + propertyValue + "\"");
|
||||
}
|
||||
|
||||
@@ -72,7 +72,7 @@
|
||||
var cssVals = new List<string>();
|
||||
foreach (JProperty property in style.Properties())
|
||||
{
|
||||
var propertyValue = TemplateUtilities.CleanForXss(property.Value.ToString());
|
||||
var propertyValue = property.Value.ToString();
|
||||
if (string.IsNullOrWhiteSpace(propertyValue) == false)
|
||||
{
|
||||
cssVals.Add(property.Name + ":" + propertyValue + ";");
|
||||
@@ -80,7 +80,7 @@
|
||||
}
|
||||
|
||||
if (cssVals.Any())
|
||||
attrs.Add("style='" + string.Join(" ", cssVals) + "'");
|
||||
attrs.Add("style='" + HttpUtility.HtmlAttributeEncode(string.Join(" ", cssVals)) + "'");
|
||||
}
|
||||
|
||||
return new MvcHtmlString(string.Join(" ", attrs));
|
||||
|
||||
@@ -66,17 +66,17 @@
|
||||
if(cfg != null)
|
||||
foreach (JProperty property in cfg.Properties())
|
||||
{
|
||||
var propertyValue = TemplateUtilities.CleanForXss(property.Value.ToString());
|
||||
var propertyValue = HttpUtility.HtmlAttributeEncode(property.Value.ToString());
|
||||
attrs.Add(property.Name + "=\"" + propertyValue + "\"");
|
||||
}
|
||||
|
||||
|
||||
JObject style = contentItem.styles;
|
||||
|
||||
if (style != null) {
|
||||
var cssVals = new List<string>();
|
||||
foreach (JProperty property in style.Properties())
|
||||
{
|
||||
var propertyValue = TemplateUtilities.CleanForXss(property.Value.ToString());
|
||||
var propertyValue = property.Value.ToString();
|
||||
if (string.IsNullOrWhiteSpace(propertyValue) == false)
|
||||
{
|
||||
cssVals.Add(property.Name + ":" + propertyValue + ";");
|
||||
@@ -84,7 +84,7 @@
|
||||
}
|
||||
|
||||
if (cssVals.Any())
|
||||
attrs.Add("style=\"" + string.Join(" ", cssVals) + "\"");
|
||||
attrs.Add("style=\"" + HttpUtility.HtmlAttributeEncode(string.Join(" ", cssVals)) + "\"");
|
||||
}
|
||||
|
||||
return new MvcHtmlString(string.Join(" ", attrs));
|
||||
|
||||
@@ -4,9 +4,9 @@
|
||||
@if (Model.editor.config.markup != null)
|
||||
{
|
||||
string markup = Model.editor.config.markup.ToString();
|
||||
var UmbracoHelper = new UmbracoHelper(UmbracoContext.Current);
|
||||
var umbracoHelper = new UmbracoHelper(UmbracoContext.Current);
|
||||
|
||||
markup = markup.Replace("#value#", UmbracoHelper.ReplaceLineBreaksForHtml(TemplateUtilities.CleanForXss(Model.value.ToString())));
|
||||
markup = markup.Replace("#value#", umbracoHelper.ReplaceLineBreaksForHtml(HttpUtility.HtmlEncode(Model.value.ToString())));
|
||||
markup = markup.Replace("#style#", Model.editor.config.style.ToString());
|
||||
|
||||
<text>
|
||||
|
||||
@@ -119,7 +119,7 @@
|
||||
<add verb="*" path="DependencyHandler.axd" type="ClientDependency.Core.CompositeFiles.CompositeDependencyHandler, ClientDependency.Core " />
|
||||
</httpHandlers>
|
||||
|
||||
<compilation defaultLanguage="c#" debug="false" batch="false" targetFramework="4.5">
|
||||
<compilation defaultLanguage="c#" debug="false" batch="false" targetFramework="4.5" numRecompilesBeforeAppRestart="50">
|
||||
<assemblies>
|
||||
<remove assembly="System.Web.Http" />
|
||||
<remove assembly="System.Net.Http" />
|
||||
|
||||
@@ -11,11 +11,11 @@ namespace Umbraco.Web.Controllers
|
||||
public class UmbLoginController : SurfaceController
|
||||
{
|
||||
[HttpPost]
|
||||
public ActionResult HandleLogin([Bind(Prefix="loginModel")]LoginModel model)
|
||||
public ActionResult HandleLogin([Bind(Prefix = "loginModel")]LoginModel model)
|
||||
{
|
||||
if (ModelState.IsValid == false)
|
||||
{
|
||||
return CurrentUmbracoPage();
|
||||
return CurrentUmbracoPage();
|
||||
}
|
||||
|
||||
if (Members.Login(model.Username, model.Password) == false)
|
||||
@@ -30,11 +30,20 @@ namespace Umbraco.Web.Controllers
|
||||
//if there is a specified path to redirect to then use it
|
||||
if (model.RedirectUrl.IsNullOrWhiteSpace() == false)
|
||||
{
|
||||
return Redirect(model.RedirectUrl);
|
||||
// validate the redirect url
|
||||
if (Url.IsLocalUrl(model.RedirectUrl))
|
||||
{
|
||||
return Redirect(model.RedirectUrl);
|
||||
}
|
||||
else
|
||||
{
|
||||
// if it's not a local url we'll redirect to the root of the current site
|
||||
return Redirect(base.CurrentPage.Site().Url);
|
||||
}
|
||||
}
|
||||
|
||||
//redirect to current page by default
|
||||
|
||||
|
||||
return RedirectToCurrentUmbracoPage();
|
||||
//return RedirectToCurrentUmbracoUrl();
|
||||
}
|
||||
|
||||
@@ -1,8 +1,10 @@
|
||||
using System.Text;
|
||||
using System;
|
||||
using System.Text;
|
||||
using System.Xml;
|
||||
using System.Collections.Generic;
|
||||
using System.Net;
|
||||
using System.Net.Http;
|
||||
using System.Web;
|
||||
using Newtonsoft.Json;
|
||||
using Umbraco.Core.Media;
|
||||
|
||||
@@ -27,10 +29,13 @@ namespace Umbraco.Web.Media.EmbedProviders
|
||||
|
||||
public virtual string BuildFullUrl(string url, int maxWidth, int maxHeight)
|
||||
{
|
||||
if (Uri.IsWellFormedUriString(url, UriKind.RelativeOrAbsolute) == false)
|
||||
throw new ArgumentException("Not a valid Url");
|
||||
|
||||
var fullUrl = new StringBuilder();
|
||||
|
||||
fullUrl.Append(APIEndpoint);
|
||||
fullUrl.Append("?url=" + url);
|
||||
fullUrl.Append("?url=" + HttpUtility.UrlEncode(url));
|
||||
|
||||
foreach (var p in RequestParams)
|
||||
fullUrl.Append(string.Format("&{0}={1}", p.Key, p.Value));
|
||||
|
||||
Reference in New Issue
Block a user